Migrate to Vue 3 and Vite

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-07-12 10:55:28 +02:00
parent 8f4099ee33
commit ee20e03cc2
464 changed files with 31515 additions and 32758 deletions

View File

@@ -1,40 +1,10 @@
/* eslint-disable no-shadow */
import VueInstance from "vue";
import { ColorModifiers } from "buefy/types/helpers.d";
import { Route, RawLocation } from "vue-router";
declare module "vue/types/vue" {
interface Vue {
$notifier: {
success: (message: string) => void;
error: (message: string) => void;
info: (message: string) => void;
};
beforeRouteEnter?(
to: Route,
from: Route,
next: (to?: RawLocation | false | ((vm: VueInstance) => void)) => void
): void;
beforeRouteLeave?(
to: Route,
from: Route,
next: (to?: RawLocation | false | ((vm: VueInstance) => void)) => void
): void;
beforeRouteUpdate?(
to: Route,
from: Route,
next: (to?: RawLocation | false | ((vm: VueInstance) => void)) => void
): void;
}
}
import { App } from "vue";
export class Notifier {
private readonly vue: typeof VueInstance;
private app: App;
constructor(vue: typeof VueInstance) {
this.vue = vue;
constructor(app: App) {
this.app = app;
}
success(message: string): void {
@@ -49,8 +19,8 @@ export class Notifier {
this.notification(message, "is-info");
}
private notification(message: string, type: ColorModifiers) {
this.vue.prototype.$buefy.notification.open({
private notification(message: string, type: string) {
this.app.config.globalProperties.$oruga.notification.open({
message,
duration: 5000,
position: "is-bottom-right",
@@ -60,7 +30,10 @@ export class Notifier {
}
}
/* eslint-disable */
export function NotifierPlugin(vue: typeof VueInstance): void {
vue.prototype.$notifier = new Notifier(vue);
}
export const notifierPlugin = {
install(app: App) {
const notifier = new Notifier(app);
app.config.globalProperties.$notifier = notifier;
app.provide("notifier", notifier);
},
};