I've been tinkering a bit more with the feature, but since I wanna do more stuff in javascript I was bit limited since there's no API for the flowchart (yet). But the point is I just couldn't resist finding some ways to circumvent the restrictions with the power of javascript. Thought I'd share.
The ~ denotes an option with an expression inside and I use eval() to then execute the logic inside the value. If the result is an empty string, the option is not added.
async function addOption(optionName, optionValue) {
var evalOption = /^~/i;
if(evalOption.test(optionName)) {
optionValue = eval(optionValue);
if(optionValue === "") return;
await globalThis.UImain.insertContent(`<div class="option" id="${optionName}">${optionValue}</div>`, "html", true, ".options");
}
}
It's moderatly elegant I'd argue unless you're scared of eval() lol.