@angular/core 14.2.0-next.0 → 14.2.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 v14.2.0-next.0
2
+ * @license Angular v14.2.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -834,6 +834,9 @@ function ɵɵdefineInjector(options) {
834
834
  function getInjectableDef(type) {
835
835
  return getOwnDefinition(type, NG_PROV_DEF) || getOwnDefinition(type, NG_INJECTABLE_DEF);
836
836
  }
837
+ function isInjectable(type) {
838
+ return getInjectableDef(type) !== null;
839
+ }
837
840
  /**
838
841
  * Return definition only if it is defined directly on `type` and is not inherited from a base
839
842
  * class of `type`.
@@ -2604,7 +2607,6 @@ function extractDirectiveDef(type) {
2604
2607
  function nonNull(value) {
2605
2608
  return value !== null;
2606
2609
  }
2607
- const autoRegisterModuleById = {};
2608
2610
  /**
2609
2611
  * @codeGenApi
2610
2612
  */
@@ -2620,9 +2622,6 @@ function ɵɵdefineNgModule(def) {
2620
2622
  schemas: def.schemas || null,
2621
2623
  id: def.id || null,
2622
2624
  };
2623
- if (def.id != null) {
2624
- autoRegisterModuleById[def.id] = def.type;
2625
- }
2626
2625
  return res;
2627
2626
  });
2628
2627
  }
