Skip to content

Commit f4f5b53

Browse files
committed
updates
1 parent a752f9f commit f4f5b53

5 files changed

Lines changed: 57 additions & 49 deletions

File tree

package-lock.json

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
"@expressive-code/plugin-line-numbers": "^0.41.3",
1616
"@inox-tools/portal-gun": "^1.2.0",
1717
"@playwright/test": "^1.54.2",
18-
"@types/node": "^24.2.1",
18+
"@types/node": "^24.3.0",
1919
"@vtbag/cam-shaft": "^1.0.6",
2020
"@vtbag/element-crossing": "^1.1.0",
2121
"@vtbag/inspection-chamber": "^1.0.22",
2222
"@vtbag/turn-signal": "^1.3.1",
2323
"@vtbag/utensil-drawer": "^1.2.11",
24-
"astro": "^5.12.9",
24+
"astro": "^5.13.2",
2525
"astro-d2": "^0.8.0",
2626
"astro-og": "^0.3.0",
2727
"astro-vtbot": "^2.1.7",

src/components/TestPage.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@
5959
await document.startViewTransition().ready;
6060
document.getAnimations().forEach((a) => {
6161
if (a.animationName === "no-match-element") matchElement = false;
62-
});
62+
});
6363
document.documentElement.setAttribute("sdvt", "");
6464
matchElement && document.documentElement.setAttribute("vtnme", "");
6565
}
6666
"onpageswap" in window &&
6767
document.documentElement.setAttribute("cdvt", "");
68+
"activeViewTransition" in document &&
69+
document.documentElement.setAttribute("avt", "");
6870
sessionStorage.getItem("vtbag-pageswap-idx") &&
6971
document.documentElement.setAttribute("idx", "");
7072
CSS.supports("view-transition-class", "mine") &&

src/content/docs/basics/pseudos.mdx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ What are those pseudo-elements of the View Transition API and how can I style an
1414

1515
The key feature of the View Transition API is that it generates images for parts of your DOM and operates solely on those images. This enables the API to display sections of the old page exactly as they appeared before the transition began.
1616

17-
None of your actual DOM elements are directly visible during the transition. Everything is covered by the generated images, which are moved around in their own layer above your web page.
17+
Without further customization, none of your actual DOM elements are directly visible during the transition. Everything is covered by the generated images, which are moved around in their own layer above your web page.
1818

1919
## The Theater Curtain
2020

@@ -150,7 +150,7 @@ Now that we've covered the general concept, we can move on from the magic and di
150150

151151
## View Transition Names
152152

153-
You tell the view transition API which elements should be animated by assigning `view-transition-name` CSS properties to the HTML elements.
153+
You tell the view transition API which elements should be animated by assigning `view-transition-name` CSS properties to HTML elements. You can use inline styling or a stylesheet to assign the view transition name.
154154

155155
```html title="Assigning a view transition name using inline styling"
156156
<main style="view-transition-name: main">
@@ -162,12 +162,14 @@ main {
162162
}
163163
```
164164

165-
At the start of the view transition, the **view transition names have to be unique** in the DOM.
165+
Capturing of images happens in two passes. One captures images of the old DOM state before the view transition, and the other pass captures the new images of the target state.
166+
167+
For both passes, when the View Transition API captures the images to be animated, the **view transition names have to be unique** in the DOM.
166168

167169
There are two exceptions:
168-
- The API ignores the `view-transition-name` of a fragmented element, i.e. an element that consists of two or more boxes, like an inline element that spans two lines.
170+
- The API ignores the `view-transition-name` of a fragmented element, i.e. an element that consists of two or more boxes, like an inline element that spans two lines. View transition names assigned to such elements are ignored.
169171

170-
- The API ignores the `view-transition-name` of an element if that element is not rendered, like the `<head>`, or if it is skipped. For instance, you can use the same `view-transition-name` multiple times within the same DOM, provided that all but one instance have their `display` CSS property set to `none`. This can also be done by setting an HTML element's hidden attribute or property. Looking for an example? This technique is utilized in the intra-document [image morph examples](/basics/examples/#image-morph-examples) on this site. This trick also works with an ancestor with `content-visibility: hidden` but not with a simple `visibility: hidden` directly on the element.
172+
- The API also ignores the `view-transition-name` of an element if that element is not rendered, like the `<head>`, or if it is skipped. For instance, you can use the same `view-transition-name` multiple times within the same DOM, provided that all but one instance have their `display` CSS property set to `none`. This can also be done by setting an HTML element's hidden attribute or property. Looking for an example? This technique is utilized in the intra-document [image morph examples](/basics/examples/#image-morph-examples) on this site. This trick also works with an ancestor with `content-visibility: hidden` but not with a simple `visibility: hidden` directly on the element.
171173

172174

