docs: function resolveInputToStream(input, globals) {
    let vdom$;
    if (isStream(input)) {
      // resolve downstream components
      vdom$ = input
        .flatMap(input => {
          let resolved = resolveChild(input, globals);
  
          // resolvedChild can return an array of elements but we expect only one
          // TODO make this better
          if (Array.isArray(resolved)) {
            resolved = resolved[0];
          }
  
          // because we are flatMapping we need to return streams
          if (!isStream(resolved)) {
            return stream(resolved);
          }
  
          return resolved;
        })
        // a resolved input could return an array but we expect the vdom$
        // to return just one root vdom elem
        .map(x => {
          if (Array.isArray(x)) {
            x = x[0];
          }
          return x;
        });
      return vdom$;
    }
  
    if (input instanceof Component) {
      vdom$ = input.build(globals);
      vdom$ = resolveInputToStream(vdom$, globals);
      return vdom$;
    } else if (typeof input === "function") {
      // simple element constructor
      vdom$ = input({}, [], globals);
    }
  
    // reiterate if still not a vdom-stream
    if (!isStream(vdom$)) vdom$ = resolveInputToStream(vdom$, globals);
  
    return vdom$;
  }