@ssv/ngx.ux 2.0.2 → 2.1.0-dev.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +296 -297
  3. package/config.d.ts +7 -7
  4. package/esm2020/config.mjs +7 -7
  5. package/esm2020/index.mjs +5 -5
  6. package/esm2020/internal/internal.model.mjs +2 -2
  7. package/esm2020/module.mjs +65 -65
  8. package/esm2020/platform/window.mjs +30 -30
  9. package/esm2020/ssv-ngx.ux.mjs +4 -4
  10. package/esm2020/version.mjs +2 -2
  11. package/esm2020/viewport/index.mjs +9 -9
  12. package/esm2020/viewport/viewport-data/index.mjs +4 -4
  13. package/esm2020/viewport/viewport-data/viewport-data-matcher.mjs +108 -108
  14. package/esm2020/viewport/viewport-data/viewport-data.pipe.mjs +43 -43
  15. package/esm2020/viewport/viewport-data/viewport-data.service.mjs +37 -37
  16. package/esm2020/viewport/viewport-data/viewport-data.utils.mjs +100 -100
  17. package/esm2020/viewport/viewport-matcher-var.directive.mjs +63 -63
  18. package/esm2020/viewport/viewport-matcher.directive.mjs +131 -131
  19. package/esm2020/viewport/viewport-server-size.service.mjs +43 -43
  20. package/esm2020/viewport/viewport.const.mjs +17 -18
  21. package/esm2020/viewport/viewport.model.mjs +30 -31
  22. package/esm2020/viewport/viewport.service.mjs +66 -67
  23. package/esm2020/viewport/viewport.util.mjs +117 -117
  24. package/fesm2015/ssv-ngx.ux.mjs +787 -790
  25. package/fesm2015/ssv-ngx.ux.mjs.map +1 -1
  26. package/fesm2020/ssv-ngx.ux.mjs +781 -784
  27. package/fesm2020/ssv-ngx.ux.mjs.map +1 -1
  28. package/index.d.ts +4 -4
  29. package/internal/internal.model.d.ts +9 -9
  30. package/module.d.ts +19 -19
  31. package/package.json +1 -1
  32. package/platform/window.d.ts +13 -13
  33. package/version.d.ts +1 -1
  34. package/viewport/index.d.ts +8 -8
  35. package/viewport/viewport-data/index.d.ts +3 -3
  36. package/viewport/viewport-data/viewport-data-matcher.d.ts +32 -32
  37. package/viewport/viewport-data/viewport-data.pipe.d.ts +18 -18
  38. package/viewport/viewport-data/viewport-data.service.d.ts +20 -20
  39. package/viewport/viewport-data/viewport-data.utils.d.ts +21 -21
  40. package/viewport/viewport-matcher-var.directive.d.ts +25 -25
  41. package/viewport/viewport-matcher.directive.d.ts +33 -33
  42. package/viewport/viewport-server-size.service.d.ts +12 -12
  43. package/viewport/viewport.const.d.ts +5 -5
  44. package/viewport/viewport.model.d.ts +56 -57
  45. package/viewport/viewport.service.d.ts +37 -37
  46. package/viewport/viewport.util.d.ts +25 -25
  47. package/CHANGELOG.md +0 -149
  48. package/bundles/ssv-ngx.ux.umd.js +0 -1219
  49. package/bundles/ssv-ngx.ux.umd.js.map +0 -1
  50. package/bundles/ssv-ngx.ux.umd.min.js +0 -16
  51. package/bundles/ssv-ngx.ux.umd.min.js.map +0 -1
  52. package/esm2015/config.js +0 -7
  53. package/esm2015/index.js +0 -5
  54. package/esm2015/internal/internal.model.js +0 -2
  55. package/esm2015/module.js +0 -50
  56. package/esm2015/platform/window.js +0 -28
  57. package/esm2015/ssv-ngx.ux.js +0 -7
  58. package/esm2015/version.js +0 -2
  59. package/esm2015/viewport/index.js +0 -9
  60. package/esm2015/viewport/viewport-data/index.js +0 -4
  61. package/esm2015/viewport/viewport-data/viewport-data-matcher.js +0 -108
  62. package/esm2015/viewport/viewport-data/viewport-data.pipe.js +0 -43
  63. package/esm2015/viewport/viewport-data/viewport-data.service.js +0 -38
  64. package/esm2015/viewport/viewport-data/viewport-data.utils.js +0 -100
  65. package/esm2015/viewport/viewport-matcher-var.directive.js +0 -64
  66. package/esm2015/viewport/viewport-matcher.directive.js +0 -134
  67. package/esm2015/viewport/viewport-server-size.service.js +0 -38
  68. package/esm2015/viewport/viewport.const.js +0 -18
  69. package/esm2015/viewport/viewport.model.js +0 -31
  70. package/esm2015/viewport/viewport.service.js +0 -69
  71. package/esm2015/viewport/viewport.util.js +0 -117
  72. package/fesm2015/ssv-ngx.ux.js +0 -807
  73. package/fesm2015/ssv-ngx.ux.js.map +0 -1
  74. package/ssv-ngx.ux.d.ts +0 -6
  75. package/ssv-ngx.ux.metadata.json +0 -1
