Commit graph

24639 commits

Author SHA1 Message Date
Adrien Crivelli
34890fb901 docs(router): Complete QueryParamsHandling documentation (#46286)
`QueryParamsHandling` has a third possibility which is the default behavior,
and it was not documented until now.

PR Close #46286
2022-06-08 12:40:56 -07:00
Alan Agius
7391143dd3 docs: remove azure builder reference (#46285)
This builder is not compatible with newer versions of the Angular CLI.

See https://github.com/angular/angular-cli/issues/23255 for more context

PR Close #46285
2022-06-08 12:40:23 -07:00
Paul Gschwendtner
960c7ed755 build: update dev-infra shared code to latest revision (#46291)
Updates dev-infra to the latest revision. This revision supports
for custom release prechecks and performs the release build
before the staging, verifying integrity later. This has various
benefits for stability and making the less less relucant to build
issues that mess up a previously-merged staging PR.

PR Close #46291
2022-06-07 10:43:38 -07:00
Renovate Bot
342836d784 build: update dependency magic-string to v0.26.2 (#46279)
PR Close #46279
2022-06-07 10:43:12 -07:00
George Kalpakas
5f339ef9f8 build(docs-infra): update dependencies in docs examples package.json files (#46248)
This is a follow-up to #46227 to update the dependency version ranges in
the docs examples `package.json` files.

PR Close #46248
2022-06-07 10:42:43 -07:00
Paul Gschwendtner
b280b97d5a refactor(common): include locale extra data in closure locale file (#46167)
The recent update to CLDR 41 highlighted (internally) that some time
formats have changed to rely on locale-specific day periods. In
particular the `zh_TW` (or canonical: `zh_Hant`) has changed some
time formats/patterns from the universal `AM/PM` symbols (`a`) to `B`.

The `b`/`B` symbols rely on locale-specific day period rules. This data
is only extracted from CLDR into the so-called extra locale data that
Angular provides.

To fix this, and to be able to reverse the internal workaround that
doesn't allow us to use the actual CLDR 41 data here, we always provide
the locale extra data when conditonally loading CLDR data based on
`goog.LOCALE`.

This will result in additional payload cost that locale-specific JS
bundles have to pay, but the only alternative would be to break
Angular's `b`/`B` symbol support in favor of falling back to `AM/PM`
rules (similar to how Closure Libray itself does it).

For our external users (something I want to note here), they will be
able to load the extra data easily (like it was possible before).
Angular has some good erroring if the extra data is required. Most of
our users will always use the global locale files anyway (the Angular
CLI always uses them). These come with the extra data by default.

Resources:

- 0d538327d1
- 0d538327d1/common/main/zh_Hant.xml
- 6a4353cb40/packages/common/src/i18n/format_date.ts (L609-L639)
- https://cldr.unicode.org/translation/date-time/date-time-symbols
- 4be7cdce82/packages/angular_devkit/build_angular/src/utils/i18n-options.ts (L23)

PR Close #46167
2022-06-07 10:14:14 -07:00
Andrew Kushnir
627cdf31a3 test: add an internal helper to populate document.head before a test (#46250)
This commit reuses the logic of the `withBody` helper and implements the `withHead` based on it.The helper method is useful for tests that rely on a certain tags being present in document's `<head>` element.

PR Close #46250
2022-06-06 16:12:32 -07:00
Andrew Kushnir
8c15eea5a2 refactor(core): rename a file to avoid old terminology (to avoid mentioning render3) (#46250)
This commit renames the packages/private/testing/src/render3.ts -> packages/private/testing/src/utils.ts to avoid using the `render3` term as it used to differentiate VE and Ivy, which is no longer relevant.

PR Close #46250
2022-06-06 16:12:32 -07:00
Alan Agius
a9e8a212f8 docs: mark version 13 as LTS in releases guide (#46268)
Verson 13 is now in LTS.

PR Close #46268
2022-06-06 11:48:05 -07:00
mgechev
d67cf922c2 docs: add i18n video to the overview page (#46273)
PR Close #46273
2022-06-06 11:46:49 -07:00
Renovate Bot
c083f6dcb2 build: lock file maintenance (#46270)
PR Close #46270
2022-06-06 11:46:27 -07:00
Phalgun Vaddepalli
385b5ec92c docs: removed outdated migration documentation (#46257)
Fixes #46236

PR Close #46257
2022-06-06 11:42:51 -07:00
Andrew Kushnir
aa2e8acd0e docs: annotate more APIs with the @developerPreview tag (#46234)
This commit updates a few more standalone-related APIs with the `@developerPreview` tag.

PR Close #46234
2022-06-06 11:37:55 -07:00
Andrew Kushnir
612b4088b9 refactor(core): export missing util function (#46274)
This commit exports the `isHostComponentStandalone` function and also changes a location where it's imported from. The function was moved recently in a different PR, which caused some conflicts after merging other PRs that relied on the old structure.

PR Close #46274
2022-06-06 11:35:25 -07:00
wellWINeo
cac4d0527e docs: fix duplicate in CHANGELOG (#46267)
PR Close #46267
2022-06-06 10:18:32 -07:00
dario-piotrowicz
3ab9d48ef0 docs: change wrong alters to callouts (#46262)
change the alerts present in the docs to callouts so
that their header can be properly rendered
(since alters don't support have headers)

PR Close #46262
2022-06-06 10:17:53 -07:00
dario-piotrowicz
d4f11147f4 refactor(core): fix eaither typo in transitiveScopesFor comment (#46261)
fix the 'eaither' typo (instead of 'either') in the tsdoc comment
for the transitiveScopesFor function

PR Close #46261
2022-06-06 10:17:01 -07:00
Kristiyan Kostadinov
ceb9abd9fd fix(bazel): update API extractor version (#46259)
`@angular/bazel` currently uses an older version of `@microsoft/api-extractor` which is causing downstream issues in Components. These changes bump up to a version that has a fix.

Context: https://github.com/angular/components/pull/25027

PR Close #46259
2022-06-06 10:16:04 -07:00
Fabrizio Fallico
6724e43bf6 docs: fix missing closing div in http page (#46258)
PR Close #46258
2022-06-06 10:15:37 -07:00
Jelle Bruisten
185cbc414c docs: fix typo in the CHANGELOG (#46255)
Fixes a type made in the CHANGELOG.md under the 14.0.0 at router release notes
PR Close #46255
2022-06-06 10:14:46 -07:00
Dylan Hunn
f18e1739b8 fix(forms): allow FormBuilder.group(...) to accept optional fields. (#46253)
Consider the case in which `FormBuilder` is used to construct a group with an optional field:

```
const controls = { name: fb.control('') };
const foo: FormGroup<{
  name: FormControl<string | null>;
  address?: FormControl<string | null>;
}> = fb.group<{
  name: FormControl<string | null>;
  address?: FormControl<string | null>;
}>(controls);
```

Today, with fully strict TypeScript settings, the above will not compile:

```
Types of property 'controls' are incompatible.
Type '{ name: FormControl<string | null>; address?: FormControl<FormGroup<SubFormControls> | null | undefined> | undefined; }' is not assignable to type '{ name: FormControl<string | null>; address?: FormGroup<SubFormControls> | undefined; }'.
```

Notice that the `fb.group(...)` is calculating the following type for address: `address?: FormControl<FormGroup<string|null>`. This is clearly wrong -- an extraneous `FormControl` has been added!

This is coming from the calculation of the result type of `fb.group(...)`. In the type definition, if we cannot detect the outer control type, [we assume it's just an unwrapped value, and automatically wrap it in `FormControl`](https://github.com/angular/angular/blob/14.0.0/packages/forms/src/form_builder.ts#L66).

Because the optional `{address?: FormControl<string|null>}` implicitly makes the RHS have type `FormControl<string|null>|undefined`, [the relevant condition is not satisfied](https://github.com/angular/angular/blob/14.0.0/packages/forms/src/form_builder.ts#L55). In particular, the condition expects just `FormGroup<T>`, not `FormGroup<T>|undefined`. So we assume `T` is a value type, and it gets wrapped with `FormControl`.

The solution is to add the cases where `undefined` is included in the union type when detecting which control `T` is (if any).

PR Close #46253
2022-06-06 10:14:19 -07:00
dario-piotrowicz
0d10fe52f1 refactor(core): add helpful info in the pipe not found error message (#46247)
Add info to the pipe not found error message so to give some help to the developer for
resolving the problem more efficiently

(Note: this change also distinguishes the case in which the hosting component is standalone)

PR Close #46247
2022-06-06 10:13:28 -07:00
dario-piotrowicz
cc183928e1 refactor(core): split RuntimeError unit test up (#46239)
split the single RuntimeError utils test testing about the correct
formatting of errors in multiple separate unit tests (for better
granularity and clearness)

PR Close #46239
2022-06-06 10:12:06 -07:00
dario-piotrowicz
0b7ab075b7 refactor(core): improve the runtime errors formatting (#46239)
the formatted error messages always include a period separator between the
provided error message and the find-more suffix, this is not always
desirable as it may add periods when they shoud not be, so improve the
formatting by checking and applying the period only if the provided message
doesn't end with a character which already represents a separator

additionally also improve the formatting by trimming the provided error
message

note that such trimming needs to be performed before the separator check
so that for example an error message like `"some error! "` doesn't produce
`"some error! ."` but it successfully produces "some error!"

PR Close #46239
2022-06-06 10:12:05 -07:00
Dylan Hunn
f12cf2b89b docs(forms): Amend the FormGroupDirective docs to indicate it also works with FormRecord. (#46235)
It is currently unclear which directive to use for FormRecord. This commit amends the docs to explicitly state that the group directives can and should be used with records.

PR Close #46235
2022-06-06 10:11:15 -07:00
dario-piotrowicz
d846bba678 refactor(core): improve code around element validation (#46175)
improve code regarding element validation by creating a new file
exporting validation functions and not exporting utils previously
globally available

PR Close #46175
2022-06-06 10:10:41 -07:00
Renovate Bot
5cfde8b23e build: lock file maintenance (#46104)
PR Close #46104
2022-06-03 10:23:36 -07:00
George Kalpakas
e9cb0454dc feat(upgrade): more closely align UpgradeModule#bootstrap() with angular.bootstrap() (#46214)
Previously, [UpgradeModule#bootstrap()][1], while being a replacement
for and accepting the same arguments as [angular.bootstrap()][2], did
not return the same value as `angular.bootstrap()` (i.e. the AngularJS
injector in most cases). This made it less straight forward to migrate
some usecases that relied on the return value of `.bootstrap()`. The
work-around was to access the injector via [UpgradeModule#$injector][3]
(after the app had been bootstrapped with `UpgradeModule#bootstrap()`).

This commit addresses this by ensuring `UpgradeModule#bootstrap()`
returns the same value as `angular.bootstrap()`, making it easier to
replace the latter with the former.

[1]: https://angular.io/api/upgrade/static/UpgradeModule#bootstrap
[2]: https://docs.angularjs.org/api/ng/function/angular.bootstrap
[3]: https://angular.io/api/upgrade/static/UpgradeModule#%24injector

Fixes #46211

PR Close #46214
2022-06-03 10:16:05 -07:00
George Kalpakas
4e5e3123c2 test(upgrade): add some tests for UpgradeModule (#46214)
Add some tests for the `UpgradeModule` class and its members.

PR Close #46214
2022-06-03 10:16:05 -07:00
Krzysztof Platis
da0f53be76 docs: fix release notes for v14.0.0 - remove notice "fixes 45350" from breaking changes (#46238)
PR Close #46238
2022-06-03 10:09:54 -07:00
dario-piotrowicz
ee98f4eaf8 docs: update outdated link title for structural directives guide (#46228)
amend the aio glossary using as the structural-directives guide link's title the
outdated heading of that guide (changed in PR #44895)

PR Close #46228
2022-06-03 10:08:15 -07:00
dario-piotrowicz
6eb234b622 docs: replace wrong NgFor with NgForOf (#46228)
amend the aio structural-directives guide incorrectly mentioning
`NgFor` instead of `NgForOf` as a structural directive

PR Close #46228
2022-06-03 10:08:15 -07:00
Andrew Scott
243c6797f4 test(router): illustrate canceling of intermediate results in canLoad (#46231)
This adds a test to illustrate the "canceling" behavior we get from the
`Observable` chain in the Router. A new navigation cancels ongoing ones,
and that means also preventing intermediate results in user guards from
executing. This test is important when thinking about future refactors
which might attempt to change the details of how the `applyRedirects`
operator executes.

PR Close #46231
2022-06-03 10:06:54 -07:00
Kristiyan Kostadinov
6c44222fa1 refactor(core): don't use patched data in LifecycleHooksFeature (#46237)
We don't need to read patched data off the component instance since we already know what the `LView` is.

PR Close #46237
2022-06-03 10:06:19 -07:00
San Leen
07b40849db docs: update navigation update-to-latest for v14 (#46246)
This commit adds content related to Angular v14 to the title and  tooltip of `navigation.json -> guide/update-to-latest-version` .
PR Close #46246
2022-06-03 09:52:14 -07:00
Alex Rickabaugh
1ba2098dbd build(docs-infra): update to 14.0.0 (#46227)
This commit updates AIO to use the published 14.0.0 packages, as the final
step after the release.

PR Close #46227
2022-06-02 14:45:33 -07:00
George Kalpakas
f42f80b858 build(docs-infra): upgrade cli command docs sources to 4a6dfc1d8 (#46208)
Updating [angular#main](https://github.com/angular/angular/tree/main) from
[cli-builds#main](https://github.com/angular/cli-builds/tree/main).

##
Relevant changes in
[commit range](874ad2184...4a6dfc1d8):

**Modified**
- help/completion.json

PR Close #46208
2022-06-02 13:45:05 -07:00
Paul Gschwendtner
f74bd1b0f5 perf(bazel): reduce input files for ng_package rollup and type bundle actions (#46187)
We currently use all the ESM2020 and type sources as inputs for rollup
and type bundle actions, respectively. This is a source of slowness in
Bazel sandboxed builds because many unused files will be linked/made
available for many concurrently-running actions.

We should limit the inputs only to what is assumed to be used. We cannot
know exactly and need to include transitive types from `node_modules`,
but that is an inevitable construct with the current Bazel rules.

Note that the external node modules could still bring in a lot of files,
like in Material where the `.d.ts` files for all locales are brought
into the sandbox (from `@angular/common`). We likely would need to
remove these files in a postinstall for now, to speed up actions,
similar to how we did it for RxJS in all repositories. These are known
to be not used in the components repo.

PR Close #46187
2022-06-02 13:43:22 -07:00
JoostK
c26b6d9a42 refactor(common): remove unused method in internal SubscriptionStrategy interface (#46128)
The `onDestroy` method was not being called so this commit removes it entirely.

PR Close #46128
2022-06-02 13:42:38 -07:00
JoostK
99a15ec25f refactor(common): clear ChangeDetectorRef when AsyncPipe is destroyed (#46128)
To mitigate the effect of Observables with memory leak, this change clears
the `ChangeDetectorRef` when the `AsyncPipe` is destroyed. This avoids any
leak within the `Observable` to retain the view data. A test has been added
to verify that this change works correctly with promises that resolve _after_
the pipe has been destroyed.

Note: this is not marked as fix as `AsyncPipe` itself is _not_ leaking any
memory.

Closes #17624

PR Close #46128
2022-06-02 13:42:38 -07:00
JoostK
8eb1b386b2 refactor(common): improve type of AsyncPipe._strategy field (#46128)
The field's type does not account for the `null` value that is assigned
in the field's initializer. This commit includes `null` in the type for
better type-safety. Exising reads are updated with a non-null assertion
operation in places where initialization is known to have occurred.

PR Close #46128
2022-06-02 13:42:38 -07:00
Kristiyan Kostadinov
0206c10f8e refactor(core): minor ComponentDef improvements (#46093)
Makes the following improvements in the runtime:
* Uses the unique ID of the component definition to keep track of its injector in the `StandaloneFeature`, instead of the definition itself. This reduces the amount of memory we can leak, if something doesn't get cleaned up.
* Changes the naming and description of the `ComponentDef.id` to reflect what it is used for.

PR Close #46093
2022-06-02 13:41:27 -07:00
Kristiyan Kostadinov
8fb737cfa4 refactor(core): remove unused error handler logic (#46216)
There's some old logic in the error handler that tries to read an `ngErrorHandler` property off of the errors that are being logged. As far as I can tell, this is a ViewEngine leftover and it isn't actually being used anywhere.

PR Close #46216
2022-06-02 13:40:16 -07:00
Kristiyan Kostadinov
d981aabfcf refactor(core): clean up closure deoptimization (#46149)
In #45445 function inlining had to be disabled on one of our instructions, because Closure wasn't optimizing it correctly, causing an error at runtime. The error has been resolved so we can remove the deoptimization hint.

PR Close #46149
2022-06-02 13:39:50 -07:00
Alex Rickabaugh
a006edefd1 refactor(compiler-cli): introduce onlyPublishPublicTypingsForNgModules (#45894)
When generating .d.ts metadata for NgModules, by default we emit type
references to their declarations, imports, and exports. However, this
information is not necessarily useful to consumers. References to private
directives (those that aren't exported by the NgModule) for example aren't
at all useful as they can only affect other components declared in the
NgModule. References to imports are of limited usefulness - they might be
helpful for an IDE to understand the DI structure of an application, but
aren't at all used by a downstream compiler.

Generating this metadata is not without cost. When an incremental build
system uses changes in inputs to determine when a rebuild is necessary, any
changes in .d.ts files might cause downstream targets to rebuild. If those
.d.ts changes are in the "private" side of the NgModule (imports or non-
exported directives/pipes), then these rebuilds are wholly unnecessary.

This commit introduces the `onlyPublishPublicTypingsForNgModules` flag for
the compiler. When this flag is set, the compiler will filter the emitted
references in NgModule .d.ts output and only reference those directives/
pipes that are exported from the NgModule (its public API surface). Omitting
the flag preserves the existing behavior of emitting all references, both
public and private.

This is especially useful for build systems such as Bazel.

PR Close #45894
2022-06-02 13:39:14 -07:00
Alex Rickabaugh
2444f36cbf fix(docs-infra): correct developer preview link (#46225)
The developer preview link was previously prefixed with the Github URL for
Angular's repo. However, it's meant to go to a guide page on AIO itself.
This commit removes the link prefix.

PR Close #46225
2022-06-02 12:35:13 -07:00
mgechev
917f421f60 docs: set proper type parameter of FormArray in changelog (#46226)
PR Close #46226
2022-06-02 12:33:00 -07:00
mgechev
4a89466483 docs: add blog post to the v14 release in changelog (#46226)
PR Close #46226
2022-06-02 12:33:00 -07:00
Alex Rickabaugh
ab114e2e24 docs: fix release notes for v14.0.0 2022-06-02 11:01:37 -07:00
Alex Rickabaugh
7985f492cd docs: release notes for the v14.0.0 release (#46224)
PR Close #46224
2022-06-02 10:04:22 -07:00