Skip to content

Commit

Permalink
Merge pull request #419 from PrefectHQ/vue-3-3
Browse files Browse the repository at this point in the history
Remove some 3.3. shims
  • Loading branch information
collincchoy authored Apr 2, 2024
2 parents 48fb335 + 7ea01b6 commit 7448021
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 41 deletions.
4 changes: 1 addition & 3 deletions src/types/maybe.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Ref, UnwrapRef } from 'vue'
import { UnwrapRef } from 'vue'

export type MaybePromise<T = unknown> = T | Promise<T>
export type MaybeRef<T = unknown> = T | Ref<T>
export type MaybeUnwrapRef<T = unknown> = T | UnwrapRef<T>
export type MaybeRefOrGetter<T = unknown> = MaybeRef<T> | (() => T)
export type MaybeArray<T = unknown> = T | T[]
3 changes: 1 addition & 2 deletions src/useBoolean/useBoolean.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ref, Ref } from 'vue'
import { MaybeRef } from '@/types/maybe'
import { ref, Ref, MaybeRef } from 'vue'

type UseBoolean = {
value: Ref<boolean>,
Expand Down
4 changes: 1 addition & 3 deletions src/useClickOutside/useClickOutside.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { onScopeDispose } from 'vue'
import { MaybeRefOrGetter } from '@/types/maybe'
import { MaybeRefOrGetter, onScopeDispose, toValue } from 'vue'
import { useGlobalEventListener } from '@/useGlobalEventListener'
import { toValue } from '@/utilities/vue'

type ClickOutsideEntry = {
element: MaybeRefOrGetter<Element>,
Expand Down
4 changes: 1 addition & 3 deletions src/useEventListener/useEventListener.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { ref, watch } from 'vue'
import { MaybeRefOrGetter } from '@/types/maybe'
import { ref, watch, toValue, MaybeRefOrGetter } from 'vue'
import { tryOnScopeDispose } from '@/utilities/tryOnScopeDispose'
import { toValue } from '@/utilities/vue'

export type UseEventListener = {
add: () => void,
Expand Down
4 changes: 1 addition & 3 deletions src/useIntersectionObserver/useIntersectionObserver.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { onMounted, onUnmounted, ref, Ref, unref, watch } from 'vue'
import { MaybeRef, MaybeRefOrGetter } from '@/types/maybe'
import { toValue } from '@/utilities/vue'
import { onMounted, onUnmounted, ref, Ref, unref, watch, toValue, MaybeRef, MaybeRefOrGetter } from 'vue'

export type UseIntersectionObserverResponse = {
observe: (element: MaybeRefOrGetter<HTMLElement | undefined>) => void,
Expand Down
3 changes: 1 addition & 2 deletions src/useIsSame/useIsSame.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { computed, ComputedRef, ref } from 'vue'
import { MaybeRef } from '@/types/maybe'
import { computed, ComputedRef, ref, MaybeRef } from 'vue'
import { isSame } from '@/utilities/isSame'

export function useIsSame(valueA: MaybeRef, valueB: MaybeRef): ComputedRef<boolean> {
Expand Down
4 changes: 2 additions & 2 deletions src/useKeyDown/useKeyDown.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComputedRef, computed, reactive, unref } from 'vue'
import { MaybeArray, MaybeRef } from '@/types/maybe'
import { ComputedRef, computed, reactive, unref, MaybeRef } from 'vue'
import { MaybeArray } from '@/types/maybe'
import { asArray } from '@/utilities/arrays'
import { tryOnScopeDispose } from '@/utilities/tryOnScopeDispose'

Expand Down
3 changes: 1 addition & 2 deletions src/useNow/useNow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ref, Ref } from 'vue'
import { MaybeRef } from '@/types/maybe'
import { ref, Ref, MaybeRef } from 'vue'
import { tryOnScopeDispose } from '@/utilities/tryOnScopeDispose'

export type UseNow = {
Expand Down
6 changes: 2 additions & 4 deletions src/usePositionStickyObserver/usePositionStickyObserver.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Ref, computed, ref, watch } from 'vue'
import { MaybeRefOrGetter } from '@/types/maybe'
import { Ref, computed, ref, watch, toRef, toValue, MaybeRefOrGetter } from 'vue'
import { useIntersectionObserver } from '@/useIntersectionObserver'
import { toValue } from '@/utilities/vue'

export type UsePositionStickyObserverResponse = {
stuck: Ref<boolean>,
Expand All @@ -21,7 +19,7 @@ export function usePositionStickyObserver(
element: MaybeRefOrGetter<HTMLElement | undefined>,
options?: MaybeRefOrGetter<UsePositionStickyObserverOptions>,
): UsePositionStickyObserverResponse {
const elementRef = computed(() => toValue(element))
const elementRef = toRef(element)
const stuck = ref(false)

const observerOptions = computed(() => {
Expand Down
3 changes: 1 addition & 2 deletions src/useScrollLinking/useScrollLinking.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { onMounted, onUnmounted, ref, Ref } from 'vue'
import { MaybeRef } from '@/types/maybe'
import { onMounted, onUnmounted, ref, Ref, MaybeRef } from 'vue'

type DisconnectScrollLink = () => void
type UseScrollLinking = {
Expand Down
2 changes: 1 addition & 1 deletion src/useSubscription/types/subscription.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MaybeRef } from '@/types/maybe'
import { MaybeRef } from 'vue'
import { SubscriptionManager } from '@/useSubscription/models/manager'
import { Subscription } from '@/useSubscription/models/subscription'
import { Action, ActionArguments, ActionParamsRequired, ActionResponse } from '@/useSubscription/types/action'
Expand Down
3 changes: 1 addition & 2 deletions src/useSubscription/useSubscriptionWithDependencies.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import isEqual from 'lodash.isequal'
import { reactive, ref, Ref, toRaw, watch } from 'vue'
import { MaybeRef } from '@/types/maybe'
import { reactive, ref, Ref, toRaw, watch, MaybeRef } from 'vue'
import { Action, SubscriptionOptions, UseSubscription, ActionArguments, MappedSubscription } from '@/useSubscription/types'
import { useSubscription } from '@/useSubscription/useSubscription'

Expand Down
4 changes: 2 additions & 2 deletions src/useValidation/useValidation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { computed, onMounted, onUnmounted, reactive, ref, ToRefs, watch, unref, Ref, WatchStopHandle, toRef } from 'vue'
import { computed, onMounted, onUnmounted, reactive, ref, ToRefs, watch, unref, Ref, MaybeRef, MaybeRefOrGetter, WatchStopHandle, toRef } from 'vue'
import { NoInfer } from '@/types/generics'
import { MaybeArray, MaybePromise, MaybeRefOrGetter, MaybeRef } from '@/types/maybe'
import { MaybeArray, MaybePromise } from '@/types/maybe'
import { isValidationAbortedError } from '@/useValidation/ValidationAbortedError'
import { ValidationRuleExecutor } from '@/useValidation/ValidationExecutor'
import { ValidationObserverUnregister, VALIDATION_OBSERVER_INJECTION_KEY } from '@/useValidationObserver/useValidationObserver'
Expand Down
3 changes: 1 addition & 2 deletions src/useVisibilityObserver/useVisibilityObserver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { computed, onMounted, ref, Ref } from 'vue'
import { MaybeRef } from '@/types/maybe'
import { computed, onMounted, ref, Ref, MaybeRef } from 'vue'
import { useIntersectionObserver, UseIntersectionObserverOptions } from '@/useIntersectionObserver'

export type UseVisibilityObserverResponse = {
Expand Down
8 changes: 0 additions & 8 deletions src/utilities/vue.ts

This file was deleted.

0 comments on commit 7448021

Please sign in to comment.