github egoist/mygo v0.11.0
MyGo 0.11.0

one hour ago

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, Values and Close read it, and AbortSignal cancels it. It's the counterpart of Channel (#2151).
  • IPC middleware. mygo.Intercept(...Middleware) wraps every call to a bound method, mygo:window.* calls included, with a CallInfo describing the call. It's free when an app sets none (#2148).
  • Download controls. mygo.ControlDownload reports a download's progress and can pause, resume or cancel it. Pause returns ErrUnsupported on macOS and Linux (#2150).
  • Pages drive their windows. mygo.BindWindowControls() gives the page's currentWindow bounds, 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/richtext reads 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/command adds command.Palette, a searchable list of commands with their shortcuts (#1612).
  • QR codes from the camera. In the camera plugin, Options.OnCode reports the QR codes in view, every code in a frame on both iOS and Android (#2357).
  • Rendering on several cores. plugins/render draws 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).
    • audio writes 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.Position places a window, 0, 0 included (#2186). Window.SetAspectRatio keeps the content's aspect ratio while the user resizes (#2144).
  • WindowOptions.ConsumeActivationClick is supported on Windows and macOS (#2094).
  • WindowOptions.CornerRadius now rounds:
    • titled windows on macOS, drawn by AppKit and widened near a display's rounded corners (#2261);
    • transparent windows on Windows 10 (#2176);
    • transparent frameless windows on Linux (#2606).
  • On Windows:
    • Window.SetThumbBar adds buttons under the taskbar preview (#2084).
    • The app's badge shows on its windows' taskbar buttons (#2503).
    • A page that goes full screen takes its window full screen (#1872).
    • An app keeps full speed out of sight while KeepRunning (#2197).
  • Application.SetOpenFileExtensions sets, at run time, which files OnOpenFile receives (#2615).
  • WasOpenedAtLogin tells whether a login item started the app on macOS (#2033).
  • Tabs.SetTitle changes a tab's title after NewTabs (#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:
    • A Save As no longer blocks the main thread (#2315).
    • The app asks before replacing a file (#2313).
    • The recovery copy follows a renamed file (#2316).
    • What's typed while a changed file is read again is kept (#2317).
    • A canceled quit keeps the discarded changes (#2320).
  • 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:
    • takes a custom HTTP client (UpdaterModule.SetHTTPClient, #2599);
    • compares long version numbers numerically (#2623);
    • shows an update's version in Windows' Settings > Apps (#1952);
    • keeps a state file it can't read (#2490).
  • A panic that ends a packaged app is written to crash.log in PathLogs (#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.ZoomControl lets the user zoom a page with Ctrl+wheel. It's off by default (#2097).
  • Page.Eval:
    • returns an error when its page navigates away (#1811);
    • runs a script of statements on iOS and Android (#2023);
    • runs on Android even where the page's Content Security Policy forbids eval (#2035).
  • CapturePage returns an error when its window closes (#2540).
  • Drops reach the page of a web view in native UI on macOS (#1946).
  • Generated TypeScript:
    • Slices of a named uint8 are typed as the number[] they're sent as (#2302).
    • Constants typed by a conversion join their type's union (#2305).
    • Text-appender map keys are accepted, and uintptr is a number (#2614, #2624).

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.Emphasized and ListState.KeepAccent go with it.
    • ListState.SelectionColor and SelectionTextColor color the chosen rows (#2510).
    • ListState.DragLabel names the rows a list drags out (#2409).
    • ui.Table virtualizes its columns and can freeze them (VirtualColumns, TableColumn.Frozen, #1973).
  • Split panes take a gap (SplitGap, #1997), per-pane limits (SplitLimits, #2051) and second-pane sizing (SplitSecond, #1969).
  • AlertDialogWith takes AlertButtons, destructive ones included (#1981).
  • Focus:
    • AutoFocus takes FocusOptions, and Handle.FocusWith is new (#1995).
    • A focused control's ring is brought into view with it (#2492).
  • Tooltips: disabled elements and disabled menu items show theirs (#1982, #1372).
  • Text:
    • Element.Truncated reports an ellipsis cut (#1968).
    • Span.Stroke and NewTextStroke outline spans (#1933).
    • A text area can keep its lines whole and scroll sideways (NoWrap, #1961).
    • Element.Selecting tells whether the pointer is selecting text (#2574).
  • Layout:
    • Physical padding and margin edges: PaddingLeft, MarginRight and the rest (#2613).
    • A labeled check box or radio button lines up by its label's baseline (#1953).
  • RoleForm, the form landmark (#2227).
  • Testing:
    • TesterOptions.Now starts a Tester's clock at a given time (#2356).
    • Tester.DragFiles and DragFilesOut hold a file drag over the window (#2324).
  • Element.Key after a state read is reported (#1993).
  • An element with several Drop calls takes every type (#2358).
  • Space clicks a button on release (#2212).
  • Setting a ScrollState's offset stops a ScrollTo (#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).
  • CursorNone hides the carets (#2163).
  • DetectIndent indents as the text itself is indented (#2194).
  • DiffPatch, FormatPatch and FilePatch.Format write 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.ExtFrontmatter and Options.EnableFrontmatter (#489).
  • Options.LinkColor colors 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.HideMarker leaves 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.OnCode reads QR codes (#2357).
  • render:
    • Options.Workers draws frames on several cores (#2036, #2058).
    • Still frames are held, and Options.ConstantFrameRate turns that off (#2052).
  • fetch:
    • Allow judges followed redirects (#2610).
    • An empty request body is sent with Content-Length: 0 (#2309).
  • sqlite:
    • uintptr parameters are accepted (#2626).
    • A canceled context interrupts until the operation ends (#2328).
  • websocket: CloseTimeout also bounds the close handshake, and pongs no longer wait behind blocked writes (#2291).
  • terminal:
    • Windows paths are linked whole, from the drive (#2120).
    • The theme's cursor alpha is kept (#2481).
    • A sideways wheel is reported to programs that take the mouse (#2118).
    • Themes are read from ~/.config/ghostty/themes on Windows too (#1861).
  • preferences: an unreadable file is never written over (#2288).
  • automation: the form role is supported, and open --socket tcp:host:port dials TCP (#2179).
  • audio:
    • Sound.WriteWAV (#2191).
    • ReadPeaks for waveforms (#2616).
    • Decoders report errors after partial reads (#2601–#2608, #2504).
  • i18n: Quarters is new, and Q/q format 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:
    • -version sets a release's tag (#2269).
    • -max-size sets a budget for the app's size (#2269).
  • macos.signCommand signs off a Mac (#1800).
  • macos.extensions and ios.extensions embed and sign prebuilt app extensions (#2354, #2006).
  • Windows installer:
    • Uninstaller pages for installer hooks, and the login entry is removed (#2082).
    • Apps are installed in a folder of their own (#2312).
    • The app's files are replaced with POSIX semantics (#1398).
  • mygo dev shows the signing identity by kind (#1608).
  • stapler is retried on a dropped connection (#2547).

Mobile

  • mygo.JavaVM() and mygo.AndroidContext() hand the JavaVM and the application Context to an app's C on Android (#1987).
  • Android configuration:
    • android.identifier gives the Android app its own package (#2404).
    • android.abis builds for some ABIs only (#2250).
    • android.v1Signing adds the JAR signature (#2251).
    • android.extractNativeLibs extracts native libraries on install (#2007).
    • build -debug makes the APK debuggable (#2405).
  • Android builds:
    • work with JDK 17 through 25 (#2066);
    • work on Windows, with gradlew.bat (#2065);
    • link native modules' C for 16 KB pages (#2061).
  • 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.AutoFocus takes optional ui.FocusOptions. Calls compile unchanged. Only a method value typed func() ui.Element breaks: wrap it in a function literal.
  • camera: camera.Camera and camera.Options hold a func now, so they're no longer comparable with ==.
  • ui/markdown/parser: GFM and Default include ExtTagFilter. HTML written from Markdown escapes <script>, <style>, <iframe>, <title>, <textarea>, <xmp>, <noembed>, <noframes> and <plaintext>, as GitHub does. Each Ext* 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 text AccentText because a row is chosen should test row.Emphasized() or ListState.Emphasized(c) instead. Otherwise it draws white text on light gray. Set ListState.KeepAccent for a list whose keys another control takes.
  • Element.Key after a state read (Local, Clicked, Hovered, FocusBind, OnUnmount, ContextMenu, …) is reported. A running app logs it once, and a ui.Tester panics. Key the element first, or use c.Key(k) before building it.

Apps and pages

  • Windows: pages no longer zoom with Ctrl+wheel or Ctrl+Plus/Minus. Set PageOptions.ZoomControl to allow it.
  • Windows: Clipboard.ReadText returns LF line endings.
  • Page.Eval returns an error when the page navigates away before it finishes.
  • App.Run writes a panic that ends a packaged app to crash.log in PathLogs. To send crashes elsewhere, call debug.SetCrashOutput once 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 uint8 are number[], and the unions of enums grow with constants converted to their type.
  • mygo-runtime: WindowControls and Runtime gained members, which breaks hand-written mocks of them.

CLI

  • mygo build -debug makes 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.View runs on several goroutines at once for Frames, Images and motion-blurred Video, so it must not change shared state. Set Options.Workers: 1 for the old behavior.
  • render: Video holds frames that show what the frame before showed, which gives a variable frame rate. Set Options.ConstantFrameRate: true for editors that need a constant one.
  • fetch: Options.Allow is also called for every redirect followed. A refused redirect rejects the request.
  • preferences: Set and Delete return 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. DecodeSound and ReadSound of a damaged file fail rather than return a truncated sound.
  • i18n: Q and q in date patterns and skeletons format the quarter. They used to print the letters.

Known issues

  • On macOS 26, WindowOptions.CornerRadius on a titled window isn't drawn: the window keeps the system's corners (#2261).

New Contributors

Full Changelog: v0.10.0...v0.11.0

Don't miss a new mygo release

NewReleases is sending notifications on new releases.