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
- Variables
- func Await[T any](a *App, fn func() T) T
- func AwaitAsync[T any](a *App, start func(done func(T))) T
- func TryAwaitAsync[T any](a *App, start func(done func(T))) (T, error)
- type App
- func (a *App) AddBridgeScript(js string)
- func (a *App) Backend() platform.Backend
- func (a *App) DownloadDir() string
- func (a *App) DownloadPath(req DownloadRequest) string
- func (a *App) Go(fn func())
- func (a *App) HandleArgs(args []string, dir string)
- func (a *App) ID() string
- func (a *App) Name() string
- func (a *App) NewSurface(opts SurfaceOptions) (*Surface, error)
- func (a *App) OnBinary(fn func(s *Surface, generation uint64, packet []byte))
- func (a *App) OnDownloadEvent(fn func(s *Surface, ev DownloadEvent))
- func (a *App) OnEvent(fn func(AppEvent))
- func (a *App) OnEventKind(kind AppEventKind, fn func(AppEvent))
- func (a *App) OnLifecycle(fn func(Lifecycle))
- func (a *App) OnMessage(fn func(s *Surface, msg string))
- func (a *App) OnOpenFiles(fn func(paths []string))
- func (a *App) OnOpenURL(fn func(url string))
- func (a *App) OnQuitRequest(fn func() bool)
- func (a *App) OnReady(fn func())
- func (a *App) OnSurfaceCreated(fn func(*Surface))
- func (a *App) OnWebViewRestored(fn func(s *Surface, url string))
- func (a *App) ParseArgs(args []string, dir string) []AppEvent
- func (a *App) Post(fn func())
- func (a *App) Quit()
- func (a *App) Run() error
- func (a *App) SetAuthHandler(fn func(s *Surface, ch AuthChallenge) AuthResponse)
- func (a *App) SetDownloadDir(dir string)
- func (a *App) SetDownloadHandler(fn func(s *Surface, req DownloadRequest) string)
- func (a *App) SetNavigationPolicy(fn func(s *Surface, nav NavigationRequest) bool)
- func (a *App) SetNewWindowHandler(fn func(s *Surface, req NewWindowRequest) NewWindowAction)
- func (a *App) SetPermissionHandler(fn func(s *Surface, req PermissionRequest) PermissionDecision)
- func (a *App) SetPermissionPolicy(kind WebPermission, d PermissionDecision)
- func (a *App) Surfaces() []*Surface
- type AppEvent
- type AppEventKind
- type Appearance
- type AuthAction
- type AuthChallenge
- type AuthResponse
- type BrowsingData
- type DownloadEvent
- type DownloadRequest
- type DownloadState
- type DragOperation
- type FindOptions
- type FindResult
- type HeaderScope
- type Lifecycle
- type Material
- type NavigationRequest
- type NewWindowAction
- type NewWindowRequest
- type Options
- type PDFOptions
- type Panic
- type PermissionDecision
- type PermissionRequest
- type Rect
- type Surface
- func (s *Surface) App() *App
- func (s *Surface) Appearance() (ap Appearance)
- func (s *Surface) BinaryMinSize() int
- func (s *Surface) BinarySession() (uint64, ipc.BinaryConn)
- func (s *Surface) Bounds() (r Rect)
- func (s *Surface) CancelDownload(id uint64) error
- func (s *Surface) CaptureWebView(stamp WebViewStamp) ([]byte, error)
- func (s *Surface) Center() error
- func (s *Surface) ClearBrowsingData(kinds BrowsingData) error
- func (s *Surface) ClearCookies(domain string) error
- func (s *Surface) Close()
- func (s *Surface) CloseDevTools() error
- func (s *Surface) Cookies(rawURL string) ([]*http.Cookie, error)
- func (s *Surface) DeleteCookie(c *http.Cookie) error
- func (s *Surface) DevToolsOpen() (bool, error)
- func (s *Surface) DragFiles(paths []string, icon []byte, done func(DragOperation)) error
- func (s *Surface) DropBinarySession()
- func (s *Surface) Eval(js string)
- func (s *Surface) EvalWebView(stamp WebViewStamp, expression string) (json.RawMessage, error)
- func (s *Surface) Find(text string, opts FindOptions) (FindResult, error)
- func (s *Surface) FindNext() (FindResult, error)
- func (s *Surface) FindPrevious() (FindResult, error)
- func (s *Surface) Focus()
- func (s *Surface) Fullscreen() error
- func (s *Surface) GoBack() (bool, error)
- func (s *Surface) GoForward() (bool, error)
- func (s *Surface) Hide()
- func (s *Surface) ID() platform.SurfaceID
- func (s *Surface) IsFocused() (f bool)
- func (s *Surface) IsVisible() (v bool)
- func (s *Surface) LaneHello() json.RawMessage
- func (s *Surface) LastActivityAt() time.Time
- func (s *Surface) Maximize() error
- func (s *Surface) Minimize() error
- func (s *Surface) Native() (p uintptr)
- func (s *Surface) Navigate(u string)
- func (s *Surface) OnBlurred(fn func())
- func (s *Surface) OnClose(fn func() bool)
- func (s *Surface) OnClosed(fn func())
- func (s *Surface) OnDownloadEvent(fn func(ev DownloadEvent))
- func (s *Surface) OnFilesDropped(fn func(paths []string, x, y int))
- func (s *Surface) OnFocused(fn func())
- func (s *Surface) OnLoadFailed(fn func(url, err string))
- func (s *Surface) OnLoaded(fn func())
- func (s *Surface) OnMoved(fn func(x, y int))
- func (s *Surface) OnNavigating(fn func(url string))
- func (s *Surface) OnResized(fn func(w, h int))
- func (s *Surface) OnStateChanged(fn func(WindowState))
- func (s *Surface) OnWebFileChooser(fn func(WebFileChooserEvent)) error
- func (s *Surface) OnWebNavigation(fn func(WebNavigationEvent))
- func (s *Surface) OpenDevTools()
- func (s *Surface) Print() error
- func (s *Surface) PrintToPDF(opts PDFOptions) ([]byte, error)
- func (s *Surface) Reload() error
- func (s *Surface) Restore() error
- func (s *Surface) Screenshot() ([]byte, error)
- func (s *Surface) Send(msg string)
- func (s *Surface) SendBinary(packet []byte) bool
- func (s *Surface) SendBinaryOrdered(packet []byte) (sent, ordered bool)
- func (s *Surface) SendWebInput(stamp WebViewStamp, in WebInput) error
- func (s *Surface) SetAppearance(ap Appearance) error
- func (s *Surface) SetAuthHandler(fn func(ch AuthChallenge) AuthResponse)
- func (s *Surface) SetBounds(r Rect) error
- func (s *Surface) SetCookie(c *http.Cookie) error
- func (s *Surface) SetDownloadDestinationHandler(fn func(DownloadRequest, func(string))) error
- func (s *Surface) SetDownloadHandler(fn func(req DownloadRequest) string)
- func (s *Surface) SetExtraHeaders(h http.Header, scope HeaderScope) error
- func (s *Surface) SetNavigationPolicy(fn func(nav NavigationRequest) bool)
- func (s *Surface) SetNewWindowHandler(fn func(req NewWindowRequest) NewWindowAction)
- func (s *Surface) SetPermissionHandler(fn func(req PermissionRequest) PermissionDecision)
- func (s *Surface) SetSize(w, h int)
- func (s *Surface) SetSizeLimits(minW, minH, maxW, maxH int) error
- func (s *Surface) SetState(st WindowState) error
- func (s *Surface) SetTitle(title string)
- func (s *Surface) SetUserAgent(ua string) error
- func (s *Surface) SetWebDialogHandler(fn func(WebDialogRequest, func(WebDialogResponse))) error
- func (s *Surface) SetWebFileChooserHandler(fn func(WebFileChooserRequest, func([]string))) error
- func (s *Surface) SetWebPopupHandler(fn func(NewWindowRequest) func(child *Surface)) error
- func (s *Surface) SetZoom(factor float64) error
- func (s *Surface) Show()
- func (s *Surface) Size() (w, h int)
- func (s *Surface) State() (st WindowState)
- func (s *Surface) StopFind() error
- func (s *Surface) Title() (t string)
- func (s *Surface) UserAgent() (ua string)
- func (s *Surface) WebNavigation() WebNavigationEvent
- func (s *Surface) WebViewStamp() (WebViewStamp, error)
- func (s *Surface) Zoom() float64
- type SurfaceKind
- type SurfaceOptions
- type TitleBar
- type WebDialogKind
- type WebDialogRequest
- type WebDialogResponse
- type WebFileChooserEvent
- type WebFileChooserRequest
- type WebInput
- type WebInputKind
- type WebNavigationEvent
- type WebNavigationKind
- type WebPageState
- type WebPermission
- type WebViewOptions
- type WebViewStamp
- type WindowState
Constants ¶
const ( DragNone = platform.DragNone // canceled or refused DragCopy = platform.DragCopy DragMove = platform.DragMove DragLink = platform.DragLink )
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.
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.
const ( StateNormal = platform.StateNormal StateMinimized = platform.StateMinimized StateMaximized = platform.StateMaximized StateFullscreen = platform.StateFullscreen )
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 )
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 )
const ( MaterialNone = platform.MaterialNone MaterialBlur = platform.MaterialBlur // macOS vibrancy, Windows acrylic MaterialMica = platform.MaterialMica // Windows 11 Mica, macOS window-background vibrancy )
const ( Started = platform.LifecycleStarted Foreground = platform.LifecycleForeground Background = platform.LifecycleBackground Terminating = platform.LifecycleTerminating )
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 )
const ( PermissionDefault = platform.PermissionDefault PermissionPrompt = platform.PermissionPrompt // ask the user (the platform's prompt where it has one) PermissionAllow = platform.PermissionAllow PermissionDeny = platform.PermissionDeny )
const ( AuthDefault = platform.AuthDefault AuthCredentials = platform.AuthCredentials AuthCancel = platform.AuthCancel )
const ( DownloadProgress = platform.DownloadProgress DownloadDone = platform.DownloadDone DownloadFailed = platform.DownloadFailed DownloadCanceled = platform.DownloadCanceled )
const ( DataCookies = platform.DataCookies DataCache = platform.DataCache DataStorage = platform.DataStorage DataAll = platform.DataAll )
const ( WebDialogAlert = platform.WebDialogAlert WebDialogConfirm = platform.WebDialogConfirm WebDialogPrompt = platform.WebDialogPrompt WebDialogBeforeUnload = platform.WebDialogBeforeUnload )
const ( WebPageChanged = platform.WebPageChanged )
const ( WebClick = platform.WebClick WebType = platform.WebType WebScroll = platform.WebScroll )
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 ¶
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.
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.
var ErrNoFiles = errors.New("tango: DragFiles needs at least one file")
ErrNoFiles is returned by DragFiles without paths.
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.
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.
var ErrStaleWebView = errors.New("tango: embedded WebView changed")
ErrStaleWebView indicates that a navigation, URL, or applied placement changed since the caller acquired a stamp.
var ErrSurfaceClosed = errors.New("tango: surface is closed")
ErrSurfaceClosed is returned by WebView controls called after the surface closed.
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.
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 ¶
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 ¶
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 ¶
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 (*App) AddBridgeScript ¶
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 ¶
Backend returns the platform backend, for capability packages to type-assert optional interfaces on. Nil if none is built in.
func (*App) DownloadDir ¶
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 ¶
HandleArgs parses args like ParseArgs and delivers the events to OnEvent listeners on the main thread. Safe from any goroutine.
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 ¶
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 ¶
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 ¶
OnLifecycle registers fn for every lifecycle event, on the main thread.
func (*App) OnMessage ¶
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 ¶
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 ¶
OnOpenURL registers fn for EventOpenURL: deep links, from launch arguments, later launches (package single) or the OS (macOS).
func (*App) OnQuitRequest ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.
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 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 NavigationRequest ¶
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 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 ¶
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) Appearance ¶
func (s *Surface) Appearance() (ap Appearance)
Appearance returns the appearance last set (at creation or with SetAppearance).
func (*Surface) BinaryMinSize ¶
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) CancelDownload ¶
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) 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 ¶
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 ¶
CloseDevTools closes the native inspector if open. It returns ErrUnsupported if the engine does not expose a close operation.
func (*Surface) Cookies ¶
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 ¶
DeleteCookie deletes the cookie with c's Name, Domain and Path (Path defaults to "/").
func (*Surface) DevToolsOpen ¶
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 ¶
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) Fullscreen ¶
func (*Surface) GoBack ¶
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 ¶
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) IsFocused ¶
IsFocused reports whether the window has keyboard focus (is the key / foreground window). False once closed.
func (*Surface) IsVisible ¶
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 ¶
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) Native ¶
Native returns the native handle (NSWindow*, HWND, GtkWindow*, ...), or 0 once closed.
func (*Surface) Navigate ¶
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 ¶
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 ¶
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 ¶
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) OnNavigating ¶
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) 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) PrintToPDF ¶
func (s *Surface) PrintToPDF(opts PDFOptions) ([]byte, error)
PrintToPDF renders the page as a PDF document.
func (*Surface) Reload ¶
Reload reloads the page. Like Navigate, messages sent afterwards wait for the reloaded page.
func (*Surface) Screenshot ¶
Screenshot captures the visible part of the page as a PNG image.
func (*Surface) Send ¶
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 ¶
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 ¶
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) SetCookie ¶
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) SetSizeLimits ¶
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) SetUserAgent ¶
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. macOS dismisses unhandled script dialogs. 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) Title ¶
Title returns the title last set (SurfaceOptions.Title or SetTitle), "" once closed.
func (*Surface) UserAgent ¶
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.
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 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.
- ID (uint64) identifies the dialog on this surface.
- Kind (WebDialogKind) identifies the script dialog type.
- URL (string) is the requesting document's URL, when available.
- Message (string) is the text supplied by the page.
- DefaultText (string) is the initial value for a prompt.
type WebDialogResponse ¶
type WebDialogResponse = platform.WebDialogResponse
WebDialogResponse accepts or dismisses a dialog.
- Accepted (bool) signals OK for confirm or prompt, or allows navigation for beforeunload.
- Text (string) supplies the value of an accepted prompt.
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 ¶
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 {
}
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 ¶
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.
Source Files
¶
- activity.go
- assets.go
- bridge.go
- canvas_frame.go
- downpoll.go
- downshim.go
- dragout.go
- events.go
- hooks.go
- lanes.go
- lifecycle.go
- loop.go
- mobile_events.go
- panic.go
- panic_release.go
- surface.go
- surface_ext.go
- tango.go
- webembed.go
- webview.go
- webview_download.go
- webview_interaction.go
- webview_navigation.go
- webview_operation.go
- webview_policy.go
- webview_profile.go
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. |
|
skills
|
|
|
tango/examples/native-tray-timer
command
Native Tray Timer pairs a countdown and tray menu with a saved checklist.
|
Native Tray Timer pairs a countdown and tray menu with a saved checklist. |
|
tango/examples/webview-notes
command
WebView Notes saves an embedded editor's text through a native dialog.
|
WebView Notes saves an embedded editor's text through a native dialog. |
|
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. |
|
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 6.7 (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 6.7 (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. |