Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jan 3, 2023
1 parent d3ac60e commit fbae8e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions packages/core/_configurable.ts
Expand Up @@ -11,6 +11,13 @@ export interface ConfigurableDocument {
/*
* Specify a custom `document` instance, e.g. working with iframes or in testing environments.
*/
document?: Document
}

export interface ConfigurableDocumentOrShadowRoot {
/*
* Specify a custom `document` instance or a shadow root, e.g. working with iframes or in testing environments.
*/
document?: DocumentOrShadowRoot
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/useActiveElement/index.ts
@@ -1,9 +1,9 @@
import { computedWithControl } from '@vueuse/shared'
import { useEventListener } from '../useEventListener'
import type { ConfigurableDocument, ConfigurableWindow } from '../_configurable'
import type { ConfigurableDocumentOrShadowRoot, ConfigurableWindow } from '../_configurable'
import { defaultWindow } from '../_configurable'

export type UseActiveElementOptions = ConfigurableWindow & ConfigurableDocument
export interface UseActiveElementOptions extends ConfigurableWindow, ConfigurableDocumentOrShadowRoot {}

/**
* Reactive `document.activeElement`
Expand Down
2 changes: 1 addition & 1 deletion packages/core/useEventListener/index.ts
Expand Up @@ -63,7 +63,7 @@ export function useEventListener<E extends keyof WindowEventMap>(
* @param options
*/
export function useEventListener<E extends keyof DocumentEventMap>(
target: Document,
target: DocumentOrShadowRoot,
event: Arrayable<E>,
listener: Arrayable<(this: Document, ev: DocumentEventMap[E]) => any>,
options?: boolean | AddEventListenerOptions
Expand Down

0 comments on commit fbae8e1

Please sign in to comment.