@angular/compiler 14.0.0-next.14 → 14.0.0-next.15
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/compiler.mjs +3 -2
- package/esm2020/src/jit_compiler_facade.mjs +9 -13
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/directive.mjs +1 -1
- 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 +1 -1
- package/esm2020/src/render3/partial/pipe.mjs +1 -1
- package/esm2020/src/shadow_css.mjs +291 -12
- package/esm2020/src/util.mjs +8 -8
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +311 -39
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +314 -39
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/index.d.ts +4964 -5
- package/package.json +3 -3
- package/testing/index.d.ts +22 -5
- package/compiler.d.ts +0 -8
- package/public_api.d.ts +0 -13
- package/src/assertions.d.ts +0 -8
- package/src/chars.d.ts +0 -75
- package/src/compiler.d.ts +0 -77
- package/src/compiler_facade_interface.d.ts +0 -299
- package/src/compiler_util/expression_converter.d.ts +0 -71
- package/src/config.d.ts +0 -25
- package/src/constant_pool.d.ts +0 -37
- package/src/core.d.ts +0 -216
- package/src/expression_parser/ast.d.ts +0 -440
- package/src/expression_parser/lexer.d.ts +0 -47
- package/src/expression_parser/parser.d.ts +0 -315
- package/src/i18n/big_integer.d.ts +0 -108
- package/src/i18n/digest.d.ts +0 -44
- package/src/i18n/extractor_merger.d.ts +0 -27
- package/src/i18n/i18n_ast.d.ts +0 -148
- package/src/i18n/i18n_html_parser.d.ts +0 -19
- package/src/i18n/i18n_parser.d.ts +0 -18
- package/src/i18n/index.d.ts +0 -15
- package/src/i18n/message_bundle.d.ts +0 -28
- package/src/i18n/parse_util.d.ts +0 -14
- package/src/i18n/serializers/placeholder.d.ts +0 -25
- package/src/i18n/serializers/serializer.d.ts +0 -46
- package/src/i18n/serializers/xliff.d.ts +0 -19
- package/src/i18n/serializers/xliff2.d.ts +0 -19
- package/src/i18n/serializers/xmb.d.ts +0 -22
- package/src/i18n/serializers/xml_helper.d.ts +0 -52
- package/src/i18n/serializers/xtb.d.ts +0 -20
- package/src/i18n/translation_bundle.d.ts +0 -27
- package/src/injectable_compiler_2.d.ts +0 -24
- package/src/jit_compiler_facade.d.ts +0 -46
- package/src/ml_parser/ast.d.ts +0 -89
- package/src/ml_parser/entities.d.ts +0 -9
- package/src/ml_parser/html_parser.d.ts +0 -13
- package/src/ml_parser/html_tags.d.ts +0 -33
- package/src/ml_parser/html_whitespaces.d.ts +0 -45
- package/src/ml_parser/icu_ast_expander.d.ts +0 -42
- package/src/ml_parser/interpolation_config.d.ts +0 -14
- package/src/ml_parser/lexer.d.ts +0 -114
- package/src/ml_parser/parser.d.ts +0 -26
- package/src/ml_parser/tags.d.ts +0 -29
- package/src/ml_parser/tokens.d.ts +0 -141
- package/src/ml_parser/xml_parser.d.ts +0 -13
- package/src/ml_parser/xml_tags.d.ts +0 -24
- package/src/output/abstract_emitter.d.ts +0 -66
- package/src/output/abstract_js_emitter.d.ts +0 -19
- package/src/output/map_util.d.ts +0 -18
- package/src/output/output_ast.d.ts +0 -575
- package/src/output/output_jit.d.ts +0 -73
- package/src/output/output_jit_trusted_types.d.ts +0 -43
- package/src/output/source_map.d.ts +0 -29
- package/src/parse_util.d.ts +0 -75
- package/src/render3/partial/api.d.ts +0 -463
- package/src/render3/partial/class_metadata.d.ts +0 -10
- package/src/render3/partial/component.d.ts +0 -39
- package/src/render3/partial/directive.d.ts +0 -13
- package/src/render3/partial/factory.d.ts +0 -3
- package/src/render3/partial/injectable.d.ts +0 -19
- package/src/render3/partial/injector.d.ts +0 -3
- package/src/render3/partial/ng_module.d.ts +0 -3
- package/src/render3/partial/pipe.d.ts +0 -12
- package/src/render3/partial/util.d.ts +0 -33
- package/src/render3/r3_ast.d.ts +0 -211
- package/src/render3/r3_class_metadata_compiler.d.ts +0 -35
- package/src/render3/r3_factory.d.ts +0 -94
- package/src/render3/r3_identifiers.d.ts +0 -183
- package/src/render3/r3_injector_compiler.d.ts +0 -18
- package/src/render3/r3_jit.d.ts +0 -22
- package/src/render3/r3_module_compiler.d.ts +0 -103
- package/src/render3/r3_pipe_compiler.d.ts +0 -50
- package/src/render3/r3_template_transform.d.ts +0 -24
- package/src/render3/util.d.ts +0 -94
- package/src/render3/view/api.d.ts +0 -342
- package/src/render3/view/compiler.d.ts +0 -86
- package/src/render3/view/i18n/context.d.ts +0 -68
- package/src/render3/view/i18n/get_msg_utils.d.ts +0 -47
- package/src/render3/view/i18n/icu_serializer.d.ts +0 -9
- package/src/render3/view/i18n/localize_utils.d.ts +0 -24
- package/src/render3/view/i18n/meta.d.ts +0 -78
- package/src/render3/view/i18n/util.d.ts +0 -78
- package/src/render3/view/style_parser.d.ts +0 -18
- package/src/render3/view/styling_builder.d.ts +0 -211
- package/src/render3/view/t2_api.d.ts +0 -152
- package/src/render3/view/t2_binder.d.ts +0 -57
- package/src/render3/view/template.d.ts +0 -450
- package/src/render3/view/util.d.ts +0 -94
- package/src/resource_loader.d.ts +0 -17
- package/src/schema/dom_element_schema_registry.d.ts +0 -45
- package/src/schema/dom_security_schema.d.ts +0 -11
- package/src/schema/element_schema_registry.d.ts +0 -29
- package/src/schema/trusted_types_sinks.d.ts +0 -15
- package/src/selector.d.ts +0 -105
- package/src/shadow_css.d.ts +0 -76
- package/src/style_url_resolver.d.ts +0 -8
- package/src/template_parser/binding_parser.d.ts +0 -91
- package/src/template_parser/template_preparser.d.ts +0 -24
- package/src/util.d.ts +0 -42
- package/src/version.d.ts +0 -14
- package/testing/package.json +0 -9
- package/testing/public_api.d.ts +0 -13
- package/testing/src/testing.d.ts +0 -23
- package/testing/testing.d.ts +0 -4
package/fesm2015/testing.mjs
CHANGED
package/fesm2020/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.15
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -756,13 +756,13 @@ class Version {
|
|
|
756
756
|
this.patch = splits.slice(2).join('.');
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
759
|
+
// Check `global` first, because in Node tests both `global` and `window` may be defined and our
|
|
760
|
+
// `_global` variable should point to the NodeJS `global` in that case. Note: Typeof/Instanceof
|
|
761
|
+
// checks are considered side-effects in Terser. We explicitly mark this as side-effect free:
|
|
762
|
+
// https://github.com/terser/terser/issues/250.
|
|
763
|
+
const _global = ( /* @__PURE__ */(() => (typeof global !== 'undefined' && global) || (typeof window !== 'undefined' && window) ||
|
|
764
|
+
(typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
|
765
|
+
self instanceof WorkerGlobalScope && self))());
|
|
766
766
|
function newArray(size, value) {
|
|
767
767
|
const list = [];
|
|
768
768
|
for (let i = 0; i < size; i++) {
|
|
@@ -7687,7 +7687,26 @@ class BuiltinFunctionCall extends Call {
|
|
|
7687
7687
|
* found in the LICENSE file at https://angular.io/license
|
|
7688
7688
|
*/
|
|
7689
7689
|
/**
|
|
7690
|
-
*
|
|
7690
|
+
* The following set contains all keywords that can be used in the animation css shorthand
|
|
7691
|
+
* property and is used during the scoping of keyframes to make sure such keywords
|
|
7692
|
+
* are not modified.
|
|
7693
|
+
*/
|
|
7694
|
+
const animationKeywords = new Set([
|
|
7695
|
+
// global values
|
|
7696
|
+
'inherit', 'initial', 'revert', 'unset',
|
|
7697
|
+
// animation-direction
|
|
7698
|
+
'alternate', 'alternate-reverse', 'normal', 'reverse',
|
|
7699
|
+
// animation-fill-mode
|
|
7700
|
+
'backwards', 'both', 'forwards', 'none',
|
|
7701
|
+
// animation-play-state
|
|
7702
|
+
'paused', 'running',
|
|
7703
|
+
// animation-timing-function
|
|
7704
|
+
'ease', 'ease-in', 'ease-in-out', 'ease-out', 'linear', 'step-start', 'step-end',
|
|
7705
|
+
// `steps()` function
|
|
7706
|
+
'end', 'jump-both', 'jump-end', 'jump-none', 'jump-start', 'start'
|
|
7707
|
+
]);
|
|
7708
|
+
/**
|
|
7709
|
+
* The following class is a port of shadowCSS from webcomponents.js to TypeScript.
|
|
7691
7710
|
*
|
|
7692
7711
|
* Please make sure to keep to edits in sync with the source file.
|
|
7693
7712
|
*
|
|
@@ -7813,6 +7832,21 @@ class BuiltinFunctionCall extends Call {
|
|
|
7813
7832
|
class ShadowCss {
|
|
7814
7833
|
constructor() {
|
|
7815
7834
|
this.strictStyling = true;
|
|
7835
|
+
/**
|
|
7836
|
+
* Regular expression used to extrapolate the possible keyframes from an
|
|
7837
|
+
* animation declaration (with possibly multiple animation definitions)
|
|
7838
|
+
*
|
|
7839
|
+
* The regular expression can be divided in three parts
|
|
7840
|
+
* - (^|\s+)
|
|
7841
|
+
* simply captures how many (if any) leading whitespaces are present
|
|
7842
|
+
* - (?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))
|
|
7843
|
+
* captures two different possible keyframes, ones which are quoted or ones which are valid css
|
|
7844
|
+
* idents (custom properties excluded)
|
|
7845
|
+
* - (?=[,\s;]|$)
|
|
7846
|
+
* simply matches the end of the possible keyframe, valid endings are: a comma, a space, a
|
|
7847
|
+
* semicolon or the end of the string
|
|
7848
|
+
*/
|
|
7849
|
+
this._animationDeclarationKeyframesRe = /(^|\s+)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;
|
|
7816
7850
|
}
|
|
7817
7851
|
/*
|
|
7818
7852
|
* Shim some cssText with the given selector. Returns cssText that can
|
|
@@ -7833,6 +7867,143 @@ class ShadowCss {
|
|
|
7833
7867
|
cssText = this._insertPolyfillDirectivesInCssText(cssText);
|
|
7834
7868
|
return this._insertPolyfillRulesInCssText(cssText);
|
|
7835
7869
|
}
|
|
7870
|
+
/**
|
|
7871
|
+
* Process styles to add scope to keyframes.
|
|
7872
|
+
*
|
|
7873
|
+
* Modify both the names of the keyframes defined in the component styles and also the css
|
|
7874
|
+
* animation rules using them.
|
|
7875
|
+
*
|
|
7876
|
+
* Animation rules using keyframes defined elsewhere are not modified to allow for globally
|
|
7877
|
+
* defined keyframes.
|
|
7878
|
+
*
|
|
7879
|
+
* For example, we convert this css:
|
|
7880
|
+
*
|
|
7881
|
+
* ```
|
|
7882
|
+
* .box {
|
|
7883
|
+
* animation: box-animation 1s forwards;
|
|
7884
|
+
* }
|
|
7885
|
+
*
|
|
7886
|
+
* @keyframes box-animation {
|
|
7887
|
+
* to {
|
|
7888
|
+
* background-color: green;
|
|
7889
|
+
* }
|
|
7890
|
+
* }
|
|
7891
|
+
* ```
|
|
7892
|
+
*
|
|
7893
|
+
* to this:
|
|
7894
|
+
*
|
|
7895
|
+
* ```
|
|
7896
|
+
* .box {
|
|
7897
|
+
* animation: scopeName_box-animation 1s forwards;
|
|
7898
|
+
* }
|
|
7899
|
+
*
|
|
7900
|
+
* @keyframes scopeName_box-animation {
|
|
7901
|
+
* to {
|
|
7902
|
+
* background-color: green;
|
|
7903
|
+
* }
|
|
7904
|
+
* }
|
|
7905
|
+
* ```
|
|
7906
|
+
*
|
|
7907
|
+
* @param cssText the component's css text that needs to be scoped.
|
|
7908
|
+
* @param scopeSelector the component's scope selector.
|
|
7909
|
+
*
|
|
7910
|
+
* @returns the scoped css text.
|
|
7911
|
+
*/
|
|
7912
|
+
_scopeKeyframesRelatedCss(cssText, scopeSelector) {
|
|
7913
|
+
const unscopedKeyframesSet = new Set();
|
|
7914
|
+
const scopedKeyframesCssText = processRules(cssText, rule => this._scopeLocalKeyframeDeclarations(rule, scopeSelector, unscopedKeyframesSet));
|
|
7915
|
+
return processRules(scopedKeyframesCssText, rule => this._scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet));
|
|
7916
|
+
}
|
|
7917
|
+
/**
|
|
7918
|
+
* Scopes local keyframes names, returning the updated css rule and it also
|
|
7919
|
+
* adds the original keyframe name to a provided set to collect all keyframes names
|
|
7920
|
+
* so that it can later be used to scope the animation rules.
|
|
7921
|
+
*
|
|
7922
|
+
* For example, it takes a rule such as:
|
|
7923
|
+
*
|
|
7924
|
+
* ```
|
|
7925
|
+
* @keyframes box-animation {
|
|
7926
|
+
* to {
|
|
7927
|
+
* background-color: green;
|
|
7928
|
+
* }
|
|
7929
|
+
* }
|
|
7930
|
+
* ```
|
|
7931
|
+
*
|
|
7932
|
+
* and returns:
|
|
7933
|
+
*
|
|
7934
|
+
* ```
|
|
7935
|
+
* @keyframes scopeName_box-animation {
|
|
7936
|
+
* to {
|
|
7937
|
+
* background-color: green;
|
|
7938
|
+
* }
|
|
7939
|
+
* }
|
|
7940
|
+
* ```
|
|
7941
|
+
* and as a side effect it adds "box-animation" to the `unscopedKeyframesSet` set
|
|
7942
|
+
*
|
|
7943
|
+
* @param cssRule the css rule to process.
|
|
7944
|
+
* @param scopeSelector the component's scope selector.
|
|
7945
|
+
* @param unscopedKeyframesSet the set of unscoped keyframes names (which can be
|
|
7946
|
+
* modified as a side effect)
|
|
7947
|
+
*
|
|
7948
|
+
* @returns the css rule modified with the scoped keyframes name.
|
|
7949
|
+
*/
|
|
7950
|
+
_scopeLocalKeyframeDeclarations(rule, scopeSelector, unscopedKeyframesSet) {
|
|
7951
|
+
return {
|
|
7952
|
+
...rule,
|
|
7953
|
+
selector: rule.selector.replace(/(^@(?:-webkit-)?keyframes(?:\s+))(['"]?)(.+)\2(\s*)$/, (_, start, quote, keyframeName, endSpaces) => {
|
|
7954
|
+
unscopedKeyframesSet.add(unescapeQuotes(keyframeName, quote));
|
|
7955
|
+
return `${start}${quote}${scopeSelector}_${keyframeName}${quote}${endSpaces}`;
|
|
7956
|
+
}),
|
|
7957
|
+
};
|
|
7958
|
+
}
|
|
7959
|
+
/**
|
|
7960
|
+
* Function used to scope a keyframes name (obtained from an animation declaration)
|
|
7961
|
+
* using an existing set of unscopedKeyframes names to discern if the scoping needs to be
|
|
7962
|
+
* performed (keyframes names of keyframes not defined in the component's css need not to be
|
|
7963
|
+
* scoped).
|
|
7964
|
+
*
|
|
7965
|
+
* @param keyframe the keyframes name to check.
|
|
7966
|
+
* @param scopeSelector the component's scope selector.
|
|
7967
|
+
* @param unscopedKeyframesSet the set of unscoped keyframes names.
|
|
7968
|
+
*
|
|
7969
|
+
* @returns the scoped name of the keyframe, or the original name is the name need not to be
|
|
7970
|
+
* scoped.
|
|
7971
|
+
*/
|
|
7972
|
+
_scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet) {
|
|
7973
|
+
return keyframe.replace(/^(\s*)(['"]?)(.+?)\2(\s*)$/, (_, spaces1, quote, name, spaces2) => {
|
|
7974
|
+
name = `${unscopedKeyframesSet.has(unescapeQuotes(name, quote)) ? scopeSelector + '_' : ''}${name}`;
|
|
7975
|
+
return `${spaces1}${quote}${name}${quote}${spaces2}`;
|
|
7976
|
+
});
|
|
7977
|
+
}
|
|
7978
|
+
/**
|
|
7979
|
+
* Scope an animation rule so that the keyframes mentioned in such rule
|
|
7980
|
+
* are scoped if defined in the component's css and left untouched otherwise.
|
|
7981
|
+
*
|
|
7982
|
+
* It can scope values of both the 'animation' and 'animation-name' properties.
|
|
7983
|
+
*
|
|
7984
|
+
* @param rule css rule to scope.
|
|
7985
|
+
* @param scopeSelector the component's scope selector.
|
|
7986
|
+
* @param unscopedKeyframesSet the set of unscoped keyframes names.
|
|
7987
|
+
*
|
|
7988
|
+
* @returns the updated css rule.
|
|
7989
|
+
**/
|
|
7990
|
+
_scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet) {
|
|
7991
|
+
let content = rule.content.replace(/((?:^|\s+)(?:-webkit-)?animation(?:\s*):(?:\s*))([^;]+)/g, (_, start, animationDeclarations) => start +
|
|
7992
|
+
animationDeclarations.replace(this._animationDeclarationKeyframesRe, (original, leadingSpaces, quote = '', quotedName, nonQuotedName) => {
|
|
7993
|
+
if (quotedName) {
|
|
7994
|
+
return `${leadingSpaces}${this._scopeAnimationKeyframe(`${quote}${quotedName}${quote}`, scopeSelector, unscopedKeyframesSet)}`;
|
|
7995
|
+
}
|
|
7996
|
+
else {
|
|
7997
|
+
return animationKeywords.has(nonQuotedName) ?
|
|
7998
|
+
original :
|
|
7999
|
+
`${leadingSpaces}${this._scopeAnimationKeyframe(nonQuotedName, scopeSelector, unscopedKeyframesSet)}`;
|
|
8000
|
+
}
|
|
8001
|
+
}));
|
|
8002
|
+
content = content.replace(/((?:^|\s+)(?:-webkit-)?animation-name(?:\s*):(?:\s*))([^;]+)/g, (_match, start, commaSeparatedKeyframes) => `${start}${commaSeparatedKeyframes.split(',')
|
|
8003
|
+
.map((keyframe) => this._scopeAnimationKeyframe(keyframe, scopeSelector, unscopedKeyframesSet))
|
|
8004
|
+
.join(',')}`);
|
|
8005
|
+
return { ...rule, content };
|
|
8006
|
+
}
|
|
7836
8007
|
/*
|
|
7837
8008
|
* Process styles to convert native ShadowDOM rules that will trip
|
|
7838
8009
|
* up the css parser; we rely on decorating the stylesheet with inert rules.
|
|
@@ -7891,6 +8062,7 @@ class ShadowCss {
|
|
|
7891
8062
|
cssText = this._convertColonHostContext(cssText);
|
|
7892
8063
|
cssText = this._convertShadowDOMSelectors(cssText);
|
|
7893
8064
|
if (scopeSelector) {
|
|
8065
|
+
cssText = this._scopeKeyframesRelatedCss(cssText, scopeSelector);
|
|
7894
8066
|
cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
|
|
7895
8067
|
}
|
|
7896
8068
|
cssText = cssText + '\n' + unscopedRules;
|
|
@@ -8262,11 +8434,14 @@ function extractCommentsWithHash(input) {
|
|
|
8262
8434
|
return input.match(_commentWithHashRe) || [];
|
|
8263
8435
|
}
|
|
8264
8436
|
const BLOCK_PLACEHOLDER = '%BLOCK%';
|
|
8265
|
-
const QUOTE_PLACEHOLDER = '%QUOTED%';
|
|
8266
8437
|
const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
8267
|
-
const _quotedRe = /%QUOTED%/g;
|
|
8268
8438
|
const CONTENT_PAIRS = new Map([['{', '}']]);
|
|
8269
|
-
const
|
|
8439
|
+
const COMMA_IN_PLACEHOLDER = '%COMMA_IN_PLACEHOLDER%';
|
|
8440
|
+
const SEMI_IN_PLACEHOLDER = '%SEMI_IN_PLACEHOLDER%';
|
|
8441
|
+
const COLON_IN_PLACEHOLDER = '%COLON_IN_PLACEHOLDER%';
|
|
8442
|
+
const _cssCommaInPlaceholderReGlobal = new RegExp(COMMA_IN_PLACEHOLDER, 'g');
|
|
8443
|
+
const _cssSemiInPlaceholderReGlobal = new RegExp(SEMI_IN_PLACEHOLDER, 'g');
|
|
8444
|
+
const _cssColonInPlaceholderReGlobal = new RegExp(COLON_IN_PLACEHOLDER, 'g');
|
|
8270
8445
|
class CssRule {
|
|
8271
8446
|
constructor(selector, content) {
|
|
8272
8447
|
this.selector = selector;
|
|
@@ -8274,12 +8449,10 @@ class CssRule {
|
|
|
8274
8449
|
}
|
|
8275
8450
|
}
|
|
8276
8451
|
function processRules(input, ruleCallback) {
|
|
8277
|
-
const
|
|
8278
|
-
const inputWithEscapedBlocks = escapeBlocks(
|
|
8452
|
+
const escaped = escapeInStrings(input);
|
|
8453
|
+
const inputWithEscapedBlocks = escapeBlocks(escaped, CONTENT_PAIRS, BLOCK_PLACEHOLDER);
|
|
8279
8454
|
let nextBlockIndex = 0;
|
|
8280
|
-
|
|
8281
|
-
return inputWithEscapedBlocks.escapedString
|
|
8282
|
-
.replace(_ruleRe, (...m) => {
|
|
8455
|
+
const escapedResult = inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
|
|
8283
8456
|
const selector = m[2];
|
|
8284
8457
|
let content = '';
|
|
8285
8458
|
let suffix = m[4];
|
|
@@ -8291,8 +8464,8 @@ function processRules(input, ruleCallback) {
|
|
|
8291
8464
|
}
|
|
8292
8465
|
const rule = ruleCallback(new CssRule(selector, content));
|
|
8293
8466
|
return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
|
|
8294
|
-
})
|
|
8295
|
-
|
|
8467
|
+
});
|
|
8468
|
+
return unescapeInStrings(escapedResult);
|
|
8296
8469
|
}
|
|
8297
8470
|
class StringWithEscapedBlocks {
|
|
8298
8471
|
constructor(escapedString, blocks) {
|
|
@@ -8343,6 +8516,112 @@ function escapeBlocks(input, charPairs, placeholder) {
|
|
|
8343
8516
|
}
|
|
8344
8517
|
return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
|
|
8345
8518
|
}
|
|
8519
|
+
/**
|
|
8520
|
+
* Object containing as keys characters that should be substituted by placeholders
|
|
8521
|
+
* when found in strings during the css text parsing, and as values the respective
|
|
8522
|
+
* placeholders
|
|
8523
|
+
*/
|
|
8524
|
+
const ESCAPE_IN_STRING_MAP = {
|
|
8525
|
+
';': SEMI_IN_PLACEHOLDER,
|
|
8526
|
+
',': COMMA_IN_PLACEHOLDER,
|
|
8527
|
+
':': COLON_IN_PLACEHOLDER
|
|
8528
|
+
};
|
|
8529
|
+
/**
|
|
8530
|
+
* Parse the provided css text and inside strings (meaning, inside pairs of unescaped single or
|
|
8531
|
+
* double quotes) replace specific characters with their respective placeholders as indicated
|
|
8532
|
+
* by the `ESCAPE_IN_STRING_MAP` map.
|
|
8533
|
+
*
|
|
8534
|
+
* For example convert the text
|
|
8535
|
+
* `animation: "my-anim:at\"ion" 1s;`
|
|
8536
|
+
* to
|
|
8537
|
+
* `animation: "my-anim%COLON_IN_PLACEHOLDER%at\"ion" 1s;`
|
|
8538
|
+
*
|
|
8539
|
+
* This is necessary in order to remove the meaning of some characters when found inside strings
|
|
8540
|
+
* (for example `;` indicates the end of a css declaration, `,` the sequence of values and `:` the
|
|
8541
|
+
* division between property and value during a declaration, none of these meanings apply when such
|
|
8542
|
+
* characters are within strings and so in order to prevent parsing issues they need to be replaced
|
|
8543
|
+
* with placeholder text for the duration of the css manipulation process).
|
|
8544
|
+
*
|
|
8545
|
+
* @param input the original css text.
|
|
8546
|
+
*
|
|
8547
|
+
* @returns the css text with specific characters in strings replaced by placeholders.
|
|
8548
|
+
**/
|
|
8549
|
+
function escapeInStrings(input) {
|
|
8550
|
+
let result = input;
|
|
8551
|
+
let currentQuoteChar = null;
|
|
8552
|
+
for (let i = 0; i < result.length; i++) {
|
|
8553
|
+
const char = result[i];
|
|
8554
|
+
if (char === '\\') {
|
|
8555
|
+
i++;
|
|
8556
|
+
}
|
|
8557
|
+
else {
|
|
8558
|
+
if (currentQuoteChar !== null) {
|
|
8559
|
+
// index i is inside a quoted sub-string
|
|
8560
|
+
if (char === currentQuoteChar) {
|
|
8561
|
+
currentQuoteChar = null;
|
|
8562
|
+
}
|
|
8563
|
+
else {
|
|
8564
|
+
const placeholder = ESCAPE_IN_STRING_MAP[char];
|
|
8565
|
+
if (placeholder) {
|
|
8566
|
+
result = `${result.substr(0, i)}${placeholder}${result.substr(i + 1)}`;
|
|
8567
|
+
i += placeholder.length - 1;
|
|
8568
|
+
}
|
|
8569
|
+
}
|
|
8570
|
+
}
|
|
8571
|
+
else if (char === '\'' || char === '"') {
|
|
8572
|
+
currentQuoteChar = char;
|
|
8573
|
+
}
|
|
8574
|
+
}
|
|
8575
|
+
}
|
|
8576
|
+
return result;
|
|
8577
|
+
}
|
|
8578
|
+
/**
|
|
8579
|
+
* Replace in a string all occurrences of keys in the `ESCAPE_IN_STRING_MAP` map with their
|
|
8580
|
+
* original representation, this is simply used to revert the changes applied by the
|
|
8581
|
+
* escapeInStrings function.
|
|
8582
|
+
*
|
|
8583
|
+
* For example it reverts the text:
|
|
8584
|
+
* `animation: "my-anim%COLON_IN_PLACEHOLDER%at\"ion" 1s;`
|
|
8585
|
+
* to it's original form of:
|
|
8586
|
+
* `animation: "my-anim:at\"ion" 1s;`
|
|
8587
|
+
*
|
|
8588
|
+
* Note: For the sake of simplicity this function does not check that the placeholders are
|
|
8589
|
+
* actually inside strings as it would anyway be extremely unlikely to find them outside of strings.
|
|
8590
|
+
*
|
|
8591
|
+
* @param input the css text containing the placeholders.
|
|
8592
|
+
*
|
|
8593
|
+
* @returns the css text without the placeholders.
|
|
8594
|
+
*/
|
|
8595
|
+
function unescapeInStrings(input) {
|
|
8596
|
+
let result = input.replace(_cssCommaInPlaceholderReGlobal, ',');
|
|
8597
|
+
result = result.replace(_cssSemiInPlaceholderReGlobal, ';');
|
|
8598
|
+
result = result.replace(_cssColonInPlaceholderReGlobal, ':');
|
|
8599
|
+
return result;
|
|
8600
|
+
}
|
|
8601
|
+
/**
|
|
8602
|
+
* Unescape all quotes present in a string, but only if the string was actually already
|
|
8603
|
+
* quoted.
|
|
8604
|
+
*
|
|
8605
|
+
* This generates a "canonical" representation of strings which can be used to match strings
|
|
8606
|
+
* which would otherwise only differ because of differently escaped quotes.
|
|
8607
|
+
*
|
|
8608
|
+
* For example it converts the string (assumed to be quoted):
|
|
8609
|
+
* `this \\"is\\" a \\'\\\\'test`
|
|
8610
|
+
* to:
|
|
8611
|
+
* `this "is" a '\\\\'test`
|
|
8612
|
+
* (note that the latter backslashes are not removed as they are not actually escaping the single
|
|
8613
|
+
* quote)
|
|
8614
|
+
*
|
|
8615
|
+
*
|
|
8616
|
+
* @param input the string possibly containing escaped quotes.
|
|
8617
|
+
* @param isQuoted boolean indicating whether the string was quoted inside a bigger string (if not
|
|
8618
|
+
* then it means that it doesn't represent an inner string and thus no unescaping is required)
|
|
8619
|
+
*
|
|
8620
|
+
* @returns the string in the "canonical" representation without escaped quotes.
|
|
8621
|
+
*/
|
|
8622
|
+
function unescapeQuotes(str, isQuoted) {
|
|
8623
|
+
return !isQuoted ? str : str.replace(/((?:^|[^\\])(?:\\\\)*)\\(?=['"])/g, '$1');
|
|
8624
|
+
}
|
|
8346
8625
|
/**
|
|
8347
8626
|
* Combine the `contextSelectors` with the `hostMarker` and the `otherSelectors`
|
|
8348
8627
|
* to create a selector that matches the same as `:host-context()`.
|
|
@@ -19397,10 +19676,10 @@ class CompilerFacadeImpl {
|
|
|
19397
19676
|
internalType: new WrappedNodeExpr(facade.type),
|
|
19398
19677
|
typeArgumentCount: facade.typeArgumentCount,
|
|
19399
19678
|
providedIn: computeProvidedIn(facade.providedIn),
|
|
19400
|
-
useClass: convertToProviderExpression(facade,
|
|
19401
|
-
useFactory: wrapExpression(facade,
|
|
19402
|
-
useValue: convertToProviderExpression(facade,
|
|
19403
|
-
useExisting: convertToProviderExpression(facade,
|
|
19679
|
+
useClass: convertToProviderExpression(facade, 'useClass'),
|
|
19680
|
+
useFactory: wrapExpression(facade, 'useFactory'),
|
|
19681
|
+
useValue: convertToProviderExpression(facade, 'useValue'),
|
|
19682
|
+
useExisting: convertToProviderExpression(facade, 'useExisting'),
|
|
19404
19683
|
deps: facade.deps?.map(convertR3DependencyMetadata),
|
|
19405
19684
|
},
|
|
19406
19685
|
/* resolveForwardRefs */ true);
|
|
@@ -19413,10 +19692,10 @@ class CompilerFacadeImpl {
|
|
|
19413
19692
|
internalType: new WrappedNodeExpr(facade.type),
|
|
19414
19693
|
typeArgumentCount: 0,
|
|
19415
19694
|
providedIn: computeProvidedIn(facade.providedIn),
|
|
19416
|
-
useClass: convertToProviderExpression(facade,
|
|
19417
|
-
useFactory: wrapExpression(facade,
|
|
19418
|
-
useValue: convertToProviderExpression(facade,
|
|
19419
|
-
useExisting: convertToProviderExpression(facade,
|
|
19695
|
+
useClass: convertToProviderExpression(facade, 'useClass'),
|
|
19696
|
+
useFactory: wrapExpression(facade, 'useFactory'),
|
|
19697
|
+
useValue: convertToProviderExpression(facade, 'useValue'),
|
|
19698
|
+
useExisting: convertToProviderExpression(facade, 'useExisting'),
|
|
19420
19699
|
deps: facade.deps?.map(convertR3DeclareDependencyMetadata),
|
|
19421
19700
|
},
|
|
19422
19701
|
/* resolveForwardRefs */ true);
|
|
@@ -19556,10 +19835,6 @@ class CompilerFacadeImpl {
|
|
|
19556
19835
|
return res['$def'];
|
|
19557
19836
|
}
|
|
19558
19837
|
}
|
|
19559
|
-
const USE_CLASS = Object.keys({ useClass: null })[0];
|
|
19560
|
-
const USE_FACTORY = Object.keys({ useFactory: null })[0];
|
|
19561
|
-
const USE_VALUE = Object.keys({ useValue: null })[0];
|
|
19562
|
-
const USE_EXISTING = Object.keys({ useExisting: null })[0];
|
|
19563
19838
|
function convertToR3QueryMetadata(facade) {
|
|
19564
19839
|
return {
|
|
19565
19840
|
...facade,
|
|
@@ -19885,7 +20160,7 @@ function publishFacade(global) {
|
|
|
19885
20160
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19886
20161
|
* found in the LICENSE file at https://angular.io/license
|
|
19887
20162
|
*/
|
|
19888
|
-
const VERSION = new Version('14.0.0-next.
|
|
20163
|
+
const VERSION = new Version('14.0.0-next.15');
|
|
19889
20164
|
|
|
19890
20165
|
/**
|
|
19891
20166
|
* @license
|
|
@@ -21918,7 +22193,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21918
22193
|
function compileDeclareClassMetadata(metadata) {
|
|
21919
22194
|
const definitionMap = new DefinitionMap();
|
|
21920
22195
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21921
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22196
|
+
definitionMap.set('version', literal('14.0.0-next.15'));
|
|
21922
22197
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21923
22198
|
definitionMap.set('type', metadata.type);
|
|
21924
22199
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -22035,7 +22310,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
22035
22310
|
function createDirectiveDefinitionMap(meta) {
|
|
22036
22311
|
const definitionMap = new DefinitionMap();
|
|
22037
22312
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
22038
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22313
|
+
definitionMap.set('version', literal('14.0.0-next.15'));
|
|
22039
22314
|
// e.g. `type: MyDirective`
|
|
22040
22315
|
definitionMap.set('type', meta.internalType);
|
|
22041
22316
|
if (meta.isStandalone) {
|
|
@@ -22249,7 +22524,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22249
22524
|
function compileDeclareFactoryFunction(meta) {
|
|
22250
22525
|
const definitionMap = new DefinitionMap();
|
|
22251
22526
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22252
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22527
|
+
definitionMap.set('version', literal('14.0.0-next.15'));
|
|
22253
22528
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22254
22529
|
definitionMap.set('type', meta.internalType);
|
|
22255
22530
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22291,7 +22566,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22291
22566
|
function createInjectableDefinitionMap(meta) {
|
|
22292
22567
|
const definitionMap = new DefinitionMap();
|
|
22293
22568
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22294
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22569
|
+
definitionMap.set('version', literal('14.0.0-next.15'));
|
|
22295
22570
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22296
22571
|
definitionMap.set('type', meta.internalType);
|
|
22297
22572
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22349,7 +22624,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22349
22624
|
function createInjectorDefinitionMap(meta) {
|
|
22350
22625
|
const definitionMap = new DefinitionMap();
|
|
22351
22626
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22352
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22627
|
+
definitionMap.set('version', literal('14.0.0-next.15'));
|
|
22353
22628
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22354
22629
|
definitionMap.set('type', meta.internalType);
|
|
22355
22630
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22386,7 +22661,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22386
22661
|
function createNgModuleDefinitionMap(meta) {
|
|
22387
22662
|
const definitionMap = new DefinitionMap();
|
|
22388
22663
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22389
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22664
|
+
definitionMap.set('version', literal('14.0.0-next.15'));
|
|
22390
22665
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22391
22666
|
definitionMap.set('type', meta.internalType);
|
|
22392
22667
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22444,7 +22719,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22444
22719
|
function createPipeDefinitionMap(meta) {
|
|
22445
22720
|
const definitionMap = new DefinitionMap();
|
|
22446
22721
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22447
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22722
|
+
definitionMap.set('version', literal('14.0.0-next.15'));
|
|
22448
22723
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22449
22724
|
// e.g. `type: MyPipe`
|
|
22450
22725
|
definitionMap.set('type', meta.internalType);
|