/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { HighContrastModeDetector } from '@angular/cdk/a11y'; import { BidiModule } from '@angular/cdk/bidi'; import { inject, Inject, InjectionToken, NgModule, Optional } from '@angular/core'; import { VERSION as CDK_VERSION } from '@angular/cdk'; import { DOCUMENT } from '@angular/common'; import { Platform, _isTestEnvironment } from '@angular/cdk/platform'; import { VERSION } from '../version'; import * as i0 from "@angular/core"; import * as i1 from "@angular/cdk/a11y"; /** @docs-private */ export function MATERIAL_SANITY_CHECKS_FACTORY() { return true; } /** Injection token that configures whether the Material sanity checks are enabled. */ export const MATERIAL_SANITY_CHECKS = new InjectionToken('mat-sanity-checks', { providedIn: 'root', factory: MATERIAL_SANITY_CHECKS_FACTORY, }); /** * Module that captures anything that should be loaded and/or run for *all* Angular Material * components. This includes Bidi, etc. * * This module should be imported to each top-level component module (e.g., MatTabsModule). */ export class MatCommonModule { constructor(highContrastModeDetector, _sanityChecks, _document) { this._sanityChecks = _sanityChecks; this._document = _document; /** Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype). */ this._hasDoneGlobalChecks = false; // While A11yModule also does this, we repeat it here to avoid importing A11yModule // in MatCommonModule. highContrastModeDetector._applyBodyHighContrastModeCssClasses(); if (!this._hasDoneGlobalChecks) { this._hasDoneGlobalChecks = true; if (typeof ngDevMode === 'undefined' || ngDevMode) { // Inject in here so the reference to `Platform` can be removed in production mode. const platform = inject(Platform, { optional: true }); if (this._checkIsEnabled('doctype')) { _checkDoctypeIsDefined(this._document); } if (this._checkIsEnabled('theme')) { _checkThemeIsPresent(this._document, !!platform?.isBrowser); } if (this._checkIsEnabled('version')) { _checkCdkVersionMatch(); } } } } /** Gets whether a specific sanity check is enabled. */ _checkIsEnabled(name) { if (_isTestEnvironment()) { return false; } if (typeof this._sanityChecks === 'boolean') { return this._sanityChecks; } return !!this._sanityChecks[name]; } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatCommonModule, deps: [{ token: i1.HighContrastModeDetector }, { token: MATERIAL_SANITY_CHECKS, optional: true }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.NgModule }); } static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.1", ngImport: i0, type: MatCommonModule, imports: [BidiModule], exports: [BidiModule] }); } static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatCommonModule, imports: [BidiModule, BidiModule] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.1", ngImport: i0, type: MatCommonModule, decorators: [{ type: NgModule, args: [{ imports: [BidiModule], exports: [BidiModule], }] }], ctorParameters: function () { return [{ type: i1.HighContrastModeDetector }, { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MATERIAL_SANITY_CHECKS] }] }, { type: Document, decorators: [{ type: Inject, args: [DOCUMENT] }] }]; } }); /** Checks that the page has a doctype. */ function _checkDoctypeIsDefined(doc) { if (!doc.doctype) { console.warn('Current document does not have a doctype. This may cause ' + 'some Angular Material components not to behave as expected.'); } } /** Checks that a theme has been included. */ function _checkThemeIsPresent(doc, isBrowser) { // We need to assert that the `body` is defined, because these checks run very early // and the `body` won't be defined if the consumer put their scripts in the `head`. if (!doc.body || !isBrowser) { return; } const testElement = doc.createElement('div'); testElement.classList.add('mat-theme-loaded-marker'); doc.body.appendChild(testElement); const computedStyle = getComputedStyle(testElement); // In some situations the computed style of the test element can be null. For example in // Firefox, the computed style is null if an application is running inside of a hidden iframe. // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397 if (computedStyle && computedStyle.display !== 'none') { console.warn('Could not find Angular Material core theme. Most Material ' + 'components may not work as expected. For more info refer ' + 'to the theming guide: https://material.angular.io/guide/theming'); } testElement.remove(); } /** Checks whether the Material version matches the CDK version. */ function _checkCdkVersionMatch() { if (VERSION.full !== CDK_VERSION.full) { console.warn('The Angular Material version (' + VERSION.full + ') does not match ' + 'the Angular CDK version (' + CDK_VERSION.full + ').\n' + 'Please ensure the versions of these two packages exactly match.'); } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLW1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC9jb3JlL2NvbW1vbi1iZWhhdmlvcnMvY29tbW9uLW1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsd0JBQXdCLEVBQUMsTUFBTSxtQkFBbUIsQ0FBQztBQUMzRCxPQUFPLEVBQUMsVUFBVSxFQUFDLE1BQU0sbUJBQW1CLENBQUM7QUFDN0MsT0FBTyxFQUFDLE1BQU0sRUFBRSxNQUFNLEVBQUUsY0FBYyxFQUFFLFFBQVEsRUFBRSxRQUFRLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFDakYsT0FBTyxFQUFDLE9BQU8sSUFBSSxXQUFXLEVBQUMsTUFBTSxjQUFjLENBQUM7QUFDcEQsT0FBTyxFQUFDLFFBQVEsRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBQ3pDLE9BQU8sRUFBQyxRQUFRLEVBQUUsa0JBQWtCLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQztBQUNuRSxPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sWUFBWSxDQUFDOzs7QUFFbkMsb0JBQW9CO0FBQ3BCLE1BQU0sVUFBVSw4QkFBOEI7SUFDNUMsT0FBTyxJQUFJLENBQUM7QUFDZCxDQUFDO0FBRUQsc0ZBQXNGO0FBQ3RGLE1BQU0sQ0FBQyxNQUFNLHNCQUFzQixHQUFHLElBQUksY0FBYyxDQUFlLG1CQUFtQixFQUFFO0lBQzFGLF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