@angular/material 12.2.0 → 12.2.1

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.
@@ -34,7 +34,7 @@
34
34
  * found in the LICENSE file at https://angular.io/license
35
35
  */
36
36
  /** Current version of Angular Material. */
37
- var VERSION$1 = new i0.Version('12.2.0');
37
+ var VERSION$1 = new i0.Version('12.2.1');
38
38
 
39
39
  /**
40
40
  * @license
@@ -74,7 +74,7 @@
74
74
  // i.e. avoid core to depend on the @angular/material primary entry-point
75
75
  // Can be removed once the Material primary entry-point no longer
76
76
  // re-exports all secondary entry-points
77
- var VERSION = new i0.Version('12.2.0');
77
+ var VERSION = new i0.Version('12.2.1');
78
78
  /** @docs-private */
79
79
  function MATERIAL_SANITY_CHECKS_FACTORY() {
80
80
  return true;
@@ -113,13 +113,19 @@
113
113
  var win = this._document.defaultView || window;
114
114
  return typeof win === 'object' && win ? win : null;
115
115
  };
116
- /** Whether any sanity checks are enabled. */
117
- MatCommonModule.prototype._checksAreEnabled = function () {
116
+ /** Gets whether a specific sanity check is enabled. */
117
+ MatCommonModule.prototype._checkIsEnabled = function (name) {
118
118
  // TODO(crisbeto): we can't use `ngDevMode` here yet, because ViewEngine apps might not support
119
119
  // it. Since these checks can have performance implications and they aren't tree shakeable
120
120
  // in their current form, we can leave the `isDevMode` check in for now.
121
121
  // tslint:disable-next-line:ban
122
- return i0.isDevMode() && !this._isTestEnv();
122
+ if (!i0.isDevMode() || this._isTestEnv()) {
123
+ return false;
124
+ }
125
+ if (typeof this._sanityChecks === 'boolean') {
126
+ return this._sanityChecks;
127
+ }
128
+ return !!this._sanityChecks[name];
123
129
  };
124
130
  /** Whether the code is running in tests. */
125
131
  MatCommonModule.prototype._isTestEnv = function () {
@@ -127,9 +133,7 @@
127
133
  return window && (window.__karma__ || window.jasmine);
128
134
  };
129
135
  MatCommonModule.prototype._checkDoctypeIsDefined = function () {
130
- var isEnabled = this._checksAreEnabled() &&
131
- (this._sanityChecks === true || this._sanityChecks.doctype);
132
- if (isEnabled && !this._document.doctype) {
136
+ if (this._checkIsEnabled('doctype') && !this._document.doctype) {
133
137
  console.warn('Current document does not have a doctype. This may cause ' +
134
138
  'some Angular Material components not to behave as expected.');
135
139
  }
@@ -137,9 +141,8 @@
137
141
  MatCommonModule.prototype._checkThemeIsPresent = function () {
138
142
  // We need to assert that the `body` is defined, because these checks run very early
139
143
  // and the `body` won't be defined if the consumer put their scripts in the `head`.
140
- var isDisabled = !this._checksAreEnabled() ||
141
- (this._sanityChecks === false || !this._sanityChecks.theme);
142
- if (isDisabled || !this._document.body || typeof getComputedStyle !== 'function') {
144
+ if (!this._checkIsEnabled('theme') || !this._document.body ||
145
+ typeof getComputedStyle !== 'function') {
143
146
  return;
144
147
  }
145
148
  var testElement = this._document.createElement('div');
@@ -158,9 +161,7 @@
158
161
  };
159
162
  /** Checks whether the material version matches the cdk version */
160
163
  MatCommonModule.prototype._checkCdkVersionMatch = function () {
161
- var isEnabled = this._checksAreEnabled() &&
162
- (this._sanityChecks === true || this._sanityChecks.version);
163
- if (isEnabled && VERSION.full !== cdk.VERSION.full) {
164
+ if (this._checkIsEnabled('version') && VERSION.full !== cdk.VERSION.full) {
164
165
  console.warn('The Angular Material version (' + VERSION.full + ') does not match ' +
165
166
  'the Angular CDK version (' + cdk.VERSION.full + ').\n' +
166
167
  'Please ensure the versions of these two packages exactly match.');