Commit Graph

24523 Commits

Author SHA1 Message Date
George Kalpakas 7059655a0b build(docs-infra): update Angular CLI/framework to v14.0.0-rc.0 in docs examples (#45997)
Update the docs examples to the latest prerelease versions of Angular
CLI and framework (v14.0.0-rc.0).

Also update the example apps to more closely align with new CLI apps.
See also the [diff][1] between a basic v13.0.0-rc.3 CLI app and a
v14.0.0-rc.0 one.

[1]: https://github.com/cexbrayat/angular-cli-diff/compare/13.0.0-rc.3...14.0.0-rc.0

PR Close #45997
2022-05-23 13:20:11 -07:00
dario-piotrowicz f2e5234e07 fix(compiler-cli): update unknown tag error for aot standalone components (#45919)
update the error message presented during aot compilation when an unrecognized
tag/element is found in a standalone component so that it does not mention
the ngModule anymore

Note: the jit variant is present in PR #45920

resolves #45818

PR Close #45919
2022-05-23 13:18:49 -07:00
Jerome Kruse 2949ae340c docs: update service-worker-config to more clearly describe behavior (#45909)
Fixes #45280

PR Close #45909
2022-05-23 13:17:53 -07:00
Andrew Kushnir 3172b4cc99 fix(core): produce proper error message for unknown props on <ng-template>s (#46068)
Currently for cases when an unknown structural directive is applied to `<ng-template>`s, an error message thrown by the framework doesn't contain a tag name, for example:

```
NG0303: Can't bind to 'unknownDir' since it isn't a known property of 'null'.
```

The underlying reason is that the tag name for the `<ng-template>` is not produced (`null` is useed as a value) by the compiler in case of inline templates and runtime logic relies on this effect.

This commit handles this situation when an error message is thrown, as the fastest way to improve the error message. More refactoring would be needed to avoid relying on the mentioned effect at runtime.

PR Close #46068
2022-05-23 10:03:24 -07:00
Thomas Mair 42db488ed7 fix(docs-infra): add member name to search index without ignore list (#46060)
Previously classs, interface and enum members where filtered with the default word ignore list. This lead to  poor search results if a search for a member on the ignore list was performed.

PR Close #46060
2022-05-23 09:56:10 -07:00
J Rob Gant 45ed2b7584 docs: Remove outdated note (#46022)
Component.styles can now use SCSS or LESS preprocessors.

PR Close #46022
2022-05-23 09:53:42 -07:00
Doug Parker b11a939e21 docs: add demo video for Angular CLI autocompletion doc (#45995)
The CLI autocompletion doc added in https://github.com/angular/angular-cli/pull/23146 includes a demo GIF, but AIO currently has no infrastructure to pull assets like images from the CLI repository, so this demo needs to be stored directly in AIO on this repository.

PR Close #45995
2022-05-23 09:30:45 -07:00
dario-piotrowicz df339d8abf fix(core): update unknown tag error for jit standalone components (#45920)
update the error message presented during jit compilation when an unrecognized
tag/element is found in a standalone component so that it does not mention
the ngModule anymore

Note: the aot variant is present in PR #45919

resolves #45818

PR Close #45920
2022-05-23 09:27:08 -07:00
Andrew Kushnir 701405fa71 fix(core): handle AOT-compiled standalone components in TestBed correctly (#46052)
Previously, the code in TestBed didn't take into account the fact that the `cmp.dependencies` array after the AOT compilation might contain regular (NgModule-based) Components/Directive/Pipes. As a result, some NgModule-specific code paths were invoked for non-NgModule types, thus leading to errors.

This commit updates the code to handle AOT-compiled structure of standalone components correctly.

PR Close #46052
2022-05-23 09:25:08 -07:00
Andrew Kushnir 4f1a813596 fix(core): restore NgModule state correctly after TestBed overrides (#46049)
This commit updates the NgModule logic to account for a case when a type has more than one generated def. This is a common situation for NgModules which have at least two: ɵmod and ɵinj. Previously, the second def was not stored before applying overrides, thus leaving it modified after the test, leaking the state as a result. This fix ensures that we store all defs before applying any overrides.

PR Close #46049
2022-05-23 09:23:12 -07:00
Pawel Kozlowski 2c52284e44 docs: add guide to standalone components preview (#46058)
Add a new page in developers guide section with the general
overview of the standalone components, directives and pipes
Additional APIs (bootstrapApplication, router, DI) as also
covered.

PR Close #46058
2022-05-23 09:15:06 -07:00
Joey Perrott 183b5f3fde build: update saucelabs key (#46089)
Update the saucelabs key for the newly generated key

PR Close #46089
2022-05-21 20:21:41 +00:00
Joey Perrott ad93c28889 build: update saucelabs key (#46088)
Update the saucelabs key for the newly generated key

PR Close #46088
2022-05-21 20:11:02 +00:00
Paul Gschwendtner f02ba99820 reactor(compiler-cli): account for babel types change (#45967)
This commit accounts for the Babel types changes. Some properties
can now also be `undefined` so existing checks/assertions had to
be adjusted to also capture `undefined` (along with `null`).

Additionally, in preparation for a new ECMA proposal, Babel types
seem to have been updated to include private names in object property
keys. This is not necessarily the case for object expressions, but
could be for object patterns (in the future -- when implemented).

More details: https://github.com/babel/babel/pull/14304 and
https://github.com/tc39/proposal-destructuring-private.

PR Close #45967
2022-05-20 14:18:10 -07:00
Paul Gschwendtner 45eb491a25 build: update api-extractor to avoid crash for properties without explicit type (#45967)
API extractor crashes got fixed with
https://github.com/microsoft/rushstack/pull/3424.

PR Close #45967
2022-05-20 14:18:10 -07:00
Paul Gschwendtner 054cb99421 build: lock file maintenance to avoid node module differences for babel types (#45967)
We recently updated Babel and the Bazel types but this actually
resulted in duplicates, causing differences between what people
seen in their IDE vs. what Bazel builds.

This commit removes the lock file and generates it fully fresh,
deduping dependencies and also fixing the differences between
local IDE and Bazel.

As part of this we also need to update/fixup one assertion on the
Babel node path types, because the node start/end can now also
be `undefined`.

PR Close #45967
2022-05-20 14:18:10 -07:00
Renovate Bot 05f0cd7727 build: update all non-major dependencies (#45967)
PR Close #45967
2022-05-20 14:18:10 -07:00
Dylan Hunn 2e96cede3e fix(forms): Warn on FormControls that are constructed with both options and asyncValidators.
DEPRECATED:

It is now deprecated to provide *both* `AbstractControlOption`s and an async validators argument to a FormControl. Previously, the async validators would just be silently dropped, resulting in a probably buggy forms. Now, the constructor call is deprecated, and Angular will print a warning in devmode.
2022-05-19 15:50:18 -07:00
Dylan Hunn 39be06037d fix(forms): Add a nonNullable option to FormControl for consistency.
DEPRECATED:

The `initialValueIsDefault` option has been deprecated and replaced with the otherwise-identical `nonNullable` option, for the sake of naming consistency.
2022-05-19 15:50:08 -07:00
George Kalpakas 2bc65351b4 docs: fix inline JSDoc tags (@see --> @link) (#46040)
In some places, the [@see][1] JSDoc tag was incorrectly used instead of
the [@link][2] inline tag, leading to warnings during doc generation and
the `@see` tags being ignored (and thus shown in the docs as is).
Replace the `@see` tags with the intended `@link` tags.

[1]: https://jsdoc.app/tags-see.html
[2]: https://jsdoc.app/tags-inline-link.html

PR Close #46040
2022-05-19 13:32:20 -07:00
Jessica Janiuk 8869fce1a4 release: cut the v14.0.0-rc.1 release (#46044) 14.0.0-rc.1 2022-05-18 12:06:27 -07:00
Andrew Scott 74ff3b55c1 test(router): Add tests for initialNavigation: enabledBlocking (#45733)
Adds additional tests to verify `enabledBlocking` functionality. The
initial attempt to fix #44355 would have broken the scenario where a new
navigation cancels the initial navigation. We also cannot rely on
`NavigationError` like the example workaround in that issue report is
doing because there won't be one if a guard simply rejects
the initial nav (#16211).

PR Close #45733
2022-05-18 08:57:30 -07:00
Alex Rickabaugh 35f20afcac fix(compiler-cli): use existing imports for standalone dependencies (#46029)
This commit fixes a small issue in the logic around the calculation of
template scopes for standalone components. These scopes include a
`Reference` for each dependency of a standalone component, which is used to
generate references to that dependency in various contexts.

Previously, the `Reference` used for a dependency was the one generated from
its own metadata. For example, a referenced directive used the `Reference`
that was created when analyzing the directive declaration itself. This still
works, as the compiler is always able to emit a reference to any valid
`Reference`. However, it's not optimal.

The `Reference` which should be used instead is the one generated from
analyzing the standalone component's `imports` array, which has knowledge of
how the dependency is referenced from within the standalone component's file
itself. This allows the compiler to skip creating a new import for the
dependency when emitting the standalone component, and use the existing,
user-authored import instead. This saves on code size and avoids taxing the
bundler with unnecessary imports.

PR Close #46029
2022-05-18 08:55:32 -07:00
Alex Rickabaugh a524a50361 fix(compiler-cli): handle standalone components with cycles (#46029)
The Angular compiler performs cycle detection when generating imports within
component files. This was previously necessary as reifying dependencies
discovered via NgModules into the component output could add imports that
weren't present in the original component and potentially create cycles.
Doing this could cause order-of-execution issues with existing user imports,
so the compiler detects this case and falls back to an alternative way of
specifying component dependencies that doesn't risk creating cycles.

For standalone components, Angular does not need to add new imports to the
component file as the user has already explicitly referenced dependencies
in the `@Component.imports`. As a result, the cycle detection can be
skipped.

Correctly authoring a program with import cycles is always challenging. One
side of a cyclic import will always initially evaluate to `undefined`, and
this can result in errors in the component definition when this happens
within component `imports`.

Our compiler _could_ detect the cycle and choose to wrap the component
dependencies in an automatic closure instead, avoiding any issues with
`undefined` during an eager evaluation. However, this commit makes an active
choice not to do that as it only serves to mask the problems with cyclic
imports. Future refactorings may cause the "other half" of the cycle to
break. Users should instead be aware of the potential problems with cycles
and explicitly defer evaluations with `forwardRef` where needed. This
ensures that future implementations of Angular compilation which may not be
able to automatically detect import cycles and correct accordingly can still
compile such components.

PR Close #46029
2022-05-18 08:55:31 -07:00
Dylan Hunn 37dbe55945 revert "fix(forms): Value and RawValue should be part of the public API." (#46023)
As per discussion on #fw-forms, this reverts #45978 (although the more in-depth comments were kept).

PR Close #46023
2022-05-17 22:48:03 +00:00
Dylan Hunn cb479bfa46 docs(forms): Make some fixes to typed forms docs: (#46023)
* `FormRecord` jsdocs should now appear on a.io
* The `{@see foo#bar}` syntax previously did not work, and has been replace with backticks

PR Close #46023
2022-05-17 22:48:03 +00:00
George Kalpakas 5a04963305 docs: explicitly specify a version in the CLI install command (#46020)
Update the CLI install command in the CLI overview page to explicitly
specify a version. This ensures that the version installed is
appropriate for the version of the docs (e.g. installing CLI v12.x when
following the v12 docs) and it consistent with the `setup-local` guide.

PR Close #46020
2022-05-17 18:28:32 +00:00
George Kalpakas f92add1157 fix(docs-infra): correctly style the CLI version in code snippet (#46020)
Some CLI versions (such as `@next`) are not parsed (and thus not
formatted) correctly in code snippets. Fix this by explicitly adding an
appropriate CSS class to the `<aio-angular-dist-tag>` elements to let
PrettyPrint know how to style this token.

PR Close #46020
2022-05-17 18:28:32 +00:00
Bob Watson 338de1b4cf docs: remove Narco from hero list in code, text, and images (#46008)
Fixes issue #45769

Removes the malevolent comic book character, "Narco," from the list of heroes. This change removes the reference from the code, text and screenshots used in the documentation and makes other minor edits as necessary.

PR Close #46008
2022-05-17 17:47:05 +00:00
Renovate Bot 79025a69ba build: update angular (#46016)
PR Close #46016
2022-05-17 08:58:58 -07:00
Virginia Dooley add2bb8e89 docs: add template overview doc (#45897)
Organize bottom list into cards.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley 29ac86deb8 docs: update links and TOC (#45897)
Update links and TOC for updated content.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley 2d444db6b4 docs: updated Property binding doc (#45897)
Refined and edited as a task-based document with the assistance
of the SME
Add missing prerequisites and what's next sections

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley b8e27fafa1 docs: updated Event binding doc (#45897)
Document updated with the assistance of the SME.
Add missing prerequisites and what's next sections
Make suggested changes to Event binding doc.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley 97e90f8470 docs: new binding overview doc (#45897)
New binding overview doc. Content derived from existing docs.
Make changes suggested in PR for binding overview doc.
Deleted bottom paragraph from Binding overview per comments made by
atscott and alxhub.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley c14c5fcb86 docs: Text interpolation doc amended to be task-based (#45897)
Rewrite document as task-based
Add prerequisites and What's next sections.
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley af5b3c181a docs: new Pipes in templates doc (#45897)
New using a Pipe in a template document.
Content taken from the original Pipes document.
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley 3e2b443b20 docs: Pipes transform data new doc (#45897)
New Transforming data with pipes document.
Content taken from the original Pipes document.
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley 29ad2aa44b docs: Understanding pipes new doc (#45897)
New overview file using the Understanding… format.
The original Pipes document was considered too long and
was broken down into several separate topics.
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley 063fc8cde3 docs: new Template expressions overview doc (#45897)
Create a new Template expressions overview doc in the Understanding...
format.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley 4b2c3617d0 docs: class-binding created as a separate task-based doc (#45897)
Class and style binding was pulled out of Attribute, class, and style
binding doc and put in its own doc.
Content edited with the assistance of the SME.
Prerequisites and What's next sections were added.

PR Close #45897
2022-05-16 16:07:35 -07:00
Virginia Dooley e56e6d6166 docs: Attribute binding changed to include attribute binding only (#45897)
Attribute document broken down into two separate documents:
1) Attribute binding
2) Class and style binding
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:34 -07:00
Virginia Dooley 5879e4616f docs: Understanding template variables updated (#45897)
This converts the "Template variables" doc to the new "Understanding"
format and remove some irrelevant content.

PR Close #45897
2022-05-16 16:07:34 -07:00
Joey Perrott 3c690bc1e9 build: use updated commit sha for github actions (#46010)
Update the commit sha for the dev-infra github actions.

PR Close #46010
2022-05-16 14:12:21 -07:00
Dylan Hunn 018550ed50 fix(forms): Value and RawValue should be part of the public API. (#45978)
Consider a typed group for storing contact information:

```
declare interface ContactControls {
	name: FormControl<string|null>;
}

contactForm: FormGroup<ContactControls> = ...;

saveForm(form: FormGroup<ContactControls>) {
	service.newContact(contactForm.value);
}
```

What should be the type of `newContact`? The answer, of course, is the value type:

```
declare interface Contact {
	name: string|null;
}

class ContactService {
	newContact(c: Contact) {}
}
```

This is quite redundant, and therefore, we should allow the value type to be generated automatically. We already have the helper types to do this -- we just need to document and export them. Then, this becomes possible:

```
class ContactService {
	newContact(c: RawValue<FormGroup<ContactControls>>) {}
}
```

PR Close #45978
2022-05-16 18:36:54 +00:00
4javier 39a1364e43 docs(devtools): add firefox extension references (#45985)
add a link to recent deployed firefox extension and use less specific terminology
PR Close #45985
2022-05-16 18:04:52 +00:00
Andrew Kushnir 9b97b840af refactor(core): avoid code duplication in standalone-related logic (#45949)
This commit updates the standalone-related logic to address the feedback from previous code reviews (specifically: https://github.com/angular/angular/pull/45687#discussion_r854499586).

PR Close #45949
2022-05-16 10:05:23 -07:00
Andrew Kushnir 5e71f2abc0 refactor(core): tree-shake away a DI error message string in prod bundles (#45994)
This commit adds the `ngDevMode` check to tree-shake away an error message string (which also retains a reference to an extra function).

PR Close #45994
2022-05-16 10:04:57 -07:00
ivanwonder 3ae133c69e fix(language-service): Fix detection of Angular for v14+ projects (#45998)
In v14, the .d.ts file for angular core is now "index.d.ts" rather than "core.d.ts".

This change happened in https://github.com/ng-packagr/ng-packagr/commit/c6f6e4d701d31e3d9e8636703ede731c3790778b

PR Close #45998
2022-05-16 10:03:53 -07:00
mariu 9cd2626e63 docs: add transparency to Ecosystem image (#45993)
PR Close #45993
2022-05-16 09:37:37 -07:00