async function showWindow(data) {
  await setupWindow()
  return new Promise((resolve, reject) => {
    // do not open again if a window resolve is pending
    if (pendingWindowResolve) {
      return
    }

    // get thread dictionary
    let threadDictionary = NSThread.mainThread().threadDictionary()

    // nothing to show if the window doesn't exist
    let webView = threadDictionary['com.datapopulator.sketch.ui.web']
    if (!webView) return

    // store reference to resolve handler to call it later when window closes
    pendingWindowResolve = resolve

    // ask window to be shown with given data
    let windowObject = webView.windowScriptObject()
    let encodedData = Utils.encode(data)
    windowObject.evaluateWebScript(`window.callHandler('show', '${encodedData}')`)

    // NSApp.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo(threadDictionary['com.datapopulator.sketch.ui.window'], Context().document.window(), null, null, null)
  })
}
Gui

Provides functionality to create various user interface components.