@angular/language-service 7.2.0-rc.0 → 7.2.0

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v7.2.0-rc.0
2
+ * @license Angular v7.2.0
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -3379,11 +3379,13 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
3379
3379
  Identifiers.elementStart = { name: 'ɵelementStart', moduleName: CORE$1 };
3380
3380
  Identifiers.elementEnd = { name: 'ɵelementEnd', moduleName: CORE$1 };
3381
3381
  Identifiers.elementProperty = { name: 'ɵelementProperty', moduleName: CORE$1 };
3382
+ Identifiers.componentHostSyntheticProperty = { name: 'ɵcomponentHostSyntheticProperty', moduleName: CORE$1 };
3382
3383
  Identifiers.elementAttribute = { name: 'ɵelementAttribute', moduleName: CORE$1 };
3383
3384
  Identifiers.elementClassProp = { name: 'ɵelementClassProp', moduleName: CORE$1 };
3384
3385
  Identifiers.elementContainerStart = { name: 'ɵelementContainerStart', moduleName: CORE$1 };
3385
3386
  Identifiers.elementContainerEnd = { name: 'ɵelementContainerEnd', moduleName: CORE$1 };
3386
3387
  Identifiers.elementStyling = { name: 'ɵelementStyling', moduleName: CORE$1 };
3388
+ Identifiers.elementHostAttrs = { name: 'ɵelementHostAttrs', moduleName: CORE$1 };
3387
3389
  Identifiers.elementStylingMap = { name: 'ɵelementStylingMap', moduleName: CORE$1 };
3388
3390
  Identifiers.elementStyleProp = { name: 'ɵelementStyleProp', moduleName: CORE$1 };
3389
3391
  Identifiers.elementStylingApply = { name: 'ɵelementStylingApply', moduleName: CORE$1 };
@@ -4820,6 +4822,26 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
4820
4822
  }
4821
4823
  return expressionType(type, null, params);
4822
4824
  }
4825
+ var ANIMATE_SYMBOL_PREFIX = '@';
4826
+ function prepareSyntheticPropertyName(name) {
4827
+ return "" + ANIMATE_SYMBOL_PREFIX + name;
4828
+ }
4829
+ function prepareSyntheticListenerName(name, phase) {
4830
+ return "" + ANIMATE_SYMBOL_PREFIX + name + "." + phase;
4831
+ }
4832
+ function getSyntheticPropertyName(name) {
4833
+ // this will strip out listener phase values...
4834
+ // @foo.start => @foo
4835
+ var i = name.indexOf('.');
4836
+ name = i > 0 ? name.substring(0, i) : name;
4837
+ if (name.charAt(0) !== ANIMATE_SYMBOL_PREFIX) {
4838
+ name = ANIMATE_SYMBOL_PREFIX + name;
4839
+ }
4840
+ return name;
4841
+ }
4842
+ function prepareSyntheticListenerFunctionName(name, phase) {
4843
+ return "animation_" + name + "_" + phase;
4844
+ }
4823
4845
 
4824
4846
  /**
4825
4847
  * @license
@@ -8337,10 +8359,15 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
8337
8359
  *
8338
8360
  * @param value string representation of style as used in the `style` attribute in HTML.
8339
8361
  * Example: `color: red; height: auto`.
8340
- * @returns an object literal. `{ color: 'red', height: 'auto'}`.
8362
+ * @returns An array of style property name and value pairs, e.g. `['color', 'red', 'height',
8363
+ * 'auto']`
8341
8364
  */
8342
8365
  function parse(value) {
8343
- var styles = {};
8366
+ // we use a string array here instead of a string map
8367
+ // because a string-map is not guaranteed to retain the
8368
+ // order of the entries whereas a string array can be
8369
+ // construted in a [key, value, key, value] format.
8370
+ var styles = [];
8344
8371
  var i = 0;
8345
8372
  var parenDepth = 0;
8346
8373
  var quote = 0 /* QuoteNone */;
@@ -8387,7 +8414,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
8387
8414
  case 59 /* Semicolon */:
8388
8415
  if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* QuoteNone */) {
8389
8416
  var styleVal = value.substring(valueStart, i - 1).trim();
8390
- styles[currentProp] = valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal;
8417
+ styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
8391
8418
  propStart = i;
8392
8419
  valueStart = 0;
8393
8420
  currentProp = null;
@@ -8398,7 +8425,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
8398
8425
  }
8399
8426
  if (currentProp && valueStart) {
8400
8427
  var styleVal = value.substr(valueStart).trim();
8401
- styles[currentProp] = valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal;
8428
+ styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
8402
8429
  }
8403
8430
  return styles;
8404
8431
  }
@@ -8424,6 +8451,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
8424
8451
  /**
8425
8452
  * Produces creation/update instructions for all styling bindings (class and style)
8426
8453
  *
8454
+ * It also produces the creation instruction to register all initial styling values
8455
+ * (which are all the static class="..." and style="..." attribute values that exist
8456
+ * on an element within a template).
8457
+ *
8427
8458
  * The builder class below handles producing instructions for the following cases:
8428
8459
  *
8429
8460
  * - Static style/class attributes (style="..." and class="...")
@@ -8450,21 +8481,49 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
8450
8481
  function StylingBuilder(_elementIndexExpr, _directiveExpr) {
8451
8482
  this._elementIndexExpr = _elementIndexExpr;
8452
8483
  this._directiveExpr = _directiveExpr;
8453
- this.hasBindingsOrInitialValues = false;
8484
+ /** Whether or not there are any static styling values present */
8485
+ this._hasInitialValues = false;
8486
+ /**
8487
+ * Whether or not there are any styling bindings present
8488
+ * (i.e. `[style]`, `[class]`, `[style.prop]` or `[class.name]`)
8489
+ */
8490
+ this._hasBindings = false;
8491
+ /** the input for [class] (if it exists) */
8454
8492
  this._classMapInput = null;
8493
+ /** the input for [style] (if it exists) */
8455
8494
  this._styleMapInput = null;
8495
+ /** an array of each [style.prop] input */
8456
8496
  this._singleStyleInputs = null;
8497
+ /** an array of each [class.name] input */
8457
8498
  this._singleClassInputs = null;
8458
8499
  this._lastStylingInput = null;
8459
8500
  // maps are used instead of hash maps because a Map will
8460
8501
  // retain the ordering of the keys
8502
+ /**
8503
+ * Represents the location of each style binding in the template
8504
+ * (e.g. `<div [style.width]="w" [style.height]="h">` implies
8505
+ * that `width=0` and `height=1`)
8506
+ */
8461
8507
  this._stylesIndex = new Map();
8508
+ /**
8509
+ * Represents the location of each class binding in the template
8510
+ * (e.g. `<div [class.big]="b" [class.hidden]="h">` implies
8511
+ * that `big=0` and `hidden=1`)
8512
+ */
8462
8513
  this._classesIndex = new Map();
8463
- this._initialStyleValues = {};
8464
- this._initialClassValues = {};
8514
+ this._initialStyleValues = [];
8515
+ this._initialClassValues = [];
8516
+ // certain style properties ALWAYS need sanitization
8517
+ // this is checked each time new styles are encountered
8465
8518
  this._useDefaultSanitizer = false;
8466
- this._applyFnRequired = false;
8467
8519
  }
8520
+ StylingBuilder.prototype.hasBindingsOrInitialValues = function () { return this._hasBindings || this._hasInitialValues; };
8521
+ /**
8522
+ * Registers a given input to the styling builder to be later used when producing AOT code.
8523
+ *
8524
+ * The code below will only accept the input if it is somehow tied to styling (whether it be
8525
+ * style/class bindings or static style/class attributes).
8526
+ */
8468
8527
  StylingBuilder.prototype.registerBoundInput = function (input) {
8469
8528
  // [attr.style] or [attr.class] are skipped in the code below,
8470
8529
  // they should not be treated as styling-based bindings since
@@ -8498,112 +8557,149 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
8498
8557
  (this._singleStyleInputs = this._singleStyleInputs || []).push(entry);
8499
8558
  this._useDefaultSanitizer = this._useDefaultSanitizer || isStyleSanitizable(propertyName);
8500
8559
  registerIntoMap(this._stylesIndex, propertyName);
8501
- this.hasBindingsOrInitialValues = true;
8502
8560
  }
8503
8561
  else {
8504
8562
  this._useDefaultSanitizer = true;
8505
8563
  this._styleMapInput = entry;
8506
8564
  }
8507
8565
  this._lastStylingInput = entry;
8508
- this.hasBindingsOrInitialValues = true;
8509
- this._applyFnRequired = true;
8566
+ this._hasBindings = true;
8510
8567
  return entry;
8511
8568
  };
8512
8569
  StylingBuilder.prototype.registerClassInput = function (className, value, sourceSpan) {
8513
8570
  var entry = { name: className, value: value, sourceSpan: sourceSpan };
8514
8571
  if (className) {
8515
8572
  (this._singleClassInputs = this._singleClassInputs || []).push(entry);
8516
- this.hasBindingsOrInitialValues = true;
8517
8573
  registerIntoMap(this._classesIndex, className);
8518
8574
  }
8519
8575
  else {
8520
8576
  this._classMapInput = entry;
8521
8577
  }
8522
8578
  this._lastStylingInput = entry;
8523
- this.hasBindingsOrInitialValues = true;
8524
- this._applyFnRequired = true;
8579
+ this._hasBindings = true;
8525
8580
  return entry;
8526
8581
  };
8582
+ /**
8583
+ * Registers the element's static style string value to the builder.
8584
+ *
8585
+ * @param value the style string (e.g. `width:100px; height:200px;`)
8586
+ */
8527
8587
  StylingBuilder.prototype.registerStyleAttr = function (value) {
8528
- var _this = this;
8529
8588
  this._initialStyleValues = parse(value);
8530
- Object.keys(this._initialStyleValues).forEach(function (prop) {
8531
- registerIntoMap(_this._stylesIndex, prop);
8532
- _this.hasBindingsOrInitialValues = true;
8533
- });
8589
+ this._hasInitialValues = true;
8534
8590
  };
8591
+ /**
8592
+ * Registers the element's static class string value to the builder.
8593
+ *
8594
+ * @param value the className string (e.g. `disabled gold zoom`)
8595
+ */
8535
8596
  StylingBuilder.prototype.registerClassAttr = function (value) {
8536
- var _this = this;
8537
- this._initialClassValues = {};
8538
- value.split(/\s+/g).forEach(function (className) {
8539
- _this._initialClassValues[className] = true;
8540
- registerIntoMap(_this._classesIndex, className);
8541
- _this.hasBindingsOrInitialValues = true;
8542
- });
8597
+ this._initialClassValues = value.trim().split(/\s+/g);
8598
+ this._hasInitialValues = true;
8543
8599
  };
