From 1ec3b4ecabf6dbd56f0d38b2e568d7a32f2d1b0e Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Thu, 1 Feb 2024 21:09:03 +1100 Subject: [PATCH] v3.0.0-alpha.4 --- mkdocs-website/docs/en/learn/runtime.md | 58 +++++++++++++++++++ mkdocs-website/docs/en/roadmap.md | 36 ++++++------ mkdocs-website/mkdocs.yml | 2 + .../shared/alpha3-bindings-callbyname.csv | 6 +- .../shared/alpha4-wails3-package.csv | 7 +-- v3/cmd/wails3/main.go | 1 + .../commands/build_assets/runtime/compiled.go | 4 +- v3/internal/commands/runtime.go | 21 +++++++ 8 files changed, 109 insertions(+), 26 deletions(-) create mode 100644 mkdocs-website/docs/en/learn/runtime.md create mode 100644 v3/internal/commands/runtime.go diff --git a/mkdocs-website/docs/en/learn/runtime.md b/mkdocs-website/docs/en/learn/runtime.md new file mode 100644 index 00000000000..b3d4180c798 --- /dev/null +++ b/mkdocs-website/docs/en/learn/runtime.md @@ -0,0 +1,58 @@ +# Runtime + +The Wails runtime is the standard library for Wails applications. It provides a number of features that may +be used in your applications, including: + +- Window management +- Dialogs +- Browser integration +- Clipboard +- Frameless dragging +- Tray icons +- Menu management +- System information +- Events +- Calling Go code +- Context Menus +- Screens +- WML (Wails Markup Language) + +The runtime is required for integration between Go and the frontend. There are 2 ways to integrate the runtime: + +- Using the `@wailsio/runtime` package +- Using a pre-built version of the runtime + +## Using the `@wailsio/runtime` package + +The `@wailsio/runtime` package is a JavaScript package that provides access to the Wails runtime. It is used in by all +the standard templates and is the recommended way to integrate the runtime into your application. By using the package, +you will only include the parts of the runtime that you use. + +The package is available on npm and can be installed using: + +```shell +npm install --save @wailsio/runtime +``` + +## Using a pre-built version of the runtime + +Some projects will not use a Javascript bundler and may prefer to use a pre-built version of the runtime. This is +the default for the examples in `v3/examples`. The pre-built version of the runtime can be generated using the +following command: + +```shell +wails3 generate runtime +``` + +This will generate a `runtime.js` (and `runtime.debug.js`) file in the `frontend` directory of your project. +This file can be included in your assets directory and used in your application by adding it to your assets +directory (normally `frontend/dist`) and then including it in your HTML: + +```html + + + + + + +``` \ No newline at end of file diff --git a/mkdocs-website/docs/en/roadmap.md b/mkdocs-website/docs/en/roadmap.md index 1cc10277ba6..286ab283a93 100644 --- a/mkdocs-website/docs/en/roadmap.md +++ b/mkdocs-website/docs/en/roadmap.md @@ -10,7 +10,23 @@ we are aiming to achieve. These are subject to change. ## Alpha milestones -### Current: Alpha 4 +### Current: Alpha 5 + +#### Goals + +- [ ] Get Linux to Alpha 4 parity +- [ ] Keyboard shortcuts + - Window Level shortcuts + - Application Level shortcuts (applies to all windows) + - Ensure Keydown/Keyup events are sent to JS if not handled by Go + +## Upcoming milestones + +## Alpha 6 + +## Previous milestones + +### Alpha 4 - Completed 2024-02-01 #### Goals @@ -135,24 +151,6 @@ Examples: - [ ] All examples working on Linux -## Upcoming milestones - -### Alpha 4 - -#### Goals - - -### Alpha 5 - -#### Goals - -- [ ] Keyboard shortcuts - - Window Level shortcuts - - Application Level shortcuts (applies to all windows) - - Ensure Keydown/Keyup events are sent to JS if not handled by Go - -## Previous milestones - ### Alpha 2 #### Goals diff --git a/mkdocs-website/mkdocs.yml b/mkdocs-website/mkdocs.yml index 65319327eef..8515730783c 100644 --- a/mkdocs-website/mkdocs.yml +++ b/mkdocs-website/mkdocs.yml @@ -150,6 +150,8 @@ nav: # - Links: community/links.md - Your First Application: getting-started/your-first-app.md - Next Steps: getting-started/next-steps.md + - Learn More: + - Runtime: getting-started/learn.md - Feedback: getting-started/feedback.md - Feedback: getting-started/feedback.md - What's New in v3?: whats-new.md diff --git a/mkdocs-website/shared/alpha3-bindings-callbyname.csv b/mkdocs-website/shared/alpha3-bindings-callbyname.csv index 8483f206831..dbbc00e5c2b 100644 --- a/mkdocs-website/shared/alpha3-bindings-callbyname.csv +++ b/mkdocs-website/shared/alpha3-bindings-callbyname.csv @@ -1,5 +1,9 @@ Scenario,Windows,Mac,Linux -Same package,:material-check-bold:,:material-check-bold:,:material-check-bold: +Same package,: clipboardLock.RLock() + defer clipboardLock.RUnlock() + clipboardText := C.getClipboardText() + result := C.GoString(clipboardText) + return result, true:,:material-check-bold:,:material-check-bold: Different package,:material-check-bold:,:material-check-bold:,:material-check-bold: Different package with same name,"on hold","on hold","on hold" Containing another struct from same package,:material-check-bold:,:material-check-bold:,:material-check-bold: diff --git a/mkdocs-website/shared/alpha4-wails3-package.csv b/mkdocs-website/shared/alpha4-wails3-package.csv index 4f1a2a87512..26cdb1c506a 100644 --- a/mkdocs-website/shared/alpha4-wails3-package.csv +++ b/mkdocs-website/shared/alpha4-wails3-package.csv @@ -1,5 +1,4 @@ " ",Mac,Windows,Linux -Standard Executable," "," "," " -macOS Application Bundle," ",:material-cancel:,:material-cancel: -NSIS," "," "," " -macOS DMG," ",:material-cancel:,:material-cancel: +Standard Executable,:material-check-bold:,:material-check-bold:,:material-check-bold: +macOS Application Bundle,:material-check-bold:,:material-cancel:,:material-cancel: +NSIS,:material-cancel:,:material-check-bold:,:material-cancel: diff --git a/v3/cmd/wails3/main.go b/v3/cmd/wails3/main.go index 34920ae11fc..47e45f12562 100644 --- a/v3/cmd/wails3/main.go +++ b/v3/cmd/wails3/main.go @@ -46,6 +46,7 @@ func main() { generate.NewSubCommandFunction("constants", "Generate JS constants from Go", commands.GenerateConstants) generate.NewSubCommandFunction(".desktop", "Generate .desktop file", commands.GenerateDotDesktop) generate.NewSubCommandFunction("appimage", "Generate Linux AppImage", commands.GenerateAppImage) + generate.NewSubCommandFunction("runtime", "Generate the latest compiled runtime", commands.GenerateRuntime) plugin := app.NewSubCommand("plugin", "Plugin tools") //plugin.NewSubCommandFunction("list", "List plugins", commands.PluginList) diff --git a/v3/internal/commands/build_assets/runtime/compiled.go b/v3/internal/commands/build_assets/runtime/compiled.go index 5a7c2466997..f7dea63c625 100644 --- a/v3/internal/commands/build_assets/runtime/compiled.go +++ b/v3/internal/commands/build_assets/runtime/compiled.go @@ -3,7 +3,7 @@ package runtime import _ "embed" //go:embed runtime.js -var runtimeJS []byte +var RuntimeJS []byte //go:embed runtime.debug.js -var runtimeDebugJS []byte +var RuntimeDebugJS []byte diff --git a/v3/internal/commands/runtime.go b/v3/internal/commands/runtime.go new file mode 100644 index 00000000000..d62bf5ed429 --- /dev/null +++ b/v3/internal/commands/runtime.go @@ -0,0 +1,21 @@ +package commands + +import ( + "github.com/wailsapp/wails/v3/internal/commands/build_assets/runtime" + "os" +) + +type GenerateRuntimeOptions struct { +} + +func GenerateRuntime(options *GenerateRuntimeOptions) error { + err := os.WriteFile("runtime.js", runtime.RuntimeJS, 0644) + if err != nil { + return err + } + err = os.WriteFile("runtime.debug.js", runtime.RuntimeDebugJS, 0644) + if err != nil { + return err + } + return nil +}