-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c879faa
commit 921363d
Showing
80 changed files
with
1,702 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "example", | ||
"name": "tauri-specta-app", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Tauri + Solid + Typescript | ||
|
||
This template should help get you started developing with Tauri, Solid and Typescript in Vite. | ||
|
||
## Recommended IDE Setup | ||
|
||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<link rel="icon" type="image/svg+xml" href="/src/assets/logo.svg" /> | ||
<title>Tauri + Solid + Typescript App</title> | ||
</head> | ||
|
||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
|
||
<script src="/src/index.tsx" type="module"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "tauri-specta-example-custom-plugin-app", | ||
"version": "0.0.0", | ||
"description": "", | ||
"scripts": { | ||
"start": "vite", | ||
"dev": "vite", | ||
"build": "vite build", | ||
"serve": "vite preview", | ||
"tauri": "tauri" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"solid-js": "^1.7.8", | ||
"@tauri-apps/api": "^1.4.0", | ||
"tauri-specta-custom-plugin": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.0.2", | ||
"vite": "^4.4.4", | ||
"vite-plugin-solid": "^2.7.0", | ||
"@tauri-apps/cli": "^1.4.0" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "tauri-specta-example-custom-plugin-app" | ||
version = "0.0.0" | ||
description = "A Tauri App" | ||
authors = ["you"] | ||
license = "" | ||
repository = "" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[build-dependencies] | ||
tauri-build = { version = "1.4", features = [] } | ||
|
||
[dependencies] | ||
tauri = { version = "1.4", features = ["shell-open"] } | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
tauri-specta-example-custom-plugin = { path = "../../plugin" } | ||
|
||
[features] | ||
# this feature is used for production builds or when `devPath` points to the filesystem | ||
# DO NOT REMOVE!! | ||
custom-protocol = ["tauri/custom-protocol"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
tauri_build::build() | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
fn main() { | ||
tauri::Builder::default() | ||
.plugin(tauri_specta_example_custom_plugin::init()) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"build": { | ||
"beforeDevCommand": "pnpm dev", | ||
"beforeBuildCommand": "pnpm build", | ||
"devPath": "http://localhost:1420", | ||
"distDir": "../dist", | ||
"withGlobalTauri": false | ||
}, | ||
"package": { | ||
"productName": "app", | ||
"version": "0.0.0" | ||
}, | ||
"tauri": { | ||
"allowlist": { | ||
"all": false, | ||
"shell": { | ||
"all": false, | ||
"open": true | ||
} | ||
}, | ||
"bundle": { | ||
"active": true, | ||
"targets": "all", | ||
"identifier": "com.tauri.dev", | ||
"icon": [ | ||
"icons/32x32.png", | ||
"icons/128x128.png", | ||
"icons/[email protected]", | ||
"icons/icon.icns", | ||
"icons/icon.ico" | ||
] | ||
}, | ||
"security": { | ||
"csp": null | ||
}, | ||
"windows": [ | ||
{ | ||
"fullscreen": false, | ||
"resizable": true, | ||
"title": "app", | ||
"width": 800, | ||
"height": 600 | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Match, Switch, createSignal, onCleanup } from "solid-js"; | ||
import { events, addNumbers } from "tauri-specta-custom-plugin"; | ||
|
||
function App() { | ||
const [latestNumber, setLatestNumber] = createSignal<number | null>(null); | ||
|
||
const [generatedNumber, setGeneratedNumber] = createSignal< | ||
{ type: "loading" } | { type: "loaded"; value: number } | null | ||
>(null); | ||
|
||
events.randomNumber | ||
.listen((e) => setLatestNumber(e.payload)) | ||
.then((unlisten) => onCleanup(unlisten)); | ||
|
||
return ( | ||
<div> | ||
<p>Latest Random Number: {latestNumber()}</p> | ||
<button | ||
disabled={generatedNumber()?.type === "loading"} | ||
onClick={() => { | ||
setGeneratedNumber({ type: "loading" }); | ||
|
||
addNumbers( | ||
Math.floor(Math.random() * 10), | ||
Math.floor(Math.random() * 10) | ||
) | ||
.then((value) => setGeneratedNumber({ type: "loaded", value })) | ||
.catch(() => setGeneratedNumber(null)); | ||
}} | ||
> | ||
Generate Random Number | ||
</button> | ||
<Switch fallback="Generate a number!"> | ||
<Match when={generatedNumber()?.type === "loading"}> | ||
Loading number... | ||
</Match> | ||
<Match | ||
when={(() => { | ||
const n = generatedNumber(); | ||
return n?.type === "loaded" && n.value; | ||
})()} | ||
> | ||
{(value) => value()} | ||
</Match> | ||
</Switch> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* @refresh reload */ | ||
import { render } from "solid-js/web"; | ||
|
||
import App from "./App"; | ||
|
||
render(() => <App />, document.getElementById("root") as HTMLElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"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", | ||
"jsxImportSource": "solid-js", | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true, | ||
|
||
"checkJs": true | ||
}, | ||
"include": ["src"], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"skipLibCheck": true, | ||
"module": "ESNext", | ||
"moduleResolution": "bundler", | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { defineConfig } from "vite"; | ||
import solidPlugin from "vite-plugin-solid"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig(async () => ({ | ||
plugins: [solidPlugin()], | ||
|
||
// 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, | ||
}, | ||
// 3. to make use of `TAURI_DEBUG` and other env variables | ||
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand | ||
envPrefix: ["VITE_", "TAURI_"], | ||
})); |
Oops, something went wrong.