This commit is contained in:
2026-04-08 21:26:18 +08:00
commit 8fdc7ac0c3
401 changed files with 53093 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{
"globals": {}
}

13
apps/tauri/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DCS Editor (Tauri)</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

30
apps/tauri/package.json Normal file
View File

@@ -0,0 +1,30 @@
{
"name": "@cslab-dcs/tauri",
"type": "module",
"version": "1.0.0",
"private": true,
"scripts": {
"dev:web": "vite dev",
"dev": "tauri dev",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@cslab-dcs/bridge": "workspace:*",
"@cslab-dcs/core": "workspace:*",
"@tauri-apps/api": "2.10.1",
"@tauri-apps/plugin-dialog": "^2.2.0",
"@tauri-apps/plugin-fs": "^2.2.0",
"@tauri-apps/plugin-opener": "^2.2.5",
"vue": "^3.5.13"
},
"devDependencies": {
"@tauri-apps/cli": "2.10.0",
"@vitejs/plugin-vue": "^6.0.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"typescript": "^5.9.3",
"vite": "^6.0.3",
"vue-tsc": "^2.2.0"
}
}

5295
apps/tauri/src-tauri/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
[package]
name = "cslab-dcs-editor"
version = "1.0.0"
description = "DCS Editor - CSLAB DCS 编辑器"
authors = [ "cslab" ]
edition = "2021"
[lib]
name = "cslab_dcs_tauri_lib"
crate-type = [
"staticlib",
"cdylib",
"rlib"
]
[build-dependencies]
tauri-build = { version = "2.5.4", features = [] }
[dependencies]
tauri = { version = "2.10.0", features = [] }
tauri-plugin-opener = "2.2.5"
tauri-plugin-dialog = "2.2.0"
tauri-plugin-fs = "2.2.0"
tauri-plugin-os = "2"
serde = { version = "1", features = [ "derive" ] }
serde_json = "1"
[features]
# this feature is used for production builds or when `devPath` points to the filesystem
# DO NOT REMOVE!!
custom-protocol = [ "tauri/custom-protocol" ]

View File

@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}

View File

@@ -0,0 +1,13 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"core:default",
"dialog:default",
"opener:default",
"fs:default",
"os:default"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View File

@@ -0,0 +1,10 @@
// #[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_os::init())
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

View File

@@ -0,0 +1,6 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
cslab_dcs_tauri_lib::run()
}

View File

@@ -0,0 +1,40 @@
{
"identifier": "com.cslab.dcs.editor",
"build": {
"beforeDevCommand": "pnpm dev:web",
"beforeBuildCommand": "pnpm build:web",
"devUrl": "http://localhost:1420",
"frontendDist": "../dist"
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
},
"app": {
"withGlobalTauri": false,
"windows": [
{
"title": "DCS Editor",
"width": 800,
"height": 600,
"dragDropEnabled": false
}
],
"security": {
"csp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self' https:; font-src 'self' data:"
}
},
"plugins": {
"fs": {}
}
}

9
apps/tauri/src/main.ts Normal file
View File

@@ -0,0 +1,9 @@
import { WebBridge } from '@cslab-dcs/bridge'
import { TauriBridge } from '@cslab-dcs/bridge/tauri'
import { createDCSApp } from '@cslab-dcs/core'
const isTauri = !!(window as any).__TAURI_INTERNALS__ || !!(window as any).__TAURI__
const bridge = isTauri ? new TauriBridge() : new WebBridge()
const app = createDCSApp(bridge)
app.mount('#app')

23
apps/tauri/tsconfig.json Normal file
View File

@@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["../../packages/core/src/*"],
"@cslab-dcs/core": ["../../packages/core/src"],
"@cslab-dcs/bridge": ["../../packages/bridge/src"],
"@cslab-dcs/schema": ["../../packages/schema/src"]
},
"types": ["element-plus/global"]
},
"include": [
"src/**/*",
"../../packages/core/src/**/*",
"../../packages/core/env.d.ts",
"../../packages/bridge/src/**/*",
"../../packages/request/src/**/*",
"../../packages/schema/src/**/*",
"../../packages/utils/src/**/*"
],
"exclude": ["node_modules", "dist", "src-tauri"]
}

36
apps/tauri/vite.config.ts Normal file
View File

@@ -0,0 +1,36 @@
import type { UserConfig } from 'vite'
import { resolve } from 'node:path'
import process from 'node:process'
import { defineConfig } from 'vite'
import { createSharedViteConfig } from '../../packages/core/vite.shared'
const coreRoot = resolve(__dirname, '../../packages/core')
const host = process.env.VITE_DEV_SERVER_HOST
// 使用类型断言绕过 pnpm 导致的 Vite 依赖重复安装类型不兼容问题
export default defineConfig({
...createSharedViteConfig(coreRoot) as UserConfig,
root: __dirname,
clearScreen: false,
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host
? {
protocol: 'ws',
host,
port: 1421,
}
: undefined,
watch: {
// 3. tell vite to ignore watching `src-tauri`
ignored: ['**/src-tauri/**'],
},
},
build: {
outDir: 'dist',
emptyOutDir: true,
},
})