@angular/core 19.2.0-rc.0 → 19.2.1
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.
- package/fesm2022/core.mjs +510 -335
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +45 -0
- package/fesm2022/primitives/di.mjs.map +1 -0
- package/fesm2022/primitives/event-dispatch.mjs +2 -2
- package/fesm2022/primitives/signals.mjs +2 -2
- package/fesm2022/rxjs-interop.mjs +2 -2
- package/fesm2022/testing.mjs +858 -6
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +221 -48
- package/package.json +5 -1
- package/primitives/di/index.d.ts +99 -0
- package/primitives/event-dispatch/index.d.ts +2 -2
- package/primitives/signals/index.d.ts +2 -2
- package/rxjs-interop/index.d.ts +2 -2
- package/schematics/bundles/{apply_import_manager-a930fcf1.js → apply_import_manager-b8d6885d.js} +4 -4
- package/schematics/bundles/{checker-2eecc677.js → checker-89987c98.js} +11 -15
- package/schematics/bundles/cleanup-unused-imports.js +8 -8
- package/schematics/bundles/{compiler_host-c280a924.js → compiler_host-2398e4ca.js} +3 -3
- package/schematics/bundles/control-flow-migration.js +4 -4
- package/schematics/bundles/explicit-standalone-flag.js +6 -6
- package/schematics/bundles/{imports-abe29092.js → imports-047fbbc8.js} +2 -2
- package/schematics/bundles/{index-3891dd55.js → index-10911843.js} +5 -5
- package/schematics/bundles/{index-24a2ad1e.js → index-e0b2e4a7.js} +5 -5
- package/schematics/bundles/inject-migration.js +8 -8
- package/schematics/bundles/{leading_space-d190b83b.js → leading_space-f8944434.js} +2 -2
- package/schematics/bundles/{migrate_ts_type_references-71b3a951.js → migrate_ts_type_references-52508cd4.js} +7 -7
- package/schematics/bundles/{ng_decorators-e699c081.js → ng_decorators-b0d8b324.js} +3 -3
- package/schematics/bundles/{nodes-a535b2be.js → nodes-7758dbf6.js} +2 -2
- package/schematics/bundles/output-migration.js +8 -8
- package/schematics/bundles/pending-tasks.js +6 -6
- package/schematics/bundles/{program-24da9092.js → program-0e1d4f10.js} +13 -13
- package/schematics/bundles/{project_paths-b073c4d6.js → project_paths-c48796dd.js} +4 -4
- package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-b558633b.js} +2 -2
- package/schematics/bundles/{property_name-7c8433f5.js → property_name-ac18447e.js} +2 -2
- package/schematics/bundles/provide-initializer.js +6 -6
- package/schematics/bundles/route-lazy-loading.js +6 -6
- package/schematics/bundles/self-closing-tags-migration.js +44 -28
- package/schematics/bundles/signal-input-migration.js +10 -10
- package/schematics/bundles/signal-queries-migration.js +10 -10
- package/schematics/bundles/signals.js +10 -10
- package/schematics/bundles/standalone-migration.js +10 -10
- package/testing/index.d.ts +309 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
4
|
-
* (c) 2010-
|
|
3
|
+
* @license Angular v19.2.1
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
@@ -9,21 +9,21 @@
|
|
|
9
9
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
13
|
-
var project_paths = require('./project_paths-
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-b558633b.js');
|
|
13
|
+
var project_paths = require('./project_paths-c48796dd.js');
|
|
14
14
|
require('os');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var checker = require('./checker-
|
|
17
|
-
require('./program-
|
|
16
|
+
var checker = require('./checker-89987c98.js');
|
|
17
|
+
require('./program-0e1d4f10.js');
|
|
18
18
|
require('path');
|
|
19
|
-
var ng_decorators = require('./ng_decorators-
|
|
20
|
-
var property_name = require('./property_name-
|
|
19
|
+
var ng_decorators = require('./ng_decorators-b0d8b324.js');
|
|
20
|
+
var property_name = require('./property_name-ac18447e.js');
|
|
21
21
|
require('@angular-devkit/core');
|
|
22
22
|
require('node:path/posix');
|
|
23
23
|
require('fs');
|
|
24
24
|
require('module');
|
|
25
25
|
require('url');
|
|
26
|
-
require('./imports-
|
|
26
|
+
require('./imports-047fbbc8.js');
|
|
27
27
|
|
|
28
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
29
29
|
|
|
@@ -315,6 +315,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
315
315
|
const tagReplacements = [];
|
|
316
316
|
for (const sf of sourceFiles) {
|
|
317
317
|
ts__default["default"].forEachChild(sf, (node) => {
|
|
318
|
+
// Skipping any non component declarations
|
|
318
319
|
if (!ts__default["default"].isClassDeclaration(node)) {
|
|
319
320
|
return;
|
|
320
321
|
}
|
|
@@ -326,22 +327,23 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
326
327
|
templateVisitor.visitNode(node);
|
|
327
328
|
templateVisitor.resolvedTemplates.forEach((template) => {
|
|
328
329
|
const { migrated, changed, replacementCount } = migrateTemplateToSelfClosingTags(template.content);
|
|
329
|
-
if (changed) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
330
|
+
if (!changed) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const fileToMigrate = template.inline
|
|
334
|
+
? file
|
|
335
|
+
: project_paths.projectFile(template.filePath, info);
|
|
336
|
+
const end = template.start + template.content.length;
|
|
337
|
+
const replacements = [
|
|
338
|
+
prepareTextReplacement(fileToMigrate, migrated, template.start, end),
|
|
339
|
+
];
|
|
340
|
+
const fileReplacements = tagReplacements.find((tagReplacement) => tagReplacement.file === file);
|
|
341
|
+
if (fileReplacements) {
|
|
342
|
+
fileReplacements.replacements.push(...replacements);
|
|
343
|
+
fileReplacements.replacementCount += replacementCount;
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
tagReplacements.push({ file, replacements, replacementCount });
|
|
345
347
|
}
|
|
346
348
|
});
|
|
347
349
|
});
|
|
@@ -349,9 +351,11 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
349
351
|
return project_paths.confirmAsSerializable({ tagReplacements });
|
|
350
352
|
}
|
|
351
353
|
async combine(unitA, unitB) {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
354
|
+
const uniqueReplacements = removeDuplicateReplacements([
|
|
355
|
+
...unitA.tagReplacements,
|
|
356
|
+
...unitB.tagReplacements,
|
|
357
|
+
]);
|
|
358
|
+
return project_paths.confirmAsSerializable({ tagReplacements: uniqueReplacements });
|
|
355
359
|
}
|
|
356
360
|
async globalMeta(combinedData) {
|
|
357
361
|
const globalMeta = {
|
|
@@ -380,6 +384,18 @@ function prepareTextReplacement(file, replacement, start, end) {
|
|
|
380
384
|
toInsert: replacement,
|
|
381
385
|
}));
|
|
382
386
|
}
|
|
387
|
+
function removeDuplicateReplacements(replacements) {
|
|
388
|
+
const uniqueFiles = new Set();
|
|
389
|
+
const result = [];
|
|
390
|
+
for (const replacement of replacements) {
|
|
391
|
+
const fileId = replacement.file.id;
|
|
392
|
+
if (!uniqueFiles.has(fileId)) {
|
|
393
|
+
uniqueFiles.add(fileId);
|
|
394
|
+
result.push(replacement);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return result;
|
|
398
|
+
}
|
|
383
399
|
|
|
384
400
|
function migrate(options) {
|
|
385
401
|
return async (tree, context) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
4
|
-
* (c) 2010-
|
|
3
|
+
* @license Angular v19.2.1
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
|
-
var migrate_ts_type_references = require('./migrate_ts_type_references-
|
|
12
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-52508cd4.js');
|
|
13
13
|
var ts = require('typescript');
|
|
14
14
|
require('os');
|
|
15
|
-
var checker = require('./checker-
|
|
16
|
-
var program = require('./program-
|
|
15
|
+
var checker = require('./checker-89987c98.js');
|
|
16
|
+
var program = require('./program-0e1d4f10.js');
|
|
17
17
|
require('path');
|
|
18
|
-
var project_paths = require('./project_paths-
|
|
19
|
-
var index = require('./index-
|
|
18
|
+
var project_paths = require('./project_paths-c48796dd.js');
|
|
19
|
+
var index = require('./index-e0b2e4a7.js');
|
|
20
20
|
var assert = require('assert');
|
|
21
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
22
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
23
|
-
require('./leading_space-
|
|
21
|
+
var apply_import_manager = require('./apply_import_manager-b8d6885d.js');
|
|
22
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-b558633b.js');
|
|
23
|
+
require('./leading_space-f8944434.js');
|
|
24
24
|
require('fs');
|
|
25
25
|
require('module');
|
|
26
26
|
require('url');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
4
|
-
* (c) 2010-
|
|
3
|
+
* @license Angular v19.2.1
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
@@ -9,23 +9,23 @@
|
|
|
9
9
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
13
|
-
var project_paths = require('./project_paths-
|
|
12
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-b558633b.js');
|
|
13
|
+
var project_paths = require('./project_paths-c48796dd.js');
|
|
14
14
|
require('os');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var checker = require('./checker-
|
|
17
|
-
var program = require('./program-
|
|
16
|
+
var checker = require('./checker-89987c98.js');
|
|
17
|
+
var program = require('./program-0e1d4f10.js');
|
|
18
18
|
require('path');
|
|
19
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
20
|
-
var migrate_ts_type_references = require('./migrate_ts_type_references-
|
|
19
|
+
var apply_import_manager = require('./apply_import_manager-b8d6885d.js');
|
|
20
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-52508cd4.js');
|
|
21
21
|
var assert = require('assert');
|
|
22
|
-
var index = require('./index-
|
|
22
|
+
var index = require('./index-e0b2e4a7.js');
|
|
23
23
|
require('@angular-devkit/core');
|
|
24
24
|
require('node:path/posix');
|
|
25
25
|
require('fs');
|
|
26
26
|
require('module');
|
|
27
27
|
require('url');
|
|
28
|
-
require('./leading_space-
|
|
28
|
+
require('./leading_space-f8944434.js');
|
|
29
29
|
|
|
30
30
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
31
31
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
4
|
-
* (c) 2010-
|
|
3
|
+
* @license Angular v19.2.1
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
@@ -12,23 +12,23 @@ var schematics = require('@angular-devkit/schematics');
|
|
|
12
12
|
var signalQueriesMigration = require('./signal-queries-migration.js');
|
|
13
13
|
var signalInputMigration = require('./signal-input-migration.js');
|
|
14
14
|
var outputMigration = require('./output-migration.js');
|
|
15
|
-
require('./project_tsconfig_paths-
|
|
15
|
+
require('./project_tsconfig_paths-b558633b.js');
|
|
16
16
|
require('@angular-devkit/core');
|
|
17
|
-
require('./project_paths-
|
|
17
|
+
require('./project_paths-c48796dd.js');
|
|
18
18
|
require('node:path/posix');
|
|
19
19
|
require('os');
|
|
20
20
|
require('typescript');
|
|
21
|
-
require('./checker-
|
|
21
|
+
require('./checker-89987c98.js');
|
|
22
22
|
require('fs');
|
|
23
23
|
require('module');
|
|
24
24
|
require('path');
|
|
25
25
|
require('url');
|
|
26
|
-
require('./program-
|
|
27
|
-
require('./apply_import_manager-
|
|
28
|
-
require('./migrate_ts_type_references-
|
|
26
|
+
require('./program-0e1d4f10.js');
|
|
27
|
+
require('./apply_import_manager-b8d6885d.js');
|
|
28
|
+
require('./migrate_ts_type_references-52508cd4.js');
|
|
29
29
|
require('assert');
|
|
30
|
-
require('./index-
|
|
31
|
-
require('./leading_space-
|
|
30
|
+
require('./index-e0b2e4a7.js');
|
|
31
|
+
require('./leading_space-f8944434.js');
|
|
32
32
|
|
|
33
33
|
function migrate(options) {
|
|
34
34
|
// The migrations are independent so we can run them in any order, but we sort them here
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v19.2.
|
|
4
|
-
* (c) 2010-
|
|
3
|
+
* @license Angular v19.2.1
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
10
|
|
|
11
11
|
var schematics = require('@angular-devkit/schematics');
|
|
12
|
-
require('./index-
|
|
12
|
+
require('./index-10911843.js');
|
|
13
13
|
var fs = require('fs');
|
|
14
14
|
var p = require('path');
|
|
15
15
|
var ts = require('typescript');
|
|
16
|
-
var compiler_host = require('./compiler_host-
|
|
17
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
18
|
-
var ng_decorators = require('./ng_decorators-
|
|
19
|
-
var nodes = require('./nodes-
|
|
20
|
-
var imports = require('./imports-
|
|
21
|
-
var checker = require('./checker-
|
|
16
|
+
var compiler_host = require('./compiler_host-2398e4ca.js');
|
|
17
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-b558633b.js');
|
|
18
|
+
var ng_decorators = require('./ng_decorators-b0d8b324.js');
|
|
19
|
+
var nodes = require('./nodes-7758dbf6.js');
|
|
20
|
+
var imports = require('./imports-047fbbc8.js');
|
|
21
|
+
var checker = require('./checker-89987c98.js');
|
|
22
22
|
require('os');
|
|
23
|
-
var program = require('./program-
|
|
23
|
+
var program = require('./program-0e1d4f10.js');
|
|
24
24
|
require('@angular-devkit/core');
|
|
25
25
|
require('module');
|
|
26
26
|
require('url');
|
package/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.2.
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v19.2.1
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -191,6 +191,45 @@ export declare function fakeAsync(fn: Function, options?: {
|
|
|
191
191
|
flush?: boolean;
|
|
192
192
|
}): (...args: any[]) => any;
|
|
193
193
|
|
|
194
|
+
/**
|
|
195
|
+
* Fake equivalent of `NavigationHistoryEntry`.
|
|
196
|
+
*/
|
|
197
|
+
declare class FakeNavigationHistoryEntry implements NavigationHistoryEntry {
|
|
198
|
+
private eventTarget;
|
|
199
|
+
readonly url: string | null;
|
|
200
|
+
readonly sameDocument: boolean;
|
|
201
|
+
readonly id: string;
|
|
202
|
+
readonly key: string;
|
|
203
|
+
readonly index: number;
|
|
204
|
+
private readonly state;
|
|
205
|
+
private readonly historyState;
|
|
206
|
+
ondispose: ((this: NavigationHistoryEntry, ev: Event) => any) | null;
|
|
207
|
+
constructor(eventTarget: EventTarget, url: string | null, { id, key, index, sameDocument, state, historyState, }: {
|
|
208
|
+
id: string;
|
|
209
|
+
key: string;
|
|
210
|
+
index: number;
|
|
211
|
+
sameDocument: boolean;
|
|
212
|
+
historyState: unknown;
|
|
213
|
+
state?: unknown;
|
|
214
|
+
});
|
|
215
|
+
getState(): unknown;
|
|
216
|
+
getHistoryState(): unknown;
|
|
217
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
|
|
218
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: EventListenerOptions | boolean): void;
|
|
219
|
+
dispatchEvent(event: Event): boolean;
|
|
220
|
+
/** internal */
|
|
221
|
+
dispose(): void;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Fake equivalent of the `NavigationResult` interface with
|
|
226
|
+
* `FakeNavigationHistoryEntry`.
|
|
227
|
+
*/
|
|
228
|
+
declare interface FakeNavigationResult extends NavigationResult {
|
|
229
|
+
readonly committed: Promise<FakeNavigationHistoryEntry>;
|
|
230
|
+
readonly finished: Promise<FakeNavigationHistoryEntry>;
|
|
231
|
+
}
|
|
232
|
+
|
|
194
233
|
/**
|
|
195
234
|
* Flushes any pending microtasks and simulates the asynchronous passage of time for the timers in
|
|
196
235
|
* the `fakeAsync` zone by
|
|
@@ -275,6 +314,137 @@ export declare interface ModuleTeardownOptions {
|
|
|
275
314
|
rethrowErrors?: boolean;
|
|
276
315
|
}
|
|
277
316
|
|
|
317
|
+
declare class NavigateEvent extends Event {
|
|
318
|
+
constructor(type: string, eventInit?: NavigateEventInit);
|
|
319
|
+
readonly navigationType: NavigationTypeString;
|
|
320
|
+
readonly canIntercept: boolean;
|
|
321
|
+
readonly userInitiated: boolean;
|
|
322
|
+
readonly hashChange: boolean;
|
|
323
|
+
readonly destination: NavigationDestination;
|
|
324
|
+
readonly signal: AbortSignal;
|
|
325
|
+
readonly formData: FormData | null;
|
|
326
|
+
readonly downloadRequest: string | null;
|
|
327
|
+
readonly info?: unknown;
|
|
328
|
+
intercept(options?: NavigationInterceptOptions): void;
|
|
329
|
+
scroll(): void;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
declare interface NavigateEventInit extends EventInit {
|
|
333
|
+
navigationType?: NavigationTypeString;
|
|
334
|
+
canIntercept?: boolean;
|
|
335
|
+
userInitiated?: boolean;
|
|
336
|
+
hashChange?: boolean;
|
|
337
|
+
destination: NavigationDestination;
|
|
338
|
+
signal: AbortSignal;
|
|
339
|
+
formData?: FormData | null;
|
|
340
|
+
downloadRequest?: string | null;
|
|
341
|
+
info?: unknown;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
declare class Navigation extends EventTarget {
|
|
345
|
+
entries(): NavigationHistoryEntry[];
|
|
346
|
+
readonly currentEntry: NavigationHistoryEntry | null;
|
|
347
|
+
updateCurrentEntry(options: NavigationUpdateCurrentEntryOptions): void;
|
|
348
|
+
readonly transition: NavigationTransition | null;
|
|
349
|
+
readonly canGoBack: boolean;
|
|
350
|
+
readonly canGoForward: boolean;
|
|
351
|
+
navigate(url: string, options?: NavigationNavigateOptions): NavigationResult;
|
|
352
|
+
reload(options?: NavigationReloadOptions): NavigationResult;
|
|
353
|
+
traverseTo(key: string, options?: NavigationOptions): NavigationResult;
|
|
354
|
+
back(options?: NavigationOptions): NavigationResult;
|
|
355
|
+
forward(options?: NavigationOptions): NavigationResult;
|
|
356
|
+
onnavigate: ((this: Navigation, ev: NavigateEvent) => any) | null;
|
|
357
|
+
onnavigatesuccess: ((this: Navigation, ev: Event) => any) | null;
|
|
358
|
+
onnavigateerror: ((this: Navigation, ev: ErrorEvent) => any) | null;
|
|
359
|
+
oncurrententrychange: ((this: Navigation, ev: NavigationCurrentEntryChangeEvent) => any) | null;
|
|
360
|
+
addEventListener<K extends keyof NavigationEventMap>(type: K, listener: (this: Navigation, ev: NavigationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
361
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
362
|
+
removeEventListener<K extends keyof NavigationEventMap>(type: K, listener: (this: Navigation, ev: NavigationEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
363
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare class NavigationCurrentEntryChangeEvent extends Event {
|
|
367
|
+
constructor(type: string, eventInit?: NavigationCurrentEntryChangeEventInit);
|
|
368
|
+
readonly navigationType: NavigationTypeString | null;
|
|
369
|
+
readonly from: NavigationHistoryEntry;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare interface NavigationCurrentEntryChangeEventInit extends EventInit {
|
|
373
|
+
navigationType?: NavigationTypeString | null;
|
|
374
|
+
from: NavigationHistoryEntry;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
declare class NavigationDestination {
|
|
378
|
+
readonly url: string;
|
|
379
|
+
readonly key: string | null;
|
|
380
|
+
readonly id: string | null;
|
|
381
|
+
readonly index: number;
|
|
382
|
+
readonly sameDocument: boolean;
|
|
383
|
+
getState(): unknown;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
declare interface NavigationEventMap {
|
|
388
|
+
navigate: NavigateEvent;
|
|
389
|
+
navigatesuccess: Event;
|
|
390
|
+
navigateerror: ErrorEvent;
|
|
391
|
+
currententrychange: NavigationCurrentEntryChangeEvent;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
declare class NavigationHistoryEntry extends EventTarget {
|
|
395
|
+
readonly key: string;
|
|
396
|
+
readonly id: string;
|
|
397
|
+
readonly url: string | null;
|
|
398
|
+
readonly index: number;
|
|
399
|
+
readonly sameDocument: boolean;
|
|
400
|
+
getState(): unknown;
|
|
401
|
+
ondispose: ((this: NavigationHistoryEntry, ev: Event) => any) | null;
|
|
402
|
+
addEventListener<K extends keyof NavigationHistoryEntryEventMap>(type: K, listener: (this: NavigationHistoryEntry, ev: NavigationHistoryEntryEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
403
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
404
|
+
removeEventListener<K extends keyof NavigationHistoryEntryEventMap>(type: K, listener: (this: NavigationHistoryEntry, ev: NavigationHistoryEntryEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
405
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
declare interface NavigationHistoryEntryEventMap {
|
|
409
|
+
dispose: Event;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
declare interface NavigationInterceptOptions {
|
|
413
|
+
handler?: () => Promise<void>;
|
|
414
|
+
focusReset?: 'after-transition' | 'manual';
|
|
415
|
+
scroll?: 'after-transition' | 'manual';
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
declare interface NavigationNavigateOptions extends NavigationOptions {
|
|
419
|
+
state?: unknown;
|
|
420
|
+
history?: 'auto' | 'push' | 'replace';
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
declare interface NavigationOptions {
|
|
424
|
+
info?: unknown;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
declare interface NavigationReloadOptions extends NavigationOptions {
|
|
428
|
+
state?: unknown;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
declare interface NavigationResult {
|
|
432
|
+
committed: Promise<NavigationHistoryEntry>;
|
|
433
|
+
finished: Promise<NavigationHistoryEntry>;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
declare class NavigationTransition {
|
|
437
|
+
readonly navigationType: NavigationTypeString;
|
|
438
|
+
readonly from: NavigationHistoryEntry;
|
|
439
|
+
readonly finished: Promise<void>;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
declare type NavigationTypeString = 'reload' | 'push' | 'replace' | 'traverse';
|
|
443
|
+
|
|
444
|
+
declare interface NavigationUpdateCurrentEntryOptions {
|
|
445
|
+
state: unknown;
|
|
446
|
+
}
|
|
447
|
+
|
|
278
448
|
/**
|
|
279
449
|
* Clears out the shared fake async zone for a test.
|
|
280
450
|
* To be called in a global `beforeEach`.
|
|
@@ -557,6 +727,143 @@ export declare function withModule(moduleDef: TestModuleMetadata): InjectSetupWr
|
|
|
557
727
|
|
|
558
728
|
export declare function withModule(moduleDef: TestModuleMetadata, fn: Function): () => any;
|
|
559
729
|
|
|
730
|
+
/**
|
|
731
|
+
* Fake implementation of user agent history and navigation behavior. This is a
|
|
732
|
+
* high-fidelity implementation of browser behavior that attempts to emulate
|
|
733
|
+
* things like traversal delay.
|
|
734
|
+
*/
|
|
735
|
+
export declare class ɵFakeNavigation implements Navigation {
|
|
736
|
+
private readonly window;
|
|
737
|
+
/**
|
|
738
|
+
* The fake implementation of an entries array. Only same-document entries
|
|
739
|
+
* allowed.
|
|
740
|
+
*/
|
|
741
|
+
private readonly entriesArr;
|
|
742
|
+
/**
|
|
743
|
+
* The current active entry index into `entriesArr`.
|
|
744
|
+
*/
|
|
745
|
+
private currentEntryIndex;
|
|
746
|
+
/**
|
|
747
|
+
* A Map of pending traversals, so that traversals to the same entry can be
|
|
748
|
+
* re-used.
|
|
749
|
+
*/
|
|
750
|
+
private readonly traversalQueue;
|
|
751
|
+
/**
|
|
752
|
+
* A Promise that resolves when the previous traversals have finished. Used to
|
|
753
|
+
* simulate the cross-process communication necessary for traversals.
|
|
754
|
+
*/
|
|
755
|
+
private nextTraversal;
|
|
756
|
+
/**
|
|
757
|
+
* A prospective current active entry index, which includes unresolved
|
|
758
|
+
* traversals. Used by `go` to determine where navigations are intended to go.
|
|
759
|
+
*/
|
|
760
|
+
private prospectiveEntryIndex;
|
|
761
|
+
/**
|
|
762
|
+
* A test-only option to make traversals synchronous, rather than emulate
|
|
763
|
+
* cross-process communication.
|
|
764
|
+
*/
|
|
765
|
+
private synchronousTraversals;
|
|
766
|
+
/** Whether to allow a call to setInitialEntryForTesting. */
|
|
767
|
+
private canSetInitialEntry;
|
|
768
|
+
/** The next unique id for created entries. Replace recreates this id. */
|
|
769
|
+
private nextId;
|
|
770
|
+
/** The next unique key for created entries. Replace inherits this id. */
|
|
771
|
+
private nextKey;
|
|
772
|
+
/** Whether this fake is disposed. */
|
|
773
|
+
private disposed;
|
|
774
|
+
/** Equivalent to `navigation.currentEntry`. */
|
|
775
|
+
get currentEntry(): FakeNavigationHistoryEntry;
|
|
776
|
+
get canGoBack(): boolean;
|
|
777
|
+
get canGoForward(): boolean;
|
|
778
|
+
constructor(window: Window, startURL: `http${string}`);
|
|
779
|
+
/**
|
|
780
|
+
* Sets the initial entry.
|
|
781
|
+
*/
|
|
782
|
+
setInitialEntryForTesting(url: `http${string}`, options?: {
|
|
783
|
+
historyState: unknown;
|
|
784
|
+
state?: unknown;
|
|
785
|
+
}): void;
|
|
786
|
+
/** Returns whether the initial entry is still eligible to be set. */
|
|
787
|
+
canSetInitialEntryForTesting(): boolean;
|
|
788
|
+
/**
|
|
789
|
+
* Sets whether to emulate traversals as synchronous rather than
|
|
790
|
+
* asynchronous.
|
|
791
|
+
*/
|
|
792
|
+
setSynchronousTraversalsForTesting(synchronousTraversals: boolean): void;
|
|
793
|
+
/** Equivalent to `navigation.entries()`. */
|
|
794
|
+
entries(): FakeNavigationHistoryEntry[];
|
|
795
|
+
/** Equivalent to `navigation.navigate()`. */
|
|
796
|
+
navigate(url: string, options?: NavigationNavigateOptions): FakeNavigationResult;
|
|
797
|
+
/** Equivalent to `history.pushState()`. */
|
|
798
|
+
pushState(data: unknown, title: string, url?: string): void;
|
|
799
|
+
/** Equivalent to `history.replaceState()`. */
|
|
800
|
+
replaceState(data: unknown, title: string, url?: string): void;
|
|
801
|
+
private pushOrReplaceState;
|
|
802
|
+
/** Equivalent to `navigation.traverseTo()`. */
|
|
803
|
+
traverseTo(key: string, options?: NavigationOptions): FakeNavigationResult;
|
|
804
|
+
/** Equivalent to `navigation.back()`. */
|
|
805
|
+
back(options?: NavigationOptions): FakeNavigationResult;
|
|
806
|
+
/** Equivalent to `navigation.forward()`. */
|
|
807
|
+
forward(options?: NavigationOptions): FakeNavigationResult;
|
|
808
|
+
/**
|
|
809
|
+
* Equivalent to `history.go()`.
|
|
810
|
+
* Note that this method does not actually work precisely to how Chrome
|
|
811
|
+
* does, instead choosing a simpler model with less unexpected behavior.
|
|
812
|
+
* Chrome has a few edge case optimizations, for instance with repeated
|
|
813
|
+
* `back(); forward()` chains it collapses certain traversals.
|
|
814
|
+
*/
|
|
815
|
+
go(direction: number): void;
|
|
816
|
+
/** Runs a traversal synchronously or asynchronously */
|
|
817
|
+
private runTraversal;
|
|
818
|
+
/** Equivalent to `navigation.addEventListener()`. */
|
|
819
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
|
|
820
|
+
/** Equivalent to `navigation.removeEventListener()`. */
|
|
821
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: EventListenerOptions | boolean): void;
|
|
822
|
+
/** Equivalent to `navigation.dispatchEvent()` */
|
|
823
|
+
dispatchEvent(event: Event): boolean;
|
|
824
|
+
/** Cleans up resources. */
|
|
825
|
+
dispose(): void;
|
|
826
|
+
/** Returns whether this fake is disposed. */
|
|
827
|
+
isDisposed(): boolean;
|
|
828
|
+
/** Implementation for all navigations and traversals. */
|
|
829
|
+
private userAgentNavigate;
|
|
830
|
+
/**
|
|
831
|
+
* Implementation for a push or replace navigation.
|
|
832
|
+
* https://whatpr.org/html/10919/browsing-the-web.html#url-and-history-update-steps
|
|
833
|
+
* https://whatpr.org/html/10919/nav-history-apis.html#update-the-navigation-api-entries-for-a-same-document-navigation
|
|
834
|
+
*/
|
|
835
|
+
private urlAndHistoryUpdateSteps;
|
|
836
|
+
/**
|
|
837
|
+
* Implementation for a traverse navigation.
|
|
838
|
+
*
|
|
839
|
+
* https://whatpr.org/html/10919/browsing-the-web.html#apply-the-traverse-history-step
|
|
840
|
+
* ...
|
|
841
|
+
* > Let updateDocument be an algorithm step which performs update document for history step application given targetEntry's document, targetEntry, changingNavigableContinuation's update-only, scriptHistoryLength, scriptHistoryIndex, navigationType, entriesForNavigationAPI, and previousEntry.
|
|
842
|
+
* > If targetEntry's document is equal to displayedDocument, then perform updateDocument.
|
|
843
|
+
* https://whatpr.org/html/10919/browsing-the-web.html#update-document-for-history-step-application
|
|
844
|
+
* which then goes to https://whatpr.org/html/10919/nav-history-apis.html#update-the-navigation-api-entries-for-a-same-document-navigation
|
|
845
|
+
*/
|
|
846
|
+
private userAgentTraverse;
|
|
847
|
+
/** https://whatpr.org/html/10919/nav-history-apis.html#update-the-navigation-api-entries-for-a-same-document-navigation */
|
|
848
|
+
private updateNavigationEntriesForSameDocumentNavigation;
|
|
849
|
+
/** Utility method for finding entries with the given `key`. */
|
|
850
|
+
private findEntry;
|
|
851
|
+
set onnavigate(_handler: ((this: Navigation, ev: NavigateEvent) => any) | null);
|
|
852
|
+
get onnavigate(): ((this: Navigation, ev: NavigateEvent) => any) | null;
|
|
853
|
+
set oncurrententrychange(_handler: // tslint:disable-next-line:no-any
|
|
854
|
+
((this: Navigation, ev: NavigationCurrentEntryChangeEvent) => any) | null);
|
|
855
|
+
get oncurrententrychange(): // tslint:disable-next-line:no-any
|
|
856
|
+
((this: Navigation, ev: NavigationCurrentEntryChangeEvent) => any) | null;
|
|
857
|
+
set onnavigatesuccess(_handler: ((this: Navigation, ev: Event) => any) | null);
|
|
858
|
+
get onnavigatesuccess(): ((this: Navigation, ev: Event) => any) | null;
|
|
859
|
+
set onnavigateerror(_handler: ((this: Navigation, ev: ErrorEvent) => any) | null);
|
|
860
|
+
get onnavigateerror(): ((this: Navigation, ev: ErrorEvent) => any) | null;
|
|
861
|
+
private _transition;
|
|
862
|
+
get transition(): NavigationTransition | null;
|
|
863
|
+
updateCurrentEntry(_options: NavigationUpdateCurrentEntryOptions): void;
|
|
864
|
+
reload(_options?: NavigationReloadOptions): NavigationResult;
|
|
865
|
+
}
|
|
866
|
+
|
|
560
867
|
export declare class ɵMetadataOverrider {
|
|
561
868
|
private _references;
|
|
562
869
|
/**
|