22698 Commits

Author SHA1 Message Date
Andrew Scott 9cd3583920 fix(compiler-cli): Handle ng-template with structural directive in indexer (#44788)
An `ng-template` with an inline template (i.e. has a structural
directive) would previously not get an `undefined` `tagName` because the
logic assumed the element would be `t.Element` or `t.Content` and read
the tag name from the `name` property. For a `t.Template`, this exists
instead on the `t.tagName`. The final result would be an `tagName` of `undefined`
for the parent `t.Template`, causing failures in the indexer downstream.

This `undefined` value is actually expected in the renderer code, even
though the type does not specify this possibility. This change updates
the type of `tagName` to be `string|null` and explicitly handles the
case where there is a structural directive on an `ng-template`. You can
see how the two are differentiated in the compliance code that was
modified in this commit.

PR Close #44788
2022-01-25 14:15:44 -08:00
George Kalpakas 02d3d65203 build(docs-infra): update dgeni-packages to v0.29.3 (#44810)
This version includes angular/dgeni-packages#318 and thus fixes the
rendering of overridden methods in API docs.

Fixes #44468

PR Close #44810
2022-01-25 09:24:41 -08:00
Renovate Bot 0749626690 build: update angular (#44771)
PR Close #44771
2022-01-25 09:23:59 -08:00
Andrew Kushnir dd7364fc16 ci: update payload size limit for the Forms test app (#44813)
This commit updates (reduces) the payload size limit for the Forms test app. The increase was made in a previous PR and the limit is different between master and patch branches.

PR Close #44813
2022-01-24 17:10:33 -08:00
Tim Bowersox 91d4e89f37 docs: add link to AbstractControlOptions reference (#44764)
PR Close #44764
2022-01-24 14:53:16 -08:00
Tim Bowersox c77759dd57 docs: exclude setValue from async-validator-usage docregion (#44764)
Co-authored-by: Andrew Kushnir <43554145+AndrewKushnir@users.noreply.github.com>
PR Close #44764
2022-01-24 14:53:16 -08:00
Tim Bowersox 37ae53fd8f docs: add missing return statement to validate() (#44764)
PR Close #44764
2022-01-24 14:53:16 -08:00
Tim Bowersox 85f60592e6 docs: remove trailing space in code example (#44764)
PR Close #44764
2022-01-24 14:53:16 -08:00
Tim Bowersox c9f7f5e010 docs: fix UniqueAlterEgoValidatorDirective (#44764)
PR Close #44764
2022-01-24 14:53:16 -08:00
Tim Bowersox 589a6fa1e7 docs: expand async validators in reactive forms (#44764)
* Hone docregions for code examples
* Add more detailed description

PR Close #44764
2022-01-24 14:53:16 -08:00
Tim Bowersox c82c90d540 docs: revise text for adding async validators to template-driven forms (#44764)
Co-authored-by: Andrew Kushnir <43554145+AndrewKushnir@users.noreply.github.com>
PR Close #44764
2022-01-24 14:53:16 -08:00
Tim Bowersox 9f6ef6d909 docs: restore UniqueAlterEgoValidator (#44764)
Update the docregion for the directive class to differentiate them

PR Close #44764
2022-01-24 14:53:16 -08:00
Tim Bowersox 68f6676303 docs: fix UniqueAlterEgoValidatorDirective (#44764)
* Use correct class name in providers
* Update parameter & return signature for validate()
PR Close #44764
2022-01-24 14:53:15 -08:00
Tim Bowersox 961ff858ec docs: update async validators section (#44764)
* Update the UniqueAlterEgoValidator code example
* Add async-validator docregion to hero-form-reactive.component.2.ts
* Fix typo under Implementing a custom async validator
* Add h3 sections for adding async validators to reactive & template-driven forms
PR Close #44764
2022-01-24 14:53:15 -08:00
Tim Bowersox 3f4114a942 docs: add note about using NG_ASYNC_VALIDATORS (#44764)
When setting up an async validator in a template-driven form, it's necessary to register the directive with NG_ASYNC_VALIDATORS instead of NG_VALIDATORS. This was not mentioned in the docs.
PR Close #44764
2022-01-24 14:53:15 -08:00
Jessica Janiuk d4d32afa42 test(animations): Add bundling symbol test for animations package (#44809)
This adds a full bundling animation symbols test to the test suite.

PR Close #44809
2022-01-24 14:52:31 -08:00
iRealNirmal 91f9be381d refactor(forms): update required validator and checkbox validator to inherit abstractValidator (#44162)
Modified required validator and checkbox validator to inherit abstractValidator.

For every validato type different PR will be raised as discussed in #42378.

Closes #42267

PR Close #44162
2022-01-24 14:50:58 -08:00
Kristiyan Kostadinov a52685bdaf fix(core): error if NgZone.isInAngularZone is called with a noop zone (#44800)
When the user opts into the noop `NgZone`, they usually still interact with the static methods on the non-noop class. This change adds a check to handle the case where zone.js hasn't been loaded.

Fixes #44784.

PR Close #44800
2022-01-24 10:44:43 -08:00
Wiley Marques 38ebd480d3 docs(router): fixing pathMatch doc to style code correctly (#44796)
PR Close #44796
2022-01-24 10:42:52 -08:00
Andrew Scott b1c1005835 fix(compiler): correct spans when parsing bindings with comments (#44785)
The previous fix for correcting spans with comments in
https://github.com/angular/angular/commit/59eef29a6c5d568ca80595cd7018e21ad406c85d
had the unfortunate side effect of _breaking_ the spans with comments
when there was leading whitespace. This happened because the previous
fix was testing one without a comment, identifying that the offset shouldn't
have anything added to it, and then removing that offset adjustment
(`offsets[i] + (expressionText.length - sourceToLex.length)`).

Upon further investigation, this offset adjustment _was actually
necessary_ for when the input had comments, but this was only because
the `stripComments` function used `trim` to remove whitespace for these
cases. This is the real problem -- not only does it create a ton of confusion
but also it means that the behavior of the lexer and resulting spans is
different between inputs with comments and inputs without comments.

After reviewing how the `inputLength` of `_ParseAST` was used, it
appears that the correct behavior would be to _not_ trim the input. The
`inputLength` is used to advance the current index beyond points which
have been processed. This _should_ include any whitespace. Additionally,
`inputLength` doesn't appear to be needed at all. When there was no
comment in the input, it was always equal to the `input.length` anyways.
When there _is_ a comment, it should include that comment anyways to
advance the index beyond the comment.

PR Close #44785
2022-01-24 10:41:54 -08:00
Andrew Scott 188bc8a655 fix(compiler-cli): properly index <svg> elements when on a template (#44785)
The original fix for svg elements in
https://github.com/angular/angular/commit/92b23f48519a1adb460a431c356bcd9917fb059d
did not account for svg elements when they also had a structural
directive on them, making the node a template. This resulted in the
logic added in fix above not being applied.

PR Close #44785
2022-01-24 10:41:53 -08:00
Oleg Postoev 45503b43e7 refactor(common): unused return value from attemptFocus (#44457)
The function attemptFocus had a return value that nowhere is used. But it still saves in the bundle.

PR Close #44457
2022-01-21 13:11:31 -08:00
JoostK 71d28acf0c fix(compiler): properly compile DI factories when coverage reporting is enabled (#44732)
When running tests with code coverage using Istanbul, the code is
instrumented with coverage reporting statements. These statements are
also inserted into synthesized constructors, preventing Angular from
properly recognizing them as synthesized constructor.

This commit changes the regex to detect synthesized constructors to allow
for statements within the constructor before the `super(...arguments);`
call. This is limited to code that does not contain a `}`, but this
is sufficient to support Istanbul's coverage instrumentation statements.

The tests have been extended with an input file that is being
instrumented using `babel-plugin-istanbul` for both ES2015 and ES5
targets, in order to verify that the approach works for real-world
usages.

Fixes #31337

PR Close #44732
2022-01-21 13:10:43 -08:00
Renovate Bot ef5486fab5 build: update all non-major dependencies (#44713)
PR Close #44713
2022-01-21 11:21:51 -08:00
Andrew Scott e251eaec6c fix(core): consistently use namespace short name rather than URI (#44766)
`Renderer2` APIs expect to be called with the namespace name rather than
the namespace URI. Rather than passing around the URI and having to
account for different calling contexts, this change consistently uses
the namespace short names.

Importantly, the URI was only used in `component_ref.ts` `create`
(because `getNamespace returned the URIs`) and `createElementNode` in
`node_manipulation.ts` (because `getNamespaceUri` also used the URIs).
In contrast, attributes would use the _short names instead of URIs_
(see `setUpAttributes` in `attrs_utils.ts`). These names are pulled
directly from the attribute, i.e. `xhtml:href` and not converted to URI.
This dichotomy is confusing and unnecessary. The change here aligns the two
approaches in order to provide consistently throughout the system.

This relates to #44766 because the `createElementNode` was calling the
`AnimationRenderer.createElement` which delegates to the
`ServerRenderer`, which in turn was only set up to expect short names.
As a result, the `NAMESPACE_URIS` lookup failed and `Domino` created
the `svg` as a regular `Element` which does not have a `styles`
property.

resolves #44766

PR Close #44766
2022-01-21 11:19:30 -08:00
Andrew Scott d050118f4f test: Update test to not declare component in multiple modules (#44766)
When running locally, these integration tests appear to fail because the
component is declared in many test modules.

PR Close #44766
2022-01-21 11:19:30 -08:00
George Kalpakas a9f5c87cc6 build(docs-infra): upgrade cli command docs sources to 0ee298908 (#44769)
Updating [angular#13.1.x](https://github.com/angular/angular/tree/13.1.x) from
[cli-builds#13.2.x](https://github.com/angular/cli-builds/tree/13.2.x).

##
Relevant changes in
[commit range](https://github.com/angular/cli-builds/compare/febee7484...0ee298908):

**Modified**
- help/build.json

PR Close #44769
2022-01-20 14:02:16 -08:00
Martin Probst 2b6461ebad refactor(compiler): pass rootDir to tsickle (#44768)
tsickle's underlying API has changed to require passing a rootDir to getGeneratedExterns.
PR Close #44768
2022-01-20 11:16:35 -08:00
Stephanie Tuerk e534f8ee1d docs: correct (possible) typo (#44759)
change 'reference' to 'referencing' -- I believe this is is a typo and that this is the proper correction.
PR Close #44759
2022-01-20 09:22:36 -08:00
Derek Cormier d509a0d75f fix(docs-infra): fix date parsing in a flaky test (#44763)
Mock dates in EventsComponent tests are parsed in inconsistent ways
across platforms/browsers, which makes the comparison to the mocked
UTC "now" date behave differently causing the test to fail. This fix
ensures that the mocked "now" date is parsed in the same way as the
test dates to avoid inconsistencies.

PR Close #44763
2022-01-19 16:47:16 -08:00
Dylan Hunn 7cb3b78acc release: cut the v13.1.3 release (#44757)
PR Close #44757
13.1.3
2022-01-19 09:31:48 -08:00
Ramesh Thiruchelvam 3797d1022d refactor(core): make the error messages tree shakable (#44359)
Long error messages can be tree-shaken in the production build and replaced with error codes.

See: https://github.com/angular/angular/pull/44219#issuecomment-983216374

PR Close #44359
2022-01-18 17:38:10 -08:00
dario-piotrowicz 929788d9a8 refactor(animations): change errors type from any to string (#44726)
errors in the animations code are of type `any` but are consistently
used as if there were `string`s, change `any` to `string` to make
typing more accurate

PR Close #44726
2022-01-18 15:52:05 -08:00
JoostK e9bd16adbe refactor(compiler): remove directive matching from template compiler (#44731)
The directive matching pass that happens during template compilation is
redundant, since directive matching has already happened during the resolution
phase of ngtsc and only matching declarables are provided to the template
compiler. In JIT mode the declarables only become available after the primary
template compilation has completed, so there is no need to perform directive
matching in both JIT and AOT mode.

PR Close #44731
2022-01-18 14:51:09 -08:00
JoostK 95248a0bab refactor(compiler): store modifiers in a bitmask instead of an array (#44731)
This commit slightly reduces memory usage of output AST by storing type
and statement modifiers as a bitmask instead of using an array.

PR Close #44731
2022-01-18 14:51:09 -08:00
JoostK 626f3f230b perf(compiler-cli): reduce analysis work during incremental rebuilds (#44731)
This commit reduces the analysis work that needs to happen during an
incremental rebuild by properly recording files for which no traits were found
in the set of files that have no traits, such that the same file doesn't have
to be reanalyzed during subsequent rebuilds. It also excludes shim files from
analysis.

PR Close #44731
2022-01-18 14:51:08 -08:00
Ramesh Thiruchelvam cab81ba13a refactor(common): make the error messages tree shakable (#44663)
Make Long error messages tree-shakable in the production build with error codes.

fixes #40096

PR Close #44663
2022-01-18 10:31:44 -08:00
AnkitSharma-007 617610e3b0 docs: add Ankit to GDE resources (#44659)
PR Close #44659
2022-01-18 09:25:08 -08:00
Renovate Bot 14eb6c4fab build: update angular (#44728)
PR Close #44728
2022-01-18 09:24:43 -08:00
JoostK f9ca4d8499 fix(ngcc): support element accesses for export declarations (#44669)
Bundlers like Rollup may use an element access expression for an export
declaration, which causes ngcc to ignore those export declarations possibly
resulting in incomplete processing of packages.

Element access syntax may be used when the declared name is not considered
as valid JS identifier, but bundlers may be conservative in determining whether
an identifier can be used (to emit a property access) and opt for a string
literal in an element access instead.

The element access syntax introduces a problem for ngcc, where it wouldn't
consider such export as class declaration, causing them to be skipped. The
ngtsc compiler is implemented with the assumption that all class declarations
use a `ts.Identifier` as name, whereas the element access is using a string
literal for the declared name. This makes it troublesome for ngcc to support
this syntax form in UMD bundles.

To work around the problem, this function transforms these access expressions
into regular property accesses. The source text is parsed to an AST to allow
finding the element accesses in a robust way, after which the affected text
ranges are replaced with property accesses in the original source text.

Closes #44037

PR Close #44669
2022-01-14 17:44:00 -08:00
dario-piotrowicz af0a152a2c fix(animations): apply setStyles to only rootTimelines (#44515)
during keyframe building only consider the root element's timelines
for the style setting, so that the states styles (applied with '*')
can be applied correctly

resolves #32133
resolves #28654

PR Close #44515
2022-01-13 12:01:51 -08:00
Renovate Bot e0bea36acf build: update all non-major dependencies (#44705)
PR Close #44705
2022-01-13 12:01:08 -08:00
Alan Agius 44ff4fbceb test: update integration payload size checks golden file (#44440)
This updates the size checks for Angular CLI version 13.1.3. The increase in size is due to changes in ESBuild.

Before
```js
class bS extends Wl {
  constructor(t, n, r, i) {
    super(t), (this.component = r);
    const o = Is(i + "-" + r.id, r.styles, []);
    n.addStyles(o),
      (this.contentAttr = "_ngcontent-%COMP%".replace(Gl, i + "-" + r.id)),
      (this.hostAttr = "_nghost-%COMP%".replace(Gl, i + "-" + r.id));
  }
  applyToHost(t) {
    super.setAttribute(t, this.hostAttr, "");
  }
  createElement(t, n) {
    const r = super.createElement(t, n);
    return super.setAttribute(r, this.contentAttr, ""), r;
  }
}
```

Now
```js
class ES extends Wl {
  constructor(t, n, r, i) {
    super(t), (this.component = r);
    const o = Is(i + "-" + r.id, r.styles, []);
    n.addStyles(o),
      (this.contentAttr = (function _S(e) {
        return "_ngcontent-%COMP%".replace(Gl, e);
      })(i + "-" + r.id)),
      (this.hostAttr = (function CS(e) {
        return "_nghost-%COMP%".replace(Gl, e);
      })(i + "-" + r.id));
  }
  applyToHost(t) {
    super.setAttribute(t, this.hostAttr, "");
  }
  createElement(t, n) {
    const r = super.createElement(t, n);
    return super.setAttribute(r, this.contentAttr, ""), r;
  }
}
```

PR Close #44440
2022-01-13 18:30:53 +00:00
Renovate Bot 7c49b4148e build: update angular (#44440)
PR Close #44440
2022-01-13 18:30:53 +00:00
Łukasz Holeczek 8234564bff docs: add CoreUI UI Components Library to the resources list (#44613)
PR Close #44613
2022-01-13 18:27:51 +00:00
Joey Perrott 5e4038eb63 build: update shelljs dependencies to "^0.8.5" (#44697)
Update shelljs dependencies to ^0.8.5 to fix a vulnerability reported to shelljs.

PR Close #44697
2022-01-13 18:27:33 +00:00
Daniel Díaz ba5fe3f531 docs: remove unnecessary parenthesis in View Encapsulation file (#44702)
PR Close #44702
2022-01-13 18:27:13 +00:00
dario-piotrowicz 71449b1dae refactor(elements): remove the createCustomEvent function (#44703)
the createCustomEvent function's pupose is to create customEvents
even on browsers where `CustomEvent` is not a constructor,
`CustomEvent` is currently available in all supported browsers (since
IE11 support has ended), so remove the function as it is no longer
needed

PR Close #44703
2022-01-13 18:26:54 +00:00
Jessica Janiuk ec95631ceb refactor(animations): Remove unnecessary IE specific code (#44686)
There were a few places we were still checking for Internet Explorer. This removes the references throughout the animations package.

PR Close #44686
2022-01-12 20:43:23 +00:00
Andrew Kushnir 74037f165c ci: add golden files for runtime error codes (#44677)
Runtime error codes in the Core, Common and Forms packages were not included into the `public-api` group reviews. This commit creates the necessary golden files to keep track of further changes in the runtime codes.

This is a followup from https://github.com/angular/angular/pull/44398#issuecomment-1006910976.

PR Close #44677
2022-01-12 20:42:06 +00:00