Compare commits

...

135 Commits

Author SHA1 Message Date
Lea Anthony def40786c8 Refactored events 2023-10-05 21:44:13 +11:00
Lea Anthony d8e27aa5f9 Fix svelte template 2023-10-05 21:12:01 +11:00
Lea Anthony ce6d587771 Fix multiple window weirdness. Update deps 2023-10-05 20:54:12 +11:00
Lea Anthony 81d7bc2d68 Fix vue templates 2023-10-05 20:13:50 +11:00
Lea Anthony a49350f300 [windows] Remove unused code. 2023-10-05 20:12:28 +11:00
Lea Anthony 9ac6359e56 Merge remote-tracking branch 'origin/v3-alpha' into v3-alpha 2023-10-05 19:19:26 +11:00
Lea Anthony 5958d9c646 [windows] Serve assets async 2023-10-05 19:18:32 +11:00
Lea Anthony 9b88c8afda Merge branch 'master' into v3-alpha
# Conflicts:
#	v2/internal/app/app_devtools.go
#	v2/internal/app/app_devtools_not.go
2023-10-04 20:23:23 +11:00
Lea Anthony 1b71fef89f Update v3 website frontpage 2023-10-04 20:22:20 +11:00
Lea Anthony 8ddd29d285 [linux] Implement events 2023-10-03 08:37:11 +11:00
Lea Anthony dc8cbcf410 [darwin] Refactor events into mac specific files 2023-10-03 08:33:58 +11:00
Travis McLane 757a4383e6 [v3] send dialog results over channels 2023-10-02 11:07:12 -05:00
Travis McLane 7c98ee329a [v3] move linux clipboard logic to linux_cgo 2023-10-02 11:07:12 -05:00
Lea Anthony 9d615463f4 [linux] support clipboard 2023-10-02 20:47:04 +11:00
Lea Anthony 1c9765096d Add webview2 error message to troubleshooting 2023-10-01 23:45:30 +11:00
Lea Anthony aea0db5919 [linux] Fix packagemap 2023-09-30 21:17:30 +10:00
Lea Anthony fc593d90cf Export Package map 2023-09-30 21:09:35 +10:00
Lea Anthony 2524f7b5a0 Remove old KitchenSink example 2023-09-30 21:09:10 +10:00
Lea Anthony 5a0cb1baef Fix svelte-ts template 2023-09-30 21:04:00 +10:00
ALMAS 18ee469c47 [v2/Mac] Change Window Level (#2944)
* Change Window Level in Mac
2023-09-30 20:59:50 +10:00
Lea Anthony 255690eee0 [darwin] Add webview preferences 2023-09-30 15:23:56 +10:00
Lea Anthony 86b6e10620 [darwin]AlwaysOnTop: NSStatusWindowLevel -> NSFloatingWindowLevel 2023-09-30 14:27:48 +10:00
Travis McLane b757292211 [v3 darwin] use NativeWindowHandle 2023-09-29 12:13:51 -05:00
Travis McLane af54419a0b [v3] use concrete *WebviewWindow 2023-09-29 11:40:43 -05:00
Travis McLane 7b84b1c79c [v3] Window fallout 2023-09-28 17:17:11 -05:00
Travis McLane d047c22526 [v3] change window back to *WebviewWindow 2023-09-28 17:10:17 -05:00
Travis McLane 6feab70a72 [v3 workflow] add libayatana dependency 2023-09-28 17:00:33 -05:00
Travis McLane 5e1b5ca4e8 [v3] typo - missing comma 2023-09-28 16:55:52 -05:00
Travis McLane 1726cdb0ad [v3] add ubuntu-latest to workflow 2023-09-28 16:48:23 -05:00
Travis McLane 2b2828ea41 [v3] goformat fixes 2023-09-28 16:47:04 -05:00
Travis McLane 29859ceedf [v3] correct return types for CurrentWindow
this shouldn't have been changed to Window
2023-09-28 16:46:19 -05:00
Travis McLane 8e2527ad35 [v3 linux] implement single_instance plugin 2023-09-28 15:53:28 -05:00
Travis McLane 92b26488da Merge branch 'v3-alpha-linux-systray' into v3-alpha 2023-09-28 14:52:12 -05:00
Travis McLane efa67cb01c [v3 linux] systray implementation
Linux requires a `gtk_menu_bar` for a gtk_window to display a menu.
For the `systray` a `gtk_menu` is needed instead.
This change creates the correct type of `impl` for the `Menu`
depending on how it is being used.
2023-09-28 14:50:38 -05:00
Travis McLane 71fc222059 [v3 linux] systray: cleanup + add basic menu 2023-09-28 13:31:09 -05:00
Travis McLane fa6adad4ab [v3 linux] wip: systray implementation 2023-09-28 13:31:09 -05:00
Travis McLane 1c48d567e1 [v3] NewWebviewWindow* return *WebviewWindow 2023-09-28 13:30:47 -05:00
Travis McLane 2c3216ba36 Merge branch 'v3-alpha-plugin-server' into v3-alpha 2023-09-28 12:15:11 -05:00
Travis McLane 74e2a7e225 [v3 examples] add server plugin to 'plugins' example 2023-09-28 12:14:54 -05:00
Travis McLane ff2c92451d [v3] go.* update 2023-09-28 12:14:54 -05:00
Travis McLane 2a83402d4a [v3 example/server] initial implementation 2023-09-28 12:14:54 -05:00
Travis McLane 2449b473c0 [v3 plugin/server] initial implementation 2023-09-28 12:14:54 -05:00
Travis McLane 60c44c44ff [v3 runtime] updated javascript 2023-09-28 12:14:54 -05:00
Travis McLane 7e1d685167 [v3 js] add and send x-wails-client-id
The constant x-wails-client-id is generated once on startup and then
sent with each request to the Wails host.  It is used primarily by
the server plugin to distinguish different remote sessions.
2023-09-28 12:14:54 -05:00
Travis McLane a9d4a393ba [v3 linux] add non-functional activeInstance implementation 2023-09-28 12:10:17 -05:00
Travis McLane a0953fea93 [v3] Merge feature Window interface 2023-09-28 11:52:23 -05:00
Travis McLane 02d76835c9 [v3 linux] noop: remove spurious print 2023-09-28 11:48:46 -05:00
Travis McLane dfe03f1347 [v3] WailsEvent expose ToJSON 2023-09-28 11:39:44 -05:00
Travis McLane c87489adf3 [v3] implement Window interface 2023-09-28 11:39:39 -05:00
Travis McLane a428a730d5 [v3] define Window interface
Define an interface that all Window(s) need to define.
Currently copies the WebviewWindow public api
2023-09-28 11:37:48 -05:00
Travis McLane 7f7c642339 [v3 linux] systray.openMenu 2023-09-28 10:02:44 -05:00
Travis McLane 03b79e9a67 [v3 linux] noop: handleKeyEvent skeleton 2023-09-27 16:31:59 -05:00
Travis McLane 56b0fcebba [v3 linux] use ifdef for APPLICATION_DEFAULT_FLAGS 2023-09-27 09:53:53 -05:00
stffabi e31ad83472 [docs] Merge changed section (#2940) 2023-09-26 19:12:57 +10:00
Mohamed Gharib 3f9067c815 [v2] Devtools tag doesn't enable default context-menu (#2923)
* Devtools tag doesn't enable default context-menu

* Update changelog
2023-09-26 07:43:18 +10:00
Lea Anthony d9a5130311 Use prettier on docs source 2023-09-25 20:56:29 +10:00
Lea Anthony 4663a45e59 Add raw API docs 2023-09-25 20:50:53 +10:00
David Haukeness ab0b0f8a7f filter the base directory from ignoreDirs (#2869)
* filter the base directory from ignoreDirs

* added PR 2869

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-09-25 19:50:17 +10:00
github-actions[bot] 6d1489bf8e chore: update sponsors.svg (#2938)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2023-09-25 19:25:51 +10:00
Fadi Khadra 05eddc65b1 [v2 mac] Allow to specify webview preferences (#2937)
* [mac] allow to specify webview preferences
2023-09-25 08:15:55 +10:00
Lea Anthony fb820bcdad Add some more API docs. Small refactors. 2023-09-24 17:23:24 +10:00
Lea Anthony 31c167b412 Add some more API docs. 2023-09-24 17:03:42 +10:00
Lea Anthony 7cdab16ba9 Add API docs. Do small refactors 2023-09-24 08:57:40 +10:00
FarDawn 787ca80770 Add minimal React template (#2935) 2023-09-23 19:06:31 +10:00
github-actions[bot] d228b2ad37 chore: update sponsors.svg (#2930)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2023-09-21 19:36:33 +10:00
Lea Anthony 05262134ca [darwin] Add systray.OpenMenu 2023-09-21 19:24:30 +10:00
Lea Anthony fe48b9d03d [windows] Add systray.OpenMenu 2023-09-21 19:14:44 +10:00
stffabi e9519269ca [v2] Bump go-webview2 to 1.0.7 (#2929) 2023-09-21 06:43:28 +10:00
Lea Anthony 013ec1d726 Fix compiler error. Add test. 2023-09-21 06:33:08 +10:00
Travis McLane 27b4a984d5 [v3] process pointer and non-pointer receiver functions 2023-09-20 15:09:15 -05:00
Travis McLane d6b6111395 noop: import sort 2023-09-20 15:09:15 -05:00
Mohamed Gharib 5a7b868e80 [Github] Exclude /website from language stats (#2927) 2023-09-21 05:48:19 +10:00
stffabi d370f72ede [v2, windows] Support async request processing on AssetServer (#2926) 2023-09-20 19:28:18 +02:00
Lea Anthony af8ee6703e [darwin] Support keybindings 2023-09-20 21:34:50 +10:00
Lea Anthony 3369327ad2 [v2] Support Enabling/Disabling swipe gestures (#2878)
* [v2] Support Enabling/Disabling swipe gestures

* [v2] Update change log

* [v2] Remove old call to PutIsSwipeNavigationEnabled

* Use latest webview2

* Update go-webview2 mod version
2023-09-20 08:23:38 +10:00
Denis Dvornikov eca6afc18c Describe a guide to build an app for all platforms in github actions (#2879)
* Describe a guide to build an app for all platforms in github actions

* Update changelog, remove tabs from an added guide

---------

Co-authored-by: Denis <denis@Deniss-Mac-mini.fritz.box>
2023-09-20 08:12:57 +10:00
Mohamed Gharib 34c725231c [v2] Refactor devtools (better naming to remove confusion) (#2921) 2023-09-19 20:56:49 +10:00
github-actions[bot] db519de1cd chore: update sponsors.svg (#2922)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2023-09-19 18:50:35 +10:00
Lea Anthony 6aa6762f12 Devtools hotkey (#2915)
* Add Ctrl/Cmd+Shift+F12 Hotkey to open devtools when `-devtools` flag used.
2023-09-19 05:56:14 +10:00
Lea Anthony 64e44b1b51 [docs] Add wrong webview2 architecture section in troubleshooting guide 2023-09-18 20:15:54 +10:00
Lea Anthony 793191a479 Initial key binding support 2023-09-17 20:48:30 +10:00
Lea Anthony efc86c1056 Delete wails binary 2023-09-16 15:00:20 +10:00
Lea Anthony 39d44d2644 Merge latest website changes 2023-09-16 14:58:24 +10:00
Lea Anthony 9584a2ce5a Merge latest v2 changes 2023-09-16 14:56:23 +10:00
Lea Anthony 95b8ceb87a Merge remote-tracking branch 'origin/master' into v3-alpha 2023-09-16 14:44:57 +10:00
ALMAS 37b99b9cb8 Update webview_window.go (#2912) 2023-09-16 07:20:49 +10:00
Lea Anthony 3116c1a622 Update favicon.ico 2023-09-15 20:47:14 +10:00
Lea Anthony 86354e9fc0 Support IsDarkMode in application event context. Fix bug with event mapping. 2023-09-15 20:10:09 +10:00
Lea Anthony b49f135e31 Add context to application/common events 2023-09-15 17:12:35 +10:00
github-actions[bot] c26f3ad7d1 chore: update sponsors.svg (#2909)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2023-09-15 16:35:00 +10:00
github-actions[bot] 40f645a864 chore: update sponsors.svg (#2903)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2023-09-14 08:33:15 +10:00
Travis McLane fff266f50d [v3 linux] remove unused dialog callbacks
If it turns out these are needed in the future
we can add them back in then.
2023-09-13 13:12:22 -05:00
Travis McLane 7cfea7c22c [v3 linux] file/directory dialogs 2023-09-13 13:12:22 -05:00
Travis McLane 6141e5a8ce [linux v3] purego: updates
- file/directory chooser dialog logic
- add name + css so that menu isn't transparent
2023-09-13 13:12:22 -05:00
Lea Anthony ed58949d24 try logging in goroutine 2023-09-13 16:47:14 +10:00
Lea Anthony c1d85bd3d9 Add generate constants tool 2023-09-13 16:45:19 +10:00
Lea Anthony 8d3324465e Revert flags change 2023-09-13 16:11:23 +10:00
Lea Anthony 8c72746edb Update log plugin to have log levels. 2023-09-13 09:45:26 +10:00
Lea Anthony ea3509d2e7 Add LogLevel application option. Update log plugin to have log levels. 2023-09-13 09:44:37 +10:00
Lea Anthony bb3a0cc54f Add WebviewWindow.IsFocused() 2023-09-13 08:57:20 +10:00
Travis McLane d808654d99 [v3 linux] update purego replace 2023-09-11 17:27:21 -05:00
Travis McLane a6cfdbb403 [v3 linux] const -> var 2023-09-11 17:26:59 -05:00
Travis McLane 2f7c6834d0 [v3 linux] use invokeSync 2023-09-11 17:12:57 -05:00
Travis McLane ebdd57a7c4 remove cmd/wails/wails binary 2023-09-11 17:12:57 -05:00
Lea Anthony 4ff6d74054 Remove plain template 2023-09-09 20:08:26 +10:00
Lea Anthony 0d8b4aafd5 Better vanilla taskfile. Better asset generation at init. 2023-09-09 17:31:48 +10:00
Lea Anthony 0cca7e9189 Fix syso tests. Add precommit task 2023-09-09 16:27:51 +10:00
Lea Anthony a5812578c5 Add generate build-assets. Update Taskfile for vanilla template 2023-09-09 10:25:56 +10:00
github-actions[bot] a419721dcd docs: sync translations (#2699)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2023-09-08 23:25:21 +10:00
Light e731e2591a Fix typo on https://wails.io/docs/reference/options#application-options (#2887)
* Update options.mdx

* Update changelog.mdx
2023-09-08 23:23:33 +10:00
Lea Anthony 350b411afe Update what's new section 2023-09-08 20:18:50 +10:00
Lea Anthony 9ca86c6093 Fix template versions 2023-09-08 18:51:39 +10:00
Lea Anthony 01729ae22a Add what's new section 2023-09-08 18:45:42 +10:00
Lea Anthony 9196dc2216 Remove ci flag 2023-09-08 14:49:50 +10:00
Lea Anthony b925335bbb Fix tests 2023-09-08 14:37:07 +10:00
Duoc Nguyen 59b25edb5c docs: make the install command easier to copy (#2891) 2023-09-08 13:56:40 +10:00
Lea Anthony 965f939967 Fix parser/generator tests 2023-09-08 12:03:55 +10:00
Lea Anthony 00feccbb77 Add MACOSX_DEPLOYMENT_TARGET to taskfiles 2023-09-08 11:23:38 +10:00
Lea Anthony b6fc66ba0d Improve workflow 2023-09-08 11:09:32 +10:00
Lea Anthony c40debc0e9 Disable linux tests 2023-09-08 11:04:59 +10:00
Lea Anthony 3b31d70865 Update doc dependencies 2023-09-08 11:00:15 +10:00
Lea Anthony afa8b62de7 Update doc dependencies 2023-09-08 10:57:47 +10:00
Lea Anthony 70fd15de2d fix workflow 2023-09-08 10:42:13 +10:00
Lea Anthony c54d330f89 fix workflow 2023-09-08 10:39:29 +10:00
Lea Anthony 4028560d12 fix workflow 2023-09-08 10:37:45 +10:00
Lea Anthony 3c28c28623 fix workflow 2023-09-08 10:36:48 +10:00
Lea Anthony a958fa06e7 Update docs 2023-09-08 10:31:16 +10:00
Lea Anthony 4d39e9e15a Update v3-docs.yml 2023-09-08 10:27:32 +10:00
Zámbó, Levente 647bc87600 [v2, Linux] fix menu background color (#2873)
* fix menu background color

* remove commented line

* handle transparent window and background color

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-09-07 21:25:02 +10:00
dependabot[bot] ebf56f6585 Bump semver from 5.7.1 to 5.7.2 in /website (#2808)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-07 21:22:43 +10:00
Lea Anthony 1644ee152e v2.6.0 2023-09-06 19:45:08 +10:00
David Haukeness 069fe18b9d Move watcher init to doWatcherLoop and implement -reloaddirs (#2871)
* remove random print statement

* move watcher into loop and implement reloaddirs

* Fixed -reloaddirs for issue #2829

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-09-06 19:33:22 +10:00
Lea Anthony acf8dea170 [chore] Big tidy up. Fix bullet point output. 2023-09-06 19:27:29 +10:00
github-actions[bot] 7a87b0476e chore: update sponsors.svg (#2885)
Co-authored-by: leaanthony <leaanthony@users.noreply.github.com>
2023-09-06 19:16:31 +10:00
Andreas Christou 886bcc7b47 Add print functionality to v2 (#2822)
* Add print functionality to v2

* Update changelog

* Update runtime docs

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-09-06 07:55:36 +10:00
873 changed files with 53188 additions and 4449 deletions
+6 -5
View File
@@ -3,6 +3,8 @@ name: Build + Test v3 alpha
on:
push:
branches: [v3-alpha]
paths-ignore:
- 'mkdocs-website/**/*'
workflow_dispatch:
jobs:
@@ -12,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [windows-latest, macos-latest, ubuntu-latest]
go-version: [1.21]
steps:
@@ -21,7 +23,7 @@ jobs:
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev build-essential pkg-config
- name: Setup Go
uses: actions/setup-go@v3
@@ -87,7 +89,6 @@ jobs:
lit-ts,
vanilla,
vanilla-ts,
plain,
]
go-version: [1.21]
steps:
@@ -107,13 +108,13 @@ jobs:
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev build-essential pkg-config
- name: Generate template '${{ matrix.template }}'
run: |
go install github.com/go-task/task/v3/cmd/task@latest
mkdir -p ./test-${{ matrix.template }}
cd ./test-${{ matrix.template }}
wails3 init -n ${{ matrix.template }} -t ${{ matrix.template }} -ci
wails3 init -n ${{ matrix.template }} -t ${{ matrix.template }}
cd ${{ matrix.template }}
wails3 build
+11 -1
View File
@@ -3,11 +3,17 @@ on:
push:
branches:
- v3-alpha
paths:
- 'mkdocs-website/**/*'
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
defaults:
run:
working-directory: ./mkdocs-website
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
@@ -20,6 +26,10 @@ jobs:
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.insiders.txt
- run: sudo apt-get install pngquant
- run: pip install pillow cairosvg
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
- run: mkdocs build --config-file mkdocs.insiders.yml
- run: mkdocs gh-deploy --force
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
+15 -11
View File
@@ -2,6 +2,9 @@
This is the documentation for Wails v3. It is currently a work in progress.
If you do not wish to build it locally, it is available online at
[https://wailsapp.github.io/wails/](https://wailsapp.github.io/wails/).
## Recommended Setup Steps
Install the wails3 CLI if you haven't already:
@@ -10,16 +13,18 @@ Install the wails3 CLI if you haven't already:
go install github.com/wailsapp/wails/v3/cmd/wails3@latest
```
The documentation uses mkdocs, so you will need to install [Python](https://www.python.org/). Once installed,
you can setup the documentation by running the following command:
The documentation uses mkdocs, so you will need to install
[Python](https://www.python.org/). Once installed, you can setup the
documentation by running the following command:
```bash
wails3 task docs:setup
```
This will install the required dependencies for you.
This will install the required dependencies for you.
If you have installed the wails3 CLI, you can run the following command to build the documentation and serve it locally:
If you have installed the wails3 CLI, you can run the following command to build
the documentation and serve it locally:
```bash
wails3 task docs:serve
@@ -29,13 +34,12 @@ wails3 task docs:serve
To install manually, you will need to do the following:
- Install [Python](https://www.python.org/)
- Run `pip install -r requirements.txt` to install the required dependencies
- Run `mkdocs serve` to serve the documentation locally
- Run `mkdocs build` to build the documentation
- Install [Python](https://www.python.org/)
- Run `pip install -r requirements.txt` to install the required dependencies
- Run `mkdocs serve` to serve the documentation locally
- Run `mkdocs build` to build the documentation
## Contributing
If you would like to contribute to the documentation, please feel free to open a PR!
If you would like to contribute to the documentation, please feel free to open a
PR!
+6
View File
@@ -51,3 +51,9 @@ tasks:
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
cmds:
- mkdocs serve --config-file mkdocs.insiders.yml
update:api:
summary: Updates the API documentation
dir: generate
cmds:
- go run .
+359
View File
@@ -0,0 +1,359 @@
# Application
The application API assists in creating an application using the Wails
framework.
### New
API: `New(appOptions Options) *App`
`New(appOptions Options)` creates a new application using the given application
options . It applies default values for unspecified options, merges them with
the provided ones, initializes and returns an instance of the application.
In case of an error during initialization, the application is stopped with the
error message provided.
It should be noted that if a global application instance already exists, that
instance will be returned instead of creating a new one.
```go title="main.go" hl_lines="6-9"
package main
import "github.com/wailsapp/wails/v3/pkg/application"
func main() {
app := application.New(application.Options{
Name: "WebviewWindow Demo",
// Other options
})
// Rest of application
}
```
### Get
`Get()` returns the global application instance. It's useful when you need to
access the application from different parts of your code.
```go
// Get the application instance
app := application.Get()
```
### Capabilities
API: `Capabilities() capabilities.Capabilities`
`Capabilities()` retrieves a map of capabilities that the application currently
has. Capabilities can be about different features the operating system provides,
like webview features.
```go
// Get the application capabilities
capabilities := app.Capabilities()
if capabilities.HasNativeDrag {
// Do something
}
```
### GetPID
API: `GetPID() int`
`GetPID()` returns the Process ID of the application.
```go
pid := app.GetPID()
```
### Run
API: `Run() error`
`Run()` starts the execution of the application and its components.
```go
app := application.New(application.Options{
//options
})
// Run the application
err := application.Run()
if err != nil {
// Handle error
}
```
### Quit
API: `Quit()`
`Quit()` quits the application by destroying windows and potentially other
components.
```go
// Quit the application
app.Quit()
```
### IsDarkMode
API: `IsDarkMode() bool`
`IsDarkMode()` checks if the application is running in dark mode. It returns a
boolean indicating whether dark mode is enabled.
```go
// Check if dark mode is enabled
if app.IsDarkMode() {
// Do something
}
```
### Hide
API: `Hide()`
`Hide()` hides the application window.
```go
// Hide the application window
app.Hide()
```
### Show
API: `Show()`
`Show()` shows the application window.
```go
// Show the application window
app.Show()
```
### NewWebviewWindow
API: `NewWebviewWindow() *WebviewWindow`
`NewWebviewWindow()` creates a new Webview window with default options, and
returns it.
```go
// Create a new webview window
window := app.NewWebviewWindow()
```
### NewWebviewWindowWithOptions
API:
`NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow`
`NewWebviewWindowWithOptions()` creates a new webview window with custom
options. The newly created window is added to a map of windows managed by the
application.
```go
// Create a new webview window with custom options
window := app.NewWebviewWindowWithOptions(WebviewWindowOptions{
Name: "Main",
Title: "My Window",
Width: 800,
Height: 600,
})
```
### OnWindowCreation
API: `OnWindowCreation(callback func(window *WebviewWindow))`
`OnWindowCreation()` registers a callback function to be called when a window is
created.
```go
// Register a callback to be called when a window is created
app.OnWindowCreation(func(window *WebviewWindow) {
// Do something
})
```
### GetWindowByName
API: `GetWindowByName(name string) *WebviewWindow`
`GetWindowByName()` fetches and returns a window with a specific name.
```go
// Get a window by name
window := app.GetWindowByName("Main")
```
### CurrentWindow
API: `CurrentWindow() *WebviewWindow`
`CurrentWindow()` fetches and returns a pointer to the currently active window
in the application. If there is no window, it returns nil.
```go
// Get the current window
window := app.CurrentWindow()
```
### RegisterContextMenu
API: `RegisterContextMenu(name string, menu *Menu)`
`RegisterContextMenu()` registers a context menu with a given name. This menu
can be used later in the application.
```go
// Create a new menu
ctxmenu := app.NewMenu()
// Register the menu as a context menu
app.RegisterContextMenu("MyContextMenu", ctxmenu)
```
### SetMenu
API: `SetMenu(menu *Menu)`
`SetMenu()` sets the menu for the application. On Mac, this will be the global
menu. For Windows and Linux, this will be the default menu for any new window
created.
```go
// Create a new menu
menu := app.NewMenu()
// Set the menu for the application
app.SetMenu(menu)
```
### ShowAboutDialog
API: `ShowAboutDialog()`
`ShowAboutDialog()` shows an "About" dialog box. It can show the application's
name, description and icon.
```go
// Show the about dialog
app.ShowAboutDialog()
```
### Info
API: `InfoDialog()`
`InfoDialog()` creates and returns a new instance of `MessageDialog` with an
`InfoDialogType`. This dialog is typically used to display informational
messages to the user.
### Question
API: `QuestionDialog()`
`QuestionDialog()` creates and returns a new instance of `MessageDialog` with a
`QuestionDialogType`. This dialog is often used to ask a question to the user
and expect a response.
### Warning
API: `WarningDialog()`
`WarningDialog()` creates and returns a new instance of `MessageDialog` with a
`WarningDialogType`. As the name suggests, this dialog is primarily used to
display warning messages to the user.
### Error
API: `ErrorDialog()`
`ErrorDialog()` creates and returns a new instance of `MessageDialog` with an
`ErrorDialogType`. This dialog is designed to be used when you need to display
an error message to the user.
### OpenFile
API: `OpenFileDialog()`
`OpenFileDialog()` creates and returns a new `OpenFileDialogStruct`. This dialog
prompts the user to select one or more files from their file system.
### SaveFile
API: `SaveFileDialog()`
`SaveFileDialog()` creates and returns a new `SaveFileDialogStruct`. This dialog
prompts the user to choose a location on their file system where a file should
be saved.
### OpenDirectory
API: `OpenDirectoryDialog()`
`OpenDirectoryDialog()` creates and returns a new instance of `MessageDialog`
with an `OpenDirectoryDialogType`. This dialog enables the user to choose a
directory from their file system.
### On
API:
`On(eventType events.ApplicationEventType, callback func(event *Event)) func()`
`On()` registers an event listener for specific application events. The callback
function provided will be triggered when the corresponding event occurs. The
function returns a function that can be called to remove the listener.
### RegisterHook
API:
`RegisterHook(eventType events.ApplicationEventType, callback func(event *Event)) func()`
`RegisterHook()` registers a callback to be run as a hook during specific
events. These hooks are run before listeners attached with `On()`. The function
returns a function that can be called to remove the hook.
### GetPrimaryScreen
API: `GetPrimaryScreen() (*Screen, error)`
`GetPrimaryScreen()` returns the primary screen of the system.
### GetScreens
API: `GetScreens() ([]*Screen, error)`
`GetScreens()` returns information about all screens attached to the system.
This is a brief summary of the exported methods in the provided `App` struct. Do
note that for more detailed functionality or considerations, refer to the actual
Go code or further internal documentation.
## Options
```go title="application_options.go"
--8<--
../v3/pkg/application/options_application.go
--8<--
```
### Windows Options
```go title="application_options_windows.go"
--8<--
../v3/pkg/application/options_application_win.go
--8<--
```
### Mac Options
```go title="options_application_mac.go"
--8<--
../v3/pkg/application/options_application_mac.go
--8<--
```
File diff suppressed because it is too large Load Diff
+50
View File
@@ -0,0 +1,50 @@
# Main Thread Functions
These methods are utility functions to run code on the main thread. This is
required when you want to run custom code on the UI thread.
### InvokeSync
API: `InvokeSync(fn func())`
This function runs the passed function (`fn`) synchronously. It uses a WaitGroup
(`wg`) to ensure that the main thread waits for the `fn` function to finish
before it continues. If a panic occurs inside `fn`, it will be passed to the
handler function `PanicHandler`, defined in the application options.
### InvokeSyncWithResult
API: `InvokeSyncWithResult[T any](fn func() T) (res T)`
This function works similarly to `InvokeSync(fn func())`, however, it yields a
result. Use this for calling any function with a single return.
### InvokeSyncWithError
API: `InvokeSyncWithError(fn func() error) (err error)`
This function runs `fn` synchronously and returns any error that `fn` produces.
Note that this function will recover from a panic if one occurs during `fn`'s
execution.
### InvokeSyncWithResultAndError
API:
`InvokeSyncWithResultAndError[T any](fn func() (T, error)) (res T, err error)`
This function runs `fn` synchronously and returns both a result of type `T` and
an error.
### InvokeAsync
API: `InvokeAsync(fn func())`
This function runs `fn` asynchronously. It runs the given function on the main
thread. If a panic occurs inside `fn`, it will be passed to the handler function
`PanicHandler`, defined in the application options.
---
_Note_: These functions will block execution until `fn` has finished. It's
critical to ensure that `fn` doesn't block. If you need to run a function that
blocks, use `InvokeAsync` instead.
+69
View File
@@ -0,0 +1,69 @@
# Menu
Menus can be created and added to the application. They can be used to create
context menus, system tray menus and application menus.
To create a new menu, call:
```go
// Create a new menu
menu := app.NewMenu()
```
The following operations are then available on the `Menu` type:
### Add
API: `Add(label string) *MenuItem`
This method takes a `label` of type `string` as an input and adds a new
`MenuItem` with the given label to the menu. It returns the `MenuItem` added.
### AddSeparator
API: `AddSeparator()`
This method adds a new separator `MenuItem` to the menu.
### AddCheckbox
API: `AddCheckbox(label string, enabled bool) *MenuItem`
This method takes a `label` of type `string` and `enabled` of type `bool` as
inputs and adds a new checkbox `MenuItem` with the given label and enabled state
to the menu. It returns the `MenuItem` added.
### AddRadio
API: `AddRadio(label string, enabled bool) *MenuItem`
This method takes a `label` of type `string` and `enabled` of type `bool` as
inputs and adds a new radio `MenuItem` with the given label and enabled state to
the menu. It returns the `MenuItem` added.
### Update
API: `Update()`
This method processes any radio groups and updates the menu if a menu
implementation is not initialized.
### AddSubmenu
API: `AddSubmenu(s string) *Menu`
This method takes a `s` of type `string` as input and adds a new submenu
`MenuItem` with the given label to the menu. It returns the submenu added.
### AddRole
API: `AddRole(role Role) *Menu`
This method takes `role` of type `Role` as input, adds it to the menu if it is
not `nil` and returns the `Menu`.
### SetLabel
API: `SetLabel(label string)`
This method sets the `label` of the `Menu`.
+112
View File
@@ -0,0 +1,112 @@
# System Tray
The system tray houses notification area on a desktop environment, which can
contain both icons of currently-running applications and specific system
notifications.
You create a system tray by calling `app.NewSystemTray()`:
```go
// Create a new system tray
tray := app.NewSystemTray()
```
The following methods are available on the `SystemTray` type:
### SetLabel
API: `SetLabel(label string)`
The `SetLabel` method sets the tray's label.
### Label
API: `Label() string`
The `Label` method retrieves the tray's label.
### PositionWindow
API: `PositionWindow(*WebviewWindow, offset int) error`
The `PositionWindow` method calls both `AttachWindow` and `WindowOffset`
methods.
### SetIcon
API: `SetIcon(icon []byte) *SystemTray`
The `SetIcon` method sets the system tray's icon.
### SetDarkModeIcon
API: `SetDarkModeIcon(icon []byte) *SystemTray`
The `SetDarkModeIcon` method sets the system tray's icon when in dark mode.
### SetMenu
API: `SetMenu(menu *Menu) *SystemTray`
The `SetMenu` method sets the system tray's menu.
### Destroy
API: `Destroy()`
The `Destroy` method destroys the system tray instance.
### OnClick
API: `OnClick(handler func()) *SystemTray`
The `OnClick` method sets the function to execute when the tray icon is clicked.
### OnRightClick
API: `OnRightClick(handler func()) *SystemTray`
The `OnRightClick` method sets the function to execute when right-clicking the
tray icon.
### OnDoubleClick
API: `OnDoubleClick(handler func()) *SystemTray`
The `OnDoubleClick` method sets the function to execute when double-clicking the
tray icon.
### OnRightDoubleClick
API: `OnRightDoubleClick(handler func()) *SystemTray`
The `OnRightDoubleClick` method sets the function to execute when right
double-clicking the tray icon.
### AttachWindow
API: `AttachWindow(window *WebviewWindow) *SystemTray`
The `AttachWindow` method attaches a window to the system tray. The window will
be shown when the system tray icon is clicked.
### WindowOffset
API: `WindowOffset(offset int) *SystemTray`
The `WindowOffset` method sets the gap in pixels between the system tray and the
window.
### WindowDebounce
API: `WindowDebounce(debounce time.Duration) *SystemTray`
The `WindowDebounce` method sets a debounce time. In the context of Windows,
this is used to specify how long to wait before responding to a mouse up event
on the notification icon.
### OpenMenu
API: `OpenMenu()`
The `OpenMenu` method opens the menu associated with the system tray.
+114
View File
@@ -0,0 +1,114 @@
# Window
To create a window, use
[Application.NewWebviewWindow](application.md#newwebviewwindow) or
[Application.NewWebviewWindowWithOptions](application.md#newwebviewwindowwithoptions).
The former creates a window with default options, while the latter allows you to
specify custom options.
These methods are callable on the returned WebviewWindow object:
### SetTitle
API: `SetTitle(title string) *WebviewWindow`
This method updates the window title to the provided string. It returns the
WebviewWindow object, allowing for method chaining.
### Name
API: `Name() string`
This function returns the name of the WebviewWindow.
### SetSize
API: `SetSize(width, height int) *WebviewWindow`
This method sets the size of the WebviewWindow to the provided width and height
parameters. If the dimensions provided exceed the constraints, they are adjusted
appropriately.
### SetAlwaysOnTop
API: `SetAlwaysOnTop(b bool) *WebviewWindow`
This function sets the window to stay on top based on the boolean flag provided.
### Show
API: `Show() *WebviewWindow`
`Show` method is used to make the window visible. If the window is not running,
it first invokes the `run` method to start the window and then makes it visible.
### Hide
API: `Hide() *WebviewWindow`
`Hide` method is used to hide the window. It sets the hidden status of the
window to true and emits the window hide event.
### SetURL
API: `SetURL(s string) *WebviewWindow`
`SetURL` method is used to set the URL of the window to the given URL string.
### SetZoom
API: `SetZoom(magnification float64) *WebviewWindow`
`SetZoom` method sets the zoom level of the window content to the provided
magnification level.
### GetZoom
API: `GetZoom() float64`
`GetZoom` function returns the current zoom level of the window content.
### GetScreen
API: `GetScreen() (*Screen, error)`
`GetScreen` method returns the screen on which the window is displayed.
#### SetFrameless
API: `SetFrameless(frameless bool) *WebviewWindow`
This function is used to remove the window frame and title bar. It toggles the
framelessness of the window according to the boolean value provided (true for
frameless, false for framed).
#### RegisterContextMenu
API: `RegisterContextMenu(name string, menu *Menu)`
This function is used to register a context menu and assigns it the given name.
#### NativeWindowHandle
API: `NativeWindowHandle() (uintptr, error)`
This function is used to fetch the platform native window handle for the window.
#### Focus
API: `Focus()`
This function is used to focus the window.
#### SetEnabled
API: `SetEnabled(enabled bool)`
This function is used to enable/disable the window based on the provided boolean
value.
#### SetAbsolutePosition
API: `SetAbsolutePosition(x int, y int)`
This function sets the absolute position of the window in the screen.
+8 -5
View File
@@ -17,14 +17,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
* [darwin] add getPrimaryScreen/getScreens to impl by @tmclane in https://github.com/wailsapp/wails/pull/2618
- [darwin] add getPrimaryScreen/getScreens to impl by @tmclane in
https://github.com/wailsapp/wails/pull/2618
### Fixed
- Fixed background colours of examples on Windows by [mmgvh](https://github.com/mmghv) in [#2750](https://github.com/wailsapp/wails/pull/2750).
- Fixed default context menus by [mmgvh](https://github.com/mmghv) in [#2753](https://github.com/wailsapp/wails/pull/2753).
- Fixed background colours of examples on Windows by
[mmgvh](https://github.com/mmghv) in
[#2750](https://github.com/wailsapp/wails/pull/2750).
- Fixed default context menus by [mmgvh](https://github.com/mmghv) in
[#2753](https://github.com/wailsapp/wails/pull/2753).
### Changed
@@ -33,4 +37,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecated
### Security
File diff suppressed because it is too large Load Diff
+75 -43
View File
@@ -1,32 +1,35 @@
# Introduction
!!! note
This guide is a work in progress.
!!! note This guide is a work in progress.
Thanks for wanting to help out with development of Wails! This guide will help you get started.
Thanks for wanting to help out with development of Wails! This guide will help
you get started.
## Getting Started
- Git clone this repository. Checkout the `v3-alpha` branch.
- Install the CLI: `cd v3/cmd/wails3 && go install`
- Optional: If you are wanting to use the build system to build frontend code, you will need to install [npm](https://nodejs.org/en/download).
- Optional: If you are wanting to use the build system to build frontend code,
you will need to install [npm](https://nodejs.org/en/download).
## Building
For simple programs, you can use the standard `go build` command. It's also possible to use `go run`.
For simple programs, you can use the standard `go build` command. It's also
possible to use `go run`.
Wails also comes with a build system that can be used to build more complex projects. It utilises the awesome [Task](https://taskfile.dev) build system.
For more information, check out the task homepage or run `wails task --help`.
Wails also comes with a build system that can be used to build more complex
projects. It utilises the awesome [Task](https://taskfile.dev) build system. For
more information, check out the task homepage or run `wails task --help`.
## Project layout
The project has the following structure:
```
v3
├── cmd/wails3 // CLI
├── examples // Examples of Wails apps
├── examples // Examples of Wails apps
├── internal // Internal packages
| ├── runtime // The Wails JS runtime
| └── templates // The supported project templates
@@ -44,18 +47,27 @@ The project has the following structure:
### Adding window functionality
The preferred way to add window functionality is to add a new function to the `pkg/application/webview_window.go` file. This should implement all the functionality required for all platforms. Any platform specific code should be called via a `webviewWindowImpl` interface method. This interface is implemented by each of the target platforms to provide the platform specific functionality. In some cases, this may do nothing.
Once you've added the interface method, ensure each platform implements it. A good example of this is the `SetMinSize` method.
The preferred way to add window functionality is to add a new function to the
`pkg/application/webview_window.go` file. This should implement all the
functionality required for all platforms. Any platform specific code should be
called via a `webviewWindowImpl` interface method. This interface is implemented
by each of the target platforms to provide the platform specific functionality.
In some cases, this may do nothing. Once you've added the interface method,
ensure each platform implements it. A good example of this is the `SetMinSize`
method.
- Mac: `webview_window_darwin.go`
- Windows: `webview_window_windows.go`
- Linux: `webview_window_linux.go`
Most, if not all, of the platform specific code should be run on the main thread. To simplify this, there are a number of `invokeSync` methods defined in `application.go`.
Most, if not all, of the platform specific code should be run on the main
thread. To simplify this, there are a number of `invokeSync` methods defined in
`application.go`.
### Updating the runtime
The runtime is located in `v3/internal/runtime`. When the runtime is updated, the following steps need to be taken:
The runtime is located in `v3/internal/runtime`. When the runtime is updated,
the following steps need to be taken:
```shell
wails3 task runtime:build
@@ -63,14 +75,19 @@ wails3 task runtime:build
### Events
Events are defined in `v3/pkg/events`. When adding a new event, the following steps need to be taken:
Events are defined in `v3/pkg/events`. When adding a new event, the following
steps need to be taken:
- Add the event to the `events.txt` file
- Run `wails3 task events:generate`
There are a number of types of events: platform specific application and window events + common events. The common events are useful for cross-platform event handling, but you aren't limited to the "lowest common denominator". You can use the platform specific events if you need to.
There are a number of types of events: platform specific application and window
events + common events. The common events are useful for cross-platform event
handling, but you aren't limited to the "lowest common denominator". You can use
the platform specific events if you need to.
When adding a common event, ensure that the platform specific events are mapped. An example of this is in `window_webview_darwin.go`:
When adding a common event, ensure that the platform specific events are mapped.
An example of this is in `window_webview_darwin.go`:
```go
// Translate ShouldClose to common WindowClosing event
@@ -79,7 +96,8 @@ When adding a common event, ensure that the platform specific events are mapped.
})
```
NOTE: We may try to automate this in the future by adding the mapping to the event definition.
NOTE: We may try to automate this in the future by adding the mapping to the
event definition.
### Plugins
@@ -93,35 +111,39 @@ Plugins are standard Go structure that adhere to the following interface:
type Plugin interface {
Name() string
Init(*application.App) error
Shutdown()
Shutdown()
CallableByJS() []string
InjectJS() string
}
```
The `Name()` method returns the name of the plugin. This is used for logging purposes.
The `Name()` method returns the name of the plugin. This is used for logging
purposes.
The `Init(*application.App) error` method is called when the plugin is loaded. The `*application.App`
parameter is the application that the plugin is being loaded into. Any errors will prevent
the application from starting.
The `Init(*application.App) error` method is called when the plugin is loaded.
The `*application.App` parameter is the application that the plugin is being
loaded into. Any errors will prevent the application from starting.
The `Shutdown()` method is called when the application is shutting down.
The `CallableByJS()` method returns a list of exported functions that can be called from
the frontend. These method names must exactly match the names of the methods exported
by the plugin.
The `InjectJS()` method returns JavaScript that should be injected into all windows as they are created. This is useful for adding custom JavaScript functions that complement the plugin.
The `CallableByJS()` method returns a list of exported functions that can be
called from the frontend. These method names must exactly match the names of the
methods exported by the plugin.
The `InjectJS()` method returns JavaScript that should be injected into all
windows as they are created. This is useful for adding custom JavaScript
functions that complement the plugin.
## Misc Tasks
### Upgrading Taskfile
The Wails CLI uses the [Task](https://taskfile.dev) build system. It is imported as a library and used to run the tasks defined in `Taskfile.yaml`.
The main interfacing with Task happens in `v3/internal/commands/task.go`.
The Wails CLI uses the [Task](https://taskfile.dev) build system. It is imported
as a library and used to run the tasks defined in `Taskfile.yaml`. The main
interfacing with Task happens in `v3/internal/commands/task.go`.
To check if there's an upgrade for Taskfile, run `wails3 task -version` and check against the Task website.
To check if there's an upgrade for Taskfile, run `wails3 task -version` and
check against the Task website.
To upgrade the version of Taskfile used, run:
@@ -129,11 +151,15 @@ To upgrade the version of Taskfile used, run:
wails3 task taskfile:upgrade
```
If there are incompatibilities then they should appear in the `v3/internal/commands/task.go` file.
If there are incompatibilities then they should appear in the
`v3/internal/commands/task.go` file.
Usually the best way to fix incompatibilities is to clone the task repo at `https://github.com/go-task/task` and look at the git history to determine what has changed and why.
Usually the best way to fix incompatibilities is to clone the task repo at
`https://github.com/go-task/task` and look at the git history to determine what
has changed and why.
To check all changes have worked correctly, re-install the CLI and check the version again:
To check all changes have worked correctly, re-install the CLI and check the
version again:
```shell
wails3 task cli:install
@@ -142,18 +168,21 @@ wails3 task -version
## Opening a PR
Make sure that all PRs have a ticket associated with them providing context to the change. If there is no ticket, please create one first.
Ensure that all PRs have updated the CHANGELOG.md file with the changes made. The CHANGELOG.md file is located in the `v3` directory.
Make sure that all PRs have a ticket associated with them providing context to
the change. If there is no ticket, please create one first. Ensure that all PRs
have updated the CHANGELOG.md file with the changes made. The CHANGELOG.md file
is located in the `v3` directory.
## Misc Tasks
### Upgrading Taskfile
The Wails CLI uses the [Task](https://taskfile.dev) build system. It is imported as a library and used to run the tasks defined in `Taskfile.yaml`.
The main interfacing with Task happens in `v3/internal/commands/task.go`.
The Wails CLI uses the [Task](https://taskfile.dev) build system. It is imported
as a library and used to run the tasks defined in `Taskfile.yaml`. The main
interfacing with Task happens in `v3/internal/commands/task.go`.
To check if there's an upgrade for Taskfile, run `wails3 task -version` and check against the Task website.
To check if there's an upgrade for Taskfile, run `wails3 task -version` and
check against the Task website.
To upgrade the version of Taskfile used, run:
@@ -161,14 +190,17 @@ To upgrade the version of Taskfile used, run:
wails3 task taskfile:upgrade
```
If there are incompatibilities then they should appear in the `v3/internal/commands/task.go` file.
If there are incompatibilities then they should appear in the
`v3/internal/commands/task.go` file.
Usually the best way to fix incompatibilities is to clone the task repo at `https://github.com/go-task/task` and look at the git history to determine what has changed and why.
Usually the best way to fix incompatibilities is to clone the task repo at
`https://github.com/go-task/task` and look at the git history to determine what
has changed and why.
To check all changes have worked correctly, re-install the CLI and check the version again:
To check all changes have worked correctly, re-install the CLI and check the
version again:
```shell
wails3 task cli:install
wails3 task -version
```
+43 -39
View File
@@ -16,10 +16,10 @@ Status of features in v3.
Application interface methods
| Method | Windows | Linux | Mac | Notes |
|---------------------------------------------------------------|---------|-------|-----|-------|
| ------------------------------------------------------------- | ------- | ----- | --- | ----- |
| run() error | Y | Y | Y | |
| destroy() | | Y | Y | |
| setApplicationMenu(menu *Menu) | Y | Y | Y | |
| setApplicationMenu(menu \*Menu) | Y | Y | Y | |
| name() string | | Y | Y | |
| getCurrentWindowID() uint | Y | Y | Y | |
| showAboutDialog(name string, description string, icon []byte) | | Y | Y | |
@@ -28,15 +28,15 @@ Application interface methods
| dispatchOnMainThread(fn func()) | Y | Y | Y | |
| hide() | Y | Y | Y | |
| show() | Y | Y | Y | |
| getPrimaryScreen() (*Screen, error) | | Y | Y | |
| getScreens() ([]*Screen, error) | | Y | Y | |
| getPrimaryScreen() (\*Screen, error) | | Y | Y | |
| getScreens() ([]\*Screen, error) | | Y | Y | |
## Webview Window
Webview Window Interface Methods
| Method | Windows | Linux | Mac | Notes |
|----------------------------------------------------|---------|-------|-----|------------------------------------------|
| -------------------------------------------------- | ------- | ----- | --- | ---------------------------------------- |
| center() | Y | Y | Y | |
| close() | y | Y | Y | |
| destroy() | | Y | Y | |
@@ -44,7 +44,7 @@ Webview Window Interface Methods
| focus() | Y | Y | | |
| forceReload() | | Y | Y | |
| fullscreen() | Y | Y | Y | |
| getScreen() (*Screen, error) | y | Y | Y | |
| getScreen() (\*Screen, error) | y | Y | Y | |
| getZoom() float64 | | Y | Y | |
| height() int | Y | Y | Y | |
| hide() | Y | Y | Y | |
@@ -90,7 +90,7 @@ Webview Window Interface Methods
### Application
| Feature | Windows | Linux | Mac | Notes |
|---------|---------|-------|-----|-------|
| ------- | ------- | ----- | --- | ----- |
| Quit | Y | Y | Y | |
| Hide | Y | | Y | |
| Show | Y | | Y | |
@@ -98,7 +98,7 @@ Webview Window Interface Methods
### Dialogs
| Feature | Windows | Linux | Mac | Notes |
|----------|---------|-------|-----|-------|
| -------- | ------- | ----- | --- | ----- |
| Info | Y | Y | Y | |
| Warning | Y | Y | Y | |
| Error | Y | Y | Y | |
@@ -109,30 +109,32 @@ Webview Window Interface Methods
### Clipboard
| Feature | Windows | Linux | Mac | Notes |
|---------|---------|-------|-----|-------|
| ------- | ------- | ----- | --- | ----- |
| SetText | Y | | Y | |
| Text | Y | | Y | |
### ContextMenu
| Feature | Windows | Linux | Mac | Notes |
|------------------|---------|-------|-----|-------|
| ---------------- | ------- | ----- | --- | ----- |
| OpenContextMenu | Y | | Y | |
| On By Default | | | | |
| Control via HTML | Y | | | |
The default context menu is enabled by default for all elements that are `contentEditable: true`, `<input>`
or `<textarea>` tags or have the `--default-contextmenu: true` style set.
The `--default-contextmenu: show` style will always show the context menu
The `--default-contextmenu: hide` style will always hide the context menu
The default context menu is enabled by default for all elements that are
`contentEditable: true`, `<input>` or `<textarea>` tags or have the
`--default-contextmenu: true` style set. The `--default-contextmenu: show` style
will always show the context menu The `--default-contextmenu: hide` style will
always hide the context menu
Anything nested under a tag with `--default-contextmenu: hide` style will not show the context menu unless it is
explicitly set with `--default-contextmenu: show`.
Anything nested under a tag with `--default-contextmenu: hide` style will not
show the context menu unless it is explicitly set with
`--default-contextmenu: show`.
### Screens
| Feature | Windows | Linux | Mac | Notes |
|------------|---------|-------|-----|-------|
| ---------- | ------- | ----- | --- | ----- |
| GetAll | Y | Y | Y | |
| GetPrimary | Y | Y | Y | |
| GetCurrent | Y | Y | Y | |
@@ -140,18 +142,17 @@ explicitly set with `--default-contextmenu: show`.
### System
| Feature | Windows | Linux | Mac | Notes |
|------------|---------|-------|-----|-------|
| ---------- | ------- | ----- | --- | ----- |
| IsDarkMode | | | Y | |
### Window
Y = Supported
U = Untested
Y = Supported U = Untested
- = Not available
| Feature | Windows | Linux | Mac | Notes |
|---------------------|---------|-------|-----|--------------------------------------------------------------------------------------|
| ------------------- | ------- | ----- | --- | ------------------------------------------------------------------------------------ |
| Center | Y | Y | Y | |
| Focus | Y | Y | | |
| FullScreen | Y | Y | Y | |
@@ -184,11 +185,12 @@ U = Untested
### Window Options
A 'Y' in the table below indicates that the option has been tested and is applied when the window is created.
An 'X' indicates that the option is not supported by the platform.
A 'Y' in the table below indicates that the option has been tested and is
applied when the window is created. An 'X' indicates that the option is not
supported by the platform.
| Feature | Windows | Linux | Mac | Notes |
|---------------------------------|---------|-------|-----|--------------------------------------------|
| ------------------------------- | ------- | ----- | --- | ------------------------------------------ |
| AlwaysOnTop | Y | | | |
| BackgroundColour | Y | Y | | |
| BackgroundType | | | | Acrylic seems to work but the others don't |
@@ -228,13 +230,13 @@ To log or not to log? System logger vs custom logger.
## Menu
| Event | Windows | Linux | Mac | Notes |
|--------------------------|---------|-------|-----|-------|
| ------------------------ | ------- | ----- | --- | ----- |
| Default Application Menu | Y | Y | Y | |
## Tray Menus
| Feature | Windows | Linux | Mac | Notes |
|--------------------|---------|-------|-----|----------------------------------------------------------------------|
| ------------------ | ------- | ----- | --- | -------------------------------------------------------------------- |
| Icon | Y | | Y | Windows has default icons for light/dark mode & supports PNG or ICO. |
| Label | - | | Y | |
| Label (ANSI Codes) | - | | | |
@@ -243,11 +245,11 @@ To log or not to log? System logger vs custom logger.
### Methods
| Method | Windows | Linux | Mac | Notes |
|-------------------------------|---------|-------|-----|-------|
| ----------------------------- | ------- | ----- | --- | ----- |
| setLabel(label string) | - | | Y | |
| run() | Y | | Y | |
| setIcon(icon []byte) | Y | | Y | |
| setMenu(menu *Menu) | Y | | Y | |
| setMenu(menu \*Menu) | Y | | Y | |
| setIconPosition(position int) | - | | Y | |
| setTemplateIcon(icon []byte) | - | | Y | |
| destroy() | Y | | Y | |
@@ -258,7 +260,7 @@ To log or not to log? System logger vs custom logger.
Mapping native events to cross-platform events.
| Event | Windows | Linux | Mac | Notes |
|--------------------------|---------|-------|-----------------|-------|
| ------------------------ | ------- | ----- | --------------- | ----- |
| WindowWillClose | | | WindowWillClose | |
| WindowDidClose | | | | |
| WindowDidResize | | | | |
@@ -282,7 +284,7 @@ Contains a lot needed for development.
## Theme
| Mode | Windows | Linux | Mac | Notes |
|--------|---------|-------|-----|-------|
| ------ | ------- | ----- | --- | ----- |
| Dark | Y | | | |
| Light | Y | | | |
| System | Y | | | |
@@ -300,7 +302,7 @@ All templates are working.
Built-in plugin support:
| Plugin | Windows | Linux | Mac | Notes |
|-----------------|---------|-------|-----|-------|
| --------------- | ------- | ----- | --- | ----- |
| Browser | Y | | Y | |
| KV Store | Y | Y | Y | |
| Log | Y | Y | Y | |
@@ -316,7 +318,7 @@ TODO:
## Packaging
| | Windows | Linux | Mac | Notes |
|-----------------|---------|-------|-----|-------|
| --------------- | ------- | ----- | --- | ----- |
| Icon Generation | Y | | Y | |
| Icon Embedding | Y | | Y | |
| Info.plist | - | | Y | |
@@ -327,7 +329,7 @@ TODO:
## Frameless Windows
| Feature | Windows | Linux | Mac | Notes |
|---------|---------|-------|-----|------------------------------------------------|
| ------- | ------- | ----- | --- | ---------------------------------------------- |
| Resize | Y | | Y | |
| Drag | Y | Y | Y | Linux - can always drag with `Meta`+left mouse |
@@ -338,7 +340,7 @@ TODO:
### Mac Options
| Feature | Default | Notes |
|-------------------------|-------------------|------------------------------------------------------|
| ----------------------- | ----------------- | ---------------------------------------------------- |
| Backdrop | MacBackdropNormal | Standard solid window |
| DisableShadow | false | |
| TitleBar | | Standard window decorations by default |
@@ -354,7 +356,7 @@ TODO:
### Windows Options
| Feature | Default | Notes |
|-----------------------------------|---------------|---------------------------------------------|
| --------------------------------- | ------------- | ------------------------------------------- |
| BackdropType | Solid | |
| DisableIcon | false | |
| Theme | SystemDefault | |
@@ -364,15 +366,17 @@ TODO:
## Linux Specific
Implementation details for the functions utilized by the `*_linux.go` files are located in the following files:
Implementation details for the functions utilized by the `*_linux.go` files are
located in the following files:
- linux_cgo.go: CGo implementation
- linux_purego.go: PureGo implementation
### CGO
By default CGO is utilized to compile the Linux port. This prevents easy cross-compilation and so the PureGo
implementation is also being simultaneously developed.
By default CGO is utilized to compile the Linux port. This prevents easy
cross-compilation and so the PureGo implementation is also being simultaneously
developed.
### Purego
@@ -385,7 +389,7 @@ Note: things are currently not working after the refactor
## Examples
| Example | Windows | Linux | Mac |
|--------------|----------------------|-------|-----|
| ------------ | -------------------- | ----- | --- |
| binding | NO | | |
| build | Yes (Debug + Prod) | | |
| clipboard | Yes | | |
Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 15 KiB

+21 -21
View File
@@ -1,11 +1,12 @@
# Feedback
We welcome (and encourage) your feedback! Here are the different ways to provide feedback:
We welcome (and encourage) your feedback! Here are the different ways to provide
feedback:
=== "Bugs"
If you find a bug, please let us know by posting into the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel on Discord:
- The post should clearly state what the bug is and have a simple reproducible example. If the docs are unclear what *should* happen, please include that in the post.
- The post should be given the `Bug` tag.
- Please include the output of `wails doctor` in your post.
@@ -14,12 +15,12 @@ We welcome (and encourage) your feedback! Here are the different ways to provide
=== "Fixes"
If you have a fix for a bug or an update for documentation, please do the following:
- Open a pull request on the [Wails repository](https://github.com/wailsapp/wails). The title of the PR should start with `[v3]`.
- Create a post in the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel.
- The post should be given the `PR` tag.
- Please include a link to the PR in your post.
=== "Suggestions"
If you have a suggestion, please let us know by posting into the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel on Discord:
@@ -30,27 +31,26 @@ We welcome (and encourage) your feedback! Here are the different ways to provide
=== "Upvoting"
- Posts can be "upvoted" by using the :thumbsup: emoji. Please apply to any posts that are a priority for you.
- Please *don't* just add comments like "+1" or "me too".
- Posts can be "upvoted" by using the :thumbsup: emoji. Please apply to any posts that are a priority for you.
- Please *don't* just add comments like "+1" or "me too".
- Please feel free to comment if there is more to add to the post, such as "this bug also affect ARM builds" or "Another option would be to ....."
Things we are looking for feedback on:
- The API
- Is it easy to use?
- Does it do what you expect?
- Is it missing anything?
- Is there anything that should be removed?
- Is it consistent between Go and JS?
- The build system
- Is it easy to use?
- Can we improve it?
- The API
- Is it easy to use?
- Does it do what you expect?
- Is it missing anything?
- Is there anything that should be removed?
- Is it consistent between Go and JS?
- The build system
- Is it easy to use?
- Can we improve it?
- The examples
- Are they clear?
- Do they cover the basics?
- Are they clear?
- Do they cover the basics?
- Features
- What features are missing?
- What features are not needed?
- What features are missing?
- What features are not needed?
- Documentation
- What could be clearer?
- What could be clearer?
@@ -1,7 +1,7 @@
# Installation
To install the Wails CLI, ensure you have [Go 1.21+](https://go.dev/dl/) installed and run:
To install the Wails CLI, ensure you have [Go 1.21+](https://go.dev/dl/)
installed and run:
```shell
go install github.com/wailsapp/wails/v3/cmd/wails3@latest
@@ -21,9 +21,9 @@ Wails has a number of common dependencies that are required before installation:
=== "Go 1.21+"
Download Go from the [Go Downloads Page](https://go.dev/dl/).
Ensure that you follow the official [Go installation instructions](https://go.dev/doc/install). You will also need to ensure that your `PATH` environment variable also includes the path to your `~/go/bin` directory. Restart your terminal and do the following checks:
- Check Go is installed correctly: `go version`
- Check `~/go/bin` is in your PATH variable: `echo $PATH | grep go/bin`
@@ -32,7 +32,7 @@ Wails has a number of common dependencies that are required before installation:
Although Wails doesn't require npm to be installed, it is needed if you want to use the bundled templates.
Download the latest node installer from the [Node Downloads Page](https://nodejs.org/en/download/). It is best to use the latest release as that is what we generally test against.
Run `npm --version` to verify.
=== "Task (Optional)"
@@ -63,12 +63,15 @@ You will also need to install platform specific dependencies:
## System Check
Running `wails3 doctor` will check if you have the correct dependencies installed. If not, it will advise on what is missing and help on how to rectify any problems.
Running `wails3 doctor` will check if you have the correct dependencies
installed. If not, it will advise on what is missing and help on how to rectify
any problems.
## The `wails3` command appears to be missing?
If your system is reporting that the `wails3` command is missing, check the following:
- Make sure you have followed the Go installation guide correctly.
- Check that the `go/bin` directory is in the `PATH` environment variable.
- Close/Reopen current terminals to pick up the new `PATH` variable.
If your system is reporting that the `wails3` command is missing, check the
following:
- Make sure you have followed the Go installation guide correctly.
- Check that the `go/bin` directory is in the `PATH` environment variable.
- Close/Reopen current terminals to pick up the new `PATH` variable.
@@ -2,7 +2,8 @@
Now that you have Wails installed, you can start exploring the alpha version.
The best place to start is the `examples` directory in the Wails repository. This contains a number of examples that you can run and play with.
The best place to start is the `examples` directory in the Wails repository.
This contains a number of examples that you can run and play with.
## Running an example
@@ -11,23 +12,26 @@ To run an example, you can simply use:
```shell
go run .
```
in the example directory.
## Creating a new project
To create a new project, you can use the `wails3 init` command. This will create a new project in the current directory.
To create a new project, you can use the `wails3 init` command. This will create
a new project in the current directory.
Wails3 uses [Task](https://taskfile.dev) as its build system by default, although there is no reason why you can't
use your own build system, or use `go build` directly. Wails has the task build system built in and can be run using `wails3 task`.
Wails3 uses [Task](https://taskfile.dev) as its build system by default,
although there is no reason why you can't use your own build system, or use
`go build` directly. Wails has the task build system built in and can be run
using `wails3 task`.
If you look through the `Taskfile.yaml` file, you will see that there are a number of tasks defined. The most important
one is the `build` task. This is the task that is run when you use `wails3 build`.
If you look through the `Taskfile.yaml` file, you will see that there are a
number of tasks defined. The most important one is the `build` task. This is the
task that is run when you use `wails3 build`.
The task file is unlikely to be complete and is subject to change over time.
## Building a project
To build a project, you can use the `wails3 build` command. This is a shortcut for `wails3 task build`.
To build a project, you can use the `wails3 build` command. This is a shortcut
for `wails3 task build`.
+337
View File
@@ -0,0 +1,337 @@
# What's new in v3?
!!! note The features that will be included in the v3 release may change from
this list.
## Multiple Windows
It's now possible to create multiple windows and configure each one
independently.
```go
package main
import (
_ "embed"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
)
//go:embed assets/*
var assets embed.FS
func main() {
app := application.New(application.Options{
Name: "Multi Window Demo",
Assets: application.AssetOptions{
FS: assets,
},
})
window1 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Window 1",
})
window2 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Window 2",
})
// load the embedded html from the embed.FS
window1.SetURL("/")
window1.Center()
// Load an external URL
window2.SetURL("https://wails.app")
err := app.Run()
if err != nil {
log.Fatal(err.Error())
}
}
```
## Systrays
Systrays allow you to add an icon in the system tray area of your desktop and
have the following features:
- Attach window (the window will be centered to the systray icon)
- Full menu support
- Light/Dark mode icons
```go
package main
import (
_ "embed"
"log"
"runtime"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/icons"
)
func main() {
app := application.New(application.Options{
Name: "Systray Demo",
Mac: application.MacOptions{
ActivationPolicy: application.ActivationPolicyAccessory,
},
})
window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Width: 500,
Height: 800,
Frameless: true,
AlwaysOnTop: true,
Hidden: true,
Windows: application.WindowsWindow{
HiddenOnTaskbar: true,
},
})
systemTray := app.NewSystemTray()
// Support for template icons on macOS
if runtime.GOOS == "darwin" {
systemTray.SetTemplateIcon(icons.SystrayMacTemplate)
} else {
// Support for light/dark mode icons
systemTray.SetDarkModeIcon(icons.SystrayDark)
systemTray.SetIcon(icons.SystrayLight)
}
// Support for menu
myMenu := app.NewMenu()
myMenu.Add("Hello World!").OnClick(func(_ *application.Context) {
println("Hello World!")
})
systemTray.SetMenu(myMenu)
// This will center the window to the systray icon with a 5px offset
// It will automatically be shown when the systray icon is clicked
// and hidden when the window loses focus
systemTray.AttachWindow(window).WindowOffset(5)
err := app.Run()
if err != nil {
log.Fatal(err)
}
}
```
## Plugins
Plugins allow you to extend the functionality of the Wails system. Not only can
plugin methods be used in Go, but also called from Javascript. Included plugins:
- kvstore - A key/value store
- browser - open links in a browser
- log - custom logger
- oauth - handles oauth authentication and supports 60 providers
- single_instance - only allow one copy of your app to be run
- sqlite - add a sqlite db to your app. Uses the modernc pure go library
- start_at_login - Register/Unregister your application to start at login
## Improved bindings generation
v3 uses a new static analyser to generate bindings. This makes it extremely fast
and maintains comments and parameter names in your bindings. By default,
bindings are generated with calls using IDs instead of strings. This provides a
performance boost and allows for using obfuscation tools such as
[garble](https://github.com/burrowers/garble).
Bindings are generated by simply running `wails3 generate bindings` in the
project directory.
```js
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Ă‚ MODIWL
// This file is automatically generated. DO NOT EDIT
import { main } from "./models";
window.go = window.go || {};
window.go.main = {
GreetService: {
/**
* GreetService.Greet
* Greet greets a person
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function (name) {
wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
},
/**
* GreetService.GreetPerson
* GreetPerson greets a person
* @param person {main.Person}
* @returns {Promise<string>}
**/
GreetPerson: function (person) {
wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0));
},
},
};
```
## Improved build system
In v2, the build system was completely opaque and hard to customise. In v3, it's
possible to build everything using standard Go tooling.
All the heavy lifting that the v2 build system did, such as icon generation,
have been added as tool commands in the CLI. We have incorporated
[Taskfile](https://taskfile.dev) into the CLI to orchestrate these calls to
bring the same developer experience as v2. However, this approach brings the
ultimate balance of flexibility and ease of use as you can now customise the
build process to your needs.
You can even use make if that's your thing!
```yaml title="Snippet from Taskfile.yml"
build:darwin:
summary: Builds the application
platforms:
- darwin
cmds:
- task: pre-build
- task: build-frontend
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
- task: post-build
env:
CGO_CFLAGS: "-mmacosx-version-min=10.13"
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
MACOSX_DEPLOYMENT_TARGET: "10.13"
```
## Improved events
Events are now emitted for a lot of the runtime operations, allowing you to hook
into application/system events. Cross-platform (common) events are also emitted
where there are common platform events, allowing you to write the same event
handling methods cross platform.
Event hooks can also be registered. These are like the `On` method but are
synchronous and allow you to cancel the event. An example of this would be to
show a confirmation dialog before closing a window.
```go
package main
import (
_ "embed"
"log"
"time"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/events"
)
//go:embed assets
var assets embed.FS
func main() {
app := application.New(application.Options{
Name: "Events Demo",
Description: "A demo of the Events API",
Assets: application.AssetOptions{
FS: assets,
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
})
// Custom event handling
app.Events.On("myevent", func(e *application.WailsEvent) {
log.Printf("[Go] WailsEvent received: %+v\n", e)
})
// OS specific application events
app.On(events.Mac.ApplicationDidFinishLaunching, func(event *application.Event) {
println("events.Mac.ApplicationDidFinishLaunching fired!")
})
// Platform agnostic events
app.On(events.Common.ApplicationStarted, func(event *application.Event) {
println("events.Common.ApplicationStarted fired!")
})
win1 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Title: "Takes 3 attempts to close me!",
})
var countdown = 3
// Register a hook to cancel the window closing
win1.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
countdown--
if countdown == 0 {
println("Closing!")
return
}
println("Nope! Not closing!")
e.Cancel()
})
win1.On(events.Common.WindowFocus, func(e *application.WindowEvent) {
println("[Event] Window focus!")
})
err := app.Run()
if err != nil {
log.Fatal(err.Error())
}
}
```
## Wails Markup Language (wml)
An experimental feature to call runtime methods using plain html, similar to
[htmx](https://htmx.org).
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Wails ML Demo</title>
</head>
<body style="margin-top:50px; color: white; background-color: #191919">
<h2>Wails ML Demo</h2>
<p>This application contains no Javascript!</p>
<button data-wml-event="button-pressed">Press me!</button>
<button data-wml-event="delete-things" data-wml-confirm="Are you sure?">
Delete all the things!
</button>
<button data-wml-window="Close" data-wml-confirm="Are you sure?">
Close the Window?
</button>
<button data-wml-window="Center">Center</button>
<button data-wml-window="Minimise">Minimise</button>
<button data-wml-window="Maximise">Maximise</button>
<button data-wml-window="UnMaximise">UnMaximise</button>
<button data-wml-window="Fullscreen">Fullscreen</button>
<button data-wml-window="UnFullscreen">UnFullscreen</button>
<button data-wml-window="Restore">Restore</button>
<div
style="width: 200px; height: 200px; border: 2px solid white;"
data-wml-event="hover"
data-wml-trigger="mouseover"
>
Hover over me
</div>
</body>
</html>
```
+57
View File
@@ -0,0 +1,57 @@
package main
import (
"go/build"
"os"
"path/filepath"
"github.com/princjef/gomarkdoc"
"github.com/princjef/gomarkdoc/lang"
"github.com/princjef/gomarkdoc/logger"
)
func main() {
// Create a renderer to output data
out, err := gomarkdoc.NewRenderer()
if err != nil {
// handle error
}
wd, err := os.Getwd()
if err != nil {
// handle error
}
packagePath := filepath.Join(wd, "../../v3/pkg/application")
buildPkg, err := build.ImportDir(packagePath, build.ImportComment)
if err != nil {
// handle error
}
// Create a documentation package from the build representation of our
// package.
log := logger.New(logger.DebugLevel)
pkg, err := lang.NewPackageFromBuild(log, buildPkg)
if err != nil {
// handle error
panic(err)
}
// Write the documentation out to console.
data, err := out.Package(pkg)
if err != nil {
panic(err)
}
cwd, err := os.Getwd()
if err != nil {
panic(err)
}
println(cwd)
err = os.WriteFile(filepath.Join("..", "docs", "API", "fullapi.md"), []byte(data), 0644)
if err != nil {
panic(err)
}
}

Some files were not shown because too many files have changed in this diff Show More