import { compileCandidates } from './compile'
import type { DesignSystem } from './design-system'
export function getClassOrder(design: DesignSystem, classes: string[]): [string, bigint | null][] {
let { astNodes, nodeSorting } = compileCandidates(Array.from(classes), design)
let sorted = new Map<string, bigint | null>(classes.map((className) => [className, null]))
let idx = 0n
for (let node of astNodes) {
let candidate = nodeSorting.get(node)?.candidate
if (!candidate) continue
sorted.set(candidate, sorted.get(candidate) ?? idx++)
}
return classes.map((className) => [
className,
sorted.get(className) ?? null,
])
}