Compare commits

..

24 Commits

Author SHA1 Message Date
Lea Anthony
52554009ce Merge pull request #807 from Baiyuetribe/v2-alpha
Add commonly used shortcut keys
2021-09-15 23:33:48 +10:00
Lea Anthony
9f89a4a58a Merge branch 'v2-alpha' into v2-alpha 2021-09-15 23:33:33 +10:00
Lea Anthony
5585d72c1c [v2] Fix wailsjs generation 2021-09-15 23:20:47 +10:00
Lea Anthony
7748cc2497 [windows] Support ctrl-a 2021-09-15 23:19:48 +10:00
佰阅部落
60f9a02143 Add commonly used shortcut keys
add ctral+A,arrowUp,left,down,right and del
2021-09-15 20:59:06 +08:00
Lea Anthony
899e522c74 [windows] Webview to handle ctrl-x/c/z/v. Foreward other accelerators to Window. 2021-09-15 20:30:14 +10:00
Lea Anthony
be87d73da8 [v2] go fmt + windowIsTranslucent 2021-09-15 20:30:14 +10:00
Travis McLane
00639677f5 fix Apple Silicon check 2021-09-14 12:19:22 -05:00
leaanthony
3c25a73ae8 The runtime was rebuilt 2021-09-14 10:24:40 +00:00
Lea Anthony
344103739f [v2] Fix JS builds 2021-09-14 20:24:14 +10:00
Lea Anthony
c2b8247fbb [v2] Fix type on runtime 2021-09-14 06:48:19 +10:00
leaanthony
03cdfad418 The runtime was rebuilt 2021-09-13 20:24:44 +00:00
Lea Anthony
3fe4c5455a Merge pull request #804 from misitebao/fix-js-runtime
Fix js runtime
2021-09-14 06:24:21 +10:00
misitebao
a6b95b23c9 fix: fix js runtime related issues 2021-09-13 21:56:09 +08:00
misitebao
2616d87922 fix: fix the BrowserOpenURL method signature in the ts declaration file 2021-09-13 21:54:18 +08:00
leaanthony
f983649bc6 The runtime was rebuilt 2021-09-13 10:49:07 +00:00
Lea Anthony
15ed02b78c [v2] More updates 2021-09-13 20:48:41 +10:00
Lea Anthony
2cb93b4b4b [v2] Tidy up typescript declaration 2021-09-13 20:45:36 +10:00
Lea Anthony
7e0ad801b0 Update runtime.yml 2021-09-13 20:38:33 +10:00
Lea Anthony
ccdfa9a8be [v2] Update runtime 2021-09-13 20:35:52 +10:00
Lea Anthony
85e04d8094 Merge pull request #801 from misitebao/796-support-browseropenurl
feat(runtime): add a method to open the link from the default browser(#796)
2021-09-13 20:22:10 +10:00
Lea Anthony
e7d4ec5836 Merge branch 'v2-alpha' into 796-support-browseropenurl 2021-09-13 20:21:59 +10:00
Lea Anthony
7fdbb0372c Update runtime.yml 2021-09-13 20:17:04 +10:00
misitebao
954470250e feat: added a method to open the link in runtime(wailsapp#796) 2021-09-13 17:58:36 +08:00
49 changed files with 1791 additions and 637 deletions

View File

@@ -25,6 +25,5 @@ jobs:
uses: devops-infra/action-commit-push@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
add_timestamp: true
commit_prefix: "[AUTO]"
commit_message: "The runtime was rebuilt"

View File

@@ -1,3 +1,4 @@
//go:build linux || darwin || !windows
// +build linux darwin !windows
package wails

View File

@@ -1,3 +1,4 @@
//go:build windows || !linux || !darwin
// +build windows !linux !darwin
package wails

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,4 @@
//go:build dev
// +build dev
package main

View File

@@ -1,3 +1,4 @@
//go:build dev
// +build dev
package main

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package cmd

View File

@@ -1,4 +1,4 @@
package interfaces
// Runtime interface
type Runtime interface {}
type Runtime interface{}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,6 @@ import (
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/mac"
)
func main() {
@@ -29,16 +28,11 @@ func main() {
Frameless: false,
StartHidden: false,
HideWindowOnClose: false,
RGBA: 0x000000FF,
RGBA: &options.RGBA{0, 0, 0, 255},
Windows: &windows.Options{
WebviewIsTransparent: true,
WindowBackgroundIsTranslucent: true,
DisableWindowIcon: true,
},
Mac: &mac.Options{
WebviewIsTransparent: true,
WindowBackgroundIsTranslucent: true,
TitleBar: mac.TitleBarHiddenInset(),
WebviewIsTransparent: true,
WindowIsTranslucent: true,
DisableWindowIcon: true,
},
LogLevel: logger.DEBUG,
OnStartup: app.startup,

View File

@@ -35,18 +35,18 @@ HideWindowOnClose: false,
RGBA: 0x000000FF,
Assets: assets,
Windows: &windows.Options{
WebviewIsTransparent: true,
WindowBackgroundIsTranslucent: true,
DisableWindowIcon: true,
},
LogLevel: logger.DEBUG,
OnStartup: app.startup,
OnShutdown: app.shutdown,
Bind: []interface{}{
app,
},
})
if err != nil {
log.Fatal(err)
}
WebviewIsTransparent: true,
WindowIsTranslucent: true,
DisableWindowIcon: true,
},
LogLevel: logger.DEBUG,
OnStartup: app.startup,
OnShutdown: app.shutdown,
Bind: []interface{}{
app,
},
})
if err != nil {
log.Fatal(err)
}
}

View File

