feat(core): support IntersectionObserver options in viewport triggers#64130
feat(core): support IntersectionObserver options in viewport triggers#64130crisbeto wants to merge 6 commits intoangular:mainfrom
Conversation
b7057e9 to
8546617
Compare
packages/compiler-cli/src/ngtsc/typecheck/test/type_check_block_spec.ts
Outdated
Show resolved
Hide resolved
|
Is there any particular reason why the IntersectionObserver options must be a static object literal and cannot be dynamic, for example by using signals to customize them at runtime? |
|
It's because the |
…ters Currently we produce the string value of a defer `on` trigger by concatenating the string values of all of its tokens. This ends up ignoring whitespaces which in turn throws off source spans. These changes switch to producing the string by taking the text between the start and end tokens, as well as tracking the start index.
Updates the template parser and AST to capture a second object literal parameter on `viewport` triggers.
Updates the template type checker to check the options of the `viewport` trigger against `IntersectionObserver`.
Updates the template pipeline to support options for the `viewport` triggers.
8546617 to
9804ce7
Compare
| expect(diags.length).toBe(1); | ||
| expect(diags[0].messageText).toBe( | ||
| 'Trigger with no parameters can only be placed on an @defer that has a @placeholder block', | ||
| 'Trigger with no target can only be placed on an @defer that has a @placeholder block', |
thePunderWoman
left a comment
There was a problem hiding this comment.
LGTM
Just a couple of small comments.
Adds support for customizing the `IntersectionObserver` options for the `on viewport`, `prefetch on viewport` and `hydrate on viewport` triggers.
Note that the options need to be a static object literal, e.g. `@defer (on viewport(trigger, {rootMargin: '123px'})`.
Fixes angular#52799.
Updates the docs to mention the new options for the `viewport` trigger.
b88d4b0 to
3ce33ed
Compare
mturco
left a comment
There was a problem hiding this comment.
LGTM
Reviewed-for: primitives-shared
|
This PR was merged into the repository. The changes were merged into the following branches:
|
) Updates the template parser and AST to capture a second object literal parameter on `viewport` triggers. PR Close #64130
Updates the template type checker to check the options of the `viewport` trigger against `IntersectionObserver`. PR Close #64130
) Updates the template pipeline to support options for the `viewport` triggers. PR Close #64130
…#64130) Adds support for customizing the `IntersectionObserver` options for the `on viewport`, `prefetch on viewport` and `hydrate on viewport` triggers. Note that the options need to be a static object literal, e.g. `@defer (on viewport(trigger, {rootMargin: '123px'})`. Fixes #52799. PR Close #64130
Updates the docs to mention the new options for the `viewport` trigger. PR Close #64130
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds support for customizing the
IntersectionObserveroptions for theon viewport,prefetch on viewportandhydrate on viewporttriggers.Note that the options need to be a static object literal, e.g.
@defer (on viewport({trigger, rootMargin: '123px'}).Fixes #52799.