Skip to content

Commit 82051f5

Browse files
authored
View Transition Class Names based on event kind (DefinitelyTyped#71642)
1 parent 78dca60 commit 82051f5

4 files changed

Lines changed: 66 additions & 2 deletions

File tree

types/react/experimental.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,21 @@ declare module "." {
136136
* Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node.
137137
*/
138138
className?: string | undefined;
139+
/**
140+
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is mounted and there's no other with the same name being deleted.
141+
* `"none"` is a special value that deactivates the view transition name under that condition.
142+
*/
143+
enter?: "none" | (string & {}) | undefined;
144+
/**
145+
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is unmounted and there's no other with the same name being deleted.
146+
* `"none"` is a special value that deactivates the view transition name under that condition.
147+
*/
148+
exit?: "none" | (string & {}) | undefined;
149+
/**
150+
* Combined with {@link className} there are no updates to the content inside this boundary itself but the boundary has resized or moved due to other changes to siblings.
151+
* `"none"` is a special value that deactivates the view transition name under that condition.
152+
*/
153+
layout?: "none" | (string & {}) | undefined;
139154
/**
140155
* "auto" will automatically assign a view-transition-name to the inner DOM node.
141156
* That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise.
@@ -165,6 +180,16 @@ declare module "." {
165180
*/
166181
onUpdate?: (instance: ViewTransitionInstance) => void;
167182
ref?: Ref<ViewTransitionInstance> | undefined;
183+
/**
184+
* Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.
185+
* `"none"` is a special value that deactivates the view transition name under that condition.
186+
*/
187+
share?: "none" | (string & {}) | undefined;
188+
/**
189+
* Combined with {@link className} if the content of this `<ViewTransition>` has changed either due to DOM mutations or because an inner child has resized.
190+
* `"none"` is a special value that deactivates the view transition name under that condition.
191+
*/
192+
update?: "none" | (string & {}) | undefined;
168193
}
169194

170195
/**

types/react/test/experimental.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,14 @@ function viewTransitionTests() {
143143
const ViewTransition = React.unstable_ViewTransition;
144144

145145
<ViewTransition />;
146-
<ViewTransition className="enter-slide-in exit-fade-out update-cross-fade" />;
146+
<ViewTransition
147+
className="enter-slide-in exit-fade-out update-cross-fade"
148+
enter="slide-from-left"
149+
exit="slide-to-right"
150+
layout="slide"
151+
update="none"
152+
share="cross-fade"
153+
/>;
147154
<ViewTransition name="auto" />;
148155
<ViewTransition name="foo" />;
149156
// autocomplete should display "auto"

types/react/ts5.0/experimental.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,21 @@ declare module "." {
136136
* Assigns the {@link https://developer.chrome.com/blog/view-transitions-update-io24#view-transition-class `view-transition-class`} class to the underlying DOM node.
137137
*/
138138
className?: string | undefined;
139+
/**
140+
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is mounted and there's no other with the same name being deleted.
141+
* `"none"` is a special value that deactivates the view transition name under that condition.
142+
*/
143+
enter?: "none" | (string & {}) | undefined;
144+
/**
145+
* Combined with {@link className} if this `<ViewTransition>` or its parent Component is unmounted and there's no other with the same name being deleted.
146+
* `"none"` is a special value that deactivates the view transition name under that condition.
147+
*/
148+
exit?: "none" | (string & {}) | undefined;
149+
/**
150+
* Combined with {@link className} there are no updates to the content inside this boundary itself but the boundary has resized or moved due to other changes to siblings.
151+
* `"none"` is a special value that deactivates the view transition name under that condition.
152+
*/
153+
layout?: "none" | (string & {}) | undefined;
139154
/**
140155
* "auto" will automatically assign a view-transition-name to the inner DOM node.
141156
* That way you can add a View Transition to a Component without controlling its DOM nodes styling otherwise.
@@ -165,6 +180,16 @@ declare module "." {
165180
*/
166181
onUpdate?: (instance: ViewTransitionInstance) => void;
167182
ref?: Ref<ViewTransitionInstance> | undefined;
183+
/**
184+
* Combined with {@link className} if this `<ViewTransition>` is being mounted and another instance with the same name is being unmounted elsewhere.
185+
* `"none"` is a special value that deactivates the view transition name under that condition.
186+
*/
187+
share?: "none" | (string & {}) | undefined;
188+
/**
189+
* Combined with {@link className} if the content of this `<ViewTransition>` has changed either due to DOM mutations or because an inner child has resized.
190+
* `"none"` is a special value that deactivates the view transition name under that condition.
191+
*/
192+
update?: "none" | (string & {}) | undefined;
168193
}
169194

170195
/**

types/react/ts5.0/test/experimental.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,14 @@ function viewTransitionTests() {
146146
const ViewTransition = React.unstable_ViewTransition;
147147

148148
<ViewTransition />;
149-
<ViewTransition className="enter-slide-in exit-fade-out update-cross-fade" />;
149+
<ViewTransition
150+
className="enter-slide-in exit-fade-out update-cross-fade"
151+
enter="slide-from-left"
152+
exit="slide-to-right"
153+
layout="slide"
154+
update="none"
155+
share="cross-fade"
156+
/>;
150157
<ViewTransition name="auto" />;
151158
<ViewTransition name="foo" />;
152159
// autocomplete should display "auto"

0 commit comments

Comments
 (0)