| 1 | /** |
| 2 | * <v-after/> click animations component |
| 3 | * |
| 4 | * Learn more: https://sli.dev/guide/animations.html#click-animation |
| 5 | */ |
| 6 | |
| 7 | import type { Directive, VNode } from 'vue' |
| 8 | import { toArray } from '@antfu/utils' |
| 9 | import { defineComponent, h, resolveDirective, withDirectives } from 'vue' |
| 10 | |
| 11 | export default defineComponent({ |
| 12 | render() { |
| 13 | const after = resolveDirective('after')! |
| 14 | |
| 15 | function applyDirective(node: VNode, directive: Directive) { |
| 16 | return withDirectives(node, [[directive]]) |
| 17 | } |
| 18 | |
| 19 | let defaults = this.$slots.default?.() |
| 20 | |
| 21 | if (!defaults) |
| 22 | return |
| 23 | |
| 24 | defaults = toArray(defaults) |
| 25 | |
| 26 | return defaults.map(i => applyDirective(h(i), after)) |
| 27 | }, |
| 28 | }) |
| 29 |