perf: support border radius on Linux, Windows 7 and below

This commit is contained in:
tiny-craft 2023-09-05 14:43:43 +08:00
parent 8912971be0
commit 7e60eec701
7 changed files with 123 additions and 122 deletions

View File

@ -53,7 +53,7 @@ jobs:
- name: Build frontend assets
shell: bash
run: |
npm install -g npm@8
npm install -g npm@9
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
mv tmp.json wails.json
cd frontend

View File

@ -59,7 +59,7 @@ jobs:
- name: Build frontend assets
shell: bash
run: |
npm install -g npm@8
npm install -g npm@9
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
mv tmp.json wails.json
cd frontend

View File

@ -52,7 +52,7 @@ jobs:
- name: Build frontend assets
shell: bash
run: |
npm install -g npm@8
npm install -g npm@9
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
mv tmp.json wails.json
cd frontend

View File

@ -26,7 +26,7 @@ hljs.registerLanguage('plaintext', plaintext)
const prefStore = usePreferencesStore()
const connectionStore = useConnectionStore()
const i18n = useI18n()
const initializing = ref(false)
const initializing = ref(true)
onMounted(async () => {
try {
initializing.value = true
@ -61,12 +61,8 @@ watch(
:theme-overrides="themeOverrides"
:locale="prefStore.themeLocale"
class="fill-height">
<n-global-style />
<n-dialog-provider>
<n-spin v-show="initializing" :theme-overrides="{ opacitySpinning: 0 }" style="--wails-draggable: drag">
<div id="launch-container" />
</n-spin>
<app-content v-if="!initializing" class="flex-item-expand" />
<app-content :loading="initializing" />
<!-- top modal dialogs -->
<connection-dialog />
@ -82,16 +78,4 @@ watch(
</n-config-provider>
</template>
<style lang="scss">
#launch-container {
width: 100vw;
height: 100vh;
}
#app-title {
text-align: center;
width: 100vw;
height: 30px;
line-height: 30px;
}
</style>
<style lang="scss"></style>

View File

@ -19,8 +19,11 @@ import iconUrl from '@/assets/images/icon.png'
const themeVars = useThemeVars()
const props = defineProps({
loading: Boolean,
})
const data = reactive({
initializing: false,
navMenuWidth: 60,
hoverResize: false,
resizing: false,
@ -75,103 +78,117 @@ watch(
<template>
<!-- app content-->
<div id="app-content-wrapper" class="flex-box-v">
<!-- title bar -->
<n-spin
:show="props.loading"
:theme-overrides="{ opacitySpinning: 0 }"
style="--wails-draggable: drag; border-radius: 10px"
:style="{ backgroundColor: themeVars.bodyColor }">
<div
id="app-toolbar"
class="flex-box-h"
style="--wails-draggable: drag"
:style="{ height: data.toolbarHeight + 'px' }"
@dblclick="WindowToggleMaximise">
<!-- title -->
id="app-content-wrapper"
class="flex-box-v"
:style="{
backgroundColor: themeVars.bodyColor,
color: themeVars.textColorBase,
}">
<!-- title bar -->
<div
id="app-toolbar-title"
:style="{
width: `${data.navMenuWidth + prefStore.general.asideWidth - 4}px`,
paddingLeft: isMacOS() ? '70px' : '10px',
}">
<n-space align="center" :wrap-item="false" :wrap="false" :size="3">
<n-avatar :src="iconUrl" color="#0000" :size="35" style="min-width: 35px" />
<div style="min-width: 68px; font-weight: 800">Tiny RDM</div>
<transition name="fade">
<n-text v-if="tabStore.nav === 'browser'" strong class="ellipsis" style="font-size: 13px">
- {{ get(tabStore.currentTab, 'name') }}
</n-text>
</transition>
</n-space>
</div>
<div
:class="{
'resize-divider-hover': data.hoverResize,
'resize-divider-drag': data.resizing,
}"
class="resize-divider resize-divider-hide"
@mousedown="startResize"
@mouseout="data.hoverResize = false"
@mouseover="data.hoverResize = true" />
<!-- browser tabs -->
<div v-show="tabStore.nav === 'browser'" class="app-toolbar-tab flex-item-expand">
<content-value-tab />
</div>
<div class="flex-item-expand"></div>
<!-- simulate window control buttons -->
<toolbar-control-widget v-if="!isMacOS()" :size="data.toolbarHeight" style="align-self: flex-start" />
</div>
<!-- content -->
<div id="app-content" :style="prefStore.generalFont" class="flex-box-h flex-item-expand">
<nav-menu v-model:value="tabStore.nav" :width="data.navMenuWidth" />
<!-- browser page-->
<div v-show="tabStore.nav === 'browser'" :class="{ dragging }" class="flex-box-h flex-item-expand">
<div id="app-side" :style="{ width: asideWidthVal }" class="flex-box-h flex-item">
<browser-pane
v-for="t in tabStore.tabs"
v-show="get(tabStore.currentTab, 'name') === t.name"
:key="t.name"
class="flex-item-expand" />
<div
:class="{
'resize-divider-hover': data.hoverResize,
'resize-divider-drag': data.resizing,
}"
class="resize-divider"
@mousedown="startResize"
@mouseout="data.hoverResize = false"
@mouseover="data.hoverResize = true" />
id="app-toolbar"
class="flex-box-h"
style="--wails-draggable: drag"
:style="{ height: data.toolbarHeight + 'px' }"
@dblclick="WindowToggleMaximise">
<!-- title -->
<div
id="app-toolbar-title"
:style="{
width: `${data.navMenuWidth + prefStore.general.asideWidth - 4}px`,
paddingLeft: isMacOS() ? '70px' : '10px',
}">
<n-space align="center" :wrap-item="false" :wrap="false" :size="3">
<n-avatar :src="iconUrl" color="#0000" :size="35" style="min-width: 35px" />
<div style="min-width: 68px; font-weight: 800">Tiny RDM</div>
<transition name="fade">
<n-text v-if="tabStore.nav === 'browser'" strong class="ellipsis" style="font-size: 13px">
- {{ get(tabStore.currentTab, 'name') }}
</n-text>
</transition>
</n-space>
</div>
<content-pane class="flex-item-expand" />
</div>
<!-- server list page -->
<div v-show="tabStore.nav === 'server'" :class="{ dragging }" class="flex-box-h flex-item-expand">
<div id="app-side" :style="{ width: asideWidthVal }" class="flex-box-h flex-item">
<connection-pane class="flex-item-expand" />
<div
:class="{
'resize-divider-hover': data.hoverResize,
'resize-divider-drag': data.resizing,
}"
class="resize-divider"
@mousedown="startResize"
@mouseout="data.hoverResize = false"
@mouseover="data.hoverResize = true" />
<div
:class="{
'resize-divider-hover': data.hoverResize,
'resize-divider-drag': data.resizing,
}"
class="resize-divider resize-divider-hide"
@mousedown="startResize"
@mouseout="data.hoverResize = false"
@mouseover="data.hoverResize = true" />
<!-- browser tabs -->
<div v-show="tabStore.nav === 'browser'" class="app-toolbar-tab flex-item-expand">
<content-value-tab />
</div>
<content-server-pane class="flex-item-expand" />
<div class="flex-item-expand"></div>
<!-- simulate window control buttons -->
<toolbar-control-widget v-if="!isMacOS()" :size="data.toolbarHeight" style="align-self: flex-start" />
</div>
<!-- log page -->
<div v-show="tabStore.nav === 'log'" class="flex-box-h flex-item-expand">
<content-log-pane ref="logPaneRef" class="flex-item-expand" />
<!-- content -->
<div id="app-content" :style="prefStore.generalFont" class="flex-box-h flex-item-expand">
<nav-menu v-model:value="tabStore.nav" :width="data.navMenuWidth" />
<!-- browser page-->
<div v-show="tabStore.nav === 'browser'" :class="{ dragging }" class="flex-box-h flex-item-expand">
<div id="app-side" :style="{ width: asideWidthVal }" class="flex-box-h flex-item">
<browser-pane
v-for="t in tabStore.tabs"
v-show="get(tabStore.currentTab, 'name') === t.name"
:key="t.name"
class="flex-item-expand" />
<div
:class="{
'resize-divider-hover': data.hoverResize,
'resize-divider-drag': data.resizing,
}"
class="resize-divider"
@mousedown="startResize"
@mouseout="data.hoverResize = false"
@mouseover="data.hoverResize = true" />
</div>
<content-pane class="flex-item-expand" />
</div>
<!-- server list page -->
<div v-show="tabStore.nav === 'server'" :class="{ dragging }" class="flex-box-h flex-item-expand">
<div id="app-side" :style="{ width: asideWidthVal }" class="flex-box-h flex-item">
<connection-pane class="flex-item-expand" />
<div
:class="{
'resize-divider-hover': data.hoverResize,
'resize-divider-drag': data.resizing,
}"
class="resize-divider"
@mousedown="startResize"
@mouseout="data.hoverResize = false"
@mouseover="data.hoverResize = true" />
</div>
<content-server-pane class="flex-item-expand" />
</div>
<!-- log page -->
<div v-show="tabStore.nav === 'log'" class="flex-box-h flex-item-expand">
<content-log-pane ref="logPaneRef" class="flex-item-expand" />
</div>
</div>
</div>
</div>
</n-spin>
</template>
<style lang="scss" scoped>
#app-content-wrapper {
height: 100%;
width: 100vw;
height: 100vh;
overflow: hidden;
box-sizing: border-box;
border-radius: 10px;
#app-toolbar {
background-color: v-bind('themeVars.tabColor');

