import { LitElement } from 'lit';
/**
 * @mixin
 * Mixin that ensures DOM is fully loaded before initializing component
 * Prevents components from querying or manipulating DOM elements before
 * they're available by deferring \`super.connectedCallback()\` until the DOM is ready.
 *
 * @example
 * ```typescript
 * import { ReadyMixin } from './ReadyMixin'
 *
 * // Basic usage
 * class MyComponent extends ReadyMixin(LitElement) {
 *   connectedCallback() {
 *     super.connectedCallback()
 *     // DOM is guaranteed to be ready here
 *     const child = this.querySelector('.child')
 *   }
 * }
 *
 * // With multiple mixins
 * class NavRail extends EventEmitterMixin(ReadyMixin(LitElement)) {
 *   // All mixins benefit from DOM-ready guarantee
 * }
 */
export const ReadyMixin = (superClass) => {
    class ReadyMixinClass extends superClass {
        connectedCallback() {
            const init = () => {
                super.connectedCallback();
            };
            if (document.readyState !== 'loading') {
                init();
            }
            else {
                document.addEventListener('DOMContentLoaded', () => init());
            }
        }
    }
    return ReadyMixinClass;
};
//# sourceMappingURL=ReadyMixin.js.map