Compare commits

...

1 commit

Author SHA1 Message Date
leaanthony
c3faf60707 docs: format document 2023-06-09 00:41:43 +00:00
138 changed files with 8621 additions and 2883 deletions

View file

@ -1,29 +1,35 @@
# Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Please include a summary of the change and which issue is fixed. Please also
include relevant motivation and context. List any dependencies that are required
for this change.
Fixes # (issue)
## Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Breaking change (fix or feature that would cause existing functionality to
not work as expected)
- [ ] This change requires a documentation update
# How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using `wails doctor`.
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details for your
test configuration using `wails doctor`.
- [ ] Windows
- [ ] macOS
- [ ] Linux
## Test Configuration
Please paste the output of `wails doctor`. If you are unable to run this command, please describe your environment in as much detail as possible.
Please paste the output of `wails doctor`. If you are unable to run this
command, please describe your environment in as much detail as possible.
# Checklist:

View file

@ -1 +1,2 @@
The current Contribution Guidelines can be found at: https://wails.io/community-guide
The current Contribution Guidelines can be found at:
https://wails.io/community-guide

View file

@ -1,2 +1,2 @@
The latest contributors list may be found at: https://wails.io/credits#contributors
The latest contributors list may be found at:
https://wails.io/credits#contributors

View file

@ -42,7 +42,8 @@
<strong>
<samp>
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) · [한국어](README.ko.md)
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
[한국어](README.ko.md)
</samp>
</strong>
@ -66,38 +67,46 @@
## はじめに
Go プログラムにウェブインタフェースを提供する従来の方法は内蔵のウェブサーバを経由するものですが、 Wails では異なるアプローチを提供します。
Wails では Go のコードとウェブフロントエンドを単一のバイナリにまとめる機能を提供します。
また、プロジェクトの作成、コンパイル、ビルドを行うためのツールが提供されています。あなたがすべきことは創造性を発揮することです!
Go プログラムにウェブインタフェースを提供する従来の方法は内蔵のウェブサーバを経
由するものですが、 Wails では異なるアプローチを提供します。 Wails では Go のコー
ドとウェブフロントエンドを単一のバイナリにまとめる機能を提供します。また、プロジ
ェクトの作成、コンパイル、ビルドを行うためのツールが提供されています。あなたがす
べきことは創造性を発揮することです!
### 公式サイト
Version 2:
Wails v2 が 3 つのプラットフォームでベータ版としてリリースされました。興味のある方は[新しいウェブサイト](https://wails.io)をご覧ください。
Wails v2 が 3 つのプラットフォームでベータ版としてリリースされました。興味のある
方は[新しいウェブサイト](https://wails.io)をご覧ください。
レガシー版 v1:
レガシー版 v1 のドキュメントは[https://wails.app](https://wails.app)で見ることができます。
レガシー版 v1 のドキュメントは[https://wails.app](https://wails.app)で見ることが
できます。
### ロードマップ
プロジェクトのロードマップは[こちら](https://github.com/wailsapp/wails/discussions/1484)になります。
プロジェクトのロードマップ
は[こちら](https://github.com/wailsapp/wails/discussions/1484)になります。
機能拡張のリクエストを出す前にご覧ください。
## 特徴
- バックエンドには Go を利用しています
- 使い慣れたフロントエンド技術を利用して UI を構築できます
- あらかじめ用意されたテンプレートを利用することで、リッチなフロントエンドを備えた Go プログラムを作成できます
- あらかじめ用意されたテンプレートを利用することで、リッチなフロントエンドを備え
た Go プログラムを作成できます
- JavaScript から Go のメソッドを簡単に呼び出すことができます
- あなたの書いた Go の構造体やメソットに応じた TypeScript の定義が自動生成されます
- あなたの書いた Go の構造体やメソットに応じた TypeScript の定義が自動生成されま
- ネイティブのダイアログとメニューが利用できます
- モダンな半透明や「frosted window」エフェクトをサポートしています
- Go と JavaScript 間で統一されたイベント・システムを備えています
- プロジェクトを素早く生成して構築する強力な cli ツールを用意しています
- マルチプラットフォームに対応しています
- ネイティブなレンダリングエンジンを使用しています - _つまりブラウザを埋め込んでいるわけではありません_
- ネイティブなレンダリングエンジンを使用しています - _つまりブラウザを埋め込んで
いるわけではありません_
## スポンサー
@ -106,25 +115,34 @@ Wails v2 が 3 つのプラットフォームでベータ版としてリリー
## 始め方
インストール方法は[公式サイト](https://wails.io/docs/gettingstarted/installation)に掲載されています。
インストール方法
は[公式サイト](https://wails.io/docs/gettingstarted/installation)に掲載されてい
ます。
## FAQ
- Electron の代替品になりますか?
それはあなたの求める要件によります。Wails は Go プログラマーが簡単に軽量のデスクトップアプリケーションを作成したり、既存のアプリケーションにフロントエンドを追加できるように設計されています。
Wails v2 ではメニューやダイアログといったネイティブな要素を提供するようになったため、軽量な Electron の代替となりつつあります。
それはあなたの求める要件によります。Wails は Go プログラマーが簡単に軽量のデス
クトップアプリケーションを作成したり、既存のアプリケーションにフロントエンドを
追加できるように設計されています。 Wails v2 ではメニューやダイアログといったネ
イティブな要素を提供するようになったため、軽量な Electron の代替となりつつあり
ます。
- このプロジェクトは誰に向けたものですか?
HTML/JS/CSS のフロントエンド技術をアプリケーションにバンドルさせることで、サーバーを作成してブラウザ経由で表示させることなくアプリケーションを利用したい Go プログラマにおすすめです。
HTML/JS/CSS のフロントエンド技術をアプリケーションにバンドルさせることで、サー
バーを作成してブラウザ経由で表示させることなくアプリケーションを利用したい Go
プログラマにおすすめです。
- 名前の由来を教えて下さい
WebView を見たとき、私はこう思いました。
「私が本当に欲しいのは、WebView アプリを構築するためのツールであり、Ruby に対する Rails のようなものである」と。
「私が本当に欲しいのは、WebView アプリを構築するためのツールであり、Ruby に対
する Rails のようなものである」と。
そのため、最初は言葉遊びのつもりでしたWebview on Rails
また、私の[出身国](https://en.wikipedia.org/wiki/Wales)の英語名と同音異義語でもあります。そしてこの名前が定着しました。
また、私の[出身国](https://en.wikipedia.org/wiki/Wales)の英語名と同音異義語で
もあります。そしてこの名前が定着しました。
## スター数の推移
@ -133,15 +151,20 @@ Wails v2 が 3 つのプラットフォームでベータ版としてリリー
## コントリビューター
貢献してくれた方のリストが大きくなりすぎて、readme に入りきらなくなりました!
このプロジェクトに貢献してくれた素晴らしい方々のページは[こちら](https://wails.io/credits#contributors)です。
このプロジェクトに貢献してくれた素晴らしい方々のページ
は[こちら](https://wails.io/credits#contributors)です。
## 特記事項
このプロジェクトは以下の方々の協力がなければ、実現しなかったと思います。
- [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot) - 彼のサポートとフィードバックはとても大きいものでした。
- [Serge Zaitsev](https://github.com/zserge) - Wails のウィンドウで使用している[Webview](https://github.com/zserge/webview)の作者です。
- [Byron](https://github.com/bh90210) - 時には Byron が一人でこのプロジェクトを存続させてくれたこともありました。彼の素晴らしいインプットがなければ v1 に到達することはなかったでしょう。
- [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot) - 彼のサポートとフィード
バックはとても大きいものでした。
- [Serge Zaitsev](https://github.com/zserge) - Wails のウィンドウで使用してい
る[Webview](https://github.com/zserge/webview)の作者です。
- [Byron](https://github.com/bh90210) - 時には Byron が一人でこのプロジェクトを
存続させてくれたこともありました。彼の素晴らしいインプットがなければ v1 に到達
することはなかったでしょう。
プロジェクトを進める際に、以下のアルバムたちも支えてくれています。

View file

@ -42,7 +42,8 @@
<strong>
<samp>
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) · [한국어](README.ko.md)
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
[한국어](README.ko.md)
</samp>
</strong>
@ -64,16 +65,17 @@
## 소개
Go 프로그램에 웹 인터페이스를 제공하는 전통적인 방법은 내장 웹 서버를 이용하는 것입니다.
Wails는 다르게 접근합니다: Go 코드와 웹 프론트엔드를 단일 바이너리로 래핑하는 기능을 제공합니다.
프로젝트 생성, 컴파일 및 번들링을 처리하여 이를 쉽게 수행할 수 있도록 도구가 제공됩니다.
창의력을 발휘하기만 하면 됩니다!
Go 프로그램에 웹 인터페이스를 제공하는 전통적인 방법은 내장 웹 서버를 이용하는
것입니다. Wails는 다르게 접근합니다: Go 코드와 웹 프론트엔드를 단일 바이너리로
래핑하는 기능을 제공합니다. 프로젝트 생성, 컴파일 및 번들링을 처리하여 이를 쉽게
수행할 수 있도록 도구가 제공됩니다. 창의력을 발휘하기만 하면 됩니다!
## 기능
- 백엔드에 표준 Go 사용
- 이미 익숙한 프론트엔드 기술을 사용하여 UI 구축
- 사전 구축된 템플릿을 사용하여 Go 프로그램을 위한 풍부한 프론트엔드를 빠르게 생성
- 사전 구축된 템플릿을 사용하여 Go 프로그램을 위한 풍부한 프론트엔드를 빠르게 생
- Javascript에서 Go 메서드를 쉽게 호출
- Go 구조체 및 메서드에 대한 자동 생성된 Typescript 정의
- 기본 대화 및 메뉴
@ -86,13 +88,13 @@ Wails는 다르게 접근합니다: Go 코드와 웹 프론트엔드를 단일
### 로드맵
프로젝트 로드맵은 [여기](https://github.com/wailsapp/wails/discussions/1484)에서
프로젝트 로드맵은 [여기](https://github.com/wailsapp/wails/discussions/1484)에서
확인할 수 있습니다. 개선 요청을 하기 전에 이것을 참조하십시오.
## 시작하기
설치 지침은
[공식 웹사이트](https://wails.io/docs/gettingstarted/installation)에 있습니다.
설치 지침은 [공식 웹사이트](https://wails.io/docs/gettingstarted/installation)에
있습니다.
## 스폰서
@ -103,22 +105,23 @@ Wails는 다르게 접근합니다: Go 코드와 웹 프론트엔드를 단일
- 이것은 Electron의 대안인가요?
요구 사항에 따라 다릅니다. Go 프로그래머가 쉽게 가벼운 데스크톱 애플리케이션을
만들거나 기존 애플리케이션에 프론트엔드를 추가할 수 있도록 설계되었습니다.
Wails는 메뉴 및 대화 상자와 같은 기본 요소를 제공하므로 가벼운 Electron 대안으
간주될 수 있습니다.
요구 사항에 따라 다릅니다. Go 프로그래머가 쉽게 가벼운 데스크톱 애플리케이션을
만들거나 기존 애플리케이션에 프론트엔드를 추가할 수 있도록 설계되었습니다.
Wails는 메뉴 및 대화 상자와 같은 기본 요소를 제공하므로 가벼운 Electron 대안으
간주될 수 있습니다.
- 이 프로젝트는 누구를 대상으로 하나요?
서버를 생성하고 이를 보기 위해 브라우저를 열 필요 없이 HTML/JS/CSS 프런트엔드
애플리케이션과 함께 묶고자 하는 프로그래머를 대상으로 합니다.
서버를 생성하고 이를 보기 위해 브라우저를 열 필요 없이 HTML/JS/CSS 프런트엔드
애플리케이션과 함께 묶고자 하는 프로그래머를 대상으로 합니다.
- Wails 이름의 의미는 무엇인가요?
WebView를 보았을 때 저는 "내가 정말로 원하는 것은 WebView 앱을 구축하기 위한
도구를 사용하는거야. 마치 Ruby on Rails 처럼 말이야."라고 생각했습니다.
그래서 처음에는 말장난(Webview on Rails)이었습니다.
[국가](https://en.wikipedia.org/wiki/Wales)에 대한 영어 이름의 동음이의어이기도 하여 정했습니다.
WebView를 보았을 때 저는 "내가 정말로 원하는 것은 WebView 앱을 구축하기 위한
도구를 사용하는거야. 마치 Ruby on Rails 처럼 말이야."라고 생각했습니다. 그래서
처음에는 말장난(Webview on Rails)이었습니다.
[국가](https://en.wikipedia.org/wiki/Wales)에 대한 영어 이름의 동음이의어이기
도 하여 정했습니다.
## Stargazers 성장 추세
@ -126,8 +129,9 @@ Wails는 다르게 접근합니다: Go 코드와 웹 프론트엔드를 단일
## 기여자
기여자 목록이 추가 정보에 비해 너무 커지고 있습니다! 이 프로젝트에 기여한 모든 놀라운 사람들은
[여기](https://wails.io/credits#contributors)에 자신의 페이지를 가지고 있습니다.
기여자 목록이 추가 정보에 비해 너무 커지고 있습니다! 이 프로젝트에 기여한 모든
놀라운 사람들은 [여기](https://wails.io/credits#contributors)에 자신의 페이지를
가지고 있습니다.
## 라이센스

View file

@ -40,7 +40,8 @@
<strong>
<samp>
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) · [한국어](README.ko.md)
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
[한국어](README.ko.md)
</samp>
</strong>
@ -62,9 +63,11 @@
## Introduction
The traditional method of providing web interfaces to Go programs is via a built-in web server. Wails offers a different
approach: it provides the ability to wrap both Go code and a web frontend into a single binary. Tools are provided to
make this easy for you by handling project creation, compilation and bundling. All you have to do is get creative!
The traditional method of providing web interfaces to Go programs is via a
built-in web server. Wails offers a different approach: it provides the ability
to wrap both Go code and a web frontend into a single binary. Tools are provided
to make this easy for you by handling project creation, compilation and
bundling. All you have to do is get creative!
## Features
@ -83,12 +86,14 @@ make this easy for you by handling project creation, compilation and bundling. A
### Roadmap
The project roadmap may be found [here](https://github.com/wailsapp/wails/discussions/1484). Please consult
this before open up an enhancement request.
The project roadmap may be found
[here](https://github.com/wailsapp/wails/discussions/1484). Please consult this
before open up an enhancement request.
## Getting Started
The installation instructions are on the [official website](https://wails.io/docs/gettingstarted/installation).
The installation instructions are on the
[official website](https://wails.io/docs/gettingstarted/installation).
## Sponsors
@ -103,20 +108,24 @@ This project is supported by these kind people / companies:
- Is this an alternative to Electron?
Depends on your requirements. It's designed to make it easy for Go programmers to make lightweight desktop
applications or add a frontend to their existing applications. Wails does offer native elements such as menus
and dialogs, so it could be considered a lightweight electron alternative.
Depends on your requirements. It's designed to make it easy for Go programmers
to make lightweight desktop applications or add a frontend to their existing
applications. Wails does offer native elements such as menus and dialogs, so
it could be considered a lightweight electron alternative.
- Who is this project aimed at?
Go programmers who want to bundle an HTML/JS/CSS frontend with their applications, without resorting to creating a
server and opening a browser to view it.
Go programmers who want to bundle an HTML/JS/CSS frontend with their
applications, without resorting to creating a server and opening a browser to
view it.
- What's with the name?
When I saw WebView, I thought "What I really want is tooling around building a WebView app, a bit like Rails is to
Ruby". So initially it was a play on words (Webview on Rails). It just so happened to also be a homophone of the
English name for the [Country](https://en.wikipedia.org/wiki/Wales) I am from. So it stuck.
When I saw WebView, I thought "What I really want is tooling around building a
WebView app, a bit like Rails is to Ruby". So initially it was a play on words
(Webview on Rails). It just so happened to also be a homophone of the English
name for the [Country](https://en.wikipedia.org/wiki/Wales) I am from. So it
stuck.
## Stargazers over time
@ -124,8 +133,9 @@ This project is supported by these kind people / companies:
## Contributors
The contributors list is getting too big for the readme! All the amazing people who have contributed to this
project have their own page [here](https://wails.io/credits#contributors).
The contributors list is getting too big for the readme! All the amazing people
who have contributed to this project have their own page
[here](https://wails.io/credits#contributors).
## License

View file

@ -42,7 +42,8 @@
<strong>
<samp>
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) · [한국어](README.ko.md)
[English](README.md) · [简体中文](README.zh-Hans.md) · [日本語](README.ja.md) ·
[한국어](README.ko.md)
</samp>
</strong>
@ -64,8 +65,9 @@
## 项目介绍
为 Go 程序提供 Web 界面的传统方法是通过内置 Web 服务器。Wails 提供了一种不同的方法:它提供了将 Go 代码和 Web
前端一起打包成单个二进制文件的能力。通过提供的工具,可以很轻松的完成项目的创建、编译和打包。你所要做的就是发挥创造力!
为 Go 程序提供 Web 界面的传统方法是通过内置 Web 服务器。Wails 提供了一种不同的方
法:它提供了将 Go 代码和 Web 前端一起打包成单个二进制文件的能力。通过提供的工具
,可以很轻松的完成项目的创建、编译和打包。你所要做的就是发挥创造力!
## 功能
@ -83,7 +85,8 @@
### 路线图
项目路线图可在 [此处](https://github.com/wailsapp/wails/discussions/1484) 找到。在提出增强请求之前请查阅此内容。
项目路线图可在 [此处](https://github.com/wailsapp/wails/discussions/1484) 找到。
在提出增强请求之前请查阅此内容。
## 快速入门
@ -99,16 +102,21 @@
- 它是 Electron 的替代品吗?
取决于您的要求。它旨在使 Go 程序员可以轻松制作轻量级桌面应用程序或在其现有应用程序中添加前端。尽管 Wails 当前不提供对诸如菜单之类的原生元素的钩子,但将来可能会改变。
取决于您的要求。它旨在使 Go 程序员可以轻松制作轻量级桌面应用程序或在其现有应用
程序中添加前端。尽管 Wails 当前不提供对诸如菜单之类的原生元素的钩子,但将来可
能会改变。
- 这个项目针对的是哪些人?
希望将 HTML / JS / CSS 前端与其应用程序捆绑在一起的程序员,而不是借助创建服务并打开浏览器进行查看的方式。
希望将 HTML / JS / CSS 前端与其应用程序捆绑在一起的程序员,而不是借助创建服务
并打开浏览器进行查看的方式。
- 名字怎么来的?
当我看到 WebView 时,我想"我真正想要的是围绕构建 WebView 应用程序工作,有点像 Rails 对于 Ruby"。因此最初它是一个文字游戏Webview on
Rails。碰巧也是我来自的 [国家](https://en.wikipedia.org/wiki/Wales) 的英文名字的同音。所以就是它了。
当我看到 WebView 时,我想"我真正想要的是围绕构建 WebView 应用程序工作,有点像
Rails 对于 Ruby"。因此最初它是一个文字游戏Webview on Rails。碰巧也是我来
自的 [国家](https://en.wikipedia.org/wiki/Wales) 的英文名字的同音。所以就是它
了。
## 星星增长趋势
@ -116,7 +124,8 @@
## 贡献者
贡献者列表对于 README 文件来说太大了!所有为这个项目做出贡献的了不起的人在[这里](https://wails.io/credits#contributors)都有自己的页面。
贡献者列表对于 README 文件来说太大了!所有为这个项目做出贡献的了不起的人
在[这里](https://wails.io/credits#contributors)都有自己的页面。
## 许可证

View file

@ -62,9 +62,11 @@
## Introduction
The traditional method of providing web interfaces to Go programs is via a built-in web server. Wails offers a different
approach: it provides the ability to wrap both Go code and a web frontend into a single binary. Tools are provided to
make this easy for you by handling project creation, compilation and bundling. All you have to do is get creative!
The traditional method of providing web interfaces to Go programs is via a
built-in web server. Wails offers a different approach: it provides the ability
to wrap both Go code and a web frontend into a single binary. Tools are provided
to make this easy for you by handling project creation, compilation and
bundling. All you have to do is get creative!
## Features
@ -83,8 +85,9 @@ make this easy for you by handling project creation, compilation and bundling. A
### Roadmap
The project roadmap may be found [here](https://github.com/wailsapp/wails/discussions/1484). Please consult
this before open up an enhancement request.
The project roadmap may be found
[here](https://github.com/wailsapp/wails/discussions/1484). Please consult this
before open up an enhancement request.
## Sponsors
@ -185,26 +188,31 @@ This project is supported by these kind people / companies:
## Getting Started
The installation instructions are on the [official website](https://wails.io/docs/gettingstarted/installation).
The installation instructions are on the
[official website](https://wails.io/docs/gettingstarted/installation).
## FAQ
- Is this an alternative to Electron?
Depends on your requirements. It's designed to make it easy for Go programmers to make lightweight desktop
applications or add a frontend to their existing applications. Wails does offer native elements such as menus
and dialogs, so it could be considered a lightweight electron alternative.
Depends on your requirements. It's designed to make it easy for Go programmers
to make lightweight desktop applications or add a frontend to their existing
applications. Wails does offer native elements such as menus and dialogs, so
it could be considered a lightweight electron alternative.
- Who is this project aimed at?
Go programmers who want to bundle an HTML/JS/CSS frontend with their applications, without resorting to creating a
server and opening a browser to view it.
Go programmers who want to bundle an HTML/JS/CSS frontend with their
applications, without resorting to creating a server and opening a browser to
view it.
- What's with the name?
When I saw WebView, I thought "What I really want is tooling around building a WebView app, a bit like Rails is to
Ruby". So initially it was a play on words (Webview on Rails). It just so happened to also be a homophone of the
English name for the [Country](https://en.wikipedia.org/wiki/Wales) I am from. So it stuck.
When I saw WebView, I thought "What I really want is tooling around building a
WebView app, a bit like Rails is to Ruby". So initially it was a play on words
(Webview on Rails). It just so happened to also be a homophone of the English
name for the [Country](https://en.wikipedia.org/wiki/Wales) I am from. So it
stuck.
## Stargazers over time
@ -212,8 +220,9 @@ The installation instructions are on the [official website](https://wails.io/doc
## Contributors
The contributors list is getting too big for the readme! All the amazing people who have contributed to this
project have their own page [here](https://wails.io/credits#contributors).
The contributors list is getting too big for the readme! All the amazing people
who have contributed to this project have their own page
[here](https://wails.io/credits#contributors).
## License

View file

@ -6,8 +6,9 @@ About your template
## Live Development
To run in live development mode, run `wails dev` in the project directory. In another terminal, go into the `frontend`
directory and run `npm run dev`. The frontend dev server will run on http://localhost:34115. Connect to this in your
To run in live development mode, run `wails dev` in the project directory. In
another terminal, go into the `frontend` directory and run `npm run dev`. The
frontend dev server will run on http://localhost:34115. Connect to this in your
browser and connect to your application.
## Building

View file

@ -1,4 +1,4 @@
# README
This is an example project that shows how to use a custom layout.
Run `wails build` in the `cmd/customlayout` directory to build the project.
This is an example project that shows how to use a custom layout. Run
`wails build` in the `cmd/customlayout` directory to build the project.

View file

@ -1,35 +1,41 @@
# Build Directory
The build directory is used to house all the build files and assets for your application.
The build directory is used to house all the build files and assets for your
application.
The structure is:
* bin - Output directory
* darwin - macOS specific files
* windows - Windows specific files
- bin - Output directory
- darwin - macOS specific files
- windows - Windows specific files
## Mac
The `darwin` directory holds files specific to Mac builds.
These may be customised and used as part of the build. To return these files to the default state, simply delete them
and
build with `wails build`.
The `darwin` directory holds files specific to Mac builds. These may be
customised and used as part of the build. To return these files to the default
state, simply delete them and build with `wails build`.
The directory contains the following files:
- `Info.plist` - the main plist file used for Mac builds. It is used when building using `wails build`.
- `Info.dev.plist` - same as the main plist file but used when building using `wails dev`.
- `Info.plist` - the main plist file used for Mac builds. It is used when
building using `wails build`.
- `Info.dev.plist` - same as the main plist file but used when building using
`wails dev`.
## Windows
The `windows` directory contains the manifest and rc files used when building with `wails build`.
These may be customised for your application. To return these files to the default state, simply delete them and
build with `wails build`.
The `windows` directory contains the manifest and rc files used when building
with `wails build`. These may be customised for your application. To return
these files to the default state, simply delete them and build with
`wails build`.
- `icon.ico` - The icon used for the application. This is used when building using `wails build`. If you wish to
use a different icon, simply replace this file with your own. If it is missing, a new `icon.ico` file
will be created using the `appicon.png` file in the build directory.
- `installer/*` - The files used to create the Windows installer. These are used when building using `wails build`.
- `info.json` - Application details used for Windows builds. The data here will be used by the Windows installer,
as well as the application itself (right click the exe -> properties -> details)
- `wails.exe.manifest` - The main application manifest file.
- `icon.ico` - The icon used for the application. This is used when building
using `wails build`. If you wish to use a different icon, simply replace this
file with your own. If it is missing, a new `icon.ico` file will be created
using the `appicon.png` file in the build directory.
- `installer/*` - The files used to create the Windows installer. These are used
when building using `wails build`.
- `info.json` - Application details used for Windows builds. The data here will
be used by the Windows installer, as well as the application itself (right
click the exe -> properties -> details)
- `wails.exe.manifest` - The main application manifest file.

View file

@ -1,17 +1,21 @@
# go-webview2
This is a proof of concept for embedding Webview2 into Go without CGo. It is based
on [webview/webview](https://github.com/webview/webview) and provides a compatible API.
This is a proof of concept for embedding Webview2 into Go without CGo. It is
based on [webview/webview](https://github.com/webview/webview) and provides a
compatible API.
## Notice
Because this version doesn't currently have an EdgeHTML fallback, it will not work unless you have a Webview2 runtime
installed. In addition, it requires the Webview2Loader DLL in order to function. Adding an EdgeHTML fallback should be
technically possible but will likely require much worse hacks since the API is not strictly COM to my knowledge.
Because this version doesn't currently have an EdgeHTML fallback, it will not
work unless you have a Webview2 runtime installed. In addition, it requires the
Webview2Loader DLL in order to function. Adding an EdgeHTML fallback should be
technically possible but will likely require much worse hacks since the API is
not strictly COM to my knowledge.
## Demo
For now, you'll need to install the Webview2 runtime, as it does not ship with Windows.
For now, you'll need to install the Webview2 runtime, as it does not ship with
Windows.
[WebView2 runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/)
@ -23,5 +27,6 @@ go run go-webview2/cmd/demo
This will use go-winloader to load an embedded copy of WebView2Loader.dll.
If this does not work, please try running from a directory that has an appropriate copy of `WebView2Loader.dll` for your
GOARCH. If _that_ worked, *please* file a bug so we can figure out what's wrong with go-winloader :)
If this does not work, please try running from a directory that has an
appropriate copy of `WebView2Loader.dll` for your GOARCH. If _that_ worked,
_please_ file a bug so we can figure out what's wrong with go-winloader :)

View file

@ -1,9 +1,11 @@
# Webviewloader
Webviewloader is a port of [OpenWebView2Loader](https://github.com/jchv/OpenWebView2Loader) to Go.
Webviewloader is a port of
[OpenWebView2Loader](https://github.com/jchv/OpenWebView2Loader) to Go.
It is intended to be feature-complete with the original WebView2Loader distributed with
the WebView2 NuGet package, but some features are intentionally not implemented.
It is intended to be feature-complete with the original WebView2Loader
distributed with the WebView2 NuGet package, but some features are intentionally
not implemented.
## Status
@ -16,4 +18,5 @@ the WebView2 NuGet package, but some features are intentionally not implemented.
- Registry Overrides of Parameters
- Env Variable Overrides of Parameters
- Does not incorporate `GetCurrentPackageInfo` to search for an installed runtime
- Does not incorporate `GetCurrentPackageInfo` to search for an installed
runtime

View file

@ -1,10 +1,11 @@
# winc
** This is a fork of [tadvi/winc](https://github.com/tadvi/winc) for the sole purpose of integration
with [Wails](https://github.com/wailsapp/wails). This repository comes with ***no support*** **
** This is a fork of [tadvi/winc](https://github.com/tadvi/winc) for the sole
purpose of integration with [Wails](https://github.com/wailsapp/wails). This
repository comes with \***no support**\* **
Common library for Go GUI apps on Windows. It is for Windows OS only. This makes library smaller than some other UI
libraries for Go.
Common library for Go GUI apps on Windows. It is for Windows OS only. This makes
library smaller than some other UI libraries for Go.
Design goals: minimalism and simplicity.
@ -14,9 +15,10 @@ No other dependencies except Go standard library.
## Building
If you want to package icon files and other resources into binary **rsrc** tool is recommended:
If you want to package icon files and other resources into binary **rsrc** tool
is recommended:
rsrc -manifest app.manifest -ico=app.ico,application_edit.ico,application_error.ico -o rsrc.syso
rsrc -manifest app.manifest -ico=app.ico,application_edit.ico,application_error.ico -o rsrc.syso
Here app.manifest is XML file in format:
@ -32,19 +34,20 @@ Here app.manifest is XML file in format:
</assembly>
```
Most Windows applications do not display command prompt. Build your Go project with flag to indicate that it is Windows
GUI binary:
Most Windows applications do not display command prompt. Build your Go project
with flag to indicate that it is Windows GUI binary:
go build -ldflags="-H windowsgui"
go build -ldflags="-H windowsgui"
## Samples
Best way to learn how to use the library is to look at the included **examples** projects.
Best way to learn how to use the library is to look at the included **examples**
projects.
## Setup
1. Make sure you have a working Go installation and build environment, see more for details on page below.
http://golang.org/doc/install
1. Make sure you have a working Go installation and build environment, see more
for details on page below. http://golang.org/doc/install
2. go get github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc
@ -69,38 +72,46 @@ const myIcon = 13
btn.SetResIcon(myIcon) // Set icon on the button.
```
Included source **examples** use basic building via `release.bat` files. Note that icon IDs are order dependent. So if
you change they order in -ico flag then icon IDs will be different. If you want to keep order the same, just add new
Included source **examples** use basic building via `release.bat` files. Note
that icon IDs are order dependent. So if you change they order in -ico flag then
icon IDs will be different. If you want to keep order the same, just add new
icons to the end of -ico comma separated list.
## Layout Manager
SimpleDock is default layout manager.
Current design of docking and split views allows building simple apps but if you need to have multiple split views in
few different directions you might need to create your own layout manager.
Current design of docking and split views allows building simple apps but if you
need to have multiple split views in few different directions you might need to
create your own layout manager.
Important point is to have **one** control inside SimpleDock set to dock as **Fill**. Controls that are not set to any
docking get placed using SetPos() function. So you can have Panel set to dock at the Top and then have another dock to
arrange controls inside that Panel or have controls placed using SetPos() at fixed positions.
Important point is to have **one** control inside SimpleDock set to dock as
**Fill**. Controls that are not set to any docking get placed using SetPos()
function. So you can have Panel set to dock at the Top and then have another
dock to arrange controls inside that Panel or have controls placed using
SetPos() at fixed positions.
![Example layout with two toolbars and status bar](dock_topbottom.png)
This is basic layout. Instead of toolbars and status bar you can have Panel or any other control that can resize. Panel
can have its own internal Dock that will arrange other controls inside of it.
This is basic layout. Instead of toolbars and status bar you can have Panel or
any other control that can resize. Panel can have its own internal Dock that
will arrange other controls inside of it.
![Example layout with two toolbars and navigation on the left](dock_topleft.png)
This is layout with extra control(s) on the left. Left side is usually treeview or listview.
This is layout with extra control(s) on the left. Left side is usually treeview
or listview.
The rule is simple: you either dock controls using SimpleDock OR use SetPos() to set them at fixed positions. That's it.
The rule is simple: you either dock controls using SimpleDock OR use SetPos() to
set them at fixed positions. That's it.
At some point **winc** may get more sophisticated layout manager.
## Dialog Screens
Dialog screens are not based on Windows resource files (.rc). They are just windows with controls placed at fixed
coordinates. This works fine for dialog screens up to 10-14 controls.
Dialog screens are not based on Windows resource files (.rc). They are just
windows with controls placed at fixed coordinates. This works fine for dialog
screens up to 10-14 controls.
# Minimal Demo
@ -151,16 +162,18 @@ Result of running sample_minimal.
## Create Your Own
It is good practice to create your own controls based on existing structures and event model. Library contains some of
the controls built that way: IconButton (button.go), ErrorPanel (panel.go), MultiEdit (edit.go), etc. Please look at
It is good practice to create your own controls based on existing structures and
event model. Library contains some of the controls built that way: IconButton
(button.go), ErrorPanel (panel.go), MultiEdit (edit.go), etc. Please look at
existing controls as examples before building your own.
When designing your own controls keep in mind that types have to be converted from Go into Win32 API and back. This is
usually due to string UTF8 and UTF16 conversions. But there are other types of conversions too.
When designing your own controls keep in mind that types have to be converted
from Go into Win32 API and back. This is usually due to string UTF8 and UTF16
conversions. But there are other types of conversions too.
When developing your own controls you might also need to:
import "github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc/w32"
import "github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc/w32"
w32 has Win32 API low level constants and functions.
@ -176,6 +189,5 @@ This library is built on
[AllenDang/gform Windows GUI framework for Go](https://github.com/AllenDang/gform)
**winc** takes most design decisions from **gform** and adds many more controls and code samples to it.
**winc** takes most design decisions from **gform** and adds many more controls
and code samples to it.

View file

@ -2,30 +2,36 @@
[Project Home](https://github.com/harry1453/go-common-file-dialog)
This library contains bindings for Windows Vista and
newer's [Common File Dialogs](https://docs.microsoft.com/en-us/windows/win32/shell/common-file-dialog), which is the
standard system dialog for selecting files or folders to open or save.
This library contains bindings for Windows Vista and newer's
[Common File Dialogs](https://docs.microsoft.com/en-us/windows/win32/shell/common-file-dialog),
which is the standard system dialog for selecting files or folders to open or
save.
The Common File Dialogs have to be accessed via
the [COM Interface](https://en.wikipedia.org/wiki/Component_Object_Model), normally via C++ or via bindings (like in C#)
.
The Common File Dialogs have to be accessed via the
[COM Interface](https://en.wikipedia.org/wiki/Component_Object_Model), normally
via C++ or via bindings (like in C#) .
This library contains bindings for Golang. **It does not require CGO**, and contains empty stubs for non-windows
platforms (so is safe to compile and run on platforms other than windows, but will just return errors at runtime).
This library contains bindings for Golang. **It does not require CGO**, and
contains empty stubs for non-windows platforms (so is safe to compile and run on
platforms other than windows, but will just return errors at runtime).
This can be very useful if you want to quickly get a file selector in your Golang application. The `cfdutil` package
contains utility functions with a single call to open and configure a dialog, and then get the result from it. Examples
for this are in [`_examples/usingutil`](_examples/usingutil). Or, if you want finer control over the dialog's operation,
you can use the base package. Examples for this are in [`_examples/notusingutil`](_examples/notusingutil).
This can be very useful if you want to quickly get a file selector in your
Golang application. The `cfdutil` package contains utility functions with a
single call to open and configure a dialog, and then get the result from it.
Examples for this are in [`_examples/usingutil`](_examples/usingutil). Or, if
you want finer control over the dialog's operation, you can use the base
package. Examples for this are in
[`_examples/notusingutil`](_examples/notusingutil).
This library is available under the MIT license.
Currently supported features:
* Open File Dialog (to open a single file)
* Open Multiple Files Dialog (to open multiple files)
* Open Folder Dialog
* Save File Dialog
* Dialog "roles" to allow Windows to remember different "last locations" for different types of dialog
* Set dialog Title, Default Folder and Initial Folder
* Set dialog File Filters
- Open File Dialog (to open a single file)
- Open Multiple Files Dialog (to open multiple files)
- Open Folder Dialog
- Save File Dialog
- Dialog "roles" to allow Windows to remember different "last locations" for
different types of dialog
- Set dialog Title, Default Folder and Initial Folder
- Set dialog File Filters

View file

@ -4,15 +4,17 @@
This is the official Wails Vanilla template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -1,2 +1,2 @@
Based on: https://github.com/tkrajina/typescriptify-golang-structs
License: LICENSE.txt
Based on: https://github.com/tkrajina/typescriptify-golang-structs License:
LICENSE.txt

View file

@ -1,35 +1,41 @@
# Build Directory
The build directory is used to house all the build files and assets for your application.
The build directory is used to house all the build files and assets for your
application.
The structure is:
* bin - Output directory
* darwin - macOS specific files
* windows - Windows specific files
- bin - Output directory
- darwin - macOS specific files
- windows - Windows specific files
## Mac
The `darwin` directory holds files specific to Mac builds.
These may be customised and used as part of the build. To return these files to the default state, simply delete them
and
build with `wails build`.
The `darwin` directory holds files specific to Mac builds. These may be
customised and used as part of the build. To return these files to the default
state, simply delete them and build with `wails build`.
The directory contains the following files:
- `Info.plist` - the main plist file used for Mac builds. It is used when building using `wails build`.
- `Info.dev.plist` - same as the main plist file but used when building using `wails dev`.
- `Info.plist` - the main plist file used for Mac builds. It is used when
building using `wails build`.
- `Info.dev.plist` - same as the main plist file but used when building using
`wails dev`.
## Windows
The `windows` directory contains the manifest and rc files used when building with `wails build`.
These may be customised for your application. To return these files to the default state, simply delete them and
build with `wails build`.
The `windows` directory contains the manifest and rc files used when building
with `wails build`. These may be customised for your application. To return
these files to the default state, simply delete them and build with
`wails build`.
- `icon.ico` - The icon used for the application. This is used when building using `wails build`. If you wish to
use a different icon, simply replace this file with your own. If it is missing, a new `icon.ico` file
will be created using the `appicon.png` file in the build directory.
- `installer/*` - The files used to create the Windows installer. These are used when building using `wails build`.
- `info.json` - Application details used for Windows builds. The data here will be used by the Windows installer,
as well as the application itself (right click the exe -> properties -> details)
- `wails.exe.manifest` - The main application manifest file.
- `icon.ico` - The icon used for the application. This is used when building
using `wails build`. If you wish to use a different icon, simply replace this
file with your own. If it is missing, a new `icon.ico` file will be created
using the `appicon.png` file in the build directory.
- `installer/*` - The files used to create the Windows installer. These are used
when building using `wails build`.
- `info.json` - Application details used for Windows builds. The data here will
be used by the Windows installer, as well as the application itself (right
click the exe -> properties -> details)
- `wails.exe.manifest` - The main application manifest file.

View file

@ -3,27 +3,34 @@
NOTE: Currently, this is a Mac only feature.
Place any PNG file in this directory to be able to use them in message dialogs.
The files should have names in the following format: `name[-(light|dark)][2x].png`
The files should have names in the following format:
`name[-(light|dark)][2x].png`
Examples:
* `mypic.png` - Standard definition icon with ID `mypic`
* `mypic-light.png` - Standard definition icon with ID `mypic`, used when system theme is light
* `mypic-dark.png` - Standard definition icon with ID `mypic`, used when system theme is dark
* `mypic2x.png` - High definition icon with ID `mypic`
* `mypic-light2x.png` - High definition icon with ID `mypic`, used when system theme is light
* `mypic-dark2x.png` - High definition icon with ID `mypic`, used when system theme is dark
- `mypic.png` - Standard definition icon with ID `mypic`
- `mypic-light.png` - Standard definition icon with ID `mypic`, used when system
theme is light
- `mypic-dark.png` - Standard definition icon with ID `mypic`, used when system
theme is dark
- `mypic2x.png` - High definition icon with ID `mypic`
- `mypic-light2x.png` - High definition icon with ID `mypic`, used when system
theme is light
- `mypic-dark2x.png` - High definition icon with ID `mypic`, used when system
theme is dark
### Order of preference
Icons are selected with the following order of preference:
For High Definition displays:
* name-(theme)2x.png
* name2x.png
* name-(theme).png
* name.png
- name-(theme)2x.png
- name2x.png
- name-(theme).png
- name.png
For Standard Definition displays:
* name-(theme).png
* name.png
- name-(theme).png
- name.png

View file

@ -1,8 +1,8 @@
## Tray
Place any PNG file in this directory to be able to use them as tray icons.
The name of the filename will be the ID to reference the image.
Place any PNG file in this directory to be able to use them as tray icons. The
name of the filename will be the ID to reference the image.
Example:
* `mypic.png` - May be referenced using `runtime.Tray.SetIcon("mypic")`
- `mypic.png` - May be referenced using `runtime.Tray.SetIcon("mypic")`

View file

@ -4,7 +4,7 @@ Menu support is heavily inspired by Electron's approach.
## Features
* Supports Text, Checkbox, Radio, Submenu and Separator
* Radio groups are defined as any number of adjacent radio items
* UTF-8 menu labels
* UTF-8 menu IDs
- Supports Text, Checkbox, Radio, Submenu and Separator
- Radio groups are defined as any number of adjacent radio items
- UTF-8 menu labels
- UTF-8 menu IDs

View file

@ -4,15 +4,17 @@
This is the official Wails $NAME template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -1,4 +1,5 @@
This template uses a work around as the default template does not compile due to this issue:
https://github.com/vuejs/core/issues/1228
This template uses a work around as the default template does not compile due to
this issue: https://github.com/vuejs/core/issues/1228
In `tsconfig.json`, `isolatedModules` is set to `false` rather than `true` to work around the issue.
In `tsconfig.json`, `isolatedModules` is set to `false` rather than `true` to
work around the issue.

View file

@ -4,15 +4,16 @@
This template uses plain JS / HTML and CSS.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. The frontend dev server will run
on http://localhost:34115. Open this in your browser to connect to your application.
To run in live development mode, run `wails dev` in the project directory. The
frontend dev server will run on http://localhost:34115. Open this in your
browser to connect to your application.
## Building
For a production build, use `wails build`.

View file

@ -4,15 +4,17 @@
This is the official Wails Lit-TS template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -4,15 +4,17 @@
This is the official Wails Lit template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -4,15 +4,17 @@
This template uses plain JS / HTML and CSS.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -4,15 +4,17 @@
This is the official Wails Preact-TS template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -4,15 +4,17 @@
This is the official Wails Preact template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -4,15 +4,17 @@
This is the official Wails React-TS template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -4,15 +4,17 @@
This is the official Wails React template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -6,10 +6,11 @@ This is the official Wails Svelte-TS template.
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -1,65 +1,77 @@
# Svelte + TS + Vite
This template should help get you started developing with Svelte and TypeScript in Vite.
This template should help get you started developing with Svelte and TypeScript
in Vite.
## Recommended IDE Setup
[VS Code](https://code.visualstudio.com/)
+ [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
- [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
## Need an official Svelte framework?
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its
serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less,
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also
powered by Vite. Deploy anywhere with its serverless-first approach and adapt to
various platforms, with out of the box support for TypeScript, SCSS, and Less,
and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
## Technical considerations
**Why use this over SvelteKit?**
- It brings its own routing solution which might not be preferable for some users.
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
`vite dev` and `vite build` wouldn't work in a SvelteKit environment, for example.
- It brings its own routing solution which might not be preferable for some
users.
- It is first and foremost a framework that just happens to use Vite under the
hood, not a Vite app. `vite dev` and `vite build` wouldn't work in a SvelteKit
environment, for example.
This template contains as little as possible to get started with Vite + TypeScript + Svelte, while taking into account
the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the
other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte
project.
This template contains as little as possible to get started with Vite +
TypeScript + Svelte, while taking into account the developer experience with
regards to HMR and intellisense. It demonstrates capabilities on par with the
other `create-vite` templates and is a good starting point for beginners dipping
their toes into a Vite + Svelte project.
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been
structured similarly to SvelteKit so that it is easy to migrate.
Should you later need the extended capabilities and extensibility provided by
SvelteKit, the template has been structured similarly to SvelteKit so that it is
easy to migrate.
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or
`tsconfig.json`?**
Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash
references keeps the default TypeScript setting of accepting type information from the entire workspace, while also
Setting `compilerOptions.types` shuts out all other types not explicitly listed
in the configuration. Using triple-slash references keeps the default TypeScript
setting of accepting type information from the entire workspace, while also
adding `svelte` and `vite/client` type information.
**Why include `.vscode/extensions.json`?**
Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to
install the recommended extension upon opening the project.
Other templates indirectly recommend extensions via the README, but this file
allows VS Code to prompt the user to install the recommended extension upon
opening the project.
**Why enable `allowJs` in the TS template?**
While `allowJs: false` would indeed prevent the use of `.js` files in the project, it does not prevent the use of
JavaScript syntax in `.svelte` files. In addition, it would force `checkJs: false`, bringing the worst of both worlds:
not being able to guarantee the entire codebase is TypeScript, and also having worse typechecking for the existing
JavaScript. In addition, there are valid use cases in which a mixed codebase may be relevant.
While `allowJs: false` would indeed prevent the use of `.js` files in the
project, it does not prevent the use of JavaScript syntax in `.svelte` files. In
addition, it would force `checkJs: false`, bringing the worst of both worlds:
not being able to guarantee the entire codebase is TypeScript, and also having
worse typechecking for the existing JavaScript. In addition, there are valid use
cases in which a mixed codebase may be relevant.
**Why is HMR not preserving my local component state?**
HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr`
and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the
details [here](https://github.com/rixo/svelte-hmr#svelte-hmr).
HMR state preservation comes with a number of gotchas! It has been disabled by
default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often
surprising behavior. You can read the details
[here](https://github.com/rixo/svelte-hmr#svelte-hmr).
If you have state that's important to retain within a component, consider creating an external store which would not be
replaced by HMR.
If you have state that's important to retain within a component, consider
creating an external store which would not be replaced by HMR.
```ts
// store.ts
// An extremely simple external store
import { writable } from 'svelte/store'
export default writable(0)
import { writable } from "svelte/store";
export default writable(0);
```

View file

@ -6,10 +6,11 @@ This is the official Wails Svelte template.
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -6,58 +6,69 @@ This template should help get you started developing with Svelte in Vite.
[VS Code](https://code.visualstudio.com/)
+ [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
- [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
## Need an official Svelte framework?
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its
serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less,
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also
powered by Vite. Deploy anywhere with its serverless-first approach and adapt to
various platforms, with out of the box support for TypeScript, SCSS, and Less,
and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
## Technical considerations
**Why use this over SvelteKit?**
- It brings its own routing solution which might not be preferable for some users.
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
`vite dev` and `vite build` wouldn't work in a SvelteKit environment, for example.
- It brings its own routing solution which might not be preferable for some
users.
- It is first and foremost a framework that just happens to use Vite under the
hood, not a Vite app. `vite dev` and `vite build` wouldn't work in a SvelteKit
environment, for example.
This template contains as little as possible to get started with Vite + Svelte, while taking into account the developer
experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite`
templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.
This template contains as little as possible to get started with Vite + Svelte,
while taking into account the developer experience with regards to HMR and
intellisense. It demonstrates capabilities on par with the other `create-vite`
templates and is a good starting point for beginners dipping their toes into a
Vite + Svelte project.
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been
structured similarly to SvelteKit so that it is easy to migrate.
Should you later need the extended capabilities and extensibility provided by
SvelteKit, the template has been structured similarly to SvelteKit so that it is
easy to migrate.
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or
`tsconfig.json`?**
Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash
references keeps the default TypeScript setting of accepting type information from the entire workspace, while also
Setting `compilerOptions.types` shuts out all other types not explicitly listed
in the configuration. Using triple-slash references keeps the default TypeScript
setting of accepting type information from the entire workspace, while also
adding `svelte` and `vite/client` type information.
**Why include `.vscode/extensions.json`?**
Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to
install the recommended extension upon opening the project.
Other templates indirectly recommend extensions via the README, but this file
allows VS Code to prompt the user to install the recommended extension upon
opening the project.
**Why enable `checkJs` in the JS template?**
It is likely that most cases of changing variable types in runtime are likely to be accidental, rather than deliberate.
This provides advanced typechecking out of the box. Should you like to take advantage of the dynamically-typed nature of
It is likely that most cases of changing variable types in runtime are likely to
be accidental, rather than deliberate. This provides advanced typechecking out
of the box. Should you like to take advantage of the dynamically-typed nature of
JavaScript, it is trivial to change the configuration.
**Why is HMR not preserving my local component state?**
HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr`
and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the
details [here](https://github.com/rixo/svelte-hmr#svelte-hmr).
HMR state preservation comes with a number of gotchas! It has been disabled by
default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often
surprising behavior. You can read the details
[here](https://github.com/rixo/svelte-hmr#svelte-hmr).
If you have state that's important to retain within a component, consider creating an external store which would not be
replaced by HMR.
If you have state that's important to retain within a component, consider
creating an external store which would not be replaced by HMR.
```js
// store.js
// An extremely simple external store
import { writable } from 'svelte/store'
export default writable(0)
import { writable } from "svelte/store";
export default writable(0);
```

View file

@ -4,15 +4,17 @@
This is the official Wails Vanilla-TS template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -4,15 +4,17 @@
This is the official Wails Vanilla template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -4,15 +4,17 @@
This is the official Wails Vue-TS template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -1,4 +1,5 @@
This template uses a work around as the default template does not compile due to this issue:
https://github.com/vuejs/core/issues/1228
This template uses a work around as the default template does not compile due to
this issue: https://github.com/vuejs/core/issues/1228
In `tsconfig.json`, `isolatedModules` is set to `false` rather than `true` to work around the issue.
In `tsconfig.json`, `isolatedModules` is set to `false` rather than `true` to
work around the issue.

View file

@ -1,23 +1,30 @@
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue
3 `<script setup>` SFCs, check out
the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
This template should help get you started developing with Vue 3 and TypeScript
in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the
[script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup)
to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
- [VS Code](https://code.visualstudio.com/) +
[Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
## Type Support For `.vue` Imports in TS
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type
by default. In most cases this is fine if you don't really care about component prop types outside of templates.
However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using
manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
Since TypeScript cannot handle type information for `.vue` imports, they are
shimmed to be a generic Vue component type by default. In most cases this is
fine if you don't really care about component prop types outside of templates.
However, if you wish to get actual prop types in `.vue` imports (for example to
get props validation when using manual `h(...)` calls), you can enable Volar's
Take Over mode by following these steps:
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look
for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default,
Take Over mode will enable itself if the default TypeScript extension is disabled.
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette,
look for `TypeScript and JavaScript Language Features`, then right click and
select `Disable (Workspace)`. By default, Take Over mode will enable itself
if the default TypeScript extension is disabled.
2. Reload the VS Code window by running `Developer: Reload Window` from the
command palette.
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
You can learn more about Take Over mode
[here](https://github.com/johnsoncodehk/volar/discussions/471).

View file

@ -4,15 +4,17 @@
This is the official Wails Vue template.
You can configure the project by editing `wails.json`. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
You can configure the project by editing `wails.json`. More information about
the project settings can be found here:
https://wails.io/docs/reference/project-config
## Live Development
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
To run in live development mode, run `wails dev` in the project directory. This
will run a Vite development server that will provide very fast hot reload of
your frontend changes. If you want to develop in a browser and have access to
your Go methods, there is also a dev server that runs on http://localhost:34115.
Connect to this in your browser, and you can call your Go code from devtools.
## Building

View file

@ -1,8 +1,11 @@
# Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs,
check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
This template should help get you started developing with Vue 3 in Vite. The
template uses Vue 3 `<script setup>` SFCs, check out the
[script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup)
to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
- [VS Code](https://code.visualstudio.com/) +
[Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)

View file

@ -1,3 +1,4 @@
# v3
This directory is experimental. It probably won't work for you. There's no support for this directory. Dragons be here. You have been warned!
This directory is experimental. It probably won't work for you. There's no
support for this directory. Dragons be here. You have been warned!

View file

@ -46,4 +46,4 @@ Informal and incomplete list of things needed in v3.
## Plugins
- [ ] Move logins to `v3/plugins`
- [ ] Expose application logger to plugins
- [ ] Expose application logger to plugins

View file

@ -10,46 +10,74 @@ In v3, there are 3 types of events:
### Application Events
Application events are events that are emitted by the application. These events include native events such as `ApplicationDidFinishLaunching` on macOS.
Application events are events that are emitted by the application. These events
include native events such as `ApplicationDidFinishLaunching` on macOS.
### Window Events
Window events are events that are emitted by a window. These events include native events such as `WindowDidBecomeMain` on macOS.
Window events are events that are emitted by a window. These events include
native events such as `WindowDidBecomeMain` on macOS.
### Custom Events
Events that the user defines are called `WailsEvents`. This is to differentiate them from the `Event` object that is used to communicate with the browser. WailsEvents are now objects that encapsulate all the details of an event. This includes the event name, the data, and the source of the event.
Events that the user defines are called `WailsEvents`. This is to differentiate
them from the `Event` object that is used to communicate with the browser.
WailsEvents are now objects that encapsulate all the details of an event. This
includes the event name, the data, and the source of the event.
The data associated with a WailsEvent is now a single value. If multiple values are required, then a struct can be used.
The data associated with a WailsEvent is now a single value. If multiple values
are required, then a struct can be used.
### Event callbacks and `Emit` function signature
The signatures events callbacks (as used by `On`, `Once` & `OnMultiple`) have changed. In v2, the callback function received optional data. In v3, the callback function receives a `WailsEvent` object that contains all data related to the event.
The signatures events callbacks (as used by `On`, `Once` & `OnMultiple`) have
changed. In v2, the callback function received optional data. In v3, the
callback function receives a `WailsEvent` object that contains all data related
to the event.
Similarly, the `Emit` function has changed. Instead of taking a name and optional data, it now takes a single `WailsEvent` object that it will emit.
Similarly, the `Emit` function has changed. Instead of taking a name and
optional data, it now takes a single `WailsEvent` object that it will emit.
### `Off` and `OffAll`
In v2, `Off` and `OffAll` calls would remove events in both JS and Go. Due to the multi-window nature of v3, this has been changed so that these methods only apply to the context they are called in. For example, if you call `Off` in a window, it will only remove events for that window. If you use `Off` in Go, it will only remove events for Go.
In v2, `Off` and `OffAll` calls would remove events in both JS and Go. Due to
the multi-window nature of v3, this has been changed so that these methods only
apply to the context they are called in. For example, if you call `Off` in a
window, it will only remove events for that window. If you use `Off` in Go, it
will only remove events for Go.
### Logging
There was a lot of requests for different types of logging in v2 so for v3 we have simplified things to make it as customisable as you want. There is now a single call `Log` that takes a LogMessage object. This object contains the message, the level, and the source, the log message and any data to be printed out. The default logger is the Console logger, however any number of outputs to log to can be added. Simply add custom loggers to the `options.Application.Logger.CustomLoggers` slice. The default logger does not have log level filtering, however custom loggers can be added that do.
There was a lot of requests for different types of logging in v2 so for v3 we
have simplified things to make it as customisable as you want. There is now a
single call `Log` that takes a LogMessage object. This object contains the
message, the level, and the source, the log message and any data to be printed
out. The default logger is the Console logger, however any number of outputs to
log to can be added. Simply add custom loggers to the
`options.Application.Logger.CustomLoggers` slice. The default logger does not
have log level filtering, however custom loggers can be added that do.
### Developer notes
When emitting an event in Go, it will dispatch the event to local Go listeners and also each window in the application.
When emitting an event in JS, it now sends the event to the application. This will be processed as if it was emitted in Go, however the sender ID will be that of the window.
When emitting an event in Go, it will dispatch the event to local Go listeners
and also each window in the application. When emitting an event in JS, it now
sends the event to the application. This will be processed as if it was emitted
in Go, however the sender ID will be that of the window.
## Window
The Window API has largely remained the same, however the methods are now on an instance of a window rather than the runtime.
Some notable differences are:
- Windows now have a Name that identifies them. This is used to identify the window when emitting events.
The Window API has largely remained the same, however the methods are now on an
instance of a window rather than the runtime. Some notable differences are:
- Windows now have a Name that identifies them. This is used to identify the
window when emitting events.
## ClipBoard
The clipboard API has been simplified. There is now a single `Clipboard` object that can be used to read and write to the clipboard. The `Clipboard` object is available in both Go and JS. `SetText()` to set the text and `Text()` to get the text.
The clipboard API has been simplified. There is now a single `Clipboard` object
that can be used to read and write to the clipboard. The `Clipboard` object is
available in both Go and JS. `SetText()` to set the text and `Text()` to get the
text.
## Bindings
@ -57,44 +85,70 @@ TBD
## Dialogs
Dialogs are now available in JavaScript!
Dialogs are now available in JavaScript!
## Drag and Drop
Native drag and drop can be enabled per-window. Simply set the `EnableDragAndDrop` window config option to `true` and the window will allow files to be dragged onto it. When this happens, the `events.FilesDropped` event will be emitted. The filenames can then be retrieved from the WindowEventContext using the `DroppedFiles()` method. This returns a slice of strings containing the filenames.
Native drag and drop can be enabled per-window. Simply set the
`EnableDragAndDrop` window config option to `true` and the window will allow
files to be dragged onto it. When this happens, the `events.FilesDropped` event
will be emitted. The filenames can then be retrieved from the WindowEventContext
using the `DroppedFiles()` method. This returns a slice of strings containing
the filenames.
## Context Menus
Context menus are contextual menus that are shown when the user right-clicks on an element. Creating a context menu is the same as creating a standard menu , by using `app.NewMenu()`. To make the context menu available to a window, call `window.RegisterContextMenu(name, menu)`. The name will be the id of the context menu and used by the frontend.
Context menus are contextual menus that are shown when the user right-clicks on
an element. Creating a context menu is the same as creating a standard menu , by
using `app.NewMenu()`. To make the context menu available to a window, call
`window.RegisterContextMenu(name, menu)`. The name will be the id of the context
menu and used by the frontend.
To indicate that an element has a context menu, add the `data-contextmenu` attribute to the element. The value of this attribute should be the name of a context menu previously registered with the window.
To indicate that an element has a context menu, add the `data-contextmenu`
attribute to the element. The value of this attribute should be the name of a
context menu previously registered with the window.
It is possible to register a context menu at the application level, making it available to all windows. This can be done using `app.RegisterContextMenu(name, menu)`. If a context menu cannot be found at the window level, the application context menus will be checked. A demo of this can be found in `v3/examples/contextmenus`.
It is possible to register a context menu at the application level, making it
available to all windows. This can be done using
`app.RegisterContextMenu(name, menu)`. If a context menu cannot be found at the
window level, the application context menus will be checked. A demo of this can
be found in `v3/examples/contextmenus`.
## Wails Markup Language (WML)
The Wails Markup Language is a simple markup language that allows you to add functionality to standard HTML elements without the use of Javascript.
The Wails Markup Language is a simple markup language that allows you to add
functionality to standard HTML elements without the use of Javascript.
The following tags are currently supported:
### `data-wml-event`
### `data-wml-event`
This specifies that a Wails event will be emitted when the element is clicked. The value of the attribute should be the name of the event to emit.
This specifies that a Wails event will be emitted when the element is clicked.
The value of the attribute should be the name of the event to emit.
Example:
```html
<button data-wml-event="myevent">Click Me</button>
```
Sometimes you need the user to confirm an action. This can be done by adding the `data-wml-confirm` attribute to the element. The value of this attribute will be the message to display to the user.
Sometimes you need the user to confirm an action. This can be done by adding the
`data-wml-confirm` attribute to the element. The value of this attribute will be
the message to display to the user.
Example:
```html
<button data-wml-event="delete-all-items" data-wml-confirm="Are you sure?">Delete All Items</button>
<button data-wml-event="delete-all-items" data-wml-confirm="Are you sure?">
Delete All Items
</button>
```
### `data-wml-window`
Any `wails.window` method can be called by adding the `data-wml-window` attribute to an element. The value of the attribute should be the name of the method to call. The method name should be in the same case as the method.
Any `wails.window` method can be called by adding the `data-wml-window`
attribute to an element. The value of the attribute should be the name of the
method to call. The method name should be in the same case as the method.
```html
<button data-wml-window="Close">Close Window</button>
@ -102,10 +156,13 @@ Any `wails.window` method can be called by adding the `data-wml-window` attribut
### `data-wml-trigger`
This attribute specifies which javascript event should trigger the action. The default is `click`.
This attribute specifies which javascript event should trigger the action. The
default is `click`.
```html
<button data-wml-event="hover-box" data-wml-trigger="mouseover">Hover over me!</button>
<button data-wml-event="hover-box" data-wml-trigger="mouseover">
Hover over me!
</button>
```
## Plugins
@ -120,25 +177,28 @@ 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 `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 `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.
### Tips
@ -156,7 +216,8 @@ const (
)
```
Due to incompatibility between Go and JavaScript, custom types cannot be used in this way. The best strategy is to use a type alias for float64:
Due to incompatibility between Go and JavaScript, custom types cannot be used in
this way. The best strategy is to use a type alias for float64:
```go
type MyEnum = float64
@ -172,11 +233,14 @@ In Javascript, you can then use the following:
```js
const MyEnum = {
MyEnumOne: 0,
MyEnumTwo: 1,
MyEnumThree: 2
}
MyEnumOne: 0,
MyEnumTwo: 1,
MyEnumThree: 2,
};
```
- Why use `float64`? Can't we use `int`?
- Because JavaScript doesn't have a concept of `int`. Everything is a `number`, which translates to `float64` in Go. There are also restrictions on casting types in Go's reflection package, which means using `int` doesn't work.
- Why use `float64`? Can't we use `int`?
- Because JavaScript doesn't have a concept of `int`. Everything is a
`number`, which translates to `float64` in Go. There are also restrictions
on casting types in Go's reflection package, which means using `int` doesn't
work.

View file

@ -1,32 +1,34 @@
# The Wails CLI
The Wails CLI is a command line tool that allows you to create, build and run Wails applications.
There are a number of commands related to tooling, such as icon generation and asset bundling.
The Wails CLI is a command line tool that allows you to create, build and run
Wails applications. There are a number of commands related to tooling, such as
icon generation and asset bundling.
## Commands
### run
The run command is for running tasks defined in `Taskfile.yml`.
The run command is for running tasks defined in `Taskfile.yml`.
| Flag | Type | Description | Default |
|--------------------|--------|------------------------------------------------------|-----------------------|
| `-t` | string | The name of the task to run | |
| Flag | Type | Description | Default |
| ---- | ------ | --------------------------- | ------- |
| `-t` | string | The name of the task to run | |
### generate
The `generate` command is used to generate resources and assets for your Wails project.
It can be used to generate many things including:
- application icons,
- resource files for Windows applications
- Info.plist files for macOS deployments
The `generate` command is used to generate resources and assets for your Wails
project. It can be used to generate many things including:
- application icons,
- resource files for Windows applications
- Info.plist files for macOS deployments
#### icon
The `icon` command generates icons for your project.
The `icon` command generates icons for your project.
| Flag | Type | Description | Default |
|--------------------|--------|------------------------------------------------------|-----------------------|
| ------------------ | ------ | ---------------------------------------------------- | --------------------- |
| `-example` | bool | Generates example icon file (appicon.png) | |
| `-input` | string | The input image file | |
| `-sizes` | string | The sizes to generate in .ico file (comma separated) | "256,128,64,48,32,16" |
@ -34,11 +36,11 @@ The `icon` command generates icons for your project.
| `-macFilename` | string | The output filename for the Mac icon bundle | icons.icns |
```bash
wails generate icon -input myicon.png -sizes "32,64,128" -windowsFilename myicon.ico -macFilename myicon.icns
wails generate icon -input myicon.png -sizes "32,64,128" -windowsFilename myicon.ico -macFilename myicon.icns
```
This will generate icons for mac and windows and save them in the current directory as `myicon.ico`
and `myicons.icns`.
This will generate icons for mac and windows and save them in the current
directory as `myicon.ico` and `myicons.icns`.
#### syso
@ -48,35 +50,38 @@ The `syso` command generates a Windows resource file (aka `.syso`).
wails generate syso <options>
```
| Flag | Type | Description | Default |
|-------------|--------|--------------------------------------------|------------------|
| `-example` | bool | Generates example manifest & info files | |
| `-manifest` | string | The manifest file | |
| `-info` | string | The info.json file | |
| `-icon` | string | The icon file | |
| `-out` | string | The output filename for the syso file | `wails.exe.syso` |
| `-arch` | string | The target architecture (amd64,arm64,386) | `runtime.GOOS` |
| Flag | Type | Description | Default |
| ----------- | ------ | ----------------------------------------- | ---------------- |
| `-example` | bool | Generates example manifest & info files | |
| `-manifest` | string | The manifest file | |
| `-info` | string | The info.json file | |
| `-icon` | string | The icon file | |
| `-out` | string | The output filename for the syso file | `wails.exe.syso` |
| `-arch` | string | The target architecture (amd64,arm64,386) | `runtime.GOOS` |
If `-example` is provided, the command will generate example manifest and info files
in the current directory and exit.
If `-example` is provided, the command will generate example manifest and info
files in the current directory and exit.
If `-manifest` is provided, the command will use the provided manifest file to generate
the syso file.
If `-manifest` is provided, the command will use the provided manifest file to
generate the syso file.
If `-info` is provided, the command will use the provided info.json file to set the version
information in the syso file.
If `-info` is provided, the command will use the provided info.json file to set
the version information in the syso file.
NOTE: We use [winres](https://github.com/tc-hib/winres) to generate the syso file. Please
refer to the winres documentation for more information.
NOTE: We use [winres](https://github.com/tc-hib/winres) to generate the syso
file. Please refer to the winres documentation for more information.
NOTE: Whilst the tool will work for 32-bit Windows, it is not supported. Please use 64-bit.
NOTE: Whilst the tool will work for 32-bit Windows, it is not supported. Please
use 64-bit.
#### defaults
```bash
wails generate defaults
wails generate defaults
```
This will generate all the default assets and resources in the current directory.
This will generate all the default assets and resources in the current
directory.
#### bindings
@ -84,4 +89,4 @@ This will generate all the default assets and resources in the current directory
wails generate bindings
```
Generates bindings and models for your bound Go methods and structs.
Generates bindings and models for your bound Go methods and structs.

View file

@ -1,10 +1,11 @@
# Build
Wails has adopted [Taskfile](https://taskfile.dev) as its build tool. This is optional
and any build tool can be used. However, Taskfile is a great tool, and we recommend it.
Wails has adopted [Taskfile](https://taskfile.dev) as its build tool. This is
optional and any build tool can be used. However, Taskfile is a great tool, and
we recommend it.
The Wails CLI has built-in integration with Taskfile so the standalone version is not a
requirement.
The Wails CLI has built-in integration with Taskfile so the standalone version
is not a requirement.
## Building

View file

@ -15,17 +15,19 @@ Add the plugin to the `Plugins` option in the Applications options:
You can then call the Generate method from the frontend:
```js
wails.Plugin("hashes","Generate","hello world").then((result) => console.log(result))
wails
.Plugin("hashes", "Generate", "hello world")
.then((result) => console.log(result));
```
This method returns a struct with the following fields:
```typescript
interface Hashes {
md5: string;
sha1: string;
sha256: string;
}
interface Hashes {
md5: string;
sha1: string;
sha256: string;
}
```
A TypeScript definition file is provided for this interface.

View file

@ -1,6 +1,7 @@
# Parser
This package contains the static analyser used for parsing Wails projects so that we may:
This package contains the static analyser used for parsing Wails projects so
that we may:
- Generate the bindings for the frontend
- Generate Typescript definitions for the structs used by the bindings
@ -8,6 +9,7 @@ This package contains the static analyser used for parsing Wails projects so tha
## Implemented
- [ ] Bound types
- [x] Struct Literal Pointer
- [ ] Variable
- [ ] Assignment
@ -38,7 +40,7 @@ This package contains the static analyser used for parsing Wails projects so tha
- [x] Pointer
- [x] Struct
- [x] Pointer
- [x] Slices
- [x] Slices
- [x] Pointer
- [x] Maps
- [x] Pointer
@ -61,8 +63,9 @@ This package contains the static analyser used for parsing Wails projects so tha
## Limitations
There are many ways to write a Go program so there are many program structures that we would need to support. This is a work in progress and will be improved over time. The current limitations are:
There are many ways to write a Go program so there are many program structures
that we would need to support. This is a work in progress and will be improved
over time. The current limitations are:
- The call to `application.New()` must be in the `main` package
- Bound structs must be declared as struct literals

View file

@ -1,7 +1,7 @@
# Next Steps
Congratulations on generating a plugin. This guide will help you author your plugin
and provide some tips on how to get started.
Congratulations on generating a plugin. This guide will help you author your
plugin and provide some tips on how to get started.
## Plugin Structure
@ -15,17 +15,19 @@ type Plugin interface {
}
```
The `Name()` method returns the name of the plugin. It should follow the Go module naming convention
and have a prefix of `wails-plugin-`, e.g. `github.com/myuser/wails-plugin-example`.
The `Name()` method returns the name of the plugin. It should follow the Go
module naming convention and have a prefix of `wails-plugin-`, e.g.
`github.com/myuser/wails-plugin-example`.
The `Init()` method is called when the plugin is loaded. The `App` parameter is a pointer to the
main application struct. This may be used for showing dialogs, listening for events or even opening
new windows. The `Init()` method should return an error if it fails to initialise. This method is
called synchronously so the application will not start until it returns.
The `Init()` method is called when the plugin is loaded. The `App` parameter is
a pointer to the main application struct. This may be used for showing dialogs,
listening for events or even opening new windows. The `Init()` method should
return an error if it fails to initialise. This method is called synchronously
so the application will not start until it returns.
The `Shutdown()` method is called when the application is shutting down. This is a good place to
perform any cleanup. This method is called synchronously so the application will not exit completely until
it returns.
The `Shutdown()` method is called when the application is shutting down. This is
a good place to perform any cleanup. This method is called synchronously so the
application will not exit completely until it returns.
## Plugin Directory Structure
@ -44,39 +46,42 @@ plugin-name
### `plugin.go`
This file contains the plugin code. It should contain a struct that implements the `Plugin` interface
and a `NewPlugin()` method that returns a pointer to the struct. Methods are exported by capitalising
the first letter of the method name. These methods may be called from the frontend. If methods
accept or return structs, these structs must be exported.
This file contains the plugin code. It should contain a struct that implements
the `Plugin` interface and a `NewPlugin()` method that returns a pointer to the
struct. Methods are exported by capitalising the first letter of the method
name. These methods may be called from the frontend. If methods accept or return
structs, these structs must be exported.
### `plugin.js`
This file should contain any JavaScript code that may help developers use the plugin.
In the example plugin, this file contains function wrappers for the plugin methods.
It's good to include JSDocs as that will help developers using your plugin.
This file should contain any JavaScript code that may help developers use the
plugin. In the example plugin, this file contains function wrappers for the
plugin methods. It's good to include JSDocs as that will help developers using
your plugin.
### `models.d.ts`
This file should contain TypeScript definitions for any structs that are passed
or returned from the plugin.
`
or returned from the plugin. `
### `plugin.toml`
This file contains the plugin metadata. It is important to fill this out correctly
as it will be used by the Wails CLI.
This file contains the plugin metadata. It is important to fill this out
correctly as it will be used by the Wails CLI.
### `README.md`
This file should contain a description of the plugin and how to use it. It should
also contain a link to the plugin repository and how to report bugs.
This file should contain a description of the plugin and how to use it. It
should also contain a link to the plugin repository and how to report bugs.
### `go.mod` and `go.sum`
These are standard Go module files. The package name in `go.mod` should match the
name of the plugin, e.g. `github.com/myuser/wails-plugin-example`.
These are standard Go module files. The package name in `go.mod` should match
the name of the plugin, e.g. `github.com/myuser/wails-plugin-example`.
## Promoting your Plugin
Once you have created your plugin, you should promote it on the Wails Discord server
in the `#plugins` channel. You should also open a PR to promote your plugin on the Wails
website. Update the `website/content/plugins.md` file and add your plugin to the list.
Once you have created your plugin, you should promote it on the Wails Discord
server in the `#plugins` channel. You should also open a PR to promote your
plugin on the Wails website. Update the `website/content/plugins.md` file and
add your plugin to the list.

View file

@ -17,22 +17,25 @@ Add the plugin to the `Plugins` option in the Applications options:
You can then call the methods from the frontend:
```js
wails.Plugin("{{.Name}}","All","hello world").then((result) => console.log(result))
wails
.Plugin("{{.Name}}", "All", "hello world")
.then((result) => console.log(result));
```
This method returns a struct with the following fields:
```typescript
interface Hashes {
MD5: string;
SHA1: string;
SHA256: string;
}
interface Hashes {
MD5: string;
SHA1: string;
SHA256: string;
}
```
A TypeScript definition file is provided for this interface.
## Support
If you find a bug in this plugin, please raise a ticket [here](https://github.com/plugin/repository).
Please do not contact the Wails team for support.
If you find a bug in this plugin, please raise a ticket
[here](https://github.com/plugin/repository). Please do not contact the Wails
team for support.

View file

@ -1,3 +1,4 @@
# Runtime
To rebuild the runtime run `task build-runtime` or if you have Wails v3 CLI, you can use `wails task build-runtime`.
To rebuild the runtime run `task build-runtime` or if you have Wails v3 CLI, you
can use `wails task build-runtime`.

View file

@ -1,3 +1,4 @@
# README
After updating any files in this directory, you must run `wails task build-runtime` to regenerate the compiled JS.
After updating any files in this directory, you must run
`wails task build-runtime` to regenerate the compiled JS.

View file

@ -1,6 +1,6 @@
# Wails API
This package provides a typed Javascript API for Wails applications.
This package provides a typed Javascript API for Wails applications.
It provides methods for the following components:
@ -13,7 +13,8 @@ It provides methods for the following components:
## Installation
In your Wails application, run the following command in the frontend project directory:
In your Wails application, run the following command in the frontend project
directory:
```bash
npm install -D @wailsapp/api
@ -31,18 +32,16 @@ Then use the API components:
```javascript
function showDialog() {
Wails.Dialog.Info({
Title: "Hello",
}).then((result) => {
console.log("Result: " + result);
});
Wails.Dialog.Info({
Title: "Hello",
}).then((result) => {
console.log("Result: " + result);
});
}
```
Individual components of the API can also be imported directly.
## API
### Dialog
@ -53,19 +52,19 @@ The Dialog API provides access to the native system dialogs.
import { Dialog } from "@wailsapp/api";
function example() {
Dialog.Info({
Title: "Hello",
}).then((result) => {
console.log("Result: " + result);
});
Dialog.Info({
Title: "Hello",
}).then((result) => {
console.log("Result: " + result);
});
}
```
#### Message Dialogs
Message dialogs are used to display a message to the user.
They can be used to display information, errors, warnings and questions.
Each method returns the button that was pressed by the user.
Message dialogs are used to display a message to the user. They can be used to
display information, errors, warnings and questions. Each method returns the
button that was pressed by the user.
- `Info(options: MessageDialogOptions): Promise<string>`
- `Error(options: MessageDialogOptions): Promise<string>`
@ -74,39 +73,40 @@ Each method returns the button that was pressed by the user.
#### Open Dialog
The Open Dialog is used to open a file or directory. It returns the path of the selected file or directory.
If the `AllowsMultipleFiles` option is set, multiple files or directories can be selected and are returned
as an array of file paths.
The Open Dialog is used to open a file or directory. It returns the path of the
selected file or directory. If the `AllowsMultipleFiles` option is set, multiple
files or directories can be selected and are returned as an array of file paths.
- `Open(options: OpenDialogOptions): Promise<string[]|string>`
#### Save Dialog
The Save Dialog is used to save a file. It returns the path of the selected file.
The Save Dialog is used to save a file. It returns the path of the selected
file.
- `Save(options: SaveDialogOptions): Promise<string>`
### Events
The Events API provides access to the Wails event system. This is a global event system
that can be used to send events between the Go and Javascript.
Events are available to every window in a multi-window application.
These API methods are specific to the window in which they are called in.
The Events API provides access to the Wails event system. This is a global event
system that can be used to send events between the Go and Javascript. Events are
available to every window in a multi-window application. These API methods are
specific to the window in which they are called in.
```javascript
import { Events } from "@wailsapp/api";
function example() {
// Emit an event
Events.Emit("myevent", { message: "Hello" });
// Subscribe to an event
let unsub = Events.On("otherEvent", (data) => {
console.log("Received event: " + data);
});
// Unsubscribe from the event
unsub();
// Emit an event
Events.Emit("myevent", { message: "Hello" });
// Subscribe to an event
let unsub = Events.On("otherEvent", (data) => {
console.log("Received event: " + data);
});
// Unsubscribe from the event
unsub();
}
```
@ -118,23 +118,31 @@ Emit an event with optional data.
#### Subscribe
Three methods are provided to subscribe to an event:
- `On(eventName: string, callback: (data: any) => void): () => void` - Subscribe to all events of the given name
- `Once(eventName: string, callback: (data: any) => void): () => void` - Subscribe to one event of the given name
- `OnMultiple(eventName: string, callback: (data: any) => void, count: number): () => void` - Subscribe to multiple events of the given name
Three methods are provided to subscribe to an event:
The callback will be called when the event is emitted.
The returned function can be called to unsubscribe from the event.
- `On(eventName: string, callback: (data: any) => void): () => void` - Subscribe
to all events of the given name
- `Once(eventName: string, callback: (data: any) => void): () => void` -
Subscribe to one event of the given name
- `OnMultiple(eventName: string, callback: (data: any) => void, count: number): () => void` -
Subscribe to multiple events of the given name
The callback will be called when the event is emitted. The returned function can
be called to unsubscribe from the event.
#### Unsubscribe
As well as unsubscribing from a single event, you can unsubscribe from events of a given name or all events.
- `Off(eventName: string, additionalEventNames: ...string): void` - Unsubscribe from all events of the given name(s)
- `OffAll(): void` - Unsubscribe all events
As well as unsubscribing from a single event, you can unsubscribe from events of
a given name or all events.
- `Off(eventName: string, additionalEventNames: ...string): void` - Unsubscribe
from all events of the given name(s)
- `OffAll(): void` - Unsubscribe all events
### Window
The Window API provides a number of methods that interact with the window in which the API is called.
The Window API provides a number of methods that interact with the window in
which the API is called.
- `Center: (void) => void` - Center the window
- `SetTitle: (title) => void` - Set the window title
@ -157,47 +165,47 @@ The Window API provides a number of methods that interact with the window in whi
- `UnMaximise: () => void` - UnMaximise the window
- `Minimise: () => void` - Minimise the window
- `UnMinimise: () => void` - UnMinimise the window
- `SetBackgroundColour: (r, g, b, a) => void` - Set the background colour of the window
- `SetBackgroundColour: (r, g, b, a) => void` - Set the background colour of the
window
### Plugin
The Plugin API provides access to the Wails plugin system.
This method provides the ability to call a plugin method from the frontend.
The Plugin API provides access to the Wails plugin system. This method provides
the ability to call a plugin method from the frontend.
```javascript
import { Plugin } from "@wailsapp/api";
function example() {
// Call a plugin method
Plugin.Call("myplugin", "MyMethod", { message: "Hello" }).then((result) => {
console.log("Result: " + result);
});
// Call a plugin method
Plugin.Call("myplugin", "MyMethod", { message: "Hello" }).then((result) => {
console.log("Result: " + result);
});
}
```
### Screens
The Screens API provides access to the Wails screen system.
```javascript
import { Screens } from "@wailsapp/api";
function example() {
// Get all attatched screens
Screens.GetAll().then((screens) => {
console.log("Screens: " + screens);
});
// Get the primary screen
Screens.GetPrimary().then((screen) => {
console.log("Primary screen: " + screen);
});
// Get the screen the window is on
Screens.GetCurrent().then((screen) => {
console.log("Window screen: " + screen);
});
// Get all attatched screens
Screens.GetAll().then((screens) => {
console.log("Screens: " + screens);
});
// Get the primary screen
Screens.GetPrimary().then((screen) => {
console.log("Primary screen: " + screen);
});
// Get the screen the window is on
Screens.GetCurrent().then((screen) => {
console.log("Window screen: " + screen);
});
}
```
@ -213,16 +221,14 @@ The Application API provides access to the Wails application system.
import { Application } from "@wailsapp/api";
function example() {
// Hide the application
Application.Hide();
// Shopw the application
Application.Show();
// Quit the application
Application.Quit();
// Hide the application
Application.Hide();
// Shopw the application
Application.Show();
// Quit the application
Application.Quit();
}
```
@ -235,129 +241,127 @@ function example() {
This is a comprehensive list of types used by the Wails API.
```typescript
export interface Button {
// The label of the button
Label?: string;
// True if this button is the cancel button (selected when pressing escape)
IsCancel?: boolean;
// True if this button is the default button (selected when pressing enter)
IsDefault?: boolean;
// The label of the button
Label?: string;
// True if this button is the cancel button (selected when pressing escape)
IsCancel?: boolean;
// True if this button is the default button (selected when pressing enter)
IsDefault?: boolean;
}
interface MessageDialogOptions {
// The title for the dialog
Title?: string;
// The message to display
Message?: string;
// The buttons to use on the dialog
Buttons?: Button[];
// The title for the dialog
Title?: string;
// The message to display
Message?: string;
// The buttons to use on the dialog
Buttons?: Button[];
}
export interface OpenFileDialogOptions {
// Allows the user to be able to select directories
CanChooseDirectories?: boolean;
// Allows the user to be able to select files
CanChooseFiles?: boolean;
// Provide an option to create directories in the dialog
CanCreateDirectories?: boolean;
// Makes the dialog show hidden files
ShowHiddenFiles?: boolean;
// Whether the dialog should follow filesystem aliases
ResolvesAliases?: boolean;
// Allow the user to select multiple files or directories
AllowsMultipleSelection?: boolean;
// Hide the extension when showing the filename
HideExtension?: boolean;
// Allow the user to select files where the system hides their extensions
CanSelectHiddenExtension?: boolean;
// Treats file packages as directories, e.g. .app on macOS
TreatsFilePackagesAsDirectories?: boolean;
// Allows selection of filetypes not specified in the filters
AllowsOtherFiletypes?: boolean;
// The file filters to use in the dialog
Filters?: FileFilter[];
// The title of the dialog
Title?: string;
// The message to display
Message?: string;
// The label for the select button
ButtonText?: string;
// The default directory to open the dialog in
Directory?: string;
// Allows the user to be able to select directories
CanChooseDirectories?: boolean;
// Allows the user to be able to select files
CanChooseFiles?: boolean;
// Provide an option to create directories in the dialog
CanCreateDirectories?: boolean;
// Makes the dialog show hidden files
ShowHiddenFiles?: boolean;
// Whether the dialog should follow filesystem aliases
ResolvesAliases?: boolean;
// Allow the user to select multiple files or directories
AllowsMultipleSelection?: boolean;
// Hide the extension when showing the filename
HideExtension?: boolean;
// Allow the user to select files where the system hides their extensions
CanSelectHiddenExtension?: boolean;
// Treats file packages as directories, e.g. .app on macOS
TreatsFilePackagesAsDirectories?: boolean;
// Allows selection of filetypes not specified in the filters
AllowsOtherFiletypes?: boolean;
// The file filters to use in the dialog
Filters?: FileFilter[];
// The title of the dialog
Title?: string;
// The message to display
Message?: string;
// The label for the select button
ButtonText?: string;
// The default directory to open the dialog in
Directory?: string;
}
export interface FileFilter {
// The display name for the filter, e.g. "Text Files"
DisplayName?: string;
// The pattern to use for the filter, e.g. "*.txt;*.md"
Pattern?: string;
// The display name for the filter, e.g. "Text Files"
DisplayName?: string;
// The pattern to use for the filter, e.g. "*.txt;*.md"
Pattern?: string;
}
export interface SaveFileDialogOptions {
// Provide an option to create directories in the dialog
CanCreateDirectories?: boolean;
// Makes the dialog show hidden files
ShowHiddenFiles?: boolean;
// Allow the user to select files where the system hides their extensions
CanSelectHiddenExtension?: boolean;
// Allows selection of filetypes not specified in the filters
AllowOtherFiletypes?: boolean;
// Hide the extension when showing the filename
HideExtension?: boolean;
// Treats file packages as directories, e.g. .app on macOS
TreatsFilePackagesAsDirectories?: boolean;
// The message to show in the dialog
Message?: string;
// The default directory to open the dialog in
Directory?: string;
// The default filename to use in the dialog
Filename?: string;
// The label for the select button
ButtonText?: string;
// Provide an option to create directories in the dialog
CanCreateDirectories?: boolean;
// Makes the dialog show hidden files
ShowHiddenFiles?: boolean;
// Allow the user to select files where the system hides their extensions
CanSelectHiddenExtension?: boolean;
// Allows selection of filetypes not specified in the filters
AllowOtherFiletypes?: boolean;
// Hide the extension when showing the filename
HideExtension?: boolean;
// Treats file packages as directories, e.g. .app on macOS
TreatsFilePackagesAsDirectories?: boolean;
// The message to show in the dialog
Message?: string;
// The default directory to open the dialog in
Directory?: string;
// The default filename to use in the dialog
Filename?: string;
// The label for the select button
ButtonText?: string;
}
export interface Screen {
// The screen ID
Id: string;
// The screen name
Name: string;
// The screen scale. 1 = standard resolution, 2: 2x retina, etc.
Scale: number;
// The X position of the screen
X: number;
// The Y position of the screen
Y: number;
// The width and height of the screen
Size: Size;
// The bounds of the screen
Bounds: Rect;
// The work area of the screen
WorkArea: Rect;
// True if this is the primary screen
IsPrimary: boolean;
// The rotation of the screen
Rotation: number;
// The screen ID
Id: string;
// The screen name
Name: string;
// The screen scale. 1 = standard resolution, 2: 2x retina, etc.
Scale: number;
// The X position of the screen
X: number;
// The Y position of the screen
Y: number;
// The width and height of the screen
Size: Size;
// The bounds of the screen
Bounds: Rect;
// The work area of the screen
WorkArea: Rect;
// True if this is the primary screen
IsPrimary: boolean;
// The rotation of the screen
Rotation: number;
}
export interface Rect {
X: number;
Y: number;
Width: number;
Height: number;
X: number;
Y: number;
Width: number;
Height: number;
}
export interface WailsEvent {
// The name of the event
Name: string;
// The data associated with the event
Data?: any;
// The name of the event
Name: string;
// The data associated with the event
Data?: any;
}
export interface Size {
Width: number;
Height: number;
Width: number;
Height: number;
}
export interface Position {
X: number;
Y: number;
X: number;
Y: number;
}
```
```

View file

@ -1 +1 @@
# Wails + Svelte
# Wails + Svelte

View file

@ -1,47 +1,75 @@
# Svelte + TS + Vite
This template should help get you started developing with Svelte and TypeScript in Vite.
This template should help get you started developing with Svelte and TypeScript
in Vite.
## Recommended IDE Setup
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
[VS Code](https://code.visualstudio.com/) +
[Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
## Need an official Svelte framework?
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also
powered by Vite. Deploy anywhere with its serverless-first approach and adapt to
various platforms, with out of the box support for TypeScript, SCSS, and Less,
and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more.
## Technical considerations
**Why use this over SvelteKit?**
- It brings its own routing solution which might not be preferable for some users.
- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app.
- It brings its own routing solution which might not be preferable for some
users.
- It is first and foremost a framework that just happens to use Vite under the
hood, not a Vite app.
This template contains as little as possible to get started with Vite + TypeScript + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project.
This template contains as little as possible to get started with Vite +
TypeScript + Svelte, while taking into account the developer experience with
regards to HMR and intellisense. It demonstrates capabilities on par with the
other `create-vite` templates and is a good starting point for beginners dipping
their toes into a Vite + Svelte project.
Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate.
Should you later need the extended capabilities and extensibility provided by
SvelteKit, the template has been structured similarly to SvelteKit so that it is
easy to migrate.
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?**
**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or
`tsconfig.json`?**
Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information.
Setting `compilerOptions.types` shuts out all other types not explicitly listed
in the configuration. Using triple-slash references keeps the default TypeScript
setting of accepting type information from the entire workspace, while also
adding `svelte` and `vite/client` type information.
**Why include `.vscode/extensions.json`?**
Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project.
Other templates indirectly recommend extensions via the README, but this file
allows VS Code to prompt the user to install the recommended extension upon
opening the project.
**Why enable `allowJs` in the TS template?**
While `allowJs: false` would indeed prevent the use of `.js` files in the project, it does not prevent the use of JavaScript syntax in `.svelte` files. In addition, it would force `checkJs: false`, bringing the worst of both worlds: not being able to guarantee the entire codebase is TypeScript, and also having worse typechecking for the existing JavaScript. In addition, there are valid use cases in which a mixed codebase may be relevant.
While `allowJs: false` would indeed prevent the use of `.js` files in the
project, it does not prevent the use of JavaScript syntax in `.svelte` files. In
addition, it would force `checkJs: false`, bringing the worst of both worlds:
not being able to guarantee the entire codebase is TypeScript, and also having
worse typechecking for the existing JavaScript. In addition, there are valid use
cases in which a mixed codebase may be relevant.
**Why is HMR not preserving my local component state?**
HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/rixo/svelte-hmr#svelte-hmr).
HMR state preservation comes with a number of gotchas! It has been disabled by
default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often
surprising behavior. You can read the details
[here](https://github.com/rixo/svelte-hmr#svelte-hmr).
If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR.
If you have state that's important to retain within a component, consider
creating an external store which would not be replaced by HMR.
```ts
// store.ts
// An extremely simple external store
import { writable } from 'svelte/store'
export default writable(0)
import { writable } from "svelte/store";
export default writable(0);
```

View file

@ -1 +1 @@
# Wails + Svelte
# Wails + Svelte

View file

@ -1,18 +1,32 @@
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
This template should help get you started developing with Vue 3 and TypeScript
in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the
[script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup)
to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
- [VS Code](https://code.visualstudio.com/) +
[Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and
disable Vetur) +
[TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## Type Support For `.vue` Imports in TS
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
TypeScript cannot handle type information for `.vue` imports by default, so we
replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need
[TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)
to make the TypeScript language service aware of `.vue` types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has
also implemented a
[Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669)
that is more performant. You can enable it by the following steps:
1. Disable the built-in TypeScript Extension
1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
2. Find `TypeScript and JavaScript Language Features`, right click and select
`Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the
command palette.

View file

@ -1,7 +1,13 @@
# Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
This template should help get you started developing with Vue 3 in Vite. The
template uses Vue 3 `<script setup>` SFCs, check out the
[script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup)
to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
- [VS Code](https://code.visualstudio.com/) +
[Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and
disable Vetur) +
[TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).

View file

@ -1,10 +1,10 @@
Features
- [ ] AssetServer
- [ ] Offline page if navigating to external URL
- [x] Application menu
Bugs
- [ ] Resize Window
- [ ] Fullscreen/Maximise/Minimise/Restore

View file

@ -1,6 +1,7 @@
# Browser Plugin
This plugin provides the ability to open a URL or local file in the default browser.
This plugin provides the ability to open a URL or local file in the default
browser.
## Installation
@ -41,11 +42,12 @@ You can call the methods exported by the plugin directly:
You can call the methods from the frontend using the Plugin method:
```js
wails.Plugin("browser","OpenURL","https://www.google.com")
// or
wails.Plugin("browser","OpenFile","/path/to/file")
wails.Plugin("browser", "OpenURL", "https://www.google.com");
// or
wails.Plugin("browser", "OpenFile", "/path/to/file");
```
## Support
If you find a bug in this plugin, please raise a ticket on the Wails [Issue Tracker](https://github.com/wailsapp/wails/issues).
If you find a bug in this plugin, please raise a ticket on the Wails
[Issue Tracker](https://github.com/wailsapp/wails/issues).

View file

@ -39,7 +39,7 @@ You can call the methods exported by the plugin directly:
// handle error
}
url := kvstore.Get("url").(string)
// If you have not enables AutoSave, you will need to call Save() to persist the changes
err = kvstore.Save()
if err != nil {
@ -52,15 +52,14 @@ You can call the methods exported by the plugin directly:
You can call the methods from the frontend using the Plugin method:
```js
wails.Plugin("kvstore","Set", "url", "https://www.google.com")
wails.Plugin("kvstore","Get", "url").then((url) => {
})
// or
wails.Plugin("browser","OpenFile","/path/to/file")
wails.Plugin("kvstore", "Set", "url", "https://www.google.com");
wails.Plugin("kvstore", "Get", "url").then((url) => {});
// or
wails.Plugin("browser", "OpenFile", "/path/to/file");
```
## Support
If you find a bug in this plugin, please raise a ticket on the Wails [Issue Tracker](https://github.com/wailsapp/wails/issues).
If you find a bug in this plugin, please raise a ticket on the Wails
[Issue Tracker](https://github.com/wailsapp/wails/issues).

View file

@ -17,22 +17,23 @@ Add the plugin to the `Plugins` option in the Applications options:
You can then call the methods from the frontend:
```js
wails.Plugin("log","All","hello world").then((result) => console.log(result))
wails.Plugin("log", "All", "hello world").then((result) => console.log(result));
```
This method returns a struct with the following fields:
```typescript
interface Hashes {
MD5: string;
SHA1: string;
SHA256: string;
}
interface Hashes {
MD5: string;
SHA1: string;
SHA256: string;
}
```
A TypeScript definition file is provided for this interface.
## Support
If you find a bug in this plugin, please raise a ticket [here](https://github.com/plugin/repository).
Please do not contact the Wails team for support.
If you find a bug in this plugin, please raise a ticket
[here](https://github.com/plugin/repository). Please do not contact the Wails
team for support.

View file

@ -17,15 +17,19 @@ Add the plugin to the `Plugins` option in the Applications options:
## Usage
This plugin prevents the launch of multiple copies of your application.
If you set `ActivateAppOnSubsequentLaunch` to true the original app will be activated when a second instance is launched.
This plugin prevents the launch of multiple copies of your application. If you
set `ActivateAppOnSubsequentLaunch` to true the original app will be activated
when a second instance is launched.
## Support
If you find a bug in this plugin, please raise a ticket [here](https://github.com/plugin/repository).
Please do not contact the Wails team for support.
If you find a bug in this plugin, please raise a ticket
[here](https://github.com/plugin/repository). Please do not contact the Wails
team for support.
## Credit
This plugin contains modified code from the awesome [go-singleinstance](https://github.com/allan-simon/go-singleinstance) module (c) 2015 Allan Simon.
Original license file has been renamed `go-singleinstance.LICENSE` and is available [here](./singleinstance_LICENSE).
This plugin contains modified code from the awesome
[go-singleinstance](https://github.com/allan-simon/go-singleinstance) module (c)
2015 Allan Simon. Original license file has been renamed
`go-singleinstance.LICENSE` and is available [here](./singleinstance_LICENSE).

View file

@ -17,11 +17,16 @@ Add the plugin to the `Plugins` option in the Applications options:
You can then call the methods from the frontend:
```js
wails.Plugin("start_at_login","StartAtLogin", true).then((result) => console.log(result))
wails.Plugin("start_at_login","IsStartAtLogin").then((result) => console.log(result))
wails
.Plugin("start_at_login", "StartAtLogin", true)
.then((result) => console.log(result));
wails
.Plugin("start_at_login", "IsStartAtLogin")
.then((result) => console.log(result));
```
To use this from Go, create a new instance of the plugin, then call the methods on that:
To use this from Go, create a new instance of the plugin, then call the methods
on that:
```go
start_at_login := start_at_login.NewPlugin()
@ -30,5 +35,6 @@ To use this from Go, create a new instance of the plugin, then call the methods
## Support
If you find a bug in this plugin, please raise a ticket [here](https://github.com/plugin/repository).
Please do not contact the Wails team for support.
If you find a bug in this plugin, please raise a ticket
[here](https://github.com/plugin/repository). Please do not contact the Wails
team for support.

View file

@ -1,6 +1,7 @@
# Website
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern
static website generator.
### Installation
@ -20,13 +21,16 @@ Other languages:
npm run start -- --locale <language>
```
language - The language code configured in the i18n field in the docusaurus.config.js file.
language - The language code configured in the i18n field in the
docusaurus.config.js file.
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
This command starts a local development server and opens up a browser window.
Most changes are reflected live without having to restart the server.
### Translate
After the English source file is updated, run the following command to submit the source file to Crowdin:
After the English source file is updated, run the following command to submit
the source file to Crowdin:
```
npm run crowdin push -- -b <branch>
@ -40,9 +44,12 @@ Run the following command to pull the translated files in crowdin to the local:
npm run crowdin pull -- -b <branch> -l <languageCode>
```
languageCode - **Note** that this refers to the language code in the crowdin project.
languageCode - **Note** that this refers to the language code in the crowdin
project.
The recommended practice is to update the English source file locally, then translate the file in crowdin, and finally pull the translated file to the local.
The recommended practice is to update the English source file locally, then
translate the file in crowdin, and finally pull the translated file to the
local.
### Build
@ -50,4 +57,5 @@ The recommended practice is to update the English source file locally, then tran
$ yarn build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
This command generates static content into the `build` directory and can be
served using any static contents hosting service.

View file

@ -16,34 +16,44 @@ tags: [wails, v2]
<br />
```
When I first announced Wails on Reddit, just over 2 years ago from a train in Sydney, I did not expect it to get much
attention. A few days later, a prolific tech vlogger released a tutorial video, gave it a positive review and from that
When I first announced Wails on Reddit, just over 2 years ago from a train in
Sydney, I did not expect it to get much attention. A few days later, a prolific
tech vlogger released a tutorial video, gave it a positive review and from that
point on, interest in the project has skyrocketed.
It was clear that people were excited about adding web frontends to their Go projects, and almost immediately pushed the
project beyond the proof of concept that I had created.
At the time, Wails used the [webview](https://github.com/webview/webview) project to handle the frontend, and the only
option for Windows was the IE11 renderer. Many bug reports were rooted in this limitation: poor JavaScript/CSS support
and no dev tools to debug it. This was a frustrating development experience but there wasn't much that could have been
done to rectify it.
It was clear that people were excited about adding web frontends to their Go
projects, and almost immediately pushed the project beyond the proof of concept
that I had created. At the time, Wails used the
[webview](https://github.com/webview/webview) project to handle the frontend,
and the only option for Windows was the IE11 renderer. Many bug reports were
rooted in this limitation: poor JavaScript/CSS support and no dev tools to debug
it. This was a frustrating development experience but there wasn't much that
could have been done to rectify it.
For a long time, I'd firmly believed that Microsoft would eventually have to sort out their browser situation.
The world was moving on, frontend development was booming and IE wasn't cutting it.
When Microsoft announced the move to using Chromium as the basis for their new browser direction, I knew it was only a
matter of time until Wails could use it, and move the Windows developer experience to the next level.
For a long time, I'd firmly believed that Microsoft would eventually have to
sort out their browser situation. The world was moving on, frontend development
was booming and IE wasn't cutting it. When Microsoft announced the move to using
Chromium as the basis for their new browser direction, I knew it was only a
matter of time until Wails could use it, and move the Windows developer
experience to the next level.
Today, I am pleased to announce: **Wails v2 Beta for Windows**! There's a huge amount to unpack in this release, so
grab a drink, take a seat and we'll begin...
Today, I am pleased to announce: **Wails v2 Beta for Windows**! There's a huge
amount to unpack in this release, so grab a drink, take a seat and we'll
begin...
### No CGO Dependency!
No, I'm not joking: _No_ _CGO_ _dependency_ 🤯! The thing about Windows is that, unlike MacOS and Linux, it doesn't
come with a default compiler. In addition, CGO requires a mingw compiler and there's a ton of different installation
options. Removing the CGO requirement has massively simplified setup, as well as making debugging an awful lot easier.
Whilst I have put a fair bit of effort in getting this working, the majority of the
credit should go to [John Chadwick](https://github.com/jchv) for not only starting a couple of projects to make this
possible, but also being open to someone taking those projects and building on them. Credit also to
[Tad Vizbaras](https://github.com/tadvi) whose [winc](https://github.com/tadvi/winc) project started me down this path.
No, I'm not joking: _No_ _CGO_ _dependency_ 🤯! The thing about Windows is that,
unlike MacOS and Linux, it doesn't come with a default compiler. In addition,
CGO requires a mingw compiler and there's a ton of different installation
options. Removing the CGO requirement has massively simplified setup, as well as
making debugging an awful lot easier. Whilst I have put a fair bit of effort in
getting this working, the majority of the credit should go to
[John Chadwick](https://github.com/jchv) for not only starting a couple of
projects to make this possible, but also being open to someone taking those
projects and building on them. Credit also to
[Tad Vizbaras](https://github.com/tadvi) whose
[winc](https://github.com/tadvi/winc) project started me down this path.
### WebView2 Chromium Renderer
@ -58,16 +68,19 @@ possible, but also being open to someone taking those projects and building on t
<br />
```
Finally, Windows developers get a first class rendering engine for their applications! Gone are the days of contorting
your frontend code to work on Windows. On top of that, you get a first-class developer tools experience!
Finally, Windows developers get a first class rendering engine for their
applications! Gone are the days of contorting your frontend code to work on
Windows. On top of that, you get a first-class developer tools experience!
The WebView2 component does, however, have a requirement to have the `WebView2Loader.dll` sitting alongside the binary.
This makes distribution just that little bit more painful than we gophers are used to. All solutions and libraries
(that I know of) that use WebView2 have this dependency.
The WebView2 component does, however, have a requirement to have the
`WebView2Loader.dll` sitting alongside the binary. This makes distribution just
that little bit more painful than we gophers are used to. All solutions and
libraries (that I know of) that use WebView2 have this dependency.
However, I'm really excited to announce that Wails applications _have no such requirement_! Thanks to the wizardry of
[John Chadwick](https://github.com/jchv), we are able to bundle this dll inside the binary and get Windows to load it
as if it were present on disk.
However, I'm really excited to announce that Wails applications _have no such
requirement_! Thanks to the wizardry of
[John Chadwick](https://github.com/jchv), we are able to bundle this dll inside
the binary and get Windows to load it as if it were present on disk.
Gophers rejoice! The single binary dream lives on!
@ -84,18 +97,21 @@ Gophers rejoice! The single binary dream lives on!
<br />
```
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available
and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus
and separators.
There were a lot of requests for native menu support. Wails has finally got you
covered. Application menus are now available and include support for most native
menu features. This includes standard menu items, checkboxes, radio groups,
submenus and separators.
There were a huge number of requests in v1 for the ability to have greater control of the window itself.
I'm happy to announce that there's new runtime APIs specifically for this.
It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native
dialogs with rich configuration to cater for all your dialog needs.
There were a huge number of requests in v1 for the ability to have greater
control of the window itself. I'm happy to announce that there's new runtime
APIs specifically for this. It's feature-rich and supports multi-monitor
configurations. There is also an improved dialogs API: Now, you can have modern,
native dialogs with rich configuration to cater for all your dialog needs.
There is now the option to generate IDE configuration along with your project. This means that if you open your project
in a supported IDE, it will already be configured for building and debugging your application. Currently VSCode is supported
but we hope to support other IDEs such as Goland soon.
There is now the option to generate IDE configuration along with your project.
This means that if you open your project in a supported IDE, it will already be
configured for building and debugging your application. Currently VSCode is
supported but we hope to support other IDEs such as Goland soon.
```mdx-code-block
<div class="text--center">
@ -110,9 +126,11 @@ but we hope to support other IDEs such as Goland soon.
### No requirement to bundle assets
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to
announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an
`<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
A huge pain-point of v1 was the need to condense your entire application down to
single JS & CSS files. I'm happy to announce that for v2, there is no
requirement to bundle assets, in any way, shape or form. Want to load a local
image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy
it in and add the path to it in your CSS.
> Wow, that sounds like a webserver...
@ -120,8 +138,9 @@ Yes, it works just like a webserver, except it isn't.
> So how do I include my assets?
You just pass a single `embed.FS` that contains all your assets into your application configuration.
They don't even need to be in the top directory - Wails will just work it out for you.
You just pass a single `embed.FS` that contains all your assets into your
application configuration. They don't even need to be in the top directory -
Wails will just work it out for you.
### New Development Experience
@ -136,27 +155,34 @@ They don't even need to be in the top directory - Wails will just work it out fo
<br />
```
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev`
command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly
from disk.
Now that assets don't need to be bundled, it's enabled a whole new development
experience. The new `wails dev` command will build and run your application, but
instead of using the assets in the `embed.FS`, it loads them directly from disk.
It also provides the additional features:
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
- Hot reload - Any changes to frontend assets will trigger and auto reload of
the application frontend
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your
application
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that
connects to it. All connected web browsers will respond to system events like hot reload on asset change.
In addition to this, a webserver will start on port 34115. This will serve your
application to any browser that connects to it. All connected web browsers will
respond to system events like hot reload on asset change.
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend
and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the
developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript
models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data
In Go, we are used to dealing with structs in our applications. It's often
useful to send structs to our frontend and use them as state in our application.
In v1, this was a very manual process and a bit of a burden on the developer.
I'm happy to announce that in v2, any application run in dev mode will
automatically generate TypeScript models for all structs that are input or
output parameters to bound methods. This enables seamless interchange of data
models between the two worlds.
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides
JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models
auto-imported when hitting tab in an auto-generated module wrapping your Go code!
In addition to this, another JS module is dynamically generated wrapping all
your bound methods. This provides JSDoc for your methods, providing code
completion and hinting in your IDE. It's really cool when you get data models
auto-imported when hitting tab in an auto-generated module wrapping your Go
code!
### Remote Templates
@ -171,45 +197,63 @@ auto-imported when hitting tab in an auto-generated module wrapping your Go code
<br />
```
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried
to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very
opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty
quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest
and greatest tech stacks.
Getting an application up and running quickly was always a key goal for the
Wails project. When we launched, we tried to cover a lot of the modern
frameworks at the time: react, vue and angular. The world of frontend
development is very opinionated, fast moving and hard to keep on top of! As a
result, we found our base templates getting out of date pretty quickly and this
caused a maintenance headache. It also meant that we didn't have cool modern
templates for the latest and greatest tech stacks.
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather
than rely on the Wails project. So now you can create projects using community supported templates! I hope this will
inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer
community can create!
With v2, I wanted to empower the community by giving you the ability to create
and host templates yourselves, rather than rely on the Wails project. So now you
can create projects using community supported templates! I hope this will
inspire developers to create a vibrant ecosystem of project templates. I'm
really quite excited about what our developer community can create!
### In Conclusion
Wails v2 represents a new foundation for the project.
The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release.
Your input would be most welcome. Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828)
discussion board.
Wails v2 represents a new foundation for the project. The aim of this release is
to get feedback on the new approach, and to iron out any bugs before a full
release. Your input would be most welcome. Please direct any feedback to the
[v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
There were many twists and turns, pivots and u-turns to get to this point. This was due partly to early technical decisions
that needed changing, and partly because some core problems we had spent time building workarounds for were fixed upstream:
Gos embed feature is a good example. Fortunately, everything came together at the right time, and today we have the
very best solution that we can have. I believe the wait has been worth it - this would not have been possible even 2
months ago.
There were many twists and turns, pivots and u-turns to get to this point. This
was due partly to early technical decisions that needed changing, and partly
because some core problems we had spent time building workarounds for were fixed
upstream: Gos embed feature is a good example. Fortunately, everything came
together at the right time, and today we have the very best solution that we can
have. I believe the wait has been worth it - this would not have been possible
even 2 months ago.
I also need to give a huge thank you :pray: to the following people because without them, this release just wouldn't exist:
I also need to give a huge thank you :pray: to the following people because
without them, this release just wouldn't exist:
- [Misite Bao](https://github.com/misitebao) - An absolute workhorse on the Chinese translations and an incredible bug finder.
- [John Chadwick](https://github.com/jchv) - His amazing work on [go-webview2](https://github.com/jchv/go-webview2) and
[go-winloader](https://github.com/jchv/go-winloader) have made the Windows version we have today possible.
- [Tad Vizbaras](https://github.com/tadvi) - Experimenting with his [winc](https://github.com/tadvi/winc) project was the first step down the path to a pure Go Wails.
- [Mat Ryer](https://github.com/matryer) - His support, encouragement and feedback has really helped drive the project forward.
- [Misite Bao](https://github.com/misitebao) - An absolute workhorse on the
Chinese translations and an incredible bug finder.
- [John Chadwick](https://github.com/jchv) - His amazing work on
[go-webview2](https://github.com/jchv/go-webview2) and
[go-winloader](https://github.com/jchv/go-winloader) have made the Windows
version we have today possible.
- [Tad Vizbaras](https://github.com/tadvi) - Experimenting with his
[winc](https://github.com/tadvi/winc) project was the first step down the path
to a pure Go Wails.
- [Mat Ryer](https://github.com/matryer) - His support, encouragement and
feedback has really helped drive the project forward.
And finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors), including [JetBrains](https://www.jetbrains.com?from=Wails),
whose support drive the project in many ways behind the scenes.
And finally, I'd like to give a special thank you to all the
[project sponsors](/credits#sponsors), including
[JetBrains](https://www.jetbrains.com?from=Wails), whose support drive the
project in many ways behind the scenes.
I look forward to seeing what people build with Wails in this next exciting phase of the project!
I look forward to seeing what people build with Wails in this next exciting
phase of the project!
Lea.
PS: MacOS and Linux users need not feel left out - porting to this new foundation is actively under way and most of the hard work has already been done. Hang in there!
PS: MacOS and Linux users need not feel left out - porting to this new
foundation is actively under way and most of the hard work has already been
done. Hang in there!
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
PPS: If you or your company find Wails useful, please consider
[sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!

View file

@ -16,16 +16,19 @@ tags: [wails, v2]
<br />
```
Today marks the first beta release of Wails v2 for Mac! It's taken quite a while to get to this point and I'm hoping
that today's release will give you something that's reasonably useful. There have been a number of twists and turns
to get to this point and I'm hoping, with your help, to iron out the crinkles and get the Mac port polished for the
final v2 release.
Today marks the first beta release of Wails v2 for Mac! It's taken quite a while
to get to this point and I'm hoping that today's release will give you something
that's reasonably useful. There have been a number of twists and turns to get to
this point and I'm hoping, with your help, to iron out the crinkles and get the
Mac port polished for the final v2 release.
You mean this isn't ready for production? For your use case, it may well be ready, but there are still a number of
known issues so keep your eye on [this project board](https://github.com/wailsapp/wails/projects/7) and if you would
like to contribute, you'd be very welcome!
You mean this isn't ready for production? For your use case, it may well be
ready, but there are still a number of known issues so keep your eye on
[this project board](https://github.com/wailsapp/wails/projects/7) and if you
would like to contribute, you'd be very welcome!
So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windows Beta :wink:
So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the
Windows Beta :wink:
### New Features
@ -40,18 +43,21 @@ So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windo
<br />
```
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available
and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus
and separators.
There were a lot of requests for native menu support. Wails has finally got you
covered. Application menus are now available and include support for most native
menu features. This includes standard menu items, checkboxes, radio groups,
submenus and separators.
There were a huge number of requests in v1 for the ability to have greater control of the window itself.
I'm happy to announce that there's new runtime APIs specifically for this.
It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native
dialogs with rich configuration to cater for all your dialog needs.
There were a huge number of requests in v1 for the ability to have greater
control of the window itself. I'm happy to announce that there's new runtime
APIs specifically for this. It's feature-rich and supports multi-monitor
configurations. There is also an improved dialogs API: Now, you can have modern,
native dialogs with rich configuration to cater for all your dialog needs.
### Mac Specific Options
In addition to the normal application options, Wails v2 for Mac also brings some Mac extras:
In addition to the normal application options, Wails v2 for Mac also brings some
Mac extras:
- Make your window all funky and translucent, like all the pretty swift apps!
- Highly customisable titlebar
@ -60,9 +66,11 @@ In addition to the normal application options, Wails v2 for Mac also brings some
### No requirement to bundle assets
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to
announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an
`<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
A huge pain-point of v1 was the need to condense your entire application down to
single JS & CSS files. I'm happy to announce that for v2, there is no
requirement to bundle assets, in any way, shape or form. Want to load a local
image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy
it in and add the path to it in your CSS.
> Wow, that sounds like a webserver...
@ -70,32 +78,40 @@ Yes, it works just like a webserver, except it isn't.
> So how do I include my assets?
You just pass a single `embed.FS` that contains all your assets into your application configuration.
They don't even need to be in the top directory - Wails will just work it out for you.
You just pass a single `embed.FS` that contains all your assets into your
application configuration. They don't even need to be in the top directory -
Wails will just work it out for you.
### New Development Experience
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev`
command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly
from disk.
Now that assets don't need to be bundled, it's enabled a whole new development
experience. The new `wails dev` command will build and run your application, but
instead of using the assets in the `embed.FS`, it loads them directly from disk.
It also provides the additional features:
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
- Hot reload - Any changes to frontend assets will trigger and auto reload of
the application frontend
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your
application
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that
connects to it. All connected web browsers will respond to system events like hot reload on asset change.
In addition to this, a webserver will start on port 34115. This will serve your
application to any browser that connects to it. All connected web browsers will
respond to system events like hot reload on asset change.
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend
and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the
developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript
models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data
In Go, we are used to dealing with structs in our applications. It's often
useful to send structs to our frontend and use them as state in our application.
In v1, this was a very manual process and a bit of a burden on the developer.
I'm happy to announce that in v2, any application run in dev mode will
automatically generate TypeScript models for all structs that are input or
output parameters to bound methods. This enables seamless interchange of data
models between the two worlds.
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides
JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models
auto-imported when hitting tab in an auto-generated module wrapping your Go code!
In addition to this, another JS module is dynamically generated wrapping all
your bound methods. This provides JSDoc for your methods, providing code
completion and hinting in your IDE. It's really cool when you get data models
auto-imported when hitting tab in an auto-generated module wrapping your Go
code!
### Remote Templates
@ -110,21 +126,24 @@ auto-imported when hitting tab in an auto-generated module wrapping your Go code
<br />
```
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried
to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very
opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty
quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest
and greatest tech stacks.
Getting an application up and running quickly was always a key goal for the
Wails project. When we launched, we tried to cover a lot of the modern
frameworks at the time: react, vue and angular. The world of frontend
development is very opinionated, fast moving and hard to keep on top of! As a
result, we found our base templates getting out of date pretty quickly and this
caused a maintenance headache. It also meant that we didn't have cool modern
templates for the latest and greatest tech stacks.
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather
than rely on the Wails project. So now you can create projects using community supported templates! I hope this will
inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer
community can create!
With v2, I wanted to empower the community by giving you the ability to create
and host templates yourselves, rather than rely on the Wails project. So now you
can create projects using community supported templates! I hope this will
inspire developers to create a vibrant ecosystem of project templates. I'm
really quite excited about what our developer community can create!
### Native M1 Support
Thanks to the amazing support of [Mat Ryer](https://github.com/matryer/), the Wails project now supports M1 native
builds:
Thanks to the amazing support of [Mat Ryer](https://github.com/matryer/), the
Wails project now supports M1 native builds:
```mdx-code-block
<div class="text--center">
@ -165,7 +184,8 @@ Oh, I almost forgot.... you can also do `darwin/universal`.... :wink:
### Cross Compilation to Windows
Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.
Because Wails v2 for Windows is pure Go, you can target Windows builds without
docker.
```mdx-code-block
<div class="text--center">
@ -180,22 +200,28 @@ Because Wails v2 for Windows is pure Go, you can target Windows builds without d
### WKWebView Renderer
V1 relied on a (now deprecated) WebView component. V2 uses the most recent WKWebKit component so expect the latest and greatest from Apple.
V1 relied on a (now deprecated) WebView component. V2 uses the most recent
WKWebKit component so expect the latest and greatest from Apple.
### In Conclusion
As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project.
The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release.
Your input would be most welcome! Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828)
discussion board.
As I'd said in the Windows release notes, Wails v2 represents a new foundation
for the project. The aim of this release is to get feedback on the new approach,
and to iron out any bugs before a full release. Your input would be most
welcome! Please direct any feedback to the
[v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
And finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors), including [JetBrains](https://www.jetbrains.com?from=Wails),
whose support drive the project in many ways behind the scenes.
And finally, I'd like to give a special thank you to all the
[project sponsors](/credits#sponsors), including
[JetBrains](https://www.jetbrains.com?from=Wails), whose support drive the
project in many ways behind the scenes.
I look forward to seeing what people build with Wails in this next exciting phase of the project!
I look forward to seeing what people build with Wails in this next exciting
phase of the project!
Lea.
PS: Linux users, you're next!
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
PPS: If you or your company find Wails useful, please consider
[sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!

View file

@ -16,9 +16,11 @@ tags: [wails, v2]
<br />
```
I'm pleased to finally announce that Wails v2 is now in beta for Linux! It is somewhat ironic that the very first
experiments with v2 was on Linux and yet it has ended up as the last release. That being said, the v2 we have today
is very different from those first experiments. So without further ado, let's go over the new features:
I'm pleased to finally announce that Wails v2 is now in beta for Linux! It is
somewhat ironic that the very first experiments with v2 was on Linux and yet it
has ended up as the last release. That being said, the v2 we have today is very
different from those first experiments. So without further ado, let's go over
the new features:
### New Features
@ -33,20 +35,24 @@ is very different from those first experiments. So without further ado, let's go
<br />
```
There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available
and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus
and separators.
There were a lot of requests for native menu support. Wails has finally got you
covered. Application menus are now available and include support for most native
menu features. This includes standard menu items, checkboxes, radio groups,
submenus and separators.
There were a huge number of requests in v1 for the ability to have greater control of the window itself.
I'm happy to announce that there's new runtime APIs specifically for this.
It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native
dialogs with rich configuration to cater for all your dialog needs.
There were a huge number of requests in v1 for the ability to have greater
control of the window itself. I'm happy to announce that there's new runtime
APIs specifically for this. It's feature-rich and supports multi-monitor
configurations. There is also an improved dialogs API: Now, you can have modern,
native dialogs with rich configuration to cater for all your dialog needs.
### No requirement to bundle assets
A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to
announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an
`<img>` tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.
A huge pain-point of v1 was the need to condense your entire application down to
single JS & CSS files. I'm happy to announce that for v2, there is no
requirement to bundle assets, in any way, shape or form. Want to load a local
image? Use an `<img>` tag with a local src path. Want to use a cool font? Copy
it in and add the path to it in your CSS.
> Wow, that sounds like a webserver...
@ -54,32 +60,40 @@ Yes, it works just like a webserver, except it isn't.
> So how do I include my assets?
You just pass a single `embed.FS` that contains all your assets into your application configuration.
They don't even need to be in the top directory - Wails will just work it out for you.
You just pass a single `embed.FS` that contains all your assets into your
application configuration. They don't even need to be in the top directory -
Wails will just work it out for you.
### New Development Experience
Now that assets don't need to be bundled, it's enabled a whole new development experience. The new `wails dev`
command will build and run your application, but instead of using the assets in the `embed.FS`, it loads them directly
from disk.
Now that assets don't need to be bundled, it's enabled a whole new development
experience. The new `wails dev` command will build and run your application, but
instead of using the assets in the `embed.FS`, it loads them directly from disk.
It also provides the additional features:
- Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your application
- Hot reload - Any changes to frontend assets will trigger and auto reload of
the application frontend
- Auto rebuild - Any changes to your Go code will rebuild and relaunch your
application
In addition to this, a webserver will start on port 34115. This will serve your application to any browser that
connects to it. All connected web browsers will respond to system events like hot reload on asset change.
In addition to this, a webserver will start on port 34115. This will serve your
application to any browser that connects to it. All connected web browsers will
respond to system events like hot reload on asset change.
In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend
and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the
developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript
models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data
In Go, we are used to dealing with structs in our applications. It's often
useful to send structs to our frontend and use them as state in our application.
In v1, this was a very manual process and a bit of a burden on the developer.
I'm happy to announce that in v2, any application run in dev mode will
automatically generate TypeScript models for all structs that are input or
output parameters to bound methods. This enables seamless interchange of data
models between the two worlds.
In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides
JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models
auto-imported when hitting tab in an auto-generated module wrapping your Go code!
In addition to this, another JS module is dynamically generated wrapping all
your bound methods. This provides JSDoc for your methods, providing code
completion and hinting in your IDE. It's really cool when you get data models
auto-imported when hitting tab in an auto-generated module wrapping your Go
code!
### Remote Templates
@ -94,20 +108,24 @@ auto-imported when hitting tab in an auto-generated module wrapping your Go code
<br />
```
Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried
to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very
opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty
quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest
and greatest tech stacks.
Getting an application up and running quickly was always a key goal for the
Wails project. When we launched, we tried to cover a lot of the modern
frameworks at the time: react, vue and angular. The world of frontend
development is very opinionated, fast moving and hard to keep on top of! As a
result, we found our base templates getting out of date pretty quickly and this
caused a maintenance headache. It also meant that we didn't have cool modern
templates for the latest and greatest tech stacks.
With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather
than rely on the Wails project. So now you can create projects using community supported templates! I hope this will
inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer
community can create!
With v2, I wanted to empower the community by giving you the ability to create
and host templates yourselves, rather than rely on the Wails project. So now you
can create projects using community supported templates! I hope this will
inspire developers to create a vibrant ecosystem of project templates. I'm
really quite excited about what our developer community can create!
### Cross Compilation to Windows
Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.
Because Wails v2 for Windows is pure Go, you can target Windows builds without
docker.
```mdx-code-block
<div class="text--center">
@ -122,21 +140,25 @@ Because Wails v2 for Windows is pure Go, you can target Windows builds without d
### In Conclusion
As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project.
The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release.
Your input would be most welcome! Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828)
discussion board.
As I'd said in the Windows release notes, Wails v2 represents a new foundation
for the project. The aim of this release is to get feedback on the new approach,
and to iron out any bugs before a full release. Your input would be most
welcome! Please direct any feedback to the
[v2 Beta](https://github.com/wailsapp/wails/discussions/828) discussion board.
Linux is **hard** to support. We expect there to be a number of quirks with the beta. Please help us to help you by
filing detailed bug reports!
Linux is **hard** to support. We expect there to be a number of quirks with the
beta. Please help us to help you by filing detailed bug reports!
Finally, I'd like to give a special thank you to all the [project sponsors](/credits#sponsors) whose support
drive the project in many ways behind the scenes.
Finally, I'd like to give a special thank you to all the
[project sponsors](/credits#sponsors) whose support drive the project in many
ways behind the scenes.
I look forward to seeing what people build with Wails in this next exciting phase of the project!
I look forward to seeing what people build with Wails in this next exciting
phase of the project!
Lea.
PS: The v2 release isn't far off now!
PPS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
PPS: If you or your company find Wails useful, please consider
[sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!

View file

@ -17,80 +17,189 @@ tags: [wails, v2]
# It's here!
Today marks the release of [Wails](https://wails.io) v2. It's been about 18 months since the first v2 alpha and about a year from the first beta release. I'm truly grateful to everyone involved in the evolution of the project.
Today marks the release of [Wails](https://wails.io) v2. It's been about 18
months since the first v2 alpha and about a year from the first beta release.
I'm truly grateful to everyone involved in the evolution of the project.
Part of the reason it took that long was due to wanting to get to some definition of completeness before officially calling it v2. The truth is, there's never a perfect time to tag a release - there's always outstanding issues or "just one more" feature to squeeze in. What tagging an imperfect major release does do, however, is to provide a bit of stability for users of the project, as well as a bit of a reset for the developers.
Part of the reason it took that long was due to wanting to get to some
definition of completeness before officially calling it v2. The truth is,
there's never a perfect time to tag a release - there's always outstanding
issues or "just one more" feature to squeeze in. What tagging an imperfect major
release does do, however, is to provide a bit of stability for users of the
project, as well as a bit of a reset for the developers.
This release is more than I'd ever expected it to be. I hope it gives you as much pleasure as it has given us to develop it.
This release is more than I'd ever expected it to be. I hope it gives you as
much pleasure as it has given us to develop it.
# What _is_ Wails?
If you are unfamiliar with Wails, it is a project that enables Go programmers to provide rich frontends for their Go programs using familiar web technologies. It's a lightweight, Go alternative to Electron. Much more information can be found on the [official site](https://wails.io/docs/introduction).
If you are unfamiliar with Wails, it is a project that enables Go programmers to
provide rich frontends for their Go programs using familiar web technologies.
It's a lightweight, Go alternative to Electron. Much more information can be
found on the [official site](https://wails.io/docs/introduction).
# What's new?
The v2 release is a huge leap forward for the project, addressing many of the pain points of v1. If you have not read any of the blog posts on the Beta releases for [macOS](/blog/wails-v2-beta-for-mac), [Windows](/blog/wails-v2-beta-for-windows) or [Linux](/blog/wails-v2-beta-for-linux), then I encourage you to do so
as it covers all the major changes in more detail. In summary:
The v2 release is a huge leap forward for the project, addressing many of the
pain points of v1. If you have not read any of the blog posts on the Beta
releases for [macOS](/blog/wails-v2-beta-for-mac),
[Windows](/blog/wails-v2-beta-for-windows) or
[Linux](/blog/wails-v2-beta-for-linux), then I encourage you to do so as it
covers all the major changes in more detail. In summary:
- Webview2 component for Windows that supports modern web standards and debugging capabilities.
- [Dark / Light theme](/docs/reference/options#theme) + [custom theming](/docs/reference/options#customtheme) on Windows.
- Webview2 component for Windows that supports modern web standards and
debugging capabilities.
- [Dark / Light theme](/docs/reference/options#theme) +
[custom theming](/docs/reference/options#customtheme) on Windows.
- Windows now has no CGO requirements.
- Out-of-the-box support for Svelte, Vue, React, Preact, Lit & Vanilla project templates.
- [Vite](https://vitejs.dev/) integration providing a hot-reload development environment for your application.
- Native application [menus](/docs/guides/application-development#application-menu) and [dialogs](/docs/reference/runtime/dialog).
- Native window translucency effects for [Windows](/docs/reference/options#windowistranslucent) and [macOS](/docs/reference/options#windowistranslucent-1). Support for Mica & Acrylic backdrops.
- Easily generate an [NSIS installer](/docs/guides/windows-installer) for Windows deployments.
- A rich [runtime library](/docs/reference/runtime/intro) providing utility methods for window manipulation, eventing, dialogs, menus and logging.
- Support for [obfuscating](/docs/guides/obfuscated) your application using [garble](https://github.com/burrowers/garble).
- Out-of-the-box support for Svelte, Vue, React, Preact, Lit & Vanilla project
templates.
- [Vite](https://vitejs.dev/) integration providing a hot-reload development
environment for your application.
- Native application
[menus](/docs/guides/application-development#application-menu) and
[dialogs](/docs/reference/runtime/dialog).
- Native window translucency effects for
[Windows](/docs/reference/options#windowistranslucent) and
[macOS](/docs/reference/options#windowistranslucent-1). Support for Mica &
Acrylic backdrops.
- Easily generate an [NSIS installer](/docs/guides/windows-installer) for
Windows deployments.
- A rich [runtime library](/docs/reference/runtime/intro) providing utility
methods for window manipulation, eventing, dialogs, menus and logging.
- Support for [obfuscating](/docs/guides/obfuscated) your application using
[garble](https://github.com/burrowers/garble).
- Support for compressing your application using [UPX](https://upx.github.io/).
- Automatic TypeScript generation of Go structs. More info [here](/docs/howdoesitwork#calling-bound-go-methods).
- No extra libraries or DLLs are required to be shipped with your application. For any platform.
- No requirement to bundle frontend assets. Just develop your application like any other web application.
- Automatic TypeScript generation of Go structs. More info
[here](/docs/howdoesitwork#calling-bound-go-methods).
- No extra libraries or DLLs are required to be shipped with your application.
For any platform.
- No requirement to bundle frontend assets. Just develop your application like
any other web application.
# Credit & Thanks
Getting to v2 has been a huge effort. There have been ~2.2K commits by 89 contributors between the initial alpha and the release today, and many, many more that have provided translations, testing, feedback and help on the discussion forums as well as the issue tracker. I'm so unbelievably grateful to each one of you. I'd also like to give an extra special thank you to all the project sponsors who have provided guidance, advice and feedback. Everything you do is hugely appreciated.
Getting to v2 has been a huge effort. There have been ~2.2K commits by 89
contributors between the initial alpha and the release today, and many, many
more that have provided translations, testing, feedback and help on the
discussion forums as well as the issue tracker. I'm so unbelievably grateful to
each one of you. I'd also like to give an extra special thank you to all the
project sponsors who have provided guidance, advice and feedback. Everything you
do is hugely appreciated.
There are a few people I'd like to give special mention to:
Firstly, a **huge** thank you to [@stffabi](https://github.com/stffabi) who has provided so many contributions which we all benefit from, as well as providing a lot of support on many issues. He has provided some key features such as the external dev server support which transformed our dev mode offering by allowing us to hook into [Vite](https://vitejs.dev/)'s superpowers. It's fair to say that Wails v2 would be a far less exciting release without his [incredible contributions](https://github.com/wailsapp/wails/commits?author=stffabi&since=2020-01-04). Thank you so much @stffabi!
Firstly, a **huge** thank you to [@stffabi](https://github.com/stffabi) who has
provided so many contributions which we all benefit from, as well as providing a
lot of support on many issues. He has provided some key features such as the
external dev server support which transformed our dev mode offering by allowing
us to hook into [Vite](https://vitejs.dev/)'s superpowers. It's fair to say that
Wails v2 would be a far less exciting release without his
[incredible contributions](https://github.com/wailsapp/wails/commits?author=stffabi&since=2020-01-04).
Thank you so much @stffabi!
I'd also like to give a huge shout-out to [@misitebao](https://github.com/misitebao) who has tirelessly been maintaining the website, as well as providing Chinese translations, managing Crowdin and helping new translators get up to speed. This is a hugely important task, and I'm extremely grateful for all the time and effort put into this! You rock!
I'd also like to give a huge shout-out to
[@misitebao](https://github.com/misitebao) who has tirelessly been maintaining
the website, as well as providing Chinese translations, managing Crowdin and
helping new translators get up to speed. This is a hugely important task, and
I'm extremely grateful for all the time and effort put into this! You rock!
Last, but not least, a huge thank you to Mat Ryer who has provided advice and support during the development of v2. Writing xBar together using an early Alpha of v2 was helpful in shaping the direction of v2, as well as give me an understanding of some design flaws in the early releases. I'm happy to announce that as of today, we will start to port xBar to Wails v2, and it will become the flagship application for the project. Cheers Mat!
Last, but not least, a huge thank you to Mat Ryer who has provided advice and
support during the development of v2. Writing xBar together using an early Alpha
of v2 was helpful in shaping the direction of v2, as well as give me an
understanding of some design flaws in the early releases. I'm happy to announce
that as of today, we will start to port xBar to Wails v2, and it will become the
flagship application for the project. Cheers Mat!
# Lessons Learnt
There are a number of lessons learnt in getting to v2 that will shape development moving forward.
There are a number of lessons learnt in getting to v2 that will shape
development moving forward.
## Smaller, Quicker, Focused Releases
In the course of developing v2, there were many features and bug fixes that were developed on an ad-hoc basis. This led to longer release cycles and were harder to debug. Moving forward, we are going to create releases more often that will include a reduced number of features. A release will involve updates to documentation as well as thorough testing. Hopefully, these smaller, quicker, focussed releases will lead to fewer regressions and better quality documentation.
In the course of developing v2, there were many features and bug fixes that were
developed on an ad-hoc basis. This led to longer release cycles and were harder
to debug. Moving forward, we are going to create releases more often that will
include a reduced number of features. A release will involve updates to
documentation as well as thorough testing. Hopefully, these smaller, quicker,
focussed releases will lead to fewer regressions and better quality
documentation.
## Encourage Engagement
When starting this project, I wanted to immediately help everyone who had a problem. Issues were "personal" and I wanted them resolved as quickly as possible. This is unsustainable and ultimately works against the longevity of the project. Moving forward, I will be giving more space for people to get involved in answering questions and triaging issues. It would be good to get some tooling to help with this so if you have any suggestions, please join in the discussion [here](https://github.com/wailsapp/wails/discussions/1855).
When starting this project, I wanted to immediately help everyone who had a
problem. Issues were "personal" and I wanted them resolved as quickly as
possible. This is unsustainable and ultimately works against the longevity of
the project. Moving forward, I will be giving more space for people to get
involved in answering questions and triaging issues. It would be good to get
some tooling to help with this so if you have any suggestions, please join in
the discussion [here](https://github.com/wailsapp/wails/discussions/1855).
## Learning to say No
The more people that engage with an Open Source project, the more requests there will be for additional features that may or may not be useful to the majority of people. These features will take an initial amount of time to develop and debug, and incur an ongoing maintenance cost from that point on. I myself am the most guilty of this, often wanting to "boil the sea" rather than provide the minimum viable feature. Moving forward, we will need to say "No" a bit more to adding core features and focus our energies on a way to empower developers to provide that functionality themselves. We are looking seriously into plugins for this scenario. This will allow anyone to extend the project as they see fit, as well as providing an easy way to contribute towards the project.
The more people that engage with an Open Source project, the more requests there
will be for additional features that may or may not be useful to the majority of
people. These features will take an initial amount of time to develop and debug,
and incur an ongoing maintenance cost from that point on. I myself am the most
guilty of this, often wanting to "boil the sea" rather than provide the minimum
viable feature. Moving forward, we will need to say "No" a bit more to adding
core features and focus our energies on a way to empower developers to provide
that functionality themselves. We are looking seriously into plugins for this
scenario. This will allow anyone to extend the project as they see fit, as well
as providing an easy way to contribute towards the project.
# Looking to the Future
There are so many core features we are looking at to add to Wails in the next major development cycle already. The [roadmap](https://github.com/wailsapp/wails/discussions/1484) is full of interesting ideas, and I'm keen to start work on them. One of the big asks has been for multiple window support. It's a tricky one and to do it right, and we may need to look at providing an alternative API, as the current one was not designed with this in mind. Based on some preliminary ideas and feedback, I think you'll like where we're looking to go with it.
There are so many core features we are looking at to add to Wails in the next
major development cycle already. The
[roadmap](https://github.com/wailsapp/wails/discussions/1484) is full of
interesting ideas, and I'm keen to start work on them. One of the big asks has
been for multiple window support. It's a tricky one and to do it right, and we
may need to look at providing an alternative API, as the current one was not
designed with this in mind. Based on some preliminary ideas and feedback, I
think you'll like where we're looking to go with it.
I'm personally very excited at the prospect of getting Wails apps running on mobile. We already have a demo project showing that it is possible to run a Wails app on Android, so I'm really keen to explore where we can go with this!
I'm personally very excited at the prospect of getting Wails apps running on
mobile. We already have a demo project showing that it is possible to run a
Wails app on Android, so I'm really keen to explore where we can go with this!
A final point I'd like to raise is that of feature parity. It has long been a core principle that we wouldn't add anything to the project without there being full cross-platform support for it. Whilst this has proven to be (mainly) achievable so far, it has really held the project back in releasing new features. Moving forward, we will be adopting a slightly different approach: any new feature that cannot be immediately released for all platforms will be released under an experimental configuration or API. This allows early adopters on certain platforms to try the feature and provide feedback that will feed into the final design of the feature. This, of course, means that there are no guarantees of API stability until it is fully supported by all the platforms it can be supported on, but at least it will unblock development.
A final point I'd like to raise is that of feature parity. It has long been a
core principle that we wouldn't add anything to the project without there being
full cross-platform support for it. Whilst this has proven to be (mainly)
achievable so far, it has really held the project back in releasing new
features. Moving forward, we will be adopting a slightly different approach: any
new feature that cannot be immediately released for all platforms will be
released under an experimental configuration or API. This allows early adopters
on certain platforms to try the feature and provide feedback that will feed into
the final design of the feature. This, of course, means that there are no
guarantees of API stability until it is fully supported by all the platforms it
can be supported on, but at least it will unblock development.
# Final Words
I'm really proud of what we've been able to achieve with the V2 release. It's amazing to see what people have already been able to build using the beta releases so far. Quality applications like [Varly](https://varly.app/), [Surge](https://getsurge.io/) and [October](https://october.utf9k.net/). I encourage you to check them out.
I'm really proud of what we've been able to achieve with the V2 release. It's
amazing to see what people have already been able to build using the beta
releases so far. Quality applications like [Varly](https://varly.app/),
[Surge](https://getsurge.io/) and [October](https://october.utf9k.net/). I
encourage you to check them out.
This release was achieved through the hard work of many contributors. Whilst it is free to download and use, it has not come about through zero cost. Make no mistakes, this project has come at considerable cost. It has not only been my time and the time of each and every contributor, but also the cost of absence from friends and families of each of those people too. That's why I'm extremely grateful for every second that has been dedicated to making this project happen. The more contributors we have, the more this effort can be spread out and the more we can achieve together. I'd like to encourage you all to pick one thing that you can contribute, whether it is confirming someone's bug, suggesting a fix, making a documentation change or helping out someone who needs it. All of these small things have such a huge impact! It would be so awesome if you too were part of the story in getting to v3.
This release was achieved through the hard work of many contributors. Whilst it
is free to download and use, it has not come about through zero cost. Make no
mistakes, this project has come at considerable cost. It has not only been my
time and the time of each and every contributor, but also the cost of absence
from friends and families of each of those people too. That's why I'm extremely
grateful for every second that has been dedicated to making this project happen.
The more contributors we have, the more this effort can be spread out and the
more we can achieve together. I'd like to encourage you all to pick one thing
that you can contribute, whether it is confirming someone's bug, suggesting a
fix, making a documentation change or helping out someone who needs it. All of
these small things have such a huge impact! It would be so awesome if you too
were part of the story in getting to v3.
Enjoy!
&dash; Lea
PS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
PS: If you or your company find Wails useful, please consider
[sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!

View file

@ -17,12 +17,13 @@ tags: [wails, v3]
# Introduction
Wails is a project that simplifies the ability to write cross-platform desktop applications using
Go. It uses native webview components for the frontend (not embedded browsers), bringing the power
of the world's most popular UI system to Go, whilst remaining lightweight.
Wails is a project that simplifies the ability to write cross-platform desktop
applications using Go. It uses native webview components for the frontend (not
embedded browsers), bringing the power of the world's most popular UI system to
Go, whilst remaining lightweight.
Version 2 was released on the 22nd of September 2022 and brought with it a lot of enhancements
including:
Version 2 was released on the 22nd of September 2022 and brought with it a lot
of enhancements including:
- Live development, leveraging the popular Vite project
- Rich functionality for managing windows and creating menus
@ -31,21 +32,22 @@ including:
- Creating of NSIS Installer
- Obfuscated builds
Right now, Wails v2 provides powerful tooling for creating rich, cross-platform desktop
applications.
Right now, Wails v2 provides powerful tooling for creating rich, cross-platform
desktop applications.
This blog post aims to look at where the project is at right now and what we can improve
on moving forward.
This blog post aims to look at where the project is at right now and what we can
improve on moving forward.
# Where are we now?
It's been incredible to see the popularity of Wails rising since the v2 release. I'm constantly
amazed by the creativity of the community and the wonderful things that are being built with it.
With more popularity, comes more eyes on the project. And with that, more feature requests and
bug reports.
It's been incredible to see the popularity of Wails rising since the v2 release.
I'm constantly amazed by the creativity of the community and the wonderful
things that are being built with it. With more popularity, comes more eyes on
the project. And with that, more feature requests and bug reports.
Over time, I've been able to identify some of the most pressing issues facing the project.
I've also been able to identify some of the things that are holding the project back.
Over time, I've been able to identify some of the most pressing issues facing
the project. I've also been able to identify some of the things that are holding
the project back.
## Current issues
@ -62,14 +64,16 @@ The API to build a Wails application currently consists of 2 parts:
- The Application API
- The Runtime API
The Application API famously has only 1 function: `Run()` which takes a heap of
options which govern how the application will work. Whilst this is very simple to use,
it is also very limiting. It is a "declarative" approach which hides a lot of the
underlying complexity. For instance, there is no handle to the main window, so you can't
interact with it directly. For that, you need to use the Runtime API. This is a problem
when you start to want to do more complex things like create multiple windows.
The Application API famously has only 1 function: `Run()` which takes a heap of
options which govern how the application will work. Whilst this is very simple
to use, it is also very limiting. It is a "declarative" approach which hides a
lot of the underlying complexity. For instance, there is no handle to the main
window, so you can't interact with it directly. For that, you need to use the
Runtime API. This is a problem when you start to want to do more complex things
like create multiple windows.
The Runtime API provides a lot of utility functions for the developer. This includes:
The Runtime API provides a lot of utility functions for the developer. This
includes:
- Window management
- Dialogs
@ -77,13 +81,13 @@ The Runtime API provides a lot of utility functions for the developer. This incl
- Events
- Logs
There are a number of things I am not happy with the Runtime API. The first is that it
requires a "context" to be passed around. This is both frustrating and confusing for
new developers who pass in a context and then get a runtime error.
There are a number of things I am not happy with the Runtime API. The first is
that it requires a "context" to be passed around. This is both frustrating and
confusing for new developers who pass in a context and then get a runtime error.
The biggest issue with the Runtime API is that it was designed for applications that only
use a single window. Over time, the demand for multiple windows has grown and the API is
not well suited to this.
The biggest issue with the Runtime API is that it was designed for applications
that only use a single window. Over time, the demand for multiple windows has
grown and the API is not well suited to this.
### Thoughts on the v3 API
@ -101,10 +105,10 @@ func main() {
}
```
This programmatic approach is far more intuitive and allows the developer to interact
with the application elements directly. All current runtime methods for windows would
simply be methods on the window object. For the other runtime methods, we could move
them to the application object like so:
This programmatic approach is far more intuitive and allows the developer to
interact with the application elements directly. All current runtime methods for
windows would simply be methods on the window object. For the other runtime
methods, we could move them to the application object like so:
```go
app := wails.NewApplication(options.App{})
@ -112,8 +116,9 @@ app.NewInfoDialog(options.InfoDialog{})
app.Log.Info("Hello World")
```
This is a much more powerful API which will allow for more complex applications to be built.
It also allows for the creation of multiple windows, [the most up-voted feature on GitHub](https://github.com/wailsapp/wails/issues/1480):
This is a much more powerful API which will allow for more complex applications
to be built. It also allows for the creation of multiple windows,
[the most up-voted feature on GitHub](https://github.com/wailsapp/wails/issues/1480):
```go
func main() {
@ -134,107 +139,125 @@ func main() {
### Bindings generation
One of the key features of Wails is generating bindings for your Go methods so they may be
called from Javascript. The current method for doing this is a bit of a hack. It involves
building the application with a special flag and then running the resultant binary which
uses reflection to determine what has been bound. This leads to a bit of a chicken and egg
situation: You can't build the application without the bindings and you can't generate the
bindings without building the application. There are many ways around this but the best one
would be not to use this approach at all.
One of the key features of Wails is generating bindings for your Go methods so
they may be called from Javascript. The current method for doing this is a bit
of a hack. It involves building the application with a special flag and then
running the resultant binary which uses reflection to determine what has been
bound. This leads to a bit of a chicken and egg situation: You can't build the
application without the bindings and you can't generate the bindings without
building the application. There are many ways around this but the best one would
be not to use this approach at all.
There was a number of attempts at writing a static analyser for Wails projects but they
didn't get very far. In more recent times, it has become slightly easier to do this with
more material available on the subject.
There was a number of attempts at writing a static analyser for Wails projects
but they didn't get very far. In more recent times, it has become slightly
easier to do this with more material available on the subject.
Compared to reflection, the AST approach is much faster however it is significantly more
complicated. To start with, we may need to impose certain constraints on how to specify
bindings in the code. The goal is to support the most common use cases and then expand
it later on.
Compared to reflection, the AST approach is much faster however it is
significantly more complicated. To start with, we may need to impose certain
constraints on how to specify bindings in the code. The goal is to support the
most common use cases and then expand it later on.
### The Build System
Like the declarative approach to the API, the build system was created to hide the
complexities of building a desktop application. When you run `wails build`, it does a
lot of things behind the scenes:
Like the declarative approach to the API, the build system was created to hide
the complexities of building a desktop application. When you run `wails build`,
it does a lot of things behind the scenes:
- Builds the backend binary for bindings and generates the bindings
- Installs the frontend dependencies
- Installs the frontend dependencies
- Builds the frontend assets
- Determines if the application icon is present and if so, embeds it
- Builds the final binary
- If the build is for `darwin/universal` it builds 2 binaries, one for `darwin/amd64` and one for `darwin/arm64` and then creates a fat binary using `lipo`
- If the build is for `darwin/universal` it builds 2 binaries, one for
`darwin/amd64` and one for `darwin/arm64` and then creates a fat binary using
`lipo`
- If compression is required, it compresses the binary with UPX
- Determines if this binary is to be packaged and if so:
- Ensures the icon and application manifest are compiled into the binary (Windows)
- Builds out the application bundle, generates the icon bundle and copies it, the binary and Info.plist to the application bundle (Mac)
- Ensures the icon and application manifest are compiled into the binary
(Windows)
- Builds out the application bundle, generates the icon bundle and copies it,
the binary and Info.plist to the application bundle (Mac)
- If an NSIS installer is required, it builds it
This entire process, whilst very powerful, is also very opaque. It is very difficult to
customise it and it is very difficult to debug.
This entire process, whilst very powerful, is also very opaque. It is very
difficult to customise it and it is very difficult to debug.
To address this in v3, I would like to move to a build system that exists outside of Wails.
After using [Task](https://taskfile.dev/) for a while, I am a big fan of it. It is a great
tool for configuring build systems and should be reasonably familiar to anyone who has used
Makefiles.
To address this in v3, I would like to move to a build system that exists
outside of Wails. After using [Task](https://taskfile.dev/) for a while, I am a
big fan of it. It is a great tool for configuring build systems and should be
reasonably familiar to anyone who has used Makefiles.
The build system would be configured using a `Taskfile.yml` file which would be generated
by default with any of the supported templates. This would have all of the steps required
to do all the current tasks, such as building or packaging the application, allowing for
easy customisation.
The build system would be configured using a `Taskfile.yml` file which would be
generated by default with any of the supported templates. This would have all of
the steps required to do all the current tasks, such as building or packaging
the application, allowing for easy customisation.
There will be no external requirement for this tooling as it would form part of the Wails
CLI. This means that you can still use `wails build` and it will do all the things it does
today. However, if you want to customise the build process, you can do so by editing the
`Taskfile.yml` file. It also means you can easily understand the build steps and use your
own build system if you wish.
There will be no external requirement for this tooling as it would form part of
the Wails CLI. This means that you can still use `wails build` and it will do
all the things it does today. However, if you want to customise the build
process, you can do so by editing the `Taskfile.yml` file. It also means you can
easily understand the build steps and use your own build system if you wish.
The missing piece in the build puzzle is the atomic operations in the build process, such
as icon generation, compression and packaging. To require a bunch of external tooling would
not be a great experience for the developer. To address this, the Wails CLI will provide
all these capabilities as part of the CLI. This means that the builds still work as expected,
with no extra external tooling, however you can replace any step of the build with any tool
you like.
The missing piece in the build puzzle is the atomic operations in the build
process, such as icon generation, compression and packaging. To require a bunch
of external tooling would not be a great experience for the developer. To
address this, the Wails CLI will provide all these capabilities as part of the
CLI. This means that the builds still work as expected, with no extra external
tooling, however you can replace any step of the build with any tool you like.
This will be a much more transparent build system which will allow for easier customisation
and address a lot of the issues that have been raised around it.
This will be a much more transparent build system which will allow for easier
customisation and address a lot of the issues that have been raised around it.
## The Payoff
These positive changes will be a huge benefit to the project:
- The new API will be much more intuitive and will allow for more complex applications
to be built.
- Using static analysis for bindings generation will be much faster and reduce a lot
of the complexity around the current process.
- Using an established, external build system will make the build process completely
transparent, allowing for powerful customisation.
These positive changes will be a huge benefit to the project:
- The new API will be much more intuitive and will allow for more complex
applications to be built.
- Using static analysis for bindings generation will be much faster and reduce a
lot of the complexity around the current process.
- Using an established, external build system will make the build process
completely transparent, allowing for powerful customisation.
Benefits to the project maintainers are:
- The new API will be much easier to maintain and adapt to new features and platforms.
- The new build system will be much easier to maintain and extend. I hope this will lead to a new ecosystem of community driven build pipelines.
- Better separation of concerns within the project. This will make it easier to add new features and platforms.
- The new API will be much easier to maintain and adapt to new features and
platforms.
- The new build system will be much easier to maintain and extend. I hope this
will lead to a new ecosystem of community driven build pipelines.
- Better separation of concerns within the project. This will make it easier to
add new features and platforms.
## The Plan
A lot of the experimentation for this has already been done and it's looking good.
There is no current timeline for this work but I'm hoping by the end of Q1 2023, there
will be an alpha release for Mac to allow the community to test, experiment with and
provide feedback.
A lot of the experimentation for this has already been done and it's looking
good. There is no current timeline for this work but I'm hoping by the end of Q1
2023, there will be an alpha release for Mac to allow the community to test,
experiment with and provide feedback.
## Summary
- The v2 API is declarative, hides a lot from the developer and not suitable for features such as multiple windows. A new API will be created which will be simpler, intuitive and more powerful.
- The build system is opaque and difficult to customise so we will move to an external build system which will open it all up.
- The bindings generation is slow and complex so we will move to static analysis which will remove a lot of the complexity the current method has.
- The v2 API is declarative, hides a lot from the developer and not suitable for
features such as multiple windows. A new API will be created which will be
simpler, intuitive and more powerful.
- The build system is opaque and difficult to customise so we will move to an
external build system which will open it all up.
- The bindings generation is slow and complex so we will move to static analysis
which will remove a lot of the complexity the current method has.
There has been a lot of work put into the guts of v2 and it's solid.
It's now time to address the layer on top of it and make it a much better experience for the developer.
There has been a lot of work put into the guts of v2 and it's solid. It's now
time to address the layer on top of it and make it a much better experience for
the developer.
I hope you are as excited about this as I am. I'm looking forward to hearing your thoughts and feedback.
I hope you are as excited about this as I am. I'm looking forward to hearing
your thoughts and feedback.
Regards,
&dash; Lea
PS: If you or your company find Wails useful, please consider [sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
PS: If you or your company find Wails useful, please consider
[sponsoring the project](https://github.com/sponsors/leaanthony). Thanks!
PPS: Yes, that's a genuine screenshot of a multi-window application built with Wails. It's not a mockup. It's real. It's awesome. It's coming soon.
PPS: Yes, that's a genuine screenshot of a multi-window application built with
Wails. It's not a mockup. It's real. It's awesome. It's coming soon.

View file

@ -4,12 +4,13 @@ sidebar_position: 2
# Links
This page serves as a list for community related links. Please submit a PR (click `Edit this page` at the bottom)
to submit links.
This page serves as a list for community related links. Please submit a PR
(click `Edit this page` at the bottom) to submit links.
## Awesome Wails
The [definitive list](https://github.com/wailsapp/awesome-wails) of links related to Wails.
The [definitive list](https://github.com/wailsapp/awesome-wails) of links
related to Wails.
## Support Channels
@ -20,7 +21,8 @@ The [definitive list](https://github.com/wailsapp/awesome-wails) of links relate
## Social Media
- [Twitter](https://twitter.com/wailsapp)
- [Wails Chinese Community QQ Group](https://qm.qq.com/cgi-bin/qm/qr?k=PmIURne5hFGNd7QWzW5qd6FV-INEjNJv&jump_from=webapi) - Group number: 1067173054
- [Wails Chinese Community QQ Group](https://qm.qq.com/cgi-bin/qm/qr?k=PmIURne5hFGNd7QWzW5qd6FV-INEjNJv&jump_from=webapi) -
Group number: 1067173054
## Other Tutorials and Articles

View file

@ -7,4 +7,13 @@
</p>
```
The [BulletinBoard](https://github.com/raguay/BulletinBoard) application is a versital message board for static messages or dialogs to get information from the user for a script. It has a TUI for creating new dialogs that can latter be used to get information from the user. It's design is to stay running on your system and show the information as needed and then hide away. I have a process for watching a file on my system and sending the contents to BulletinBoard when changed. It works great with my workflows. There is also an [Alfred workflow](https://github.com/raguay/MyAlfred/blob/master/Alfred%205/EmailIt.alfredworkflow) for sending information to the program. The workflow is also for working with [EmailIt](https://github.com/raguay/EmailIt).
The [BulletinBoard](https://github.com/raguay/BulletinBoard) application is a
versital message board for static messages or dialogs to get information from
the user for a script. It has a TUI for creating new dialogs that can latter be
used to get information from the user. It's design is to stay running on your
system and show the information as needed and then hide away. I have a process
for watching a file on my system and sending the contents to BulletinBoard when
changed. It works great with my workflows. There is also an
[Alfred workflow](https://github.com/raguay/MyAlfred/blob/master/Alfred%205/EmailIt.alfredworkflow)
for sending information to the program. The workflow is also for working with
[EmailIt](https://github.com/raguay/EmailIt).

View file

@ -7,4 +7,11 @@
</p>
```
[EmailIt](https://github.com/raguay/EmailIt/) is a Wails 2 program that is a markdown based email sender only with nine notepads, scripts to manipulate the text, and templates. It also has a scripts terminal to run scripts in EmailIt on files in your system. The scripts and templates can be used from the commandline itself or with the Alfred, Keyboard Maestro, Dropzone, or PopClip extensions. It also supports scripts and themes downloaded form GitHub. Documentation is not complete, but the programs works. Its built using Wails2 and Svelte, and the download is a universal macOS application.
[EmailIt](https://github.com/raguay/EmailIt/) is a Wails 2 program that is a
markdown based email sender only with nine notepads, scripts to manipulate the
text, and templates. It also has a scripts terminal to run scripts in EmailIt on
files in your system. The scripts and templates can be used from the commandline
itself or with the Alfred, Keyboard Maestro, Dropzone, or PopClip extensions. It
also supports scripts and themes downloaded form GitHub. Documentation is not
complete, but the programs works. Its built using Wails2 and Svelte, and the
download is a universal macOS application.

View file

@ -7,6 +7,13 @@
</p>
```
**[EncryptEasy](https://www.encrypteasy.app) is a simple and easy to use PGP encryption tool, managing all your and your contacts keys. Encryption should be simple. Developed with Wails.**
**[EncryptEasy](https://www.encrypteasy.app) is a simple and easy to use PGP
encryption tool, managing all your and your contacts keys. Encryption should be
simple. Developed with Wails.**
Encrypting messages using PGP is the industry standard. Everyone has a private and a public key. Your private key, well, needs to be kept private so only you can read messages. Your public key is distributed to anyone who wants to send you secret, encrypted messages. Managing keys, encrypting messages and decrypting messages should be a smooth experience. EncryptEasy is all about making it easy.
Encrypting messages using PGP is the industry standard. Everyone has a private
and a public key. Your private key, well, needs to be kept private so only you
can read messages. Your public key is distributed to anyone who wants to send
you secret, encrypted messages. Managing keys, encrypting messages and
decrypting messages should be a smooth experience. EncryptEasy is all about
making it easy.

View file

@ -7,18 +7,16 @@
</p>
```
[FileHound Export Utility](https://www.filehound.co.uk/) FileHound is a cloud document management platform made for secure file retention, business process automation and SmartCapture capabilities.
[FileHound Export Utility](https://www.filehound.co.uk/) FileHound is a cloud
document management platform made for secure file retention, business process
automation and SmartCapture capabilities.
The FileHound Export Utility allows FileHound Administrators the ability to run a secure document and data extraction tasks for alternative back-up and recovery purposes. This application will download all documents and/or meta data saved in FileHound based on the filters you choose. The metadata will be exported in both JSON and XML formats.
The FileHound Export Utility allows FileHound Administrators the ability to run
a secure document and data extraction tasks for alternative back-up and recovery
purposes. This application will download all documents and/or meta data saved in
FileHound based on the filters you choose. The metadata will be exported in both
JSON and XML formats.
Backend built with:
Go 1.15
Wails 1.11.0
go-sqlite3 1.14.6
go-linq 3.2
Backend built with: Go 1.15 Wails 1.11.0 go-sqlite3 1.14.6 go-linq 3.2
Frontend with:
Vue 2.6.11
Vuex 3.4.0
TypeScript
Tailwind 1.9.6
Frontend with: Vue 2.6.11 Vuex 3.4.0 TypeScript Tailwind 1.9.6

View file

@ -7,4 +7,5 @@
</p>
```
[hiposter](https://github.com/obity/hiposter) is a simple and efficient http API testing client tool. Based on Wails, Go and sveltejs.
[hiposter](https://github.com/obity/hiposter) is a simple and efficient http API
testing client tool. Based on Wails, Go and sveltejs.

View file

@ -11,4 +11,7 @@
</p>
```
[Minecraft Updater](https://github.com/Gurkengewuerz/MinecraftModUpdater) is a utility tool to update and synchronize Minecraft mods for your userbase. Its built using Wails2 and React with [antd](https://ant.design/) as frontend framework.
[Minecraft Updater](https://github.com/Gurkengewuerz/MinecraftModUpdater) is a
utility tool to update and synchronize Minecraft mods for your userbase. Its
built using Wails2 and React with [antd](https://ant.design/) as frontend
framework.

View file

@ -9,6 +9,18 @@
</p>
```
[Modal File Manager](https://github.com/raguay/ModalFileManager) is a dual pane file manager using web technologies. My original design was based on NW.js and can be found [here](https://github.com/raguay/ModalFileManager-NWjs). This version uses the same Svelte based frontend code (but it has be greatly modified since the departure from NW.js), but the backend is a [Wails 2](https://wails.io/) implementation. By using this implementation, I no longer use command line `rm`, `cp`, etc. commands, but a git install has to be on the system to download themes and extensions. It is fully coded using Go and runs much faster than the previous versions.
[Modal File Manager](https://github.com/raguay/ModalFileManager) is a dual pane
file manager using web technologies. My original design was based on NW.js and
can be found [here](https://github.com/raguay/ModalFileManager-NWjs). This
version uses the same Svelte based frontend code (but it has be greatly modified
since the departure from NW.js), but the backend is a
[Wails 2](https://wails.io/) implementation. By using this implementation, I no
longer use command line `rm`, `cp`, etc. commands, but a git install has to be
on the system to download themes and extensions. It is fully coded using Go and
runs much faster than the previous versions.
This file manager is designed around the same principle as Vim: a state controlled keyboard actions. The number of states isn't fixed, but very programmable. Therefore, an infinite number of keyboard configurations can be created and used. This is the main difference from other file managers. There are themes and extensions available to download from GitHub.
This file manager is designed around the same principle as Vim: a state
controlled keyboard actions. The number of states isn't fixed, but very
programmable. Therefore, an infinite number of keyboard configurations can be
created and used. This is the main difference from other file managers. There
are themes and extensions available to download from GitHub.

View file

@ -7,4 +7,6 @@
</p>
```
[Molly Wallet](https://github.com/grvlle/constellation_wallet/) the official $DAG wallet of the Constellation Network. It'll let users interact with the Hypergraph Network in various ways, not limited to producing $DAG transactions.
[Molly Wallet](https://github.com/grvlle/constellation_wallet/) the official
$DAG wallet of the Constellation Network. It'll let users interact with the
Hypergraph Network in various ways, not limited to producing $DAG transactions.

View file

@ -7,8 +7,13 @@
</p>
```
[October](https://october.utf9k.net) is a small Wails application that makes it really easy to extract highlights from [Kobo eReaders](https://en.wikipedia.org/wiki/Kobo_eReader) and then forward them to [Readwise](https://readwise.io).
[October](https://october.utf9k.net) is a small Wails application that makes it
really easy to extract highlights from
[Kobo eReaders](https://en.wikipedia.org/wiki/Kobo_eReader) and then forward
them to [Readwise](https://readwise.io).
It has a relatively small scope with all platform versions weighing in under 10MB, and that's without enabling [UPX compression](https://upx.github.io/)!
It has a relatively small scope with all platform versions weighing in under
10MB, and that's without enabling [UPX compression](https://upx.github.io/)!
In contrast, the author's previous attempts with Electron quickly bloated to several hundred megabytes.
In contrast, the author's previous attempts with Electron quickly bloated to
several hundred megabytes.

View file

@ -7,4 +7,6 @@
</p>
```
[Optimus](https://github.com/splode/optimus) is a desktop image optimization application. It supports conversion and compression between WebP, JPEG, and PNG image formats.
[Optimus](https://github.com/splode/optimus) is a desktop image optimization
application. It supports conversion and compression between WebP, JPEG, and PNG
image formats.

View file

@ -7,4 +7,5 @@
</p>
```
[Portfall](https://github.com/rekon-oss/portfall) - A desktop k8s port-forwarding portal for easy access to all your cluster UIs
[Portfall](https://github.com/rekon-oss/portfall) - A desktop k8s
port-forwarding portal for easy access to all your cluster UIs

View file

@ -9,4 +9,6 @@
</p>
```
[Restic-Browser](https://github.com/emuell/restic-browser) - A simple, cross-platform [restic](https://github.com/restic/restic) backup GUI for browsing and restoring restic repositories.
[Restic-Browser](https://github.com/emuell/restic-browser) - A simple,
cross-platform [restic](https://github.com/restic/restic) backup GUI for
browsing and restoring restic repositories.

View file

@ -7,15 +7,20 @@
</p>
```
Easy, Secure, and Free file sharing for everyone. Learn more at [Riftshare.app](https://riftshare.app)
Easy, Secure, and Free file sharing for everyone. Learn more at
[Riftshare.app](https://riftshare.app)
## Features
- Easy secure file sharing between computers both in the local network and through the internet
- Supports sending files or directories securely through the [magic wormhole protocol](https://magic-wormhole.readthedocs.io/en/latest/)
- Compatible with all other apps using magic wormhole (magic-wormhole or wormhole-william CLI, wormhole-gui, etc.)
- Easy secure file sharing between computers both in the local network and
through the internet
- Supports sending files or directories securely through the
[magic wormhole protocol](https://magic-wormhole.readthedocs.io/en/latest/)
- Compatible with all other apps using magic wormhole (magic-wormhole or
wormhole-william CLI, wormhole-gui, etc.)
- Automatic zipping of multiple selected files to send at once
- Full animations, progress bar, and cancellation support for sending and receiving
- Full animations, progress bar, and cancellation support for sending and
receiving
- Native OS File Selection
- Open files in one click once received
- Auto Update - don't worry about having the latest release!

View file

@ -7,4 +7,11 @@
</p>
```
[ScriptBar](https://GitHub.com/raguay/ScriptBarApp) is a program to show the output of scripts or [Node-Red](https://nodered.org) server. It runs scripts defined in EmailIt program and shows the output. Scripts from xBar or TextBar can be used, but currently on the TextBar scripts work well. It also displays the output of scripts on your system. ScriptBar doesn't put them in the menubar, but has them all in a convient window for easy viewing. You can have multiple tabs to have many different things show. You can also keep the links to your most visited web sites.
[ScriptBar](https://GitHub.com/raguay/ScriptBarApp) is a program to show the
output of scripts or [Node-Red](https://nodered.org) server. It runs scripts
defined in EmailIt program and shows the output. Scripts from xBar or TextBar
can be used, but currently on the TextBar scripts work well. It also displays
the output of scripts on your system. ScriptBar doesn't put them in the menubar,
but has them all in a convient window for easy viewing. You can have multiple
tabs to have many different things show. You can also keep the links to your
most visited web sites.

View file

@ -7,4 +7,6 @@
</p>
```
[Surge](https://getsurge.io/) is a p2p filesharing app designed to utilize blockchain technologies to enable 100% anonymous file transfers. Surge is end-to-end encrypted, decentralized and open source.
[Surge](https://getsurge.io/) is a p2p filesharing app designed to utilize
blockchain technologies to enable 100% anonymous file transfers. Surge is
end-to-end encrypted, decentralized and open source.

View file

@ -7,4 +7,7 @@
</p>
```
[Wally](https://ergodox-ez.com/pages/wally) is the official firmware flasher for [Ergodox](https://ergodox-ez.com/) keyboards. It looks great and is a fantastic example of what you can achieve with Wails: the ability to combine the power of Go and the rich graphical tools of the web development world.
[Wally](https://ergodox-ez.com/pages/wally) is the official firmware flasher for
[Ergodox](https://ergodox-ez.com/) keyboards. It looks great and is a fantastic
example of what you can achieve with Wails: the ability to combine the power of
Go and the rich graphical tools of the web development world.

View file

@ -1,4 +1,4 @@
# Minecraft launcher for WarMine
# Minecraft launcher for WarMine
```mdx-code-block
<p style={{ "text-align": "center" }}>
@ -12,8 +12,13 @@
</p>
```
[Minecraft launcher for WarMine](https://warmine.ru/) is a Wails application, that allows you to easily join modded game servers and manage your game accounts.
[Minecraft launcher for WarMine](https://warmine.ru/) is a Wails application,
that allows you to easily join modded game servers and manage your game
accounts.
The Launcher downloads the game files, checks their integrity and launches the game with a wide range of customization options for the launch arguments from the backend.
The Launcher downloads the game files, checks their integrity and launches the
game with a wide range of customization options for the launch arguments from
the backend.
Frontend is written in Svelte, whole launcher fits in 9MB and supports Windows 7-11.
Frontend is written in Svelte, whole launcher fits in 9MB and supports Windows
7-11.

View file

@ -7,4 +7,7 @@
</p>
```
[Ytd](https://github.com/marcio199226/ytd/tree/v2-wails) is an app for downloading tracks from youtube, creating offline playlists and share them with your friends, your friends will be able to playback your playlists or download them for offline listening, has an built-in player.
[Ytd](https://github.com/marcio199226/ytd/tree/v2-wails) is an app for
downloading tracks from youtube, creating offline playlists and share them with
your friends, your friends will be able to playback your playlists or download
them for offline listening, has an built-in player.

View file

@ -4,61 +4,94 @@ sidebar_position: 1
# Templates
This page serves as a list for community supported templates. Please submit a PR (click `Edit this page` at the bottom)
to include your templates. To build your own template, please see the [Templates](../guides/templates.mdx) guide.
This page serves as a list for community supported templates. Please submit a PR
(click `Edit this page` at the bottom) to include your templates. To build your
own template, please see the [Templates](../guides/templates.mdx) guide.
To use these templates, run `wails init -n "Your Project Name" -t [the link below[@version]]`
To use these templates, run
`wails init -n "Your Project Name" -t [the link below[@version]]`
If there is no version suffix, the main branch code template is used by default. If there is a version suffix, the code template corresponding to the tag of this version is used.
If there is no version suffix, the main branch code template is used by default.
If there is a version suffix, the code template corresponding to the tag of this
version is used.
Example: `wails init -n "Your Project Name" -t https://github.com/misitebao/wails-template-vue`
Example:
`wails init -n "Your Project Name" -t https://github.com/misitebao/wails-template-vue`
:::warning Attention
**The Wails project does not maintain, is not responsible nor liable for 3rd party templates!**
**The Wails project does not maintain, is not responsible nor liable for 3rd
party templates!**
If you are unsure about a template, inspect `package.json` and `wails.json` for what scripts are run and what packages are installed.
If you are unsure about a template, inspect `package.json` and `wails.json` for
what scripts are run and what packages are installed.
:::
## Vue
- [wails-template-vue](https://github.com/misitebao/wails-template-vue) - Wails template based on Vue ecology (Integrated TypeScript, Dark theme, Internationalization, Single page routing, TailwindCSS)
- [wails-vite-vue-ts](https://github.com/codydbentley/wails-vite-vue-ts) - Vue 3 TypeScript with Vite (and instructions to add features)
- [wails-vite-vue-the-works](https://github.com/codydbentley/wails-vite-vue-the-works) - Vue 3 TypeScript with Vite, Vuex, Vue Router, Sass, and ESLint + Prettier
- [wails-template-quasar-js](https://github.com/sgosiaco/wails-template-quasar-js) - A template using JavaScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint, Prettier)
- [wails-template-quasar-ts](https://github.com/sgosiaco/wails-template-quasar-ts) - A template using TypeScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint, Prettier, Composition API with &lt;script setup&gt;)
- [wails-template-naive](https://github.com/tk103331/wails-template-naive) - Wails template based on Naive UI (A Vue 3 Component Library)
- [wails-template-vue](https://github.com/misitebao/wails-template-vue) - Wails
template based on Vue ecology (Integrated TypeScript, Dark theme,
Internationalization, Single page routing, TailwindCSS)
- [wails-vite-vue-ts](https://github.com/codydbentley/wails-vite-vue-ts) - Vue 3
TypeScript with Vite (and instructions to add features)
- [wails-vite-vue-the-works](https://github.com/codydbentley/wails-vite-vue-the-works) -
Vue 3 TypeScript with Vite, Vuex, Vue Router, Sass, and ESLint + Prettier
- [wails-template-quasar-js](https://github.com/sgosiaco/wails-template-quasar-js) -
A template using JavaScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint,
Prettier)
- [wails-template-quasar-ts](https://github.com/sgosiaco/wails-template-quasar-ts) -
A template using TypeScript + Quasar V2 (Vue 3, Vite, Sass, Pinia, ESLint,
Prettier, Composition API with &lt;script setup&gt;)
- [wails-template-naive](https://github.com/tk103331/wails-template-naive) -
Wails template based on Naive UI (A Vue 3 Component Library)
## Angular
- [wails-template-angular](https://github.com/mateothegreat/wails-template-angular) - Angular 15+ action packed & ready to roll to production.
- [wails-angular-template](https://github.com/TAINCER/wails-angular-template) - Angular with TypeScript, Sass, Hot-Reload, Code-Splitting and i18n
- [wails-template-angular](https://github.com/mateothegreat/wails-template-angular) -
Angular 15+ action packed & ready to roll to production.
- [wails-angular-template](https://github.com/TAINCER/wails-angular-template) -
Angular with TypeScript, Sass, Hot-Reload, Code-Splitting and i18n
## React
- [wails-react-template](https://github.com/AlienRecall/wails-react-template) - A template using reactjs
- [wails-react-template](https://github.com/flin7/wails-react-template) - A minimal template for React that supports live development
- [wails-template-nextjs](https://github.com/LGiki/wails-template-nextjs) - A template using Next.js and TypeScript
- [wails-vite-react-ts-tailwind-template](https://github.com/hotafrika/wails-vite-react-ts-tailwind-template) - A template for React + TypeScript + Vite + TailwindCSS
- [wails-react-template](https://github.com/AlienRecall/wails-react-template) -
A template using reactjs
- [wails-react-template](https://github.com/flin7/wails-react-template) - A
minimal template for React that supports live development
- [wails-template-nextjs](https://github.com/LGiki/wails-template-nextjs) - A
template using Next.js and TypeScript
- [wails-vite-react-ts-tailwind-template](https://github.com/hotafrika/wails-vite-react-ts-tailwind-template) -
A template for React + TypeScript + Vite + TailwindCSS
## Svelte
- [wails-svelte-template](https://github.com/raitonoberu/wails-svelte-template) - A template using Svelte
- [wails-vite-svelte-template](https://github.com/BillBuilt/wails-vite-svelte-template) - A template using Svelte and Vite
- [wails-vite-svelte-tailwind-template](https://github.com/BillBuilt/wails-vite-svelte-tailwind-template) - A template using Svelte and Vite with TailwindCSS v3
- [wails-sveltekit-template](https://github.com/h8gi/wails-sveltekit-template) - A template using SvelteKit
- [wails-svelte-template](https://github.com/raitonoberu/wails-svelte-template) -
A template using Svelte
- [wails-vite-svelte-template](https://github.com/BillBuilt/wails-vite-svelte-template) -
A template using Svelte and Vite
- [wails-vite-svelte-tailwind-template](https://github.com/BillBuilt/wails-vite-svelte-tailwind-template) -
A template using Svelte and Vite with TailwindCSS v3
- [wails-sveltekit-template](https://github.com/h8gi/wails-sveltekit-template) -
A template using SvelteKit
## Solid
- [wails-template-vite-solid-ts](https://github.com/xijaja/wails-template-solid-ts) - A template using Solid + Ts + Vite
- [wails-template-vite-solid-js](https://github.com/xijaja/wails-template-solid-js) - A template using Solid + Js + Vite
- [wails-template-vite-solid-ts](https://github.com/xijaja/wails-template-solid-ts) -
A template using Solid + Ts + Vite
- [wails-template-vite-solid-js](https://github.com/xijaja/wails-template-solid-js) -
A template using Solid + Js + Vite
## Elm
- [wails-elm-template](https://github.com/benjamin-thomas/wails-elm-template) - Develop your GUI app with functional programming and a **snappy** hot-reload setup :tada: :rocket:
- [wails-template-elm-tailwind](https://github.com/rnice01/wails-template-elm-tailwind) - Combine the powers :muscle: of Elm + Tailwind CSS + Wails! Hot reloading supported.
- [wails-elm-template](https://github.com/benjamin-thomas/wails-elm-template) -
Develop your GUI app with functional programming and a **snappy** hot-reload
setup :tada: :rocket:
- [wails-template-elm-tailwind](https://github.com/rnice01/wails-template-elm-tailwind) -
Combine the powers :muscle: of Elm + Tailwind CSS + Wails! Hot reloading
supported.
## Pure JavaScript (Vanilla)
- [wails-pure-js-template](https://github.com/KiddoV/wails-pure-js-template) - A template with nothing but just basic JavaScript, HTML, and CSS
- [wails-pure-js-template](https://github.com/KiddoV/wails-pure-js-template) - A
template with nothing but just basic JavaScript, HTML, and CSS

View file

@ -4,8 +4,8 @@ sidebar_position: 6
# Compiling your Project
From the project directory, run `wails build`.
This will compile your project and save the production-ready binary in the `build/bin` directory.
From the project directory, run `wails build`. This will compile your project
and save the production-ready binary in the `build/bin` directory.
If you run the binary, you should see the default application:
@ -20,4 +20,5 @@ If you run the binary, you should see the default application:
<br />
```
For more details on compilation options, please refer to the [CLI Reference](../reference/cli.mdx#build).
For more details on compilation options, please refer to the
[CLI Reference](../reference/cli.mdx#build).

View file

@ -4,13 +4,18 @@ sidebar_position: 5
# Developing your Application
You can run your application in development mode by running `wails dev` from your project directory. This will do the following things:
You can run your application in development mode by running `wails dev` from
your project directory. This will do the following things:
- Build your application and run it
- Bind your Go code to the frontend so it can be called from JavaScript
- Using the power of [Vite](https://vitejs.dev/), will watch for modifications in your Go files and rebuild/re-run on change
- Sets up a [webserver](http://localhost:34115) that will serve your application over a browser. This allows you to use your favourite browser extensions. You can even call your Go code from the console
- Using the power of [Vite](https://vitejs.dev/), will watch for modifications
in your Go files and rebuild/re-run on change
- Sets up a [webserver](http://localhost:34115) that will serve your application
over a browser. This allows you to use your favourite browser extensions. You
can even call your Go code from the console
To get started, run `wails dev` in the project directory. More information on this can be found [here](../reference/cli.mdx#dev).
To get started, run `wails dev` in the project directory. More information on
this can be found [here](../reference/cli.mdx#dev).
Coming soon: Tutorial

View file

@ -6,7 +6,8 @@ sidebar_position: 2
## Project Generation
Now that the CLI is installed, you can generate a new project by using the `wails init` command.
Now that the CLI is installed, you can generate a new project by using the
`wails init` command.
Pick your favourite framework:
@ -90,10 +91,11 @@ If you would rather use TypeScript:<br/>
<hr />
There are also [community templates](../community/templates.mdx) available that offer different capabilities and frameworks.
There are also [community templates](../community/templates.mdx) available that
offer different capabilities and frameworks.
To see the other options available, you can run `wails init -help`.
More details can be found in the [CLI Reference](../reference/cli.mdx#init).
To see the other options available, you can run `wails init -help`. More details
can be found in the [CLI Reference](../reference/cli.mdx#init).
## Project Layout
@ -124,9 +126,12 @@ Wails projects have the following layout:
- `/go.mod` - Go module file
- `/go.sum` - Go module checksum file
The `frontend` directory has nothing specific to Wails and can be any frontend project of your choosing.
The `frontend` directory has nothing specific to Wails and can be any frontend
project of your choosing.
The `build` directory is used during the build process. These files may be updated to customise your builds. If
files are removed from the build directory, default versions will be regenerated.
The `build` directory is used during the build process. These files may be
updated to customise your builds. If files are removed from the build directory,
default versions will be regenerated.
The default module name in `go.mod` is "changeme". You should change this to something more appropriate.
The default module name in `go.mod` is "changeme". You should change this to
something more appropriate.

View file

@ -22,14 +22,18 @@ Wails has a number of common dependencies that are required before installation:
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:
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`
### NPM
Download NPM 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.
Download NPM 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.
@ -65,29 +69,37 @@ import TabItem from "@theme/TabItem";
## Optional Dependencies
- [UPX](https://upx.github.io/) for compressing your applications.
- [NSIS](https://wails.io/docs/guides/windows-installer/) for generating Windows installers.
- [NSIS](https://wails.io/docs/guides/windows-installer/) for generating Windows
installers.
## Installing Wails
Run `go install github.com/wailsapp/wails/v2/cmd/wails@latest` to install the Wails CLI.
Run `go install github.com/wailsapp/wails/v2/cmd/wails@latest` to install the
Wails CLI.
Note: If you get an error similar to this:
```shell
....\Go\pkg\mod\github.com\wailsapp\wails\v2@v2.1.0\pkg\templates\templates.go:28:12: pattern all:ides/*: no matching files found
```
please check you have Go 1.18+ installed:
```shell
go version
```
## System Check
Running `wails 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 `wails 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 `wails` command appears to be missing?
If your system is reporting that the `wails` command is missing, make sure you have followed the Go installation guide
correctly. Normally, it means that the `go/bin` directory in your User's home directory is not in the `PATH` environment
variable. You will also normally need to close and reopen any open command prompts so that changes to the environment
made by the installer are reflected at the command prompt.
If your system is reporting that the `wails` command is missing, make sure you
have followed the Go installation guide correctly. Normally, it means that the
`go/bin` directory in your User's home directory is not in the `PATH`
environment variable. You will also normally need to close and reopen any open
command prompts so that changes to the environment made by the installer are
reflected at the command prompt.

View file

@ -1,14 +1,16 @@
# Angular
Whilst Wails does not have an Angular template, it is possible to use Angular with Wails.
Whilst Wails does not have an Angular template, it is possible to use Angular
with Wails.
## Dev Mode
To get dev mode working with Angular, you need to add the following to your `wails.json`:
To get dev mode working with Angular, you need to add the following to your
`wails.json`:
```json
"frontend:build": "npx ng build",
"frontend:install": "npm install",
"frontend:dev:watcher": "npx ng serve",
"frontend:dev:serverUrl": "http://localhost:4200",
```
```

View file

@ -1,13 +1,16 @@
# Application Development
There are no hard and fast rules for developing applications with Wails, but there are some basic guidelines.
There are no hard and fast rules for developing applications with Wails, but
there are some basic guidelines.
## Application Setup
The pattern used by the default templates are that `main.go` is used for configuring and running the application, whilst
`app.go` is used for defining the application logic.
The pattern used by the default templates are that `main.go` is used for
configuring and running the application, whilst `app.go` is used for defining
the application logic.
The `app.go` file will define a struct that has 2 methods which act as hooks into the main application:
The `app.go` file will define a struct that has 2 methods which act as hooks
into the main application:
```go title="app.go"
type App struct {
@ -26,18 +29,23 @@ func (a *App) shutdown(ctx context.Context) {
}
```
- The startup method is called as soon as Wails allocates the resources it needs and is a good place for creating resources,
setting up event listeners and anything else the application needs at startup.
It is given a `context.Context` which is usually saved in a struct field. This context is needed for calling the
[runtime](../reference/runtime/intro.mdx). If this method returns an error, the application will terminate.
In dev mode, the error will be output to the console.
- The startup method is called as soon as Wails allocates the resources it needs
and is a good place for creating resources, setting up event listeners and
anything else the application needs at startup. It is given a
`context.Context` which is usually saved in a struct field. This context is
needed for calling the [runtime](../reference/runtime/intro.mdx). If this
method returns an error, the application will terminate. In dev mode, the
error will be output to the console.
- The shutdown method will be called by Wails right at the end of the shutdown process. This is a good place to deallocate
memory and perform any shutdown tasks.
- The shutdown method will be called by Wails right at the end of the shutdown
process. This is a good place to deallocate memory and perform any shutdown
tasks.
The `main.go` file generally consists of a single call to `wails.Run()`, which accepts the application configuration.
The pattern used by the templates is that before the call to `wails.Run()`, an instance of the struct we defined in
`app.go` is created and saved in a variable called `app`. This configuration is where we add our callbacks:
The `main.go` file generally consists of a single call to `wails.Run()`, which
accepts the application configuration. The pattern used by the templates is that
before the call to `wails.Run()`, an instance of the struct we defined in
`app.go` is created and saved in a variable called `app`. This configuration is
where we add our callbacks:
```go {3,9,10} title="main.go"
func main() {
@ -58,12 +66,14 @@ func main() {
```
More information on application lifecycle hooks can be found [here](../howdoesitwork.mdx#application-lifecycle-callbacks).
More information on application lifecycle hooks can be found
[here](../howdoesitwork.mdx#application-lifecycle-callbacks).
## Binding Methods
It is likely that you will want to call Go methods from the frontend. This is normally done by adding public methods to
the already defined struct in `app.go`:
It is likely that you will want to call Go methods from the frontend. This is
normally done by adding public methods to the already defined struct in
`app.go`:
```go {16-18} title="app.go"
type App struct {
@ -86,7 +96,8 @@ func (a *App) Greet(name string) string {
}
```
In the main application configuration, the `Bind` key is where we can tell Wails what we want to bind:
In the main application configuration, the `Bind` key is where we can tell Wails
what we want to bind:
```go {11-13} title="main.go"
func main() {
@ -110,13 +121,15 @@ func main() {
```
This will bind all public methods in our `App` struct (it will never bind the startup and shutdown methods).
This will bind all public methods in our `App` struct (it will never bind the
startup and shutdown methods).
### Dealing with context when binding multiple structs
If you want to bind methods for multiple structs but want each struct to keep a reference to the context so that you
can use the runtime functions, a good pattern is to pass the context from the `OnStartup` method to your struct instances
:
If you want to bind methods for multiple structs but want each struct to keep a
reference to the context so that you can use the runtime functions, a good
pattern is to pass the context from the `OnStartup` method to your struct
instances :
```go
func main() {
@ -144,13 +157,15 @@ func main() {
}
```
More information on Binding can be found [here](../howdoesitwork.mdx#method-binding).
More information on Binding can be found
[here](../howdoesitwork.mdx#method-binding).
## Application Menu
Wails supports adding a menu to your application. This is done by passing a [Menu](../reference/menus.mdx#menu) struct
to application config. It's common to use a method that returns a Menu, and even more common for that to be a method on
the `App` struct used for the lifecycle hooks.
Wails supports adding a menu to your application. This is done by passing a
[Menu](../reference/menus.mdx#menu) struct to application config. It's common to
use a method that returns a Menu, and even more common for that to be a method
on the `App` struct used for the lifecycle hooks.
```go {11} title="main.go"
func main() {
@ -177,52 +192,63 @@ func main() {
## Assets
The great thing about the way Wails v2 handles assets is that it doesn't! The only thing you need to give Wails is an
`embed.FS`. How you get to that is entirely up to you. You can use vanilla html/css/js files like the vanilla template.
You could have some complicated build system, it doesn't matter.
The great thing about the way Wails v2 handles assets is that it doesn't! The
only thing you need to give Wails is an `embed.FS`. How you get to that is
entirely up to you. You can use vanilla html/css/js files like the vanilla
template. You could have some complicated build system, it doesn't matter.
When `wails build` is run, it will check the `wails.json` project file at the project root. There are 2 keys in the
project file that are read:
When `wails build` is run, it will check the `wails.json` project file at the
project root. There are 2 keys in the project file that are read:
- "frontend:install"
- "frontend:build"
The first, if given, will be executed in the `frontend` directory to install the node modules.
The second, if given, will be executed in the `frontend` directory to build the frontend project.
The first, if given, will be executed in the `frontend` directory to install the
node modules. The second, if given, will be executed in the `frontend` directory
to build the frontend project.
If these 2 keys aren't given, then Wails does absolutely nothing with the frontend. It is only expecting that `embed.FS`.
If these 2 keys aren't given, then Wails does absolutely nothing with the
frontend. It is only expecting that `embed.FS`.
### AssetsHandler
A Wails v2 app can optionally define a `http.Handler` in the `options.App`, which allows hooking into the AssetServer to
create files on the fly or process POST/PUT requests.
GET requests are always first handled by the `assets` FS. If the FS doesn't find the requested file the request will be
forwarded to the `http.Handler` for serving. Any requests other than GET will be directly processed by the `AssetsHandler`
if specified.
It's also possible to only use the `AssetsHandler` by specifiy `nil` as the `Assets` option.
A Wails v2 app can optionally define a `http.Handler` in the `options.App`,
which allows hooking into the AssetServer to create files on the fly or process
POST/PUT requests. GET requests are always first handled by the `assets` FS. If
the FS doesn't find the requested file the request will be forwarded to the
`http.Handler` for serving. Any requests other than GET will be directly
processed by the `AssetsHandler` if specified. It's also possible to only use
the `AssetsHandler` by specifiy `nil` as the `Assets` option.
## Built in Dev Server
Running `wails dev` will start the built in dev server which will start a file watcher in your project directory. By
default, if any file changes, wails checks if it was an application file (default: `.go`, configurable with `-e` flag).
If it was, then it will rebuild your application and relaunch it. If the changed file was in the assets,
it will issue a reload after a short amount of time.
Running `wails dev` will start the built in dev server which will start a file
watcher in your project directory. By default, if any file changes, wails checks
if it was an application file (default: `.go`, configurable with `-e` flag). If
it was, then it will rebuild your application and relaunch it. If the changed
file was in the assets, it will issue a reload after a short amount of time.
The dev server uses a technique called "debouncing" which means it doesn't reload straight away,
as there may be multiple files changed in a short amount of time. When a trigger occurs, it waits for a set amount of time
before issuing a reload. If another trigger happens, it resets to the wait time again. By default this value is `100ms`.
If this value doesn't work for your project, it can be configured using the `-debounce` flag. If used, this value will
be saved to your project config and become the default.
The dev server uses a technique called "debouncing" which means it doesn't
reload straight away, as there may be multiple files changed in a short amount
of time. When a trigger occurs, it waits for a set amount of time before issuing
a reload. If another trigger happens, it resets to the wait time again. By
default this value is `100ms`. If this value doesn't work for your project, it
can be configured using the `-debounce` flag. If used, this value will be saved
to your project config and become the default.
## External Dev Server
Some frameworks come with their own live-reloading server, however they will not be able to take advantage of the Wails
Go bindings. In this scenario, it is best to run a watcher script that rebuilds the project into the build directory, which
Wails will be watching. For an example, see the default svelte template that uses [rollup](https://rollupjs.org/guide/en/).
For [create-react-app](https://create-react-app.dev/), it's possible to use
[this script](https://gist.github.com/int128/e0cdec598c5b3db728ff35758abdbafd) to achieve a similar result.
Some frameworks come with their own live-reloading server, however they will not
be able to take advantage of the Wails Go bindings. In this scenario, it is best
to run a watcher script that rebuilds the project into the build directory,
which Wails will be watching. For an example, see the default svelte template
that uses [rollup](https://rollupjs.org/guide/en/). For
[create-react-app](https://create-react-app.dev/), it's possible to use
[this script](https://gist.github.com/int128/e0cdec598c5b3db728ff35758abdbafd)
to achieve a similar result.
## Go Module
The default Wails templates generate a `go.mod` file that contains the module name "changeme". You should change this
to something more appropriate after project generation.
The default Wails templates generate a `go.mod` file that contains the module
name "changeme". You should change this to something more appropriate after
project generation.

View file

@ -1,15 +1,18 @@
# Dynamic Assets
If you want to load or generate assets for your frontend dynamically, you can achieve that using the
[AssetsHandler](../reference/options#assetshandler) option. The AssetsHandler is a generic `http.Handler` which will
be called for any non GET request on the assets server and for GET requests which can not be served from the
bundled assets because the file is not found.
If you want to load or generate assets for your frontend dynamically, you can
achieve that using the [AssetsHandler](../reference/options#assetshandler)
option. The AssetsHandler is a generic `http.Handler` which will be called for
any non GET request on the assets server and for GET requests which can not be
served from the bundled assets because the file is not found.
By installing a custom AssetsHandler, you can serve your own assets using a custom asset server.
By installing a custom AssetsHandler, you can serve your own assets using a
custom asset server.
## Example
In our example project, we will create a simple assets handler which will load files off disk:
In our example project, we will create a simple assets handler which will load
files off disk:
```go title=main.go {17-36,49}
package main
@ -75,7 +78,8 @@ func main() {
}
```
When we run the application in dev mode using `wails dev`, we will see the following output:
When we run the application in dev mode using `wails dev`, we will see the
following output:
```
DEB | [ExternalAssetHandler] Loading 'http://localhost:3001/favicon.ico'
@ -83,18 +87,19 @@ DEB | [ExternalAssetHandler] Loading 'http://localhost:3001/favicon.ico' failed,
Requesting file: favicon.ico
```
As you can see, the assets handler is called when the default assets server is unable to serve
the `favicon.ico` file.
As you can see, the assets handler is called when the default assets server is
unable to serve the `favicon.ico` file.
If you right click the main application and select "inspect" to bring up the devtools, you can test
this feature out by typing the following into the console:
If you right click the main application and select "inspect" to bring up the
devtools, you can test this feature out by typing the following into the
console:
```
let response = await fetch('does-not-exist.txt');
```
This will generate an error in the devtools. We can see that the error is what we expect, returned by
our custom assets handler:
This will generate an error in the devtools. We can see that the error is what
we expect, returned by our custom assets handler:
```mdx-code-block
<p className="text--center">
@ -112,8 +117,8 @@ However, if we request `go.mod`, we will see the following output:
</p>
```
This technique can be used to load images directly into the page. If we updated our default vanilla template and
replaced the logo image:
This technique can be used to load images directly into the page. If we updated
our default vanilla template and replaced the logo image:
```html
<img id="logo" class="logo" />
@ -138,7 +143,7 @@ Then we would see the following:
:::warning
Exposing your filesystem in this way is a security risk. It is recommended that you properly manage access
to your filesystem.
Exposing your filesystem in this way is a security risk. It is recommended that
you properly manage access to your filesystem.
:::

View file

@ -1,11 +1,14 @@
# Frameless Applications
Wails supports application that have no frames. This can be achieved by using the [frameless](../reference/options.mdx#frameless)
field in [Application Options](../reference/options.mdx#application-options).
Wails supports application that have no frames. This can be achieved by using
the [frameless](../reference/options.mdx#frameless) field in
[Application Options](../reference/options.mdx#application-options).
Wails offers a simple solution for dragging the window: Any HTML element that has the CSS style `--wails-draggable:drag` will
act as a "drag handle". This property applies to all child elements. If you need to indicate that a nested element
should not drag, then use the attribute '--wails-draggable:no-drag' on that element.
Wails offers a simple solution for dragging the window: Any HTML element that
has the CSS style `--wails-draggable:drag` will act as a "drag handle". This
property applies to all child elements. If you need to indicate that a nested
element should not drag, then use the attribute '--wails-draggable:no-drag' on
that element.
```html
<html>
@ -26,8 +29,9 @@ should not drag, then use the attribute '--wails-draggable:no-drag' on that elem
</html>
```
For some projects, using a CSS variable may not be possible due to dynamic styling. In this case, you can use the
`CSSDragProperty` and `CSSDragValue` application options to define a property and value that will be used to indicate
For some projects, using a CSS variable may not be possible due to dynamic
styling. In this case, you can use the `CSSDragProperty` and `CSSDragValue`
application options to define a property and value that will be used to indicate
draggable regions:
```go title=main.go
@ -87,6 +91,7 @@ func main() {
:::info Fullscreen
If you allow your application to go fullscreen, this drag functionality will be disabled.
If you allow your application to go fullscreen, this drag functionality will be
disabled.
:::

View file

@ -2,8 +2,9 @@
## Script Injection
When Wails serves your `index.html`, by default, it will inject 2 script entries into the `<body>` tag to load `/wails/ipc.js`
and `/wails/runtime.js`. These files install the bindings and runtime respectively.
When Wails serves your `index.html`, by default, it will inject 2 script entries
into the `<body>` tag to load `/wails/ipc.js` and `/wails/runtime.js`. These
files install the bindings and runtime respectively.
The code below shows where these are injected by default:
@ -31,7 +32,8 @@ The code below shows where these are injected by default:
### Overriding Default Script Injection
To provide more flexibility to developers, there is a meta tag that may be used to customise this behaviour:
To provide more flexibility to developers, there is a meta tag that may be used
to customise this behaviour:
```html
<meta name="wails-options" content="[options]" />

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