2021-12-10 02:37:01 +00:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google LLC All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
2024-09-20 15:23:15 +00:00
|
|
|
* found in the LICENSE file at https://angular.dev/license
|
2021-12-10 02:37:01 +00:00
|
|
|
*/
|
|
|
|
|
|
2025-03-07 00:49:41 +00:00
|
|
|
import {
|
|
|
|
|
ɵFramework as Framework,
|
|
|
|
|
ɵAcxViewEncapsulation as AcxViewEncapsulation,
|
|
|
|
|
InjectionToken,
|
|
|
|
|
InjectOptions,
|
|
|
|
|
Injector,
|
|
|
|
|
Type,
|
|
|
|
|
ViewEncapsulation as AngularViewEncapsulation,
|
|
|
|
|
} from '@angular/core';
|
2020-04-08 18:35:50 +00:00
|
|
|
|
2020-01-27 18:40:18 +00:00
|
|
|
export interface DirectiveType {
|
|
|
|
|
name: string;
|
2020-02-20 01:33:54 +00:00
|
|
|
id: number;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ComponentType {
|
|
|
|
|
name: string;
|
2020-03-09 23:13:34 +00:00
|
|
|
isElement: boolean;
|
2020-02-20 01:33:54 +00:00
|
|
|
id: number;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
2024-01-19 19:29:24 +00:00
|
|
|
export type HydrationStatus =
|
|
|
|
|
| null
|
|
|
|
|
| {status: 'hydrated' | 'skipped'}
|
|
|
|
|
| {
|
|
|
|
|
status: 'mismatched';
|
|
|
|
|
expectedNodeDetails: string | null;
|
|
|
|
|
actualNodeDetails: string | null;
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-21 00:34:52 +00:00
|
|
|
export interface DevToolsNode<DirType = DirectiveType, CmpType = ComponentType> {
|
2020-01-27 18:40:18 +00:00
|
|
|
element: string;
|
|
|
|
|
directives: DirType[];
|
2021-12-09 05:44:17 +00:00
|
|
|
component: CmpType | null;
|
2020-02-21 00:34:52 +00:00
|
|
|
children: DevToolsNode<DirType, CmpType>[];
|
|
|
|
|
nativeElement?: Node;
|
2023-10-05 08:00:31 +00:00
|
|
|
resolutionPath?: SerializedInjector[];
|
2024-01-19 19:29:24 +00:00
|
|
|
hydration: HydrationStatus;
|
2025-02-19 23:03:20 +00:00
|
|
|
onPush?: boolean;
|
2023-10-05 08:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface SerializedInjector {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
2025-02-19 13:53:23 +00:00
|
|
|
type: 'imported-module' | 'environment' | 'element' | 'null' | 'hidden';
|
2023-10-05 08:00:31 +00:00
|
|
|
node?: DevToolsNode;
|
2023-11-02 05:50:48 +00:00
|
|
|
providers?: number;
|
2023-10-05 08:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface SerializedProviderRecord {
|
|
|
|
|
token: string;
|
2023-11-02 05:50:48 +00:00
|
|
|
type: 'type' | 'existing' | 'class' | 'value' | 'factory' | 'multi';
|
2023-10-05 08:00:31 +00:00
|
|
|
multi: boolean;
|
|
|
|
|
isViewProvider: boolean;
|
2023-11-02 05:50:48 +00:00
|
|
|
index?: number | number[];
|
2023-10-05 08:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Duplicate of the InjectedService interface from Angular framework to prevent
|
2023-11-25 19:26:37 +00:00
|
|
|
* needing to publicly expose the interface from the framework.
|
2023-10-05 08:00:31 +00:00
|
|
|
*/
|
|
|
|
|
export interface InjectedService {
|
|
|
|
|
token?: Type<unknown> | InjectionToken<unknown>;
|
|
|
|
|
value: unknown;
|
|
|
|
|
flags?: InjectOptions;
|
|
|
|
|
providedIn: Injector;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
2023-12-06 16:02:03 +00:00
|
|
|
export type ContainerType = 'WritableSignal' | 'ReadonlySignal' | null;
|
|
|
|
|
|
2020-01-27 18:40:18 +00:00
|
|
|
export enum PropType {
|
|
|
|
|
Number,
|
|
|
|
|
String,
|
|
|
|
|
Null,
|
|
|
|
|
Undefined,
|
|
|
|
|
Symbol,
|
2020-03-20 23:40:01 +00:00
|
|
|
HTMLNode,
|
2020-01-27 18:40:18 +00:00
|
|
|
Boolean,
|
|
|
|
|
BigInt,
|
|
|
|
|
Function,
|
|
|
|
|
Object,
|
|
|
|
|
Date,
|
|
|
|
|
Array,
|
2023-03-20 13:41:19 +00:00
|
|
|
Set,
|
2023-11-25 19:26:37 +00:00
|
|
|
Map,
|
2020-01-27 18:40:18 +00:00
|
|
|
Unknown,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Descriptor {
|
|
|
|
|
expandable: boolean;
|
|
|
|
|
value?: any;
|
|
|
|
|
editable: boolean;
|
|
|
|
|
type: PropType;
|
|
|
|
|
preview: string;
|
2023-12-06 16:02:03 +00:00
|
|
|
containerType: ContainerType;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface DirectivesProperties {
|
|
|
|
|
[name: string]: Properties;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-07 00:49:41 +00:00
|
|
|
/** Directive metadata shared by all frameworks. */
|
|
|
|
|
export interface BaseDirectiveMetadata {
|
|
|
|
|
framework: Framework;
|
|
|
|
|
name?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Directive metadata specific to Angular. */
|
|
|
|
|
export interface AngularDirectiveMetadata extends BaseDirectiveMetadata {
|
|
|
|
|
framework: Framework.Angular;
|
2021-12-09 05:44:17 +00:00
|
|
|
inputs: {[name: string]: string};
|
|
|
|
|
outputs: {[name: string]: string};
|
2025-03-07 00:49:41 +00:00
|
|
|
encapsulation?: AngularViewEncapsulation;
|
2025-03-19 02:37:39 +00:00
|
|
|
onPush?: boolean;
|
2023-10-05 08:00:31 +00:00
|
|
|
dependencies?: SerializedInjectedService[];
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-07 00:49:41 +00:00
|
|
|
/** Directive metadata specific to ACX. */
|
|
|
|
|
export interface AcxDirectiveMetadata extends BaseDirectiveMetadata {
|
|
|
|
|
framework: Framework.ACX;
|
|
|
|
|
inputs: {[name: string]: string};
|
|
|
|
|
outputs: {[name: string]: string};
|
|
|
|
|
encapsulation?: AcxViewEncapsulation;
|
|
|
|
|
onPush?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Directive metadata specific to Wiz. */
|
|
|
|
|
export interface WizComponentMetadata extends BaseDirectiveMetadata {
|
|
|
|
|
framework: Framework.Wiz;
|
|
|
|
|
props: {[name: string]: string};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Directive metadata for all supported frameworks. */
|
|
|
|
|
export type DirectiveMetadata =
|
|
|
|
|
| AngularDirectiveMetadata
|
|
|
|
|
| AcxDirectiveMetadata
|
|
|
|
|
| WizComponentMetadata;
|
|
|
|
|
|
2023-10-05 08:00:31 +00:00
|
|
|
export interface SerializedInjectedService {
|
|
|
|
|
token: string;
|
|
|
|
|
value: string;
|
|
|
|
|
position: number[];
|
|
|
|
|
flags?: InjectOptions;
|
2023-11-02 07:09:20 +00:00
|
|
|
resolutionPath?: SerializedInjector[];
|
2020-04-08 18:35:50 +00:00
|
|
|
}
|
|
|
|
|
|
2020-01-27 18:40:18 +00:00
|
|
|
export interface Properties {
|
2021-12-09 05:44:17 +00:00
|
|
|
props: {[name: string]: Descriptor};
|
2020-04-08 18:35:50 +00:00
|
|
|
metadata?: DirectiveMetadata;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
2020-02-19 21:39:32 +00:00
|
|
|
export type ElementPosition = number[];
|
2020-01-27 18:40:18 +00:00
|
|
|
|
2020-02-19 21:39:32 +00:00
|
|
|
export interface DirectivePosition {
|
|
|
|
|
element: ElementPosition;
|
2020-01-27 18:40:18 +00:00
|
|
|
directive?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface NestedProp {
|
2021-12-09 05:44:17 +00:00
|
|
|
name: string | number;
|
2020-01-27 18:40:18 +00:00
|
|
|
children: NestedProp[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ComponentExplorerViewProperties {
|
2020-03-20 23:02:11 +00:00
|
|
|
[directive: string]: NestedProp[];
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-20 23:02:11 +00:00
|
|
|
export enum PropertyQueryTypes {
|
|
|
|
|
All,
|
|
|
|
|
Specified,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface AllPropertiesQuery {
|
|
|
|
|
type: PropertyQueryTypes.All;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface SelectedPropertiesQuery {
|
|
|
|
|
type: PropertyQueryTypes.Specified;
|
|
|
|
|
properties: ComponentExplorerViewProperties;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-09 05:44:17 +00:00
|
|
|
export type PropertyQuery = AllPropertiesQuery | SelectedPropertiesQuery;
|
2020-03-20 23:02:11 +00:00
|
|
|
|
2020-01-27 18:40:18 +00:00
|
|
|
export interface ComponentExplorerViewQuery {
|
2020-03-20 23:02:11 +00:00
|
|
|
selectedElement: ElementPosition;
|
|
|
|
|
propertyQuery: PropertyQuery;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ComponentExplorerView {
|
2020-02-21 00:34:52 +00:00
|
|
|
forest: DevToolsNode[];
|
2020-03-20 23:02:11 +00:00
|
|
|
properties?: DirectivesProperties;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
2020-02-20 20:48:53 +00:00
|
|
|
export interface LifecycleProfile {
|
|
|
|
|
ngOnInit?: number;
|
|
|
|
|
ngOnDestroy?: number;
|
|
|
|
|
ngOnChanges?: number;
|
|
|
|
|
ngDoCheck?: number;
|
|
|
|
|
ngAfterContentInit?: number;
|
|
|
|
|
ngAfterContentChecked?: number;
|
|
|
|
|
ngAfterViewInit?: number;
|
|
|
|
|
ngAfterViewChecked?: number;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-29 00:20:20 +00:00
|
|
|
export interface OutputProfile {
|
|
|
|
|
[outputName: string]: number;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-20 19:49:08 +00:00
|
|
|
export interface DirectiveProfile {
|
|
|
|
|
name: string;
|
2020-03-09 23:13:34 +00:00
|
|
|
isElement: boolean;
|
2020-02-20 19:49:08 +00:00
|
|
|
isComponent: boolean;
|
2020-02-20 20:48:53 +00:00
|
|
|
lifecycle: LifecycleProfile;
|
2021-04-29 00:20:20 +00:00
|
|
|
outputs: OutputProfile;
|
2020-03-31 17:44:59 +00:00
|
|
|
changeDetection?: number;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
2020-02-20 19:49:08 +00:00
|
|
|
export interface ElementProfile {
|
|
|
|
|
directives: DirectiveProfile[];
|
|
|
|
|
children: ElementProfile[];
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
2020-02-20 19:49:08 +00:00
|
|
|
export interface ProfilerFrame {
|
2020-01-27 18:40:18 +00:00
|
|
|
source: string;
|
2020-03-31 19:01:03 +00:00
|
|
|
duration: number;
|
2020-02-20 19:49:08 +00:00
|
|
|
directives: ElementProfile[];
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|
|
|
|
|
|
2020-02-19 20:07:01 +00:00
|
|
|
export interface UpdatedStateData {
|
2020-02-24 17:38:22 +00:00
|
|
|
directiveId: DirectivePosition;
|
2020-02-19 20:07:01 +00:00
|
|
|
keyPath: string[];
|
|
|
|
|
newValue: any;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-07 13:15:42 +00:00
|
|
|
export interface Route {
|
2024-10-15 18:39:26 +00:00
|
|
|
name?: string;
|
|
|
|
|
hash?: string | null;
|
|
|
|
|
specificity?: string | null;
|
|
|
|
|
handler?: string;
|
|
|
|
|
pathMatch?: 'prefix' | 'full';
|
2024-10-27 01:52:33 +00:00
|
|
|
canActivateGuards?: string[] | null;
|
|
|
|
|
providers?: string[] | null;
|
2024-10-15 18:39:26 +00:00
|
|
|
title?: string;
|
2021-02-07 13:15:42 +00:00
|
|
|
children?: Array<Route>;
|
2024-10-15 18:39:26 +00:00
|
|
|
data?: any;
|
|
|
|
|
path: string;
|
|
|
|
|
component: string;
|
|
|
|
|
isActive: boolean;
|
2021-02-07 13:15:42 +00:00
|
|
|
isAux: boolean;
|
2024-10-15 18:39:26 +00:00
|
|
|
isLazy: boolean;
|
2021-02-07 13:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
2024-03-05 03:54:58 +00:00
|
|
|
export interface AngularDetection {
|
|
|
|
|
// This is necessary because the runtime
|
|
|
|
|
// message listener handles messages globally
|
|
|
|
|
// including from other extensions. We don't
|
|
|
|
|
// want to set icon and/or popup based on
|
|
|
|
|
// a message coming from an unrelated extension.
|
|
|
|
|
isAngularDevTools: true;
|
|
|
|
|
isIvy: boolean;
|
|
|
|
|
isAngular: boolean;
|
|
|
|
|
isDebugMode: boolean;
|
|
|
|
|
isSupportedAngularVersion: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-23 23:35:02 +00:00
|
|
|
export type Topic = keyof Events;
|
|
|
|
|
|
2023-10-05 08:00:31 +00:00
|
|
|
export interface InjectorGraphViewQuery {
|
|
|
|
|
directivePosition: DirectivePosition;
|
|
|
|
|
paramIndex: number;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-27 18:40:18 +00:00
|
|
|
export interface Events {
|
|
|
|
|
handshake: () => void;
|
|
|
|
|
shutdown: () => void;
|
|
|
|
|
queryNgAvailability: () => void;
|
2021-12-09 05:44:17 +00:00
|
|
|
ngAvailability: (config: {
|
2024-04-05 22:24:43 +00:00
|
|
|
version: string | undefined;
|
2021-12-09 05:44:17 +00:00
|
|
|
devMode: boolean;
|
|
|
|
|
ivy: boolean;
|
2024-01-19 19:29:24 +00:00
|
|
|
hydration: boolean;
|
2021-12-09 05:44:17 +00:00
|
|
|
}) => void;
|
2020-01-27 18:40:18 +00:00
|
|
|
|
|
|
|
|
inspectorStart: () => void;
|
|
|
|
|
inspectorEnd: () => void;
|
|
|
|
|
|
2020-02-19 21:39:32 +00:00
|
|
|
getNestedProperties: (position: DirectivePosition, path: string[]) => void;
|
|
|
|
|
nestedProperties: (position: DirectivePosition, data: Properties, path: string[]) => void;
|
2020-01-27 18:40:18 +00:00
|
|
|
|
2020-02-19 21:39:32 +00:00
|
|
|
setSelectedComponent: (position: ElementPosition) => void;
|
2021-02-26 05:25:47 +00:00
|
|
|
getRoutes: () => void;
|
2021-02-07 13:15:42 +00:00
|
|
|
updateRouterTree: (routes: Route[]) => void;
|
2020-01-31 18:54:51 +00:00
|
|
|
|
2020-01-27 18:40:18 +00:00
|
|
|
componentTreeDirty: () => void;
|
2020-03-20 23:02:11 +00:00
|
|
|
getLatestComponentExplorerView: (query?: ComponentExplorerViewQuery) => void;
|
2020-01-27 18:40:18 +00:00
|
|
|
latestComponentExplorerView: (view: ComponentExplorerView) => void;
|
|
|
|
|
|
2020-02-19 20:07:01 +00:00
|
|
|
updateState: (value: UpdatedStateData) => void;
|
|
|
|
|
|
2020-01-27 18:40:18 +00:00
|
|
|
startProfiling: () => void;
|
|
|
|
|
stopProfiling: () => void;
|
2020-02-20 19:49:08 +00:00
|
|
|
sendProfilerChunk: (results: ProfilerFrame) => void;
|
|
|
|
|
profilerResults: (results: ProfilerFrame) => void;
|
2020-04-14 22:27:59 +00:00
|
|
|
|
|
|
|
|
createHighlightOverlay: (position: ElementPosition) => void;
|
|
|
|
|
removeHighlightOverlay: () => void;
|
|
|
|
|
|
2024-01-19 19:29:24 +00:00
|
|
|
createHydrationOverlay: () => void;
|
|
|
|
|
removeHydrationOverlay: () => void;
|
|
|
|
|
|
2020-04-14 22:27:59 +00:00
|
|
|
highlightComponent: (id: number) => void;
|
|
|
|
|
selectComponent: (id: number) => void;
|
|
|
|
|
removeComponentHighlight: () => void;
|
2020-05-07 03:21:32 +00:00
|
|
|
|
|
|
|
|
enableTimingAPI: () => void;
|
|
|
|
|
disableTimingAPI: () => void;
|
2023-10-05 08:00:31 +00:00
|
|
|
|
|
|
|
|
// todo: type properly
|
|
|
|
|
getInjectorProviders: (injector: SerializedInjector) => void;
|
|
|
|
|
latestInjectorProviders: (
|
|
|
|
|
injector: SerializedInjector,
|
|
|
|
|
providers: SerializedProviderRecord[],
|
|
|
|
|
) => void;
|
2023-11-02 05:50:48 +00:00
|
|
|
|
|
|
|
|
logProvider: (injector: SerializedInjector, providers: SerializedProviderRecord) => void;
|
2024-03-05 03:54:58 +00:00
|
|
|
|
|
|
|
|
contentScriptConnected: (frameId: number, name: string, url: string) => void;
|
|
|
|
|
contentScriptDisconnected: (frameId: number, name: string, url: string) => void;
|
|
|
|
|
enableFrameConnection: (frameId: number, tabId: number) => void;
|
|
|
|
|
frameConnected: (frameId: number) => void;
|
|
|
|
|
detectAngular: (detectionResult: AngularDetection) => void;
|
|
|
|
|
backendReady: () => void;
|
|
|
|
|
|
|
|
|
|
log: (logEvent: {message: string; level: 'log' | 'warn' | 'debug' | 'error'}) => void;
|
2020-01-27 18:40:18 +00:00
|
|
|
}
|