@angular/compiler 14.0.0-next.15 → 14.0.0-next.16
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.
- package/esm2020/src/core.mjs +6 -6
- package/esm2020/src/expression_parser/parser.mjs +12 -12
- package/esm2020/src/i18n/i18n_parser.mjs +3 -3
- package/esm2020/src/jit_compiler_facade.mjs +6 -6
- package/esm2020/src/ml_parser/html_whitespaces.mjs +2 -2
- package/esm2020/src/ml_parser/lexer.mjs +36 -36
- package/esm2020/src/ml_parser/parser.mjs +41 -41
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/component.mjs +2 -2
- package/esm2020/src/render3/partial/directive.mjs +3 -3
- package/esm2020/src/render3/partial/factory.mjs +1 -1
- package/esm2020/src/render3/partial/injectable.mjs +1 -1
- package/esm2020/src/render3/partial/injector.mjs +1 -1
- package/esm2020/src/render3/partial/ng_module.mjs +3 -3
- package/esm2020/src/render3/partial/pipe.mjs +3 -3
- package/esm2020/src/render3/r3_ast.mjs +3 -3
- package/esm2020/src/render3/r3_factory.mjs +6 -6
- package/esm2020/src/render3/util.mjs +4 -4
- package/esm2020/src/render3/view/compiler.mjs +28 -21
- package/esm2020/src/render3/view/i18n/meta.mjs +4 -4
- package/esm2020/src/render3/view/style_parser.mjs +19 -19
- package/esm2020/src/render3/view/styling_builder.mjs +6 -6
- package/esm2020/src/render3/view/template.mjs +22 -22
- package/esm2020/src/render3/view/util.mjs +4 -4
- package/esm2020/src/selector.mjs +8 -8
- package/esm2020/src/shadow_css.mjs +12 -291
- package/esm2020/src/template_parser/binding_parser.mjs +8 -8
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +224 -493
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +224 -496
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/index.d.ts +1 -1
- package/package.json +2 -2
- package/testing/index.d.ts +1 -1
package/fesm2015/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.16
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -211,7 +211,7 @@ class CssSelector {
|
|
|
211
211
|
let inNot = false;
|
|
212
212
|
_SELECTOR_REGEXP.lastIndex = 0;
|
|
213
213
|
while (match = _SELECTOR_REGEXP.exec(selector)) {
|
|
214
|
-
if (match[1 /* NOT */]) {
|
|
214
|
+
if (match[1 /* SelectorRegexp.NOT */]) {
|
|
215
215
|
if (inNot) {
|
|
216
216
|
throw new Error('Nesting :not in a selector is not allowed');
|
|
217
217
|
}
|
|
@@ -219,9 +219,9 @@ class CssSelector {
|
|
|
219
219
|
current = new CssSelector();
|
|
220
220
|
cssSelector.notSelectors.push(current);
|
|
221
221
|
}
|
|
222
|
-
const tag = match[2 /* TAG */];
|
|
222
|
+
const tag = match[2 /* SelectorRegexp.TAG */];
|
|
223
223
|
if (tag) {
|
|
224
|
-
const prefix = match[3 /* PREFIX */];
|
|
224
|
+
const prefix = match[3 /* SelectorRegexp.PREFIX */];
|
|
225
225
|
if (prefix === '#') {
|
|
226
226
|
// #hash
|
|
227
227
|
current.addAttribute('id', tag.slice(1));
|
|
@@ -235,15 +235,15 @@ class CssSelector {
|
|
|
235
235
|
current.setElement(tag);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
const attribute = match[4 /* ATTRIBUTE */];
|
|
238
|
+
const attribute = match[4 /* SelectorRegexp.ATTRIBUTE */];
|
|
239
239
|
if (attribute) {
|
|
240
|
-
current.addAttribute(current.unescapeAttribute(attribute), match[6 /* ATTRIBUTE_VALUE */]);
|
|
240
|
+
current.addAttribute(current.unescapeAttribute(attribute), match[6 /* SelectorRegexp.ATTRIBUTE_VALUE */]);
|
|
241
241
|
}
|
|
242
|
-
if (match[7 /* NOT_END */]) {
|
|
242
|
+
if (match[7 /* SelectorRegexp.NOT_END */]) {
|
|
243
243
|
inNot = false;
|
|
244
244
|
current = cssSelector;
|
|
245
245
|
}
|
|
246
|
-
if (match[8 /* SEPARATOR */]) {
|
|
246
|
+
if (match[8 /* SelectorRegexp.SEPARATOR */]) {
|
|
247
247
|
if (inNot) {
|
|
248
248
|
throw new Error('Multiple selectors in :not are not supported');
|
|
249
249
|
}
|
|
@@ -611,26 +611,26 @@ var MissingTranslationStrategy;
|
|
|
611
611
|
})(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
|
|
612
612
|
function parserSelectorToSimpleSelector(selector) {
|
|
613
613
|
const classes = selector.classNames && selector.classNames.length ?
|
|
614
|
-
[8 /* CLASS */, ...selector.classNames] :
|
|
614
|
+
[8 /* SelectorFlags.CLASS */, ...selector.classNames] :
|
|
615
615
|
[];
|
|
616
616
|
const elementName = selector.element && selector.element !== '*' ? selector.element : '';
|
|
617
617
|
return [elementName, ...selector.attrs, ...classes];
|
|
618
618
|
}
|
|
619
619
|
function parserSelectorToNegativeSelector(selector) {
|
|
620
620
|
const classes = selector.classNames && selector.classNames.length ?
|
|
621
|
-
[8 /* CLASS */, ...selector.classNames] :
|
|
621
|
+
[8 /* SelectorFlags.CLASS */, ...selector.classNames] :
|
|
622
622
|
[];
|
|
623
623
|
if (selector.element) {
|
|
624
624
|
return [
|
|
625
|
-
1 /* NOT */ | 4 /* ELEMENT */, selector.element, ...selector.attrs, ...classes
|
|
625
|
+
1 /* SelectorFlags.NOT */ | 4 /* SelectorFlags.ELEMENT */, selector.element, ...selector.attrs, ...classes
|
|
626
626
|
];
|
|
627
627
|
}
|
|
628
628
|
else if (selector.attrs.length) {
|
|
629
|
-
return [1 /* NOT */ | 2 /* ATTRIBUTE */, ...selector.attrs, ...classes];
|
|
629
|
+
return [1 /* SelectorFlags.NOT */ | 2 /* SelectorFlags.ATTRIBUTE */, ...selector.attrs, ...classes];
|
|
630
630
|
}
|
|
631
631
|
else {
|
|
632
632
|
return selector.classNames && selector.classNames.length ?
|
|
633
|
-
[1 /* NOT */ | 8 /* CLASS */, ...selector.classNames] :
|
|
633
|
+
[1 /* SelectorFlags.NOT */ | 8 /* SelectorFlags.CLASS */, ...selector.classNames] :
|
|
634
634
|
[];
|
|
635
635
|
}
|
|
636
636
|
}
|
|
@@ -3666,10 +3666,10 @@ function createMayBeForwardRefExpression(expression, forwardRef) {
|
|
|
3666
3666
|
*/
|
|
3667
3667
|
function convertFromMaybeForwardRefExpression({ expression, forwardRef }) {
|
|
3668
3668
|
switch (forwardRef) {
|
|
3669
|
-
case 0 /* None */:
|
|
3670
|
-
case 1 /* Wrapped */:
|
|
3669
|
+
case 0 /* ForwardRefHandling.None */:
|
|
3670
|
+
case 1 /* ForwardRefHandling.Wrapped */:
|
|
3671
3671
|
return expression;
|
|
3672
|
-
case 2 /* Unwrapped */:
|
|
3672
|
+
case 2 /* ForwardRefHandling.Unwrapped */:
|
|
3673
3673
|
return generateForwardRef(expression);
|
|
3674
3674
|
}
|
|
3675
3675
|
}
|
|
@@ -3793,14 +3793,14 @@ function compileInjectDependency(dep, target, index) {
|
|
|
3793
3793
|
}
|
|
3794
3794
|
else if (dep.attributeNameType === null) {
|
|
3795
3795
|
// Build up the injection flags according to the metadata.
|
|
3796
|
-
const flags = 0 /* Default */ | (dep.self ? 2 /* Self */ : 0) |
|
|
3797
|
-
(dep.skipSelf ? 4 /* SkipSelf */ : 0) | (dep.host ? 1 /* Host */ : 0) |
|
|
3798
|
-
(dep.optional ? 8 /* Optional */ : 0) |
|
|
3799
|
-
(target === FactoryTarget$1.Pipe ? 16 /* ForPipe */ : 0);
|
|
3796
|
+
const flags = 0 /* InjectFlags.Default */ | (dep.self ? 2 /* InjectFlags.Self */ : 0) |
|
|
3797
|
+
(dep.skipSelf ? 4 /* InjectFlags.SkipSelf */ : 0) | (dep.host ? 1 /* InjectFlags.Host */ : 0) |
|
|
3798
|
+
(dep.optional ? 8 /* InjectFlags.Optional */ : 0) |
|
|
3799
|
+
(target === FactoryTarget$1.Pipe ? 16 /* InjectFlags.ForPipe */ : 0);
|
|
3800
3800
|
// If this dependency is optional or otherwise has non-default flags, then additional
|
|
3801
3801
|
// parameters describing how to inject the dependency must be passed to the inject function
|
|
3802
3802
|
// that's being used.
|
|
3803
|
-
let flagsParam = (flags !== 0 /* Default */ || dep.optional) ? literal(flags) : null;
|
|
3803
|
+
let flagsParam = (flags !== 0 /* InjectFlags.Default */ || dep.optional) ? literal(flags) : null;
|
|
3804
3804
|
// Build up the arguments to the injectFn call.
|
|
3805
3805
|
const injectArgs = [dep.token];
|
|
3806
3806
|
if (flagsParam) {
|
|
@@ -3971,8 +3971,8 @@ class BoundEvent {
|
|
|
3971
3971
|
this.keySpan = keySpan;
|
|
3972
3972
|
}
|
|
3973
3973
|
static fromParsedEvent(event) {
|
|
3974
|
-
const target = event.type === 0 /* Regular */ ? event.targetOrPhase : null;
|
|
3975
|
-
const phase = event.type === 1 /* Animation */ ? event.targetOrPhase : null;
|
|
3974
|
+
const target = event.type === 0 /* ParsedEventType.Regular */ ? event.targetOrPhase : null;
|
|
3975
|
+
const phase = event.type === 1 /* ParsedEventType.Animation */ ? event.targetOrPhase : null;
|
|
3976
3976
|
if (event.keySpan === undefined) {
|
|
3977
3977
|
throw new Error(`Unexpected state: keySpan must be defined for bound event but was not for ${event.name}: ${event.sourceSpan}`);
|
|
3978
3978
|
}
|
|
@@ -5030,10 +5030,10 @@ function getQueryPredicate(query, constantPool) {
|
|
|
5030
5030
|
else {
|
|
5031
5031
|
// The original predicate may have been wrapped in a `forwardRef()` call.
|
|
5032
5032
|
switch (query.predicate.forwardRef) {
|
|
5033
|
-
case 0 /* None */:
|
|
5034
|
-
case 2 /* Unwrapped */:
|
|
5033
|
+
case 0 /* ForwardRefHandling.None */:
|
|
5034
|
+
case 2 /* ForwardRefHandling.Unwrapped */:
|
|
5035
5035
|
return query.predicate.expression;
|
|
5036
|
-
case 1 /* Wrapped */:
|
|
5036
|
+
case 1 /* ForwardRefHandling.Wrapped */:
|
|
5037
5037
|
return importExpr(Identifiers.resolveForwardRef).callFn([query.predicate.expression]);
|
|
5038
5038
|
}
|
|
5039
5039
|
}
|
|
@@ -7678,26 +7678,7 @@ class BuiltinFunctionCall extends Call {
|
|
|
7678
7678
|
* found in the LICENSE file at https://angular.io/license
|
|
7679
7679
|
*/
|
|
7680
7680
|
/**
|
|
7681
|
-
*
|
|
7682
|
-
* property and is used during the scoping of keyframes to make sure such keywords
|
|
7683
|
-
* are not modified.
|
|
7684
|
-
*/
|
|
7685
|
-
const animationKeywords = new Set([
|
|
7686
|
-
// global values
|
|
7687
|
-
'inherit', 'initial', 'revert', 'unset',
|
|
7688
|
-
// animation-direction
|
|
7689
|
-
'alternate', 'alternate-reverse', 'normal', 'reverse',
|
|
7690
|
-
// animation-fill-mode
|
|
7691
|
-
'backwards', 'both', 'forwards', 'none',
|
|
7692
|
-
// animation-play-state
|
|
7693
|
-
'paused', 'running',
|
|
7694
|
-
// animation-timing-function
|
|
7695
|
-
'ease', 'ease-in', 'ease-in-out', 'ease-out', 'linear', 'step-start', 'step-end',
|
|
7696
|
-
// `steps()` function
|
|
7697
|
-
'end', 'jump-both', 'jump-end', 'jump-none', 'jump-start', 'start'
|
|
7698
|
-
]);
|
|
7699
|
-
/**
|
|
7700
|
-
* The following class is a port of shadowCSS from webcomponents.js to TypeScript.
|
|
7681
|
+
* This file is a port of shadowCSS from webcomponents.js to TypeScript.
|
|
7701
7682
|
*
|
|
7702
7683
|
* Please make sure to keep to edits in sync with the source file.
|
|
7703
7684
|
*
|
|
@@ -7823,21 +7804,6 @@ const animationKeywords = new Set([
|
|
|
7823
7804
|
class ShadowCss {
|
|
7824
7805
|
constructor() {
|
|
7825
7806
|
this.strictStyling = true;
|
|
7826
|
-
/**
|
|
7827
|
-
* Regular expression used to extrapolate the possible keyframes from an
|
|
7828
|
-
* animation declaration (with possibly multiple animation definitions)
|
|
7829
|
-
*
|
|
7830
|
-
* The regular expression can be divided in three parts
|
|
7831
|
-
* - (^|\s+)
|
|
7832
|
-
* simply captures how many (if any) leading whitespaces are present
|
|
7833
|
-
* - (?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))
|
|
7834
|
-
* captures two different possible keyframes, ones which are quoted or ones which are valid css
|
|
7835
|
-
* idents (custom properties excluded)
|
|
7836
|
-
* - (?=[,\s;]|$)
|
|
7837
|
-
* simply matches the end of the possible keyframe, valid endings are: a comma, a space, a
|
|
7838
|
-
* semicolon or the end of the string
|
|
7839
|
-
*/
|
|
7840
|
-
this._animationDeclarationKeyframesRe = /(^|\s+)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;
|
|
7841
7807
|
}
|
|
7842
7808
|
/*
|
|
7843
7809
|
* Shim some cssText with the given selector. Returns cssText that can
|
|
@@ -7858,140 +7824,6 @@ class ShadowCss {
|
|
|
7858
7824
|
cssText = this._insertPolyfillDirectivesInCssText(cssText);
|
|
7859
7825
|
return this._insertPolyfillRulesInCssText(cssText);
|
|
7860
7826
|
}
|
|
7861
|
-
/**
|
|
7862
|
-
* Process styles to add scope to keyframes.
|
|
7863
|
-
*
|
|
7864
|
-
* Modify both the names of the keyframes defined in the component styles and also the css
|
|
7865
|
-
* animation rules using them.
|
|
7866
|
-
*
|
|
7867
|
-
* Animation rules using keyframes defined elsewhere are not modified to allow for globally
|
|
7868
|
-
* defined keyframes.
|
|
7869
|
-
*
|
|
7870
|
-
* For example, we convert this css:
|
|
7871
|
-
*
|
|
7872
|
-
* ```
|
|
7873
|
-
* .box {
|
|
7874
|
-
* animation: box-animation 1s forwards;
|
|
7875
|
-
* }
|
|
7876
|
-
*
|
|
7877
|
-
* @keyframes box-animation {
|
|
7878
|
-
* to {
|
|
7879
|
-
* background-color: green;
|
|
7880
|
-
* }
|
|
7881
|
-
* }
|
|
7882
|
-
* ```
|
|
7883
|
-
*
|
|
7884
|
-
* to this:
|
|
7885
|
-
*
|
|
7886
|
-
* ```
|
|
7887
|
-
* .box {
|
|
7888
|
-
* animation: scopeName_box-animation 1s forwards;
|
|
7889
|
-
* }
|
|
7890
|
-
*
|
|
7891
|
-
* @keyframes scopeName_box-animation {
|
|
7892
|
-
* to {
|
|
7893
|
-
* background-color: green;
|
|
7894
|
-
* }
|
|
7895
|
-
* }
|
|
7896
|
-
* ```
|
|
7897
|
-
*
|
|
7898
|
-
* @param cssText the component's css text that needs to be scoped.
|
|
7899
|
-
* @param scopeSelector the component's scope selector.
|
|
7900
|
-
*
|
|
7901
|
-
* @returns the scoped css text.
|
|
7902
|
-
*/
|
|
7903
|
-
_scopeKeyframesRelatedCss(cssText, scopeSelector) {
|
|
7904
|
-
const unscopedKeyframesSet = new Set();
|
|
7905
|
-
const scopedKeyframesCssText = processRules(cssText, rule => this._scopeLocalKeyframeDeclarations(rule, scopeSelector, unscopedKeyframesSet));
|
|
7906
|
-
return processRules(scopedKeyframesCssText, rule => this._scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet));
|
|
7907
|
-
}
|
|
7908
|
-
/**
|
|
7909
|
-
* Scopes local keyframes names, returning the updated css rule and it also
|
|
7910
|
-
* adds the original keyframe name to a provided set to collect all keyframes names
|
|
7911
|
-
* so that it can later be used to scope the animation rules.
|
|
7912
|
-
*
|
|
7913
|
-
* For example, it takes a rule such as:
|
|
7914
|
-
*
|
|
7915
|
-
* ```
|
|
7916
|
-
* @keyframes box-animation {
|
|
7917
|
-
* to {
|
|
7918
|
-
* background-color: green;
|
|
7919
|
-
* }
|
|
7920
|
-
* }
|
|
7921
|
-
* ```
|
|
7922
|
-
*
|
|
7923
|
-
* and returns:
|
|
7924
|
-
*
|
|
7925
|
-
* ```
|
|
7926
|
-
* @keyframes scopeName_box-animation {
|
|
7927
|
-
* to {
|
|
7928
|
-
* background-color: green;
|
|
7929
|
-
* }
|
|
7930
|
-
* }
|
|
7931
|
-
* ```
|
|
7932
|
-
* and as a side effect it adds "box-animation" to the `unscopedKeyframesSet` set
|
|
7933
|
-
*
|
|
7934
|
-
* @param cssRule the css rule to process.
|
|
7935
|
-
* @param scopeSelector the component's scope selector.
|
|
7936
|
-
* @param unscopedKeyframesSet the set of unscoped keyframes names (which can be
|
|
7937
|
-
* modified as a side effect)
|
|
7938
|
-
*
|
|
7939
|
-
* @returns the css rule modified with the scoped keyframes name.
|
|
7940
|
-
*/
|
|
7941
|
-
_scopeLocalKeyframeDeclarations(rule, scopeSelector, unscopedKeyframesSet) {
|
|
7942
|
-
return Object.assign(Object.assign({}, rule), { selector: rule.selector.replace(/(^@(?:-webkit-)?keyframes(?:\s+))(['"]?)(.+)\2(\s*)$/, (_, start, quote, keyframeName, endSpaces) => {
|
|
7943
|
-
unscopedKeyframesSet.add(unescapeQuotes(keyframeName, quote));
|
|
7944
|
-
return `${start}${quote}${scopeSelector}_${keyframeName}${quote}${endSpaces}`;
|
|
7945
|
-
}) });
|
|
7946
|
-
}
|
|
7947
|
-
/**
|
|
7948
|
-
* Function used to scope a keyframes name (obtained from an animation declaration)
|
|
7949
|
-
* using an existing set of unscopedKeyframes names to discern if the scoping needs to be
|
|
7950
|
-
* performed (keyframes names of keyframes not defined in the component's css need not to be
|
|
7951
|
-
* scoped).
|
|
7952
|
-
*
|
|
7953
|
-
* @param keyframe the keyframes name to check.
|
|
7954
|
-
* @param scopeSelector the component's scope selector.
|
|
7955
|
-
* @param unscopedKeyframesSet the set of unscoped keyframes names.
|
|
7956
|
-
*
|
|
7957
|
-
* @returns the scoped name of the keyframe, or the original name is the name need not to be
|
|
7958
|
-
* scoped.
|
|
7959
|
-
*/
|
|
7960
|
-
_scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet) {
|
|
7961
|
-
return keyframe.replace(/^(\s*)(['"]?)(.+?)\2(\s*)$/, (_, spaces1, quote, name, spaces2) => {
|
|
7962
|
-
name = `${unscopedKeyframesSet.has(unescapeQuotes(name, quote)) ? scopeSelector + '_' : ''}${name}`;
|
|
7963
|
-
return `${spaces1}${quote}${name}${quote}${spaces2}`;
|
|
7964
|
-
});
|
|
7965
|
-
}
|
|
7966
|
-
/**
|
|
7967
|
-
* Scope an animation rule so that the keyframes mentioned in such rule
|
|
7968
|
-
* are scoped if defined in the component's css and left untouched otherwise.
|
|
7969
|
-
*
|
|
7970
|
-
* It can scope values of both the 'animation' and 'animation-name' properties.
|
|
7971
|
-
*
|
|
7972
|
-
* @param rule css rule to scope.
|
|
7973
|
-
* @param scopeSelector the component's scope selector.
|
|
7974
|
-
* @param unscopedKeyframesSet the set of unscoped keyframes names.
|
|
7975
|
-
*
|
|
7976
|
-
* @returns the updated css rule.
|
|
7977
|
-
**/
|
|
7978
|
-
_scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet) {
|
|
7979
|
-
let content = rule.content.replace(/((?:^|\s+)(?:-webkit-)?animation(?:\s*):(?:\s*))([^;]+)/g, (_, start, animationDeclarations) => start +
|
|
7980
|
-
animationDeclarations.replace(this._animationDeclarationKeyframesRe, (original, leadingSpaces, quote = '', quotedName, nonQuotedName) => {
|
|
7981
|
-
if (quotedName) {
|
|
7982
|
-
return `${leadingSpaces}${this._scopeAnimationKeyframe(`${quote}${quotedName}${quote}`, scopeSelector, unscopedKeyframesSet)}`;
|
|
7983
|
-
}
|
|
7984
|
-
else {
|
|
7985
|
-
return animationKeywords.has(nonQuotedName) ?
|
|
7986
|
-
original :
|
|
7987
|
-
`${leadingSpaces}${this._scopeAnimationKeyframe(nonQuotedName, scopeSelector, unscopedKeyframesSet)}`;
|
|
7988
|
-
}
|
|
7989
|
-
}));
|
|
7990
|
-
content = content.replace(/((?:^|\s+)(?:-webkit-)?animation-name(?:\s*):(?:\s*))([^;]+)/g, (_match, start, commaSeparatedKeyframes) => `${start}${commaSeparatedKeyframes.split(',')
|
|
7991
|
-
.map((keyframe) => this._scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet))
|
|
7992
|
-
.join(',')}`);
|
|
7993
|
-
return Object.assign(Object.assign({}, rule), { content });
|
|
7994
|
-
}
|
|
7995
7827
|
/*
|
|
7996
7828
|
* Process styles to convert native ShadowDOM rules that will trip
|
|
7997
7829
|
* up the css parser; we rely on decorating the stylesheet with inert rules.
|
|
@@ -8050,7 +7882,6 @@ class ShadowCss {
|
|
|
8050
7882
|
cssText = this._convertColonHostContext(cssText);
|
|
8051
7883
|
cssText = this._convertShadowDOMSelectors(cssText);
|
|
8052
7884
|
if (scopeSelector) {
|
|
8053
|
-
cssText = this._scopeKeyframesRelatedCss(cssText, scopeSelector);
|
|
8054
7885
|
cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
|
|
8055
7886
|
}
|
|
8056
7887
|
cssText = cssText + '\n' + unscopedRules;
|
|
@@ -8423,14 +8254,11 @@ function extractCommentsWithHash(input) {
|
|
|
8423
8254
|
return input.match(_commentWithHashRe) || [];
|
|
8424
8255
|
}
|
|
8425
8256
|
const BLOCK_PLACEHOLDER = '%BLOCK%';
|
|
8257
|
+
const QUOTE_PLACEHOLDER = '%QUOTED%';
|
|
8426
8258
|
const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
8259
|
+
const _quotedRe = /%QUOTED%/g;
|
|
8427
8260
|
const CONTENT_PAIRS = new Map([['{', '}']]);
|
|
8428
|
-
const
|
|
8429
|
-
const SEMI_IN_PLACEHOLDER = '%SEMI_IN_PLACEHOLDER%';
|
|
8430
|
-
const COLON_IN_PLACEHOLDER = '%COLON_IN_PLACEHOLDER%';
|
|
8431
|
-
const _cssCommaInPlaceholderReGlobal = new RegExp(COMMA_IN_PLACEHOLDER, 'g');
|
|
8432
|
-
const _cssSemiInPlaceholderReGlobal = new RegExp(SEMI_IN_PLACEHOLDER, 'g');
|
|
8433
|
-
const _cssColonInPlaceholderReGlobal = new RegExp(COLON_IN_PLACEHOLDER, 'g');
|
|
8261
|
+
const QUOTE_PAIRS = new Map([[`"`, `"`], [`'`, `'`]]);
|
|
8434
8262
|
class CssRule {
|
|
8435
8263
|
constructor(selector, content) {
|
|
8436
8264
|
this.selector = selector;
|
|
@@ -8438,10 +8266,12 @@ class CssRule {
|
|
|
8438
8266
|
}
|
|
8439
8267
|
}
|
|
8440
8268
|
function processRules(input, ruleCallback) {
|
|
8441
|
-
const
|
|
8442
|
-
const inputWithEscapedBlocks = escapeBlocks(
|
|
8269
|
+
const inputWithEscapedQuotes = escapeBlocks(input, QUOTE_PAIRS, QUOTE_PLACEHOLDER);
|
|
8270
|
+
const inputWithEscapedBlocks = escapeBlocks(inputWithEscapedQuotes.escapedString, CONTENT_PAIRS, BLOCK_PLACEHOLDER);
|
|
8443
8271
|
let nextBlockIndex = 0;
|
|
8444
|
-
|
|
8272
|
+
let nextQuoteIndex = 0;
|
|
8273
|
+
return inputWithEscapedBlocks.escapedString
|
|
8274
|
+
.replace(_ruleRe, (...m) => {
|
|
8445
8275
|
const selector = m[2];
|
|
8446
8276
|
let content = '';
|
|
8447
8277
|
let suffix = m[4];
|
|
@@ -8453,8 +8283,8 @@ function processRules(input, ruleCallback) {
|
|
|
8453
8283
|
}
|
|
8454
8284
|
const rule = ruleCallback(new CssRule(selector, content));
|
|
8455
8285
|
return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
|
|
8456
|
-
})
|
|
8457
|
-
|
|
8286
|
+
})
|
|
8287
|
+
.replace(_quotedRe, () => inputWithEscapedQuotes.blocks[nextQuoteIndex++]);
|
|
8458
8288
|
}
|
|
8459
8289
|
class StringWithEscapedBlocks {
|
|
8460
8290
|
constructor(escapedString, blocks) {
|
|
@@ -8505,112 +8335,6 @@ function escapeBlocks(input, charPairs, placeholder) {
|
|
|
8505
8335
|
}
|
|
8506
8336
|
return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
|
|
8507
8337
|
}
|
|
8508
|
-
/**
|
|
8509
|
-
* Object containing as keys characters that should be substituted by placeholders
|
|
8510
|
-
* when found in strings during the css text parsing, and as values the respective
|
|
8511
|
-
* placeholders
|
|
8512
|
-
*/
|
|
8513
|
-
const ESCAPE_IN_STRING_MAP = {
|
|
8514
|
-
';': SEMI_IN_PLACEHOLDER,
|
|
8515
|
-
',': COMMA_IN_PLACEHOLDER,
|
|
8516
|
-
':': COLON_IN_PLACEHOLDER
|
|
8517
|
-
};
|
|
8518
|
-
/**
|
|
8519
|
-
* Parse the provided css text and inside strings (meaning, inside pairs of unescaped single or
|
|
8520
|
-
* double quotes) replace specific characters with their respective placeholders as indicated
|
|
8521
|
-
* by the `ESCAPE_IN_STRING_MAP` map.
|
|
8522
|
-
*
|
|
8523
|
-
* For example convert the text
|
|
8524
|
-
* `animation: "my-anim:at\"ion" 1s;`
|
|
8525
|
-
* to
|
|
8526
|
-
* `animation: "my-anim%COLON_IN_PLACEHOLDER%at\"ion" 1s;`
|
|
8527
|
-
*
|
|
8528
|
-
* This is necessary in order to remove the meaning of some characters when found inside strings
|
|
8529
|
-
* (for example `;` indicates the end of a css declaration, `,` the sequence of values and `:` the
|
|
8530
|
-
* division between property and value during a declaration, none of these meanings apply when such
|
|
8531
|
-
* characters are within strings and so in order to prevent parsing issues they need to be replaced
|
|
8532
|
-
* with placeholder text for the duration of the css manipulation process).
|
|
8533
|
-
*
|
|
8534
|
-
* @param input the original css text.
|
|
8535
|
-
*
|
|
8536
|
-
* @returns the css text with specific characters in strings replaced by placeholders.
|
|
8537
|
-
**/
|
|
8538
|
-
function escapeInStrings(input) {
|
|
8539
|
-
let result = input;
|
|
8540
|
-
let currentQuoteChar = null;
|
|
8541
|
-
for (let i = 0; i < result.length; i++) {
|
|
8542
|
-
const char = result[i];
|
|
8543
|
-
if (char === '\\') {
|
|
8544
|
-
i++;
|
|
8545
|
-
}
|
|
8546
|
-
else {
|
|
8547
|
-
if (currentQuoteChar !== null) {
|
|
8548
|
-
// index i is inside a quoted sub-string
|
|
8549
|
-
if (char === currentQuoteChar) {
|
|
8550
|
-
currentQuoteChar = null;
|
|
8551
|
-
}
|
|
8552
|
-
else {
|
|
8553
|
-
const placeholder = ESCAPE_IN_STRING_MAP[char];
|
|
8554
|
-
if (placeholder) {
|
|
8555
|
-
result = `${result.substr(0, i)}${placeholder}${result.substr(i + 1)}`;
|
|
8556
|
-
i += placeholder.length - 1;
|
|
8557
|
-
}
|
|
8558
|
-
}
|
|
8559
|
-
}
|
|
8560
|
-
else if (char === '\'' || char === '"') {
|
|
8561
|
-
currentQuoteChar = char;
|
|
8562
|
-
}
|
|
8563
|
-
}
|
|
8564
|
-
}
|
|
8565
|
-
return result;
|
|
8566
|
-
}
|
|
8567
|
-
/**
|
|
8568
|
-
* Replace in a string all occurrences of keys in the `ESCAPE_IN_STRING_MAP` map with their
|
|
8569
|
-
* original representation, this is simply used to revert the changes applied by the
|
|
8570
|
-
* escapeInStrings function.
|
|
8571
|
-
*
|
|
8572
|
-
* For example it reverts the text:
|
|
8573
|
-
* `animation: "my-anim%COLON_IN_PLACEHOLDER%at\"ion" 1s;`
|
|
8574
|
-
* to it's original form of:
|
|
8575
|
-
* `animation: "my-anim:at\"ion" 1s;`
|
|
8576
|
-
*
|
|
8577
|
-
* Note: For the sake of simplicity this function does not check that the placeholders are
|
|
8578
|
-
* actually inside strings as it would anyway be extremely unlikely to find them outside of strings.
|
|
8579
|
-
*
|
|
8580
|
-
* @param input the css text containing the placeholders.
|
|
8581
|
-
*
|
|
8582
|
-
* @returns the css text without the placeholders.
|
|
8583
|
-
*/
|
|
8584
|
-
function unescapeInStrings(input) {
|
|
8585
|
-
let result = input.replace(_cssCommaInPlaceholderReGlobal, ',');
|
|
8586
|
-
result = result.replace(_cssSemiInPlaceholderReGlobal, ';');
|
|
8587
|
-
result = result.replace(_cssColonInPlaceholderReGlobal, ':');
|
|
8588
|
-
return result;
|
|
8589
|
-
}
|
|
8590
|
-
/**
|
|
8591
|
-
* Unescape all quotes present in a string, but only if the string was actually already
|
|
8592
|
-
* quoted.
|
|
8593
|
-
*
|
|
8594
|
-
* This generates a "canonical" representation of strings which can be used to match strings
|
|
8595
|
-
* which would otherwise only differ because of differently escaped quotes.
|
|
8596
|
-
*
|
|
8597
|
-
* For example it converts the string (assumed to be quoted):
|
|
8598
|
-
* `this \\"is\\" a \\'\\\\'test`
|
|
8599
|
-
* to:
|
|
8600
|
-
* `this "is" a '\\\\'test`
|
|
8601
|
-
* (note that the latter backslashes are not removed as they are not actually escaping the single
|
|
8602
|
-
* quote)
|
|
8603
|
-
*
|
|
8604
|
-
*
|
|
8605
|
-
* @param input the string possibly containing escaped quotes.
|
|
8606
|
-
* @param isQuoted boolean indicating whether the string was quoted inside a bigger string (if not
|
|
8607
|
-
* then it means that it doesn't represent an inner string and thus no unescaping is required)
|
|
8608
|
-
*
|
|
8609
|
-
* @returns the string in the "canonical" representation without escaped quotes.
|
|
8610
|
-
*/
|
|
8611
|
-
function unescapeQuotes(str, isQuoted) {
|
|
8612
|
-
return !isQuoted ? str : str.replace(/((?:^|[^\\])(?:\\\\)*)\\(?=['"])/g, '$1');
|
|
8613
|
-
}
|
|
8614
8338
|
/**
|
|
8615
8339
|
* Combine the `contextSelectors` with the `hostMarker` and the `otherSelectors`
|
|
8616
8340
|
* to create a selector that matches the same as `:host-context()`.
|
|
@@ -8709,7 +8433,7 @@ function parse(value) {
|
|
|
8709
8433
|
const styles = [];
|
|
8710
8434
|
let i = 0;
|
|
8711
8435
|
let parenDepth = 0;
|
|
8712
|
-
let quote = 0 /* QuoteNone */;
|
|
8436
|
+
let quote = 0 /* Char.QuoteNone */;
|
|
8713
8437
|
let valueStart = 0;
|
|
8714
8438
|
let propStart = 0;
|
|
8715
8439
|
let currentProp = null;
|
|
@@ -8717,41 +8441,41 @@ function parse(value) {
|
|
|
8717
8441
|
while (i < value.length) {
|
|
8718
8442
|
const token = value.charCodeAt(i++);
|
|
8719
8443
|
switch (token) {
|
|
8720
|
-
case 40 /* OpenParen */:
|
|
8444
|
+
case 40 /* Char.OpenParen */:
|
|
8721
8445
|
parenDepth++;
|
|
8722
8446
|
break;
|
|
8723
|
-
case 41 /* CloseParen */:
|
|
8447
|
+
case 41 /* Char.CloseParen */:
|
|
8724
8448
|
parenDepth--;
|
|
8725
8449
|
break;
|
|
8726
|
-
case 39 /* QuoteSingle */:
|
|
8450
|
+
case 39 /* Char.QuoteSingle */:
|
|
8727
8451
|
// valueStart needs to be there since prop values don't
|
|
8728
8452
|
// have quotes in CSS
|
|
8729
8453
|
valueHasQuotes = valueHasQuotes || valueStart > 0;
|
|
8730
|
-
if (quote === 0 /* QuoteNone */) {
|
|
8731
|
-
quote = 39 /* QuoteSingle */;
|
|
8454
|
+
if (quote === 0 /* Char.QuoteNone */) {
|
|
8455
|
+
quote = 39 /* Char.QuoteSingle */;
|
|
8732
8456
|
}
|
|
8733
|
-
else if (quote === 39 /* QuoteSingle */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */) {
|
|
8734
|
-
quote = 0 /* QuoteNone */;
|
|
8457
|
+
else if (quote === 39 /* Char.QuoteSingle */ && value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */) {
|
|
8458
|
+
quote = 0 /* Char.QuoteNone */;
|
|
8735
8459
|
}
|
|
8736
8460
|
break;
|
|
8737
|
-
case 34 /* QuoteDouble */:
|
|
8461
|
+
case 34 /* Char.QuoteDouble */:
|
|
8738
8462
|
// same logic as above
|
|
8739
8463
|
valueHasQuotes = valueHasQuotes || valueStart > 0;
|
|
8740
|
-
if (quote === 0 /* QuoteNone */) {
|
|
8741
|
-
quote = 34 /* QuoteDouble */;
|
|
8464
|
+
if (quote === 0 /* Char.QuoteNone */) {
|
|
8465
|
+
quote = 34 /* Char.QuoteDouble */;
|
|
8742
8466
|
}
|
|
8743
|
-
else if (quote === 34 /* QuoteDouble */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */) {
|
|
8744
|
-
quote = 0 /* QuoteNone */;
|
|
8467
|
+
else if (quote === 34 /* Char.QuoteDouble */ && value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */) {
|
|
8468
|
+
quote = 0 /* Char.QuoteNone */;
|
|
8745
8469
|
}
|
|
8746
8470
|
break;
|
|
8747
|
-
case 58 /* Colon */:
|
|
8748
|
-
if (!currentProp && parenDepth === 0 && quote === 0 /* QuoteNone */) {
|
|
8471
|
+
case 58 /* Char.Colon */:
|
|
8472
|
+
if (!currentProp && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
|
8749
8473
|
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
|
8750
8474
|
valueStart = i;
|
|
8751
8475
|
}
|
|
8752
8476
|
break;
|
|
8753
|
-
case 59 /* Semicolon */:
|
|
8754
|
-
if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* QuoteNone */) {
|
|
8477
|
+
case 59 /* Char.Semicolon */:
|
|
8478
|
+
if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
|
8755
8479
|
const styleVal = value.substring(valueStart, i - 1).trim();
|
|
8756
8480
|
styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
|
|
8757
8481
|
propStart = i;
|
|
@@ -8771,7 +8495,7 @@ function parse(value) {
|
|
|
8771
8495
|
function stripUnnecessaryQuotes(value) {
|
|
8772
8496
|
const qS = value.charCodeAt(0);
|
|
8773
8497
|
const qE = value.charCodeAt(value.length - 1);
|
|
8774
|
-
if (qS == qE && (qS == 39 /* QuoteSingle */ || qS == 34 /* QuoteDouble */)) {
|
|
8498
|
+
if (qS == qE && (qS == 39 /* Char.QuoteSingle */ || qS == 34 /* Char.QuoteDouble */)) {
|
|
8775
8499
|
const tempValue = value.substring(1, value.length - 1);
|
|
8776
8500
|
// special case to avoid using a multi-quoted string that was just chomped
|
|
8777
8501
|
// (e.g. `font-family: "Verdana", "sans-serif"`)
|
|
@@ -8922,13 +8646,13 @@ class StylingBuilder {
|
|
|
8922
8646
|
let binding = null;
|
|
8923
8647
|
let name = input.name;
|
|
8924
8648
|
switch (input.type) {
|
|
8925
|
-
case 0 /* Property */:
|
|
8649
|
+
case 0 /* BindingType.Property */:
|
|
8926
8650
|
binding = this.registerInputBasedOnName(name, input.value, input.sourceSpan);
|
|
8927
8651
|
break;
|
|
8928
|
-
case 3 /* Style */:
|
|
8652
|
+
case 3 /* BindingType.Style */:
|
|
8929
8653
|
binding = this.registerStyleInput(name, false, input.value, input.sourceSpan, input.unit);
|
|
8930
8654
|
break;
|
|
8931
|
-
case 2 /* Class */:
|
|
8655
|
+
case 2 /* BindingType.Class */:
|
|
8932
8656
|
binding = this.registerClassInput(name, false, input.value, input.sourceSpan);
|
|
8933
8657
|
break;
|
|
8934
8658
|
}
|
|
@@ -9027,14 +8751,14 @@ class StylingBuilder {
|
|
|
9027
8751
|
populateInitialStylingAttrs(attrs) {
|
|
9028
8752
|
// [CLASS_MARKER, 'foo', 'bar', 'baz' ...]
|
|
9029
8753
|
if (this._initialClassValues.length) {
|
|
9030
|
-
attrs.push(literal(1 /* Classes */));
|
|
8754
|
+
attrs.push(literal(1 /* AttributeMarker.Classes */));
|
|
9031
8755
|
for (let i = 0; i < this._initialClassValues.length; i++) {
|
|
9032
8756
|
attrs.push(literal(this._initialClassValues[i]));
|
|
9033
8757
|
}
|
|
9034
8758
|
}
|
|
9035
8759
|
// [STYLE_MARKER, 'width', '200px', 'height', '100px', ...]
|
|
9036
8760
|
if (this._initialStyleValues.length) {
|
|
9037
|
-
attrs.push(literal(2 /* Styles */));
|
|
8761
|
+
attrs.push(literal(2 /* AttributeMarker.Styles */));
|
|
9038
8762
|
for (let i = 0; i < this._initialStyleValues.length; i += 2) {
|
|
9039
8763
|
attrs.push(literal(this._initialStyleValues[i]), literal(this._initialStyleValues[i + 1]));
|
|
9040
8764
|
}
|
|
@@ -9766,9 +9490,9 @@ class Parser$1 {
|
|
|
9766
9490
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9767
9491
|
const sourceToLex = this._stripComments(input);
|
|
9768
9492
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9769
|
-
let flags = 1 /* Action */;
|
|
9493
|
+
let flags = 1 /* ParseFlags.Action */;
|
|
9770
9494
|
if (isAssignmentEvent) {
|
|
9771
|
-
flags |= 2 /* AssignmentEvent */;
|
|
9495
|
+
flags |= 2 /* ParseFlags.AssignmentEvent */;
|
|
9772
9496
|
}
|
|
9773
9497
|
const ast = new _ParseAST(input, location, absoluteOffset, tokens, flags, this.errors, 0).parseChain();
|
|
9774
9498
|
return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
|
|
@@ -9797,7 +9521,7 @@ class Parser$1 {
|
|
|
9797
9521
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9798
9522
|
const sourceToLex = this._stripComments(input);
|
|
9799
9523
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9800
|
-
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9524
|
+
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0)
|
|
9801
9525
|
.parseChain();
|
|
9802
9526
|
}
|
|
9803
9527
|
/**
|
|
@@ -9828,7 +9552,7 @@ class Parser$1 {
|
|
|
9828
9552
|
*/
|
|
9829
9553
|
parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
|
|
9830
9554
|
const tokens = this._lexer.tokenize(templateValue);
|
|
9831
|
-
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* None */, this.errors, 0 /* relative offset */);
|
|
9555
|
+
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0 /* relative offset */);
|
|
9832
9556
|
return parser.parseTemplateBindings({
|
|
9833
9557
|
source: templateKey,
|
|
9834
9558
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
@@ -9843,7 +9567,7 @@ class Parser$1 {
|
|
|
9843
9567
|
const expressionText = expressions[i].text;
|
|
9844
9568
|
const sourceToLex = this._stripComments(expressionText);
|
|
9845
9569
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9846
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, offsets[i])
|
|
9570
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, offsets[i])
|
|
9847
9571
|
.parseChain();
|
|
9848
9572
|
expressionNodes.push(ast);
|
|
9849
9573
|
}
|
|
@@ -9857,7 +9581,7 @@ class Parser$1 {
|
|
|
9857
9581
|
parseInterpolationExpression(expression, location, absoluteOffset) {
|
|
9858
9582
|
const sourceToLex = this._stripComments(expression);
|
|
9859
9583
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9860
|
-
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9584
|
+
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0)
|
|
9861
9585
|
.parseChain();
|
|
9862
9586
|
const strings = ['', '']; // The prefix and suffix strings are both empty
|
|
9863
9587
|
return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);
|
|
@@ -10214,7 +9938,7 @@ class _ParseAST {
|
|
|
10214
9938
|
const expr = this.parsePipe();
|
|
10215
9939
|
exprs.push(expr);
|
|
10216
9940
|
if (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
10217
|
-
if (!(this.parseFlags & 1 /* Action */)) {
|
|
9941
|
+
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
10218
9942
|
this.error('Binding expression cannot contain chained expression');
|
|
10219
9943
|
}
|
|
10220
9944
|
while (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
@@ -10238,7 +9962,7 @@ class _ParseAST {
|
|
|
10238
9962
|
const start = this.inputIndex;
|
|
10239
9963
|
let result = this.parseExpression();
|
|
10240
9964
|
if (this.consumeOptionalOperator('|')) {
|
|
10241
|
-
if (this.parseFlags & 1 /* Action */) {
|
|
9965
|
+
if (this.parseFlags & 1 /* ParseFlags.Action */) {
|
|
10242
9966
|
this.error('Cannot have a pipe in an action expression');
|
|
10243
9967
|
}
|
|
10244
9968
|
do {
|
|
@@ -10591,7 +10315,7 @@ class _ParseAST {
|
|
|
10591
10315
|
}
|
|
10592
10316
|
else {
|
|
10593
10317
|
if (this.consumeOptionalAssignment()) {
|
|
10594
|
-
if (!(this.parseFlags & 1 /* Action */)) {
|
|
10318
|
+
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
10595
10319
|
this.error('Bindings cannot contain assignments');
|
|
10596
10320
|
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10597
10321
|
}
|
|
@@ -10623,7 +10347,7 @@ class _ParseAST {
|
|
|
10623
10347
|
// primary expression is substituted as LHS of the assignment operator to achieve
|
|
10624
10348
|
// two-way-binding, such that the LHS could be the non-null operator. The grammar doesn't
|
|
10625
10349
|
// naturally allow for this syntax, so assignment events are parsed specially.
|
|
10626
|
-
if ((this.parseFlags & 2 /* AssignmentEvent */) && this.next.isOperator('!') &&
|
|
10350
|
+
if ((this.parseFlags & 2 /* ParseFlags.AssignmentEvent */) && this.next.isOperator('!') &&
|
|
10627
10351
|
this.peek(1).isOperator('=')) {
|
|
10628
10352
|
// First skip over the ! operator.
|
|
10629
10353
|
this.advance();
|
|
@@ -10945,7 +10669,7 @@ function getIndexMapForOriginalTemplate(interpolatedTokens) {
|
|
|
10945
10669
|
let tokenIndex = 0;
|
|
10946
10670
|
while (tokenIndex < interpolatedTokens.length) {
|
|
10947
10671
|
const currentToken = interpolatedTokens[tokenIndex];
|
|
10948
|
-
if (currentToken.type === 9 /* ENCODED_ENTITY */) {
|
|
10672
|
+
if (currentToken.type === 9 /* MlParserTokenType.ENCODED_ENTITY */) {
|
|
10949
10673
|
const [decoded, encoded] = currentToken.parts;
|
|
10950
10674
|
consumedInOriginalTemplate += encoded.length;
|
|
10951
10675
|
consumedInInput += decoded.length;
|
|
@@ -13343,14 +13067,14 @@ class _Tokenizer {
|
|
|
13343
13067
|
else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
|
|
13344
13068
|
// In (possibly interpolated) text the end of the text is given by `isTextEnd()`, while
|
|
13345
13069
|
// the premature end of an interpolation is given by the start of a new HTML element.
|
|
13346
|
-
this._consumeWithInterpolation(5 /* TEXT */, 8 /* INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
|
13070
|
+
this._consumeWithInterpolation(5 /* TokenType.TEXT */, 8 /* TokenType.INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
|
13347
13071
|
}
|
|
13348
13072
|
}
|
|
13349
13073
|
catch (e) {
|
|
13350
13074
|
this.handleError(e);
|
|
13351
13075
|
}
|
|
13352
13076
|
}
|
|
13353
|
-
this._beginToken(24 /* EOF */);
|
|
13077
|
+
this._beginToken(24 /* TokenType.EOF */);
|
|
13354
13078
|
this._endToken([]);
|
|
13355
13079
|
}
|
|
13356
13080
|
/**
|
|
@@ -13494,7 +13218,7 @@ class _Tokenizer {
|
|
|
13494
13218
|
return char;
|
|
13495
13219
|
}
|
|
13496
13220
|
_consumeEntity(textTokenType) {
|
|
13497
|
-
this._beginToken(9 /* ENCODED_ENTITY */);
|
|
13221
|
+
this._beginToken(9 /* TokenType.ENCODED_ENTITY */);
|
|
13498
13222
|
const start = this._cursor.clone();
|
|
13499
13223
|
this._cursor.advance();
|
|
13500
13224
|
if (this._attemptCharCode($HASH)) {
|
|
@@ -13540,7 +13264,7 @@ class _Tokenizer {
|
|
|
13540
13264
|
}
|
|
13541
13265
|
}
|
|
13542
13266
|
_consumeRawText(consumeEntities, endMarkerPredicate) {
|
|
13543
|
-
this._beginToken(consumeEntities ? 6 /* ESCAPABLE_RAW_TEXT */ : 7 /* RAW_TEXT */);
|
|
13267
|
+
this._beginToken(consumeEntities ? 6 /* TokenType.ESCAPABLE_RAW_TEXT */ : 7 /* TokenType.RAW_TEXT */);
|
|
13544
13268
|
const parts = [];
|
|
13545
13269
|
while (true) {
|
|
13546
13270
|
const tagCloseStart = this._cursor.clone();
|
|
@@ -13552,8 +13276,8 @@ class _Tokenizer {
|
|
|
13552
13276
|
if (consumeEntities && this._cursor.peek() === $AMPERSAND) {
|
|
13553
13277
|
this._endToken([this._processCarriageReturns(parts.join(''))]);
|
|
13554
13278
|
parts.length = 0;
|
|
13555
|
-
this._consumeEntity(6 /* ESCAPABLE_RAW_TEXT */);
|
|
13556
|
-
this._beginToken(6 /* ESCAPABLE_RAW_TEXT */);
|
|
13279
|
+
this._consumeEntity(6 /* TokenType.ESCAPABLE_RAW_TEXT */);
|
|
13280
|
+
this._beginToken(6 /* TokenType.ESCAPABLE_RAW_TEXT */);
|
|
13557
13281
|
}
|
|
13558
13282
|
else {
|
|
13559
13283
|
parts.push(this._readChar());
|
|
@@ -13562,25 +13286,25 @@ class _Tokenizer {
|
|
|
13562
13286
|
this._endToken([this._processCarriageReturns(parts.join(''))]);
|
|
13563
13287
|
}
|
|
13564
13288
|
_consumeComment(start) {
|
|
13565
|
-
this._beginToken(10 /* COMMENT_START */, start);
|
|
13289
|
+
this._beginToken(10 /* TokenType.COMMENT_START */, start);
|
|
13566
13290
|
this._requireCharCode($MINUS);
|
|
13567
13291
|
this._endToken([]);
|
|
13568
13292
|
this._consumeRawText(false, () => this._attemptStr('-->'));
|
|
13569
|
-
this._beginToken(11 /* COMMENT_END */);
|
|
13293
|
+
this._beginToken(11 /* TokenType.COMMENT_END */);
|
|
13570
13294
|
this._requireStr('-->');
|
|
13571
13295
|
this._endToken([]);
|
|
13572
13296
|
}
|
|
13573
13297
|
_consumeCdata(start) {
|
|
13574
|
-
this._beginToken(12 /* CDATA_START */, start);
|
|
13298
|
+
this._beginToken(12 /* TokenType.CDATA_START */, start);
|
|
13575
13299
|
this._requireStr('CDATA[');
|
|
13576
13300
|
this._endToken([]);
|
|
13577
13301
|
this._consumeRawText(false, () => this._attemptStr(']]>'));
|
|
13578
|
-
this._beginToken(13 /* CDATA_END */);
|
|
13302
|
+
this._beginToken(13 /* TokenType.CDATA_END */);
|
|
13579
13303
|
this._requireStr(']]>');
|
|
13580
13304
|
this._endToken([]);
|
|
13581
13305
|
}
|
|
13582
13306
|
_consumeDocType(start) {
|
|
13583
|
-
this._beginToken(18 /* DOC_TYPE */, start);
|
|
13307
|
+
this._beginToken(18 /* TokenType.DOC_TYPE */, start);
|
|
13584
13308
|
const contentStart = this._cursor.clone();
|
|
13585
13309
|
this._attemptUntilChar($GT);
|
|
13586
13310
|
const content = this._cursor.getChars(contentStart);
|
|
@@ -13634,12 +13358,12 @@ class _Tokenizer {
|
|
|
13634
13358
|
if (e instanceof _ControlFlowError) {
|
|
13635
13359
|
if (openTagToken) {
|
|
13636
13360
|
// We errored before we could close the opening tag, so it is incomplete.
|
|
13637
|
-
openTagToken.type = 4 /* INCOMPLETE_TAG_OPEN */;
|
|
13361
|
+
openTagToken.type = 4 /* TokenType.INCOMPLETE_TAG_OPEN */;
|
|
13638
13362
|
}
|
|
13639
13363
|
else {
|
|
13640
13364
|
// When the start tag is invalid, assume we want a "<" as text.
|
|
13641
13365
|
// Back to back text tokens are merged at the end.
|
|
13642
|
-
this._beginToken(5 /* TEXT */, start);
|
|
13366
|
+
this._beginToken(5 /* TokenType.TEXT */, start);
|
|
13643
13367
|
this._endToken(['<']);
|
|
13644
13368
|
}
|
|
13645
13369
|
return;
|
|
@@ -13666,13 +13390,13 @@ class _Tokenizer {
|
|
|
13666
13390
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13667
13391
|
return this._attemptCharCode($GT);
|
|
13668
13392
|
});
|
|
13669
|
-
this._beginToken(3 /* TAG_CLOSE */);
|
|
13393
|
+
this._beginToken(3 /* TokenType.TAG_CLOSE */);
|
|
13670
13394
|
this._requireCharCodeUntilFn(code => code === $GT, 3);
|
|
13671
13395
|
this._cursor.advance(); // Consume the `>`
|
|
13672
13396
|
this._endToken([prefix, tagName]);
|
|
13673
13397
|
}
|
|
13674
13398
|
_consumeTagOpenStart(start) {
|
|
13675
|
-
this._beginToken(0 /* TAG_OPEN_START */, start);
|
|
13399
|
+
this._beginToken(0 /* TokenType.TAG_OPEN_START */, start);
|
|
13676
13400
|
const parts = this._consumePrefixAndName();
|
|
13677
13401
|
return this._endToken(parts);
|
|
13678
13402
|
}
|
|
@@ -13681,7 +13405,7 @@ class _Tokenizer {
|
|
|
13681
13405
|
if (attrNameStart === $SQ || attrNameStart === $DQ) {
|
|
13682
13406
|
throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan());
|
|
13683
13407
|
}
|
|
13684
|
-
this._beginToken(14 /* ATTR_NAME */);
|
|
13408
|
+
this._beginToken(14 /* TokenType.ATTR_NAME */);
|
|
13685
13409
|
const prefixAndName = this._consumePrefixAndName();
|
|
13686
13410
|
this._endToken(prefixAndName);
|
|
13687
13411
|
}
|
|
@@ -13693,27 +13417,27 @@ class _Tokenizer {
|
|
|
13693
13417
|
// In an attribute then end of the attribute value and the premature end to an interpolation
|
|
13694
13418
|
// are both triggered by the `quoteChar`.
|
|
13695
13419
|
const endPredicate = () => this._cursor.peek() === quoteChar;
|
|
13696
|
-
this._consumeWithInterpolation(16 /* ATTR_VALUE_TEXT */, 17 /* ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13420
|
+
this._consumeWithInterpolation(16 /* TokenType.ATTR_VALUE_TEXT */, 17 /* TokenType.ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13697
13421
|
this._consumeQuote(quoteChar);
|
|
13698
13422
|
}
|
|
13699
13423
|
else {
|
|
13700
13424
|
const endPredicate = () => isNameEnd(this._cursor.peek());
|
|
13701
|
-
this._consumeWithInterpolation(16 /* ATTR_VALUE_TEXT */, 17 /* ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13425
|
+
this._consumeWithInterpolation(16 /* TokenType.ATTR_VALUE_TEXT */, 17 /* TokenType.ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13702
13426
|
}
|
|
13703
13427
|
}
|
|
13704
13428
|
_consumeQuote(quoteChar) {
|
|
13705
|
-
this._beginToken(15 /* ATTR_QUOTE */);
|
|
13429
|
+
this._beginToken(15 /* TokenType.ATTR_QUOTE */);
|
|
13706
13430
|
this._requireCharCode(quoteChar);
|
|
13707
13431
|
this._endToken([String.fromCodePoint(quoteChar)]);
|
|
13708
13432
|
}
|
|
13709
13433
|
_consumeTagOpenEnd() {
|
|
13710
|
-
const tokenType = this._attemptCharCode($SLASH) ? 2 /* TAG_OPEN_END_VOID */ : 1 /* TAG_OPEN_END */;
|
|
13434
|
+
const tokenType = this._attemptCharCode($SLASH) ? 2 /* TokenType.TAG_OPEN_END_VOID */ : 1 /* TokenType.TAG_OPEN_END */;
|
|
13711
13435
|
this._beginToken(tokenType);
|
|
13712
13436
|
this._requireCharCode($GT);
|
|
13713
13437
|
this._endToken([]);
|
|
13714
13438
|
}
|
|
13715
13439
|
_consumeTagClose(start) {
|
|
13716
|
-
this._beginToken(3 /* TAG_CLOSE */, start);
|
|
13440
|
+
this._beginToken(3 /* TokenType.TAG_CLOSE */, start);
|
|
13717
13441
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13718
13442
|
const prefixAndName = this._consumePrefixAndName();
|
|
13719
13443
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
@@ -13721,11 +13445,11 @@ class _Tokenizer {
|
|
|
13721
13445
|
this._endToken(prefixAndName);
|
|
13722
13446
|
}
|
|
13723
13447
|
_consumeExpansionFormStart() {
|
|
13724
|
-
this._beginToken(19 /* EXPANSION_FORM_START */);
|
|
13448
|
+
this._beginToken(19 /* TokenType.EXPANSION_FORM_START */);
|
|
13725
13449
|
this._requireCharCode($LBRACE);
|
|
13726
13450
|
this._endToken([]);
|
|
13727
|
-
this._expansionCaseStack.push(19 /* EXPANSION_FORM_START */);
|
|
13728
|
-
this._beginToken(7 /* RAW_TEXT */);
|
|
13451
|
+
this._expansionCaseStack.push(19 /* TokenType.EXPANSION_FORM_START */);
|
|
13452
|
+
this._beginToken(7 /* TokenType.RAW_TEXT */);
|
|
13729
13453
|
const condition = this._readUntil($COMMA);
|
|
13730
13454
|
const normalizedCondition = this._processCarriageReturns(condition);
|
|
13731
13455
|
if (this._i18nNormalizeLineEndingsInICUs) {
|
|
@@ -13741,32 +13465,32 @@ class _Tokenizer {
|
|
|
13741
13465
|
}
|
|
13742
13466
|
this._requireCharCode($COMMA);
|
|
13743
13467
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13744
|
-
this._beginToken(7 /* RAW_TEXT */);
|
|
13468
|
+
this._beginToken(7 /* TokenType.RAW_TEXT */);
|
|
13745
13469
|
const type = this._readUntil($COMMA);
|
|
13746
13470
|
this._endToken([type]);
|
|
13747
13471
|
this._requireCharCode($COMMA);
|
|
13748
13472
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13749
13473
|
}
|
|
13750
13474
|
_consumeExpansionCaseStart() {
|
|
13751
|
-
this._beginToken(20 /* EXPANSION_CASE_VALUE */);
|
|
13475
|
+
this._beginToken(20 /* TokenType.EXPANSION_CASE_VALUE */);
|
|
13752
13476
|
const value = this._readUntil($LBRACE).trim();
|
|
13753
13477
|
this._endToken([value]);
|
|
13754
13478
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13755
|
-
this._beginToken(21 /* EXPANSION_CASE_EXP_START */);
|
|
13479
|
+
this._beginToken(21 /* TokenType.EXPANSION_CASE_EXP_START */);
|
|
13756
13480
|
this._requireCharCode($LBRACE);
|
|
13757
13481
|
this._endToken([]);
|
|
13758
13482
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13759
|
-
this._expansionCaseStack.push(21 /* EXPANSION_CASE_EXP_START */);
|
|
13483
|
+
this._expansionCaseStack.push(21 /* TokenType.EXPANSION_CASE_EXP_START */);
|
|
13760
13484
|
}
|
|
13761
13485
|
_consumeExpansionCaseEnd() {
|
|
13762
|
-
this._beginToken(22 /* EXPANSION_CASE_EXP_END */);
|
|
13486
|
+
this._beginToken(22 /* TokenType.EXPANSION_CASE_EXP_END */);
|
|
13763
13487
|
this._requireCharCode($RBRACE);
|
|
13764
13488
|
this._endToken([]);
|
|
13765
13489
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13766
13490
|
this._expansionCaseStack.pop();
|
|
13767
13491
|
}
|
|
13768
13492
|
_consumeExpansionFormEnd() {
|
|
13769
|
-
this._beginToken(23 /* EXPANSION_FORM_END */);
|
|
13493
|
+
this._beginToken(23 /* TokenType.EXPANSION_FORM_END */);
|
|
13770
13494
|
this._requireCharCode($RBRACE);
|
|
13771
13495
|
this._endToken([]);
|
|
13772
13496
|
this._expansionCaseStack.pop();
|
|
@@ -13916,12 +13640,12 @@ class _Tokenizer {
|
|
|
13916
13640
|
_isInExpansionCase() {
|
|
13917
13641
|
return this._expansionCaseStack.length > 0 &&
|
|
13918
13642
|
this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
|
|
13919
|
-
21 /* EXPANSION_CASE_EXP_START */;
|
|
13643
|
+
21 /* TokenType.EXPANSION_CASE_EXP_START */;
|
|
13920
13644
|
}
|
|
13921
13645
|
_isInExpansionForm() {
|
|
13922
13646
|
return this._expansionCaseStack.length > 0 &&
|
|
13923
13647
|
this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
|
|
13924
|
-
19 /* EXPANSION_FORM_START */;
|
|
13648
|
+
19 /* TokenType.EXPANSION_FORM_START */;
|
|
13925
13649
|
}
|
|
13926
13650
|
isExpansionFormStart() {
|
|
13927
13651
|
if (this._cursor.peek() !== $LBRACE) {
|
|
@@ -13968,9 +13692,9 @@ function mergeTextTokens(srcTokens) {
|
|
|
13968
13692
|
let lastDstToken = undefined;
|
|
13969
13693
|
for (let i = 0; i < srcTokens.length; i++) {
|
|
13970
13694
|
const token = srcTokens[i];
|
|
13971
|
-
if ((lastDstToken && lastDstToken.type === 5 /* TEXT */ && token.type === 5 /* TEXT */) ||
|
|
13972
|
-
(lastDstToken && lastDstToken.type === 16 /* ATTR_VALUE_TEXT */ &&
|
|
13973
|
-
token.type === 16 /* ATTR_VALUE_TEXT */)) {
|
|
13695
|
+
if ((lastDstToken && lastDstToken.type === 5 /* TokenType.TEXT */ && token.type === 5 /* TokenType.TEXT */) ||
|
|
13696
|
+
(lastDstToken && lastDstToken.type === 16 /* TokenType.ATTR_VALUE_TEXT */ &&
|
|
13697
|
+
token.type === 16 /* TokenType.ATTR_VALUE_TEXT */)) {
|
|
13974
13698
|
lastDstToken.parts[0] += token.parts[0];
|
|
13975
13699
|
lastDstToken.sourceSpan.end = token.sourceSpan.end;
|
|
13976
13700
|
}
|
|
@@ -14263,28 +13987,28 @@ class _TreeBuilder {
|
|
|
14263
13987
|
this._advance();
|
|
14264
13988
|
}
|
|
14265
13989
|
build() {
|
|
14266
|
-
while (this._peek.type !== 24 /* EOF */) {
|
|
14267
|
-
if (this._peek.type === 0 /* TAG_OPEN_START */ ||
|
|
14268
|
-
this._peek.type === 4 /* INCOMPLETE_TAG_OPEN */) {
|
|
13990
|
+
while (this._peek.type !== 24 /* TokenType.EOF */) {
|
|
13991
|
+
if (this._peek.type === 0 /* TokenType.TAG_OPEN_START */ ||
|
|
13992
|
+
this._peek.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
|
14269
13993
|
this._consumeStartTag(this._advance());
|
|
14270
13994
|
}
|
|
14271
|
-
else if (this._peek.type === 3 /* TAG_CLOSE */) {
|
|
13995
|
+
else if (this._peek.type === 3 /* TokenType.TAG_CLOSE */) {
|
|
14272
13996
|
this._consumeEndTag(this._advance());
|
|
14273
13997
|
}
|
|
14274
|
-
else if (this._peek.type === 12 /* CDATA_START */) {
|
|
13998
|
+
else if (this._peek.type === 12 /* TokenType.CDATA_START */) {
|
|
14275
13999
|
this._closeVoidElement();
|
|
14276
14000
|
this._consumeCdata(this._advance());
|
|
14277
14001
|
}
|
|
14278
|
-
else if (this._peek.type === 10 /* COMMENT_START */) {
|
|
14002
|
+
else if (this._peek.type === 10 /* TokenType.COMMENT_START */) {
|
|
14279
14003
|
this._closeVoidElement();
|
|
14280
14004
|
this._consumeComment(this._advance());
|
|
14281
14005
|
}
|
|
14282
|
-
else if (this._peek.type === 5 /* TEXT */ || this._peek.type === 7 /* RAW_TEXT */ ||
|
|
14283
|
-
this._peek.type === 6 /* ESCAPABLE_RAW_TEXT */) {
|
|
14006
|
+
else if (this._peek.type === 5 /* TokenType.TEXT */ || this._peek.type === 7 /* TokenType.RAW_TEXT */ ||
|
|
14007
|
+
this._peek.type === 6 /* TokenType.ESCAPABLE_RAW_TEXT */) {
|
|
14284
14008
|
this._closeVoidElement();
|
|
14285
14009
|
this._consumeText(this._advance());
|
|
14286
14010
|
}
|
|
14287
|
-
else if (this._peek.type === 19 /* EXPANSION_FORM_START */) {
|
|
14011
|
+
else if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */) {
|
|
14288
14012
|
this._consumeExpansion(this._advance());
|
|
14289
14013
|
}
|
|
14290
14014
|
else {
|
|
@@ -14310,11 +14034,11 @@ class _TreeBuilder {
|
|
|
14310
14034
|
}
|
|
14311
14035
|
_consumeCdata(_startToken) {
|
|
14312
14036
|
this._consumeText(this._advance());
|
|
14313
|
-
this._advanceIf(13 /* CDATA_END */);
|
|
14037
|
+
this._advanceIf(13 /* TokenType.CDATA_END */);
|
|
14314
14038
|
}
|
|
14315
14039
|
_consumeComment(token) {
|
|
14316
|
-
const text = this._advanceIf(7 /* RAW_TEXT */);
|
|
14317
|
-
this._advanceIf(11 /* COMMENT_END */);
|
|
14040
|
+
const text = this._advanceIf(7 /* TokenType.RAW_TEXT */);
|
|
14041
|
+
this._advanceIf(11 /* TokenType.COMMENT_END */);
|
|
14318
14042
|
const value = text != null ? text.parts[0].trim() : null;
|
|
14319
14043
|
this._addToParent(new Comment(value, token.sourceSpan));
|
|
14320
14044
|
}
|
|
@@ -14323,14 +14047,14 @@ class _TreeBuilder {
|
|
|
14323
14047
|
const type = this._advance();
|
|
14324
14048
|
const cases = [];
|
|
14325
14049
|
// read =
|
|
14326
|
-
while (this._peek.type === 20 /* EXPANSION_CASE_VALUE */) {
|
|
14050
|
+
while (this._peek.type === 20 /* TokenType.EXPANSION_CASE_VALUE */) {
|
|
14327
14051
|
const expCase = this._parseExpansionCase();
|
|
14328
14052
|
if (!expCase)
|
|
14329
14053
|
return; // error
|
|
14330
14054
|
cases.push(expCase);
|
|
14331
14055
|
}
|
|
14332
14056
|
// read the final }
|
|
14333
|
-
if (this._peek.type !== 23 /* EXPANSION_FORM_END */) {
|
|
14057
|
+
if (this._peek.type !== 23 /* TokenType.EXPANSION_FORM_END */) {
|
|
14334
14058
|
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
14335
14059
|
return;
|
|
14336
14060
|
}
|
|
@@ -14341,7 +14065,7 @@ class _TreeBuilder {
|
|
|
14341
14065
|
_parseExpansionCase() {
|
|
14342
14066
|
const value = this._advance();
|
|
14343
14067
|
// read {
|
|
14344
|
-
if (this._peek.type !== 21 /* EXPANSION_CASE_EXP_START */) {
|
|
14068
|
+
if (this._peek.type !== 21 /* TokenType.EXPANSION_CASE_EXP_START */) {
|
|
14345
14069
|
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '{'.`));
|
|
14346
14070
|
return null;
|
|
14347
14071
|
}
|
|
@@ -14351,7 +14075,7 @@ class _TreeBuilder {
|
|
|
14351
14075
|
if (!exp)
|
|
14352
14076
|
return null;
|
|
14353
14077
|
const end = this._advance();
|
|
14354
|
-
exp.push({ type: 24 /* EOF */, parts: [], sourceSpan: end.sourceSpan });
|
|
14078
|
+
exp.push({ type: 24 /* TokenType.EOF */, parts: [], sourceSpan: end.sourceSpan });
|
|
14355
14079
|
// parse everything in between { and }
|
|
14356
14080
|
const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
|
|
14357
14081
|
expansionCaseParser.build();
|
|
@@ -14365,14 +14089,14 @@ class _TreeBuilder {
|
|
|
14365
14089
|
}
|
|
14366
14090
|
_collectExpansionExpTokens(start) {
|
|
14367
14091
|
const exp = [];
|
|
14368
|
-
const expansionFormStack = [21 /* EXPANSION_CASE_EXP_START */];
|
|
14092
|
+
const expansionFormStack = [21 /* TokenType.EXPANSION_CASE_EXP_START */];
|
|
14369
14093
|
while (true) {
|
|
14370
|
-
if (this._peek.type === 19 /* EXPANSION_FORM_START */ ||
|
|
14371
|
-
this._peek.type === 21 /* EXPANSION_CASE_EXP_START */) {
|
|
14094
|
+
if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */ ||
|
|
14095
|
+
this._peek.type === 21 /* TokenType.EXPANSION_CASE_EXP_START */) {
|
|
14372
14096
|
expansionFormStack.push(this._peek.type);
|
|
14373
14097
|
}
|
|
14374
|
-
if (this._peek.type === 22 /* EXPANSION_CASE_EXP_END */) {
|
|
14375
|
-
if (lastOnStack(expansionFormStack, 21 /* EXPANSION_CASE_EXP_START */)) {
|
|
14098
|
+
if (this._peek.type === 22 /* TokenType.EXPANSION_CASE_EXP_END */) {
|
|
14099
|
+
if (lastOnStack(expansionFormStack, 21 /* TokenType.EXPANSION_CASE_EXP_START */)) {
|
|
14376
14100
|
expansionFormStack.pop();
|
|
14377
14101
|
if (expansionFormStack.length === 0)
|
|
14378
14102
|
return exp;
|
|
@@ -14382,8 +14106,8 @@ class _TreeBuilder {
|
|
|
14382
14106
|
return null;
|
|
14383
14107
|
}
|
|
14384
14108
|
}
|
|
14385
|
-
if (this._peek.type === 23 /* EXPANSION_FORM_END */) {
|
|
14386
|
-
if (lastOnStack(expansionFormStack, 19 /* EXPANSION_FORM_START */)) {
|
|
14109
|
+
if (this._peek.type === 23 /* TokenType.EXPANSION_FORM_END */) {
|
|
14110
|
+
if (lastOnStack(expansionFormStack, 19 /* TokenType.EXPANSION_FORM_START */)) {
|
|
14387
14111
|
expansionFormStack.pop();
|
|
14388
14112
|
}
|
|
14389
14113
|
else {
|
|
@@ -14391,7 +14115,7 @@ class _TreeBuilder {
|
|
|
14391
14115
|
return null;
|
|
14392
14116
|
}
|
|
14393
14117
|
}
|
|
14394
|
-
if (this._peek.type === 24 /* EOF */) {
|
|
14118
|
+
if (this._peek.type === 24 /* TokenType.EOF */) {
|
|
14395
14119
|
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
14396
14120
|
return null;
|
|
14397
14121
|
}
|
|
@@ -14410,18 +14134,18 @@ class _TreeBuilder {
|
|
|
14410
14134
|
tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text] };
|
|
14411
14135
|
}
|
|
14412
14136
|
}
|
|
14413
|
-
while (this._peek.type === 8 /* INTERPOLATION */ || this._peek.type === 5 /* TEXT */ ||
|
|
14414
|
-
this._peek.type === 9 /* ENCODED_ENTITY */) {
|
|
14137
|
+
while (this._peek.type === 8 /* TokenType.INTERPOLATION */ || this._peek.type === 5 /* TokenType.TEXT */ ||
|
|
14138
|
+
this._peek.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14415
14139
|
token = this._advance();
|
|
14416
14140
|
tokens.push(token);
|
|
14417
|
-
if (token.type === 8 /* INTERPOLATION */) {
|
|
14141
|
+
if (token.type === 8 /* TokenType.INTERPOLATION */) {
|
|
14418
14142
|
// For backward compatibility we decode HTML entities that appear in interpolation
|
|
14419
14143
|
// expressions. This is arguably a bug, but it could be a considerable breaking change to
|
|
14420
14144
|
// fix it. It should be addressed in a larger project to refactor the entire parser/lexer
|
|
14421
14145
|
// chain after View Engine has been removed.
|
|
14422
14146
|
text += token.parts.join('').replace(/&([^;]+);/g, decodeEntity);
|
|
14423
14147
|
}
|
|
14424
|
-
else if (token.type === 9 /* ENCODED_ENTITY */) {
|
|
14148
|
+
else if (token.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14425
14149
|
text += token.parts[0];
|
|
14426
14150
|
}
|
|
14427
14151
|
else {
|
|
@@ -14442,14 +14166,14 @@ class _TreeBuilder {
|
|
|
14442
14166
|
_consumeStartTag(startTagToken) {
|
|
14443
14167
|
const [prefix, name] = startTagToken.parts;
|
|
14444
14168
|
const attrs = [];
|
|
14445
|
-
while (this._peek.type === 14 /* ATTR_NAME */) {
|
|
14169
|
+
while (this._peek.type === 14 /* TokenType.ATTR_NAME */) {
|
|
14446
14170
|
attrs.push(this._consumeAttr(this._advance()));
|
|
14447
14171
|
}
|
|
14448
14172
|
const fullName = this._getElementFullName(prefix, name, this._getParentElement());
|
|
14449
14173
|
let selfClosing = false;
|
|
14450
14174
|
// Note: There could have been a tokenizer error
|
|
14451
14175
|
// so that we don't get a token for the end tag...
|
|
14452
|
-
if (this._peek.type === 2 /* TAG_OPEN_END_VOID */) {
|
|
14176
|
+
if (this._peek.type === 2 /* TokenType.TAG_OPEN_END_VOID */) {
|
|
14453
14177
|
this._advance();
|
|
14454
14178
|
selfClosing = true;
|
|
14455
14179
|
const tagDef = this.getTagDefinition(fullName);
|
|
@@ -14457,7 +14181,7 @@ class _TreeBuilder {
|
|
|
14457
14181
|
this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void and foreign elements can be self closed "${startTagToken.parts[1]}"`));
|
|
14458
14182
|
}
|
|
14459
14183
|
}
|
|
14460
|
-
else if (this._peek.type === 1 /* TAG_OPEN_END */) {
|
|
14184
|
+
else if (this._peek.type === 1 /* TokenType.TAG_OPEN_END */) {
|
|
14461
14185
|
this._advance();
|
|
14462
14186
|
selfClosing = false;
|
|
14463
14187
|
}
|
|
@@ -14472,7 +14196,7 @@ class _TreeBuilder {
|
|
|
14472
14196
|
// element start tag also represents the end tag.
|
|
14473
14197
|
this._popElement(fullName, span);
|
|
14474
14198
|
}
|
|
14475
|
-
else if (startTagToken.type === 4 /* INCOMPLETE_TAG_OPEN */) {
|
|
14199
|
+
else if (startTagToken.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
|
14476
14200
|
// We already know the opening tag is not complete, so it is unlikely it has a corresponding
|
|
14477
14201
|
// close tag. Let's optimistically parse it as a full element and emit an error.
|
|
14478
14202
|
this._popElement(fullName, null);
|
|
@@ -14529,7 +14253,7 @@ class _TreeBuilder {
|
|
|
14529
14253
|
const fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
|
|
14530
14254
|
let attrEnd = attrName.sourceSpan.end;
|
|
14531
14255
|
// Consume any quote
|
|
14532
|
-
if (this._peek.type === 15 /* ATTR_QUOTE */) {
|
|
14256
|
+
if (this._peek.type === 15 /* TokenType.ATTR_QUOTE */) {
|
|
14533
14257
|
this._advance();
|
|
14534
14258
|
}
|
|
14535
14259
|
// Consume the attribute value
|
|
@@ -14542,22 +14266,22 @@ class _TreeBuilder {
|
|
|
14542
14266
|
// being able to consider `ATTR_VALUE_INTERPOLATION` as an option. This is because TS is not
|
|
14543
14267
|
// able to see that `_advance()` will actually mutate `_peek`.
|
|
14544
14268
|
const nextTokenType = this._peek.type;
|
|
14545
|
-
if (nextTokenType === 16 /* ATTR_VALUE_TEXT */) {
|
|
14269
|
+
if (nextTokenType === 16 /* TokenType.ATTR_VALUE_TEXT */) {
|
|
14546
14270
|
valueStartSpan = this._peek.sourceSpan;
|
|
14547
14271
|
valueEnd = this._peek.sourceSpan.end;
|
|
14548
|
-
while (this._peek.type === 16 /* ATTR_VALUE_TEXT */ ||
|
|
14549
|
-
this._peek.type === 17 /* ATTR_VALUE_INTERPOLATION */ ||
|
|
14550
|
-
this._peek.type === 9 /* ENCODED_ENTITY */) {
|
|
14272
|
+
while (this._peek.type === 16 /* TokenType.ATTR_VALUE_TEXT */ ||
|
|
14273
|
+
this._peek.type === 17 /* TokenType.ATTR_VALUE_INTERPOLATION */ ||
|
|
14274
|
+
this._peek.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14551
14275
|
const valueToken = this._advance();
|
|
14552
14276
|
valueTokens.push(valueToken);
|
|
14553
|
-
if (valueToken.type === 17 /* ATTR_VALUE_INTERPOLATION */) {
|
|
14277
|
+
if (valueToken.type === 17 /* TokenType.ATTR_VALUE_INTERPOLATION */) {
|
|
14554
14278
|
// For backward compatibility we decode HTML entities that appear in interpolation
|
|
14555
14279
|
// expressions. This is arguably a bug, but it could be a considerable breaking change to
|
|
14556
14280
|
// fix it. It should be addressed in a larger project to refactor the entire parser/lexer
|
|
14557
14281
|
// chain after View Engine has been removed.
|
|
14558
14282
|
value += valueToken.parts.join('').replace(/&([^;]+);/g, decodeEntity);
|
|
14559
14283
|
}
|
|
14560
|
-
else if (valueToken.type === 9 /* ENCODED_ENTITY */) {
|
|
14284
|
+
else if (valueToken.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14561
14285
|
value += valueToken.parts[0];
|
|
14562
14286
|
}
|
|
14563
14287
|
else {
|
|
@@ -14567,7 +14291,7 @@ class _TreeBuilder {
|
|
|
14567
14291
|
}
|
|
14568
14292
|
}
|
|
14569
14293
|
// Consume any quote
|
|
14570
|
-
if (this._peek.type === 15 /* ATTR_QUOTE */) {
|
|
14294
|
+
if (this._peek.type === 15 /* TokenType.ATTR_QUOTE */) {
|
|
14571
14295
|
const quoteToken = this._advance();
|
|
14572
14296
|
attrEnd = quoteToken.sourceSpan.end;
|
|
14573
14297
|
}
|
|
@@ -14697,7 +14421,7 @@ class WhitespaceVisitor {
|
|
|
14697
14421
|
(context.prev instanceof Expansion || context.next instanceof Expansion);
|
|
14698
14422
|
if (isNotBlank || hasExpansionSibling) {
|
|
14699
14423
|
// Process the whitespace in the tokens of this Text node
|
|
14700
|
-
const tokens = text.tokens.map(token => token.type === 5 /* TEXT */ ? createWhitespaceProcessedTextToken(token) : token);
|
|
14424
|
+
const tokens = text.tokens.map(token => token.type === 5 /* TokenType.TEXT */ ? createWhitespaceProcessedTextToken(token) : token);
|
|
14701
14425
|
// Process the whitespace of the value of this Text node
|
|
14702
14426
|
const value = processWhitespace(text.value);
|
|
14703
14427
|
return new Text(value, text.sourceSpan, tokens, text.i18n);
|
|
@@ -15547,7 +15271,7 @@ class BindingParser {
|
|
|
15547
15271
|
}
|
|
15548
15272
|
createBoundElementProperty(elementSelector, boundProp, skipValidation = false, mapPropertyName = true) {
|
|
15549
15273
|
if (boundProp.isAnimation) {
|
|
15550
|
-
return new BoundElementProperty(boundProp.name, 4 /* Animation */, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
15274
|
+
return new BoundElementProperty(boundProp.name, 4 /* BindingType.Animation */, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
15551
15275
|
}
|
|
15552
15276
|
let unit = null;
|
|
15553
15277
|
let bindingType = undefined;
|
|
@@ -15568,17 +15292,17 @@ class BindingParser {
|
|
|
15568
15292
|
const name = boundPropertyName.substring(nsSeparatorIdx + 1);
|
|
15569
15293
|
boundPropertyName = mergeNsAndName(ns, name);
|
|
15570
15294
|
}
|
|
15571
|
-
bindingType = 1 /* Attribute */;
|
|
15295
|
+
bindingType = 1 /* BindingType.Attribute */;
|
|
15572
15296
|
}
|
|
15573
15297
|
else if (parts[0] == CLASS_PREFIX) {
|
|
15574
15298
|
boundPropertyName = parts[1];
|
|
15575
|
-
bindingType = 2 /* Class */;
|
|
15299
|
+
bindingType = 2 /* BindingType.Class */;
|
|
15576
15300
|
securityContexts = [SecurityContext.NONE];
|
|
15577
15301
|
}
|
|
15578
15302
|
else if (parts[0] == STYLE_PREFIX) {
|
|
15579
15303
|
unit = parts.length > 2 ? parts[2] : null;
|
|
15580
15304
|
boundPropertyName = parts[1];
|
|
15581
|
-
bindingType = 3 /* Style */;
|
|
15305
|
+
bindingType = 3 /* BindingType.Style */;
|
|
15582
15306
|
securityContexts = [SecurityContext.STYLE];
|
|
15583
15307
|
}
|
|
15584
15308
|
}
|
|
@@ -15587,7 +15311,7 @@ class BindingParser {
|
|
|
15587
15311
|
const mappedPropName = this._schemaRegistry.getMappedPropName(boundProp.name);
|
|
15588
15312
|
boundPropertyName = mapPropertyName ? mappedPropName : boundProp.name;
|
|
15589
15313
|
securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, mappedPropName, false);
|
|
15590
|
-
bindingType = 0 /* Property */;
|
|
15314
|
+
bindingType = 0 /* BindingType.Property */;
|
|
15591
15315
|
if (!skipValidation) {
|
|
15592
15316
|
this._validatePropertyOrAttributeName(mappedPropName, boundProp.sourceSpan, false);
|
|
15593
15317
|
}
|
|
@@ -15619,7 +15343,7 @@ class BindingParser {
|
|
|
15619
15343
|
const eventName = matches[0];
|
|
15620
15344
|
const phase = matches[1].toLowerCase();
|
|
15621
15345
|
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15622
|
-
targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15346
|
+
targetEvents.push(new ParsedEvent(eventName, phase, 1 /* ParsedEventType.Animation */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15623
15347
|
if (eventName.length === 0) {
|
|
15624
15348
|
this._reportError(`Animation event name is missing in binding`, sourceSpan);
|
|
15625
15349
|
}
|
|
@@ -15637,7 +15361,7 @@ class BindingParser {
|
|
|
15637
15361
|
const [target, eventName] = splitAtColon(name, [null, name]);
|
|
15638
15362
|
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15639
15363
|
targetMatchableAttrs.push([name, ast.source]);
|
|
15640
|
-
targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15364
|
+
targetEvents.push(new ParsedEvent(eventName, target, 0 /* ParsedEventType.Regular */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15641
15365
|
// Don't detect directives for event names for now,
|
|
15642
15366
|
// so don't add the event name to the matchableAttrs
|
|
15643
15367
|
}
|
|
@@ -16720,8 +16444,8 @@ class _I18nVisitor {
|
|
|
16720
16444
|
let hasInterpolation = false;
|
|
16721
16445
|
for (const token of tokens) {
|
|
16722
16446
|
switch (token.type) {
|
|
16723
|
-
case 8 /* INTERPOLATION */:
|
|
16724
|
-
case 17 /* ATTR_VALUE_INTERPOLATION */:
|
|
16447
|
+
case 8 /* TokenType.INTERPOLATION */:
|
|
16448
|
+
case 17 /* TokenType.ATTR_VALUE_INTERPOLATION */:
|
|
16725
16449
|
hasInterpolation = true;
|
|
16726
16450
|
const expression = token.parts[1];
|
|
16727
16451
|
const baseName = extractPlaceholderName(expression) || 'INTERPOLATION';
|
|
@@ -17050,14 +16774,14 @@ function parseI18nMeta(meta = '') {
|
|
|
17050
16774
|
function i18nMetaToJSDoc(meta) {
|
|
17051
16775
|
const tags = [];
|
|
17052
16776
|
if (meta.description) {
|
|
17053
|
-
tags.push({ tagName: "desc" /* Desc */, text: meta.description });
|
|
16777
|
+
tags.push({ tagName: "desc" /* o.JSDocTagName.Desc */, text: meta.description });
|
|
17054
16778
|
}
|
|
17055
16779
|
else {
|
|
17056
16780
|
// Suppress the JSCompiler warning that a `@desc` was not given for this message.
|
|
17057
|
-
tags.push({ tagName: "suppress" /* Suppress */, text: '{msgDescriptions}' });
|
|
16781
|
+
tags.push({ tagName: "suppress" /* o.JSDocTagName.Suppress */, text: '{msgDescriptions}' });
|
|
17058
16782
|
}
|
|
17059
16783
|
if (meta.meaning) {
|
|
17060
|
-
tags.push({ tagName: "meaning" /* Meaning */, text: meta.meaning });
|
|
16784
|
+
tags.push({ tagName: "meaning" /* o.JSDocTagName.Meaning */, text: meta.meaning });
|
|
17061
16785
|
}
|
|
17062
16786
|
return jsDocComment(tags);
|
|
17063
16787
|
}
|
|
@@ -17332,7 +17056,7 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
|
|
|
17332
17056
|
statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
|
|
17333
17057
|
}
|
|
17334
17058
|
}
|
|
17335
|
-
const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
17059
|
+
const eventName = type === 1 /* ParsedEventType.Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
17336
17060
|
const fnName = handlerName && sanitizeIdentifier(handlerName);
|
|
17337
17061
|
const fnArgs = [];
|
|
17338
17062
|
if (implicitReceiverAccesses.has(eventArgumentName)) {
|
|
@@ -17484,10 +17208,10 @@ class TemplateDefinitionBuilder {
|
|
|
17484
17208
|
const creationVariables = this._bindingScope.viewSnapshotStatements();
|
|
17485
17209
|
const updateVariables = this._bindingScope.variableDeclarations().concat(this._tempVariables);
|
|
17486
17210
|
const creationBlock = creationStatements.length > 0 ?
|
|
17487
|
-
[renderFlagCheckIfStmt(1 /* Create */, creationVariables.concat(creationStatements))] :
|
|
17211
|
+
[renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, creationVariables.concat(creationStatements))] :
|
|
17488
17212
|
[];
|
|
17489
17213
|
const updateBlock = updateStatements.length > 0 ?
|
|
17490
|
-
[renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(updateStatements))] :
|
|
17214
|
+
[renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateVariables.concat(updateStatements))] :
|
|
17491
17215
|
[];
|
|
17492
17216
|
return fn(
|
|
17493
17217
|
// i.e. (rf: RenderFlags, ctx: any)
|
|
@@ -17525,7 +17249,7 @@ class TemplateDefinitionBuilder {
|
|
|
17525
17249
|
const scopedName = this._bindingScope.freshReferenceName();
|
|
17526
17250
|
const retrievalLevel = this.level;
|
|
17527
17251
|
const lhs = variable(variable$1.name + scopedName);
|
|
17528
|
-
this._bindingScope.set(retrievalLevel, variable$1.name, lhs, 1 /* CONTEXT */, (scope, relativeLevel) => {
|
|
17252
|
+
this._bindingScope.set(retrievalLevel, variable$1.name, lhs, 1 /* DeclarationPriority.CONTEXT */, (scope, relativeLevel) => {
|
|
17529
17253
|
let rhs;
|
|
17530
17254
|
if (scope.bindingLevel === retrievalLevel) {
|
|
17531
17255
|
if (scope.isListenerScope() && scope.hasRestoreViewVariable()) {
|
|
@@ -17779,7 +17503,7 @@ class TemplateDefinitionBuilder {
|
|
|
17779
17503
|
element.inputs.forEach(input => {
|
|
17780
17504
|
const stylingInputWasSet = stylingBuilder.registerBoundInput(input);
|
|
17781
17505
|
if (!stylingInputWasSet) {
|
|
17782
|
-
if (input.type === 0 /* Property */ && input.i18n) {
|
|
17506
|
+
if (input.type === 0 /* BindingType.Property */ && input.i18n) {
|
|
17783
17507
|
boundI18nAttrs.push(input);
|
|
17784
17508
|
}
|
|
17785
17509
|
else {
|
|
@@ -17852,7 +17576,7 @@ class TemplateDefinitionBuilder {
|
|
|
17852
17576
|
// Generate element input bindings
|
|
17853
17577
|
allOtherInputs.forEach(input => {
|
|
17854
17578
|
const inputType = input.type;
|
|
17855
|
-
if (inputType === 4 /* Animation */) {
|
|
17579
|
+
if (inputType === 4 /* BindingType.Animation */) {
|
|
17856
17580
|
const value = input.value.visit(this._valueConverter);
|
|
17857
17581
|
// animation bindings can be presented in the following formats:
|
|
17858
17582
|
// 1. [@binding]="fooExp"
|
|
@@ -17879,7 +17603,7 @@ class TemplateDefinitionBuilder {
|
|
|
17879
17603
|
if (value !== undefined) {
|
|
17880
17604
|
const params = [];
|
|
17881
17605
|
const [attrNamespace, attrName] = splitNsName(input.name);
|
|
17882
|
-
const isAttributeBinding = inputType === 1 /* Attribute */;
|
|
17606
|
+
const isAttributeBinding = inputType === 1 /* BindingType.Attribute */;
|
|
17883
17607
|
const sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
|
|
17884
17608
|
if (sanitizationRef)
|
|
17885
17609
|
params.push(sanitizationRef);
|
|
@@ -17895,7 +17619,7 @@ class TemplateDefinitionBuilder {
|
|
|
17895
17619
|
}
|
|
17896
17620
|
}
|
|
17897
17621
|
this.allocateBindingSlots(value);
|
|
17898
|
-
if (inputType === 0 /* Property */) {
|
|
17622
|
+
if (inputType === 0 /* BindingType.Property */) {
|
|
17899
17623
|
if (value instanceof Interpolation) {
|
|
17900
17624
|
// prop="{{value}}" and friends
|
|
17901
17625
|
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
|
@@ -17909,7 +17633,7 @@ class TemplateDefinitionBuilder {
|
|
|
17909
17633
|
});
|
|
17910
17634
|
}
|
|
17911
17635
|
}
|
|
17912
|
-
else if (inputType === 1 /* Attribute */) {
|
|
17636
|
+
else if (inputType === 1 /* BindingType.Attribute */) {
|
|
17913
17637
|
if (value instanceof Interpolation && getInterpolationArgsLength(value) > 1) {
|
|
17914
17638
|
// attr.name="text{{value}}" and friends
|
|
17915
17639
|
this.interpolatedUpdateInstruction(getAttributeInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
|
@@ -18306,13 +18030,13 @@ class TemplateDefinitionBuilder {
|
|
|
18306
18030
|
const input = inputs[i];
|
|
18307
18031
|
// We don't want the animation and attribute bindings in the
|
|
18308
18032
|
// attributes array since they aren't used for directive matching.
|
|
18309
|
-
if (input.type !== 4 /* Animation */ && input.type !== 1 /* Attribute */) {
|
|
18033
|
+
if (input.type !== 4 /* BindingType.Animation */ && input.type !== 1 /* BindingType.Attribute */) {
|
|
18310
18034
|
addAttrExpr(input.name);
|
|
18311
18035
|
}
|
|
18312
18036
|
}
|
|
18313
18037
|
for (let i = 0; i < outputs.length; i++) {
|
|
18314
18038
|
const output = outputs[i];
|
|
18315
|
-
if (output.type !== 1 /* Animation */) {
|
|
18039
|
+
if (output.type !== 1 /* ParsedEventType.Animation */) {
|
|
18316
18040
|
addAttrExpr(output.name);
|
|
18317
18041
|
}
|
|
18318
18042
|
}
|
|
@@ -18321,15 +18045,15 @@ class TemplateDefinitionBuilder {
|
|
|
18321
18045
|
// to the expressions. The marker is important because it tells the runtime
|
|
18322
18046
|
// code that this is where attributes without values start...
|
|
18323
18047
|
if (attrExprs.length !== attrsLengthBeforeInputs) {
|
|
18324
|
-
attrExprs.splice(attrsLengthBeforeInputs, 0, literal(3 /* Bindings */));
|
|
18048
|
+
attrExprs.splice(attrsLengthBeforeInputs, 0, literal(3 /* core.AttributeMarker.Bindings */));
|
|
18325
18049
|
}
|
|
18326
18050
|
}
|
|
18327
18051
|
if (templateAttrs.length) {
|
|
18328
|
-
attrExprs.push(literal(4 /* Template */));
|
|
18052
|
+
attrExprs.push(literal(4 /* core.AttributeMarker.Template */));
|
|
18329
18053
|
templateAttrs.forEach(attr => addAttrExpr(attr.name));
|
|
18330
18054
|
}
|
|
18331
18055
|
if (boundI18nAttrs.length) {
|
|
18332
|
-
attrExprs.push(literal(6 /* I18n */));
|
|
18056
|
+
attrExprs.push(literal(6 /* core.AttributeMarker.I18n */));
|
|
18333
18057
|
boundI18nAttrs.forEach(attr => addAttrExpr(attr.name));
|
|
18334
18058
|
}
|
|
18335
18059
|
return attrExprs;
|
|
@@ -18360,7 +18084,7 @@ class TemplateDefinitionBuilder {
|
|
|
18360
18084
|
const variableName = this._bindingScope.freshReferenceName();
|
|
18361
18085
|
const retrievalLevel = this.level;
|
|
18362
18086
|
const lhs = variable(variableName);
|
|
18363
|
-
this._bindingScope.set(retrievalLevel, reference.name, lhs, 0 /* DEFAULT */, (scope, relativeLevel) => {
|
|
18087
|
+
this._bindingScope.set(retrievalLevel, reference.name, lhs, 0 /* DeclarationPriority.DEFAULT */, (scope, relativeLevel) => {
|
|
18364
18088
|
// e.g. nextContext(2);
|
|
18365
18089
|
const nextContextStmt = relativeLevel > 0 ? [generateNextContextExpr(relativeLevel).toStmt()] : [];
|
|
18366
18090
|
// e.g. const $foo$ = reference(1);
|
|
@@ -18374,7 +18098,7 @@ class TemplateDefinitionBuilder {
|
|
|
18374
18098
|
prepareListenerParameter(tagName, outputAst, index) {
|
|
18375
18099
|
return () => {
|
|
18376
18100
|
const eventName = outputAst.name;
|
|
18377
|
-
const bindingFnName = outputAst.type === 1 /* Animation */ ?
|
|
18101
|
+
const bindingFnName = outputAst.type === 1 /* ParsedEventType.Animation */ ?
|
|
18378
18102
|
// synthetic @listener.foo values are treated the exact same as are standard listeners
|
|
18379
18103
|
prepareSyntheticListenerFunctionName(eventName, outputAst.phase) :
|
|
18380
18104
|
sanitizeIdentifier(eventName);
|
|
@@ -18494,7 +18218,7 @@ function getAttributeNameLiterals(name) {
|
|
|
18494
18218
|
const nameLiteral = literal(attributeName);
|
|
18495
18219
|
if (attributeNamespace) {
|
|
18496
18220
|
return [
|
|
18497
|
-
literal(0 /* NamespaceURI */), literal(attributeNamespace), nameLiteral
|
|
18221
|
+
literal(0 /* core.AttributeMarker.NamespaceURI */), literal(attributeNamespace), nameLiteral
|
|
18498
18222
|
];
|
|
18499
18223
|
}
|
|
18500
18224
|
return [nameLiteral];
|
|
@@ -18563,7 +18287,7 @@ class BindingScope {
|
|
|
18563
18287
|
* @param declareLocalCallback The callback to invoke when declaring this local var
|
|
18564
18288
|
* @param localRef Whether or not this is a local ref
|
|
18565
18289
|
*/
|
|
18566
|
-
set(retrievalLevel, name, lhs, priority = 0 /* DEFAULT */, declareLocalCallback, localRef) {
|
|
18290
|
+
set(retrievalLevel, name, lhs, priority = 0 /* DeclarationPriority.DEFAULT */, declareLocalCallback, localRef) {
|
|
18567
18291
|
if (this.map.has(name)) {
|
|
18568
18292
|
if (localRef) {
|
|
18569
18293
|
// Do not throw an error if it's a local ref and do not update existing value,
|
|
@@ -18619,7 +18343,7 @@ class BindingScope {
|
|
|
18619
18343
|
return sharedCtxObj && sharedCtxObj.declare ? sharedCtxObj.lhs : null;
|
|
18620
18344
|
}
|
|
18621
18345
|
maybeGenerateSharedContextVar(value) {
|
|
18622
|
-
if (value.priority === 1 /* CONTEXT */ &&
|
|
18346
|
+
if (value.priority === 1 /* DeclarationPriority.CONTEXT */ &&
|
|
18623
18347
|
value.retrievalLevel < this.bindingLevel) {
|
|
18624
18348
|
const sharedCtxObj = this.map.get(SHARED_CONTEXT_KEY + value.retrievalLevel);
|
|
18625
18349
|
if (sharedCtxObj) {
|
|
@@ -18640,7 +18364,7 @@ class BindingScope {
|
|
|
18640
18364
|
return [lhs.set(generateNextContextExpr(relativeLevel)).toConstDecl()];
|
|
18641
18365
|
},
|
|
18642
18366
|
declare: false,
|
|
18643
|
-
priority: 2 /* SHARED_CONTEXT */,
|
|
18367
|
+
priority: 2 /* DeclarationPriority.SHARED_CONTEXT */,
|
|
18644
18368
|
});
|
|
18645
18369
|
}
|
|
18646
18370
|
getComponentProperty(name) {
|
|
@@ -18737,7 +18461,7 @@ function getNgProjectAsLiteral(attribute) {
|
|
|
18737
18461
|
// Parse the attribute value into a CssSelectorList. Note that we only take the
|
|
18738
18462
|
// first selector, because we don't support multiple selectors in ngProjectAs.
|
|
18739
18463
|
const parsedR3Selector = parseSelectorToR3Selector(attribute.value)[0];
|
|
18740
|
-
return [literal(5 /* ProjectAs */), asLiteral(parsedR3Selector)];
|
|
18464
|
+
return [literal(5 /* core.AttributeMarker.ProjectAs */), asLiteral(parsedR3Selector)];
|
|
18741
18465
|
}
|
|
18742
18466
|
/**
|
|
18743
18467
|
* Gets the instruction to generate for an interpolated property
|
|
@@ -19168,8 +18892,15 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
19168
18892
|
const styleValues = meta.encapsulation == ViewEncapsulation.Emulated ?
|
|
19169
18893
|
compileStyles(meta.styles, CONTENT_ATTR, HOST_ATTR) :
|
|
19170
18894
|
meta.styles;
|
|
19171
|
-
const
|
|
19172
|
-
|
|
18895
|
+
const styleNodes = styleValues.reduce((result, style) => {
|
|
18896
|
+
if (style.trim().length > 0) {
|
|
18897
|
+
result.push(constantPool.getConstLiteral(literal(style)));
|
|
18898
|
+
}
|
|
18899
|
+
return result;
|
|
18900
|
+
}, []);
|
|
18901
|
+
if (styleNodes.length > 0) {
|
|
18902
|
+
definitionMap.set('styles', literalArr(styleNodes));
|
|
18903
|
+
}
|
|
19173
18904
|
}
|
|
19174
18905
|
else if (meta.encapsulation === ViewEncapsulation.Emulated) {
|
|
19175
18906
|
// If there is no style, don't generate css selectors on elements
|
|
@@ -19207,13 +18938,13 @@ function createComponentType(meta) {
|
|
|
19207
18938
|
*/
|
|
19208
18939
|
function compileDeclarationList(list, mode) {
|
|
19209
18940
|
switch (mode) {
|
|
19210
|
-
case 0 /* Direct */:
|
|
18941
|
+
case 0 /* DeclarationListEmitMode.Direct */:
|
|
19211
18942
|
// directives: [MyDir],
|
|
19212
18943
|
return list;
|
|
19213
|
-
case 1 /* Closure */:
|
|
18944
|
+
case 1 /* DeclarationListEmitMode.Closure */:
|
|
19214
18945
|
// directives: function () { return [MyDir]; }
|
|
19215
18946
|
return fn([], [new ReturnStatement(list)]);
|
|
19216
|
-
case 2 /* ClosureResolved */:
|
|
18947
|
+
case 2 /* DeclarationListEmitMode.ClosureResolved */:
|
|
19217
18948
|
// directives: function () { return [MyDir].map(ng.resolveForwardRef); }
|
|
19218
18949
|
const resolvedList = list.prop('map').callFn([importExpr(Identifiers.resolveForwardRef)]);
|
|
19219
18950
|
return fn([], [new ReturnStatement(resolvedList)]);
|
|
@@ -19231,9 +18962,9 @@ function prepareQueryParams(query, constantPool) {
|
|
|
19231
18962
|
* @param query
|
|
19232
18963
|
*/
|
|
19233
18964
|
function toQueryFlags(query) {
|
|
19234
|
-
return (query.descendants ? 1 /* descendants */ : 0 /* none */) |
|
|
19235
|
-
(query.static ? 2 /* isStatic */ : 0 /* none */) |
|
|
19236
|
-
(query.emitDistinctChangesOnly ? 4 /* emitDistinctChangesOnly */ : 0 /* none */);
|
|
18965
|
+
return (query.descendants ? 1 /* QueryFlags.descendants */ : 0 /* QueryFlags.none */) |
|
|
18966
|
+
(query.static ? 2 /* QueryFlags.isStatic */ : 0 /* QueryFlags.none */) |
|
|
18967
|
+
(query.emitDistinctChangesOnly ? 4 /* QueryFlags.emitDistinctChangesOnly */ : 0 /* QueryFlags.none */);
|
|
19237
18968
|
}
|
|
19238
18969
|
function convertAttributesToExpressions(attributes) {
|
|
19239
18970
|
const values = [];
|
|
@@ -19267,8 +18998,8 @@ function createContentQueriesFunction(queries, constantPool, name) {
|
|
|
19267
18998
|
new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null),
|
|
19268
18999
|
new FnParam('dirIndex', null)
|
|
19269
19000
|
], [
|
|
19270
|
-
renderFlagCheckIfStmt(1 /* Create */, createStatements),
|
|
19271
|
-
renderFlagCheckIfStmt(2 /* Update */, updateStatements)
|
|
19001
|
+
renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, createStatements),
|
|
19002
|
+
renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateStatements)
|
|
19272
19003
|
], INFERRED_TYPE, null, contentQueriesFnName);
|
|
19273
19004
|
}
|
|
19274
19005
|
function stringAsType(str) {
|
|
@@ -19334,8 +19065,8 @@ function createViewQueriesFunction(viewQueries, constantPool, name) {
|
|
|
19334
19065
|
});
|
|
19335
19066
|
const viewQueryFnName = name ? `${name}_Query` : null;
|
|
19336
19067
|
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], [
|
|
19337
|
-
renderFlagCheckIfStmt(1 /* Create */, createStatements),
|
|
19338
|
-
renderFlagCheckIfStmt(2 /* Update */, updateStatements)
|
|
19068
|
+
renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, createStatements),
|
|
19069
|
+
renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateStatements)
|
|
19339
19070
|
], INFERRED_TYPE, null, viewQueryFnName);
|
|
19340
19071
|
}
|
|
19341
19072
|
// Return a host binding function or null if one is not necessary.
|
|
@@ -19475,10 +19206,10 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
19475
19206
|
const hostBindingsFnName = name ? `${name}_HostBindings` : null;
|
|
19476
19207
|
const statements = [];
|
|
19477
19208
|
if (createInstructions.length > 0) {
|
|
19478
|
-
statements.push(renderFlagCheckIfStmt(1 /* Create */, getInstructionStatements(createInstructions)));
|
|
19209
|
+
statements.push(renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, getInstructionStatements(createInstructions)));
|
|
19479
19210
|
}
|
|
19480
19211
|
if (updateInstructions.length > 0) {
|
|
19481
|
-
statements.push(renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(getInstructionStatements(updateInstructions))));
|
|
19212
|
+
statements.push(renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateVariables.concat(getInstructionStatements(updateInstructions))));
|
|
19482
19213
|
}
|
|
19483
19214
|
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], statements, INFERRED_TYPE, null, hostBindingsFnName);
|
|
19484
19215
|
}
|
|
@@ -19519,12 +19250,12 @@ function createHostListeners(eventBindings, name) {
|
|
|
19519
19250
|
const instructions = [];
|
|
19520
19251
|
for (const binding of eventBindings) {
|
|
19521
19252
|
let bindingName = binding.name && sanitizeIdentifier(binding.name);
|
|
19522
|
-
const bindingFnName = binding.type === 1 /* Animation */ ?
|
|
19253
|
+
const bindingFnName = binding.type === 1 /* ParsedEventType.Animation */ ?
|
|
19523
19254
|
prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) :
|
|
19524
19255
|
bindingName;
|
|
19525
19256
|
const handlerName = name && bindingName ? `${name}_${bindingFnName}_HostBindingHandler` : null;
|
|
19526
19257
|
const params = prepareEventListenerParameters(BoundEvent.fromParsedEvent(binding), handlerName);
|
|
19527
|
-
if (binding.type == 1 /* Animation */) {
|
|
19258
|
+
if (binding.type == 1 /* ParsedEventType.Animation */) {
|
|
19528
19259
|
syntheticListenerParams.push(params);
|
|
19529
19260
|
}
|
|
19530
19261
|
else {
|
|
@@ -19573,7 +19304,7 @@ function parseHostBindings(host) {
|
|
|
19573
19304
|
}
|
|
19574
19305
|
}
|
|
19575
19306
|
}
|
|
19576
|
-
else if (matches[1 /* Binding */] != null) {
|
|
19307
|
+
else if (matches[1 /* HostBindingGroup.Binding */] != null) {
|
|
19577
19308
|
if (typeof value !== 'string') {
|
|
19578
19309
|
// TODO(alxhub): make this a diagnostic.
|
|
19579
19310
|
throw new Error(`Property binding must be string`);
|
|
@@ -19581,14 +19312,14 @@ function parseHostBindings(host) {
|
|
|
19581
19312
|
// synthetic properties (the ones that have a `@` as a prefix)
|
|
19582
19313
|
// are still treated the same as regular properties. Therefore
|
|
19583
19314
|
// there is no point in storing them in a separate map.
|
|
19584
|
-
properties[matches[1 /* Binding */]] = value;
|
|
19315
|
+
properties[matches[1 /* HostBindingGroup.Binding */]] = value;
|
|
19585
19316
|
}
|
|
19586
|
-
else if (matches[2 /* Event */] != null) {
|
|
19317
|
+
else if (matches[2 /* HostBindingGroup.Event */] != null) {
|
|
19587
19318
|
if (typeof value !== 'string') {
|
|
19588
19319
|
// TODO(alxhub): make this a diagnostic.
|
|
19589
19320
|
throw new Error(`Event binding must be string`);
|
|
19590
19321
|
}
|
|
19591
|
-
listeners[matches[2 /* Event */]] = value;
|
|
19322
|
+
listeners[matches[2 /* HostBindingGroup.Event */]] = value;
|
|
19592
19323
|
}
|
|
19593
19324
|
}
|
|
19594
19325
|
return { attributes, listeners, properties, specialAttributes };
|
|
@@ -19756,7 +19487,7 @@ class CompilerFacadeImpl {
|
|
|
19756
19487
|
// Parse the template and check for errors.
|
|
19757
19488
|
const { template, interpolation } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
|
|
19758
19489
|
// Compile the component metadata, including template, into an expression.
|
|
19759
|
-
const meta = Object.assign(Object.assign(Object.assign({}, facade), convertDirectiveFacadeToMetadata(facade)), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template, declarations: facade.declarations.map(convertDeclarationFacadeToMetadata), declarationListEmitMode: 0 /* Direct */, styles: [...facade.styles, ...template.styles], encapsulation: facade.encapsulation, interpolation, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
|
|
19490
|
+
const meta = Object.assign(Object.assign(Object.assign({}, facade), convertDirectiveFacadeToMetadata(facade)), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template, declarations: facade.declarations.map(convertDeclarationFacadeToMetadata), declarationListEmitMode: 0 /* DeclarationListEmitMode.Direct */, styles: [...facade.styles, ...template.styles], encapsulation: facade.encapsulation, interpolation, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
|
|
19760
19491
|
null, relativeContextFilePath: '', i18nUseExternalIds: true });
|
|
19761
19492
|
const jitExpressionSourceMap = `ng:///${facade.name}.js`;
|
|
19762
19493
|
return this.compileComponentFromMeta(angularCoreEnv, jitExpressionSourceMap, meta);
|
|
@@ -19839,7 +19570,7 @@ function convertQueryPredicate(predicate) {
|
|
|
19839
19570
|
// The predicate is an array of strings so pass it through.
|
|
19840
19571
|
predicate :
|
|
19841
19572
|
// The predicate is a type - assume that we will need to unwrap any `forwardRef()` calls.
|
|
19842
|
-
createMayBeForwardRefExpression(new WrappedNodeExpr(predicate), 1 /* Wrapped */);
|
|
19573
|
+
createMayBeForwardRefExpression(new WrappedNodeExpr(predicate), 1 /* ForwardRefHandling.Wrapped */);
|
|
19843
19574
|
}
|
|
19844
19575
|
function convertDirectiveFacadeToMetadata(facade) {
|
|
19845
19576
|
const inputsFromMetadata = parseInputOutputs(facade.inputs || []);
|
|
@@ -19932,7 +19663,7 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
|
|
|
19932
19663
|
decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
|
|
19933
19664
|
}
|
|
19934
19665
|
return Object.assign(Object.assign({}, convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan)), { template, styles: (_b = decl.styles) !== null && _b !== void 0 ? _b : [], declarations, viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
|
|
19935
|
-
null, animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null, changeDetection: (_c = decl.changeDetection) !== null && _c !== void 0 ? _c : ChangeDetectionStrategy.Default, encapsulation: (_d = decl.encapsulation) !== null && _d !== void 0 ? _d : ViewEncapsulation.Emulated, interpolation, declarationListEmitMode: 2 /* ClosureResolved */, relativeContextFilePath: '', i18nUseExternalIds: true });
|
|
19666
|
+
null, animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null, changeDetection: (_c = decl.changeDetection) !== null && _c !== void 0 ? _c : ChangeDetectionStrategy.Default, encapsulation: (_d = decl.encapsulation) !== null && _d !== void 0 ? _d : ViewEncapsulation.Emulated, interpolation, declarationListEmitMode: 2 /* DeclarationListEmitMode.ClosureResolved */, relativeContextFilePath: '', i18nUseExternalIds: true });
|
|
19936
19667
|
}
|
|
19937
19668
|
function convertDeclarationFacadeToMetadata(declaration) {
|
|
19938
19669
|
return Object.assign(Object.assign({}, declaration), { type: new WrappedNodeExpr(declaration.type) });
|
|
@@ -19988,7 +19719,7 @@ function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
|
19988
19719
|
*/
|
|
19989
19720
|
function convertToProviderExpression(obj, property) {
|
|
19990
19721
|
if (obj.hasOwnProperty(property)) {
|
|
19991
|
-
return createMayBeForwardRefExpression(new WrappedNodeExpr(obj[property]), 0 /* None */);
|
|
19722
|
+
return createMayBeForwardRefExpression(new WrappedNodeExpr(obj[property]), 0 /* ForwardRefHandling.None */);
|
|
19992
19723
|
}
|
|
19993
19724
|
else {
|
|
19994
19725
|
return undefined;
|
|
@@ -20006,7 +19737,7 @@ function computeProvidedIn(providedIn) {
|
|
|
20006
19737
|
const expression = typeof providedIn === 'function' ? new WrappedNodeExpr(providedIn) :
|
|
20007
19738
|
new LiteralExpr(providedIn !== null && providedIn !== void 0 ? providedIn : null);
|
|
20008
19739
|
// See `convertToProviderExpression()` for why this uses `ForwardRefHandling.None`.
|
|
20009
|
-
return createMayBeForwardRefExpression(expression, 0 /* None */);
|
|
19740
|
+
return createMayBeForwardRefExpression(expression, 0 /* ForwardRefHandling.None */);
|
|
20010
19741
|
}
|
|
20011
19742
|
function convertR3DependencyMetadataArray(facades) {
|
|
20012
19743
|
return facades == null ? null : facades.map(convertR3DependencyMetadata);
|
|
@@ -20115,7 +19846,7 @@ function publishFacade(global) {
|
|
|
20115
19846
|
* Use of this source code is governed by an MIT-style license that can be
|
|
20116
19847
|
* found in the LICENSE file at https://angular.io/license
|
|
20117
19848
|
*/
|
|
20118
|
-
const VERSION = new Version('14.0.0-next.
|
|
19849
|
+
const VERSION = new Version('14.0.0-next.16');
|
|
20119
19850
|
|
|
20120
19851
|
/**
|
|
20121
19852
|
* @license
|
|
@@ -22142,7 +21873,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
22142
21873
|
function compileDeclareClassMetadata(metadata) {
|
|
22143
21874
|
const definitionMap = new DefinitionMap();
|
|
22144
21875
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
22145
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21876
|
+
definitionMap.set('version', literal('14.0.0-next.16'));
|
|
22146
21877
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22147
21878
|
definitionMap.set('type', metadata.type);
|
|
22148
21879
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -22242,7 +21973,7 @@ function compileDependency(dep) {
|
|
|
22242
21973
|
*
|
|
22243
21974
|
* Do not include any prerelease in these versions as they are ignored.
|
|
22244
21975
|
*/
|
|
22245
|
-
const MINIMUM_PARTIAL_LINKER_VERSION$5 = '
|
|
21976
|
+
const MINIMUM_PARTIAL_LINKER_VERSION$5 = '14.0.0';
|
|
22246
21977
|
/**
|
|
22247
21978
|
* Compile a directive declaration defined by the `R3DirectiveMetadata`.
|
|
22248
21979
|
*/
|
|
@@ -22259,7 +21990,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
22259
21990
|
function createDirectiveDefinitionMap(meta) {
|
|
22260
21991
|
const definitionMap = new DefinitionMap();
|
|
22261
21992
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
22262
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21993
|
+
definitionMap.set('version', literal('14.0.0-next.16'));
|
|
22263
21994
|
// e.g. `type: MyDirective`
|
|
22264
21995
|
definitionMap.set('type', meta.internalType);
|
|
22265
21996
|
if (meta.isStandalone) {
|
|
@@ -22426,7 +22157,7 @@ function computeEndLocation(file, contents) {
|
|
|
22426
22157
|
return new ParseLocation(file, length, line, length - lastLineStart);
|
|
22427
22158
|
}
|
|
22428
22159
|
function compileUsedDependenciesMetadata(meta) {
|
|
22429
|
-
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22160
|
+
const wrapType = meta.declarationListEmitMode !== 0 /* DeclarationListEmitMode.Direct */ ?
|
|
22430
22161
|
generateForwardRef :
|
|
22431
22162
|
(expr) => expr;
|
|
22432
22163
|
return toOptionalLiteralArray(meta.declarations, decl => {
|
|
@@ -22473,7 +22204,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22473
22204
|
function compileDeclareFactoryFunction(meta) {
|
|
22474
22205
|
const definitionMap = new DefinitionMap();
|
|
22475
22206
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22476
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22207
|
+
definitionMap.set('version', literal('14.0.0-next.16'));
|
|
22477
22208
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22478
22209
|
definitionMap.set('type', meta.internalType);
|
|
22479
22210
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22515,7 +22246,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22515
22246
|
function createInjectableDefinitionMap(meta) {
|
|
22516
22247
|
const definitionMap = new DefinitionMap();
|
|
22517
22248
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22518
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22249
|
+
definitionMap.set('version', literal('14.0.0-next.16'));
|
|
22519
22250
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22520
22251
|
definitionMap.set('type', meta.internalType);
|
|
22521
22252
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22573,7 +22304,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22573
22304
|
function createInjectorDefinitionMap(meta) {
|
|
22574
22305
|
const definitionMap = new DefinitionMap();
|
|
22575
22306
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22576
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22307
|
+
definitionMap.set('version', literal('14.0.0-next.16'));
|
|
22577
22308
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22578
22309
|
definitionMap.set('type', meta.internalType);
|
|
22579
22310
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22597,7 +22328,7 @@ function createInjectorDefinitionMap(meta) {
|
|
|
22597
22328
|
*
|
|
22598
22329
|
* Do not include any prerelease in these versions as they are ignored.
|
|
22599
22330
|
*/
|
|
22600
|
-
const MINIMUM_PARTIAL_LINKER_VERSION$1 = '
|
|
22331
|
+
const MINIMUM_PARTIAL_LINKER_VERSION$1 = '14.0.0';
|
|
22601
22332
|
function compileDeclareNgModuleFromMetadata(meta) {
|
|
22602
22333
|
const definitionMap = createNgModuleDefinitionMap(meta);
|
|
22603
22334
|
const expression = importExpr(Identifiers.declareNgModule).callFn([definitionMap.toLiteralMap()]);
|
|
@@ -22610,7 +22341,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22610
22341
|
function createNgModuleDefinitionMap(meta) {
|
|
22611
22342
|
const definitionMap = new DefinitionMap();
|
|
22612
22343
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22613
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22344
|
+
definitionMap.set('version', literal('14.0.0-next.16'));
|
|
22614
22345
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22615
22346
|
definitionMap.set('type', meta.internalType);
|
|
22616
22347
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22652,7 +22383,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
22652
22383
|
*
|
|
22653
22384
|
* Do not include any prerelease in these versions as they are ignored.
|
|
22654
22385
|
*/
|
|
22655
|
-
const MINIMUM_PARTIAL_LINKER_VERSION = '
|
|
22386
|
+
const MINIMUM_PARTIAL_LINKER_VERSION = '14.0.0';
|
|
22656
22387
|
/**
|
|
22657
22388
|
* Compile a Pipe declaration defined by the `R3PipeMetadata`.
|
|
22658
22389
|
*/
|
|
@@ -22668,7 +22399,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22668
22399
|
function createPipeDefinitionMap(meta) {
|
|
22669
22400
|
const definitionMap = new DefinitionMap();
|
|
22670
22401
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22671
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22402
|
+
definitionMap.set('version', literal('14.0.0-next.16'));
|
|
22672
22403
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22673
22404
|
// e.g. `type: MyPipe`
|
|
22674
22405
|
definitionMap.set('type', meta.internalType);
|