import type { MaybeElementRef } from '@vueuse/core' ; import { unrefElement , useResizeObserver } from '@vueuse/core' ; export const useScrollStyle = ( target , cssVarName ) => { const scrollStyle = ref < string | null > ( null ) ; useResizeObserver ( target , ( ) => { const clientHeight = unrefElement ( target ) ?. clientHeight ; scrollStyle . value = clientHeight ? `--${ cssVarName }: calc(100vh - ${ clientHeight }px - 2px);` : null ; } ) ; return scrollStyle ; } ;