@angular/compiler 15.1.3 → 15.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.3
2
+ * @license Angular v15.1.5
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.3
2
+ * @license Angular v15.1.5
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7437,9 +7437,8 @@ const animationKeywords = new Set([
7437
7437
  'end', 'jump-both', 'jump-end', 'jump-none', 'jump-start', 'start'
7438
7438
  ]);
7439
7439
  /**
7440
- * The following class is a port of shadowCSS from webcomponents.js to TypeScript.
7441
- *
7442
- * Please make sure to keep to edits in sync with the source file.
7440
+ * The following class has its origin from a port of shadowCSS from webcomponents.js to TypeScript.
7441
+ * It has since diverge in many ways to tailor Angular's needs.
7443
7442
  *
7444
7443
  * Source:
7445
7444
  * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
@@ -7479,28 +7478,8 @@ const animationKeywords = new Set([
7479
7478
  }
7480
7479
 
7481
7480
  * encapsulation: Styles defined within ShadowDOM, apply only to
7482
- dom inside the ShadowDOM. Polymer uses one of two techniques to implement
7483
- this feature.
7484
-
7485
- By default, rules are prefixed with the host element tag name
7486
- as a descendant selector. This ensures styling does not leak out of the 'top'
7487
- of the element's ShadowDOM. For example,
7488
-
7489
- div {
7490
- font-weight: bold;
7491
- }
7492
-
7493
- becomes:
7494
-
7495
- x-foo div {
7496
- font-weight: bold;
7497
- }
7498
-
7499
- becomes:
7500
-
7501
-
7502
- Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then
7503
- selectors are scoped by adding an attribute selector suffix to each
7481
+ dom inside the ShadowDOM.
7482
+ The selectors are scoped by adding an attribute selector suffix to each
7504
7483
  simple selector that contains the host element tag name. Each element
7505
7484
  in the element's ShadowDOM template is also given the scope attribute.
7506
7485
  Thus, these rules match only elements that have the scope attribute.
@@ -7562,8 +7541,6 @@ const animationKeywords = new Set([
7562
7541
  */
