Commit graph

10085 commits

Author SHA1 Message Date
Payam Valadkhan
07b04b2511 refactor(core): implement logic for getting component dependencies in the runtime deps tracker (#50980)
This includes implementation of methods getComponentDependencies and registerNgModule.

In order to correlate ng-modules with their declarations it is required to use the method registerNgModule to regiater the ng-module. However, the actual correlation will happen lazily once getComponentDependencies method is called. This lazy behaviour also allows for forward refs to be resolved.

The method getComponentDependencies will be used in local compilation mode to compute the rendering component deps in runtime.

PR Close #50980
2023-07-18 14:04:39 +00:00
Payam Valadkhan
548cf56782 refactor(core): implement clearScopeCacheFor for runtime deps tracker (#50980)
This method mainly has application test beds where we want to apply overrides and re-compute the scope.

PR Close #50980
2023-07-18 14:04:39 +00:00
Payam Valadkhan
afae358009 refactor(core): implement getStandaloneComponentScope method of the runtime deps tracker (#50980)
The logic mainly followed the `render3/jit/directive.ts#getStandaloneDefFunctions` helper.

PR Close #50980
2023-07-18 14:04:39 +00:00
Payam Valadkhan
48a3197d8f refactor(core): implement getNgModuleScope method of runtime dependency tracker (#50980)
The implementation is more or less follows the pattern in render3/jit/module.ts#transitiveScopesFor helper. A few additional helper functions also added to jit utils.

PR Close #50980
2023-07-18 14:04:39 +00:00
Kristiyan Kostadinov
76d22ae752 refactor(compiler): add defer trigger parsing (#51050)
Adds the logic to parse the `when` and `on` triggers in a deferred block.

PR Close #51050
2023-07-17 21:05:47 +00:00
Kristiyan Kostadinov
9e61616ffe refactor(compiler): introduce deferred block AST (#51050)
Adds the logic to create `defer`-specific AST nodes from the generic HTML `BlockGroup` and `Block`. The logic for parsing the triggers will be in the next commit.

PR Close #51050
2023-07-17 21:05:47 +00:00
Miles Malerba
f1cb971645 refactor(compiler): consolidate renaming logic (#50805)
Moves the property name normalization logic under the naming phase

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
154b695d6e refactor(compiler): add attribute bindings to ordering algorithm (#50805)
Adds attribute and attribute interpolation bindings to the ordering
algorithm that decides the order of various property, style, and
attribute ops.

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
3a0e091468 refactor(compiler): fix var counting for style bindings (#50805)
Use the correct number of var slots for style and class bindings.

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
afd2fd8681 refactor(compiler): ensure correct ordering of properties and attributes (#50805)
Ensures that all property and attribute ops are ordered consistently
regardless of the order they appear in the template. This ensures
correct precedence (e.g. `[style.color]="'#000'"` awlays wins out over
`[style]="{color: '#fff'}"`)

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
03e6dc3f28 refactor(compiler): normalize style prop binding names (#50805)
Normalizes style property names in bindings by converting them to
kebab-case and stripping off `!important`

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
c27d6b6b37 build: enable newly passing style tests for the template compiler (#50805)
Enables style tests that are now passing in the template compiler thanks
to recent fixes

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
a35e3799f3 refactor(compiler): make style and class properties chainable (#50805)
Makes the stylePropInterpolate and classProp functions chainable by the
compiler

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
2fb5a847ca refactor(compiler): fix single argument class and style interpolations (#50805)
Single argument class and style interpolations (e.g.
`style.color="{{color}"`) should be converted to standard class and
property operations with no interpolation (e.g. `[style.color]="color")

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
2f7072dc3f refactor(compiler): add support for class property bindings (#50805)
Adds support for bindings of the form `[class.some-class]="isActive"`

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
021025964a refactor(compiler): add support for class map interpolation bindings (#50805)
Adds support for bindings of the form `class="static {{dynamic}}"`

PR Close #50805
2023-07-17 17:03:57 +00:00
Miles Malerba
7e5e37af36 refactor(compiler): add support for class map bindings (#50805)
Adds support for bindings of the form `[class]="classActiveMap"`

PR Close #50805
2023-07-17 17:03:57 +00:00
Matthieu Riegler
c5608e5ca9 fix(http): Run fetch request out the angular zone (#50981)
Having the request run in the angular zone has the consequence of triggering the CD for every read of the response stream.

This commit wraps the whole `doRequest` to run outside angular with every callback on the observer being called inside the zone.

Fixes #50979.

PR Close #50981
2023-07-17 14:53:52 +00:00
Joey Perrott
743be79749 ci: migrate windows job to GHA (#51010)
Migrate windows job to use Github Actions

PR Close #51010
2023-07-17 14:51:36 +00:00
Paul Gschwendtner
f15b24de04 refactor(compiler): properly sanitize identifier names in template pipeline (#50946)
Currently, a listener on an element containing a dash, will result in
runtime errors because the function name will be generated using a dash.

e.g.

```
function MyApp_Template_some-comp_bla_0() {}
```

throwing with a syntax error due to the dash. We fix this by re-using
the sanitize identifier function from the current template definition
builder.

PR Close #50946
2023-07-14 19:48:49 +00:00
Matthieu Riegler
67df5a9771 refactor(platform-browser): use globalThis for global (#50063)
`globalThis` is now available on every runtime supported by Angular

PR Close #50063
2023-07-14 18:32:01 +00:00
Matthieu Riegler
7b23d4de8c refactor(compiler): use globalThis for global (#50063)
`globalThis` is now available on every runtime supported by Angular

PR Close #50063
2023-07-14 18:32:01 +00:00
Matthieu Riegler
8aec8d3058 refactor(localize): use globalThis for global (#50063)
`globalThis` is now available on every runtime supported by Angular

PR Close #50063
2023-07-14 18:32:01 +00:00
Matthieu Riegler
fa80975832 refactor(core): use globalThis for global (#50063)
`globalThis` is now available on every runtime supported by Angular

PR Close #50063
2023-07-14 18:32:01 +00:00
alkavats1
8d636ad6a7 docs: updated the http tag with https (#50927)
PR Close #50927
2023-07-14 09:44:55 -07:00
Matthieu Riegler
b8107b1914 refactor(common): remove supportScrollRestoration (#50056)
`scrollRestoration` is supported across all everygreen browsers we can remove the testing method.

PR Close #50056
2023-07-13 09:42:05 -07:00
Payam Valadkhan
3b78d068ea refactor(compiler-cli): basic local compilation for components (#50545)
A minimal change to full compilation mode to work in local mode. Now compiler can compile components without ctor injections, though the compiled code missing the following items which will be added in subsequent commits:
* it does not produce `dependencies` for component definition.
* it fails if component has ctor injection

PR Close #50545
2023-07-13 09:34:53 -07:00
Payam Valadkhan
68fd99fad3 refactor(compiler-cli): Trait compiler workflow for local compilation mode (#50545)
The compiler will only include analysis and compile phases in local mode. Also a new `compileLocal` method is added to the annotation handler for local compilation.

This commit makes no change to the full/partial compilation code paths.

PR Close #50545
2023-07-13 09:34:53 -07:00
Kristiyan Kostadinov
b14a78ebb0 refactor(compiler): implement block syntax in html ast (#50953)
⚠️Disclaimer⚠️ this PR implements syntax that is still in an open RFC. It will be adjusted once the RFC is closed.

These changes implement the `BlockGroup` and `Block` AST nodes that will then be used to generate instructions based on the new syntax. A `BlockGroup` is a container for `Block` instances. The first block of a block is always implicit and required while any subsequent blocks are optional.

PR Close #50953
2023-07-13 09:32:53 -07:00
Charles Lyding
5bd530ab32 refactor(compiler-cli): add internal compiler option to control NgModule selector scope emit (#51007)
An internal compiler option named `supportJitMode` is now available for use by the Angular CLI.
This option currently controls the emit of NgModule selector scope information. This emitted
information is only needed in AOT mode when an application also uses JIT. However, AOT mode
combined with JIT mode is not currently supported nor will work in the Angular CLI. With
the Angular CLI, JIT mode is only supported if the entire application is built in JIT mode.
Without this option, the CLI needs to manually perform a code transform to remove the information
and also replicate TypeScript's import eliding. This is can be a complicated operation and must
be continually kept up to date with any changes to both the Angular compiler and TypeScript.
The introduction of this new option alleviates these concerns while also removing several build
time actions that would otherwise need to be performed on every application build.

PR Close #51007
2023-07-13 09:32:11 -07:00
Alan Agius
f1b629961f perf(platform-browser): do not remove renderer from cache when REMOVE_STYLES_ON_COMPONENT_DESTROY is enabled. (#51005)
Removing the renderer from cache is not needed when `REMOVE_STYLES_ON_COMPONENT_DESTROY` is enabled. This change retains the behaviour of keeping the renderer cached for the entire lifecycle of the application the same way it is done when `REMOVE_STYLES_ON_COMPONENT_DESTROY` is disabled.

This seems to have be causing an increase in scripting. See: http://b/290666638

PR Close #51005
2023-07-11 10:11:51 -07:00
Alex Castle
1837efb9da feat(common): Allow ngSrc to be changed post-init (#50683)
Remove thrown error when ngSrc is modified after an NgOptimizedImage image is initialized

PR Close #50683
2023-07-11 08:30:49 -07:00
Daniel Puckowski
c27a1e61d6 feat(compiler): scope selectors in @scope queries (#50747)
make sure selectors inside @scope queries are correctly scoped

PR Close #50747
2023-07-11 08:29:53 -07:00
Matthieu Riegler
3dafc14e84 refactor(core): Log a warning when multiple pipes match a name (#50389)
Since this might be too breaking, let's log for now and wait for a major to throw an actual error.

Fixes #13569

PR Close #50389
2023-07-11 08:29:07 -07:00
Antonio Pekeljevic
1ec2aa902d docs: add missing jsdocs for static ngzone methods (#50924)
PR Close #50924
2023-07-11 08:28:38 -07:00
Matthieu Riegler
a14bdfe859 fix(animations): Ensure elements are removed from the cache after leave animation. (#50929)
This commit fixes a memory leak.

`_namespaceLookup` was cleared before the call to `processLeaveNode()` which was using the lookup.
Without that lookup `clearElementCache()` wasn't called thus keeping a reference to the element.

Fixes #24197 & #50533

PR Close #50929
2023-07-11 08:28:10 -07:00
Matthieu Riegler
253d756464 fix(upgrade): Use takeUntil on leaky subscription. (#50901)
Using the life cycling hook `onDestroy` to end the subscription.

fixes #48032

PR Close #50901
2023-07-11 08:24:30 -07:00
Dzhavat Ushev
8bb6b7ddb5 docs: add missing backtick character (#50908)
PR Close #50908
2023-07-11 08:23:48 -07:00
Matthieu Riegler
61be62d621 refactor(core): fix Tnode/TView assertion. (#50914)
The debug data structure was removed in #48281. Before this fix the assertion relied on it.

PR Close #50914
2023-07-11 08:23:18 -07:00
Matthieu Riegler
5d6ec0336b fix(core): handle deref returning null on RefactiveNode. (#50992)
On Safari <16.1 there is a bug where `deref` can return `null`.

Fixes #50989

PR Close #50992
2023-07-11 08:22:47 -07:00
Kristiyan Kostadinov
29aaded0c3 refactor(compiler): introduce block parsing in lexer (#50895)
⚠️Disclaimer⚠️ this PR implements syntax that is still in an open RFC. It will be adjusted once the RFC is closed.

These changes extend the lexer to recognize the concepts of a block group (`{#foo paramA; paramB}{/foo}`) and a block (`{:foo paramA; paramB;}`) which will be useful later on for the control flow and defer proposals. Block groups can be used anywhere and require a closing tag while block can only be used inside of a block.

The idea is that in the next PRs the markup AST will be expanded to have some more specialized node like `ConditionalBlock` or `DeferBlock` which will then be turned into instructions.

PR Close #50895
2023-07-11 08:21:48 -07:00
Dylan Hunn
875851776c refactor(compiler): Generate attribute and attributeInterpolate instructions in template pipeline (#50818)
This commit adds the ability to generate attribute instructions as a result of property bindings such as `[attr.foo]='bar'` or `attr.foo='{{bar}}'`. "Singleton" interpolations, such as the previous example, will also be transformed into a simple `attribute` instruction.

PR Close #50818
2023-07-10 07:17:18 -07:00
Matthieu Riegler
394ca3b49a docs: Improve documentation about Injection context / inject (#49782)
Injection context has gain public visibility with the exposure of `inject`. Lets provide some insights.

Closes  #49774

PR Close #49782
2023-07-10 07:09:31 -07:00
Paul Gschwendtner
8a0c5c710a refactor: improve type safety of interpolation AST (#50903)
Instead of using `any`, we should use the actual types that
are available from the parser.

PR Close #50903
2023-07-10 07:08:28 -07:00
Andrew Kushnir
031b599a55 fix(core): ensure that standalone components get correct injector instances (#50954)
Prior to this change, we've used `componentDef.id` as a key in a Map that acts as a cache to avoid re-creating injector instances for standalone components. In v16, the logic that generates the id has changed from an auto-incremental to a generation based on metadata. If multiple components have similar metadata, their ids might overlap.

This commit updates the logic to stop using `componentDef.id` as a key and instead, use the `componentDef` itself. This would ensure that we always have a correct instance of an injector associated with a standalone component instance.

Resolves #50724.

PR Close #50954
2023-07-10 07:07:44 -07:00
Terry
e77cb75c54 docs(forms): FormBuilder is not associated with ReactiveFormsModule (#50941)
PR Close #50941
2023-07-05 13:53:10 +02:00
Matthieu Riegler
925dad91a8 refactor(platform-browser-dynamic): Fix JSDoc comment (#50893)
JSDoc comments should start with 2 stars or the annotations would not be picked up by the AIO workflow.

With this fix, the internal methods are no longer visible in the doc.

PR Close #50893
2023-06-30 11:49:29 -07:00
Matthieu Riegler
01e2bde0c0 refactor(animations): Fix JSDoc comment (#50893)
JSDoc comments should start with 2 stars or the annotations would not be picked up by the AIO workflow.

With this fix, the internal methods are no longer visible in the doc.

PR Close #50893
2023-06-30 11:49:29 -07:00
Angular Robot
4782336fe4 build: update cross-repo angular dependencies (#50881)
See associated pull request for more information.

PR Close #50881
2023-06-30 11:43:29 -07:00
Payam Valadkhan
5724dbc82d test(compiler-cli): add compliance tests for NgModule only scenarios in local mode (#50577)
Reused the existing compliance tests for full compilation.

PR Close #50577
2023-06-30 11:38:36 -07:00