rename methods to make phases more explicit

pull/18267/head
Rich Harris 2 months ago
parent 1ea3389f04
commit 45b12df4ac

@ -634,9 +634,9 @@ function reconcile(state, array, anchor, flags, get_key) {
// `getBoundingClientRect` read); batching brings the whole batch
// down to ~2 flushes total.
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.measure();
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.fix_size();
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.fix_position();
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.fix_transform();
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.capture_size();
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.set_position();
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.set_transform();
}
pause_effects(state, to_destroy, controlled_anchor);

@ -96,9 +96,9 @@ export function animation(element, get_fn, get_params) {
/** @type {null | { position: string, width: string, height: string, transform: string }} */
var original_styles = null;
/** Captured pre-absolute size, set by `fix_size`, consumed by `fix_position`. */
/** Captured pre-absolute size, set by `capture_size`, consumed by `set_position`. */
var frozen_width = '';
/** Captured pre-absolute size, set by `fix_size`, consumed by `fix_position`. */
/** Captured pre-absolute size, set by `capture_size`, consumed by `set_position`. */
var frozen_height = '';
nodes.a ??= {
@ -132,7 +132,7 @@ export function animation(element, get_fn, get_params) {
);
}
},
fix_size() {
capture_size() {
original_styles = null;
// If an animation is already running, transforming the element is likely to fail,
@ -160,7 +160,7 @@ export function animation(element, get_fn, get_params) {
frozen_width = width;
frozen_height = height;
},
fix_position() {
set_position() {
if (original_styles === null) return;
var style = /** @type {HTMLElement | SVGElement} */ (this.element).style;
@ -169,7 +169,7 @@ export function animation(element, get_fn, get_params) {
style.width = frozen_width;
style.height = frozen_height;
},
fix_transform() {
set_transform() {
if (original_styles === null) return;
var to = this.element.getBoundingClientRect();

@ -131,20 +131,20 @@ export interface AnimationManager {
* Pure read pass runs before any items have been mutated so the captured
* dimensions reflect the original layout (matters in flex/grid containers).
*/
fix_size: () => void;
capture_size: () => void;
/**
* Apply `position: absolute` and the captured size. Pure write pass runs
* after all items' sizes have been captured, so the layout invalidation
* is batched into a single subsequent flush.
*/
fix_position: () => void;
set_position: () => void;
/**
* Read the element's post-absolute bounding rect and apply a compensating
* transform so it visually stays at its captured-`from` position. The first
* call in a batch pays one layout flush; subsequent calls in the same
* batch are flush-free because `transform` is compositor-only.
*/
fix_transform: () => void;
set_transform: () => void;
/** Unfix the element position if the outro is aborted */
unfix: () => void;
}

Loading…
Cancel
Save