7563
7542
  class ShadowCss {
7564
7543
  constructor() {
7565
- // TODO: Is never re-assigned, could be removed.
7566
- this.strictStyling = true;
7567
7544
  /**
7568
7545
  * Regular expression used to extrapolate the possible keyframes from an
7569
7546
  * animation declaration (with possibly multiple animation definitions)
@@ -7581,12 +7558,10 @@ class ShadowCss {
7581
7558
  this._animationDeclarationKeyframesRe = /(^|\s+)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;
7582
7559
  }
7583
7560
  /*
7584
- * Shim some cssText with the given selector. Returns cssText that can
7585
- * be included in the document via WebComponents.ShadowCSS.addCssToDocument(css).
7561
+ * Shim some cssText with the given selector. Returns cssText that can be included in the document
7586
7562
  *
7587
- * When strictStyling is true:
7588
- * - selector is the attribute added to all elements inside the host,
7589
- * - hostSelector is the attribute added to the host itself.
7563
+ * The selector is the attribute added to all elements inside the host,
7564
+ * The hostSelector is the attribute added to the host itself.
7590
7565
  */
7591
7566
  shimCssText(cssText, selector, hostSelector = '') {
7592
7567
  const commentsWithHash = extractCommentsWithHash(cssText);
@@ -7751,7 +7726,6 @@ class ShadowCss {
7751
7726
  *
7752
7727
  **/
7753
7728
  _insertPolyfillDirectivesInCssText(cssText) {
7754
- // Difference with webcomponents.js: does not handle comments
7755
7729
  return cssText.replace(_cssContentNextSelectorRe, function (...m) {
7756
7730
  return m[2] + '{';
7757
7731
  });
@@ -7772,7 +7746,6 @@ class ShadowCss {
7772
7746
  *
7773
7747
  **/
7774
7748
  _insertPolyfillRulesInCssText(cssText) {
7775
- // Difference with webcomponents.js: does not handle comments
7776
7749
  return cssText.replace(_cssContentRuleRe, (...m) => {
7777
7750
  const rule = m[0].replace(m[1], '').replace(m[2], '');
7778
7751
  return m[4] + rule;
@@ -7816,7 +7789,6 @@ class ShadowCss {
7816
7789
  *
7817
7790
  **/
7818
7791
  _extractUnscopedRulesFromCssText(cssText) {
7819
- // Difference with webcomponents.js: does not handle comments
7820
7792
  let r = '';
7821
7793
  let m;
7822
7794
  _cssContentUnscopedRuleRe.lastIndex = 0;
@@ -7932,8 +7904,7 @@ class ShadowCss {
7932
7904
  let selector = rule.selector;
7933
7905
  let content = rule.content;
7934
7906
  if (rule.selector[0] !== '@') {
7935
- selector =
7936
- this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
7907
+ selector = this._scopeSelector(rule.selector, scopeSelector, hostSelector);
7937
7908
  }
7938
7909
  else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
7939
7910
  rule.selector.startsWith('@document') || rule.selector.startsWith('@layer') ||
@@ -7974,16 +7945,14 @@ class ShadowCss {
7974
7945
  return new CssRule(selector, rule.content);
7975
7946
  });
7976
7947
  }
7977
- _scopeSelector(selector, scopeSelector, hostSelector, strict) {
7948
+ _scopeSelector(selector, scopeSelector, hostSelector) {
7978
7949
  return selector.split(',')
7979
7950
  .map(part => part.trim().split(_shadowDeepSelectors))
7980
7951
  .map((deepParts) => {
7981
7952
  const [shallowPart, ...otherParts] = deepParts;
7982
7953
  const applyScope = (shallowPart) => {
7983
7954
  if (this._selectorNeedsScoping(shallowPart, scopeSelector)) {
7984
- return strict ?
7985
- this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) :
7986
- this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
7955
+ return this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
7987
7956
  }
7988
7957
  else {
7989
7958
  return shallowPart;
@@ -8003,16 +7972,12 @@ class ShadowCss {
8003
7972
  scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
8004
7973
  return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
8005
7974
  }
8006
- _applySelectorScope(selector, scopeSelector, hostSelector) {
8007
- // Difference from webcomponents.js: scopeSelector could not be an array
8008
- return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
8009
- }
8010
7975
  // scope via name and [is=name]
8011
7976
  _applySimpleSelectorScope(selector, scopeSelector, hostSelector) {
8012
7977
  // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
8013
7978
  _polyfillHostRe.lastIndex = 0;
8014
7979
  if (_polyfillHostRe.test(selector)) {
8015
- const replaceBy = this.strictStyling ? `[${hostSelector}]` : scopeSelector;
7980
+ const replaceBy = `[${hostSelector}]`;
8016
7981
  return selector
8017
7982
  .replace(_polyfillHostNoCombinatorRe, (hnc, selector) => {
8018
7983
  return selector.replace(/([^:]*)(:*)(.*)/, (_, before, colon, after) => {
@@ -8025,7 +7990,7 @@ class ShadowCss {
8025
7990
  }
8026
7991
  // return a selector with [name] suffix on each simple selector
8027
7992
  // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
8028
- _applyStrictSelectorScope(selector, scopeSelector, hostSelector) {
7993
+ _applySelectorScope(selector, scopeSelector, hostSelector) {
8029
7994
  const isRe = /\[is=([^\]]*)\]/g;
8030
7995
  scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
8031
7996
  const attrName = '[' + scopeSelector + ']';
@@ -19922,7 +19887,7 @@ function publishFacade(global) {
19922
19887
  * @description
19923
19888
  * Entry point for all public APIs of the compiler package.
19924
19889
  */
19925
- const VERSION = new Version('15.1.3');
19890
+ const VERSION = new Version('15.1.5');
19926
19891
 
19927
19892
  class CompilerConfig {
19928
19893
  constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, useJit = true, missingTranslation = null, preserveWhitespaces, strictInjectionParameters } = {}) {
@@ -21847,7 +21812,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21847
21812
  function compileDeclareClassMetadata(metadata) {
21848
21813
  const definitionMap = new DefinitionMap();
21849
21814
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21850
- definitionMap.set('version', literal('15.1.3'));
21815
+ definitionMap.set('version', literal('15.1.5'));
21851
21816
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21852
21817
  definitionMap.set('type', metadata.type);
21853
21818
  definitionMap.set('decorators', metadata.decorators);
@@ -21950,7 +21915,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
21950
21915
  function createDirectiveDefinitionMap(meta) {
21951
21916
  const definitionMap = new DefinitionMap();
21952
21917
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21953
- definitionMap.set('version', literal('15.1.3'));
21918
+ definitionMap.set('version', literal('15.1.5'));
21954
21919
  // e.g. `type: MyDirective`
21955
21920
  definitionMap.set('type', meta.internalType);
21956
21921
  if (meta.isStandalone) {
@@ -22175,7 +22140,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22175
22140
  function compileDeclareFactoryFunction(meta) {
22176
22141
  const definitionMap = new DefinitionMap();
22177
22142
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22178
- definitionMap.set('version', literal('15.1.3'));
22143
+ definitionMap.set('version', literal('15.1.5'));
22179
22144
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22180
22145
  definitionMap.set('type', meta.internalType);
22181
22146
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22210,7 +22175,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22210
22175
  function createInjectableDefinitionMap(meta) {
22211
22176
  const definitionMap = new DefinitionMap();
22212
22177
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22213
- definitionMap.set('version', literal('15.1.3'));
22178
+ definitionMap.set('version', literal('15.1.5'));
22214
22179
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22215
22180
  definitionMap.set('type', meta.internalType);
22216
22181
  // Only generate providedIn property if it has a non-null value
@@ -22261,7 +22226,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22261
22226
  function createInjectorDefinitionMap(meta) {
22262
22227
  const definitionMap = new DefinitionMap();
22263
22228
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22264
- definitionMap.set('version', literal('15.1.3'));
22229
+ definitionMap.set('version', literal('15.1.5'));
22265
22230
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22266
22231
  definitionMap.set('type', meta.internalType);
22267
22232
  definitionMap.set('providers', meta.providers);
@@ -22291,7 +22256,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22291
22256
  function createNgModuleDefinitionMap(meta) {
22292
22257
  const definitionMap = new DefinitionMap();
22293
22258
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22294
- definitionMap.set('version', literal('15.1.3'));
22259
+ definitionMap.set('version', literal('15.1.5'));
22295
22260
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22296
22261
  definitionMap.set('type', meta.internalType);
22297
22262
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22342,7 +22307,7 @@ function compileDeclarePipeFromMetadata(meta) {
22342
22307
  function createPipeDefinitionMap(meta) {
22343
22308
  const definitionMap = new DefinitionMap();
22344
22309
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22345
- definitionMap.set('version', literal('15.1.3'));
22310
+ definitionMap.set('version', literal('15.1.5'));
22346
22311
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22347
22312
  // e.g. `type: MyPipe`
22348
22313
  definitionMap.set('type', meta.internalType);