progress-spinner.es5.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. import { __extends } from 'tslib';
  9. import { coerceNumberProperty } from '@angular/cdk/coercion';
  10. import { Platform } from '@angular/cdk/platform';
  11. import { DOCUMENT, CommonModule } from '@angular/common';
  12. import { ChangeDetectionStrategy, Component, ElementRef, Inject, InjectionToken, Input, Optional, ViewEncapsulation, NgModule } from '@angular/core';
  13. import { mixinColor, MatCommonModule } from '@angular/material/core';
  14. import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
  15. /**
  16. * @fileoverview added by tsickle
  17. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  18. */
  19. /**
  20. * Base reference size of the spinner.
  21. * \@docs-private
  22. * @type {?}
  23. */
  24. var BASE_SIZE = 100;
  25. /**
  26. * Base reference stroke width of the spinner.
  27. * \@docs-private
  28. * @type {?}
  29. */
  30. var BASE_STROKE_WIDTH = 10;
  31. // Boilerplate for applying mixins to MatProgressSpinner.
  32. /**
  33. * \@docs-private
  34. */
  35. var
  36. // Boilerplate for applying mixins to MatProgressSpinner.
  37. /**
  38. * \@docs-private
  39. */
  40. MatProgressSpinnerBase = /** @class */ (function () {
  41. function MatProgressSpinnerBase(_elementRef) {
  42. this._elementRef = _elementRef;
  43. }
  44. return MatProgressSpinnerBase;
  45. }());
  46. /** @type {?} */
  47. var _MatProgressSpinnerMixinBase = mixinColor(MatProgressSpinnerBase, 'primary');
  48. /**
  49. * Injection token to be used to override the default options for `mat-progress-spinner`.
  50. * @type {?}
  51. */
  52. var MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS = new InjectionToken('mat-progress-spinner-default-options', {
  53. providedIn: 'root',
  54. factory: MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY,
  55. });
  56. /**
  57. * \@docs-private
  58. * @return {?}
  59. */
  60. function MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY() {
  61. return { diameter: BASE_SIZE };
  62. }
  63. // .0001 percentage difference is necessary in order to avoid unwanted animation frames
  64. // for example because the animation duration is 4 seconds, .1% accounts to 4ms
  65. // which are enough to see the flicker described in
  66. // https://github.com/angular/components/issues/8984
  67. /** @type {?} */
  68. var INDETERMINATE_ANIMATION_TEMPLATE = "\n @keyframes mat-progress-spinner-stroke-rotate-DIAMETER {\n 0% { stroke-dashoffset: START_VALUE; transform: rotate(0); }\n 12.5% { stroke-dashoffset: END_VALUE; transform: rotate(0); }\n 12.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(72.5deg); }\n 25% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(72.5deg); }\n\n 25.0001% { stroke-dashoffset: START_VALUE; transform: rotate(270deg); }\n 37.5% { stroke-dashoffset: END_VALUE; transform: rotate(270deg); }\n 37.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(161.5deg); }\n 50% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(161.5deg); }\n\n 50.0001% { stroke-dashoffset: START_VALUE; transform: rotate(180deg); }\n 62.5% { stroke-dashoffset: END_VALUE; transform: rotate(180deg); }\n 62.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(251.5deg); }\n 75% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(251.5deg); }\n\n 75.0001% { stroke-dashoffset: START_VALUE; transform: rotate(90deg); }\n 87.5% { stroke-dashoffset: END_VALUE; transform: rotate(90deg); }\n 87.5001% { stroke-dashoffset: END_VALUE; transform: rotateX(180deg) rotate(341.5deg); }\n 100% { stroke-dashoffset: START_VALUE; transform: rotateX(180deg) rotate(341.5deg); }\n }\n";
  69. /**
  70. * `<mat-progress-spinner>` component.
  71. */
  72. var MatProgressSpinner = /** @class */ (function (_super) {
  73. __extends(MatProgressSpinner, _super);
  74. function MatProgressSpinner(_elementRef, platform, _document, animationMode, defaults) {
  75. var _this = _super.call(this, _elementRef) || this;
  76. _this._elementRef = _elementRef;
  77. _this._document = _document;
  78. _this._diameter = BASE_SIZE;
  79. _this._value = 0;
  80. _this._fallbackAnimation = false;
  81. /**
  82. * Mode of the progress circle
  83. */
  84. _this.mode = 'determinate';
  85. /** @type {?} */
  86. var trackedDiameters = MatProgressSpinner._diameters;
  87. // The base size is already inserted via the component's structural styles. We still
  88. // need to track it so we don't end up adding the same styles again.
  89. if (!trackedDiameters.has(_document.head)) {
  90. trackedDiameters.set(_document.head, new Set([BASE_SIZE]));
  91. }
  92. _this._styleRoot = _getShadowRoot(_elementRef.nativeElement, _document) || _document.head;
  93. _this._fallbackAnimation = platform.EDGE || platform.TRIDENT;
  94. _this._noopAnimations = animationMode === 'NoopAnimations' &&
  95. (!!defaults && !defaults._forceAnimations);
  96. if (defaults) {
  97. if (defaults.diameter) {
  98. _this.diameter = defaults.diameter;
  99. }
  100. if (defaults.strokeWidth) {
  101. _this.strokeWidth = defaults.strokeWidth;
  102. }
  103. }
  104. // On IE and Edge, we can't animate the `stroke-dashoffset`
  105. // reliably so we fall back to a non-spec animation.
  106. /** @type {?} */
  107. var animationClass = "mat-progress-spinner-indeterminate" + (_this._fallbackAnimation ? '-fallback' : '') + "-animation";
  108. _elementRef.nativeElement.classList.add(animationClass);
  109. return _this;
  110. }
  111. Object.defineProperty(MatProgressSpinner.prototype, "diameter", {
  112. /** The diameter of the progress spinner (will set width and height of svg). */
  113. get: /**
  114. * The diameter of the progress spinner (will set width and height of svg).
  115. * @return {?}
  116. */
  117. function () { return this._diameter; },
  118. set: /**
  119. * @param {?} size
  120. * @return {?}
  121. */
  122. function (size) {
  123. this._diameter = coerceNumberProperty(size);
  124. if (!this._fallbackAnimation) {
  125. /** @type {?} */
  126. var trackedDiameters = MatProgressSpinner._diameters;
  127. /** @type {?} */
  128. var diametersForElement = trackedDiameters.get(this._styleRoot);
  129. if (!diametersForElement || !diametersForElement.has(this._diameter)) {
  130. this._attachStyleNode();
  131. }
  132. }
  133. },
  134. enumerable: true,
  135. configurable: true
  136. });
  137. Object.defineProperty(MatProgressSpinner.prototype, "strokeWidth", {
  138. /** Stroke width of the progress spinner. */
  139. get: /**
  140. * Stroke width of the progress spinner.
  141. * @return {?}
  142. */
  143. function () {
  144. return this._strokeWidth || this.diameter / 10;
  145. },
  146. set: /**
  147. * @param {?} value
  148. * @return {?}
  149. */
  150. function (value) {
  151. this._strokeWidth = coerceNumberProperty(value);
  152. },
  153. enumerable: true,
  154. configurable: true
  155. });
  156. Object.defineProperty(MatProgressSpinner.prototype, "value", {
  157. /** Value of the progress circle. */
  158. get: /**
  159. * Value of the progress circle.
  160. * @return {?}
  161. */
  162. function () {
  163. return this.mode === 'determinate' ? this._value : 0;
  164. },
  165. set: /**
  166. * @param {?} newValue
  167. * @return {?}
  168. */
  169. function (newValue) {
  170. this._value = Math.max(0, Math.min(100, coerceNumberProperty(newValue)));
  171. },
  172. enumerable: true,
  173. configurable: true
  174. });
  175. Object.defineProperty(MatProgressSpinner.prototype, "_circleRadius", {
  176. /** The radius of the spinner, adjusted for stroke width. */
  177. get: /**
  178. * The radius of the spinner, adjusted for stroke width.
  179. * @return {?}
  180. */
  181. function () {
  182. return (this.diameter - BASE_STROKE_WIDTH) / 2;
  183. },
  184. enumerable: true,
  185. configurable: true
  186. });
  187. Object.defineProperty(MatProgressSpinner.prototype, "_viewBox", {
  188. /** The view box of the spinner's svg element. */
  189. get: /**
  190. * The view box of the spinner's svg element.
  191. * @return {?}
  192. */
  193. function () {
  194. /** @type {?} */
  195. var viewBox = this._circleRadius * 2 + this.strokeWidth;
  196. return "0 0 " + viewBox + " " + viewBox;
  197. },
  198. enumerable: true,
  199. configurable: true
  200. });
  201. Object.defineProperty(MatProgressSpinner.prototype, "_strokeCircumference", {
  202. /** The stroke circumference of the svg circle. */
  203. get: /**
  204. * The stroke circumference of the svg circle.
  205. * @return {?}
  206. */
  207. function () {
  208. return 2 * Math.PI * this._circleRadius;
  209. },
  210. enumerable: true,
  211. configurable: true
  212. });
  213. Object.defineProperty(MatProgressSpinner.prototype, "_strokeDashOffset", {
  214. /** The dash offset of the svg circle. */
  215. get: /**
  216. * The dash offset of the svg circle.
  217. * @return {?}
  218. */
  219. function () {
  220. if (this.mode === 'determinate') {
  221. return this._strokeCircumference * (100 - this._value) / 100;
  222. }
  223. // In fallback mode set the circle to 80% and rotate it with CSS.
  224. if (this._fallbackAnimation && this.mode === 'indeterminate') {
  225. return this._strokeCircumference * 0.2;
  226. }
  227. return null;
  228. },
  229. enumerable: true,
  230. configurable: true
  231. });
  232. Object.defineProperty(MatProgressSpinner.prototype, "_circleStrokeWidth", {
  233. /** Stroke width of the circle in percent. */
  234. get: /**
  235. * Stroke width of the circle in percent.
  236. * @return {?}
  237. */
  238. function () {
  239. return this.strokeWidth / this.diameter * 100;
  240. },
  241. enumerable: true,
  242. configurable: true
  243. });
  244. /** Dynamically generates a style tag containing the correct animation for this diameter. */
  245. /**
  246. * Dynamically generates a style tag containing the correct animation for this diameter.
  247. * @private
  248. * @return {?}
  249. */
  250. MatProgressSpinner.prototype._attachStyleNode = /**
  251. * Dynamically generates a style tag containing the correct animation for this diameter.
  252. * @private
  253. * @return {?}
  254. */
  255. function () {
  256. /** @type {?} */
  257. var styleTag = this._document.createElement('style');
  258. /** @type {?} */
  259. var styleRoot = this._styleRoot;
  260. /** @type {?} */
  261. var currentDiameter = this._diameter;
  262. /** @type {?} */
  263. var diameters = MatProgressSpinner._diameters;
  264. /** @type {?} */
  265. var diametersForElement = diameters.get(styleRoot);
  266. styleTag.setAttribute('mat-spinner-animation', currentDiameter + '');
  267. styleTag.textContent = this._getAnimationText();
  268. styleRoot.appendChild(styleTag);
  269. if (!diametersForElement) {
  270. diametersForElement = new Set();
  271. diameters.set(styleRoot, diametersForElement);
  272. }
  273. diametersForElement.add(currentDiameter);
  274. };
  275. /** Generates animation styles adjusted for the spinner's diameter. */
  276. /**
  277. * Generates animation styles adjusted for the spinner's diameter.
  278. * @private
  279. * @return {?}
  280. */
  281. MatProgressSpinner.prototype._getAnimationText = /**
  282. * Generates animation styles adjusted for the spinner's diameter.
  283. * @private
  284. * @return {?}
  285. */
  286. function () {
  287. return INDETERMINATE_ANIMATION_TEMPLATE
  288. // Animation should begin at 5% and end at 80%
  289. .replace(/START_VALUE/g, "" + 0.95 * this._strokeCircumference)
  290. .replace(/END_VALUE/g, "" + 0.2 * this._strokeCircumference)
  291. .replace(/DIAMETER/g, "" + this.diameter);
  292. };
  293. /**
  294. * Tracks diameters of existing instances to de-dupe generated styles (default d = 100).
  295. * We need to keep track of which elements the diameters were attached to, because for
  296. * elements in the Shadow DOM the style tags are attached to the shadow root, rather
  297. * than the document head.
  298. */
  299. MatProgressSpinner._diameters = new WeakMap();
  300. MatProgressSpinner.decorators = [
  301. { type: Component, args: [{selector: 'mat-progress-spinner',
  302. exportAs: 'matProgressSpinner',
  303. host: {
  304. 'role': 'progressbar',
  305. 'class': 'mat-progress-spinner',
  306. '[class._mat-animation-noopable]': "_noopAnimations",
  307. '[style.width.px]': 'diameter',
  308. '[style.height.px]': 'diameter',
  309. '[attr.aria-valuemin]': 'mode === "determinate" ? 0 : null',
  310. '[attr.aria-valuemax]': 'mode === "determinate" ? 100 : null',
  311. '[attr.aria-valuenow]': 'mode === "determinate" ? value : null',
  312. '[attr.mode]': 'mode',
  313. },
  314. inputs: ['color'],
  315. template: "<svg [style.width.px]=\"diameter\" [style.height.px]=\"diameter\" [attr.viewBox]=\"_viewBox\" preserveAspectRatio=\"xMidYMid meet\" focusable=\"false\" [ngSwitch]=\"mode === 'indeterminate'\"><circle *ngSwitchCase=\"true\" cx=\"50%\" cy=\"50%\" [attr.r]=\"_circleRadius\" [style.animation-name]=\"'mat-progress-spinner-stroke-rotate-' + diameter\" [style.stroke-dashoffset.px]=\"_strokeDashOffset\" [style.stroke-dasharray.px]=\"_strokeCircumference\" [style.stroke-width.%]=\"_circleStrokeWidth\"></circle><circle *ngSwitchCase=\"false\" cx=\"50%\" cy=\"50%\" [attr.r]=\"_circleRadius\" [style.stroke-dashoffset.px]=\"_strokeDashOffset\" [style.stroke-dasharray.px]=\"_strokeCircumference\" [style.stroke-width.%]=\"_circleStrokeWidth\"></circle></svg>",
  316. styles: [".mat-progress-spinner{display:block;position:relative}.mat-progress-spinner svg{position:absolute;transform:rotate(-90deg);top:0;left:0;transform-origin:center;overflow:visible}.mat-progress-spinner circle{fill:transparent;transform-origin:center;transition:stroke-dashoffset 225ms linear}._mat-animation-noopable.mat-progress-spinner circle{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate]{animation:mat-progress-spinner-linear-rotate 2s linear infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate]{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate] circle{transition-property:stroke;animation-duration:4s;animation-timing-function:cubic-bezier(.35,0,.25,1);animation-iteration-count:infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate] circle{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate]{animation:mat-progress-spinner-stroke-rotate-fallback 10s cubic-bezier(.87,.03,.33,1) infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate]{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate] circle{transition-property:stroke}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate] circle{transition:none;animation:none}@keyframes mat-progress-spinner-linear-rotate{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes mat-progress-spinner-stroke-rotate-100{0%{stroke-dashoffset:268.60617px;transform:rotate(0)}12.5%{stroke-dashoffset:56.54867px;transform:rotate(0)}12.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(72.5deg)}25%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(72.5deg)}25.0001%{stroke-dashoffset:268.60617px;transform:rotate(270deg)}37.5%{stroke-dashoffset:56.54867px;transform:rotate(270deg)}37.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(161.5deg)}50%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(161.5deg)}50.0001%{stroke-dashoffset:268.60617px;transform:rotate(180deg)}62.5%{stroke-dashoffset:56.54867px;transform:rotate(180deg)}62.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(251.5deg)}75%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(251.5deg)}75.0001%{stroke-dashoffset:268.60617px;transform:rotate(90deg)}87.5%{stroke-dashoffset:56.54867px;transform:rotate(90deg)}87.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(341.5deg)}100%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(341.5deg)}}@keyframes mat-progress-spinner-stroke-rotate-fallback{0%{transform:rotate(0)}25%{transform:rotate(1170deg)}50%{transform:rotate(2340deg)}75%{transform:rotate(3510deg)}100%{transform:rotate(4680deg)}}"],
  317. changeDetection: ChangeDetectionStrategy.OnPush,
  318. encapsulation: ViewEncapsulation.None,
  319. },] },
  320. ];
  321. /** @nocollapse */
  322. MatProgressSpinner.ctorParameters = function () { return [
  323. { type: ElementRef },
  324. { type: Platform },
  325. { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
  326. { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] },
  327. { type: undefined, decorators: [{ type: Inject, args: [MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS,] }] }
  328. ]; };
  329. MatProgressSpinner.propDecorators = {
  330. diameter: [{ type: Input }],
  331. strokeWidth: [{ type: Input }],
  332. mode: [{ type: Input }],
  333. value: [{ type: Input }]
  334. };
  335. return MatProgressSpinner;
  336. }(_MatProgressSpinnerMixinBase));
  337. /**
  338. * `<mat-spinner>` component.
  339. *
  340. * This is a component definition to be used as a convenience reference to create an
  341. * indeterminate `<mat-progress-spinner>` instance.
  342. */
  343. var MatSpinner = /** @class */ (function (_super) {
  344. __extends(MatSpinner, _super);
  345. function MatSpinner(elementRef, platform, document, animationMode, defaults) {
  346. var _this = _super.call(this, elementRef, platform, document, animationMode, defaults) || this;
  347. _this.mode = 'indeterminate';
  348. return _this;
  349. }
  350. MatSpinner.decorators = [
  351. { type: Component, args: [{selector: 'mat-spinner',
  352. host: {
  353. 'role': 'progressbar',
  354. 'mode': 'indeterminate',
  355. 'class': 'mat-spinner mat-progress-spinner',
  356. '[class._mat-animation-noopable]': "_noopAnimations",
  357. '[style.width.px]': 'diameter',
  358. '[style.height.px]': 'diameter',
  359. },
  360. inputs: ['color'],
  361. template: "<svg [style.width.px]=\"diameter\" [style.height.px]=\"diameter\" [attr.viewBox]=\"_viewBox\" preserveAspectRatio=\"xMidYMid meet\" focusable=\"false\" [ngSwitch]=\"mode === 'indeterminate'\"><circle *ngSwitchCase=\"true\" cx=\"50%\" cy=\"50%\" [attr.r]=\"_circleRadius\" [style.animation-name]=\"'mat-progress-spinner-stroke-rotate-' + diameter\" [style.stroke-dashoffset.px]=\"_strokeDashOffset\" [style.stroke-dasharray.px]=\"_strokeCircumference\" [style.stroke-width.%]=\"_circleStrokeWidth\"></circle><circle *ngSwitchCase=\"false\" cx=\"50%\" cy=\"50%\" [attr.r]=\"_circleRadius\" [style.stroke-dashoffset.px]=\"_strokeDashOffset\" [style.stroke-dasharray.px]=\"_strokeCircumference\" [style.stroke-width.%]=\"_circleStrokeWidth\"></circle></svg>",
  362. styles: [".mat-progress-spinner{display:block;position:relative}.mat-progress-spinner svg{position:absolute;transform:rotate(-90deg);top:0;left:0;transform-origin:center;overflow:visible}.mat-progress-spinner circle{fill:transparent;transform-origin:center;transition:stroke-dashoffset 225ms linear}._mat-animation-noopable.mat-progress-spinner circle{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate]{animation:mat-progress-spinner-linear-rotate 2s linear infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate]{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate] circle{transition-property:stroke;animation-duration:4s;animation-timing-function:cubic-bezier(.35,0,.25,1);animation-iteration-count:infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-animation[mode=indeterminate] circle{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate]{animation:mat-progress-spinner-stroke-rotate-fallback 10s cubic-bezier(.87,.03,.33,1) infinite}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate]{transition:none;animation:none}.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate] circle{transition-property:stroke}._mat-animation-noopable.mat-progress-spinner.mat-progress-spinner-indeterminate-fallback-animation[mode=indeterminate] circle{transition:none;animation:none}@keyframes mat-progress-spinner-linear-rotate{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes mat-progress-spinner-stroke-rotate-100{0%{stroke-dashoffset:268.60617px;transform:rotate(0)}12.5%{stroke-dashoffset:56.54867px;transform:rotate(0)}12.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(72.5deg)}25%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(72.5deg)}25.0001%{stroke-dashoffset:268.60617px;transform:rotate(270deg)}37.5%{stroke-dashoffset:56.54867px;transform:rotate(270deg)}37.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(161.5deg)}50%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(161.5deg)}50.0001%{stroke-dashoffset:268.60617px;transform:rotate(180deg)}62.5%{stroke-dashoffset:56.54867px;transform:rotate(180deg)}62.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(251.5deg)}75%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(251.5deg)}75.0001%{stroke-dashoffset:268.60617px;transform:rotate(90deg)}87.5%{stroke-dashoffset:56.54867px;transform:rotate(90deg)}87.5001%{stroke-dashoffset:56.54867px;transform:rotateX(180deg) rotate(341.5deg)}100%{stroke-dashoffset:268.60617px;transform:rotateX(180deg) rotate(341.5deg)}}@keyframes mat-progress-spinner-stroke-rotate-fallback{0%{transform:rotate(0)}25%{transform:rotate(1170deg)}50%{transform:rotate(2340deg)}75%{transform:rotate(3510deg)}100%{transform:rotate(4680deg)}}"],
  363. changeDetection: ChangeDetectionStrategy.OnPush,
  364. encapsulation: ViewEncapsulation.None,
  365. },] },
  366. ];
  367. /** @nocollapse */
  368. MatSpinner.ctorParameters = function () { return [
  369. { type: ElementRef },
  370. { type: Platform },
  371. { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
  372. { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] },
  373. { type: undefined, decorators: [{ type: Inject, args: [MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS,] }] }
  374. ]; };
  375. return MatSpinner;
  376. }(MatProgressSpinner));
  377. /**
  378. * Gets the shadow root of an element, if supported and the element is inside the Shadow DOM.
  379. * @param {?} element
  380. * @param {?} _document
  381. * @return {?}
  382. */
  383. function _getShadowRoot(element, _document) {
  384. // TODO(crisbeto): see whether we should move this into the CDK
  385. // feature detection utilities once #15616 gets merged in.
  386. if (typeof window !== 'undefined') {
  387. /** @type {?} */
  388. var head = _document.head;
  389. // Check whether the browser supports Shadow DOM.
  390. if (head && (((/** @type {?} */ (head))).createShadowRoot || head.attachShadow)) {
  391. /** @type {?} */
  392. var rootNode = element.getRootNode ? element.getRootNode() : null;
  393. // We need to take the `ShadowRoot` off of `window`, because the built-in types are
  394. // incorrect. See https://github.com/Microsoft/TypeScript/issues/27929.
  395. if (rootNode instanceof ((/** @type {?} */ (window))).ShadowRoot) {
  396. return rootNode;
  397. }
  398. }
  399. }
  400. return null;
  401. }
  402. /**
  403. * @fileoverview added by tsickle
  404. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  405. */
  406. var MatProgressSpinnerModule = /** @class */ (function () {
  407. function MatProgressSpinnerModule() {
  408. }
  409. MatProgressSpinnerModule.decorators = [
  410. { type: NgModule, args: [{
  411. imports: [MatCommonModule, CommonModule],
  412. exports: [
  413. MatProgressSpinner,
  414. MatSpinner,
  415. MatCommonModule
  416. ],
  417. declarations: [
  418. MatProgressSpinner,
  419. MatSpinner
  420. ],
  421. },] },
  422. ];
  423. return MatProgressSpinnerModule;
  424. }());
  425. /**
  426. * @fileoverview added by tsickle
  427. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  428. */
  429. /**
  430. * @fileoverview added by tsickle
  431. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  432. */
  433. export { MatProgressSpinner, MatSpinner, MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS, MAT_PROGRESS_SPINNER_DEFAULT_OPTIONS_FACTORY, MatProgressSpinnerModule };
  434. //# sourceMappingURL=progress-spinner.es5.js.map