A 14-year-old girl who attempted to murder two teachers and a pupil at a school in Wales has been sentenced to 15 years in detention.