8544
- StylingBuilder.prototype._buildInitExpr = function (registry, initialValues) {
8545
- var exprs = [];
8546
- var nameAndValueExprs = [];
8547
- // _c0 = [prop, prop2, prop3, ...]
8548
- registry.forEach(function (value, key) {
8549
- var keyLiteral = literal(key);
8550
- exprs.push(keyLiteral);
8551
- var initialValue = initialValues[key];
8552
- if (initialValue) {
8553
- nameAndValueExprs.push(keyLiteral, literal(initialValue));
8600
+ /**
8601
+ * Appends all styling-related expressions to the provided attrs array.
8602
+ *
8603
+ * @param attrs an existing array where each of the styling expressions
8604
+ * will be inserted into.
8605
+ */
8606
+ StylingBuilder.prototype.populateInitialStylingAttrs = function (attrs) {
8607
+ // [CLASS_MARKER, 'foo', 'bar', 'baz' ...]
8608
+ if (this._initialClassValues.length) {
8609
+ attrs.push(literal(1 /* Classes */));
8610
+ for (var i = 0; i < this._initialClassValues.length; i++) {
8611
+ attrs.push(literal(this._initialClassValues[i]));
8612
+ }
8613
+ }
8614
+ // [STYLE_MARKER, 'width', '200px', 'height', '100px', ...]
8615
+ if (this._initialStyleValues.length) {
8616
+ attrs.push(literal(2 /* Styles */));
8617
+ for (var i = 0; i < this._initialStyleValues.length; i += 2) {
8618
+ attrs.push(literal(this._initialStyleValues[i]), literal(this._initialStyleValues[i + 1]));
8554
8619
  }
8555
- });
8556
- if (nameAndValueExprs.length) {
8557
- // _c0 = [... MARKER ...]
8558
- exprs.push(literal(1 /* VALUES_MODE */));
8559
- // _c0 = [prop, VALUE, prop2, VALUE2, ...]
8560
- exprs.push.apply(exprs, __spread(nameAndValueExprs));
8561
- }
8562
- return exprs.length ? literalArr(exprs) : null;
8563
- };
8564
- StylingBuilder.prototype.buildCreateLevelInstruction = function (sourceSpan, constantPool) {
8565
- if (this.hasBindingsOrInitialValues) {
8566
- var initialClasses = this._buildInitExpr(this._classesIndex, this._initialClassValues);
8567
- var initialStyles = this._buildInitExpr(this._stylesIndex, this._initialStyleValues);
8568
- // in the event that a [style] binding is used then sanitization will
8569
- // always be imported because it is not possible to know ahead of time
8570
- // whether style bindings will use or not use any sanitizable properties
8571
- // that isStyleSanitizable() will detect
8572
- var useSanitizer = this._useDefaultSanitizer;
8573
- var params_1 = [];
8574
- if (initialClasses) {
8575
- // the template compiler handles initial class styling (e.g. class="foo") values
8576
- // in a special command called `elementClass` so that the initial class
8577
- // can be processed during runtime. These initial class values are bound to
8578
- // a constant because the inital class values do not change (since they're static).
8579
- params_1.push(constantPool.getConstLiteral(initialClasses, true));
8580
- }
8581
- else if (initialStyles || useSanitizer || this._directiveExpr) {
8582
- // no point in having an extra `null` value unless there are follow-up params
8583
- params_1.push(NULL_EXPR);
8584
- }
8585
- if (initialStyles) {
8586
- // the template compiler handles initial style (e.g. style="foo") values
8587
- // in a special command called `elementStyle` so that the initial styles
8588
- // can be processed during runtime. These initial styles values are bound to
8589
- // a constant because the inital style values do not change (since they're static).
8590
- params_1.push(constantPool.getConstLiteral(initialStyles, true));
8591
- }
8592
- else if (useSanitizer || this._directiveExpr) {
8593
- // no point in having an extra `null` value unless there are follow-up params
8594
- params_1.push(NULL_EXPR);
8595
- }
8596
- if (useSanitizer || this._directiveExpr) {
8597
- params_1.push(useSanitizer ? importExpr(Identifiers$1.defaultStyleSanitizer) : NULL_EXPR);
8598
- if (this._directiveExpr) {
8599
- params_1.push(this._directiveExpr);
8600
- }
8601
- }
8602
- return { sourceSpan: sourceSpan, reference: Identifiers$1.elementStyling, buildParams: function () { return params_1; } };
8620
+ }
8621
+ };
8622
+ /**
8623
+ * Builds an instruction with all the expressions and parameters for `elementHostAttrs`.
8624
+ *
8625
+ * The instruction generation code below is used for producing the AOT statement code which is
8626
+ * responsible for registering initial styles (within a directive hostBindings' creation block)
8627
+ * to the directive host element.
8628
+ */
8629
+ StylingBuilder.prototype.buildDirectiveHostAttrsInstruction = function (sourceSpan, constantPool) {
8630
+ var _this = this;
8631
+ if (this._hasInitialValues && this._directiveExpr) {
8632
+ return {
8633
+ sourceSpan: sourceSpan,
8634
+ reference: Identifiers$1.elementHostAttrs,
8635
+ buildParams: function () {
8636
+ var attrs = [];
8637
+ _this.populateInitialStylingAttrs(attrs);
8638
+ return [_this._directiveExpr, getConstantLiteralFromArray(constantPool, attrs)];
8639
+ }
8640
+ };
8603
8641
  }
8604
8642
  return null;
8605
8643
  };
8606
- StylingBuilder.prototype._buildStylingMap = function (valueConverter) {
8644
+ /**
8645
+ * Builds an instruction with all the expressions and parameters for `elementStyling`.
8646
+ *
8647
+ * The instruction generation code below is used for producing the AOT statement code which is
8648
+ * responsible for registering style/class bindings to an element.
8649
+ */
8650
+ StylingBuilder.prototype.buildElementStylingInstruction = function (sourceSpan, constantPool) {
8651
+ var _this = this;
8652
+ if (this._hasBindings) {
8653
+ return {
8654
+ sourceSpan: sourceSpan,
8655
+ reference: Identifiers$1.elementStyling,
8656
+ buildParams: function () {
8657
+ // a string array of every style-based binding
8658
+ var styleBindingProps = _this._singleStyleInputs ? _this._singleStyleInputs.map(function (i) { return literal(i.name); }) : [];
8659
+ // a string array of every class-based binding
8660
+ var classBindingNames = _this._singleClassInputs ? _this._singleClassInputs.map(function (i) { return literal(i.name); }) : [];
8661
+ // to salvage space in the AOT generated code, there is no point in passing
8662
+ // in `null` into a param if any follow-up params are not used. Therefore,
8663
+ // only when a trailing param is used then it will be filled with nulls in between
8664
+ // (otherwise a shorter amount of params will be filled). The code below helps
8665
+ // determine how many params are required in the expression code.
8666
+ //
8667
+ // min params => elementStyling()
8668
+ // max params => elementStyling(classBindings, styleBindings, sanitizer, directive)
8669
+ var expectedNumberOfArgs = 0;
8670
+ if (_this._directiveExpr) {
8671
+ expectedNumberOfArgs = 4;
8672
+ }
8673
+ else if (_this._useDefaultSanitizer) {
8674
+ expectedNumberOfArgs = 3;
8675
+ }
8676
+ else if (styleBindingProps.length) {
8677
+ expectedNumberOfArgs = 2;
8678
+ }
8679
+ else if (classBindingNames.length) {
8680
+ expectedNumberOfArgs = 1;
8681
+ }
8682
+ var params = [];
8683
+ addParam(params, classBindingNames.length > 0, getConstantLiteralFromArray(constantPool, classBindingNames), 1, expectedNumberOfArgs);
8684
+ addParam(params, styleBindingProps.length > 0, getConstantLiteralFromArray(constantPool, styleBindingProps), 2, expectedNumberOfArgs);
8685
+ addParam(params, _this._useDefaultSanitizer, importExpr(Identifiers$1.defaultStyleSanitizer), 3, expectedNumberOfArgs);
8686
+ if (_this._directiveExpr) {
8687
+ params.push(_this._directiveExpr);
8688
+ }
8689
+ return params;
8690
+ }
8691
+ };
8692
+ }
8693
+ return null;
8694
+ };
8695
+ /**
8696
+ * Builds an instruction with all the expressions and parameters for `elementStylingMap`.
8697
+ *
8698
+ * The instruction data will contain all expressions for `elementStylingMap` to function
8699
+ * which include the `[style]` and `[class]` expression params (if they exist) as well as
8700
+ * the sanitizer and directive reference expression.
8701
+ */
8702
+ StylingBuilder.prototype.buildElementStylingMapInstruction = function (valueConverter) {
8607
8703
  var _this = this;
8608
8704
  if (this._classMapInput || this._styleMapInput) {
8609
8705
  var stylingInput = this._classMapInput || this._styleMapInput;
@@ -8690,18 +8786,20 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
8690
8786
  }
8691
8787
  };
8692
8788
  };
8789
+ /**
8790
+ * Constructs all instructions which contain the expressions that will be placed
8791
+ * into the update block of a template function or a directive hostBindings function.
8792
+ */
8693
8793
  StylingBuilder.prototype.buildUpdateLevelInstructions = function (valueConverter) {
8694
8794
  var instructions = [];
8695
- if (this.hasBindingsOrInitialValues) {
8696
- var mapInstruction = this._buildStylingMap(valueConverter);
8795
+ if (this._hasBindings) {
8796
+ var mapInstruction = this.buildElementStylingMapInstruction(valueConverter);
8697
8797
  if (mapInstruction) {
8698
8798
  instructions.push(mapInstruction);
8699
8799
  }
8700
8800
  instructions.push.apply(instructions, __spread(this._buildStyleInputs(valueConverter)));
8701
8801
  instructions.push.apply(instructions, __spread(this._buildClassInputs(valueConverter)));
8702
- if (this._applyFnRequired) {
8703
- instructions.push(this._buildApplyFn());
8704
- }
8802
+ instructions.push(this._buildApplyFn());
8705
8803
  }
8706
8804
  return instructions;
8707
8805
  };
@@ -8719,6 +8817,25 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
8719
8817
  return prop === 'background-image' || prop === 'background' || prop === 'border-image' ||
8720
8818
  prop === 'filter' || prop === 'list-style' || prop === 'list-style-image';
8721
8819
  }
8820
+ /**
8821
+ * Simple helper function to either provide the constant literal that will house the value
8822
+ * here or a null value if the provided values are empty.
8823
+ */
8824
+ function getConstantLiteralFromArray(constantPool, values) {
8825
+ return values.length ? constantPool.getConstLiteral(literalArr(values), true) : NULL_EXPR;
8826
+ }
8827
+ /**
8828
+ * Simple helper function that adds a parameter or does nothing at all depending on the provided
8829
+ * predicate and totalExpectedArgs values
8830
+ */
8831
+ function addParam(params, predicate, value, argNumber, totalExpectedArgs) {
8832
+ if (predicate) {
8833
+ params.push(value);
8834
+ }
8835
+ else if (argNumber < totalExpectedArgs) {
8836
+ params.push(NULL_EXPR);
8837
+ }
8838
+ }
8722
8839
 
8723
8840
  /**
8724
8841
  * @license
@@ -10350,7 +10467,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
10350
10467
  var charCode = parseInt(strNum, isHex ? 16 : 10);
10351
10468
  return String.fromCharCode(charCode);
10352
10469
  }
10353
- catch (e) {
10470
+ catch (_a) {
10354
10471
  var entity = this._input.substring(start.offset + 1, this._index - 1);
10355
10472
  throw this._createError(_unknownEntityErrorMsg(entity), this._getSpan(start));
10356
10473
  }
@@ -13316,6 +13433,9 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13316
13433
  this._hasNgContent = false;
13317
13434
  // Selectors found in the <ng-content> tags in the template.
13318
13435
  this._ngContentSelectors = [];
13436
+ // Number of non-default selectors found in all parent templates of this template. We need to
13437
+ // track it to properly adjust projection bucket index in the `projection` instruction.
13438
+ this._ngContentSelectorsOffset = 0;
13319
13439
  // These should be handled in the template or element directly.
13320
13440
  this.visitReference = invalid$1;
13321
13441
  this.visitVariable = invalid$1;
@@ -13357,8 +13477,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13357
13477
  return [lhs.set(rhs.prop(variable$$1.value || IMPLICIT_REFERENCE)).toConstDecl()];
13358
13478
  });
13359
13479
  };
13360
- TemplateDefinitionBuilder.prototype.buildTemplateFunction = function (nodes, variables, i18n) {
13480
+ TemplateDefinitionBuilder.prototype.buildTemplateFunction = function (nodes, variables, ngContentSelectorsOffset, i18n) {
13361
13481
  var _this = this;
13482
+ if (ngContentSelectorsOffset === void 0) { ngContentSelectorsOffset = 0; }
13483
+ this._ngContentSelectorsOffset = ngContentSelectorsOffset;
13362
13484
  if (this._namespace !== Identifiers$1.namespaceHTML) {
13363
13485
  this.creationInstruction(null, this._namespace);
13364
13486
  }
@@ -13379,8 +13501,20 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13379
13501
  // pass. It's necessary to separate the passes to ensure local refs are defined before
13380
13502
  // resolving bindings. We also count bindings in this pass as we walk bound expressions.
13381
13503
  visitAll$1(this, nodes);
13382
- // Output a `ProjectionDef` instruction when some `<ng-content>` are present
13383
- if (this._hasNgContent) {
13504
+ // Add total binding count to pure function count so pure function instructions are
13505
+ // generated with the correct slot offset when update instructions are processed.
13506
+ this._pureFunctionSlots += this._bindingSlots;
13507
+ // Pipes are walked in the first pass (to enqueue `pipe()` creation instructions and
13508
+ // `pipeBind` update instructions), so we have to update the slot offsets manually
13509
+ // to account for bindings.
13510
+ this._valueConverter.updatePipeSlotOffsets(this._bindingSlots);
13511
+ // Nested templates must be processed before creation instructions so template()
13512
+ // instructions can be generated with the correct internal const count.
13513
+ this._nestedTemplateFns.forEach(function (buildTemplateFn) { return buildTemplateFn(); });
13514
+ // Output the `projectionDef` instruction when some `<ng-content>` are present.
13515
+ // The `projectionDef` instruction only emitted for the component template and it is skipped for
13516
+ // nested templates (<ng-template> tags).
13517
+ if (this.level === 0 && this._hasNgContent) {
13384
13518
  var parameters = [];
13385
13519
  // Only selectors with a non-default value are generated
13386
13520
  if (this._ngContentSelectors.length) {
@@ -13395,16 +13529,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13395
13529
  // any `projection` instructions
13396
13530
  this.creationInstruction(null, Identifiers$1.projectionDef, parameters, /* prepend */ true);
13397
13531
  }
13398
- // Add total binding count to pure function count so pure function instructions are
13399
- // generated with the correct slot offset when update instructions are processed.
13400
- this._pureFunctionSlots += this._bindingSlots;
13401
- // Pipes are walked in the first pass (to enqueue `pipe()` creation instructions and
13402
- // `pipeBind` update instructions), so we have to update the slot offsets manually
13403
- // to account for bindings.
13404
- this._valueConverter.updatePipeSlotOffsets(this._bindingSlots);
13405
- // Nested templates must be processed before creation instructions so template()
13406
- // instructions can be generated with the correct internal const count.
13407
- this._nestedTemplateFns.forEach(function (buildTemplateFn) { return buildTemplateFn(); });
13408
13532
  if (initI18nContext) {
13409
13533
  this.i18nEnd(null, selfClosingI18nInstruction);
13410
13534
  }
@@ -13578,7 +13702,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13578
13702
  var slot = this.allocateDataSlot();
13579
13703
  var selectorIndex = ngContent.selector === DEFAULT_NG_CONTENT_SELECTOR ?
13580
13704
  0 :
13581
- this._ngContentSelectors.push(ngContent.selector);
13705
+ this._ngContentSelectors.push(ngContent.selector) + this._ngContentSelectorsOffset;
13582
13706
  var parameters = [literal(slot)];
13583
13707
  var attributeAsList = [];
13584
13708
  ngContent.attributes.forEach(function (attribute) {
@@ -13631,10 +13755,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13631
13755
  if (name_1 === NON_BINDABLE_ATTR) {
13632
13756
  isNonBindableMode = true;
13633
13757
  }
13634
- else if (name_1 == 'style') {
13758
+ else if (name_1 === 'style') {
13635
13759
  stylingBuilder.registerStyleAttr(value);
13636
13760
  }
13637
- else if (name_1 == 'class') {
13761
+ else if (name_1 === 'class') {
13638
13762
  stylingBuilder.registerClassAttr(value);
13639
13763
  }
13640
13764
  else if (attr.i18n) {
@@ -13664,7 +13788,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13664
13788
  var allOtherInputs = [];
13665
13789
  element.inputs.forEach(function (input) {
13666
13790
  if (!stylingBuilder.registerBoundInput(input)) {
13667
- if (input.type == 0 /* Property */) {
13791
+ if (input.type === 0 /* Property */) {
13668
13792
  if (input.i18n) {
13669
13793
  i18nAttrs.push(input);
13670
13794
  }
@@ -13680,7 +13804,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13680
13804
  outputAttrs.forEach(function (attr) { return attributes.push(literal(attr.name), literal(attr.value)); });
13681
13805
  // this will build the instructions so that they fall into the following syntax
13682
13806
  // add attributes for directive matching purposes
13683
- attributes.push.apply(attributes, __spread(this.prepareSyntheticAndSelectOnlyAttrs(allOtherInputs, element.outputs)));
13807
+ attributes.push.apply(attributes, __spread(this.prepareSyntheticAndSelectOnlyAttrs(allOtherInputs, element.outputs, stylingBuilder)));
13684
13808
  parameters.push(this.toAttrsParam(attributes));
13685
13809
  // local refs (ex.: <div #foo #bar="baz">)
13686
13810
  parameters.push(this.prepareRefsParameter(element.references));
@@ -13703,10 +13827,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13703
13827
  }
13704
13828
  return element.children.length > 0;
13705
13829
  };
13706
- var createSelfClosingInstruction = !stylingBuilder.hasBindingsOrInitialValues &&
13830
+ var createSelfClosingInstruction = !stylingBuilder.hasBindingsOrInitialValues() &&
13707
13831
  !isNgContainer$$1 && element.outputs.length === 0 && i18nAttrs.length === 0 && !hasChildren();
13708
13832
  var createSelfClosingI18nInstruction = !createSelfClosingInstruction &&
13709
- !stylingBuilder.hasBindingsOrInitialValues && hasTextChildrenOnly(element.children);
13833
+ !stylingBuilder.hasBindingsOrInitialValues() && hasTextChildrenOnly(element.children);
13710
13834
  if (createSelfClosingInstruction) {
13711
13835
  this.creationInstruction(element.sourceSpan, Identifiers$1.element, trimTrailingNulls(parameters));
13712
13836
  }
@@ -13751,13 +13875,22 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13751
13875
  }
13752
13876
  }
13753
13877
  }
13754
- // initial styling for static style="..." and class="..." attributes
13755
- this.processStylingInstruction(implicit, stylingBuilder.buildCreateLevelInstruction(element.sourceSpan, this.constantPool), true);
13878
+ // The style bindings code is placed into two distinct blocks within the template function AOT
13879
+ // code: creation and update. The creation code contains the `elementStyling` instructions
13880
+ // which will apply the collected binding values to the element. `elementStyling` is
13881
+ // designed to run inside of `elementStart` and `elementEnd`. The update instructions
13882
+ // (things like `elementStyleProp`, `elementClassProp`, etc..) are applied later on in this
13883
+ // file
13884
+ this.processStylingInstruction(implicit, stylingBuilder.buildElementStylingInstruction(element.sourceSpan, this.constantPool), true);
13756
13885
  // Generate Listeners (outputs)
13757
13886
  element.outputs.forEach(function (outputAst) {
13758
- _this.creationInstruction(outputAst.sourceSpan, Identifiers$1.listener, _this.prepareListenerParameter(element.name, outputAst));
13887
+ _this.creationInstruction(outputAst.sourceSpan, Identifiers$1.listener, _this.prepareListenerParameter(element.name, outputAst, elementIndex));
13759
13888
  });
13760
13889
  }
13890
+ // the code here will collect all update-level styling instructions and add them to the
13891
+ // update block of the template function AOT code. Instructions like `elementStyleProp`,
13892
+ // `elementStylingMap`, `elementClassProp` and `elementStylingApply` are all generated
13893
+ // and assign in the code below.
13761
13894
  stylingBuilder.buildUpdateLevelInstructions(this._valueConverter).forEach(function (instruction) {
13762
13895
  _this.processStylingInstruction(implicit, instruction, false);
13763
13896
  });
@@ -13768,11 +13901,12 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13768
13901
  var value_1 = input.value.visit(_this._valueConverter);
13769
13902
  // setProperty without a value doesn't make any sense
13770
13903
  if (value_1.name || value_1.value) {
13904
+ var bindingName_1 = prepareSyntheticPropertyName(input.name);
13771
13905
  _this.allocateBindingSlots(value_1);
13772
- var name_2 = prepareSyntheticAttributeName(input.name);
13773
13906
  _this.updateInstruction(input.sourceSpan, Identifiers$1.elementProperty, function () {
13774
13907
  return [
13775
- literal(elementIndex), literal(name_2), _this.convertPropertyBinding(implicit, value_1)
13908
+ literal(elementIndex), literal(bindingName_1),
13909
+ _this.convertPropertyBinding(implicit, value_1)
13776
13910
  ];
13777
13911
  });
13778
13912
  }
@@ -13820,8 +13954,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13820
13954
  this.i18n.appendTemplate(template.i18n, templateIndex);
13821
13955
  }
13822
13956
  var tagName = sanitizeIdentifier(template.tagName || '');
13823
- var contextName = tagName ? this.contextName + "_" + tagName : '';
13824
- var templateName = contextName ? contextName + "_Template_" + templateIndex : "Template_" + templateIndex;
13957
+ var contextName = (tagName ? this.contextName + '_' + tagName : '') + "_" + templateIndex;
13958
+ var templateName = contextName + "_Template";
13825
13959
  var parameters = [
13826
13960
  literal(templateIndex),
13827
13961
  variable(templateName),
@@ -13839,7 +13973,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13839
13973
  parameters.push(this.prepareRefsParameter(template.references));
13840
13974
  parameters.push(importExpr(Identifiers$1.templateRefExtractor));
13841
13975
  }
13842
- // handle property bindings e.g. p(1, 'forOf', ɵbind(ctx.items));
13976
+ // handle property bindings e.g. p(1, 'ngForOf', ɵbind(ctx.items));
13843
13977
  var context = variable(CONTEXT_NAME);
13844
13978
  template.inputs.forEach(function (input) {
13845
13979
  var value = input.value.visit(_this._valueConverter);
@@ -13856,10 +13990,15 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13856
13990
  // Nested templates must not be visited until after their parent templates have completed
13857
13991
  // processing, so they are queued here until after the initial pass. Otherwise, we wouldn't
13858
13992
  // be able to support bindings in nested templates to local refs that occur after the
13859
- // template definition. e.g. <div *ngIf="showing"> {{ foo }} </div> <div #foo></div>
13993
+ // template definition. e.g. <div *ngIf="showing">{{ foo }}</div> <div #foo></div>
13860
13994
  this._nestedTemplateFns.push(function () {
13861
- var templateFunctionExpr = templateVisitor.buildTemplateFunction(template.children, template.variables, template.i18n);
13995
+ var _a;
13996
+ var templateFunctionExpr = templateVisitor.buildTemplateFunction(template.children, template.variables, _this._ngContentSelectors.length + _this._ngContentSelectorsOffset, template.i18n);
13862
13997
  _this.constantPool.statements.push(templateFunctionExpr.toDeclStmt(templateName, null));
13998
+ if (templateVisitor._hasNgContent) {
13999
+ _this._hasNgContent = true;
14000
+ (_a = _this._ngContentSelectors).push.apply(_a, __spread(templateVisitor._ngContentSelectors));
14001
+ }
13863
14002
  });
13864
14003
  // e.g. template(1, MyComp_Template_1)
13865
14004
  this.creationInstruction(template.sourceSpan, Identifiers$1.templateCreate, function () {
@@ -13868,7 +14007,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13868
14007
  });
13869
14008
  // Generate listeners for directive output
13870
14009
  template.outputs.forEach(function (outputAst) {
13871
- _this.creationInstruction(outputAst.sourceSpan, Identifiers$1.listener, _this.prepareListenerParameter('ng_template', outputAst));
14010
+ _this.creationInstruction(outputAst.sourceSpan, Identifiers$1.listener, _this.prepareListenerParameter('ng_template', outputAst, templateIndex));
13872
14011
  });
13873
14012
  };
13874
14013
  TemplateDefinitionBuilder.prototype.visitBoundText = function (text) {
@@ -13993,9 +14132,47 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
13993
14132
  this.directiveMatcher.match(selector, function (cssSelector, staticType) { _this.directives.add(staticType); });
13994
14133
  }
13995
14134
  };
13996
- TemplateDefinitionBuilder.prototype.prepareSyntheticAndSelectOnlyAttrs = function (inputs, outputs) {
14135
+ /**
14136
+ * Prepares all attribute expression values for the `TAttributes` array.
14137
+ *
14138
+ * The purpose of this function is to properly construct an attributes array that
14139
+ * is passed into the `elementStart` (or just `element`) functions. Because there
14140
+ * are many different types of attributes, the array needs to be constructed in a
14141
+ * special way so that `elementStart` can properly evaluate them.
14142
+ *
14143
+ * The format looks like this:
14144
+ *
14145
+ * ```
14146
+ * attrs = [prop, value, prop2, value2,
14147
+ * CLASSES, class1, class2,
14148
+ * STYLES, style1, value1, style2, value2,
14149
+ * SELECT_ONLY, name1, name2, name2, ...]
14150
+ * ```
14151
+ */
14152
+ TemplateDefinitionBuilder.prototype.prepareSyntheticAndSelectOnlyAttrs = function (inputs, outputs, styles) {
13997
14153
  var attrExprs = [];
13998
14154
  var nonSyntheticInputs = [];
14155
+ var alreadySeen = new Set();
14156
+ function isASTWithSource(ast) {
14157
+ return ast instanceof ASTWithSource;
14158
+ }
14159
+ function isLiteralPrimitive(ast) {
14160
+ return ast instanceof LiteralPrimitive;
14161
+ }
14162
+ function addAttrExpr(key, value) {
14163
+ if (typeof key === 'string') {
14164
+ if (!alreadySeen.has(key)) {
14165
+ attrExprs.push(literal(key));
14166
+ if (value !== undefined) {
14167
+ attrExprs.push(value);
14168
+ }
14169
+ alreadySeen.add(key);
14170
+ }
14171
+ }
14172
+ else {
14173
+ attrExprs.push(literal(key));
14174
+ }
14175
+ }
13999
14176
  if (inputs.length) {
14000
14177
  var EMPTY_STRING_EXPR_1 = asLiteral('');
14001
14178
  inputs.forEach(function (input) {
@@ -14004,17 +14181,32 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14004
14181
  // may be supported differently in future versions of angular. However,
14005
14182
  // @triggers should always just be treated as regular attributes (it's up
14006
14183
  // to the renderer to detect and use them in a special way).
14007
- attrExprs.push(asLiteral(prepareSyntheticAttributeName(input.name)), EMPTY_STRING_EXPR_1);
14184
+ var valueExp = input.value;
14185
+ if (isASTWithSource(valueExp)) {
14186
+ var literal$$1 = valueExp.ast;
14187
+ if (isLiteralPrimitive(literal$$1) && literal$$1.value === undefined) {
14188
+ addAttrExpr(prepareSyntheticPropertyName(input.name), EMPTY_STRING_EXPR_1);
14189
+ }
14190
+ }
14008
14191
  }
14009
14192
  else {
14010
14193
  nonSyntheticInputs.push(input);
14011
14194
  }
14012
14195
  });
14013
14196
  }
14197
+ // it's important that this occurs before SelectOnly because once `elementStart`
14198
+ // comes across the SelectOnly marker then it will continue reading each value as
14199
+ // as single property value cell by cell.
14200
+ if (styles) {
14201
+ styles.populateInitialStylingAttrs(attrExprs);
14202
+ }
14014
14203
  if (nonSyntheticInputs.length || outputs.length) {
14015
- attrExprs.push(literal(1 /* SelectOnly */));
14016
- nonSyntheticInputs.forEach(function (i) { return attrExprs.push(asLiteral(i.name)); });
14017
- outputs.forEach(function (o) { return attrExprs.push(asLiteral(o.name)); });
14204
+ addAttrExpr(3 /* SelectOnly */);
14205
+ nonSyntheticInputs.forEach(function (i) { return addAttrExpr(i.name); });
14206
+ outputs.forEach(function (o) {
14207
+ var name = o.type === 1 /* Animation */ ? getSyntheticPropertyName(o.name) : o.name;
14208
+ addAttrExpr(name);
14209
+ });
14018
14210
  }
14019
14211
  return attrExprs;
14020
14212
  };
@@ -14045,15 +14237,20 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14045
14237
  }));
14046
14238
  return this.constantPool.getConstLiteral(asLiteral(refsParam), true);
14047
14239
  };
