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

perf(vite): chunk webcams, locales and large libraries #1578

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1,898 changes: 970 additions & 928 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
"@jaames/iro": "^5.5.2",
"@lezer/highlight": "^1.0.0",
"@sindarius/gcodeviewer": "^3.2.2",
"@types/node": "^18.0.0",
"@types/overlayscrollbars": "^1.12.1",
"@uiw/codemirror-theme-vscode": "^4.19.11",
"axios": "^0.27.0",
"codemirror": "^6.0.1",
Expand All @@ -45,12 +43,12 @@
"echarts-gl": "^2.0.8",
"hls.js": "^1.3.3",
"jmuxer": "^2.0.5",
"js-sha256": "^0.9.0",
"js-sha256": "^0.10.0",
"lodash.kebabcase": "^4.1.1",
"lodash.throttle": "^4.1.1",
"overlayscrollbars": "^1.13.1",
"overlayscrollbars-vue": "^0.2.2",
"regenerator-runtime": "^0.13.9",
"regenerator-runtime": "^0.14.0",
"resize-observer-polyfill": "^1.5.1",
"semver": "^7.5.2",
"typed_janus_js": "^1.0.14",
Expand All @@ -76,8 +74,10 @@
"@types/jmuxer": "^2.0.3",
"@types/lodash.kebabcase": "^4.1.6",
"@types/lodash.throttle": "^4.1.6",
"@types/node": "^20.0.0",
"@types/overlayscrollbars": "^1.12.1",
"@types/semver": "^7.3.8",
"@types/uuid": "^8.3.1",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
Expand All @@ -87,13 +87,15 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jsonc": "^2.2.1",
"eslint-plugin-vue": "^9.0.0",
"postcss": "^8.4.31",
"postcss-nesting": "^12.0.1",
"prettier": "^3.0.0",
"sass": "~1.32",
"start-server-and-test": "^1.14.0",
"start-server-and-test": "^2.0.0",
"typescript": "^4.5.5",
"unplugin-vue-components": "^0.22.12",
"vite": "^3.2.7",
"vite-plugin-checker": "^0.5.0",
"vite": "^4.4.9",
"vite-plugin-checker": "^0.6.0",
"vite-plugin-package-version": "^1.0.2",
"vite-plugin-pwa": "^0.16.4",
"vite-plugin-vue2": "^2.0.1",
Expand Down
13 changes: 7 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import TheUploadSnackbar from '@/components/TheUploadSnackbar.vue'
import TheManualProbeDialog from '@/components/dialogs/TheManualProbeDialog.vue'
import TheBedScrewsDialog from '@/components/dialogs/TheBedScrewsDialog.vue'
import TheScrewsTiltAdjustDialog from '@/components/dialogs/TheScrewsTiltAdjustDialog.vue'
import { setAndLoadLocale } from './plugins/i18n'

Component.registerHooks(['metaInfo'])

Expand Down Expand Up @@ -162,8 +163,8 @@ export default class App extends Mixins(BaseMixin) {
}