@@ -32,12 +32,12 @@ func main() {
Frameless: false,
StartHidden: false,
HideWindowOnClose: false,
RGBA: 0x000000FF,
RGBA: &options.RGBA{0, 0, 0, 255},
Assets: assets,
Windows: &windows.Options{
WebviewIsTransparent: false,
WindowBackgroundIsTranslucent: false,
DisableWindowIcon: false,
WebviewIsTransparent: false,
WindowIsTranslucent: false,
DisableWindowIcon: false,
},
LogLevel: logger.DEBUG,
OnStartup: app.startup,

View File

@@ -21,7 +21,7 @@ require (
github.com/leaanthony/debme v1.2.1
github.com/leaanthony/go-ansi-parser v1.0.1
github.com/leaanthony/go-common-file-dialog v1.0.3
github.com/leaanthony/go-webview2 v0.0.0-20210912034341-849718dc22d7
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934
github.com/leaanthony/gosod v1.0.1
github.com/leaanthony/idgen v1.0.0
github.com/leaanthony/slicer v1.5.0

View File

@@ -125,8 +125,8 @@ github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQ
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZylykMwwx/MNEXn9fp+Y=
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
github.com/leaanthony/go-webview2 v0.0.0-20210912034341-849718dc22d7 h1:8IvKTQk33VBpncfgezD6BKutv5kCSZbDIcCNHOT9T4w=
github.com/leaanthony/go-webview2 v0.0.0-20210912034341-849718dc22d7/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934 h1:nK/JTPyJi5QRqYjVZjXgtN4/dhg2qtngoLxLDVn429k=
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/gosod v1.0.1 h1:F+4c3DmEBfigi7oAswCV2RpQ+k4DcNbhuCZUGdBHacQ=
github.com/leaanthony/gosod v1.0.1/go.mod h1:W8RyeSFBXu7RpIxPGEJfW4moSyGGEjlJMLV25wEbAdU=
github.com/leaanthony/idgen v1.0.0 h1:IZreR+JGEzFV4yeVuBZA25gM0keUoFy+RDUldncQ+Jw=

View File

@@ -144,7 +144,10 @@ func generateBindings(bindings *binding.Bindings) error {
}
targetDir := filepath.Join(projectConfig.WailsJSDir, "wailsjs", "go")
println("TargetDir =", targetDir)
err = os.RemoveAll(targetDir)
if err != nil {
return err
}
_ = fs.MkDirs(targetDir)
modelsFile := filepath.Join(targetDir, "models.ts")
err = bindings.WriteTS(modelsFile)

View File

@@ -46,7 +46,7 @@ extern void UpdateTrayMenuLabel(struct Application*, const char* JSON);
extern void AddContextMenu(struct Application*, char *contextMenuJSON);
extern void UpdateContextMenu(struct Application*, char *contextMenuJSON);
extern void WebviewIsTransparent(struct Application*);
extern void WindowBackgroundIsTranslucent(struct Application*);
extern void WindowIsTranslucent(struct Application*);
extern void* GetWindowHandle(struct Application*);
#ifdef __cplusplus

View File

@@ -135,7 +135,7 @@ struct Application {
int fullSizeContent;
int useToolBar;
int hideToolbarSeparator;
int windowBackgroundIsTranslucent;
int WindowIsTranslucent;
int hasURLHandlers;
const char *startupURL;
@@ -293,8 +293,8 @@ void Show(struct Application *app) {
);
}
void WindowBackgroundIsTranslucent(struct Application *app) {
app->windowBackgroundIsTranslucent = 1;
void WindowIsTranslucent(struct Application *app) {
app->WindowIsTranslucent = 1;
}
// Sends messages to the backend
@@ -1534,7 +1534,7 @@ void Run(struct Application *app, int argc, char **argv) {
applyWindowColour(app);
// Process translucency
if (app->windowBackgroundIsTranslucent) {
if (app->WindowIsTranslucent) {
makeWindowBackgroundTranslucent(app);
}
@@ -1775,7 +1775,7 @@ void* NewApplication(const char *title, int width, int height, int resizable, in
result->useToolBar = 0;
result->hideToolbarSeparator = 0;
result->appearance = NULL;
result->windowBackgroundIsTranslucent = 0;
result->WindowIsTranslucent = 0;
// Window data
result->delegate = NULL;

View File

@@ -57,8 +57,8 @@ func (a *Application) processPlatformSettings() error {
}
// Check if window should be translucent
if mac.WindowBackgroundIsTranslucent {
C.WindowBackgroundIsTranslucent(a.app)
if mac.WindowIsTranslucent {
C.WindowIsTranslucent(a.app)
}
// Process menu

View File

@@ -138,7 +138,7 @@ void HideToolbarSeparator(struct Application* app);
void DisableFrame(struct Application* app);
void SetAppearance(struct Application* app, const char *);
void WebviewIsTransparent(struct Application* app);
void WindowBackgroundIsTranslucent(struct Application* app);
void WindowIsTranslucent(struct Application* app);
void SetTray(struct Application* app, const char *, const char *, const char *);
//void SetContextMenus(struct Application* app, const char *);
void AddTrayMenu(struct Application* app, const char *);

View File

@@ -862,7 +862,7 @@ void UpdateTrayMenuLabel(struct Application* app, const char* JSON) {}
void AddContextMenu(struct Application* app, char *contextMenuJSON) {}
void UpdateContextMenu(struct Application* app, char *contextMenuJSON) {}
void WebviewIsTransparent(struct Application* app) {}
void WindowBackgroundIsTranslucent(struct Application* app) {}
void WindowIsTranslucent(struct Application* app) {}
void OpenDialog(struct Application* app, char *callbackID, char *title, char *filters, char *defaultFilename, char *defaultDir, int allowFiles, int allowDirs, int allowMultiple, int showHiddenFiles, int canCreateDirectories, int resolvesAliases, int treatPackagesAsDirectories) {}
void SaveDialog(struct Application* app, char *callbackID, char *title, char *filters, char *defaultFilename, char *defaultDir, int showHiddenFiles, int canCreateDirectories, int treatPackagesAsDirectories) {}
void MessageDialog(struct Application* app, char *callbackID, char *type, char *title, char *message, char *icon, char *button1, char *button2, char *button3, char *button4, char *defaultButton, char *cancelButton) {}

View File

@@ -105,7 +105,7 @@ struct Application *NewApplication(const char *title, int width, int height, int
result->logLevel = logLevel;
result->hideWindowOnClose = hideWindowOnClose;
result->webviewIsTranparent = false;
result->windowBackgroundIsTranslucent = false;
result->WindowIsTranslucent = false;
result->disableWindowIcon = false;
// Min/Max Width/Height
@@ -465,7 +465,7 @@ bool initWebView2(struct Application *app, int debugEnabled, messageCallback cb)
wvColor.G = app->backgroundColour.G;
wvColor.B = app->backgroundColour.B;
wvColor.A = app->backgroundColour.A == 0 ? 0 : 255;
if( app->windowBackgroundIsTranslucent ) {
if( app->WindowIsTranslucent ) {
wvColor.A = 0;
}
HRESULT result = wc2->put_DefaultBackgroundColor(wvColor);
@@ -538,7 +538,7 @@ void Run(struct Application* app, int argc, char **argv) {
// Configure translucency
DWORD dwExStyle = 0;
if ( app->windowBackgroundIsTranslucent) {
if ( app->WindowIsTranslucent) {
dwExStyle = WS_EX_NOREDIRECTIONBITMAP;
wc.hbrBackground = CreateSolidBrush(RGB(255,255,255));
}
@@ -590,7 +590,7 @@ void Run(struct Application* app, int argc, char **argv) {
SetWindowPos(nullptr, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
}
if ( app->windowBackgroundIsTranslucent ) {
if ( app->WindowIsTranslucent ) {
// Enable the translucent background effect
enableTranslucentBackground(app);
@@ -877,8 +877,8 @@ void WebviewIsTransparent(struct Application *app) {
app->webviewIsTranparent = true;
}
void WindowBackgroundIsTranslucent(struct Application *app) {
app->windowBackgroundIsTranslucent = true;
void WindowIsTranslucent(struct Application *app) {
app->WindowIsTranslucent = true;
}

View File

@@ -47,8 +47,8 @@ func (a *Application) processPlatformSettings() error {
C.WebviewIsTransparent(a.app)
}
if config.WindowBackgroundIsTranslucent {
C.WindowBackgroundIsTranslucent(a.app)
if config.WindowIsTranslucent {
C.WindowIsTranslucent(a.app)
}
if config.DisableWindowIcon {

View File

@@ -43,7 +43,7 @@ struct Application{
int frame;
char *startupURL;
bool webviewIsTranparent;
bool windowBackgroundIsTranslucent;
bool WindowIsTranslucent;
COREWEBVIEW2_COLOR backgroundColour;
bool disableWindowIcon;

View File

@@ -0,0 +1,11 @@
package windows
import (
"github.com/pkg/browser"
)
// BrowserOpenURL Use the default browser to open the url
func (f *Frontend) BrowserOpenURL(url string) {
// Specific method implementation
_ = browser.OpenURL(url)
}

View File

@@ -6,6 +6,13 @@ import (
"context"
"encoding/json"
"fmt"
"log"
"runtime"
"strconv"
"strings"
"github.com/leaanthony/slicer"
"github.com/leaanthony/go-webview2/pkg/edge"
"github.com/leaanthony/winc"
"github.com/leaanthony/winc/w32"
@@ -14,10 +21,6 @@ import (
"github.com/wailsapp/wails/v2/internal/frontend/assetserver"
"github.com/wailsapp/wails/v2/internal/logger"
"github.com/wailsapp/wails/v2/pkg/options"
"log"
"runtime"
"strconv"
"strings"
)
type Frontend struct {
@@ -41,6 +44,42 @@ type Frontend struct {
servingFromDisk bool
}
func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.Logger, appBindings *binding.Bindings, dispatcher frontend.Dispatcher) *Frontend {
result := &Frontend{
frontendOptions: appoptions,
logger: myLogger,
bindings: appBindings,
dispatcher: dispatcher,
ctx: ctx,
minHeight: appoptions.MinHeight,
minWidth: appoptions.MinWidth,
maxHeight: appoptions.MaxHeight,
maxWidth: appoptions.MaxWidth,
}
// Check if we have been given a directory to serve assets from.
// If so, this means we are in dev mode and are serving assets off disk.
// We indicate this through the `servingFromDisk` flag to ensure requests
// aren't cached by WebView2 in dev mode
_assetdir := ctx.Value("assetdir")
if _assetdir != nil {
result.servingFromDisk = true
}
bindingsJSON, err := appBindings.ToJSON()
if err != nil {
log.Fatal(err)
}
assets, err := assetserver.NewDesktopAssetServer(ctx, appoptions.Assets, bindingsJSON)
if err != nil {
log.Fatal(err)
}
result.assets = assets
return result
}
func (f *Frontend) WindowReload() {
f.ExecJS("runtime.WindowReload();")
}
@@ -202,14 +241,35 @@ func (f *Frontend) Quit() {
winc.Exit()
}
const (
ctrlZ int = 90
ctrlX = 88
ctrlC = 67
ctrlV = 86
ctrlA = 65
arrowUp = 38
arrowDown = 40
arrowRight = 39
arrowLeft = 37
keyDel = 46
)
func (f *Frontend) setupChromium() {
chromium := edge.NewChromium()
f.chromium = chromium
chromium.MessageCallback = f.processMessage
chromium.WebResourceRequestedCallback = f.processRequest
chromium.NavigationCompletedCallback = f.navigationCompleted
chromium.AcceleratorKeyCallback = func(_ uint) {
// TODO: Link to standard application shortcuts
acceleratorsWebviewShouldProcess := slicer.Int([]int{ctrlV, ctrlC, ctrlX, ctrlZ, ctrlA, arrowLeft, arrowRight, arrowUp, arrowDown, keyDel})
chromium.AcceleratorKeyCallback = func(vkey uint) bool {
// We want webview to handle ctrl-C, ctrl-Z, ctrl-v, ctrl-x
if acceleratorsWebviewShouldProcess.Contains(int(vkey)) {
return false
}
// Post keypress
w32.PostMessage(f.mainWindow.Handle(), w32.WM_KEYDOWN, uintptr(vkey), 0)
return true
}
chromium.Embed(f.mainWindow.Handle())
chromium.Resize()
@@ -365,39 +425,3 @@ func (f *Frontend) navigationCompleted(sender *edge.ICoreWebView2, args *edge.IC
f.mainWindow.Show()
}
func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.Logger, appBindings *binding.Bindings, dispatcher frontend.Dispatcher) *Frontend {
result := &Frontend{
frontendOptions: appoptions,
logger: myLogger,
bindings: appBindings,
dispatcher: dispatcher,
ctx: ctx,
minHeight: appoptions.MinHeight,
minWidth: appoptions.MinWidth,
maxHeight: appoptions.MaxHeight,
maxWidth: appoptions.MaxWidth,
}
// Check if we have been given a directory to serve assets from.
// If so, this means we are in dev mode and are serving assets off disk.
// We indicate this through the `servingFromDisk` flag to ensure requests
// aren't cached by WebView2 in dev mode
_assetdir := ctx.Value("assetdir")
if _assetdir != nil {
result.servingFromDisk = true
}
bindingsJSON, err := appBindings.ToJSON()
if err != nil {
log.Fatal(err)
}
assets, err := assetserver.NewDesktopAssetServer(ctx, appoptions.Assets, bindingsJSON)
if err != nil {
log.Fatal(err)
}
result.assets = assets
return result
}

View File

@@ -26,7 +26,7 @@ func NewWindow(parent winc.Controller, options *options.App) *Window {
var exStyle int
if options.Windows != nil {
exStyle = w32.WS_EX_CONTROLPARENT | w32.WS_EX_APPWINDOW
if options.Windows.WindowBackgroundIsTranslucent {
if options.Windows.WindowIsTranslucent {
exStyle |= w32.WS_EX_NOREDIRECTIONBITMAP
}
}
@@ -58,7 +58,7 @@ func NewWindow(parent winc.Controller, options *options.App) *Window {
result.SetMaxSize(options.MaxWidth, options.MaxHeight)
if options.Windows != nil {
if options.Windows.WindowBackgroundIsTranslucent {
if options.Windows.WindowIsTranslucent {
result.SetTranslucentBackground()
}

View File

@@ -8,6 +8,13 @@ import (
"context"
"encoding/json"
"fmt"
"io/fs"
"log"
"path/filepath"
"strings"
"sync"
"time"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/websocket/v2"
"github.com/wailsapp/wails/v2/internal/binding"
@@ -17,12 +24,6 @@ import (
"github.com/wailsapp/wails/v2/internal/menumanager"
"github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/options"
"io/fs"
"log"
"path/filepath"
"strings"
"sync"
"time"
)
type DevWebServer struct {
@@ -68,7 +69,7 @@ func (d *DevWebServer) Run(ctx context.Context) error {
if mt, msg, err = c.ReadMessage(); err != nil {
break
}
//d.logger.Info("[%p] %s", c, msg)
// d.logger.Info("[%p] %s", c, msg)
if string(msg) == "drag" {
continue
}
@@ -238,6 +239,11 @@ func (d *DevWebServer) MenuUpdateApplicationMenu() {
d.desktopFrontend.MenuUpdateApplicationMenu()
}
// BrowserOpenURL uses the system default browser to open the url
func (d *DevWebServer) BrowserOpenURL(url string) {
d.desktopFrontend.BrowserOpenURL(url)
}
func (d *DevWebServer) Notify(name string, data ...interface{}) {
d.notify(name, data...)
}

View File

@@ -0,0 +1,23 @@
package dispatcher
import (
"errors"
"github.com/wailsapp/wails/v2/internal/frontend"
)
// processBrowserMessage processing browser messages
func (d *Dispatcher) processBrowserMessage(message string, sender frontend.Frontend) (string, error) {
if len(message) < 2 {
return "", errors.New("Invalid Browser Message: " + message)
}
switch message[1] {
case 'O':
url := message[3:]
go sender.BrowserOpenURL(url)
default:
d.log.Error("unknown Browser message: %s", message)
}
return "", nil
}

View File

@@ -36,6 +36,8 @@ func (d *Dispatcher) ProcessMessage(message string, sender frontend.Frontend) (s
return d.processCallMessage(message, sender)
case 'W':
return d.processWindowMessage(message, sender)
case 'B':
return d.processBrowserMessage(message, sender)
case 'Q':
sender.Quit()
return "", nil

View File

@@ -2,6 +2,7 @@ package frontend
import (
"context"
"github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/options"
)
@@ -98,4 +99,7 @@ type Frontend interface {
// Events
Notify(name string, data ...interface{})
// Browser
BrowserOpenURL(url string)
}

View File

@@ -0,0 +1,8 @@
/**
* @description: Use the system default browser to open the url
* @param {string} url
* @return {void}
*/
export function BrowserOpenURL(url) {
window.WailsInvoke('BO:' + url);
}

View File

@@ -14,14 +14,19 @@ The electron alternative for Go
*
* @param {string} message
*/
// const windows = 0;
// const linux = 1;
// const macos = 2;
window.WailsInvoke = function (message) {
// Call Platform specific invoke method
if (PLATFORM === "windows") {
if (PLATFORM === 0) {
window.chrome.webview.postMessage(message);
} else if (PLATFORM === "darwin") {
} else if (PLATFORM === 1) {
window.blah();
} else {
} else if (PLATFORM === 2) {
console.error("Unsupported Platform");
}
};

View File

@@ -13,6 +13,7 @@ import {eventListeners, EventsEmit, EventsNotify, EventsOff, EventsOn, EventsOnc
import {Callback, callbacks} from './calls';
import {SetBindings} from "./bindings";
import * as Window from "./window";
import * as Browser from "./browser";
export function Quit() {
@@ -23,6 +24,7 @@ export function Quit() {
window.runtime = {
...Log,
...Window,
...Browser,
EventsOn,
EventsOnce,
EventsOnMultiple,
@@ -45,7 +47,9 @@ window.wails.SetBindings(window.wailsbindings);
delete window.wails.SetBindings;
// This is evaluated at build time in package.json
if (ENV === "production") {
// const dev = 0;
// const production = 1;
if (ENV === 0) {
delete window.wailsbindings;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
(()=>{window.WailsInvoke=function(e){windows==="windows"?window.chrome.webview.postMessage(e):windows==="darwin"?window.blah():console.error("Unsupported Platform")};})();
(()=>{window.WailsInvoke=function(e){window.chrome.webview.postMessage(e)};})();

View File

@@ -5,10 +5,10 @@
"main": "index.js",
"scripts": {
"build": "run-p build:*",
"build:ipc-windows": "esbuild desktop/ipc.js --bundle --minify --outfile=ipc_windows.js --define:PLATFORM='windows'",
"build:ipc-windows": "esbuild desktop/ipc.js --bundle --minify --outfile=ipc_windows.js --define:PLATFORM=0",
"build:ipc-dev": "cd dev && npm run build",
"build:runtime-desktop-prod": "esbuild desktop/main.js --bundle --minify --outfile=runtime_prod_desktop.js --define:ENV='production'",
"build:runtime-desktop-dev": "esbuild desktop/main.js --bundle --sourcemap=inline --outfile=runtime_dev_desktop.js --define:ENV='dev'",
"build:runtime-desktop-prod": "esbuild desktop/main.js --bundle --minify --outfile=runtime_prod_desktop.js --define:ENV=1",
"build:runtime-desktop-dev": "esbuild desktop/main.js --bundle --sourcemap=inline --outfile=runtime_dev_desktop.js --define:ENV=0",
"build:runtime-wrapper": "cd wrapper && esbuild main.js --bundle --minify --outfile=runtime.js",
"test": "echo \"Error: no test specified\" && exit 1"
},

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
(()=>{var v=Object.defineProperty;var h=n=>v(n,"__esModule",{value:!0});var x=(n,o)=>{h(n);for(var e in o)v(n,e,{get:o[e],enumerable:!0})};var f={};x(f,{LogDebug:()=>T,LogError:()=>D,LogFatal:()=>F,LogInfo:()=>C,LogLevel:()=>z,LogPrint:()=>R,LogTrace:()=>b,LogWarning:()=>J,SetLogLevel:()=>G});function l(n,o){window.WailsInvoke("L"+n+o)}function b(n){l("T",n)}function R(n){l("P",n)}function T(n){l("D",n)}function C(n){l("I",n)}function J(n){l("W",n)}function D(n){l("E",n)}function F(n){l("F",n)}function G(n){l("S",n)}var z={TRACE:1,DEBUG:2,INFO:3,WARNING:4,ERROR:5};var g=class{constructor(o,e){e=e||-1,this.Callback=t=>(o.apply(null,t),e===-1?!1:(e-=1,e===0))}},s={};function a(n,o,e){s[n]=s[n]||[];let t=new g(o,e);s[n].push(t)}function E(n,o){a(n,o,-1)}function I(n,o){a(n,o,1)}function k(n){let o=n.name;if(s[o]){let e=s[o].slice();for(let t=0;t<s[o].length;t+=1){let r=s[o][t],i=n.data;r.Callback(i)&&e.splice(t,1)}s[o]=e}}function S(n){let o;try{o=JSON.parse(n)}catch(e){let t="Invalid JSON passed to Notify: "+n;throw new Error(t)}k(o)}function m(n){let o={name:n,data:[].slice.apply(arguments).slice(1)};k(o),window.WailsInvoke("EE"+JSON.stringify(o))}function y(n){s.delete(n),window.WailsInvoke("EX"+n)}var c={};function A(){var n=new Uint32Array(1);return window.crypto.getRandomValues(n)[0]}function B(){return Math.random()*9007199254740991}var W;window.crypto?W=A:W=B;function d(n,o,e){return e==null&&(e=0),new Promise(function(t,r){var i;do i=n+"-"+W();while(c[i]);var w;e>0&&(w=setTimeout(function(){r(Error("Call to "+n+" timed out. Request ID: "+i))},e)),c[i]={timeoutHandle:w,reject:r,resolve:t};try{let u={name:n,args:o,callbackID:i};window.WailsInvoke("C"+JSON.stringify(u))}catch(u){console.error(u)}})}function L(n){var o;try{o=JSON.parse(n)}catch(r){let i=`Invalid JSON passed to callback: ${r.message}. Message: ${n}`;throw wails.LogDebug(i),new Error(i)}var e=o.callbackid,t=c[e];if(!t){let r=`Callback '${e}' not registered!!!`;throw console.error(r),new Error(r)}clearTimeout(t.timeoutHandle),delete c[e],o.error?t.reject(o.error):t.resolve(o.result)}window.go={};function O(n){try{n=JSON.parse(n)}catch(o){console.error(o)}window.go=window.go||{},Object.keys(n).forEach(o=>{window.go[o]=window.go[o]||{},Object.keys(n[o]).forEach(e=>{window.go[o][e]=window.go[o][e]||{},Object.keys(n[o][e]).forEach(t=>{window.go[o][e][t]=function(){let r=0;function i(){let w=[].slice.call(arguments);return d([o,e,t].join("."),w,r)}return i.setTimeout=function(w){r=w},i.getTimeout=function(){return r},i}()})})})}var p={};x(p,{WindowCenter:()=>U,WindowFullscreen:()=>H,WindowGetPosition:()=>X,WindowGetSize:()=>Q,WindowHide:()=>Z,WindowMaximise:()=>Y,WindowMinimise:()=>nn,WindowReload:()=>P,WindowSetMaxSize:()=>V,WindowSetMinSize:()=>q,WindowSetPosition:()=>N,WindowSetRGBA:()=>en,WindowSetSize:()=>$,WindowSetTitle:()=>j,WindowShow:()=>K,WindowUnFullscreen:()=>M,WindowUnmaximise:()=>_,WindowUnminimise:()=>on});function P(){window.location.reload()}function U(){window.WailsInvoke("Wc")}function j(n){window.WailsInvoke("WT"+n)}function H(){window.WailsInvoke("WF")}function M(){window.WailsInvoke("Wf")}function $(n,o){window.WailsInvoke("Ws:"+n+":"+o)}function Q(){return d(":wails:WindowGetSize")}function V(n,o){window.WailsInvoke("WZ:"+n+":"+o)}function q(n,o){window.WailsInvoke("Wz:"+n+":"+o)}function N(n,o){window.WailsInvoke("Wp:"+n+":"+o)}function X(){return d(":wails:WindowGetPos")}function Z(){window.WailsInvoke("WH")}function K(){window.WailsInvoke("WS")}function Y(){window.WailsInvoke("WM")}function _(){window.WailsInvoke("WU")}function nn(){window.WailsInvoke("Wm")}function on(){window.WailsInvoke("Wu")}function en(n){let o=JSON.stringify(n);window.WailsInvoke("Wr:"+o)}function tn(){window.WailsInvoke("Q")}window.runtime={...f,...p,EventsOn:E,EventsOnce:I,EventsOnMultiple:a,EventsEmit:m,EventsOff:y,Quit:tn};window.wails={Callback:L,EventsNotify:S,SetBindings:O,eventListeners:s,callbacks:c};window.wails.SetBindings(window.wailsbindings);delete window.wails.SetBindings;production==="production"&&delete window.wailsbindings;window.addEventListener("mousedown",n=>{let o=n.target;for(;o!=null&&!o.hasAttribute("data-wails-no-drag");){if(o.hasAttribute("data-wails-drag")){window.WailsInvoke("drag");break}o=o.parentElement}});})();
(()=>{var g=Object.defineProperty;var h=o=>g(o,"__esModule",{value:!0});var f=(o,n)=>{h(o);for(var e in n)g(o,e,{get:n[e],enumerable:!0})};var W={};f(W,{LogDebug:()=>T,LogError:()=>D,LogFatal:()=>F,LogInfo:()=>C,LogLevel:()=>U,LogPrint:()=>B,LogTrace:()=>R,LogWarning:()=>J,SetLogLevel:()=>G});function l(o,n){window.WailsInvoke("L"+o+n)}function R(o){l("T",o)}function B(o){l("P",o)}function T(o){l("D",o)}function C(o){l("I",o)}function J(o){l("W",o)}function D(o){l("E",o)}function F(o){l("F",o)}function G(o){l("S",o)}var U={TRACE:1,DEBUG:2,INFO:3,WARNING:4,ERROR:5};var E=class{constructor(n,e){e=e||-1,this.Callback=t=>(n.apply(null,t),e===-1?!1:(e-=1,e===0))}},s={};function d(o,n,e){s[o]=s[o]||[];let t=new E(n,e);s[o].push(t)}function I(o,n){d(o,n,-1)}function k(o,n){d(o,n,1)}function m(o){let n=o.name;if(s[n]){let e=s[n].slice();for(let t=0;t<s[n].length;t+=1){let r=s[n][t],i=o.data;r.Callback(i)&&e.splice(t,1)}s[n]=e}}function S(o){let n;try{n=JSON.parse(o)}catch(e){let t="Invalid JSON passed to Notify: "+o;throw new Error(t)}m(n)}function y(o){let n={name:o,data:[].slice.apply(arguments).slice(1)};m(n),window.WailsInvoke("EE"+JSON.stringify(n))}function L(o){s.delete(o),window.WailsInvoke("EX"+o)}var c={};function z(){var o=new Uint32Array(1);return window.crypto.getRandomValues(o)[0]}function A(){return Math.random()*9007199254740991}var p;window.crypto?p=z:p=A;function a(o,n,e){return e==null&&(e=0),new Promise(function(t,r){var i;do i=o+"-"+p();while(c[i]);var w;e>0&&(w=setTimeout(function(){r(Error("Call to "+o+" timed out. Request ID: "+i))},e)),c[i]={timeoutHandle:w,reject:r,resolve:t};try{let u={name:o,args:n,callbackID:i};window.WailsInvoke("C"+JSON.stringify(u))}catch(u){console.error(u)}})}function O(o){var n;try{n=JSON.parse(o)}catch(r){let i=`Invalid JSON passed to callback: ${r.message}. Message: ${o}`;throw wails.LogDebug(i),new Error(i)}var e=n.callbackid,t=c[e];if(!t){let r=`Callback '${e}' not registered!!!`;throw console.error(r),new Error(r)}clearTimeout(t.timeoutHandle),delete c[e],n.error?t.reject(n.error):t.resolve(n.result)}window.go={};function b(o){try{o=JSON.parse(o)}catch(n){console.error(n)}window.go=window.go||{},Object.keys(o).forEach(n=>{window.go[n]=window.go[n]||{},Object.keys(o[n]).forEach(e=>{window.go[n][e]=window.go[n][e]||{},Object.keys(o[n][e]).forEach(t=>{window.go[n][e][t]=function(){let r=0;function i(){let w=[].slice.call(arguments);return a([n,e,t].join("."),w,r)}return i.setTimeout=function(w){r=w},i.getTimeout=function(){return r},i}()})})})}var v={};f(v,{WindowCenter:()=>j,WindowFullscreen:()=>M,WindowGetPosition:()=>Z,WindowGetSize:()=>V,WindowHide:()=>K,WindowMaximise:()=>_,WindowMinimise:()=>no,WindowReload:()=>P,WindowSetMaxSize:()=>q,WindowSetMinSize:()=>N,WindowSetPosition:()=>X,WindowSetRGBA:()=>to,WindowSetSize:()=>Q,WindowSetTitle:()=>H,WindowShow:()=>Y,WindowUnFullscreen:()=>$,WindowUnmaximise:()=>oo,WindowUnminimise:()=>eo});function P(){window.location.reload()}function j(){window.WailsInvoke("Wc")}function H(o){window.WailsInvoke("WT"+o)}function M(){window.WailsInvoke("WF")}function $(){window.WailsInvoke("Wf")}function Q(o,n){window.WailsInvoke("Ws:"+o+":"+n)}function V(){return a(":wails:WindowGetSize")}function q(o,n){window.WailsInvoke("WZ:"+o+":"+n)}function N(o,n){window.WailsInvoke("Wz:"+o+":"+n)}function X(o,n){window.WailsInvoke("Wp:"+o+":"+n)}function Z(){return a(":wails:WindowGetPos")}function K(){window.WailsInvoke("WH")}function Y(){window.WailsInvoke("WS")}function _(){window.WailsInvoke("WM")}function oo(){window.WailsInvoke("WU")}function no(){window.WailsInvoke("Wm")}function eo(){window.WailsInvoke("Wu")}function to(o){let n=JSON.stringify(o);window.WailsInvoke("Wr:"+n)}var x={};f(x,{BrowserOpenURL:()=>io});function io(o){window.WailsInvoke("BO:"+o)}function ro(){window.WailsInvoke("Q")}window.runtime={...W,...v,...x,EventsOn:I,EventsOnce:k,EventsOnMultiple:d,EventsEmit:y,EventsOff:L,Quit:ro};window.wails={Callback:O,EventsNotify:S,SetBindings:b,eventListeners:s,callbacks:c};window.wails.SetBindings(window.wailsbindings);delete window.wails.SetBindings;window.addEventListener("mousedown",o=>{let n=o.target;for(;n!=null&&!n.hasAttribute("data-wails-no-drag");){if(n.hasAttribute("data-wails-drag")){window.WailsInvoke("drag");break}n=n.parentElement}});})();

View File

@@ -0,0 +1,8 @@
/**
* @description: Use the system default browser to open the url
* @param {string} url
* @return {void}
*/
export function BrowserOpenURL(url) {
window.runtime.BrowserOpenURL(url);
}

View File

@@ -12,6 +12,7 @@ The electron alternative for Go
import * as Log from "./log";
import * as Events from './events';
import * as Window from './window';
import * as Browser from './browser';
export function Quit() {
window.runtime.Quit();
@@ -22,5 +23,6 @@ export default {
...Log,
...Events,
...Window,
...Browser,
Quit
};

View File

@@ -1,492 +1,13 @@
{
"name": "@wailsapp/runtime",
"version": "1.1.1",
"lockfileVersion": 1,
"version": "2.0.0",
"lockfileVersion": 2,
"requires": true,
"dependencies": {
"ansi-regex": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
"dev": true
},
"camelcase": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=",
"dev": true
},
"cliui": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
"dev": true,
"requires": {
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1",
"wrap-ansi": "^2.0.0"
}
},
"code-point-at": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
"integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=",
"dev": true
},
"decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"dev": true
},
"dts-dom": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/dts-dom/-/dts-dom-3.6.0.tgz",
"integrity": "sha512-on5jxTgt+A6r0Zyyz6ZRHXaAO7J1VPnOd6+AmvI1vH440AlAZZNc5rUHzgPuTjGlrVr1rOWQYNl7ZJK6rDohbw==",
"dev": true
},
"dts-gen": {
"version": "0.5.8",
"resolved": "https://registry.npmjs.org/dts-gen/-/dts-gen-0.5.8.tgz",
"integrity": "sha512-kIAV6dlHaF7r5J+tIuOC1BJls2P72YM0cyWQUR88zcJEpX2ccRZe+HmXLfkkvfPwjvSO3FEqUiyC8On/grx5qw==",
"dev": true,
"requires": {
"dts-dom": "^3.6.0",
"parse-git-config": "^1.1.1",
"typescript": "^3.5.1",
"yargs": "^4.8.1"
}
},
"error-ex": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
"integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==",
"dev": true,
"requires": {
"is-arrayish": "^0.2.1"
}
},
"extend-shallow": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
"dev": true,
"requires": {
"is-extendable": "^0.1.0"
}
},
"find-up": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
"dev": true,
"requires": {
"path-exists": "^2.0.0",
"pinkie-promise": "^2.0.0"
}
},
"fs-exists-sync": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz",
"integrity": "sha1-mC1ok6+RjnLQjeyehnP/K1qNat0=",
"dev": true
},
"get-caller-file": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
"integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
"dev": true
},
"git-config-path": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/git-config-path/-/git-config-path-1.0.1.tgz",
"integrity": "sha1-bTP37WPbDQ4RgTFQO6s6ykfVRmQ=",
"dev": true,
"requires": {
"extend-shallow": "^2.0.1",
"fs-exists-sync": "^0.1.0",
"homedir-polyfill": "^1.0.0"
}
},
"graceful-fs": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
"dev": true
},
"homedir-polyfill": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
"integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==",
"dev": true,
"requires": {
"parse-passwd": "^1.0.0"
}
},
"hosted-git-info": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
"dev": true
},
"ini": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
"dev": true
},
"invert-kv": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
"dev": true
},
"is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
"integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=",
"dev": true
},
"is-extendable": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
"integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=",
"dev": true
},
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
"integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=",
"dev": true,
"requires": {
"number-is-nan": "^1.0.0"
}
},
"is-utf8": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true
},
"lcid": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
"integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
"dev": true,
"requires": {
"invert-kv": "^1.0.0"
}
},
"load-json-file": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"parse-json": "^2.2.0",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0",
"strip-bom": "^2.0.0"
}
},
"lodash.assign": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
"integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=",
"dev": true
},
"normalize-package-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
"integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
"dev": true,
"requires": {
"hosted-git-info": "^2.1.4",
"resolve": "^1.10.0",
"semver": "2 || 3 || 4 || 5",
"validate-npm-package-license": "^3.0.1"
}
},
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true
},
"os-locale": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
"dev": true,
"requires": {
"lcid": "^1.0.0"
}
},
"parse-git-config": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/parse-git-config/-/parse-git-config-1.1.1.tgz",
"integrity": "sha1-06mYQxcTL1c5hxK7pDjhKVkN34w=",
"dev": true,
"requires": {
"extend-shallow": "^2.0.1",
"fs-exists-sync": "^0.1.0",
"git-config-path": "^1.0.1",
"ini": "^1.3.4"
}
},
"parse-json": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
"integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=",
"dev": true,
"requires": {
"error-ex": "^1.2.0"
}
},
"parse-passwd": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz",
"integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=",
"dev": true
},
"path-exists": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
"dev": true,
"requires": {
"pinkie-promise": "^2.0.0"
}
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
"dev": true
},
"path-type": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
}
},
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
},
"pinkie": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=",
"dev": true
},
"pinkie-promise": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
"dev": true,
"requires": {
"pinkie": "^2.0.0"
}
},
"read-pkg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
"dev": true,
"requires": {
"load-json-file": "^1.0.0",
"normalize-package-data": "^2.3.2",
"path-type": "^1.0.0"
}
},
"read-pkg-up": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
"dev": true,
"requires": {
"find-up": "^1.0.0",
"read-pkg": "^1.0.0"
}
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
"dev": true
},
"require-main-filename": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"dev": true
},
"resolve": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
}
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
},
"set-blocking": {
"packages": {
"": {
"name": "@wailsapp/runtime",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"dev": true
},
"spdx-correct": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
"integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
"dev": true,
"requires": {
"spdx-expression-parse": "^3.0.0",
"spdx-license-ids": "^3.0.0"
}
},
"spdx-exceptions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
"integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
"dev": true
},
"spdx-expression-parse": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
"integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
"dev": true,
"requires": {
"spdx-exceptions": "^2.1.0",
"spdx-license-ids": "^3.0.0"
}
},
"spdx-license-ids": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz",
"integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==",
"dev": true
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
}
},
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"dev": true,
"requires": {
"ansi-regex": "^2.0.0"
}
},
"strip-bom": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
"dev": true,
"requires": {
"is-utf8": "^0.2.0"
}
},
"typescript": {
"version": "3.9.7",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
"integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
"dev": true
},
"validate-npm-package-license": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
"integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
"dev": true,
"requires": {
"spdx-correct": "^3.0.0",
"spdx-expression-parse": "^3.0.0"
}
},
"which-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz",
"integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=",
"dev": true
},
"window-size": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/window-size/-/window-size-0.2.0.tgz",
"integrity": "sha1-tDFbtCFKPXBY6+7okuE/ok2YsHU=",
"dev": true
},
"wrap-ansi": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"dev": true,
"requires": {
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1"
}
},
"y18n": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
"integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=",
"dev": true
},
"yargs": {
"version": "4.8.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz",
"integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=",
"dev": true,
"requires": {
"cliui": "^3.2.0",
"decamelize": "^1.1.1",
"get-caller-file": "^1.0.1",
"lodash.assign": "^4.0.3",
"os-locale": "^1.4.0",
"read-pkg-up": "^1.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^1.0.1",
"set-blocking": "^2.0.0",
"string-width": "^1.0.1",
"which-module": "^1.0.0",
"window-size": "^0.2.0",
"y18n": "^3.2.1",
"yargs-parser": "^2.4.1"
}
},
"yargs-parser": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz",
"integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=",
"dev": true,
"requires": {
"camelcase": "^3.0.0",
"lodash.assign": "^4.0.6"
}
"license": "MIT"
}
}
}

