@angular/core 19.0.0-next.8 → 19.0.0-next.9

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.
Files changed (30) hide show
  1. package/fesm2022/core.mjs +93 -13
  2. package/fesm2022/core.mjs.map +1 -1
  3. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  4. package/fesm2022/primitives/signals.mjs +1 -1
  5. package/fesm2022/primitives/signals.mjs.map +1 -1
  6. package/fesm2022/rxjs-interop.mjs +1 -1
  7. package/fesm2022/testing.mjs +6 -4
  8. package/fesm2022/testing.mjs.map +1 -1
  9. package/index.d.ts +41 -18
  10. package/package.json +1 -1
  11. package/primitives/event-dispatch/index.d.ts +1 -1
  12. package/primitives/signals/index.d.ts +5 -1
  13. package/rxjs-interop/index.d.ts +1 -1
  14. package/schematics/bundles/{checker-e68dd7ce.js → checker-3b2ea20f.js} +124 -76
  15. package/schematics/bundles/{compiler_host-9a4d0c2b.js → compiler_host-b4ba5a28.js} +2 -2
  16. package/schematics/bundles/control-flow-migration.js +3 -3
  17. package/schematics/bundles/explicit-standalone-flag.js +3 -3
  18. package/schematics/bundles/{group_replacements-472b2387.js → group_replacements-e1b5cbf8.js} +234 -108
  19. package/schematics/bundles/imports-4ac08251.js +1 -1
  20. package/schematics/bundles/inject-migration.js +3 -3
  21. package/schematics/bundles/leading_space-d190b83b.js +1 -1
  22. package/schematics/bundles/nodes-0e7d45ca.js +1 -1
  23. package/schematics/bundles/pending-tasks.js +3 -3
  24. package/schematics/bundles/{program-105283c5.js → program-6534a30a.js} +67 -21
  25. package/schematics/bundles/project_tsconfig_paths-e9ccccbf.js +1 -1
  26. package/schematics/bundles/route-lazy-loading.js +3 -3
  27. package/schematics/bundles/signal-input-migration.js +147 -171
  28. package/schematics/bundles/signal-queries-migration.js +93 -74
  29. package/schematics/bundles/standalone-migration.js +5 -5
  30. package/testing/index.d.ts +3 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.0.0-next.8
2
+ * @license Angular v19.0.0-next.9
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4341,6 +4341,8 @@ export declare interface ExistingSansProvider {
4341
4341
  useExisting: any;
4342
4342
  }
4343
4343
 
4344
+ declare type ExternalGlobalUtilsFunctions = keyof NgGlobalPublishUtils;
4345
+
4344
4346
  /**
4345
4347
  * Definition of what a factory function should look like.
4346
4348
  */
