drei is fully open source, mrm for instance is here: https://github.com/pmndrs/drei/blob/6ddc5ec042f69e52106a66a8ebeeb78de38f60de/src/materials/MeshRefractionMaterial.tsx you could use it 1:1 because “shaderMaterial” is just a little helper function that creates a THREE.ShaderMaterial with all uniforms available as getter/setters. so no changes needed for it.
the trouble is that, as is often the case in vanilla, a class doesn’t really lend to packing away all the code and behaviour and in this case there’s some glue code needed: https://github.com/pmndrs/drei/blob/6ddc5ec042f69e52106a66a8ebeeb78de38f60de/src/core/MeshRefractionMaterial.tsx for instance Sampler2D and SamplerCube need different defines, the BVH stuff, etc. the component paradigm can abstract that all into a single thing <MeshRefractionMaterial />, but a class can’t. this code you’ll have to run over your shadermaterial after it exists.
in essence, get the material, copy the component code, it won’t be a problem. though this is one of hundred things that drei and fibers eco system offers. use react with three, this is the only way that you can participate in an eco system. the only reason MRM can be shared like that is because of the component paradigm.