Prepositions normally precede nouns but, with the exception of the dialectic form “while supper time,” while isn’t used that way. So, by elimination, it has to be called a conjunction even though conjunctions are normally used to join similar parts: clauses to clauses, adjectives to adjectives, etc.
How would you diagram the following sentence?
John, while high on drugs, liked chestnuts when roasted.