import { Renderer } from './Renderer.js';
/**
 * FragmentRenderer is responsible for rendering a Fragment instance.
 * It extends the Renderer class and implements the rendering logic specific to Fragments.
 *
 * The fragment must decide how to render itself. Event when a fragment is a host
 * and it only shows a single child, it still needs to render that child.
 */
export class FragmentRenderer extends Renderer {
    fragment;
    constructor(fragment) {
        super();
        this.fragment = fragment;
    }
    renderer() {
        const root = this.renderRoot;
        if (!root) {
            // return quietly. Fragments can be rendered directly.
            return;
        }
        if (!this.firstRendered) {
            this.firstRenderedFlag = true;
            this._clearRoot(root);
            queueMicrotask(() => this.fragment.onFirstRender());
        }
        this._render(this.fragment.render(), root, this.fragment.host);
    }
}
//# sourceMappingURL=FragmentRenderer.js.map