14048
- TemplateDefinitionBuilder.prototype.prepareListenerParameter = function (tagName, outputAst) {
14240
+ TemplateDefinitionBuilder.prototype.prepareListenerParameter = function (tagName, outputAst, index) {
14049
14241
  var _this = this;
14050
14242
  var eventName = outputAst.name;
14243
+ var bindingFnName;
14051
14244
  if (outputAst.type === 1 /* Animation */) {
14052
- eventName = prepareSyntheticAttributeName(outputAst.name + "." + outputAst.phase);
14245
+ // synthetic @listener.foo values are treated the exact same as are standard listeners
14246
+ bindingFnName = prepareSyntheticListenerFunctionName(eventName, outputAst.phase);
14247
+ eventName = prepareSyntheticListenerName(eventName, outputAst.phase);
14248
+ }
14249
+ else {
14250
+ bindingFnName = sanitizeIdentifier(eventName);
14053
14251
  }
14054
- var evNameSanitized = sanitizeIdentifier(eventName);
14055
14252
  var tagNameSanitized = sanitizeIdentifier(tagName);
14056
- var functionName = this.templateName + "_" + tagNameSanitized + "_" + evNameSanitized + "_listener";
14253
+ var functionName = this.templateName + "_" + tagNameSanitized + "_" + bindingFnName + "_" + index + "_listener";
14057
14254
  return function () {
14058
14255
  var listenerScope = _this._bindingScope.nestedScope(_this._bindingScope.bindingLevel);
14059
14256
  var bindingExpr = convertActionBinding(listenerScope, variable(CONTEXT_NAME), outputAst.handler, 'b', function () { return error('Unexpected interpolation'); });
@@ -14359,7 +14556,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14359
14556
  var value = attributes[name];
14360
14557
  cssSelector.addAttribute(name, value);
14361
14558
  if (name.toLowerCase() === 'class') {
14362
- var classes = value.trim().split(/\s+/g);
14559
+ var classes = value.trim().split(/\s+/);
14363
14560
  classes.forEach(function (className) { return cssSelector.addClassName(className); });
14364
14561
  }
14365
14562
  });
@@ -14451,16 +14648,14 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14451
14648
  return null;
14452
14649
  }
14453
14650
  }
14454
- function prepareSyntheticAttributeName(name) {
14455
- return '@' + name;
14456
- }
14457
14651
  function isSingleElementTemplate(children) {
14458
14652
  return children.length === 1 && children[0] instanceof Element$1;
14459
14653
  }
14654
+ function isTextNode(node) {
14655
+ return node instanceof Text$3 || node instanceof BoundText || node instanceof Icu$1;
14656
+ }
14460
14657
  function hasTextChildrenOnly(children) {
14461
- return !children.find(function (child) {
14462
- return !(child instanceof Text$3 || child instanceof BoundText || child instanceof Icu$1);
14463
- });
14658
+ return children.every(isTextNode);
14464
14659
  }
14465
14660
 
14466
14661
  /**
@@ -14618,6 +14813,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14618
14813
  var templateName = templateTypeName ? templateTypeName + "_Template" : null;
14619
14814
  var directivesUsed = new Set();
14620
14815
  var pipesUsed = new Set();
14816
+ var changeDetection = meta.changeDetection;
14621
14817
  var template = meta.template;
14622
14818
  var templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.ROOT_SCOPE, 0, templateTypeName, null, null, templateName, meta.viewQueries, directiveMatcher, directivesUsed, meta.pipes, pipesUsed, Identifiers$1.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds);
14623
14819
  var templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []);
@@ -14665,6 +14861,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14665
14861
  if (meta.animations !== null) {
14666
14862
  definitionMap.set('data', literalMap([{ key: 'animation', value: meta.animations, quoted: false }]));
14667
14863
  }
14864
+ // Only set the change detection flag if it's defined and it's not the default.
14865
+ if (changeDetection != null && changeDetection !== ChangeDetectionStrategy.Default) {
14866
+ definitionMap.set('changeDetection', literal(changeDetection));
14867
+ }
14668
14868
  // On the type side, remove newlines from the selector as it will need to fit into a TypeScript
14669
14869
  // string literal, which must be on one line.
14670
14870
  var selectorForType = (meta.selector || '').replace(/\n/g, '');
@@ -14857,7 +15057,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14857
15057
  // resolve literal arrays and literal objects
14858
15058
  var value = binding.expression.visit(valueConverter);
14859
15059
  var bindingExpr = bindingFn(bindingContext, value);
14860
- var _c = getBindingNameAndInstruction(name_1), bindingName = _c.bindingName, instruction = _c.instruction, extraParams = _c.extraParams;
15060
+ var _c = getBindingNameAndInstruction(binding), bindingName = _c.bindingName, instruction = _c.instruction, extraParams = _c.extraParams;
14861
15061
  var instructionParams = [
14862
15062
  elVarExp, literal(bindingName), importExpr(Identifiers$1.bind).callFn([bindingExpr.currValExpr])
14863
15063
  ];
@@ -14873,15 +15073,30 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14873
15073
  }
14874
15074
  finally { if (e_3) throw e_3.error; }
14875
15075
  }
14876
- if (styleBuilder.hasBindingsOrInitialValues) {
14877
- var createInstruction = styleBuilder.buildCreateLevelInstruction(null, constantPool);
14878
- if (createInstruction) {
14879
- var createStmt = createStylingStmt(createInstruction, bindingContext, bindingFn);
14880
- createStatements.push(createStmt);
14881
- }
15076
+ if (styleBuilder.hasBindingsOrInitialValues()) {
15077
+ // since we're dealing with directives here and directives have a hostBinding
15078
+ // function, we need to generate special instructions that deal with styling
15079
+ // (both bindings and initial values). The instruction below will instruct
15080
+ // all initial styling (styling that is inside of a host binding within a
15081
+ // directive) to be attached to the host element of the directive.
15082
+ var hostAttrsInstruction = styleBuilder.buildDirectiveHostAttrsInstruction(null, constantPool);
15083
+ if (hostAttrsInstruction) {
15084
+ createStatements.push(createStylingStmt(hostAttrsInstruction, bindingContext, bindingFn));
15085
+ }
15086
+ // singular style/class bindings (things like `[style.prop]` and `[class.name]`)
15087
+ // MUST be registered on a given element within the component/directive
15088
+ // templateFn/hostBindingsFn functions. The instruction below will figure out
15089
+ // what all the bindings are and then generate the statements required to register
15090
+ // those bindings to the element via `elementStyling`.
15091
+ var elementStylingInstruction = styleBuilder.buildElementStylingInstruction(null, constantPool);
15092
+ if (elementStylingInstruction) {
15093
+ createStatements.push(createStylingStmt(elementStylingInstruction, bindingContext, bindingFn));
15094
+ }
15095
+ // finally each binding that was registered in the statement above will need to be added to
15096
+ // the update block of a component/directive templateFn/hostBindingsFn so that the bindings
15097
+ // are evaluated and updated for the element.
14882
15098
  styleBuilder.buildUpdateLevelInstructions(valueConverter).forEach(function (instruction) {
14883
- var updateStmt = createStylingStmt(instruction, bindingContext, bindingFn);
14884
- updateStatements.push(updateStmt);
15099
+ updateStatements.push(createStylingStmt(instruction, bindingContext, bindingFn));
14885
15100
  });
14886
15101
  }
14887
15102
  }
@@ -14910,7 +15125,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14910
15125
  .callFn(params, instruction.sourceSpan)
14911
15126
  .toStmt();
14912
15127
  }
14913
- function getBindingNameAndInstruction(bindingName) {
15128
+ function getBindingNameAndInstruction(binding) {
15129
+ var bindingName = binding.name;
14914
15130
  var instruction;
14915
15131
  var extraParams = [];
14916
15132
  // Check to see if this is an attr binding or a property binding
@@ -14920,7 +15136,16 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14920
15136
  instruction = Identifiers$1.elementAttribute;
14921
15137
  }
14922
15138
  else {
14923
- instruction = Identifiers$1.elementProperty;
15139
+ if (binding.isAnimation) {
15140
+ bindingName = prepareSyntheticPropertyName(bindingName);
15141
+ // host bindings that have a synthetic property (e.g. @foo) should always be rendered
15142
+ // in the context of the component and not the parent. Therefore there is a special
15143
+ // compatibility instruction available for this purpose.
15144
+ instruction = Identifiers$1.componentHostSyntheticProperty;
15145
+ }
15146
+ else {
15147
+ instruction = Identifiers$1.elementProperty;
15148
+ }
14924
15149
  extraParams.push(literal(null), // TODO: This should be a sanitizer fn (FW-785)
14925
15150
  literal(true) // host bindings must have nativeOnly prop set to true
14926
15151
  );
@@ -14931,10 +15156,15 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14931
15156
  return eventBindings.map(function (binding) {
14932
15157
  var bindingExpr = convertActionBinding(null, bindingContext, binding.handler, 'b', function () { return error('Unexpected interpolation'); });
14933
15158
  var bindingName = binding.name && sanitizeIdentifier(binding.name);
15159
+ var bindingFnName = bindingName;
15160
+ if (binding.type === 1 /* Animation */) {
15161
+ bindingFnName = prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase);
15162
+ bindingName = prepareSyntheticListenerName(bindingName, binding.targetOrPhase);
15163
+ }
14934
15164
  var typeName = meta.name;
14935
- var functionName = typeName && bindingName ? typeName + "_" + bindingName + "_HostBindingHandler" : null;
15165
+ var functionName = typeName && bindingName ? typeName + "_" + bindingFnName + "_HostBindingHandler" : null;
14936
15166
  var handler = fn([new FnParam('$event', DYNAMIC_TYPE)], __spread(bindingExpr.render3Stmts), INFERRED_TYPE, null, functionName);
14937
- return importExpr(Identifiers$1.listener).callFn([literal(binding.name), handler]).toStmt();
15167
+ return importExpr(Identifiers$1.listener).callFn([literal(bindingName), handler]).toStmt();
14938
15168
  });
14939
15169
  }
14940
15170
  function metadataAsSummary(meta) {
@@ -14946,12 +15176,11 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14946
15176
  };
14947
15177
  // clang-format on
14948
15178
  }
14949
- var HOST_REG_EXP$1 = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
15179
+ var HOST_REG_EXP$1 = /^(?:\[([^\]]+)\])|(?:\(([^\)]+)\))$/;
14950
15180
  function parseHostBindings(host) {
14951
15181
  var attributes = {};
14952
15182
  var listeners = {};
14953
15183
  var properties = {};
14954
- var animations = {};
14955
15184
  Object.keys(host).forEach(function (key) {
14956
15185
  var value = host[key];
14957
15186
  var matches = key.match(HOST_REG_EXP$1);
@@ -14959,16 +15188,16 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
14959
15188
  attributes[key] = value;
14960
15189
  }
14961
15190
  else if (matches[1 /* Binding */] != null) {
15191
+ // synthetic properties (the ones that have a `@` as a prefix)
15192
+ // are still treated the same as regular properties. Therefore
15193
+ // there is no point in storing them in a separate map.
14962
15194
  properties[matches[1 /* Binding */]] = value;
14963
15195
  }
14964
15196
  else if (matches[2 /* Event */] != null) {
14965
15197
  listeners[matches[2 /* Event */]] = value;
14966
15198
  }
14967
- else if (matches[3 /* Animation */] != null) {
14968
- animations[matches[3 /* Animation */]] = value;
14969
- }
14970
15199
  });
14971
- return { attributes: attributes, listeners: listeners, properties: properties, animations: animations };
15200
+ return { attributes: attributes, listeners: listeners, properties: properties };
14972
15201
  }
14973
15202
  function compileStyles(styles, selector, hostSelector) {
14974
15203
  var shadowCss = new ShadowCss();
@@ -15073,7 +15302,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
15073
15302
  }
15074
15303
  // Compile the component metadata, including template, into an expression.
15075
15304
  // TODO(alxhub): implement inputs, outputs, queries, etc.
15076
- var res = compileComponentFromMetadata(__assign({}, facade, convertDirectiveFacadeToMetadata(facade), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template: template, viewQueries: facade.viewQueries.map(convertToR3QueryMetadata), wrapDirectivesAndPipesInClosure: false, styles: facade.styles || [], encapsulation: facade.encapsulation, interpolation: interpolationConfig, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
15305
+ var res = compileComponentFromMetadata(__assign({}, facade, convertDirectiveFacadeToMetadata(facade), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template: template, viewQueries: facade.viewQueries.map(convertToR3QueryMetadata), wrapDirectivesAndPipesInClosure: false, styles: facade.styles || [], encapsulation: facade.encapsulation, interpolation: interpolationConfig, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
15077
15306
  null, relativeContextFilePath: '', i18nUseExternalIds: true }), constantPool, makeBindingParser(interpolationConfig));
15078
15307
  var preStatements = __spread(constantPool.statements, res.statements);
15079
15308
  return jitExpression(res.expression, angularCoreEnv, sourceMapUrl, preStatements);
@@ -15157,10 +15386,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
15157
15386
  }
