@angular/compiler 15.2.0-next.3 → 15.2.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.2.0-next.3
2
+ * @license Angular v15.2.0-rc.0
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.2.0-next.3
2
+ * @license Angular v15.2.0-rc.0
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.2.0-next.3');
19890
+ const VERSION = new Version('15.2.0-rc.0');
19926
19891
 
19927
19892
  class CompilerConfig {
19928
19893
  constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, useJit = true, missingTranslation = null, preserveWhitespaces, strictInjectionParameters } = {}) {
@@ -21846,7 +21811,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21846
21811
  function compileDeclareClassMetadata(metadata) {
21847
21812
  const definitionMap = new DefinitionMap();
21848
21813
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21849
- definitionMap.set('version', literal('15.2.0-next.3'));
21814
+ definitionMap.set('version', literal('15.2.0-rc.0'));
21850
21815
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21851
21816
  definitionMap.set('type', metadata.type);
21852
21817
  definitionMap.set('decorators', metadata.decorators);
@@ -21949,7 +21914,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
21949
21914
  function createDirectiveDefinitionMap(meta) {
21950
21915
  const definitionMap = new DefinitionMap();
21951
21916
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21952
- definitionMap.set('version', literal('15.2.0-next.3'));
21917
+ definitionMap.set('version', literal('15.2.0-rc.0'));
21953
21918
  // e.g. `type: MyDirective`
21954
21919
  definitionMap.set('type', meta.internalType);
21955
21920
  if (meta.isStandalone) {
@@ -22174,7 +22139,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22174
22139
  function compileDeclareFactoryFunction(meta) {
22175
22140
  const definitionMap = new DefinitionMap();
22176
22141
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22177
- definitionMap.set('version', literal('15.2.0-next.3'));
22142
+ definitionMap.set('version', literal('15.2.0-rc.0'));
22178
22143
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22179
22144
  definitionMap.set('type', meta.internalType);
22180
22145
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22209,7 +22174,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22209
22174
  function createInjectableDefinitionMap(meta) {
22210
22175
  const definitionMap = new DefinitionMap();
22211
22176
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22212
- definitionMap.set('version', literal('15.2.0-next.3'));
22177
+ definitionMap.set('version', literal('15.2.0-rc.0'));
22213
22178
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22214
22179
  definitionMap.set('type', meta.internalType);
22215
22180
  // Only generate providedIn property if it has a non-null value
@@ -22260,7 +22225,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22260
22225
  function createInjectorDefinitionMap(meta) {
22261
22226
  const definitionMap = new DefinitionMap();
22262
22227
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22263
- definitionMap.set('version', literal('15.2.0-next.3'));
22228
+ definitionMap.set('version', literal('15.2.0-rc.0'));
22264
22229
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22265
22230
  definitionMap.set('type', meta.internalType);
22266
22231
  definitionMap.set('providers', meta.providers);
@@ -22290,7 +22255,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22290
22255
  function createNgModuleDefinitionMap(meta) {
22291
22256
  const definitionMap = new DefinitionMap();
22292
22257
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22293
- definitionMap.set('version', literal('15.2.0-next.3'));
22258
+ definitionMap.set('version', literal('15.2.0-rc.0'));
22294
22259
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22295
22260
  definitionMap.set('type', meta.internalType);
22296
22261
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22341,7 +22306,7 @@ function compileDeclarePipeFromMetadata(meta) {
22341
22306
  function createPipeDefinitionMap(meta) {
22342
22307
  const definitionMap = new DefinitionMap();
22343
22308
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22344
- definitionMap.set('version', literal('15.2.0-next.3'));
22309
+ definitionMap.set('version', literal('15.2.0-rc.0'));
22345
22310
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22346
22311
  // e.g. `type: MyPipe`
22347
22312
  definitionMap.set('type', meta.internalType);