@angular/cdk 8.0.0-beta.2 → 8.0.0
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 +2 -2
- package/_overlay.scss +4 -4
- package/bundles/cdk-a11y.umd.js +227 -79
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js +20 -8
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-accordion.umd.min.js.map +1 -1
- package/bundles/cdk-bidi.umd.js +5 -5
- package/bundles/cdk-bidi.umd.min.js +1 -1
- package/bundles/cdk-bidi.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +5 -5
- package/bundles/cdk-collections.umd.js +38 -15
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +571 -180
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +2 -2
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-keycodes.umd.js +7 -3
- package/bundles/cdk-keycodes.umd.js.map +1 -1
- package/bundles/cdk-keycodes.umd.min.js.map +1 -1
- package/bundles/cdk-layout.umd.js +83 -30
- package/bundles/cdk-layout.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.min.js +1 -1
- package/bundles/cdk-layout.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +30 -11
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +1 -1
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +229 -108
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +2 -2
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +17 -10
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +32 -13
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +184 -62
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +30 -12
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +384 -74
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +61 -21
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +85 -29
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +2 -2
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/typings/directives/drag.d.ts +11 -2
- package/drag-drop/typings/drag-events.d.ts +17 -0
- package/drag-drop/typings/drag-ref.d.ts +9 -5
- package/drag-drop/typings/drop-list-ref.d.ts +9 -3
- package/drag-drop/typings/index.metadata.json +1 -1
- package/esm2015/a11y.js +229 -81
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/accordion.js +22 -10
- package/esm2015/accordion.js.map +1 -1
- package/esm2015/bidi.js +8 -8
- package/esm2015/cdk.js +4 -4
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/coercion.js +7 -7
- package/esm2015/collections.js +41 -18
- package/esm2015/collections.js.map +1 -1
- package/esm2015/drag-drop.js +540 -181
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/keycodes.js +9 -5
- package/esm2015/keycodes.js.map +1 -1
- package/esm2015/layout.js +89 -36
- package/esm2015/layout.js.map +1 -1
- package/esm2015/observers.js +33 -14
- package/esm2015/observers.js.map +1 -1
- package/esm2015/overlay.js +232 -110
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +20 -13
- package/esm2015/platform.js.map +1 -1
- package/esm2015/portal.js +34 -15
- package/esm2015/portal.js.map +1 -1
- package/esm2015/scrolling.js +180 -58
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +32 -14
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +369 -69
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +64 -24
- package/esm2015/text-field.js.map +1 -1
- package/esm2015/tree.js +86 -30
- package/esm2015/tree.js.map +1 -1
- package/esm5/a11y.es5.js +230 -82
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/accordion.es5.js +22 -10
- package/esm5/accordion.es5.js.map +1 -1
- package/esm5/bidi.es5.js +8 -8
- package/esm5/cdk.es5.js +4 -4
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/coercion.es5.js +7 -7
- package/esm5/collections.es5.js +42 -19
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +574 -183
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/keycodes.es5.js +9 -5
- package/esm5/keycodes.es5.js.map +1 -1
- package/esm5/layout.es5.js +86 -33
- package/esm5/layout.es5.js.map +1 -1
- package/esm5/observers.es5.js +33 -14
- package/esm5/observers.es5.js.map +1 -1
- package/esm5/overlay.es5.js +232 -111
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +20 -13
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/portal.es5.js +34 -15
- package/esm5/portal.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +187 -65
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +32 -14
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +386 -72
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +64 -24
- package/esm5/text-field.es5.js.map +1 -1
- package/esm5/tree.es5.js +87 -31
- package/esm5/tree.es5.js.map +1 -1
- package/layout/typings/breakpoints-observer.d.ts +3 -3
- package/layout/typings/index.metadata.json +1 -1
- package/layout/typings/media-matcher.d.ts +2 -2
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/position/flexible-connected-position-strategy.d.ts +1 -3
- package/package.json +8 -8
- package/portal/typings/portal.d.ts +2 -2
- package/schematics/ng-update/data/attribute-selectors.js +1 -1
- package/schematics/ng-update/data/attribute-selectors.js.map +1 -1
- package/schematics/ng-update/data/class-names.js +3 -3
- package/schematics/ng-update/data/class-names.js.map +1 -1
- package/schematics/ng-update/data/constructor-checks.js +1 -1
- package/schematics/ng-update/data/constructor-checks.js.map +1 -1
- package/schematics/ng-update/data/input-names.js +1 -1
- package/schematics/ng-update/data/input-names.js.map +1 -1
- package/schematics/ng-update/data/method-call-checks.js +1 -1
- package/schematics/ng-update/data/method-call-checks.js.map +1 -1
- package/schematics/ng-update/data/property-names.js +4 -4
- package/schematics/ng-update/data/property-names.js.map +1 -1
- package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.js +1 -1
- package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.js.map +1 -1
- package/schematics/tsconfig.tsbuildinfo +5811 -0
- package/schematics/utils/ast.d.ts +1 -1
- package/schematics/utils/build-component.js +1 -1
- package/schematics/utils/build-component.js.map +1 -1
- package/schematics/utils/get-project.d.ts +1 -1
- package/schematics/utils/project-main-file.d.ts +1 -1
- package/schematics/utils/project-style-file.d.ts +1 -1
- package/schematics/utils/project-targets.d.ts +1 -1
- package/schematics/utils/schematic-options.d.ts +1 -1
- package/table/typings/cell.d.ts +3 -2
- package/table/typings/index.metadata.json +1 -1
- package/table/typings/public-api.d.ts +1 -0
- package/table/typings/row.d.ts +5 -4
- package/table/typings/sticky-styler.d.ts +5 -5
- package/table/typings/table-errors.d.ts +10 -0
- package/table/typings/text-column.d.ts +80 -0
- package/typings/drag-drop/directives/drag.d.ts +11 -2
- package/typings/drag-drop/drag-events.d.ts +17 -0
- package/typings/drag-drop/drag-ref.d.ts +9 -5
- package/typings/drag-drop/drop-list-ref.d.ts +9 -3
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/drag-drop/directives/drag.d.ts +11 -2
- package/typings/esm5/drag-drop/drag-events.d.ts +17 -0
- package/typings/esm5/drag-drop/drag-ref.d.ts +9 -5
- package/typings/esm5/drag-drop/drop-list-ref.d.ts +9 -3
- package/typings/esm5/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/layout/breakpoints-observer.d.ts +3 -3
- package/typings/esm5/layout/index.metadata.json +1 -1
- package/typings/esm5/layout/media-matcher.d.ts +2 -2
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/position/flexible-connected-position-strategy.d.ts +1 -3
- package/typings/esm5/portal/portal.d.ts +2 -2
- package/typings/esm5/table/cell.d.ts +3 -2
- package/typings/esm5/table/index.metadata.json +1 -1
- package/typings/esm5/table/public-api.d.ts +1 -0
- package/typings/esm5/table/row.d.ts +5 -4
- package/typings/esm5/table/sticky-styler.d.ts +5 -5
- package/typings/esm5/table/table-errors.d.ts +10 -0
- package/typings/esm5/table/text-column.d.ts +80 -0
- package/typings/index.metadata.json +1 -1
- package/typings/layout/breakpoints-observer.d.ts +3 -3
- package/typings/layout/index.metadata.json +1 -1
- package/typings/layout/media-matcher.d.ts +2 -2
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/position/flexible-connected-position-strategy.d.ts +1 -3
- package/typings/portal/portal.d.ts +2 -2
- package/typings/schematics/utils/ast.d.ts +1 -1
- package/typings/schematics/utils/get-project.d.ts +1 -1
- package/typings/schematics/utils/project-main-file.d.ts +1 -1
- package/typings/schematics/utils/project-style-file.d.ts +1 -1
- package/typings/schematics/utils/project-targets.d.ts +1 -1
- package/typings/schematics/utils/schematic-options.d.ts +1 -1
- package/typings/table/cell.d.ts +3 -2
- package/typings/table/index.metadata.json +1 -1
- package/typings/table/public-api.d.ts +1 -0
- package/typings/table/row.d.ts +5 -4
- package/typings/table/sticky-styler.d.ts +5 -5
- package/typings/table/table-errors.d.ts +10 -0
- package/typings/table/text-column.d.ts +80 -0
package/esm2015/keycodes.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview added by tsickle
|
|
10
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
10
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/** @type {?} */
|
|
@@ -258,7 +258,7 @@ const MAC_META = 224;
|
|
|
258
258
|
|
|
259
259
|
/**
|
|
260
260
|
* @fileoverview added by tsickle
|
|
261
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
261
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
262
262
|
*/
|
|
263
263
|
|
|
264
264
|
/**
|
|
@@ -269,19 +269,23 @@ const MAC_META = 224;
|
|
|
269
269
|
*/
|
|
270
270
|
function hasModifierKey(event, ...modifiers) {
|
|
271
271
|
if (modifiers.length) {
|
|
272
|
-
return modifiers.some(
|
|
272
|
+
return modifiers.some((/**
|
|
273
|
+
* @param {?} modifier
|
|
274
|
+
* @return {?}
|
|
275
|
+
*/
|
|
276
|
+
modifier => event[modifier]));
|
|
273
277
|
}
|
|
274
278
|
return event.altKey || event.shiftKey || event.ctrlKey || event.metaKey;
|
|
275
279
|
}
|
|
276
280
|
|
|
277
281
|
/**
|
|
278
282
|
* @fileoverview added by tsickle
|
|
279
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
283
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
280
284
|
*/
|
|
281
285
|
|
|
282
286
|
/**
|
|
283
287
|
* @fileoverview added by tsickle
|
|
284
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
288
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
285
289
|
*/
|
|
286
290
|
|
|
287
291
|
export { MAC_ENTER, BACKSPACE, TAB, NUM_CENTER, ENTER, SHIFT, CONTROL, ALT, PAUSE, CAPS_LOCK, ESCAPE, SPACE, PAGE_UP, PAGE_DOWN, END, HOME, LEFT_ARROW, UP_ARROW, RIGHT_ARROW, DOWN_ARROW, PLUS_SIGN, PRINT_SCREEN, INSERT, DELETE, ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, FF_SEMICOLON, FF_EQUALS, QUESTION_MARK, AT_SIGN, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, META, MAC_WK_CMD_LEFT, MAC_WK_CMD_RIGHT, CONTEXT_MENU, NUMPAD_ZERO, NUMPAD_ONE, NUMPAD_TWO, NUMPAD_THREE, NUMPAD_FOUR, NUMPAD_FIVE, NUMPAD_SIX, NUMPAD_SEVEN, NUMPAD_EIGHT, NUMPAD_NINE, NUMPAD_MULTIPLY, NUMPAD_PLUS, NUMPAD_MINUS, NUMPAD_PERIOD, NUMPAD_DIVIDE, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, NUM_LOCK, SCROLL_LOCK, FIRST_MEDIA, FF_MINUS, MUTE, VOLUME_DOWN, VOLUME_UP, FF_MUTE, FF_VOLUME_DOWN, LAST_MEDIA, FF_VOLUME_UP, SEMICOLON, EQUALS, COMMA, DASH, SLASH, APOSTROPHE, TILDE, OPEN_SQUARE_BRACKET, BACKSLASH, CLOSE_SQUARE_BRACKET, SINGLE_QUOTE, MAC_META, hasModifierKey };
|
package/esm2015/keycodes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keycodes.js","sources":["../../../src/cdk/keycodes/modifiers.ts","../../../src/cdk/keycodes/keycodes.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\ntype ModifierKey = 'altKey' | 'shiftKey' | 'ctrlKey' | 'metaKey';\n\n/**\n * Checks whether a modifier key is pressed.\n * @param event Event to be checked.\n */\nexport function hasModifierKey(event: KeyboardEvent, ...modifiers: ModifierKey[]): boolean {\n if (modifiers.length) {\n return modifiers.some(modifier => event[modifier]);\n }\n\n return event.altKey || event.shiftKey || event.ctrlKey || event.metaKey;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport const MAC_ENTER = 3;\nexport const BACKSPACE = 8;\nexport const TAB = 9;\nexport const NUM_CENTER = 12;\nexport const ENTER = 13;\nexport const SHIFT = 16;\nexport const CONTROL = 17;\nexport const ALT = 18;\nexport const PAUSE = 19;\nexport const CAPS_LOCK = 20;\nexport const ESCAPE = 27;\nexport const SPACE = 32;\nexport const PAGE_UP = 33;\nexport const PAGE_DOWN = 34;\nexport const END = 35;\nexport const HOME = 36;\nexport const LEFT_ARROW = 37;\nexport const UP_ARROW = 38;\nexport const RIGHT_ARROW = 39;\nexport const DOWN_ARROW = 40;\nexport const PLUS_SIGN = 43;\nexport const PRINT_SCREEN = 44;\nexport const INSERT = 45;\nexport const DELETE = 46;\nexport const ZERO = 48;\nexport const ONE = 49;\nexport const TWO = 50;\nexport const THREE = 51;\nexport const FOUR = 52;\nexport const FIVE = 53;\nexport const SIX = 54;\nexport const SEVEN = 55;\nexport const EIGHT = 56;\nexport const NINE = 57;\nexport const FF_SEMICOLON = 59; // Firefox (Gecko) fires this for semicolon instead of 186\nexport const FF_EQUALS = 61; // Firefox (Gecko) fires this for equals instead of 187\nexport const QUESTION_MARK = 63;\nexport const AT_SIGN = 64;\nexport const A = 65;\nexport const B = 66;\nexport const C = 67;\nexport const D = 68;\nexport const E = 69;\nexport const F = 70;\nexport const G = 71;\nexport const H = 72;\nexport const I = 73;\nexport const J = 74;\nexport const K = 75;\nexport const L = 76;\nexport const M = 77;\nexport const N = 78;\nexport const O = 79;\nexport const P = 80;\nexport const Q = 81;\nexport const R = 82;\nexport const S = 83;\nexport const T = 84;\nexport const U = 85;\nexport const V = 86;\nexport const W = 87;\nexport const X = 88;\nexport const Y = 89;\nexport const Z = 90;\nexport const META = 91; // WIN_KEY_LEFT\nexport const MAC_WK_CMD_LEFT = 91;\nexport const MAC_WK_CMD_RIGHT = 93;\nexport const CONTEXT_MENU = 93;\nexport const NUMPAD_ZERO = 96;\nexport const NUMPAD_ONE = 97;\nexport const NUMPAD_TWO = 98;\nexport const NUMPAD_THREE = 99;\nexport const NUMPAD_FOUR = 100;\nexport const NUMPAD_FIVE = 101;\nexport const NUMPAD_SIX = 102;\nexport const NUMPAD_SEVEN = 103;\nexport const NUMPAD_EIGHT = 104;\nexport const NUMPAD_NINE = 105;\nexport const NUMPAD_MULTIPLY = 106;\nexport const NUMPAD_PLUS = 107;\nexport const NUMPAD_MINUS = 109;\nexport const NUMPAD_PERIOD = 110;\nexport const NUMPAD_DIVIDE = 111;\nexport const F1 = 112;\nexport const F2 = 113;\nexport const F3 = 114;\nexport const F4 = 115;\nexport const F5 = 116;\nexport const F6 = 117;\nexport const F7 = 118;\nexport const F8 = 119;\nexport const F9 = 120;\nexport const F10 = 121;\nexport const F11 = 122;\nexport const F12 = 123;\nexport const NUM_LOCK = 144;\nexport const SCROLL_LOCK = 145;\nexport const FIRST_MEDIA = 166;\nexport const FF_MINUS = 173;\nexport const MUTE = 173; // Firefox (Gecko) fires 181 for MUTE\nexport const VOLUME_DOWN = 174; // Firefox (Gecko) fires 182 for VOLUME_DOWN\nexport const VOLUME_UP = 175; // Firefox (Gecko) fires 183 for VOLUME_UP\nexport const FF_MUTE = 181;\nexport const FF_VOLUME_DOWN = 182;\nexport const LAST_MEDIA = 183;\nexport const FF_VOLUME_UP = 183;\nexport const SEMICOLON = 186; // Firefox (Gecko) fires 59 for SEMICOLON\nexport const EQUALS = 187; // Firefox (Gecko) fires 61 for EQUALS\nexport const COMMA = 188;\nexport const DASH = 189; // Firefox (Gecko) fires 173 for DASH/MINUS\nexport const SLASH = 191;\nexport const APOSTROPHE = 192;\nexport const TILDE = 192;\nexport const OPEN_SQUARE_BRACKET = 219;\nexport const BACKSLASH = 220;\nexport const CLOSE_SQUARE_BRACKET = 221;\nexport const SINGLE_QUOTE = 222;\nexport const MAC_META = 224;\n"],"names":[],"mappings":";;;;;;;;;;;;;ACQA,AAAA,MAAa,SAAS,GAAG,CAAC,CAA1B;;AACA,AAAA,MAAa,SAAS,GAAG,CAAC,CAA1B;;AACA,AAAA,MAAa,GAAG,GAAG,CAAC,CAApB;;AACA,AAAA,MAAa,UAAU,GAAG,EAAE,CAA5B;;AACA,AAAA,MAAa,KAAK,GAAG,EAAE,CAAvB;;AACA,AAAA,MAAa,KAAK,GAAG,EAAE,CAAvB;;AACA,AAAA,MAAa,OAAO,GAAG,EAAE,CAAzB;;AACA,AAAA,MAAa,GAAG,GAAG,EAAE,CAArB;;AACA,AAAA,MAAa,KAAK,GAAG,EAAE,CAAvB;;AACA,AAAA,MAAa,SAAS,G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es.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\ntype ModifierKey = 'altKey' | 'shiftKey' | 'ctrlKey' | 'metaKey';\n\n/**\n * Checks whether a modifier key is pressed.\n * @param event Event to be checked.\n */\nexport function hasModifierKey(event: KeyboardEvent, ...modifiers: ModifierKey[]): boolean {\n if (modifiers.length) {\n return modifiers.some(modifier => event[modifier]);\n }\n\n return event.altKey || event.shiftKey || event.ctrlKey || event.metaKey;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nexport const MAC_ENTER = 3;\nexport const BACKSPACE = 8;\nexport const TAB = 9;\nexport const NUM_CENTER = 12;\nexport const ENTER = 13;\nexport const SHIFT = 16;\nexport const CONTROL = 17;\nexport const ALT = 18;\nexport const PAUSE = 19;\nexport const CAPS_LOCK = 20;\nexport const ESCAPE = 27;\nexport const SPACE = 32;\nexport const PAGE_UP = 33;\nexport const PAGE_DOWN = 34;\nexport const END = 35;\nexport const HOME = 36;\nexport const LEFT_ARROW = 37;\nexport const UP_ARROW = 38;\nexport const RIGHT_ARROW = 39;\nexport const DOWN_ARROW = 40;\nexport const PLUS_SIGN = 43;\nexport const PRINT_SCREEN = 44;\nexport const INSERT = 45;\nexport const DELETE = 46;\nexport const ZERO = 48;\nexport const ONE = 49;\nexport const TWO = 50;\nexport const THREE = 51;\nexport const FOUR = 52;\nexport const FIVE = 53;\nexport const SIX = 54;\nexport const SEVEN = 55;\nexport const EIGHT = 56;\nexport const NINE = 57;\nexport const FF_SEMICOLON = 59; // Firefox (Gecko) fires this for semicolon instead of 186\nexport const FF_EQUALS = 61; // Firefox (Gecko) fires this for equals instead of 187\nexport const QUESTION_MARK = 63;\nexport const AT_SIGN = 64;\nexport const A = 65;\nexport const B = 66;\nexport const C = 67;\nexport const D = 68;\nexport const E = 69;\nexport const F = 70;\nexport const G = 71;\nexport const H = 72;\nexport const I = 73;\nexport const J = 74;\nexport const K = 75;\nexport const L = 76;\nexport const M = 77;\nexport const N = 78;\nexport const O = 79;\nexport const P = 80;\nexport const Q = 81;\nexport const R = 82;\nexport const S = 83;\nexport const T = 84;\nexport const U = 85;\nexport const V = 86;\nexport const W = 87;\nexport const X = 88;\nexport const Y = 89;\nexport const Z = 90;\nexport const META = 91; // WIN_KEY_LEFT\nexport const MAC_WK_CMD_LEFT = 91;\nexport const MAC_WK_CMD_RIGHT = 93;\nexport const CONTEXT_MENU = 93;\nexport const NUMPAD_ZERO = 96;\nexport const NUMPAD_ONE = 97;\nexport const NUMPAD_TWO = 98;\nexport const NUMPAD_THREE = 99;\nexport const NUMPAD_FOUR = 100;\nexport const NUMPAD_FIVE = 101;\nexport const NUMPAD_SIX = 102;\nexport const NUMPAD_SEVEN = 103;\nexport const NUMPAD_EIGHT = 104;\nexport const NUMPAD_NINE = 105;\nexport const NUMPAD_MULTIPLY = 106;\nexport const NUMPAD_PLUS = 107;\nexport const NUMPAD_MINUS = 109;\nexport const NUMPAD_PERIOD = 110;\nexport const NUMPAD_DIVIDE = 111;\nexport const F1 = 112;\nexport const F2 = 113;\nexport const F3 = 114;\nexport const F4 = 115;\nexport const F5 = 116;\nexport const F6 = 117;\nexport const F7 = 118;\nexport const F8 = 119;\nexport const F9 = 120;\nexport const F10 = 121;\nexport const F11 = 122;\nexport const F12 = 123;\nexport const NUM_LOCK = 144;\nexport const SCROLL_LOCK = 145;\nexport const FIRST_MEDIA = 166;\nexport const FF_MINUS = 173;\nexport const MUTE = 173; // Firefox (Gecko) fires 181 for MUTE\nexport const VOLUME_DOWN = 174; // Firefox (Gecko) fires 182 for VOLUME_DOWN\nexport const VOLUME_UP = 175; // Firefox (Gecko) fires 183 for VOLUME_UP\nexport const FF_MUTE = 181;\nexport const FF_VOLUME_DOWN = 182;\nexport const LAST_MEDIA = 183;\nexport const FF_VOLUME_UP = 183;\nexport const SEMICOLON = 186; // Firefox (Gecko) fires 59 for SEMICOLON\nexport const EQUALS = 187; // Firefox (Gecko) fires 61 for EQUALS\nexport const COMMA = 188;\nexport const DASH = 189; // Firefox (Gecko) fires 173 for DASH/MINUS\nexport const SLASH = 191;\nexport const APOSTROPHE = 192;\nexport const TILDE = 192;\nexport const OPEN_SQUARE_BRACKET = 219;\nexport const BACKSLASH = 220;\nexport const CLOSE_SQUARE_BRACKET = 221;\nexport const SINGLE_QUOTE = 222;\nexport const MAC_META = 224;\n"],"names":[],"mappings":";;;;;;;;;;;;;ACQA,AAAA,MAAa,SAAS,GAAG,CAAC,CAA1B;;AACA,AAAA,MAAa,SAAS,GAAG,CAAC,CAA1B;;AACA,AAAA,MAAa,GAAG,GAAG,CAAC,CAApB;;AACA,AAAA,MAAa,UAAU,GAAG,EAAE,CAA5B;;AACA,AAAA,MAAa,KAAK,GAAG,EAAE,CAAvB;;AACA,AAAA,MAAa,KAAK,GAAG,EAAE,CAAvB;;AACA,AAAA,MAAa,OAAO,GAAG,EAAE,CAAzB;;AACA,AAAA,MAAa,GAAG,GAAG,EAAE,CAArB;;AACA,AAAA,MAAa,KAAK,GAAG,EAAE,CAAvB;;AACA,AAAA,MAAa,SAAS,GAAG,EAAE,CAA3B;;AACA,AAAA,MAAa,MAAM,GAAG,EAAE,CAAxB;;AACA,AAAA,MAAa,KAAK,GAAG,EAAE,CAAvB;;AACA,AAAA,MAAa,OAAO,GAAG,EAAE,CAAzB;;AACA,AAAA,MAAa,SAAS,GAAG,EAAE,CAA3B;;AACA,AAAA,MAAa,GAAG,GAAG,EAAE,CAArB;;AACA,AAAA,MAAa,IAAI,GAAG,EAAE,CAAtB;;AACA,AAAA,MAAa,UAAU,GAAG,EAAE,CAA5B;;AACA,AAAA,MAAa,QAAQ,GAAG,EAAE,CAA1B;;AACA,AAAA,MAAa,WAAW,GAAG,EAAE,CAA7B;;AACA,AAAA,MAAa,UAAU,GAAG,EAAE,CAA5B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a,YAAY,GAAG,GAAG,CAA/B;;AACA,AAAA,MAAa,SAAS,GAAG,GAAG,CAA5B;;;AACA,AAAA,MAAa,MAAM,GAAG,GAAG,CAAzB;;;AACA,AAAA,MAAa,KAAK,GAAG,GAAG,CAAxB;;AACA,AAAA,MAAa,IAAI,GAAG,GAAG,CAAvB;;;AACA,AAAA,MAAa,KAAK,GAAG,GAAG,CAAxB;;AACA,AAAA,MAAa,UAAU,GAAG,GAAG,CAA7B;;AACA,AAAA,MAAa,KAAK,GAAG,GAAG,CAAxB;;AACA,AAAA,MAAa,mBAAmB,GAAG,GAAG,CAAtC;;AACA,AAAA,MAAa,SAAS,GAAG,GAAG,CAA5B;;AACA,AAAA,MAAa,oBAAoB,GAAG,GAAG,CAAvC;;AACA,AAAA,MAAa,YAAY,GAAG,GAAG,CAA/B;;AACA,AAAA,MAAa,QAAQ,GAAG,GAAG;;;;;;;;;;;;;AD/G3B,AAAA,SAAgB,cAAc,CAAC,KAAoB,EAAE,GAAG,SAAwB,EAAhF;IACE,IAAI,SAAS,CAAC,MAAM,EAAE;QACpB,OAAO,SAAS,CAAC,IAAI;;;;QAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAC,CAAC;KACpD;IAED,OAAO,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC;CACzE;;;;;;;;;;;;;;"}
|
package/esm2015/layout.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import { NgModule, Injectable, NgZone,
|
|
8
|
+
import { NgModule, Injectable, NgZone, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
|
|
9
9
|
import { Platform } from '@angular/cdk/platform';
|
|
10
10
|
import { asapScheduler, combineLatest, Observable, Subject } from 'rxjs';
|
|
11
11
|
import { debounceTime, map, startWith, takeUntil } from 'rxjs/operators';
|
|
@@ -13,7 +13,7 @@ import { coerceArray } from '@angular/cdk/coercion';
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @fileoverview added by tsickle
|
|
16
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
16
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
17
17
|
*/
|
|
18
18
|
class LayoutModule {
|
|
19
19
|
}
|
|
@@ -23,7 +23,7 @@ LayoutModule.decorators = [
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @fileoverview added by tsickle
|
|
26
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
26
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
27
27
|
*/
|
|
28
28
|
/**
|
|
29
29
|
* Global registry for all dynamically-created, injected media queries.
|
|
@@ -40,11 +40,11 @@ let mediaQueryStyleNode;
|
|
|
40
40
|
*/
|
|
41
41
|
class MediaMatcher {
|
|
42
42
|
/**
|
|
43
|
-
* @param {?}
|
|
43
|
+
* @param {?} _platform
|
|
44
44
|
*/
|
|
45
|
-
constructor(
|
|
46
|
-
this.
|
|
47
|
-
this._matchMedia = this.
|
|
45
|
+
constructor(_platform) {
|
|
46
|
+
this._platform = _platform;
|
|
47
|
+
this._matchMedia = this._platform.isBrowser && window.matchMedia ?
|
|
48
48
|
// matchMedia is bound to the window scope intentionally as it is an illegal invocation to
|
|
49
49
|
// call it from a different scope.
|
|
50
50
|
window.matchMedia.bind(window) :
|
|
@@ -59,7 +59,7 @@ class MediaMatcher {
|
|
|
59
59
|
* @return {?}
|
|
60
60
|
*/
|
|
61
61
|
matchMedia(query) {
|
|
62
|
-
if (this.
|
|
62
|
+
if (this._platform.WEBKIT) {
|
|
63
63
|
createEmptyStyleRule(query);
|
|
64
64
|
}
|
|
65
65
|
return this._matchMedia(query);
|
|
@@ -72,7 +72,7 @@ MediaMatcher.decorators = [
|
|
|
72
72
|
MediaMatcher.ctorParameters = () => [
|
|
73
73
|
{ type: Platform }
|
|
74
74
|
];
|
|
75
|
-
/** @nocollapse */ MediaMatcher.ngInjectableDef =
|
|
75
|
+
/** @nocollapse */ MediaMatcher.ngInjectableDef = ɵɵdefineInjectable({ factory: function MediaMatcher_Factory() { return new MediaMatcher(ɵɵinject(Platform)); }, token: MediaMatcher, providedIn: "root" });
|
|
76
76
|
/**
|
|
77
77
|
* For Webkit engines that only trigger the MediaQueryListListener when
|
|
78
78
|
* there is at least one CSS selector for the respective media query.
|
|
@@ -110,26 +110,32 @@ function noopMatchMedia(query) {
|
|
|
110
110
|
return (/** @type {?} */ ({
|
|
111
111
|
matches: query === 'all' || query === '',
|
|
112
112
|
media: query,
|
|
113
|
-
addListener: (
|
|
114
|
-
|
|
113
|
+
addListener: (/**
|
|
114
|
+
* @return {?}
|
|
115
|
+
*/
|
|
116
|
+
() => { }),
|
|
117
|
+
removeListener: (/**
|
|
118
|
+
* @return {?}
|
|
119
|
+
*/
|
|
120
|
+
() => { })
|
|
115
121
|
}));
|
|
116
122
|
}
|
|
117
123
|
|
|
118
124
|
/**
|
|
119
125
|
* @fileoverview added by tsickle
|
|
120
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
126
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
121
127
|
*/
|
|
122
128
|
/**
|
|
123
129
|
* Utility for checking the matching state of \@media queries.
|
|
124
130
|
*/
|
|
125
131
|
class BreakpointObserver {
|
|
126
132
|
/**
|
|
127
|
-
* @param {?}
|
|
128
|
-
* @param {?}
|
|
133
|
+
* @param {?} _mediaMatcher
|
|
134
|
+
* @param {?} _zone
|
|
129
135
|
*/
|
|
130
|
-
constructor(
|
|
131
|
-
this.
|
|
132
|
-
this.
|
|
136
|
+
constructor(_mediaMatcher, _zone) {
|
|
137
|
+
this._mediaMatcher = _mediaMatcher;
|
|
138
|
+
this._zone = _zone;
|
|
133
139
|
/**
|
|
134
140
|
* A map of all media queries currently being listened for.
|
|
135
141
|
*/
|
|
@@ -155,7 +161,11 @@ class BreakpointObserver {
|
|
|
155
161
|
isMatched(value) {
|
|
156
162
|
/** @type {?} */
|
|
157
163
|
const queries = splitQueries(coerceArray(value));
|
|
158
|
-
return queries.some(
|
|
164
|
+
return queries.some((/**
|
|
165
|
+
* @param {?} mediaQuery
|
|
166
|
+
* @return {?}
|
|
167
|
+
*/
|
|
168
|
+
mediaQuery => this._registerQuery(mediaQuery).mql.matches));
|
|
159
169
|
}
|
|
160
170
|
/**
|
|
161
171
|
* Gets an observable of results for the given queries that will emit new results for any changes
|
|
@@ -167,19 +177,31 @@ class BreakpointObserver {
|
|
|
167
177
|
/** @type {?} */
|
|
168
178
|
const queries = splitQueries(coerceArray(value));
|
|
169
179
|
/** @type {?} */
|
|
170
|
-
const observables = queries.map(
|
|
171
|
-
|
|
180
|
+
const observables = queries.map((/**
|
|
181
|
+
* @param {?} query
|
|
182
|
+
* @return {?}
|
|
183
|
+
*/
|
|
184
|
+
query => this._registerQuery(query).observable));
|
|
185
|
+
return combineLatest(observables).pipe(debounceTime(0, asapScheduler), map((/**
|
|
186
|
+
* @param {?} breakpointStates
|
|
187
|
+
* @return {?}
|
|
188
|
+
*/
|
|
189
|
+
(breakpointStates) => {
|
|
172
190
|
/** @type {?} */
|
|
173
191
|
const response = {
|
|
174
192
|
matches: false,
|
|
175
193
|
breakpoints: {},
|
|
176
194
|
};
|
|
177
|
-
breakpointStates.forEach((
|
|
195
|
+
breakpointStates.forEach((/**
|
|
196
|
+
* @param {?} state
|
|
197
|
+
* @return {?}
|
|
198
|
+
*/
|
|
199
|
+
(state) => {
|
|
178
200
|
response.matches = response.matches || state.matches;
|
|
179
201
|
response.breakpoints[state.query] = state.matches;
|
|
180
|
-
});
|
|
202
|
+
}));
|
|
181
203
|
return response;
|
|
182
|
-
}));
|
|
204
|
+
})));
|
|
183
205
|
}
|
|
184
206
|
/**
|
|
185
207
|
* Registers a specific query to be listened for.
|
|
@@ -193,22 +215,40 @@ class BreakpointObserver {
|
|
|
193
215
|
return (/** @type {?} */ (this._queries.get(query)));
|
|
194
216
|
}
|
|
195
217
|
/** @type {?} */
|
|
196
|
-
const mql = this.
|
|
218
|
+
const mql = this._mediaMatcher.matchMedia(query);
|
|
197
219
|
// Create callback for match changes and add it is as a listener.
|
|
198
220
|
/** @type {?} */
|
|
199
|
-
const queryObservable = new Observable((
|
|
221
|
+
const queryObservable = new Observable((/**
|
|
222
|
+
* @param {?} observer
|
|
223
|
+
* @return {?}
|
|
224
|
+
*/
|
|
225
|
+
(observer) => {
|
|
200
226
|
// Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed
|
|
201
227
|
// back into the zone because matchMedia is only included in Zone.js by loading the
|
|
202
228
|
// webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not
|
|
203
229
|
// have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js
|
|
204
230
|
// patches it.
|
|
205
231
|
/** @type {?} */
|
|
206
|
-
const handler = (
|
|
232
|
+
const handler = (/**
|
|
233
|
+
* @param {?} e
|
|
234
|
+
* @return {?}
|
|
235
|
+
*/
|
|
236
|
+
(e) => this._zone.run((/**
|
|
237
|
+
* @return {?}
|
|
238
|
+
*/
|
|
239
|
+
() => observer.next(e))));
|
|
207
240
|
mql.addListener(handler);
|
|
208
|
-
return (
|
|
241
|
+
return (/**
|
|
242
|
+
* @return {?}
|
|
243
|
+
*/
|
|
244
|
+
() => {
|
|
209
245
|
mql.removeListener(handler);
|
|
210
|
-
};
|
|
211
|
-
}).pipe(startWith(mql), map((
|
|
246
|
+
});
|
|
247
|
+
})).pipe(startWith(mql), map((/**
|
|
248
|
+
* @param {?} nextMql
|
|
249
|
+
* @return {?}
|
|
250
|
+
*/
|
|
251
|
+
(nextMql) => ({ query, matches: nextMql.matches }))), takeUntil(this._destroySubject));
|
|
212
252
|
// Add the MediaQueryList to the set of queries.
|
|
213
253
|
/** @type {?} */
|
|
214
254
|
const output = { observable: queryObservable, mql };
|
|
@@ -224,7 +264,7 @@ BreakpointObserver.ctorParameters = () => [
|
|
|
224
264
|
{ type: MediaMatcher },
|
|
225
265
|
{ type: NgZone }
|
|
226
266
|
];
|
|
227
|
-
/** @nocollapse */ BreakpointObserver.ngInjectableDef =
|
|
267
|
+
/** @nocollapse */ BreakpointObserver.ngInjectableDef = ɵɵdefineInjectable({ factory: function BreakpointObserver_Factory() { return new BreakpointObserver(ɵɵinject(MediaMatcher), ɵɵinject(NgZone)); }, token: BreakpointObserver, providedIn: "root" });
|
|
228
268
|
/**
|
|
229
269
|
* Split each query string into separate query strings if two queries are provided as comma
|
|
230
270
|
* separated.
|
|
@@ -232,14 +272,27 @@ BreakpointObserver.ctorParameters = () => [
|
|
|
232
272
|
* @return {?}
|
|
233
273
|
*/
|
|
234
274
|
function splitQueries(queries) {
|
|
235
|
-
return queries.map((
|
|
236
|
-
|
|
237
|
-
|
|
275
|
+
return queries.map((/**
|
|
276
|
+
* @param {?} query
|
|
277
|
+
* @return {?}
|
|
278
|
+
*/
|
|
279
|
+
(query) => query.split(',')))
|
|
280
|
+
.reduce((/**
|
|
281
|
+
* @param {?} a1
|
|
282
|
+
* @param {?} a2
|
|
283
|
+
* @return {?}
|
|
284
|
+
*/
|
|
285
|
+
(a1, a2) => a1.concat(a2)))
|
|
286
|
+
.map((/**
|
|
287
|
+
* @param {?} query
|
|
288
|
+
* @return {?}
|
|
289
|
+
*/
|
|
290
|
+
query => query.trim()));
|
|
238
291
|
}
|
|
239
292
|
|
|
240
293
|
/**
|
|
241
294
|
* @fileoverview added by tsickle
|
|
242
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
295
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
243
296
|
*/
|
|
244
297
|
// PascalCase is being used as Breakpoints is used like an enum.
|
|
245
298
|
// tslint:disable-next-line:variable-name
|
|
@@ -273,12 +326,12 @@ const Breakpoints = {
|
|
|
273
326
|
|
|
274
327
|
/**
|
|
275
328
|
* @fileoverview added by tsickle
|
|
276
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
329
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
277
330
|
*/
|
|
278
331
|
|
|
279
332
|
/**
|
|
280
333
|
* @fileoverview added by tsickle
|
|
281
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
334
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
282
335
|
*/
|
|
283
336
|
|
|
284
337
|
export { LayoutModule, BreakpointObserver, Breakpoints, MediaMatcher };
|
package/esm2015/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sources":["../../../src/cdk/layout/breakpoints.ts","../../../src/cdk/layout/breakpoints-observer.ts","../../../src/cdk/layout/media-matcher.ts","../../../src/cdk/layout/layout-module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nexport const Breakpoints = {\n XSmall: '(max-width: 599.99px)',\n Small: '(min-width: 600px) and (max-width: 959.99px)',\n Medium: '(min-width: 960px) and (max-width: 1279.99px)',\n Large: '(min-width: 1280px) and (max-width: 1919.99px)',\n XLarge: '(min-width: 1920px)',\n\n Handset: '(max-width: 599.99px) and (orientation: portrait), ' +\n '(max-width: 959.99px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839.99px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279.99px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n\n HandsetPortrait: '(max-width: 599.99px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839.99px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n\n HandsetLandscape: '(max-width: 959.99px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279.99px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {MediaMatcher} from './media-matcher';\nimport {asapScheduler, combineLatest, Observable, Subject, Observer} from 'rxjs';\nimport {debounceTime, map, startWith, takeUntil} from 'rxjs/operators';\nimport {coerceArray} from '@angular/cdk/coercion';\n\n\n/** The current state of a layout breakpoint. */\nexport interface BreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /**\n * A key boolean pair for each query provided to the observe method,\n * with its current matched state.\n */\n breakpoints: {\n [key: string]: boolean;\n };\n}\n\n/** The current state of a layout breakpoint. */\ninterface InternalBreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /** The media query being to be matched */\n query: string;\n}\n\ninterface Query {\n observable: Observable<InternalBreakpointState>;\n mql: MediaQueryList;\n}\n\n/** Utility for checking the matching state of @media queries. */\n@Injectable({providedIn: 'root'})\nexport class BreakpointObserver implements OnDestroy {\n /** A map of all media queries currently being listened for. */\n private _queries = new Map<string, Query>();\n /** A subject for all other observables to takeUntil based on. */\n private _destroySubject = new Subject<void>();\n\n constructor(private mediaMatcher: MediaMatcher, private zone: NgZone) {}\n\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value: string | string[]): boolean {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value: string | string[]): Observable<BreakpointState> {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n\n return combineLatest(observables).pipe(\n debounceTime(0, asapScheduler),\n map((breakpointStates: InternalBreakpointState[]) => {\n const response: BreakpointState = {\n matches: false,\n breakpoints: {},\n };\n breakpointStates.forEach((state: InternalBreakpointState) => {\n response.matches = response.matches || state.matches;\n response.breakpoints[state.query] = state.matches;\n });\n return response;\n }));\n }\n\n /** Registers a specific query to be listened for. */\n private _registerQuery(query: string): Query {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query)!;\n }\n\n const mql: MediaQueryList = this.mediaMatcher.matchMedia(query);\n\n // Create callback for match changes and add it is as a listener.\n const queryObservable = new Observable<MediaQueryList>((observer: Observer<MediaQueryList>) => {\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n const handler = (e: any) => this.zone.run(() => observer.next(e));\n mql.addListener(handler);\n\n return () => {\n mql.removeListener(handler);\n };\n }).pipe(\n startWith(mql),\n map((nextMql: MediaQueryList) => ({query, matches: nextMql.matches})),\n takeUntil(this._destroySubject)\n );\n\n // Add the MediaQueryList to the set of queries.\n const output = {observable: queryObservable, mql};\n this._queries.set(query, output);\n return output;\n }\n}\n\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries: string[]): string[] {\n return queries.map((query: string) => query.split(','))\n .reduce((a1: string[], a2: string[]) => a1.concat(a2))\n .map(query => query.trim());\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\n@Injectable({providedIn: 'root'})\nexport class MediaMatcher {\n /** The internal matchMedia method to return back a MediaQueryList like object. */\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor(private platform: Platform) {\n this._matchMedia = this.platform.isBrowser && window.matchMedia ?\n // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window) :\n noopMatchMedia;\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this.platform.WEBKIT) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * For Webkit engines that only trigger the MediaQueryListListener when\n * there is at least one CSS selector for the respective media query.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head!.appendChild(mediaQueryStyleNode);\n }\n\n if (mediaQueryStyleNode.sheet) {\n (mediaQueryStyleNode.sheet as CSSStyleSheet)\n .insertRule(`@media ${query} {.fx-query-test{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n console.error(e);\n }\n}\n\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query: string): MediaQueryList {\n // Use `as any` here to avoid adding additional necessary properties for\n // the noop matcher.\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => {},\n removeListener: () => {}\n } as any;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {NgModule} from '@angular/core';\n\n\n@NgModule({})\nexport class LayoutModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AGWA,MAAa,YAAY,CAAzB;;;IADA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU,EAAE,EAAZ,EAAA;;;;;;;;;;;ADCA,MAAM,kCAAkC,GAAgB,IAAI,GAAG,EAAU,CAAzE;;;;;AAGA,IAAI,mBAAiD,CAArD;;;;AAIA,AAAA,MAAa,YAAY,CAAzB;;;;IAIE,WAAF,CAAsB,QAAkB,EAAxC;QAAsB,IAAtB,CAAA,QAA8B,GAAR,QAAQ,CAAU;QACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU;;;YAG7D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,cAAc,CAAC;KAClB;;;;;;;;;IAQD,UAAU,CAAC,KAAa,EAA1B;QACI,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACxB,oBAAoB,CAAC,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAChC;;;IAxBH,EAAA,IAA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C,CAAC,KAAa,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACxC,MAAM,CAAC,CAAC,EAAY,EAAE,EAAY,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;SACrD,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;CAC3C;;;;;;;;;;;;;;;;AD9HD,AAAA,MAAa,WAAW,GAAG;IACzB,MAAM,EAAE,uBAAuB;IAC/B,KAAK,EAAE,8CAA8C;IACrD,MAAM,EAAE,+CAA+C;IACvD,KAAK,EAAE,gDAAgD;IACvD,MAAM,EAAE,qBAAqB;IAE7B,OAAO,EAAE,qDAAqD;QACrD,oDAAoD;IAC7D,MAAM,EAAE,4EAA4E;QAC5E,4EAA4E;IACpF,GAAG,EAAE,kDAAkD;QAClD,kDAAkD;IAEvD,eAAe,EAAE,mDAAmD;IACpE,cAAc,EAAE,0EAA0E;IAC1F,WAAW,EAAE,gDAAgD;IAE7D,gBAAgB,EAAE,oDAAoD;IACtE,eAAe,EAAE,4EAA4E;IAC7F,YAAY,EAAE,kDAAkD;CACjE;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"layout.js","sources":["../../../src/cdk/layout/breakpoints.ts","../../../src/cdk/layout/breakpoints-observer.ts","../../../src/cdk/layout/media-matcher.ts","../../../src/cdk/layout/layout-module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// PascalCase is being used as Breakpoints is used like an enum.\n// tslint:disable-next-line:variable-name\nexport const Breakpoints = {\n XSmall: '(max-width: 599.99px)',\n Small: '(min-width: 600px) and (max-width: 959.99px)',\n Medium: '(min-width: 960px) and (max-width: 1279.99px)',\n Large: '(min-width: 1280px) and (max-width: 1919.99px)',\n XLarge: '(min-width: 1920px)',\n\n Handset: '(max-width: 599.99px) and (orientation: portrait), ' +\n '(max-width: 959.99px) and (orientation: landscape)',\n Tablet: '(min-width: 600px) and (max-width: 839.99px) and (orientation: portrait), ' +\n '(min-width: 960px) and (max-width: 1279.99px) and (orientation: landscape)',\n Web: '(min-width: 840px) and (orientation: portrait), ' +\n '(min-width: 1280px) and (orientation: landscape)',\n\n HandsetPortrait: '(max-width: 599.99px) and (orientation: portrait)',\n TabletPortrait: '(min-width: 600px) and (max-width: 839.99px) and (orientation: portrait)',\n WebPortrait: '(min-width: 840px) and (orientation: portrait)',\n\n HandsetLandscape: '(max-width: 959.99px) and (orientation: landscape)',\n TabletLandscape: '(min-width: 960px) and (max-width: 1279.99px) and (orientation: landscape)',\n WebLandscape: '(min-width: 1280px) and (orientation: landscape)',\n};\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Injectable, NgZone, OnDestroy} from '@angular/core';\nimport {MediaMatcher} from './media-matcher';\nimport {asapScheduler, combineLatest, Observable, Subject, Observer} from 'rxjs';\nimport {debounceTime, map, startWith, takeUntil} from 'rxjs/operators';\nimport {coerceArray} from '@angular/cdk/coercion';\n\n\n/** The current state of a layout breakpoint. */\nexport interface BreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /**\n * A key boolean pair for each query provided to the observe method,\n * with its current matched state.\n */\n breakpoints: {\n [key: string]: boolean;\n };\n}\n\n/** The current state of a layout breakpoint. */\ninterface InternalBreakpointState {\n /** Whether the breakpoint is currently matching. */\n matches: boolean;\n /** The media query being to be matched */\n query: string;\n}\n\ninterface Query {\n observable: Observable<InternalBreakpointState>;\n mql: MediaQueryList;\n}\n\n/** Utility for checking the matching state of @media queries. */\n@Injectable({providedIn: 'root'})\nexport class BreakpointObserver implements OnDestroy {\n /** A map of all media queries currently being listened for. */\n private _queries = new Map<string, Query>();\n /** A subject for all other observables to takeUntil based on. */\n private _destroySubject = new Subject<void>();\n\n constructor(private _mediaMatcher: MediaMatcher, private _zone: NgZone) {}\n\n /** Completes the active subject, signalling to all other observables to complete. */\n ngOnDestroy() {\n this._destroySubject.next();\n this._destroySubject.complete();\n }\n\n /**\n * Whether one or more media queries match the current viewport size.\n * @param value One or more media queries to check.\n * @returns Whether any of the media queries match.\n */\n isMatched(value: string | string[]): boolean {\n const queries = splitQueries(coerceArray(value));\n return queries.some(mediaQuery => this._registerQuery(mediaQuery).mql.matches);\n }\n\n /**\n * Gets an observable of results for the given queries that will emit new results for any changes\n * in matching of the given queries.\n * @param value One or more media queries to check.\n * @returns A stream of matches for the given queries.\n */\n observe(value: string | string[]): Observable<BreakpointState> {\n const queries = splitQueries(coerceArray(value));\n const observables = queries.map(query => this._registerQuery(query).observable);\n\n return combineLatest(observables).pipe(\n debounceTime(0, asapScheduler),\n map((breakpointStates: InternalBreakpointState[]) => {\n const response: BreakpointState = {\n matches: false,\n breakpoints: {},\n };\n breakpointStates.forEach((state: InternalBreakpointState) => {\n response.matches = response.matches || state.matches;\n response.breakpoints[state.query] = state.matches;\n });\n return response;\n }));\n }\n\n /** Registers a specific query to be listened for. */\n private _registerQuery(query: string): Query {\n // Only set up a new MediaQueryList if it is not already being listened for.\n if (this._queries.has(query)) {\n return this._queries.get(query)!;\n }\n\n const mql: MediaQueryList = this._mediaMatcher.matchMedia(query);\n\n // Create callback for match changes and add it is as a listener.\n const queryObservable = new Observable<MediaQueryList>((observer: Observer<MediaQueryList>) => {\n // Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed\n // back into the zone because matchMedia is only included in Zone.js by loading the\n // webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not\n // have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js\n // patches it.\n const handler = (e: any) => this._zone.run(() => observer.next(e));\n mql.addListener(handler);\n\n return () => {\n mql.removeListener(handler);\n };\n }).pipe(\n startWith(mql),\n map((nextMql: MediaQueryList) => ({query, matches: nextMql.matches})),\n takeUntil(this._destroySubject)\n );\n\n // Add the MediaQueryList to the set of queries.\n const output = {observable: queryObservable, mql};\n this._queries.set(query, output);\n return output;\n }\n}\n\n/**\n * Split each query string into separate query strings if two queries are provided as comma\n * separated.\n */\nfunction splitQueries(queries: string[]): string[] {\n return queries.map((query: string) => query.split(','))\n .reduce((a1: string[], a2: string[]) => a1.concat(a2))\n .map(query => query.trim());\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Injectable} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\n\n/** Global registry for all dynamically-created, injected media queries. */\nconst mediaQueriesForWebkitCompatibility: Set<string> = new Set<string>();\n\n/** Style tag that holds all of the dynamically-created media queries. */\nlet mediaQueryStyleNode: HTMLStyleElement | undefined;\n\n/** A utility for calling matchMedia queries. */\n@Injectable({providedIn: 'root'})\nexport class MediaMatcher {\n /** The internal matchMedia method to return back a MediaQueryList like object. */\n private _matchMedia: (query: string) => MediaQueryList;\n\n constructor(private _platform: Platform) {\n this._matchMedia = this._platform.isBrowser && window.matchMedia ?\n // matchMedia is bound to the window scope intentionally as it is an illegal invocation to\n // call it from a different scope.\n window.matchMedia.bind(window) :\n noopMatchMedia;\n }\n\n /**\n * Evaluates the given media query and returns the native MediaQueryList from which results\n * can be retrieved.\n * Confirms the layout engine will trigger for the selector query provided and returns the\n * MediaQueryList for the query provided.\n */\n matchMedia(query: string): MediaQueryList {\n if (this._platform.WEBKIT) {\n createEmptyStyleRule(query);\n }\n return this._matchMedia(query);\n }\n}\n\n/**\n * For Webkit engines that only trigger the MediaQueryListListener when\n * there is at least one CSS selector for the respective media query.\n */\nfunction createEmptyStyleRule(query: string) {\n if (mediaQueriesForWebkitCompatibility.has(query)) {\n return;\n }\n\n try {\n if (!mediaQueryStyleNode) {\n mediaQueryStyleNode = document.createElement('style');\n mediaQueryStyleNode.setAttribute('type', 'text/css');\n document.head!.appendChild(mediaQueryStyleNode);\n }\n\n if (mediaQueryStyleNode.sheet) {\n (mediaQueryStyleNode.sheet as CSSStyleSheet)\n .insertRule(`@media ${query} {.fx-query-test{ }}`, 0);\n mediaQueriesForWebkitCompatibility.add(query);\n }\n } catch (e) {\n console.error(e);\n }\n}\n\n/** No-op matchMedia replacement for non-browser platforms. */\nfunction noopMatchMedia(query: string): MediaQueryList {\n // Use `as any` here to avoid adding additional necessary properties for\n // the noop matcher.\n return {\n matches: query === 'all' || query === '',\n media: query,\n addListener: () => {},\n removeListener: () => {}\n } as any;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {NgModule} from '@angular/core';\n\n\n@NgModule({})\nexport class LayoutModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AGWA,MAAa,YAAY,CAAzB;;;IADA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU,EAAE,EAAZ,EAAA;;;;;;;;;;;ADCA,MAAM,kCAAkC,GAAgB,IAAI,GAAG,EAAU,CAAzE;;;;;AAGA,IAAI,mBAAiD,CAArD;;;;AAIA,AAAA,MAAa,YAAY,CAAzB;;;;IAIE,WAAF,CAAsB,SAAmB,EAAzC;QAAsB,IAAtB,CAAA,SAA+B,GAAT,SAAS,CAAU;QACrC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,IAAI,MAAM,CAAC,UAAU;;;YAG9D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,cAAc,CAAC;KAClB;;;;;;;;;IAQD,UAAU,CAAC,KAAa,EAA1B;QACI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACzB,oBAAoB,CAAC,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAChC;;;IAxBH,EAAA,IAAA,EAAC,UAAU,EAAX,I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AAO,OAAO,CAAC,GAAG;;;;IAAC,CAAC,KAAa,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAC;SACxC,MAAM;;;;;IAAC,CAAC,EAAY,EAAE,EAAY,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EAAC;SACrD,GAAG;;;;IAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,EAAC,CAAC;CAC3C;;;;;;;;;;;;;;;;AD9HD,AAAA,MAAa,WAAW,GAAG;IACzB,MAAM,EAAE,uBAAuB;IAC/B,KAAK,EAAE,8CAA8C;IACrD,MAAM,EAAE,+CAA+C;IACvD,KAAK,EAAE,gDAAgD;IACvD,MAAM,EAAE,qBAAqB;IAE7B,OAAO,EAAE,qDAAqD;QACrD,oDAAoD;IAC7D,MAAM,EAAE,4EAA4E;QAC5E,4EAA4E;IACpF,GAAG,EAAE,kDAAkD;QAClD,kDAAkD;IAEvD,eAAe,EAAE,mDAAmD;IACpE,cAAc,EAAE,0EAA0E;IAC1F,WAAW,EAAE,gDAAgD;IAE7D,gBAAgB,EAAE,oDAAoD;IACtE,eAAe,EAAE,4EAA4E;IAC7F,YAAY,EAAE,kDAAkD;CACjE;;;;;;;;;;;;;;"}
|
package/esm2015/observers.js
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { coerceBooleanProperty, coerceNumberProperty, coerceElement } from '@angular/cdk/coercion';
|
|
9
|
-
import { Directive, ElementRef, EventEmitter, Injectable, Input, NgModule, NgZone, Output,
|
|
9
|
+
import { Directive, ElementRef, EventEmitter, Injectable, Input, NgModule, NgZone, Output, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
|
|
10
10
|
import { Observable, Subject } from 'rxjs';
|
|
11
11
|
import { debounceTime } from 'rxjs/operators';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @fileoverview added by tsickle
|
|
15
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
15
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
18
|
* Factory that creates a new MutationObserver and allows us to stub it out in unit tests.
|
|
@@ -30,7 +30,7 @@ class MutationObserverFactory {
|
|
|
30
30
|
MutationObserverFactory.decorators = [
|
|
31
31
|
{ type: Injectable, args: [{ providedIn: 'root' },] },
|
|
32
32
|
];
|
|
33
|
-
/** @nocollapse */ MutationObserverFactory.ngInjectableDef =
|
|
33
|
+
/** @nocollapse */ MutationObserverFactory.ngInjectableDef = ɵɵdefineInjectable({ factory: function MutationObserverFactory_Factory() { return new MutationObserverFactory(); }, token: MutationObserverFactory, providedIn: "root" });
|
|
34
34
|
/**
|
|
35
35
|
* An injectable service that allows watching elements for changes to their content.
|
|
36
36
|
*/
|
|
@@ -49,7 +49,12 @@ class ContentObserver {
|
|
|
49
49
|
* @return {?}
|
|
50
50
|
*/
|
|
51
51
|
ngOnDestroy() {
|
|
52
|
-
this._observedElements.forEach((
|
|
52
|
+
this._observedElements.forEach((/**
|
|
53
|
+
* @param {?} _
|
|
54
|
+
* @param {?} element
|
|
55
|
+
* @return {?}
|
|
56
|
+
*/
|
|
57
|
+
(_, element) => this._cleanupObserver(element)));
|
|
53
58
|
}
|
|
54
59
|
/**
|
|
55
60
|
* @param {?} elementOrRef
|
|
@@ -58,16 +63,23 @@ class ContentObserver {
|
|
|
58
63
|
observe(elementOrRef) {
|
|
59
64
|
/** @type {?} */
|
|
60
65
|
const element = coerceElement(elementOrRef);
|
|
61
|
-
return new Observable((
|
|
66
|
+
return new Observable((/**
|
|
67
|
+
* @param {?} observer
|
|
68
|
+
* @return {?}
|
|
69
|
+
*/
|
|
70
|
+
(observer) => {
|
|
62
71
|
/** @type {?} */
|
|
63
72
|
const stream = this._observeElement(element);
|
|
64
73
|
/** @type {?} */
|
|
65
74
|
const subscription = stream.subscribe(observer);
|
|
66
|
-
return (
|
|
75
|
+
return (/**
|
|
76
|
+
* @return {?}
|
|
77
|
+
*/
|
|
78
|
+
() => {
|
|
67
79
|
subscription.unsubscribe();
|
|
68
80
|
this._unobserveElement(element);
|
|
69
|
-
};
|
|
70
|
-
});
|
|
81
|
+
});
|
|
82
|
+
}));
|
|
71
83
|
}
|
|
72
84
|
/**
|
|
73
85
|
* Observes the given element by using the existing MutationObserver if available, or creating a
|
|
@@ -81,7 +93,11 @@ class ContentObserver {
|
|
|
81
93
|
/** @type {?} */
|
|
82
94
|
const stream = new Subject();
|
|
83
95
|
/** @type {?} */
|
|
84
|
-
const observer = this._mutationObserverFactory.create(
|
|
96
|
+
const observer = this._mutationObserverFactory.create((/**
|
|
97
|
+
* @param {?} mutations
|
|
98
|
+
* @return {?}
|
|
99
|
+
*/
|
|
100
|
+
mutations => stream.next(mutations)));
|
|
85
101
|
if (observer) {
|
|
86
102
|
observer.observe(element, {
|
|
87
103
|
characterData: true,
|
|
@@ -135,7 +151,7 @@ ContentObserver.decorators = [
|
|
|
135
151
|
ContentObserver.ctorParameters = () => [
|
|
136
152
|
{ type: MutationObserverFactory }
|
|
137
153
|
];
|
|
138
|
-
/** @nocollapse */ ContentObserver.ngInjectableDef =
|
|
154
|
+
/** @nocollapse */ ContentObserver.ngInjectableDef = ɵɵdefineInjectable({ factory: function ContentObserver_Factory() { return new ContentObserver(ɵɵinject(MutationObserverFactory)); }, token: ContentObserver, providedIn: "root" });
|
|
139
155
|
/**
|
|
140
156
|
* Directive that triggers a callback whenever the content of
|
|
141
157
|
* its associated element has changed.
|
|
@@ -210,10 +226,13 @@ class CdkObserveContent {
|
|
|
210
226
|
// Consider brining it back inside the zone next time we're making breaking changes.
|
|
211
227
|
// Bringing it back inside can cause things like infinite change detection loops and changed
|
|
212
228
|
// after checked errors if people's code isn't handling it properly.
|
|
213
|
-
this._ngZone.runOutsideAngular((
|
|
229
|
+
this._ngZone.runOutsideAngular((/**
|
|
230
|
+
* @return {?}
|
|
231
|
+
*/
|
|
232
|
+
() => {
|
|
214
233
|
this._currentSubscription =
|
|
215
234
|
(this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);
|
|
216
|
-
});
|
|
235
|
+
}));
|
|
217
236
|
}
|
|
218
237
|
/**
|
|
219
238
|
* @private
|
|
@@ -254,12 +273,12 @@ ObserversModule.decorators = [
|
|
|
254
273
|
|
|
255
274
|
/**
|
|
256
275
|
* @fileoverview added by tsickle
|
|
257
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
276
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
258
277
|
*/
|
|
259
278
|
|
|
260
279
|
/**
|
|
261
280
|
* @fileoverview added by tsickle
|
|
262
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
281
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
263
282
|
*/
|
|
264
283
|
|
|
265
284
|
export { MutationObserverFactory, ContentObserver, CdkObserveContent, ObserversModule };
|
package/esm2015/observers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observers.js","sources":["../../../src/cdk/observers/observe-content.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {coerceBooleanProperty, coerceNumberProperty, coerceElement} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription, Observer} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = coerceElement(elementOrRef);\n\n return new Observable((observer: Observer<MutationRecord[]>) => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n this._disabled ? this._unsubscribe() : this._subscribe();\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,AAAA,MAAa,uBAAuB,CAApC;;;;;IACE,MAAM,CAAC,QAA0B,EAAnC;QACI,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACxF;;;IAJH,EAAA,IAAA,EAAC,UAAU,EAAX,IAAA,EAAA,CAAY,EAAC,UAAU,EAAE,MAAM,EAAC,EAAhC,EAAA;;;;;;AAUA,AAAA,MAAa,eAAe,CAA5B;;;;IAQE,WAAF,CAAsB,wBAAiD,EAAvE;QAAsB,IAAtB,CAAA,wBAA8C,GAAxB,wBAAwB,CAAyB;;;;QAN7D,IAAV,CAAA,iBAA2B,GAAG,IAAI,GAAG,EAI/B,CAAC;KAEoE;;;;IAEzE,WAAW,GAAb;QACI,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;KAChF;;;;;IAcD,OAAO,CAAC,YAA2C,EAArD;;QACA,MAAU,OAAO,GAAG,aAAa,CAAC,YAAY,CAAC,CAA/C;QAEI,OAAO,IAAI,UAAU,CAAC,CAAC,QAAoC,KAA/D;;YACA,MAAY,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAlD;;YACA,MAAY,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAArD;YAEM,OAAO,MAAb;gBACQ,YAAY,CAAC,WAAW,EAAE,CAAC;gBAC3B,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;aACjC,CAAC;SACH,CAAC,CAAC;KACJ;;;;;;;;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A;IAMA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,2BAA2B,EAApC,EAAA,CAAA;IASA,QAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,CAAA;;AAmDA,MAAa,eAAe,CAA5B;;;IALA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,OAAO,EAAE,CAAC,iBAAiB,CAAC;gBAC5B,YAAY,EAAE,CAAC,iBAAiB,CAAC;gBACjC,SAAS,EAAE,CAAC,uBAAuB,CAAC;aACrC,EAAD,EAAA;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"observers.js","sources":["../../../src/cdk/observers/observe-content.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {coerceBooleanProperty, coerceNumberProperty, coerceElement} from '@angular/cdk/coercion';\nimport {\n AfterContentInit,\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n Input,\n NgModule,\n NgZone,\n OnDestroy,\n Output,\n} from '@angular/core';\nimport {Observable, Subject, Subscription, Observer} from 'rxjs';\nimport {debounceTime} from 'rxjs/operators';\n\n/**\n * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.\n * @docs-private\n */\n@Injectable({providedIn: 'root'})\nexport class MutationObserverFactory {\n create(callback: MutationCallback): MutationObserver | null {\n return typeof MutationObserver === 'undefined' ? null : new MutationObserver(callback);\n }\n}\n\n\n/** An injectable service that allows watching elements for changes to their content. */\n@Injectable({providedIn: 'root'})\nexport class ContentObserver implements OnDestroy {\n /** Keeps track of the existing MutationObservers so they can be reused. */\n private _observedElements = new Map<Element, {\n observer: MutationObserver | null,\n stream: Subject<MutationRecord[]>,\n count: number\n }>();\n\n constructor(private _mutationObserverFactory: MutationObserverFactory) {}\n\n ngOnDestroy() {\n this._observedElements.forEach((_, element) => this._cleanupObserver(element));\n }\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: Element): Observable<MutationRecord[]>;\n\n /**\n * Observe content changes on an element.\n * @param element The element to observe for content changes.\n */\n observe(element: ElementRef<Element>): Observable<MutationRecord[]>;\n\n observe(elementOrRef: Element | ElementRef<Element>): Observable<MutationRecord[]> {\n const element = coerceElement(elementOrRef);\n\n return new Observable((observer: Observer<MutationRecord[]>) => {\n const stream = this._observeElement(element);\n const subscription = stream.subscribe(observer);\n\n return () => {\n subscription.unsubscribe();\n this._unobserveElement(element);\n };\n });\n }\n\n /**\n * Observes the given element by using the existing MutationObserver if available, or creating a\n * new one if not.\n */\n private _observeElement(element: Element): Subject<MutationRecord[]> {\n if (!this._observedElements.has(element)) {\n const stream = new Subject<MutationRecord[]>();\n const observer = this._mutationObserverFactory.create(mutations => stream.next(mutations));\n if (observer) {\n observer.observe(element, {\n characterData: true,\n childList: true,\n subtree: true\n });\n }\n this._observedElements.set(element, {observer, stream, count: 1});\n } else {\n this._observedElements.get(element)!.count++;\n }\n return this._observedElements.get(element)!.stream;\n }\n\n /**\n * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is\n * observing this element.\n */\n private _unobserveElement(element: Element) {\n if (this._observedElements.has(element)) {\n this._observedElements.get(element)!.count--;\n if (!this._observedElements.get(element)!.count) {\n this._cleanupObserver(element);\n }\n }\n }\n\n /** Clean up the underlying MutationObserver for the specified element. */\n private _cleanupObserver(element: Element) {\n if (this._observedElements.has(element)) {\n const {observer, stream} = this._observedElements.get(element)!;\n if (observer) {\n observer.disconnect();\n }\n stream.complete();\n this._observedElements.delete(element);\n }\n }\n}\n\n\n/**\n * Directive that triggers a callback whenever the content of\n * its associated element has changed.\n */\n@Directive({\n selector: '[cdkObserveContent]',\n exportAs: 'cdkObserveContent',\n})\nexport class CdkObserveContent implements AfterContentInit, OnDestroy {\n /** Event emitted for each change in the element's content. */\n @Output('cdkObserveContent') event = new EventEmitter<MutationRecord[]>();\n\n /**\n * Whether observing content is disabled. This option can be used\n * to disconnect the underlying MutationObserver until it is needed.\n */\n @Input('cdkObserveContentDisabled')\n get disabled() { return this._disabled; }\n set disabled(value: any) {\n this._disabled = coerceBooleanProperty(value);\n this._disabled ? this._unsubscribe() : this._subscribe();\n }\n private _disabled = false;\n\n /** Debounce interval for emitting the changes. */\n @Input()\n get debounce(): number { return this._debounce; }\n set debounce(value: number) {\n this._debounce = coerceNumberProperty(value);\n this._subscribe();\n }\n private _debounce: number;\n\n private _currentSubscription: Subscription | null = null;\n\n constructor(private _contentObserver: ContentObserver,\n private _elementRef: ElementRef<HTMLElement>,\n private _ngZone: NgZone) {}\n\n ngAfterContentInit() {\n if (!this._currentSubscription && !this.disabled) {\n this._subscribe();\n }\n }\n\n ngOnDestroy() {\n this._unsubscribe();\n }\n\n private _subscribe() {\n this._unsubscribe();\n const stream = this._contentObserver.observe(this._elementRef);\n\n // TODO(mmalerba): We shouldn't be emitting on this @Output() outside the zone.\n // Consider brining it back inside the zone next time we're making breaking changes.\n // Bringing it back inside can cause things like infinite change detection loops and changed\n // after checked errors if people's code isn't handling it properly.\n this._ngZone.runOutsideAngular(() => {\n this._currentSubscription =\n (this.debounce ? stream.pipe(debounceTime(this.debounce)) : stream).subscribe(this.event);\n });\n }\n\n private _unsubscribe() {\n if (this._currentSubscription) {\n this._currentSubscription.unsubscribe();\n }\n }\n}\n\n\n@NgModule({\n exports: [CdkObserveContent],\n declarations: [CdkObserveContent],\n providers: [MutationObserverFactory]\n})\nexport class ObserversModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,AAAA,MAAa,uBAAuB,CAApC;;;;;IACE,MAAM,CAAC,QAA0B,EAAnC;QACI,OAAO,OAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC;KACxF;;;IAJH,EAAA,IAAA,EAAC,UAAU,EAAX,IAAA,EAAA,CAAY,EAAC,UAAU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