Commit graph

343 commits

Author SHA1 Message Date
Alan Agius
1b9fd46d14 feat(core): add support for Node.js version 18 (#47730)
This change aligns with the supported Node.js versions of the Angular CLI.
See: https://github.com/angular/angular-cli/pull/24026

BREAKING CHANGE: Angular no longer supports Node.js versions `14.[15-19].x` and `16.[10-12].x`. Current supported versions of Node.js are `14.20.x`, `16.13.x` and `18.10.x`.

PR Close #47730
2022-10-11 17:21:19 +00:00
dario-piotrowicz
d11b1d99b0 fix(animations): make sure that the useAnimation function delay is applied (#47468)
make sure that when an animation is used via the `useAnimation` function
and a delay has been provided then that delay gets correctly applied

(this PR is a follow up for #47285)

PR Close #47468
2022-09-20 10:10:23 +02:00
dario-piotrowicz
7ec196e0fb fix(animations): make sure that the animation function delay is applied (#47285)
make sure that when an animation is defined via the `animation` function
(and used via `useAnimation`) and a delay has been provided then that
delay gets correctly applied

resolves #47283

PR Close #47285
2022-09-13 09:20:45 -07:00
Jeremy Elbourn
834927d0e7 refactor(animations): remove unnecesary null (#47238)
These null values are unused and unecessary. I suspect it's a remnant from when the codebase was transpiled to Dart.

PR Close #47238
2022-09-06 09:57:37 -07:00
Alex Rickabaugh
b6fbbeacf2 Revert "fix(animations): fix stagger timing not handling params (#47208)" (#47222)
This reverts commit 05f5e8ad86.

Reason: breaks internal g3 tests

PR Close #47222
2022-08-22 14:53:20 -07:00
dario-piotrowicz
05f5e8ad86 fix(animations): fix stagger timing not handling params (#47208)
prior to this change the stagger timing was being built during the
ast building instead of dynamically when visiting the stagger animation,
thus it could not handle params correctly, this change makes it so that
during ast building a timing ast is built instead and that ast is used
dynammically to build animations which can handle params correctly

resolves #19786

PR Close #47208
2022-08-22 10:51:28 -07:00
dario-piotrowicz
65a28a9ea3 fix(animations): make sure falsy values are added to _globalTimelineStyles (#46863)
style values get added to the `_globalTimelineStyles` map in order to keep
them so that they can be used across different timelines

`_globalTimelineStyles` was previously a plain object but has been
refactored to a map in #44482, as part of the update a check has been
changed from a ternary operation to an or (||), causing falsy values (as 0)
not to be added to the map anymore, apply the nullish coalescing operator (??)
instead to make sure only `undefined` and `null` are filtered out

also since this aspect was clearly not covered by tests, add a new test
to ensure that such regression doesn't happen in the future

resolves #46833

PR Close #46863
2022-07-18 21:46:12 +00:00
dario-piotrowicz
a4ec1096a1 refactor(animations): refactor non-animatable check to be timeline based (#46666)
move the check for non-animatable properties from the animation building
phase to the application of the animation's transition instead, in such
a way we can check it against the keyframes of the transition's timeline
in order to only provide warnings for properties which are being
animated, thus not providing any warning for non-animatable properties
being applied to elements via the style function

this change has the benfit just mentioned above but it comes with two
drawbacks:
 - the warning handling is not done in the building time so it is a bit
inconsistent with other type of validations (such as the unsupported css
properties one for example)
 - before the warning was being applied only when the animation's data
was being parsed, so it happed only once but now since it is applied
when the animation is actually being prepared to be played, it happens
each time the animation runs

resolves #46602

PR Close #46666
2022-07-12 22:36:22 +00:00
John Vandenberg
c14c701775 docs: fix spelling (#46713)
PR Close #46713
2022-07-08 20:54:52 +00:00
dario-piotrowicz
b3c20add72 Revert "fix(animations): enable shadowElements to leave when their parent does (#46459)" (#46739)
This reverts commit b417370383.

The change applied is no longer appropriate since the use of animations
and shadow dom components is discouraged (as of #46738)

PR Close #46739
2022-07-07 13:51:30 -07:00
dario-piotrowicz
b417370383 fix(animations): enable shadowElements to leave when their parent does (#46459)
when a component uses the shadowDom view encapsulation its children are
not rendered as normal HTML children of the element but they are
insterted in the element's shadowRoot, this causes the leave of the
element not to be normally propagated to the shadow child elements, fix
such issue

resolves #46450

PR Close #46459
2022-06-23 13:49:12 -07:00
dario-piotrowicz
342effeb7d fix(animations): reset the start and done fns on player reset (#46364)
in the animation players, make sure than upon reset the
_onStartFns and _onDoneFns are also re-applied so that
they can be called again after resetting the animation

also set the noop animation player's _finished to false
when the player resets (needed to make sure that the _onDoneFns
get called)

resolves #26630

PR Close #46364
2022-06-21 12:40:24 -07:00
Ramesh Thiruchelvam
07ea938aed refactor(common): align tree shakable error messages to the new format (#46382)
Simplifying the tree shakable error messages with the new format and removing the errorMessage variables

```ts
throw new RuntimeError(
RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
ngDevMode && 'Injector has already been destroyed.');
```

PR Close #46382
2022-06-16 09:32:44 -07:00
Paul Gschwendtner
68597bb0ca feat(bazel): speed up dev-turnaround by bundling types only when packaging (#45405)
Speeds up the dev-turnaround by only bundling types when packaging. Currently
bundling occurs for all the `ng_module` targets in devmode.

This has various positive benefits:

* Avoidance of this rather slower operation in development
* Makes APF-built packages also handle types for `ts_library` targets consistently.
* Allows us to ensure APF entry-points have `d.ts` _always_ bundled (working with ESM
module resolution in TypeScript -- currently experimental)
* Allows us to remove the secondary `package.json` files from APF (maybe APF v14? - seems
low-impact). This would clean-up the APF even more and fix resolution issues (like in Vite)

PR Close #45405
2022-04-21 11:09:39 -07:00
dario-piotrowicz
3fceba4bd1 refactor(animations): include pushUnrecognizedPropertiesWarning in ngDevMode check (#45591)
the check for unsupported CSS properties has been made dev-mode-only in
PR #45570, so the check for the unsupportedCSSPRopertiesFound can be
moved inside a ngDevMode check so that more code can be treeshaken away

PR Close #45591
2022-04-11 21:06:03 +00:00
dario-piotrowicz
9572bb2ded refactor(animations): use full ngDevMode check in animatable prop validation (#45570)
in the `validateAnimatableStyleProperty` function use the more complete
check for the ngDevMode as it seems to be the preferred version
(see: https://github.com/angular/angular/pull/45212#discussion_r823045428)

PR Close #45570
2022-04-11 16:52:02 +00:00
dario-piotrowicz
a6fa37bc6e feat(animations): make validateStyleProperty check dev-mode only (#45570)
make the validateStyleProperty check dev-mode only so that it is
consistent with the validateAnimatableStyleProperty check introduced in
PR #45212

besides consistency this change also reduces the payload size and
increases performance (since less logic is executed)

original conversation: https://github.com/angular/angular/pull/45212#discussion_r818106737

PR Close #45570
2022-04-11 16:52:02 +00:00
Kristiyan Kostadinov
41223a81f2 build: update to jasmine 4.0 (#45558)
Updates us to version 4.0 of Jasmine and fixes some errors that were the result of us depending upon deprecated APIs. We need to do this both to stay up to date and because it was going to break eventually, because one of the Bazel packages was logging a deprecation warning that version 4.0 was required.

There were also some cases where the state of `ngDevMode` had started leaking out between tests.

PR Close #45558
2022-04-11 16:25:28 +00:00
Jessica Janiuk
7a37fe9f28 Revert "build: update to jasmine 4.0 (#45558)" (#45566)
This reverts commit a248df0682.

PR Close #45566
2022-04-08 19:07:29 +00:00
Kristiyan Kostadinov
a248df0682 build: update to jasmine 4.0 (#45558)
Updates us to version 4.0 of Jasmine and fixes some errors that were the result of us depending upon deprecated APIs. We need to do this both to stay up to date and because it was going to break eventually, because one of the Bazel packages was logging a deprecation warning that version 4.0 was required.

There were also some cases where the state of `ngDevMode` had started leaking out between tests.

PR Close #45558
2022-04-08 15:55:58 +00:00
Christoph Guttandin
a3f344ff6e test(animations): add test for buildAnimationAst() function (#31107)
This commit adds a test for the buildAnimationAst() function.

PR Close #31107
2022-04-05 08:41:38 -07:00
Christoph Guttandin
29d3891782 fix(animations): handle structured AnimateTimings (#31107)
This commit makes sure structured AnimateTimings are not procesed any further when building the AST.

Fixes: #22752

PR Close #31107
2022-04-05 08:41:38 -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
dario-piotrowicz
79d334b138 feat(animations): provide warnings for non-animatable CSS properties (#45212)
warn developers when they are trying to animate non-animatable CSS
properties so that can more easily understand why something is not being
animated as they would expect it to

resolves #27577

PR Close #45212
2022-03-21 14:33:19 -07:00
Kristiyan Kostadinov
2a75754ee8 fix(animations): apply default params when resolved value is null or undefined (#45339)
The animations package supports adding default parameter values to an animation that will be used as a fallback if some parameters aren't defined. The problem is that they're applied using a spread expression which means that any own property of the animation parameters will override the defaults, even if it resolves to null or undefined. This can lead to obscure errors like "Cannot read property toString of undefined" for an animation that looks like `{params: {foo: undefined}}` with defaults `{foo: 123}`.

I ran into this issue while debugging some test failures on Material.

These changes address the issue by:
1. Applying the defaults if the resolved value is null or undefined.
2. Updating the validation function to use a null check instead of `hasOwnProperty`.

PR Close #45339
2022-03-17 14:02:37 -07:00
Alan Agius
6eaaefd22e feat(core): drop support for Node.js 12 (#45286)
Node.js v12 will become EOL on 2022-04-30. As a result, Angular CLI v14 will no longer support Node.js v12.

BREAKING CHANGE:

Support for Node.js v12 has been removed as it will become EOL on 2022-04-30. Please use Node.js v14.15 or later.

PR Close #45286
2022-03-08 12:05:03 -08:00
dario-piotrowicz
f8dc660605 fix(animations): allow animations with unsupported CSS properties (#44729)
currently animations with unsupported CSS properties cause a hard error
and the crash of the animation itself, instead of this behaviour just
ignore such properties and provide a warning for the developer in
the console (only in dev mode)

this change also introduces a general way to present warnings
in the animations code

resolves #23195

PR Close #44729
2022-02-23 08:57:57 -08:00
JoostK
59559fdbac refactor(animations): make AnimationDriver.getParentElement required (#45114)
This change is a follow up to #45057 to make `AnimationDriver.getParentElement`
a required method, which allows removing the slow path for the animation
namespace insertion logic.

BREAKING CHANGE:

The `AnimationDriver.getParentElement` method has become required, so any
implementors of this interface are now required to provide an implementation
for this method. This breakage is unlikely to affect application developers,
as `AnimationDriver` is not expected to be implemented in user code.

PR Close #45114
2022-02-22 14:05:17 -08:00
JoostK
5c7c56bc85 perf(animations): improve algorithm to balance animation namespaces (#45057)
The prior approach would consider all existing namespaces from back to front
to find the one that's the closest ancestor for a given host element. An
expensive `contains` operation was used which needed to traverse all the
way up the document root _for each existing namespace_. This commit implements
an optimization where the closest namespace is found by traversing up from
the host element, avoiding repeated DOM traversal.

Closes #45055

PR Close #45057
2022-02-16 13:48:51 -08:00
dario-piotrowicz
3678434292 docs(animations): clarify information about query with :leave (#45059)
add information to the query api docs clarifying that elements with
a trigger can be queried via `:leave` when their parent is leaving

this exception is potentially something to be changed (see #45058)
but for the time being the docs can be updated to make the users
aware of such behavior

PR Close #45059
2022-02-14 14:05:22 -08:00
Jessica Janiuk
4c778cdb28 perf(animations): made errors in the animations package tree shakeable (#45004)
This moves all the error strings into exported functions that can be tree shaken away.

PR Close #45004
2022-02-09 11:43:42 -08:00
dario-piotrowicz
e46b379204 fix(animations): implement missing transition delay (#44799)
fix the transition function accepting a delay in its AnimationOptions
input but not acting on it by adding such delay to all the transition's
timelines

(note: adding the delay to all the transition's timelines is the only
way to accomplish this since transitions have their own logic and do not
have their own timelines like other animation functions have)

resolves #29762

PR Close #44799
2022-02-03 23:54:16 +00:00
Andrew Scott
fdfcef5a0a build: enable useUnknownInCatchVariables (#44679)
This unblocks the internal migration to turn the option on in g3.

PR Close #44679
2022-02-01 18:17:29 +00:00
Andrew Kushnir
6642e3c8fd perf(animations): remove no longer needed CssKeyframes classes (#44903)
This commit removes CSS keyframes-based code that was used to support animations in old browsers. With IE11 deprecation, all supported browsers have native WebAnimations support, so the old code can be removed. This results in ~7KB decrease of the animations package bundle size, since most of the code was non-tree-shakable.

Closes #44520.

PR Close #44903
2022-01-31 21:36:35 +00:00
Jessica Janiuk
7a81481fb2 perf(animations): Remove generic objects in favor of Maps (#44482)
We were using a number of generic objects as if they were maps and relying on delete to remove
properties. In order to improve performance, these have been switched to native maps.

PR Close #44482
2022-01-31 20:28:43 +00:00
dario-piotrowicz
ece530faf5 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
dario-piotrowicz
adc487fb75 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:50 -08:00
Jessica Janiuk
290df4f806 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
Dario Piotrowicz
8ba43a1a1e fix(animations): retain triggers values for moved tracked list items (#44578)
when reordering a list with animations the list items lose their current
triggers values, that is because the reordering of an item is implemented
as follows (_note:_ the following implementation has been added in PR #23534)
 - the item is removed and marked _setForRemoval_
 - the item is re-inserted, and the _setForRemoval_ is changed to _setForMove_
 - the player set for animating the removal is destroyed when _setForMove_ is detected

the above steps allow the element not to be animated and to keep its styling but the
triggers values get lost since the removal transition/player has already been initialized,
so this change adds a _previousTriggersValues_ map in the _REMOVAL_FLAG_ field in order to
restore the triggers values if/when the removal turns out to be a move, changing the above steps to:
 - the item is removed and marked setForRemoval __and its current triggers values are saved as well__
 - the item is re-inserted, and the setForRemoval is changed to setForMove
 - the player set for animating the removal is destroyed when setForMove is detected __and the
   trigger values are re-applied in the engine's statesByElement map__

resolves #29526

PR Close #44578
2022-01-07 22:15:52 +00:00
Yuchao Wu
7b9169e5e1 docs(animations): fix grammar (#44607)
Fix grammar issues based on suggestions in issue #44403

Fixes #44403

PR Close #44607
2022-01-06 18:40:02 +00:00
Dario Piotrowicz
b69a5148aa docs(animations): fix links to the AnimationBuilder.build method (#44594)
In angular.io links to the AnimationBuilder.build method are broken and do not
point to the api docs page, fix such broken links

Also apply minor wording and related improvements

PR Close #44594
2022-01-06 00:22:43 +00:00
Paul Gschwendtner
c46d533b22 build: switch devmode output to es2015 (#44505)
To make our test output i.e. devmode output more aligned
with what we produce in the NPM packages, or to be more
aligned with what Angular applications will usually consume,
the devmode output is switched from ES5 to ES2015.

Additionally various tsconfigs (outside of Bazel) have been
updated to match with the other parts of the build. The rules
are:

ES2015 for test configurations, ES2020 for actual code that will
end up being shipped (this includes the IDE-only tsconfigs).

PR Close #44505
2022-01-05 23:20:20 +00:00
dario-piotrowicz
7663dd082d docs(animations): add links to state() references (#44376)
the keyword 'state' is included in the `ignoredWords` set that prevents
certain words to be autolinked, this causes the animations' state
function not to be automatically linked, so manually link those
references to the state api docs

PR Close #44376
2022-01-04 12:19:08 -08:00
dario-piotrowicz
f394831ec4 refactor(animations): remove the unused enter and leave selectors (#44460)
remove the no longer used ENTER_SELECTOR and LEAVE_SELECTOR constants

note: their uses have been removed in PR #19455

PR Close #44460
2021-12-14 16:12:35 -05:00
dario-piotrowicz
f56ac0fe83 refactor(animations): improve _finalKeyframe non-null assertion (#44458)
instead of declaring the WebAnimationsPlayer's _finalKeyframe
field with a non-null assertion, declare it as optional field
and use a non-null assertion only when it is being used in the
beforeDestroy function

relates to #24571

PR Close #44458
2021-12-14 16:12:11 -05:00
dario-piotrowicz
38ddae1c2e fix(animations): don't consume instructions for animateChild (#44357)
TODO: Fill body commit if PR gets accepted

resolves #41483
resolves #30693

PR Close #44357
2021-12-14 16:05:35 -05:00
zuckjet
bab7ed3541 fix(animations): should not invoke disabled child animations (#37724)
Currently child animation will be triggered by `animateChild()` despite it has been disabled.
These changes add some logic to prevent that unexpected behavior.

PR Close #37724

PR Close #37724
2021-12-14 16:05:00 -05:00
dario-piotrowicz
92495060d2 docs(animations): improve animation transition api docs (#44396)
improve the transition api docs by removing unnecessary examplanations
and examples

also provide helpful information regarding entering and leaving
elements (as part of #44253)

PR Close #44396
2021-12-10 16:34:00 -05:00
Paul Gschwendtner
98c5063cd8 build: update visibility for npm package targets to work with new integration test structure (#44238)
As mentioned in the previous commit, integration tests will be declared
in subpackages of `//integration`. For these tests to still rely on the
NPM packages from `HEAD`, we need to update the visibility.

PR Close #44238
2021-12-08 13:42:41 -05:00
Kristiyan Kostadinov
6df314f3d9 refactor(animations): remove unnecessary code (#44378)
* The `TransitionAnimationEngine` had a fallback where it would store classes directly on a node if it doesn't have a `classList`. Presumably this is to support old browsers or if an animation is set on something like `ng-container`. This information was never used for anything since `containsClass` was never called. These changes simplify the logic to just a null check.
* Deprecates the `AnimationDriver.matchesElement` method, because it was only used in one place which can be replaced with `classList.contains`. We can't remove the method completely, because `AnimationDriver` is a public API. We also can't turn it into a method on the base class in order to remove it from the sub-classes, because it can break apps using `noImplicitOverride` while extending `AnimationDriver`.

PR Close #44378
2021-12-08 13:23:40 -05:00