@@ -1,20 +1,20 @@
1
- import { Observable } from "rxjs";
2
- import { UxOptions } from "../../config";
3
- import { ViewportSizeTypeInfo } from "../viewport.model";
4
- import { ViewportService } from "../viewport.service";
5
- import { ViewportDataConfig, ViewportDataMatchStrategy } from "./viewport-data-matcher";
6
- import { ViewportDataRule } from "./viewport-data.utils";
7
- import * as i0 from "@angular/core";
8
- export declare class ViewportDataService {
9
- private viewport;
10
- private config;
11
- constructor(viewport: ViewportService, config: UxOptions);
12
- /** Get data for match. */
13
- get<T>(dataConfig: ViewportDataConfig<T>, strategy?: ViewportDataMatchStrategy, sizeType?: ViewportSizeTypeInfo): T | undefined;
14
- /** Get data for match as observable. */
15
- get$<T>(dataConfig: ViewportDataConfig<T>, strategy?: ViewportDataMatchStrategy, throttle?: boolean): Observable<T | undefined>;
16
- /** Generate rules based on strategies for data. */
17
- generateRules<T>(dataConfig: ViewportDataConfig<T>, strategy?: ViewportDataMatchStrategy): ViewportDataRule<T>[];
18
- static ɵfac: i0.ɵɵFactoryDeclaration<ViewportDataService, never>;
19
- static ɵprov: i0.ɵɵInjectableDeclaration<ViewportDataService>;
20
- }
1
+ import { Observable } from "rxjs";
2
+ import { UxOptions } from "../../config";
3
+ import { ViewportSizeTypeInfo } from "../viewport.model";
4
+ import { ViewportService } from "../viewport.service";
5
+ import { ViewportDataConfig, ViewportDataMatchStrategy } from "./viewport-data-matcher";
6
+ import { ViewportDataRule } from "./viewport-data.utils";
7
+ import * as i0 from "@angular/core";
8
+ export declare class ViewportDataService {
9
+ private viewport;
10
+ private config;
11
+ constructor(viewport: ViewportService, config: UxOptions);
12
+ /** Get data for match. */
13
+ get<T>(dataConfig: ViewportDataConfig<T>, strategy?: ViewportDataMatchStrategy, sizeType?: ViewportSizeTypeInfo): T | undefined;
14
+ /** Get data for match as observable. */
15
+ get$<T>(dataConfig: ViewportDataConfig<T>, strategy?: ViewportDataMatchStrategy, throttle?: boolean): Observable<T | undefined>;
16
+ /** Generate rules based on strategies for data. */
17
+ generateRules<T>(dataConfig: ViewportDataConfig<T>, strategy?: ViewportDataMatchStrategy): ViewportDataRule<T>[];
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<ViewportDataService, never>;
19
+ static ɵprov: i0.ɵɵInjectableDeclaration<ViewportDataService>;
20
+ }
@@ -1,21 +1,21 @@
1
- import { Dictionary } from "../../internal/internal.model";
2
- import { ViewportSizeTypeInfo } from "../viewport.model";
3
- import { ViewportDataConfig, ViewportDataMatchStrategy } from "./viewport-data-matcher";
4
- export interface ViewportDataRule<T> {
5
- min?: number;
6
- max?: number;
7
- value: T;
8
- }
9
- /**
10
- * Utility function to generate rules based on strategies.
11
- *
12
- * @param dataConfig Data config to generate rules based on.
13
- * @param strategy Strategy to use when building rules.
14
- * @param sizeTypes Available size types ordered by index type. (Can be obtained from `ViewportService`)
15
- * @param sizeTypeMap Available size type map. (Can be obtained from `ViewportService`)
16
- * @returns Returns a collection of rules (ordered).
17
- */
18
- export declare function generateViewportRulesRangeFromDataMatcher<T>(dataConfig: ViewportDataConfig<T>, strategy: ViewportDataMatchStrategy, sizeTypes: ViewportSizeTypeInfo[], sizeTypeMap: Dictionary<ViewportSizeTypeInfo>): ViewportDataRule<T>[];
19
- export interface ViewportRuleRangeBuilder<T = unknown> {
20
- (rule: ViewportDataRule<T>, dataSize: ViewportSizeTypeInfo, nextDataSize: ViewportSizeTypeInfo | undefined, prevDataSize: ViewportSizeTypeInfo | undefined, prevSize: ViewportSizeTypeInfo | undefined, prevRule: ViewportDataRule<T> | undefined, sizeTypes: ViewportSizeTypeInfo[]): void;
21
- }
1
+ import { Dictionary } from "../../internal/internal.model";
2
+ import { ViewportSizeTypeInfo } from "../viewport.model";
3
+ import { ViewportDataConfig, ViewportDataMatchStrategy } from "./viewport-data-matcher";
4
+ export interface ViewportDataRule<T> {
5
+ min?: number;
6
+ max?: number;
7
+ value: T;
8
+ }
9
+ /**
10
+ * Utility function to generate rules based on strategies.
11
+ *
12
+ * @param dataConfig Data config to generate rules based on.
13
+ * @param strategy Strategy to use when building rules.
14
+ * @param sizeTypes Available size types ordered by index type. (Can be obtained from `ViewportService`)
15
+ * @param sizeTypeMap Available size type map. (Can be obtained from `ViewportService`)
16
+ * @returns Returns a collection of rules (ordered).
17
+ */
18
+ export declare function generateViewportRulesRangeFromDataMatcher<T>(dataConfig: ViewportDataConfig<T>, strategy: ViewportDataMatchStrategy, sizeTypes: ViewportSizeTypeInfo[], sizeTypeMap: Dictionary<ViewportSizeTypeInfo>): ViewportDataRule<T>[];
19
+ export interface ViewportRuleRangeBuilder<T = unknown> {
20
+ (rule: ViewportDataRule<T>, dataSize: ViewportSizeTypeInfo, nextDataSize: ViewportSizeTypeInfo | undefined, prevDataSize: ViewportSizeTypeInfo | undefined, prevSize: ViewportSizeTypeInfo | undefined, prevRule: ViewportDataRule<T> | undefined, sizeTypes: ViewportSizeTypeInfo[]): void;
21
+ }
@@ -1,25 +1,25 @@
1
- import { OnInit, OnDestroy, TemplateRef, ViewContainerRef } from "@angular/core";
2
- import { ViewportService } from "./viewport.service";
3
- import { ViewportSizeMatcherExpression } from "./viewport.model";
4
- import * as i0 from "@angular/core";
5
- export declare class SsvViewportMatcherVarContext {
6
- $implicit: boolean;
7
- constructor($implicit?: boolean);
8
- }
9
- export declare class SsvViewportMatcherVarDirective implements OnInit, OnDestroy {
10
- private viewport;
11
- private viewContainer;
12
- private templateRef;
13
- private _matchConditions;
14
- private _context;
15
- private readonly _destroy$;
16
- private readonly _update$;
17
- private _viewRef;
18
- set condition(value: string | string[] | ViewportSizeMatcherExpression);
19
- constructor(viewport: ViewportService, viewContainer: ViewContainerRef, templateRef: TemplateRef<SsvViewportMatcherVarContext>);
20
- ngOnInit(): void;
21
- ngOnDestroy(): void;
22
- private updateView;
23
- static ɵfac: i0.ɵɵFactoryDeclaration<SsvViewportMatcherVarDirective, never>;
24
- static ɵdir: i0.ɵɵDirectiveDeclaration<SsvViewportMatcherVarDirective, "[ssvViewportMatcherVar]", never, { "condition": "ssvViewportMatcherVarWhen"; }, {}, never, never, false, never>;
25
- }
1
+ import { OnInit, OnDestroy, TemplateRef, ViewContainerRef } from "@angular/core";
2
+ import { ViewportService } from "./viewport.service";
3
+ import { ViewportSizeMatcherExpression } from "./viewport.model";
4
+ import * as i0 from "@angular/core";
5
+ export declare class SsvViewportMatcherVarContext {
6
+ $implicit: boolean;
7
+ constructor($implicit?: boolean);
8
+ }
9
+ export declare class SsvViewportMatcherVarDirective implements OnInit, OnDestroy {
10
+ private viewport;
11
+ private viewContainer;
12
+ private templateRef;
13
+ private _matchConditions;
14
+ private _context;
15
+ private readonly _destroy$;
16
+ private readonly _update$;
17
+ private _viewRef;
18
+ set condition(value: string | string[] | ViewportSizeMatcherExpression);
19
+ constructor(viewport: ViewportService, viewContainer: ViewContainerRef, templateRef: TemplateRef<SsvViewportMatcherVarContext>);
20
+ ngOnInit(): void;
21
+ ngOnDestroy(): void;
22
+ private updateView;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<SsvViewportMatcherVarDirective, never>;
24
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SsvViewportMatcherVarDirective, "[ssvViewportMatcherVar]", never, { "condition": "ssvViewportMatcherVarWhen"; }, {}, never, never, false, never>;
25
+ }
@@ -1,33 +1,33 @@
1
- import { OnInit, OnDestroy, Renderer2, ViewContainerRef, TemplateRef, ChangeDetectorRef } from "@angular/core";
2
- import { ViewportService } from "./viewport.service";
3
- import { ViewportSizeTypeInfo, ViewportMatchConditions, ViewportSizeMatcherExpression } from "./viewport.model";
4
- import * as i0 from "@angular/core";
5
- export declare class SsvViewportMatcherContext implements ViewportMatchConditions {
6
- sizeType: string | string[] | null;
7
- sizeTypeExclude: string | string[] | null;
8
- expression?: ViewportSizeMatcherExpression;
9
- }
10
- export declare class SsvViewportMatcherDirective implements OnInit, OnDestroy {
11
- private viewport;
12
- private renderer;
13
- private viewContainer;
14
- private cdr;
15
- sizeInfo: ViewportSizeTypeInfo | undefined;
16
- private _context;
17
- private _thenTemplateRef;
18
- private _elseTemplateRef;
19
- private _thenViewRef;
20
- private _elseViewRef;
21
- private sizeType$$;
22
- private cssClass$$;
23
- private readonly _update$;
24
- set ssvViewportMatcher(value: string | string[] | ViewportSizeMatcherExpression);
25
- set ssvViewportMatcherExclude(value: string | string[]);
26
- set ssvViewportMatcherElse(templateRef: TemplateRef<SsvViewportMatcherContext> | null);
27
- constructor(viewport: ViewportService, renderer: Renderer2, viewContainer: ViewContainerRef, cdr: ChangeDetectorRef, templateRef: TemplateRef<SsvViewportMatcherContext>);
28
- ngOnInit(): void;
29
- ngOnDestroy(): void;
30
- private _updateView;
31
- static ɵfac: i0.ɵɵFactoryDeclaration<SsvViewportMatcherDirective, never>;
32
- static ɵdir: i0.ɵɵDirectiveDeclaration<SsvViewportMatcherDirective, "[ssvViewportMatcher]", ["ssvViewportMatcher"], { "ssvViewportMatcher": "ssvViewportMatcher"; "ssvViewportMatcherExclude": "ssvViewportMatcherExclude"; "ssvViewportMatcherElse": "ssvViewportMatcherElse"; }, {}, never, never, false, never>;
33
- }
1
+ import { OnInit, OnDestroy, Renderer2, ViewContainerRef, TemplateRef, ChangeDetectorRef } from "@angular/core";
2
+ import { ViewportService } from "./viewport.service";
3
+ import { ViewportSizeTypeInfo, ViewportMatchConditions, ViewportSizeMatcherExpression } from "./viewport.model";
4
+ import * as i0 from "@angular/core";
5
+ export declare class SsvViewportMatcherContext implements ViewportMatchConditions {
6
+ sizeType: string | string[] | null;
7
+ sizeTypeExclude: string | string[] | null;
8
+ expression?: ViewportSizeMatcherExpression;
9
+ }
10
+ export declare class SsvViewportMatcherDirective implements OnInit, OnDestroy {
11
+ private viewport;
12
+ private renderer;
13
+ private viewContainer;
14
+ private cdr;
15
+ sizeInfo: ViewportSizeTypeInfo | undefined;
16
+ private _context;
17
+ private _thenTemplateRef;
18
+ private _elseTemplateRef;
19
+ private _thenViewRef;
20
+ private _elseViewRef;
21
+ private sizeType$$;
22
+ private cssClass$$;
23
+ private readonly _update$;
24
+ set ssvViewportMatcher(value: string | string[] | ViewportSizeMatcherExpression);
25
+ set ssvViewportMatcherExclude(value: string | string[]);
26
+ set ssvViewportMatcherElse(templateRef: TemplateRef<SsvViewportMatcherContext> | null);
27
+ constructor(viewport: ViewportService, renderer: Renderer2, viewContainer: ViewContainerRef, cdr: ChangeDetectorRef, templateRef: TemplateRef<SsvViewportMatcherContext>);
28
+ ngOnInit(): void;
29
+ ngOnDestroy(): void;
30
+ private _updateView;
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<SsvViewportMatcherDirective, never>;
32
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SsvViewportMatcherDirective, "[ssvViewportMatcher]", ["ssvViewportMatcher"], { "ssvViewportMatcher": "ssvViewportMatcher"; "ssvViewportMatcherExclude": "ssvViewportMatcherExclude"; "ssvViewportMatcherElse": "ssvViewportMatcherElse"; }, {}, never, never, false, never>;
33
+ }
@@ -1,12 +1,12 @@
1
- import { InjectionToken } from "@angular/core";
2
- import { DeviceType, ViewportSize } from "./viewport.model";
3
- import { UxOptions } from "../config";
4
- import * as i0 from "@angular/core";
5
- export declare const UX_VIEWPORT_SSR_DEVICE: InjectionToken<UxOptions>;
6
- export declare class ViewportServerSizeService {
7
- private deviceType;
8
- constructor(deviceType: DeviceType);
9
- get(): ViewportSize;
10
- static ɵfac: i0.ɵɵFactoryDeclaration<ViewportServerSizeService, [{ optional: true; }]>;
11
- static ɵprov: i0.ɵɵInjectableDeclaration<ViewportServerSizeService>;
12
- }
1
+ import { InjectionToken } from "@angular/core";
2
+ import { DeviceType, ViewportSize } from "./viewport.model";
3
+ import { UxOptions } from "../config";
4
+ import * as i0 from "@angular/core";
5
+ export declare const UX_VIEWPORT_SSR_DEVICE: InjectionToken<UxOptions>;
6
+ export declare class ViewportServerSizeService {
7
+ private deviceType;
8
+ constructor(deviceType: DeviceType);
9
+ get(): ViewportSize;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<ViewportServerSizeService, [{ optional: true; }]>;
11
+ static ɵprov: i0.ɵɵInjectableDeclaration<ViewportServerSizeService>;
12
+ }
@@ -1,5 +1,5 @@
1
- import { Dictionary } from "../internal/internal.model";
2
- import { UxViewportOptions } from "./viewport.model";
3
- /** Default viewport breakpoints. */
4
- export declare const UX_VIEWPORT_DEFAULT_BREAKPOINTS: Dictionary<number>;
5
- export declare const UX_VIEWPORT_DEFAULT_CONFIG: UxViewportOptions;
1
+ import { Dictionary } from "../internal/internal.model";
2
+ import { UxViewportOptions } from "./viewport.model";
3
+ /** Default viewport breakpoints. */
4
+ export declare const UX_VIEWPORT_DEFAULT_BREAKPOINTS: Dictionary<number>;
5
+ export declare const UX_VIEWPORT_DEFAULT_CONFIG: UxViewportOptions;
@@ -1,57 +1,56 @@
1
- import { Dictionary } from "../internal/internal.model";
2
- import { ViewportDataMatchStrategy } from "./viewport-data";
3
- /**
4
- * The indices of each breakpoint provided based on the `UX_VIEWPORT_DEFAULT_BREAKPOINTS`.
5
- * @see UX_VIEWPORT_DEFAULT_BREAKPOINTS
6
- */
7
- export declare enum ViewportSizeType {
8
- xsmall = 0,
9
- small = 1,
10
- medium = 2,
11
- large = 3,
12
- fhd = 4,
13
- qhd = 6,
14
- uhd4k = 7,
15
- uhd8k = 8
16
- }
17
- export declare enum ComparisonOperation {
18
- equals = "=",
19
- notEquals = "<>",
20
- lessThan = "<",
21
- lessOrEqualThan = "<=",
22
- greaterThan = ">",
23
- greaterOrEqualThan = ">="
24
- }
25
- export declare enum DeviceType {
26
- desktop = "desktop",
27
- mobile = "mobile",
28
- tablet = "tablet"
29
- }
30
- export interface UxViewportOptions {
31
- /** Polling speed on resizing (in milliseconds). e.g. the higher the number the longer it takes to recalculate. */
32
- resizePollingSpeed: number;
33
- /** Breakpoints to use. Key needs to match the size type and the value the width threshold.
34
- * e.g. given width '1000' and `medium` is set to '992' => `large`.
35
- */
36
- breakpoints: Dictionary<number>;
37
- /** Default data match strategy to use. */
38
- defaultDataMatchStrategy: ViewportDataMatchStrategy;
39
- }
40
- export interface ViewportSize {
41
- width: number;
42
- height: number;
43
- }
44
- export interface ViewportSizeTypeInfo {
45
- type: number;
46
- name: string;
47
- widthThreshold: number;
48
- }
49
- export interface ViewportMatchConditions {
50
- sizeType?: string | string[] | null;
51
- sizeTypeExclude?: string | string[] | null;
52
- expression?: ViewportSizeMatcherExpression;
53
- }
54
- export interface ViewportSizeMatcherExpression {
55
- size: string;
56
- operation: ComparisonOperation;
57
- }
1
+ import { Dictionary } from "../internal/internal.model";
2
+ import { ViewportDataMatchStrategy } from "./viewport-data";
3
+ /**
4
+ * The indices of each breakpoint provided based on the `UX_VIEWPORT_DEFAULT_BREAKPOINTS`.
5
+ * @see UX_VIEWPORT_DEFAULT_BREAKPOINTS
6
+ */
7
+ export declare enum ViewportSizeType {
8
+ xsmall = 0,
9
+ small = 1,
10
+ medium = 2,
11
+ large = 3,
12
+ xlarge = 4,
13
+ xxlarge = 5,
14
+ xxlarge1 = 6
15
+ }
16
+ export declare enum ComparisonOperation {
17
+ equals = "=",
18
+ notEquals = "<>",
19
+ lessThan = "<",
20
+ lessOrEqualThan = "<=",
21
+ greaterThan = ">",
22
+ greaterOrEqualThan = ">="
23
+ }
24
+ export declare enum DeviceType {
25
+ desktop = "desktop",
26
+ mobile = "mobile",
27
+ tablet = "tablet"
28
+ }
29
+ export interface UxViewportOptions {
30
+ /** Polling speed on resizing (in milliseconds). e.g. the higher the number the longer it takes to recalculate. */
31
+ resizePollingSpeed: number;
32
+ /** Breakpoints to use. Key needs to match the size type and the value the width threshold.
33
+ * e.g. given width '1000' and `medium` is set to '992' => `large`.
34
+ */
35
+ breakpoints: Dictionary<number>;
36
+ /** Default data match strategy to use. */
37
+ defaultDataMatchStrategy: ViewportDataMatchStrategy;
38
+ }
39
+ export interface ViewportSize {
40
+ width: number;
41
+ height: number;
42
+ }
43
+ export interface ViewportSizeTypeInfo {
44
+ type: number;
45
+ name: string;
46
+ widthThreshold: number;
47
+ }
48
+ export interface ViewportMatchConditions {
49
+ sizeType?: string | string[] | null;
50
+ sizeTypeExclude?: string | string[] | null;
51
+ expression?: ViewportSizeMatcherExpression;
52
+ }
53
+ export interface ViewportSizeMatcherExpression {
54
+ size: string;
55
+ operation: ComparisonOperation;
56
+ }
@@ -1,37 +1,37 @@
1
- import { Observable } from "rxjs";
2
- import { UxOptions } from "../config";
3
- import { ViewportSizeTypeInfo, ViewportSize } from "./viewport.model";
4
- import { WindowRef } from "../platform/window";
5
- import { ViewportServerSizeService } from "./viewport-server-size.service";
6
- import { Dictionary } from "../internal/internal.model";
7
- import * as i0 from "@angular/core";
8
- export declare class ViewportService {
9
- private windowRef;
10
- private viewportServerSize;
11
- /** Window resize observable. */
12
- readonly resizeSnap$: Observable<ViewportSize>;
13
- /** Window resize observable (which is also throttled). */
14
- readonly resize$: Observable<ViewportSize>;
15
- /** Viewport size type observable (which is also throttled). */
16
- readonly sizeType$: Observable<ViewportSizeTypeInfo>;
17
- /** Viewport size type observable. */
18
- readonly sizeTypeSnap$: Observable<ViewportSizeTypeInfo>;
19
- /** Viewport size type snapshot of the last value. (Prefer use `sizeType$` observable when possible.) */
20
- get sizeTypeSnapshot(): ViewportSizeTypeInfo;
21
- /** Viewport size observable (which is also throttled). */
22
- readonly size$: Observable<ViewportSize>;
23
- /** Viewport size observable. */
24
- readonly sizeSnap$: Observable<ViewportSize>;
25
- /** Size types refs of the generated viewport size type info. */
26
- get sizeTypeMap(): Dictionary<ViewportSizeTypeInfo>;
27
- /** Viewport size types list ordered by type, smallest to largest. */
28
- get sizeTypes(): ViewportSizeTypeInfo[];
29
- private _sizeTypeMap;
30
- private _sizeTypes;
31
- private _sizeTypeSnapshot;
32
- constructor(windowRef: WindowRef, viewportServerSize: ViewportServerSizeService, config: UxOptions);
33
- /** Returns the current viewport size */
34
- private getViewportSize;
35
- static ɵfac: i0.ɵɵFactoryDeclaration<ViewportService, never>;
36
- static ɵprov: i0.ɵɵInjectableDeclaration<ViewportService>;
37
- }
1
+ import { Observable } from "rxjs";
2
+ import { UxOptions } from "../config";
3
+ import { ViewportSizeTypeInfo, ViewportSize } from "./viewport.model";
4
+ import { WindowRef } from "../platform/window";
5
+ import { ViewportServerSizeService } from "./viewport-server-size.service";
6
+ import { Dictionary } from "../internal/internal.model";
7
+ import * as i0 from "@angular/core";
8
+ export declare class ViewportService {
9
+ private windowRef;
10
+ private viewportServerSize;
11
+ /** Window resize observable. */
12
+ readonly resizeSnap$: Observable<ViewportSize>;
13
+ /** Window resize observable (which is also throttled). */
14
+ readonly resize$: Observable<ViewportSize>;
15
+ /** Viewport size type observable (which is also throttled). */
16
+ readonly sizeType$: Observable<ViewportSizeTypeInfo>;
17
+ /** Viewport size type observable. */
18
+ readonly sizeTypeSnap$: Observable<ViewportSizeTypeInfo>;
19
+ /** Viewport size type snapshot of the last value. (Prefer use `sizeType$` observable when possible.) */
20
+ get sizeTypeSnapshot(): ViewportSizeTypeInfo;
21
+ /** Viewport size observable (which is also throttled). */
22
+ readonly size$: Observable<ViewportSize>;
23
+ /** Viewport size observable. */
24
+ readonly sizeSnap$: Observable<ViewportSize>;
25
+ /** Size types refs of the generated viewport size type info. */
26
+ get sizeTypeMap(): Dictionary<ViewportSizeTypeInfo>;
27
+ /** Viewport size types list ordered by type, smallest to largest. */
28
+ get sizeTypes(): ViewportSizeTypeInfo[];
29
+ private _sizeTypeMap;
30
+ private _sizeTypes;
31
+ private _sizeTypeSnapshot;
32
+ constructor(windowRef: WindowRef, viewportServerSize: ViewportServerSizeService, config: UxOptions);
33
+ /** Returns the current viewport size */
34
+ private getViewportSize;
35
+ static ɵfac: i0.ɵɵFactoryDeclaration<ViewportService, never>;
36
+ static ɵprov: i0.ɵɵInjectableDeclaration<ViewportService>;
37
+ }
@@ -1,25 +1,25 @@
1
- import { Dictionary } from "../internal/internal.model";
2
- import { ComparisonOperation, ViewportSizeMatcherExpression, ViewportSizeTypeInfo, ViewportMatchConditions } from "./viewport.model";
3
- export declare function isViewportSizeMatcherExpression(value: unknown): value is ViewportSizeMatcherExpression;
4
- export declare function isViewportSizeMatcherTupleExpression(arg: unknown): arg is [ComparisonOperation, string];
5
- export declare const COMPARISON_OPERATION_FUNC_MAPPING: Dictionary<(a: number, b: number) => boolean>;
6
- export declare function isViewportConditionMatch(evaluateSize: ViewportSizeTypeInfo, conditions: ViewportMatchConditions, viewportSizeTypeInfoRefs: Dictionary<ViewportSizeTypeInfo>): boolean;
7
- export declare function getSizeTypeInfo(width: number, sizeTypes: ViewportSizeTypeInfo[]): ViewportSizeTypeInfo;
8
- /**
9
- * A util function which generates the ViewportSizeTypeInfo.type for each breakpoint.
10
- * @param breakpoints the custom breakpoints
11
- */
12
- export declare function generateViewportSizeType<T extends Record<string, number>>(breakpoints: T): T & Record<number, string>;
13
- /**
14
- * Pre-processes the given breakpoints into an ordered list from smallest to largest while generating
15
- * all the necessary information on the viewport.
16
- * @param breakpoints the breakpoints obtained from the config
17
- * @internal
18
- */
19
- export declare function generateViewportSizeTypeInfoList(breakpoints: Dictionary<number>): ViewportSizeTypeInfo[];
20
- /**
21
- * Converts the breakpoint list into a dictionary while using the name as key.
22
- * @param breakpointList the list of breakpoints
23
- * @internal
24
- */
25
- export declare function generateViewportSizeTypeInfoRefs(breakpointList: ViewportSizeTypeInfo[]): Dictionary<ViewportSizeTypeInfo>;
1
+ import { Dictionary } from "../internal/internal.model";
2
+ import { ComparisonOperation, ViewportSizeMatcherExpression, ViewportSizeTypeInfo, ViewportMatchConditions } from "./viewport.model";
3
+ export declare function isViewportSizeMatcherExpression(value: unknown): value is ViewportSizeMatcherExpression;
4
+ export declare function isViewportSizeMatcherTupleExpression(arg: unknown): arg is [ComparisonOperation, string];
5
+ export declare const COMPARISON_OPERATION_FUNC_MAPPING: Dictionary<(a: number, b: number) => boolean>;
6
+ export declare function isViewportConditionMatch(evaluateSize: ViewportSizeTypeInfo, conditions: ViewportMatchConditions, viewportSizeTypeInfoRefs: Dictionary<ViewportSizeTypeInfo>): boolean;
7
+ export declare function getSizeTypeInfo(width: number, sizeTypes: ViewportSizeTypeInfo[]): ViewportSizeTypeInfo;
8
+ /**
9
+ * A util function which generates the ViewportSizeTypeInfo.type for each breakpoint.
10
+ * @param breakpoints the custom breakpoints
11
+ */
12
+ export declare function generateViewportSizeType<T extends Record<string, number>>(breakpoints: T): T & Record<number, string>;
13
+ /**
14
+ * Pre-processes the given breakpoints into an ordered list from smallest to largest while generating
15
+ * all the necessary information on the viewport.
16
+ * @param breakpoints the breakpoints obtained from the config
17
+ * @internal
18
+ */
19
+ export declare function generateViewportSizeTypeInfoList(breakpoints: Dictionary<number>): ViewportSizeTypeInfo[];
20
+ /**
21
+ * Converts the breakpoint list into a dictionary while using the name as key.
22
+ * @param breakpointList the list of breakpoints
23
+ * @internal
24
+ */
25
+ export declare function generateViewportSizeTypeInfoRefs(breakpointList: ViewportSizeTypeInfo[]): Dictionary<ViewportSizeTypeInfo>;
package/CHANGELOG.md DELETED
@@ -1,149 +0,0 @@
1
- ## [2.0.0](https://github.com/sketch7/ngx.ux/compare/1.2.2...2.0.0) (2020-xx-xx)
2
-
3
- ### Features
4
-
5
- - **deps:** update dependencies to support Angular v10
6
- - **deps:** add dependency on `tslib: ^2.0.0`
7
-
8
- ### BREAKING CHANGES
9
-
10
- - **viewport:** make several utils/models internal only
11
- - **viewport:** change `ViewportSizeType` and `UX_VIEWPORT_DEFAULT_BREAKPOINTS` has been changed (see readme)
12
- - **viewport:** remove `ViewportService.calculateItemsPerRow` function
13
-
14
- ## [1.4.1](https://github.com/sketch7/ngx.ux/compare/1.4.0...1.4.1) (2023-04-13)
15
-
16
- ### Features
17
-
18
- - **viewport:** `ViewportService` - add `resizeSnap$`, `sizeTypeSnap$`, `sizeSnap$` which are unthrottled
19
- - **viewport:** `ViewportDataService ` `get$` add option to `throttle`
20
-
21
- ## [1.4.0](https://github.com/sketch7/ngx.ux/compare/1.3.0...1.4.0) (2020-11-25)
22
-
23
- ### Features
24
-
25
- - **viewport:** implement `ssvViewportMatcherVar` directive
26
-
27
- ## [1.3.0](https://github.com/sketch7/ngx.ux/compare/1.2.2...1.3.0) (2020-11-11)
28
-
29
- ### Features
30
-
31
- - **viewport:** implement viewport data - `ViewportDataService`, `ssvViewportData` pipe (see doc for more info)
32
- - **viewport:** change `ViewportService.sizeTypeMap` - now maps by type (id) as well
33
- - **viewport:** add `ViewportService.sizeTypeSnapshot`
34
-
35
- ### Refactor
36
-
37
- - **module:** refactor main module config
38
-
39
- ## [1.2.2](https://github.com/sketch7/ngx.ux/compare/1.2.1...1.2.2) (2020-10-30)
40
-
41
- ### Features
42
-
43
- - **viewport:** add `size$` to `ViewportService`
44
-
45
- ### Bug Fixes
46
-
47
- - **viewport:** throw error when invalid size type is used in matcher
48
-
49
- ## [1.2.1](https://github.com/sketch7/ngx.ux/compare/1.2.0...1.2.1) (2020-10-28)
50
-
51
- ### Bug Fixes
52
-
53
- - **build:** down version several dependencies packages in order to support angular 8 (and possibly less)
54
- - **deps:** revert dependency on tslib `^1.10.0`
55
-
56
- ## [1.2.0](https://github.com/sketch7/ngx.ux/compare/1.1.1...1.2.0) (2020-10-27)
57
-
58
- ### Features
59
-
60
- - **viewport:** implement configurable breakpoints (thanks to contrib [@joseph118](https://github.com/joseph118))
61
- - **viewport:** add util method `generateViewportSizeType` to generate a representation of `ViewportSizeType`
62
- - **deps:** now depends on tslib `^1.10.0`
63
-
64
- ### Refactor
65
-
66
- - **all:** minor refactoring
67
-
68
- ### Chore
69
-
70
- - **deps:** update dev dependencies
71
- - **ci:** update node version
72
- - **lint:** migrate from tslint to eslint
73
-
74
- ## [1.1.1](https://github.com/sketch7/ngx.ux/compare/1.1.0...1.1.1) (2020-05-29)
75
-
76
- ### Bug Fixes
77
-
78
- - **viewport:** use `documentElement.clientWidth` to check viewport width on Safari only
79
- - **viewport:** `getViewportSize` not being called on SSR
80
-
81
- ## [1.1.0](https://github.com/sketch7/ngx.ux/compare/1.0.0...1.1.0) (2019-08-22)
82
-
83
- ### Features
84
-
85
- - **viewport:** add additional viewport breakpoint size `xxlarge1 >=1920`
86
-
87
- ## [1.0.0](https://github.com/sketch7/ngx.ux/compare/0.2.0...1.0.0) (2019-06-11)
88
-
89
- ### Chore
90
-
91
- *No new fixes/features in this release*
92
-
93
- - **deps:** update dev dependencies
94
- - **ci:** update node version
95
-
96
- ## [0.2.0](https://github.com/sketch7/ngx.ux/compare/0.1.5...0.2.0) (2019-05-20)
97
-
98
- - **viewport:** width now includes scrollbar to be more inline with css media queries e.g. `window.innerWidth` instead of `documentElement.clientWidth` (same for height)
99
- - **viewport:** resize now emits more frequently, not only after stopping resizing for a duration of time e.g. use `auditTime` instead of `debounceTime`
100
-
101
-
102
- ### BREAKING CHANGES
103
-
104
- - **viewport:** viewport size matching (including viewport matcher) size ranges now change according to the viewport size instead of the viewport container (e.g. scrollbar size is included)
105
-
106
-
107
- ## [0.1.5](https://github.com/sketch7/ngx.ux/compare/0.1.4...0.1.5) (2018-02-26)
108
-
109
- ### Features
110
-
111
- - **viewport:** implemented `calculateItemsPerRow` in service
112
-
113
-
114
- ## [0.1.4](https://github.com/sketch7/ngx.ux/compare/0.1.3...0.1.4) (2018-02-21)
115
-
116
- ### Chore
117
-
118
- update tooling
119
-
120
-
121
- ## [0.1.3](https://github.com/sketch7/ngx.ux/compare/0.1.2...0.1.3) (2018-01-31)
122
-
123
- ### Bug Fixes
124
-
125
- - **viewport:** fix `sizeType$` was returning the initial `sizeType` on subscribe until resizing instead of the last value
126
-
127
-
128
- ## [0.1.2](https://github.com/sketch7/ngx.ux/compare/0.1.1...0.1.2) (2018-11-27)
129
-
130
- ### Bug Fixes
131
-
132
- - **viewport:** fix `ssvViewportMatcher` when used on `ng-container` was trying to add cssClass and throwing an error
133
-
134
-
135
- ## [0.1.1](https://github.com/sketch7/ngx.ux/compare/0.1.0...0.1.1) (2018-11-26)
136
-
137
- ### Bug Fixes
138
-
139
- - **viewport:** fix when using OnPush with `ssvViewportMatcher`
140
-
141
-
142
- ## [0.1.0](https://github.com/sketch7/ngx.ux) (2018-11-23)
143
-
144
- Initial release
145
-
146
- ### Features
147
-
148
- - **viewport:** viewport service implementation
149
- - **viewport:** viewport size matcher implementation