View File

@@ -39,41 +39,43 @@ interface runtime {
WindowReload(): void;
WindowCenter(): void
WindowCenter(): void;
WindowSetTitle(title: string): void
WindowSetTitle(title: string): void;
WindowFullscreen(): void
WindowFullscreen(): void;
WindowUnFullscreen(): void
WindowUnFullscreen(): void;
WindowSetSize(width: number, height: number): Promise<Size>
WindowSetSize(width: number, height: number): Promise<Size>;
WindowGetSize(): Promise<Size>
WindowGetSize(): Promise<Size>;
WindowSetMaxSize(width: number, height: number): void
WindowSetMaxSize(width: number, height: number): void;
WindowSetMinSize(width: number, height: number): void
WindowSetMinSize(width: number, height: number): void;
WindowSetPosition(x: number, y: number): void
WindowSetPosition(x: number, y: number): void;
WindowGetPosition(): Promise<Position>
WindowGetPosition(): Promise<Position>;
WindowHide(): void
WindowHide(): void;
WindowShow(): void
WindowShow(): void;
WindowMaximise(): void
WindowMaximise(): void;
WindowUnmaximise(): void
WindowUnmaximise(): void;
WindowMinimise(): void
WindowMinimise(): void;
WindowUnminimise(): void
WindowUnminimise(): void;
WindowSetRGBA(rgba: RGBA): void;
Quit(): void
BrowserOpenURL(url: string): void;
Quit(): void;
}
declare global {
@@ -82,4 +84,4 @@ declare global {
}
}
export {};
export { };

