Primeiro commit do projeto Angular
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2026 Google LLC. https://angular.dev/license
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
# Angular
|
||||
|
||||
The sources for this package are in the main [Angular](https://github.com/angular/angular) repo. Please file issues and pull requests against that repo.
|
||||
|
||||
Usage information and reference details can be found in [Angular documentation](https://angular.dev/overview).
|
||||
|
||||
License: MIT
|
||||
+4681
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+1621
File diff suppressed because it is too large
Load Diff
+1
File diff suppressed because one or more lines are too long
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, OutletContext, PRIMARY_OUTLET, ROUTER_CONFIGURATION, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterOutlet, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, destroyDetachedRouteHandle, isActive, ɵEmptyOutletComponent, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren } from './_router-chunk.mjs';
|
||||
export { NoPreloading, PreloadAllModules, PreloadingStrategy, ROUTER_INITIALIZER, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterPreloader, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withExperimentalAutoCleanupInjectors, withExperimentalPlatformNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS } from './_router_module-chunk.mjs';
|
||||
import { inject, Version } from '@angular/core';
|
||||
import '@angular/common';
|
||||
import 'rxjs';
|
||||
import 'rxjs/operators';
|
||||
import '@angular/platform-browser';
|
||||
|
||||
function mapToCanMatch(providers) {
|
||||
return providers.map(provider => (...params) => inject(provider).canMatch(...params));
|
||||
}
|
||||
function mapToCanActivate(providers) {
|
||||
return providers.map(provider => (...params) => inject(provider).canActivate(...params));
|
||||
}
|
||||
function mapToCanActivateChild(providers) {
|
||||
return providers.map(provider => (...params) => inject(provider).canActivateChild(...params));
|
||||
}
|
||||
function mapToCanDeactivate(providers) {
|
||||
return providers.map(provider => (...params) => inject(provider).canDeactivate(...params));
|
||||
}
|
||||
function mapToResolve(provider) {
|
||||
return (...params) => inject(provider).resolve(...params);
|
||||
}
|
||||
|
||||
const VERSION = /* @__PURE__ */new Version('21.2.1');
|
||||
|
||||
export { VERSION, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve };
|
||||
//# sourceMappingURL=router.mjs.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"router.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/router/src/utils/functional_guards.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/router/src/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {inject, Type} from '@angular/core';\n\nimport {\n CanActivate,\n CanActivateChild,\n CanActivateChildFn,\n CanActivateFn,\n CanDeactivate,\n CanDeactivateFn,\n CanMatch,\n CanMatchFn,\n Resolve,\n ResolveFn,\n} from '../models';\n\n/**\n * Maps an array of injectable classes with canMatch functions to an array of equivalent\n * `CanMatchFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanMatch(providers: Array<Type<CanMatch>>): CanMatchFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canMatch(...params),\n );\n}\n\n/**\n * Maps an array of injectable classes with canActivate functions to an array of equivalent\n * `CanActivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanActivate(providers: Array<Type<CanActivate>>): CanActivateFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canActivate(...params),\n );\n}\n/**\n * Maps an array of injectable classes with canActivateChild functions to an array of equivalent\n * `CanActivateChildFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanActivateChild(\n providers: Array<Type<CanActivateChild>>,\n): CanActivateChildFn[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canActivateChild(...params),\n );\n}\n/**\n * Maps an array of injectable classes with canDeactivate functions to an array of equivalent\n * `CanDeactivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToCanDeactivate<T = unknown>(\n providers: Array<Type<CanDeactivate<T>>>,\n): CanDeactivateFn<T>[] {\n return providers.map(\n (provider) =>\n (...params) =>\n inject(provider).canDeactivate(...params),\n );\n}\n/**\n * Maps an injectable class with a resolve function to an equivalent `ResolveFn`\n * for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='Resolve'}\n *\n * @publicApi\n * @see {@link Route}\n */\nexport function mapToResolve<T>(provider: Type<Resolve<T>>): ResolveFn<T> {\n return (...params) => inject(provider).resolve(...params);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router package.\n */\n\nimport {Version} from '@angular/core';\n\n/**\n * @publicApi\n */\nexport const VERSION = /* @__PURE__ */ new Version('21.2.1');\n"],"names":["mapToCanMatch","providers","map","provider","params","inject","canMatch","mapToCanActivate","canActivate","mapToCanActivateChild","canActivateChild","mapToCanDeactivate","canDeactivate","mapToResolve","resolve","VERSION","Version"],"mappings":";;;;;;;;;;;;;;AAgCM,SAAUA,aAAaA,CAACC,SAAgC,EAAA;EAC5D,OAAOA,SAAS,CAACC,GAAG,CACjBC,QAAQ,IACP,CAAC,GAAGC,MAAM,KACRC,MAAM,CAACF,QAAQ,CAAC,CAACG,QAAQ,CAAC,GAAGF,MAAM,CAAC,CACzC;AACH;AAWM,SAAUG,gBAAgBA,CAACN,SAAmC,EAAA;EAClE,OAAOA,SAAS,CAACC,GAAG,CACjBC,QAAQ,IACP,CAAC,GAAGC,MAAM,KACRC,MAAM,CAACF,QAAQ,CAAC,CAACK,WAAW,CAAC,GAAGJ,MAAM,CAAC,CAC5C;AACH;AAUM,SAAUK,qBAAqBA,CACnCR,SAAwC,EAAA;EAExC,OAAOA,SAAS,CAACC,GAAG,CACjBC,QAAQ,IACP,CAAC,GAAGC,MAAM,KACRC,MAAM,CAACF,QAAQ,CAAC,CAACO,gBAAgB,CAAC,GAAGN,MAAM,CAAC,CACjD;AACH;AAUM,SAAUO,kBAAkBA,CAChCV,SAAwC,EAAA;EAExC,OAAOA,SAAS,CAACC,GAAG,CACjBC,QAAQ,IACP,CAAC,GAAGC,MAAM,KACRC,MAAM,CAACF,QAAQ,CAAC,CAACS,aAAa,CAAC,GAAGR,MAAM,CAAC,CAC9C;AACH;AAUM,SAAUS,YAAYA,CAAIV,QAA0B,EAAA;AACxD,EAAA,OAAO,CAAC,GAAGC,MAAM,KAAKC,MAAM,CAACF,QAAQ,CAAC,CAACW,OAAO,CAAC,GAAGV,MAAM,CAAC;AAC3D;;ACpFO,MAAMW,OAAO,kBAAmB,IAAIC,OAAO,CAAC,mBAAmB;;;;"}
|
||||
+235
@@ -0,0 +1,235 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import * as i0 from '@angular/core';
|
||||
import { NgModule, Injectable, signal, Component, ViewChild } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ROUTES, ROUTER_CONFIGURATION, RouterOutlet, Router, afterNextNavigation } from './_router-chunk.mjs';
|
||||
export { ɵEmptyOutletComponent as ɵɵEmptyOutletComponent } from './_router-chunk.mjs';
|
||||
import { RouterModule, ROUTER_PROVIDERS, withPreloading, NoPreloading } from './_router_module-chunk.mjs';
|
||||
export { RouterLink as ɵɵRouterLink, RouterLinkActive as ɵɵRouterLinkActive } from './_router_module-chunk.mjs';
|
||||
import { provideLocationMocks } from '@angular/common/testing';
|
||||
import '@angular/common';
|
||||
import 'rxjs';
|
||||
import 'rxjs/operators';
|
||||
import '@angular/platform-browser';
|
||||
|
||||
class RouterTestingModule {
|
||||
static withRoutes(routes, config) {
|
||||
return {
|
||||
ngModule: RouterTestingModule,
|
||||
providers: [{
|
||||
provide: ROUTES,
|
||||
multi: true,
|
||||
useValue: routes
|
||||
}, {
|
||||
provide: ROUTER_CONFIGURATION,
|
||||
useValue: config ? config : {}
|
||||
}]
|
||||
};
|
||||
}
|
||||
static ɵfac = i0.ɵɵngDeclareFactory({
|
||||
minVersion: "12.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RouterTestingModule,
|
||||
deps: [],
|
||||
target: i0.ɵɵFactoryTarget.NgModule
|
||||
});
|
||||
static ɵmod = i0.ɵɵngDeclareNgModule({
|
||||
minVersion: "14.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RouterTestingModule,
|
||||
exports: [RouterModule]
|
||||
});
|
||||
static ɵinj = i0.ɵɵngDeclareInjector({
|
||||
minVersion: "12.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RouterTestingModule,
|
||||
providers: [ROUTER_PROVIDERS, provideLocationMocks(), withPreloading(NoPreloading).ɵproviders, {
|
||||
provide: ROUTES,
|
||||
multi: true,
|
||||
useValue: []
|
||||
}],
|
||||
imports: [RouterModule]
|
||||
});
|
||||
}
|
||||
i0.ɵɵngDeclareClassMetadata({
|
||||
minVersion: "12.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RouterTestingModule,
|
||||
decorators: [{
|
||||
type: NgModule,
|
||||
args: [{
|
||||
exports: [RouterModule],
|
||||
providers: [ROUTER_PROVIDERS, provideLocationMocks(), withPreloading(NoPreloading).ɵproviders, {
|
||||
provide: ROUTES,
|
||||
multi: true,
|
||||
useValue: []
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
});
|
||||
|
||||
class RootFixtureService {
|
||||
fixture;
|
||||
harness;
|
||||
createHarness() {
|
||||
if (this.harness) {
|
||||
throw new Error('Only one harness should be created per test.');
|
||||
}
|
||||
this.harness = new RouterTestingHarness(this.getRootFixture());
|
||||
return this.harness;
|
||||
}
|
||||
getRootFixture() {
|
||||
if (this.fixture !== undefined) {
|
||||
return this.fixture;
|
||||
}
|
||||
this.fixture = TestBed.createComponent(RootCmp);
|
||||
this.fixture.detectChanges();
|
||||
return this.fixture;
|
||||
}
|
||||
static ɵfac = i0.ɵɵngDeclareFactory({
|
||||
minVersion: "12.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RootFixtureService,
|
||||
deps: [],
|
||||
target: i0.ɵɵFactoryTarget.Injectable
|
||||
});
|
||||
static ɵprov = i0.ɵɵngDeclareInjectable({
|
||||
minVersion: "12.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RootFixtureService,
|
||||
providedIn: 'root'
|
||||
});
|
||||
}
|
||||
i0.ɵɵngDeclareClassMetadata({
|
||||
minVersion: "12.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RootFixtureService,
|
||||
decorators: [{
|
||||
type: Injectable,
|
||||
args: [{
|
||||
providedIn: 'root'
|
||||
}]
|
||||
}]
|
||||
});
|
||||
class RootCmp {
|
||||
outlet;
|
||||
routerOutletData = signal(undefined, ...(ngDevMode ? [{
|
||||
debugName: "routerOutletData"
|
||||
}] : []));
|
||||
static ɵfac = i0.ɵɵngDeclareFactory({
|
||||
minVersion: "12.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RootCmp,
|
||||
deps: [],
|
||||
target: i0.ɵɵFactoryTarget.Component
|
||||
});
|
||||
static ɵcmp = i0.ɵɵngDeclareComponent({
|
||||
minVersion: "14.0.0",
|
||||
version: "21.2.1",
|
||||
type: RootCmp,
|
||||
isStandalone: true,
|
||||
selector: "ng-component",
|
||||
viewQueries: [{
|
||||
propertyName: "outlet",
|
||||
first: true,
|
||||
predicate: RouterOutlet,
|
||||
descendants: true
|
||||
}],
|
||||
ngImport: i0,
|
||||
template: '<router-outlet [routerOutletData]="routerOutletData()"></router-outlet>',
|
||||
isInline: true,
|
||||
dependencies: [{
|
||||
kind: "directive",
|
||||
type: RouterOutlet,
|
||||
selector: "router-outlet",
|
||||
inputs: ["name", "routerOutletData"],
|
||||
outputs: ["activate", "deactivate", "attach", "detach"],
|
||||
exportAs: ["outlet"]
|
||||
}]
|
||||
});
|
||||
}
|
||||
i0.ɵɵngDeclareClassMetadata({
|
||||
minVersion: "12.0.0",
|
||||
version: "21.2.1",
|
||||
ngImport: i0,
|
||||
type: RootCmp,
|
||||
decorators: [{
|
||||
type: Component,
|
||||
args: [{
|
||||
template: '<router-outlet [routerOutletData]="routerOutletData()"></router-outlet>',
|
||||
imports: [RouterOutlet]
|
||||
}]
|
||||
}],
|
||||
propDecorators: {
|
||||
outlet: [{
|
||||
type: ViewChild,
|
||||
args: [RouterOutlet]
|
||||
}]
|
||||
}
|
||||
});
|
||||
class RouterTestingHarness {
|
||||
static async create(initialUrl) {
|
||||
const harness = TestBed.inject(RootFixtureService).createHarness();
|
||||
if (initialUrl !== undefined) {
|
||||
await harness.navigateByUrl(initialUrl);
|
||||
}
|
||||
return harness;
|
||||
}
|
||||
fixture;
|
||||
constructor(fixture) {
|
||||
this.fixture = fixture;
|
||||
}
|
||||
detectChanges() {
|
||||
this.fixture.detectChanges();
|
||||
}
|
||||
get routeDebugElement() {
|
||||
const outlet = this.fixture.componentInstance.outlet;
|
||||
if (!outlet || !outlet.isActivated) {
|
||||
return null;
|
||||
}
|
||||
return this.fixture.debugElement.query(v => v.componentInstance === outlet.component);
|
||||
}
|
||||
get routeNativeElement() {
|
||||
return this.routeDebugElement?.nativeElement ?? null;
|
||||
}
|
||||
async navigateByUrl(url, requiredRoutedComponentType) {
|
||||
const router = TestBed.inject(Router);
|
||||
let resolveFn;
|
||||
const redirectTrackingPromise = new Promise(resolve => {
|
||||
resolveFn = resolve;
|
||||
});
|
||||
afterNextNavigation(TestBed.inject(Router), resolveFn);
|
||||
await router.navigateByUrl(url);
|
||||
await redirectTrackingPromise;
|
||||
this.fixture.detectChanges();
|
||||
const outlet = this.fixture.componentInstance.outlet;
|
||||
if (outlet && outlet.isActivated && outlet.activatedRoute.component) {
|
||||
const activatedComponent = outlet.component;
|
||||
if (requiredRoutedComponentType !== undefined && !(activatedComponent instanceof requiredRoutedComponentType)) {
|
||||
throw new Error(`Unexpected routed component type. Expected ${requiredRoutedComponentType.name} but got ${activatedComponent.constructor.name}`);
|
||||
}
|
||||
return activatedComponent;
|
||||
} else {
|
||||
if (requiredRoutedComponentType !== undefined) {
|
||||
throw new Error(`Unexpected routed component type. Expected ${requiredRoutedComponentType.name} but the navigation did not activate any component.`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { RouterTestingHarness, RouterTestingModule, RouterOutlet as ɵɵRouterOutlet };
|
||||
//# sourceMappingURL=testing.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+67
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import { Location } from '@angular/common';
|
||||
import { APP_BOOTSTRAP_LISTENER, inject } from '@angular/core';
|
||||
import { UpgradeModule } from '@angular/upgrade/static';
|
||||
import { Router } from './_router-chunk.mjs';
|
||||
import 'rxjs';
|
||||
import 'rxjs/operators';
|
||||
import '@angular/platform-browser';
|
||||
|
||||
const RouterUpgradeInitializer = {
|
||||
provide: APP_BOOTSTRAP_LISTENER,
|
||||
multi: true,
|
||||
useFactory: locationSyncBootstrapListener
|
||||
};
|
||||
function locationSyncBootstrapListener() {
|
||||
const ngUpgrade = inject(UpgradeModule);
|
||||
return () => {
|
||||
setUpLocationSync(ngUpgrade);
|
||||
};
|
||||
}
|
||||
function setUpLocationSync(ngUpgrade, urlType = 'path') {
|
||||
if (!ngUpgrade.$injector) {
|
||||
throw new Error(`
|
||||
RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.
|
||||
Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.
|
||||
`);
|
||||
}
|
||||
const router = ngUpgrade.injector.get(Router);
|
||||
const location = ngUpgrade.injector.get(Location);
|
||||
ngUpgrade.$injector.get('$rootScope').$on('$locationChangeStart', (event, newUrl, oldUrl, newState, oldState) => {
|
||||
const currentNavigationId = router.getCurrentNavigation()?.id;
|
||||
const newStateNavigationId = newState?.navigationId;
|
||||
if (newStateNavigationId !== undefined && newStateNavigationId === currentNavigationId) {
|
||||
return;
|
||||
}
|
||||
let url;
|
||||
if (urlType === 'path') {
|
||||
url = resolveUrl(newUrl);
|
||||
} else if (urlType === 'hash') {
|
||||
const hashIdx = newUrl.indexOf('#');
|
||||
url = resolveUrl(newUrl.substring(0, hashIdx) + newUrl.substring(hashIdx + 1));
|
||||
} else {
|
||||
throw 'Invalid URLType passed to setUpLocationSync: ' + urlType;
|
||||
}
|
||||
const path = location.normalize(url.pathname);
|
||||
router.navigateByUrl(path + url.search + url.hash);
|
||||
});
|
||||
}
|
||||
let anchor;
|
||||
function resolveUrl(url) {
|
||||
anchor ??= document.createElement('a');
|
||||
anchor.setAttribute('href', url);
|
||||
anchor.setAttribute('href', anchor.href);
|
||||
return {
|
||||
pathname: `/${anchor.pathname.replace(/^\//, '')}`,
|
||||
search: anchor.search,
|
||||
hash: anchor.hash
|
||||
};
|
||||
}
|
||||
|
||||
export { RouterUpgradeInitializer, locationSyncBootstrapListener, setUpLocationSync };
|
||||
//# sourceMappingURL=upgrade.mjs.map
|
||||
+1
File diff suppressed because one or more lines are too long
+76
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"name": "@angular/router",
|
||||
"version": "21.2.1",
|
||||
"description": "Angular - the routing library",
|
||||
"keywords": [
|
||||
"angular",
|
||||
"router"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angular/angular.git",
|
||||
"directory": "packages/router"
|
||||
},
|
||||
"author": "angular",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.12.0 || >=24.0.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular/issues"
|
||||
},
|
||||
"homepage": "https://github.com/angular/angular/tree/main/packages/router",
|
||||
"dependencies": {
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/dom-navigation": "^1.0.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/core": "21.2.1",
|
||||
"@angular/common": "21.2.1",
|
||||
"@angular/platform-browser": "21.2.1",
|
||||
"rxjs": "^6.5.3 || ^7.4.0"
|
||||
},
|
||||
"ng-update": {
|
||||
"packageGroup": [
|
||||
"@angular/core",
|
||||
"@angular/bazel",
|
||||
"@angular/common",
|
||||
"@angular/compiler",
|
||||
"@angular/compiler-cli",
|
||||
"@angular/animations",
|
||||
"@angular/elements",
|
||||
"@angular/platform-browser",
|
||||
"@angular/platform-browser-dynamic",
|
||||
"@angular/forms",
|
||||
"@angular/platform-server",
|
||||
"@angular/upgrade",
|
||||
"@angular/router",
|
||||
"@angular/language-service",
|
||||
"@angular/localize",
|
||||
"@angular/service-worker"
|
||||
]
|
||||
},
|
||||
"sideEffects": false,
|
||||
"module": "./fesm2022/router.mjs",
|
||||
"typings": "./types/router.d.ts",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"./package.json": {
|
||||
"default": "./package.json"
|
||||
},
|
||||
".": {
|
||||
"types": "./types/router.d.ts",
|
||||
"default": "./fesm2022/router.mjs"
|
||||
},
|
||||
"./testing": {
|
||||
"types": "./types/testing.d.ts",
|
||||
"default": "./fesm2022/testing.mjs"
|
||||
},
|
||||
"./upgrade": {
|
||||
"types": "./types/upgrade.d.ts",
|
||||
"default": "./fesm2022/upgrade.mjs"
|
||||
}
|
||||
}
|
||||
}
|
||||
+4131
File diff suppressed because it is too large
Load Diff
+1004
File diff suppressed because it is too large
Load Diff
+123
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import * as i0 from '@angular/core';
|
||||
import { ModuleWithProviders, WritableSignal, DebugElement, Type } from '@angular/core';
|
||||
import { Routes, ExtraOptions, RouterModule } from './_router_module-chunk.js';
|
||||
export { ɵEmptyOutletComponent as ɵɵEmptyOutletComponent, RouterLink as ɵɵRouterLink, RouterLinkActive as ɵɵRouterLinkActive, RouterOutlet as ɵɵRouterOutlet } from './_router_module-chunk.js';
|
||||
import { ComponentFixture } from '@angular/core/testing';
|
||||
import 'rxjs';
|
||||
import '@angular/common';
|
||||
|
||||
/**
|
||||
* @description
|
||||
*
|
||||
* Sets up the router to be used for testing.
|
||||
*
|
||||
* The modules sets up the router to be used for testing.
|
||||
* It provides spy implementations of `Location` and `LocationStrategy`.
|
||||
*
|
||||
* @usageNotes
|
||||
* ### Example
|
||||
*
|
||||
* ```ts
|
||||
* beforeEach(() => {
|
||||
* TestBed.configureTestingModule({
|
||||
* imports: [
|
||||
* RouterModule.forRoot(
|
||||
* [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]
|
||||
* )
|
||||
* ]
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
* @deprecated Use `provideRouter` or `RouterModule`/`RouterModule.forRoot` instead.
|
||||
* This module was previously used to provide a helpful collection of test fakes,
|
||||
* most notably those for `Location` and `LocationStrategy`. These are generally not
|
||||
* required anymore, as `MockPlatformLocation` is provided in `TestBed` by default.
|
||||
* However, you can use them directly with `provideLocationMocks`.
|
||||
*/
|
||||
declare class RouterTestingModule {
|
||||
static withRoutes(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterTestingModule>;
|
||||
static ɵfac: i0.ɵɵFactoryDeclaration<RouterTestingModule, never>;
|
||||
static ɵmod: i0.ɵɵNgModuleDeclaration<RouterTestingModule, never, never, [typeof RouterModule]>;
|
||||
static ɵinj: i0.ɵɵInjectorDeclaration<RouterTestingModule>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A testing harness for the `Router` to reduce the boilerplate needed to test routes and routed
|
||||
* components.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
declare class RouterTestingHarness {
|
||||
/**
|
||||
* Creates a `RouterTestingHarness` instance.
|
||||
*
|
||||
* The `RouterTestingHarness` also creates its own root component with a `RouterOutlet` for the
|
||||
* purposes of rendering route components.
|
||||
*
|
||||
* Throws an error if an instance has already been created.
|
||||
* Use of this harness also requires `destroyAfterEach: true` in the `ModuleTeardownOptions`
|
||||
*
|
||||
* @param initialUrl The target of navigation to trigger before returning the harness.
|
||||
*/
|
||||
static create(initialUrl?: string): Promise<RouterTestingHarness>;
|
||||
/**
|
||||
* Fixture of the root component of the RouterTestingHarness
|
||||
*/
|
||||
readonly fixture: ComponentFixture<{
|
||||
routerOutletData: WritableSignal<unknown>;
|
||||
}>;
|
||||
/** Instructs the root fixture to run change detection. */
|
||||
detectChanges(): void;
|
||||
/** The `DebugElement` of the `RouterOutlet` component. `null` if the outlet is not activated. */
|
||||
get routeDebugElement(): DebugElement | null;
|
||||
/** The native element of the `RouterOutlet` component. `null` if the outlet is not activated. */
|
||||
get routeNativeElement(): HTMLElement | null;
|
||||
/**
|
||||
* Triggers a `Router` navigation and waits for it to complete.
|
||||
*
|
||||
* The root component with a `RouterOutlet` created for the harness is used to render `Route`
|
||||
* components. The root component is reused within the same test in subsequent calls to
|
||||
* `navigateForTest`.
|
||||
*
|
||||
* When testing `Routes` with a guards that reject the navigation, the `RouterOutlet` might not be
|
||||
* activated and the `activatedComponent` may be `null`.
|
||||
*
|
||||
* {@example router/testing/test/router_testing_harness_examples.spec.ts region='Guard'}
|
||||
*
|
||||
* @param url The target of the navigation. Passed to `Router.navigateByUrl`.
|
||||
* @returns The activated component instance of the `RouterOutlet` after navigation completes
|
||||
* (`null` if the outlet does not get activated).
|
||||
*/
|
||||
navigateByUrl(url: string): Promise<null | {}>;
|
||||
/**
|
||||
* Triggers a router navigation and waits for it to complete.
|
||||
*
|
||||
* The root component with a `RouterOutlet` created for the harness is used to render `Route`
|
||||
* components.
|
||||
*
|
||||
* {@example router/testing/test/router_testing_harness_examples.spec.ts region='RoutedComponent'}
|
||||
*
|
||||
* The root component is reused within the same test in subsequent calls to `navigateByUrl`.
|
||||
*
|
||||
* This function also makes it easier to test components that depend on `ActivatedRoute` data.
|
||||
*
|
||||
* {@example router/testing/test/router_testing_harness_examples.spec.ts region='ActivatedRoute'}
|
||||
*
|
||||
* @param url The target of the navigation. Passed to `Router.navigateByUrl`.
|
||||
* @param requiredRoutedComponentType After navigation completes, the required type for the
|
||||
* activated component of the `RouterOutlet`. If the outlet is not activated or a different
|
||||
* component is activated, this function will throw an error.
|
||||
* @returns The activated component instance of the `RouterOutlet` after navigation completes.
|
||||
*/
|
||||
navigateByUrl<T>(url: string, requiredRoutedComponentType: Type<T>): Promise<T>;
|
||||
}
|
||||
|
||||
export { RouterTestingHarness, RouterTestingModule };
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @license Angular v21.2.1
|
||||
* (c) 2010-2026 Google LLC. https://angular.dev/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
import * as i0 from '@angular/core';
|
||||
import { ComponentRef } from '@angular/core';
|
||||
import { UpgradeModule } from '@angular/upgrade/static';
|
||||
|
||||
/**
|
||||
* Creates an initializer that sets up `ngRoute` integration
|
||||
* along with setting up the Angular router.
|
||||
*
|
||||
* @usageNotes
|
||||
*
|
||||
* For standalone applications:
|
||||
* ```ts
|
||||
* export const appConfig: ApplicationConfig = {
|
||||
* providers: [RouterUpgradeInitializer],
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* For NgModule based applications:
|
||||
* ```ts
|
||||
* @NgModule({
|
||||
* imports: [
|
||||
* RouterModule.forRoot(SOME_ROUTES),
|
||||
* UpgradeModule
|
||||
* ],
|
||||
* providers: [
|
||||
* RouterUpgradeInitializer
|
||||
* ]
|
||||
* })
|
||||
* export class AppModule {
|
||||
* ngDoBootstrap() {}
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
declare const RouterUpgradeInitializer: {
|
||||
provide: i0.InjectionToken<readonly ((compRef: ComponentRef<any>) => void)[]>;
|
||||
multi: boolean;
|
||||
useFactory: () => () => void;
|
||||
};
|
||||
/**
|
||||
* Sets up a location change listener to trigger `history.pushState`.
|
||||
* Works around the problem that `onPopState` does not trigger `history.pushState`.
|
||||
* Must be called *after* calling `UpgradeModule.bootstrap`.
|
||||
*
|
||||
* @param ngUpgrade The upgrade NgModule.
|
||||
* @param urlType The location strategy.
|
||||
* @see {@link /api/common/HashLocationStrategy HashLocationStrategy}
|
||||
* @see {@link /api/common/PathLocationStrategy PathLocationStrategy}
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
declare function setUpLocationSync(ngUpgrade: UpgradeModule, urlType?: 'path' | 'hash'): void;
|
||||
|
||||
export { RouterUpgradeInitializer, setUpLocationSync };
|
||||
Reference in New Issue
Block a user