tango

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 32 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Build with your web stack. Draw in Go. Connect to the system.

Documentation · Quick start · Go reference · Changelog

CI Go Reference npm runtime MIT License

English · 简体中文 · 繁體中文 · 日本語

TanGo is a Go application framework for macOS, Windows, Linux, iOS and Android. Use a system WebView with your preferred frontend, build a desktop interface with Go-drawn components, or combine both in one desktop window.

TanGo Showcase
A real TanGo application: a system WebView connected to Go services, events and streams.

Early 0.x. Public APIs may change before 1.0. Mobile and Go-drawn UI are experimental; see the platform matrix below for the current verification scope.

Why TanGo

Capability What you get
Your frontend, your choice Plain HTML, TypeScript, React, Vue or shadcn/ui in a system WebView. The default template needs no npm.
UI written in Go A component library with Ant Design, Element Plus and shadcn themes, including dark variants, charts, forms and tables.
Calls, events and streams Go method bindings, generated TypeScript clients, bidirectional events, and cancellable streams with backpressure.
Native integration Menus, tray icons, dialogs, notifications, clipboard, shortcuts, displays and system appearance through focused Go packages.
Explicit page permissions A Go-side capability allowlist controls page access to system APIs; the bridge also checks message origins.
Development to distribution Project templates, automatic rebuilds, hot reload for Go-drawn windows, packaging, signing and signed auto-updates.

Choose how you build

Interface Best for Template
WebView Your existing web stack, with Go services and native capabilities. vanilla · vanilla-ts · react-ts · vue-ts · shadcn
Go-drawn UI Desktop interfaces built from Go components, without a web frontend. ui
Hybrid A WebView with an attached Go-drawn panel in the same desktop window. hybrid

iOS and Android also support experimental Go-drawn pages alongside WebView pages. See mobile setup. Desktop hybrid apps restart on Go changes instead of using canvas hot reload.

Start building

Requires Go 1.27+. TanGo’s desktop backends do not require cgo. Apps that link C libraries can enable it in tan.json with "cgo": true. WebView apps still need the target system’s WebView libraries. Mobile builds need the relevant SDKs.

go install github.com/tangoui/tango/cmd/tan@latest
tan init hello          # Plain HTML/CSS/JS; no npm needed
cd hello
tan dev                 # Run the app; rebuild when Go code changes
tan build               # Create a release build in build/

A plain go build / go run . is a production build too. Development features (hot reload, the automation channel, the front-end dev-server proxy) exist only in builds with -tags tango_dev, which tan dev adds; see development features and production builds.

Choose another starting point:
tan init -template react-ts my-react-app   # React + TypeScript + Vite
tan init -template vue-ts my-vue-app       # Vue + TypeScript + Vite
tan init -template shadcn my-shadcn-app    # React + Tailwind CSS + shadcn/ui
tan init -template ui my-go-app            # Go-drawn components
tan init -template hybrid my-hybrid-app    # WebView + a Go-drawn tool panel

Run on a simulator or connected Android device (experimental):

tan run -platform ios-simulator
tan run -platform android

See mobile setup for SDKs, signing and device requirements.

Connect an AI assistant with MCP

tan mcp lets an MCP client inspect a Tango project, build it, and interact with the UI of a development build. For Claude Code, add .mcp.json at the project root:

{
  "mcpServers": {
    "tango": { "command": "tan", "args": ["mcp", "-root", "."] }
  }
}

Start Claude Code in that directory and ask it to call tango_project_inspect with {}. It reads the project without launching the app. Only enable build and launch tools for projects you trust: they run project code. See the MCP guide for UI automation and local HTTP setup.

Go services, one call away

Once your app has an IPC router and the runtime bridge installed, expose a Go service:

type Greeter struct{}

func (Greeter) Hello(name string) string {
	return "Hello, " + name + "!"
}

// Register with your app’s IPC router.
func registerServices(router *ipc.Router) error {
	return bind.Register(router, "Greeter", Greeter{})
}

Call it from the page:

const message = await window.tango.call("Greeter.Hello", "TanGo");
// "Hello, TanGo!"

Use tan generate bindings for a typed TypeScript client. The runnable hello example includes the complete bridge setup, events and a stream.

Platform support

Target Interface Verification
macOS System WebView · Go-drawn UI · hybrid Verified on macOS hardware.
Windows System WebView · Go-drawn UI · hybrid Implemented; cross-compilation and CI smoke coverage. Systematic hardware validation is pending.
Linux System WebView · Go-drawn UI · hybrid Implemented; cross-compilation and CI smoke coverage. Systematic hardware validation is pending.
iOS System WebView · Go-drawn UI Experimental; simulator validation, plus one hardware run (iPhone 12 Pro, iOS 27): WebView and Go-drawn example apps, touch, input method, Metal and CPU rendering, accessibility. Broader hardware validation is pending.
Android System WebView · Go-drawn UI Experimental. WebView and Go-drawn samples have run in the emulator. Hardware validation is pending.

Capabilities differ by platform. Check WebView support, mobile capabilities and runtime APIs before relying on a feature. Android push requires app-provided FCM integration; Play Billing and iOS widgets are not built in.

Explore the examples

Example Explore
examples/showcase Calls, events, streams, menus, tray icons, notifications and theme following.
examples/hello A small end-to-end bridge example.
examples/runtime-demo JavaScript access to native capabilities.
examples/ui-window A desktop window drawn in Go.
examples/ui-gallery Components, themes, charts and forms; generates gallery images.
examples/webview-overlay A WebView and Go-drawn content sharing a desktop window.
examples/mobile-hello Mobile pages, lifecycle and system capability demos.
examples/ledger A complete bookkeeping app in self-drawn UI: tray, CSV export, packaged with tan build.
examples/ui-hotreload Hot reload of self-drawn UI under tan dev, keeping state across rebuilds.
examples/editor-demo A complete ui/editor code editor: native open/save, Save As, dirty-state protection, find/replace, themes, split and diff views, and background syntax highlighting on large files.
examples/terminal A small local-shell terminal, with echo/replay modes and latency benchmarks.
examples/terminal-workspace A complete native terminal workspace: independent shell tabs, draggable split panes, themes and keyboard shortcuts.
examples/a11y-demo How screen readers see self-drawn UI (VoiceOver), with an accessibility self-check.
examples/i18n-demo System languages, an app message catalog and localized native menus.
examples/app-demo Quit interception, deep links and opened files, single instance.
examples/webview-demo Advanced WebView: permissions, downloads, cookies, auth, find in page, PDF/PNG capture.
examples/print-demo System print dialog, PDF export and printing documents and images.
examples/system-demo Screen, theme, shell, autostart and environment integration checks.
examples/sysx-demo Secure storage, power, network, tray flyouts, Dock menu / Jump List, file drag-out.
examples/notify-demo Clipboard images, global hotkeys, notifications and window shortcuts smoke test.

From a checkout of this repository:

go run ./examples/showcase

Built with TanGo

Project What it is
MinCode An open-source desktop developer workspace: terminals, SSH/SFTP, databases, HTTP debugging, notes, an AI assistant and AI CLI sessions in one app. A Vue front end on the system WebView, packaged with tan package (installers of about 11–16 MB for macOS, Windows and Linux, x64 and ARM64) and updated through service/updater from GitHub Releases. AGPL-3.0.

Documentation

Topic Read
Get started English guide · CLI · Go packages
Core and bridge Architecture · Runtime API · WebView
Build and ship Release · Packaging · Windows · Linux packages · Auto-updates
System integration Mobile · Permissions · Icons · Printing
Quality and tooling Dev features vs production builds · Accessibility · Automation · tan mcp · Panic handling · CI and smoke tests

README translations cover English, Simplified Chinese, Traditional Chinese and Japanese. Most detailed documentation is currently in Chinese; English guides and the generated Go API reference are available.

Contribute

Issues and pull requests are welcome. Read CONTRIBUTING.md for development and DCO sign-off requirements, follow the Code of Conduct, and report vulnerabilities privately using SECURITY.md.


MIT © 2026 TanGo contributors.

Documentation

Overview

Package tango is the core of the Tango application framework: one Go program that runs on desktop (macOS, Windows, Linux) and mobile, showing its interface in the system WebView.

An App owns the native event loop and a queue of work for the main (UI) thread. A Surface is one window (desktop) or page (mobile) hosting a WebView. Pages and Go exchange raw string messages: pages call window.__tango.post(str) and window.__tango.onMessage(fn); Go calls Surface.Send and App.OnMessage. Higher layers (ipc, bind) build on that.

Threading

App.Run must be called from the main goroutine (from main()); the package locks it to the process' main thread in init on desktop. Everything else is safe from any goroutine. Callbacks (OnReady, OnLifecycle, OnMessage, Surface.OnClose, ...) run on the main thread; keep them short.

Post queues work for the main thread. Await runs a function there and waits for its result; AwaitAsync starts asynchronous work there (a dialog, say) and waits until it calls done. Called on the main thread, Await runs directly and AwaitAsync keeps pumping native events while it waits, so nested use does not deadlock.

After the app has quit (Run returned), Post drops its function, Await and AwaitAsync return the zero value without running anything, Surface methods do nothing and NewSurface returns ErrNotRunning. Calling Await, AwaitAsync or NewSurface on the main goroutine before Run would deadlock; Await and AwaitAsync panic and NewSurface returns ErrNotRunning instead. Create surfaces in OnReady.

Index

Constants

View Source
const (
	DragNone = platform.DragNone // canceled or refused
	DragCopy = platform.DragCopy
	DragMove = platform.DragMove
	DragLink = platform.DragLink
)
View Source
const (
	EventOpenURL         = platform.AppOpenURL
	EventOpenFiles       = platform.AppOpenFiles
	EventThemeChanged    = platform.AppThemeChanged
	EventDisplaysChanged = platform.AppDisplaysChanged
	EventReopen          = platform.AppReopen
	// EventNotificationOpened: a notification sent by an earlier run of
	// the app was clicked (Notification holds its id); see notify.OnClick.
	EventNotificationOpened = platform.AppNotificationOpened
)

AppEventKind values.

View Source
const (
	EventSafeAreaChanged    = platform.AppSafeAreaChanged
	EventOrientationChanged = platform.AppOrientationChanged
	EventPushToken          = platform.AppPushToken
	EventPushReceived       = platform.AppPushReceived
	EventPushOpened         = platform.AppPushOpened
	EventWebViewRestored    = platform.AppWebViewRestored
)

App events of the mobile capabilities (internal/platform/mobile_ext.go). Their payloads are typed AppEvent fields: Insets, Orientation, Push (Token / Payload) and Surface. The sys/... packages wrap most of them (safearea.OnChange, orientation.OnChange, push.OnReceive, ...); they are listed here so OnEvent listeners can tell them apart.

View Source
const (
	StateNormal     = platform.StateNormal
	StateMinimized  = platform.StateMinimized
	StateMaximized  = platform.StateMaximized
	StateFullscreen = platform.StateFullscreen
)
View Source
const (
	KindWindow = platform.KindWindow // a normal window
	KindPanel  = platform.KindPanel  // floating utility panel that does not activate the app
	KindModal  = platform.KindModal  // modal to SurfaceOptions.Parent
	KindSheet  = platform.KindSheet  // macOS sheet on Parent; KindModal elsewhere
)
View Source
const (
	TitleBarDefault = platform.TitleBarDefault
	// TitleBarHidden extends the content under the title area; the system
	// buttons stay where the platform can keep them (macOS). Elsewhere it is
	// TitleBarNone.
	TitleBarHidden = platform.TitleBarHidden
	// TitleBarNone is a frameless window. Mark draggable areas of the page
	// with the CSS property `--tango-drag: drag` (`no-drag` inside them for
	// buttons); a double click on them toggles maximize. Resizable frameless
	// windows resize from the page's edges.
	TitleBarNone = platform.TitleBarNone
)
View Source
const (
	MaterialNone = platform.MaterialNone
	MaterialBlur = platform.MaterialBlur // macOS vibrancy, Windows acrylic
	MaterialMica = platform.MaterialMica // Windows 11 Mica, macOS window-background vibrancy
)
View Source
const (
	WebPermCamera        = platform.WebPermCamera
	WebPermMicrophone    = platform.WebPermMicrophone
	WebPermGeolocation   = platform.WebPermGeolocation
	WebPermNotifications = platform.WebPermNotifications
	WebPermClipboardRead = platform.WebPermClipboardRead
	WebPermMIDI          = platform.WebPermMIDI
	WebPermScreen        = platform.WebPermScreen
	WebPermMotion        = platform.WebPermMotion
	WebPermStorage       = platform.WebPermStorage
	WebPermMedia         = platform.WebPermMedia
	WebPermOther         = platform.WebPermOther
)
View Source
const (
	PermissionDefault = platform.PermissionDefault
	PermissionPrompt  = platform.PermissionPrompt // ask the user (the platform's prompt where it has one)
	PermissionAllow   = platform.PermissionAllow
	PermissionDeny    = platform.PermissionDeny
)
View Source
const (
	AuthDefault     = platform.AuthDefault
	AuthCredentials = platform.AuthCredentials
	AuthCancel      = platform.AuthCancel
)
View Source
const (
	DownloadProgress = platform.DownloadProgress
	DownloadDone     = platform.DownloadDone
	DownloadFailed   = platform.DownloadFailed
	DownloadCanceled = platform.DownloadCanceled
)
View Source
const (
	DataCookies = platform.DataCookies
	DataCache   = platform.DataCache
	DataStorage = platform.DataStorage
	DataAll     = platform.DataAll
)
View Source
const (
	WebDialogAlert        = platform.WebDialogAlert
	WebDialogConfirm      = platform.WebDialogConfirm
	WebDialogPrompt       = platform.WebDialogPrompt
	WebDialogBeforeUnload = platform.WebDialogBeforeUnload
)
View Source
const (
	WebNavigationStarted   = platform.WebNavigationStarted
	WebNavigationCommitted = platform.WebNavigationCommitted
	WebNavigationFinished  = platform.WebNavigationFinished
	WebNavigationFailed    = platform.WebNavigationFailed
	WebPageChanged         = platform.WebPageChanged
)
View Source
const (
	WebClick  = platform.WebClick
	WebType   = platform.WebType
	WebScroll = platform.WebScroll
)
View Source
const EventMemoryWarning = platform.AppMemoryWarning