173175
The static user agent stylesheet provides one default name for the document, called `root`.
@@ -185,10 +187,12 @@ This default defines an animation for the current viewport. If you want to anima
185187
```
186188
The special value `none` removes a potentially set view transition name.
187189

188-
Other special names are [`match-element`](#auto-generated-names-match-element) and [`auto`](#auto-generated-names-auto), and all names beginning with `-ua-`.
190+
Other special names are [`match-element`](#auto-generated-names-match-element) and [`auto`](#auto-generated-names-auto), and all names beginning with `-ua-` as in _u_ser-_a_gent, as this is a reserved namespace for browser generated view transition names.
189191

190192
### Escaping
191-
Do not quote the names. They are not strings but [custom-ident](https://developer.mozilla.org/de/docs/Web/CSS/custom-ident) values. Ensure proper escaping of special characters. The simplest, most portable approach is to just use upper and lower case letters from A to Z, digits from 0 to 9, an underscore `_` or a hyphen `-` character. But don't start the name with a digit. While all other characters with a code < 128 need to be escaped, codes > 127 like 😄 seem to work just fine in view transition names. In browsers, you can use `CSS.escape()` to properly escape strings as custom identifiers.
193+
Do not quote the names. They are not strings but [custom-ident](https://developer.mozilla.org/de/docs/Web/CSS/custom-ident) values. Ensure proper escaping of special characters. The simplest, most portable approach is to just use upper and lower case letters from A to Z, digits from 0 to 9, an underscore `_` or a hyphen `-` character. But don't start the name with a positive or negative number.
194+
195+
While all other characters with a code < 128 need to be escaped, codes > 127 like 😄 seem to work just fine in view transition names. In browsers, you can use `CSS.escape()` to properly escape strings as custom identifiers.
192196

193197
It is not important to have much imagination when choosing names. They can be the similar to the `id` of an element or name of a unique tag like `body` or `footer`.
194198

src/content/docs/basics/test-page.mdx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ import TestPage from "../../../components/TestPage.astro";
1414

1515
This page shows whether your current browser <span id="browser"></span>has native support for view transitions and related APIs like the Navigation API and Speculation Rules.
1616

17-
| Feature | Support? |
18-
| ------------------------------------------------------------------------------------------------------------ | ----------------- |
19-
| [Same-document view transitions](https://drafts.csswg.org/css-view-transitions-1) | <span id="sdvt"/> |
20-
| [Cross-document view transitions](https://drafts.csswg.org/css-view-transitions-2) | <span id="cdvt"/> |
21-
| [PageSwapEvent.activation.\*.index](https://drafts.csswg.org/css-view-transitions-2/#old-doc-event) | <span id="idx"/> |
22-
| [view-transition-class](https://drafts.csswg.org/css-view-transitions-2/#view-transition-class-prop) | <span id="vtc"/> |
23-
| [view-transition-name: match-element](https://drafts.csswg.org/css-view-transitions-2/#additions-to-vt-name) | <span id="vtnme"/> |
24-
| [Nested view transition groups](https://drafts.csswg.org/css-view-transitions-2/#view-transition-group-prop) | <span id="vtg"/> |
17+
| Feature | Support? |
18+
| ------------------------------------------------------------------------------------------------------------------------ | ------------------ |
19+
| [Same-document view transitions](https://drafts.csswg.org/css-view-transitions-1) | <span id="sdvt"/> |
20+
| [Cross-document view transitions](https://drafts.csswg.org/css-view-transitions-2) | <span id="cdvt"/> |
21+
| [PageSwapEvent.activation.\*.index](https://drafts.csswg.org/css-view-transitions-2/#old-doc-event) | <span id="idx"/> |
22+
| [view-transition-class](https://drafts.csswg.org/css-view-transitions-2/#view-transition-class-prop) | <span id="vtc"/> |
23+
| [view-transition-name: match-element](https://drafts.csswg.org/css-view-transitions-2/#additions-to-vt-name) | <span id="vtnme"/> |
24+
| [Active view transition name](https://github.com/w3c/csswg-drafts/issues/12407) | <span id="avt"/> |
25+
| [Nested view transition groups](https://drafts.csswg.org/css-view-transitions-2/#view-transition-group-prop) | <span id="vtg"/> |
2526
| [View transition group children](https://drafts.csswg.org/css-view-transitions-2/#view-transition-group-children-pseudo) | <span id="vtgc"/> |
26-
| [Scoped view transitions](https://github.com/WICG/view-transitions/blob/main/scoped-transitions.md) | <span id="svt"/> |
27-
| [Navigation API](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API) | <span id="nav"/> |
28-
| [Speculation Rules](https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API) | <span id="spec"/> |
29-
27+
| [Scoped view transitions](https://github.com/WICG/view-transitions/blob/main/scoped-transitions.md) | <span id="svt"/> |
28+
| [Navigation API](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API) | <span id="nav"/> |
29+
| [Speculation Rules](https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API) | <span id="spec"/> |
3030

3131
<div class="test"></div>
3232
<div class="test-match-element"></div>
@@ -38,31 +38,33 @@ For browser compatibility data regarding the View Transition API see [the mdn pa
3838
[More pointers to interesting reads](/basics/api/#references).
3939

4040
<style>{`
41-
#sdvt,
41+
#avt,
4242
#cdvt,
43+
#idx,
4344
#nav,
44-
#vtnme,
45+
#sdvt,
46+
#spec,
47+
#svt,
4548
#vtc,
4649
#vtg,
4750
#vtgc,
48-
#idx,
49-
#svt,
50-
#spec {
51+
#vtnme {
5152
&::before {
5253
content: 'Not supported';
5354
}
5455
}
5556
56-
:root[sdvt] #sdvt,
57+
:root[avt] #avt,
5758
:root[cdvt] #cdvt,
59+
:root[idx] #idx,
5860
:root[nav] #nav,
61+
:root[sdvt] #sdvt,
62+
:root[spec] #spec,
63+
:root[svt] #svt,
5964
:root[vtc] #vtc,
6065
:root[vtg] #vtg,
6166
:root[vtgc] #vtgc,
62-
:root[vtnme] #vtnme,
63-
:root[idx] #idx,
64-
:root[svt] #svt,
65-
:root[spec] #spec
67+
:root[vtnme] #vtnme
6668
{
6769
&::before {
6870
content: 'Supported';

0 commit comments

Comments
 (0)