MyGo 0.11 adds typed streams and middleware to IPC, lets pages drive their windows, and reworks how native UI keeps elements' identity across frames. It also brings a command palette, Markdown tables in the rich text editor, QR scanning on phones and rendering on several cores. 441 commits from 55 people since 0.10.0.
Highlights
- Streams from the page to Go. A bound method can take a
*mygo.Source[T], and the page streams values into it (Source<T>in the generated client).Recv,ValuesandCloseread it, andAbortSignalcancels it. It's the counterpart ofChannel(#2151). - IPC middleware.
mygo.Intercept(...Middleware)wraps every call to a bound method,mygo:window.*calls included, with aCallInfodescribing the call. It's free when an app sets none (#2148). - Download controls.
mygo.ControlDownloadreports a download's progress and can pause, resume or cancel it.PausereturnsErrUnsupportedon macOS and Linux (#2150). - Pages drive their windows.
mygo.BindWindowControls()gives the page'scurrentWindowbounds, sizing, focus and state, beyond the title bar's buttons. It's opt-in and linked only when called (#2198). - Element identity in native UI (#1599, stages 2 and 3). Liveness comes from the node, references are made by incarnation, and overlays are keyed by their opener (#1955). Each identity has one node, and frames build into the same nodes (#1974). Exit copies now stack in the order elements left, and hover and focus no longer jump between overlays.
- Long paragraphs on macOS. Core Text breaks long left-to-right paragraphs over bounded windows, so wrapping them is no longer quadratic: a 1 MiB paragraph used to take a minute (#2143).
- Markdown tables in the rich text editor.
ui/richtextreads and writes Markdown tables (#1772) and lays their rows out as a table, with keys for its cells (#1773). - Command palette. The new package
ui/commandaddscommand.Palette, a searchable list of commands with their shortcuts (#1612). - QR codes from the camera. In the camera plugin,
Options.OnCodereports the QR codes in view, every code in a frame on both iOS and Android (#2357). - Rendering on several cores.
plugins/renderdraws frames on several cores (Options.Workers, #2036). Frames that hold still are neither drawn nor encoded again (#2052). - Also new:
- Front matter in Markdown, shown as a collapsible block (#489).
- Blocks between an editor's lines (#1662).
- Column virtualization and frozen columns in
ui.Table(#1973). audiowrites WAV (#2191) and reads waveform peaks (#2616).- A window's content can keep its aspect ratio (#2144).
- A thumbnail toolbar on Windows (#2084).
App and windows
WindowOptions.Positionplaces a window,0, 0included (#2186).Window.SetAspectRatiokeeps the content's aspect ratio while the user resizes (#2144).WindowOptions.ConsumeActivationClickis supported on Windows and macOS (#2094).WindowOptions.CornerRadiusnow rounds:- On Windows:
Application.SetOpenFileExtensionssets, at run time, which filesOnOpenFilereceives (#2615).WasOpenedAtLogintells whether a login item started the app on macOS (#2033).Tabs.SetTitlechanges a tab's title afterNewTabs(#2321).- A restored window fits its display's work area (#2443).
- A second instance's message waits until the app is ready (#2544, #2437).
- The trash reports where it put an item on Windows and Linux (#2147).
- Documents:
- File watches can poll where the system can't report changes (
FileWatchOptions.Poll, #2268), and hints-only watches got a series of fixes (#2325–#2334). - The updater:
- A panic that ends a packaged app is written to
crash.loginPathLogs(#2116).
IPC and pages
- Sources (
Source[T], #2151), middleware (Intercept, #2148), download control (ControlDownload, #2150) and the page's window controls (BindWindowControls, #2198), as in the highlights above. - Streaming calls start and stop with
AbortSignal(#1960). PageOptions.ZoomControllets the user zoom a page with Ctrl+wheel. It's off by default (#2097).Page.Eval:CapturePagereturns an error when its window closes (#2540).- Drops reach the page of a web view in native UI on macOS (#1946).
- Generated TypeScript:
Native UI
- Element identity, stages 2 and 3 (#1955, #1974), as in the highlights above.
- Lists:
- A List, Table or Outline without the keyboard focus shows its chosen rows in gray, as AppKit does (#1980).
ListRow.Emphasized,ListState.EmphasizedandListState.KeepAccentgo with it. ListState.SelectionColorandSelectionTextColorcolor the chosen rows (#2510).ListState.DragLabelnames the rows a list drags out (#2409).ui.Tablevirtualizes its columns and can freeze them (VirtualColumns,TableColumn.Frozen, #1973).
- A List, Table or Outline without the keyboard focus shows its chosen rows in gray, as AppKit does (#1980).
- Split panes take a gap (
SplitGap, #1997), per-pane limits (SplitLimits, #2051) and second-pane sizing (SplitSecond, #1969). AlertDialogWithtakesAlertButtons, destructive ones included (#1981).- Focus:
- Tooltips: disabled elements and disabled menu items show theirs (#1982, #1372).
- Text:
- Layout:
RoleForm, the form landmark (#2227).- Testing:
Element.Keyafter a state read is reported (#1993).- An element with several
Dropcalls takes every type (#2358). - Space clicks a button on release (#2212).
- Setting a
ScrollState's offset stops aScrollTo(#2235). - Several optional painters are linked only by apps that use them, published atomically (#2467, #2475–#2479).
- Text and rendering:
- Variable fonts draw their weights between named instances on Windows (#2142).
- An app's font is kept once, not once per engine (#1948).
- Browsers get a registered font's weights and lay out again once it loads (#2071).
- The hardware D3D11 device is shared with DirectComposition (#2596).
- Idle D3D11 textures are released (#1926).
- Metal gives back the drawables of hidden windows (#2048).
Editor
- Blocks between lines (
State.Blocks, #1662). - A panel below the caret (
State.ShowPopup,State.Rect, #1972). State.TextX, where the text starts right of the gutter (#2384).State.GutterDigits(#2172).CursorNonehides the carets (#2163).DetectIndentindents as the text itself is indented (#2194).DiffPatch,FormatPatchandFilePatch.Formatwrite a patch, as the diff viewer reads one (#2195).DiffState.DraggingLines(#2342).Buffer.MixedLineEndings(#1810).- In Markdown, Enter continues lists, task items and quotes (#1939).
- A multi-line paste is spread over the carets (#2161).
- An edit shapes only the lines it changed (#2471).
Markdown and richtext
- Markdown tables in
ui/richtext(#1772, #1773). - Front matter:
parser.ExtFrontmatterandOptions.EnableFrontmatter(#489). Options.LinkColorcolors a link by its destination (#2022).Theme.InlineCodeSize(#2231).- Raw tags a browser reads to their end are escaped, as GitHub's tagfilter does (
ExtTagFilter, #2193). EditorOptions.HideMarkerleaves a paragraph's marker unpainted (#2513).- Many round-trip fixes for Markdown, HTML and RTF in richtext: list items, headings, code blocks, code spans,
<br>and pastes.
Plugins
- camera:
Options.OnCodereads QR codes (#2357). - render:
- fetch:
- sqlite:
- websocket:
CloseTimeoutalso bounds the close handshake, and pongs no longer wait behind blocked writes (#2291). - terminal:
- preferences: an unreadable file is never written over (#2288).
- automation: the
formrole is supported, andopen --socket tcp:host:portdials TCP (#2179). - audio:
- i18n:
Quartersis new, andQ/qformat the quarter (#2200). - video: fixes for HLS, seeking and missing decoders, plus MPEG-TS, MPEG-PS and AVI from bytes on macOS.
CLI and packaging
mygo build:macos.signCommandsigns off a Mac (#1800).macos.extensionsandios.extensionsembed and sign prebuilt app extensions (#2354, #2006).- Windows installer:
mygo devshows the signing identity by kind (#1608).stapleris retried on a dropped connection (#2547).
Mobile
mygo.JavaVM()andmygo.AndroidContext()hand the JavaVM and the application Context to an app's C on Android (#1987).- Android configuration:
- Android builds:
- On iOS, the display link ticks at the content's frame rate (#2008). Frames are paced by the display (#2009).
- A hardware keyboard types into native UI's text inputs on iOS and Android (#2074, #2077).
- An Android frame that changes nothing draws nothing (#2341).
- The iOS simulator app is built for the Mac's architecture (#2425).
Breaking changes
See the v0.11 section of the migration guide for native UI.
Go API
- ui:
Element.AutoFocustakes optionalui.FocusOptions. Calls compile unchanged. Only a method value typedfunc() ui.Elementbreaks: wrap it in a function literal. - camera:
camera.Cameraandcamera.Optionshold a func now, so they're no longer comparable with==. - ui/markdown/parser:
GFMandDefaultincludeExtTagFilter. HTML written from Markdown escapes<script>,<style>,<iframe>,<title>,<textarea>,<xmp>,<noembed>,<noframes>and<plaintext>, as GitHub does. EachExt*constant keeps its v0.10.0 value.
Native UI behavior
- Unfocused lists turn gray. A List, Table or Outline without the keyboard focus shows its chosen rows in gray (
Theme.SurfacePressed) with the text's own color. Code that colors row textAccentTextbecause a row is chosen should testrow.Emphasized()orListState.Emphasized(c)instead. Otherwise it draws white text on light gray. SetListState.KeepAccentfor a list whose keys another control takes. Element.Keyafter a state read (Local,Clicked,Hovered,FocusBind,OnUnmount,ContextMenu, …) is reported. A running app logs it once, and aui.Testerpanics. Key the element first, or usec.Key(k)before building it.
Apps and pages
- Windows: pages no longer zoom with Ctrl+wheel or Ctrl+Plus/Minus. Set
PageOptions.ZoomControlto allow it. - Windows:
Clipboard.ReadTextreturns LF line endings. Page.Evalreturns an error when the page navigates away before it finishes.App.Runwrites a panic that ends a packaged app tocrash.loginPathLogs. To send crashes elsewhere, calldebug.SetCrashOutputonce the app is ready (App.WhenReady).- The updater refuses redirects to HTTP, keeps an update's archive inside the app, and stops unpacking at 8 GB.
TypeScript
- Generated clients: slices of a named
uint8arenumber[], and the unions of enums grow with constants converted to their type. - mygo-runtime:
WindowControlsandRuntimegained members, which breaks hand-written mocks of them.
CLI
mygo build -debugmakes Android's APK debuggable.- The Windows installer installs into a folder of the app's own, such as
D:\Tools\My App, when the folder chosen holds other files. Uninstalling removes that folder.
Plugins
- render:
Composition.Viewruns on several goroutines at once forFrames,Imagesand motion-blurredVideo, so it must not change shared state. SetOptions.Workers: 1for the old behavior. - render:
Videoholds frames that show what the frame before showed, which gives a variable frame rate. SetOptions.ConstantFrameRate: truefor editors that need a constant one. - fetch:
Options.Allowis also called for every redirect followed. A refused redirect rejects the request. - preferences:
SetandDeletereturn an error when the file exists but can't be read. They used to write over it. - audio: the WAV, MP3, AAC and MP4 decoders report read errors that come after decoded samples, and a damaged MP3 returns an error instead of panicking.
DecodeSoundandReadSoundof a damaged file fail rather than return a truncated sound. - i18n:
Qandqin date patterns and skeletons format the quarter. They used to print the letters.
Known issues
- On macOS 26,
WindowOptions.CornerRadiuson a titled window isn't drawn: the window keeps the system's corners (#2261).
New Contributors
- @zlxdike made their first contribution in #1946
- @kazma233 made their first contribution in #2001
- @tacshi made their first contribution in #2074
- @sinhong2011 made their first contribution in #1872
- @caelyreth made their first contribution in #2017
- @Viel0320 made their first contribution in #2084
- @JinJieBeWater made their first contribution in #2136
- @Glassous made their first contribution in #2094
- @ggdream made their first contribution in #2133
- @gaoxingxs made their first contribution in #2120
- @marukolibro made their first contribution in #2124
- @Ciao1019 made their first contribution in #2170
- @l0rraine made their first contribution in #2176
- @ibrahimhnif made their first contribution in #2174
- @bet4it made their first contribution in #2189
- @luochang212 made their first contribution in #2222
- @tbase made their first contribution in #2354
- @MichaelC001 made their first contribution in #2358
- @allenxu09 made their first contribution in #2348
- @yudongyouqing made their first contribution in #2408
- @loveklmn made their first contribution in #2492
- @AkagiYui made their first contribution in #2582
- @miantiao-me made their first contribution in #2534
Full Changelog: v0.10.0...v0.11.0