Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x | /** @import { Expression } from 'estree' */
/** @import { AnimateDirective } from '#compiler' */
/** @import { ComponentContext } from '../types' */
import * as b from '../../../../utils/builders.js';
import { parse_directive_name } from './shared/utils.js';
 
/**
 * @param {AnimateDirective} node
 * @param {ComponentContext} context
 */
export function AnimateDirective(node, context) {
	const expression =
		node.expression === null
			? b.literal(null)
			: b.thunk(/** @type {Expression} */ (context.visit(node.expression)));
 
	// in after_update to ensure it always happens after bind:this
	context.state.after_update.push(
		b.stmt(
			b.call(
				'$.animation',
				context.state.node,
				b.thunk(/** @type {Expression} */ (context.visit(parse_directive_name(node.name)))),
				expression
			)
		)
	);
}
  |