15158
15387
  function extractHostBindings(host, propMetadata) {
15159
15388
  // First parse the declarations from the metadata.
15160
- var _a = parseHostBindings(host || {}), attributes = _a.attributes, listeners = _a.listeners, properties = _a.properties, animations = _a.animations;
15161
- if (Object.keys(animations).length > 0) {
15162
- throw new Error("Animation bindings are as-of-yet unsupported in Ivy");
15163
- }
15389
+ var _a = parseHostBindings(host || {}), attributes = _a.attributes, listeners = _a.listeners, properties = _a.properties;
15164
15390
  var _loop_2 = function (field) {
15165
15391
  if (propMetadata.hasOwnProperty(field)) {
15166
15392
  propMetadata[field].forEach(function (ann) {
@@ -15210,7 +15436,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
15210
15436
  * Use of this source code is governed by an MIT-style license that can be
15211
15437
  * found in the LICENSE file at https://angular.io/license
15212
15438
  */
15213
- var VERSION$1 = new Version('7.2.0-rc.0');
15439
+ var VERSION$1 = new Version('7.2.0');
15214
15440
 
15215
15441
  /**
15216
15442
  * @license
@@ -28471,7 +28697,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
28471
28697
  /**
28472
28698
  * Use the `CheckOnce` strategy, meaning that automatic change detection is deactivated
28473
28699
  * until reactivated by setting the strategy to `Default` (`CheckAlways`).
28474
- * Change detection can still be explictly invoked.
28700
+ * Change detection can still be explicitly invoked.
28475
28701
  */
28476
28702
  ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
28477
28703
  /**
@@ -28497,7 +28723,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
28497
28723
  */
28498
28724
  ChangeDetectorStatus[ChangeDetectorStatus["Checked"] = 1] = "Checked";
28499
28725
  /**
28500
- * A state in which change detection continues automatically until explictly
28726
+ * A state in which change detection continues automatically until explicitly
28501
28727
  * deactivated.
28502
28728
  */
28503
28729
  ChangeDetectorStatus[ChangeDetectorStatus["CheckAlways"] = 2] = "CheckAlways";
@@ -28518,67 +28744,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
28518
28744
  ChangeDetectorStatus[ChangeDetectorStatus["Destroyed"] = 5] = "Destroyed";
28519
28745
  })(ChangeDetectorStatus || (ChangeDetectorStatus = {}));
28520
28746
 
28521
- /**
28522
- * @license
28523
- * Copyright Google Inc. All Rights Reserved.
28524
- *
28525
- * Use of this source code is governed by an MIT-style license that can be
28526
- * found in the LICENSE file at https://angular.io/license
28527
- */
28528
-
28529
- /**
28530
- * @license
28531
- * Copyright Google Inc. All Rights Reserved.
28532
- *
28533
- * Use of this source code is governed by an MIT-style license that can be
28534
- * found in the LICENSE file at https://angular.io/license
28535
- */
28536
- /**
28537
- * Defines template and style encapsulation options available for Component's {@link Component}.
28538
- *
28539
- * See {@link Component#encapsulation encapsulation}.
28540
- *
28541
- * @usageNotes
28542
- * ### Example
28543
- *
28544
- * {@example core/ts/metadata/encapsulation.ts region='longform'}
28545
- *
28546
- * @publicApi
28547
- */
28548
- var ViewEncapsulation$1;
28549
- (function (ViewEncapsulation) {
28550
- /**
28551
- * Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host
28552
- * Element and pre-processing the style rules provided via {@link Component#styles styles} or
28553
- * {@link Component#styleUrls styleUrls}, and adding the new Host Element attribute to all
28554
- * selectors.
28555
- *
28556
- * This is the default option.
28557
- */
28558
- ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
28559
- /**
28560
- * @deprecated v6.1.0 - use {ViewEncapsulation.ShadowDom} instead.
28561
- * Use the native encapsulation mechanism of the renderer.
28562
- *
28563
- * For the DOM this means using the deprecated [Shadow DOM
28564
- * v0](https://w3c.github.io/webcomponents/spec/shadow/) and
28565
- * creating a ShadowRoot for Component's Host Element.
28566
- */
28567
- ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native";
28568
- /**
28569
- * Don't provide any template or style encapsulation.
28570
- */
28571
- ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
28572
- /**
28573
- * Use Shadow DOM to encapsulate styles.
28574
- *
28575
- * For the DOM this means using modern [Shadow
28576
- * DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
28577
- * creating a ShadowRoot for Component's Host Element.
28578
- */
28579
- ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
28580
- })(ViewEncapsulation$1 || (ViewEncapsulation$1 = {}));
28581
-
28582
28747
  /**
28583
28748
  * @license
28584
28749
  * Copyright Google Inc. All Rights Reserved.
@@ -28652,6 +28817,116 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
28652
28817
  return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
28653
28818
  }
28654
28819
 
28820
+ /**
28821
+ * @license
28822
+ * Copyright Google Inc. All Rights Reserved.
28823
+ *
28824
+ * Use of this source code is governed by an MIT-style license that can be
28825
+ * found in the LICENSE file at https://angular.io/license
28826
+ */
28827
+ var __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty });
28828
+ /**
28829
+ * Allows to refer to references which are not yet defined.
28830
+ *
28831
+ * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
28832
+ * DI is declared, but not yet defined. It is also used when the `token` which we use when creating
28833
+ * a query is not yet defined.
28834
+ *
28835
+ * @usageNotes
28836
+ * ### Example
28837
+ * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
28838
+ * @publicApi
28839
+ */
28840
+ function forwardRef(forwardRefFn) {
28841
+ forwardRefFn.__forward_ref__ = forwardRef;
28842
+ forwardRefFn.toString = function () { return stringify$1(this()); };
28843
+ return forwardRefFn;
28844
+ }
28845
+ /**
28846
+ * Lazily retrieves the reference value from a forwardRef.
28847
+ *
28848
+ * Acts as the identity function when given a non-forward-ref value.
28849
+ *
28850
+ * @usageNotes
28851
+ * ### Example
28852
+ *
28853
+ * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
28854
+ *
28855
+ * @see `forwardRef`
28856
+ * @publicApi
28857
+ */
28858
+ function resolveForwardRef$1(type) {
28859
+ var fn = type;
28860
+ if (typeof fn === 'function' && fn.hasOwnProperty(__forward_ref__) &&
28861
+ fn.__forward_ref__ === forwardRef) {
28862
+ return fn();
28863
+ }
28864
+ else {
28865
+ return type;
28866
+ }
28867
+ }
28868
+
28869
+ /**
28870
+ * @license
28871
+ * Copyright Google Inc. All Rights Reserved.
28872
+ *
28873
+ * Use of this source code is governed by an MIT-style license that can be
28874
+ * found in the LICENSE file at https://angular.io/license
28875
+ */
28876
+
28877
+ /**
28878
+ * @license
28879
+ * Copyright Google Inc. All Rights Reserved.
28880
+ *
28881
+ * Use of this source code is governed by an MIT-style license that can be
28882
+ * found in the LICENSE file at https://angular.io/license
28883
+ */
28884
+ /**
28885
+ * Defines template and style encapsulation options available for Component's {@link Component}.
28886
+ *
28887
+ * See {@link Component#encapsulation encapsulation}.
28888
+ *
28889
+ * @usageNotes
28890
+ * ### Example
28891
+ *
28892
+ * {@example core/ts/metadata/encapsulation.ts region='longform'}
28893
+ *
28894
+ * @publicApi
28895
+ */
28896
+ var ViewEncapsulation$1;
28897
+ (function (ViewEncapsulation) {
28898
+ /**
28899
+ * Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host
28900
+ * Element and pre-processing the style rules provided via {@link Component#styles styles} or
28901
+ * {@link Component#styleUrls styleUrls}, and adding the new Host Element attribute to all
28902
+ * selectors.
28903
+ *
28904
+ * This is the default option.
28905
+ */
28906
+ ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
28907
+ /**
28908
+ * @deprecated v6.1.0 - use {ViewEncapsulation.ShadowDom} instead.
28909
+ * Use the native encapsulation mechanism of the renderer.
28910
+ *
28911
+ * For the DOM this means using the deprecated [Shadow DOM
28912
+ * v0](https://w3c.github.io/webcomponents/spec/shadow/) and
28913
+ * creating a ShadowRoot for Component's Host Element.
28914
+ */
28915
+ ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native";
28916
+ /**
28917
+ * Don't provide any template or style encapsulation.
28918
+ */
28919
+ ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
28920
+ /**
28921
+ * Use Shadow DOM to encapsulate styles.
28922
+ *
28923
+ * For the DOM this means using modern [Shadow
28924
+ * DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
28925
+ * creating a ShadowRoot for Component's Host Element.
28926
+ */
28927
+ ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
28928
+ })(ViewEncapsulation$1 || (ViewEncapsulation$1 = {}));
28929
+
28655
28930
  /**
28656
28931
  * @license
28657
28932
  * Copyright Google Inc. All Rights Reserved.
@@ -28710,6 +28985,27 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
28710
28985
  ngDevModeResetPerfCounters();
28711
28986
  }
28712
28987
 
28988
+ /**
28989
+ * @license
28990
+ * Copyright Google Inc. All Rights Reserved.
28991
+ *
28992
+ * Use of this source code is governed by an MIT-style license that can be
28993
+ * found in the LICENSE file at https://angular.io/license
28994
+ */
28995
+ /**
28996
+ * This file contains reuseable "empty" symbols that can be used as default return values
28997
+ * in different parts of the rendering code. Because the same symbols are returned, this
28998
+ * allows for identity checks against these values to be consistently used by the framework
28999
+ * code.
29000
+ */
29001
+ var EMPTY_OBJ = {};
29002
+ var EMPTY_ARRAY$1 = [];
29003
+ // freezing the values prevents any code from accidentally inserting new values in
29004
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
29005
+ Object.freeze(EMPTY_OBJ);
29006
+ Object.freeze(EMPTY_ARRAY$1);
29007
+ }
29008
+
28713
29009
  /**
28714
29010
  * @license
28715
29011
  * Copyright Google Inc. All Rights Reserved.
@@ -28717,12 +29013,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
28717
29013
  * Use of this source code is governed by an MIT-style license that can be
28718
29014
  * found in the LICENSE file at https://angular.io/license
28719
29015
  */
