import { nothing, type TemplateResult } from 'lit';
import { ActivityManager } from './ActivityManager.js';
import type { Activity } from './Activity.js';
import { ApplicationRenderer } from './renderer/ApplicationRenderer.js';
import { ThemeManager } from './ThemeManager.js';
/**
 * Allows to fine-tune the update request.
 * For example, if a `Fragment` wants to update only itself, then
 * list other types should be set to false.
 */
export interface UpdateRequest {
    /**
     * Whether the whole application should be updated.
     * Default to true.
     */
    app?: boolean;
    /**
     * Whether the activity should be updated.
     * Default to true.
     */
    activity?: boolean;
    /**
     * Whether the fragment should be updated.
     * Default to true.
     */
    fragment?: boolean;
}
/**
 * The application represents an application screen that hosts
 * Activities. Activities are managed by the Activity manager.
 *
 * An application is a separate app within the ecosystem. For example,
 * the file browser is one application. The domain designer is another.
 *
 * Each application manages it's own lifecycle. The application is rendered
 * by the lit's library `render()` function. Activities can call application's
 * main `requestUpdate()` function to render the entire application.
 *
 * Activities have the render function that renders its UI.
 * The Activity's UI can be composed of fragments, but this is optional.
 * When an activity uses fragments, they receive control over rendering their
 * UIs. An activity implementation has to take care of passing HTMLElement
 * references to their Fragments to make that happen. Otherwise, the activity
 * has to communicate with their fragments to request to re-render the application.
 */
export declare abstract class Application extends EventTarget {
    #private;
    private activityUpdateListener;
    /**
     * Application's theme manager.
     */
    get theme(): ThemeManager;
    /**
     * Returns the application's activity manager.
     */
    get manager(): ActivityManager;
    /**
     * The application main event bus.
     * All activities and fragments use it to communicate.
     * This way, events do not leak outside the application.
     */
    get events(): EventTarget;
    get renderer(): ApplicationRenderer;
    /**
     * @type A promise resolved when the render finished.
     */
    get updateComplete(): Promise<void> | undefined;
    /**
     * @type True when the application was first rendered.
     */
    get firstRendered(): boolean;
    /**
     * @param renderRoot The element or a CSS query to the element where the application will be rendered.
     */
    constructor(renderRoot: HTMLElement | string);
    /**
     * @see {@link ./Renderer.js}
     */
    setRenderRoot(renderRoot: HTMLElement | string): void;
    /**
     * Called when the application starts.
     * This is where you should start the initial Activity using
     * `ActivityManager.startActivity(...)`.
     */
    abstract onStart(): void | Promise<void>;
    /**
     * Called when the application is stopped/closed.
     * Perform cleanup here.
     */
    onStop(): void | Promise<void>;
    /**
     * Called when the application was rendered for the first time.
     * Call `super.onFirstRender()` when overriding this method.
     */
    onFirstRender(): void;
    /**
     * Called when the application was rendered.
     */
    onRendered(): void;
    /**
     * The main render method for the Application.  Called whenever an activity
     * requests an update. Renders the currently active Activity's content.
     *
     * If you override this method then any activity won't be rendered.
     *
     * @returns The Lit template to render.
     */
    render(): TemplateResult | typeof nothing;
    /**
     * Handles activity update requests and re-renders the application.
     */
    private handleActivityUpdate;
    /**
     * Requests an update of the application UI. This will call the `render()` method
     * and update the DOM.
     */
    requestUpdate(opts?: UpdateRequest): void;
    /**
     * Starts the application by calling onStart and performing an initial render.
     */
    run(): Promise<void>;
    /**
     * Stops the application, performing cleanup if necessary.
     */
    stop(): Promise<void>;
    getCurrentActivity(): Activity | undefined;
    /**
     * Unifies Fragment and Application interfaces.
     * @returns `this`
     */
    getApplication(): this;
    findActiveActivity(id: string): Activity | undefined;
}
//# sourceMappingURL=Application.d.ts.map