View File

@ -18,17 +18,10 @@ html {
body {
margin: 0;
font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
}
@font-face {
font-family: "Nunito";
font-style: normal;
font-weight: 400;
src: local(""),
url("../assets/fonts/nunito-v16-latin-regular.woff2") format("woff2");
padding: 0;
background-color: #0000;
line-height: 1.5;
font-family: v-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"
}
#app {

17
main.go
View File

@ -9,6 +9,7 @@ import (
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/linux"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows"
"runtime"
"tinyrdm/backend/services"
)
@ -46,7 +47,7 @@ func main() {
AssetServer: &assetserver.Options{
Assets: assets,
},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 0},
OnStartup: func(ctx context.Context) {
app.startup(ctx)
connSvc.Start(ctx)
@ -66,12 +67,18 @@ func main() {
Message: "A modern lightweight cross-platform Redis desktop client.\n\nCopyright © 2023",
Icon: icon,
},
//WebviewIsTransparent: true,
//WindowIsTranslucent: true,
WebviewIsTransparent: false,
WindowIsTranslucent: false,
},
Windows: &windows.Options{
WebviewIsTransparent: true,
WindowIsTranslucent: true,
DisableFramelessWindowDecorations: true,
},
Linux: &linux.Options{
Icon: icon,
WebviewGpuPolicy: linux.WebviewGpuPolicyOnDemand,
Icon: icon,
WebviewGpuPolicy: linux.WebviewGpuPolicyOnDemand,
WindowIsTranslucent: true,
},
})