feat(dialog): add plugin (#306)

This commit is contained in:
Lucas Fernandes Nogueira
2023-04-18 22:41:12 -03:00
committed by GitHub
parent 4d32919f0f
commit 7a8633f429
131 changed files with 10394 additions and 513 deletions
@@ -0,0 +1,19 @@
<script>
import MessageDialogs from "./lib/MessageDialogs.svelte";
import FileDialogs from "./lib/FileDialogs.svelte";
</script>
<main class="container">
<div class="row">
<MessageDialogs />
</div>
<div class="row">
<FileDialogs />
</div>
</main>
<style>
.container > .row {
margin-top: 24px;
}
</style>
@@ -0,0 +1,27 @@
<script>
import * as dialog from "tauri-plugin-dialog-api";
let response = "";
async function open() {
try {
const res = await dialog.open({
filters: [
{
name: "test",
extensions: ["image/jpg"],
},
],
multiple: false,
});
response = JSON.stringify(res, null, 2);
} catch (e) {
console.error(e);
}
}
</script>
<div>
<div>{response}</div>
<button on:click={open}> Open </button>
</div>
@@ -0,0 +1,24 @@
<script>
import * as dialog from "tauri-plugin-dialog-api";
let response = "";
async function prompt() {
try {
const res = await dialog.confirm("Is Tauri awesome?", {
okLabel: "Absolutely",
cancelLabel: "Totally",
});
response = res
? "Tauri is absolutely awesome"
: "Tauri is totally awesome";
} catch (e) {
console.error(e);
}
}
</script>
<div>
<div>{response}</div>
<button on:click={prompt}> Prompt </button>
</div>
@@ -0,0 +1,8 @@
import "./style.css";
import App from "./App.svelte";
const app = new App({
target: document.getElementById("app"),
});
export default app;
@@ -0,0 +1,102 @@
: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;
}
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;
}
}
+2
View File
@@ -0,0 +1,2 @@
/// <reference types="svelte" />
/// <reference types="vite/client" />