Skip to content

Commit

Permalink
fix(useResizeObserver)!: rename type ResizeObserverOptions to `UseR…
Browse files Browse the repository at this point in the history
…esizeObserverOptions` (#1862)
  • Loading branch information
okxiaoliang4 committed Jul 12, 2022
1 parent 4d887e4 commit 28db2bc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/core/useElementBounding/component.ts
@@ -1,9 +1,9 @@
import { defineComponent, h, reactive, ref } from 'vue-demi'
import { useElementBounding } from '@vueuse/core'
import type { ResizeObserverOptions } from '../useResizeObserver'
import type { UseResizeObserverOptions } from '../useResizeObserver'
import type { RenderableComponent } from '../types'

export const UseElementBounding = defineComponent<ResizeObserverOptions & RenderableComponent>({
export const UseElementBounding = defineComponent<UseResizeObserverOptions & RenderableComponent>({
name: 'UseElementBounding',
props: ['box', 'as'] as unknown as undefined,
setup(props, { slots }) {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/useElementSize/component.ts
Expand Up @@ -2,9 +2,9 @@ import { defineComponent, h, reactive, ref } from 'vue-demi'
import type { ElementSize } from '@vueuse/core'
import { useElementSize } from '@vueuse/core'
import type { RenderableComponent } from '../types'
import type { ResizeObserverOptions } from '../useResizeObserver'
import type { UseResizeObserverOptions } from '../useResizeObserver'

export const UseElementSize = defineComponent<ElementSize & ResizeObserverOptions & RenderableComponent>({
export const UseElementSize = defineComponent<ElementSize & UseResizeObserverOptions & RenderableComponent>({
name: 'UseElementSize',
props: ['width', 'height', 'box'] as unknown as undefined,
setup(props, { slots }) {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/useElementSize/index.ts
@@ -1,6 +1,6 @@
import { ref, watch } from 'vue-demi'
import type { MaybeComputedElementRef } from '../unrefElement'
import type { ResizeObserverOptions } from '../useResizeObserver'
import type { UseResizeObserverOptions } from '../useResizeObserver'
import { useResizeObserver } from '../useResizeObserver'
import { unrefElement } from '../unrefElement'

Expand All @@ -20,7 +20,7 @@ export interface ElementSize {
export function useElementSize(
target: MaybeComputedElementRef,
initialSize: ElementSize = { width: 0, height: 0 },
options: ResizeObserverOptions = {},
options: UseResizeObserverOptions = {},
) {
const width = ref(initialSize.width)
const height = ref(initialSize.height)
Expand Down
6 changes: 3 additions & 3 deletions packages/core/useResizeObserver/index.ts
Expand Up @@ -21,7 +21,7 @@ export interface ResizeObserverEntry {

export type ResizeObserverCallback = (entries: ReadonlyArray<ResizeObserverEntry>, observer: ResizeObserver) => void

export interface ResizeObserverOptions extends ConfigurableWindow {
export interface UseResizeObserverOptions extends ConfigurableWindow {
/**
* Sets which box model the observer will observe changes to. Possible values
* are `content-box` (the default), and `border-box`.
Expand All @@ -34,7 +34,7 @@ export interface ResizeObserverOptions extends ConfigurableWindow {
declare class ResizeObserver {
constructor(callback: ResizeObserverCallback)
disconnect(): void
observe(target: Element, options?: ResizeObserverOptions): void
observe(target: Element, options?: UseResizeObserverOptions): void
unobserve(target: Element): void
}

Expand All @@ -49,7 +49,7 @@ declare class ResizeObserver {
export function useResizeObserver(
target: MaybeComputedElementRef,
callback: ResizeObserverCallback,
options: ResizeObserverOptions = {},
options: UseResizeObserverOptions = {},
) {
const { window = defaultWindow, ...observerOptions } = options
let observer: ResizeObserver | undefined
Expand Down

0 comments on commit 28db2bc

Please sign in to comment.