import { Ref$ } from '@usels/core'; import { Observable, OpaqueObject } from '@legendapp/state'; /** Window를 resolve할 수 있는 소스 타입 */ type WindowSource = Window | Ref$; interface ConfigurableWindow { window?: WindowSource; } interface ConfigurableDocumentOrShadowRoot { document?: DocumentOrShadowRoot; } declare const defaultWindow: (Window & typeof globalThis) | undefined; declare const defaultDocument: Document | undefined; declare const defaultNavigator: Navigator | undefined; declare const defaultLocation: Location | undefined; /** * Reactive `WindowSource` resolver. Given the `window` field of an options * observable (e.g. `opts$.window`), returns a computed * `Observable | null>` that recomputes whenever the * source observable changes (iframe ref mounting/unmounting, observable * options replacement, etc.). * * Usage inside a scope-based core: * ```ts * const win$ = resolveWindowSource(opts$.window); * const isSupported$ = createSupported(() => { * const win = win$.get(); // reactive * return !!win && "matchMedia" in win; * }); * onMount(() => { * const win = win$.peek(); // non-reactive snapshot at mount * if (!win) return; * // ... * }); * ``` * * The returned observable holds `null` when no window can be resolved (SSR, * detached iframe) and an opaque-wrapped `Window` otherwise. The opaque * wrapping prevents Legend-State from deep-proxying the `Window` object — * property access (`win.matchMedia`, `win.speechSynthesis`, etc.) still works * directly because `OpaqueObject` is `T & { [symbolOpaque]: true }`. */ declare function resolveWindowSource(source$: Observable): Observable | null>; export { type ConfigurableDocumentOrShadowRoot, type ConfigurableWindow, type WindowSource, defaultDocument, defaultLocation, defaultNavigator, defaultWindow, resolveWindowSource };