@@ -6619,10 +6621,7 @@ export declare interface KeyValueDifferFactory {
6619
6621
  export declare class KeyValueDiffers {
6620
6622
  /** @nocollapse */
6621
6623
  static ɵprov: unknown;
6622
- /**
6623
- * @deprecated v4.0.0 - Should be private.
6624
- */
6625
- factories: KeyValueDifferFactory[];
6624
+ private readonly factories;
6626
6625
  constructor(factories: KeyValueDifferFactory[]);
6627
6626
  static create<S>(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers;
6628
6627
  /**
@@ -7378,6 +7377,10 @@ declare const NATIVE = 7;
7378
7377
 
7379
7378
  declare const NEXT = 4;
7380
7379
 
7380
+ declare interface NgGlobalPublishUtils {
7381
+ ɵgetLoadedRoutes(route: any): any;
7382
+ }
7383
+
7381
7384
  /**
7382
7385
  * A type describing supported iterable types.
7383
7386
  *
@@ -12165,16 +12168,6 @@ export declare abstract class ViewRef extends ChangeDetectorRef {
12165
12168
  abstract onDestroy(callback: Function): void;
12166
12169
  }
12167
12170
 
12168
- /**
12169
- * Interface for tracking root `ViewRef`s in `ApplicationRef`.
12170
- *
12171
- * NOTE: Importing `ApplicationRef` here directly creates circular dependency, which is why we have
12172
- * a subset of the `ApplicationRef` interface `ViewRefTracker` here.
12173
- */
12174
- declare interface ViewRefTracker {
12175
- detachView(viewRef: ViewRef): void;
12176
- }
12177
-
12178
12171
  /**
12179
12172
  * A `Signal` with a value that can be mutated via a setter interface.
12180
12173
  */
@@ -12996,6 +12989,8 @@ export declare interface ɵDirectiveType<T> extends Type<T> {
12996
12989
  ɵfac: unknown;
12997
12990
  }
12998
12991
 
12992
+ export declare function ɵdisableProfiling(): void;
12993
+
12999
12994
  /**
13000
12995
  * A scheduler which manages the execution of effects.
13001
12996
  */
@@ -13014,6 +13009,13 @@ export declare abstract class ɵEffectScheduler {
13014
13009
  static ɵprov: unknown;
13015
13010
  }
13016
13011
 
13012
+ /**
13013
+ * This enables an internal performance profiler
13014
+ *
13015
+ * It should not be imported in application code
13016
+ */
13017
+ export declare function ɵenableProfiling(): void;
13018
+
13017
13019
  /**
13018
13020
  * Index of each type of locale data from the extra locale data array
13019
13021
  */
@@ -13624,6 +13626,9 @@ export declare const enum ɵNotificationSource {
13624
13626
  export declare function ɵpatchComponentDefWithScope<C>(componentDef: ɵComponentDef<C>, transitiveScopes: ɵNgModuleTransitiveScopes): void;
13625
13627
 
13626
13628
 
13629
+ export declare const ɵPERFORMANCE_MARK_PREFIX = "\uD83C\uDD70\uFE0F";
13630
+
13631
+
13627
13632
  /**
13628
13633
  * A guarded `performance.mark` for feature marking.
13629
13634
  *
@@ -13757,6 +13762,12 @@ export declare interface ɵProviderRecord {
13757
13762
  importPath?: Type<unknown>[];
13758
13763
  }
13759
13764
 
13765
+ /**
13766
+ * Publishes the given function to `window.ng` from package other than @angular/core
13767
+ * So that it can be used from the browser console when an application is not in production.
13768
+ */
13769
+ export declare function ɵpublishExternalGlobalUtil<K extends ExternalGlobalUtilsFunctions>(name: K, fn: NgGlobalPublishUtils[K]): void;
13770
+
13760
13771
  export declare function ɵreadHydrationInfo(node: RNode): ɵHydrationInfo | null;
13761
13772
 
13762
13773
  export declare class ɵReflectionCapabilities implements PlatformReflectionCapabilities {
@@ -14036,8 +14047,8 @@ export declare const enum ɵRuntimeErrorCode {
14036
14047
  OUTPUT_REF_DESTROYED = 953,
14037
14048
  LOOP_TRACK_DUPLICATE_KEYS = -955,
14038
14049
  LOOP_TRACK_RECREATE = -956,
14039
- RUNTIME_DEPS_INVALID_IMPORTED_TYPE = 1000,
14040
- RUNTIME_DEPS_ORPHAN_COMPONENT = 1001
14050
+ RUNTIME_DEPS_INVALID_IMPORTED_TYPE = 980,
14051
+ RUNTIME_DEPS_ORPHAN_COMPONENT = 981
14041
14052
  }
14042
14053
 
14043
14054
  /**
@@ -14175,6 +14186,18 @@ export { ɵSIGNAL }
14175
14186
  */
14176
14187
  export declare const ɵSSR_CONTENT_INTEGRITY_MARKER = "nghm";
14177
14188
 
14189
+ /**
14190
+ * Function that will start measuring against the performance API
14191
+ * Should be used in pair with stopMeasuring
14192
+ */
14193
+ export declare function ɵstartMeasuring<T>(label: string): void;
14194
+
14195
+ /**
14196
+ * Function that will stop measuring against the performance API
14197
+ * Should be used in pair with stopMeasuring
14198
+ */
14199
+ export declare function ɵstopMeasuring(label: string): void;
14200
+
14178
14201
  /** Store a value in the `data` at a given `index`. */
14179
14202
  export declare function ɵstore<T>(tView: TView, lView: LView, index: number, value: T): void;
14180
14203
 
@@ -14478,7 +14501,7 @@ export declare class ɵViewRef<T> implements EmbeddedViewRef<T>, ChangeDetectorR
14478
14501
  checkNoChanges(): void;
14479
14502
  attachToViewContainerRef(): void;
14480
14503
  detachFromAppRef(): void;
14481
- attachToAppRef(appRef: ViewRefTracker): void;
14504
+ attachToAppRef(appRef: ApplicationRef): void;
14482
14505
  }
14483
14506
 
14484
14507
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "19.0.0-next.8",
3
+ "version": "19.0.0-next.9",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.0.0-next.8
2
+ * @license Angular v19.0.0-next.9
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.0.0-next.8
2
+ * @license Angular v19.0.0-next.9
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -213,6 +213,10 @@ export declare interface ReactiveNode {
213
213
  * Called when a signal is read within this consumer.
214
214
  */
215
215
  consumerOnSignalRead(node: unknown): void;
216
+ /**
217
+ * A debug name for the reactive node. Used in Angular DevTools to identify the node.
218
+ */
219
+ debugName?: string;
216
220
  }
217
221
 
218
222
  export declare function runPostSignalSetFn(): void;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.0.0-next.8
2
+ * @license Angular v19.0.0-next.9
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.0.0-next.8
3
+ * @license Angular v19.0.0-next.9
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -2653,6 +2653,10 @@ class Identifiers {
2653
2653
  name: 'ɵɵInputTransformsFeature',
2654
2654
  moduleName: CORE,
2655
2655
  }; }
2656
+ static { this.ExternalStylesFeature = {
2657
+ name: 'ɵɵExternalStylesFeature',
2658
+ moduleName: CORE,
2659
+ }; }
2656
2660
  static { this.listener = { name: 'ɵɵlistener', moduleName: CORE }; }
2657
2661
  static { this.getInheritedFactory = {
2658
2662
  name: 'ɵɵgetInheritedFactory',
@@ -6712,7 +6716,7 @@ class ShadowCss {
6712
6716
  * captures how many (if any) leading whitespaces are present or a comma
6713
6717
  * - (?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))
6714
6718
  * captures two different possible keyframes, ones which are quoted or ones which are valid css
6715
- * idents (custom properties excluded)
6719
+ * indents (custom properties excluded)
6716
6720
  * - (?=[,\s;]|$)
6717
6721
  * simply matches the end of the possible keyframe, valid endings are: a comma, a space, a
6718
6722
  * semicolon or the end of the string
@@ -6941,7 +6945,7 @@ class ShadowCss {
6941
6945
  */
6942
6946
  _scopeCssText(cssText, scopeSelector, hostSelector) {
6943
6947
  const unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
6944
- // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively
6948
+ // replace :host and :host-context with -shadowcsshost and -shadowcsshostcontext respectively
6945
6949
  cssText = this._insertPolyfillHostInCssText(cssText);
6946
6950
  cssText = this._convertColonHost(cssText);
6947
6951
  cssText = this._convertColonHostContext(cssText);
@@ -7019,7 +7023,7 @@ class ShadowCss {
7019
7023
  * .foo<scopeName> .bar { ... }
7020
7024
  */
7021
7025
  _convertColonHostContext(cssText) {
7022
- return cssText.replace(_cssColonHostContextReGlobal, (selectorText) => {
7026
+ return cssText.replace(_cssColonHostContextReGlobal, (selectorText, pseudoPrefix) => {
7023
7027
  // We have captured a selector that contains a `:host-context` rule.
7024
7028
  // For backward compatibility `:host-context` may contain a comma separated list of selectors.
7025
7029
  // Each context selector group will contain a list of host-context selectors that must match
@@ -7068,10 +7072,10 @@ class ShadowCss {
7068
7072
  selectorText = match[2];
7069
7073
  }
7070
7074
  // The context selectors now must be combined with each other to capture all the possible
7071
- // selectors that `:host-context` can match. See `combineHostContextSelectors()` for more
7075
+ // selectors that `:host-context` can match. See `_combineHostContextSelectors()` for more
7072
7076
  // info about how this is done.
7073
7077
  return contextSelectorGroups
7074
- .map((contextSelectors) => combineHostContextSelectors(contextSelectors, selectorText))
7078
+ .map((contextSelectors) => _combineHostContextSelectors(contextSelectors, selectorText, pseudoPrefix))
7075
7079
  .join(', ');
7076
7080
  });
7077
7081
  }
@@ -7088,7 +7092,12 @@ class ShadowCss {
7088
7092
  let selector = rule.selector;
7089
7093
  let content = rule.content;
7090
7094
  if (rule.selector[0] !== '@') {
7091
- selector = this._scopeSelector(rule.selector, scopeSelector, hostSelector);
7095
+ selector = this._scopeSelector({
7096
+ selector,
7097
+ scopeSelector,
7098
+ hostSelector,
7099
+ isParentSelector: true,
7100
+ });
7092
7101
  }
7093
7102
  else if (scopedAtRuleIdentifiers.some((atRule) => rule.selector.startsWith(atRule))) {
7094
7103
  content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
@@ -7128,15 +7137,29 @@ class ShadowCss {
7128
7137
  return new CssRule(selector, rule.content);
7129
7138
  });
7130
7139
  }
7131
- _scopeSelector(selector, scopeSelector, hostSelector) {
7140
+ // `isParentSelector` is used to distinguish the selectors which are coming from
7141
+ // the initial selector string and any nested selectors, parsed recursively,
7142
+ // for example `selector = 'a:where(.one)'` could be the parent, while recursive call
7143
+ // would have `selector = '.one'`.
7144
+ _scopeSelector({ selector, scopeSelector, hostSelector, isParentSelector = false, }) {
7145
+ // Split the selector into independent parts by `,` (comma) unless
7146
+ // comma is within parenthesis, for example `:is(.one, two)`.
7147
+ // Negative lookup after comma allows not splitting inside nested parenthesis,
7148
+ // up to three levels (((,))).
7149
+ const selectorSplitRe = / ?,(?!(?:[^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\))) ?/;
7132
7150
  return selector
7133
- .split(/ ?, ?/)
7151
+ .split(selectorSplitRe)
7134
7152
  .map((part) => part.split(_shadowDeepSelectors))
7135
7153
  .map((deepParts) => {
7136
7154
  const [shallowPart, ...otherParts] = deepParts;
7137
7155
  const applyScope = (shallowPart) => {
7138
7156
  if (this._selectorNeedsScoping(shallowPart, scopeSelector)) {
7139
- return this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
7157
+ return this._applySelectorScope({
7158
+ selector: shallowPart,
7159
+ scopeSelector,
7160
+ hostSelector,
7161
+ isParentSelector,
7162
+ });
7140
7163
  }
7141
7164
  else {
7142
7165
  return shallowPart;
@@ -7163,8 +7186,8 @@ class ShadowCss {
7163
7186
  if (_polyfillHostRe.test(selector)) {
7164
7187
  const replaceBy = `[${hostSelector}]`;
7165
7188
  return selector
7166
- .replace(_polyfillHostNoCombinatorRe, (hnc, selector) => {
7167
- return selector.replace(/([^:]*)(:*)(.*)/, (_, before, colon, after) => {
7189
+ .replace(_polyfillHostNoCombinatorReGlobal, (_hnc, selector) => {
7190
+ return selector.replace(/([^:\)]*)(:*)(.*)/, (_, before, colon, after) => {
7168
7191
  return before + replaceBy + colon + after;
7169
7192
  });
7170
7193
  })
@@ -7174,7 +7197,7 @@ class ShadowCss {
7174
7197
  }
7175
7198
  // return a selector with [name] suffix on each simple selector
7176
7199
  // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
7177
- _applySelectorScope(selector, scopeSelector, hostSelector) {
7200
+ _applySelectorScope({ selector, scopeSelector, hostSelector, isParentSelector, }) {
7178
7201
  const isRe = /\[is=([^\]]*)\]/g;
7179
7202
  scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
7180
7203
  const attrName = '[' + scopeSelector + ']';
@@ -7185,6 +7208,10 @@ class ShadowCss {
7185
7208
  }
7186
7209
  if (p.includes(_polyfillHostNoCombinator)) {
7187
7210
  scopedP = this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
7211
+ if (_polyfillHostNoCombinatorWithinPseudoFunction.test(p)) {
7212
+ const [_, before, colon, after] = scopedP.match(/([^:]*)(:*)(.*)/);
7213
+ scopedP = before + attrName + colon + after;
7214
+ }
7188
7215
  }
7189
7216
  else {
7190
7217
  // remove :host since it should be unnecessary
@@ -7198,12 +7225,50 @@ class ShadowCss {
7198
7225
  }
7199
7226
  return scopedP;
7200
7227
  };
7201
- const safeContent = new SafeSelector(selector);
7202
- selector = safeContent.content();
7228
+ // Wraps `_scopeSelectorPart()` to not use it directly on selectors with
7229
+ // pseudo selector functions like `:where()`. Selectors within pseudo selector
7230
+ // functions are recursively sent to `_scopeSelector()`.
7231
+ const _pseudoFunctionAwareScopeSelectorPart = (selectorPart) => {
7232
+ let scopedPart = '';
7233
+ const cssPrefixWithPseudoSelectorFunctionMatch = selectorPart.match(_cssPrefixWithPseudoSelectorFunction);
7234
+ if (cssPrefixWithPseudoSelectorFunctionMatch) {
7235
+ const [cssPseudoSelectorFunction] = cssPrefixWithPseudoSelectorFunctionMatch;
7236
+ // Unwrap the pseudo selector to scope its contents.
7237
+ // For example,
7238
+ // - `:where(selectorToScope)` -> `selectorToScope`;
7239
+ // - `:is(.foo, .bar)` -> `.foo, .bar`.
7240
+ const selectorToScope = selectorPart.slice(cssPseudoSelectorFunction.length, -1);
7241
+ if (selectorToScope.includes(_polyfillHostNoCombinator)) {
7242
+ this._shouldScopeIndicator = true;
7243
+ }
7244
+ const scopedInnerPart = this._scopeSelector({
7245
+ selector: selectorToScope,
7246
+ scopeSelector,
7247
+ hostSelector,
7248
+ });
7249
+ // Put the result back into the pseudo selector function.
7250
+ scopedPart = `${cssPseudoSelectorFunction}${scopedInnerPart})`;
7251
+ }
7252
+ else {
7253
+ this._shouldScopeIndicator =
7254
+ this._shouldScopeIndicator || selectorPart.includes(_polyfillHostNoCombinator);
7255
+ scopedPart = this._shouldScopeIndicator ? _scopeSelectorPart(selectorPart) : selectorPart;
7256
+ }
7257
+ return scopedPart;
7258
+ };
7259
+ if (isParentSelector) {
7260
+ this._safeSelector = new SafeSelector(selector);
7261
+ selector = this._safeSelector.content();
7262
+ }
7203
7263
  let scopedSelector = '';
7204
7264
  let startIndex = 0;
7205
7265
  let res;
7206
- const sep = /( |>|\+|~(?!=))\s*/g;
7266
+ // Combinators aren't used as a delimiter if they are within parenthesis,
7267
+ // for example `:where(.one .two)` stays intact.
7268
+ // Similarly to selector separation by comma initially, negative lookahead
7269
+ // is used here to not break selectors within nested parenthesis up to three
7270
+ // nested layers.
7271
+ const sep = /( |>|\+|~(?!=))(?!([^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\)))\s*/g;
7207
7272
  // If a selector appears before :host it should not be shimmed as it
7208
7273
  // matches on ancestor elements and not on elements in the host's shadow
7209
7274
  // `:host-context(div)` is transformed to
@@ -7216,8 +7281,13 @@ class ShadowCss {
7216
7281
  // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
7217
7282
  // `:host-context(tag)`)
7218
7283
  const hasHost = selector.includes(_polyfillHostNoCombinator);
7219
- // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
7220
- let shouldScope = !hasHost;
7284
+ // Only scope parts after or on the same level as the first `-shadowcsshost-no-combinator`
7285
+ // when it is present. The selector has the same level when it is a part of a pseudo
7286
+ // selector, like `:where()`, for example `:where(:host, .foo)` would result in `.foo`
7287
+ // being scoped.
7288
+ if (isParentSelector || this._shouldScopeIndicator) {
7289
+ this._shouldScopeIndicator = !hasHost;
7290
+ }
7221
7291
  while ((res = sep.exec(selector)) !== null) {
7222
7292
  const separator = res[1];
7223
7293
  // Do not trim the selector, as otherwise this will break sourcemaps
@@ -7233,16 +7303,15 @@ class ShadowCss {
7233
7303
  if (part.match(/__esc-ph-(\d+)__/) && selector[res.index + 1]?.match(/[a-fA-F\d]/)) {
7234
7304
  continue;
7235
7305
  }
7236
- shouldScope = shouldScope || part.includes(_polyfillHostNoCombinator);
7237
- const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
7306
+ const scopedPart = _pseudoFunctionAwareScopeSelectorPart(part);
7238
7307
  scopedSelector += `${scopedPart} ${separator} `;
7239
7308
  startIndex = sep.lastIndex;
7240
7309
  }
7241
7310
  const part = selector.substring(startIndex);
7242
- shouldScope = shouldScope || part.includes(_polyfillHostNoCombinator);
7243
- scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
7311
+ scopedSelector += _pseudoFunctionAwareScopeSelectorPart(part);
7244
7312
  // replace the placeholders with their original values
7245
- return safeContent.restore(scopedSelector);
7313
+ // using values stored inside the `safeSelector` instance.
7314
+ return this._safeSelector.restore(scopedSelector);
7246
7315
  }
7247
7316
  _insertPolyfillHostInCssText(selector) {
7248
7317
  return selector
@@ -7297,6 +7366,8 @@ class SafeSelector {
7297
7366
  });
7298
7367
  }
7299
7368
  }
7369
+ const _cssScopedPseudoFunctionPrefix = '(:(where|is)\\()?';
7370
+ const _cssPrefixWithPseudoSelectorFunction = /^:(where|is)\(/i;
7300
7371
  const _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
7301
7372
  const _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
7302
7373
  const _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
@@ -7305,10 +7376,12 @@ const _polyfillHost = '-shadowcsshost';
7305
7376
  const _polyfillHostContext = '-shadowcsscontext';
7306
7377
  const _parenSuffix = '(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
7307
7378
  const _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix, 'gim');
7308
- const _cssColonHostContextReGlobal = new RegExp(_polyfillHostContext + _parenSuffix, 'gim');
7379
+ const _cssColonHostContextReGlobal = new RegExp(_cssScopedPseudoFunctionPrefix + '(' + _polyfillHostContext + _parenSuffix + ')', 'gim');
7309
7380
  const _cssColonHostContextRe = new RegExp(_polyfillHostContext + _parenSuffix, 'im');
7310
7381
  const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
7382
+ const _polyfillHostNoCombinatorWithinPseudoFunction = new RegExp(`:.*\\(.*${_polyfillHostNoCombinator}.*\\)`);
7311
7383
  const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
7384
+ const _polyfillHostNoCombinatorReGlobal = new RegExp(_polyfillHostNoCombinatorRe, 'g');
7312
7385
  const _shadowDOMSelectorsRe = [
7313
7386
  /::shadow/g,
7314
7387
  /::content/g,
@@ -7542,7 +7615,7 @@ function unescapeQuotes(str, isQuoted) {
7542
7615
  * @param contextSelectors an array of context selectors that will be combined.
7543
7616
  * @param otherSelectors the rest of the selectors that are not context selectors.
7544
7617
  */
7545
- function combineHostContextSelectors(contextSelectors, otherSelectors) {
7618
+ function _combineHostContextSelectors(contextSelectors, otherSelectors, pseudoPrefix = '') {
7546
7619
  const hostMarker = _polyfillHostNoCombinator;
7547
7620
  _polyfillHostRe.lastIndex = 0; // reset the regex to ensure we get an accurate test
7548
7621
  const otherSelectorsHasHost = _polyfillHostRe.test(otherSelectors);
@@ -7568,8 +7641,8 @@ function combineHostContextSelectors(contextSelectors, otherSelectors) {
7568
7641
  // (A<hostMarker>) or as an ancestor (A <hostMarker>).
7569
7642
  return combined
7570
7643
  .map((s) => otherSelectorsHasHost
7571
- ? `${s}${otherSelectors}`
7572
- : `${s}${hostMarker}${otherSelectors}, ${s} ${hostMarker}${otherSelectors}`)
7644
+ ? `${pseudoPrefix}${s}${otherSelectors}`
7645
+ : `${pseudoPrefix}${s}${hostMarker}${otherSelectors}, ${pseudoPrefix}${s} ${hostMarker}${otherSelectors}`)
7573
7646
  .join(',');
7574
7647
  }
7575
7648
  /**
@@ -24456,29 +24529,9 @@ function convertAst(ast, job, baseSourceSpan) {
24456
24529
  return convertAst(ast.ast, job, baseSourceSpan);
24457
24530
  }
24458
24531
  else if (ast instanceof PropertyRead) {
24459
- const isThisReceiver = ast.receiver instanceof ThisReceiver;
24460
24532
  // Whether this is an implicit receiver, *excluding* explicit reads of `this`.
24461
24533
  const isImplicitReceiver = ast.receiver instanceof ImplicitReceiver && !(ast.receiver instanceof ThisReceiver);
24462
- // Whether the name of the read is a node that should be never retain its explicit this
24463
- // receiver.
24464
- const isSpecialNode = ast.name === '$any' || ast.name === '$event';
24465
- // TODO: The most sensible condition here would be simply `isImplicitReceiver`, to convert only
24466
- // actual implicit `this` reads, and not explicit ones. However, TemplateDefinitionBuilder (and
24467
- // the Typecheck block!) both have the same bug, in which they also consider explicit `this`
24468
- // reads to be implicit. This causes problems when the explicit `this` read is inside a
24469
- // template with a context that also provides the variable name being read:
24470
- // ```
24471
- // <ng-template let-a>{{this.a}}</ng-template>
24472
- // ```
24473
- // The whole point of the explicit `this` was to access the class property, but TDB and the
24474
- // current TCB treat the read as implicit, and give you the context property instead!
24475
- //
24476
- // For now, we emulate this old behavior by aggressively converting explicit reads to to
24477
- // implicit reads, except for the special cases that TDB and the current TCB protect. However,
24478
- // it would be an improvement to fix this.
24479
- //
24480
- // See also the corresponding comment for the TCB, in `type_check_block.ts`.
24481
- if (isImplicitReceiver || (isThisReceiver && !isSpecialNode)) {
24534
+ if (isImplicitReceiver) {
24482
24535
  return new LexicalReadExpr(ast.name);
24483
24536
  }
24484
24537
  else {
@@ -27327,6 +27380,10 @@ function addFeatures(definitionMap, meta) {
27327
27380
  if (meta.hasOwnProperty('template') && meta.isStandalone) {
27328
27381
  features.push(importExpr(Identifiers.StandaloneFeature));
27329
27382
  }
27383
+ if ('externalStyles' in meta && meta.externalStyles?.length) {
27384
+ const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal$1(externalStyle));
27385
+ features.push(importExpr(Identifiers.ExternalStylesFeature).callFn([literalArr(externalStyleNodes)]));
27386
+ }
27330
27387
  if (features.length) {
27331
27388
  definitionMap.set('features', literalArr(features));
27332
27389
  }
@@ -27402,6 +27459,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
27402
27459
  if (meta.encapsulation === null) {
27403
27460
  meta.encapsulation = exports.ViewEncapsulation.Emulated;
27404
27461
  }
27462
+ let hasStyles = !!meta.externalStyles?.length;
27405
27463
  // e.g. `styles: [str1, str2]`
27406
27464
  if (meta.styles && meta.styles.length) {
27407
27465
  const styleValues = meta.encapsulation == exports.ViewEncapsulation.Emulated
@@ -27414,10 +27472,11 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
27414
27472
  return result;
27415
27473
  }, []);
27416
27474
  if (styleNodes.length > 0) {
27475
+ hasStyles = true;
27417
27476
  definitionMap.set('styles', literalArr(styleNodes));
27418
27477
  }
27419
27478
  }
27420
- else if (meta.encapsulation === exports.ViewEncapsulation.Emulated) {
27479
+ if (!hasStyles && meta.encapsulation === exports.ViewEncapsulation.Emulated) {
27421
27480
  // If there is no style, don't generate css selectors on elements
27422
27481
  meta.encapsulation = exports.ViewEncapsulation.None;
27423
27482
  }
@@ -28378,18 +28437,12 @@ class TemplateBinder extends RecursiveAstVisitor {
28378
28437
  maybeMap(ast, name) {
28379
28438
  // If the receiver of the expression isn't the `ImplicitReceiver`, this isn't the root of an
28380
28439
  // `AST` expression that maps to a `Variable` or `Reference`.
28381
- if (!(ast.receiver instanceof ImplicitReceiver)) {
28440
+ if (!(ast.receiver instanceof ImplicitReceiver) || ast.receiver instanceof ThisReceiver) {
28382
28441
  return;
28383
28442
  }
28384
28443
  // Check whether the name exists in the current scope. If so, map it. Otherwise, the name is
28385
28444
  // probably a property on the top-level component context.
28386
28445
  const target = this.scope.lookup(name);
28387
- // It's not allowed to read template entities via `this`, however it previously worked by
28388
- // accident (see #55115). Since `@let` declarations are new, we can fix it from the beginning,
28389
- // whereas pre-existing template entities will be fixed in #55115.
28390
- if (target instanceof LetDeclaration$1 && ast.receiver instanceof ThisReceiver) {
28391
- return;
28392
- }
28393
28446
  if (target !== null) {
28394
28447
  this.bindings.set(ast, target);
28395
28448
  }
@@ -29246,7 +29299,7 @@ function publishFacade(global) {
29246
29299
  * @description
29247
29300
  * Entry point for all public APIs of the compiler package.
29248
29301
  */
29249
- new Version('19.0.0-next.8');
29302
+ new Version('19.0.0-next.9');
29250
29303
 
29251
29304
  const _I18N_ATTR = 'i18n';
29252
29305
  const _I18N_ATTR_PREFIX = 'i18n-';
@@ -30594,7 +30647,7 @@ class NodeJSPathManipulation {
30594
30647
  // G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
30595
30648
  // CommonJS/ESM interop for determining the current file name and containing dir.
30596
30649
  const isCommonJS = typeof __filename !== 'undefined';
30597
- const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('checker-e68dd7ce.js', document.baseURI).href));
30650
+ const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('checker-3b2ea20f.js', document.baseURI).href));
30598
30651
  const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
30599
30652
  /**
30600
30653
  * A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
@@ -41987,21 +42040,9 @@ class TcbExpressionTranslator {
41987
42040
  * context). This method assists in resolving those.
41988
42041
  */
41989
42042
  resolve(ast) {
41990
- // TODO: this is actually a bug, because `ImplicitReceiver` extends `ThisReceiver`. Consider a
41991
- // case when the explicit `this` read is inside a template with a context that also provides the
41992
- // variable name being read:
41993
- // ```
41994
- // <ng-template let-a>{{this.a}}</ng-template>
41995
- // ```
41996
- // Clearly, `this.a` should refer to the class property `a`. However, because of this code,
41997
- // `this.a` will refer to `let-a` on the template context.
41998
- //
41999
- // Note that the generated code is actually consistent with this bug. To fix it, we have to:
42000
- // - Check `!(ast.receiver instanceof ThisReceiver)` in this condition
42001
- // - Update `ingest.ts` in the Template Pipeline (see the corresponding comment)
42002
- // - Turn off legacy TemplateDefinitionBuilder
42003
- // - Fix g3, and release in a major version
42004
- if (ast instanceof PropertyRead && ast.receiver instanceof ImplicitReceiver) {
42043
+ if (ast instanceof PropertyRead &&
42044
+ ast.receiver instanceof ImplicitReceiver &&
42045
+ !(ast.receiver instanceof ThisReceiver)) {
42005
42046
  // Try to resolve a bound target for this expression. If no such target is available, then
42006
42047
  // the expression is referencing the top-level component context. In that case, `null` is
42007
42048
  // returned here to let it fall through resolution so it will be caught when the
@@ -43652,7 +43693,7 @@ class TemplateTypeCheckerImpl {
43652
43693
  this.elementTagCache = new Map();
43653
43694
  this.isComplete = false;
43654
43695
  }
43655
- getTemplate(component) {
43696
+ getTemplate(component, optimizeFor) {
43656
43697
  const { data } = this.getLatestComponentState(component);
43657
43698
  if (data === null) {
43658
43699
  return null;
@@ -43665,8 +43706,15 @@ class TemplateTypeCheckerImpl {
43665
43706
  getUsedPipes(component) {
43666
43707
  return this.getLatestComponentState(component).data?.boundTarget.getUsedPipes() || null;
43667
43708
  }
43668
- getLatestComponentState(component) {
43669
- this.ensureShimForComponent(component);
43709
+ getLatestComponentState(component, optimizeFor = exports.OptimizeFor.SingleFile) {
43710
+ switch (optimizeFor) {
43711
+ case exports.OptimizeFor.WholeProgram:
43712
+ this.ensureAllShimsForAllFiles();
43713
+ break;
43714
+ case exports.OptimizeFor.SingleFile:
43715
+ this.ensureShimForComponent(component);
43716
+ break;
43717
+ }
43670
43718
  const sf = component.getSourceFile();
43671
43719
  const sfPath = absoluteFromSourceFile(sf);
43672
43720
  const shimPath = TypeCheckShimGenerator.shimFor(sfPath);
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.0.0-next.8
3
+ * @license Angular v19.0.0-next.9
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
9
  var ts = require('typescript');
10
- var checker = require('./checker-e68dd7ce.js');
10
+ var checker = require('./checker-3b2ea20f.js');
11
11
  require('os');
12
12
  var p = require('path');
13
13
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.0.0-next.8
3
+ * @license Angular v19.0.0-next.9
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -10,8 +10,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
10
10
 
11
11
  var schematics = require('@angular-devkit/schematics');
12
12
  var p = require('path');
13
- var compiler_host = require('./compiler_host-9a4d0c2b.js');
14
- var checker = require('./checker-e68dd7ce.js');
13
+ var compiler_host = require('./compiler_host-b4ba5a28.js');
14
+ var checker = require('./checker-3b2ea20f.js');
15
15
  var ts = require('typescript');
16
16
  require('os');
17
17
  require('fs');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.0.0-next.8
3
+ * @license Angular v19.0.0-next.9
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -11,11 +11,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
11
11
  var schematics = require('@angular-devkit/schematics');
12
12
  var p = require('path');
13
13
  var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js');
14
- var compiler_host = require('./compiler_host-9a4d0c2b.js');
14
+ var compiler_host = require('./compiler_host-b4ba5a28.js');
15
15
  var ts = require('typescript');
16
16
  var imports = require('./imports-4ac08251.js');
17
17
  require('@angular-devkit/core');
18
- require('./checker-e68dd7ce.js');
18
+ require('./checker-3b2ea20f.js');
19
19
  require('os');
20
20
  require('fs');
21
21
  require('module');