source: trip-planner-front/node_modules/@angular/compiler/src/render3/partial/directive.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 18.4 KB
Line 
1(function (factory) {
2 if (typeof module === "object" && typeof module.exports === "object") {
3 var v = factory(require, exports);
4 if (v !== undefined) module.exports = v;
5 }
6 else if (typeof define === "function" && define.amd) {
7 define("@angular/compiler/src/render3/partial/directive", ["require", "exports", "@angular/compiler/src/output/output_ast", "@angular/compiler/src/render3/r3_identifiers", "@angular/compiler/src/render3/view/compiler", "@angular/compiler/src/render3/view/util", "@angular/compiler/src/render3/partial/util"], factory);
8 }
9})(function (require, exports) {
10 "use strict";
11 Object.defineProperty(exports, "__esModule", { value: true });
12 exports.createDirectiveDefinitionMap = exports.compileDeclareDirectiveFromMetadata = void 0;
13 /**
14 * @license
15 * Copyright Google LLC All Rights Reserved.
16 *
17 * Use of this source code is governed by an MIT-style license that can be
18 * found in the LICENSE file at https://angular.io/license
19 */
20 var o = require("@angular/compiler/src/output/output_ast");
21 var r3_identifiers_1 = require("@angular/compiler/src/render3/r3_identifiers");
22 var compiler_1 = require("@angular/compiler/src/render3/view/compiler");
23 var util_1 = require("@angular/compiler/src/render3/view/util");
24 var util_2 = require("@angular/compiler/src/render3/partial/util");
25 /**
26 * Every time we make a breaking change to the declaration interface or partial-linker behavior, we
27 * must update this constant to prevent old partial-linkers from incorrectly processing the
28 * declaration.
29 *
30 * Do not include any prerelease in these versions as they are ignored.
31 */
32 var MINIMUM_PARTIAL_LINKER_VERSION = '12.0.0';
33 /**
34 * Compile a directive declaration defined by the `R3DirectiveMetadata`.
35 */
36 function compileDeclareDirectiveFromMetadata(meta) {
37 var definitionMap = createDirectiveDefinitionMap(meta);
38 var expression = o.importExpr(r3_identifiers_1.Identifiers.declareDirective).callFn([definitionMap.toLiteralMap()]);
39 var type = compiler_1.createDirectiveType(meta);
40 return { expression: expression, type: type, statements: [] };
41 }
42 exports.compileDeclareDirectiveFromMetadata = compileDeclareDirectiveFromMetadata;
43 /**
44 * Gathers the declaration fields for a directive into a `DefinitionMap`. This allows for reusing
45 * this logic for components, as they extend the directive metadata.
46 */
47 function createDirectiveDefinitionMap(meta) {
48 var definitionMap = new util_1.DefinitionMap();
49 definitionMap.set('minVersion', o.literal(MINIMUM_PARTIAL_LINKER_VERSION));
50 definitionMap.set('version', o.literal('12.2.9'));
51 // e.g. `type: MyDirective`
52 definitionMap.set('type', meta.internalType);
53 // e.g. `selector: 'some-dir'`
54 if (meta.selector !== null) {
55 definitionMap.set('selector', o.literal(meta.selector));
56 }
57 definitionMap.set('inputs', util_1.conditionallyCreateMapObjectLiteral(meta.inputs, true));
58 definitionMap.set('outputs', util_1.conditionallyCreateMapObjectLiteral(meta.outputs));
59 definitionMap.set('host', compileHostMetadata(meta.host));
60 definitionMap.set('providers', meta.providers);
61 if (meta.queries.length > 0) {
62 definitionMap.set('queries', o.literalArr(meta.queries.map(compileQuery)));
63 }
64 if (meta.viewQueries.length > 0) {
65 definitionMap.set('viewQueries', o.literalArr(meta.viewQueries.map(compileQuery)));
66 }
67 if (meta.exportAs !== null) {
68 definitionMap.set('exportAs', util_1.asLiteral(meta.exportAs));
69 }
70 if (meta.usesInheritance) {
71 definitionMap.set('usesInheritance', o.literal(true));
72 }
73 if (meta.lifecycle.usesOnChanges) {
74 definitionMap.set('usesOnChanges', o.literal(true));
75 }
76 definitionMap.set('ngImport', o.importExpr(r3_identifiers_1.Identifiers.core));
77 return definitionMap;
78 }
79 exports.createDirectiveDefinitionMap = createDirectiveDefinitionMap;
80 /**
81 * Compiles the metadata of a single query into its partial declaration form as declared
82 * by `R3DeclareQueryMetadata`.
83 */
84 function compileQuery(query) {
85 var meta = new util_1.DefinitionMap();
86 meta.set('propertyName', o.literal(query.propertyName));
87 if (query.first) {
88 meta.set('first', o.literal(true));
89 }
90 meta.set('predicate', Array.isArray(query.predicate) ? util_1.asLiteral(query.predicate) : query.predicate);
91 if (!query.emitDistinctChangesOnly) {
92 // `emitDistinctChangesOnly` is special because we expect it to be `true`.
93 // Therefore we explicitly emit the field, and explicitly place it only when it's `false`.
94 meta.set('emitDistinctChangesOnly', o.literal(false));
95 }
96 else {
97 // The linker will assume that an absent `emitDistinctChangesOnly` flag is by default `true`.
98 }
99 if (query.descendants) {
100 meta.set('descendants', o.literal(true));
101 }
102 meta.set('read', query.read);
103 if (query.static) {
104 meta.set('static', o.literal(true));
105 }
106 return meta.toLiteralMap();
107 }
108 /**
109 * Compiles the host metadata into its partial declaration form as declared
110 * in `R3DeclareDirectiveMetadata['host']`
111 */
112 function compileHostMetadata(meta) {
113 var hostMetadata = new util_1.DefinitionMap();
114 hostMetadata.set('attributes', util_2.toOptionalLiteralMap(meta.attributes, function (expression) { return expression; }));
115 hostMetadata.set('listeners', util_2.toOptionalLiteralMap(meta.listeners, o.literal));
116 hostMetadata.set('properties', util_2.toOptionalLiteralMap(meta.properties, o.literal));
117 if (meta.specialAttributes.styleAttr) {
118 hostMetadata.set('styleAttribute', o.literal(meta.specialAttributes.styleAttr));
119 }
120 if (meta.specialAttributes.classAttr) {
121 hostMetadata.set('classAttribute', o.literal(meta.specialAttributes.classAttr));
122 }
123 if (hostMetadata.values.length > 0) {
124 return hostMetadata.toLiteralMap();
125 }
126 else {
127 return null;
128 }
129 }
130});
131//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL3JlbmRlcjMvcGFydGlhbC9kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0lBQUE7Ozs7OztPQU1HO0lBQ0gsMkRBQTZDO0lBQzdDLCtFQUFvRDtJQUdwRCx3RUFBcUQ7SUFDckQsZ0VBQTJ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