Compare commits

..

2 Commits

Author SHA1 Message Date
Lea Anthony cce627e7bd [v3] Update deps 2023-04-06 21:59:39 +10:00
Lea Anthony 5f7b74e05b [v3] Update runtime + messageProcessor to use window names
[v3] Implement `Application.GetWindowByName` in JS
2023-04-06 21:58:16 +10:00
960 changed files with 54560 additions and 39249 deletions
+1
View File
@@ -0,0 +1 @@
runtime/assets/default.html
+30
View File
@@ -0,0 +1,30 @@
{
"env": {
"browser": true,
"es6": true,
"node": true,
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2016,
"sourceType": "module",
},
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
-4
View File
@@ -1,9 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Discord Chat
url: https://discord.gg/BrRSWTaxVK
about: Ask questions and discuss with other Wails users in real time.
- name: GitHub Community Discussions
url: https://github.com/wailsapp/wails/discussions
about: If your question is not a feature or a bug, please go to the discussion panel and retrieve if your question already exists before submitting.
+30
View File
@@ -0,0 +1,30 @@
name: Generate Contributors Image
on:
schedule:
- cron: '0 1 * * 0' # At 01:00 on Sunday.
push:
branches:
- master
jobs:
contributors:
runs-on: ubuntu-latest
if: github.repository == 'wailsapp/wails'
steps:
- uses: actions/checkout@v3
- uses: wow-actions/contributors-list@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
svgPath: website/static/img/contributors.svg
noCommit: true
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "chore: update contributors.svg"
add-paths: "website/static/img/contributors.svg"
title: Update Contributors Image
body: Generated new image
branch: update-contributors
delete-branch: true
+15
View File
@@ -0,0 +1,15 @@
name: Label sponsors
on:
pull_request:
types: [ opened ]
issues:
types: [ opened ]
jobs:
build:
name: is-sponsor-label
if: github.repository == 'wailsapp/wails'
runs-on: ubuntu-latest
steps:
- uses: JasonEtco/is-sponsor-label-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,9 +1,8 @@
name: Upload Source Documents
name: Push Checks
on:
push:
branches: [master]
workflow_dispatch:
jobs:
push_files_to_crowdin:
@@ -14,28 +13,25 @@ jobs:
- uses: actions/checkout@v2
- name: Verify Changed files
id: changed-files
uses: tj-actions/changed-files@v35
uses: tj-actions/verify-changed-files@v11.1
id: verify-changed-files
with:
files: |
website/**/*.mdx
website/**/*.md
website/**/*.json
- name: Setup Nodejs
- name: Set node
uses: actions/setup-node@v2
with:
node-version: 18.x
node-version: 16.x
- name: Setup Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload source documents
if: steps.changed-files.outputs.any_changed == 'true'
- name: Push files
if: steps.verify-changed-files.outputs.files_changed == 'true'
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
working-directory: ./website
run: task crowdin:push
run: |
cd website
corepack enable
pnpm install
pnpm run crowdin push -b master
@@ -1,4 +1,4 @@
name: Sync Translations
name: Sync Translated Documents
on:
workflow_dispatch:
@@ -10,30 +10,22 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup Nodejs
- name: Set node
uses: actions/setup-node@v2
with:
node-version: 18.x
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
node-version: 16.x
- name: Sync Translated Documents
run: cd scripts && chmod 755 ./sync-translated-documents.sh && ./sync-translated-documents.sh
env:
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
working-directory: ./website
run: task crowdin:pull
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: "docs: sync translations"
title: "docs: sync translations"
commit-message: "docs: sync documents"
title: "docs: sync documents"
body: "- [x] Sync translated documents"
branch: chore/sync-translations
labels: translation
branch: feature/documents
delete-branch: true
draft: true
+34
View File
@@ -0,0 +1,34 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
builds:
- env:
- CGO_ENABLED=0
goos:
- windows
- linux
- darwin
goarch:
- 386
- amd64
ignore:
- goos: darwin
goarch: 386
main: ./cmd/wails/main.go
archive:
replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
+6
View File
@@ -0,0 +1,6 @@
jshint:
config_file: .jshintrc
eslint:
enabled: true
config_file: .eslintrc
ignore_file: .eslintignore
+3
View File
@@ -0,0 +1,3 @@
{
"esversion": 6
}
+2 -3
View File
@@ -26,8 +26,8 @@
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
</a>
<a href="https://discord.gg/BrRSWTaxVK">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
<a href="https://app.slack.com/client/T029RQSE6/CJ4P9F7MZ">
<img alt="Slack" src="https://img.shields.io/badge/slack-gophers%2Fwails%20-blue?logo=slack"/>
</a>
<br/>
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
@@ -58,7 +58,6 @@
- [スポンサー](#スポンサー)
- [始め方](#始め方)
- [FAQ](#faq)
- [スター数の推移](#スター数の推移)
- [コントリビューター](#コントリビューター)
- [特記事項](#特記事項)
- [スペシャルサンクス](#スペシャルサンクス)
+2 -3
View File
@@ -26,8 +26,8 @@
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
</a>
<a href="https://discord.gg/BrRSWTaxVK">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
<a href="https://app.slack.com/client/T029RQSE6/CJ4P9F7MZ">
<img alt="Slack" src="https://img.shields.io/badge/slack-gophers%2Fwails%20-blue?logo=slack"/>
</a>
<br/>
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
@@ -57,7 +57,6 @@
- [시작하기](#시작하기)
- [스폰서](#스폰서)
- [FAQ](#faq)
- [Stargazers 성장 추세](#stargazers-성장-추세)
- [기여자](#기여자)
- [라이센스](#라이센스)
- [영감](#영감)
+3 -4
View File
@@ -24,8 +24,8 @@
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
</a>
<a href="https://discord.gg/BrRSWTaxVK">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
<a href="https://app.slack.com/client/T029RQSE6/CJ4P9F7MZ">
<img alt="Slack" src="https://img.shields.io/badge/slack-gophers%2Fwails%20-blue?logo=slack"/>
</a>
<br/>
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
@@ -55,7 +55,6 @@
- [Getting Started](#getting-started)
- [Sponsors](#sponsors)
- [FAQ](#faq)
- [Stargazers over time](#stargazers-over-time)
- [Contributors](#contributors)
- [License](#license)
- [Inspiration](#inspiration)
@@ -92,9 +91,9 @@ The installation instructions are on the [official website](https://wails.io/doc
## Sponsors
This project is supported by these kind people / companies:
<img src="website/static/img/sponsors.svg" style="width:100%;max-width:800px;"/>
<p align="center">
<img src="https://wails.io/img/sponsor/jetbrains-grayscale.webp" style="width: 100px"/>
</p>
+2 -3
View File
@@ -26,8 +26,8 @@
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome" />
</a>
<a href="https://discord.gg/BrRSWTaxVK">
<img alt="Discord" src="https://dcbadge.vercel.app/api/server/BrRSWTaxVK?style=flat"/>
<a href="https://app.slack.com/client/T029RQSE6/CJ4P9F7MZ">
<img alt="Slack" src="https://img.shields.io/badge/slack-gophers%2Fwails%20-blue?logo=slack"/>
</a>
<br/>
<a href="https://github.com/wailsapp/wails/actions/workflows/build-and-test.yml" rel="nofollow">
@@ -57,7 +57,6 @@
- [快速入门](#快速入门)
- [赞助商](#赞助商)
- [常见问题](#常见问题)
- [星星增长趋势](#星星增长趋势)
- [贡献者](#贡献者)
- [许可证](#许可证)
- [灵感](#灵感)
+5 -5
View File
@@ -1,24 +1,24 @@
# https://taskfile.dev
version: "3"
version: '3'
vars:
GREETING: Hello, World!
tasks:
contributors:check:
check-contributors:
cmds:
- npx -y all-contributors-cli check
contributors:update:
update-contributors:
cmds:
- go run v3/tasks/contribs/main.go
contributors:build:
build-contributors:
cmds:
- npx -y all-contributors-cli generate
release:
dir: v2/tools/release
cmds:
- go run release.go {{.CLI_ARGS}}
- go run release.go
+174
View File
@@ -0,0 +1,174 @@
package wails
import (
"os"
"syscall"
"github.com/syossan27/tebata"
"github.com/wailsapp/wails/cmd"
"github.com/wailsapp/wails/lib/binding"
"github.com/wailsapp/wails/lib/event"
"github.com/wailsapp/wails/lib/interfaces"
"github.com/wailsapp/wails/lib/ipc"
"github.com/wailsapp/wails/lib/logger"
"github.com/wailsapp/wails/lib/renderer"
wailsruntime "github.com/wailsapp/wails/runtime"
)
// -------------------------------- Compile time Flags ------------------------------
// BuildMode indicates what mode we are in
var BuildMode = cmd.BuildModeProd
// Runtime is the Go Runtime struct
type Runtime = wailsruntime.Runtime
// Store is a state store used for syncing with
// the front end
type Store = wailsruntime.Store
// CustomLogger is a specialised logger
type CustomLogger = logger.CustomLogger
// ----------------------------------------------------------------------------------
// App defines the main application struct
type App struct {
config *AppConfig // The Application configuration object
cli *cmd.Cli // In debug mode, we have a cli
renderer interfaces.Renderer // The renderer is what we will render the app to
logLevel string // The log level of the app
ipc interfaces.IPCManager // Handles the IPC calls
log *logger.CustomLogger // Logger
bindingManager interfaces.BindingManager // Handles binding of Go code to renderer
eventManager interfaces.EventManager // Handles all the events
runtime interfaces.Runtime // The runtime object for registered structs
}
// CreateApp creates the application window with the given configuration
// If none given, the defaults are used
func CreateApp(optionalConfig ...*AppConfig) *App {
var userConfig *AppConfig
if len(optionalConfig) > 0 {
userConfig = optionalConfig[0]
}
result := &App{
logLevel: "debug",
renderer: renderer.NewWebView(),
ipc: ipc.NewManager(),
bindingManager: binding.NewManager(),
eventManager: event.NewManager(),
log: logger.NewCustomLogger("App"),
}
appconfig, err := newConfig(userConfig)
if err != nil {
result.log.Fatalf("Cannot use custom HTML: %s", err.Error())
}
result.config = appconfig
// Set up the CLI if not in release mode
if BuildMode != cmd.BuildModeProd {
result.cli = result.setupCli()
} else {
// Disable Inspector in release mode
result.config.DisableInspector = true
}
// Platform specific init
platformInit()
return result
}
// Run the app
func (a *App) Run() error {
if BuildMode != cmd.BuildModeProd {
return a.cli.Run()
}
a.logLevel = "error"
err := a.start()
if err != nil {
a.log.Error(err.Error())
}
return err
}
func (a *App) start() error {
// Set the log level
logger.SetLogLevel(a.logLevel)
// Log starup
a.log.Info("Starting")
// Check if we are to run in bridge mode
if BuildMode == cmd.BuildModeBridge {
a.renderer = renderer.NewBridge()
}
// Initialise the renderer
err := a.renderer.Initialise(a.config, a.ipc, a.eventManager)
if err != nil {
return err
}
// Start signal handler
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
t.Reserve(func() {
a.log.Debug("SIGNAL CAUGHT! Starting Shutdown")
a.renderer.Close()
})
// Start event manager and give it our renderer
a.eventManager.Start(a.renderer)
// Start the IPC Manager and give it the event manager and binding manager
a.ipc.Start(a.eventManager, a.bindingManager)
// Create the runtime
a.runtime = wailsruntime.NewRuntime(a.eventManager, a.renderer)
// Start binding manager and give it our renderer
err = a.bindingManager.Start(a.renderer, a.runtime)
if err != nil {
return err
}
// Defer the shutdown
defer a.shutdown()
// Run the renderer
err = a.renderer.Run()
if err != nil {
return err
}
return nil
}
// shutdown the app
func (a *App) shutdown() {
// Make sure this is only called once
a.log.Debug("Shutting down")
// Shutdown Binding Manager
a.bindingManager.Shutdown()
// Shutdown IPC Manager
a.ipc.Shutdown()
// Shutdown Event Manager
a.eventManager.Shutdown()
a.log.Debug("Cleanly Shutdown")
}
// Bind allows the user to bind the given object
// with the application
func (a *App) Bind(object interface{}) {
a.bindingManager.Bind(object)
}
+8
View File
@@ -0,0 +1,8 @@
//go:build linux || darwin || !windows
// +build linux darwin !windows
package wails
func platformInit() {
}
+28
View File
@@ -0,0 +1,28 @@
//go:build windows || !linux || !darwin
// +build windows !linux !darwin
package wails
import (
"fmt"
"log"
"syscall"
)
func platformInit() {
err := SetProcessDPIAware()
if err != nil {
log.Fatalf(err.Error())
}
}
// SetProcessDPIAware via user32.dll
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
// Also, thanks Jack Mordaunt! https://github.com/wailsapp/wails/issues/293
func SetProcessDPIAware() error {
status, r, err := syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
if status == 0 {
return fmt.Errorf("exit status %d: %v %v", status, r, err)
}
return nil
}
+27
View File
@@ -0,0 +1,27 @@
package wails
import (
"github.com/wailsapp/wails/cmd"
)
// setupCli creates a new cli handler for the application
func (app *App) setupCli() *cmd.Cli {
// Create a new cli
result := cmd.NewCli(app.config.Title, "Debug build")
result.Version(cmd.Version)
// Setup cli to handle loglevel
result.
StringFlag("loglevel", "Sets the log level [debug|info|error|panic|fatal]. Default debug", &app.logLevel).
Action(app.start)
// Banner
result.PreRun(func(cli *cmd.Cli) error {
log := cmd.NewLogger()
log.YellowUnderline(app.config.Title + " - Debug Build")
return nil
})
return result
}
+10
View File
@@ -0,0 +1,10 @@
package cmd
const (
// BuildModeProd indicates we are building for prod mode
BuildModeProd = "prod"
// BuildModeDebug indicates we are building for debug mode
BuildModeDebug = "debug"
// BuildModeBridge indicates we are building for bridge mode
BuildModeBridge = "bridge"
)

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