Files
headlessui/packages/@headlessui-vue/src/test-utils/report-dom-node-changes.ts
T
Robin Malfait 0a39cf6b22 Transition component (#326)
* add redent function when verifying snapshots

This allows us not to care about the correct amount of spaces and always
produces a clean output.

* make the container the parent of the wrapper element

* drop the visible prop on the Portal component

* drop visible prop on Portal component

+ Also cleanup a little bit

* expose the RenderStrategy

* implement Transition component in Vue

* expose Transition component

* add Transitions to the Dialog example
2021-04-12 23:40:42 +02:00

21 lines
383 B
TypeScript

import { disposables } from '../utils/disposables'
export function reportChanges<TType>(key: () => TType, onChange: (value: TType) => void) {
let d = disposables()
let previous: TType
function track() {
let next = key()
if (previous !== next) {
previous = next
onChange(next)
}
d.requestAnimationFrame(track)
}
track()
return d.dispose
}