@@ -2776,6 +2775,10 @@ function getDirectiveDef(type) {
2776
2775
  function getPipeDef$1(type) {
2777
2776
  return type[NG_PIPE_DEF] || null;
2778
2777
  }
2778
+ function isStandalone(type) {
2779
+ const def = getComponentDef$1(type) || getDirectiveDef(type) || getPipeDef$1(type);
2780
+ return def !== null ? def.standalone : false;
2781
+ }
2779
2782
  function getNgModuleDef(type, throwNotFound) {
2780
2783
  const ngModuleDef = type[NG_MOD_DEF] || null;
2781
2784
  if (!ngModuleDef && throwNotFound === true) {
@@ -5508,11 +5511,6 @@ function setAllowDuplicateNgModuleIdsForTest(allowDuplicates) {
5508
5511
  * Use of this source code is governed by an MIT-style license that can be
5509
5512
  * found in the LICENSE file at https://angular.io/license
5510
5513
  */
5511
- const defaultScheduler = (() => (typeof requestAnimationFrame !== 'undefined' &&
5512
- requestAnimationFrame || // browser only
5513
- setTimeout // everything else
5514
- )
5515
- .bind(_global$1))();
5516
5514
  /**
5517
5515
  *
5518
5516
  * @codeGenApi
@@ -6093,14 +6091,10 @@ function isDOMParserAvailable() {
6093
6091
  *
6094
6092
  * This regular expression was taken from the Closure sanitization library.
6095
6093
  */
6096
- const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;
6097
- /* A pattern that matches safe srcset values */
6098
- const SAFE_SRCSET_PATTERN = /^(?:(?:https?|file):|[^&:/?#]*(?:[/?#]|$))/gi;
6099
- /** A pattern that matches safe data URLs. Only matches image, video and audio types. */
6100
- const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i;
6094
+ const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|data|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;
6101
6095
  function _sanitizeUrl(url) {
6102
6096
  url = String(url);
6103
- if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
6097
+ if (url.match(SAFE_URL_PATTERN))
6104
6098
  return url;
6105
6099
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
6106
6100
  console.warn(`WARNING: sanitizing unsafe URL value ${url} (see https://g.co/ng/security#xss)`);
@@ -7649,7 +7643,7 @@ class Version {
7649
7643
  /**
7650
7644
  * @publicApi
7651
7645
  */
7652
- const VERSION = new Version('14.2.0-next.0');
7646
+ const VERSION = new Version('14.2.0');
7653
7647
 
7654
7648
  /**
7655
7649
  * @license
@@ -12045,11 +12039,6 @@ class LContainerDebug {
12045
12039
  * Use of this source code is governed by an MIT-style license that can be
12046
12040
  * found in the LICENSE file at https://angular.io/license
12047
12041
  */
12048
- /**
12049
- * A permanent marker promise which signifies that the current CD tree is
12050
- * clean.
12051
- */
12052
- const _CLEAN_PROMISE = (() => Promise.resolve(null))();
12053
12042
  /**
12054
12043
  * Invoke `HostBindingsFunction`s for view.
12055
12044
  *
@@ -13430,13 +13419,15 @@ function refreshContainsDirtyView(lView) {
13430
13419
  for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
13431
13420
  for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
13432
13421
  const embeddedLView = lContainer[i];
13433
- if (embeddedLView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
13434
- const embeddedTView = embeddedLView[TVIEW];
13435
- ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
13436
- refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
13437
- }
13438
- else if (embeddedLView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
13439
- refreshContainsDirtyView(embeddedLView);
13422
+ if (viewAttachedToChangeDetector(embeddedLView)) {
13423
+ if (embeddedLView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
13424
+ const embeddedTView = embeddedLView[TVIEW];
13425
+ ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
13426
+ refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
13427
+ }
13428
+ else if (embeddedLView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
13429
+ refreshContainsDirtyView(embeddedLView);
13430
+ }
13440
13431
  }
13441
13432
  }
13442
13433
  }
@@ -13545,42 +13536,6 @@ function markViewDirty(lView) {
13545
13536
  }
13546
13537
  return null;
13547
13538
  }
13548
- /**
13549
- * Used to schedule change detection on the whole application.
13550
- *
13551
- * Unlike `tick`, `scheduleTick` coalesces multiple calls into one change detection run.
13552
- * It is usually called indirectly by calling `markDirty` when the view needs to be
13553
- * re-rendered.
13554
- *
13555
- * Typically `scheduleTick` uses `requestAnimationFrame` to coalesce multiple
13556
- * `scheduleTick` requests. The scheduling function can be overridden in
13557
- * `renderComponent`'s `scheduler` option.
13558
- */
13559
- function scheduleTick(rootContext, flags) {
13560
- const nothingScheduled = rootContext.flags === 0 /* RootContextFlags.Empty */;
13561
- if (nothingScheduled && rootContext.clean == _CLEAN_PROMISE) {
13562
- // https://github.com/angular/angular/issues/39296
13563
- // should only attach the flags when really scheduling a tick
13564
- rootContext.flags |= flags;
13565
- let res;
13566
- rootContext.clean = new Promise((r) => res = r);
13567
- rootContext.scheduler(() => {
13568
- if (rootContext.flags & 1 /* RootContextFlags.DetectChanges */) {
13569
- rootContext.flags &= ~1 /* RootContextFlags.DetectChanges */;
13570
- tickRootContext(rootContext);
13571
- }
13572
- if (rootContext.flags & 2 /* RootContextFlags.FlushPlayers */) {
13573
- rootContext.flags &= ~2 /* RootContextFlags.FlushPlayers */;
13574
- const playerHandler = rootContext.playerHandler;
13575
- if (playerHandler) {
13576
- playerHandler.flushPlayers();
13577
- }
13578
- }
13579
- rootContext.clean = _CLEAN_PROMISE;
13580
- res(null);
13581
- });
13582
- }
13583
- }
13584
13539
  function tickRootContext(rootContext) {
13585
13540
  for (let i = 0; i < rootContext.components.length; i++) {
13586
13541
  const rootComponent = rootContext.components[i];
@@ -13689,7 +13644,6 @@ function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex,
13689
13644
  }
13690
13645
  }
13691
13646
  }
13692
- const CLEAN_PROMISE = _CLEAN_PROMISE;
13693
13647
  function getOrCreateLViewCleanup(view) {
13694
13648
  // top level variables should not be exported for performance reasons (PERF_NOTES.md)
13695
13649
  return view[CLEANUP] || (view[CLEANUP] = ngDevMode ? new LCleanup() : []);
@@ -14448,14 +14402,8 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
14448
14402
  }
14449
14403
  return component;
14450
14404
  }
14451
- function createRootContext(scheduler, playerHandler) {
14452
- return {
14453
- components: [],
14454
- scheduler: scheduler || defaultScheduler,
14455
- clean: CLEAN_PROMISE,
14456
- playerHandler: playerHandler || null,
14457
- flags: 0 /* RootContextFlags.Empty */
14458
- };
14405
+ function createRootContext() {
14406
+ return { components: [] };
14459
14407
  }
14460
14408
  /**
14461
14409
  * Used to enable lifecycle hooks on the root component.
@@ -14475,25 +14423,6 @@ function LifecycleHooksFeature() {
14475
14423
  ngDevMode && assertDefined(tNode, 'TNode is required');
14476
14424
  registerPostOrderHooks(getLView()[TVIEW], tNode);
14477
14425
  }
14478
- /**
14479
- * Wait on component until it is rendered.
14480
- *
14481
- * This function returns a `Promise` which is resolved when the component's
14482
- * change detection is executed. This is determined by finding the scheduler
14483
- * associated with the `component`'s render tree and waiting until the scheduler
14484
- * flushes. If nothing is scheduled, the function returns a resolved promise.
14485
- *
14486
- * Example:
14487
- * ```
14488
- * await whenRendered(myComponent);
14489
- * ```
14490
- *
14491
- * @param component Component to wait upon
14492
- * @returns Promise which resolves when the component is rendered.
14493
- */
14494
- function whenRendered(component) {
14495
- return getRootContext(component).clean;
14496
- }
14497
14426
 
14498
14427
  /**
14499
14428
  * @license
@@ -15478,21 +15407,6 @@ function detectChanges(component) {
15478
15407
  const view = getComponentViewByInstance(component);
15479
15408
  detectChangesInternal(view[TVIEW], view, component);
15480
15409
  }
15481
- /**
15482
- * Marks the component as dirty (needing change detection). Marking a component dirty will
15483
- * schedule a change detection on it at some point in the future.
15484
- *
15485
- * Marking an already dirty component as dirty won't do anything. Only one outstanding change
15486
- * detection can be scheduled per component tree.
15487
- *
15488
- * @param component Component to mark as dirty.
15489
- */
15490
- function markDirty(component) {
15491
- ngDevMode && assertDefined(component, 'component');
15492
- const rootView = markViewDirty(getComponentViewByInstance(component));
15493
- ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
15494
- scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
15495
- }
15496
15410
 
15497
15411
  /**
15498
15412
  * @license
@@ -24654,10 +24568,6 @@ function compileNgModuleDefs(moduleType, ngModule, allowDuplicateDeclarationsInR
24654
24568
  configurable: !!ngDevMode,
24655
24569
  });
24656
24570
  }
24657
- function isStandalone(type) {
24658
- const def = getComponentDef$1(type) || getDirectiveDef(type) || getPipeDef$1(type);
24659
- return def !== null ? def.standalone : false;
24660
- }
24661
24571
  function generateStandaloneInDeclarationsError(type, location) {
24662
24572
  const prefix = `Unexpected "${stringifyForError(type)}" found in the "declarations" array of the`;
24663
24573
  const suffix = `"${stringifyForError(type)}" is marked as standalone and can't be declared ` +