refactot: remove GlobalMixin

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/877/head
Varun Patil 2023-10-16 11:15:02 -07:00
parent 449e36e9a1
commit 2c18198c37
4 changed files with 12 additions and 20 deletions

View File

@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
- **Breaking**: Nextcloud 26+ and PHP 8 are now required.
- Significant improvements to code quality and maintainability.
## [v5.5.0] - 2023-10-06

View File

@ -1,17 +1,19 @@
// Library imports
import 'reflect-metadata';
import Vue from 'vue';
import { generateFilePath } from '@nextcloud/router';
import { getRequestToken } from '@nextcloud/auth';
import { translate, translatePlural } from '@nextcloud/l10n';
// Global components
import XImg from './components/frame/XImg.vue';
import XLoadingIcon from './components/XLoadingIcon.vue';
import GlobalMixin from './mixins/GlobalMixin';
import VueVirtualScroller from 'vue-virtual-scroller';
// Locals
import router from './router';
import { c, initState } from './services/utils';
// CSS for components
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
@ -59,7 +61,13 @@ if ('virtualKeyboard' in navigator) {
(<any>navigator.virtualKeyboard).overlaysContent = true;
}
Vue.mixin(GlobalMixin as any);
// Register global components and plugins
Vue.use(VueVirtualScroller);
Vue.component('XImg', XImg);
Vue.component('XLoadingIcon', XLoadingIcon);
// Register global constants and functions
Vue.prototype.c = c;
Vue.prototype.initState = initState;
Vue.prototype.t = translate;
Vue.prototype.n = translatePlural;

2
src/globals.d.ts vendored
View File

@ -95,7 +95,7 @@ declare global {
};
}
// GlobalMixin.ts types, present on all components
// types present on all components (bootstrap.ts, router.ts)
declare module 'vue' {
interface ComponentCustomProperties extends GlobalRouteCheckers {
t: typeof translate;

View File

@ -1,17 +0,0 @@
import { translate as t, translatePlural as n } from '@nextcloud/l10n';
import { c, initState } from '../services/utils';
import { defineComponent } from 'vue';
export default defineComponent({
name: 'GlobalMixin',
data: () => ({
c,
initState,
}),
methods: {
t,
n,
},
});