@angular/material 13.0.2 → 13.0.3

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/fesm2015/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Version, InjectionToken, isDevMode, NgModule, Optional, Inject, inject, LOCALE_ID, Injectable, Directive, Input, Component, ViewEncapsulation, ChangeDetectionStrategy, EventEmitter, Output } from '@angular/core';
2
+ import { Version, InjectionToken, NgModule, Optional, Inject, inject, LOCALE_ID, Injectable, Directive, Input, Component, ViewEncapsulation, ChangeDetectionStrategy, EventEmitter, Output } from '@angular/core';
3
3
  import { BidiModule } from '@angular/cdk/bidi';
4
4
  import { VERSION as VERSION$2 } from '@angular/cdk';
5
5
  import * as i3 from '@angular/common';
@@ -22,7 +22,7 @@ import { ENTER, SPACE, hasModifierKey } from '@angular/cdk/keycodes';
22
22
  * found in the LICENSE file at https://angular.io/license
23
23
  */
24
24
  /** Current version of Angular Material. */
25
- const VERSION$1 = new Version('13.0.2');
25
+ const VERSION$1 = new Version('13.0.3');
26
26
 
27
27
  /**
28
28
  * @license
@@ -49,7 +49,7 @@ AnimationDurations.EXITING = '195ms';
49
49
  // i.e. avoid core to depend on the @angular/material primary entry-point
50
50
  // Can be removed once the Material primary entry-point no longer
51
51
  // re-exports all secondary entry-points
52
- const VERSION = new Version('13.0.2');
52
+ const VERSION = new Version('13.0.3');
53
53
  /** @docs-private */
54
54
  function MATERIAL_SANITY_CHECKS_FACTORY() {
55
55
  return true;
@@ -66,30 +66,32 @@ const MATERIAL_SANITY_CHECKS = new InjectionToken('mat-sanity-checks', {
66
66
  * This module should be imported to each top-level component module (e.g., MatTabsModule).
67
67
  */
68
68
  class MatCommonModule {
69
- constructor(highContrastModeDetector, sanityChecks, document) {
69
+ constructor(highContrastModeDetector, _sanityChecks, _document) {
70
+ this._sanityChecks = _sanityChecks;
71
+ this._document = _document;
70
72
  /** Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype). */
71
73
  this._hasDoneGlobalChecks = false;
72
- this._document = document;
73
74
  // While A11yModule also does this, we repeat it here to avoid importing A11yModule
74
75
  // in MatCommonModule.
75
76
  highContrastModeDetector._applyBodyHighContrastModeCssClasses();
76
- // Note that `_sanityChecks` is typed to `any`, because AoT
77
- // throws an error if we use the `SanityChecks` type directly.
78
- this._sanityChecks = sanityChecks;
79
77
  if (!this._hasDoneGlobalChecks) {
80
- this._checkDoctypeIsDefined();
81
- this._checkThemeIsPresent();
82
- this._checkCdkVersionMatch();
83
78
  this._hasDoneGlobalChecks = true;
79
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
80
+ if (this._checkIsEnabled('doctype')) {
81
+ _checkDoctypeIsDefined(this._document);
82
+ }
83
+ if (this._checkIsEnabled('theme')) {
84
+ _checkThemeIsPresent(this._document);
85
+ }
86
+ if (this._checkIsEnabled('version')) {
87
+ _checkCdkVersionMatch();
88
+ }
89
+ }
84
90
  }
85
91
  }
86
92
  /** Gets whether a specific sanity check is enabled. */
87
93
  _checkIsEnabled(name) {
88
- // TODO(crisbeto): we can't use `ngDevMode` here yet, because ViewEngine apps might not support
89
- // it. Since these checks can have performance implications and they aren't tree shakeable
90
- // in their current form, we can leave the `isDevMode` check in for now.
91
- // tslint:disable-next-line:ban
92
- if (!isDevMode() || _isTestEnvironment()) {
94
+ if (_isTestEnvironment()) {
93
95
  return false;
94
96
  }
95
97
  if (typeof this._sanityChecks === 'boolean') {
@@ -97,46 +99,6 @@ class MatCommonModule {
97
99
  }
98
100
  return !!this._sanityChecks[name];
99
101
  }
100
- _checkDoctypeIsDefined() {
101
- if (this._checkIsEnabled('doctype') && !this._document.doctype) {
102
- console.warn('Current document does not have a doctype. This may cause ' +
103
- 'some Angular Material components not to behave as expected.');
104
- }
105
- }
106
- _checkThemeIsPresent() {
107
- // We need to assert that the `body` is defined, because these checks run very early
108
- // and the `body` won't be defined if the consumer put their scripts in the `head`.
109
- if (!this._checkIsEnabled('theme') ||
110
- !this._document.body ||
111
- typeof getComputedStyle !== 'function') {
112
- return;
113
- }
114
- const testElement = this._document.createElement('div');
115
- testElement.classList.add('mat-theme-loaded-marker');
116
- this._document.body.appendChild(testElement);
117
- const computedStyle = getComputedStyle(testElement);
118
- // In some situations the computed style of the test element can be null. For example in
119
- // Firefox, the computed style is null if an application is running inside of a hidden iframe.
120
- // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
121
- if (computedStyle && computedStyle.display !== 'none') {
122
- console.warn('Could not find Angular Material core theme. Most Material ' +
123
- 'components may not work as expected. For more info refer ' +
124
- 'to the theming guide: https://material.angular.io/guide/theming');
125
- }
126
- testElement.remove();
127
- }
128
- /** Checks whether the material version matches the cdk version */
129
- _checkCdkVersionMatch() {
130
- if (this._checkIsEnabled('version') && VERSION.full !== VERSION$2.full) {
131
- console.warn('The Angular Material version (' +
132
- VERSION.full +
133
- ') does not match ' +
134
- 'the Angular CDK version (' +
135
- VERSION$2.full +
136
- ').\n' +
137
- 'Please ensure the versions of these two packages exactly match.');
138
- }
139
- }
140
102
  }
141
103
  MatCommonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: MatCommonModule, deps: [{ token: i1.HighContrastModeDetector }, { token: MATERIAL_SANITY_CHECKS, optional: true }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.NgModule });
142
104
  MatCommonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.1", ngImport: i0, type: MatCommonModule, imports: [BidiModule], exports: [BidiModule] });
@@ -153,11 +115,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.1", ngImpor
153
115
  }, {
154
116
  type: Inject,
155
117
  args: [MATERIAL_SANITY_CHECKS]
156
- }] }, { type: undefined, decorators: [{
118
+ }] }, { type: Document, decorators: [{
157
119
  type: Inject,
158
120
  args: [DOCUMENT]
159
121
  }] }];