@Watch('language')
languageChanged(newVal: string): void {
this.$i18n.locale = newVal
async languageChanged(newVal: string): Promise<void> {
await setAndLoadLocale(newVal)
}

@Watch('customStylesheet')
Expand Down Expand Up @@ -310,10 +311,10 @@ export default class App extends Mixins(BaseMixin) {
<style>
@import './assets/styles/fonts.css';
@import './assets/styles/toastr.css';
@import './assets/styles/page.scss';
@import './assets/styles/sidebar.scss';
@import './assets/styles/utils.scss';
@import './assets/styles/updateManager.scss';
@import './assets/styles/page.css';
@import './assets/styles/sidebar.css';
@import './assets/styles/utils.css';
@import './assets/styles/updateManager.css';

:root {
--app-height: 100%;
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 0 additions & 9 deletions src/assets/styles/utils.scss → src/assets/styles/utils.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
@mixin no-select {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

.user-select-none {
-webkit-touch-callout: none;
-webkit-user-select: none;
Expand Down
2 changes: 1 addition & 1 deletion src/components/CommandHelpModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default class CommandHelpModal extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
.command-help-content {
overflow-x: hidden;

Expand Down
2 changes: 1 addition & 1 deletion src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export default class TheEditor extends Mixins(BaseMixin) {
}
}
</script>
<style lang="scss" scoped>
<style scoped>
::v-deep .ͼ1 .cm-panel.cm-search *:focus:not(.focus-visible) {
outline: none;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/console/ConsoleTable.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style scoped lang="scss"></style>
<style scoped></style>

<template>
<div :class="'consoleTable ' + (isMini ? 'mini' : '')">
Expand Down
2 changes: 1 addition & 1 deletion src/components/console/ConsoleTableEntry.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style scoped lang="scss">
<style scoped>
.consoleTableRow {
font-family: 'Roboto Mono', monospace;
font-size: 0.95em;
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialogs/TheBedScrewsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ export default class TheBedScrewsDialog extends Mixins(BaseMixin, ControlMixin)
}
</script>

<style lang="scss" scoped></style>
<style scoped></style>
2 changes: 1 addition & 1 deletion src/components/dialogs/TheManualProbeDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default class TheManualProbeDialog extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
.v-btn-toggle {
width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ExtruderMixi
}
</script>

<style lang="scss" scoped>
<style scoped>
._btn-group {
border-radius: 4px;
display: inline-flex;
Expand Down
3 changes: 1 addition & 2 deletions src/components/panels/Extruder/ExtruderControlPanelTools.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ export default class ExtruderControlPanel extends Mixins(BaseMixin, ControlMixin
}
</script>

<style lang="scss" scoped>
<style scoped>
._btn-group {
border-radius: 4px;
display: inline-flex;
flex-wrap: nowrap;
max-width: 100%;
min-width: 100%;
width: 100%;

.v-btn {
border-radius: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default class GitCommitsList extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
.groupedCommits {
padding-top: 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default class GitCommitsListDayCommit extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
li.commit {
border-color: rgb(48, 54, 61);
border-style: solid;
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/MacrogroupPanel.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped></style>
<style scoped></style>

<template>
<panel
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/ExcludeObject.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped></style>
<style scoped></style>

<template>
<div v-if="['printing', 'paused'].includes(printer_state) && printing_objects.length">
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/ExcludeObjectDialog.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped></style>
<style scoped></style>

<template>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/ExcludeObjectDialogList.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped></style>
<style scoped></style>

<template>
<div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/panels/Status/ExcludeObjectDialogMap.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<style lang="scss" scoped>
<style scoped>
svg {
//background: rgba(200, 200, 200);
border: 2px solid #888;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/Jobqueue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default class StatusPanelJobqueue extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
.filesJobqueue {
position: relative;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/JobqueueEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export default class StatusPanelJobqueueEntry extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
.filesJobqueue {
position: relative;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/PauseAtLayerDialog.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped></style>
<style scoped></style>

<template>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/Printstatus.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped></style>
<style scoped></style>

<template>
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/PrintstatusComplete.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped></style>
<style scoped></style>

<template>
<v-card-text class="pa-0">
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/PrintstatusPrinting.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped></style>
<style scoped></style>

<template>
<v-card-text class="pa-0">
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Status/PrintstatusThumbnail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export default class StatusPanelPrintstatusThumbnail extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
.statusPanel-big-thumbnail {
transition: height 0.25s ease-out;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/StatusPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ export default class StatusPanel extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
._border-radius {
border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit;
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/Temperature/TemperaturePanelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default class TemperaturePanelList extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
.temperature-panel-table th,
.temperature-panel-table ::v-deep td {
padding-top: 5px !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export default class TemperaturePanelListItem extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
::v-deep .v-icon._no-focus-style:focus::after {
opacity: 0 !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default class TemperaturePanelListItemNevermore extends Mixins(BaseMixin)
}
</script>

<style lang="scss" scoped>
<style scoped>
::v-deep .v-icon._no-focus-style:focus::after {
opacity: 0 !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class TemperaturePanelPresets extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
._preset-title {
font-size: 0.8125rem;
font-weight: 500;
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/ToolheadControls/BarsControl.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped>
<style scoped>
.btnHomeAxis {
width: 36px;
min-width: 36px !important;
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/ToolheadControls/CircleControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ export default class CircleControl extends Mixins(BaseMixin, ControlMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
svg {
max-height: 350px;
min-height: 275px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/ToolheadControls/CrossControl.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<style lang="scss" scoped>
<style scoped>
.btnMinWidthAuto {
min-width: auto !important;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/ToolheadControls/ZoffsetControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export default class ZoffsetControl extends Mixins(BaseMixin) {
}
</script>

<style lang="scss" scoped>
<style scoped>
.v-btn-toggle {
width: 100%;
}
Expand Down
35 changes: 19 additions & 16 deletions src/components/settings/SettingsGeneralTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin, SettingsGenera
mdiHelpCircle = mdiHelpCircle
mdiCloseThick = mdiCloseThick

availableLanguages: { text: string; value: string }[] = []

async created() {
const locales = import.meta.glob<string>('../../locales/*.json', { import: 'title' })
const languages: { text: string; value: string }[] = []

for (const file in locales) {
const langKey = file.slice(file.lastIndexOf('.') - 2, file.lastIndexOf('.'))
const title = await locales[file]()

languages.push({
text: title,
value: langKey,
})
}

this.availableLanguages = languages
}

get printerName() {
return this.$store.state.gui.general.printername
}
Expand All @@ -98,22 +117,6 @@ export default class SettingsGeneralTab extends Mixins(BaseMixin, SettingsGenera
this.$store.dispatch('gui/saveSetting', { name: 'general.language', value: newVal })
}

get availableLanguages() {
const locales = import.meta.glob('../../locales/*.json', { eager: true }) as { [key: string]: any }
const languages: { text: string; value: string }[] = []

Object.keys(locales).map((file: string) => {
const langKey = file.slice(file.lastIndexOf('.') - 2, file.lastIndexOf('.'))

languages.push({
text: locales[file].title,
value: langKey,
})
})

return languages
}

get dateFormat() {
return this.$store.state.gui.general.dateFormat
}
Expand Down
Loading
Loading