-
Notifications
You must be signed in to change notification settings - Fork 760
[css-view-transitions-2] Add transition types #9385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a3405ce
Transition types
noamr b02d663
Update css-view-transitions-2/Overview.bs
noamr 6b8226d
Update css-view-transitions-2/Overview.bs
noamr 20634f6
Semantic line break + remove UpdateCallback
noamr 7c63de3
Update css-view-transitions-2/Overview.bs
noamr fef8fa0
Update css-view-transitions-2/Overview.bs
noamr c17085d
Make conds more readable
noamr 04423df
Overload
noamr 51a3dd7
Added example
noamr 24ffc30
Fix union nullness
noamr d460f9b
nit
noamr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ spec:html | |
| text: run the animation frame callbacks; type: dfn; | ||
| text: unload; type: dfn; | ||
| text: update the rendering; type: dfn; | ||
| spec:infra; type:dfn; text:list | ||
| </pre> | ||
|
|
||
| <pre class=anchors> | ||
|
|
@@ -205,7 +206,56 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; | |
| ``` | ||
| </div> | ||
|
|
||
| # Pseudo-classes # {#pseudo-classes} | ||
|
|
||
| ## Active View Transition Pseudo-class '':active-view-transition()''' ## {#the-active-view-transition-pseudo} | ||
|
|
||
| The <dfn id='active-view-transition-pseudo'>:active-view-transition(<<vt-type-selector>>)</dfn> pseudo-class applies to the root element of the document, if it has a matching [=active view transition=]. | ||
| It has the following syntax definition: | ||
|
|
||
| <pre class=prod> | ||
| :active-view-transition(<<vt-type-selector>>) | ||
| <dfn><vt-type-selector></dfn> = '*' | <<custom-ident>># | ||
| </pre> | ||
|
|
||
| An ''::active-view-transition()'' pseudo-class matches the [=document element=] when it has an non-null [=active view transition=] |viewTransition|, for which any of the following are true: | ||
|
|
||
| * The <<vt-type-selector>> is ''*'' | ||
| * |viewTransition|'s [=ViewTransition/active types=] [=list/contains=] at least one of the <<custom-ident>> values of the <<vt-type-selector>>. | ||
|
|
||
| <div class=example> | ||
| For example, the developer might start a transition in the following manner: | ||
| ```js | ||
| document.startViewTransition({update: updateTheDOMSomehow, types: ["slide-in", "reverse"]}); | ||
| ``` | ||
|
|
||
| This will activate any of the following '::active-view-transition()'' selectors: | ||
| ```css | ||
| :root:active-view-transition(slide-in) {} | ||
| :root:active-view-transition(reverse) {} | ||
| :root:active-view-transition(slide-in, reverse) {} | ||
| :root:active-view-transition(slide-in, something-else) {} | ||
| :root:active-view-transition(*) {} | ||
| ``` | ||
|
|
||
| While starting a transition without selecting transition types, would only activate '::active-view-transition()'' with ''*'': | ||
|
|
||
| ```js | ||
| document.startViewTransition(updateTheDOMSomehow); | ||
| // or | ||
| document.startViewTransition({update: updateTheDOMSomehow}); | ||
| ``` | ||
|
|
||
| ```css | ||
| /* This would be active */ | ||
| :root { } | ||
| :root:active-view-transition(*) {} | ||
|
|
||
| /* This would not be active */ | ||
| :root:active-view-transition(slide-in) {} | ||
| :root:active-view-transition(any-type-at-all-except-star) {} | ||
| ``` | ||
| </div> | ||
|
|
||
| # CSS rules # {#css-rules} | ||
|
|
||
|
|
@@ -264,6 +314,34 @@ Note: this event is fired when [=reveal document|revealing a document=]. | |
| The <dfn attribute for=PageRevealEvent>viewTransition</dfn> [=getter steps=] are to return the | ||
| [=inbound cross-document view-transition=] for [=this's=] [=relevant global object's=] [=associated document=]. | ||
|
|
||
| ## Additions to {{Document}} ## {#additions-to-document-api} | ||
|
|
||
| <xmp class=idl> | ||
| dictionary StartViewTransitionOptions { | ||
| UpdateCallback? update = null; | ||
| sequence<DOMString>? types = null; | ||
| }; | ||
|
|
||
| partial interface Document { | ||
|
|
||
| ViewTransition startViewTransition((UpdateCallback or StartViewTransitionOptions?) callbackOptionsOrNull); | ||
| }; | ||
| </xmp> | ||
|
|
||
| ### {{Document/startViewTransition(options)}} Method Steps ### {#ViewTransition-start-with-options} | ||
|
|
||
| <div algorithm="start-vt-with-options"> | ||
| The [=method steps=] for <dfn method for=Document>startViewTransition(|callbackOptionsOrNull|)</dfn> are as follows: | ||
|
|
||
| 1. If |callbackOptionsOrNull| is an {{UpdateCallback}} or null, then run the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptionsOrNull| and return the result. | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given the comment above, these steps should also handle both situations by deferring to L1's algorithms as appropriate
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| 1. Let |viewTransition| be the result of running [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptionsOrNull|'s {{StartViewTransitionOptions/update}}. | ||
|
|
||
| 1. Set |transition|'s [=ViewTransition/active types=] to |callbackOptionsOrNull|'s {{StartViewTransitionOptions/types}}. | ||
|
|
||
| 1. Return |viewTransition|. | ||
| </div> | ||
|
|
||
|
|
||
|
|
||
| # Algorithms # {#algorithms} | ||
|
|
@@ -283,6 +361,9 @@ The <dfn attribute for=PageRevealEvent>viewTransition</dfn> [=getter steps=] are | |
| <dl dfn-for=ViewTransition> | ||
| : <dfn>is inbound cross-document transition</dfn> | ||
| :: a boolean, initially false. | ||
|
|
||
| : <dfn>active types</dfn> | ||
| :: Null or a [=list=] of strings, initially null. | ||
| </dl> | ||
|
|
||
| ## Monkey patches to HTML ## {#monkey-patch-to-html} | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.