Skip to content

Commit bcef7b1

Browse files
committed
vue 3
1 parent 37e8ab0 commit bcef7b1

32 files changed

+370
-462
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
node: true
55
},
66
extends: [
7-
'plugin:vue/recommended',
7+
'plugin:vue/vue3-recommended',
88
'eslint:recommended',
99
'@vue/standard',
1010
'@vue/typescript',

package.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,24 @@
99
},
1010
"dependencies": {
1111
"@iconify-icons/bi": "^1.2.2",
12+
"@ts-pro/vue-eternal-loading": "^1.1.1",
1213
"@vueuse/core": "^11.1.0",
1314
"bootstrap": "^5.3.3",
14-
"bootstrap-vue": "^2.23.1",
15+
"bootstrap-vue-next": "^0.26.28",
1516
"icecast-metadata-stats": "^0.1.1",
1617
"lodash-es": "^4.17.21",
1718
"md5-es": "^1.8.2",
18-
"pinia": "^2.0.28",
19-
"vue": "^2.7.0",
19+
"pinia": "^3.0.1",
20+
"vue": "^3.2.31",
2021
"vue-infinite-loading": "^2.4.5",
21-
"vue-router": "^3.5.2",
22-
"vue-slider-component": "^3.2.22"
22+
"vue-router": "^4.0.0",
23+
"vue-slider-component": "^4.1.0-beta.7"
2324
},
2425
"devDependencies": {
2526
"@types/lodash-es": "^4.17.6",
2627
"@typescript-eslint/eslint-plugin": "^5.18.0",
2728
"@typescript-eslint/parser": "^5.18.0",
28-
"@vitejs/plugin-vue2": "^2.3.3",
29+
"@vitejs/plugin-vue": "^5.2.1",
2930
"@vue/eslint-config-standard": "^8.0.1",
3031
"@vue/eslint-config-typescript": "^11.0.2",
3132
"autoprefixer": "^10.4.20",
@@ -39,7 +40,7 @@
3940
"sass": "^1.34.0",
4041
"typescript": "^5.0.4",
4142
"vite": "^6.1.0",
42-
"vite-plugin-checker": "^0.8.0",
43+
"vite-plugin-checker": "^0.9.0",
4344
"vue-tsc": "^2.2.2"
4445
},
4546
"postcss": {

src/app/ErrorToast.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<script lang="ts">
1919
import { computed, defineComponent } from 'vue'
2020
import { useMainStore } from '@/shared/store'
21-
import { BToast } from 'bootstrap-vue'
21+
import { BToast } from 'bootstrap-vue-next'
2222
2323
export default defineComponent({
2424
components: {

src/auth/Login.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import Logo from '@/app/Logo.vue'
4444
import { useMainStore } from '@/shared/store'
4545
import { useAuth } from '@/auth/service'
46-
import { BOverlay } from 'bootstrap-vue'
46+
import { BOverlay } from 'bootstrap-vue-next'
4747
4848
export default defineComponent({
4949
components: {

src/auth/service.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { md5, randomString, toQueryString } from '@/shared/utils'
22
import { config } from '@/shared/config'
3-
import { inject } from 'vue'
4-
import { App, PluginObject } from '@/shared/compat'
3+
import { App, Plugin, inject } from 'vue'
54
import { pickBy } from 'lodash-es'
65

76
type Auth = { password?: string, salt?: string, hash?: string }
@@ -144,7 +143,7 @@ export function useAuth(): AuthService {
144143
return inject(apiSymbol) as AuthService
145144
}
146145

147-
export function createAuth(): AuthService & PluginObject<never> {
146+
export function createAuth(): AuthService & Plugin {
148147
const instance = new AuthService()
149148
return Object.assign(instance, {
150149
install: (app: App) => {

src/global.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ declare module '*.svg';
22
declare module 'md5-es';
33
declare module 'vue-slider-component';
44
declare module 'icecast-metadata-stats';
5+
declare module 'bootstrap-vue-next';

src/library/album/AlbumList.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
:draggable="true" @dragstart="dragstart(item.id, $event)"
99
>
1010
<template #text>
11-
<template v-for="(artist, index) in item.artists">
11+
<template v-for="(artist, index) in item.artists" :key="artist.id">
1212
<span v-if="index > 0" :key="artist.id" class="text-muted">, </span>
13-
<router-link :key="`${artist.id}-link`" :to="{name: 'artist', params: { id: artist.id }}" class="text-muted">
13+
<router-link :to="{name: 'artist', params: { id: artist.id }}" class="text-muted">
1414
{{ artist.name }}
1515
</router-link>
1616
</template>

src/library/artist/ArtistList.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<template functional>
1+
<template>
22
<Tiles>
3-
<Tile v-for="item in props.items" :key="item.id"
3+
<Tile v-for="item in $attrs.items" :key="item.id"
44
:to="{name: 'artist', params: { id: item.id } }"
55
:title="item.name" :image="item.image">
66
<template #text>

src/library/favourite/store.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Vue from 'vue'
21
import { defineStore } from 'pinia'
32

43
type MediaType = 'track' | 'album' | 'artist'
@@ -20,10 +19,11 @@ export const useFavouriteStore = defineStore('favourite', {
2019
toggle(type: MediaType, id: string) {
2120
const field = getTypeKey(type)
2221
if (this[field][id]) {
23-
Vue.delete(this[field], id)
22+
// TODO
23+
delete this[field][id]
2424
return this.api.removeFavourite(id, type)
2525
} else {
26-
Vue.set(this[field], id, true)
26+
this[field][id] = true
2727
return this.api.addFavourite(id, type)
2828
}
2929
},

src/library/radio/RadioStations.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<EmptyIndicator v-else-if="unsupported" label="Not supported" />
2424
<EmptyIndicator v-else />
2525

26-
<EditModal :visible.sync="modalVisible" :item="editItem" @confirm="saveRadioStation">
26+
<EditModal v-model:visible="modalVisible" :item="editItem" @confirm="saveRadioStation">
2727
<template #title="{ item }">
2828
{{ item?.id ? "Edit" : "Add" }} Radio Station
2929
</template>

src/library/track/BaseTable.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template functional>
1+
<template>
22
<table class="table table-hover table-borderless table-numbered">
33
<slot />
44
</table>

src/library/track/BaseTableHead.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template functional>
1+
<template>
22
<thead>
33
<tr>
44
<th>#</th>

src/library/track/CellAlbum.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<template functional>
1+
<template>
22
<td class="d-none d-md-table-cell">
3-
<template v-if="props.track.albumId">
4-
<router-link :to="{name: 'album', params: {id: props.track.albumId}}" @click.native.stop>
5-
{{ props.track.album }}
3+
<template v-if="$attrs.track.albumId">
4+
<router-link :to="{name: 'album', params: {id: $attrs.track.albumId}}" @click.stop>
5+
{{ $attrs.track.album }}
66
</router-link>
77
</template>
88
<template v-else>
9-
{{ props.track.album }}
9+
{{ $attrs.track.album }}
1010
</template>
1111
</td>
1212
</template>

src/library/track/CellArtist.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<template functional>
1+
<template>
22
<td class="d-none d-lg-table-cell">
3-
<template v-for="(artist, index) in props.track.artists">
3+
<template v-for="(artist, index) in $attrs.track.artists" :key="artist.id">
44
<span v-if="index > 0" :key="artist.id">, </span>
5-
<router-link v-if="artist.id" :key="`${artist.id}-link`" :to="{name: 'artist', params: { id: artist.id }}">
5+
<router-link v-if="artist.id" :to="{name: 'artist', params: { id: artist.id }}">
66
{{ artist.name }}
77
</router-link>
88
<template v-else>

src/library/track/CellTrackNumber.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<template functional>
1+
<template>
22
<td>
33
<button>
4-
<Icon class="icon" :icon="props.active ? 'pause' :'play'" />
5-
<span class="number">{{ props.value || '-' }}</span>
4+
<Icon class="icon" :icon="$attrs.active ? 'pause' :'play'" />
5+
<span class="number">{{ $attrs.value || '-' }}</span>
66
</button>
77
</td>
88
</template>

src/main.ts

+13-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1+
import { createApp, markRaw, watch } from 'vue'
12
import '@/style/main.scss'
2-
import Vue, { markRaw, watch } from 'vue'
3-
import Router from 'vue-router'
43
import AppComponent from '@/app/App.vue'
5-
import { createApp } from '@/shared/compat'
64
import { components } from '@/shared/components'
75
import { setupRouter } from '@/shared/router'
86
import { useMainStore } from '@/shared/store'
97
import { API } from '@/shared/api'
108
import { createAuth } from '@/auth/service'
119
import { setupAudio, usePlayerStore } from './player/store'
1210
import { createApi } from '@/shared'
13-
import { createPinia, PiniaVuePlugin } from 'pinia'
11+
import { createPinia } from 'pinia'
1412
import { useFavouriteStore } from '@/library/favourite/store'
1513
import { usePlaylistStore } from '@/library/playlist/store'
1614

17-
declare module 'vue/types/vue' {
18-
interface Vue {
15+
declare module '@vue/runtime-core' {
16+
interface ComponentCustomProperties {
17+
$router: typeof router
1918
$api: API
2019
}
2120
}
@@ -26,17 +25,12 @@ declare module 'pinia' {
2625
}
2726
}
2827

29-
Vue.use(Router)
30-
Vue.use(PiniaVuePlugin)
31-
3228
const auth = createAuth()
3329
const api = createApi(auth)
3430
const router = setupRouter(auth)
3531

3632
const pinia = createPinia()
37-
.use(({ store }) => {
38-
store.api = markRaw(api)
39-
})
33+
.use(() => ({ api: markRaw(api) }))
4034

4135
const mainStore = useMainStore(pinia)
4236
const playerStore = usePlayerStore(pinia)
@@ -50,7 +44,8 @@ watch(
5044
return Promise.all([
5145
useFavouriteStore().load(),
5246
usePlaylistStore().load(),
53-
playerStore.loadQueue(),
47+
// TODO
48+
// playerStore.loadQueue(),
5449
])
5550
}
5651
})
@@ -60,14 +55,16 @@ router.beforeEach((to, from, next) => {
6055
next()
6156
})
6257

63-
const app = createApp(AppComponent, { router, pinia, store: playerStore })
58+
const app = createApp(AppComponent)
6459

65-
app.config.errorHandler = (err: Error) => {
60+
app.config.errorHandler = (err) => {
6661
// eslint-disable-next-line
6762
console.error(err)
68-
mainStore.setError(err)
63+
mainStore.setError(err as Error)
6964
}
7065

66+
app.use(pinia)
67+
app.use(router)
7168
app.use(auth)
7269
app.use(api)
7370

src/player/Player.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
import ProgressBar from '@/player/ProgressBar.vue'
136136
import { useFavouriteStore } from '@/library/favourite/store'
137137
import { formatArtists } from '@/shared/utils'
138-
import { BPopover } from 'bootstrap-vue'
138+
import { BPopover } from 'bootstrap-vue-next'
139139
import SwitchInput from '@/shared/components/SwitchInput.vue'
140140
import IconReplayGain from '@/shared/components/IconReplayGain.vue'
141141
import IconReplayGainTrack from '@/shared/components/IconReplayGainTrack.vue'

src/shared/compat.ts

-49
This file was deleted.

src/shared/components/Avatar.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template functional>
1+
<template>
22
<span class="bg-secondary text-white rounded-circle avatar">
33
<slot />
44
</span>

src/shared/components/ContentLoader.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<template functional>
1+
<template>
22
<div>
3-
<div v-if="props.loading" class="d-flex justify-content-center">
3+
<div v-if="$attrs.loading" class="d-flex justify-content-center">
44
<span class="spinner-border" />
55
</div>
66
<slot v-else />

src/shared/components/ContextMenu.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</div>
1313
</template>
1414
<script lang="ts">
15-
import Vue, { defineComponent } from 'vue'
15+
import { defineComponent } from 'vue'
1616
1717
export default defineComponent({
1818
data() {
@@ -25,7 +25,7 @@
2525
watch: {
2626
visible: {
2727
handler(value: boolean) {
28-
Vue.set((this.$refs.dropdown as any), 'visible', value)
28+
(this.$refs.dropdown as any).visible = value
2929
}
3030
}
3131
},

src/shared/components/ContextMenuItem.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
'd-flex justify-content-between align-items-center text-nowrap',
66
{[`dropdown-item-${variant}`]: variant}
77
]"
8-
v-on="$listeners"
8+
v-bind="$attrs"
99
>
1010
<slot>
1111
{{ text }}

src/shared/components/EmptyIndicator.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<template functional>
1+
<template>
22
<div class="d-flex flex-column align-items-center pt-5">
33
<Icon icon="stack" class="empty-icon" />
44
<div class="mt-4 text-muted">
55
<slot>
6-
{{ props.label || 'Empty' }}
6+
{{ $attrs.label || 'Empty' }}
77
</slot>
88
</div>
99
</div>

src/shared/components/ExternalLink.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<template functional>
2-
<a :href="props.href"
1+
<template>
2+
<a :href="$attrs.href"
33
target="_blank"
44
rel="noopener noreferrer"
5-
:class="[data.class, data.staticClass]"
6-
v-bind="data.attrs"
5+
:class="[$data.class, $data.staticClass]"
6+
v-bind="$data.attrs"
77
>
88
<slot />
99
</a>

0 commit comments

Comments
 (0)