Thanks for that, I got it working in a flow - that uses the ClientCode node that executes frontend Javascript from a backend trigger. So I took what Nick had done and put it in a client-code node with an inject node attached.
Now anyone who wants an initial layout engine can copy the nodes from the flow above. (Sorry for the own advertising but the flow might genuinely help!)