EventMemoryWarning: the system is low on memory (an iOS memory warning, Android onTrimMemory at TRIM_MEMORY_RUNNING_LOW or above). The event has no payload. Release what can be rebuilt (caches, decoded images, data that can be reloaded); windows opened with uihost already drop their GPU atlases, image textures and shaped-text caches and redraw. Desktop platforms do not send it. Register with App.OnEventKind(EventMemoryWarning, ...).

Variables

View Source
var ErrNestedWait = errors.New("tango: cannot wait for asynchronous work on the main thread on this platform; call from another goroutine")

ErrNestedWait is returned by TryAwaitAsync called on the main thread of a platform that cannot keep processing native events while the main thread waits (Android): waiting there would never end. Call from another goroutine instead.

View Source
var ErrNoBackend = errors.New("tango: no platform backend for this platform")

ErrNoBackend is returned by Run when no platform backend is built in for this GOOS.

View Source
var ErrNoFiles = errors.New("tango: DragFiles needs at least one file")

ErrNoFiles is returned by DragFiles without paths.

View Source
var ErrNotRunning = errors.New("tango: app is not running")

ErrNotRunning is returned by calls that need the running app when it has not started yet (on the main goroutine) or has already quit.

View Source
var ErrPanicked = errors.New("tango: the function run on the main thread panicked")

ErrPanicked is returned by TryAwaitAsync when start panicked before calling done. The panic went to Options.OnPanic.

View Source
var ErrStaleWebView = errors.New("tango: embedded WebView changed")

ErrStaleWebView indicates that a navigation, URL, or applied placement changed since the caller acquired a stamp.

View Source
var ErrSurfaceClosed = errors.New("tango: surface is closed")

ErrSurfaceClosed is returned by WebView controls called after the surface closed.

View Source
var ErrUnsupported = platform.ErrUnsupported

ErrUnsupported is returned when the platform does not support a capability. It is platform.ErrUnsupported, so errors.Is matches the capability packages' ErrUnsupported too.

View Source
var ErrWebViewNotReady = errors.New("tango: embedded WebView is not ready")

ErrWebViewNotReady indicates that the embedded page has not finished loading or has no visible placement.

Functions

func Await

func Await[T any](a *App, fn func() T) T

Await runs fn on the main thread and returns its result. On the main thread it calls fn directly. After the app has quit it returns the zero value without calling fn. It panics on the main goroutine before Run. If fn panics off the main thread, the panic goes to Options.OnPanic and Await returns the zero value; on the main thread it propagates to the caller like any call.

func AwaitAsync

func AwaitAsync[T any](a *App, start func(done func(T))) T

AwaitAsync calls start on the main thread and blocks until start's done is called (from any goroutine; later calls are ignored), returning its value. On the main thread it calls start directly and processes native events with Backend.Step(true) until done, so dialogs and other nested work keep running. If the app quits first it returns the zero value. It panics on the main goroutine before Run.

Where the platform cannot process native events while the main thread waits (Android), AwaitAsync on the main thread returns the zero value at once without calling start; TryAwaitAsync reports that as ErrNestedWait.

func TryAwaitAsync

func TryAwaitAsync[T any](a *App, start func(done func(T))) (T, error)

TryAwaitAsync is AwaitAsync reporting why no value was produced: ErrNotRunning when the app quit (or quits) before done was called, ErrNestedWait on the main thread where the platform cannot wait there (start is then not called), ErrPanicked when start panicked off the main thread before calling done (on the main thread the panic propagates to the caller).

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is a Tango application. Create it with New.

func New

func New(opts Options) *App

New returns an App on the platform's default backend.

func (*App) AddBridgeScript

func (a *App) AddBridgeScript(js string)

AddBridgeScript appends js to the bridge script of surfaces created after the call, after the core shim (window.__tango) and earlier scripts.

func (*App) Backend

func (a *App) Backend() platform.Backend

Backend returns the platform backend, for capability packages to type-assert optional interfaces on. Nil if none is built in.

func (*App) DownloadDir

func (a *App) DownloadDir() string

DownloadDir returns the directory DownloadPath uses.

func (*App) DownloadPath

func (a *App) DownloadPath(req DownloadRequest) string

DownloadPath is the default destination of a download: the suggested file name (or the last URL path segment, or "download") in DownloadDir, with " (1)", " (2)", ... added before the extension if a file of that name exists.

func (*App) Go

func (a *App) Go(fn func())

Go runs fn on a new goroutine. A panic in fn is handled like one in a callback (Options.OnPanic, Where "goroutine") instead of crashing the process. Use it instead of a go statement for application goroutines: a panic on a goroutine started with a plain go statement cannot be intercepted by the framework and terminates the program at once.

func (*App) HandleArgs

func (a *App) HandleArgs(args []string, dir string)

HandleArgs parses args like ParseArgs and delivers the events to OnEvent listeners on the main thread. Safe from any goroutine.

func (*App) ID

func (a *App) ID() string

ID returns Options.ID, or Options.Name when ID is empty.

func (*App) Name

func (a *App) Name() string

Name returns Options.Name.

func (*App) NewSurface

func (a *App) NewSurface(opts SurfaceOptions) (*Surface, error)

NewSurface creates a surface. Safe from any goroutine once the app runs; from other goroutines before Run it waits for Run to start. It returns ErrNotRunning on the main goroutine before Run and after the app quit.

func (*App) OnBinary

func (a *App) OnBinary(fn func(s *Surface, generation uint64, packet []byte))

OnBinary registers fn for upstream fast lane packets from any surface's page; it is usually ipc.Router.HandleBinarySession (not HandleBinary, which drops every packet of a Surface):

app.OnBinary(func(s *tango.Surface, gen uint64, p []byte) { r.HandleBinarySession(s, gen, p) })

Fast lanes are offered to a page only while at least one handler is registered (and the page comes from the asset origin, the backend has lanes and they are not turned off: Options.DisableFastLanes, TANGO_IPC_LANES=0). fn runs on the goroutine that received the packet, not on the main thread: it must be safe there and must not block. packet is only valid during the call, and may carry no frames (count 0: the up:post start probe); a handler that forwards to Router.HandleBinarySession need not care. generation is the immutable identity captured at authorization; forward it to Router.HandleBinarySession, never replace it with the surface current generation inside a delayed callback.

func (*App) OnDownloadEvent

func (a *App) OnDownloadEvent(fn func(s *Surface, ev DownloadEvent))

OnDownloadEvent registers fn for progress and completion of every download of every surface.

func (*App) OnEvent

func (a *App) OnEvent(fn func(AppEvent))

OnEvent registers fn for app-level events. Events that arrived before the first listener registered (a deep link that launched the app) are replayed to it on the main thread.

func (*App) OnEventKind

func (a *App) OnEventKind(kind AppEventKind, fn func(AppEvent))

OnEventKind registers fn for app-level events of one kind. Unlike an OnEvent listener, it leaves pending events of other kinds (a launch deep link, say) for the listeners that want them.

func (*App) OnLifecycle

func (a *App) OnLifecycle(fn func(Lifecycle))

OnLifecycle registers fn for every lifecycle event, on the main thread.

func (*App) OnMessage

func (a *App) OnMessage(fn func(s *Surface, msg string))

OnMessage registers fn for raw messages any surface's page sends with window.__tango.post. Messages from origins other than the asset origin or the origin the core last navigated the surface to are dropped.

func (*App) OnOpenFiles

func (a *App) OnOpenFiles(fn func(paths []string))

OnOpenFiles registers fn for EventOpenFiles: files given on the command line, dropped on the Dock icon, or opened with the app from the file manager.

func (*App) OnOpenURL

func (a *App) OnOpenURL(fn func(url string))

OnOpenURL registers fn for EventOpenURL: deep links, from launch arguments, later launches (package single) or the OS (macOS).

func (*App) OnQuitRequest

func (a *App) OnQuitRequest(fn func() bool)

OnQuitRequest registers fn to be asked when the user quits the app (Cmd+Q, a Quit menu item). Returning false cancels the quit. App.Quit called from code is never intercepted.

func (*App) OnReady

func (a *App) OnReady(fn func())

OnReady registers fn to run on the main thread once the app has started. Registered after that, fn is posted to run soon.

func (*App) OnSurfaceCreated

func (a *App) OnSurfaceCreated(fn func(*Surface))

OnSurfaceCreated registers fn to run on the main thread each time a surface (WebView or canvas) has been created, before NewSurface returns it; the surface's page may not have loaded yet. Surfaces that exist when fn is registered are not reported: see Surfaces. Packages use it to set up per-window state (badges on new taskbar buttons, page sync, window state persistence).

func (*App) OnWebViewRestored

func (a *App) OnWebViewRestored(fn func(s *Surface, url string))

OnWebViewRestored registers fn to run on the main thread when the system killed the web content process of surface s (memory pressure, a crash) and the backend reloaded its page from url. Page state (JS variables, form input) is gone: restore what the page needs once it has loaded again (Surface.OnLoaded fires as usual). iOS and Android only.

func (*App) ParseArgs

func (a *App) ParseArgs(args []string, dir string) []AppEvent

ParseArgs finds deep links and files in command-line arguments: an argument using one of Options.URLSchemes becomes an EventOpenURL; an existing file or directory (relative paths resolve against dir), or a file: URL, joins a single EventOpenFiles. Arguments starting with "-" are skipped until a "--". The program name must not be included.

func (*App) Post

func (a *App) Post(fn func())

Post schedules fn to run on the main thread, after everything posted before it. Safe from any goroutine; before Run, fn waits for Run to start. After the app has quit, fn is dropped.

func (*App) Quit

func (a *App) Quit()

Quit asks the app to quit. Safe from any goroutine; before Run it makes Run quit right after starting.

func (*App) Run

func (a *App) Run() error

Run initializes the backend and runs the native event loop until the app quits. Call it once, from the main goroutine.

func (*App) SetAuthHandler

func (a *App) SetAuthHandler(fn func(s *Surface, ch AuthChallenge) AuthResponse)

SetAuthHandler sets the app's handler for HTTP authentication challenges of surfaces without their own handler (or whose handler returned AuthDefault). nil removes it.

func (*App) SetDownloadDir

func (a *App) SetDownloadDir(dir string)

SetDownloadDir sets the directory of DownloadPath; "" restores the default, the user's Downloads folder (the temporary directory where there is none).

func (*App) SetDownloadHandler

func (a *App) SetDownloadHandler(fn func(s *Surface, req DownloadRequest) string)

SetDownloadHandler sets the app's handler choosing where downloads of surfaces without their own handler are saved. It returns an absolute path (a relative one is taken relative to the download directory), or "" to cancel. Missing directories are created; an existing file is replaced. nil removes it.

Without a handler, downloads started by the app's own pages (the page shown is of the asset origin or the origin the app navigated the surface to) go to DownloadPath(req); downloads started by any other page are canceled. A handler decides for every page; to save them all as before, return a.DownloadPath(req).

func (*App) SetNavigationPolicy

func (a *App) SetNavigationPolicy(fn func(s *Surface, nav NavigationRequest) bool)

SetNavigationPolicy sets the app's navigation policy: fn is asked before main-frame navigations of every surface (after the surface's own policy) and returning false cancels the navigation. Navigations the app starts itself (SurfaceOptions.URL, Navigate) are not asked about. nil removes it.

Without any navigation policy (neither the app's nor the surface's) the default applies: a navigation to an http(s) URL outside the app's own origins (Surface trust: the asset origin and the origin the app navigated the surface to) is canceled and the URL is opened in the system browser; everything else proceeds. A policy, once set, decides alone: returning true loads the URL in the surface, as before this default existed.

func (*App) SetNewWindowHandler

func (a *App) SetNewWindowHandler(fn func(s *Surface, req NewWindowRequest) NewWindowAction)

SetNewWindowHandler sets the app's handler for new-window requests of surfaces without their own handler (or whose handler returned NewWindowDefault). nil removes it.

func (*App) SetPermissionHandler

func (a *App) SetPermissionHandler(fn func(s *Surface, req PermissionRequest) PermissionDecision)

SetPermissionHandler sets the app's handler for page permission requests of surfaces without their own handler (or whose handler returned PermissionDefault). nil removes it.

func (*App) SetPermissionPolicy

func (a *App) SetPermissionPolicy(kind WebPermission, d PermissionDecision)

SetPermissionPolicy sets the decision for kind when no handler decides; kind "" sets it for every kind without its own policy. Without a policy the platform asks the user (PermissionPrompt). A request naming several kinds is denied if one is denied, allowed if all are allowed, and asks the user otherwise.

The policy applies to the app's own pages only (the asset origin and the origin the app navigated the surface to). Requests of any other origin that no handler decides are denied; a permission handler that checks PermissionRequest.Origin can allow them.

func (*App) Surfaces

func (a *App) Surfaces() []*Surface

Surfaces returns the open surfaces in creation order.

type AppEvent

type AppEvent = platform.AppEvent

AppEvent is something that happened to the app as a whole.

type AppEventKind

type AppEventKind = platform.AppEventKind

AppEventKind identifies an AppEvent.

type Appearance

type Appearance = platform.Appearance

Appearance is how a window looks: title bar, transparency, background, material, always-on-top, opacity, and the shadow and system buttons. The zero value is an ordinary window (the switches are negative: NoShadow, NoClose, NoMinimize, NoMaximize). Fields a platform cannot honour are ignored.

type AuthAction

type AuthAction = platform.AuthAction

type AuthChallenge

type AuthChallenge = platform.AuthChallenge

AuthChallenge is an HTTP authentication challenge (Basic, Digest, ...).

type AuthResponse

type AuthResponse = platform.AuthResponse

AuthResponse answers an AuthChallenge. The zero value (AuthDefault) leaves it to the next handler, then to the platform.

type BrowsingData

type BrowsingData = platform.BrowsingData

