build(vite): migrate to vitejs (#594)

This commit is contained in:
pataar authored and GitHub committed 2022-02-08 10:10:06 +01:00
1 parent 5f0c4baaca
commit 410610137a
72 files changed
+3348 -29226

No files matched your search

+1
View File
@@ -0,0 +1 @@
/node_modules/
-1
View File
@@ -17,7 +17,6 @@
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
+2 -2
View File
@@ -16,8 +16,8 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# This workflow contains a single job called "lint"
lint:
# The type of runner that the job will run on
runs-on: ubuntu-latest
-5
View File
@@ -1,5 +0,0 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
+165
View File
@@ -0,0 +1,165 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/vue-next/pull/3399
declare module 'vue' {
export interface GlobalComponents {
AboutModal: typeof import('./src/components/modals/AboutModal.vue')['default']
Codemirror: typeof import('./src/components/inputs/Codemirror.vue')['default']
CommandHelpModal: typeof import('./src/components/CommandHelpModal.vue')['default']
ConfigFilesPanel: typeof import('./src/components/panels/Machine/ConfigFilesPanel.vue')['default']
ConnectionStatus: typeof import('./src/components/ui/ConnectionStatus.vue')['default']
ConsoleTable: typeof import('./src/components/console/ConsoleTable.vue')['default']
ConsoleTableEntry: typeof import('./src/components/console/ConsoleTableEntry.vue')['default']
ControlPanel: typeof import('./src/components/panels/ControlPanel.vue')['default']
ControlPanelBarsControl: typeof import('./src/components/panels/ControlPanelBarsControl.vue')['default']
ControlPanelCircleControl: typeof import('./src/components/panels/ControlPanelCircleControl.vue')['default']
ControlPanelCrossControl: typeof import('./src/components/panels/ControlPanelCrossControl.vue')['default']
ControlPanelExtruder: typeof import('./src/components/panels/ControlPanelExtruder.vue')['default']
DependenciesPanel: typeof import('./src/components/panels/DependenciesPanel.vue')['default']
EndstopPanel: typeof import('./src/components/panels/Machine/EndstopPanel.vue')['default']
FarmPrinterPanel: typeof import('./src/components/panels/FarmPrinterPanel.vue')['default']
FilamentSensor: typeof import('./src/components/inputs/FilamentSensor.vue')['default']
FirmwareRetractionSettings: typeof import('./src/components/panels/MachineSettings/FirmwareRetractionSettings.vue')['default']
FirmwareRetractionSettingsInput: typeof import('./src/components/inputs/FirmwareRetractionSettingsInput.vue')['default']
GcodefilesPanel: typeof import('./src/components/panels/GcodefilesPanel.vue')['default']
HistoryAllPrintStatus: typeof import('./src/components/charts/HistoryAllPrintStatus.vue')['default']
HistoryFilamentUsage: typeof import('./src/components/charts/HistoryFilamentUsage.vue')['default']
HistoryListPanel: typeof import('./src/components/panels/HistoryListPanel.vue')['default']
HistoryPrinttimeAvg: typeof import('./src/components/charts/HistoryPrinttimeAvg.vue')['default']
HistoryStatisticsPanel: typeof import('./src/components/panels/HistoryStatisticsPanel.vue')['default']
Ipstreamer: typeof import('./src/components/webcams/Ipstreamer.vue')['default']
JobqueuePanel: typeof import('./src/components/panels/JobqueuePanel.vue')['default']
KlipperWarningsPanel: typeof import('./src/components/panels/KlipperWarningsPanel.vue')['default']
KlippyStatePanel: typeof import('./src/components/panels/KlippyStatePanel.vue')['default']
LogfilesPanel: typeof import('./src/components/panels/Machine/LogfilesPanel.vue')['default']
MachineSettingsPanel: typeof import('./src/components/panels/MachineSettings/MachineSettingsPanel.vue')['default']
MacroButton: typeof import('./src/components/inputs/MacroButton.vue')['default']
MacrogroupPanel: typeof import('./src/components/panels/MacrogroupPanel.vue')['default']
MacrosPanel: typeof import('./src/components/panels/MacrosPanel.vue')['default']
MainsailLogo: typeof import('./src/components/ui/MainsailLogo.vue')['default']
MiniconsolePanel: typeof import('./src/components/panels/MiniconsolePanel.vue')['default']
MinSettingsPanel: typeof import('./src/components/panels/MinSettingsPanel.vue')['default']
MiscellaneousPanel: typeof import('./src/components/panels/MiscellaneousPanel.vue')['default']
MiscellaneousSlider: typeof import('./src/components/inputs/MiscellaneousSlider.vue')['default']
Mjpegstreamer: typeof import('./src/components/webcams/Mjpegstreamer.vue')['default']
MjpegstreamerAdaptive: typeof import('./src/components/webcams/MjpegstreamerAdaptive.vue')['default']
MoonrakerStatePanel: typeof import('./src/components/panels/MoonrakerStatePanel.vue')['default']
MotionSettings: typeof import('./src/components/panels/MachineSettings/MotionSettings.vue')['default']
MotionSettingsInput: typeof import('./src/components/inputs/MotionSettingsInput.vue')['default']
Panel: typeof import('./src/components/ui/Panel.vue')['default']
PowerControlPanel: typeof import('./src/components/panels/PowerControlPanel.vue')['default']
PressureAdvanceSettings: typeof import('./src/components/panels/MachineSettings/PressureAdvanceSettings.vue')['default']
PressureAdvanceSettingsInput: typeof import('./src/components/inputs/PressureAdvanceSettingsInput.vue')['default']
PrinterSelector: typeof import('./src/components/ui/PrinterSelector.vue')['default']
PrintsettingsPanel: typeof import('./src/components/panels/PrintsettingsPanel.vue')['default']
SettingsConsoleTab: typeof import('./src/components/settings/SettingsConsoleTab.vue')['default']
SettingsControlTab: typeof import('./src/components/settings/SettingsControlTab.vue')['default']
SettingsDashboardTab: typeof import('./src/components/settings/SettingsDashboardTab.vue')['default']
SettingsDashboardTabDesktop: typeof import('./src/components/settings/SettingsDashboardTabDesktop.vue')['default']
SettingsDashboardTabMobile: typeof import('./src/components/settings/SettingsDashboardTabMobile.vue')['default']
SettingsDashboardTabTablet: typeof import('./src/components/settings/SettingsDashboardTabTablet.vue')['default']
SettingsDashboardTabWidescreen: typeof import('./src/components/settings/SettingsDashboardTabWidescreen.vue')['default']
SettingsEditorTab: typeof import('./src/components/settings/SettingsEditorTab.vue')['default']
SettingsGCodeViewerTab: typeof import('./src/components/settings/SettingsGCodeViewerTab.vue')['default']
SettingsGeneralTab: typeof import('./src/components/settings/SettingsGeneralTab.vue')['default']
SettingsMacrosTab: typeof import('./src/components/settings/SettingsMacrosTab.vue')['default']
SettingsMacrosTabExpert: typeof import('./src/components/settings/SettingsMacrosTabExpert.vue')['default']
SettingsMacrosTabSimple: typeof import('./src/components/settings/SettingsMacrosTabSimple.vue')['default']
SettingsPresetsTab: typeof import('./src/components/settings/SettingsPresetsTab.vue')['default']
SettingsRemotePrintersTab: typeof import('./src/components/settings/SettingsRemotePrintersTab.vue')['default']
SettingsRow: typeof import('./src/components/settings/SettingsRow.vue')['default']
SettingsTimelapseTab: typeof import('./src/components/settings/SettingsTimelapseTab.vue')['default']
SettingsUiSettingsTab: typeof import('./src/components/settings/SettingsUiSettingsTab.vue')['default']
SettingsWebcamsTab: typeof import('./src/components/settings/SettingsWebcamsTab.vue')['default']
StatusPanel: typeof import('./src/components/panels/StatusPanel.vue')['default']
StatusPanelExcludeObject: typeof import('./src/components/panels/StatusPanelExcludeObject.vue')['default']
StatusPanelExcludeObjectDialog: typeof import('./src/components/panels/StatusPanelExcludeObjectDialog.vue')['default']
StatusPanelExcludeObjectDialogList: typeof import('./src/components/panels/StatusPanelExcludeObjectDialogList.vue')['default']
StatusPanelExcludeObjectDialogMap: typeof import('./src/components/panels/StatusPanelExcludeObjectDialogMap.vue')['default']
SubPanel: typeof import('./src/components/ui/SubPanel.vue')['default']
SystemPanel: typeof import('./src/components/panels/Machine/SystemPanel.vue')['default']
TempChart: typeof import('./src/components/charts/TempChart.vue')['default']
TheConnectingDialog: typeof import('./src/components/TheConnectingDialog.vue')['default']
TheEditor: typeof import('./src/components/TheEditor.vue')['default']
TheSelectPrinterDialog: typeof import('./src/components/TheSelectPrinterDialog.vue')['default']
TheSettingsMenu: typeof import('./src/components/TheSettingsMenu.vue')['default']
TheSidebar: typeof import('./src/components/TheSidebar.vue')['default']
TheThrottledStates: typeof import('./src/components/TheThrottledStates.vue')['default']
TheTimelapseRenderingSnackbar: typeof import('./src/components/TheTimelapseRenderingSnackbar.vue')['default']
TheTopbar: typeof import('./src/components/TheTopbar.vue')['default']
TheTopCornerMenu: typeof import('./src/components/TheTopCornerMenu.vue')['default']
TheUpdateDialog: typeof import('./src/components/TheUpdateDialog.vue')['default']
TimelapseFilesPanel: typeof import('./src/components/panels/Timelapse/TimelapseFilesPanel.vue')['default']
TimelapseStatusPanel: typeof import('./src/components/panels/Timelapse/TimelapseStatusPanel.vue')['default']
ToolInput: typeof import('./src/components/inputs/ToolInput.vue')['default']
ToolSlider: typeof import('./src/components/inputs/ToolSlider.vue')['default']
ToolsPanel: typeof import('./src/components/panels/ToolsPanel.vue')['default']
UpdatePanel: typeof import('./src/components/panels/Machine/UpdatePanel.vue')['default']
Uv4lMjpeg: typeof import('./src/components/webcams/Uv4lMjpeg.vue')['default']
VAlert: typeof import('vuetify/lib')['VAlert']
VApp: typeof import('vuetify/lib')['VApp']
VAppBar: typeof import('vuetify/lib')['VAppBar']
VAppBarNavIcon: typeof import('vuetify/lib')['VAppBarNavIcon']
VBtn: typeof import('vuetify/lib')['VBtn']
VBtnToggle: typeof import('vuetify/lib')['VBtnToggle']
VCard: typeof import('vuetify/lib')['VCard']
VCardActions: typeof import('vuetify/lib')['VCardActions']
VCardText: typeof import('vuetify/lib')['VCardText']
VCardTitle: typeof import('vuetify/lib')['VCardTitle']
VCheckbox: typeof import('vuetify/lib')['VCheckbox']
VChip: typeof import('vuetify/lib')['VChip']
VCol: typeof import('vuetify/lib')['VCol']
VColorPicker: typeof import('vuetify/lib')['VColorPicker']
VCombobox: typeof import('vuetify/lib')['VCombobox']
VContainer: typeof import('vuetify/lib')['VContainer']
VDataTable: typeof import('vuetify/lib')['VDataTable']
VDialog: typeof import('vuetify/lib')['VDialog']
VDivider: typeof import('vuetify/lib')['VDivider']
VExpandTransition: typeof import('vuetify/lib')['VExpandTransition']
VFadeTransition: typeof import('vuetify/lib')['VFadeTransition']
VForm: typeof import('vuetify/lib')['VForm']
VHover: typeof import('vuetify/lib')['VHover']
VIcon: typeof import('vuetify/lib')['VIcon']
Viewer: typeof import('./src/components/gcodeviewer/Viewer.vue')['default']
VImg: typeof import('vuetify/lib')['VImg']
VItemGroup: typeof import('vuetify/lib')['VItemGroup']
VList: typeof import('vuetify/lib')['VList']
VListItem: typeof import('vuetify/lib')['VListItem']
VListItemAction: typeof import('vuetify/lib')['VListItemAction']
VListItemContent: typeof import('vuetify/lib')['VListItemContent']
VListItemGroup: typeof import('vuetify/lib')['VListItemGroup']
VListItemIcon: typeof import('vuetify/lib')['VListItemIcon']
VListItemSubtitle: typeof import('vuetify/lib')['VListItemSubtitle']
VListItemTitle: typeof import('vuetify/lib')['VListItemTitle']
VMain: typeof import('vuetify/lib')['VMain']
VMenu: typeof import('vuetify/lib')['VMenu']
VNavigationDrawer: typeof import('vuetify/lib')['VNavigationDrawer']
VOverlay: typeof import('vuetify/lib')['VOverlay']
VProgressCircular: typeof import('vuetify/lib')['VProgressCircular']
VProgressLinear: typeof import('vuetify/lib')['VProgressLinear']
VRow: typeof import('vuetify/lib')['VRow']
VSelect: typeof import('vuetify/lib')['VSelect']
VSimpleTable: typeof import('vuetify/lib')['VSimpleTable']
VSlider: typeof import('vuetify/lib')['VSlider']
VSnackbar: typeof import('vuetify/lib')['VSnackbar']
VSpacer: typeof import('vuetify/lib')['VSpacer']
VSubheader: typeof import('vuetify/lib')['VSubheader']
VSwitch: typeof import('vuetify/lib')['VSwitch']
VTab: typeof import('vuetify/lib')['VTab']
VTabs: typeof import('vuetify/lib')['VTabs']
VTextarea: typeof import('vuetify/lib')['VTextarea']
VTextField: typeof import('vuetify/lib')['VTextField']
VTimeline: typeof import('vuetify/lib')['VTimeline']
VTimelineItem: typeof import('vuetify/lib')['VTimelineItem']
VToolbar: typeof import('vuetify/lib')['VToolbar']
VToolbarItems: typeof import('vuetify/lib')['VToolbarItems']
VToolbarTitle: typeof import('vuetify/lib')['VToolbarTitle']
VTooltip: typeof import('vuetify/lib')['VTooltip']
WebcamGrid: typeof import('./src/components/webcams/WebcamGrid.vue')['default']
WebcamPanel: typeof import('./src/components/panels/WebcamPanel.vue')['default']
ZoffsetPanel: typeof import('./src/components/panels/ZoffsetPanel.vue')['default']
}
}
export { }
+9 -3
View File
@@ -17,11 +17,17 @@ services:
- dev_net
npm:
build:
context: ./docker
dockerfile: Dockerfile
context: .
dockerfile: docker/Dockerfile
image: mainsail-stack-npm/1
env_file:
- .env
volumes:
- ./:/home/node/mainsail
# Do not bind '.' as volume. As we want the node modules being installed in the container
- ./src/:/home/node/mainsail/src
- ./public/:/home/node/mainsail/public
- ./vite.config.ts:/home/node/mainsail/vite.config.ts
- ./index.html:/home/node/mainsail/index.html
container_name: mainsail-stack-npm
ports:
- "8080:8080"
+8 -1
View File
@@ -5,11 +5,18 @@ EXPOSE 8080
RUN apt-get update
RUN apt-get install -y zip
COPY start-npm /usr/local/bin/start-npm
COPY docker/start-npm /usr/local/bin/start-npm
RUN chmod +x /usr/local/bin/start-npm
USER node
WORKDIR /home/node/mainsail
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm ci
COPY . .
ENTRYPOINT ["start-npm"]
+1 -1
View File
@@ -2,4 +2,4 @@
if [ ! -d 'node_modules' ]; then
npm ci
fi
npm run serve
npm run serve -- --host
+30
View File
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Mainsail</title>
<link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png">
<meta name="theme-color" content="#121212">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="manifest" href="/manifest.json">
<meta name="apple-mobile-web-app-title" content="Mainsail">
<link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png">
<link rel="mask-icon" href="/img/icons/icon-196-maskable.png" color="#121212">
<meta name="msapplication-TileImage" content="/img/icons/mstile-150x150.png">
<meta name="msapplication-TileColor" content="#121212">
<script type="module" src="/src/main.ts"></script>
</head>
<body>
<noscript>
<strong>We're sorry but Mainsail doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
</body>
</html>
+2824 -28893
View File
File diff suppressed because it is too large. Load diff
+20 -25
View File
@@ -7,9 +7,10 @@
"name": "Stefan Dej"
},
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build && npm run build.zip",
"lint": "vue-cli-service lint",
"serve": "vite serve",
"build": "vite build && npm run build.zip",
"lint": "eslint --ext .ts,.vue --ignore-path .gitignore src",
"lint:fix": "eslint --ext .ts,.vue --ignore-path .gitignore src --fix",
"build.zip": "cd ./dist && zip -r mainsail.zip ./ && cd ..",
"i18n-extract": "vue-i18n-extract use-config"
},
@@ -31,58 +32,46 @@
"echarts": "^5.2.2",
"echarts-for-vue": "^1.4.1",
"echarts-gl": "^2.0.8",
"joi": "^17.4.1",
"js-sha256": "^0.9.0",
"object-assign-deep": "^0.4.0",
"overlayscrollbars": "^1.13.1",
"overlayscrollbars-vue": "^0.2.2",
"sass-loader": "^10.2.0",
"regenerator-runtime": "^0.13.9",
"semver": "^7.3.5",
"uuid": "^8.3.2",
"vue": "^2.6.14",
"vue-class-component": "^7.2.6",
"vue-context": "^6.0.0",
"vue-github-api": "^0.1.7",
"vue-headful": "^2.1.0",
"vue-i18n": "^8.25.0",
"vue-load-image": "^0.2.0",
"vue-observe-visibility": "^1.0.0",
"vue-property-decorator": "^9.1.2",
"vue-resource": "^1.5.3",
"vue-simple-upload": "^0.1.6",
"vue-toast-notification": "^0.6.1",
"vuedraggable": "^2.24.3",
"vuetify": "^2.6.1",
"vuex": "^3.6.2"
},
"devDependencies": {
"@intlify/vite-plugin-vue-i18n": "^2.5.0",
"@mdi/font": "^6.2.95",
"@types/semver": "^7.3.8",
"@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"@vue/cli-plugin-babel": "^4.5.13",
"@vue/cli-plugin-eslint": "^4.5.13",
"@vue/cli-plugin-pwa": "^4.5.13",
"@vue/cli-plugin-typescript": "^4.5.13",
"@vue/cli-service": "^4.5.13",
"@vue/composition-api": "^1.0.5",
"@vue/eslint-config-typescript": "^7.0.0",
"babel-eslint": "^10.1.0",
"autoprefixer": "^10.4.2",
"eslint": "^6.8.0",
"eslint-plugin-vue": "^6.2.2",
"generate-file-webpack-plugin": "^1.0.1",
"sass": "~1.32",
"sw-precache-webpack-plugin": "^1.0.0",
"typescript": "^4.3.5",
"vue-cli-plugin-route": "0.0.7",
"vue-cli-plugin-vuetify": "^2.4.0",
"typescript": "^4.5.5",
"unplugin-vue-components": "0.17.11",
"vite": "^2.7.13",
"vite-plugin-package-version": "^1.0.2",
"vite-plugin-vue2": "^1.9.3",
"vue-debounce-decorator": "^1.0.1",
"vue-i18n-extract": "^1.2.3",
"vue-loader": "^16.2.0",
"vue-router": "^3.5.2",
"vue-template-compiler": "^2.6.14",
"vuetify-loader": "^1.7.2"
"vue-template-compiler": "^2.6.14"
},
"postcss": {
"plugins": {
@@ -91,7 +80,13 @@
},
"browserslist": [
"> 1%",
"last 2 versions"
"not dead",
"not op_mini all",
"last 2 chrome major versions",
"last 2 firefox major versions",
"last 2 safari major versions",
"last 2 opera major versions",
"last 2 edge major versions"
],
"engines": {
"node": "^16"
-16
View File
@@ -1,16 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Mainsail</title>
</head>
<body>
<noscript>
<strong>We're sorry but Mainsail doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
+23
View File
@@ -0,0 +1,23 @@
{
"short_name": "Mainsail",
"name": "Mainsail",
"display": "standalone",
"scope" : "/",
"start_url" : "/",
"theme_color": "#D51F26",
"background_color": "#121212",
"icons": [
{
"src": "/img/icons/icon-196-maskable.png",
"sizes": "196x196",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "/img/icons/icon-512-maskable.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any maskable"
}
]
}
+2 -2
View File
@@ -78,8 +78,8 @@ import Panel from '@/components/ui/Panel.vue'
})
export default class CommandHelpModal extends Mixins(BaseMixin) {
@Prop({ required: false, default: false }) isMini!: boolean;
@Prop({ required: false, default: false }) inToolbar!: boolean;
@Prop({ required: false, default: false }) declare isMini: boolean;
@Prop({ required: false, default: false }) declare inToolbar: boolean;
cmdListSearch = '';
isOpen = false;
+1 -1
View File
@@ -99,7 +99,7 @@ export default class TheEditor extends Mixins(BaseMixin) {
formatFilesize = formatFilesize
refs!: {
declare $refs: {
editor: any
}
+1 -1
View File
@@ -86,7 +86,7 @@ export default class TheSettingsMenu extends Mixins(BaseMixin) {
private showSettings = false
private activeTab = 'general'
$refs!: {
declare $refs: {
settingsScroll: any
}
+2 -2
View File
@@ -171,7 +171,7 @@ export default class TheTopbar extends Mixins(BaseMixin) {
formatFilesize = formatFilesize
$refs!: {
declare $refs: {
fileUploadAndStart: HTMLFormElement
}
@@ -317,4 +317,4 @@ export default class TheTopbar extends Mixins(BaseMixin) {
this.uploadSnackbar.status = false
}
}
</script>
</script>
+1 -1
View File
@@ -99,7 +99,7 @@ import BaseMixin from '@/components/mixins/base'
}
})
export default class TheUpdateDialog extends Mixins(BaseMixin) {
$refs!: {
declare $refs: {
updaterLogScroll: any
updaterLog: HTMLDivElement
}
@@ -24,7 +24,7 @@ import {ECharts} from 'echarts/core'
})
export default class HistoryAllPrintStatus extends Mixins(BaseMixin) {
$refs!: {
declare $refs: {
historyAllPrintStatus: any
}
@@ -23,7 +23,7 @@ import {ECharts} from 'echarts/core'
}
})
export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
$refs!: {
declare $refs: {
historyFilamentUsage: any
}
@@ -22,7 +22,7 @@ import {ECharts} from 'echarts/core'
}
})
export default class HistoryPrinttimeAvg extends Mixins(BaseMixin) {
$refs!: {
declare $refs: {
historyPrinttimeAvg: any
}
+1 -1
View File
@@ -32,7 +32,7 @@ interface echartsTooltipObj {
export default class TempChart extends Mixins(BaseMixin) {
convertName = convertName
$refs!: {
declare $refs: {
tempchart: any
}
+2 -2
View File
@@ -31,10 +31,10 @@ import ConsoleTableEntry from '@/components/console/ConsoleTableEntry.vue'
})
export default class ConsoleTable extends Vue {
@Prop({ required: true })
readonly events!: any[];
declare readonly events: any[];
@Prop({ required: false, default: false })
readonly isMini!: boolean;
declare readonly isMini: boolean;
commandClick(msg: string) {
this.$emit('command-click', msg)
+1 -1
View File
@@ -39,7 +39,7 @@ import {ServerStateEvent} from '@/store/server/types'
@Component
export default class ConsoleTableEntry extends Vue {
@Prop({ required: true })
readonly event!: ServerStateEvent
declare readonly event: ServerStateEvent
get entryStyle() {
return this.$store.state.gui.console.entryStyle ?? 'default'
+7 -8
View File
@@ -60,7 +60,7 @@
<div>
<panel :title="$t('GCodeViewer.Title')" icon="mdi-video-3d" card-class="gcode-viewer-panel">
<template v-slot:buttons>
<v-btn
<v-btn
:icon="$vuetify.breakpoint.xs"
:text="$vuetify.breakpoint.smAndUp"
tile
@@ -94,7 +94,7 @@
<v-row class="mt-0 d-flex align-top">
<v-col>
<v-row>
<v-col order-md="2" class="d-flex align-content-space-around justify-center flex-wrap flex-md-nowrap col-12 col-md-4">
<v-col order-md="2" class="d-flex align-content-space-around justify-center flex-wrap flex-md-nowrap col-12 col-md-4">
<template v-if="loadedFile === null">
<v-btn @click="loadCurrentFile" class="mr-3" v-if="sdCardFilePath !== '' && sdCardFilePath !== loadedFile">{{ $t("GCodeViewer.LoadCurrentFile")}}</v-btn>
<v-btn @click="chooseFile">{{ $t("GCodeViewer.LoadLocal") }}</v-btn>
@@ -187,7 +187,6 @@
<script lang="ts">
import {Component, Mixins, Prop, Ref, Watch} from 'vue-property-decorator'
import BaseMixin from '../mixins/base'
// @ts-ignore
import GCodeViewer from '@sindarius/gcodeviewer'
import axios from 'axios'
import {formatFilesize} from '@/plugins/helpers'
@@ -240,11 +239,11 @@ export default class Viewer extends Mixins(BaseMixin) {
}
}
@Prop({type: String, default: '', required: false}) filename!: string
@Ref('fileInput') fileInput!: HTMLInputElement
//@Ref('viewerCanvasContainer') viewerCanvasContainer!: HTMLElement
@Prop({type: String, default: '', required: false}) declare filename: string
@Ref('fileInput') declare fileInput: HTMLInputElement
@Ref('viewerCanvasContainer') declare viewerCanvasContainer: HTMLElement
$refs!: {
declare $refs: {
viewerCanvasContainer: HTMLElement
}
@@ -385,7 +384,7 @@ export default class Viewer extends Mixins(BaseMixin) {
}
}
}
async cancelRendering() {
if (viewer) {
viewer.gcodeProcessor.cancelLoad = true
+5 -5
View File
@@ -30,21 +30,21 @@ export default class Codemirror extends Mixins(BaseMixin) {
private codemirror: null | EditorView = null
private cminstance: null | EditorView = null
$refs!: {
declare $refs: {
codemirror: HTMLElement
}
@Prop({ required: false, default: '' })
readonly code!: string
declare readonly code: string
@Prop({ required: false, default: '' })
value!: string
declare value: string
@Prop({ required: false, default: 'codemirror' })
readonly name!: string
declare readonly name: string
@Prop({ required: false, default: '' })
readonly fileExtension!: string
declare readonly fileExtension: string
@Watch('value')
valueChanged(newVal: string) {
+3 -3
View File
@@ -30,9 +30,9 @@ import BaseMixin from '@/components/mixins/base'
export default class FilamentSensor extends Mixins(BaseMixin) {
convertName = convertName
@Prop({ type: String, required: true }) readonly name!: string
@Prop({ type: Boolean, required: true }) readonly enabled!: boolean
@Prop({ type: Boolean, required: true }) readonly filament_detected!: boolean
@Prop({ type: String, required: true }) declare readonly name: string
@Prop({ type: Boolean, required: true }) declare readonly enabled: boolean
@Prop({ type: Boolean, required: true }) declare readonly filament_detected: boolean
get statusColor() {
if (!this.enabled) return 'gray'
@@ -61,17 +61,17 @@ export default class FirmwareRetractionSettingsInput extends Mixins(BaseMixin) {
private value: number = 0
private error: boolean | undefined
@Prop({ type: String, required: true }) readonly label!: string
@Prop({ type: Number, required: false , default: 1 }) readonly step!: number
@Prop({ type: Boolean, required: false , default: false }) readonly hasSpinner!: number
@Prop({ type: Number, required: false , default: 1 }) readonly spinnerFactor!: number
@Prop({ type: Number, required: true , default: 0 }) readonly min!: number
@Prop({ type: Number, default: null }) readonly max!: number | null
@Prop({ type: Number, required: true , default: 0 }) readonly dec!: number
@Prop({ type: Number, required: true, default: 0 }) readonly target!: number
@Prop({ type: Number, required: true, default: 0 }) readonly defaultValue!: number
@Prop({ type: String, required: true }) readonly attributeName!: string
@Prop({ type: String, required: true }) readonly unit!: string
@Prop({ type: String, required: true }) declare readonly label: string
@Prop({ type: Number, required: false , default: 1 }) declare readonly step: number
@Prop({ type: Boolean, required: false , default: false }) declare readonly hasSpinner: number
@Prop({ type: Number, required: false , default: 1 }) declare readonly spinnerFactor: number
@Prop({ type: Number, required: true , default: 0 }) declare readonly min: number
@Prop({ type: Number, default: null }) declare readonly max: number | null
@Prop({ type: Number, required: true , default: 0 }) declare readonly dec: number
@Prop({ type: Number, required: true, default: 0 }) declare readonly target: number
@Prop({ type: Number, required: true, default: 0 }) declare readonly defaultValue: number
@Prop({ type: String, required: true }) declare readonly attributeName: string
@Prop({ type: String, required: true }) declare readonly unit: string
@Watch('target')
targetChanged(newVal: number): void {
+2 -2
View File
@@ -86,8 +86,8 @@ export default class MacroButton extends Mixins(BaseMixin) {
private paramArray: string[] = []
private params: params = {}
@Prop({ required: true }) readonly macro!: GuiMacrosStateMacrogroupMacro
@Prop({ default: 'primary' }) readonly color!: string
@Prop({ required: true }) declare readonly macro: GuiMacrosStateMacrogroupMacro
@Prop({ default: 'primary' }) declare readonly color: string
get klipperMacro() {
return this.$store.getters['printer/getMacro'](this.macro.name)
@@ -80,15 +80,15 @@ export default class MiscellaneousSlider extends Mixins(BaseMixin) {
private min = 0
private value = 0
@Prop({ type: Number, required: true }) target!: number
@Prop({ type: Number, default: 1 }) max!: number
@Prop({ type: String, default: '' }) name!: string
@Prop({ type: String, default: '' }) type!: string
@Prop({ type: Boolean, default: false }) controllable!: boolean
@Prop({ type: Boolean, default: false }) pwm!: boolean
@Prop({ type: [Number, Boolean], default: false }) rpm!: number | boolean
@Prop({ type: Number, default: 1 }) multi!: number
@Prop({ type: Number, default: 0 }) off_below!: number
@Prop({ type: Number, required: true }) declare target: number
@Prop({ type: Number, default: 1 }) declare max: number
@Prop({ type: String, default: '' }) declare name: string
@Prop({ type: String, default: '' }) declare type: string
@Prop({ type: Boolean, default: false }) declare controllable: boolean
@Prop({ type: Boolean, default: false }) declare pwm: boolean
@Prop({ type: [Number, Boolean], default: false }) declare rpm: number | boolean
@Prop({ type: Number, default: 1 }) declare multi: number
@Prop({ type: Number, default: 0 }) declare off_below: number
@Watch('lockSliders', {immediate: true})
lockSlidersChanged(){
+11 -11
View File
@@ -61,17 +61,17 @@ export default class MotionSettingsInput extends Mixins(BaseMixin) {
private value: number = 0
private error: boolean | undefined
@Prop({ type: String, required: true }) readonly label!: string
@Prop({ type: Number, required: false , default: 1 }) readonly step!: number
@Prop({ type: Boolean, required: false , default: false }) readonly hasSpinner!: number
@Prop({ type: Number, required: false , default: 1 }) readonly spinnerFactor!: number
@Prop({ type: Number, required: true , default: 0 }) readonly min!: number
@Prop({ type: Number, default: null }) readonly max!: number | null
@Prop({ type: Number, required: true , default: 0 }) readonly dec!: number
@Prop({ type: Number, required: true, default: 0 }) readonly target!: number
@Prop({ type: Number, required: true, default: 0 }) readonly defaultValue!: number
@Prop({ type: String, required: true }) readonly attributeName!: string
@Prop({ type: String, required: true }) readonly unit!: string
@Prop({ type: String, required: true }) declare readonly label: string
@Prop({ type: Number, required: false , default: 1 }) declare readonly step: number
@Prop({ type: Boolean, required: false , default: false }) declare readonly hasSpinner: number
@Prop({ type: Number, required: false , default: 1 }) declare readonly spinnerFactor: number
@Prop({ type: Number, required: true , default: 0 }) declare readonly min: number
@Prop({ type: Number, default: null }) declare readonly max: number | null
@Prop({ type: Number, required: true , default: 0 }) declare readonly dec: number
@Prop({ type: Number, required: true, default: 0 }) declare readonly target: number
@Prop({ type: Number, required: true, default: 0 }) declare readonly defaultValue: number
@Prop({ type: String, required: true }) declare readonly attributeName: string
@Prop({ type: String, required: true }) declare readonly unit: string
@Watch('target')
targetChanged(newVal: number): void {
@@ -61,18 +61,18 @@ export default class PressureAdvanceSettingsInput extends Mixins(BaseMixin) {
private value: number = 0
private error: boolean | undefined
@Prop({ type: String, required: true }) readonly label!: string
@Prop({ type: Number, required: false , default: 1 }) readonly step!: number
@Prop({ type: Boolean, required: false , default: false }) readonly hasSpinner!: number
@Prop({ type: Number, required: false , default: 1 }) readonly spinnerFactor!: number
@Prop({ type: Number, required: true , default: 0 }) readonly min!: number
@Prop({ type: Number, default: null }) readonly max!: number | null
@Prop({ type: Number, required: true , default: 0 }) readonly dec!: number
@Prop({ type: Number, required: true, default: 0 }) readonly target!: number
@Prop({ type: Number, required: true, default: 0 }) readonly defaultValue!: number
@Prop({ type: String, required: true, default: 'extruder'}) readonly extruder!: string
@Prop({ type: String, required: true }) readonly attributeName!: string
@Prop({ type: String, required: true }) readonly unit!: string
@Prop({ type: String, required: true }) declare readonly label: string
@Prop({ type: Number, required: false , default: 1 }) declare readonly step: number
@Prop({ type: Boolean, required: false , default: false }) declare readonly hasSpinner: number
@Prop({ type: Number, required: false , default: 1 }) declare readonly spinnerFactor: number
@Prop({ type: Number, required: true , default: 0 }) declare readonly min: number
@Prop({ type: Number, default: null }) declare readonly max: number | null
@Prop({ type: Number, required: true , default: 0 }) declare readonly dec: number
@Prop({ type: Number, required: true, default: 0 }) declare readonly target: number
@Prop({ type: Number, required: true, default: 0 }) declare readonly defaultValue: number
@Prop({ type: String, required: true, default: 'extruder'}) declare readonly extruder: string
@Prop({ type: String, required: true }) declare readonly attributeName: string
@Prop({ type: String, required: true }) declare readonly unit: string
@Watch('target')
targetChanged(newVal: number): void {
+7 -7
View File
@@ -44,13 +44,13 @@ import BaseMixin from '@/components/mixins/base'
export default class ToolInput extends Mixins(BaseMixin) {
private value: any = 0
@Prop({ type: String, required: true }) readonly name!: string
@Prop({ type: Number, required: true, default: 0 }) readonly target!: number
@Prop({ type: Number, required: true }) readonly min_temp!: number
@Prop({ type: Number, required: true }) readonly max_temp!: number
@Prop({ type: String, required: true }) readonly command!: string
@Prop({ type: String, required: true }) readonly attributeName!: string
@Prop({ type: Array, default: [] }) items!: number[]
@Prop({ type: String, required: true }) declare readonly name: string
@Prop({ type: Number, required: true, default: 0 }) declare readonly target: number
@Prop({ type: Number, required: true }) declare readonly min_temp: number
@Prop({ type: Number, required: true }) declare readonly max_temp: number
@Prop({ type: String, required: true }) declare readonly command: string
@Prop({ type: String, required: true }) declare readonly attributeName: string
@Prop({ type: Array, default: [] }) declare items: number[]
changeValue(newVal: any) {
if (typeof newVal === 'object') {
+13 -13
View File
@@ -79,19 +79,19 @@ export default class ToolSlider extends Mixins(BaseMixin) {
processedMax = 100
dynamicStep = 50
@Prop({ type: Number, required: true }) readonly target!: number
@Prop({ type: String, required: true }) readonly command!: string
@Prop({ type: String, default: '' }) readonly attributeName!: string
@Prop({ type: String, default: '' }) readonly label!: string
@Prop({ type: String, default: '' }) readonly icon!: string
@Prop({ type: String, default: '%' }) readonly unit!: string
@Prop({ type: Number, default: 1 }) readonly attributeScale!: number
@Prop({ type: Number, default: 0 }) readonly min!: number
@Prop({ type: Number, default: 100 }) readonly max!: number
@Prop({ type: Boolean, default: false }) readonly dynamicRange!: boolean
@Prop({ type: Number, default: 100 }) readonly defaultValue!: number
@Prop({ type: Number, default: 100 }) readonly step!: number
@Prop({ type: Number, default: 1 }) readonly multi!: number
@Prop({ type: Number, required: true }) declare readonly target: number
@Prop({ type: String, required: true }) declare readonly command: string
@Prop({ type: String, default: '' }) declare readonly attributeName: string
@Prop({ type: String, default: '' }) declare readonly label: string
@Prop({ type: String, default: '' }) declare readonly icon: string
@Prop({ type: String, default: '%' }) declare readonly unit: string
@Prop({ type: Number, default: 1 }) declare readonly attributeScale: number
@Prop({ type: Number, default: 0 }) declare readonly min: number
@Prop({ type: Number, default: 100 }) declare readonly max: number
@Prop({ type: Boolean, default: false }) declare readonly dynamicRange: boolean
@Prop({ type: Number, default: 100 }) declare readonly defaultValue: number
@Prop({ type: Number, default: 100 }) declare readonly step: number
@Prop({ type: Number, default: 1 }) declare readonly multi: number
created() {
this.value = this.target * this.multi
+2 -2
View File
@@ -136,8 +136,8 @@ import Panel from '@/components/ui/Panel.vue'
export default class FarmPrinterPanel extends Mixins(BaseMixin) {
private imageHeight = 200;
@Prop({ type: Object, required: true }) printer!: FarmPrinterState
@Ref() readonly imageDiv!: Vue
@Prop({ type: Object, required: true }) declare printer: FarmPrinterState
@Ref() declare readonly imageDiv: Vue
get printerUrl() {
const thisUrl = window.location.href.split('/')
+1 -1
View File
@@ -452,7 +452,7 @@ export default class GcodefilesPanel extends Mixins(BaseMixin) {
formatPrintTime = formatPrintTime
sortFiles = sortFiles
$refs!: {
declare $refs: {
fileUpload: HTMLInputElement,
inputFieldRenameFile: HTMLInputElement,
inputFieldCreateDirectory: HTMLInputElement,
@@ -354,7 +354,7 @@ export default class ConfigFilesPanel extends Mixins(BaseMixin) {
formatFilesize = formatFilesize
formatDate = formatDate
$refs!: {
declare $refs: {
fileUpload: HTMLInputElement,
inputDialogCreateFileName: HTMLInputElement,
inputDialogRenameFileName: HTMLInputElement,
+1 -1
View File
@@ -37,7 +37,7 @@ import {GuiMacrosStateMacrogroupMacro} from '@/store/gui/macros/types'
})
export default class MacrogroupPanel extends Mixins(BaseMixin) {
@Prop({ required: true }) panelId!: string
@Prop({ required: true }) declare panelId: string
get macrogroup() {
return this.$store.getters['gui/macros/getMacrogroup'](this.panelId)
+1 -1
View File
@@ -100,7 +100,7 @@ import Panel from '@/components/ui/Panel.vue'
}
})
export default class MiniconsolePanel extends Mixins(BaseMixin) {
$refs!: {
declare $refs: {
gcodeCommandField: VTextareaType,
console: ConsoleTable,
miniConsoleScroll: any
+1 -1
View File
@@ -297,7 +297,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {
maxFlow = 0
boolShowObjects = false
$refs!: {
declare $refs: {
bigThumbnail: any
}
@@ -54,7 +54,7 @@ export default class StatusPanelExcludeObject extends Mixins(BaseMixin) {
boolShowExcludeObjectDialog = false
excludeObjectDialogName = ''
@Prop({ required: true }) readonly showDialog!: boolean
@Prop({ required: true }) declare readonly showDialog: boolean
get showDialogPass() {
return this.showDialog
@@ -48,9 +48,9 @@ import Panel from '@/components/ui/Panel.vue'
export default class StatusPanelExcludeObjectDialog extends Mixins(BaseMixin) {
private hoverName = ''
@Prop({ required: true }) readonly showDialog!: boolean
@Prop({ required: true }) readonly excludeObjectDialogBool!: boolean
@Prop({ required: true }) readonly excludeObjectDialogName!: string
@Prop({ required: true }) declare readonly showDialog: boolean
@Prop({ required: true }) declare readonly excludeObjectDialogBool: boolean
@Prop({ required: true }) declare readonly excludeObjectDialogName: string
hideDialog() {
this.$emit('update:showDialog', false )
@@ -26,7 +26,7 @@ import BaseMixin from '@/components/mixins/base'
@Component
export default class StatusPanelObjectsDialogList extends Mixins(BaseMixin) {
@Prop({ required: false, default: '' }) readonly hoverName!: string
@Prop({ required: false, default: '' }) declare readonly hoverName: string
get printing_objects() {
return this.$store.state.printer.exclude_object?.objects ?? []
@@ -72,9 +72,9 @@ export default class StatusPanelObjectsDialogMap extends Mixins(BaseMixin) {
private coordinationCrossColor = '#888'
private stripesOffset = 50
@Prop({ required: false, default: '' }) readonly hoverName!: string
@Prop({ required: false, default: '' }) declare readonly hoverName: string
$refs!: {
declare $refs: {
tooltipObjectMap: HTMLDivElement
}
@@ -277,7 +277,7 @@ export default class TimelapseFilesPanel extends Mixins(BaseMixin) {
formatFilesize = formatFilesize
sortFiles = sortFiles
$refs!: {
declare $refs: {
inputFieldRenameFile: any,
inputFieldCreateDirectory: any,
inputFieldRenameDirectory: any,
+1 -1
View File
@@ -89,7 +89,7 @@ import {GuiWebcamStateWebcam} from '@/store/gui/webcams/types'
}
})
export default class WebcamPanel extends Mixins(BaseMixin) {
@Prop({ default: 'dashboard' }) viewport?: string
@Prop({ default: 'dashboard' }) declare viewport?: string
get webcams(): GuiWebcamStateWebcam[] {
return this.$store.getters['gui/webcams/getWebcams']
@@ -214,7 +214,7 @@ import SettingsRow from '@/components/settings/SettingsRow.vue'
})
export default class SettingsControlTab extends Mixins(BaseMixin) {
$refs!: {
declare $refs: {
formControlExtruder: HTMLFormElement
}
@@ -213,7 +213,7 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin) {
private mainsailKeys: { name: string, label: string}[] = []
private availableNamespaces: string[] = []
$refs!: {
declare $refs: {
uploadBackupFile: HTMLInputElement
}
@@ -282,15 +282,14 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin) {
}
get availableLanguages() {
// eslint-disable-next-line no-undef
const locales = require.context('@/locales', true, /[A-Za-z0-9-_,\s]+\.json$/i)
const locales = import.meta.globEager('../../locales/*.json')
const languages: any = []
locales.keys().map((key: string) => {
const langKey = key.slice(2, key.lastIndexOf('.'))
Object.keys(locales).map((file: string) => {
const langKey = file.slice(file.lastIndexOf('.') - 2, file.lastIndexOf('.'))
languages.push({
text: locales(key).title,
text: locales[file].title,
value: langKey
})
})
@@ -478,4 +477,4 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin) {
})
}
}
</script>
</script>
+6 -6
View File
@@ -32,22 +32,22 @@ import BaseMixin from '../mixins/base'
@Component
export default class SettingsRow extends Mixins(BaseMixin) {
@Prop({ required: false, default: false })
readonly loading!: boolean
declare readonly loading: boolean
@Prop({ required: false, default: '' })
readonly icon!: string
declare readonly icon: string
@Prop({ required: true })
readonly title!: string
declare readonly title: string
@Prop({ required: false })
readonly subTitle!: string
declare readonly subTitle: string
@Prop({ required: false, default: false })
readonly dynamicSlotWidth!: boolean
declare readonly dynamicSlotWidth: boolean
@Prop({ required: false, default: false })
readonly mobileSecondRow!: boolean
declare readonly mobileSecondRow: boolean
get firstColClasses() {
const defaultClasses = ' d-flex justify-center'
@@ -214,7 +214,7 @@ export default class SettingsWebcamsTab extends Mixins(BaseMixin) {
unique: (value: string) => !this.existsWebcamName(value) || this.$t('Settings.WebcamsTab.NameAlreadyExists'),
}
$refs!: {
declare $refs: {
webcamForm: any
}
+2 -2
View File
@@ -78,8 +78,8 @@ import BaseMixin from '@/components/mixins/base'
@Component
export default class ConnectionStatus extends Mixins(BaseMixin) {
@Prop({ default: false }) readonly moonraker: boolean | undefined
@Prop({ default: false }) readonly klipper: boolean | undefined
@Prop({ default: false }) declare readonly moonraker: boolean | undefined
@Prop({ default: false }) declare readonly klipper: boolean | undefined
get colorMainsail() {
return '200,200,200'
+1 -1
View File
@@ -20,7 +20,7 @@ export default class MainsailLogo extends Mixins(BaseMixin) {
private internalColor = defaultLogoColor
@Prop({ required: false, default: '' })
readonly color!: string
declare readonly color: string
@Watch('color')
colorChanged(newVal: string) {
+26 -26
View File
@@ -78,38 +78,38 @@ import {panelToolbarHeight} from '@/store/variables'
export default class Panel extends Mixins(BaseMixin) {
panelToolbarHeight = panelToolbarHeight
@Prop({ default: null }) readonly icon!: string | null
@Prop({ required: true, default: '' }) readonly title!: string
@Prop({ default: false }) readonly collapsible!: boolean
@Prop({ required: true }) readonly cardClass!: string
@Prop({ default: '' }) readonly toolbarColor!: string
@Prop({ default: '' }) readonly toolbarClass!: string
@Prop({ default: false }) readonly loading!: boolean
@Prop({ default: true }) readonly marginBottom!: boolean
@Prop({ default: false }) readonly hideButtonsOnCollapse!: boolean
@Prop({ default: null }) declare readonly icon: string | null
@Prop({ required: true, default: '' }) declare readonly title: string
@Prop({ default: false }) declare readonly collapsible: boolean
@Prop({ required: true }) declare readonly cardClass: string
@Prop({ default: '' }) declare readonly toolbarColor: string
@Prop({ default: '' })declare readonly toolbarClass: string
@Prop({ default: false }) declare readonly loading: boolean
@Prop({ default: true }) declare readonly marginBottom: boolean
@Prop({ default: false }) declare readonly hideButtonsOnCollapse: boolean
get expand() {
return this.$store.getters['gui/getPanelExpand'](this.cardClass)
}
get expand() {
return this.$store.getters['gui/getPanelExpand'](this.cardClass)
}
set expand(newVal) {
this.$store.dispatch('gui/saveExpandPanel', { name: this.cardClass, value: newVal })
}
set expand(newVal) {
this.$store.dispatch('gui/saveExpandPanel', { name: this.cardClass, value: newVal })
}
get hasIconSlot() {
return !! this.$slots.icon
}
get hasIconSlot() {
return !! this.$slots.icon
}
get hasButtonsSlot() {
return !! this.$slots.buttons
}
get hasButtonsSlot() {
return !! this.$slots.buttons
}
get getToolbarClass() {
let output = this.toolbarClass
get getToolbarClass() {
let output = this.toolbarClass
if (this.collapsible) output += ' collapsible'
if (this.collapsible) output += ' collapsible'
return output
}
return output
}
}
</script>
+4 -4
View File
@@ -40,10 +40,10 @@ import BaseMixin from '@/components/mixins/base'
export default class Panel extends Mixins(BaseMixin) {
@Prop({ required: false, default: 'mdi-minus' }) readonly iconExpanded!: string | null
@Prop({ required: false, default: 'mdi-plus' }) readonly iconCollapsed!: string | null
@Prop({ required: true, default: '' }) readonly title!: string
@Prop({ required: true }) readonly subPanelClass!: string
@Prop({ required: false, default: 'mdi-minus' }) declare readonly iconExpanded: string | null
@Prop({ required: false, default: 'mdi-plus' }) declare readonly iconCollapsed: string | null
@Prop({ required: true, default: '' }) declare readonly title: string
@Prop({ required: true }) declare readonly subPanelClass: string
get expand() {
return this.$store.getters['gui/getPanelExpand'](this.subPanelClass)
+2 -2
View File
@@ -44,9 +44,9 @@ export default class Mjpegstreamer extends Mixins(BaseMixin) {
@Prop()
printerUrl: string | undefined
@Prop({ default: true }) showFps!: boolean
@Prop({ default: true }) declare showFps: boolean
$refs!: {
declare $refs: {
canvas: HTMLCanvasElement,
image: HTMLImageElement,
}
@@ -40,13 +40,13 @@ export default class MjpegstreamerAdaptive extends Mixins(BaseMixin) {
private request_time_smoothing = 0.1
private currentFPS = 0
$refs!: {
declare $refs: {
mjpegstreamerAdaptive: any
}
@Prop({ required: true }) camSettings: any
@Prop() printerUrl: string | undefined
@Prop({ default: true }) showFps!: boolean
@Prop({ required: true }) declare camSettings: any
@Prop() declare printerUrl: string | undefined
@Prop({ default: true }) declare showFps: boolean
get webcamStyle() {
let transforms = ''
+2 -2
View File
@@ -26,9 +26,9 @@ import {GuiWebcamStateWebcam} from '@/store/gui/webcams/types'
export default class Uv4lMjpeg extends Mixins(BaseMixin) {
private isVisible = true
@Prop({ required: true }) readonly camSettings!: GuiWebcamStateWebcam
@Prop({ required: true }) declare readonly camSettings: GuiWebcamStateWebcam
@Prop({ default: null }) readonly printerUrl!: string | null
@Prop({ default: null }) declare readonly printerUrl: string | null
get url() {
const baseUrl = this.camSettings.urlStream
+1 -1
View File
@@ -49,6 +49,6 @@ import {GuiWebcamStateWebcam} from '@/store/gui/webcams/types'
})
export default class WebcamGrid extends Mixins(BaseMixin) {
@Prop() readonly webcams!: GuiWebcamStateWebcam[]
@Prop() declare readonly webcams: GuiWebcamStateWebcam[]
}
</script>
+3
View File
@@ -1,3 +1,6 @@
import 'regenerator-runtime' // async polyfill used by the gcodeviewer
import Vue from 'vue'
import App from '@/App.vue'
import vuetify from '@/plugins/vuetify'
+1 -1
View File
@@ -98,7 +98,7 @@ export default class PageConsole extends Mixins(BaseMixin) {
private lastCommandNumber: number | null = null
private items = []
$refs!: {
declare $refs: {
gcodeCommandField: VTextareaType,
console: ConsoleTable,
consoleScroll: any
+1 -1
View File
@@ -216,7 +216,7 @@ interface HeightmapSerie {
})
export default class PageHeightmap extends Mixins(BaseMixin, ControlMixin) {
$refs!: {
declare $refs: {
// eslint-disable-next-line
heightmap: any,
inputDialogRenameHeightmapName: HTMLInputElement,
+2 -2
View File
@@ -3,12 +3,12 @@
</template>
<script lang="ts">
import Viewer from '@/components/gcodeviewer/Viewer.vue'
import BaseMixin from '@/components/mixins/base'
import {Component, Mixins} from 'vue-property-decorator'
import Viewer from '@/components/gcodeviewer/Viewer.vue'
@Component({
components: {Viewer},
})
export default class PageGCodeViewer extends Mixins(BaseMixin) {}
</script>
</script>
+22
View File
@@ -0,0 +1,22 @@
import fs from 'fs'
import path from 'path'
import {version} from '../../package.json'
import {PluginOption} from 'vite'
/**
* Custom build plugin to write the version in a deticated .version file after bundling
*/
export default function buildVersion(): PluginOption {
return {
name: 'build-version',
writeBundle: (context, options, ) => {
setImmediate(async () => {
const versionIdentifier = version.toString()
const versionFile = await fs.promises.open(path.resolve(__dirname, '../../dist/.version'), 'w')
await versionFile.writeFile(`v${versionIdentifier}`)
await versionFile.close()
})
}
}
}
+12 -10
View File
@@ -2,23 +2,25 @@ import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
function loadLocaleMessages() {
const locales = require.context('../locales', true, /[A-Za-z0-9-_,\s]+\.json$/i)
const locales = import.meta.globEager('../locales/*.json')
const messages: any = {}
locales.keys().forEach(key => {
const matched = key.match(/([A-Za-z0-9-_]+)\./i)
if (matched && matched.length > 1) {
const locale = matched[1]
messages[locale] = locales(key)
for(const file in locales){
const langKey = file.slice(file.lastIndexOf('.') - 2, file.lastIndexOf('.'))
if (langKey && langKey.length > 1) {
messages[langKey] = JSON.parse(JSON.stringify(locales[file]))
}
})
}
return messages
}
export default new VueI18n({
locale: process.env.VUE_APP_I18N_LOCALE || 'en',
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en',
locale: (import.meta.env.VUE_APP_I18N_LOCALE as string) || 'en',
fallbackLocale: (import.meta.env.VUE_APP_I18N_FALLBACK_LOCALE as string) || 'en',
messages: loadLocaleMessages()
})
})
+4 -6
View File
@@ -2,13 +2,11 @@ import Dashboard from '../pages/Dashboard.vue'
import Webcam from '../pages/Webcam.vue'
import Farm from '../pages/Farm.vue'
import Console from '../pages/Console.vue'
import Heightmap from '../pages/Heightmap.vue'
import Files from '../pages/Files.vue'
import History from '../pages/History.vue'
import Timelapse from '../pages/Timelapse.vue'
import Machine from '../pages/Machine.vue'
import {Component} from 'vue'
import Viewer from '../pages/Viewer.vue'
import {AsyncComponent, Component} from 'vue'
const routes: AppRoute[] = [
{
@@ -47,7 +45,7 @@ const routes: AppRoute[] = [
title: 'Heightmap',
path: '/heightmap',
icon: 'grid',
component: Heightmap,
component: () => import('../pages/Heightmap.vue'),
alwaysShow: false,
showInNavi: true,
klipperComponent: 'bed_mesh',
@@ -65,7 +63,7 @@ const routes: AppRoute[] = [
title: 'G-Code Viewer',
path: '/viewer',
icon: 'video-3d',
component: Viewer,
component: () => import('../pages/Viewer.vue'),
alwaysShow: false,
showInNavi: true,
},
@@ -112,7 +110,7 @@ export interface AppRoute {
path: string,
redirect?: string,
icon?: string,
component: Component | null,
component: Component | AsyncComponent | null,
alwaysShow: boolean,
showInNavi: boolean,
registeredDirectory?: string,
+2 -2
View File
@@ -180,7 +180,7 @@ export const actions: ActionTree<FarmPrinterState, RootState> = {
}
})
if (subscripts !== {})
if (Object.keys(subscripts).length > 0)
dispatch('sendObj', {
method: 'printer.objects.subscribe',
params: { objects: subscripts },
@@ -244,4 +244,4 @@ export const actions: ActionTree<FarmPrinterState, RootState> = {
getWebcamsData({ commit }, payload) {
commit('setWebcamsData', payload.value)
}
}
}
+2 -2
View File
@@ -19,8 +19,8 @@ Vue.use(Vuex)
export const getDefaultState = (): RootState => {
return {
packageVersion: process.env.PACKAGE_VERSION || '0.0.0',
debugMode: process.env.VUE_APP_DEBUG_MODE || false,
packageVersion: (import.meta.env.PACKAGE_VERSION as string) || '0.0.0',
debugMode: (import.meta.env.VUE_APP_DEBUG_MODE as boolean) || false,
naviDrawer: null,
}
}
+2 -2
View File
@@ -44,7 +44,7 @@ export const actions: ActionTree<PrinterState, RootState> = {
if (!blocklist.includes(nameSplit[0])) subscripts = {...subscripts, [key]: null }
})
if (subscripts !== {}) Vue.$socket.emit('printer.objects.subscribe', { objects: subscripts }, { action: 'printer/getInitData' })
if (Object.keys(subscripts).length > 0) Vue.$socket.emit('printer.objects.subscribe', { objects: subscripts }, { action: 'printer/getInitData' })
else Vue.$socket.emit('server.temperature_store', {}, { action: 'printer/tempHistory/init' })
},
@@ -88,4 +88,4 @@ export const actions: ActionTree<PrinterState, RootState> = {
Vue.$socket.emit('printer.gcode.script', { script: payload }, { loading: 'sendGcode' })
}
}
}
}
+5 -5
View File
@@ -7,11 +7,11 @@ import {RootState} from '@/store/types'
export const getDefaultState = (): SocketState => {
return {
remoteMode: process.env.VUE_APP_REMOTE_MODE?.toLowerCase() === 'true' || (document.location.hostname === 'my.mainsail.xyz'),
hostname: process.env.VUE_APP_HOSTNAME || (process.env.VUE_APP_REMOTE_MODE?.toLowerCase() === 'true' || document.location.hostname === 'my.mainsail.xyz' ? '' : window.location.hostname),
port: process.env.VUE_APP_PORT || (process.env.VUE_APP_REMOTE_MODE?.toLowerCase() === 'true' || document.location.hostname === 'my.mainsail.xyz' ? 7125 : window.location.port),
remoteMode: import.meta.env.VUE_APP_REMOTE_MODE === true || (document.location.hostname === 'my.mainsail.xyz'),
hostname: (import.meta.env.VUE_APP_HOSTNAME as string) || ((import.meta.env.VUE_APP_REMOTE_MODE === true || document.location.hostname === 'my.mainsail.xyz') ? '' : window.location.hostname),
port: Number(import.meta.env.VUE_APP_PORT || (import.meta.env.VUE_APP_REMOTE_MODE === true || document.location.hostname === 'my.mainsail.xyz' ? 7125 : window.location.port)),
protocol: document.location.protocol === 'https:' ? 'wss' : 'ws',
reconnectInterval: process.env.VUE_APP_RECONNECT_INTERVAL || 2000,
reconnectInterval: Number(import.meta.env.VUE_APP_RECONNECT_INTERVAL || 2000),
isConnected: false,
isConnecting: false,
connectingFailed: false,
@@ -28,4 +28,4 @@ export const socket: Module<SocketState, RootState> = {
getters,
actions,
mutations
}
}
+3 -2
View File
@@ -12,8 +12,9 @@
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"vuetify"
"vite/client",
"vuetify",
"@intlify/vite-plugin-vue-i18n/client"
],
"paths": {
"@/*": [
+40
View File
@@ -0,0 +1,40 @@
import {createVuePlugin as vue} from 'vite-plugin-vue2'
import loadVersion from 'vite-plugin-package-version'
import {defineConfig} from 'vite'
import Components from 'unplugin-vue-components/vite'
import {VuetifyResolver,} from 'unplugin-vue-components/resolvers'
import path from 'path'
import buildVersion from './src/plugins/build-version';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
buildVersion(),
vue(),
loadVersion(),
Components({
resolvers: [
VuetifyResolver(),
],
}),
], css: {
preprocessorOptions: {
css: {charset: false},
scss: {
quietDeps: true
},
}
},
envPrefix: 'VUE_',
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
port: 8080
}
})
-78
View File
@@ -1,78 +0,0 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const webpack = require('webpack')
const generate = require('generate-file-webpack-plugin')
const fs = require('fs')
const packageJson = fs.readFileSync('./package.json')
const version = JSON.parse(packageJson).version || 0
module.exports = {
productionSourceMap: false,
transpileDependencies: [ 'vuetify' ],
pluginOptions: {
i18n: {
locale: 'en',
fallbackLocale: 'en',
localeDir: 'locales',
enableInSFC: true
}
},
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
'process.env': {
PACKAGE_VERSION: '"' + version + '"'
}
}),
generate({
file: '.version',
content: 'v' + version
}),
],
resolve: {
alias: {
vue$: 'vue/dist/vue.esm.js',
'@': path.resolve('src')
}
}
},
pwa: {
serviceWorker: false,
iconPaths: {
favicon16: 'img/icons/favicon-16x16.png',
favicon32: 'img/icons/favicon-32x32.png',
appleTouchIcon: 'img/icons/apple-touch-icon-152x152.png',
msTileImage: 'img/icons/mstile-150x150.png'
},
manifestPath: 'manifest.json',
name: 'Mainsail',
themeColor: '#121212',
msTileColor: '#121212',
appleMobileWebAppCapable: 'yes',
appleMobileWebAppStatusBarStyle: 'black',
manifestOptions: {
'short_name': 'Mainsail',
'name': 'Mainsail',
'start_url': '/',
'display': 'standalone',
'theme_color': '#D51F26',
'background_color': '#121212',
'icons': [
{
'src': './img/icons/icon-196-maskable.png',
'sizes': '196x196',
'type': 'image/png',
'purpose': 'maskable',
},
{
'src': './img/icons/icon-512-maskable.png',
'sizes': '512x512',
'type': 'image/png',
'purpose': 'maskable',
},
]
}
}
}