[6a3a178] | 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 | (function (factory) {
|
---|
| 9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
| 10 | var v = factory(require, exports);
|
---|
| 11 | if (v !== undefined) module.exports = v;
|
---|
| 12 | }
|
---|
| 13 | else if (typeof define === "function" && define.amd) {
|
---|
| 14 | define("@angular/compiler/src/style_compiler", ["require", "exports", "@angular/compiler/src/compile_metadata", "@angular/compiler/src/core", "@angular/compiler/src/output/output_ast", "@angular/compiler/src/parse_util", "@angular/compiler/src/shadow_css"], factory);
|
---|
| 15 | }
|
---|
| 16 | })(function (require, exports) {
|
---|
| 17 | "use strict";
|
---|
| 18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 19 | exports.StyleCompiler = exports.CompiledStylesheet = exports.StylesCompileDependency = exports.CONTENT_ATTR = exports.HOST_ATTR = void 0;
|
---|
| 20 | var compile_metadata_1 = require("@angular/compiler/src/compile_metadata");
|
---|
| 21 | var core_1 = require("@angular/compiler/src/core");
|
---|
| 22 | var o = require("@angular/compiler/src/output/output_ast");
|
---|
| 23 | var parse_util_1 = require("@angular/compiler/src/parse_util");
|
---|
| 24 | var shadow_css_1 = require("@angular/compiler/src/shadow_css");
|
---|
| 25 | var COMPONENT_VARIABLE = '%COMP%';
|
---|
| 26 | exports.HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
|
---|
| 27 | exports.CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
|
---|
| 28 | var StylesCompileDependency = /** @class */ (function () {
|
---|
| 29 | function StylesCompileDependency(name, moduleUrl, setValue) {
|
---|
| 30 | this.name = name;
|
---|
| 31 | this.moduleUrl = moduleUrl;
|
---|
| 32 | this.setValue = setValue;
|
---|
| 33 | }
|
---|
| 34 | return StylesCompileDependency;
|
---|
| 35 | }());
|
---|
| 36 | exports.StylesCompileDependency = StylesCompileDependency;
|
---|
| 37 | var CompiledStylesheet = /** @class */ (function () {
|
---|
| 38 | function CompiledStylesheet(outputCtx, stylesVar, dependencies, isShimmed, meta) {
|
---|
| 39 | this.outputCtx = outputCtx;
|
---|
| 40 | this.stylesVar = stylesVar;
|
---|
| 41 | this.dependencies = dependencies;
|
---|
| 42 | this.isShimmed = isShimmed;
|
---|
| 43 | this.meta = meta;
|
---|
| 44 | }
|
---|
| 45 | return CompiledStylesheet;
|
---|
| 46 | }());
|
---|
| 47 | exports.CompiledStylesheet = CompiledStylesheet;
|
---|
| 48 | var StyleCompiler = /** @class */ (function () {
|
---|
| 49 | function StyleCompiler(_urlResolver) {
|
---|
| 50 | this._urlResolver = _urlResolver;
|
---|
| 51 | this._shadowCss = new shadow_css_1.ShadowCss();
|
---|
| 52 | }
|
---|
| 53 | StyleCompiler.prototype.compileComponent = function (outputCtx, comp) {
|
---|
| 54 | var template = comp.template;
|
---|
| 55 | return this._compileStyles(outputCtx, comp, new compile_metadata_1.CompileStylesheetMetadata({
|
---|
| 56 | styles: template.styles,
|
---|
| 57 | styleUrls: template.styleUrls,
|
---|
| 58 | moduleUrl: parse_util_1.identifierModuleUrl(comp.type)
|
---|
| 59 | }), this.needsStyleShim(comp), true);
|
---|
| 60 | };
|
---|
| 61 | StyleCompiler.prototype.compileStyles = function (outputCtx, comp, stylesheet, shim) {
|
---|
| 62 | if (shim === void 0) { shim = this.needsStyleShim(comp); }
|
---|
| 63 | return this._compileStyles(outputCtx, comp, stylesheet, shim, false);
|
---|
| 64 | };
|
---|
| 65 | StyleCompiler.prototype.needsStyleShim = function (comp) {
|
---|
| 66 | return comp.template.encapsulation === core_1.ViewEncapsulation.Emulated;
|
---|
| 67 | };
|
---|
| 68 | StyleCompiler.prototype._compileStyles = function (outputCtx, comp, stylesheet, shim, isComponentStylesheet) {
|
---|
| 69 | var _this = this;
|
---|
| 70 | var styleExpressions = stylesheet.styles.map(function (plainStyle) { return o.literal(_this._shimIfNeeded(plainStyle, shim)); });
|
---|
| 71 | var dependencies = [];
|
---|
| 72 | stylesheet.styleUrls.forEach(function (styleUrl) {
|
---|
| 73 | var exprIndex = styleExpressions.length;
|
---|
| 74 | // Note: This placeholder will be filled later.
|
---|
| 75 | styleExpressions.push(null);
|
---|
| 76 | dependencies.push(new StylesCompileDependency(getStylesVarName(null), styleUrl, function (value) { return styleExpressions[exprIndex] = outputCtx.importExpr(value); }));
|
---|
| 77 | });
|
---|
| 78 | // styles variable contains plain strings and arrays of other styles arrays (recursive),
|
---|
| 79 | // so we set its type to dynamic.
|
---|
| 80 | var stylesVar = getStylesVarName(isComponentStylesheet ? comp : null);
|
---|
| 81 | var stmt = o.variable(stylesVar)
|
---|
| 82 | .set(o.literalArr(styleExpressions, new o.ArrayType(o.DYNAMIC_TYPE, [o.TypeModifier.Const])))
|
---|
| 83 | .toDeclStmt(null, isComponentStylesheet ? [o.StmtModifier.Final] : [
|
---|
| 84 | o.StmtModifier.Final, o.StmtModifier.Exported
|
---|
| 85 | ]);
|
---|
| 86 | outputCtx.statements.push(stmt);
|
---|
| 87 | return new CompiledStylesheet(outputCtx, stylesVar, dependencies, shim, stylesheet);
|
---|
| 88 | };
|
---|
| 89 | StyleCompiler.prototype._shimIfNeeded = function (style, shim) {
|
---|
| 90 | return shim ? this._shadowCss.shimCssText(style, exports.CONTENT_ATTR, exports.HOST_ATTR) : style;
|
---|
| 91 | };
|
---|
| 92 | return StyleCompiler;
|
---|
| 93 | }());
|
---|
| 94 | exports.StyleCompiler = StyleCompiler;
|
---|
| 95 | function getStylesVarName(component) {
|
---|
| 96 | var result = "styles";
|
---|
| 97 | if (component) {
|
---|
| 98 | result += "_" + parse_util_1.identifierName(component.type);
|
---|
| 99 | }
|
---|
| 100 | return result;
|
---|
| 101 | }
|
---|
| 102 | });
|
---|
| 103 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJ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