The feature seems useful and the code looks good. Referencing subfigures is cool btw. I took the liberty of reformatting your example into the usual documentation format and including it in the relevant file. I also copied your code into env-float.ts (changing the name to sub-figure to adapt to what seems the convention for those macros) and wrote the necessary menu item and everything seems fine.

The result of all this is in the attached patch.

There are two issues that must be addressed:
*Unnumbered versions of the macros must be implemented.
*Should the menu item be available outside a figure environment?