🎨 Refactor code structure

This commit is contained in:
2025-04-25 17:44:40 +08:00
parent 3483ac4cf6
commit b3ecc08468
12 changed files with 109 additions and 87 deletions

View File

@@ -1,11 +0,0 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import {Call as $Call, Create as $Create} from "@wailsio/runtime";
export function Greet(name: string): Promise<string> & { cancel(): void } {
let $resultPromise = $Call.ByID(1411160069, name) as any;
return $resultPromise;
}

View File

@@ -1,7 +0,0 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as GreetService from "./greetservice.js";
export {
GreetService
};

View File

@@ -10,6 +10,6 @@ declare module 'vue' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Toolbar: typeof import('./src/components/toolbar/index.vue')['default']
Toolbar: typeof import('./src/components/toolbar/Toolbar.vue')['default']
}
}

View File

@@ -10,7 +10,7 @@
"dependencies": {
"@codemirror/autocomplete": "^6.18.6",
"@codemirror/commands": "^6.8.1",
"@codemirror/lang-angular": "^0.1.3",
"@codemirror/lang-angular": "^0.1.4",
"@codemirror/lang-cpp": "^6.0.2",
"@codemirror/lang-css": "^6.3.1",
"@codemirror/lang-go": "^6.0.1",
@@ -22,7 +22,7 @@
"@codemirror/lang-liquid": "^6.2.3",
"@codemirror/lang-markdown": "^6.3.2",
"@codemirror/lang-php": "^6.0.1",
"@codemirror/lang-python": "^6.1.7",
"@codemirror/lang-python": "^6.2.0",
"@codemirror/lang-rust": "^6.0.1",
"@codemirror/lang-sass": "^6.0.2",
"@codemirror/lang-sql": "^6.8.0",
@@ -36,14 +36,16 @@
"@codemirror/lint": "^6.8.5",
"@codemirror/search": "^6.5.10",
"@codemirror/state": "^6.5.2",
"@codemirror/view": "^6.36.5",
"@codemirror/view": "^6.36.6",
"@lezer/highlight": "^1.2.1",
"@primeuix/themes": "^1.0.3",
"@types/uuid": "^10.0.0",
"codemirror": "^6.0.1",
"pinia": "^3.0.2",
"pinia-plugin-persistedstate": "^4.2.0",
"primevue": "^4.3.3",
"sass": "^1.87.0",
"uuid": "^11.1.0",
"vue": "^3.5.13",
"vue-i18n": "^11.1.3",
"vue-router": "^4.5.0"
@@ -51,7 +53,7 @@
"devDependencies": {
"@eslint/js": "^9.25.1",
"@primevue/auto-import-resolver": "^4.3.3",
"@types/node": "^22.14.1",
"@types/node": "^22.15.2",
"@vitejs/plugin-vue": "^5.2.3",
"@wailsio/runtime": "latest",
"eslint": "^9.25.1",
@@ -60,9 +62,9 @@
"typescript": "^5.8.3",
"typescript-eslint": "^8.31.0",
"unplugin-vue-components": "^28.5.0",
"vite": "^6.3.2",
"vite": "^6.3.3",
"vue-eslint-parser": "^10.1.3",
"vue-tsc": "^2.2.8"
"vue-tsc": "^2.2.10"
}
},
"node_modules/@babel/helper-string-parser": {
@@ -136,9 +138,9 @@
}
},
"node_modules/@codemirror/lang-angular": {
"version": "0.1.3",
"resolved": "https://registry.npmmirror.com/@codemirror/lang-angular/-/lang-angular-0.1.3.tgz",
"integrity": "sha512-xgeWGJQQl1LyStvndWtruUvb4SnBZDAu/gvFH/ZU+c0W25tQR8e5hq7WTwiIY2dNxnf+49mRiGI/9yxIwB6f5w==",
"version": "0.1.4",
"resolved": "https://registry.npmmirror.com/@codemirror/lang-angular/-/lang-angular-0.1.4.tgz",
"integrity": "sha512-oap+gsltb/fzdlTQWD6BFF4bSLKcDnlxDsLdePiJpCVNKWXSTAbiiQeYI3UmES+BLAdkmIC1WjyztC1pi/bX4g==",
"license": "MIT",
"dependencies": {
"@codemirror/lang-html": "^6.0.0",
@@ -295,9 +297,9 @@
}
},
"node_modules/@codemirror/lang-python": {
"version": "6.1.7",
"resolved": "https://registry.npmmirror.com/@codemirror/lang-python/-/lang-python-6.1.7.tgz",
"integrity": "sha512-mZnFTsL4lW5p9ch8uKNKeRU3xGGxr1QpESLilfON2E3fQzOa/OygEMkaDvERvXDJWJA9U9oN/D4w0ZuUzNO4+g==",
"version": "6.2.0",
"resolved": "https://registry.npmmirror.com/@codemirror/lang-python/-/lang-python-6.2.0.tgz",
"integrity": "sha512-+oLTR88uLib84tvb4XmOBBq/dgrctvPXueP3Wjotu4zmHLM2KW2wfswJ6r1BKlfJNcGgdWX1AgUeGEf3E2H5LA==",
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.3.2",
@@ -484,9 +486,9 @@
}
},
"node_modules/@codemirror/view": {
"version": "6.36.5",
"resolved": "https://registry.npmmirror.com/@codemirror/view/-/view-6.36.5.tgz",
"integrity": "sha512-cd+FZEUlu3GQCYnguYm3EkhJ8KJVisqqUsCOKedBoAt/d9c76JUUap6U0UrpElln5k6VyrEOYliMuDAKIeDQLg==",
"version": "6.36.6",
"resolved": "https://registry.npmmirror.com/@codemirror/view/-/view-6.36.6.tgz",
"integrity": "sha512-uxugGLet+Nzp0Jcit8Hn3LypM8ioMLKTsdf8FRoT3HWvZtb9GhaWMe0Cc15rz90Ljab4YFJiAulmIVB74OY0IQ==",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.5.0",
@@ -2139,15 +2141,21 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.14.1",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.14.1.tgz",
"integrity": "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw==",
"version": "22.15.2",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.15.2.tgz",
"integrity": "sha512-uKXqKN9beGoMdBfcaTY1ecwz6ctxuJAcUlwE55938g0ZJ8lRxwAZqRz2AJ4pzpt5dHdTPMB863UZ0ESiFUcP7A==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
}
},
"node_modules/@types/uuid": {
"version": "10.0.0",
"resolved": "https://registry.npmmirror.com/@types/uuid/-/uuid-10.0.0.tgz",
"integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==",
"license": "MIT"
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.31.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.31.0.tgz",
@@ -2492,9 +2500,9 @@
}
},
"node_modules/@vue/language-core": {
"version": "2.2.8",
"resolved": "https://registry.npmmirror.com/@vue/language-core/-/language-core-2.2.8.tgz",
"integrity": "sha512-rrzB0wPGBvcwaSNRriVWdNAbHQWSf0NlGqgKHK5mEkXpefjUlVRP62u03KvwZpvKVjRnBIQ/Lwre+Mx9N6juUQ==",
"version": "2.2.10",
"resolved": "https://registry.npmmirror.com/@vue/language-core/-/language-core-2.2.10.tgz",
"integrity": "sha512-+yNoYx6XIKuAO8Mqh1vGytu8jkFEOH5C8iOv3i8Z/65A7x9iAOXA97Q+PqZ3nlm2lxf5rOJuIGI/wDtx/riNYw==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4896,19 +4904,32 @@
"dev": true,
"license": "MIT"
},
"node_modules/uuid": {
"version": "11.1.0",
"resolved": "https://registry.npmmirror.com/uuid/-/uuid-11.1.0.tgz",
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"license": "MIT",
"bin": {
"uuid": "dist/esm/bin/uuid"
}
},
"node_modules/vite": {
"version": "6.3.2",
"resolved": "https://registry.npmmirror.com/vite/-/vite-6.3.2.tgz",
"integrity": "sha512-ZSvGOXKGceizRQIZSz7TGJ0pS3QLlVY/9hwxVh17W3re67je1RKYzFHivZ/t0tubU78Vkyb9WnHPENSBCzbckg==",
"version": "6.3.3",
"resolved": "https://registry.npmmirror.com/vite/-/vite-6.3.3.tgz",
"integrity": "sha512-5nXH+QsELbFKhsEfWLkHrvgRpTdGJzqOZ+utSdmPTvwHmvU6ITTm3xx+mRusihkcI8GeC7lCDyn3kDtiki9scw==",
"dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "^0.25.0",
"fdir": "^6.4.3",
"fdir": "^6.4.4",
"picomatch": "^4.0.2",
"postcss": "^8.5.3",
"rollup": "^4.34.9",
"tinyglobby": "^0.2.12"
"tinyglobby": "^0.2.13"
},
"bin": {
"vite": "bin/vite.js"
@@ -5100,14 +5121,14 @@
"license": "MIT"
},
"node_modules/vue-tsc": {
"version": "2.2.8",
"resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-2.2.8.tgz",
"integrity": "sha512-jBYKBNFADTN+L+MdesNX/TB3XuDSyaWynKMDgR+yCSln0GQ9Tfb7JS2lr46s2LiFUT1WsmfWsSvIElyxzOPqcQ==",
"version": "2.2.10",
"resolved": "https://registry.npmmirror.com/vue-tsc/-/vue-tsc-2.2.10.tgz",
"integrity": "sha512-jWZ1xSaNbabEV3whpIDMbjVSVawjAyW+x1n3JeGQo7S0uv2n9F/JMgWW90tGWNFRKya4YwKMZgCtr0vRAM7DeQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@volar/typescript": "~2.4.11",
"@vue/language-core": "2.2.8"
"@vue/language-core": "2.2.10"
},
"bin": {
"vue-tsc": "bin/vue-tsc.js"

View File

@@ -14,7 +14,7 @@
"dependencies": {
"@codemirror/autocomplete": "^6.18.6",
"@codemirror/commands": "^6.8.1",
"@codemirror/lang-angular": "^0.1.3",
"@codemirror/lang-angular": "^0.1.4",
"@codemirror/lang-cpp": "^6.0.2",
"@codemirror/lang-css": "^6.3.1",
"@codemirror/lang-go": "^6.0.1",
@@ -26,7 +26,7 @@
"@codemirror/lang-liquid": "^6.2.3",
"@codemirror/lang-markdown": "^6.3.2",
"@codemirror/lang-php": "^6.0.1",
"@codemirror/lang-python": "^6.1.7",
"@codemirror/lang-python": "^6.2.0",
"@codemirror/lang-rust": "^6.0.1",
"@codemirror/lang-sass": "^6.0.2",
"@codemirror/lang-sql": "^6.8.0",
@@ -40,14 +40,16 @@
"@codemirror/lint": "^6.8.5",
"@codemirror/search": "^6.5.10",
"@codemirror/state": "^6.5.2",
"@codemirror/view": "^6.36.5",
"@codemirror/view": "^6.36.6",
"@lezer/highlight": "^1.2.1",
"@primeuix/themes": "^1.0.3",
"@types/uuid": "^10.0.0",
"codemirror": "^6.0.1",
"pinia": "^3.0.2",
"pinia-plugin-persistedstate": "^4.2.0",
"primevue": "^4.3.3",
"sass": "^1.87.0",
"uuid": "^11.1.0",
"vue": "^3.5.13",
"vue-i18n": "^11.1.3",
"vue-router": "^4.5.0"
@@ -55,7 +57,7 @@
"devDependencies": {
"@eslint/js": "^9.25.1",
"@primevue/auto-import-resolver": "^4.3.3",
"@types/node": "^22.14.1",
"@types/node": "^22.15.2",
"@vitejs/plugin-vue": "^5.2.3",
"@wailsio/runtime": "latest",
"eslint": "^9.25.1",
@@ -64,8 +66,8 @@
"typescript": "^5.8.3",
"typescript-eslint": "^8.31.0",
"unplugin-vue-components": "^28.5.0",
"vite": "^6.3.2",
"vite": "^6.3.3",
"vue-eslint-parser": "^10.1.3",
"vue-tsc": "^2.2.8"
"vue-tsc": "^2.2.10"
}
}

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import Editor from '@/editor/index.vue';
import Toolbar from '@/components/toolbar/index.vue';
import Editor from '@/editor/Editor.vue';
import Toolbar from '@/components/toolbar/Toolbar.vue';
</script>
<template>

View File

@@ -1 +0,0 @@

View File

@@ -1,23 +1,50 @@
import { defineConfig } from 'vite';
import {defineConfig, loadEnv} from 'vite';
import vue from '@vitejs/plugin-vue';
import Components from 'unplugin-vue-components/vite';
import {PrimeVueResolver} from '@primevue/auto-import-resolver';
import * as path from 'path';
export default defineConfig({
publicDir: './public',
base: './',
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
export default defineConfig(({mode}: { mode: string }): object => {
const env: Record<string, string> = loadEnv(mode, process.cwd());
return {
publicDir: './public',
base: './',
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
plugins: [
vue(),
Components({
dts: true,
dirs: ['src/components'],
resolvers: [PrimeVueResolver()],
})
],
esbuild: {
drop: env.VITE_NODE_ENV === 'production' ? ['console', 'debugger'] : [],
},
build: {
outDir: "dist",
assetsDir: "assets",
assetsInlineLimit: "4096",
cssCodeSplit: true,
sourcemap: false,
minify: "esbuild",
write: true,
emptyOutDir: true,
brotliSize: true,
chunkSizeWarningLimit: 1500,
watch: null,
rollupOptions: {
output: {
format: 'es',
chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'js/[name]-[hash].js',
assetFileNames: '[ext]/[name]-[hash].[ext]',
},
}
}
}
},
plugins: [
vue(),
Components({
dts: true,
dirs: ['src/components'],
resolvers: [PrimeVueResolver()],
})
]
});

View File

@@ -1,7 +0,0 @@
package main
type GreetService struct{}
func (g *GreetService) Greet(name string) string {
return "Hello " + name + "!"
}

10
main.go
View File

@@ -29,10 +29,8 @@ func main() {
// 'Mac' options tailor the application when running an macOS.
app := application.New(application.Options{
Name: "voidraft",
Description: "A demo of using raw HTML & CSS",
Services: []application.Service{
application.NewService(&GreetService{}),
},
Description: "voidraft",
Services: []application.Service{},
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
},
@@ -48,8 +46,8 @@ func main() {
// 'URL' is the URL that will be loaded into the webview.
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "voidraft",
Width: 500,
Height: 600,
Width: 700,
Height: 800,
Mac: application.MacWindow{
InvisibleTitleBarHeight: 50,
Backdrop: application.MacBackdropTranslucent,