How to make a material mask with gradient borders?

Hi, I’m trying to make a simple mask that has gradient transitions near the borders, which I can use it as an opacity map and apply it to a plane object, so it fades out near the edges and blends in with whatever’s behind it, but I’m not so familiar with texture nodes. I made this image on photoshop, but I wanted to recreate this with nodes so it would probably be cheaper, and better quality as I wouldn’t rely on bitmap resolution that would result in pixel bands and artifacts etc, and I’d have more control in real time. How can I make such thing?

I’d start with that:

Quite a flexible little thing this is.