From a896a5107397940098a6dcdd5a9479172763ec80 Mon Sep 17 00:00:00 2001
From: AkiChase <1003019131@qq.com>
Date: Sat, 13 Apr 2024 08:32:42 +0800
Subject: [PATCH] init
---
.gitignore | 8 ++
index.html | 13 ++++
package.json | 30 ++++++++
public/tauri.svg | 6 ++
public/vite.svg | 1 +
src-tauri/.gitignore | 9 +++
src-tauri/Cargo.toml | 18 +++++
src-tauri/build.rs | 3 +
src-tauri/capabilities/default.json | 10 +++
src-tauri/src/main.rs | 16 ++++
src-tauri/tauri.conf.json | 31 ++++++++
src/App.vue | 52 +++++++++++++
src/assets/vue.svg | 1 +
src/components/Greet.vue | 21 ++++++
src/main.ts | 5 ++
src/styles.css | 109 ++++++++++++++++++++++++++++
src/vite-env.d.ts | 7 ++
tsconfig.json | 25 +++++++
tsconfig.node.json | 10 +++
vite.config.ts | 21 ++++++
20 files changed, 396 insertions(+)
create mode 100644 .gitignore
create mode 100644 index.html
create mode 100644 package.json
create mode 100644 public/tauri.svg
create mode 100644 public/vite.svg
create mode 100644 src-tauri/.gitignore
create mode 100644 src-tauri/Cargo.toml
create mode 100644 src-tauri/build.rs
create mode 100644 src-tauri/capabilities/default.json
create mode 100644 src-tauri/src/main.rs
create mode 100644 src-tauri/tauri.conf.json
create mode 100644 src/App.vue
create mode 100644 src/assets/vue.svg
create mode 100644 src/components/Greet.vue
create mode 100644 src/main.ts
create mode 100644 src/styles.css
create mode 100644 src/vite-env.d.ts
create mode 100644 tsconfig.json
create mode 100644 tsconfig.node.json
create mode 100644 vite.config.ts
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f9f6388
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+node_modules
+dist
+
+.vscode
+.DS_Store
+pnpm-lock.yaml
+scrcpy-mask.code-workspace
+src-tauri/Cargo.lock
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..f5f041e
--- /dev/null
+++ b/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Scrcpy Mask
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..39014eb
--- /dev/null
+++ b/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "scrcpy-mask",
+ "private": true,
+ "version": "0.0.0",
+ "type": "module",
+ "scripts": {
+ "dev": "vite",
+ "build": "vue-tsc --noEmit && vite build",
+ "preview": "vite preview",
+ "tauri": "tauri"
+ },
+ "dependencies": {
+ "pinia": "^2.1.7",
+ "vue": "^3.3.4",
+ "vue-router": "4",
+ "@tauri-apps/api": ">=2.0.0-beta.0",
+ "@tauri-apps/plugin-shell": ">=2.0.0-beta.0"
+ },
+ "devDependencies": {
+ "@vitejs/plugin-vue": "^5.0.4",
+ "typescript": "^5.0.2",
+ "vite": "^5.0.0",
+ "vue-tsc": "^1.8.5",
+ "@tauri-apps/cli": ">=2.0.0-beta.0",
+ "@vicons/fluent": "^0.12.0",
+ "@vicons/ionicons5": "^0.12.0",
+ "naive-ui": "^2.38.1",
+ "sass": "^1.71.1"
+ }
+}
diff --git a/public/tauri.svg b/public/tauri.svg
new file mode 100644
index 0000000..31b62c9
--- /dev/null
+++ b/public/tauri.svg
@@ -0,0 +1,6 @@
+
diff --git a/public/vite.svg b/public/vite.svg
new file mode 100644
index 0000000..e7b8dfb
--- /dev/null
+++ b/public/vite.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore
new file mode 100644
index 0000000..16936f9
--- /dev/null
+++ b/src-tauri/.gitignore
@@ -0,0 +1,9 @@
+# Generated by Cargo
+# will have compiled files and executables
+/target/
+
+# Generated by Tauri
+# will have schema files for capabilities auto-completion
+/gen/schemas
+
+/Cargo.lock
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
new file mode 100644
index 0000000..a374580
--- /dev/null
+++ b/src-tauri/Cargo.toml
@@ -0,0 +1,18 @@
+[package]
+name = "scrcpy-mask"
+version = "0.0.0"
+description = "A Tauri App"
+authors = ["you"]
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[build-dependencies]
+tauri-build = { version = "2.0.0-beta", features = [] }
+
+[dependencies]
+tauri = { version = "2.0.0-beta", features = ["macos-private-api"] }
+tauri-plugin-shell = "2.0.0-beta"
+serde = { version = "1", features = ["derive"] }
+serde_json = "1"
+
diff --git a/src-tauri/build.rs b/src-tauri/build.rs
new file mode 100644
index 0000000..d860e1e
--- /dev/null
+++ b/src-tauri/build.rs
@@ -0,0 +1,3 @@
+fn main() {
+ tauri_build::build()
+}
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json
new file mode 100644
index 0000000..6fc8426
--- /dev/null
+++ b/src-tauri/capabilities/default.json
@@ -0,0 +1,10 @@
+{
+ "$schema": "../gen/schemas/desktop-schema.json",
+ "identifier": "default",
+ "description": "Capability for the main window",
+ "windows": ["main"],
+ "permissions": [
+ "event:default",
+ "window:default"
+ ]
+}
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
new file mode 100644
index 0000000..96361fb
--- /dev/null
+++ b/src-tauri/src/main.rs
@@ -0,0 +1,16 @@
+// Prevents additional console window on Windows in release, DO NOT REMOVE!!
+#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
+
+// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
+#[tauri::command]
+fn greet(name: &str) -> String {
+ format!("Hello, {}! You've been greeted from Rust!", name)
+}
+
+fn main() {
+ tauri::Builder::default()
+ .plugin(tauri_plugin_shell::init())
+ .invoke_handler(tauri::generate_handler![greet])
+ .run(tauri::generate_context!())
+ .expect("error while running tauri application");
+}
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
new file mode 100644
index 0000000..a52e350
--- /dev/null
+++ b/src-tauri/tauri.conf.json
@@ -0,0 +1,31 @@
+{
+ "productName": "scrcpy-mask",
+ "version": "0.0.0",
+ "identifier": "com.tauri.dev",
+ "build": {
+ "beforeDevCommand": "pnpm dev",
+ "devUrl": "http://localhost:1420",
+ "beforeBuildCommand": "pnpm build",
+ "frontendDist": "../dist"
+ },
+ "app": {
+ "windows": [
+ {
+ "title": "scrcpy-mask",
+ "transparent": true,
+ "decorations": false
+ }
+ ],
+ "macOSPrivateApi": true,
+ "security": {
+ "csp": null
+ }
+ },
+ "bundle": {
+ "active": true,
+ "targets": "all",
+ "icon": [
+ "icons/32x32.png"
+ ]
+ }
+}
diff --git a/src/App.vue b/src/App.vue
new file mode 100644
index 0000000..91f7b0f
--- /dev/null
+++ b/src/App.vue
@@ -0,0 +1,52 @@
+
+
+
+
+
Welcome to Tauri!
+
+
+
+
Click on the Tauri, Vite, and Vue logos to learn more.
+
+
+ Recommended IDE setup:
+ VS Code
+ +
+ Volar
+ +
+ Tauri
+ +
+ rust-analyzer
+
+
+
+
+
+
+
diff --git a/src/assets/vue.svg b/src/assets/vue.svg
new file mode 100644
index 0000000..770e9d3
--- /dev/null
+++ b/src/assets/vue.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/components/Greet.vue b/src/components/Greet.vue
new file mode 100644
index 0000000..d05167c
--- /dev/null
+++ b/src/components/Greet.vue
@@ -0,0 +1,21 @@
+
+
+
+
+
+ {{ greetMsg }}
+
diff --git a/src/main.ts b/src/main.ts
new file mode 100644
index 0000000..5eea099
--- /dev/null
+++ b/src/main.ts
@@ -0,0 +1,5 @@
+import { createApp } from "vue";
+import "./styles.css";
+import App from "./App.vue";
+
+createApp(App).mount("#app");
diff --git a/src/styles.css b/src/styles.css
new file mode 100644
index 0000000..f7de85b
--- /dev/null
+++ b/src/styles.css
@@ -0,0 +1,109 @@
+:root {
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
+ font-size: 16px;
+ line-height: 24px;
+ font-weight: 400;
+
+ color: #0f0f0f;
+ background-color: #f6f6f6;
+
+ font-synthesis: none;
+ text-rendering: optimizeLegibility;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ -webkit-text-size-adjust: 100%;
+}
+
+.container {
+ margin: 0;
+ padding-top: 10vh;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ text-align: center;
+}
+
+.logo {
+ height: 6em;
+ padding: 1.5em;
+ will-change: filter;
+ transition: 0.75s;
+}
+
+.logo.tauri:hover {
+ filter: drop-shadow(0 0 2em #24c8db);
+}
+
+.row {
+ display: flex;
+ justify-content: center;
+}
+
+a {
+ font-weight: 500;
+ color: #646cff;
+ text-decoration: inherit;
+}
+
+a:hover {
+ color: #535bf2;
+}
+
+h1 {
+ text-align: center;
+}
+
+input,
+button {
+ border-radius: 8px;
+ border: 1px solid transparent;
+ padding: 0.6em 1.2em;
+ font-size: 1em;
+ font-weight: 500;
+ font-family: inherit;
+ color: #0f0f0f;
+ background-color: #ffffff;
+ transition: border-color 0.25s;
+ box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
+}
+
+button {
+ cursor: pointer;
+}
+
+button:hover {
+ border-color: #396cd8;
+}
+button:active {
+ border-color: #396cd8;
+ background-color: #e8e8e8;
+}
+
+input,
+button {
+ outline: none;
+}
+
+#greet-input {
+ margin-right: 5px;
+}
+
+@media (prefers-color-scheme: dark) {
+ :root {
+ color: #f6f6f6;
+ background-color: #2f2f2f;
+ }
+
+ a:hover {
+ color: #24c8db;
+ }
+
+ input,
+ button {
+ color: #ffffff;
+ background-color: #0f0f0f98;
+ }
+ button:active {
+ background-color: #0f0f0f69;
+ }
+}
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
new file mode 100644
index 0000000..fc81239
--- /dev/null
+++ b/src/vite-env.d.ts
@@ -0,0 +1,7 @@
+///
+
+declare module "*.vue" {
+ import type { DefineComponent } from "vue";
+ const component: DefineComponent<{}, {}, any>;
+ export default component;
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..f82888f
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "module": "ESNext",
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "skipLibCheck": true,
+
+ /* Bundler mode */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "preserve",
+
+ /* Linting */
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noFallthroughCasesInSwitch": true
+ },
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
+ "references": [{ "path": "./tsconfig.node.json" }]
+}
diff --git a/tsconfig.node.json b/tsconfig.node.json
new file mode 100644
index 0000000..42872c5
--- /dev/null
+++ b/tsconfig.node.json
@@ -0,0 +1,10 @@
+{
+ "compilerOptions": {
+ "composite": true,
+ "skipLibCheck": true,
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "allowSyntheticDefaultImports": true
+ },
+ "include": ["vite.config.ts"]
+}
diff --git a/vite.config.ts b/vite.config.ts
new file mode 100644
index 0000000..ce8e371
--- /dev/null
+++ b/vite.config.ts
@@ -0,0 +1,21 @@
+import { defineConfig } from "vite";
+import vue from "@vitejs/plugin-vue";
+
+// https://vitejs.dev/config/
+export default defineConfig(async () => ({
+ plugins: [vue()],
+
+ // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
+ //
+ // 1. prevent vite from obscuring rust errors
+ clearScreen: false,
+ // 2. tauri expects a fixed port, fail if that port is not available
+ server: {
+ port: 1420,
+ strictPort: true,
+ watch: {
+ // 3. tell vite to ignore watching `src-tauri`
+ ignored: ["**/src-tauri/**"],
+ },
+ },
+}));