Major plugin updates

This commit is contained in:
Lea Anthony
2024-04-14 21:41:33 +10:00
parent cf130a6e25
commit c7ed7e72d4
52 changed files with 1155 additions and 326 deletions
File diff suppressed because one or more lines are too long
+202
View File
@@ -0,0 +1,202 @@
html {
background-color: rgba(33, 37, 43);
text-align: center;
color: white;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-touch-callout: none;
}
body {
padding-top: 40px;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
overscroll-behavior: none;
}
.logo {
width: 30%;
height: 20%;
}
/* CSS */
.button-42 {
background-color: initial;
background-image: linear-gradient(-180deg, #555555, #2f2f2f);
border-radius: 6px;
box-shadow: rgba(0, 0, 0, 0.1) 0 2px 4px;
color: #FFFFFF;
cursor: pointer;
display: inline-block;
font-family: Inter,-apple-system,system-ui,Roboto,"Helvetica Neue",Arial,sans-serif;
height: 35px;
line-height: 35px;
outline: 0;
overflow: hidden;
padding: 0 20px;
pointer-events: auto;
position: relative;
text-align: center;
touch-action: manipulation;
user-select: none;
-webkit-user-select: none;
vertical-align: top;
white-space: nowrap;
z-index: 9;
border: 0;
transition: box-shadow .2s;
font-size: medium;
}
p {
font-size: 1rem;
}
.button-42:hover {
background-image: linear-gradient(-180deg, #cb3939, #610000);
}
html {
background-color: rgba(33, 37, 43);
text-align: center;
color: white;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-touch-callout: none;
}
body {
padding-top: 40px;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
overscroll-behavior: none;
}
.button-42 {
background-color: initial;
background-image: linear-gradient(-180deg, #555555, #2f2f2f);
border-radius: 6px;
box-shadow: rgba(0, 0, 0, 0.1) 0 2px 4px;
color: #FFFFFF;
cursor: pointer;
display: inline-block;
font-family: Inter,-apple-system,system-ui,Roboto,"Helvetica Neue",Arial,sans-serif;
height: 35px;
line-height: 35px;
outline: 0;
overflow: hidden;
padding: 0 20px;
pointer-events: auto;
position: relative;
text-align: center;
touch-action: manipulation;
user-select: none;
-webkit-user-select: none;
vertical-align: top;
white-space: nowrap;
z-index: 9;
border: 0;
transition: box-shadow .2s;
font-size: medium;
}
p {
font-size: 1rem;
}
.button-42:hover {
background-image: linear-gradient(-180deg, #cb3939, #610000);
}
.tab {
overflow: hidden;
background-color: #f1f1f100;
margin-left: 20px;
}
.tab button {
background-color: transparent; /* Make the background transparent */
color: white; /* Make the text white */
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 14px 16px;
transition: 0.3s;
position: relative; /* Added for the underline */
}
.tab button::after { /* Added for the underline */
content: '';
position: absolute;
width: 0;
height: 2px;
bottom: 0;
left: 0;
background-color: #a40505;
visibility: hidden;
transition: all 0.3s ease-in-out;
}
.tab button:hover::after, /* Added for the underline */
.tab button.active::after { /* Added for the underline */
width: 100%;
visibility: visible;
}
.tab button.active {
background-color: transparent; /* Make the background transparent */
color: red;
}
.tabcontent {
display: none;
padding: 6px 12px;
border-top: none;
}
#sqlresults, #hashresults {
font-family: 'Courier New', Courier, monospace;
min-height: 100px;
}
#selectquery {
width: 90%;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #005467;
color: white;
}
tr:hover {
background-color: #888;
}
.error-message {
color: #FF4B2B; /* Bright red color for better visibility in dark mode */
background-color: #1E1E1E; /* Dark background for the error message */
border: 1px solid #FF4B2B; /* Border color same as text color */
padding: 10px; /* Padding around the text */
margin: 10px 0; /* Margin top and bottom */
border-radius: 5px; /* Rounded corners */
text-align: center; /* Center the text */
}
.narrowColumn {
width: 1%; /* Adjust as needed */
white-space: nowrap;
}
@@ -1,4 +0,0 @@
# Experimental Plugins
This directory contains experimental plugins. These plugins are not supported by the Wails team and are provided as-is.
They may be removed at any time. If you have any thoughts about these plugins, they can be discussed on the [Wails Discord](https://discord.gg/u8JkcWsG).
@@ -15,7 +15,8 @@ Add the plugin to the `Plugins` option in the Applications options:
You can then call the Generate method from the frontend:
```js
wails.Plugin("hashes","Generate","hello world").then((result) => console.log(result))
import {Call} from "/wails/runtime.js";
Call.Plugin("hashes","Generate","hello world").then((result) => console.log(result))
```
This method returns a struct with the following fields:
@@ -6,6 +6,7 @@ import (
"crypto/sha256"
"encoding/hex"
"github.com/wailsapp/wails/v3/pkg/application"
"io/fs"
)
// ---------------- Plugin Setup ----------------
@@ -32,8 +33,8 @@ func (r *Plugin) CallableByJS() []string {
}
}
func (r *Plugin) InjectJS() string {
return ""
func (r *Plugin) Assets() fs.FS {
return nil
}
// ---------------- Plugin Methods ----------------
+5 -7
View File
@@ -2,8 +2,9 @@ package main
import (
"embed"
"log/slog"
"os"
"plugin_demo/plugins/hashes"
"plugin_demo/hashes"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/plugins/kvstore"
@@ -24,6 +25,7 @@ func main() {
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
LogLevel: slog.LevelDebug,
Plugins: map[string]application.Plugin{
"hashes": hashes.NewPlugin(),
"log": log.NewPlugin(),
@@ -34,10 +36,6 @@ func main() {
Filename: "store.json",
AutoSave: true,
}),
//"server": server.NewPlugin(&server.Config{
// Enabled: true,
// Port: 34115,
//}),
"single_instance": single_instance.NewPlugin(&single_instance.Config{
// When true, the original app will be activated when a second instance is launched
ActivateAppOnSubsequentLaunch: true,
@@ -50,8 +48,8 @@ func main() {
})
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
DevToolsEnabled: true,
OpenInspectorOnStartup: true,
Width: 1024,
Height: 768,
})
err := app.Run()
-8
View File
@@ -1,8 +0,0 @@
export namespace HashesPlugin {
export interface Hashes {
md5: string;
sha1: string;
sha256: string;
}
}
@@ -1,4 +0,0 @@
// Generate takes a string and returns a number of hashes for it
export function Generate(input) {
return wails.Plugin("hashes","Generate",input);
}
+1 -1
View File
@@ -1 +1 @@
{"url2":"https://reddit.com"}
{"q":"www","url2":"https://reddit.com"}
Binary file not shown.