28720
- var EMPTY = {};
28721
- var EMPTY_ARRAY$1 = [];
28722
- if (typeof ngDevMode !== 'undefined' && ngDevMode) {
28723
- Object.freeze(EMPTY);
28724
- Object.freeze(EMPTY_ARRAY$1);
28725
- }
28726
29016
  /**
28727
29017
  * The following getter methods retrieve the definition form the type. Currently the retrieval
28728
29018
  * honors inheritance, but in the future we may change the rule to require that definitions are
@@ -28739,6 +29029,430 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
28739
29029
  return ngModuleDef;
28740
29030
  }
28741
29031
 
29032
+ /**
29033
+ * @license
29034
+ * Copyright Google Inc. All Rights Reserved.
29035
+ *
29036
+ * Use of this source code is governed by an MIT-style license that can be
29037
+ * found in the LICENSE file at https://angular.io/license
29038
+ */
29039
+ function assertEqual(actual, expected, msg) {
29040
+ if (actual != expected) {
29041
+ throwError(msg);
29042
+ }
29043
+ }
29044
+ function assertNotEqual(actual, expected, msg) {
29045
+ if (actual == expected) {
29046
+ throwError(msg);
29047
+ }
29048
+ }
29049
+ function assertLessThan(actual, expected, msg) {
29050
+ if (actual >= expected) {
29051
+ throwError(msg);
29052
+ }
29053
+ }
29054
+ function assertGreaterThan(actual, expected, msg) {
29055
+ if (actual <= expected) {
29056
+ throwError(msg);
29057
+ }
29058
+ }
29059
+ function assertDefined(actual, msg) {
29060
+ if (actual == null) {
29061
+ throwError(msg);
29062
+ }
29063
+ }
29064
+ function assertComponentType(actual, msg) {
29065
+ if (msg === void 0) { msg = 'Type passed in is not ComponentType, it does not have \'ngComponentDef\' property.'; }
29066
+ if (!getComponentDef(actual)) {
29067
+ throwError(msg);
29068
+ }
29069
+ }
29070
+ function throwError(msg) {
29071
+ // tslint:disable-next-line
29072
+ debugger; // Left intentionally for better debugger experience.
29073
+ throw new Error("ASSERTION ERROR: " + msg);
29074
+ }
29075
+ function assertDomNode(node) {
29076
+ assertEqual(node instanceof Node, true, 'The provided value must be an instance of a DOM Node');
29077
+ }
29078
+ function assertPreviousIsParent(isParent) {
29079
+ assertEqual(isParent, true, 'previousOrParentTNode should be a parent');
29080
+ }
29081
+ function assertDataInRange(arr, index) {
29082
+ assertLessThan(index, arr ? arr.length : 0, 'index expected to be a valid data index');
29083
+ }
29084
+
29085
+ /**
29086
+ * @license
29087
+ * Copyright Google Inc. All Rights Reserved.
29088
+ *
29089
+ * Use of this source code is governed by an MIT-style license that can be
29090
+ * found in the LICENSE file at https://angular.io/license
29091
+ */
29092
+ // Below are constants for LView indices to help us look up LView members
29093
+ // without having to remember the specific indices.
29094
+ // Uglify will inline these when minifying so there shouldn't be a cost.
29095
+ var TVIEW = 0;
29096
+ var FLAGS = 1;
29097
+ var PARENT = 2;
29098
+ var NEXT = 3;
29099
+ var QUERIES = 4;
29100
+ var HOST = 5;
29101
+ var HOST_NODE = 6; // Rename to `T_HOST`?
29102
+ var BINDING_INDEX = 7;
29103
+ var CLEANUP = 8;
29104
+ var CONTEXT = 9;
29105
+ var INJECTOR = 10;
29106
+ var RENDERER_FACTORY = 11;
29107
+ var RENDERER = 12;
29108
+ var SANITIZER = 13;
29109
+ var TAIL = 14;
29110
+ var CONTAINER_INDEX = 15;
29111
+ var DECLARATION_VIEW = 17;
29112
+ /** Size of LView's header. Necessary to adjust for it when setting slots. */
29113
+ var HEADER_OFFSET = 18;
29114
+
29115
+ /**
29116
+ * @license
29117
+ * Copyright Google Inc. All Rights Reserved.
29118
+ *
29119
+ * Use of this source code is governed by an MIT-style license that can be
29120
+ * found in the LICENSE file at https://angular.io/license
29121
+ */
29122
+ /**
29123
+ * Below are constants for LContainer indices to help us look up LContainer members
29124
+ * without having to remember the specific indices.
29125
+ * Uglify will inline these when minifying so there shouldn't be a cost.
29126
+ */
29127
+ var ACTIVE_INDEX = 0;
29128
+ var VIEWS = 1;
29129
+ // PARENT, NEXT, QUERIES, and HOST are indices 2, 3, 4, and 5.
29130
+ // As we already have these constants in LView, we don't need to re-create them.
29131
+ var NATIVE = 6;
29132
+ var RENDER_PARENT = 7;
29133
+ // Because interfaces in TS/JS cannot be instanceof-checked this means that we
29134
+ // need to rely on predictable characteristics of data-structures to check if they
29135
+ // are what we expect for them to be. The `LContainer` interface code below has a
29136
+ // fixed length and the constant value below references that. Using the length value
29137
+ // below we can predictably gaurantee that we are dealing with an `LContainer` array.
29138
+ // This value MUST be kept up to date with the length of the `LContainer` array
29139
+ // interface below so that runtime type checking can work.
29140
+ var LCONTAINER_LENGTH = 8;
29141
+
29142
+ /**
29143
+ * @license
29144
+ * Copyright Google Inc. All Rights Reserved.
29145
+ *
29146
+ * Use of this source code is governed by an MIT-style license that can be
29147
+ * found in the LICENSE file at https://angular.io/license
29148
+ */
29149
+ /**
29150
+ * This property will be monkey-patched on elements, components and directives
29151
+ */
29152
+ var MONKEY_PATCH_KEY_NAME = '__ngContext__';
29153
+
29154
+ /**
29155
+ * @license
29156
+ * Copyright Google Inc. All Rights Reserved.
29157
+ *
29158
+ * Use of this source code is governed by an MIT-style license that can be
29159
+ * found in the LICENSE file at https://angular.io/license
29160
+ */
29161
+ var TNODE = 8;
29162
+ var PARENT_INJECTOR = 8;
29163
+ var INJECTOR_BLOOM_PARENT_SIZE = 9;
29164
+ var NO_PARENT_INJECTOR = -1;
29165
+ /**
29166
+ * Each injector is saved in 9 contiguous slots in `LView` and 9 contiguous slots in
29167
+ * `TView.data`. This allows us to store information about the current node's tokens (which
29168
+ * can be shared in `TView`) as well as the tokens of its ancestor nodes (which cannot be
29169
+ * shared, so they live in `LView`).
29170
+ *
29171
+ * Each of these slots (aside from the last slot) contains a bloom filter. This bloom filter
29172
+ * determines whether a directive is available on the associated node or not. This prevents us
29173
+ * from searching the directives array at this level unless it's probable the directive is in it.
29174
+ *
29175
+ * See: https://en.wikipedia.org/wiki/Bloom_filter for more about bloom filters.
29176
+ *
29177
+ * Because all injectors have been flattened into `LView` and `TViewData`, they cannot typed
29178
+ * using interfaces as they were previously. The start index of each `LInjector` and `TInjector`
29179
+ * will differ based on where it is flattened into the main array, so it's not possible to know
29180
+ * the indices ahead of time and save their types here. The interfaces are still included here
29181
+ * for documentation purposes.
29182
+ *
29183
+ * export interface LInjector extends Array<any> {
29184
+ *
29185
+ * // Cumulative bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)
29186
+ * [0]: number;
29187
+ *
29188
+ * // Cumulative bloom for directive IDs 32-63
29189
+ * [1]: number;
29190
+ *
29191
+ * // Cumulative bloom for directive IDs 64-95
29192
+ * [2]: number;
29193
+ *
29194
+ * // Cumulative bloom for directive IDs 96-127
29195
+ * [3]: number;
29196
+ *
29197
+ * // Cumulative bloom for directive IDs 128-159
29198
+ * [4]: number;
29199
+ *
29200
+ * // Cumulative bloom for directive IDs 160 - 191
29201
+ * [5]: number;
29202
+ *
29203
+ * // Cumulative bloom for directive IDs 192 - 223
29204
+ * [6]: number;
29205
+ *
29206
+ * // Cumulative bloom for directive IDs 224 - 255
29207
+ * [7]: number;
29208
+ *
29209
+ * // We need to store a reference to the injector's parent so DI can keep looking up
29210
+ * // the injector tree until it finds the dependency it's looking for.
29211
+ * [PARENT_INJECTOR]: number;
29212
+ * }
29213
+ *
29214
+ * export interface TInjector extends Array<any> {
29215
+ *
29216
+ * // Shared node bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)
29217
+ * [0]: number;
29218
+ *
29219
+ * // Shared node bloom for directive IDs 32-63
29220
+ * [1]: number;
29221
+ *
29222
+ * // Shared node bloom for directive IDs 64-95
29223
+ * [2]: number;
29224
+ *
29225
+ * // Shared node bloom for directive IDs 96-127
29226
+ * [3]: number;
29227
+ *
29228
+ * // Shared node bloom for directive IDs 128-159
29229
+ * [4]: number;
29230
+ *
29231
+ * // Shared node bloom for directive IDs 160 - 191
29232
+ * [5]: number;
29233
+ *
29234
+ * // Shared node bloom for directive IDs 192 - 223
29235
+ * [6]: number;
29236
+ *
29237
+ * // Shared node bloom for directive IDs 224 - 255
29238
+ * [7]: number;
29239
+ *
29240
+ * // Necessary to find directive indices for a particular node.
29241
+ * [TNODE]: TElementNode|TElementContainerNode|TContainerNode;
29242
+ * }
29243
+ */
29244
+ /**
29245
+ * Factory for creating instances of injectors in the NodeInjector.
29246
+ *
29247
+ * This factory is complicated by the fact that it can resolve `multi` factories as well.
29248
+ *
29249
+ * NOTE: Some of the fields are optional which means that this class has two hidden classes.
29250
+ * - One without `multi` support (most common)
29251
+ * - One with `multi` values, (rare).
29252
+ *
29253
+ * Since VMs can cache up to 4 inline hidden classes this is OK.
29254
+ *
29255
+ * - Single factory: Only `resolving` and `factory` is defined.
29256
+ * - `providers` factory: `componentProviders` is a number and `index = -1`.
29257
+ * - `viewProviders` factory: `componentProviders` is a number and `index` points to `providers`.
29258
+ */
29259
+ var NodeInjectorFactory = /** @class */ (function () {
29260
+ function NodeInjectorFactory(
29261
+ /**
29262
+ * Factory to invoke in order to create a new instance.
29263
+ */
29264
+ factory,
29265
+ /**
29266
+ * Set to `true` if the token is declared in `viewProviders` (or if it is component).
29267
+ */
29268
+ isViewProvider, injectImplementation) {
29269
+ this.factory = factory;
29270
+ /**
29271
+ * Marker set to true during factory invocation to see if we get into recursive loop.
29272
+ * Recursive loop causes an error to be displayed.
29273
+ */
29274
+ this.resolving = false;
29275
+ this.canSeeViewProviders = isViewProvider;
29276
+ this.injectImpl = injectImplementation;
29277
+ }
29278
+ return NodeInjectorFactory;
29279
+ }());
29280
+ var FactoryPrototype = NodeInjectorFactory.prototype;
29281
+ function isFactory(obj) {
29282
+ // See: https://jsperf.com/instanceof-vs-getprototypeof
29283
+ return obj != null && typeof obj == 'object' && Object.getPrototypeOf(obj) == FactoryPrototype;
29284
+ }
29285
+
29286
+ /**
29287
+ * @license
29288
+ * Copyright Google Inc. All Rights Reserved.
29289
+ *
29290
+ * Use of this source code is governed by an MIT-style license that can be
29291
+ * found in the LICENSE file at https://angular.io/license
29292
+ */
29293
+ function stringify$2(value) {
29294
+ if (typeof value == 'function')
29295
+ return value.name || value;
29296
+ if (typeof value == 'string')
29297
+ return value;
29298
+ if (value == null)
29299
+ return '';
29300
+ if (typeof value == 'object' && typeof value.type == 'function')
29301
+ return value.type.name || value.type;
29302
+ return '' + value;
29303
+ }
29304
+ /**
29305
+ * Flattens an array in non-recursive way. Input arrays are not modified.
29306
+ */
29307
+ function flatten$2(list) {
29308
+ var result = [];
29309
+ var i = 0;
29310
+ while (i < list.length) {
29311
+ var item = list[i];
29312
+ if (Array.isArray(item)) {
29313
+ if (item.length > 0) {
29314
+ list = item.concat(list.slice(i + 1));
29315
+ i = 0;
29316
+ }
29317
+ else {
29318
+ i++;
29319
+ }
29320
+ }
29321
+ else {
29322
+ result.push(item);
29323
+ i++;
29324
+ }
29325
+ }
29326
+ return result;
29327
+ }
29328
+ /**
29329
+ * Takes the value of a slot in `LView` and returns the element node.
29330
+ *
29331
+ * Normally, element nodes are stored flat, but if the node has styles/classes on it,
29332
+ * it might be wrapped in a styling context. Or if that node has a directive that injects
29333
+ * ViewContainerRef, it may be wrapped in an LContainer. Or if that node is a component,
29334
+ * it will be wrapped in LView. It could even have all three, so we keep looping
29335
+ * until we find something that isn't an array.
29336
+ *
29337
+ * @param value The initial value in `LView`
29338
+ */
29339
+ function readElementValue(value) {
29340
+ while (Array.isArray(value)) {
29341
+ value = value[HOST];
29342
+ }
29343
+ return value;
29344
+ }
29345
+ function getNativeByTNode(tNode, hostView) {
29346
+ return readElementValue(hostView[tNode.index]);
29347
+ }
29348
+ function getTNode(index, view) {
29349
+ ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');
29350
+ ngDevMode && assertLessThan(index, view[TVIEW].data.length, 'wrong index for TNode');
29351
+ return view[TVIEW].data[index + HEADER_OFFSET];
29352
+ }
29353
+ function getComponentViewByIndex(nodeIndex, hostView) {
29354
+ // Could be an LView or an LContainer. If LContainer, unwrap to find LView.
29355
+ var slotValue = hostView[nodeIndex];
29356
+ return slotValue.length >= HEADER_OFFSET ? slotValue : slotValue[HOST];
29357
+ }
29358
+ function isContentQueryHost(tNode) {
29359
+ return (tNode.flags & 4 /* hasContentQuery */) !== 0;
29360
+ }
29361
+ function isComponent(tNode) {
29362
+ return (tNode.flags & 1 /* isComponent */) === 1 /* isComponent */;
29363
+ }
29364
+ function isComponentDef(def) {
29365
+ return def.template !== null;
29366
+ }
29367
+ function isLContainer(value) {
29368
+ // Styling contexts are also arrays, but their first index contains an element node
29369
+ return Array.isArray(value) && value.length === LCONTAINER_LENGTH;
29370
+ }
29371
+ /**
29372
+ * Retrieve the root view from any component by walking the parent `LView` until
29373
+ * reaching the root `LView`.
29374
+ *
29375
+ * @param component any component
29376
+ */
29377
+ function getRootView(target) {
29378
+ ngDevMode && assertDefined(target, 'component');
29379
+ var lView = Array.isArray(target) ? target : readPatchedLView(target);
29380
+ while (lView && !(lView[FLAGS] & 128 /* IsRoot */)) {
29381
+ lView = lView[PARENT];
29382
+ }
29383
+ return lView;
29384
+ }
29385
+ function getRootContext(viewOrComponent) {
29386
+ var rootView = getRootView(viewOrComponent);
29387
+ ngDevMode &&
29388
+ assertDefined(rootView[CONTEXT], 'RootView has no context. Perhaps it is disconnected?');
29389
+ return rootView[CONTEXT];
29390
+ }
29391
+ /**
29392
+ * Returns the monkey-patch value data present on the target (which could be
29393
+ * a component, directive or a DOM node).
29394
+ */
29395
+ function readPatchedData(target) {
29396
+ ngDevMode && assertDefined(target, 'Target expected');
29397
+ return target[MONKEY_PATCH_KEY_NAME];
29398
+ }
29399
+ function readPatchedLView(target) {
29400
+ var value = readPatchedData(target);
29401
+ if (value) {
29402
+ return Array.isArray(value) ? value : value.lView;
29403
+ }
29404
+ return null;
29405
+ }
29406
+ function hasParentInjector(parentLocation) {
29407
+ return parentLocation !== NO_PARENT_INJECTOR;
29408
+ }
29409
+ function getParentInjectorIndex(parentLocation) {
29410
+ return parentLocation & 32767 /* InjectorIndexMask */;
29411
+ }
29412
+ function getParentInjectorViewOffset(parentLocation) {
29413
+ return parentLocation >> 16 /* ViewOffsetShift */;
29414
+ }
29415
+ /**
29416
+ * Unwraps a parent injector location number to find the view offset from the current injector,
29417
+ * then walks up the declaration view tree until the view is found that contains the parent
29418
+ * injector.
29419
+ *
29420
+ * @param location The location of the parent injector, which contains the view offset
29421
+ * @param startView The LView instance from which to start walking up the view tree
29422
+ * @returns The LView instance that contains the parent injector
29423
+ */
29424
+ function getParentInjectorView(location, startView) {
29425
+ var viewOffset = getParentInjectorViewOffset(location);
29426
+ var parentView = startView;
29427
+ // For most cases, the parent injector can be found on the host node (e.g. for component
29428
+ // or container), but we must keep the loop here to support the rarer case of deeply nested
29429
+ // <ng-template> tags or inline views, where the parent injector might live many views
29430
+ // above the child injector.
29431
+ while (viewOffset > 0) {
29432
+ parentView = parentView[DECLARATION_VIEW];
29433
+ viewOffset--;
29434
+ }
29435
+ return parentView;
29436
+ }
29437
+ var defaultScheduler = (typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame || // browser only
29438
+ setTimeout // everything else
29439
+ ).bind(_global$1);
29440
+ /**
29441
+ * Given a current view, finds the nearest component's host (LElement).
29442
+ *
29443
+ * @param lView LView for which we want a host element node
29444
+ * @returns The host node
29445
+ */
29446
+ function findComponentView(lView) {
29447
+ var rootTNode = lView[HOST_NODE];
29448
+ while (rootTNode && rootTNode.type === 2 /* View */) {
29449
+ ngDevMode && assertDefined(lView[DECLARATION_VIEW], 'lView[DECLARATION_VIEW]');
29450
+ lView = lView[DECLARATION_VIEW];
29451
+ rootTNode = lView[HOST_NODE];
29452
+ }
29453
+ return lView;
29454
+ }
29455
+
28742
29456
  /**
28743
29457
  * @license
28744
29458
  * Copyright Google Inc. All Rights Reserved.
@@ -28933,221 +29647,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
28933
29647
  return args;
28934
29648
  }
28935
29649
 
28936
- /**
28937
- * @license
28938
- * Copyright Google Inc. All Rights Reserved.
28939
- *
28940
- * Use of this source code is governed by an MIT-style license that can be
28941
- * found in the LICENSE file at https://angular.io/license
28942
- */
28943
- function assertEqual(actual, expected, msg) {
28944
- if (actual != expected) {
28945
- throwError(msg);
28946
- }
28947
- }
28948
- function assertNotEqual(actual, expected, msg) {
28949
- if (actual == expected) {
28950
- throwError(msg);
28951
- }
28952
- }
28953
- function assertLessThan(actual, expected, msg) {
28954
- if (actual >= expected) {
28955
- throwError(msg);
28956
- }
28957
- }
28958
- function assertGreaterThan(actual, expected, msg) {
28959
- if (actual <= expected) {
28960
- throwError(msg);
28961
- }
28962
- }
28963
- function assertDefined(actual, msg) {
28964
- if (actual == null) {
28965
- throwError(msg);
28966
- }
28967
- }
28968
- function assertComponentType(actual, msg) {
28969
- if (msg === void 0) { msg = 'Type passed in is not ComponentType, it does not have \'ngComponentDef\' property.'; }
28970
- if (!getComponentDef(actual)) {
28971
- throwError(msg);
28972
- }
28973
- }
28974
- function throwError(msg) {
28975
- // tslint:disable-next-line
28976
- debugger; // Left intentionally for better debugger experience.
28977
- throw new Error("ASSERTION ERROR: " + msg);
28978
- }
28979
- function assertDomNode(node) {
28980
- assertEqual(node instanceof Node, true, 'The provided value must be an instance of a DOM Node');
28981
- }
28982
- function assertPreviousIsParent(isParent) {
28983
- assertEqual(isParent, true, 'previousOrParentTNode should be a parent');
28984
- }
28985
- function assertDataInRange(arr, index) {
28986
- assertLessThan(index, arr ? arr.length : 0, 'index expected to be a valid data index');
28987
- }
28988
-
28989
- /**
28990
- * @license
28991
- * Copyright Google Inc. All Rights Reserved.
28992
- *
28993
- * Use of this source code is governed by an MIT-style license that can be
28994
- * found in the LICENSE file at https://angular.io/license
28995
- */
28996
- var TNODE = 8;
28997
- var PARENT_INJECTOR = 8;
28998
- var INJECTOR_BLOOM_PARENT_SIZE = 9;
28999
- var NO_PARENT_INJECTOR = -1;
29000
- /**
29001
- * Each injector is saved in 9 contiguous slots in `LView` and 9 contiguous slots in
29002
- * `TView.data`. This allows us to store information about the current node's tokens (which
29003
- * can be shared in `TView`) as well as the tokens of its ancestor nodes (which cannot be
29004
- * shared, so they live in `LView`).
29005
- *
29006
- * Each of these slots (aside from the last slot) contains a bloom filter. This bloom filter
29007
- * determines whether a directive is available on the associated node or not. This prevents us
29008
- * from searching the directives array at this level unless it's probable the directive is in it.
29009
- *
29010
- * See: https://en.wikipedia.org/wiki/Bloom_filter for more about bloom filters.
29011
- *
29012
- * Because all injectors have been flattened into `LView` and `TViewData`, they cannot typed
29013
- * using interfaces as they were previously. The start index of each `LInjector` and `TInjector`
29014
- * will differ based on where it is flattened into the main array, so it's not possible to know
29015
- * the indices ahead of time and save their types here. The interfaces are still included here
29016
- * for documentation purposes.
29017
- *
29018
- * export interface LInjector extends Array<any> {
29019
- *
29020
- * // Cumulative bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)
29021
- * [0]: number;
29022
- *
29023
- * // Cumulative bloom for directive IDs 32-63
29024
- * [1]: number;
29025
- *
29026
- * // Cumulative bloom for directive IDs 64-95
29027
- * [2]: number;
29028
- *
29029
- * // Cumulative bloom for directive IDs 96-127
29030
- * [3]: number;
29031
- *
29032
- * // Cumulative bloom for directive IDs 128-159
29033
- * [4]: number;
29034
- *
29035
- * // Cumulative bloom for directive IDs 160 - 191
29036
- * [5]: number;
29037
- *
29038
- * // Cumulative bloom for directive IDs 192 - 223
29039
- * [6]: number;
29040
- *
29041
- * // Cumulative bloom for directive IDs 224 - 255
29042
- * [7]: number;
29043
- *
29044
- * // We need to store a reference to the injector's parent so DI can keep looking up
29045
- * // the injector tree until it finds the dependency it's looking for.
29046
- * [PARENT_INJECTOR]: number;
29047
- * }
29048
- *
29049
- * export interface TInjector extends Array<any> {
29050
- *
29051
- * // Shared node bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)
29052
- * [0]: number;
29053
- *
29054
- * // Shared node bloom for directive IDs 32-63
29055
- * [1]: number;
29056
- *
29057
- * // Shared node bloom for directive IDs 64-95
29058
- * [2]: number;
29059
- *
29060
- * // Shared node bloom for directive IDs 96-127
29061
- * [3]: number;
29062
- *
29063
- * // Shared node bloom for directive IDs 128-159
29064
- * [4]: number;
29065
- *
29066
- * // Shared node bloom for directive IDs 160 - 191
29067
- * [5]: number;
29068
- *
29069
- * // Shared node bloom for directive IDs 192 - 223
29070
- * [6]: number;
29071
- *
29072
- * // Shared node bloom for directive IDs 224 - 255
29073
- * [7]: number;
29074
- *
29075
- * // Necessary to find directive indices for a particular node.
29076
- * [TNODE]: TElementNode|TElementContainerNode|TContainerNode;
29077
- * }
29078
- */
29079
- /**
29080
- * Factory for creating instances of injectors in the NodeInjector.
29081
- *
29082
- * This factory is complicated by the fact that it can resolve `multi` factories as well.
29083
- *
29084
- * NOTE: Some of the fields are optional which means that this class has two hidden classes.
29085
- * - One without `multi` support (most common)
29086
- * - One with `multi` values, (rare).
29087
- *
29088
- * Since VMs can cache up to 4 inline hidden classes this is OK.
29089
- *
29090
- * - Single factory: Only `resolving` and `factory` is defined.
29091
- * - `providers` factory: `componentProviders` is a number and `index = -1`.
29092
- * - `viewProviders` factory: `componentProviders` is a number and `index` points to `providers`.
29093
- */
29094
- var NodeInjectorFactory = /** @class */ (function () {
29095
- function NodeInjectorFactory(
29096
- /**
29097
- * Factory to invoke in order to create a new instance.
29098
- */
29099
- factory,
29100
- /**
29101
- * Set to `true` if the token is declared in `viewProviders` (or if it is component).
29102
- */
29103
- isViewProvider, injectImplementation) {
29104
- this.factory = factory;
29105
- /**
29106
- * Marker set to true during factory invocation to see if we get into recursive loop.
29107
- * Recursive loop causes an error to be displayed.
29108
- */
29109
- this.resolving = false;
29110
- this.canSeeViewProviders = isViewProvider;
29111
- this.injectImpl = injectImplementation;
29112
- }
29113
- return NodeInjectorFactory;
29114
- }());
29115
- var FactoryPrototype = NodeInjectorFactory.prototype;
29116
- function isFactory(obj) {
29117
- // See: https://jsperf.com/instanceof-vs-getprototypeof
29118
- return obj != null && typeof obj == 'object' && Object.getPrototypeOf(obj) == FactoryPrototype;
29119
- }
29120
-
29121
- /**
29122
- * @license
29123
- * Copyright Google Inc. All Rights Reserved.
29124
- *
29125
- * Use of this source code is governed by an MIT-style license that can be
29126
- * found in the LICENSE file at https://angular.io/license
29127
- */
29128
- // Below are constants for LView indices to help us look up LView members
29129
- // without having to remember the specific indices.
29130
- // Uglify will inline these when minifying so there shouldn't be a cost.
29131
- var TVIEW = 0;
29132
- var FLAGS = 1;
29133
- var PARENT = 2;
29134
- var NEXT = 3;
29135
- var QUERIES = 4;
29136
- var HOST = 5;
29137
- var HOST_NODE = 6; // Rename to `T_HOST`?
29138
- var BINDING_INDEX = 7;
29139
- var CLEANUP = 8;
29140
- var CONTEXT = 9;
29141
- var INJECTOR = 10;
29142
- var RENDERER_FACTORY = 11;
29143
- var RENDERER = 12;
29144
- var SANITIZER = 13;
29145
- var TAIL = 14;
29146
- var CONTAINER_INDEX = 15;
29147
- var DECLARATION_VIEW = 17;
29148
- /** Size of LView's header. Necessary to adjust for it when setting slots. */
29149
- var HEADER_OFFSET = 18;
29150
-
29151
29650
  /**
29152
29651
  * @license
29153
29652
  * Copyright Google Inc. All Rights Reserved.
@@ -29251,10 +29750,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29251
29750
  *
29252
29751
  * @param currentView The current view
29253
29752
  */
