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

Vue3 Migration #4428

Closed
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
8c44ca9
test: freetube running with vue3
ChunkyProgrammer Dec 7, 2023
cf3b6fd
use webhashhistory, set new locale properly, move all emits to js file
ChunkyProgrammer Dec 7, 2023
b60f1b3
fix input ids not being properly set
ChunkyProgrammer Dec 8, 2023
3828cea
Use vue/dist/vue.runtime.esm-bundler.js when running electron
ChunkyProgrammer Dec 8, 2023
5007229
handle route changes properly, fix formatNumber, don't use vueSet and…
ChunkyProgrammer Dec 9, 2023
0cf98bf
merge latest changes
ChunkyProgrammer Dec 18, 2023
8abd2c5
fix fade transition
ChunkyProgrammer Dec 21, 2023
743a950
Merge branch 'development' into vue3-test
ChunkyProgrammer Dec 21, 2023
233f115
update vue to latest version
ChunkyProgrammer Dec 21, 2023
959f82a
Merge branch 'development' into vue3-test
ChunkyProgrammer Dec 27, 2023
9751bc3
fix rss view counts
ChunkyProgrammer Dec 27, 2023
82e89a9
Merge branch 'development' into vue3-test
ChunkyProgrammer Jan 2, 2024
9063747
update vue to latest version
ChunkyProgrammer Jan 2, 2024
ec56657
Merge branch 'development' into vue3-test
ChunkyProgrammer Jan 3, 2024
1a882c7
Merge branch 'development' into vue3-test
ChunkyProgrammer Jan 11, 2024
8659877
update vue packages to latest version
ChunkyProgrammer Jan 13, 2024
92cc2f0
Merge branch 'development' into vue3-test
ChunkyProgrammer Jan 16, 2024
e06d834
remove vueSet
ChunkyProgrammer Jan 16, 2024
2cb9851
update vue version, fix some vue compatibility warnings
ChunkyProgrammer Jan 16, 2024
8d9ec47
fix minor issues
ChunkyProgrammer Jan 16, 2024
321ae9c
Merge branch 'development' into vue3-test
ChunkyProgrammer Jan 18, 2024
1e356c1
Merge branch 'development' into vue3-test
ChunkyProgrammer Jan 24, 2024
6d049e6
update to latest version of vue, fix bugs when interating with font-a…
ChunkyProgrammer Jan 24, 2024
0ea6632
Merge branch 'development' into vue3-test
ChunkyProgrammer Jan 29, 2024
8fc968e
Merge branch 'development' into vue3-test
ChunkyProgrammer Jan 29, 2024
b0828b7
Merge branch 'development' into vue3-test
ChunkyProgrammer Feb 1, 2024
00ebe9e
Merge branch 'development' into vue3-test
ChunkyProgrammer Feb 7, 2024
a1563f8
update vue to latest version
ChunkyProgrammer Feb 8, 2024
db59054
Remove vue config from main process
ChunkyProgrammer Feb 9, 2024
6c3cb8b
Merge branch 'development' into vue3-test
ChunkyProgrammer Feb 13, 2024
df75812
Apply suggestions from code review
ChunkyProgrammer Feb 13, 2024
e9b4215
don't set locale message if error occurs
ChunkyProgrammer Feb 13, 2024
d66537e
Merge branch 'vue3-test' of https://github.com/ChunkyProgrammer/FreeT…
ChunkyProgrammer Feb 13, 2024
8e7a6b2
Merge branch 'development' into vue3-test
ChunkyProgrammer Feb 19, 2024
620dab4
use null instead of false for observe-visibility
ChunkyProgrammer Feb 19, 2024
852a113
update vue to latest version
ChunkyProgrammer Feb 19, 2024
4119389
Merge branch 'development' into vue3-test
ChunkyProgrammer Feb 20, 2024
196dd33
Merge branch 'development' into vue3-test
ChunkyProgrammer Feb 25, 2024
5f4d485
update vue-router to latest
ChunkyProgrammer Feb 25, 2024
31e1421
Merge branch 'development' into vue3-test
ChunkyProgrammer Mar 8, 2024
f0ad46d
add new events to emits array
ChunkyProgrammer Mar 8, 2024
2380f58
Merge branch 'development' into vue3-test
ChunkyProgrammer Mar 13, 2024
09942e9
update vue dependencies
ChunkyProgrammer Mar 13, 2024
393e995
Merge branch 'development' into vue3-test
ChunkyProgrammer Mar 25, 2024
aa0bf8c
Merge branch 'development' into vue3-test
ChunkyProgrammer Apr 12, 2024
06c1a50
Merge branch 'development' into vue3-test
ChunkyProgrammer Apr 16, 2024
9ad5cfd
fix bug in translating window titles
ChunkyProgrammer Apr 16, 2024
410d39e
set v-observe-visibility to null instead of false
ChunkyProgrammer Apr 16, 2024
e50568b
Merge branch 'development' into vue3-test
ChunkyProgrammer Apr 17, 2024
9bf15f3
Merge branch 'development' into vue3-test
ChunkyProgrammer Apr 17, 2024
6f6de87
remove ft-card changes since they're no longer needed
ChunkyProgrammer Apr 17, 2024
9950fa6
Merge branch 'development' into vue3-test
ChunkyProgrammer Apr 18, 2024
d79aa8e
remove unneeded vue alias
ChunkyProgrammer Apr 18, 2024
d98a96a
Merge branch 'development' into vue3-test
ChunkyProgrammer Apr 19, 2024
7b95c84
Merge branch 'development' into vue3-test
ChunkyProgrammer Apr 19, 2024
ed8cc74
update packages
ChunkyProgrammer Apr 19, 2024
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 .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
extends: [
'prettier',
'eslint:recommended',
'plugin:vue/recommended',
'plugin:vue/vue3-recommended',
'standard',
'plugin:jsonc/recommended-with-json',
'plugin:vuejs-accessibility/recommended'
Expand Down
2 changes: 2 additions & 0 deletions _scripts/webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const config = {
},
plugins: [
new webpack.DefinePlugin({
'__VUE_PROD_DEVTOOLS__': true,
'__VUE_OPTIONS_API__': true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1

'process.env.IS_ELECTRON_MAIN': true
})
],
Expand Down
6 changes: 4 additions & 2 deletions _scripts/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path')
const { readFileSync } = require('fs')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const { VueLoaderPlugin } = require('vue-loader')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
const ProcessLocalesPlugin = require('./ProcessLocalesPlugin')
Expand Down Expand Up @@ -115,6 +115,8 @@ const config = {
plugins: [
processLocalesPlugin,
new webpack.DefinePlugin({
'__VUE_PROD_DEVTOOLS__': true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this only be set to true for dev builds like we did before?

'__VUE_OPTIONS_API__': true,
'process.env.IS_ELECTRON': true,
'process.env.IS_ELECTRON_MAIN': false,
'process.env.LOCALE_NAMES': JSON.stringify(processLocalesPlugin.localeNames)
Expand Down Expand Up @@ -147,7 +149,7 @@ const config = {
],
resolve: {
alias: {
ChunkyProgrammer marked this conversation as resolved.
Show resolved Hide resolved
vue$: 'vue/dist/vue.runtime.esm.js',
vue$: 'vue/dist/vue.runtime.esm-bundler.js',

'youtubei.js$': 'youtubei.js/web',

Expand Down
6 changes: 3 additions & 3 deletions _scripts/webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require('path')
const fs = require('fs')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const { VueLoaderPlugin } = require('vue-loader')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const JsonMinimizerPlugin = require('json-minimizer-webpack-plugin')
Expand Down Expand Up @@ -112,6 +112,8 @@ const config = {
},
plugins: [
new webpack.DefinePlugin({
'__VUE_PROD_DEVTOOLS__': true,
'__VUE_OPTIONS_API__': true,
'process.env.IS_ELECTRON': false,
'process.env.IS_ELECTRON_MAIN': false,

Expand Down Expand Up @@ -156,8 +158,6 @@ const config = {
],
resolve: {
alias: {
vue$: 'vue/dist/vue.runtime.esm.js',

// video.js's mpd-parser uses @xmldom/xmldom so that it can support both node and web browsers
// As FreeTube only runs in electron and web browsers, we can use the native DOMParser class, instead of the "polyfill"
// https://caniuse.com/mdn-api_domparser
Expand Down
2 changes: 1 addition & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"vueCompilerOptions": {
"target": 2.7
"target": 3.0
}
}
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/vue-fontawesome": "^2.0.10",
"@fortawesome/vue-fontawesome": "^3.0.5",
"@seald-io/nedb": "^4.0.3",
"@silvermine/videojs-quality-selector": "^1.3.1",
"autolinker": "^4.0.0",
Expand All @@ -72,11 +72,11 @@
"videojs-mobile-ui": "^0.8.0",
"videojs-overlay": "^3.1.0",
"videojs-vtt-thumbnails-freetube": "0.0.15",
"vue": "^2.7.15",
"vue-i18n": "^8.28.2",
"vue-observe-visibility": "^1.0.0",
"vue-router": "^3.6.5",
"vuex": "^3.6.2",
"vue": "^3.3.10",
"vue-i18n": "^9.8.0",
"vue-observe-visibility": "^2.0.0-alpha.1",
"vue-router": "^4.2.5",
"vuex": "^4.1.0",
"youtubei.js": "^7.0.0"
},
"devDependencies": {
Expand Down Expand Up @@ -123,7 +123,7 @@
"tree-kill": "1.2.2",
"vue-devtools": "^5.1.4",
"vue-eslint-parser": "^9.3.2",
"vue-loader": "^15.10.0",
"vue-loader": "^17.3.1",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
Expand Down
15 changes: 5 additions & 10 deletions src/renderer/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Vue, { defineComponent } from 'vue'
import { defineComponent } from 'vue'
import { mapActions, mapMutations } from 'vuex'
import { ObserveVisibility } from 'vue-observe-visibility'
import FtFlexBox from './components/ft-flex-box/ft-flex-box.vue'
import TopNav from './components/top-nav/top-nav.vue'
import SideNav from './components/side-nav/side-nav.vue'
Expand All @@ -16,8 +15,6 @@ import { openExternalLink, openInternalPath, showToast } from './helpers/utils'

let ipcRenderer = null

Vue.directive('observe-visibility', ObserveVisibility)

export default defineComponent({
name: 'App',
components: {
Expand Down Expand Up @@ -68,7 +65,7 @@ export default defineComponent({
},
windowTitle: function () {
const routeTitle = this.$route.meta.title
if (routeTitle !== 'Channel' && routeTitle !== 'Watch' && routeTitle !== 'Hashtag') {
if (routeTitle !== 'Channel' && routeTitle !== 'Watch' && routeTitle !== 'Hashtag' && routeTitle) {
let title =
this.$route.meta.path === '/home'
? packageDetails.productName
Expand Down Expand Up @@ -182,11 +179,9 @@ export default defineComponent({
this.$refs.topNav?.navigateHistory()
})

this.$router.onReady(() => {
if (this.$router.currentRoute.path === '/' && this.landingPage !== '/subscriptions') {
this.$router.replace({ path: this.landingPage })
}
})
if (this.$router.currentRoute.path === '/' && this.landingPage !== '/subscriptions') {
this.$router.replace({ path: this.landingPage })
}
})
},
methods: {
Expand Down
19 changes: 9 additions & 10 deletions src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,17 @@
@click="handleNewBlogBannerClick"
/>
</div>
<transition
v-if="dataReady"
mode="out-in"
name="fade"
<!-- <keep-alive> -->
<RouterView
ref="router"
v-slot="{ Component }"
class="routerView"
>
<!-- <keep-alive> -->
<RouterView
ref="router"
class="routerView"
/>
<transition>
ChunkyProgrammer marked this conversation as resolved.
Show resolved Hide resolved
<component :is="Component" />
</transition>
</RouterView>
<!-- </keep-alive> -->
</transition>
</ft-flex-box>

<ft-prompt
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/components/ft-button/ft-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@ export default defineComponent({
type: String,
default: ''
}
},
emits: ['click'],
methods: {
click: function() {
this.$emit('click')
}
}
})
2 changes: 1 addition & 1 deletion src/renderer/components/ft-button/ft-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
backgroundColor: backgroundColor,
border: `2px solid ${backgroundColor}`
}"
@click="$emit('click')"
@click="click"
>
<slot>
{{ label }}
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/components/ft-card/ft-card.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { defineComponent } from 'vue'

export default defineComponent({
name: 'FtCard'
name: 'FtCard',
emits: ['focusout'],
methods: {
focusOut: function () {
this.$emit('focusout')
}
}
})
2 changes: 1 addition & 1 deletion src/renderer/components/ft-card/ft-card.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div
class="ft-card"
@focusout="$emit('focusout')"
@focusout="focusout"
>
<slot />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default defineComponent({
default: false
}
},
emits: ['click'],
data: function () {
return {
selected: false
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/components/ft-icon-button/ft-icon-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default defineComponent({
default: false
}
},
emits: ['click'],
data: function () {
return {
dropdownShown: false,
Expand All @@ -74,7 +75,7 @@ export default defineComponent({
window.addEventListener('resize', this.handleResize)
}
},
beforeDestroy: function () {
beforeUnmount: function () {
if (this.dropdownModalOnMobile) {
window.removeEventListener('resize', this.handleResize)
}
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/ft-input-tags/ft-input-tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default defineComponent({
default: (_) => ({ preferredName: '', icon: '' }),
}
},
emits: ['invalid-name', 'error-find-tag-info', 'change', 'already-exists'],
methods: {
updateTags: async function (text, _e) {
// get text without spaces after last '/' in url, if any
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/components/ft-input/ft-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default defineComponent({
default: ''
}
},
emits: ['input', 'click', 'clear'],
data: function () {
let actionIcon = ['fas', 'search']
if (this.forceActionButtonIconName !== null) {
Expand Down Expand Up @@ -136,7 +137,7 @@ export default defineComponent({
}
},
mounted: function () {
this.id = this._uid
this.id = this._.uid
this.inputData = this.value
this.updateVisibleDataList()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default defineComponent({
default: false,
},
},
emits: ['pause-player'],
data: function () {
return {
visible: false
Expand Down Expand Up @@ -80,6 +81,9 @@ export default defineComponent({
if (visible && this.shouldBeVisible) {
this.visible = visible
}
},
pausePlayer: function () {
this.$emit('pause-player')
}
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
:playlist-loop="playlistLoop"
:force-list-type="forceListType"
:appearance="appearance"
@pause-player="$emit('pause-player')"
@pause-player="pausePlayer"
/>
</div>
</template>
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default defineComponent({
default: false
},
},
emits: ['pause-player'],
data: function () {
return {
id: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default defineComponent({
required: true
}
},
emits: ['click'],
methods: {
handleClick: function (response) {
this.$emit('click', response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default defineComponent({
required: true
}
},
emits: ['click'],
computed: {
isMainProfile: function () {
return this.profileId === MAIN_PROFILE_ID
Expand All @@ -35,5 +36,10 @@ export default defineComponent({
translatedProfileName: function () {
return this.isMainProfile ? this.$t('Profile.All Channels') : this.profileName
}
},
methods: {
click: function() {
this.$emit('click')
}
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
tabindex="0"
role="button"
:aria-labelledby="sanitizedId"
@click="$emit('click')"
@keydown.space.enter.prevent="$emit('click')"
@click="click"
@keydown.space.enter.prevent="click"
>
<div
class="bubble"
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/ft-profile-edit/ft-profile-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default defineComponent({
required: true
}
},
emits: ['new-profile-created', 'profile-deleted'],
data: function () {
return {
showDeletePrompt: false,
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/components/ft-prompt/ft-prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default defineComponent({
default: false
}
},
emits: ['click'],
data: function () {
return {
promptButtons: []
Expand All @@ -48,7 +49,7 @@ export default defineComponent({
return sanitizeForHtmlId(this.label)
}
},
beforeDestroy: function () {
beforeUnmount: function () {
document.removeEventListener('keydown', this.closeEventFunction, true)
},
mounted: function () {
Expand Down Expand Up @@ -100,6 +101,10 @@ export default defineComponent({
}
},

click: function(option) {
this.$emit('click', option)
},

...mapActions([
'showOutlines'
])
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/ft-prompt/ft-prompt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
:id="'prompt-' + sanitizedLabel + '-' + index"
:key="index"
:label="option"
@click="$emit('click', optionValues[index])"
@click="click(optionValues[index])"
/>
<ft-button
v-if="showClose"
Expand Down
Loading