BrowsingData selects kinds of website data for ClearBrowsingData.

type DownloadEvent

type DownloadEvent = platform.DownloadEvent

DownloadEvent reports progress or the end of an accepted download.

type DownloadRequest

type DownloadRequest = platform.DownloadRequest

DownloadRequest describes a download the page started.

type DownloadState

type DownloadState = platform.DownloadState

type DragOperation

type DragOperation = platform.DragOperation

DragOperation is what the drop target did with dragged files.

type FindOptions

type FindOptions = platform.FindOptions

FindOptions configures Find.

type FindResult

type FindResult = platform.FindResult

FindResult reports a find-in-page search: Matches is -1 where the platform does not count, Active is the 1-based highlighted match (0 unknown).

type HeaderScope

type HeaderScope int

HeaderScope selects the requests extra headers are added to.

const (
	// HeadersAssets adds the headers to requests for the app's assets
	// (the handler in Options.Assets sees them). Every platform.
	HeadersAssets HeaderScope = iota
	// HeadersAll adds them to every request of the WebView, every origin.
	// Only where the platform can (Windows); ErrUnsupported elsewhere.
	HeadersAll
)

type Lifecycle

type Lifecycle = platform.LifecycleEvent

Lifecycle is an application lifecycle event.

type Material

type Material = platform.Material

Material is a system backdrop shown behind a transparent page.

type NavigationRequest = platform.NavigationRequest

NavigationRequest is a main-frame navigation about to start.

type NewWindowAction

type NewWindowAction int

NewWindowAction is what to do with a NewWindowRequest.

const (
	// NewWindowDefault: the next handler decides; finally the default —
	// pages of the app's own origin (the asset origin or the origin the
	// surface was navigated to) open in a new surface, http(s) and mailto
	// URLs elsewhere open in the system browser, anything else is denied.
	NewWindowDefault NewWindowAction = iota
	NewWindowBrowser                 // open the URL with the system's default handler
	NewWindowSurface                 // open it in a new surface with the opener's WebView options
	NewWindowCurrent                 // load it in the requesting surface
	NewWindowDeny                    // do nothing (the handler may have handled it itself)
)

type NewWindowRequest

type NewWindowRequest = platform.NewWindowRequest

NewWindowRequest is the page asking for a new window (window.open, target=_blank).

type Options

type Options struct {
	Name, ID string
	// Assets serves requests under the backend's asset origin; nil
	// answers 404. If a request supplies an Origin header, it must name the
	// asset origin for every method, including GET and HEAD; see assets.go.
	Assets http.Handler
	// AllowCrossOriginAssets turns that Origin check off, for apps whose
	// asset handler does its own (CORS, tokens).
	AllowCrossOriginAssets bool

	// QuitOnLastClose quits the app when its last surface closes
	// (surfaces created with SurfaceOptions.Auxiliary do not count). Nil
	// means the platform default: false on macOS (apps stay in the Dock),
	// true on Windows and Linux. Ignored on mobile. See lifecycle.go.
	QuitOnLastClose *bool
	// URLSchemes are the custom URL schemes the app handles ("myapp" for
	// myapp://...). Launch arguments using them are delivered as
	// EventOpenURL; see lifecycle.go. Registering them with the OS is done
	// when packaging.
	URLSchemes []string

	// OnPanic is called when application code the framework runs panics:
	// main-thread work (Post, Await, AwaitAsync), OnReady, event handlers,
	// App.Go goroutines, ipc bindings (see docs/panics.md). It may run on
	// any goroutine. Returning false exits the process with status 2;
	// for ipc bindings the result is ignored (they only report). Nil
	// means: log the panic with log/slog, keep running in development
	// builds (-tags tango_dev), and in production builds (the default)
	// show an error dialog and exit with status 2.
	OnPanic func(p Panic) (keepRunning bool)

	// DisableFastLanes turns IPC fast lanes off: stream byte frames always
	// go on the message channel, as when the backend has no lanes. The
	// environment variable TANGO_IPC_LANES=0 does the same in any build,
	// for troubleshooting. See App.OnBinary.
	DisableFastLanes bool
}

Options configures an App.

type PDFOptions

type PDFOptions = platform.PDFOptions

PDFOptions configures PrintToPDF.

type Panic

type Panic struct {
	Value any    // the value passed to panic
	Stack []byte // the panicking goroutine's stack trace
	// Where tells what was running: "main-thread callback" (Post, Await,
	// AwaitAsync), "OnReady", "event handler" (OnXxx handlers),
	// "canvas callback", "ui frame", "goroutine" (App.Go), or
	// "binding Service.Method" / "stream Service.Method" (ipc).
	Where string
}

Panic is a panic recovered where the framework called application code.

type PermissionDecision

type PermissionDecision = platform.PermissionDecision

PermissionDecision answers a PermissionRequest. PermissionDefault means "no opinion": the next handler, then the policy decides.

type PermissionRequest

type PermissionRequest = platform.PermissionRequest

PermissionRequest is a page asking for one or more features at once (camera and microphone for one getUserMedia call).

type Rect

type Rect = platform.Rect

Rect is a rectangle in logical pixels: X/Y is the window's top-left corner on the desktop (origin top-left of the primary display), Width/Height the content size (the same size SetSize and Size use).

type Surface

type Surface struct {
	// contains filtered or unexported fields
}

Surface is one native window (desktop) or page (mobile) hosting a WebView. Its methods are safe from any goroutine; off the main thread they run there (Send and Eval asynchronously, the rest waiting for it). After the surface has closed they do nothing.

func (*Surface) App

func (s *Surface) App() *App

App returns the app the surface belongs to.

func (*Surface) Appearance

func (s *Surface) Appearance() (ap Appearance)

Appearance returns the appearance last set (at creation or with SetAppearance).

func (*Surface) BinaryMinSize

func (s *Surface) BinaryMinSize() int

BinaryMinSize implements ipc.BinaryConn: the smallest byte frame worth the downstream lane, -1 without one. Safe from any goroutine.

func (*Surface) BinarySession

func (s *Surface) BinarySession() (uint64, ipc.BinaryConn)

BinarySession snapshots the document identity for a Router connState.

func (*Surface) Bounds

func (s *Surface) Bounds() (r Rect)

Bounds returns the window's position and content size.

func (*Surface) CancelDownload

func (s *Surface) CancelDownload(id uint64) error

CancelDownload cancels a download of this surface (DownloadEvent.ID); a DownloadCanceled event follows. Unknown ids are ignored.

func (*Surface) CaptureWebView

func (s *Surface) CaptureWebView(stamp WebViewStamp) ([]byte, error)

CaptureWebView returns a PNG from the WebView's native screenshot API. It discards the result if the stamp expires before completion.

func (*Surface) Center

func (s *Surface) Center() error

Center centers the window on its display.

func (*Surface) ClearBrowsingData

func (s *Surface) ClearBrowsingData(kinds BrowsingData) error

ClearBrowsingData clears website data of every site: cookies, caches, storage (localStorage, IndexedDB, service workers, ...).

func (*Surface) ClearCookies

func (s *Surface) ClearCookies(domain string) error

ClearCookies deletes the cookies of domain and its subdomains, or every cookie when domain is "".

func (*Surface) Close

func (s *Surface) Close()

Close closes the surface without asking OnClose handlers.

func (*Surface) CloseDevTools

func (s *Surface) CloseDevTools() error

CloseDevTools closes the native inspector if open. It returns ErrUnsupported if the engine does not expose a close operation.

func (*Surface) Cookies

func (s *Surface) Cookies(rawURL string) ([]*http.Cookie, error)

Cookies returns the cookies that would be sent to rawURL, or every cookie when rawURL is "" (ErrUnsupported on Android, which cannot list them). The cookie store is shared by all surfaces of the app.

func (*Surface) DeleteCookie

func (s *Surface) DeleteCookie(c *http.Cookie) error

DeleteCookie deletes the cookie with c's Name, Domain and Path (Path defaults to "/").

func (*Surface) DevToolsOpen

func (s *Surface) DevToolsOpen() (bool, error)

DevToolsOpen reports the native inspector's current visibility. It returns ErrUnsupported if the engine does not expose that state.

func (*Surface) DragFiles

func (s *Surface) DragFiles(paths []string, icon []byte, done func(DragOperation)) error