View File

@@ -1 +1 @@
(()=>{var u=Object.defineProperty;var d=n=>u(n,"__esModule",{value:!0});var t=(n,i)=>{d(n);for(var o in i)u(n,o,{get:i[o],enumerable:!0})};var e={};t(e,{LogDebug:()=>p,LogError:()=>x,LogFatal:()=>f,LogInfo:()=>W,LogTrace:()=>m,LogWarning:()=>c});function m(n){window.runtime.LogTrace(n)}function p(n){window.runtime.LogDebug(n)}function W(n){window.runtime.LogInfo(n)}function c(n){window.runtime.LogWarning(n)}function x(n){window.runtime.LogError(n)}function f(n){window.runtime.LogFatal(n)}var w={};t(w,{EventsEmit:()=>S,EventsOn:()=>s,EventsOnMultiple:()=>l,EventsOnce:()=>a});function l(n,i,o){window.runtime.EventsOnMultiple(n,i,o)}function s(n,i){OnMultiple(n,i,-1)}function a(n,i){OnMultiple(n,i,1)}function S(n){let i=[n].slice.call(arguments);return window.runtime.EventsEmit.apply(null,i)}var r={};t(r,{WindowCenter:()=>L,WindowFullscreen:()=>E,WindowGetPosition:()=>P,WindowGetSize:()=>z,WindowHide:()=>R,WindowMaximise:()=>b,WindowMinimise:()=>A,WindowReload:()=>g,WindowSetMaxSize:()=>G,WindowSetMinSize:()=>O,WindowSetPosition:()=>U,WindowSetRGBA:()=>C,WindowSetSize:()=>F,WindowSetTitle:()=>M,WindowShow:()=>T,WindowUnFullscreen:()=>v,WindowUnmaximise:()=>h,WindowUnminimise:()=>B});function g(){window.runtime.WindowReload()}function L(){window.runtime.WindowCenter()}function M(n){window.runtime.WindowSetTitle(n)}function E(){window.runtime.WindowFullscreen()}function v(){window.runtime.WindowUnFullscreen()}function z(){window.runtime.WindowGetSize()}function F(n,i){window.runtime.WindowSetSize(n,i)}function G(n,i){window.runtime.WindowSetMaxSize(n,i)}function O(n,i){window.runtime.WindowSetMinSize(n,i)}function U(n,i){window.runtime.WindowSetPosition(n,i)}function P(){window.runtime.WindowGetPosition()}function R(){window.runtime.WindowHide()}function T(){window.runtime.WindowShow()}function b(){window.runtime.WindowMaximise()}function h(){window.runtime.WindowUnmaximise()}function A(){window.runtime.WindowMinimise()}function B(){window.runtime.WindowUnminimise()}function C(n){window.runtime.WindowSetRGBA(n)}function D(){window.runtime.Quit()}var I={...e,...w,...r,Quit:D};})();
(()=>{var d=Object.defineProperty;var m=n=>d(n,"__esModule",{value:!0});var t=(n,i)=>{m(n);for(var o in i)d(n,o,{get:i[o],enumerable:!0})};var e={};t(e,{LogDebug:()=>c,LogError:()=>x,LogFatal:()=>s,LogInfo:()=>W,LogTrace:()=>p,LogWarning:()=>f});function p(n){window.runtime.LogTrace(n)}function c(n){window.runtime.LogDebug(n)}function W(n){window.runtime.LogInfo(n)}function f(n){window.runtime.LogWarning(n)}function x(n){window.runtime.LogError(n)}function s(n){window.runtime.LogFatal(n)}var w={};t(w,{EventsEmit:()=>g,EventsOn:()=>a,EventsOnMultiple:()=>l,EventsOnce:()=>S});function l(n,i,o){window.runtime.EventsOnMultiple(n,i,o)}function a(n,i){OnMultiple(n,i,-1)}function S(n,i){OnMultiple(n,i,1)}function g(n){let i=[n].slice.call(arguments);return window.runtime.EventsEmit.apply(null,i)}var r={};t(r,{WindowCenter:()=>M,WindowFullscreen:()=>v,WindowGetPosition:()=>B,WindowGetSize:()=>O,WindowHide:()=>P,WindowMaximise:()=>b,WindowMinimise:()=>A,WindowReload:()=>L,WindowSetMaxSize:()=>F,WindowSetMinSize:()=>G,WindowSetPosition:()=>R,WindowSetRGBA:()=>D,WindowSetSize:()=>U,WindowSetTitle:()=>E,WindowShow:()=>T,WindowUnFullscreen:()=>z,WindowUnmaximise:()=>h,WindowUnminimise:()=>C});function L(){window.runtime.WindowReload()}function M(){window.runtime.WindowCenter()}function E(n){window.runtime.WindowSetTitle(n)}function v(){window.runtime.WindowFullscreen()}function z(){window.runtime.WindowUnFullscreen()}function O(){window.runtime.WindowGetSize()}function U(n,i){window.runtime.WindowSetSize(n,i)}function F(n,i){window.runtime.WindowSetMaxSize(n,i)}function G(n,i){window.runtime.WindowSetMinSize(n,i)}function R(n,i){window.runtime.WindowSetPosition(n,i)}function B(){window.runtime.WindowGetPosition()}function P(){window.runtime.WindowHide()}function T(){window.runtime.WindowShow()}function b(){window.runtime.WindowMaximise()}function h(){window.runtime.WindowUnmaximise()}function A(){window.runtime.WindowMinimise()}function C(){window.runtime.WindowUnminimise()}function D(n){window.runtime.WindowSetRGBA(n)}var u={};t(u,{BrowserOpenURL:()=>H});function H(n){window.runtime.BrowserOpenURL(n)}function I(){window.runtime.Quit()}var y={...e,...w,...r,...u,Quit:I};})();

