Commit graph

32 commits

Author SHA1 Message Date
Tomasz Ducin
2d7d4e2cf0 refactor(core): type-safe global ng (#53439)
This PR provides strict type definition for the window.ng object used
for both console debugging and devtools. `GlobalDevModeUtils` now
gathers all type information about all methods exposed on window.ng.

PR Close #53439
2024-01-09 12:17:48 -08:00
Matthieu Riegler
6cd91c675c refactor(devtools): enables typescript strict option (#53340)
Enabling `strict` is part of an effort to improve the quality of the devtools code base.
One of the direct side effect is to enable `noImplicitAny`, `strictPropertyInitialization` and `strictBindCallApply`.

This commit also replaces `fullTemplateTypeCheck` with `stringTemplates`.

PR Close #53340
2023-12-05 12:42:56 -08:00
Tomasz Ducin
cb500c7ee5 refactor(devtools): devtools support for maps and symbol description (#53167)
Added 2 tiny improvements:
- instead of "Symbol()", "Symbol(DESCRIPTION)" is displayed
- ECMAScript Maps are distinguished
Additionally:
- PropTypes has been moved to a separate file
- Simple unit tests covering each PropType except for PropType.Unknown

PR Close #53167
2023-11-30 09:45:13 -08:00
Matthieu Riegler
a429167994 fix(devtools): use a shared angular detection code (#51569)
This fixes an issue where an angular app exposes a global `ng` object that is not our `ng`.

fixes #51565

PR Close #51569
2023-11-30 09:40:11 -08:00
AleksanderBodurri
3cf18bb6f2 fix(devtools): check for all new DI debug APIs before trying to determine resolution path providers (#52791)
Previously, some versions of Angular 16.1.x that had 3/4 of the new DI debug APIs would enter a code path that required them to have access to the 4th.

Now DevTools checks for the existence of all 4 explicitly before going down this code path.

PR Close #52791
2023-11-10 18:37:05 +00:00
AleksanderBodurri
f4b915b77b feat(devtools): implement zoom and pan in injector graph visualizer (#52489)
Previously only the trackpad could be used to navigate this view.

Now we can zoom and pan around using our mouse wheel and scroll.

Additionally, this commit fixes many issues related to the visualization of the injector graph visualization, allowing it to be more compact without impacting legibility and minimizing edge collisions in larger graphs.

PR Close #52489
2023-11-03 17:37:55 -07:00
AleksanderBodurri
1f18c7464f perf(devtools): optimize injector graph discovery (#52489)
Our algorithm for discovering the injector graph of an application involves calculating resolution paths for each angular node on a page, and then using those paths to construct the underlying tree.

Along the we way we perform many expensive computations that are candidates for optimization through caching. This commit implements this caching, resulting in a substantial increase in performance for large applications.

PR Close #52489
2023-11-03 17:37:55 -07:00
AleksanderBodurri
ef12570e29 feat(devtools): squash multi providers into 1 and allow them to be logged to the console (#52489)
Implements a feature allowing users to visualize multiproviders as one row in the providers table.

Also enables the user to log to console any provider in the table. This log includes information about the provider selected, the injector it was configured in, and also calls `Injector.get(Token)` to determine the value the provider evaluates to in it's injector.

PR Close #52489
2023-11-03 17:37:55 -07:00
Alan Agius
d4bd3f198b build: configure tslint to ban performance.mark usages (#52505)
While `performance.mark` is available on all supported browsers and node.js version this API is not available in JSDOM which is used by Jest and Cloudflare worker.

PR Close #52505
2023-11-03 07:43:36 -07:00
AleksanderBodurri
8bdbbf4510 feat(devtools): Implement initial DI debugging features in devtools (#51719)
This commit introduces 2 new features into DevTools.

Directive level dependency inspection: Users can now view which dependencies their directives have injected in the property viewer tab. This view displays not only the dependency but also the resolution path that was used to service the injection.

Injector graph inspection: Users can now view a visualization of the element and environment hierarchies in their application. These trees are displayed separately but on the same page in the Injector Tree tab. User can click on individual injectors to view a list of all the providers configured in that injector, as well as highlight the resolution path from that injector to the root (with the corresponding environment injector connection highlighted as well).

PR Close #51719
2023-10-10 13:10:50 -07:00
Kristiyan Kostadinov
52cc7f839b build: align with internal tsconfig options (#51728)
Currently internally Angular has some customized tsconfig files, because we don't align with the tsconfig of the rest of g3. These changes enable `noImplicitReturns` and `noPropertyAccessFromIndexSignature` to align better with the internal config.

PR Close #51728
2023-09-12 11:39:42 -07:00
Keith Li
dc4b4aa57e feat(devtools): Display getters and setters in devtools property viewer (#49695)
Display the function representations of get/set properties in the property viewer just like the existing UI for function properties

PR Close #49695
2023-09-01 14:41:04 +00:00
Kristiyan Kostadinov
3a59de681f fix(devtools): ensure that inspected component label is always in the viewport (#50656)
Currently the label showing the component name is always positioned from the bottom/right edge of the element which may be outside of the viewport. These changes add some logic to fall back to a different position so that the label is always visible.

I've also cleaned the `highlighter.ts` file up a bit.

Fixes #48479.

PR Close #50656
2023-07-26 10:04:26 -07:00
alkavats1
258c773188 docs: remove unused imports and improved the code (#50424)
PR Close #50424
2023-05-25 14:37:54 +00:00
Matthieu Riegler
ba3e9eac92 feat(devtools): Improve Set support in component properties. (#49316)
With this commit, Sets are displayed with the label Set(#) where # is the size of the set. They are not expandable/editable though.

Partial fix for #49312

PR Close #49316
2023-04-03 19:15:34 -07:00
SyedAhm3r
db841d02c9 fix(devtools): Variables initialized to undefined appearing as [setter] in property inspector (#45921)
Fixed the condition and added a test case to catch the fix

PR Close #45921
2022-05-16 10:28:04 -07:00
AleksanderBodurri
3a468813ca fix(devtools): stop relying on getAllAngularRootElements in Angular DevTools' backend code. (#45983)
With the introduction of standalone components, it is no longer guaranteed that getAllAngularRootElements will be available on the global object. This PR removes the dependency on this function so that DevTools can continue to work for Angular applications that use `bootstrapApplication`.

PR Close #45983
2022-05-13 20:08:49 +00:00
mgechev
a212fb4dde docs: update the Angular DevTools auto-generated READMEs (#45884)
Replace the auto-generated READMEs in the different Angular DevTools
submodules with brief descriptions.

PR Close #45884
2022-05-05 15:29:27 -07:00
mgechev
136839054c refactor(devtools): remove support for v11 and older versions of Angular (#45883)
In Angular v12 we introduced debugging APIs sufficient for DevTools.
Prior to that Angular DevTools accesses the logical data structures of
Ivy directly, which sometimes produces suboptimal results and skips
dynamically inserted content.

With the end of v11's LTS, we'll support only Angular v12 and up.

PR Close #45883
2022-05-05 15:28:42 -07:00
Paul Gschwendtner
68a6a075f4 build: clean up references to old master branch (#45856)
Cleans up all references to the `master` branch we renamed to
`main` across Angular.

PR Close #45856
2022-05-04 16:23:33 -07:00
Tobias Speicher
4ddcf81e61 refactor: replace deprecated String.prototype.substr() (#45397)
.substr() is deprecated so we replace it with functions which work similarily but aren't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

PR Close #45397
2022-03-24 11:48:09 -07:00
JimMorrison723
d41dedb85b fix(devtools): highlighter should only show the hovered component's name (#44863)
The used children property on a HTMLCollection does not contain text elements. Because of this, the highlighter overlay text never got fully cleared.

PR Close #44863
2022-02-01 21:28:09 +00:00
JimMorrison723
3f0a2d3120 fix(devtools): show date type property value in preview (#44864)
Values of Date properties were not shown in the preview. It was formatted to a simple string thus not giving valuable info to the developer.

PR Close #44864
2022-01-31 19:32:47 +00:00
Paul Gschwendtner
7b7d644286 refactor: fix type checking error with devtools state-serializer spec (#44735)
Fixes an error in the satte-serializer spec:

```
devtools/projects/ng-devtools-backend/src/lib/state-serializer/state-serializer.spec.ts:103:60 - error TS2345: Argument of type '{ name: string; children: { name: string; children: { name: number; children: { name: number; children: { name: string; }[]; }[]; }[]; }[]; }[]' is not assignable to parameter of type 'NestedProp[]'.
  Type '{ name: string; children: { name: string; children: { name: number; children: { name: number; children: { name: string; }[]; }[]; }[]; }[]; }' is not assignable to type 'NestedProp'.
    Types of property 'children' are incompatible.
      Type '{ name: string; children: { name: number; children: { name: number; children: { name: string; }[]; }[]; }[]; }[]' is not assignable to type 'NestedProp[]'.
        Type '{ name: string; children: { name: number; children: { name: number; children: { name: string; }[]; }[]; }[]; }' is not assignable to type 'NestedProp'.
          Types of property 'children' are incompatible.
            Type '{ name: number; children: { name: number; children: { name: string; }[]; }[]; }[]' is not assignable to type 'NestedProp[]'.
              Type '{ name: number; children: { name: number; children: { name: string; }[]; }[]; }' is not assignable to type 'NestedProp'.
                Types of property 'children' are incompatible.
                  Type '{ name: number; children: { name: string; }[]; }[]' is not assignable to type 'NestedProp[]'.
                    Type '{ name: number; children: { name: string; }[]; }' is not assignable to type 'NestedProp'.
                      Types of property 'children' are incompatible.
                        Type '{ name: string; }[]' is not assignable to type 'NestedProp[]'.
                          Property 'children' is missing in type '{ name: string; }' but required in type 'NestedProp'.

103     const result = deeplySerializeSelectedProperties(dir1, QUERY_1_2);
```

PR Close #44735
2022-01-27 21:51:28 +00:00
AleksanderBodurri
8fb3aed874 docs(devtools): update comment to better reflect what angular version is running in g3.
PR Close #43473
2022-01-26 14:18:32 -08:00
AleksanderBodurri
445fbf81fd refactor(devtools): bring the angular devtools directory into the root bazel workspace
Previously devtools used a nested workspace for its bazel configurations. This meant framework dependencies were consumed via npm.

Now devtools is part of the root bazel directory that all other files in this codebase fall under. This allows us to build devtools using local angular packages, removing the need to consume these dependencies with npn. This is useful because we no longer have to update these dependencies with an automated tool like renovate, and our CI tests will always run against the most up to date framework packages.
2022-01-26 16:35:31 -05:00
AleksanderBodurri
7ed57f29ea refactor(devtools): add override to classes that extend abstract classes in the devtools directory
Previously the typescript override keyword was not on these methods. Now that devtools uses the tslint config in angular/angular (because of the no-implicit-override-abstract rule) we need to add these key words explicitly to method overrides. That is what this commit does.
2022-01-26 16:35:31 -05:00
AleksanderBodurri
2a1ff17b42 refactor(devtools): run tslint --fix on devtools codebase
This commit runs tslint --fix with the angular/angular tslint configuration on the files inside the devtools codebase.

Notably, the file-header rule in `tslint.json` was missing a default attribute. This commit adds that default attribute and sets it to the
license header that is present in all files in this repo. After running tslint --fix with this default added, this commit added the license header to all files in the devtools directory. Note for the reviewer: the automatically added license headers were added as comments with the "/*!" prefix. Since we want these comments removed in builds, and the rest of the codebase uses "/**", a simple find and replace was performed on the devtools directory to change these prefixes to "/**".
2022-01-26 16:35:31 -05:00
AleksanderBodurri
6b06fa3f78 refactor(devtools): make bazel labels follow snake case convention
Previously, camel case was used for bazel labels in the devtools directory. This commit changes these labels to snake case except in the case where the label is identical to the directory name that the BUILD file is in.
2022-01-26 16:35:30 -05:00
AleksanderBodurri
8b84412d76 refactor(devtools): run ng-dev format on angular devtools files
Formats the entire devtools directory with the ng-dev formatting tool. Previously we relied on prettier, so this commit also remove prettier from devtools' dependencies.
2022-01-26 16:35:30 -05:00
AleksanderBodurri
82d46b20b1 refactor(devtools): run ng-dev format on bazel files in devtools directory 2022-01-26 16:35:30 -05:00
AleksanderBodurri
528f33d13d refactor(devtools): prepare codebase for migration to angular/angular repo 2021-11-21 20:23:18 -05:00