29254
- function executeInitHooks(currentView, tView, creationMode) {
29255
- if (currentView[FLAGS] & 16 /* RunInit */) {
29256
- executeHooks(currentView, tView.initHooks, tView.checkHooks, creationMode);
29257
- currentView[FLAGS] &= ~16 /* RunInit */;
29753
+ function executeInitHooks(currentView, tView, checkNoChangesMode) {
29754
+ if (!checkNoChangesMode && currentView[FLAGS] & 32 /* RunInit */) {
29755
+ executeHooks(currentView, tView.initHooks, tView.checkHooks, checkNoChangesMode);
29756
+ currentView[FLAGS] &= ~32 /* RunInit */;
29258
29757
  }
29259
29758
  }
29260
29759
  /**
@@ -29262,15 +29761,17 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29262
29761
  *
29263
29762
  * @param currentView The current view
29264
29763
  */
29265
- function executeHooks(data, allHooks, checkHooks, creationMode) {
29266
- var hooksToCall = creationMode ? allHooks : checkHooks;
29764
+ function executeHooks(currentView, allHooks, checkHooks, checkNoChangesMode) {
29765
+ if (checkNoChangesMode)
29766
+ return;
29767
+ var hooksToCall = currentView[FLAGS] & 2 /* FirstLViewPass */ ? allHooks : checkHooks;
29267
29768
  if (hooksToCall) {
29268
- callHooks(data, hooksToCall);
29769
+ callHooks(currentView, hooksToCall);
29269
29770
  }
29270
29771
  }
29271
29772
  /**
29272
29773
  * Calls lifecycle hooks with their contexts, skipping init hooks if it's not
29273
- * creation mode.
29774
+ * the first LView pass.
29274
29775
  *
29275
29776
  * @param currentView The current view
29276
29777
  * @param arr The array in which the hooks are found
@@ -29281,192 +29782,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29281
29782
  }
29282
29783
  }
29283
29784
 
29284
- /**
29285
- * @license
29286
- * Copyright Google Inc. All Rights Reserved.
29287
- *
29288
- * Use of this source code is governed by an MIT-style license that can be
29289
- * found in the LICENSE file at https://angular.io/license
29290
- */
29291
- /**
29292
- * Below are constants for LContainer indices to help us look up LContainer members
29293
- * without having to remember the specific indices.
29294
- * Uglify will inline these when minifying so there shouldn't be a cost.
29295
- */
29296
- var ACTIVE_INDEX = 0;
29297
- var VIEWS = 1;
29298
- // PARENT, NEXT, QUERIES, and HOST are indices 2, 3, 4, and 5.
29299
- // As we already have these constants in LView, we don't need to re-create them.
29300
- var NATIVE = 6;
29301
- var RENDER_PARENT = 7;
29302
-
29303
- /**
29304
- * @license
29305
- * Copyright Google Inc. All Rights Reserved.
29306
- *
29307
- * Use of this source code is governed by an MIT-style license that can be
29308
- * found in the LICENSE file at https://angular.io/license
29309
- */
29310
- /**
29311
- * This property will be monkey-patched on elements, components and directives
29312
- */
29313
- var MONKEY_PATCH_KEY_NAME = '__ngContext__';
29314
-
29315
- /**
29316
- * @license
29317
- * Copyright Google Inc. All Rights Reserved.
29318
- *
29319
- * Use of this source code is governed by an MIT-style license that can be
29320
- * found in the LICENSE file at https://angular.io/license
29321
- */
29322
- function stringify$2(value) {
29323
- if (typeof value == 'function')
29324
- return value.name || value;
29325
- if (typeof value == 'string')
29326
- return value;
29327
- if (value == null)
29328
- return '';
29329
- if (typeof value == 'object' && typeof value.type == 'function')
29330
- return value.type.name || value.type;
29331
- return '' + value;
29332
- }
29333
- /**
29334
- * Flattens an array in non-recursive way. Input arrays are not modified.
29335
- */
29336
- function flatten$2(list) {
29337
- var result = [];
29338
- var i = 0;
29339
- while (i < list.length) {
29340
- var item = list[i];
29341
- if (Array.isArray(item)) {
29342
- if (item.length > 0) {
29343
- list = item.concat(list.slice(i + 1));
29344
- i = 0;
29345
- }
29346
- else {
29347
- i++;
29348
- }
29349
- }
29350
- else {
29351
- result.push(item);
29352
- i++;
29353
- }
29354
- }
29355
- return result;
29356
- }
29357
- /**
29358
- * Takes the value of a slot in `LView` and returns the element node.
29359
- *
29360
- * Normally, element nodes are stored flat, but if the node has styles/classes on it,
29361
- * it might be wrapped in a styling context. Or if that node has a directive that injects
29362
- * ViewContainerRef, it may be wrapped in an LContainer. Or if that node is a component,
29363
- * it will be wrapped in LView. It could even have all three, so we keep looping
29364
- * until we find something that isn't an array.
29365
- *
29366
- * @param value The initial value in `LView`
29367
- */
29368
- function readElementValue(value) {
29369
- while (Array.isArray(value)) {
29370
- value = value[HOST];
29371
- }
29372
- return value;
29373
- }
29374
- function getNativeByTNode(tNode, hostView) {
29375
- return readElementValue(hostView[tNode.index]);
29376
- }
29377
- function getTNode(index, view) {
29378
- ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');
29379
- ngDevMode && assertLessThan(index, view[TVIEW].data.length, 'wrong index for TNode');
29380
- return view[TVIEW].data[index + HEADER_OFFSET];
29381
- }
29382
- function getComponentViewByIndex(nodeIndex, hostView) {
29383
- // Could be an LView or an LContainer. If LContainer, unwrap to find LView.
29384
- var slotValue = hostView[nodeIndex];
29385
- return slotValue.length >= HEADER_OFFSET ? slotValue : slotValue[HOST];
29386
- }
29387
- function isContentQueryHost(tNode) {
29388
- return (tNode.flags & 4 /* hasContentQuery */) !== 0;
29389
- }
29390
- function isComponent(tNode) {
29391
- return (tNode.flags & 1 /* isComponent */) === 1 /* isComponent */;
29392
- }
29393
- function isComponentDef(def) {
29394
- return def.template !== null;
29395
- }
29396
- function isLContainer(value) {
29397
- // Styling contexts are also arrays, but their first index contains an element node
29398
- return Array.isArray(value) && typeof value[ACTIVE_INDEX] === 'number';
29399
- }
29400
- /**
29401
- * Retrieve the root view from any component by walking the parent `LView` until
29402
- * reaching the root `LView`.
29403
- *
29404
- * @param component any component
29405
- */
29406
- function getRootView(target) {
29407
- ngDevMode && assertDefined(target, 'component');
29408
- var lView = Array.isArray(target) ? target : readPatchedLView(target);
29409
- while (lView && !(lView[FLAGS] & 64 /* IsRoot */)) {
29410
- lView = lView[PARENT];
29411
- }
29412
- return lView;
29413
- }
29414
- function getRootContext(viewOrComponent) {
29415
- var rootView = getRootView(viewOrComponent);
29416
- ngDevMode &&
29417
- assertDefined(rootView[CONTEXT], 'RootView has no context. Perhaps it is disconnected?');
29418
- return rootView[CONTEXT];
29419
- }
29420
- /**
29421
- * Returns the monkey-patch value data present on the target (which could be
29422
- * a component, directive or a DOM node).
29423
- */
29424
- function readPatchedData(target) {
29425
- ngDevMode && assertDefined(target, 'Target expected');
29426
- return target[MONKEY_PATCH_KEY_NAME];
29427
- }
29428
- function readPatchedLView(target) {
29429
- var value = readPatchedData(target);
29430
- if (value) {
29431
- return Array.isArray(value) ? value : value.lView;
29432
- }
29433
- return null;
29434
- }
29435
- function hasParentInjector(parentLocation) {
29436
- return parentLocation !== NO_PARENT_INJECTOR;
29437
- }
29438
- function getParentInjectorIndex(parentLocation) {
29439
- return parentLocation & 32767 /* InjectorIndexMask */;
29440
- }
29441
- function getParentInjectorViewOffset(parentLocation) {
29442
- return parentLocation >> 16 /* ViewOffsetShift */;
29443
- }
29444
- /**
29445
- * Unwraps a parent injector location number to find the view offset from the current injector,
29446
- * then walks up the declaration view tree until the view is found that contains the parent
29447
- * injector.
29448
- *
29449
- * @param location The location of the parent injector, which contains the view offset
29450
- * @param startView The LView instance from which to start walking up the view tree
29451
- * @returns The LView instance that contains the parent injector
29452
- */
29453
- function getParentInjectorView(location, startView) {
29454
- var viewOffset = getParentInjectorViewOffset(location);
29455
- var parentView = startView;
29456
- // For most cases, the parent injector can be found on the host node (e.g. for component
29457
- // or container), but we must keep the loop here to support the rarer case of deeply nested
29458
- // <ng-template> tags or inline views, where the parent injector might live many views
29459
- // above the child injector.
29460
- while (viewOffset > 0) {
29461
- parentView = parentView[DECLARATION_VIEW];
29462
- viewOffset--;
29463
- }
29464
- return parentView;
29465
- }
29466
- var defaultScheduler = (typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame || // browser only
29467
- setTimeout // everything else
29468
- ).bind(_global$1);
29469
-
29470
29785
  /**
29471
29786
  * @license
29472
29787
  * Copyright Google Inc. All Rights Reserved.
@@ -29503,13 +29818,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29503
29818
  function setIsParent(value) {
29504
29819
  isParent = value;
29505
29820
  }
29506
- /**
29507
- * This property gets set before entering a template.
29508
- */
29509
- var creationMode;
29510
- function getCreationMode() {
29511
- // top level variables should not be exported for performance reasons (PERF_NOTES.md)
29512
- return creationMode;
29821
+ /** Checks whether a given view is in creation mode */
29822
+ function isCreationMode(view) {
29823
+ if (view === void 0) { view = lView; }
29824
+ return (view[FLAGS] & 1 /* CreationMode */) === 1 /* CreationMode */;
29513
29825
  }
29514
29826
  /**
29515
29827
  * State of the current view being processed.
@@ -29571,7 +29883,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29571
29883
  var oldView = lView;
29572
29884
  if (newView) {
29573
29885
  var tView = newView[TVIEW];
29574
- creationMode = (newView[FLAGS] & 1 /* CreationMode */) === 1 /* CreationMode */;
29575
29886
  firstTemplatePass = tView.firstTemplatePass;
29576
29887
  bindingRootIndex = tView.bindingStartIndex;
29577
29888
  }
@@ -29592,20 +29903,19 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29592
29903
  * the direction of traversal (up or down the view tree) a bit clearer.
29593
29904
  *
29594
29905
  * @param newView New state to become active
29595
- * @param creationOnly An optional boolean to indicate that the view was processed in creation mode
29596
- * only, i.e. the first update will be done later. Only possible for dynamically created views.
29597
29906
  */
29598
- function leaveView(newView, creationOnly) {
29907
+ function leaveView(newView) {
29599
29908
  var tView = lView[TVIEW];
29600
- if (!creationOnly) {
29601
- if (!checkNoChangesMode) {
29602
- executeHooks(lView, tView.viewHooks, tView.viewCheckHooks, creationMode);
29603
- }
29909
+ if (isCreationMode(lView)) {
29910
+ lView[FLAGS] &= ~1 /* CreationMode */;
29911
+ }
29912
+ else {
29913
+ executeHooks(lView, tView.viewHooks, tView.viewCheckHooks, checkNoChangesMode);
29604
29914
  // Views are clean and in update mode after being checked, so these bits are cleared
29605
- lView[FLAGS] &= ~(1 /* CreationMode */ | 4 /* Dirty */);
29915
+ lView[FLAGS] &= ~(8 /* Dirty */ | 2 /* FirstLViewPass */);
29916
+ lView[FLAGS] |= 32 /* RunInit */;
29917
+ lView[BINDING_INDEX] = tView.bindingStartIndex;
29606
29918
  }
29607
- lView[FLAGS] |= 16 /* RunInit */;
29608
- lView[BINDING_INDEX] = tView.bindingStartIndex;
29609
29919
  enterView(newView, null);
29610
29920
  }
29611
29921
 
@@ -29652,7 +29962,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29652
29962
  *
29653
29963
  * ```
29654
29964
  */
29655
- var includeViewProviders = false;
29965
+ var includeViewProviders = true;
29656
29966
  function setIncludeViewProviders(v) {
29657
29967
  var oldValue = includeViewProviders;
29658
29968
  includeViewProviders = v;
@@ -29767,7 +30077,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29767
30077
  */
29768
30078
  function getParentInjectorLocation(tNode, view) {
29769
30079
  if (tNode.parent && tNode.parent.injectorIndex !== -1) {
29770
- return tNode.parent.injectorIndex; // ViewOffset is 0, AcrossHostBoundary is 0
30080
+ return tNode.parent.injectorIndex; // ViewOffset is 0
29771
30081
  }
29772
30082
  // For most cases, the parent injector index can be found on the host node (e.g. for component
29773
30083
  // or container), so this loop will be skipped, but we must keep the loop here to support
@@ -29776,15 +30086,11 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29776
30086
  var viewOffset = 1;
29777
30087
  while (hostTNode && hostTNode.injectorIndex === -1) {
29778
30088
  view = view[DECLARATION_VIEW];
29779
- hostTNode = view[HOST_NODE];
30089
+ hostTNode = view ? view[HOST_NODE] : null;
29780
30090
  viewOffset++;
29781
30091
  }
29782
- var acrossHostBoundary = hostTNode && hostTNode.type === 3 /* Element */ ?
29783
- 32768 /* AcrossHostBoundary */ :
29784
- 0;
29785
30092
  return hostTNode ?
29786
- hostTNode.injectorIndex | (viewOffset << 16 /* ViewOffsetShift */) |
29787
- acrossHostBoundary :
30093
+ hostTNode.injectorIndex | (viewOffset << 16 /* ViewOffsetShift */) :
29788
30094
  -1;
29789
30095
  }
29790
30096
  /**
@@ -29812,75 +30118,80 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29812
30118
  */
29813
30119
  function getOrCreateInjectable(tNode, lView, token, flags, notFoundValue) {
29814
30120
  if (flags === void 0) { flags = InjectFlags.Default; }
29815
- var bloomHash = bloomHashBitOrFactory(token);
29816
- // If the ID stored here is a function, this is a special object like ElementRef or TemplateRef
29817
- // so just call the factory function to create it.
29818
- if (typeof bloomHash === 'function') {
29819
- var savePreviousOrParentTNode = getPreviousOrParentTNode();
29820
- var saveLView = getLView();
29821
- setTNodeAndViewData(tNode, lView);
29822
- try {
29823
- var value = bloomHash();
29824
- if (value == null && !(flags & InjectFlags.Optional)) {
29825
- throw new Error("No provider for " + stringify$2(token) + "!");
29826
- }
29827
- else {
29828
- return value;
29829
- }
29830
- }
29831
- finally {
29832
- setTNodeAndViewData(savePreviousOrParentTNode, saveLView);
29833
- }
29834
- }
29835
- else if (typeof bloomHash == 'number') {
29836
- // If the token has a bloom hash, then it is a token which could be in NodeInjector.
29837
- // A reference to the previous injector TView that was found while climbing the element injector
29838
- // tree. This is used to know if viewProviders can be accessed on the current injector.
29839
- var previousTView = null;
29840
- var injectorIndex = getInjectorIndex(tNode, lView);
29841
- var parentLocation = NO_PARENT_INJECTOR;
29842
- // If we should skip this injector, or if there is no injector on this node, start by searching
29843
- // the parent injector.
29844
- if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {
29845
- parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) :
29846
- lView[injectorIndex + PARENT_INJECTOR];
29847
- if (!shouldSearchParent(flags, parentLocation)) {
29848
- injectorIndex = -1;
29849
- }
29850
- else {
29851
- previousTView = lView[TVIEW];
29852
- injectorIndex = getParentInjectorIndex(parentLocation);
29853
- lView = getParentInjectorView(parentLocation, lView);
29854
- }
29855
- }
29856
- // Traverse up the injector tree until we find a potential match or until we know there
29857
- // *isn't* a match.
29858
- while (injectorIndex !== -1) {
29859
- parentLocation = lView[injectorIndex + PARENT_INJECTOR];
29860
- // Check the current injector. If it matches, see if it contains token.
29861
- var tView = lView[TVIEW];
29862
- if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {
29863
- // At this point, we have an injector which *may* contain the token, so we step through
29864
- // the providers and directives associated with the injector's corresponding node to get
29865
- // the instance.
29866
- var instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView);
29867
- if (instance !== NOT_FOUND) {
29868
- return instance;
29869
- }
29870
- }
29871
- if (shouldSearchParent(flags, parentLocation) &&
29872
- bloomHasToken(bloomHash, injectorIndex, lView)) {
29873
- // The def wasn't found anywhere on this node, so it was a false positive.
29874
- // Traverse up the tree and continue searching.
29875
- previousTView = tView;
29876
- injectorIndex = getParentInjectorIndex(parentLocation);
29877
- lView = getParentInjectorView(parentLocation, lView);
30121
+ if (tNode) {
30122
+ var bloomHash = bloomHashBitOrFactory(token);
30123
+ // If the ID stored here is a function, this is a special object like ElementRef or TemplateRef
30124
+ // so just call the factory function to create it.
30125
+ if (typeof bloomHash === 'function') {
30126
+ var savePreviousOrParentTNode = getPreviousOrParentTNode();
30127
+ var saveLView = getLView();
30128
+ setTNodeAndViewData(tNode, lView);
30129
+ try {
30130
+ var value = bloomHash();
30131
+ if (value == null && !(flags & InjectFlags.Optional)) {
30132
+ throw new Error("No provider for " + stringify$2(token) + "!");
30133
+ }
30134
+ else {
30135
+ return value;
30136
+ }
29878
30137
  }
29879
- else {
29880
- // If we should not search parent OR If the ancestor bloom filter value does not have the
29881
- // bit corresponding to the directive we can give up on traversing up to find the specific
29882
- // injector.
29883
- injectorIndex = -1;
30138
+ finally {
30139
+ setTNodeAndViewData(savePreviousOrParentTNode, saveLView);
30140
+ }
30141
+ }
30142
+ else if (typeof bloomHash == 'number') {
30143
+ // If the token has a bloom hash, then it is a token which could be in NodeInjector.
30144
+ // A reference to the previous injector TView that was found while climbing the element
30145
+ // injector tree. This is used to know if viewProviders can be accessed on the current
30146
+ // injector.
30147
+ var previousTView = null;
30148
+ var injectorIndex = getInjectorIndex(tNode, lView);
30149
+ var parentLocation = NO_PARENT_INJECTOR;
30150
+ var hostTElementNode = flags & InjectFlags.Host ? findComponentView(lView)[HOST_NODE] : null;
30151
+ // If we should skip this injector, or if there is no injector on this node, start by
30152
+ // searching
30153
+ // the parent injector.
30154
+ if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {
30155
+ parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) :
30156
+ lView[injectorIndex + PARENT_INJECTOR];
30157
+ if (!shouldSearchParent(flags, false)) {
30158
+ injectorIndex = -1;
30159
+ }
30160
+ else {
30161
+ previousTView = lView[TVIEW];
30162
+ injectorIndex = getParentInjectorIndex(parentLocation);
30163
+ lView = getParentInjectorView(parentLocation, lView);
30164
+ }
30165
+ }
30166
+ // Traverse up the injector tree until we find a potential match or until we know there
30167
+ // *isn't* a match.
30168
+ while (injectorIndex !== -1) {
30169
+ parentLocation = lView[injectorIndex + PARENT_INJECTOR];
30170
+ // Check the current injector. If it matches, see if it contains token.
30171
+ var tView = lView[TVIEW];
30172
+ if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {
30173
+ // At this point, we have an injector which *may* contain the token, so we step through
30174
+ // the providers and directives associated with the injector's corresponding node to get
30175
+ // the instance.
30176
+ var instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode);
30177
+ if (instance !== NOT_FOUND) {
30178
+ return instance;
30179
+ }
30180
+ }
30181
+ if (shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + TNODE] === hostTElementNode) &&
30182
+ bloomHasToken(bloomHash, injectorIndex, lView)) {
30183
+ // The def wasn't found anywhere on this node, so it was a false positive.
30184
+ // Traverse up the tree and continue searching.
30185
+ previousTView = tView;
30186
+ injectorIndex = getParentInjectorIndex(parentLocation);
30187
+ lView = getParentInjectorView(parentLocation, lView);
30188
+ }
30189
+ else {
30190
+ // If we should not search parent OR If the ancestor bloom filter value does not have the
30191
+ // bit corresponding to the directive we can give up on traversing up to find the specific
30192
+ // injector.
30193
+ injectorIndex = -1;
30194
+ }
29884
30195
  }
29885
30196
  }
29886
30197
  }
@@ -29905,7 +30216,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29905
30216
  }
29906
30217
  }
29907
30218
  var NOT_FOUND = {};
29908
- function searchTokensOnInjector(injectorIndex, lView, token, previousTView) {
30219
+ function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {
29909
30220
  var currentTView = lView[TVIEW];
29910
30221
  var tNode = currentTView.data[injectorIndex + TNODE];
29911
30222
  // First, we need to determine if view providers can be accessed by the starting element.
@@ -29926,7 +30237,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29926
30237
  // This means that we just came from the Component's View and therefore are allowed to see
29927
30238
  // into the ViewProviders.
29928
30239
  (previousTView != currentTView && (tNode.type === 3 /* Element */));
29929
- var injectableIdx = locateDirectiveOrProvider(tNode, lView, token, canAccessViewProviders);
30240
+ // This special case happens when there is a @host on the inject and when we are searching
30241
+ // on the host element node.
30242
+ var isHostSpecialCase = (flags & InjectFlags.Host) && hostTElementNode === tNode;
30243
+ var injectableIdx = locateDirectiveOrProvider(tNode, lView, token, canAccessViewProviders, isHostSpecialCase);
29930
30244
  if (injectableIdx !== null) {
29931
30245
  return getNodeInjectable(currentTView.data, lView, injectableIdx, tNode);
29932
30246
  }
@@ -29941,11 +30255,11 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29941
30255
  * @param lView The view we are currently processing
29942
30256
  * @param token Provider token or type of a directive to look for.
29943
30257
  * @param canAccessViewProviders Whether view providers should be considered.
30258
+ * @param isHostSpecialCase Whether the host special case applies.
29944
30259
  * @returns Index of a found directive or provider, or null when none found.
29945
30260
  */
29946
- function locateDirectiveOrProvider(tNode, lView, token, canAccessViewProviders) {
30261
+ function locateDirectiveOrProvider(tNode, lView, token, canAccessViewProviders, isHostSpecialCase) {
29947
30262
  var tView = lView[TVIEW];
29948
- var nodeFlags = tNode.flags;
29949
30263
  var nodeProviderIndexes = tNode.providerIndexes;
29950
30264
  var tInjectables = tView.data;
29951
30265
  var injectablesStart = nodeProviderIndexes & 65535 /* ProvidersStartIndexMask */;
@@ -29953,13 +30267,21 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
29953
30267
  var directiveEnd = tNode.directiveEnd;
29954
30268
  var cptViewProvidersCount = nodeProviderIndexes >> 16 /* CptViewProvidersCountShift */;
29955
30269
  var startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;
29956
- for (var i = startingIndex; i < directiveEnd; i++) {
30270
+ // When the host special case applies, only the viewProviders and the component are visible
30271
+ var endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;
30272
+ for (var i = startingIndex; i < endIndex; i++) {
29957
30273
  var providerTokenOrDef = tInjectables[i];
29958
30274
  if (i < directivesStart && token === providerTokenOrDef ||
29959
30275
  i >= directivesStart && providerTokenOrDef.type === token) {
29960
30276
  return i;
29961
30277
  }
29962
30278
  }
30279
+ if (isHostSpecialCase) {
30280
+ var dirDef = tInjectables[directivesStart];
30281
+ if (dirDef && isComponentDef(dirDef) && dirDef.type === token) {
30282
+ return directivesStart;
30283
+ }
30284
+ }
29963
30285
  return null;
29964
30286
  }
29965
30287
  /**
@@ -30042,10 +30364,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
30042
30364
  return !!(value & mask);
30043
30365
  }
30044
30366
  /** Returns true if flags prevent parent injector from being searched for tokens */
30045
- function shouldSearchParent(flags, parentLocation) {
30046
- return !(flags & InjectFlags.Self ||
30047
- (flags & InjectFlags.Host &&
30048
- (parentLocation & 32768 /* AcrossHostBoundary */)));
30367
+ function shouldSearchParent(flags, isFirstHostTNode) {
30368
+ return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);
30049
30369
  }
30050
30370
  var NodeInjector = /** @class */ (function () {
30051
30371
  function NodeInjector(_tNode, _lView) {
@@ -30512,7 +30832,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
30512
30832
  var secondParam = tCleanup[i++];
30513
30833
  if (typeof firstParam === 'string') {
30514
30834
  var name_1 = firstParam;
30515
- var listenerElement = lView[secondParam];
30835
+ var listenerElement = readElementValue(lView[secondParam]);
30516
30836
  var callback = lCleanup[tCleanup[i++]];
30517
30837
  var useCaptureOrIndx = tCleanup[i++];
30518
30838
  // if useCaptureOrIndx is boolean then report it as is.
@@ -30544,55 +30864,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
30544
30864
  return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined;
30545
30865
  }
30546
30866
 
30547
- /**
30548
- * @license
30549
- * Copyright Google Inc. All Rights Reserved.
30550
- *
30551
- * Use of this source code is governed by an MIT-style license that can be
30552
- * found in the LICENSE file at https://angular.io/license
30553
- */
30554
- var __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty });
30555
- /**
30556
- * Allows to refer to references which are not yet defined.
30557
- *
30558
- * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
30559
- * DI is declared, but not yet defined. It is also used when the `token` which we use when creating
30560
- * a query is not yet defined.
30561
- *
30562
- * @usageNotes
30563
- * ### Example
30564
- * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
30565
- * @publicApi
30566
- */
30567
- function forwardRef(forwardRefFn) {
30568
- forwardRefFn.__forward_ref__ = forwardRef;
30569
- forwardRefFn.toString = function () { return stringify$1(this()); };
30570
- return forwardRefFn;
30571
- }
30572
- /**
30573
- * Lazily retrieves the reference value from a forwardRef.
30574
- *
30575
- * Acts as the identity function when given a non-forward-ref value.
30576
- *
30577
- * @usageNotes
30578
- * ### Example
30579
- *
30580
- * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
30581
- *
30582
- * @see `forwardRef`
30583
- * @publicApi
30584
- */
30585
- function resolveForwardRef$1(type) {
30586
- var fn = type;
30587
- if (typeof fn === 'function' && fn.hasOwnProperty(__forward_ref__) &&
30588
- fn.__forward_ref__ === forwardRef) {
30589
- return fn();
30590
- }
30591
- else {
30592
- return type;
30593
- }
30594
- }
30595
-
30596
30867
  /**
30597
30868
  * @license
30598
30869
  * Copyright Google Inc. All Rights Reserved.
@@ -30918,21 +31189,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
30918
31189
  tNode = nextTNode;
30919
31190
  }
30920
31191
  }
30921
- /**
30922
- * Given a current view, finds the nearest component's host (LElement).
30923
- *
30924
- * @param lView LView for which we want a host element node
30925
- * @returns The host node
30926
- */
30927
- function findComponentView(lView) {
30928
- var rootTNode = lView[HOST_NODE];
30929
- while (rootTNode && rootTNode.type === 2 /* View */) {
30930
- ngDevMode && assertDefined(lView[PARENT], 'lView.parent');
30931
- lView = lView[PARENT];
30932
- rootTNode = lView[HOST_NODE];
30933
- }
30934
- return lView;
30935
- }
30936
31192
  /**
30937
31193
  * NOTE: for performance reasons, the possible actions are inlined within the function instead of
30938
31194
  * being passed as an argument.
@@ -31038,7 +31294,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31038
31294
  lView[QUERIES].insertView(index);
31039
31295
  }
31040
31296
  // Sets the attached flag
31041
- lView[FLAGS] |= 8 /* Attached */;
31297
+ lView[FLAGS] |= 16 /* Attached */;
31042
31298
  }
31043
31299
  /** Gets the child of the given LView */
31044
31300
  function getLViewChild(lView) {
@@ -31058,7 +31314,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31058
31314
  }
31059
31315
  destroyViewTree(view);
31060
31316
  // Sets the destroyed flag
31061
- view[FLAGS] |= 32 /* Destroyed */;
31317
+ view[FLAGS] |= 64 /* Destroyed */;
31062
31318
  }
31063
31319
  /**
31064
31320
  * Determines which LViewOrLContainer to jump to when traversing back up the
@@ -31197,16 +31453,17 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31197
31453
  * found in the LICENSE file at https://angular.io/license
31198
31454
  */
31199
31455
  var ANIMATION_PROP_PREFIX = '@';
31200
- function createEmptyStylingContext(element, sanitizer, initialStylingValues) {
31456
+ function createEmptyStylingContext(element, sanitizer, initialStyles, initialClasses) {
31201
31457
  return [
31202
- null,
31203
- sanitizer || null,
31204
- initialStylingValues || [null],
31205
- 0,
31206
31458
  0,
31459
+ [null, -1, false, sanitizer || null],
31460
+ initialStyles || [null],
31461
+ initialClasses || [null],
31462
+ [0, 0],
31207
31463
  element || null,
31208
31464
  null,
31209
- null // PreviousMultiStyleValue
31465
+ null,
31466
+ null,
31210
31467
  ];
31211
31468
  }
31212
31469
  /**
@@ -31219,6 +31476,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31219
31476
  // each instance gets a copy
31220
31477
  var context = templateStyleContext.slice();
31221
31478
  context[5 /* ElementPosition */] = element;
31479
+ // this will prevent any other directives from extending the context
31480
+ context[0 /* MasterFlagPosition */] |= 32 /* BindingAllocationLocked */;
31222
31481
  return context;
31223
31482
  }
31224
31483
  /**
@@ -31256,15 +31515,15 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31256
31515
  }
31257
31516
  function isStylingContext(value) {
31258
31517
  // Not an LView or an LContainer
31259
- return Array.isArray(value) && typeof value[FLAGS] !== 'number' &&
31260
- typeof value[ACTIVE_INDEX] !== 'number';
31518
+ return Array.isArray(value) && typeof value[0 /* MasterFlagPosition */] === 'number' &&
31519
+ Array.isArray(value[2 /* InitialStyleValuesPosition */]);
31261
31520
  }
31262
31521
  function isAnimationProp(name) {
31263
31522
  return name[0] === ANIMATION_PROP_PREFIX;
31264
31523
  }
31265
31524
 
31266
- function isClassBased(context, index) {
31267
- var adjustedIndex = index >= 8 /* SingleStylesStartPosition */ ? (index + 0 /* FlagsOffset */) : index;
31525
+ function isClassBasedValue(context, index) {
31526
+ var adjustedIndex = index >= 9 /* SingleStylesStartPosition */ ? (index + 0 /* FlagsOffset */) : index;
31268
31527
  return (context[adjustedIndex] & 2 /* Class */) == 2 /* Class */;
31269
31528
  }
31270
31529
  function getValue(context, index) {
@@ -31292,29 +31551,23 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31292
31551
  * bindings, refreshes child components.
31293
31552
  * Note: view hooks are triggered later when leaving the view.
31294
31553
  */
31295
- function refreshDescendantViews(lView, rf) {
31554
+ function refreshDescendantViews(lView) {
31296
31555
  var tView = lView[TVIEW];
31297
31556
  // This needs to be set before children are processed to support recursive components
31298
31557
  tView.firstTemplatePass = false;
31299
31558
  setFirstTemplatePass(false);
31300
- // Dynamically created views must run first only in creation mode. If this is a
31301
- // creation-only pass, we should not call lifecycle hooks or evaluate bindings.
31302
- // This will be done in the update-only pass.
31303
- if (rf !== 1 /* Create */) {
31304
- var creationMode = getCreationMode();
31559
+ // If this is a creation pass, we should not call lifecycle hooks or evaluate bindings.
31560
+ // This will be done in the update pass.
31561
+ if (!isCreationMode(lView)) {
31305
31562
  var checkNoChangesMode = getCheckNoChangesMode();
31306
- if (!checkNoChangesMode) {
31307
- executeInitHooks(lView, tView, creationMode);
31308
- }
31563
+ executeInitHooks(lView, tView, checkNoChangesMode);
31309
31564
  refreshDynamicEmbeddedViews(lView);
31310
31565
  // Content query results must be refreshed before content hooks are called.
31311
31566
  refreshContentQueries(tView);
31312
- if (!checkNoChangesMode) {
31313
- executeHooks(lView, tView.contentHooks, tView.contentCheckHooks, creationMode);
31314
- }
31567
+ executeHooks(lView, tView.contentHooks, tView.contentCheckHooks, checkNoChangesMode);
31315
31568
  setHostBindings(tView, lView);
31316
31569
  }
31317
- refreshChildComponents(tView.components, rf);
31570
+ refreshChildComponents(tView.components);
31318
31571
  }
31319
31572
  /** Sets the host bindings for the current view. */
31320
31573
  function setHostBindings(tView, viewData) {
@@ -31365,16 +31618,17 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31365
31618
  }
31366
31619
  }
31367
31620
  /** Refreshes child components in the current view. */
31368
- function refreshChildComponents(components, rf) {
31621
+ function refreshChildComponents(components) {
31369
31622
  if (components != null) {
31370
31623
  for (var i = 0; i < components.length; i++) {
31371
- componentRefresh(components[i], rf);
31624
+ componentRefresh(components[i]);
31372
31625
  }
31373
31626
  }
31374
31627
  }
31375
31628
  function createLView(parentLView, tView, context, flags, rendererFactory, renderer, sanitizer, injector) {
31376
31629
  var lView = tView.blueprint.slice();
31377
- lView[FLAGS] = flags | 1 /* CreationMode */ | 8 /* Attached */ | 16 /* RunInit */;
31630
+ lView[FLAGS] = flags | 1 /* CreationMode */ | 16 /* Attached */ | 32 /* RunInit */ |
31631
+ 2 /* FirstLViewPass */;
31378
31632
  lView[PARENT] = lView[DECLARATION_VIEW] = parentLView;
31379
31633
  lView[CONTEXT] = context;
31380
31634
  lView[RENDERER_FACTORY] = (rendererFactory || parentLView && parentLView[RENDERER_FACTORY]);
@@ -31437,7 +31691,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31437
31691
  var _previousOrParentTNode = getPreviousOrParentTNode();
31438
31692
  setIsParent(true);
31439
31693
  setPreviousOrParentTNode(null);
31440
- var lView = createLView(declarationView, tView, context, 2 /* CheckAlways */);
31694
+ var lView = createLView(declarationView, tView, context, 4 /* CheckAlways */);
31441
31695
  lView[DECLARATION_VIEW] = declarationView;
31442
31696
  if (queries) {
31443
31697
  lView[QUERIES] = queries.createView();
@@ -31460,13 +31714,13 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31460
31714
  * can't store TViews in the template function itself (as we do for comps). Instead, we store the
31461
31715
  * TView for dynamically created views on their host TNode, which only has one instance.
31462
31716
  */
31463
- function renderEmbeddedTemplate(viewToRender, tView, context, rf) {
31717
+ function renderEmbeddedTemplate(viewToRender, tView, context) {
31464
31718
  var _isParent = getIsParent();
31465
31719
  var _previousOrParentTNode = getPreviousOrParentTNode();
31466
31720
  setIsParent(true);
31467
31721
  setPreviousOrParentTNode(null);
31468
31722
  var oldView;
31469
- if (viewToRender[FLAGS] & 64 /* IsRoot */) {
31723
+ if (viewToRender[FLAGS] & 128 /* IsRoot */) {
31470
31724
  // This is a root view inside the view tree
31471
31725
  tickRootContext(getRootContext(viewToRender));
31472
31726
  }
@@ -31476,44 +31730,45 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31476
31730
  setPreviousOrParentTNode(null);
31477
31731
  oldView = enterView(viewToRender, viewToRender[HOST_NODE]);
31478
31732
  namespaceHTML();
31479
- tView.template(rf, context);
31480
- if (rf & 2 /* Update */) {
31481
- refreshDescendantViews(viewToRender, null);
31482
- }
31483
- else {
31484
- // This must be set to false immediately after the first creation run because in an
31485
- // ngFor loop, all the views will be created together before update mode runs and turns
31486
- // off firstTemplatePass. If we don't set it here, instances will perform directive
31487
- // matching, etc again and again.
31488
- viewToRender[TVIEW].firstTemplatePass = false;
31489
- setFirstTemplatePass(false);
31490
- }
31733
+ tView.template(getRenderFlags(viewToRender), context);
31734
+ // This must be set to false immediately after the first creation run because in an
31735
+ // ngFor loop, all the views will be created together before update mode runs and turns
31736
+ // off firstTemplatePass. If we don't set it here, instances will perform directive
31737
+ // matching, etc again and again.
31738
+ viewToRender[TVIEW].firstTemplatePass = false;
31739
+ setFirstTemplatePass(false);
31740
+ refreshDescendantViews(viewToRender);
31491
31741
  }
31492
31742
  finally {
31493
- // renderEmbeddedTemplate() is called twice, once for creation only and then once for
31494
- // update. When for creation only, leaveView() must not trigger view hooks, nor clean flags.
31495
- var isCreationOnly = (rf & 1 /* Create */) === 1 /* Create */;
31496
- leaveView(oldView, isCreationOnly);
31743
+ leaveView(oldView);
31497
31744
  setIsParent(_isParent);
31498
31745
  setPreviousOrParentTNode(_previousOrParentTNode);
31499
31746
  }
31500
31747
  }
31501
31748
  }
31502
- function renderComponentOrTemplate(hostView, componentOrContext, rf, templateFn) {
31749
+ function renderComponentOrTemplate(hostView, context, templateFn) {
31503
31750
  var rendererFactory = hostView[RENDERER_FACTORY];
31504
31751
  var oldView = enterView(hostView, hostView[HOST_NODE]);
31752
+ var normalExecutionPath = !getCheckNoChangesMode();
31505
31753
  try {
31506
- if (rendererFactory.begin) {
31754
+ if (normalExecutionPath && rendererFactory.begin) {
31507
31755
  rendererFactory.begin();
31508
31756
  }
31509
- if (templateFn) {
31510
- namespaceHTML();
31511
- templateFn(rf || getRenderFlags(hostView), componentOrContext);
31757
+ if (isCreationMode(hostView)) {
31758
+ // creation mode pass
31759
+ if (templateFn) {
31760
+ namespaceHTML();
31761
+ templateFn(1 /* Create */, context);
31762
+ }
31763
+ refreshDescendantViews(hostView);
31764
+ hostView[FLAGS] &= ~1 /* CreationMode */;
31512
31765
  }
31513
- refreshDescendantViews(hostView, rf);
31766
+ // update mode pass
31767
+ templateFn && templateFn(2 /* Update */, context);
31768
+ refreshDescendantViews(hostView);
31514
31769
  }
31515
31770
  finally {
31516
- if (rendererFactory.end) {
31771
+ if (normalExecutionPath && rendererFactory.end) {
31517
31772
  rendererFactory.end();
31518
31773
  }
31519
31774
  leaveView(oldView);
@@ -31521,16 +31776,11 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31521
31776
  }
31522
31777
  /**
31523
31778
  * This function returns the default configuration of rendering flags depending on when the
31524
- * template is in creation mode or update mode. By default, the update block is run with the
31525
- * creation block when the view is in creation mode. Otherwise, the update block is run
31526
- * alone.
31527
- *
31528
- * Dynamically created views do NOT use this configuration (update block and create block are
31529
- * always run separately).
31779
+ * template is in creation mode or update mode. Update block and create block are
31780
+ * always run separately.
31530
31781
  */
31531
31782
  function getRenderFlags(view) {
31532
- return view[FLAGS] & 1 /* CreationMode */ ? 1 /* Create */ | 2 /* Update */ :
31533
- 2 /* Update */;
31783
+ return isCreationMode(view) ? 1 /* Create */ : 2 /* Update */;
31534
31784
  }
31535
31785
  //////////////////////////
31536
31786
  //// Namespace
@@ -31641,28 +31891,30 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31641
31891
  var isProc = isProceduralRenderer(renderer);
31642
31892
  var i = 0;
31643
31893
  while (i < attrs.length) {
31644
- var attrName = attrs[i];
31645
- if (attrName === 1 /* SelectOnly */)
31646
- break;
31647
- if (attrName === NG_PROJECT_AS_ATTR_NAME) {
31648
- i += 2;
31649
- }
31650
- else {
31651
- ngDevMode && ngDevMode.rendererSetAttribute++;
31894
+ var attrName = attrs[i++];
31895
+ if (typeof attrName == 'number') {
31652
31896
  if (attrName === 0 /* NamespaceURI */) {
31653
31897
  // Namespaced attributes
31654
- var namespaceURI = attrs[i + 1];
31655
- var attrName_1 = attrs[i + 2];
31656
- var attrVal = attrs[i + 3];
31898
+ var namespaceURI = attrs[i++];
31899
+ var attrName_1 = attrs[i++];
31900
+ var attrVal = attrs[i++];
31901
+ ngDevMode && ngDevMode.rendererSetAttribute++;
31657
31902
  isProc ?
31658
31903
  renderer
31659
31904
  .setAttribute(native, attrName_1, attrVal, namespaceURI) :
31660
31905
  native.setAttributeNS(namespaceURI, attrName_1, attrVal);
31661
- i += 4;
31662
31906
  }
31663
31907
  else {
31908
+ // All other `AttributeMarker`s are ignored here.
31909
+ break;
31910
+ }
31911
+ }
31912
+ else {
31913
+ /// attrName is string;
31914
+ var attrVal = attrs[i++];
31915
+ if (attrName !== NG_PROJECT_AS_ATTR_NAME) {
31664
31916
  // Standard attributes
31665
- var attrVal = attrs[i + 1];
31917
+ ngDevMode && ngDevMode.rendererSetAttribute++;
31666
31918
  if (isAnimationProp(attrName)) {
31667
31919
  if (isProc) {
31668
31920
  renderer.setProperty(native, attrName, attrVal);
@@ -31674,7 +31926,6 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31674
31926
  .setAttribute(native, attrName, attrVal) :
31675
31927
  native.setAttribute(attrName, attrVal);
31676
31928
  }
31677
- i += 2;
31678
31929
  }
31679
31930
  }
31680
31931
  }
@@ -31850,7 +32101,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31850
32101
  var dynamicViewData = container_1[VIEWS][i];
31851
32102
  // The directives and pipes are not needed here as an existing view is only being refreshed.
31852
32103
  ngDevMode && assertDefined(dynamicViewData[TVIEW], 'TView must be allocated');
31853
- renderEmbeddedTemplate(dynamicViewData, dynamicViewData[TVIEW], dynamicViewData[CONTEXT], 2 /* Update */);
32104
+ renderEmbeddedTemplate(dynamicViewData, dynamicViewData[TVIEW], dynamicViewData[CONTEXT]);
31854
32105
  }
31855
32106
  }
31856
32107
  }
@@ -31860,17 +32111,16 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31860
32111
  * Refreshes components by entering the component view and processing its bindings, queries, etc.
31861
32112
  *
31862
32113
  * @param adjustedElementIndex Element index in LView[] (adjusted for HEADER_OFFSET)
31863
- * @param rf The render flags that should be used to process this template
31864
32114
  */
31865
- function componentRefresh(adjustedElementIndex, rf) {
32115
+ function componentRefresh(adjustedElementIndex) {
31866
32116
  var lView = getLView();
31867
32117
  ngDevMode && assertDataInRange(lView, adjustedElementIndex);
31868
32118
  var hostView = getComponentViewByIndex(adjustedElementIndex, lView);
31869
32119
  ngDevMode && assertNodeType(lView[TVIEW].data[adjustedElementIndex], 3 /* Element */);
31870
32120
  // Only attached CheckAlways components or attached, dirty OnPush components should be checked
31871
- if (viewAttached(hostView) && hostView[FLAGS] & (2 /* CheckAlways */ | 4 /* Dirty */)) {
32121
+ if (viewAttached(hostView) && hostView[FLAGS] & (4 /* CheckAlways */ | 8 /* Dirty */)) {
31872
32122
  syncViewWithBlueprint(hostView);
31873
- detectChangesInternal(hostView, hostView[CONTEXT], rf);
32123
+ checkView(hostView, hostView[CONTEXT]);
31874
32124
  }
31875
32125
  }
31876
32126
  /**
@@ -31907,7 +32157,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31907
32157
  }
31908
32158
  /** Returns a boolean for whether the view is attached */
31909
32159
  function viewAttached(view) {
31910
- return (view[FLAGS] & 8 /* Attached */) === 8 /* Attached */;
32160
+ return (view[FLAGS] & 16 /* Attached */) === 16 /* Attached */;
31911
32161
  }
31912
32162
  /**
31913
32163
  * Adds LView or LContainer to the end of the current view tree.
@@ -31934,11 +32184,11 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31934
32184
  }
31935
32185
  /** Marks current view and all ancestors dirty */
31936
32186
  function markViewDirty(lView) {
31937
- while (lView && !(lView[FLAGS] & 64 /* IsRoot */)) {
31938
- lView[FLAGS] |= 4 /* Dirty */;
32187
+ while (lView && !(lView[FLAGS] & 128 /* IsRoot */)) {
32188
+ lView[FLAGS] |= 8 /* Dirty */;
31939
32189
  lView = lView[PARENT];
31940
32190
  }
31941
- lView[FLAGS] |= 4 /* Dirty */;
32191
+ lView[FLAGS] |= 8 /* Dirty */;
31942
32192
  ngDevMode && assertDefined(lView[CONTEXT], 'rootContext should be defined');
31943
32193
  var rootContext = lView[CONTEXT];
31944
32194
  scheduleTick(rootContext, 1 /* DetectChanges */);
@@ -31980,7 +32230,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31980
32230
  function tickRootContext(rootContext) {
31981
32231
  for (var i = 0; i < rootContext.components.length; i++) {
31982
32232
  var rootComponent = rootContext.components[i];
31983
- renderComponentOrTemplate(readPatchedLView(rootComponent), rootComponent, 2 /* Update */);
32233
+ renderComponentOrTemplate(readPatchedLView(rootComponent), rootComponent);
31984
32234
  }
31985
32235
  }
31986
32236
  /**
@@ -31997,7 +32247,19 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
31997
32247
  * @param component The component which the change detection should be performed on.
31998
32248
  */
31999
32249
  function detectChanges(component) {
32000
- detectChangesInternal(getComponentViewByInstance(component), component, null);
32250
+ var view = getComponentViewByInstance(component);
32251
+ detectChangesInternal(view, component);
32252
+ }
32253
+ function detectChangesInternal(view, context) {
32254
+ var rendererFactory = view[RENDERER_FACTORY];
32255
+ if (rendererFactory.begin)
32256
+ rendererFactory.begin();
32257
+ if (isCreationMode(view)) {
32258
+ checkView(view, context); // creation mode pass
32259
+ }
32260
+ checkView(view, context); // update mode pass
32261
+ if (rendererFactory.end)
32262
+ rendererFactory.end();
32001
32263
  }
32002
32264
  /**
32003
32265
  * Synchronously perform change detection on a root view and its components.
@@ -32041,30 +32303,29 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32041
32303
  }
32042
32304
  }
32043
32305
  /** Checks the view of the component provided. Does not gate on dirty checks or execute doCheck. */
32044
- function detectChangesInternal(hostView, component, rf) {
32306
+ function checkView(hostView, component) {
32045
32307
  var hostTView = hostView[TVIEW];
32046
32308
  var oldView = enterView(hostView, hostView[HOST_NODE]);
32047
32309
  var templateFn = hostTView.template;
32048
32310
  var viewQuery = hostTView.viewQuery;
32049
32311
  try {
32050
32312
  namespaceHTML();
32051
- createViewQuery(viewQuery, rf, hostView[FLAGS], component);
32052
- templateFn(rf || getRenderFlags(hostView), component);
32053
- refreshDescendantViews(hostView, rf);
32054
- updateViewQuery(viewQuery, hostView[FLAGS], component);
32313
+ createViewQuery(viewQuery, hostView, component);
32314
+ templateFn(getRenderFlags(hostView), component);
32315
+ refreshDescendantViews(hostView);
32316
+ updateViewQuery(viewQuery, hostView, component);
32055
32317
  }
32056
32318
  finally {
32057
- leaveView(oldView, rf === 1 /* Create */);
32319
+ leaveView(oldView);
32058
32320
  }
32059
32321
  }
32060
- function createViewQuery(viewQuery, renderFlags, viewFlags, component) {
32061
- if (viewQuery && (renderFlags === 1 /* Create */ ||
32062
- (renderFlags === null && (viewFlags & 1 /* CreationMode */)))) {
32322
+ function createViewQuery(viewQuery, view, component) {
32323
+ if (viewQuery && isCreationMode(view)) {
32063
32324
  viewQuery(1 /* Create */, component);
32064
32325
  }
32065
32326
  }
32066
- function updateViewQuery(viewQuery, flags, component) {
32067
- if (viewQuery && flags & 2 /* Update */) {
32327
+ function updateViewQuery(viewQuery, view, component) {
32328
+ if (viewQuery && !isCreationMode(view)) {
32068
32329
  viewQuery(2 /* Update */, component);
32069
32330
  }
32070
32331
  }
@@ -32122,7 +32383,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32122
32383
  function createRootComponentView(rNode, def, rootView, rendererFactory, renderer, sanitizer) {
32123
32384
  resetComponentState();
32124
32385
  var tView = rootView[TVIEW];
32125
- var componentView = createLView(rootView, getOrCreateTView(def.template, def.consts, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery), null, def.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */, rendererFactory, renderer, sanitizer);
32386
+ var componentView = createLView(rootView, getOrCreateTView(def.template, def.consts, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery), null, def.onPush ? 8 /* Dirty */ : 4 /* CheckAlways */, rendererFactory, renderer, sanitizer);
32126
32387
  var tNode = createNodeAtIndex(0, 3 /* Element */, rNode, null, null);
32127
32388
  if (tView.firstTemplatePass) {
32128
32389
  diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), rootView, def.type);
@@ -32300,7 +32561,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32300
32561
  var IDENT = function (value) {
32301
32562
  return value;
32302
32563
  };
32303
- var EMPTY$1 = [];
32564
+ var EMPTY = [];
32304
32565
  var CIRCULAR = IDENT;
32305
32566
  var MULTI_PROVIDER_FN = function () {
32306
32567
  return Array.prototype.slice.call(arguments);
@@ -32318,8 +32579,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32318
32579
  this.parent = parent;
32319
32580
  this.source = source;
32320
32581
  var records = this._records = new Map();
32321
- records.set(Injector, { token: Injector, fn: IDENT, deps: EMPTY$1, value: this, useNew: false });
32322
- records.set(INJECTOR$1, { token: INJECTOR$1, fn: IDENT, deps: EMPTY$1, value: this, useNew: false });
32582
+ records.set(Injector, { token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false });
32583
+ records.set(INJECTOR$1, { token: INJECTOR$1, fn: IDENT, deps: EMPTY, value: this, useNew: false });
32323
32584
  recursivelyProcessProviders(records, providers);
32324
32585
  }
32325
32586
  StaticInjector.prototype.get = function (token, notFoundValue, flags) {
@@ -32349,7 +32610,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32349
32610
  function resolveProvider(provider) {
32350
32611
  var deps = computeDeps(provider);
32351
32612
  var fn = IDENT;
32352
- var value = EMPTY$1;
32613
+ var value = EMPTY;
32353
32614
  var useNew = false;
32354
32615
  var provide = resolveForwardRef$1(provider.provide);
32355
32616
  if (USE_VALUE$2 in provider) {
@@ -32409,7 +32670,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32409
32670
  deps: [],
32410
32671
  useNew: false,
32411
32672
  fn: MULTI_PROVIDER_FN,
32412
- value: EMPTY$1
32673
+ value: EMPTY
32413
32674
  });
32414
32675
  }
32415
32676
  // Treat the provider as the token.
@@ -32440,7 +32701,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32440
32701
  path$$1.unshift(token);
32441
32702
  if (record && record.value == CIRCULAR) {
32442
32703
  // Reset the Circular flag.
32443
- record.value = EMPTY$1;
32704
+ record.value = EMPTY;
32444
32705
  }
32445
32706
  throw e;
32446
32707
  }
@@ -32455,13 +32716,13 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32455
32716
  if (value == CIRCULAR) {
32456
32717
  throw Error(NO_NEW_LINE + 'Circular dependency');
32457
32718
  }
32458
- else if (value === EMPTY$1) {
32719
+ else if (value === EMPTY) {
32459
32720
  record.value = CIRCULAR;
32460
32721
  var obj = undefined;
32461
32722
  var useNew = record.useNew;
32462
32723
  var fn = record.fn;
32463
32724
  var depRecords = record.deps;
32464
- var deps = EMPTY$1;
32725
+ var deps = EMPTY;
32465
32726
  if (depRecords.length) {
32466
32727
  deps = [];
32467
32728
  for (var i = 0; i < depRecords.length; i++) {
@@ -32490,7 +32751,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
32490
32751
  return value;
32491
32752
  }
32492
32753
  function computeDeps(provider) {
32493
- var deps = EMPTY$1;
32754
+ var deps = EMPTY;
32494
32755
  var providerDeps = provider.deps;
32495
32756
  if (providerDeps && providerDeps.length) {
32496
32757
  deps = [];
@@ -33094,7 +33355,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
33094
33355
  });
33095
33356
  Object.defineProperty(ViewRef.prototype, "destroyed", {
33096
33357
  get: function () {
33097
- return (this._lView[FLAGS] & 32 /* Destroyed */) === 32 /* Destroyed */;
33358
+ return (this._lView[FLAGS] & 64 /* Destroyed */) === 64 /* Destroyed */;
33098
33359
  },
33099
33360
  enumerable: true,
33100
33361
  configurable: true
@@ -33201,7 +33462,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
33201
33462
  * }
33202
33463
  * ```
33203
33464
  */
33204
- ViewRef.prototype.detach = function () { this._lView[FLAGS] &= ~8 /* Attached */; };
33465
+ ViewRef.prototype.detach = function () { this._lView[FLAGS] &= ~16 /* Attached */; };
33205
33466
  /**
33206
33467
  * Re-attaches a view to the change detection tree.
33207
33468
  *
@@ -33258,7 +33519,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
33258
33519
  * }
33259
33520
  * ```
33260
33521
  */
33261
- ViewRef.prototype.reattach = function () { this._lView[FLAGS] |= 8 /* Attached */; };
33522
+ ViewRef.prototype.reattach = function () { this._lView[FLAGS] |= 16 /* Attached */; };
33262
33523
  /**
33263
33524
  * Checks the view and its children.
33264
33525
  *
@@ -33280,16 +33541,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
33280
33541
  *
33281
33542
  * See {@link ChangeDetectorRef#detach detach} for more information.
33282
33543
  */
33283
- ViewRef.prototype.detectChanges = function () {
33284
- var rendererFactory = this._lView[RENDERER_FACTORY];
33285
- if (rendererFactory.begin) {
33286
- rendererFactory.begin();
33287
- }
33288
- detectChangesInternal(this._lView, this.context, null);
33289
- if (rendererFactory.end) {
33290
- rendererFactory.end();
33291
- }
33292
- };
33544
+ ViewRef.prototype.detectChanges = function () { detectChangesInternal(this._lView, this.context); };
33293
33545
  /**
33294
33546
  * Checks the change detector and its children, and throws if any changes are detected.
33295
33547
  *
@@ -33403,7 +33655,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
33403
33655
  if (container$$1) {
33404
33656
  insertView(lView, container$$1, hostView, index, hostTNode.index);
33405
33657
  }
33406
- renderEmbeddedTemplate(lView, this._tView, context, 1 /* Create */);
33658
+ renderEmbeddedTemplate(lView, this._tView, context);
33407
33659
  var viewRef = new ViewRef(lView, context, -1);
33408
33660
  viewRef._tViewNode = lView[HOST_NODE];
33409
33661
  return viewRef;
@@ -33581,7 +33833,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
33581
33833
  /**
33582
33834
  * @publicApi
33583
33835
  */
33584
- var VERSION$2 = new Version$1('7.2.0-rc.0');
33836
+ var VERSION$2 = new Version$1('7.2.0');
33585
33837
 
33586
33838
  /**
33587
33839
  * @license
@@ -33688,8 +33940,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
33688
33940
  var hostRNode = isInternalRootView ?
33689
33941
  elementCreate(this.selector, rendererFactory.createRenderer(null, this.componentDef)) :
33690
33942
  locateHostElement(rendererFactory, rootSelectorOrNode);
33691
- var rootFlags = this.componentDef.onPush ? 4 /* Dirty */ | 64 /* IsRoot */ :
33692
- 2 /* CheckAlways */ | 64 /* IsRoot */;
33943
+ var rootFlags = this.componentDef.onPush ? 8 /* Dirty */ | 128 /* IsRoot */ :
33944
+ 4 /* CheckAlways */ | 128 /* IsRoot */;
33693
33945
  var rootContext = !isInternalRootView ? rootViewInjector.get(ROOT_CONTEXT) : createRootContext();
33694
33946
  var renderer = rendererFactory.createRenderer(hostRNode, this.componentDef);
33695
33947
  if (rootSelectorOrNode && hostRNode) {
@@ -33742,10 +33994,10 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
33742
33994
  // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
33743
33995
  component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]);
33744
33996
  addToViewTree(rootLView, HEADER_OFFSET, componentView);
33745
- refreshDescendantViews(rootLView, 1 /* Create */);
33997
+ refreshDescendantViews(rootLView);
33746
33998
  }
33747
33999
  finally {
33748
- leaveView(oldLView, true);
34000
+ leaveView(oldLView);
33749
34001
  if (rendererFactory.end)
33750
34002
  rendererFactory.end();
33751
34003
  }
@@ -35549,9 +35801,9 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
35549
35801
 
35550
35802
  var queue = new QueueScheduler(QueueAction);
35551
35803
 
35552
- var EMPTY$2 = new Observable(function (subscriber) { return subscriber.complete(); });
35804
+ var EMPTY$1 = new Observable(function (subscriber) { return subscriber.complete(); });
35553
35805
  function empty$2(scheduler) {
35554
- return scheduler ? emptyScheduled(scheduler) : EMPTY$2;
35806
+ return scheduler ? emptyScheduled(scheduler) : EMPTY$1;
35555
35807
  }
35556
35808
  function emptyScheduled(scheduler) {
35557
35809
  return new Observable(function (subscriber) { return scheduler.schedule(function () { return subscriber.complete(); }); });
@@ -37567,7 +37819,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
37567
37819
  return factoryFn();
37568
37820
  }
37569
37821
  else {
37570
- var matchingIdx = locateDirectiveOrProvider(tNode, currentView, read, false);
37822
+ var matchingIdx = locateDirectiveOrProvider(tNode, currentView, read, false, false);
37571
37823
  if (matchingIdx !== null) {
37572
37824
  return getNodeInjectable(currentView[TVIEW].data, currentView, matchingIdx, tNode);
37573
37825
  }
@@ -37612,7 +37864,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
37612
37864
  result = queryByTemplateRef(type, tNode, currentView, predicate.read);
37613
37865
  }
37614
37866
  else {
37615
- var matchingIdx = locateDirectiveOrProvider(tNode, currentView, type, false);
37867
+ var matchingIdx = locateDirectiveOrProvider(tNode, currentView, type, false, false);
37616
37868
  if (matchingIdx !== null) {
37617
37869
  result = queryRead(tNode, currentView, predicate.read, matchingIdx);
37618
37870
  }
@@ -44914,8 +45166,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
44914
45166
  var lNode = lContext.lView[lContext.nodeIndex];
44915
45167
  var stylingContext = getStylingContext(lContext.nodeIndex, lContext.lView);
44916
45168
  if (stylingContext) {
44917
- for (var i = 8 /* SingleStylesStartPosition */; i < lNode.length; i += 4 /* Size */) {
44918
- if (isClassBased(lNode, i)) {
45169
+ for (var i = 9 /* SingleStylesStartPosition */; i < lNode.length; i += 4 /* Size */) {
45170
+ if (isClassBasedValue(lNode, i)) {
44919
45171
  var className = getProp(lNode, i);
44920
45172
  var value = getValue(lNode, i);
44921
45173
  if (typeof value == 'boolean') {
@@ -44947,8 +45199,8 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
44947
45199
  var lNode = lContext.lView[lContext.nodeIndex];
44948
45200
  var stylingContext = getStylingContext(lContext.nodeIndex, lContext.lView);
44949
45201
  if (stylingContext) {
44950
- for (var i = 8 /* SingleStylesStartPosition */; i < lNode.length; i += 4 /* Size */) {
44951
- if (!isClassBased(lNode, i)) {
45202
+ for (var i = 9 /* SingleStylesStartPosition */; i < lNode.length; i += 4 /* Size */) {
45203
+ if (!isClassBasedValue(lNode, i)) {
44952
45204
  var styleName = getProp(lNode, i);
44953
45205
  var value = getValue(lNode, i);
44954
45206
  if (value !== null) {
@@ -50823,7 +51075,7 @@ define(['exports', 'fs', 'path', 'typescript'], function (exports, fs, path, ts)
50823
51075
  * Use of this source code is governed by an MIT-style license that can be
50824
51076
  * found in the LICENSE file at https://angular.io/license
50825
51077
  */
50826
- var VERSION$3 = new Version$1('7.2.0-rc.0');
51078
+ var VERSION$3 = new Version$1('7.2.0');
50827
51079
 
50828
51080
  /**
50829
51081
  * @license