View File

@@ -7,6 +7,7 @@ import (
"github.com/wailsapp/wails/v2/internal/system/packagemanager"
"os/exec"
"strings"
"syscall"
"github.com/wailsapp/wails/v2/internal/system/operatingsystem"
)
@@ -16,7 +17,7 @@ import (
func init() {
r, err := syscall.Sysctl("sysctl.proc_translated")
if err != nil {
return false
return
}
IsAppleSilicon = r == "\x00\x00\x00" || r == "\x01\x00\x00"

View File

@@ -375,9 +375,7 @@ func (b *BaseBuilder) CompileProject(options *Options) error {
func generateRuntimeWrapper(options *Options) error {
wrapperDir := filepath.Join(options.WailsJSDir, "wailsjs", "runtime")
if fs.DirExists(wrapperDir) {
return nil
}
_ = os.RemoveAll(wrapperDir)
extractor := gosod.New(wrapper.RuntimeWrapper)
return extractor.Extract(wrapperDir, nil)
}

View File

@@ -10,10 +10,10 @@ const (
// Options are options specific to Mac
type Options struct {
TitleBar *TitleBar
Appearance AppearanceType
WebviewIsTransparent bool
WindowBackgroundIsTranslucent bool
ActivationPolicy ActivationPolicy
URLHandlers map[string]func(string)
TitleBar *TitleBar
Appearance AppearanceType
WebviewIsTransparent bool
WindowIsTranslucent bool
ActivationPolicy ActivationPolicy
URLHandlers map[string]func(string)
}

View File

@@ -2,7 +2,7 @@ package windows
// Options are options specific to Windows
type Options struct {
WebviewIsTransparent bool
WindowBackgroundIsTranslucent bool
DisableWindowIcon bool
WebviewIsTransparent bool
WindowIsTranslucent bool
DisableWindowIcon bool
}

11
v2/pkg/runtime/browser.go Normal file
View File

@@ -0,0 +1,11 @@
package runtime
import (
"context"
)
// BrowserOpenURL uses the system default browser to open the url
func BrowserOpenURL(ctx context.Context, url string) {
appFrontend := getFrontend(ctx)
appFrontend.BrowserOpenURL(url)
}