160
122
  } });
123
+ /** Checks that the page has a doctype. */
124
+ function _checkDoctypeIsDefined(doc) {
125
+ if (!doc.doctype) {
126
+ console.warn('Current document does not have a doctype. This may cause ' +
127
+ 'some Angular Material components not to behave as expected.');
128
+ }
129
+ }
130
+ /** Checks that a theme has been included. */
131
+ function _checkThemeIsPresent(doc) {
132
+ // We need to assert that the `body` is defined, because these checks run very early
133
+ // and the `body` won't be defined if the consumer put their scripts in the `head`.
134
+ if (!doc.body || typeof getComputedStyle !== 'function') {
135
+ return;
136
+ }
137
+ const testElement = doc.createElement('div');
138
+ testElement.classList.add('mat-theme-loaded-marker');
139
+ doc.body.appendChild(testElement);
140
+ const computedStyle = getComputedStyle(testElement);
141
+ // In some situations the computed style of the test element can be null. For example in
142
+ // Firefox, the computed style is null if an application is running inside of a hidden iframe.
143
+ // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
144
+ if (computedStyle && computedStyle.display !== 'none') {
145
+ console.warn('Could not find Angular Material core theme. Most Material ' +
146
+ 'components may not work as expected. For more info refer ' +
147
+ 'to the theming guide: https://material.angular.io/guide/theming');
148
+ }
149
+ testElement.remove();
150
+ }
151
+ /** Checks whether the Material version matches the CDK version. */
152
+ function _checkCdkVersionMatch() {
153
+ if (VERSION.full !== VERSION$2.full) {
154
+ console.warn('The Angular Material version (' +
155
+ VERSION.full +
156
+ ') does not match ' +
157
+ 'the Angular CDK version (' +
158
+ VERSION$2.full +
159
+ ').\n' +
160
+ 'Please ensure the versions of these two packages exactly match.');
161
+ }
162
+ }
161
163
 
162
164
  /**
163
165
  * @license