Skip to content

Commit

Permalink
fix(useElementVisibility)!: rename type `VisibilityScrollTargetOption…
Browse files Browse the repository at this point in the history
…s` to `UseElementVisibilityOptions` (#1863)
  • Loading branch information
okxiaoliang4 committed Jul 12, 2022
1 parent 1685675 commit 86df7a3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/core/useElementVisibility/directive.test.ts
Expand Up @@ -3,7 +3,7 @@ import type { VueWrapper } from '@vue/test-utils'
import { mount } from '@vue/test-utils'

import { vElementVisibility } from './directive'
import type { VisibilityScrollTargetOptions } from '.'
import type { UseElementVisibilityOptions } from '.'

const App = defineComponent({
props: {
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('vElementVisibility', () => {
describe('given options', () => {
beforeEach(() => {
onVisibility = vi.fn()
const options: VisibilityScrollTargetOptions = {
const options: UseElementVisibilityOptions = {
scrollTarget: document.body,
}
wrapper = mount(App, {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/useElementVisibility/directive.ts
Expand Up @@ -2,12 +2,12 @@ import { watch } from 'vue-demi'
import { directiveHooks } from '@vueuse/shared'
import type { ObjectDirective } from 'vue-demi'

import type { VisibilityScrollTargetOptions } from '.'
import type { UseElementVisibilityOptions } from '.'
import { useElementVisibility } from '.'

type BindingValueFunction = (state: boolean) => void

type BindingValueArray = [BindingValueFunction, VisibilityScrollTargetOptions]
type BindingValueArray = [BindingValueFunction, UseElementVisibilityOptions]

export const vElementVisibility: ObjectDirective<
HTMLElement,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/useElementVisibility/index.ts
Expand Up @@ -6,7 +6,7 @@ import { useEventListener } from '../useEventListener'
import type { ConfigurableWindow } from '../_configurable'
import { defaultWindow } from '../_configurable'

export interface VisibilityScrollTargetOptions extends ConfigurableWindow {
export interface UseElementVisibilityOptions extends ConfigurableWindow {
scrollTarget?: MaybeComputedRef<HTMLElement | undefined | null>
}

Expand All @@ -19,7 +19,7 @@ export interface VisibilityScrollTargetOptions extends ConfigurableWindow {
*/
export function useElementVisibility(
element: MaybeComputedElementRef,
{ window = defaultWindow, scrollTarget }: VisibilityScrollTargetOptions = {},
{ window = defaultWindow, scrollTarget }: UseElementVisibilityOptions = {},
) {
const elementIsVisible = ref(false)

Expand Down

0 comments on commit 86df7a3

Please sign in to comment.