diff --git a/package.json b/package.json index 396afa2ea5..52acc96f19 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "three": "~0.97.0", "tiny-emitter": "^2.1.0", "vite-plugin-pwa": "^0.17.5", - "vue": "^3.5.12" + "vue": "^3.5.13" }, "devDependencies": { "@babel/core": "^7.24.4", diff --git a/src/components/init.js b/src/components/init.js index 062ec8841d..19ae8ead14 100644 --- a/src/components/init.js +++ b/src/components/init.js @@ -2,10 +2,10 @@ // `i18n` helper to window and setting up `i18next` // in the future it should be pure. This means it should // explicitly export things used by other parts of the app. -import '../js/localization.js'; -import '../js/injected_methods'; -import i18next from 'i18next'; -import { createApp } from "vue"; +import "../js/localization.js"; +import "../js/injected_methods"; +import i18next from "i18next"; +import { createApp, reactive } from "vue"; import I18NextVue from "i18next-vue"; import BatteryLegend from "./quad-status/BatteryLegend.vue"; import BetaflightLogo from "./betaflight-logo/BetaflightLogo.vue"; @@ -18,35 +18,42 @@ import PortUsage from "../js/port_usage.js"; import PortPicker from "./port-picker/PortPicker.vue"; import CONFIGURATOR from "../js/data_storage.js"; -// Most of the global objects can go here at first. -// It's a bit of overkill for simple components, -// but these instance would eventually have more children -// which would find the use for those extra properties. -const betaflightModel = { +/* + Most of the global objects can go here at first. + It's a bit of overkill for simple components, + but these instance would eventually have more children + which would find the use for those extra properties. + + FIXME For some reason, some of them (like PortHandler and FC) + need to be marked as reactive in it's own module, to detect + changes in arrays so I added the `reactive` wrapper there too. +*/ +const betaflightModel = reactive({ CONFIGURATOR, FC, MSP, PortUsage, PortHandler, -}; +}); -i18next.on('initialized', function() { +i18next.on("initialized", function () { console.log("i18n initialized, starting Vue framework"); const app = createApp({ - data() { return betaflightModel; }, + setup() { + return betaflightModel; + }, }); - app - .use(I18NextVue, { i18next }) - .component('BetaflightLogo', BetaflightLogo) - .component('BatteryLegend', BatteryLegend) - .component('StatusBar', StatusBar) - .component('BatteryIcon', BatteryIcon) - .component('PortPicker', PortPicker) - .mount('#main-wrapper'); + app.use(I18NextVue, { i18next }) + .component("BetaflightLogo", BetaflightLogo) + .component("BatteryLegend", BatteryLegend) + .component("StatusBar", StatusBar) + .component("BatteryIcon", BatteryIcon) + .component("PortPicker", PortPicker) + .mount("#main-wrapper"); - if (process.env.NODE_ENV === 'development') { + if (process.env.NODE_ENV === "development") { console.log("Development mode enabled, installing Vue tools"); // TODO Vue.config.devtools = true; app.config.performance = true; diff --git a/src/components/port-picker/FirmwareVirtualOption.vue b/src/components/port-picker/FirmwareVirtualOption.vue index 462a7e2e15..22c9793566 100644 --- a/src/components/port-picker/FirmwareVirtualOption.vue +++ b/src/components/port-picker/FirmwareVirtualOption.vue @@ -1,7 +1,13 @@ diff --git a/src/components/port-picker/PortOverrideOption.vue b/src/components/port-picker/PortOverrideOption.vue index ce7974deee..9559e14bee 100644 --- a/src/components/port-picker/PortOverrideOption.vue +++ b/src/components/port-picker/PortOverrideOption.vue @@ -1,44 +1,38 @@ diff --git a/src/components/port-picker/PortPicker.vue b/src/components/port-picker/PortPicker.vue index f973d5cd67..0bc32eeddf 100644 --- a/src/components/port-picker/PortPicker.vue +++ b/src/components/port-picker/PortPicker.vue @@ -3,28 +3,28 @@ diff --git a/src/components/port-picker/PortsInput.vue b/src/components/port-picker/PortsInput.vue index d671449b82..bfd9409d1d 100644 --- a/src/components/port-picker/PortsInput.vue +++ b/src/components/port-picker/PortsInput.vue @@ -3,20 +3,19 @@ @@ -124,7 +80,7 @@ diff --git a/src/components/quad-status/BatteryIcon.vue b/src/components/quad-status/BatteryIcon.vue index d80338e3cf..fea452f950 100644 --- a/src/components/quad-status/BatteryIcon.vue +++ b/src/components/quad-status/BatteryIcon.vue @@ -5,118 +5,92 @@ + -