Compare commits

...

72 Commits

Author SHA1 Message Date
Lea Anthony
7c249e9c6b v1.12.0-pre2 2021-02-04 20:17:08 +11:00
Lea Anthony
cb03409e3a Expose Once and OnMultiple 2021-02-04 20:15:36 +11:00
Lea Anthony
40db3587cb Update Contributors 2021-01-25 21:15:23 +11:00
Lea Anthony
6228328278 v1.12.0-pre1 2021-01-25 21:13:42 +11:00
Sophie Au
17a9cf4afb Remove spec option in babel config (#593) 2021-01-25 08:36:30 +11:00
Lea Anthony
3567ec9865 Merge remote-tracking branch 'origin/develop' into develop 2021-01-04 19:54:10 +11:00
Lea Anthony
1a3cefd180 Add Pace to Thanks 2021-01-04 19:53:43 +11:00
Lea Anthony
5ced28cb74 Merge branch 'master' into develop 2021-01-04 13:46:46 +11:00
Lea Anthony
0d49a8cc83 v1.11.0 2021-01-04 13:46:08 +11:00
Lea Anthony
9cd5ad69ce Test fix for linux high CPU usage 2020-12-29 07:48:18 +11:00
Lea Anthony
7dbf74c3e0 v1.11.0-pre3 2020-12-29 07:38:44 +11:00
Lea Anthony
6613cff1d5 Merge remote-tracking branch 'origin/develop' into develop 2020-12-29 07:29:48 +11:00
Lea Anthony
6a2700e0bf Limit v1 updates to v1 2020-12-29 07:26:24 +11:00
Lea Anthony
2a6162a91f v1.11.0-pre2 2020-12-17 20:52:57 +11:00
Lea Anthony
4e54229dfb Remove debug info 2020-12-17 20:52:31 +11:00
dependabot[bot]
ce58e9eb6c Bump ini from 1.3.5 to 1.3.8 in /runtime/js (#573)
* resolve angular routing broken when app is built

* Revert "resolve angular routing broken when app is built"

This reverts commit e0aab7c27f.

* Update issue templates

* v1.8.1 (#546)

* resolve angular routing broken when app is built

* Updated contributors

* handle Set error on Update method

* Remove incorrect build flag

* v1.8.1-pre1

* added Get method

* fixed return

* implement gopath handling during cross compilation

* update messages to output xgo version

TODO: allow image override

* use wailsapp/xgo:1.0.1 for cross-compiling

* Support platform list in templates

* Add warnings for windows builds

* add fields Tags to ProjectOptions

* add args tags to func BuildNative

* add tags to func BuildDocker

* delete escape tags

* Update Contributors

* feat: Vue3, Vue Router, Vuex, and Typescript Template

* converted spaces to tabs in vue.config.js

* single quotes and tabs

Converted vue.config.js to using single quotes
Converted example.spec.ts to tabs instead of spaces.

* Added semicolons and mocha import

* Update contributors

* Make vue 3 template linux/mac only

* Add tags to build

* Add v2 artefacts

* Update Vuetify in package.json (#537)

* Update contributors

* Replaced the old v-content tag with the new v-main (#536)

* v1.8.1-pre4

* v1.8.1-pre5

* Update issue templates (#541)

* Updated Contributors

* Remove zero copy string conversion

* v1.8.1-pre6

* Initial support for firebug (#543)

* Initial support for firebug

* Remove windows message

* v1.8.1-pre7

* Update contributors

* Allow use of custom HTML

* Allow use of custom HTML (#545)

* v1.8.1

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>

* v1.10.1 (#572)

* Bump ini from 1.3.5 to 1.3.8 in /runtime/js

Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-16 21:38:14 +11:00
dependabot[bot]
3c49577d5b Bump ini from 1.3.5 to 1.3.8 in /runtime/js/runtime (#575)
* resolve angular routing broken when app is built

* Revert "resolve angular routing broken when app is built"

This reverts commit e0aab7c27f.

* Update issue templates

* v1.8.1 (#546)

* resolve angular routing broken when app is built

* Updated contributors

* handle Set error on Update method

* Remove incorrect build flag

* v1.8.1-pre1

* added Get method

* fixed return

* implement gopath handling during cross compilation

* update messages to output xgo version

TODO: allow image override

* use wailsapp/xgo:1.0.1 for cross-compiling

* Support platform list in templates

* Add warnings for windows builds

* add fields Tags to ProjectOptions

* add args tags to func BuildNative

* add tags to func BuildDocker

* delete escape tags

* Update Contributors

* feat: Vue3, Vue Router, Vuex, and Typescript Template

* converted spaces to tabs in vue.config.js

* single quotes and tabs

Converted vue.config.js to using single quotes
Converted example.spec.ts to tabs instead of spaces.

* Added semicolons and mocha import

* Update contributors

* Make vue 3 template linux/mac only

* Add tags to build

* Add v2 artefacts

* Update Vuetify in package.json (#537)

* Update contributors

* Replaced the old v-content tag with the new v-main (#536)

* v1.8.1-pre4

* v1.8.1-pre5

* Update issue templates (#541)

* Updated Contributors

* Remove zero copy string conversion

* v1.8.1-pre6

* Initial support for firebug (#543)

* Initial support for firebug

* Remove windows message

* v1.8.1-pre7

* Update contributors

* Allow use of custom HTML

* Allow use of custom HTML (#545)

* v1.8.1

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>

* v1.10.1 (#572)

* Bump ini from 1.3.5 to 1.3.8 in /runtime/js/runtime

Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-16 21:37:08 +11:00
Lea Anthony
fb8aa8cc24 v1.11.0-pre1 2020-12-16 21:31:53 +11:00
Lea Anthony
b45e04f2db v1.11.0-rc1 2020-12-16 21:31:21 +11:00
Elie Grenon (DrunkenPoney)
026daf5e57 Fix vue template dependencies versions (fixes #574) (#576)
* resolve angular routing broken when app is built

* Revert "resolve angular routing broken when app is built"

This reverts commit e0aab7c27f.

* Update issue templates

* v1.8.1 (#546)

* resolve angular routing broken when app is built

* Updated contributors

* handle Set error on Update method

* Remove incorrect build flag

* v1.8.1-pre1

* added Get method

* fixed return

* implement gopath handling during cross compilation

* update messages to output xgo version

TODO: allow image override

* use wailsapp/xgo:1.0.1 for cross-compiling

* Support platform list in templates

* Add warnings for windows builds

* add fields Tags to ProjectOptions

* add args tags to func BuildNative

* add tags to func BuildDocker

* delete escape tags

* Update Contributors

* feat: Vue3, Vue Router, Vuex, and Typescript Template

* converted spaces to tabs in vue.config.js

* single quotes and tabs

Converted vue.config.js to using single quotes
Converted example.spec.ts to tabs instead of spaces.

* Added semicolons and mocha import

* Update contributors

* Make vue 3 template linux/mac only

* Add tags to build

* Add v2 artefacts

* Update Vuetify in package.json (#537)

* Update contributors

* Replaced the old v-content tag with the new v-main (#536)

* v1.8.1-pre4

* v1.8.1-pre5

* Update issue templates (#541)

* Updated Contributors

* Remove zero copy string conversion

* v1.8.1-pre6

* Initial support for firebug (#543)

* Initial support for firebug

* Remove windows message

* v1.8.1-pre7

* Update contributors

* Allow use of custom HTML

* Allow use of custom HTML (#545)

* v1.8.1

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>

* v1.10.1 (#572)

* fix dependencies versions

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>
2020-12-16 21:27:15 +11:00
Lea Anthony
7c04a854da v1.10.1 (#572) 2020-12-08 20:50:58 +11:00
Lea Anthony
7832a3be19 v1.10.1 2020-12-08 20:50:08 +11:00
Lea Anthony
39d687fa31 Merge branch 'develop' 2020-12-08 20:43:40 +11:00
Lea Anthony
8a768cce77 v1.10.0 2020-12-08 20:40:37 +11:00
Lea Anthony
ee04a9235d Merge commit '73ee9ef5307c6fa12007395efc68c900ba90070a' 2020-12-08 20:39:29 +11:00
Lea Anthony
7e67562e19 Support EndeavourOS (#565) 2020-11-26 20:44:42 +11:00
Lea Anthony
25d8a8763a v1.10.0-pre1 2020-11-01 06:32:42 +11:00
Lea Anthony
7929584ec5 542 use supplied html (#547)
* Fix custom HTML

* Update HTML escaping

* Added more docs around config
2020-11-01 06:31:35 +11:00
Lea Anthony
73ee9ef530 v1.9.1 2020-10-31 16:24:35 +11:00
Lea Anthony
003eecc4ff Fix firebug flag 2020-10-31 16:23:23 +11:00
Lea Anthony
f97341abbe Revert "Allow use of custom HTML (#545)"
This reverts commit dc605c1683.
2020-10-31 16:15:29 +11:00
Lea Anthony
e2599c0f76 v1.9.0 2020-10-29 20:20:26 +11:00
Lea Anthony
0c2c56e1dd v1.8.1 (#546)
* resolve angular routing broken when app is built

* Updated contributors

* handle Set error on Update method

* Remove incorrect build flag

* v1.8.1-pre1

* added Get method

* fixed return

* implement gopath handling during cross compilation

* update messages to output xgo version

TODO: allow image override

* use wailsapp/xgo:1.0.1 for cross-compiling

* Support platform list in templates

* Add warnings for windows builds

* add fields Tags to ProjectOptions

* add args tags to func BuildNative

* add tags to func BuildDocker

* delete escape tags

* Update Contributors

* feat: Vue3, Vue Router, Vuex, and Typescript Template

* converted spaces to tabs in vue.config.js

* single quotes and tabs

Converted vue.config.js to using single quotes
Converted example.spec.ts to tabs instead of spaces.

* Added semicolons and mocha import

* Update contributors

* Make vue 3 template linux/mac only

* Add tags to build

* Add v2 artefacts

* Update Vuetify in package.json (#537)

* Update contributors

* Replaced the old v-content tag with the new v-main (#536)

* v1.8.1-pre4

* v1.8.1-pre5

* Update issue templates (#541)

* Updated Contributors

* Remove zero copy string conversion

* v1.8.1-pre6

* Initial support for firebug (#543)

* Initial support for firebug

* Remove windows message

* v1.8.1-pre7

* Update contributors

* Allow use of custom HTML

* Allow use of custom HTML (#545)

* v1.8.1

Co-authored-by: Arthur Wiebe <arthur@artooro.com>
Co-authored-by: Ilgıt Yıldırım <ilgit.yildirim@triplebits.com>
Co-authored-by: Travis McLane <tmclane@gmail.com>
Co-authored-by: Altynbek <go.gelleson@gmail.com>
Co-authored-by: Kyle Muchmore <kyle.muchmore@kickview.com>
Co-authored-by: Balakrishna Prasad Ganne <balkripra.1996@gmail.com>
2020-10-29 20:18:52 +11:00
Lea Anthony
39878c1a52 v1.8.1 2020-10-29 20:17:42 +11:00
Lea Anthony
c0932f3fa4 Merge branches '542-use-supplied-HTML' and 'develop' of github.com:wailsapp/wails into develop 2020-10-29 20:17:37 +11:00
Lea Anthony
dc605c1683 Allow use of custom HTML (#545) 2020-10-29 19:57:11 +11:00
Lea Anthony
c7c9ace232 Allow use of custom HTML 2020-10-29 19:54:49 +11:00
Lea Anthony
5be197b68f Update contributors 2020-10-28 21:33:06 +11:00
Lea Anthony
3e5c406c95 Merge branch 'develop' of https://github.com/wailsapp/wails into develop 2020-10-28 21:21:13 +11:00
Lea Anthony
be6bebebe4 v1.8.1-pre7 2020-10-28 21:21:10 +11:00
Lea Anthony
5b33ed28fd Initial support for firebug (#543)
* Initial support for firebug

* Remove windows message
2020-10-28 21:20:47 +11:00
Lea Anthony
b7a59daee1 v1.8.1-pre6 2020-10-28 20:39:06 +11:00
Lea Anthony
3d4ea3918b Remove zero copy string conversion 2020-10-28 20:38:33 +11:00
Lea Anthony
4347d950d1 Updated Contributors 2020-10-28 08:41:07 +11:00
Lea Anthony
5267968151 Merge branch 'master' of github.com:wailsapp/wails into master 2020-10-27 21:11:53 +11:00
Lea Anthony
7b31c8ddd2 Update issue templates 2020-10-27 21:11:46 +11:00
Lea Anthony
8e096ff0b0 Update issue templates (#541) 2020-10-27 21:08:10 +11:00
Lea Anthony
6a03a5f8eb Merge branch 'develop' of https://github.com/wailsapp/wails into develop 2020-10-26 20:02:59 +11:00
Lea Anthony
6116f5fc05 v1.8.1-pre5 2020-10-26 20:02:54 +11:00
Lea Anthony
c49192e847 Merge branch 'develop' of github.com:wailsapp/wails into develop 2020-10-26 20:00:48 +11:00
Lea Anthony
6fb2489dae v1.8.1-pre4 2020-10-26 19:55:55 +11:00
Balakrishna Prasad Ganne
c1acbed2c7 Replaced the old v-content tag with the new v-main (#536) 2020-10-26 18:44:51 +11:00
Lea Anthony
8f6275721a Update contributors 2020-10-26 18:43:47 +11:00
Balakrishna Prasad Ganne
ef40a2eb8e Update Vuetify in package.json (#537) 2020-10-26 18:43:04 +11:00
Lea Anthony
4f7b5c71d1 Merge branch 'develop' of github.com:wailsapp/wails into develop 2020-10-26 09:03:04 +11:00
Lea Anthony
49db62afd0 Add v2 artefacts 2020-10-26 09:02:56 +11:00
Lea Anthony
9098632aa3 Add tags to build 2020-10-25 20:44:44 +11:00
Lea Anthony
f87a0f039a Make vue 3 template linux/mac only 2020-10-25 20:33:04 +11:00
Lea Anthony
a03f5871bd Update contributors 2020-10-25 20:30:47 +11:00
Kyle Muchmore
46f026c04c Added semicolons and mocha import 2020-10-25 20:30:08 +11:00
Kyle Muchmore
5e2373acb1 single quotes and tabs
Converted vue.config.js to using single quotes
Converted example.spec.ts to tabs instead of spaces.
2020-10-25 20:30:08 +11:00
Kyle Muchmore
918d6240f2 converted spaces to tabs in vue.config.js 2020-10-25 20:30:08 +11:00
Kyle Muchmore
453a225427 feat: Vue3, Vue Router, Vuex, and Typescript Template 2020-10-25 20:30:08 +11:00
Lea Anthony
2795684d5c Update Contributors 2020-10-25 20:27:40 +11:00
Altynbek
e295a5abd9 delete escape tags 2020-10-25 20:26:29 +11:00
Altynbek
fdf18b7dfa add tags to func BuildDocker 2020-10-25 20:26:29 +11:00
Altynbek
1e95d0eb44 add args tags to func BuildNative 2020-10-25 20:26:29 +11:00
Altynbek
d7f2d800de add fields Tags to ProjectOptions 2020-10-25 20:26:29 +11:00
Lea Anthony
ef4d9ae97c Add warnings for windows builds 2020-10-25 13:57:22 +11:00
Lea Anthony
e8a85d4cd6 Support platform list in templates 2020-10-16 15:15:49 +11:00
Lea Anthony
1e2bc5728a Revert "resolve angular routing broken when app is built"
This reverts commit e0aab7c27f.
2020-09-10 14:10:24 +10:00
Arthur Wiebe
e0aab7c27f resolve angular routing broken when app is built 2020-09-10 14:10:00 +10:00
58 changed files with 797 additions and 97 deletions

View File

@@ -8,8 +8,12 @@ assignees: ''
---
#####################################################
If you have a technical issue, please do not open a bug this way!
Please use the `wails issue` command!
**If you have a technical issue, please do not open a bug this way!**
Please use the `wails issue` command!
If you do not do this then the issue may be closed automatically.
NOTE: If your bug is related to Windows, make sure you read
the [Windows Developer Guide](https://wails.app/guides/windows/)
#####################################################
**Description**
@@ -33,3 +37,5 @@ Please provide your platform, GO version and variables, etc
**Additional context**
Add any other context about the problem here.
- [ ] This issue is for Windows and I have read the [Windows Developer Guide](https://wails.app/guides/windows/)

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

7
.gitignore vendored
View File

@@ -16,4 +16,9 @@ examples/**/example*
cmd/wails/wails
.DS_Store
tmp
node_modules/
node_modules/
v2/test/kitchensink/frontend/public
v2/internal/ffenestri/runtime.c
v2/internal/runtime/assets/desktop.js
v2/test/kitchensink/build/darwin/desktop/kitchensink
v2/test/kitchensink/frontend/package.json.md5

View File

@@ -35,3 +35,10 @@ Wails is what it is because of the time and effort given by these great people.
* [Dmitry Gomzyakov](https://github.com/kyoto44)
* [Arthur Wiebe](https://github.com/artooro)
* [Ilgıt Yıldırım](https://github.com/ilgityildirim)
* [Altynbek](https://github.com/gelleson)
* [Kyle](https://github.com/kmuchmore)
* [Balakrishna Prasad Ganne](https://github.com/aayush420)
* [Charaf Rezrazi](https://github.com/Rezrazi)
* [misitebao](https://github.com/misitebao)
* [Elie Grenon](https://github.com/DrunkenPoney)
* [SophieAu](https://github.com/SophieAu)

View File

@@ -147,7 +147,12 @@ This project was mainly coded to the following albums:
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_large)
## Special Thank You
## Special Thanks
<p align="center" style="text-align: center">
A *huge* thanks to <a href="https://pace.dev"><img src="pace.jpeg"/> Pace</a> for sponsoring the project and helping the efforts to get Wails ported to Apple Silicon!<br/><br/>
If you are looking for a Project Management tool that's powerful but quick and easy to use, check them out!<br/><br/>
</p>
<p align="center" style="text-align: center">
A special thank you to JetBrains for donating licenses to us!<br/><br/>

6
app.go
View File

@@ -2,7 +2,6 @@ package wails
import (
"os"
"runtime"
"syscall"
"github.com/syossan27/tebata"
@@ -117,11 +116,6 @@ func (a *App) start() error {
return err
}
// Enable console for Windows debug builds
if runtime.GOOS == "windows" && BuildMode == cmd.BuildModeDebug {
a.renderer.EnableConsole()
}
// Start signal handler
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
t.Reserve(func() {

View File

@@ -143,6 +143,7 @@ func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOpt
"-v", fmt.Sprintf("%s:/build", filepath.Join(fs.Cwd(), "build")),
"-v", fmt.Sprintf("%s:/source", fs.Cwd()),
"-e", fmt.Sprintf("LOCAL_USER_ID=%v", userid),
"-e", fmt.Sprintf("FLAG_TAGS=%s", projectOptions.Tags),
"-e", fmt.Sprintf("FLAG_LDFLAGS=%s", ldFlags(projectOptions, buildMode)),
"-e", "FLAG_V=false",
"-e", "FLAG_X=false",
@@ -248,6 +249,10 @@ func BuildNative(binaryName string, forceRebuild bool, buildMode string, project
buildCommand.AddSlice([]string{"-ldflags", ldFlags(projectOptions, buildMode)})
if projectOptions.Tags != "" {
buildCommand.AddSlice([]string{"--tags", projectOptions.Tags})
}
if projectOptions.Verbose {
fmt.Printf("Command: %v\n", buildCommand.AsSlice())
}
@@ -535,6 +540,9 @@ func InstallProdRuntime(projectDir string, projectOptions *ProjectOptions) error
func ServeProject(projectOptions *ProjectOptions, logger *Logger) error {
go func() {
time.Sleep(2 * time.Second)
if projectOptions.Platform == "windows" {
logger.Yellow("*** Please note: Windows builds use mshtml which is only compatible with IE11. We strongly recommend only using IE11 when running 'wails serve'! For more information, please read https://wails.app/guides/windows/ ***")
}
logger.Green(">>>>> To connect, you will need to run '" + projectOptions.FrontEnd.Serve + "' in the '" + projectOptions.FrontEnd.Dir + "' directory <<<<<")
}()
location, err := filepath.Abs(filepath.Join("build", projectOptions.BinaryName))
@@ -566,6 +574,10 @@ func ldFlags(po *ProjectOptions, buildMode string) string {
ldflags += "-H windowsgui "
}
if po.UseFirebug {
ldflags += "-X github.com/wailsapp/wails/lib/renderer.UseFirebug=true "
}
ldflags += "-X github.com/wailsapp/wails.BuildMode=" + buildMode
// Add additional ldflags passed in via the `ldflags` cli flag

View File

@@ -65,6 +65,8 @@ const (
Solus
// Ctlos Linux distribution
Ctlos
// EndeavourOS linux distribution
EndeavourOS
)
// DistroInfo contains all the information relating to a linux distribution
@@ -132,7 +134,7 @@ func parseOsRelease(osRelease string) *DistroInfo {
case "archlabs":
result.Distribution = ArchLabs
case "ctlos":
result.Distribution = Ctlos
result.Distribution = Ctlos
case "debian":
result.Distribution = Debian
case "ubuntu":
@@ -171,6 +173,8 @@ func parseOsRelease(osRelease string) *DistroInfo {
result.Distribution = PopOS
case "solus":
result.Distribution = Solus
case "endeavouros":
result.Distribution = EndeavourOS
default:
result.Distribution = Unknown
}

View File

@@ -202,7 +202,16 @@ distributions:
name: Ctlos Linux
gccversioncommand: *gccdumpversion
programs: *archdefaultprograms
libraries: *archdefaultlibraries
libraries: *archdefaultlibraries
endeavouros:
id: endeavouros
releases:
default:
version: default
name: EndeavourOS
gccversioncommand: *gccdumpversion
programs: *archdefaultprograms
libraries: *archdefaultlibraries
manjaro:
id: manjaro
releases:

View File

@@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"sort"
"strings"
@@ -150,6 +151,7 @@ type ProjectOptions struct {
Template string `json:"-"`
BinaryName string `json:"binaryname"`
FrontEnd *frontend `json:"frontend,omitempty"`
Tags string `json:"tags"`
NPMProjectName string `json:"-"`
system *SystemHelper
log *Logger
@@ -163,6 +165,24 @@ type ProjectOptions struct {
Architecture string
LdFlags string
GoPath string
UseFirebug bool
// Supported platforms
Platforms []string `json:"platforms,omitempty"`
}
// PlatformSupported returns true if the template is supported
// on the current platform
func (po *ProjectOptions) PlatformSupported() bool {
// Default is all platforms supported
if len(po.Platforms) == 0 {
return true
}
// Check that the platform is in the list
platformsSupported := slicer.String(po.Platforms)
return platformsSupported.Contains(runtime.GOOS)
}
// Defaults sets the default project template
@@ -233,13 +253,16 @@ func (po *ProjectOptions) PromptForInputs() error {
for _, k := range keys {
templateDetail := templateDetails[k]
templateList.Add(templateDetail)
if !templateDetail.Metadata.PlatformSupported() {
templateDetail.Metadata.Name = "* " + templateDetail.Metadata.Name
}
options.Add(fmt.Sprintf("%s - %s", templateDetail.Metadata.Name, templateDetail.Metadata.ShortDescription))
}
templateIndex := 0
if len(options.AsSlice()) > 1 {
templateIndex = PromptSelection("Please select a template", options.AsSlice(), 0)
templateIndex = PromptSelection("Please select a template (* means unsupported on current platform)", options.AsSlice(), 0)
}
if len(templateList.AsSlice()) == 0 {
@@ -250,6 +273,10 @@ func (po *ProjectOptions) PromptForInputs() error {
po.selectedTemplate = templateList.AsSlice()[templateIndex].(*TemplateDetails)
}
po.selectedTemplate.Metadata.Name = strings.TrimPrefix(po.selectedTemplate.Metadata.Name, "* ")
if !po.selectedTemplate.Metadata.PlatformSupported() {
println("WARNING: This template is unsupported on this platform!")
}
fmt.Println("Template: " + po.selectedTemplate.Metadata.Name)
// Setup NPM Project name
@@ -372,5 +399,9 @@ func processTemplateMetadata(templateMetadata *TemplateMetadata, po *ProjectOpti
}
po.FrontEnd.Serve = templateMetadata.Serve
}
// Save platforms
po.Platforms = templateMetadata.Platforms
return nil
}

View File

@@ -24,11 +24,19 @@ func NewSemanticVersion(version string) (*SemanticVersion, error) {
// IsRelease returns true if it's a release version
func (s *SemanticVersion) IsRelease() bool {
// Limit to v1
if s.Version.Major() != 1 {
return false
}
return len(s.Version.Prerelease()) == 0 && len(s.Version.Metadata()) == 0
}
// IsPreRelease returns true if it's a prerelease version
func (s *SemanticVersion) IsPreRelease() bool {
// Limit to v1
if s.Version.Major() != 1 {
return false
}
return len(s.Version.Prerelease()) > 0
}

65
cmd/semver_test.go Normal file
View File

@@ -0,0 +1,65 @@
package cmd
import (
"testing"
)
func TestSemanticVersion_IsPreRelease(t *testing.T) {
tests := []struct {
name string
version string
want bool
}{
{"v1.6.7-pre0", "v1.6.7-pre0", true},
{"v2.6.7+pre0", "v2.6.7+pre0", false},
{"v2.6.7", "v2.6.7", false},
{"v2.0.0+alpha.1", "v2.0.0+alpha.1", false},
{"v2.0.0-alpha.1", "v2.0.0-alpha.1", false},
{"v1.6.7", "v1.6.7", false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
semanticversion, err := NewSemanticVersion(tt.version)
if err != nil {
t.Errorf("Invalid semantic version: %s", semanticversion)
return
}
s := &SemanticVersion{
Version: semanticversion.Version,
}
if got := s.IsPreRelease(); got != tt.want {
t.Errorf("IsPreRelease() = %v, want %v", got, tt.want)
}
})
}
}
func TestSemanticVersion_IsRelease(t *testing.T) {
tests := []struct {
name string
version string
want bool
}{
{"v1.6.7", "v1.6.7", true},
{"v2.6.7-pre0", "v2.6.7-pre0", false},
{"v2.6.7", "v2.6.7", false},
{"v2.6.7+release", "v2.6.7+release", false},
{"v2.0.0-alpha.1", "v2.0.0-alpha.1", false},
{"v1.6.7-pre0", "v1.6.7-pre0", false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
semanticversion, err := NewSemanticVersion(tt.version)
if err != nil {
t.Errorf("Invalid semantic version: %s", semanticversion)
return
}
s := &SemanticVersion{
Version: semanticversion.Version,
}
if got := s.IsRelease(); got != tt.want {
t.Errorf("IsRelease() = %v, want %v", got, tt.want)
}
})
}
}

View File

@@ -276,7 +276,7 @@ func CheckDependencies(logger *Logger) (bool, error) {
switch distroInfo.Distribution {
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS:
libraryChecker = DpkgInstalled
case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM:
case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM, EndeavourOS:
libraryChecker = PacmanInstalled
case CentOS, Fedora, Tumbleweed, Leap:
libraryChecker = RpmInstalled

View File

@@ -7,6 +7,7 @@ import (
"io/ioutil"
"log"
"path/filepath"
"runtime"
"strings"
"text/template"
@@ -29,6 +30,26 @@ type TemplateMetadata struct {
Bridge string `json:"bridge"`
WailsDir string `json:"wailsdir"`
TemplateDependencies []*TemplateDependency `json:"dependencies,omitempty"`
// List of platforms that this template is supported on.
// No value means all platforms. A platform name is the same string
// as `runtime.GOOS` will return, eg: "darwin". NOTE: This is
// case sensitive.
Platforms []string `json:"platforms,omitempty"`
}
// PlatformSupported returns true if this template supports the
// currently running platform
func (m *TemplateMetadata) PlatformSupported() bool {
// Default is all platforms supported
if len(m.Platforms) == 0 {
return true
}
// Check that the platform is in the list
platformsSupported := slicer.String(m.Platforms)
return platformsSupported.Contains(runtime.GOOS)
}
// TemplateDependency defines a binary dependency for the template
@@ -128,11 +149,11 @@ func (t *TemplateHelper) GetTemplateDetails() (map[string]*TemplateDetails, erro
result[name] = &TemplateDetails{
Path: dir,
}
_ = &TemplateMetadata{}
metadata, err := t.LoadMetadata(dir)
if err != nil {
return nil, err
}
result[name].Metadata = metadata
if metadata.Name != "" {
result[name].Name = metadata.Name

View File

@@ -80,7 +80,6 @@ export default {
{
targets: '> 0.25%, not dead, IE 11',
modules: false,
spec: true,
useBuiltIns: 'usage',
forceAllTransforms: true,
corejs: 3,

View File

@@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

View File

@@ -0,0 +1,29 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/typescript/recommended'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
mocha: true
}
}
]
}

View File

@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*

View File

@@ -0,0 +1,35 @@
# vue basic
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Run your tests
```
npm run test
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@@ -0,0 +1,37 @@
{
"name": "{{.NPMProjectName}}",
"author": "{{.Author.Name}}<{{.Author.Email}}>",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
},
"dependencies": {
"vue": "^3.0.0-0",
"vue-router": "^4.0.0-0",
"regenerator-runtime": "^0.13.7",
"@wailsapp/runtime": "^1.1.1"
},
"devDependencies": {
"@types/chai": "^4.2.12",
"@types/mocha": "^8.0.3",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"@vue/cli-plugin-eslint": "~4.5.9",
"@vue/cli-plugin-router": "~4.5.9",
"@vue/cli-plugin-typescript": "~4.5.9",
"@vue/cli-plugin-unit-mocha": "~4.5.9",
"@vue/cli-service": "~4.5.9",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"@vue/test-utils": "^2.0.0-0",
"chai": "^4.2.0",
"eslint": "<7.0.0",
"eslint-plugin-vue": "^7.0.0",
"node-sass": "^4.14.1",
"sass-loader": "^10.0.2",
"typescript": "~4.0.3"
}
}

View File

@@ -0,0 +1,32 @@
<template>
<div id=app>
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view/>
</div>
</template>
<style lang="scss">
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
a {
font-weight: bold;
color: #2c3e50;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

View File

@@ -0,0 +1,34 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
export default defineComponent({
name: 'HelloWorld',
props: {
msg: String,
},
});
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@@ -0,0 +1,8 @@
import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import * as Wails from '@wailsapp/runtime';
Wails.Init(() => {
createApp(App).use(router).mount('#app');
});

View File

@@ -0,0 +1,27 @@
import { createRouter, createMemoryHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'
import About from '../views/About.vue'
const routes: Array<RouteRecordRaw> = [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/about',
name: 'About',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
// component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
component: About
}
]
const router = createRouter({
history: createMemoryHistory(),
routes
})
export default router

View File

@@ -0,0 +1,5 @@
declare module '*.vue' {
import { defineComponent } from 'vue'
const component: ReturnType<typeof defineComponent>
export default component
}

View File

@@ -0,0 +1,5 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>

View File

@@ -0,0 +1,40 @@
<template>
<div class="home">
<img @click="getMessage" alt="Vue logo" src="../assets/appicon.png" :style="{ height: '400px' }"/>
<HelloWorld :msg="message" />
</div>
</template>
<script lang="ts">
import { ref, defineComponent } from "vue";
import HelloWorld from "@/components/HelloWorld.vue"; // @ is an alias to /src
interface Backend {
basic(): Promise<string>;
}
declare global {
interface Window {
backend: Backend;
}
}
export default defineComponent({
name: "Home",
components: {
HelloWorld,
},
setup() {
const message = ref("Click the Icon");
const getMessage = () => {
window.backend.basic().then(result => {
message.value = result;
});
}
return { message: message, getMessage: getMessage };
},
});
</script>

View File

@@ -0,0 +1,14 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { shallowMount } from '@vue/test-utils';
import HelloWorld from '@/components/HelloWorld.vue';
describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
const msg = 'new message';
const wrapper = shallowMount(HelloWorld, {
props: { msg }
});
expect(wrapper.text()).to.include(msg);
});
});

View File

@@ -0,0 +1,41 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env",
"mocha",
"chai"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}

View File

@@ -0,0 +1,42 @@
let cssConfig = {};
if (process.env.NODE_ENV == 'production') {
cssConfig = {
extract: {
filename: '[name].css',
chunkFilename: '[name].css'
}
};
}
module.exports = {
chainWebpack: config => {
let limit = 9999999999999999;
config.module
.rule('images')
.test(/\.(png|gif|jpg)(\?.*)?$/i)
.use('url-loader')
.loader('url-loader')
.tap(options => Object.assign(options, { limit: limit }));
config.module
.rule('fonts')
.test(/\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/i)
.use('url-loader')
.loader('url-loader')
.options({
limit: limit
});
},
css: cssConfig,
configureWebpack: {
output: {
filename: '[name].js'
},
optimization: {
splitChunks: false
}
},
devServer: {
disableHostCheck: true
}
};

View File

@@ -0,0 +1,5 @@
module {{.BinaryName}}
require (
github.com/wailsapp/wails {{.WailsVersion}}
)

View File

@@ -0,0 +1,27 @@
package main
import (
"github.com/leaanthony/mewn"
"github.com/wailsapp/wails"
)
func basic() string {
return "Hello World!"
}
func main() {
js := mewn.String("./frontend/dist/app.js")
css := mewn.String("./frontend/dist/app.css")
app := wails.CreateApp(&wails.AppConfig{
Width: 1024,
Height: 768,
Title: "{{.Name}}",
JS: js,
CSS: css,
Colour: "#131313",
})
app.Bind(basic)
app.Run()
}

View File

@@ -0,0 +1,15 @@
{
"name": "Vue3 Full",
"version": "1.0.0",
"shortdescription": "Vue 3, Vuex, Vue-router, and Webpack4",
"description": "Vue3.0.0 Vuex, Vue-router, and Webpack 4",
"install": "npm install",
"build": "npm run build",
"author": "Kyle Muchmore <kmuchmor@gmail.com>",
"created": "2020-09-24 21:18:55.09417 +0000 UTC m=+90.125590001",
"frontenddir": "frontend",
"serve": "npm run serve",
"bridge": "src",
"wailsdir": "",
"platforms": ["linux", "darwin"]
}

View File

@@ -11,7 +11,7 @@
"core-js": "^3.6.4",
"regenerator-runtime": "^0.13.3",
"vue": "^2.6.11",
"vuetify": "^2.2.15",
"vuetify": "^2.3.15",
"@wailsapp/runtime": "^1.0.10"
},
"devDependencies": {

View File

@@ -24,13 +24,13 @@
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<v-toolbar-title>Application</v-toolbar-title>
</v-app-bar>
<v-content>
<v-main>
<v-container fluid class="px-0">
<v-layout justify-center align-center class="px-0">
<hello-world></hello-world>
</v-layout>
</v-container>
</v-content>
</v-main>
<v-footer app fixed>
<span style="margin-left:1em">&copy; You</span>
</v-footer>
@@ -57,4 +57,4 @@
.logo {
width: 16em;
}
</style>
</style>

View File

@@ -1,4 +1,4 @@
package cmd
// Version - Wails version
const Version = "v1.8.1-pre1"
const Version = "v1.12.0-pre2"

View File

@@ -26,11 +26,13 @@ func init() {
var packageApp = false
var forceRebuild = false
var debugMode = false
var usefirebug = false
var gopath = ""
var typescriptFilename = ""
var verbose = false
var platform = ""
var ldflags = ""
var tags = ""
buildSpinner := spinner.NewSpinner()
buildSpinner.SetSpinSpeed(50)
@@ -41,10 +43,12 @@ func init() {
BoolFlag("p", "Package application on successful build", &packageApp).
BoolFlag("f", "Force rebuild of application components", &forceRebuild).
BoolFlag("d", "Build in Debug mode", &debugMode).
BoolFlag("firebug", "Enable firebug console for debug builds", &usefirebug).
BoolFlag("verbose", "Verbose output", &verbose).
StringFlag("t", "Generate Typescript definitions to given file (at runtime)", &typescriptFilename).
StringFlag("ldflags", "Extra options for -ldflags", &ldflags).
StringFlag("gopath", "Specify your GOPATH location. Mounted to /go during cross-compilation.", &gopath)
StringFlag("gopath", "Specify your GOPATH location. Mounted to /go during cross-compilation.", &gopath).
StringFlag("tags", "Build tags to pass to the go compiler (quoted and space separated)", &tags)
var b strings.Builder
for _, plat := range getSupportedPlatforms() {
@@ -69,6 +73,7 @@ func init() {
// Project options
projectOptions := &cmd.ProjectOptions{}
projectOptions.Verbose = verbose
projectOptions.UseFirebug = usefirebug
// Check we are in project directory
// Check project.json loads correctly
@@ -78,6 +83,14 @@ func init() {
return fmt.Errorf("Unable to find 'project.json'. Please check you are in a Wails project directory")
}
// Set firebug flag
projectOptions.UseFirebug = usefirebug
// Check that this platform is supported
if !projectOptions.PlatformSupported() {
logger.Yellow("WARNING: This project is unsupported on %s - it probably won't work!\n Valid platforms: %s\n", runtime.GOOS, strings.Join(projectOptions.Platforms, ", "))
}
// Set cross-compile
projectOptions.Platform = runtime.GOOS
if len(platform) > 0 {
@@ -101,6 +114,9 @@ func init() {
projectOptions.LdFlags = ldflags
projectOptions.GoPath = gopath
// Add tags
projectOptions.Tags = tags
// Validate config
// Check if we have a frontend
err = cmd.ValidateFrontendConfig(projectOptions)
@@ -184,6 +200,10 @@ func init() {
return err
}
if projectOptions.Platform == "windows" {
logger.Yellow("*** Please note: Windows builds use mshtml which is only compatible with IE11. For more information, please read https://wails.app/guides/windows/ ***")
}
logger.Yellow("Awesome! Project '%s' built!", projectOptions.Name)
return nil

View File

@@ -70,6 +70,7 @@ func init() {
}
logger.Yellow("Awesome! Project '%s' built!", projectOptions.Name)
return cmd.ServeProject(projectOptions, logger)
})
}

View File

@@ -1,20 +1,37 @@
package wails
import (
"github.com/leaanthony/mewn"
"net/url"
"strings"
"github.com/wailsapp/wails/runtime"
)
// AppConfig is the configuration structure used when creating a Wails App object
type AppConfig struct {
Width, Height int
Title string
defaultHTML string
HTML string
JS string
CSS string
Colour string
Resizable bool
// The width and height of your application in pixels
Width, Height int
// The title to put in the title bar
Title string
// The HTML your app should use. If you leave it blank, a default will be used:
// <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="IE=edge" content="IE=edge"></head><body><div id="app"></div><script type="text/javascript"></script></body></html>
HTML string
// The Javascript your app should use. Normally this should be generated by a bundler.
JS string
// The CSS your app should use. Normally this should be generated by a bundler.
CSS string
// The colour of your window. Can take "#fff", "rgb(255,255,255)", "rgba(255,255,255,1)" formats
Colour string
// Indicates whether your app should be resizable
Resizable bool
// Indicated if the devtools should be disabled
DisableInspector bool
}
@@ -33,9 +50,14 @@ func (a *AppConfig) GetTitle() string {
return a.Title
}
// GetDefaultHTML returns the default HTML
func (a *AppConfig) GetDefaultHTML() string {
return a.defaultHTML
// GetHTML returns the default HTML
func (a *AppConfig) GetHTML() string {
if len(a.HTML) > 0 {
a.HTML = url.QueryEscape(a.HTML)
a.HTML = "data:text/html," + strings.ReplaceAll(a.HTML, "+", "%20")
a.HTML = strings.ReplaceAll(a.HTML, "%3D", "=")
}
return a.HTML
}
// GetResizable returns true if the window should be resizable
@@ -75,10 +97,18 @@ func (a *AppConfig) merge(in *AppConfig) error {
a.Colour = in.Colour
}
if in.HTML != "" {
a.HTML = in.HTML
}
if in.JS != "" {
a.JS = in.JS
}
if in.HTML != "" {
a.HTML = in.HTML
}
if in.Width != 0 {
a.Width = in.Width
}
@@ -99,7 +129,7 @@ func newConfig(userConfig *AppConfig) (*AppConfig, error) {
Resizable: true,
Title: "My Wails App",
Colour: "#FFF", // White by default
HTML: mewn.String("./runtime/assets/default.html"),
HTML: defaultHTML,
}
if userConfig != nil {
@@ -111,3 +141,17 @@ func newConfig(userConfig *AppConfig) (*AppConfig, error) {
return result, nil
}
var defaultHTML = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<div id="app"></div>
</body>
</html>`

View File

@@ -42,12 +42,12 @@ func (e *Manager) PushEvent(eventData *messages.EventData) {
// means it does not expire (default).
type eventListener struct {
callback func(...interface{}) // Function to call with emitted event data
counter int // Expire after counter callbacks. 0 = infinite
counter uint // Expire after counter callbacks. 0 = infinite
expired bool // Indicates if the listener has expired
}
// Creates a new event listener from the given callback function
func (e *Manager) addEventListener(eventName string, callback func(...interface{}), counter int) error {
func (e *Manager) addEventListener(eventName string, callback func(...interface{}), counter uint) error {
// Sanity check inputs
if callback == nil {
@@ -75,7 +75,30 @@ func (e *Manager) addEventListener(eventName string, callback func(...interface{
// On adds a listener for the given event
func (e *Manager) On(eventName string, callback func(...interface{})) {
// Add a persistent eventListener (counter = 0)
e.addEventListener(eventName, callback, 0)
err := e.addEventListener(eventName, callback, 0)
if err != nil {
e.log.Error(err.Error())
}
}
// Once adds a listener for the given event that will auto remove
// after one callback
func (e *Manager) Once(eventName string, callback func(...interface{})) {
// Add a persistent eventListener (counter = 0)
err := e.addEventListener(eventName, callback, 1)
if err != nil {
e.log.Error(err.Error())
}
}
// OnMultiple adds a listener for the given event that will trigger
// at most <counter> times.
func (e *Manager) OnMultiple(eventName string, callback func(...interface{}), counter uint) {
// Add a persistent eventListener (counter = 0)
err := e.addEventListener(eventName, callback, counter)
if err != nil {
e.log.Error(err.Error())
}
}
// Emit broadcasts the given event to the subscribed listeners
@@ -108,10 +131,13 @@ func (e *Manager) Start(renderer interfaces.Renderer) {
})
// Notify renderer
e.renderer.NotifyEvent(event)
err := e.renderer.NotifyEvent(event)
if err != nil {
e.log.Error(err.Error())
}
// Notify Go listeners
var listenersToRemove []*eventListener
var listenersToRemove int
// Iterate listeners
for _, listener := range e.listeners[event.Name] {
@@ -129,12 +155,13 @@ func (e *Manager) Start(renderer interfaces.Renderer) {
listener.counter = listener.counter - 1
if listener.counter == 0 {
listener.expired = true
listenersToRemove++
}
}
}
// Remove expired listeners in place
if len(listenersToRemove) > 0 {
if listenersToRemove > 0 {
listeners := e.listeners[event.Name][:0]
for _, listener := range listeners {
if !listener.expired {

View File

@@ -6,9 +6,9 @@ type AppConfig interface {
GetHeight() int
GetTitle() string
GetResizable() bool
GetDefaultHTML() string
GetHTML() string
GetDisableInspector() bool
GetColour() string
GetCSS() string
GetJS() string
}
}

View File

@@ -6,6 +6,8 @@ import "github.com/wailsapp/wails/lib/messages"
type EventManager interface {
PushEvent(*messages.EventData)
Emit(eventName string, optionalData ...interface{})
OnMultiple(eventName string, callback func(...interface{}), counter uint)
Once(eventName string, callback func(...interface{}))
On(eventName string, callback func(...interface{}))
Start(Renderer)
Shutdown()

View File

@@ -8,7 +8,6 @@ import (
type Renderer interface {
Initialise(AppConfig, IPCManager, EventManager) error
Run() error
EnableConsole()
// Binding
NewBinding(bindingName string) error

View File

@@ -56,10 +56,6 @@ func (h *Bridge) Initialise(appConfig interfaces.AppConfig, ipcManager interface
return nil
}
// EnableConsole not needed for bridge!
func (h *Bridge) EnableConsole() {
}
func (h *Bridge) wsBridgeHandler(w http.ResponseWriter, r *http.Request) {
conn, err := websocket.Upgrade(w, r, w.Header(), 1024, 1024)
if err != nil {

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,6 @@ package renderer
import (
"time"
"unsafe"
"github.com/gorilla/websocket"
"github.com/leaanthony/mewn"
@@ -50,7 +49,7 @@ func (s *session) Identifier() string {
func (s *session) sendMessage(msg string) error {
if !s.done {
s.writeChan <- *(*[]byte)(unsafe.Pointer(&msg))
s.writeChan <- []byte(msg)
}
return nil
}

File diff suppressed because one or more lines are too long

View File

@@ -18,14 +18,17 @@ import (
// WebView defines the main webview application window
// Default values in []
// UseFirebug indicates whether to inject the firebug console
var UseFirebug = ""
type WebView struct {
window wv.WebView // The webview object
ipc interfaces.IPCManager
log *logger.CustomLogger
config interfaces.AppConfig
eventManager interfaces.EventManager
bindingCache []string
enableConsole bool
window wv.WebView // The webview object
ipc interfaces.IPCManager
log *logger.CustomLogger
config interfaces.AppConfig
eventManager interfaces.EventManager
bindingCache []string
}
// NewWebView returns a new WebView struct
@@ -55,7 +58,7 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana
Height: config.GetHeight(),
Title: config.GetTitle(),
Resizable: config.GetResizable(),
URL: config.GetDefaultHTML(),
URL: config.GetHTML(),
Debug: !config.GetDisableInspector(),
ExternalInvokeCallback: func(_ wv.WebView, message string) {
w.ipc.Dispatch(message, w.callback)
@@ -104,11 +107,6 @@ func (w *WebView) evalJS(js string) error {
return nil
}
// EnableConsole enables the console!
func (w *WebView) EnableConsole() {
w.enableConsole = true
}
// Escape the Javascripts!
func escapeJS(js string) (string, error) {
result := strings.Replace(js, "\\", "\\\\", -1)
@@ -179,10 +177,9 @@ func (w *WebView) Run() error {
w.log.Info("Running...")
// Inject firebug in debug mode on Windows
if w.enableConsole {
w.log.Debug("Enabling Wails console")
console := mewn.String("../../runtime/assets/console.js")
w.evalJS(console)
if UseFirebug != "" {
w.log.Debug("Injecting Firebug")
w.evalJS(`window.usefirebug=true;`)
}
// Runtime assets

View File

@@ -364,6 +364,7 @@ struct webview_priv
webkit_web_view_get_settings(WEBKIT_WEB_VIEW(w->priv.webview));
webkit_settings_set_enable_write_console_messages_to_stdout(settings, true);
webkit_settings_set_enable_developer_extras(settings, true);
webkit_settings_set_hardware_acceleration_policy(settings, WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS);
}
else
{

BIN
pace.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<div id="app"></div>
<script type="text/javascript">function AddScript(js, callbackID) {
var script = document.createElement('script');
script.text = js;
document.body.appendChild(script);
}</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -19,6 +19,16 @@ func (r *Events) On(eventName string, callback func(optionalData ...interface{})
r.eventManager.On(eventName, callback)
}
// Once pass through
func (r *Events) Once(eventName string, callback func(optionalData ...interface{})) {
r.eventManager.Once(eventName, callback)
}
// OnMultiple pass through
func (r *Events) OnMultiple(eventName string, callback func(optionalData ...interface{}), counter uint) {
r.eventManager.OnMultiple(eventName, callback, counter)
}
// Emit pass through
func (r *Events) Emit(eventName string, optionalData ...interface{}) {
r.eventManager.Emit(eventName, optionalData...)

View File

@@ -13,7 +13,7 @@ import * as Browser from './browser';
import { On, OnMultiple, Emit, Notify, Heartbeat, Acknowledge } from './events';
import { NewBinding } from './bindings';
import { Callback } from './calls';
import { AddScript, InjectCSS } from './utils';
import { AddScript, InjectCSS, InjectFirebug } from './utils';
import { AddIPCListener } from './ipc';
import * as Store from './store';
@@ -60,6 +60,11 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
window.wails.Log.Error('error: ' + error);
};
// Use firebug?
if( window.usefirebug ) {
InjectFirebug();
}
// Emit loaded event
Emit('wails:loaded');

View File

@@ -20,6 +20,18 @@ export function AddScript(js, callbackID) {
}
}
export function InjectFirebug() {
// set the debug attribute on HTML
var html = document.getElementsByTagName('html')[0];
html.setAttribute('debug', 'true');
var firebugURL = 'https://wails.app/assets/js/firebug-lite.js#startOpened=true,disableWhenFirebugActive=false';
var script = document.createElement('script');
script.src = firebugURL;
script.type = 'application/javascript';
document.head.appendChild(script);
window.wails.Log.Info('Injected firebug');
}
// Adapted from webview - thanks zserge!
export function InjectCSS(css) {
var elem = document.createElement('style');

View File

@@ -3959,9 +3959,9 @@
"dev": true
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
"dev": true
},
"interpret": {

View File

@@ -1,6 +1,6 @@
{
"name": "@wailsapp/runtime",
"version": "1.1.0",
"version": "1.1.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -130,9 +130,9 @@
"dev": true
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
"dev": true
},
"invert-kv": {