How to programmatically add subgrid to Gridstack?

I’m working with Gridstack.js and I’ve hit a snag. I’ve been through the documentation and even checked their nested grid demo, but I couldn’t find specific guidance on how to programmatically add a subgrid to an existing main Gridstack instance.

I’m looking for a way to dynamically add a subgrid as a direct child of my main Gridstack instance. Ideally, the subgrid should be able to set its own gridstack options independently of the main grid.

Of course, none of these methods exist, but In my mind it should be something like this:

const subGridOptions = {...};
const subGrid = mainGridstackInstance.createGrid(subGridOptions);
mainGridstackInstance.createGrid.addGrid(subGrid);
// at some point later...
subGrid.addWidget(...);

Has anyone encountered a similar challenge or can provide some insights on how to accomplish this?