Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Vueuse #2674

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@pinia/nuxt": "0.2.1",
"@popperjs/core": "^2.11.2",
"@tailwindcss/typography": "^0.5.9",
"@vueuse/core": "^9.3.0",
"@vueuse/core": "^10.2.1",
"@wordpress/is-shallow-equal": "^4.6.0",
"async-mutex": "^0.3.2",
"axios": "^0.27.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/VHomeGallery/VHomeGallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import { computed, defineComponent, PropType, ref } from "vue"
import { useContext, useRouter } from "@nuxtjs/composition-api"

import { useReducedMotion } from "~/composables/use-media-query"
import { useReducedMotion } from "~/composables/use-reduced-motion"
import { useAnalytics } from "~/composables/use-analytics"
import useResizeObserver from "~/composables/use-resize-observer"

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/VLogoLoader/VLogoLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<script lang="ts">
import { defineComponent, PropType } from "vue"

import { useReducedMotion } from "~/composables/use-media-query"
import { useReducedMotion } from "~/composables/use-reduced-motion"

export default defineComponent({
name: "VLogoLoader",
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/composables/use-dialog-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
watch,
} from "vue"

import { MaybeComputedRef, resolveUnref } from "@vueuse/core"
import { MaybeRefOrGetter, toValue } from "@vueuse/core"

import { useBodyScrollLock } from "~/composables/use-body-scroll-lock"

Expand All @@ -25,7 +25,7 @@ export function useDialogControl({
nodeRef?: Ref<HTMLElement | null>
lockBodyScroll?: ComputedRef<boolean> | boolean
emit: SetupContext["emit"]
deactivateFocusTrap?: MaybeComputedRef<Fn | undefined>
deactivateFocusTrap?: MaybeRefOrGetter<Fn | undefined>
}) {
const internallyControlled = typeof visibleRef === "undefined"
const internalVisibleRef = internallyControlled ? ref(false) : visibleRef
Expand Down Expand Up @@ -71,7 +71,7 @@ export function useDialogControl({
const open = () => (internalVisibleRef.value = true)

const close = () => {
const fn = resolveUnref(deactivateFocusTrap)
const fn = toValue(deactivateFocusTrap)
if (fn) fn()
internalVisibleRef.value = false
}
Expand Down
45 changes: 0 additions & 45 deletions frontend/src/composables/use-event-listener.ts

This file was deleted.

102 changes: 0 additions & 102 deletions frontend/src/composables/use-media-query.ts

This file was deleted.

7 changes: 7 additions & 0 deletions frontend/src/composables/use-reduced-motion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useMediaQuery } from "@vueuse/core"
/**
* Check if the user prefers reduced motion or not.
*/
export function useReducedMotion() {
return useMediaQuery("(prefers-reduced-motion: reduce)")
}
2 changes: 1 addition & 1 deletion frontend/src/composables/use-window-scroll.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// code taken from Vueuse
import { throttle } from "throttle-debounce"
import { ref } from "vue"
import { useEventListener } from "@vueuse/core"

import { defaultWindow } from "~/constants/window"
import { useEventListener } from "~/composables/use-event-listener"

/**
* Whether the page has been scrolled down at all.
Expand Down
9 changes: 3 additions & 6 deletions frontend/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
:handle-search="handleSearch"
:search-type="searchType"
:set-search-type="setSearchType"
:is-sm="isSm"
/>

<!-- Image carousel -->
<VHomeGallery class="hidden h-full flex-grow xl:flex" />
<VHomeGallery v-if="isXl" class="flex h-full flex-grow" />
</main>
</template>

Expand Down Expand Up @@ -69,8 +68,7 @@ export default defineComponent({
updateBreakpoint()
})

const isDesktopLayout = computed(() => uiStore.isDesktopLayout)
const isSm = computed(() => uiStore.isBreakpoint("sm"))
const isXl = computed(() => uiStore.isBreakpoint("xl"))

const searchType = ref<SupportedSearchType>(ALL_MEDIA)

Expand All @@ -93,8 +91,7 @@ export default defineComponent({
}

return {
isDesktopLayout,
isSm,
isXl,

searchType,
setSearchType,
Expand Down
4 changes: 2 additions & 2 deletions frontend/test/unit/specs/components/v-logo-loader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { screen } from "@testing-library/vue"

import { render } from "~~/test/unit/test-utils/render"

import { useReducedMotion } from "~/composables/use-media-query"
import { useReducedMotion } from "~/composables/use-reduced-motion"

import VLogoLoader from "~/components/VLogoLoader/VLogoLoader.vue"

Expand All @@ -11,7 +11,7 @@ jest.mock("~/utils/console", () => ({
log: jest.fn(),
}))

jest.mock("~/composables/use-media-query", () => ({
jest.mock("~/composables/use-reduced-motion", () => ({
useReducedMotion: jest.fn(),
}))

Expand Down
45 changes: 30 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading