integrate tauri

`yarn dev` will launch tauri, `yarn dev:vite` will launch vite.
This commit is contained in:
kaj
2023-07-10 10:28:44 -08:00
parent 76772d7b9a
commit 158ccf298b
24 changed files with 3630 additions and 11 deletions
+2 -1
View File
@@ -12,7 +12,8 @@
"build:preview": "yarn build:types && vite build --mode preview",
"build:production": "yarn build:types && vite build --mode production",
"dev:types": "tsc --noEmit --watch",
"dev": "vite"
"dev": "cargo tauri dev",
"dev:vite": "vite"
},
"dependencies": {
"@emotion/css": "^11.10.5",
@@ -0,0 +1,3 @@
# Generated by Cargo
# will have compiled files and executables
/target/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.60"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.4.0", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.4.0", features = [] }
[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
# DO NOT REMOVE!!
custom-protocol = [ "tauri/custom-protocol" ]
@@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

@@ -0,0 +1,8 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
@@ -0,0 +1,65 @@
{
"build": {
"beforeBuildCommand": "yarn build",
"beforeDevCommand": "yarn dev:vite",
"devPath": "http://localhost:3000",
"distDir": "../dist"
},
"package": {
"productName": "StableStudio",
"version": "0.1.0"
},
"tauri": {
"allowlist": {
"all": false
},
"bundle": {
"active": true,
"category": "DeveloperTool",
"copyright": "",
"deb": {
"depends": []
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"identifier": "com.tauri.dev",
"longDescription": "",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
"resources": [],
"shortDescription": "",
"targets": "all",
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"security": {
"csp": null
},
"updater": {
"active": false
},
"windows": [
{
"fullscreen": false,
"height": 600,
"resizable": true,
"title": "StableStudio",
"width": 800
}
]
}
}
+8 -10
View File
@@ -1,5 +1,5 @@
import * as StableStudio from "@stability/stablestudio-plugin";
import * as StableStudioPluginExample from "@stability/stablestudio-plugin-example";
// import * as StableStudioPluginExample from "@stability/stablestudio-plugin-example";
import * as StableStudioPluginStability from "@stability/stablestudio-plugin-stability";
import * as StableStudioPluginWebUI from "@stability/stablestudio-plugin-webui";
@@ -52,7 +52,7 @@ export namespace Plugin {
const plugin = pluginModule.createPlugin({
getGitHash: () => Environment.get("GIT_HASH"),
getStableDiffusionRandomPrompt: () =>
Generation.Image.Prompt.Random.get(),
Generation.Image.Prompt.Random.get()
});
const id = ID.create();
@@ -62,8 +62,8 @@ export namespace Plugin {
[id]: {
enabled: true,
index: Object.keys(plugins).length,
plugin,
},
plugin
}
}));
State.use.getState().setActivePluginID(id);
@@ -87,7 +87,7 @@ export namespace Plugin {
isLoading,
loadFromURL,
getFromURL: doNothing,
getFromURL: doNothing
};
};
}
@@ -114,9 +114,7 @@ namespace State {
export const use = GlobalState.create<State>((set) => {
const { createPlugin: createRootPlugin } =
Environment.get("USE_EXAMPLE_PLUGIN") === "true"
? StableStudioPluginExample
: Environment.get("USE_WEBUI_PLUGIN") === "true"
Environment.get("USE_WEBUI_PLUGIN") === "true"
? StableStudioPluginWebUI
: StableStudioPluginStability;
@@ -124,7 +122,7 @@ namespace State {
rootPlugin: createRootPlugin({
getGitHash: () => Environment.get("GIT_HASH"),
getStableDiffusionRandomPrompt: () =>
Generation.Image.Prompt.Random.get(),
Generation.Image.Prompt.Random.get()
}) as unknown as GlobalState.Store<StableStudio.Plugin>,
setActivePluginID: (activePluginID) => set({ activePluginID }),
@@ -133,7 +131,7 @@ namespace State {
setPlugins: (setPlugins) =>
typeof setPlugins === "function"
? set(({ plugins }) => ({ plugins: setPlugins(plugins) }))
: set({ plugins: setPlugins }),
: set({ plugins: setPlugins })
};
});
}