@dugararchit/flex-layout 13.0.0-dugararchit
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.
- package/README.md +7 -0
- package/_private-utils/angular-flex-layout-_private-utils.d.ts +5 -0
- package/_private-utils/auto-prefixer.d.ts +24 -0
- package/_private-utils/index.d.ts +10 -0
- package/_private-utils/layout-validator.d.ts +32 -0
- package/_private-utils/object-extend.d.ts +15 -0
- package/_private-utils/package.json +10 -0
- package/_private-utils/testing/angular-flex-layout-_private-utils-testing.d.ts +5 -0
- package/_private-utils/testing/custom-matchers.d.ts +65 -0
- package/_private-utils/testing/dom-tools.d.ts +47 -0
- package/_private-utils/testing/helpers.d.ts +24 -0
- package/_private-utils/testing/index.d.ts +10 -0
- package/_private-utils/testing/package.json +10 -0
- package/angular-flex-layout-13.0.0-beta.38.tgz +0 -0
- package/angular-flex-layout.d.ts +5 -0
- package/core/README.md +25 -0
- package/core/add-alias.d.ts +14 -0
- package/core/angular-flex-layout-core.d.ts +5 -0
- package/core/base/base2.d.ts +60 -0
- package/core/base/index.d.ts +8 -0
- package/core/basis-validator/basis-validator.d.ts +13 -0
- package/core/breakpoints/break-point-registry.d.ts +42 -0
- package/core/breakpoints/break-point.d.ts +14 -0
- package/core/breakpoints/break-points-token.d.ts +14 -0
- package/core/breakpoints/breakpoint-tools.d.ts +19 -0
- package/core/breakpoints/data/break-points.d.ts +12 -0
- package/core/breakpoints/data/orientation-break-points.d.ts +23 -0
- package/core/breakpoints/index.d.ts +12 -0
- package/core/browser-provider.d.ts +24 -0
- package/core/match-media/index.d.ts +9 -0
- package/core/match-media/match-media.d.ts +59 -0
- package/core/match-media/mock/mock-match-media.d.ts +92 -0
- package/core/media-change.d.ts +30 -0
- package/core/media-marshaller/media-marshaller.d.ts +123 -0
- package/core/media-marshaller/print-hook.d.ts +95 -0
- package/core/media-observer/index.d.ts +8 -0
- package/core/media-observer/media-observer.d.ts +115 -0
- package/core/media-trigger/index.d.ts +8 -0
- package/core/media-trigger/media-trigger.d.ts +73 -0
- package/core/module.d.ts +11 -0
- package/core/multiply/multiplier.d.ts +5 -0
- package/core/package.json +10 -0
- package/core/public-api.d.ts +25 -0
- package/core/sass/_layout-bp.scss +76 -0
- package/core/style-builder/style-builder.d.ts +21 -0
- package/core/style-utils/style-utils.d.ts +53 -0
- package/core/stylesheet-map/index.d.ts +8 -0
- package/core/stylesheet-map/stylesheet-map.d.ts +24 -0
- package/core/tokens/breakpoint-token.d.ts +10 -0
- package/core/tokens/index.d.ts +10 -0
- package/core/tokens/library-config.d.ts +26 -0
- package/core/tokens/server-token.d.ts +15 -0
- package/core/utils/array.d.ts +9 -0
- package/core/utils/index.d.ts +9 -0
- package/core/utils/sort.d.ts +15 -0
- package/esm2020/_private-utils/angular-flex-layout-_private-utils.mjs +5 -0
- package/esm2020/_private-utils/auto-prefixer.mjs +65 -0
- package/esm2020/_private-utils/index.mjs +11 -0
- package/esm2020/_private-utils/layout-validator.mjs +83 -0
- package/esm2020/_private-utils/object-extend.mjs +30 -0
- package/esm2020/_private-utils/testing/angular-flex-layout-_private-utils-testing.mjs +5 -0
- package/esm2020/_private-utils/testing/custom-matchers.mjs +201 -0
- package/esm2020/_private-utils/testing/dom-tools.mjs +101 -0
- package/esm2020/_private-utils/testing/helpers.mjs +43 -0
- package/esm2020/_private-utils/testing/index.mjs +11 -0
- package/esm2020/angular-flex-layout.mjs +5 -0
- package/esm2020/core/add-alias.mjs +23 -0
- package/esm2020/core/angular-flex-layout-core.mjs +5 -0
- package/esm2020/core/base/base2.mjs +131 -0
- package/esm2020/core/base/index.mjs +9 -0
- package/esm2020/core/basis-validator/basis-validator.mjs +48 -0
- package/esm2020/core/breakpoints/break-point-registry.mjs +76 -0
- package/esm2020/core/breakpoints/break-point.mjs +2 -0
- package/esm2020/core/breakpoints/break-points-token.mjs +30 -0
- package/esm2020/core/breakpoints/breakpoint-tools.mjs +53 -0
- package/esm2020/core/breakpoints/data/break-points.mjs +78 -0
- package/esm2020/core/breakpoints/data/orientation-break-points.mjs +40 -0
- package/esm2020/core/breakpoints/index.mjs +13 -0
- package/esm2020/core/browser-provider.mjs +41 -0
- package/esm2020/core/match-media/index.mjs +10 -0
- package/esm2020/core/match-media/match-media.mjs +186 -0
- package/esm2020/core/match-media/mock/mock-match-media.mjs +224 -0
- package/esm2020/core/media-change.mjs +25 -0
- package/esm2020/core/media-marshaller/media-marshaller.mjs +317 -0
- package/esm2020/core/media-marshaller/print-hook.mjs +265 -0
- package/esm2020/core/media-observer/index.mjs +9 -0
- package/esm2020/core/media-observer/media-observer.mjs +195 -0
- package/esm2020/core/media-trigger/index.mjs +9 -0
- package/esm2020/core/media-trigger/media-trigger.mjs +188 -0
- package/esm2020/core/module.mjs +27 -0
- package/esm2020/core/multiply/multiplier.mjs +16 -0
- package/esm2020/core/public-api.mjs +26 -0
- package/esm2020/core/style-builder/style-builder.mjs +15 -0
- package/esm2020/core/style-utils/style-utils.mjs +174 -0
- package/esm2020/core/stylesheet-map/index.mjs +9 -0
- package/esm2020/core/stylesheet-map/stylesheet-map.mjs +59 -0
- package/esm2020/core/tokens/breakpoint-token.mjs +13 -0
- package/esm2020/core/tokens/index.mjs +11 -0
- package/esm2020/core/tokens/library-config.mjs +30 -0
- package/esm2020/core/tokens/server-token.mjs +19 -0
- package/esm2020/core/utils/array.mjs +12 -0
- package/esm2020/core/utils/index.mjs +10 -0
- package/esm2020/core/utils/sort.mjs +20 -0
- package/esm2020/extended/angular-flex-layout-extended.mjs +5 -0
- package/esm2020/extended/class/class.mjs +88 -0
- package/esm2020/extended/img-src/img-src.mjs +106 -0
- package/esm2020/extended/module.mjs +45 -0
- package/esm2020/extended/public-api.mjs +13 -0
- package/esm2020/extended/show-hide/show-hide.mjs +176 -0
- package/esm2020/extended/style/style-transforms.mjs +76 -0
- package/esm2020/extended/style/style.mjs +130 -0
- package/esm2020/flex/angular-flex-layout-flex.mjs +5 -0
- package/esm2020/flex/flex/flex.mjs +291 -0
- package/esm2020/flex/flex-align/flex-align.mjs +80 -0
- package/esm2020/flex/flex-fill/flex-fill.mjs +50 -0
- package/esm2020/flex/flex-offset/flex-offset.mjs +121 -0
- package/esm2020/flex/flex-order/flex-order.mjs +66 -0
- package/esm2020/flex/layout/layout.mjs +86 -0
- package/esm2020/flex/layout-align/layout-align.mjs +194 -0
- package/esm2020/flex/layout-gap/layout-gap.mjs +282 -0
- package/esm2020/flex/module.mjs +62 -0
- package/esm2020/flex/public-api.mjs +17 -0
- package/esm2020/grid/align-columns/align-columns.mjs +137 -0
- package/esm2020/grid/align-rows/align-rows.mjs +119 -0
- package/esm2020/grid/angular-flex-layout-grid.mjs +5 -0
- package/esm2020/grid/area/area.mjs +67 -0
- package/esm2020/grid/areas/areas.mjs +86 -0
- package/esm2020/grid/auto/auto.mjs +89 -0
- package/esm2020/grid/column/column.mjs +67 -0
- package/esm2020/grid/columns/columns.mjs +96 -0
- package/esm2020/grid/gap/gap.mjs +85 -0
- package/esm2020/grid/grid-align/grid-align.mjs +111 -0
- package/esm2020/grid/module.mjs +73 -0
- package/esm2020/grid/public-api.mjs +20 -0
- package/esm2020/grid/row/row.mjs +67 -0
- package/esm2020/grid/rows/rows.mjs +96 -0
- package/esm2020/module.mjs +64 -0
- package/esm2020/public-api.mjs +20 -0
- package/esm2020/server/angular-flex-layout-server.mjs +5 -0
- package/esm2020/server/module.mjs +22 -0
- package/esm2020/server/public-api.mjs +10 -0
- package/esm2020/server/server-match-media.mjs +151 -0
- package/esm2020/server/server-provider.mjs +140 -0
- package/esm2020/version.mjs +11 -0
- package/extended/README.md +18 -0
- package/extended/angular-flex-layout-extended.d.ts +5 -0
- package/extended/class/class.d.ts +38 -0
- package/extended/img-src/img-src.d.ts +51 -0
- package/extended/module.d.ts +16 -0
- package/extended/package.json +10 -0
- package/extended/public-api.d.ts +12 -0
- package/extended/show-hide/show-hide.d.ts +61 -0
- package/extended/style/style-transforms.d.ts +36 -0
- package/extended/style/style.d.ts +45 -0
- package/fesm2015/angular-flex-layout-_private-utils-testing.mjs +357 -0
- package/fesm2015/angular-flex-layout-_private-utils-testing.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-_private-utils.mjs +193 -0
- package/fesm2015/angular-flex-layout-_private-utils.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-core.mjs +2331 -0
- package/fesm2015/angular-flex-layout-core.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-extended.mjs +621 -0
- package/fesm2015/angular-flex-layout-extended.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-flex.mjs +1206 -0
- package/fesm2015/angular-flex-layout-flex.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-grid.mjs +1047 -0
- package/fesm2015/angular-flex-layout-grid.mjs.map +1 -0
- package/fesm2015/angular-flex-layout-server.mjs +324 -0
- package/fesm2015/angular-flex-layout-server.mjs.map +1 -0
- package/fesm2015/angular-flex-layout.mjs +94 -0
- package/fesm2015/angular-flex-layout.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-_private-utils-testing.mjs +357 -0
- package/fesm2020/angular-flex-layout-_private-utils-testing.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-_private-utils.mjs +192 -0
- package/fesm2020/angular-flex-layout-_private-utils.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-core.mjs +2304 -0
- package/fesm2020/angular-flex-layout-core.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-extended.mjs +612 -0
- package/fesm2020/angular-flex-layout-extended.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-flex.mjs +1198 -0
- package/fesm2020/angular-flex-layout-flex.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-grid.mjs +1047 -0
- package/fesm2020/angular-flex-layout-grid.mjs.map +1 -0
- package/fesm2020/angular-flex-layout-server.mjs +322 -0
- package/fesm2020/angular-flex-layout-server.mjs.map +1 -0
- package/fesm2020/angular-flex-layout.mjs +92 -0
- package/fesm2020/angular-flex-layout.mjs.map +1 -0
- package/flex/README.md +19 -0
- package/flex/angular-flex-layout-flex.d.ts +5 -0
- package/flex/flex/flex.d.ts +59 -0
- package/flex/flex-align/flex-align.d.ts +32 -0
- package/flex/flex-fill/flex-fill.d.ts +33 -0
- package/flex/flex-offset/flex-offset.d.ts +44 -0
- package/flex/flex-order/flex-order.d.ts +34 -0
- package/flex/layout/layout.d.ts +43 -0
- package/flex/layout-align/layout-align.d.ts +49 -0
- package/flex/layout-gap/layout-gap.d.ts +65 -0
- package/flex/module.d.ts +21 -0
- package/flex/package.json +10 -0
- package/flex/public-api.d.ts +16 -0
- package/grid/README.md +19 -0
- package/grid/align-columns/align-columns.d.ts +39 -0
- package/grid/align-rows/align-rows.d.ts +39 -0
- package/grid/angular-flex-layout-grid.d.ts +5 -0
- package/grid/area/area.d.ts +34 -0
- package/grid/areas/areas.d.ts +41 -0
- package/grid/auto/auto.d.ts +41 -0
- package/grid/column/column.d.ts +34 -0
- package/grid/columns/columns.d.ts +43 -0
- package/grid/gap/gap.d.ts +42 -0
- package/grid/grid-align/grid-align.d.ts +37 -0
- package/grid/module.d.ts +23 -0
- package/grid/package.json +10 -0
- package/grid/public-api.d.ts +19 -0
- package/grid/row/row.d.ts +34 -0
- package/grid/rows/rows.d.ts +43 -0
- package/module.d.ts +30 -0
- package/package.json +100 -0
- package/public-api.d.ts +18 -0
- package/server/README.md +23 -0
- package/server/angular-flex-layout-server.d.ts +5 -0
- package/server/module.d.ts +6 -0
- package/server/package.json +10 -0
- package/server/public-api.d.ts +9 -0
- package/server/server-match-media.d.ts +61 -0
- package/server/server-provider.d.ts +44 -0
- package/version.d.ts +10 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { DoCheck, ElementRef, IterableDiffers, KeyValueDiffers, Renderer2 } from '@angular/core';
|
|
9
|
+
import { NgClass } from '@angular/common';
|
|
10
|
+
import { BaseDirective2, StyleUtils, MediaMarshaller } from '@angular/flex-layout/core';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
export declare class ClassDirective extends BaseDirective2 implements DoCheck {
|
|
13
|
+
protected readonly ngClassInstance: NgClass;
|
|
14
|
+
protected DIRECTIVE_KEY: string;
|
|
15
|
+
/**
|
|
16
|
+
* Capture class assignments so we cache the default classes
|
|
17
|
+
* which are merged with activated styles and used as fallbacks.
|
|
18
|
+
*/
|
|
19
|
+
set klass(val: string);
|
|
20
|
+
constructor(elementRef: ElementRef, styler: StyleUtils, marshal: MediaMarshaller, iterableDiffers: IterableDiffers, keyValueDiffers: KeyValueDiffers, renderer2: Renderer2, ngClassInstance: NgClass);
|
|
21
|
+
protected updateWithValue(value: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* For ChangeDetectionStrategy.onPush and ngOnChanges() updates
|
|
24
|
+
*/
|
|
25
|
+
ngDoCheck(): void;
|
|
26
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ClassDirective, [null, null, null, null, null, null, { optional: true; self: true; }]>;
|
|
27
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ClassDirective, never, never, { "klass": "class"; }, {}, never>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Directive to add responsive support for ngClass.
|
|
31
|
+
* This maintains the core functionality of 'ngClass' and adds responsive API
|
|
32
|
+
* Note: this class is a no-op when rendered on the server
|
|
33
|
+
*/
|
|
34
|
+
export declare class DefaultClassDirective extends ClassDirective {
|
|
35
|
+
protected inputs: string[];
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultClassDirective, never>;
|
|
37
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DefaultClassDirective, " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", never, { "ngClass": "ngClass"; "ngClass.xs": "ngClass.xs"; "ngClass.sm": "ngClass.sm"; "ngClass.md": "ngClass.md"; "ngClass.lg": "ngClass.lg"; "ngClass.xl": "ngClass.xl"; "ngClass.lt-sm": "ngClass.lt-sm"; "ngClass.lt-md": "ngClass.lt-md"; "ngClass.lt-lg": "ngClass.lt-lg"; "ngClass.lt-xl": "ngClass.lt-xl"; "ngClass.gt-xs": "ngClass.gt-xs"; "ngClass.gt-sm": "ngClass.gt-sm"; "ngClass.gt-md": "ngClass.gt-md"; "ngClass.gt-lg": "ngClass.gt-lg"; }, {}, never>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { ElementRef } from '@angular/core';
|
|
9
|
+
import { MediaMarshaller, BaseDirective2, StyleBuilder, StyleDefinition, StyleUtils } from '@angular/flex-layout/core';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
export declare class ImgSrcStyleBuilder extends StyleBuilder {
|
|
12
|
+
buildStyles(url: string): {
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ImgSrcStyleBuilder, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ImgSrcStyleBuilder>;
|
|
17
|
+
}
|
|
18
|
+
export declare class ImgSrcDirective extends BaseDirective2 {
|
|
19
|
+
protected platformId: Object;
|
|
20
|
+
protected serverModuleLoaded: boolean;
|
|
21
|
+
protected DIRECTIVE_KEY: string;
|
|
22
|
+
protected defaultSrc: string;
|
|
23
|
+
set src(val: string);
|
|
24
|
+
constructor(elementRef: ElementRef, styleBuilder: ImgSrcStyleBuilder, styler: StyleUtils, marshal: MediaMarshaller, platformId: Object, serverModuleLoaded: boolean);
|
|
25
|
+
/**
|
|
26
|
+
* Use the [responsively] activated input value to update
|
|
27
|
+
* the host img src attribute or assign a default `img.src=''`
|
|
28
|
+
* if the src has not been defined.
|
|
29
|
+
*
|
|
30
|
+
* Do nothing to standard `<img src="">` usages, only when responsive
|
|
31
|
+
* keys are present do we actually call `setAttribute()`
|
|
32
|
+
*/
|
|
33
|
+
protected updateWithValue(value?: string): void;
|
|
34
|
+
protected styleCache: Map<string, StyleDefinition>;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ImgSrcDirective, never>;
|
|
36
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ImgSrcDirective, never, never, { "src": "src"; }, {}, never>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This directive provides a responsive API for the HTML <img> 'src' attribute
|
|
40
|
+
* and will update the img.src property upon each responsive activation.
|
|
41
|
+
*
|
|
42
|
+
* e.g.
|
|
43
|
+
* <img src="defaultScene.jpg" src.xs="mobileScene.jpg"></img>
|
|
44
|
+
*
|
|
45
|
+
* @see https://css-tricks.com/responsive-images-youre-just-changing-resolutions-use-src/
|
|
46
|
+
*/
|
|
47
|
+
export declare class DefaultImgSrcDirective extends ImgSrcDirective {
|
|
48
|
+
protected inputs: string[];
|
|
49
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultImgSrcDirective, never>;
|
|
50
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DefaultImgSrcDirective, " img[src.xs], img[src.sm], img[src.md], img[src.lg], img[src.xl], img[src.lt-sm], img[src.lt-md], img[src.lt-lg], img[src.lt-xl], img[src.gt-xs], img[src.gt-sm], img[src.gt-md], img[src.gt-lg]", never, { "src.xs": "src.xs"; "src.sm": "src.sm"; "src.md": "src.md"; "src.lg": "src.lg"; "src.xl": "src.xl"; "src.lt-sm": "src.lt-sm"; "src.lt-md": "src.lt-md"; "src.lt-lg": "src.lt-lg"; "src.lt-xl": "src.lt-xl"; "src.gt-xs": "src.gt-xs"; "src.gt-sm": "src.gt-sm"; "src.gt-md": "src.gt-md"; "src.gt-lg": "src.gt-lg"; }, {}, never>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./show-hide/show-hide";
|
|
3
|
+
import * as i2 from "./class/class";
|
|
4
|
+
import * as i3 from "./style/style";
|
|
5
|
+
import * as i4 from "./img-src/img-src";
|
|
6
|
+
import * as i5 from "@angular/flex-layout/core";
|
|
7
|
+
/**
|
|
8
|
+
* *****************************************************************
|
|
9
|
+
* Define module for the Extended API
|
|
10
|
+
* *****************************************************************
|
|
11
|
+
*/
|
|
12
|
+
export declare class ExtendedModule {
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ExtendedModule, never>;
|
|
14
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ExtendedModule, [typeof i1.DefaultShowHideDirective, typeof i2.DefaultClassDirective, typeof i3.DefaultStyleDirective, typeof i4.DefaultImgSrcDirective], [typeof i5.CoreModule], [typeof i1.DefaultShowHideDirective, typeof i2.DefaultClassDirective, typeof i3.DefaultStyleDirective, typeof i4.DefaultImgSrcDirective]>;
|
|
15
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ExtendedModule>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"module": "../fesm2015/angular-flex-layout-extended.mjs",
|
|
3
|
+
"es2020": "../fesm2020/angular-flex-layout-extended.mjs",
|
|
4
|
+
"esm2020": "../esm2020/extended/angular-flex-layout-extended.mjs",
|
|
5
|
+
"fesm2020": "../fesm2020/angular-flex-layout-extended.mjs",
|
|
6
|
+
"fesm2015": "../fesm2015/angular-flex-layout-extended.mjs",
|
|
7
|
+
"typings": "angular-flex-layout-extended.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"name": "@angular/flex-layout/extended"
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
export * from './module';
|
|
9
|
+
export * from './class/class';
|
|
10
|
+
export * from './img-src/img-src';
|
|
11
|
+
export * from './show-hide/show-hide';
|
|
12
|
+
export * from './style/style';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { ElementRef, OnChanges, SimpleChanges, AfterViewInit } from '@angular/core';
|
|
9
|
+
import { BaseDirective2, LayoutConfigOptions, MediaMarshaller, StyleUtils, StyleBuilder } from '@angular/flex-layout/core';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
export interface ShowHideParent {
|
|
12
|
+
display: string;
|
|
13
|
+
isServer: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class ShowHideStyleBuilder extends StyleBuilder {
|
|
16
|
+
buildStyles(show: string, parent: ShowHideParent): {
|
|
17
|
+
display: string;
|
|
18
|
+
};
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ShowHideStyleBuilder, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ShowHideStyleBuilder>;
|
|
21
|
+
}
|
|
22
|
+
export declare class ShowHideDirective extends BaseDirective2 implements AfterViewInit, OnChanges {
|
|
23
|
+
protected layoutConfig: LayoutConfigOptions;
|
|
24
|
+
protected platformId: Object;
|
|
25
|
+
protected serverModuleLoaded: boolean;
|
|
26
|
+
protected DIRECTIVE_KEY: string;
|
|
27
|
+
/** Original DOM Element CSS display style */
|
|
28
|
+
protected display: string;
|
|
29
|
+
protected hasLayout: boolean;
|
|
30
|
+
protected hasFlexChild: boolean;
|
|
31
|
+
constructor(elementRef: ElementRef, styleBuilder: ShowHideStyleBuilder, styler: StyleUtils, marshal: MediaMarshaller, layoutConfig: LayoutConfigOptions, platformId: Object, serverModuleLoaded: boolean);
|
|
32
|
+
ngAfterViewInit(): void;
|
|
33
|
+
/**
|
|
34
|
+
* On changes to any @Input properties...
|
|
35
|
+
* Default to use the non-responsive Input value ('fxShow')
|
|
36
|
+
* Then conditionally override with the mq-activated Input's current value
|
|
37
|
+
*/
|
|
38
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
39
|
+
/**
|
|
40
|
+
* Watch for these extra triggers to update fxShow, fxHide stylings
|
|
41
|
+
*/
|
|
42
|
+
protected trackExtraTriggers(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Override accessor to the current HTMLElement's `display` style
|
|
45
|
+
* Note: Show/Hide will not change the display to 'flex' but will set it to 'block'
|
|
46
|
+
* unless it was already explicitly specified inline or in a CSS stylesheet.
|
|
47
|
+
*/
|
|
48
|
+
protected getDisplayStyle(): string;
|
|
49
|
+
/** Validate the visibility value and then update the host's inline display style */
|
|
50
|
+
protected updateWithValue(value?: boolean | string): void;
|
|
51
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ShowHideDirective, never>;
|
|
52
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ShowHideDirective, never, never, {}, {}, never>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 'show' Layout API directive
|
|
56
|
+
*/
|
|
57
|
+
export declare class DefaultShowHideDirective extends ShowHideDirective {
|
|
58
|
+
protected inputs: string[];
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultShowHideDirective, never>;
|
|
60
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DefaultShowHideDirective, " [fxShow], [fxShow.print], [fxShow.xs], [fxShow.sm], [fxShow.md], [fxShow.lg], [fxShow.xl], [fxShow.lt-sm], [fxShow.lt-md], [fxShow.lt-lg], [fxShow.lt-xl], [fxShow.gt-xs], [fxShow.gt-sm], [fxShow.gt-md], [fxShow.gt-lg], [fxHide], [fxHide.print], [fxHide.xs], [fxHide.sm], [fxHide.md], [fxHide.lg], [fxHide.xl], [fxHide.lt-sm], [fxHide.lt-md], [fxHide.lt-lg], [fxHide.lt-xl], [fxHide.gt-xs], [fxHide.gt-sm], [fxHide.gt-md], [fxHide.gt-lg]", never, { "fxShow": "fxShow"; "fxShow.print": "fxShow.print"; "fxShow.xs": "fxShow.xs"; "fxShow.sm": "fxShow.sm"; "fxShow.md": "fxShow.md"; "fxShow.lg": "fxShow.lg"; "fxShow.xl": "fxShow.xl"; "fxShow.lt-sm": "fxShow.lt-sm"; "fxShow.lt-md": "fxShow.lt-md"; "fxShow.lt-lg": "fxShow.lt-lg"; "fxShow.lt-xl": "fxShow.lt-xl"; "fxShow.gt-xs": "fxShow.gt-xs"; "fxShow.gt-sm": "fxShow.gt-sm"; "fxShow.gt-md": "fxShow.gt-md"; "fxShow.gt-lg": "fxShow.gt-lg"; "fxHide": "fxHide"; "fxHide.print": "fxHide.print"; "fxHide.xs": "fxHide.xs"; "fxHide.sm": "fxHide.sm"; "fxHide.md": "fxHide.md"; "fxHide.lg": "fxHide.lg"; "fxHide.xl": "fxHide.xl"; "fxHide.lt-sm": "fxHide.lt-sm"; "fxHide.lt-md": "fxHide.lt-md"; "fxHide.lt-lg": "fxHide.lt-lg"; "fxHide.lt-xl": "fxHide.lt-xl"; "fxHide.gt-xs": "fxHide.gt-xs"; "fxHide.gt-sm": "fxHide.gt-sm"; "fxHide.gt-md": "fxHide.gt-md"; "fxHide.gt-lg": "fxHide.gt-lg"; }, {}, never>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
export declare type NgStyleRawList = string[];
|
|
9
|
+
export declare type NgStyleMap = {
|
|
10
|
+
[klass: string]: string;
|
|
11
|
+
};
|
|
12
|
+
export declare type NgStyleType = string | Set<string> | NgStyleRawList | NgStyleMap;
|
|
13
|
+
/**
|
|
14
|
+
* Callback function for SecurityContext.STYLE sanitization
|
|
15
|
+
*/
|
|
16
|
+
export declare type NgStyleSanitizer = (val: any) => string;
|
|
17
|
+
/** NgStyle allowed inputs */
|
|
18
|
+
export declare class NgStyleKeyValue {
|
|
19
|
+
key: string;
|
|
20
|
+
value: string;
|
|
21
|
+
constructor(key: string, value: string, noQuotes?: boolean);
|
|
22
|
+
}
|
|
23
|
+
export declare function getType(target: any): string;
|
|
24
|
+
/**
|
|
25
|
+
* Split string of key:value pairs into Array of k-v pairs
|
|
26
|
+
* e.g. 'key:value; key:value; key:value;' -> ['key:value',...]
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildRawList(source: any, delimiter?: string): NgStyleRawList;
|
|
29
|
+
/** Convert array of key:value strings to a iterable map object */
|
|
30
|
+
export declare function buildMapFromList(styles: NgStyleRawList, sanitize?: NgStyleSanitizer): NgStyleMap;
|
|
31
|
+
/** Convert Set<string> or raw Object to an iterable NgStyleMap */
|
|
32
|
+
export declare function buildMapFromSet(source: NgStyleType, sanitize?: NgStyleSanitizer): NgStyleMap;
|
|
33
|
+
/** Convert 'key:value' -> [key, value] */
|
|
34
|
+
export declare function stringToKeyValue(it: string): NgStyleKeyValue;
|
|
35
|
+
/** Convert [ [key,value] ] -> { key : value } */
|
|
36
|
+
export declare function keyValuesToMap(map: NgStyleMap, entry: NgStyleKeyValue): NgStyleMap;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { DoCheck, ElementRef, KeyValueDiffers, Renderer2 } from '@angular/core';
|
|
9
|
+
import { NgStyle } from '@angular/common';
|
|
10
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
11
|
+
import { BaseDirective2, StyleUtils, MediaMarshaller } from '@angular/flex-layout/core';
|
|
12
|
+
import { NgStyleType, NgStyleMap } from './style-transforms';
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
export declare class StyleDirective extends BaseDirective2 implements DoCheck {
|
|
15
|
+
protected sanitizer: DomSanitizer;
|
|
16
|
+
private readonly ngStyleInstance;
|
|
17
|
+
protected DIRECTIVE_KEY: string;
|
|
18
|
+
protected fallbackStyles: NgStyleMap;
|
|
19
|
+
protected isServer: boolean;
|
|
20
|
+
constructor(elementRef: ElementRef, styler: StyleUtils, marshal: MediaMarshaller, sanitizer: DomSanitizer, differs: KeyValueDiffers, renderer2: Renderer2, ngStyleInstance: NgStyle, serverLoaded: boolean, platformId: Object);
|
|
21
|
+
/** Add generated styles */
|
|
22
|
+
protected updateWithValue(value: any): void;
|
|
23
|
+
/** Remove generated styles */
|
|
24
|
+
protected clearStyles(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Convert raw strings to ngStyleMap; which is required by ngStyle
|
|
27
|
+
* NOTE: Raw string key-value pairs MUST be delimited by `;`
|
|
28
|
+
* Comma-delimiters are not supported due to complexities of
|
|
29
|
+
* possible style values such as `rgba(x,x,x,x)` and others
|
|
30
|
+
*/
|
|
31
|
+
protected buildStyleMap(styles: NgStyleType): NgStyleMap;
|
|
32
|
+
/** For ChangeDetectionStrategy.onPush and ngOnChanges() updates */
|
|
33
|
+
ngDoCheck(): void;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<StyleDirective, [null, null, null, null, null, null, { optional: true; self: true; }, null, null]>;
|
|
35
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<StyleDirective, never, never, {}, {}, never>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Directive to add responsive support for ngStyle.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
export declare class DefaultStyleDirective extends StyleDirective implements DoCheck {
|
|
42
|
+
protected inputs: string[];
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultStyleDirective, never>;
|
|
44
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DefaultStyleDirective, " [ngStyle], [ngStyle.xs], [ngStyle.sm], [ngStyle.md], [ngStyle.lg], [ngStyle.xl], [ngStyle.lt-sm], [ngStyle.lt-md], [ngStyle.lt-lg], [ngStyle.lt-xl], [ngStyle.gt-xs], [ngStyle.gt-sm], [ngStyle.gt-md], [ngStyle.gt-lg]", never, { "ngStyle": "ngStyle"; "ngStyle.xs": "ngStyle.xs"; "ngStyle.sm": "ngStyle.sm"; "ngStyle.md": "ngStyle.md"; "ngStyle.lg": "ngStyle.lg"; "ngStyle.xl": "ngStyle.xl"; "ngStyle.lt-sm": "ngStyle.lt-sm"; "ngStyle.lt-md": "ngStyle.lt-md"; "ngStyle.lt-lg": "ngStyle.lt-lg"; "ngStyle.lt-xl": "ngStyle.lt-xl"; "ngStyle.gt-xs": "ngStyle.gt-xs"; "ngStyle.gt-sm": "ngStyle.gt-sm"; "ngStyle.gt-md": "ngStyle.gt-md"; "ngStyle.gt-lg": "ngStyle.gt-lg"; }, {}, never>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { extendObject, applyCssPrefixes } from '@angular/flex-layout/_private-utils';
|
|
2
|
+
import { TestBed } from '@angular/core/testing';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright Google LLC All Rights Reserved.
|
|
8
|
+
*
|
|
9
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
10
|
+
* found in the LICENSE file at https://angular.io/license
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Exported DOM accessor utility functions
|
|
14
|
+
*/
|
|
15
|
+
const _dom = {
|
|
16
|
+
hasStyle,
|
|
17
|
+
getDistributedNodes,
|
|
18
|
+
getShadowRoot,
|
|
19
|
+
getText,
|
|
20
|
+
getStyle,
|
|
21
|
+
childNodes,
|
|
22
|
+
childNodesAsList,
|
|
23
|
+
hasClass,
|
|
24
|
+
hasAttribute,
|
|
25
|
+
getAttribute,
|
|
26
|
+
hasShadowRoot,
|
|
27
|
+
isCommentNode,
|
|
28
|
+
isElementNode,
|
|
29
|
+
isPresent,
|
|
30
|
+
isShadowRoot,
|
|
31
|
+
tagName,
|
|
32
|
+
lastElementChild
|
|
33
|
+
};
|
|
34
|
+
// ******************************************************************************************
|
|
35
|
+
// These functions are cloned from
|
|
36
|
+
// * @angular/platform-browser/src/browser/GenericBrowserDomAdapter
|
|
37
|
+
// and are to be used ONLY internally in custom-matchers.ts and Unit Tests
|
|
38
|
+
// ******************************************************************************************
|
|
39
|
+
function getStyle(element, stylename) {
|
|
40
|
+
return element.style[stylename];
|
|
41
|
+
}
|
|
42
|
+
function hasStyle(element, styleName, styleValue = '', inlineOnly = true) {
|
|
43
|
+
let value = getStyle(element, styleName) || '';
|
|
44
|
+
if (!value && !inlineOnly) {
|
|
45
|
+
// Search stylesheets
|
|
46
|
+
value = typeof getComputedStyle === 'function' &&
|
|
47
|
+
getComputedStyle(element).getPropertyValue(styleName) || '';
|
|
48
|
+
}
|
|
49
|
+
return styleValue ? value == styleValue : value.length > 0;
|
|
50
|
+
}
|
|
51
|
+
function getDistributedNodes(el) {
|
|
52
|
+
return el.getDistributedNodes();
|
|
53
|
+
}
|
|
54
|
+
function getShadowRoot(el) {
|
|
55
|
+
return el.shadowRoot;
|
|
56
|
+
}
|
|
57
|
+
function getText(el) {
|
|
58
|
+
return el.textContent || '';
|
|
59
|
+
}
|
|
60
|
+
function childNodesAsList(el) {
|
|
61
|
+
const list = el.childNodes;
|
|
62
|
+
const res = new Array(list.length);
|
|
63
|
+
for (let i = 0; i < list.length; i++) {
|
|
64
|
+
res[i] = list[i];
|
|
65
|
+
}
|
|
66
|
+
return res;
|
|
67
|
+
}
|
|
68
|
+
function hasClass(element, className) {
|
|
69
|
+
return element.classList.contains(className);
|
|
70
|
+
}
|
|
71
|
+
function hasAttribute(element, attributeName) {
|
|
72
|
+
return element.hasAttribute(attributeName);
|
|
73
|
+
}
|
|
74
|
+
function getAttribute(element, attributeName) {
|
|
75
|
+
return element.getAttribute(attributeName);
|
|
76
|
+
}
|
|
77
|
+
function childNodes(el) {
|
|
78
|
+
return el.childNodes;
|
|
79
|
+
}
|
|
80
|
+
function hasShadowRoot(node) {
|
|
81
|
+
return isPresent(node.shadowRoot) && node instanceof HTMLElement;
|
|
82
|
+
}
|
|
83
|
+
function isCommentNode(node) {
|
|
84
|
+
return node.nodeType === Node.COMMENT_NODE;
|
|
85
|
+
}
|
|
86
|
+
function isElementNode(node) {
|
|
87
|
+
return node.nodeType === Node.ELEMENT_NODE;
|
|
88
|
+
}
|
|
89
|
+
function isShadowRoot(node) {
|
|
90
|
+
return node instanceof DocumentFragment;
|
|
91
|
+
}
|
|
92
|
+
function isPresent(obj) {
|
|
93
|
+
return obj != null;
|
|
94
|
+
}
|
|
95
|
+
function tagName(element) {
|
|
96
|
+
return element.tagName;
|
|
97
|
+
}
|
|
98
|
+
// ******************************************************************************************
|
|
99
|
+
// These functions are part of the DOM API
|
|
100
|
+
// and are to be used ONLY internally in custom-matchers.ts and Unit Tests
|
|
101
|
+
// ******************************************************************************************
|
|
102
|
+
function lastElementChild(element) {
|
|
103
|
+
return element.lastElementChild;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const _global = (typeof window === 'undefined' ? global : window);
|
|
107
|
+
const expect$1 = _global.expect;
|
|
108
|
+
/**
|
|
109
|
+
* NOTE: These custom JASMINE Matchers are used only
|
|
110
|
+
* in the Karma/Jasmine testing for the Layout Directives
|
|
111
|
+
* in `src/lib/flex/api`
|
|
112
|
+
*/
|
|
113
|
+
const customMatchers = {
|
|
114
|
+
toEqual: function (util) {
|
|
115
|
+
return {
|
|
116
|
+
compare: function (actual, expected) {
|
|
117
|
+
return { pass: util.equals(actual, expected, [compareMap]) };
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
function compareMap(actual, expected) {
|
|
121
|
+
if (actual instanceof Map) {
|
|
122
|
+
let pass = actual.size === expected.size;
|
|
123
|
+
if (pass) {
|
|
124
|
+
actual.forEach((v, k) => {
|
|
125
|
+
pass = pass && util.equals(v, expected.get(k));
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return pass;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
toHaveText: function () {
|
|
136
|
+
return {
|
|
137
|
+
compare: function (actual, expectedText) {
|
|
138
|
+
const actualText = elementText(actual);
|
|
139
|
+
return {
|
|
140
|
+
pass: actualText == expectedText,
|
|
141
|
+
get message() {
|
|
142
|
+
return 'Expected ' + actualText + ' to be equal to ' + expectedText;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
toHaveCssClass: function () {
|
|
149
|
+
return { compare: buildError(false), negativeCompare: buildError(true) };
|
|
150
|
+
function buildError(isNot) {
|
|
151
|
+
return function (actual, className) {
|
|
152
|
+
return {
|
|
153
|
+
pass: _dom.hasClass(actual, className) == !isNot,
|
|
154
|
+
get message() {
|
|
155
|
+
return `
|
|
156
|
+
Expected ${actual.outerHTML} ${isNot ? 'not ' : ''}
|
|
157
|
+
to contain the CSS class '${className}'
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
toHaveMap: function () {
|
|
165
|
+
return {
|
|
166
|
+
compare: function (actual, map) {
|
|
167
|
+
let allPassed;
|
|
168
|
+
allPassed = Object.keys(map).length !== 0;
|
|
169
|
+
Object.keys(map).forEach(key => {
|
|
170
|
+
allPassed = allPassed && (actual[key] === map[key]);
|
|
171
|
+
});
|
|
172
|
+
return {
|
|
173
|
+
pass: allPassed,
|
|
174
|
+
get message() {
|
|
175
|
+
return `
|
|
176
|
+
Expected ${JSON.stringify(actual)} ${!allPassed ? ' ' : 'not '} to contain the
|
|
177
|
+
'${JSON.stringify(map)}'
|
|
178
|
+
`;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
toHaveAttributes: function () {
|
|
185
|
+
return {
|
|
186
|
+
compare: function (actual, map) {
|
|
187
|
+
let allPassed;
|
|
188
|
+
let attributeNames = Object.keys(map);
|
|
189
|
+
allPassed = attributeNames.length !== 0;
|
|
190
|
+
attributeNames.forEach(name => {
|
|
191
|
+
allPassed = allPassed && _dom.hasAttribute(actual, name)
|
|
192
|
+
&& _dom.getAttribute(actual, name) === map[name];
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
pass: allPassed,
|
|
196
|
+
get message() {
|
|
197
|
+
return `
|
|
198
|
+
Expected ${actual.outerHTML} ${allPassed ? 'not ' : ''} attributes to contain
|
|
199
|
+
'${JSON.stringify(map)}'
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* Check element's inline styles only
|
|
208
|
+
*/
|
|
209
|
+
toHaveStyle: function () {
|
|
210
|
+
return {
|
|
211
|
+
compare: buildCompareStyleFunction(true)
|
|
212
|
+
};
|
|
213
|
+
},
|
|
214
|
+
/**
|
|
215
|
+
* Check element's css stylesheet only (if not present inline)
|
|
216
|
+
*/
|
|
217
|
+
toHaveCSS: function () {
|
|
218
|
+
return {
|
|
219
|
+
compare: buildCompareStyleFunction(false)
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Curried value to function to check styles that are inline or in a stylesheet for the
|
|
225
|
+
* specified DOM element.
|
|
226
|
+
*/
|
|
227
|
+
function buildCompareStyleFunction(inlineOnly = true) {
|
|
228
|
+
return function (actual, styles, styler) {
|
|
229
|
+
const found = {};
|
|
230
|
+
const styleMap = {};
|
|
231
|
+
if (typeof styles === 'string') {
|
|
232
|
+
styleMap[styles] = '';
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
Object.assign(styleMap, styles);
|
|
236
|
+
}
|
|
237
|
+
let allPassed = Object.keys(styleMap).length !== 0;
|
|
238
|
+
Object.keys(styleMap).forEach(prop => {
|
|
239
|
+
let { elHasStyle, current } = hasPrefixedStyles(actual, prop, styleMap[prop], inlineOnly, styler);
|
|
240
|
+
allPassed = allPassed && elHasStyle;
|
|
241
|
+
if (!elHasStyle) {
|
|
242
|
+
extendObject(found, current);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
return {
|
|
246
|
+
pass: allPassed,
|
|
247
|
+
get message() {
|
|
248
|
+
const expectedValueStr = (typeof styles === 'string') ? styleMap :
|
|
249
|
+
JSON.stringify(styleMap, null, 2);
|
|
250
|
+
const foundValueStr = inlineOnly ? actual.outerHTML : JSON.stringify(found);
|
|
251
|
+
return `
|
|
252
|
+
Expected ${foundValueStr}${!allPassed ? '' : ' not'} to contain the
|
|
253
|
+
CSS ${typeof styles === 'string' ? 'property' : 'styles'} '${expectedValueStr}'
|
|
254
|
+
`;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Validate presence of requested style or use fallback
|
|
261
|
+
* to possible `prefixed` styles. Useful when some browsers
|
|
262
|
+
* (Safari, IE, etc) will use prefixed style instead of defaults.
|
|
263
|
+
*/
|
|
264
|
+
function hasPrefixedStyles(actual, key, value, inlineOnly, styler) {
|
|
265
|
+
const current = {};
|
|
266
|
+
if (value === '*') {
|
|
267
|
+
return { elHasStyle: styler.lookupStyle(actual, key, inlineOnly) !== '', current };
|
|
268
|
+
}
|
|
269
|
+
value = value.trim();
|
|
270
|
+
let elHasStyle = styler.lookupStyle(actual, key, inlineOnly) === value;
|
|
271
|
+
if (!elHasStyle) {
|
|
272
|
+
let prefixedStyles = applyCssPrefixes({ [key]: value });
|
|
273
|
+
Object.keys(prefixedStyles).forEach(prop => {
|
|
274
|
+
// Search for optional prefixed values
|
|
275
|
+
elHasStyle = elHasStyle ||
|
|
276
|
+
styler.lookupStyle(actual, prop, inlineOnly) === prefixedStyles[prop];
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
// Return BOTH confirmation and current computed key values (if confirmation == false)
|
|
280
|
+
return { elHasStyle, current };
|
|
281
|
+
}
|
|
282
|
+
function elementText(n) {
|
|
283
|
+
const hasNodes = (m) => {
|
|
284
|
+
const children = _dom.childNodes(m);
|
|
285
|
+
return children && children['length'];
|
|
286
|
+
};
|
|
287
|
+
if (n instanceof Array) {
|
|
288
|
+
return n.map(elementText).join('');
|
|
289
|
+
}
|
|
290
|
+
if (_dom.isCommentNode(n)) {
|
|
291
|
+
return '';
|
|
292
|
+
}
|
|
293
|
+
if (_dom.isElementNode(n) && _dom.tagName(n) == 'CONTENT') {
|
|
294
|
+
return elementText(Array.prototype.slice.apply(_dom.getDistributedNodes(n)));
|
|
295
|
+
}
|
|
296
|
+
if (_dom.hasShadowRoot(n)) {
|
|
297
|
+
return elementText(_dom.childNodesAsList(_dom.getShadowRoot(n)));
|
|
298
|
+
}
|
|
299
|
+
if (hasNodes(n)) {
|
|
300
|
+
return elementText(_dom.childNodesAsList(n));
|
|
301
|
+
}
|
|
302
|
+
return _dom.getText(n);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Function generator that captures a Component Type accessor and enables
|
|
307
|
+
* `createTestComponent()` to be reusable for *any* captured Component class.
|
|
308
|
+
*/
|
|
309
|
+
function makeCreateTestComponent(getClass) {
|
|
310
|
+
let componentAny;
|
|
311
|
+
// Return actual `createTestComponent()` function
|
|
312
|
+
return function createTestComponent(template, styles) {
|
|
313
|
+
if (!componentAny) {
|
|
314
|
+
// Defer access to Component class to enable metadata to be configured properly...
|
|
315
|
+
componentAny = getClass();
|
|
316
|
+
}
|
|
317
|
+
return TestBed
|
|
318
|
+
.overrideComponent(componentAny, {
|
|
319
|
+
set: {
|
|
320
|
+
template: template,
|
|
321
|
+
styles: styles || [],
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
.createComponent(componentAny);
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
*
|
|
329
|
+
*/
|
|
330
|
+
function expectNativeEl(fixture, instanceOptions) {
|
|
331
|
+
extendObject(fixture.componentInstance, instanceOptions || {});
|
|
332
|
+
fixture.detectChanges();
|
|
333
|
+
return expect(fixture.debugElement.children[0].nativeElement);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
*
|
|
337
|
+
*/
|
|
338
|
+
function expectEl(debugEl) {
|
|
339
|
+
return expect(debugEl.nativeElement);
|
|
340
|
+
}
|
|
341
|
+
function queryFor(fixture, selector) {
|
|
342
|
+
return fixture.debugElement.queryAll(By.css(selector));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @license
|
|
347
|
+
* Copyright Google LLC All Rights Reserved.
|
|
348
|
+
*
|
|
349
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
350
|
+
* found in the LICENSE file at https://angular.io/license
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Generated bundle index. Do not edit.
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
export { _dom, customMatchers, expect$1 as expect, expectEl, expectNativeEl, makeCreateTestComponent, queryFor };
|