Compare commits

...

138 Commits

Author SHA1 Message Date
Atterpac 9c4b412aea fix react template css (#3477)
changelog
2024-05-14 06:39:20 +10:00
Atterpac 71b2edc0fe [V3-Linux] Upgrade to Webkitgtk4.1 (#3461)
* webkitgtk4.0->webkitgtk4.1

changelog

* Update mkdocs-website/docs/en/changelog.md

* Update deps in pipeline

* Update deps in pipeline

* Install 4.1 only when v3

* Install 4.1 only when v3

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-05-08 18:08:14 +10:00
Lea Anthony 7661cd189f Fix Go version 2024-05-08 08:27:38 +10:00
Mike D Pilsbury 0833a6d6d3 [v3] Correct detection of npm with acceptable version (#3458)
* Correct detection of npm with acceptable version

* Update changelog
2024-05-06 08:29:28 +10:00
Lea Anthony 7d851d8434 Fix disable min/max buttons on windows 2024-05-06 08:26:41 +10:00
Atterpac 2c29e1ca76 update devmode to use types and yaml (#3454)
go mod update
2024-05-05 17:27:53 +10:00
Travis McLane 5a57ee99ac example: environment - change css
text was colored white and therefore invisible.
2024-05-03 12:52:15 -05:00
Travis McLane 735b6b6c87 noop: remove Println for events.Linux.ApplicationStartup 2024-05-02 15:31:49 -05:00
Travis McLane 7ea0601fc6 remove Println
unknown key codes shouldn't print out to stdout
2024-05-02 11:02:21 -05:00
Travis McLane 99537f2816 remove Register/UnregisterWindow functionality
- this is no longer needed
2024-05-02 09:37:23 -05:00
Harry Fox b384bb885b add missing map init from application.init() (#3426)
* add missing map init from `application.init()`

* add changelog entry for #3426

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-05-02 21:57:51 +10:00
abichinger 2255af1c45 [v3] Add port flag to dev command (#3429)
* Add `port` flag to dev command, ...

Add support for environment variable WAILS_VITE_PORT

* Check if port is already in use

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-05-02 21:48:50 +10:00
Fabio Massaioli f55b781d86 [v3] Binding runtime fixes (#3431)
* Unmarshal arguments to appropriate type in binding calls

* Marshal multiple return values to arrays in binding calls

* Improve logging of remote method calls

* Add tests for `BoundMethod.Call`

* Fix return value if error is nil

* Update changelog

---------

Co-authored-by: Andreas Bichinger <andreas.bichinger@gmail.com>
2024-05-02 21:46:07 +10:00
Lea Anthony 38d9a9551f Add -trimpath for production build in project taskfile 2024-04-29 17:58:48 +10:00
Lea Anthony c38cee0a4a More optimised production build in project taskfile 2024-04-29 17:40:46 +10:00
Lea Anthony 0f9c7b1bbf Fix nanoid dep for npm package 2024-04-28 19:43:37 +10:00
Lea Anthony 32ddbd8e05 set target branch to v3-alpha 2024-04-28 17:13:59 +10:00
Lea Anthony 67c493f1a8 Fix example building 2024-04-27 17:43:58 +10:00
Lea Anthony 69c513e33d Fix pipeline tests 2024-04-27 17:38:10 +10:00
Lea Anthony 82b910dd6d Fix pipeline tests 2024-04-27 17:16:21 +10:00
Lea Anthony 5d0a58cc6a Update GetRelative/AbsolutePosition to take border size into account 2024-04-25 15:59:33 +10:00
Lea Anthony 368ca13314 Update window interface 2024-04-25 15:26:31 +10:00
Lea Anthony 2cee1edcb5 Add window.GetBorderSizes 2024-04-25 15:22:01 +10:00
Travis McLane 1b288a0a1a removing experimental server plugin 2024-04-23 09:32:21 -05:00
Harry Fox 81aba310d0 update Taskfile.tmpl.yml to include darwin run task (#3417)
* update Taskfile.tmpl.yml to include darwin run task

* add changelog line for #3417
2024-04-23 18:19:25 +10:00
Atterpac b050a07362 dev mode adapt to OS (#3412)
changelog
2024-04-22 12:44:10 +10:00
Travis McLane 021efab84d allow for non-Window WailsEvent listeners (#3406)
* allow for non-Window WailsEvent listeners

- adds a RegisterListener function on the App struct such
  that code can listen for WailsEvent(s) even if it isn't a Window
- rename dispatchEventToWindows -> dispatchEventToListeners
- add all windows and WailsEventListeners to slice before emitting

* Update v3/pkg/application/application.go

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-04-20 09:39:57 +10:00
Atterpac 0a42a050bd fix dev mode windows pipe (#3402) 2024-04-18 23:14:20 +10:00
abichinger 9ca1b30da1 [v3 alpha] Fix drag-n-drop on some linux distros (#3346)
* Fix drag and drop on linux

- Move C code

* Use GTK_DEST_DEFAULT_DROP

* Update changelog

* Move C code back into `linux_cgo.go`
2024-04-15 10:05:23 -05:00
Atterpac 220d5535f7 revert dialog channel close (#3395)
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-04-15 18:03:35 +10:00
Atterpac 0895e6a508 refresh version up (#3391) 2024-04-15 16:57:19 +10:00
Lea Anthony ed5532a535 Update plugin docs 2024-04-14 21:47:37 +10:00
Lea Anthony 6f41dbf954 Merge branch 'refs/heads/v3-alpha-feature/plugin-updates' into v3-alpha 2024-04-14 21:42:16 +10:00
Lea Anthony c7ed7e72d4 Major plugin updates 2024-04-14 21:41:33 +10:00
abichinger a7208f5262 Update changelog (#3389) 2024-04-11 23:50:04 +10:00
Travis McLane 09f6680aa9 restore: run tests only after approval 2024-04-10 09:11:36 -05:00
Travis McLane 9261130fed chore: workflow update to run tests on correct directory 2024-04-09 16:57:04 -05:00
Travis McLane fec22e0052 chore: bump staticanalysis to v2.8.0 2024-04-09 16:37:50 -05:00
abichinger 7c921d6a81 [v3 alpha] implement setIcon on linux (#3354)
* implement `linuxApp.setIcon`

* Move code into `linux_cgo.go`
2024-04-09 11:04:54 -05:00
Travis McLane 16a029754f disable 'server' example
Doesn't compile currently.
Disabling such that the workflow succeeds
2024-04-08 13:29:42 -05:00
Travis McLane 3c9fd67fd0 doctor: correct compilation errors 2024-04-08 13:23:12 -05:00
Travis McLane 724ca386e7 Merge remote-tracking branch 'origin/v3-alpha-linux-dialogs' into v3-alpha 2024-04-08 11:17:56 -05:00
atterpac 6f75b00463 Proper syncing and canceling of dialogs
s

s

s
2024-04-08 11:17:05 -05:00
Travis McLane 105d9f0d3a allow directory selection 2024-04-07 16:42:33 -05:00
atterpac 38f6b1297d Call linux dialog on main thread 2024-04-07 16:42:33 -05:00
Lea Anthony cf130a6e25 [windows] Fix directory select in Open Dialog 2024-04-06 14:38:43 +11:00
Lea Anthony e91c30fad0 Small doctor improvements 2024-04-03 20:48:55 +11:00
Lea Anthony 3e3f7b9273 Update discord link 2024-04-03 08:27:32 +11:00
Lea Anthony 88ff84f5a5 [windows] Improve Set window icon when in debug mode 2024-04-01 05:02:39 +11:00
Lea Anthony eee373f15a [windows] Set window icon when in debug mode 2024-04-01 04:55:34 +11:00
Lea Anthony c839c053cb [windows] Fix min/max buttons 2024-03-29 21:44:59 +11:00
Lea Anthony 238b9ede78 Update plugin example 2024-03-26 21:11:35 +11:00
Lea Anthony c7bd39abc7 Update plugin example 2024-03-26 21:02:26 +11:00
Lea Anthony 85b1f909a7 Plugin updates 2024-03-26 20:56:58 +11:00
Calle Gustafsson 675f502802 wails3 alpha windows: fix crash when systray icon is clicked without an attached window (#3271)
* Fix: #3270

removes an unnessecary check which returned a double nil wich in turned causes a crash if systray doesn't have an attached window.

* Add iconIsInFlyout method to systray_windows

and use it to determine if the icon is in the
flyout or not when positioning an attached window.

* optimize the windows systray window positioning

we only need to get the systray bounds if
the icon is in the flyout area.

* Use correct behavior for placing the window

if the systray icon is visible in the taskbar the
window should be centered on the systray icon
otherwise the icon is in a flyout are and the
window should be placed in the corner.

Added comments to explain placement logic

* consistent placing of systray menu on right vs left click

* add PR info in changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-24 17:04:40 +11:00
abichinger db5553ec75 [linux] fix closing of custom context menu #3329 (#3330)
* [linux] fix closing of custom context menu

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-24 16:51:45 +11:00
Fabio Massaioli 413191411f Remove class fields (#3333) 2024-03-24 16:42:41 +11:00
Fabio Massaioli 45b2681dfc [v3] Fix binding generator output and import paths (#3334)
* Fix relative import path computation

* Fix models output path

* Add option to generate bindings using bundled runtime

* Update binding example

* Fix testdata

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-22 21:18:04 +11:00
Travis McLane f0986a6441 chore: version.txt == v3.0.0-alpha.4 2024-03-21 14:16:39 -05:00
stffabi e6645136f9 [windows] Set HiDPI size scaling before setting up chromium 2024-03-21 09:42:23 +01:00
stffabi 189820135a [windows] Use options for window name 2024-03-21 09:42:23 +01:00
Lea Anthony f19cc528d4 Fix context menu example 2024-03-20 21:18:46 +11:00
Fabio Massaioli 2b9891da2c [v3] Update and fix runtime JS API (#3295)
* Cleanup bundled runtime entry point

* Fix JS representation of Screen struct

* Expose IsFocused method in Window interface

* Update JS window API

* Fix cleanup of WML listeners

* Bundle runtime as ES module

* Update runtime dependencies

* Update runtime types and events

* Update bundled runtime

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-20 20:30:14 +11:00
Lea Anthony a5c843f5c6 Disable social plugin in docs 2024-03-20 08:32:24 +11:00
Lea Anthony aa8e74539c Rebuild docs 2024-03-20 07:52:31 +11:00
Lea Anthony d1968489b7 Don't build server plugin 2024-03-20 07:43:27 +11:00
Lea Anthony 33946a7aac Don't build server plugin 2024-03-19 21:56:54 +11:00
Lea Anthony ddf74d3793 Update go version in pipelines 2024-03-19 21:45:52 +11:00
Lea Anthony 1b3b8178ec Update node version in pipelines
(cherry picked from commit c451adc424)
2024-03-19 21:35:38 +11:00
Lea Anthony bf3bdadd90 Update changelog 2024-03-19 21:07:14 +11:00
Lea Anthony aba82cc527 Update system.Environment 2024-03-19 20:37:03 +11:00
atterpac e92994d2e7 Refresh Version Update (CPU Thread Leak Fix) (#3322)
* Fix appimage file sourcing

Add findGTKFiles to source webkit files for appimage generation

s

* Update refresh version to fix CPU usage

s

* update changelong

* refresh version up

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-19 08:41:47 +11:00
Lea Anthony 26d9b3a832 Update docs config 2024-03-19 08:36:57 +11:00
Lea Anthony bfabaa50bc Add Cymraeg 2024-03-18 21:52:39 +11:00
Lea Anthony 7fcd172387 Update first steps 2024-03-18 20:57:56 +11:00
Lea Anthony c5bb4c7405 Refactor docs 2024-03-18 20:47:33 +11:00
Lea Anthony 98aff7778e Support ProgramName on linux 2024-03-17 21:09:20 +11:00
Lea Anthony 4ab6352504 Set default size for linux windows 2024-03-17 20:57:46 +11:00
Lea Anthony b325381ca0 Normalise app/webview options
Update deps
2024-03-17 20:57:46 +11:00
Lea Anthony bc0a9b2e52 Add BundledAssetFileServer for bundled /wails/runtime.js. Update examples. 2024-03-17 15:08:30 +11:00
atterpac 75c0236a04 [v3] Fix Dev mode <defunct> processes (#3320)
* Fix appimage file sourcing

Add findGTKFiles to source webkit files for appimage generation

s

* Update refresh version to fix CPU usage

s

* update changelong
2024-03-17 14:17:21 +11:00
atterpac ec2ce3fcfb Fix appimage file sourcing (#3306)
Add findGTKFiles to source webkit files for appimage generation

s
2024-03-17 11:17:17 +11:00
Lea Anthony e9a9420e5c Refactor options.
Update deps
2024-03-17 09:42:27 +11:00
Travis McLane 209e097ba6 rename linux options file
`linux` suffix means it won't compile on non-Linux platforms.
Shorten the name to avoid:

../../pkg/application/options_webview_window.go:104:8: undefined: LinuxWindow
../../pkg/application/options_application.go:28:8: undefined: LinuxOptions
../../pkg/application/options_webview_window.go:104:8: undefined: LinuxWindow
2024-03-14 13:25:23 -05:00
Lea Anthony 8d234cc842 Update execjs signature 2024-03-14 08:57:10 +11:00
Lea Anthony e6805707d8 Fix mac compilation issues 2024-03-14 08:52:10 +11:00
Lea Anthony acd6f7af5b Merge remote-tracking branch 'origin/v3-alpha-linux' into v3-alpha 2024-03-14 08:39:19 +11:00
Josh Drake f38532bcf5 Correctly compute 'startURL' when using a frontend development server. (#3299)
* Fix computing 'startURL' when 'FRONTEND_DEVSERVER_URL' is present.

* Respect provided URL when computing 'startURL' and 'FRONTEND_DEVSERVER_URL' is present.

* Update changelog.

* Correctly produce absolute URI in 'GetStartURL' when input is provided.
2024-03-08 18:06:14 +11:00
Travis McLane 4b2189ba51 allow keypress propagation
- this allows the webkit to add values to the `input` when typed
FIXME: does this need to be configurable?
2024-03-07 09:03:47 -06:00
Travis McLane fb46cce963 simplify key handling logic 2024-03-07 09:03:32 -06:00
Travis McLane eedd5eb7d2 reuse the 'wv' variable 2024-03-07 09:02:39 -06:00
Travis McLane 716f4af808 [linux] add missing implementations 2024-03-06 17:10:41 -06:00
Travis McLane c21784037d wip: fixing rebase issue 2024-03-06 16:59:13 -06:00
Lea Anthony 0fde6c9922 Latest status 2024-03-06 16:59:13 -06:00
Travis McLane 6d90c1678c move install_signal_handlers to proper location 2024-03-06 16:59:13 -06:00
Lea Anthony a7fb568aff Fix signal handlers 2024-03-06 16:59:13 -06:00
Lea Anthony 065ca5f6d3 Move to latest webkit2 and remove older code.
Fix screen demo.
Update examples.
2024-03-06 16:59:13 -06:00
Lea Anthony ab9eec12eb Update status. Make wml demo non-drag 2024-03-06 16:59:13 -06:00
Lea Anthony 430736a4f2 Remove need for javascriptcore 2024-03-06 16:59:13 -06:00
Lea Anthony 161444107a Support linux systrays, of sorts... 2024-03-06 16:59:13 -06:00
Lea Anthony 12e2e2101a fix screens 2024-03-06 16:59:13 -06:00
Lea Anthony e39097a17e fix min/max 2024-03-06 16:59:13 -06:00
Lea Anthony be7c723c47 Fix window close issues
Update docs
Make uri scheme registration thread safe
2024-03-06 16:59:13 -06:00
Lea Anthony a60b198b03 Fix window close issues 2024-03-06 16:59:13 -06:00
Lea Anthony e06df85f02 WindowID now correctly processed by postMessage calls. 2024-03-06 16:59:13 -06:00
Lea Anthony 288a4757f8 WindowID now correctly passed with webview request. 2024-03-06 16:59:13 -06:00
Lea Anthony 29363fc07f ToggleDevTools -> OpenDevTools
More refactor CGO methods.
2024-03-06 16:59:13 -06:00
Lea Anthony 02a1b540ce [WIP] refactor CGO methods 2024-03-06 15:43:50 -06:00
Lea Anthony a048233f4c Added menu cloning.
Introduced the ability to clone a menu, along with its submenus, in Linux-based web applications to create a full deep copy. This fixes reusing the application menu for window menus.
2024-03-06 15:40:28 -06:00
Lea Anthony 758c4c2c8d Refactor Linux application handling in webview
This update introduces a LinuxOptions struct for Linux-specific application configurations and refines webview for Linux. The 'windows' map has been renamed to 'windowMap' to avoid confusion. Moreover, a method to unregister Windows has been added to ensure the Linux application automatically quits when the last window closes, unless explicitly disabled in the new LinuxOptions structure. Reset Window position after hiding. Some debug output has been removed.
2024-03-06 11:52:06 -06:00
Lea Anthony adae39efee Add webview GPU policy and update Linux options
The commit introduces a set of webview GPU policies to control hardware acceleration. These policies define when hardware acceleration is enabled on the webview. An option for this has been added to the LinuxWindow struct for Linux specific windows. Additional code modification was carried out to use this new GPU policy option when calling `windowNew` function. Finally, the sequence of the GPU Policies in the const declaration has been updated for better readability.
2024-03-06 11:49:11 -06:00
Lea Anthony 84e1bb4d9b Improve Linux application events and refactor app method receivers
This commit includes the addition of common events for the Linux platform. Refactored and standardized the method receivers for the application from 'm' to 'l'. Also, the application startup events in the window example have been updated according to the new naming scheme.
2024-03-06 11:48:26 -06:00
Lea Anthony 6b0daf3da9 Update windowSetupSignalHandlers & linux events 2024-03-06 11:44:55 -06:00
Lea Anthony b6c5d90c9d Window Flash for Linux
Set Min/Max window buttons
2024-03-06 11:43:16 -06:00
Lea Anthony a34ccbff33 ToggleDevTools -> OpenDevTools
More refactor CGO methods.
2024-03-06 11:43:12 -06:00
Lea Anthony 4cd4b46772 [WIP] refactor CGO methods 2024-03-06 11:42:19 -06:00
Lea Anthony 3d93c83920 Added menu cloning.
Introduced the ability to clone a menu, along with its submenus, in Linux-based web applications to create a full deep copy. This fixes reusing the application menu for window menus.
2024-03-06 11:42:19 -06:00
Lea Anthony 809863d61a Refactor Linux application handling in webview
This update introduces a LinuxOptions struct for Linux-specific application configurations and refines webview for Linux. The 'windows' map has been renamed to 'windowMap' to avoid confusion. Moreover, a method to unregister Windows has been added to ensure the Linux application automatically quits when the last window closes, unless explicitly disabled in the new LinuxOptions structure. Reset Window position after hiding. Some debug output has been removed.
2024-03-06 11:42:19 -06:00
Lea Anthony 4c7b643295 Add webview GPU policy and update Linux options
The commit introduces a set of webview GPU policies to control hardware acceleration. These policies define when hardware acceleration is enabled on the webview. An option for this has been added to the LinuxWindow struct for Linux specific windows. Additional code modification was carried out to use this new GPU policy option when calling `windowNew` function. Finally, the sequence of the GPU Policies in the const declaration has been updated for better readability.
2024-03-06 11:42:19 -06:00
Lea Anthony 05b16f1d63 Improve Linux application events and refactor app method receivers
This commit includes the addition of common events for the Linux platform. Refactored and standardized the method receivers for the application from 'm' to 'l'. Also, the application startup events in the window example have been updated according to the new naming scheme.
2024-03-06 11:42:19 -06:00
Lea Anthony bfa53dfd6c Update windowSetupSignalHandlers & linux events 2024-03-06 11:42:19 -06:00
stffabi 4467a1ffa2 [parser] Move context tests into a separate file 2024-03-04 12:38:21 +01:00
stffabi bfe9a9d015 [runtime] Add cancelation of bound method calls and context passing 2024-03-04 10:34:14 +01:00
Fabio Massaioli 7e687750b2 [v3] Add option for showing the toolbar in fullscreen mode on macOS (#3282)
* Add option for showing the toolbar in fullscreen mode on macOS

* Add an example demonstrating the ShowToolbarWhenFullscreen option

* Update docs

* Add changelog entry

* Run go mod tidy
2024-03-02 20:10:25 +11:00
Fabio Massaioli 0c3025d695 [v3] Fix ordering of if branches in WebviewWindow.Restore method (#3279)
* Add JS Window API example

* Fix ordering of if branches in Window.Restore method

* Add changelog entry
2024-03-02 16:04:02 +11:00
5aaee9 a9c22f0588 fix: wrong baseURL if open window twice (#3273) 2024-02-29 08:47:25 +11:00
Fabio Massaioli b8537d1c96 [v3] Restore ToggleMaximise method in Window interface (#3281)
* Add JS Window API example

* Add ToggleMaximise button to Window API example

* Restore ToggleMaximise method in Window interface

* Update docs and changelog
2024-02-29 08:42:57 +11:00
stffabi 12d12a33de [v3, assetServer] Update docs 2024-02-21 13:40:32 +01:00
stffabi 1956f95f9f [templates] Update templates to latest assetserver options 2024-02-16 08:04:16 +01:00
stffabi 723dd976b4 [v3, assetServer] Use middlewares for runtime, caps and falgs instead of having the implementation in the assetserver 2024-02-16 07:38:28 +01:00
stffabi 65251cdafa [v3, assetServer] Remove fs.FS from options and always use a http.Handler 2024-02-16 07:38:27 +01:00
Lea Anthony 471d626043 Add control to disable window buttons on Mac
Three new options have been introduced in the application options for MacOS to disable the minimize, maximize, and close buttons on the window. Corresponding functionality has been added in the webview window for darwin to handle these new options. These changes have been showcased in the window example main.go file.
2024-02-08 08:31:58 +11:00
Lea Anthony 0b82968c0f Add option to disable min/max windows buttons
This commit introduces the functionality to disable the minimise and maximise buttons on windows. These options have been added to the `application.WebviewWindowOptions` and integrated in the Windows application logic. Effectively, developers can now control the availability of these buttons in their windows applications.
2024-02-07 10:06:07 +11:00
ALMAS 0584a3929d Fix docs (#3228) 2024-02-03 07:01:57 +11:00
Lea Anthony 09815e6035 Update runtime.md 2024-02-02 17:14:09 +11:00
Lea Anthony 9a01650622 Update runtime.md 2024-02-02 17:10:33 +11:00
Lea Anthony fb5afbd394 Fix docs 2024-02-02 17:01:41 +11:00
Lea Anthony fc105cee2b Update docs 2024-02-01 21:39:32 +11:00
495 changed files with 17428 additions and 22799 deletions
+5 -5
View File
@@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
go-version: [1.21]
go-version: [1.22]
steps:
- name: Checkout code
@@ -23,7 +23,7 @@ jobs:
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev javascriptcoregtk-4.1-dev build-essential pkg-config
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev javascriptcoregtk-4.1-dev build-essential pkg-config
- name: Setup Go
uses: actions/setup-go@v3
@@ -58,7 +58,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]
steps:
- name: Checkout code
@@ -100,7 +100,7 @@ jobs:
vanilla,
vanilla-ts,
]
go-version: [1.21]
go-version: [1.22]
steps:
- name: Checkout
uses: actions/checkout@v3
@@ -122,7 +122,7 @@ jobs:
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev javascriptcoregtk-4.1-dev build-essential pkg-config
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev javascriptcoregtk-4.1-dev build-essential pkg-config
- name: Build Wails3 CLI
run: |
+3 -3
View File
@@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-11]
go-version: ['1.20']
go-version: ['1.22']
steps:
- name: Checkout code
@@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
steps:
- name: Checkout code
@@ -90,7 +90,7 @@ jobs:
vanilla-ts,
plain,
]
go-version: ['1.20']
go-version: ['1.22']
steps:
- name: Checkout
uses: actions/checkout@v4
+1 -1
View File
@@ -16,7 +16,7 @@ jobs:
- name: Set Node
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 20.x
- name: Update Sponsors
run: cd scripts/sponsors && chmod 755 ./generate-sponsor-image.sh && ./generate-sponsor-image.sh
+26 -8
View File
@@ -56,14 +56,18 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: ['1.20']
go-version: ['1.22']
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
- name: Install linux dependencies (v3)
if: ${{ matrix.os == 'ubuntu-latest' && github.event.pull_request.base.ref == 'v3-alpha' }}
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config
- name: Install linux dependencies (v2)
if: ${{ matrix.os == 'ubuntu-latest' && github.event.pull_request.base.ref == 'master' }}
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
- name: Setup Go
@@ -71,14 +75,28 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Run tests (mac)
if: matrix.os == 'macos-latest'
- name: Run tests (mac) | v2
if: ${{ matrix.os == 'macos-latest' && github.event.pull_request.base.ref == 'master' }}
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
CGO_CFLAGS: -mmacosx-version-min=10.13
working-directory: ./v2
run: go test -v ./...
- name: Run tests (!mac)
if: matrix.os != 'macos-latest'
working-directory: ./v2
- name: Run tests (!mac) | v2
if: ${{ matrix.os != 'macos-latest' && github.event.pull_request.base.ref == 'master' }}
working-directory: ./v2
run: go test -v ./...
- name: Run tests (mac) | v3
if: ${{ matrix.os == 'macos-latest' && github.event.pull_request.base.ref == 'v3-alpha' }}
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
CGO_CFLAGS: -mmacosx-version-min=10.13
working-directory: ./v3
run: go test -v ./...
- name: Run tests (!mac) | v3
if: ${{ matrix.os != 'macos-latest' && github.event.pull_request.base.ref == 'v3-alpha' }}
working-directory: ./v3
run: go test -v ./...
+20
View File
@@ -0,0 +1,20 @@
on:
push:
branches: ['v3-alpha']
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
- run: npm ci
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
- uses: JS-DevTools/npm-publish@v3
with:
package: v3/internal/runtime/desktop/@wailsio/runtime
access: public
token: ${{ secrets.NPM_TOKEN }}
@@ -15,7 +15,7 @@ jobs:
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 18.x
node-version: 20.x
- name: Install Task
uses: arduino/setup-task@v1
@@ -25,7 +25,7 @@ jobs:
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 18.x
node-version: 20.x
- name: Setup Task
uses: arduino/setup-task@v1
+141
View File
@@ -0,0 +1,141 @@
# Cais
Mae'r API cais yn cynorthwyo i greu cais gan ddefnyddio fframwaith Wails.
### Newydd
API: `New(appOptions Options) *App`
`New(appOptions Options)` yn creu cais newydd gan ddefnyddio'r opsiynau cais a ddarperir. Mae'n cymhwyso gwerthoedd rhagosodedig ar gyfer opsiynau heb eu pennu, yn eu cyfuno â'r rhai a ddarparwyd, yn eu cychwyn a'n dychwelyd enghraifft o'r cais.
Os bydd gwall yn ystod y cychwyn, caiff y cais ei atal gyda'r neges gwall a ddarperir.
Dylid nodi, os oes enghraifft gyffredinol o gais yn bodoli eisoes, y bydd yr enghraifft honno'n cael ei dychwelyd yn hytrach na chreu un newydd.
```go title="main.go" hl_lines="6-9"
package main
import "github.com/wailsapp/wails/v3/pkg/application"
func main() {
app := application.New(application.Options{
Name: "Demo Ffenestr Gweddarlunydd",
// Opsiynau eraill
})
// Gweddill y cais
}
```
### Cael
`Get()` yn dychwelyd yr enghraifft gyffredinol o'r cais. Mae'n ddefnyddiol pan fydd angen mynediad i'r cais o wahanol rannau o'ch cod.
```go
// Cael enghraifft o'r cais
app := application.Get()
```
### Galluoedd
API: `Capabilities() capabilities.Capabilities`
`Capabilities()` yn adfer map o'r galluoedd sydd gan y cais ar hyn o bryd. Gall y galluoedd fod ynghylch y nodweddion gwahanol y system weithredu sy'n darparu, fel nodweddion gweddarlunydd.
```go
// Cael galluoedd y cais
capabilities := app.Capabilities()
if capabilities.HasNativeDrag {
// Gwneud rhywbeth
}
```
### GetPID
API: `GetPID() int`
`GetPID()` yn dychwelyd ID y Broses y cais.
```go
pid := app.GetPID()
```
### Rhedeg
API: `Run() error`
`Run()` yn dechrau gweithredu'r cais a'i gydrannau.
```go
app := application.New(application.Options{
//options
})
// Rhedeg y cais
err := application.Run()
if err != nil {
// Ymdrin â'r gwall
}
```
### Gadael
API: `Quit()`
`Quit()` yn gadael y cais trwy ddinistrio ffenestri a rhai cydrannau eraill o bosibl.
```go
// Gadael y cais
app.Quit()
```
### AydunDdyryslyd
API: `IsDarkMode() bool`
`IsDarkMode()` yn gwirio a yw'r cais yn rhedeg mewn modd tywyll. Mae'n dychwelyd gwerth boolean yn nodi a yw'r modd tywyll wedi'i alluogi.
```go
// Gwiriwch a yw'r modd tywyll wedi'i alluogi
if app.IsDarkMode() {
// Gwneud rhywbeth
}
```
### Cuddio
API: `Hide()`
`Hide()` yn cuddio ffenestr y cais.
```go
// Cuddio ffenestr y cais
app.Hide()
```
### Dangos
API: `Show()`
`Show()` yn dangos ffenestr y cais.
```go
// Dangos ffenestr y cais
app.Show()
```
--8<--
./docs/cy/API/application_window.md
./docs/cy/API/application_menu.md
./docs/cy/API/application_dialogs.md
./docs/cy/API/application_events.md
./docs/cy/API/application_screens.md
--8<--
## Opsiynau
```go title="pkg/application/application_options.go"
--8<--
../v3/pkg/application/application_options.go
--8<--
```
@@ -0,0 +1,67 @@
### Dangos Deialog Ynghylch
API: `ShowAboutDialog()`
Mae `ShowAboutDialog()` yn dangos blwch deialog "Ynghylch". Gall ddangos enw'r
cymhwysiad, disgrifiad ac eicon.
```go
// Dangos y deialog ynghylch
app.ShowAboutDialog()
```
### Gwybodaeth
API: `InfoDialog()`
Mae `InfoDialog()` yn creu ac yn dychwelyd esiampl newydd o `MessageDialog` gyda
`InfoDialogType`. Defnyddir y deialog hon fel arfer i ddangos negeseuon
gwybodaeth i'r defnyddiwr.
### Cwestiwn
API: `QuestionDialog()`
Mae `QuestionDialog()` yn creu ac yn dychwelyd esiampl newydd o `MessageDialog`
gyda `QuestionDialogType`. Defnyddir y deialog hon yn aml i ofyn cwestiwn i'r
defnyddiwr a disgwyl ymateb.
### Rhybudd
API: `WarningDialog()`
Mae `WarningDialog()` yn creu ac yn dychwelyd esiampl newydd o `MessageDialog`
gyda `WarningDialogType`. Fel y mae'r enw yn awgrymu, defnyddir y deialog hon yn
bennaf i ddangos negeseuon rhybudd i'r defnyddiwr.
### Gwall
API: `ErrorDialog()`
Mae `ErrorDialog()` yn creu ac yn dychwelyd esiampl newydd o `MessageDialog` gyda
`ErrorDialogType`. Cynlluniwyd y deialog hon i'w defnyddio pan fydd angen
dangos neges gwall i'r defnyddiwr.
### Agor Ffeil
API: `OpenFileDialog()`
Mae `OpenFileDialog()` yn creu ac yn dychwelyd esiampl newydd o
`OpenFileDialogStruct`. Mae'r deialog hon yn annog y defnyddiwr i ddewis un neu
ragor o ffeiliau o'u system ffeiliau.
### Cadw Ffeil
API: `SaveFileDialog()`
Mae `SaveFileDialog()` yn creu ac yn dychwelyd esiampl newydd o
`SaveFileDialogStruct`. Mae'r deialog hon yn annog y defnyddiwr i ddewis lleoliad
yn eu system ffeiliau lle y dylid cadw ffeil.
### Agor Cyfeiriadur
API: `OpenDirectoryDialog()`
Mae `OpenDirectoryDialog()` yn creu ac yn dychwelyd esiampl newydd o
`MessageDialog` gyda `OpenDirectoryDialogType`. Mae'r deialog hon yn galluogi'r
defnyddiwr i ddewis cyfeiriadur o'u system ffeiliau.
@@ -0,0 +1,13 @@
### Ar
API:
`Ar(eventType digwyddiadau.DdigwyddiadweithgangeningApplicationEventType, atebydd func(digwyddiad *Digwyddiad)) func()`
Mae `Ar()` yn cofrestru gwrandäwr digwyddiad ar gyfer digwyddiadau cymhwysiad penodol. Bydd y swyddogaeth atebydd a ddarperir yn cael ei sbarduno pan fydd y digwyddiad cysylltiedig yn digwydd. Mae'r swyddogaeth yn dychwelyd swyddogaeth y gellir ei galw i dynnu'r gwrandäwr.
### CofrestruArgraffwyr
API:
`CofrestruArgraffwyr(eventType digwyddiadau.DdigwyddiadweithgangeningApplicationEventType, atebydd func(digwyddiad *Digwyddiad)) func()`
Mae `CofrestruArgraffwyr()` yn cofrestru atebydd i'w redeg fel crocen yn ystod digwyddiadau penodol. Caiff y crocenau hyn eu rhedeg cyn gwrandawyr sy'n gysylltiedig ag `Ar()`. Mae'r swyddogaeth yn dychwelyd swyddogaeth y gellir ei galw i dynnu'r bâs.
@@ -0,0 +1,27 @@
### RegisterContextMenu
API: `RegisterContextMenu(name string, menu *Menu)`
Mae `RegisterContextMenu()` yn cofrestru dewislen cyd-destun gyda enw penodol. Gellir defnyddio'r dewislen hon yn ddiweddarach yn yr ap.
```go
// Creu dewislen newydd
ctxmenu := app.NewMenu()
// Cofrestru'r dewislen fel dewislen cyd-destun
app.RegisterContextMenu("MyContextMenu", ctxmenu)
```
### SetMenu
API: `SetMenu(menu *Menu)`
Mae `SetMenu()` yn gosod y ddewislen ar gyfer yr ap. Ar Mac, bydd hyn yn fod y ddewislen fyd-eang. Ar gyfer Windows a Linux, bydd hyn yn fod y ddewislen ddiofyn ar gyfer unrhyw ffenestr newydd a grëir.
```go
// Creu dewislen newydd
menu := app.NewMenu()
// Gosod y ddewislen ar gyfer yr ap
app.SetMenu(menu)
```
@@ -0,0 +1,13 @@
### GetPrimaryScreen
API: `GetPrimaryScreen() (*Sgrin, error)`
Mae `GetPrimaryScreen()` yn dychwelyd y sgrin brif y system.
### GetScreens
API: `GetScreens() ([]*Sgrin, error)`
Mae `GetScreens()` yn dychwelyd gwybodaeth am bob sgrin sydd wedi'i chysylltu â'r system.
Dyma grynodeb byr o'r dulliau allforio yn y `App` strwythur a ddarparwyd. Cofiwch, ar gyfer mwy o swyddogaethau neu ystyriaethau manwl, cyfeiriwch at y cod Go gwirioneddol neu ddogfennaeth fewnol bellach.
@@ -0,0 +1,64 @@
Dyma'r testun wedi'i gyfieithu i'r Gymraeg:
### NewWebviewWindow
API: `NewWebviewWindow() *WebviewWindow`
Mae `NewWebviewWindow()` yn creu ffenestr Webview newydd gyda'r opsiynau rhagosodedig, ac yn ei dychwelyd.
```go
// Creu ffenestr webview newydd
window := app.NewWebviewWindow()
```
### NewWebviewWindowWithOptions
API:
`NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow`
Mae `NewWebviewWindowWithOptions()` yn creu ffenestr webview newydd gydag opsiynau custom. Caiff y ffenestr newydd ei ychwanegu at fap o ffenestri a reolir gan y cymhwysiad.
```go
// Creu ffenestr webview newydd gydag opsiynau custom
window := app.NewWebviewWindowWithOptions(WebviewWindowOptions{
Name: "Main",
Title: "Fy Ffenestr",
Width: 800,
Height: 600,
})
```
### OnWindowCreation
API: `OnWindowCreation(callback func(window *WebviewWindow))`
Mae `OnWindowCreation()` yn cofrestru ffwythiant alw-nôl i'w alw pan grëir ffenestr.
```go
// Cofrestru ffwythiant alw-nôl i'w alw pan grëir ffenestr
app.OnWindowCreation(func(window *WebviewWindow) {
// Gwneud rhywbeth
})
```
### GetWindowByName
API: `GetWindowByName(name string) *WebviewWindow`
Mae `GetWindowByName()` yn nôl ac yn dychwelyd ffenestr gyda enw penodol.
```go
// Cael ffenestr drwy ei henw
window := app.GetWindowByName("Main")
```
### CurrentWindow
API: `CurrentWindow() *WebviewWindow`
Mae `CurrentWindow()` yn nôl ac yn dychwelyd cyfeiriad at y ffenestr weithredol yn y cymhwysiad. Os nad oes ffenestr, mae'n dychwelyd nil.
```go
// Cael y ffenestr gyfredol
window := app.CurrentWindow()
```
+50
View File
@@ -0,0 +1,50 @@
# Prif Swyddogaethau Trywydd
Mae'r dulliau hyn yn swyddogaethau cymorth i redeg cod ar y prif drywydd. Mae hyn yn
ofynnol pan fyddwch am redeg cod cyfaddas ar y llwyfan UI.
### InvokeSync
API: `InvokeSync(fn func())`
Mae'r swyddogaeth hon yn rhedeg y swyddogaeth a drosglwyddwyd (`fn`) yn ddilynebol. Mae'n defnyddio WaitGroup
(`wg`) i sicrhau bod y prif drywydd yn aros i `fn` swyddogaeth orffen
cyn iddo barhau. Os bydd panig yn digwydd o fewn `fn`, bydd yn cael ei drosglwyddo i'r
swyddogaeth trin panig `PanicHandler`, a ddiffinnir yn opsiynau'r cymhwysiad.
### InvokeSyncWithResult
API: `InvokeSyncWithResult[T any](fn func() T) (res T)`
Mae'r swyddogaeth hon yn gweithio'n debyg i `InvokeSync(fn func())`, fodd bynnag, mae'n rhoi
canlyniad. Defnyddiwch hyn ar gyfer galw unrhyw swyddogaeth gyda un canlyniad yn unig.
### InvokeSyncWithError
API: `InvokeSyncWithError(fn func() error) (err error)`
Mae'r swyddogaeth hon yn rhedeg `fn` yn ddilynebol ac yn dychwelyd unrhyw wall a gynhyrchir gan `fn`.
Sylwch y bydd y swyddogaeth hon yn adfer o banig os bydd un yn digwydd yn ystod
gweithrediad `fn`.
### InvokeSyncWithResultAndError
API:
`InvokeSyncWithResultAndError[T any](fn func() (T, error)) (res T, err error)`
Mae'r swyddogaeth hon yn rhedeg `fn` yn ddilynebol ac yn dychwelyd canlyniad o fath `T` a
gwall.
### InvokeAsync
API: `InvokeAsync(fn func())`
Mae'r swyddogaeth hon yn rhedeg `fn` yn asyng. Mae'n rhedeg y swyddogaeth a roddir ar y
prif drywydd. Os bydd panig yn digwydd o fewn `fn`, bydd yn cael ei drosglwyddo i'r
swyddogaeth trin panig `PanicHandler`, a ddiffinnir yn opsiynau'r cymhwysiad.
---
_Sylw_: Bydd y swyddogaethau hyn yn rhwystro gweithrediad nes bod `fn` wedi gorffen. Mae'n
hanfodol sicrhau nad yw `fn` yn rhwystro. Os bydd angen i chi redeg swyddogaeth sy'n
rhwystro, defnyddiwch `InvokeAsync` yn lle.
+73
View File
@@ -0,0 +1,73 @@
# Dewislen
Gellir creu a chynnwys dewislenni yn y rhaglen. Gellir eu defnyddio i greu
dewislenni cyd-destun, dwylo system a dewislenni rhaglen.
I greu dewislen newydd, galwch:
```go
// Creu dewislen newydd
dewislen := app.NewMenu()
```
Mae'r gweithrediadau canlynol ar gael ar y `Dewislen` math:
### Ychwanegu
API: `Ychwanegu(label string) *EitemDewislen`
Mae'r dull hwn yn cymryd `label` o fath `string` fel mewnbwn ac yn ychwanegu
`EitemDewislen` newydd gyda'r label a roddir at y ddewislen. Mae'n dychwelyd yr
`EitemDewislen` a ychwanegwyd.
### YchwaneguSeparwr
API: `YchwaneguSeparwr()`
Mae'r dull hwn yn ychwanegu `EitemDewislen` gwahanol newydd at y ddewislen.
### YchwaneguBlwch
API: `YchwaneguBlwch(label string, galluogedig bool) *EitemDewislen`
Mae'r dull hwn yn cymryd `label` o fath `string` a `galluogedig` o fath `bool`
fel mewnbwn ac yn ychwanegu `EitemDewislen` blwch ticio newydd gyda'r label a'r
cyflwr galluogedig a roddir at y ddewislen. Mae'n dychwelyd yr `EitemDewislen`
a ychwanegwyd.
### YchwaneguRadio
API: `YchwaneguRadio(label string, galluogedig bool) *EitemDewislen`
Mae'r dull hwn yn cymryd `label` o fath `string` a `galluogedig` o fath `bool`
fel mewnbwn ac yn ychwanegu `EitemDewislen` radio newydd gyda'r label a'r
cyflwr galluogedig a roddir at y ddewislen. Mae'n dychwelyd yr `EitemDewislen`
a ychwanegwyd.
### Diweddaru
API: `Diweddaru()`
Mae'r dull hwn yn prosesu unrhyw grwpiau radio ac yn diweddaru'r ddewislen os
na chaiff y rhyngwyneb dewislen ei gychwyn.
### YchwaneguIsddewislen
API: `YchwaneguIsddewislen(s string) *Dewislen`
Mae'r dull hwn yn cymryd `s` o fath `string` fel mewnbwn ac yn ychwanegu
`EitemDewislen` isddewislen newydd gyda'r label a roddir at y ddewislen. Mae'n
dychwelyd yr isddewislen a ychwanegwyd.
### YchwaneguRôl
API: `YchwaneguRôl(rôl Rôl) *Dewislen`
Mae'r dull hwn yn cymryd `rôl` o fath `Rôl` fel mewnbwn, yn ei ychwanegu at y
ddewislen os nad yw'n `nil` ac yn dychwelyd y `Dewislen`.
### SetLabel
API: `SetLabel(label string)`
Mae'r dull hwn yn gosod `label` y `Dewislen`.
+104
View File
@@ -0,0 +1,104 @@
# Ardal Hysbysu
Mae'r ardal hysbysu yn cynnwys ardal hysbysu ar amgylchedd bwrdd gwaith, a all
gynnwys eiconau o'r rhaglenni sy'n rhedeg ar hyn o bryd a hysbysiadau system
penodol.
Rydych yn creu ardal hysbysu trwy alw `app.NewSystemTray()`:
```go
// Creu ardal hysbysu newydd
tray := app.NewSystemTray()
```
Mae'r dulliau canlynol ar gael ar y `SystemTray` math:
### SetLabel
API: `SetLabel(label string)`
Mae'r dull `SetLabel` yn gosod label yr ardal hysbysu.
### Label
API: `Label() string`
Mae'r dull `Label` yn adfer label yr ardal hysbysu.
### PositionWindow
API: `PositionWindow(*WebviewWindow, offset int) error`
Mae'r dull `PositionWindow` yn galw'r dulliau `AttachWindow` a `WindowOffset`.
### SetIcon
API: `SetIcon(icon []byte) *SystemTray`
Mae'r dull `SetIcon` yn gosod eicon yr ardal hysbysu system.
### SetDarkModeIcon
API: `SetDarkModeIcon(icon []byte) *SystemTray`
Mae'r dull `SetDarkModeIcon` yn gosod eicon yr ardal hysbysu system pan mewn modd tywyll.
### SetMenu
API: `SetMenu(menu *Menu) *SystemTray`
Mae'r dull `SetMenu` yn gosod dewislen yr ardal hysbysu.
### Destroy
API: `Destroy()`
Mae'r dull `Destroy` yn dinistrio'r enghraifft ardal hysbysu.
### OnClick
API: `OnClick(handler func()) *SystemTray`
Mae'r dull `OnClick` yn gosod y swyddogaeth i'w gweithredu pan fo'r eicon ardal hysbysu wedi'i glicio.
### OnRightClick
API: `OnRightClick(handler func()) *SystemTray`
Mae'r dull `OnRightClick` yn gosod y swyddogaeth i'w gweithredu pan fo'r eicon ardal hysbysu wedi'i glicio â'r dde.
### OnDoubleClick
API: `OnDoubleClick(handler func()) *SystemTray`
Mae'r dull `OnDoubleClick` yn gosod y swyddogaeth i'w gweithredu pan fo'r eicon ardal hysbysu wedi'i glicio ddwywaith.
### OnRightDoubleClick
API: `OnRightDoubleClick(handler func()) *SystemTray`
Mae'r dull `OnRightDoubleClick` yn gosod y swyddogaeth i'w gweithredu pan fo'r eicon ardal hysbysu wedi'i glicio ddwywaith â'r dde.
### AttachWindow
API: `AttachWindow(window *WebviewWindow) *SystemTray`
Mae'r dull `AttachWindow` yn atodi ffenestr i'r ardal hysbysu system. Bydd y ffenestr yn cael ei dangos pan fo'r eicon ardal hysbysu wedi'i glicio.
### WindowOffset
API: `WindowOffset(offset int) *SystemTray`
Mae'r dull `WindowOffset` yn gosod y bwlch mewn picselau rhwng yr ardal hysbysu system a'r ffenestr.
### WindowDebounce
API: `WindowDebounce(debounce time.Duration) *SystemTray`
Mae'r dull `WindowDebounce` yn gosod amser diddymu. Yng nghyd-destun Windows, defnyddir hyn i bennu faint o amser i aros cyn ymateb i ddigwyddiad clic llygoden i fyny ar yr eicon hysbysu.
### OpenMenu
API: `OpenMenu()`
Mae'r dull `OpenMenu` yn agor y ddewislen sy'n gysylltiedig â'r ardal hysbysu system.
+116
View File
@@ -0,0 +1,116 @@
# Ffenestr
I greu ffenestr, defnyddiwch
[Application.NewWebviewWindow](application.md#newwebviewwindow) neu
[Application.NewWebviewWindowWithOptions](application.md#newwebviewwindowwithoptions).
Mae'r cyntaf yn creu ffenestr gyda nodweddion rhagosodedig, tra bod yr olaf yn
caniatáu i chi bennu opsiynau wedi'u haddasu.
Mae'r dulliau hyn yn galladwy ar y gwrthrych WebviewWindow a ddychwelir:
### SetTitle
API: `SetTitle(teitl string) *WebviewWindow`
Mae'r dull hwn yn diweddaru teitl y ffenestr i'r llinyn a ddarperir. Mae'n dychwelyd
y gwrthrych WebviewWindow, gan ganiatáu i ddulliau gael eu cadwyn.
### Enw
API: `Enw() string`
Mae'r swyddogaeth hon yn dychwelyd enw'r WebviewWindow.
### SetSize
API: `SetSize(lled, uchder int) *WebviewWindow`
Mae'r dull hwn yn gosod maint y WebviewWindow i'r lled a'r uchder a ddarperir. Os
yw'r dimensiynau a ddarparwyd yn rhagori ar y cyfyngiadau, mae'n eu haddasu'n briodol.
### SetAlwaysOnTop
API: `SetAlwaysOnTop(b bool) *WebviewWindow`
Mae'r swyddogaeth hon yn gosod y ffenestr i aros ar y brig yn seiliedig ar y blaen
llinyn a ddarperir.
### Dangos
API: `Dangos() *WebviewWindow`
Mae'r dull `Dangos` yn cael ei ddefnyddio i wneud y ffenestr yn weladwy. Os
nad yw'r ffenestr yn rhedeg, mae'n gwahodd y dull `rhedeg` i ddechrau'r ffenestr
ac yna'n ei gwneud yn weladwy.
### Cuddio
API: `Cuddio() *WebviewWindow`
Mae'r dull `Cuddio` yn cael ei ddefnyddio i guddio'r ffenestr. Mae'n gosod y
statws cudd o'r ffenestr i wir ac yn lledu'r digwyddiad cuddio ffenestr.
### SetURL
API: `SetURL(s string) *WebviewWindow`
Mae'r dull `SetURL` yn cael ei ddefnyddio i osod URL y ffenestr i'r llinyn URL a ddarparwyd.
### SetZoom
API: `SetZoom(mewnosod float64) *WebviewWindow`
Mae'r dull `SetZoom` yn gosod lefel swm cynnwys y ffenestr i'r lefel mewnosod a ddarparwyd.
### GetZoom
API: `GetZoom() float64`
Mae'r swyddogaeth `GetZoom` yn dychwelyd y lefel swm bresennol o gynnwys y ffenestr.
### GetScreen
API: `GetScreen() (*Screen, error)`
Mae'r dull `GetScreen` yn dychwelyd y sgrin lle mae'r ffenestr yn cael ei harddangos.
### SetFrameless
API: `SetFrameless(frameless bool) *WebviewWindow`
Mae'r swyddogaeth hon yn cael ei defnyddio i dynnu'r ffrâm a bar teitl y ffenestr.
Mae'n toglo'r framelessness o'r ffenestr yn unol â'r gwerth boolean a ddarperir
(gwir ar gyfer frameless, ffug ar gyfer ffrâm).
### RegisterContextMenu
API: `RegisterContextMenu(enw string, dewislen *Dewislen)`
Mae'r swyddogaeth hon yn cael ei defnyddio i gofrestru dewislen cyd-destun ac
yn ei neilltuo i'r enw a ddarparwyd.
### NativeWindowHandle
API: `NativeWindowHandle() (uintptr, error)`
Mae'r swyddogaeth hon yn cael ei defnyddio i nodi'r handlen ffenestr brodorol
ar gyfer y ffenestr.
### Ffocws
API: `Ffocws()`
Mae'r swyddogaeth hon yn cael ei defnyddio i ffocysu'r ffenestr.
### SetEnabled
API: `SetEnabled(galluogwyd bool)`
Mae'r swyddogaeth hon yn cael ei defnyddio i alluogi/analluogi'r ffenestr yn
seiliedig ar y gwerth boolean a ddarperir.
### SetAbsolutePosition
API: `SetAbsolutePosition(x int, y int)`
Mae'r swyddogaeth hon yn gosod y safle absoliwt o'r ffenestr yn y sgrin.
+55
View File
@@ -0,0 +1,55 @@
# Croniclau
<!--
Bydd pob newid sylweddol i'r prosiect hwn yn cael ei ddogfennu yn y ffeil hon.
Mae'r fformat yn seiliedig ar [Cadw Croniclau](https://keepachangelog.com/en/1.0.0/),
ac mae'r prosiect hwn yn cydymffurfio â [Fersiwneiddio Semantig](https://semver.org/spec/v2.0.0.html).
- `Ychwanegwyd` ar gyfer nodweddion newydd.
- `Newidiwyd` ar gyfer newidiadau mewn swyddogaeth bresennol.
- `Wedi Dibrisio` ar gyfer nodweddion a fydd yn cael eu dileu yn fuan.
- `Tynnwyd` ar gyfer nodweddion a gafodd eu tynnu yn awr.
- `Wedi Trwsio` ar gyfer unrhyw ddatrysiadau grwydro.
- `Diogelwch` os oes agoreiddiadau diamddiffyn.
-->
## [Heb ei ryddhau]
### Ychwanegwyd
- [darwin] ychwanegu Digwyddiad ApplicationShouldHandleReopen i fedru ymdrin â chlicio ar yr eicon doc gan @5aaee9 yn [#2991](https://github.com/wailsapp/wails/pull/2991)
- [darwin] ychwanegu getPrimaryScreen/getScreens i impl gan @tmclane yn [#2618](https://github.com/wailsapp/wails/pull/2618)
- [darwin] ychwanegu opsiwn ar gyfer dangos y bar offer mewn modd sgrin llawn ar macOS gan [@fbbdev](https://github.com/fbbdev) yn [#3282](https://github.com/wailsapp/wails/pull/3282)
- [linux] ychwanegu rhesymeg onKeyPress i drosi allwedd linux i gyflymydd gan @[Atterpac](https://github.com/Atterpac) yn [#3022](https://github.com/wailsapp/wails/pull/3022])
- [linux] ychwanegu tasg `rhedeg:linux` gan [@marcus-crane](https://github.com/marcus-crane) yn [#3146](https://github.com/wailsapp/wails/pull/3146)
- allforio dull `SetIcon` gan @almas1992 yn [PR](https://github.com/wailsapp/wails/pull/3147)
- Gwella `OnShutdown` gan @almas1992 yn [PR](https://github.com/wailsapp/wails/pull/3189)
- adfer dull `ToggleMaximise` yn y rhyngwyneb `Window` gan [@fbbdev](https://github.com/fbbdev) yn [#3281](https://github.com/wailsapp/wails/pull/3281)
### Wedi Trwsio
- Wedi trwsio prosesau zombie wrth weithio mewn modd datblygu drwy ddiweddaru i'r diweddaraf gan [Atterpac](https://github.com/atterpac) yn [#3320](https://github.com/wailsapp/wails/pull/3320).
- Wedi trwsio ffynhonnell ffeil webkit appimage gan [Atterpac](https://github.com/atterpac) yn [#3306](https://github.com/wailsapp/wails/pull/3306).
- Wedi trwsio Doctor fygythiad pecyn apt gan [Atterpac](https://github.com/Atterpac) yn [#2972](https://github.com/wailsapp/wails/pull/2972).
- Wedi trwsio'r cais wedi rhewi wrth ddod allan (Darwin) gan @5aaee9 yn [#2982](https://github.com/wailsapp/wails/pull/2982)
- Wedi trwsio lliwiau cefndir yr enghreifftiau ar Windows gan [mmgvh](https://github.com/mmghv) yn [#2750](https://github.com/wailsapp/wails/pull/2750).
- Wedi trwsio dewislenni cyd-destun rhagosodedig gan [mmgvh](https://github.com/mmghv) yn [#2753](https://github.com/wailsapp/wails/pull/2753).
- Wedi trwsio gwerth hecsadegol ar gyfer bysellau saeth ar Darwin gan [jaybeecave](https://github.com/jaybeecave) yn [#3052](https://github.com/wailsapp/wails/pull/3052).
- Gosod llusgo-a-gollwng ar gyfer Windows i weithio. Ychwanegwyd gan [@pylotlight](https://github.com/pylotlight) yn [PR](https://github.com/wailsapp/wails/pull/3039)
- Wedi trwsio bygiau ar gyfer linux yn y meddyg os nad oes gan y defnyddiwr y gyrwyr priodol wedi'u gosod. Ychwanegwyd gan [@pylotlight](https://github.com/pylotlight) yn [PR](https://github.com/wailsapp/wails/pull/3032)
- Trwsio graddio dpi wrth gychwyn (windows). Newidiwyd gan @almas1992 yn [PR](https://github.com/wailsapp/wails/pull/3145)
- Trwsio'r llinell amnewid yn `go.mod` i ddefnyddio llwybrau cymharol - Trwsio llwybrau Windows gyda gofodau gan @leaanthony.
- Trwsio gweithredu clicio Maclanwad system wrth ddim cysylltiedig â ffenestr gan [thomas-senechal](https://github.com/thomas-senechal) yn PR [#3207](https://github.com/wailsapp/wails/pull/3207)
- Trwsio adeiladu Windows yn methu oherwydd opsiwn anhysbys gan [thomas-senechal](https://github.com/thomas-senechal) yn PR [#3208](https://github.com/wailsapp/wails/pull/3208)
- Trwsio URL sylfaenol anghywir wrth agor ffenestr ddwywaith gan @5aaee9 yn PR [#3273](https://github.com/wailsapp/wails/pull/3273)
- Trwsio trefn brigiau os yn y dull `WebviewWindow.Restore` gan [@fbbdev](https://github.com/fbbdev) yn [#3279](https://github.com/wailsapp/wails/pull/3279)
- Cyfrifo `startURL` yn gywir ar draws galwadau lluosog `GetStartURL` pan fo `FRONTEND_DEVSERVER_URL` yn bresennol. [#3299](https://github.com/wailsapp/wails/pull/3299)
### Newidiwyd
### Tynnwyd
### Wedi Dibrisio
### Diogelwch
@@ -0,0 +1,20 @@
# Newidiadau ar gyfer v3
!!! note
Mae hwn ar hyn o bryd yn ddampio meddwl heb ei drefnu o newidiadau. Bydd yn cael ei drefnu i fformat mwy darllenadwy yn fuan.
--8<--
./docs/en/development/changes_events.md
./docs/en/development/changes_window.md
./docs/en/development/changes_systray.md
./docs/en/development/changes_bindings.md
./docs/en/development/changes_dragndrop.md
./docs/en/development/changes_context_menus.md
./docs/en/development/changes_dialogs.md
./docs/en/development/changes_clipboard.md
./docs/en/development/changes_wml.md
./docs/en/development/changes_plugins.md
./docs/en/development/changes_enums.md
./docs/en/development/changes_logging.md
./docs/en/development/changes_misc.md
--8<--
@@ -0,0 +1,87 @@
Dyma'r cyfieithiad i'r gymraeg:
## Rhwymedigaethau
Mae rhwymedigaethau yn gweithio mewn modd tebyg i v2, drwy ddarparu ffordd i rwymo
dulliau strwythur i'r rhyngwyneb blaen. Gellir eu galw yn y rhyngwyneb blaen gan
ddefnyddio'r wraperi rhwymedigaeth a gynhyrchwyd gan y gorchymyn `wails3 generate bindings`:
```javascript
// @ts-check
// Mae'r ffeil hon wedi'i chynhyrchu'n awtomatig. PEIDIWCH Â'I GOLYGU
import { main } from "./models";
window.go = window.go || {};
window.go.main = {
GreetService: {
/**
* GreetService.Greet
* Mae Greet yn cyfarch rhywun
* @param name {string}
* @returns {Promise<string>}
**/
Greet: function (name) {
wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
},
/**
* GreetService.GreetPerson
* Mae GreetPerson yn cyfarch rhywun
* @param person {main.Person}
* @returns {Promise<string>}
**/
GreetPerson: function (person) {
wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0));
},
},
};
```
Mae dulliau rhwymo wedi'u cuddio'n ddiofyn, ac maent yn cael eu hadnabod gan IDs uint32,
a gyfrifir gan ddefnyddio'r [algorithm hasio FNV](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function).
Mae hyn er mwyn atal enw'r dull rhag cael ei ddatgelu mewn adeiladau cynhyrchiol. Mewn
modd dadfygio, mae'r IDs dull yn cael eu logio ynghyd â'r ID a gyfrifwyd o'r dull
i helpu i ddadfygio. Os ydych chi am ychwanegu haen arall o guddio, gallwch
ddefnyddio'r opsiwn `BindAliases`. Mae hyn yn caniatáu ichi bennu map o IDs alias i
IDs dull. Pan fydd y rhyngwyneb blaen yn galw dull gan ddefnyddio ID, bydd yr ID dull
yn cael ei chwilio yn y map alias yn gyntaf am gywiro. Os nad yw'n ei ganfod,
mae'n tybio mai ID dull safonol yw ac yn ceisio canfod y dull yn y ffordd arferol.
Enghraifft:
```go
app := application.New(application.Options{
Bind: []any{
&GreetService{},
},
BindAliases: map[uint32]uint32{
1: 1411160069,
2: 4021313248,
},
Assets: application.AssetOptions{
Handler: application.AssetFileServerFS(assets),
},
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
})
```
Nawr gallwn alw gan ddefnyddio'r alias hwn yn y rhyngwyneb blaen: `wails.Call(1, "byd!")`.
### Galwadau anniogel
Os nad ydych chi'n poeni am eich galwadau yn cael eu cyhoeddi mewn testun plaen yn eich binari
ac nid oes gennych fwriad o ddefnyddio [garble](https://github.com/burrowers/garble), yna
gallwch ddefnyddio'r dull `wails.CallByName()` anniogel. Mae'r dull hwn yn cymryd enw
llawn cymhwysol y dull i'w alw a'r arguments i'w pasio iddo.
Enghraifft:
```go
wails.CallByName("main.GreetService.Greet", "byd!")
```
!!! angen gofal
Darperir hwn dim ond fel dull cyfleustra ar gyfer datblygu. Ni chyngherir i'w ddefnyddio mewn cynhyrchiad.

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