DragFiles starts a native drag of the files at paths out of the surface, to Finder, Explorer, a file manager or any app that accepts files. paths must be absolute and exist. icon is an optional PNG drag image (nil: the system's file icons). done, if not nil, runs once on the main thread when the drop ends, with what the target did (DragNone when canceled).

Call it while the mouse button is held over the surface — from the page's mousedown or dragstart handler relayed to Go — since the platforms tie a drag to the press that starts it; without a press the drag ends at once with DragNone. In the page, call event.preventDefault() in dragstart so the WebView does not start its own drag.

Platforms: macOS NSDraggingSession, Windows OLE DoDragDrop (modal: the call returns after the drop), Linux GTK drag-and-drop (text/uri-list). It returns ErrUnsupported where the surface cannot start a drag (mobile, canvas-only surfaces on some platforms).

func (*Surface) DropBinarySession

func (s *Surface) DropBinarySession()

DropBinarySession retires the document before Router forgets its streams. It only takes State.mu and never invokes application callbacks.

func (*Surface) Eval

func (s *Surface) Eval(js string)

Eval runs js in the page, fire-and-forget, in order with Send: after the messages sent before it (from the same goroutine) and before those sent after it. While the page polls (down:poll) js runs once the page has delivered the messages before it; otherwise on the main thread.

While a page is loaded js joins that page's generation at the call, as Send does: if the page starts navigating (SurfaceNavigating, Navigate) before js has been handed to it, js is dropped, not run in the next page. A call from the main thread has been handed over by the time Eval returns, unless the page polls. Run a script meant for the new page from OnLoaded. Before a page has loaded (and after Navigate until it loads) js runs on the main thread in whatever page is there.

func (*Surface) EvalWebView

func (s *Surface) EvalWebView(stamp WebViewStamp, expression string) (json.RawMessage, error)

EvalWebView evaluates a synchronous JavaScript expression in the main frame and returns its JSON value. The stamp must be current when the request starts and when the result arrives.

func (*Surface) Find

func (s *Surface) Find(text string, opts FindOptions) (FindResult, error)

Find searches the page for text and highlights the first match (the last with Backward).

func (*Surface) FindNext

func (s *Surface) FindNext() (FindResult, error)

FindNext highlights the next match of the current search.

func (*Surface) FindPrevious

func (s *Surface) FindPrevious() (FindResult, error)

FindPrevious highlights the previous match of the current search.

func (*Surface) Focus

func (s *Surface) Focus()

func (*Surface) Fullscreen

func (s *Surface) Fullscreen() error

func (*Surface) GoBack

func (s *Surface) GoBack() (bool, error)

GoBack navigates to the preceding entry in the native history. It returns false when there is no entry. A navigation policy may veto it.

func (*Surface) GoForward

func (s *Surface) GoForward() (bool, error)

GoForward navigates to the following entry in the native history. It returns false when there is no entry. A navigation policy may veto it.

func (*Surface) Hide

func (s *Surface) Hide()

func (*Surface) ID

func (s *Surface) ID() platform.SurfaceID

ID returns the surface's id, unique for the app's lifetime.

func (*Surface) IsFocused

func (s *Surface) IsFocused() (f bool)

IsFocused reports whether the window has keyboard focus (is the key / foreground window). False once closed.

func (*Surface) IsVisible

func (s *Surface) IsVisible() (v bool)

IsVisible reports whether the window is shown (a minimized window still counts as shown). It asks the window system where the platform can tell, so hiding the whole app (appctl.Hide) is seen too; elsewhere it follows SurfaceOptions.Hidden, Show and Hide. False once closed.

func (*Surface) LaneHello

func (s *Surface) LaneHello() json.RawMessage

LaneHello implements ipc.BinaryConn: it starts a new lane generation for the page's hello and returns the hello reply's "lanes" field, or nil when the page gets no fast lanes. It does not concern applications; use ipc.Router. Safe from any goroutine.

func (*Surface) LastActivityAt

func (s *Surface) LastActivityAt() time.Time

LastActivityAt returns the time of the latest input observed on the surface, including input in embedded WebViews. It returns the zero time before any input and retains its value while hidden or after Close. It is safe to call from any goroutine and does not wait for the UI thread. Coverage depends on the host: WebView input in a separate browser process may only be observable in the main document.

func (*Surface) Maximize

func (s *Surface) Maximize() error

func (*Surface) Minimize

func (s *Surface) Minimize() error

func (*Surface) Native

func (s *Surface) Native() (p uintptr)

Native returns the native handle (NSWindow*, HWND, GtkWindow*, ...), or 0 once closed.

func (*Surface) Navigate

func (s *Surface) Navigate(u string)

Navigate loads url (resolved like SurfaceOptions.URL). Messages sent afterwards wait for the new page's Loaded.

func (*Surface) OnBlurred

func (s *Surface) OnBlurred(fn func())

OnBlurred registers fn to run on the main thread when the window loses keyboard focus.

func (*Surface) OnClose

func (s *Surface) OnClose(fn func() bool)

OnClose registers fn to be asked when the user tries to close the surface (on the main thread, in order); if one returns false the surface stays open and later handlers are not asked.

func (*Surface) OnClosed

func (s *Surface) OnClosed(fn func())

OnClosed registers fn to run on the main thread once the surface closed.

func (*Surface) OnDownloadEvent

func (s *Surface) OnDownloadEvent(fn func(ev DownloadEvent))

OnDownloadEvent registers fn for progress and completion of the surface's downloads.

func (*Surface) OnFilesDropped

func (s *Surface) OnFilesDropped(fn func(paths []string, x, y int))

OnFilesDropped registers fn for files dropped on the page (only with SurfaceOptions.AcceptFiles). x, y is the drop point in page coordinates (logical pixels), 0, 0 where the platform does not tell.

func (*Surface) OnFocused

func (s *Surface) OnFocused(fn func())

OnFocused registers fn to run on the main thread when the window gains keyboard focus.

func (*Surface) OnLoadFailed

func (s *Surface) OnLoadFailed(fn func(url, err string))

OnLoadFailed registers fn for main-frame navigations that failed.

Messages sent with Send are kept, not dropped: they go to the next page that loads, or — when the failed navigation left the previous page in place, as WebKit does for a cancelled or failed provisional load — to that page as soon as it answers a liveness probe.

func (*Surface) OnLoaded

func (s *Surface) OnLoaded(fn func())

OnLoaded registers fn to run on the main thread each time a page finishes loading, after pending messages were delivered.

func (*Surface) OnMoved

func (s *Surface) OnMoved(fn func(x, y int))

OnMoved registers fn for window moves; x, y as in Bounds.

func (*Surface) OnNavigating

func (s *Surface) OnNavigating(fn func(url string))

OnNavigating registers fn for the start of every main-frame navigation (link, reload, Navigate). From then on, messages sent with Send wait for the new page.

func (*Surface) OnResized

func (s *Surface) OnResized(fn func(w, h int))

OnResized registers fn for content size changes (logical pixels).

func (*Surface) OnStateChanged

func (s *Surface) OnStateChanged(fn func(WindowState))

OnStateChanged registers fn for window state changes, by the user or by code.

func (*Surface) OnWebFileChooser

func (s *Surface) OnWebFileChooser(fn func(WebFileChooserEvent)) error

OnWebFileChooser observes the file selection lifecycle on the main thread. With no custom handler Tango opens the platform file picker. The dev host proxy returns ErrUnsupported.

func (*Surface) OnWebNavigation

func (s *Surface) OnWebNavigation(fn func(WebNavigationEvent))

OnWebNavigation observes main-frame events and changes to URL, title and history on the main thread. A nil handler is ignored.

func (*Surface) OpenDevTools

func (s *Surface) OpenDevTools()

OpenDevTools opens the WebView inspector where the platform has one and the surface was created with SurfaceOptions.Debug (some platforms open it regardless). It does nothing otherwise.

func (*Surface) Print

func (s *Surface) Print() error

Print opens the system print dialog for the page.

func (*Surface) PrintToPDF

func (s *Surface) PrintToPDF(opts PDFOptions) ([]byte, error)

PrintToPDF renders the page as a PDF document.

func (*Surface) Reload

func (s *Surface) Reload() error

Reload reloads the page. Like Navigate, messages sent afterwards wait for the reloaded page.

func (*Surface) Restore

func (s *Surface) Restore() error

func (*Surface) Screenshot

func (s *Surface) Screenshot() ([]byte, error)

Screenshot captures the visible part of the page as a PNG image.

func (*Surface) Send

func (s *Surface) Send(msg string)

Send delivers msg to the page's window.__tango.onMessage subscribers. It does not wait for the main thread. Messages sent from one goroutine are delivered in call order. Before the page has loaded (and after Navigate until it loads again) messages are kept and delivered in order on Loaded.

func (*Surface) SendBinary

func (s *Surface) SendBinary(packet []byte) bool

SendBinary implements ipc.BinaryConn: it hands packet to the page's ready downstream lane, false when there is none or it refused. Safe from any goroutine.

func (*Surface) SendBinaryOrdered

func (s *Surface) SendBinaryOrdered(packet []byte) (sent, ordered bool)

SendBinaryOrdered implements ipc.OrderedBinaryConn: SendBinary that also reports whether down:poll took packet (it then travels in the page's one sequenced downstream queue with every later message, so ipc sends no boundary after it). Safe from any goroutine.

func (*Surface) SendWebInput

func (s *Surface) SendWebInput(stamp WebViewStamp, in WebInput) error

SendWebInput dispatches native input to an embedded WebView. An error after dispatch describes the current state. It cannot undo page effects.

func (*Surface) SetAppearance

func (s *Surface) SetAppearance(ap Appearance) error

SetAppearance changes how the window looks. The value is remembered (see Appearance) even when the platform cannot apply it.

func (*Surface) SetAuthHandler

func (s *Surface) SetAuthHandler(fn func(ch AuthChallenge) AuthResponse)

SetAuthHandler sets the surface's handler for HTTP authentication challenges; AuthDefault defers to the app's handler. nil removes it.

func (*Surface) SetBounds

func (s *Surface) SetBounds(r Rect) error

SetBounds moves and resizes the window; r is as Bounds returns it.

func (*Surface) SetCookie

func (s *Surface) SetCookie(c *http.Cookie) error

SetCookie adds or replaces a cookie. c.Domain must be set ("example.com" for a host-only cookie, ".example.com" to include subdomains); Path defaults to "/".

func (*Surface) SetDownloadDestinationHandler

func (s *Surface) SetDownloadDestinationHandler(fn func(DownloadRequest, func(string))) error

SetDownloadDestinationHandler lets the caller choose a destination after the native callback returns. Reply once with an absolute path, a name relative to App.DownloadDir, or an empty string to cancel. CancelDownload also cancels a pending choice. A nil handler restores the synchronous download policy, which also applies on older engines. The dev host proxy returns ErrUnsupported.

func (*Surface) SetDownloadHandler

func (s *Surface) SetDownloadHandler(fn func(req DownloadRequest) string)

SetDownloadHandler sets the surface's handler choosing where its downloads are saved (see App.SetDownloadHandler); it replaces the app's handler for this surface. nil removes it.

func (*Surface) SetExtraHeaders

func (s *Surface) SetExtraHeaders(h http.Header, scope HeaderScope) error

SetExtraHeaders sets headers added to requests of the given scope; nil removes them. HeadersAll is ErrUnsupported where the platform cannot change every request; the headers then still go to asset requests.

func (*Surface) SetNavigationPolicy

func (s *Surface) SetNavigationPolicy(fn func(nav NavigationRequest) bool)

SetNavigationPolicy sets the surface's navigation policy (see App.SetNavigationPolicy); both must allow a navigation. nil removes it.

func (*Surface) SetNewWindowHandler

func (s *Surface) SetNewWindowHandler(fn func(req NewWindowRequest) NewWindowAction)

SetNewWindowHandler sets the surface's handler for new-window requests; NewWindowDefault defers to the app's handler and the default. nil removes it.

func (*Surface) SetPermissionHandler

func (s *Surface) SetPermissionHandler(fn func(req PermissionRequest) PermissionDecision)

SetPermissionHandler sets the surface's handler for page permission requests; PermissionDefault defers to the app's handler and policy. nil removes it.

func (*Surface) SetSize

func (s *Surface) SetSize(w, h int)

func (*Surface) SetSizeLimits

func (s *Surface) SetSizeLimits(minW, minH, maxW, maxH int) error

SetSizeLimits sets the minimum and maximum content size; 0 means no limit.

func (*Surface) SetState

func (s *Surface) SetState(st WindowState) error

SetState minimizes, maximizes, makes fullscreen or restores the window.

func (*Surface) SetTitle

func (s *Surface) SetTitle(title string)

SetTitle sets the window title.

func (*Surface) SetUserAgent

func (s *Surface) SetUserAgent(ua string) error

SetUserAgent changes the User-Agent of later requests; "" restores the platform's.

func (*Surface) SetWebDialogHandler

func (s *Surface) SetWebDialogHandler(fn func(WebDialogRequest, func(WebDialogResponse))) error

SetWebDialogHandler intercepts script dialogs. fn runs on the main thread and may answer later from any goroutine. Only the first reply is used. Closing the surface dismisses pending dialogs. A nil handler restores the platform's default behavior. The dev host proxy returns ErrUnsupported.

func (*Surface) SetWebFileChooserHandler

func (s *Surface) SetWebFileChooserHandler(fn func(WebFileChooserRequest, func([]string))) error

SetWebFileChooserHandler intercepts webpage file selection. Reply with absolute local paths or nil to dismiss. The callback and reply have the same threading and lifetime as SetWebDialogHandler. The dev host proxy returns ErrUnsupported.

func (*Surface) SetWebPopupHandler

func (s *Surface) SetWebPopupHandler(fn func(NewWindowRequest) func(child *Surface)) error

SetWebPopupHandler lets a surface claim the engine's native popup. The handler runs synchronously on the main thread and returns an on-created callback or nil to let the legacy NewWindow policy handle the request. A popup from an embedded surface can be placed by uihost.WebViewOptions.Adopt. A popup from a window receives a new window. The engine retains window.opener when the page permits it. Use child.OnClosed to observe window.close(), user close, and App.Close. The dev host proxy returns ErrUnsupported.

func (*Surface) SetZoom

func (s *Surface) SetZoom(factor float64) error

SetZoom sets the page zoom; 1 is 100%.

func (*Surface) Show

func (s *Surface) Show()

func (*Surface) Size

func (s *Surface) Size() (w, h int)

Size returns the logical size, or 0, 0 once closed.

func (*Surface) State

func (s *Surface) State() (st WindowState)

State returns the window state.

func (*Surface) StopFind

func (s *Surface) StopFind() error

StopFind ends the search and clears its highlight.

func (*Surface) Title

func (s *Surface) Title() (t string)

Title returns the title last set (SurfaceOptions.Title or SetTitle), "" once closed.

func (*Surface) UserAgent

func (s *Surface) UserAgent() (ua string)

UserAgent returns the User-Agent last set (SurfaceOptions.WebView or SetUserAgent); "" means the platform's.

func (*Surface) WebNavigation

func (s *Surface) WebNavigation() WebNavigationEvent

WebNavigation returns the latest load phase and current page metadata. It can be called from any goroutine. Read it after registering a handler to initialize the address bar even if the initial load already started.

func (*Surface) WebViewStamp

func (s *Surface) WebViewStamp() (WebViewStamp, error)

WebViewStamp returns the identity of the currently loaded document and its applied native placement. It can be called from any goroutine. The dev host proxy does not expose stamped operations.

func (*Surface) Zoom

func (s *Surface) Zoom() float64

Zoom returns the page zoom (1 when unsupported).

type SurfaceKind

type SurfaceKind = platform.SurfaceKind

SurfaceKind is the kind of window a surface is created as.

type SurfaceOptions

type SurfaceOptions struct {
	Title               string
	Width, Height       int // logical pixels; 0 means the backend default
	MinWidth, MinHeight int
	Resizable           bool
	Hidden              bool // create without showing; shown by default
	// URL is the page to load. Relative paths ("/index.html",
	// "index.html") resolve against the backend's asset origin; empty means
	// "/". Absolute URLs (http://localhost:5173/) load as is.
	URL   string
	Debug bool // allow the inspector

	// Window options (round 2; see surface_ext.go). Platforms ignore what
	// they cannot do.
	Kind   SurfaceKind // KindModal and KindSheet need Parent
	Parent *Surface
	// X, Y place the window's top-left corner (logical pixels, desktop
	// coordinates). When both are 0, or Centered is set, the window is
	// centered.
	X, Y                int
	Centered            bool
	MaxWidth, MaxHeight int         // 0 means no limit
	State               WindowState // initial state
	Appearance          Appearance
	AcceptFiles         bool // report dropped files (OnFilesDropped) instead of letting the page open them
	// Auxiliary marks a window that does not keep the app running, such
	// as an update window or a tool palette: under Options.QuitOnLastClose
	// the app quits when the last window that is not auxiliary closes,
	// closing the auxiliary ones with it, and closing an auxiliary window
	// never quits it. False (the default) counts the window like any
	// other.
	Auxiliary bool

	// WebView settings: user agent and extra request headers (webview.go).
	WebView WebViewOptions
	// contains filtered or unexported fields
}

SurfaceOptions configures a new Surface.

type TitleBar

type TitleBar = platform.TitleBar

TitleBar is the style of a window's title bar.

type WebDialogKind

type WebDialogKind = platform.WebDialogKind

WebDialogKind identifies the script dialog to answer.

type WebDialogRequest

type WebDialogRequest = platform.WebDialogRequest

WebDialogRequest describes a dialog and its requesting document.

type WebDialogResponse

type WebDialogResponse = platform.WebDialogResponse

WebDialogResponse accepts or dismisses a dialog. Text supplies the accepted prompt's value. For beforeunload, Accepted allows navigation.

type WebFileChooserEvent

type WebFileChooserEvent struct {
	ID        uint64
	Request   WebFileChooserRequest
	Open      bool
	FileCount int
}

WebFileChooserEvent reports a file input's request or completion. On completion Open is false and FileCount reports how many paths were chosen.

type WebFileChooserRequest

type WebFileChooserRequest = platform.WebFileChooserRequest

WebFileChooserRequest describes the selection requested by a file input. Accept may be empty when the backend cannot read the requested filters.

type WebInput

type WebInput = platform.WebInput

WebInput describes input in the native WebView's local logical pixels, from its top-left. The click and scroll point must lie within its visible clip. Positive scroll deltas reveal content further down/right.

type WebInputKind

type WebInputKind = platform.WebInputKind

WebInputKind selects a native click, text entry, or scroll.

type WebNavigationEvent

type WebNavigationEvent struct {
	WebPageState
	ID    uint64
	Kind  WebNavigationKind
	Error string // failure reason, including a superseded navigation
}

WebNavigationEvent describes one main-frame load phase or a metadata change. ID increases per surface for document navigations. Redirects and same-document changes keep the ID. ID zero means no load has been observed.

type WebNavigationKind

type WebNavigationKind = platform.WebNavigationKind

WebNavigationKind identifies a main-frame load phase or a page metadata event.

type WebPageState

type WebPageState = platform.WebPageState

WebPageState describes the WebView URL, document title and native history.

type WebPermission

type WebPermission = platform.WebPermission

WebPermission names a feature a page asks for.

type WebViewOptions

type WebViewOptions struct {

	// UserAgent replaces the platform's User-Agent; "" keeps it.
	UserAgent string
	// Headers are extra request headers for the requests HeaderScope
	// selects.
	Headers     http.Header
	HeaderScope HeaderScope
	// Page enables ordinary browsing. HTTP(S) links can load in this
	// surface and the page cannot access the Tango bridge or asset origin.
	Page bool
	// Profile selects an isolated, persistent website data store shared
	// by surfaces with this name. Empty selects the application's default
	// store. Use up to 64 ASCII letters, digits, underscores or hyphens.
	Profile string
	// contains filtered or unexported fields
}

WebViewOptions are WebView settings of a new surface (SurfaceOptions.WebView).

type WebViewStamp

type WebViewStamp struct {
	SurfaceID              platform.SurfaceID
	NavigationID, LayoutID uint64
	URL                    string
	// contains filtered or unexported fields
}

WebViewStamp identifies a document and applied layout of one embedded WebView. Obtain it again when the page navigates or the layout changes.

type WindowState

type WindowState = platform.WindowState

WindowState is normal, minimized, maximized or fullscreen.

Directories

Path Synopsis
Package asset serves a front end to Tango surfaces: static files from an fs.FS, or, in development builds (-tags tango_dev, which tan dev adds), a reverse proxy to a dev server (Vite).
Package asset serves a front end to Tango surfaces: static files from an fs.FS, or, in development builds (-tags tango_dev, which tan dev adds), a reverse proxy to a dev server (Vite).
Package automation drives a running Tango application from Go tests, like Playwright drives a browser: it starts the program (a development build: -tags tango_dev, which Launch adds when it builds a package) with the automation control channel turned on, finds windows, locates nodes of self-drawn windows through their semantics tree, clicks, types, waits, evaluates JavaScript in WebView windows, takes screenshots and quits the app at the end of the test.
Package automation drives a running Tango application from Go tests, like Playwright drives a browser: it starts the program (a development build: -tags tango_dev, which Launch adds when it builds a package) with the automation control channel turned on, finds windows, locates nodes of self-drawn windows through their semantics tree, clicks, types, waits, evaluates JavaScript in WebView windows, takes screenshots and quits the app at the end of the test.
Package bind exposes the exported methods of a Go value as ipc calls named "Name.Method" using reflection.
Package bind exposes the exported methods of a Go value as ipc calls named "Name.Method" using reflection.
cmd
tan module
examples
a11y-demo command
Command a11y-demo shows how a screen reader sees Tango's self-drawn UI (docs/accessibility.md, docs/specs/a11y-bridge.md).
Command a11y-demo shows how a screen reader sees Tango's self-drawn UI (docs/accessibility.md, docs/specs/a11y-bridge.md).
app-demo command
Command app-demo exercises the app-level features: quit interception, deep links / opened files, and single instance.
Command app-demo exercises the app-level features: quit interception, deep links / opened files, and single instance.
dock-demo command
Command dock-demo is an IDE-style workbench built with ui.Dock in a real window.
Command dock-demo is an IDE-style workbench built with ui.Dock in a real window.
duplex command
Command duplex is the bidirectional stream example: an embedded page talks to Go services over ipc streams that carry JSON and bytes both ways.
Command duplex is the bidirectional stream example: an embedded page talks to Go services over ipc streams that carry JSON and bytes both ways.
duplex-ios command
duplex-ios is the iOS self-test of Tango's ipc streams: the duplex examples' services (package examples/duplex/services: Echo, Upload, Sink, Source, Bench.Report) behind an ipc.Router wired like examples/duplex, and a page (web/selftest.js) that exercises them and reports to Go, which logs one line per result.
duplex-ios is the iOS self-test of Tango's ipc streams: the duplex examples' services (package examples/duplex/services: Echo, Upload, Sink, Source, Bench.Report) behind an ipc.Router wired like examples/duplex, and a page (web/selftest.js) that exercises them and reports to Go, which logs one line per result.
duplex-mobile command
duplex-mobile is the iOS and Android self-test of Tango's ipc streams: the duplex examples' services (package examples/duplex/services: Echo, Upload, Sink, Source, Bench.Report) behind an ipc.Router wired like examples/duplex, and a page (services/selftest.js) that exercises them and reports to Go, which logs one line per result.
duplex-mobile is the iOS and Android self-test of Tango's ipc streams: the duplex examples' services (package examples/duplex/services: Echo, Upload, Sink, Source, Bench.Report) behind an ipc.Router wired like examples/duplex, and a page (services/selftest.js) that exercises them and reports to Go, which logs one line per result.
duplex/services
Package services holds the ipc services shared by the duplex examples (examples/duplex on the desktop, examples/duplex-mobile on iOS).
Package services holds the ipc services shared by the duplex examples (examples/duplex on the desktop, examples/duplex-mobile on iOS).
editor-demo command
Command editor-demo opens the Tango code editor view (ui/editor) in a real window.
Command editor-demo opens the Tango code editor view (ui/editor) in a real window.
hello command
Command hello is the desktop end-to-end example: an embedded page calls a bound Go service, consumes a stream, receives an event and reports back.
Command hello is the desktop end-to-end example: an embedded page calls a bound Go service, consumes a stream, receives an event and reports back.
i18n-demo command
Command i18n-demo shows package i18n: the system languages, an app catalog, and the native menu roles in the current locale.
Command i18n-demo shows package i18n: the system languages, an app catalog, and the native menu roles in the current locale.
ledger command
Command ledger is a small personal bookkeeping app built with Tango's self-drawn UI (no WebView): record income and expenses, filter and sort them, see monthly totals and where the money went, export to CSV.
Command ledger is a small personal bookkeeping app built with Tango's self-drawn UI (no WebView): record income and expenses, filter and sort them, see monthly totals and where the money went, export to CSV.
macoslite-counter command
macoslite-counter is the reference window for the macoslite package: a counter drawn with Canvas calls only, used to measure the idle memory of a native lite window against other frameworks (see README.md).
macoslite-counter is the reference window for the macoslite package: a counter drawn with Canvas calls only, used to measure the idle memory of a native lite window against other frameworks (see README.md).
mobile-hello command
mobile-hello is the smallest Tango app that runs unchanged on desktop (go run .) and on iOS (bash mobile/ios/build.sh examples/mobile-hello).
mobile-hello is the smallest Tango app that runs unchanged on desktop (go run .) and on iOS (bash mobile/ios/build.sh examples/mobile-hello).
mobile-ui command
mobile-ui shows Tango's self-drawn UI (packages ui and ui/mobile) as a full-screen page through uihost.Open: no WebView.
mobile-ui shows Tango's self-drawn UI (packages ui and ui/mobile) as a full-screen page through uihost.Open: no WebView.
notify-demo command
Command notify-demo smoke-tests the system integration packages on a real backend: clipboard images (written, read back, compared; the clipboard's text is saved first and restored at the end), a global hotkey registered and unregistered, a notification (from a bare binary it must fail with a clear error rather than crash), and a window shortcut triggered by a synthetic keydown.
Command notify-demo smoke-tests the system integration packages on a real backend: clipboard images (written, read back, compared; the clipboard's text is saved first and restored at the end), a global hotkey registered and unregistered, a notification (from a bare binary it must fail with a clear error rather than crash), and a window shortcut triggered by a synthetic keydown.
print-demo command
Command print-demo shows package sys/print: print the page through the system print dialog, export it as a PDF file, and print a PDF document and a generated image.
Command print-demo shows package sys/print: print the page through the system print dialog, export it as a PDF file, and print a PDF document and a generated image.
runtime-demo command
Command runtime-demo shows the page-side runtime API (package jsapi, window.tango.Window / Screens / Theme / Clipboard / Dialog ...): the page retitles and resizes its window, reads the displays and the theme, round trips the clipboard, listens to window and theme events, and shows a message box and a context menu.
Command runtime-demo shows the page-side runtime API (package jsapi, window.tango.Window / Screens / Theme / Clipboard / Dialog ...): the page retitles and resizes its window, reads the displays and the theme, round trips the clipboard, listens to window and theme events, and shows a message box and a context menu.
showcase command
Command showcase is Tango's demo app: a WebView page (plain HTML/CSS/JS, no npm) that shows the IPC layer (bound calls, errors, events, streams with back-pressure and cancel), system capabilities reached from the page through jsapi (window, clipboard, dialogs, notifications, displays, theme), and the native side driven from Go (tray icon, app menu, notifications, theme following).
Command showcase is Tango's demo app: a WebView page (plain HTML/CSS/JS, no npm) that shows the IPC layer (bound calls, errors, events, streams with back-pressure and cancel), system capabilities reached from the page through jsapi (window, clipboard, dialogs, notifications, displays, theme), and the native side driven from Go (tray icon, app menu, notifications, theme following).
system-demo command
Command system-demo exercises the desktop integration packages (screen, theme, shell, appctl, autostart, env) and logs PASS/FAIL for each check.
Command system-demo exercises the desktop integration packages (screen, theme, shell, appctl, autostart, env) and logs PASS/FAIL for each check.
sysx-demo command
Command sysx-demo exercises the desktop system packages: securestore, power, network, a tray flyout panel, the app shortcut menu (Dock menu / Jump List) and dragging a file out of a window.
Command sysx-demo exercises the desktop system packages: securestore, power, network, a tray flyout panel, the app shortcut menu (Dock menu / Jump List) and dragging a file out of a window.
terminal command
Command terminal opens the Tango terminal component (ui/terminal) in a window, connected to a shell on a local pseudo-terminal (sys/pty).
Command terminal opens the Tango terminal component (ui/terminal) in a window, connected to a shell on a local pseudo-terminal (sys/pty).
terminal-workspace command
Command terminal-workspace demonstrates application-owned terminal sessions: real local shells, editable tabs, nested split panes and window shortcuts.
Command terminal-workspace demonstrates application-owned terminal sessions: real local shells, editable tabs, nested split panes and window shortcuts.
ui-gallery command
Command ui-gallery renders the Tango self-drawn component gallery to PNG files with the headless ui.Driver:
Command ui-gallery renders the Tango self-drawn component gallery to PNG files with the headless ui.Driver:
ui-gallery/gallery
Package gallery is the page registry of the ui-gallery example.
Package gallery is the page registry of the ui-gallery example.
ui-hotreload command
Command ui-hotreload shows hot reload of the self-drawn UI under tan dev.
Command ui-hotreload shows hot reload of the self-drawn UI under tan dev.
ui-window command
Command ui-window opens Tango's self-drawn UI in a real window.
Command ui-window opens Tango's self-drawn UI in a real window.
update-demo command
Command update-demo shows the default update window of service/updater/updateui.
Command update-demo shows the default update window of service/updater/updateui.
webview-demo command
Command webview-demo exercises the advanced WebView features (package tango, webview.go): permission requests, downloads, cookies, HTTP authentication, find in page, user agent and extra headers, new-window requests, the navigation policy, PDF and PNG capture.
Command webview-demo exercises the advanced WebView features (package tango, webview.go): permission requests, downloads, cookies, HTTP authentication, find in page, user agent and extra headers, new-window requests, the navigation policy, PDF and PNG capture.
webview-embed command
Command webview-embed puts native WebViews inside a self-drawn layout (docs/specs/webview-embed.md): one fills the right side of the window, another sits in a scrolling list on the left and is clipped by it.
Command webview-embed puts native WebViews inside a self-drawn layout (docs/specs/webview-embed.md): one fills the right side of the window, another sits in a scrolling list on the left and is clipped by it.
webview-overlay command
Command webview-overlay mixes a WebView page with Tango's self-drawn UI in one window (docs/specs/canvas-surface.md, step D).
Command webview-overlay mixes a WebView page with Tango's self-drawn UI in one window (docs/specs/canvas-surface.md, step D).
Package i18n gives a Tango app the user's system languages, a current locale the app may override, and a small message catalog with named arguments and CLDR plural categories.
Package i18n gives a Tango app the user's system languages, a current locale the app may override, and a small message catalog with named arguments and CLDR plural categories.
internal
automation
Package automation is the app side of Tango's whole-app automation (docs/automation.md) and the wire protocol it shares with the test client, package github.com/tangoui/tango/automation.
Package automation is the app side of Tango's whole-app automation (docs/automation.md) and the wire protocol it shares with the test client, package github.com/tangoui/tango/automation.
automation/client
Package client is the automation channel's client without a test harness: it connects to a Tango development build, authenticates and exchanges requests (Conn), builds and starts such a program (Build, Launch) and writes the page-side JavaScript of WebView selector operations.
Package client is the automation channel's client without a test harness: it connects to a Tango development build, authenticates and exchanges requests (Conn), builds and starts such a program (Build, Launch) and writes the page-side JavaScript of WebView selector operations.
cmd/apitxt command
Command apitxt writes and checks the API golden files of the module: one sorted text file per public package under api/go, one fact per line, plus the tier checks of docs/specs/api-stability.md §4.3.
Command apitxt writes and checks the API golden files of the module: one sorted text file per public package under api/go, one fact per line, plus the tier checks of docs/specs/api-stability.md §4.3.
cmd/icongen command
Command icongen generates the icon sets in ui/icon/element, ui/icon/antd and ui/icon/lucide from the published SVG packages:
Command icongen generates the icon sets in ui/icon/element, ui/icon/antd and ui/icon/lucide from the published SVG packages:
cmd/shadcngen command
Command shadcngen writes ui/theme/shadcn_data.go from the shadcn/ui v4 theme registry (apps/v4/registry/themes.ts) and the Tailwind CSS v4 gray scales (theme.css).
Command shadcngen writes ui/theme/shadcn_data.go from the shadcn/ui v4 theme registry (apps/v4/registry/themes.ts) and the Tailwind CSS v4 gray scales (theme.css).
cmd/uiperf command
corehook
Package corehook lets Tango's own feature packages (menu, tray, ...) reach core internals without the root package exporting them.
Package corehook lets Tango's own feature packages (menu, tray, ...) reach core internals without the root package exporting them.
devfeat
Package devfeat holds the core's development features: window placement across `tan dev` restarts (windowstate.go) and the whole-app automation channel (automation.go, docs/automation.md).
Package devfeat holds the core's development features: window placement across `tan dev` restarts (windowstate.go) and the whole-app automation channel (automation.go, docs/automation.md).
devhost
Package devhost implements hot reload of Tango's self-drawn UI under `tan dev` (docs/specs/ui-hotreload.md): the wire protocol between the long-lived host process (it owns the windows) and the worker processes (the user's app, replaced on every rebuild), shared-memory frame transport and state snapshots.
Package devhost implements hot reload of Tango's self-drawn UI under `tan dev` (docs/specs/ui-hotreload.md): the wire protocol between the long-lived host process (it owns the windows) and the worker processes (the user's app, replaced on every rebuild), shared-memory frame transport and state snapshots.
devhost/host
Package host is the hot-reload host process: it owns the canvas windows of an app run by `tan dev` and shows frames rendered by worker processes (each rebuild of the app), forwarding input to the current worker and swapping workers without closing windows.
Package host is the hot-reload host process: it owns the canvas windows of an app run by `tan dev` and shows frames rendered by worker processes (each rebuild of the app), forwarding input to the current worker and swapping workers without closing windows.
downq
Package downq holds the per-page downstream queue of the down:poll lane (docs/superpowers/specs/2026-11-14-down-poll-design.md): every message, byte packet and barrier the core sends to a page gets a sequence number, and while the page polls, the items wait here until a poll request (Serve) takes them in a batch.
Package downq holds the per-page downstream queue of the down:poll lane (docs/superpowers/specs/2026-11-14-down-poll-design.md): every message, byte packet and barrier the core sends to a page gets a sequence number, and while the page polls, the items wait here until a poll request (Serve) takes them in a batch.
lane
Package lane holds the per-page state of IPC fast lanes: side channels that carry stream byte frames as binary packets next to the message channel (see the ipc package comment, "Fast lanes", and docs/specs/2026-11-13-ipc-duplex-streams.md §6.1).
Package lane holds the per-page state of IPC fast lanes: side channels that carry stream byte frames as binary packets next to the message channel (see the ipc package comment, "Fast lanes", and docs/specs/2026-11-13-ipc-duplex-streams.md §6.1).
lane/shmring
Package shmring implements the single-producer, single-consumer ring for the WebView2 shared-memory IPC lanes.
Package shmring implements the single-producer, single-consumer ring for the WebView2 shared-memory IPC lanes.
nativeglyph
Package nativeglyph connects text-engine-owned glyph resources to optional native renderers without adding platform handles to the public paint API.
Package nativeglyph connects text-engine-owned glyph resources to optional native renderers without adding platform handles to the public paint API.
platform
Package platform defines the contract between Tango's core (the root tango package) and each native backend (darwin, windows, linux, ios, android, fake).
Package platform defines the contract between Tango's core (the root tango package) and each native backend (darwin, windows, linux, ios, android, fake).
platform/a11ybridge
Package a11ybridge holds the platform-neutral parts of the accessibility bridges of the desktop backends (docs/specs/a11y-bridge.md): role and state translation from ui/a11y to NSAccessibility, UI Automation and AT-SPI2, focus and live-region computation, hit testing and coordinate conversion.
Package a11ybridge holds the platform-neutral parts of the accessibility bridges of the desktop backends (docs/specs/a11y-bridge.md): role and state translation from ui/a11y to NSAccessibility, UI Automation and AT-SPI2, focus and live-region computation, hit testing and coordinate conversion.
platform/android
Package android is Tango's Android backend: one Activity (the Java host in mobile/android) whose content is a stack of full-screen pages, WebViews or self-drawn canvases, driven over JNI.
Package android is Tango's Android backend: one Activity (the Java host in mobile/android) whose content is a stack of full-screen pages, WebViews or self-drawn canvases, driven over JNI.
platform/darwin/internal/smoke command
Command smoke drives the macOS backend end to end without the root tango package: a window, an asset page served through tango://, a JS→Go message, an Eval round trip, a fetch POST and a streamed response, a sheet dialog, the clipboard and the app menu.
Command smoke drives the macOS backend end to end without the root tango package: a window, an asset page served through tango://, a JS→Go message, an Eval round trip, a fetch POST and a streamed response, a sheet dialog, the clipboard and the app menu.
platform/darwin/internal/smokeattach command
Command smokeattach drives a canvas attached to a WebView surface of the macOS backend (docs/specs/canvas-surface.md, step D) without the root tango package.
Command smokeattach drives a canvas attached to a WebView surface of the macOS backend (docs/specs/canvas-surface.md, step D) without the root tango package.
platform/darwin/internal/smokecanvas command
Command smokecanvas drives a canvas surface of the macOS backend (the self-drawn UI window, docs/specs/canvas-surface.md) without the root tango package.
Command smokecanvas drives a canvas surface of the macOS backend (the self-drawn UI window, docs/specs/canvas-surface.md) without the root tango package.
platform/darwin/internal/smokeext command
Command smokeext checks the window capabilities (contract round 2) on the real macOS backend through the root tango package: a frameless transparent window and a normal one; SetBounds, Maximize, Restore, SetZoom, Reload, a failed navigation, a sheet and the events they cause.
Command smokeext checks the window capabilities (contract round 2) on the real macOS backend through the root tango package: a frameless transparent window and a normal one; SetBounds, Maximize, Restore, SetZoom, Reload, a failed navigation, a sheet and the events they cause.
platform/darwin/internal/smokemetal command
Command smokemetal checks the GPU presentation path of the macOS canvas (platform.CanvasMetal) with the smallest possible Metal client: it calls UseMetalLayer on a canvas surface, then on every CanvasFrame takes the layer's next drawable, clears it to a colour that changes per frame, blits a white marker into the top-left quarter (width/2 × height/4) and presents it.
Command smokemetal checks the GPU presentation path of the macOS canvas (platform.CanvasMetal) with the smallest possible Metal client: it calls UseMetalLayer on a canvas surface, then on every CanvasFrame takes the layer's next drawable, clears it to a colour that changes per frame, blits a white marker into the top-left quarter (width/2 × height/4) and presents it.
platform/darwin/internal/smoketray command
Command smoketray checks menus, context menus and the tray icon on the real macOS backend through the public tango, menu and tray packages: it creates a tray icon with a menu, updates it, clicks tray menu items, opens a context menu with menu.Popup and one from the page (data-tango-menu), each closed programmatically.
Command smoketray checks menus, context menus and the tray icon on the real macOS backend through the public tango, menu and tray packages: it creates a tray icon with a menu, updates it, clicks tray menu items, opens a context menu with menu.Popup and one from the page (data-tango-menu), each closed programmatically.
platform/darwin/internal/smokewebdrop command
Command smokewebdrop checks file drags over a WebView surface created with AcceptFiles on the real macOS backend: the page sees the hover (dragenter / dragover / dragleave, with "Files" in the types) so it can highlight a drop target, the drop goes to OnFilesDropped (paths and point) instead of to the page or a navigation, and a drag without files is left to WebKit.
Command smokewebdrop checks file drags over a WebView surface created with AcceptFiles on the real macOS backend: the page sees the hover (dragenter / dragover / dragleave, with "Files" in the types) so it can highlight a drop target, the drop goes to OnFilesDropped (paths and point) instead of to the page or a navigation, and a drag without files is left to WebKit.
platform/fake
Package fake is a headless platform.Backend for testing Tango's core.
Package fake is a headless platform.Backend for testing Tango's core.
platform/fake/apphook
Package apphook lets test helpers build a tango.App on an injected Backend without the root package exporting a constructor for it.
Package apphook lets test helpers build a tango.App on an injected Backend without the root package exporting a constructor for it.
platform/fake/faketest
Package faketest runs a tango.App on the fake backend for tests of packages built on tango (capability packages, ipc, bind, ...).
Package faketest runs a tango.App on the fake backend for tests of packages built on tango (capability packages, ipc, bind, ...).
platform/linux
Package linux is Tango's Linux desktop backend: GTK 3 windows hosting WebKitGTK 4.1 web views, loaded at run time with purego (no cgo).
Package linux is Tango's Linux desktop backend: GTK 3 windows hosting WebKitGTK 4.1 web views, loaded at run time with purego (no cgo).
platform/linux/internal/smoke command
Command smoke is a manual check of the Linux backend on a real desktop:
Command smoke is a manual check of the Linux backend on a real desktop:
platform/linux/internal/smokeattach command
Command smokeattach drives canvases attached to a WebView surface of the Linux backend (docs/specs/canvas-surface.md, step D) without the root tango package.
Command smokeattach drives canvases attached to a WebView surface of the Linux backend (docs/specs/canvas-surface.md, step D) without the root tango package.
platform/linux/internal/smokecanvas command
Command smokecanvas drives a canvas surface of the Linux backend (the self-drawn UI window, docs/specs/canvas-surface.md) without the root tango package.
Command smokecanvas drives a canvas surface of the Linux backend (the self-drawn UI window, docs/specs/canvas-surface.md) without the root tango package.
platform/mobilecanvas
Package mobilecanvas holds the platform-independent logic of the iOS and Android canvas backends (docs/specs/mobile-canvas.md): the frame scheduler, touch bookkeeping, the input-method shadow document, UTF-16 offsets and inset arithmetic.
Package mobilecanvas holds the platform-independent logic of the iOS and Android canvas backends (docs/specs/mobile-canvas.md): the frame scheduler, touch bookkeeping, the input-method shadow document, UTF-16 offsets and inset arithmetic.
platform/native
Package native picks the platform backend for the GOOS being built and holds the per-platform main-thread rules the core follows.
Package native picks the platform backend for the GOOS being built and holds the per-platform main-thread rules the core follows.
platform/rolenames
Package rolenames holds the localized labels of the native menu roles and the default dialog buttons the desktop backends supply themselves, in the wording of each platform (Apple, Microsoft and GNOME style guides).
Package rolenames holds the localized labels of the native menu roles and the default dialog buttons the desktop backends supply themselves, in the wording of each platform (Apple, Microsoft and GNOME style guides).
platform/windows
Package windows is Tango's Windows backend: Win32 windows hosting Microsoft Edge WebView2, called through package syscall and COM vtables (no cgo).
Package windows is Tango's Windows backend: Win32 windows hosting Microsoft Edge WebView2, called through package syscall and COM vtables (no cgo).
platform/windows/internal/smoke command
Command smoke exercises the Windows backend without the tango root package: it opens a window, serves a page through ServeAsset, exchanges messages with it, sets a menu, and quits once the page has loaded and its message round-tripped (or after a 30-second timeout).
Command smoke exercises the Windows backend without the tango root package: it opens a window, serves a page through ServeAsset, exchanges messages with it, sets a menu, and quits once the page has loaded and its message round-tripped (or after a 30-second timeout).
platform/windows/internal/smokeattach command
Command smokeattach drives canvases attached to a WebView surface of the Windows backend (docs/specs/canvas-surface.md, step D) without the root tango package.
Command smokeattach drives canvases attached to a WebView surface of the Windows backend (docs/specs/canvas-surface.md, step D) without the root tango package.
platform/windows/internal/smokecanvas command
Command smokecanvas drives a canvas surface of the Windows backend (the self-drawn UI window, docs/specs/canvas-surface.md) without the root tango package.
Command smokecanvas drives a canvas surface of the Windows backend (the self-drawn UI window, docs/specs/canvas-surface.md) without the root tango package.
render/gpu
Package gpu is the device-independent half of Tango's GPU renderer.
Package gpu is the device-independent half of Tango's GPU renderer.
render/gpu/atlas
Package atlas is the GPU renderer's persistent mask atlas: an R8 texture holding coverage masks across frames — glyphs (KindGlyph) and filled paths (KindPath).
Package atlas is the GPU renderer's persistent mask atlas: an R8 texture holding coverage masks across frames — glyphs (KindGlyph) and filled paths (KindPath).
render/gpu/cpuexec
Package cpuexec runs the GPU quad shader (internal/render/gpu/shaders) on the CPU, so the GPU renderer's pipeline can be tested without a GPU.
Package cpuexec runs the GPU quad shader (internal/render/gpu/shaders) on the CPU, so the GPU renderer's pipeline can be tested without a GPU.
render/gpu/d3d11
Package d3d11 is the Direct3D 11 backend of the GPU renderer: a gpu.Device that executes internal/render/gpu frames on a D3D11 device and a presenter that shows them in a window through a DXGI flip-model swap chain.
Package d3d11 is the Direct3D 11 backend of the GPU renderer: a gpu.Device that executes internal/render/gpu frames on a D3D11 device and a presenter that shows them in a window through a DXGI flip-model swap chain.
render/gpu/gen
Package gen holds the shader sources generated from internal/render/gpu/shaders.
Package gen holds the shader sources generated from internal/render/gpu/shaders.
render/gpu/gl
Package gl is the OpenGL backend of the GPU renderer: a gpu.Device that executes internal/render/gpu frames with OpenGL 3.3 core and a presenter that shows them in a GTK3 GtkGLArea.
Package gl is the OpenGL backend of the GPU renderer: a gpu.Device that executes internal/render/gpu frames with OpenGL 3.3 core and a presenter that shows them in a GTK3 GtkGLArea.
render/gpu/gl/nativewindow
Package nativewindow is the hand-over point between a platform canvas that owns a native window (an Android ANativeWindow) and the OpenGL ES presenter that draws into it (gl.NewPresenterAndroid).
Package nativewindow is the hand-over point between a platform canvas that owns a native window (an Android ANativeWindow) and the OpenGL ES presenter that draws into it (gl.NewPresenterAndroid).
render/gpu/internal/devkit
Package devkit holds the backend-neutral parts of the GPU devices (internal/render/gpu/d3d11, internal/render/gpu/gl): the layer texture pool, the partial-frame checks, the copy scratch sizing and the clearing quads, written over an abstract texture handle so they are tested on any machine.
Package devkit holds the backend-neutral parts of the GPU devices (internal/render/gpu/d3d11, internal/render/gpu/gl): the layer texture pool, the partial-frame checks, the copy scratch sizing and the clearing quads, written over an abstract texture handle so they are tested on any machine.
render/gpu/internal/gpuconf
Package gpuconf is the device conformance suite of the GPU renderer: Conformance runs the checks every gpu.Device backend (internal/render/gpu/metal, internal/render/gpu/d3d11, …) must pass on the same display lists, through gpu.Renderer and directly with hand-built gpu.Frames, comparing the read-back target with paint.CPU at the thresholds of package gputest.
Package gpuconf is the device conformance suite of the GPU renderer: Conformance runs the checks every gpu.Device backend (internal/render/gpu/metal, internal/render/gpu/d3d11, …) must pass on the same display lists, through gpu.Renderer and directly with hand-built gpu.Frames, comparing the read-back target with paint.CPU at the thresholds of package gputest.
render/gpu/internal/gputest
Package gputest holds the test scenes and image comparison shared by the GPU renderer's tests (internal/render/gpu with the CPU executor, internal/render/gpu/metal with a real device), so every backend is checked against paint.CPU on the same display lists with the same thresholds.
Package gputest holds the test scenes and image comparison shared by the GPU renderer's tests (internal/render/gpu with the CPU executor, internal/render/gpu/metal with a real device), so every backend is checked against paint.CPU on the same display lists with the same thresholds.
render/gpu/internal/racetest
Package racetest reports whether the test binary was built with the race detector, so the GPU renderer's heavy pixel tests (the CPU executor runs the shader per pixel, 10–20× slower under -race) can run a reduced but representative set of cases there and keep the full set otherwise.
Package racetest reports whether the test binary was built with the race detector, so the GPU renderer's heavy pixel tests (the CPU executor runs the shader per pixel, 10–20× slower under -race) can run a reduced but representative set of cases there and keep the full set otherwise.
render/gpu/metal
Package metal is the Metal Device of the GPU renderer (internal/render/gpu): it executes gpu.Frames into a persistent offscreen RGBA8 render target that ReadPixels reads back, and NewPresenter shows it in a CAMetalLayer.
Package metal is the Metal Device of the GPU renderer (internal/render/gpu): it executes gpu.Frames into a persistent offscreen RGBA8 render target that ReadPixels reads back, and NewPresenter shows it in a CAMetalLayer.
render/gpu/shaders
Package shaders holds the GPU renderer's shaders, written in Go against package sl.
Package shaders holds the GPU renderer's shaders, written in Go against package sl.
render/quartz
Package quartz plans retained native layers for macOS windows.
Package quartz plans retained native layers for macOS windows.
render/shader/cmd/tanshader command
Command tanshader compiles a Go shader package (written against internal/render/shader/sl) to Metal Shading Language, HLSL and GLSL.
Command tanshader compiles a Go shader package (written against internal/render/shader/sl) to Metal Shading Language, HLSL and GLSL.
render/shader/front
Package front is the shader compiler front end: it loads a Go package written against package sl, type-checks it with go/types, checks that it stays inside the shader subset, and lowers it to package ir.
Package front is the shader compiler front end: it loads a Go package written against package sl, type-checks it with go/types, checks that it stays inside the shader subset, and lowers it to package ir.
render/shader/glsl
Package glsl generates GLSL source from a shader ir.Module, for OpenGL 3.3 core (#version 330 core) or, as a dialect of the same output, OpenGL ES 3.0 (#version 300 es, which additionally declares highp default precision for float, int and sampler2D).
Package glsl generates GLSL source from a shader ir.Module, for OpenGL 3.3 core (#version 330 core) or, as a dialect of the same output, OpenGL ES 3.0 (#version 300 es, which additionally declares highp default precision for float, int and sampler2D).
render/shader/hlsl
Package hlsl generates HLSL (shader model 5.0) source from a shader ir.Module, for Direct3D 11.
Package hlsl generates HLSL (shader model 5.0) source from a shader ir.Module, for Direct3D 11.
render/shader/ir
Package ir is the structured intermediate representation shared by the shader front end (Go AST lowering) and the backends (Metal emission, CPU execution).
Package ir is the structured intermediate representation shared by the shader front end (Go AST lowering) and the backends (Metal emission, CPU execution).
render/shader/msl
Package msl generates Metal Shading Language source from a shader ir.Module.
Package msl generates Metal Shading Language source from a shader ir.Module.
render/shader/sl
Package sl is the shading language that GPU shaders are written in.
Package sl is the shading language that GPU shaders are written in.
uithread
Package uithread runs a task loop on a goroutine locked to its own OS thread: the UI thread of one window.
Package uithread runs a task loop on a goroutine locked to its own OS thread: the UI thread of one window.
Package ipc implements Tango's IPC wire protocol (version 2) on top of raw page messages: calls (JS→Go request/response), events (both directions) and flow-controlled, bidirectional streams that either side may open and that carry JSON values and bytes both ways.
Package ipc implements Tango's IPC wire protocol (version 2) on top of raw page messages: calls (JS→Go request/response), events (both directions) and flow-controlled, bidirectional streams that either side may open and that carry JSON values and bytes both ways.
Package jsapi exposes Tango's system capabilities to the page: the window the page lives in, app information and control, clipboard, dialogs, notifications, shell, context menus and global shortcuts.
Package jsapi exposes Tango's system capabilities to the page: the window the page lives in, app information and control, clipboard, dialogs, notifications, shell, context menus and global shortcuts.
Package macoslite is a minimal macOS-native window host for small utility windows (settings, updaters, prompts).
Package macoslite is a minimal macOS-native window host for small utility windows (settings, updaters, prompts).
runtime-js
runtimejs
Package runtimejs embeds the IIFE build of @tangoui/runtime.
Package runtimejs embeds the IIFE build of @tangoui/runtime.
Package service ties long-lived Go values ("services") to the lifecycle of a tango.App: they start in registration order once the app is ready and shut down in reverse order when it terminates.
Package service ties long-lived Go values ("services") to the lifecycle of a tango.App: they start in registration order once the app is ready and shut down in reverse order when it terminates.
fileserver
Package fileserver serves a local directory over HTTP, for showing user files (downloads, generated images, a documents folder) in a page.
Package fileserver serves a local directory over HTTP, for showing user files (downloads, generated images, a documents folder) in a page.
kv
Package kv is a small thread-safe key-value store for app settings and state: kept in memory and, optionally, persisted to a JSON file.
Package kv is a small thread-safe key-value store for app settings and state: kept in memory and, optionally, persisted to a JSON file.
log
Package log sets up application logging on log/slog: records go to stderr and to a log file that rotates by size, and the page can log through ipc (Handler).
Package log sets up application logging on log/slog: records go to stderr and to a log file that rotates by size, and the page can log through ipc (Handler).
paths
Package paths returns the per-user directories an application keeps its files in, on every platform Tango runs on.
Package paths returns the per-user directories an application keeps its files in, on every platform Tango runs on.
updater
Package updater keeps a Tango desktop app up to date: it fetches a signed update manifest, refuses anything older than what it runs (or has seen), downloads a binary patch or the full release, verifies it, installs it once the app quits, and rolls back if the new version does not confirm that it starts.
Package updater keeps a Tango desktop app up to date: it fetches a signed update manifest, refuses anything older than what it runs (or has seen), downloads a binary patch or the full release, verifies it, installs it once the app quits, and rolls back if the new version does not confirm that it starts.
updater/internal/e2e/drillapp command
Command drillapp is the app of the macOS update drill (see ../drill_test.go): a headless Tango app whose version is set at link time.
Command drillapp is the app of the macOS update drill (see ../drill_test.go): a headless Tango app whose version is set at link time.
updater/updateui
Package updateui is a ready-made update window for apps that use service/updater: it checks for updates in the background, shows what a new release contains, downloads it with progress, and restarts into it when the user agrees.
Package updateui is a ready-made update window for apps that use service/updater: it checks for updates in the background, shows what a new release contains, downloads it with progress, and restarts into it when the user agrees.
site
tools/apigen command
Command apigen writes the API reference of the Tango documentation site: one Markdown page per public package of the module (exported constants, variables, functions, types and methods with their doc comments) plus an index.
Command apigen writes the API reference of the Tango documentation site: one Markdown page per public package of the module (exported constants, variables, functions, types and methods with their doc comments) plus an index.
tools/compdoc command
Command compdoc extracts the usage documentation of the component pages of the Tango documentation site: for every component of the live catalog it reports the public entry points (constructor signatures and doc comments), the builder types they return with all their exported methods, the exported fields of struct types taken as parameters, and the Go source of every gallery demo of the component.
Command compdoc extracts the usage documentation of the component pages of the Tango documentation site: for every component of the live catalog it reports the public entry points (constructor signatures and doc comments), the builder types they return with all their exported methods, the exported fields of struct types taken as parameters, and the Go source of every gallery demo of the component.
tools/playground command
The documentation playground renders the public TanGo components unchanged.
The documentation playground renders the public TanGo components unchanged.
sys
appctl
Package appctl controls the app as a whole in the window manager: hide and show all its windows, the dock / taskbar badge and progress bar, bouncing the dock icon or flashing the taskbar button, and the dock icon itself (tray-only apps).
Package appctl controls the app as a whole in the window manager: hide and show all its windows, the dock / taskbar badge and progress bar, bouncing the dock icon or flashing the taskbar button, and the dock icon itself (tray-only apps).
autostart
Package autostart starts the app when the user logs in.
Package autostart starts the app when the user logs in.
background
Package background runs work while the app is in the background: periodic content refresh and longer maintenance tasks, scheduled with the system's task scheduler (BGTaskScheduler on iOS, JobScheduler on Android) and run when the system decides.
Package background runs work while the app is in the background: periodic content refresh and longer maintenance tasks, scheduled with the system's task scheduler (BGTaskScheduler on iOS, JobScheduler on Android) and run when the system decides.
biometric
Package biometric verifies the device owner with Face ID / Touch ID (iOS, macOS) or BiometricPrompt (Android 9+).
Package biometric verifies the device owner with Face ID / Touch ID (iOS, macOS) or BiometricPrompt (Android 9+).
clipboard
Package clipboard reads and writes the system clipboard: text, images (PNG bytes) and file lists.
Package clipboard reads and writes the system clipboard: text, images (PNG bytes) and file lists.
device
Package device holds small device controls of mobile apps: asking for a store rating, opening the app's settings page, keeping the screen on, screen brightness, the status bar, and the software keyboard.
Package device holds small device controls of mobile apps: asking for a store rating, opening the app's settings page, keeping the screen on, screen brightness, the status bar, and the software keyboard.
dialog
Package dialog shows native message and file dialogs.
Package dialog shows native message and file dialogs.
env
Package env describes the environment the app runs in: operating system and version, CPU architecture, whether this is a debug build, and the WebView engine.
Package env describes the environment the app runs in: operating system and version, CPU architecture, whether this is a debug build, and the WebView engine.
flyout
Package flyout shows a borderless panel under a tray icon — a popover in the macOS menu bar, a flyout above the Windows notification area — that hides itself when it loses focus.
Package flyout shows a borderless panel under a tray icon — a popover in the macOS menu bar, a flyout above the Windows notification area — that hides itself when it loses focus.
haptics
Package haptics plays haptic feedback: impacts, selection ticks and notification patterns (UIFeedbackGenerator on iOS, View.performHapticFeedback on Android, which needs no permission).
Package haptics plays haptic feedback: impacts, selection ticks and notification patterns (UIFeedbackGenerator on iOS, View.performHapticFeedback on Android, which needs no permission).
hotkey
Package hotkey registers keyboard shortcuts.
Package hotkey registers keyboard shortcuts.
internal/capcall
Package capcall holds the plumbing every sys/...
Package capcall holds the plumbing every sys/...
jumplist
Package jumplist sets the app's shortcut menu: the menu of the Dock icon on macOS and the "Tasks" of the taskbar Jump List on Windows.
Package jumplist sets the app's shortcut menu: the menu of the Dock icon on macOS and the "Tasks" of the taskbar Jump List on Windows.
location
Package location reads the device's location once or continuously (Core Location on iOS, LocationManager on Android — no Google Play services needed).
Package location reads the device's location once or continuously (Core Location on iOS, LocationManager on Android — no Google Play services needed).
media
Package media lets the user pick photos and videos from the library or take a photo with the camera.
Package media lets the user pick photos and videos from the library or take a photo with the camera.
menu
Package menu builds native menus in Go and routes their clicks to Go callbacks.
Package menu builds native menus in Go and routes their clicks to Go callbacks.
network
Package network reports whether the machine is online, over what kind of link, whether the connection is metered, and when that changes.
Package network reports whether the machine is online, over what kind of link, whether the connection is metered, and when that changes.
notify
Package notify shows system notifications (Notification Center on macOS, the notification area on Windows, the freedesktop notification service on Linux) and reports clicks on them.
Package notify shows system notifications (Notification Center on macOS, the notification area on Windows, the freedesktop notification service on Linux) and reports clicks on them.
orientation
Package orientation reads and locks the interface orientation.
Package orientation reads and locks the interface orientation.
permission
Package permission queries and requests runtime permissions with one API on iOS and Android.
Package permission queries and requests runtime permissions with one API on iOS and Android.
power
Package power reports the machine's power state (AC or battery, charge, power-saving mode), tells the app when the system sleeps and wakes, and keeps the machine awake while the app plays video or runs a long task.
Package power reports the machine's power state (AC or battery, charge, power-saving mode), tells the app when the system sleeps and wakes, and keeps the machine awake while the app plays video or runs a long task.
print
Package print prints through the system print dialog: the page shown in a WebView surface, PDF documents and images.
Package print prints through the system print dialog: the page shown in a WebView surface, PDF documents and images.
pty
Package pty runs programs on local pseudo-terminals, the connection a terminal emulator such as ui/terminal needs to run a shell.
Package pty runs programs on local pseudo-terminals, the connection a terminal emulator such as ui/terminal needs to run a shell.
purchase
Package purchase sells in-app products through the platform store.
Package purchase sells in-app products through the platform store.
push
Package push registers the app for remote (push) notifications and reports notifications that arrive or that the user taps.
Package push registers the app for remote (push) notifications and reports notifications that arrive or that the user taps.
recent
Package recent keeps the app's list of recently opened documents.
Package recent keeps the app's list of recently opened documents.
safearea
Package safearea reports the parts of a page covered by system UI (status bar, notch / Dynamic Island, home indicator, navigation bar) and follows their changes, e.g.
Package safearea reports the parts of a page covered by system UI (status bar, notch / Dynamic Island, home indicator, navigation bar) and follows their changes, e.g.
screen
Package screen lists the displays attached to the computer.
Package screen lists the displays attached to the computer.
securestore
Package securestore keeps small secrets (tokens, keys, passwords) in the platform's protected storage: the Keychain on iOS and macOS (generic passwords of the app, this device only, available after first unlock); on Android values encrypted with an AES key held in the Android Keystore, stored in the app's private SharedPreferences; the Credential Manager on Windows (generic credentials of the user, not roaming); and the Secret Service on Linux (GNOME Keyring, KWallet) through libsecret.
Package securestore keeps small secrets (tokens, keys, passwords) in the platform's protected storage: the Keychain on iOS and macOS (generic passwords of the app, this device only, available after first unlock); on Android values encrypted with an AES key held in the Android Keystore, stored in the app's private SharedPreferences; the Credential Manager on Windows (generic credentials of the user, not roaming); and the Secret Service on Linux (GNOME Keyring, KWallet) through libsecret.
share
Package share opens the system share sheet with text, a URL and/or files: UIActivityViewController on iOS, an ACTION_SEND chooser on Android, NSSharingServicePicker on macOS.
Package share opens the system share sheet with text, a URL and/or files: UIActivityViewController on iOS, an ACTION_SEND chooser on Android, NSSharingServicePicker on macOS.
shell
Package shell hands URLs and files to the operating system: open a link in the default browser, a file with its default app, or show a file in Finder / Explorer / the file manager.
Package shell hands URLs and files to the operating system: open a link in the default browser, a file with its default app, or show a file in Finder / Explorer / the file manager.
single
Package single keeps one instance of an app running per user.
Package single keeps one instance of an app running per user.
theme
Package theme reads the system's light/dark appearance and accent color and follows their changes.
Package theme reads the system's light/dark appearance and accent color and follows their changes.
theme/uivars
Package uivars injects the design tokens of Tango's self-drawn UI (ui/theme) into every WebView page as CSS custom properties, and keeps them in step with the system's light/dark appearance, so the pages of an app and its self-drawn windows look the same.
Package uivars injects the design tokens of Tango's self-drawn UI (ui/theme) into every WebView page as CSS custom properties, and keeps them in step with the system's light/dark appearance, so the pages of an app and its self-drawn windows look the same.
tray
Package tray shows an icon in the system tray (macOS menu bar extras, Windows notification area, Linux AppIndicator / StatusNotifierItem).
Package tray shows an icon in the system tray (macOS menu bar extras, Windows notification area, Linux AppIndicator / StatusNotifierItem).
widget
Package widget updates the app's home-screen widget.
Package widget updates the app's home-screen widget.
windowstate
Package windowstate remembers where a window was: its position, size and whether it was maximized, saved as it changes and restored the next time the app starts.
Package windowstate remembers where a window was: its position, size and whether it was maximized, saved as it changes and restored the next time the app starts.
tools
editor-gui-bench/fixture command
Command fixture is the opt-in real-window Tango editor fixture used by the GUI acceptance probe.
Command fixture is the opt-in real-window Tango editor fixture used by the GUI acceptance probe.
ui
Package ui is the self-drawn GUI layer of Tango: an immediate-mode API over retained widget state, rendered by a pure-Go pipeline (no cgo) with the visual language of Ant Design v5 (default), Element Plus and shadcn/ui.
Package ui is the self-drawn GUI layer of Tango: an immediate-mode API over retained widget state, rendered by a pure-Go pipeline (no cgo) with the visual language of Ant Design v5 (default), Element Plus and shadcn/ui.
a11y
Package a11y defines the platform-neutral accessibility (semantics) tree produced by the Tango UI runner.
Package a11y defines the platform-neutral accessibility (semantics) tree produced by the Tango UI runner.
chart
Package chart is the chart library of the Tango self-drawn UI: line, area, column / bar, pie / donut, scatter / bubble, radar, gauge, funnel, heatmap, dual axes, liquid and tiny (sparkline) charts, drawn with the ui/paint display list and styled after Ant Design Charts (G2) for the Ant flavor and ECharts for Element Plus.
Package chart is the chart library of the Tango self-drawn UI: line, area, column / bar, pie / donut, scatter / bubble, radar, gauge, funnel, heatmap, dual axes, liquid and tiny (sparkline) charts, drawn with the ui/paint display list and styled after Ant Design Charts (G2) for the Ant flavor and ECharts for Element Plus.
codehl
Package codehl implements ui.CodeHighlighter with the code editor's language support: the Monarch grammars of ui/editor/langs and the incremental tokenizer of ui/editor/highlight.
Package codehl implements ui.CodeHighlighter with the code editor's language support: the Monarch grammars of ui/editor/langs and the incremental tokenizer of ui/editor/highlight.
editor
Package editor is the code editor.
Package editor is the code editor.
editor/buffer
Package buffer is the immutable text model behind the code editor.
Package buffer is the immutable text model behind the code editor.
editor/diff
Package diff computes line and character level differences between two versions of a text, the algorithm layer behind a diff editor.
Package diff computes line and character level differences between two versions of a text, the algorithm layer behind a diff editor.
editor/diffview
Package diffview is the diff editor of ui/editor: two editors side by side (or one inline view) showing the differences between an original and a modified text, computed by ui/editor/diff in the background.
Package diffview is the diff editor of ui/editor: two editors side by side (or one inline view) showing the differences between an original and a modified text, computed by ui/editor/diff in the background.
editor/highlight
Package highlight runs Monarch tokenization incrementally for the code editor view: the UI thread tokenizes what is about to be drawn within a time budget (Highlight), and a background goroutine (Start) catches up on the rest of the document from immutable buffer snapshots.
Package highlight runs Monarch tokenization incrementally for the code editor view: the UI thread tokenizes what is about to be drawn within a time budget (Highlight), and a background goroutine (Start) catches up on the rest of the document from immutable buffer snapshots.
editor/internal/frameclock
Package frameclock supplies one monotonic clock for editor frame deadlines.
Package frameclock supplies one monotonic clock for editor frame deadlines.
editor/keymap
Package keymap parses keybinding text and resolves key events to commands, with VS Code's rule semantics.
Package keymap parses keybinding text and resolves key events to commands, with VS Code's rule semantics.
editor/langs
Package langs embeds the built-in language data of the code editor: Monaco Monarch grammars, language configurations and file associations, plus the four Monaco base themes.
Package langs embeds the built-in language data of the code editor: Monaco Monarch grammars, language configurations and file associations, plus the four Monaco base themes.
editor/monarch
Package monarch interprets Monaco Monarch grammars (JSON, as exported by ui/editor/langs) and tokenizes text line by line.
Package monarch interprets Monaco Monarch grammars (JSON, as exported by ui/editor/langs) and tokenizes text line by line.
editor/regex
Package regex 编译 Monaco Monarch 语法中的 JavaScript 正则。
Package regex 编译 Monaco Monarch 语法中的 JavaScript 正则。
editor/theme
Package theme parses Monaco-format editor themes (IStandaloneThemeData: {base, inherit, rules, colors}) and resolves Monarch token types such as "keyword.go" or "string.escape.ts" to display styles.
Package theme parses Monaco-format editor themes (IStandaloneThemeData: {base, inherit, rules, colors}) and resolves Monarch token types such as "keyword.go" or "string.escape.ts" to display styles.
editor/when
Package when parses and evaluates VS Code "when" clause expressions, the conditions keybindings and commands use to decide whether they apply ("editorTextFocus && !editorReadonly").
Package when parses and evaluates VS Code "when" clause expressions, the conditions keybindings and commands use to decide whether they apply ("editorTextFocus && !editorReadonly").
geom
Package geom holds the small geometry vocabulary shared by every layer of the Tango self-drawn UI (layout, paint, text, input).
Package geom holds the small geometry vocabulary shared by every layer of the Tango self-drawn UI (layout, paint, text, input).
graph
Package graph holds the graph widgets of the Tango self-drawn UI: a node-link diagram canvas (Diagram), an entity-relationship preset built on it (ER) and a git commit graph (GitGraph).
Package graph holds the graph widgets of the Tango self-drawn UI: a node-link diagram canvas (Diagram), an entity-relationship preset built on it (ER) and a git commit graph (GitGraph).
icon
Package icon draws vector UI icons (no icon font).
Package icon draws vector UI icons (no icon font).
icon/antd
Package antd is the complete Ant Design icon set (@ant-design/icons-svg, MIT; see LICENSE) in its three themes: Outlined, Filled and TwoTone, named like @ant-design/icons (SearchOutlined, CheckCircleFilled, CheckCircleTwoTone):
Package antd is the complete Ant Design icon set (@ant-design/icons-svg, MIT; see LICENSE) in its three themes: Outlined, Filled and TwoTone, named like @ant-design/icons (SearchOutlined, CheckCircleFilled, CheckCircleTwoTone):
icon/element
Package element is the complete Element Plus icon set (@element-plus/icons-svg, MIT; see LICENSE), 293 filled icons on a 1024-unit grid:
Package element is the complete Element Plus icon set (@element-plus/icons-svg, MIT; see LICENSE), 293 filled icons on a 1024-unit grid:
icon/filetype
Package filetype picks icons for files and folders, the way an IDE's file tree does: a file name resolves to a Kind (code, image, archive, …) by its exact name or extension, and a Set maps kinds to icons.
Package filetype picks icons for files and folders, the way an IDE's file tree does: a file name resolves to a Kind (code, image, archive, …) by its exact name or extension, and a Set maps kinds to icons.
input
Package input defines the events a platform host feeds into the Tango self-drawn UI (pointer, multi-touch, wheel, keyboard, committed text and IME composition), the cursor shapes the UI asks the host to show, and the focus/Tab-order bookkeeping shared by focusable widgets.
Package input defines the events a platform host feeds into the Tango self-drawn UI (pointer, multi-touch, wheel, keyboard, committed text and IME composition), the cursor shapes the UI asks the host to show, and the focus/Tab-order bookkeeping shared by focusable widgets.
internal/flexbox
Package flexbox is the flexbox-style layout solver of the Tango self-drawn UI: Row/Column with Grow/Shrink/Basis, Gap, Padding, Margin, Align, Justify and Wrap, plus Stack (children overlap) and absolute positioning for overlays.
Package flexbox is the flexbox-style layout solver of the Tango self-drawn UI: Row/Column with Grow/Shrink/Basis, Gap, Padding, Margin, Align, Justify and Wrap, plus Stack (children overlap) and absolute positioning for overlays.
internal/flexbox/flexstyle
Package flexstyle holds the layout input of a node, shared by the public option constructors (package ui/layout) and the solver (package ui/internal/flexbox).
Package flexstyle holds the layout input of a node, shared by the public option constructors (package ui/layout) and the solver (package ui/internal/flexbox).
layout
Package layout holds the layout options of the Tango self-drawn UI: Row/Column/Stack containers take Options built here (Grow, W, H, Pad, Gap, Align, Justify, Abs ...), and Box.Style applies more.
Package layout holds the layout options of the Tango self-drawn UI: Row/Column/Stack containers take Options built here (Grow, W, H, Pad, Gap, Align, Justify, Abs ...), and Box.Style applies more.
mobile
Package mobile provides touch-first widgets for the Tango self-drawn UI in the visual language of Ant Design Mobile (default), Vant and a mobile derivation of shadcn/ui (Shadcn: chosen automatically under a theme.Shadcn ui theme; Drawer-style bottom sheets with a grab handle, grouped action sheet cards, Sonner toasts, segmented tabs): NavBar, TabBar, List/Cell, SwipeCell, PullToRefresh, InfiniteList, ActionSheet, Popup, Dialog, Toast, Picker (cascade, date/time), Stepper, SearchBar, Tabs, Swiper, Grid, NoticeBar, Skeleton, Empty, Result, Badge, Tag, Button, Form, IndexBar, FloatingBubble and SafeArea.
Package mobile provides touch-first widgets for the Tango self-drawn UI in the visual language of Ant Design Mobile (default), Vant and a mobile derivation of shadcn/ui (Shadcn: chosen automatically under a theme.Shadcn ui theme; Drawer-style bottom sheets with a grab handle, grouped action sheet cards, Sonner toasts, segmented tabs): NavBar, TabBar, List/Cell, SwipeCell, PullToRefresh, InfiniteList, ActionSheet, Popup, Dialog, Toast, Picker (cascade, date/time), Stepper, SearchBar, Tabs, Swiper, Grid, NoticeBar, Skeleton, Empty, Result, Badge, Tag, Button, Form, IndexBar, FloatingBubble and SafeArea.
paint
Package paint is the display-list layer of the Tango self-drawn UI.
Package paint is the display-list layer of the Tango self-drawn UI.
terminal
Package terminal is a terminal component: it connects a Conn, the program end of a terminal such as a pseudo-terminal, to the emulator in ui/terminal/vt.
Package terminal is a terminal component: it connects a Conn, the program end of a terminal such as a pseudo-terminal, to the emulator in ui/terminal/vt.
terminal/vt
Package vt is the terminal emulator core of ui/terminal: it turns the bytes a program writes into screen state, and the keys and text the user types into the bytes the program reads.
Package vt is the terminal emulator core of ui/terminal: it turns the bytes a program writes into screen state, and the keys and text the user types into the bytes the program reads.
terminal/vt/internal/widthgen command
Command widthgen generates ui/terminal/vt/width_table.go from the Unicode Character Database.
Command widthgen generates ui/terminal/vt/width_table.go from the Unicode Character Database.
text
Package text shapes and lays out text for the Tango self-drawn UI.
Package text shapes and lays out text for the Tango self-drawn UI.
theme
Package theme defines the design tokens of the Tango self-drawn UI.
Package theme defines the design tokens of the Tango self-drawn UI.
Package uihost shows Tango's self-drawn UI (package ui) in native windows: it adapts a tango.App to the ui.Window contract and drives a ui.Runner from the backend's canvas callbacks.
Package uihost shows Tango's self-drawn UI (package ui) in native windows: it adapts a tango.App to the ui.Window contract and drives a ui.Runner from the backend's canvas callbacks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL