Documentation
¶
Overview ¶
Package driver is the protocol between core and the platform backends: the mount items a commit sends, the events backends report, the TextEngine they implement, and the values both sides share. It also holds what every backend runs the same way on its main thread: the animation graph's Animator, the selection model and text field edits.
Backends import driver, never core; core aliases the values apps use.
Index ¶
- Constants
- Variables
- func AllowsHost(patterns []string, host string) bool
- func AnswerPermission(id uint32, r PermissionRequest, status func(name string) int, ...)
- func AppKitKeyCode(code uint16) string
- func Apply(b *MountBatch, apply func(*MountBatch))
- func AudioLoopStart(offset, duration time.Duration) time.Duration
- func AudioPanGains(pan float32) (left, right float32)
- func AudioType(data []byte) string
- func AuthRedirectURI(r AuthRequest) string
- func AutomationTarget(name string) (bundleID string, ok bool)
- func BindGamepadSource(key any, src GamepadSource) func()
- func CheckURL(u string) error
- func ClampHotspotPixels(hotspot Point, pixW, pixH int, density float32) (int, int)
- func ClipUTF16(s string, max int) string
- func CloudStorageConnected() bool
- func ConnectCloudStorage(send func([]byte))
- func ConnectDownloads(send func(DownloadCommand) error)
- func ConnectGameServices(send func([]byte))
- func ConnectGamepadRumble(fn func(id int, lowFreq, highFreq float32, duration time.Duration))
- func ConnectLiveUpdates(send func([]byte))
- func ConnectRecordings(send func([]byte))
- func ConnectWidgetTest[E, A, C, O, D any](host *WidgetTest[E, A, C, O, D]) (func(), bool)
- func CopiedText(text string, spans []TextSpan, from, to int) string
- func CopyPixels(img *image.RGBA) *image.RGBA
- func DiscoveryTXT(records map[string]string) ([]byte, error)
- func DisplayTime(stamp, now time.Duration) time.Time
- func EdgeLine(s Side) (x0, y0, x1, y1 float32)
- func FileURLPath(u *url.URL, windows bool) (string, error)
- func FindKey(keymap []KeyBinding, names []string, focus KeyUse, repeat bool) (id uint32, consumed bool)
- func FolderFS(src FolderSource, root FolderEntry) fs.FS
- func GPUMipLevels(width, height uint32) uint32
- func GPUMipSize(width, height, mipLevel uint32) (uint32, uint32)
- func GameServicesConnected() bool
- func GeometryBounds(views map[NodeID]ViewGeometry) map[NodeID]Bounds
- func HasSpanCursor(spans []TextSpan) bool
- func HasTouchScrollHandle(env Environment) bool
- func HearCloudStorage(fn func([]byte))
- func HearDownloads(fn func(DownloadProgress)) func()
- func HearGameServices(fn func([]byte))
- func HearLiveUpdates(fn func([]byte))
- func HearRecordings(fn func([]byte))
- func HostCovers(pattern, other string) bool
- func ImageExtension(mime string) string
- func ImagePixelAt(fit Bounds, p Point, width, height int) (x, y int, ok bool)
- func InnerRadii(c Corners, widths Edges) [4][2]float64
- func IntersectHosts(a, b []string) []string
- func IntersectSchemes(a, b []string) []string
- func IsStandardAction(name string) bool
- func JSString(s string) string
- func KeepAllLanguage(language string) string
- func KeepAllWordRanges(text string) [][2]int
- func KeepAllWords(language string) bool
- func KeyOf(text string) string
- func LanguageTag(tag string) string
- func LimitEdit(text string, replaced int, insert string, maxLength int) (kept string, ok bool)
- func MIMEForFile(name string) string
- func MIMEForName(name string) string
- func MenuRoleUnsupported(role MenuRole, os OS, speak bool) bool
- func MenuShortcutKey(e MenuEntry, mac bool) string
- func NextClockRepeat(hour, minute, second int, weekday time.Weekday, r NotificationRepeat, ...) time.Time
- func NextNotificationRepeat(at time.Time, r NotificationRepeat, now time.Time) time.Time
- func NormalizeFramesInFlight(n int) int
- func NormalizeKey(key string) string
- func Painted(kind ViewKind, style *ViewStyle, events EventMask, drag WindowDrag) bool
- func ParseDiscoveryTXT(data []byte) map[string]string
- func ParseWAVHeader(h []byte) (rate, channels int, dataBytes uint32, ok bool)
- func PhonePermission(name string) int
- func PickedName(name, mime string) string
- func PlaceWindow(anchor Bounds, size Size, area Bounds, side WindowPlacement) (Point, WindowPlacement)
- func PressesAt(spans []TextSpan, i int) bool
- func RasterStep(scale float32) float64
- func Reach(frame Bounds, props *ViewProps, area Bounds, p Point) (self, children bool)
- func ReachView(size Size, props *ViewProps, area Bounds, transformed bool, p Point) (self, children bool)
- func ReadAssetFile(ctx context.Context, root, name string) ([]byte, error)
- func RecordingsConnected() bool
- func RecordingsDir() string
- func RefusedNavigation(url string) string
- func ReportCloudStorage(report []byte)
- func ReportDownload(progress DownloadProgress)
- func ReportGameServices(report []byte)
- func ReportGamepadAxis(id, index int, value float32)
- func ReportGamepadButton(id, index int, value float32)
- func ReportGamepadConnect(id int, name string)
- func ReportGamepadConnectInfo(id int, name string, vendorID, productID uint16, canRumble bool)
- func ReportGamepadDisconnect(id int)
- func ReportGamepadState(id int, buttons [GamepadButtonCount]float32, axes [GamepadAxisCount]float32)
- func ReportLiveUpdate(report []byte)
- func ReportRecording(report []byte)
- func RoleName(r Role) string
- func RubberBand(x, lo, hi, dimension float64) float64
- func SampleDecay(from float64, c DecayConfig) []float64
- func SampleEasing(e Easing, n int) []float64
- func SampleSpring(from, to float64, c SpringConfig) []float64
- func ScrollHandleEnabled(c *ScrollConfig) bool
- func SendCloudStorage(msg []byte)
- func SendDownload(command DownloadCommand) error
- func SendGameServices(msg []byte)
- func SendGamepadRumble(id int, lowFreq, highFreq float32, duration time.Duration)
- func SendLiveUpdate(msg []byte)
- func SendRecording(msg []byte)
- func SetAnimatedProp(c NativeComponent, b NativeBinding, num float64, col Color)
- func SetRecordingsDir(dir string)
- func ShownText(text string, spans []TextSpan, labels []string) string
- func SniffImage(b []byte) string
- func SpeakScale(v, from, mid, to float32) float32
- func SplitFilters(filters []Filter) (m ColorMatrix, ok bool, blur Points, shadows []BoxShadow)
- func TintImagePixels(dst, src []byte, tint Color, bgra, premultiplied bool)
- func TreeFS(files []TreeFile) fs.FS
- func USBKeyCode(usage uint16) string
- func USKeyName(code string) string
- func UTF16Len(s string) int
- func UTF16Offset(s string, units int) int
- func UTF16Units(s string, bytes int) int
- func UprightEmoji(t *AttributedText)
- func ValidateClipboardItems(items []ClipboardItem) error
- func ValidateCompressedTextureUpload(format GPUTextureFormat, width, height, originX, originY uint32, ...) error
- func VisibleText(text string, spans []TextSpan) string
- func WAVHeader(rate, channels int, dataBytes uint32) [WAVHeaderSize]byte
- func WatchPlatformGamepads(fn func()) func()
- func WebBridge(post string) string
- func WebEvaluateAnswer(answer string) (string, error)
- func WebEvaluateFailure(marker, message string) string
- func WebEvaluateMarker(script string) (string, bool)
- func WebEvaluateScript(script, marker string) string
- func WebMIME(path string, body []byte) string
- func WebMessageScript(data string) string
- func WebMobileScript(platform string, emulate bool) string
- func WebOrigin(rawURL string) string
- func WebUserAgent(base, suffix string) string
- func WinKeyCode(scan uint16) string
- func WriteTrace(w io.Writer, label string, b *MountBatch, took time.Duration)
- func XKBKeyCode(code uint16) string
- type AccessibilityAction
- type AccessibilityValue
- type Accessible
- type ActivityAlert
- type ActivityConfidence
- type ActivityKinds
- type ActivitySample
- type Affinity
- type AlertAction
- type AlertConfig
- type AlertRole
- type AndroidEventMapper
- type AndroidPropMapper
- type AndroidViewProp
- type AnimatedArg
- type AnimatedProp
- type AnimatedPropSetter
- type AnimatedValues
- type Animation
- type AnimationKind
- type AnimationOp
- type AnimationOpKind
- type Animator
- func (a *Animator) Apply(ops []AnimationOp)
- func (a *Animator) BindCanvas(view NodeID, slots []DrawSlot)
- func (a *Animator) BindNative(view NodeID, bindings []NativeBinding)
- func (a *Animator) BindShader(view NodeID, nodes []ShaderNode)
- func (a *Animator) CanvasBound(view NodeID) bool
- func (a *Animator) CanvasOps(view NodeID, d *Drawing) []DrawOp
- func (a *Animator) Changed(fn func(view NodeID, v AnimatedValues))
- func (a *Animator) ChangedCanvases(fn func(view NodeID))
- func (a *Animator) ChangedNatives(fn func(view NodeID, b NativeBinding, num float64, col Color))
- func (a *Animator) ChangedShaders(fn func(view NodeID))
- func (a *Animator) Ending() bool
- func (a *Animator) Forget(view NodeID)
- func (a *Animator) FrameRate() float64
- func (a *Animator) Generation() uint64
- func (a *Animator) Gesture(ev *Event) bool
- func (a *Animator) PanBound(view NodeID) bool
- func (a *Animator) Pull(view NodeID, distance Points) bool
- func (a *Animator) Pulls(view NodeID) bool
- func (a *Animator) Running() bool
- func (a *Animator) Scroll(view NodeID, offset Point) bool
- func (a *Animator) Settle(view NodeID)
- func (a *Animator) ShaderLanes(view NodeID, lanes []float64)
- func (a *Animator) Step(now time.Duration)
- func (a *Animator) StickyShift(c StickyCell, offset Points) Points
- func (a *Animator) Touch(view NodeID)
- func (a *Animator) Value(node uint32) (float64, Color, bool)
- func (a *Animator) Values(view NodeID) (AnimatedValues, bool)
- type Appearance
- type AppleCredential
- type AppleSignInRequest
- type AtlasSprite
- type AtlasSprites
- type AttributedText
- func (t *AttributedText) Cut(head bool, front, back int) AttributedText
- func (t *AttributedText) CutRest(start int, fits func(*AttributedText) bool) AttributedText
- func (t *AttributedText) CutToFit(fits func(*AttributedText) bool) AttributedText
- func (a *AttributedText) Equal(b *AttributedText) bool
- func (t *AttributedText) HasHidden() bool
- type AudioCommand
- type AudioEvent
- type AudioOutput
- type AudioOutputConfig
- type AudioOutputFactory
- type AudioPhase
- type AudioRequest
- type AudioSession
- type AuthCommand
- type AuthEvent
- type AuthPhase
- type AuthRequest
- type AutoCapitalize
- type AutoComplete
- type BackdropMaterial
- type BackgroundMotionOptions
- type BlendMode
- type BlurLevel
- type BorderStyle
- type Bounds
- func BandRect(s Side, size Size, band Points) Bounds
- func CanvasDamage(before, after []DrawOp) (Bounds, bool)
- func CaretRect(l TextLayout, c Caret) (Bounds, bool)
- func HairlineRect(s Side, band Size) Bounds
- func LerpBounds(a, b Bounds, p float64) Bounds
- func PointBounds(points [4]Point) (Bounds, bool)
- func RangeRects(l TextLayout, start, end int, out []Bounds) []Bounds
- type BoxShadow
- type CanvasEnabler
- type CanvasGradient
- type CanvasMesh
- type CanvasNode
- type CanvasSplit
- type CanvasVertex
- type Caret
- type CaretCluster
- type CaretLayout
- type CaretLine
- type Causes
- type Channel
- type ClipboardImage
- type ClipboardItem
- type ClipboardRead
- type ClipboardRepresentation
- type ClipboardResult
- type Clock
- type CodeKind
- type Color
- type ColorMatrix
- type ColorSpace
- type ColorStop
- type CompositeOp
- type Corners
- type Cursor
- type Curve
- type CustomCursor
- func (c *CustomCursor) EffectiveFallback(named Cursor) Cursor
- func (c *CustomCursor) Empty() bool
- func (c *CustomCursor) Equal(o *CustomCursor) bool
- func (c *CustomCursor) Key() string
- func (c *CustomCursor) LogicalSize() Size
- func (c *CustomCursor) SelectSource(scale float32) (src ImageSource, is2x bool)
- type DecayConfig
- type DirectoriesRequest
- type Directory
- type DiscoveryOp
- type DiscoveryReply
- type DiscoveryRequest
- type DiskSpace
- type DiskSpaceResult
- type DisplayClock
- type DisplayInfo
- type DownloadCommand
- type DownloadProgress
- type DrawArg
- type DrawKind
- type DrawOp
- type DrawSlot
- type Drawing
- func (d *Drawing) Arc(x, y, r, a0, a1 float32, ccw bool) *Drawing
- func (d *Drawing) ArcTo(x1, y1, x2, y2, r float32) *Drawing
- func (d *Drawing) BeginPath() *Drawing
- func (d *Drawing) Bind(arg DrawArg, node AnimatedArg) *Drawing
- func (d *Drawing) Clear(x, y, w, h float32) *Drawing
- func (d *Drawing) Clip() *Drawing
- func (d *Drawing) ClipEvenOdd() *Drawing
- func (d *Drawing) ClipPath(p *Path, rule FillRule) *Drawing
- func (d *Drawing) ClosePath() *Drawing
- func (d *Drawing) CubicTo(x1, y1, x2, y2, x, y float32) *Drawing
- func (d *Drawing) DrawAtlas(img ImageSource, rects []Bounds, xforms []RSXform, alphas []float32) *Drawing
- func (d *Drawing) DrawImage(img ImageSource, x, y float32) *Drawing
- func (d *Drawing) DrawImageFrom(img ImageSource, sx, sy, sw, sh, x, y, w, h float32) *Drawing
- func (d *Drawing) DrawImageIn(img ImageSource, x, y, w, h float32) *Drawing
- func (d *Drawing) DrawSVG(svg *SVG, x, y float32) *Drawing
- func (d *Drawing) DrawSVGIn(svg *SVG, x, y, w, h float32) *Drawing
- func (d *Drawing) DrawTintedImage(img ImageSource, tint Color, x, y float32) *Drawing
- func (d *Drawing) DrawTintedImageFrom(img ImageSource, tint Color, sx, sy, sw, sh, x, y, w, h float32) *Drawing
- func (d *Drawing) DrawTintedImageIn(img ImageSource, tint Color, x, y, w, h float32) *Drawing
- func (d *Drawing) DrawVertices(img ImageSource, vertices []CanvasVertex) *Drawing
- func (d *Drawing) Ellipse(x, y, rx, ry float32) *Drawing
- func (d *Drawing) EllipseArc(x, y, rx, ry, rotation, a0, a1 float32, ccw bool) *Drawing
- func (d *Drawing) Fill() *Drawing
- func (d *Drawing) FillBackgroundFromView(area Bounds) *Drawing
- func (d *Drawing) FillEvenOdd() *Drawing
- func (d *Drawing) FillFromView(initial Paint) *Drawing
- func (d *Drawing) FillPath(p *Path, rule FillRule) *Drawing
- func (d *Drawing) FillRect(x, y, w, h float32) *Drawing
- func (d *Drawing) FillText(text string, x, y float32, font Font) *Drawing
- func (d *Drawing) HasBackground() bool
- func (d *Drawing) IsPointInPath(x, y float32, rule FillRule) bool
- func (d *Drawing) IsPointInStroke(x, y float32) bool
- func (d *Drawing) LineDashFromView() *Drawing
- func (d *Drawing) LineTo(x, y float32) *Drawing
- func (d *Drawing) LineWidthFromView() *Drawing
- func (d *Drawing) MeasureText(text string, font Font) float32
- func (d *Drawing) MoveTo(x, y float32) *Drawing
- func (d *Drawing) Node(n CanvasNode) *Drawing
- func (d *Drawing) Painted(p *PaintStyle, current Color) *Drawing
- func (d *Drawing) PathContains(p *Path, x, y float32, rule FillRule) bool
- func (d *Drawing) QuadTo(cx, cy, x, y float32) *Drawing
- func (d *Drawing) Rect(x, y, w, h float32) *Drawing
- func (d *Drawing) ResetTransform() *Drawing
- func (d *Drawing) Restore() *Drawing
- func (d *Drawing) Rotate(radians float32) *Drawing
- func (d *Drawing) RoundRect(x, y, w, h, r float32) *Drawing
- func (d *Drawing) RoundRectCorners(x, y, w, h, topLeft, topRight, bottomRight, bottomLeft float32) *Drawing
- func (d *Drawing) Save() *Drawing
- func (d *Drawing) Scale(x, y float32) *Drawing
- func (d *Drawing) SetAlpha(alpha float32) *Drawing
- func (d *Drawing) SetComposite(c CompositeOp) *Drawing
- func (d *Drawing) SetFillColor(c Color) *Drawing
- func (d *Drawing) SetFillGradient(g *CanvasGradient) *Drawing
- func (d *Drawing) SetImageSmoothing(enabled bool) *Drawing
- func (d *Drawing) SetLineCap(c LineCap) *Drawing
- func (d *Drawing) SetLineDash(lengths ...float32) *Drawing
- func (d *Drawing) SetLineDashOffset(offset float32) *Drawing
- func (d *Drawing) SetLineJoin(j LineJoin) *Drawing
- func (d *Drawing) SetLineWidth(w float32) *Drawing
- func (d *Drawing) SetMiterLimit(limit float32) *Drawing
- func (d *Drawing) SetShadow(color Color, dx, dy, blur float32) *Drawing
- func (d *Drawing) SetStrokeColor(c Color) *Drawing
- func (d *Drawing) SetStrokeGradient(g *CanvasGradient) *Drawing
- func (d *Drawing) SetTextAlign(a TextAlign) *Drawing
- func (d *Drawing) SetTextBaseline(b TextBaseline) *Drawing
- func (d *Drawing) SetTransform(a, b, c, dd, e, f float32) *Drawing
- func (d *Drawing) Stroke() *Drawing
- func (d *Drawing) StrokeContains(p *Path, x, y float32) bool
- func (d *Drawing) StrokeFromView(initial Paint) *Drawing
- func (d *Drawing) StrokePath(p *Path) *Drawing
- func (d *Drawing) StrokeRect(x, y, w, h float32) *Drawing
- func (d *Drawing) StrokeText(text string, x, y float32, font Font) *Drawing
- func (d *Drawing) TextMetrics(text string, font Font) TextMetrics
- func (d *Drawing) Transform(a, b, c, dd, e, f float32) *Drawing
- func (d *Drawing) Translate(x, y float32) *Drawing
- type EaseMode
- type Easing
- type EasingKind
- type EdgeColors
- type EdgeEffect
- type Edges
- type EditAction
- type Effects
- type EllipsizeMode
- type Environment
- type Event
- func AuthEnd(id uint32, err, message string) Event
- func CaptureResult(count uint32, png []byte, err error) Event
- func DiskSpaceEvent(count uint32, space DiskSpace, err error) Event
- func NoAuthSession(it *MountItem) (ev Event, ok bool)
- func NoBiometric(it *MountItem) Event
- func NoNotification(it *MountItem) Event
- func NoPackageInstaller(id uint32) Event
- func NoSensor(it *MountItem) Event
- func NoWebCookies(it *MountItem) Event
- func SaveResult(r SaveRequest, id uint32, path string) Event
- type EventKind
- type EventMask
- type Extrapolate
- type Family
- type FamilyKind
- type File
- type FilesRequest
- type FillRule
- type Filter
- type FilterKind
- type FolderEntry
- type FolderSource
- type Font
- type FontExtent
- type FontRegistrar
- type FontVariant
- type FontWeight
- type FrameRateRange
- type FrontmostAppInfo
- type GPUAddressMode
- type GPUBindGroupDesc
- type GPUBindGroupEntry
- type GPUBindGroupLayoutDesc
- type GPUBindGroupLayoutEntry
- type GPUBindingType
- type GPUBlendComponent
- type GPUBlendFactor
- type GPUBlendOperation
- type GPUBlendState
- type GPUBufferDesc
- type GPUBufferUsage
- type GPUColorAttachment
- type GPUColorSpace
- type GPUColorTargetState
- type GPUColorWriteMask
- type GPUCommand
- type GPUCommandKind
- type GPUCompareFunc
- type GPUComputePipelineDesc
- type GPUCopyOp
- type GPUCopyOpKind
- type GPUCullMode
- type GPUDMABufPlane
- type GPUDataLayout
- type GPUDebugEvent
- type GPUDebugOp
- type GPUDebugOpKind
- type GPUDepthStencilAttachment
- type GPUDepthStencilState
- type GPUDeviceLostReason
- type GPUErrorCode
- type GPUEvent
- type GPUEventKind
- type GPUExternalTextureDesc
- type GPUExternalTextureKind
- type GPUFeatures
- type GPUFilterMode
- type GPUFrame
- type GPUFrontFace
- type GPUID
- type GPUIndexFormat
- type GPULimits
- type GPULoadOp
- type GPULoadStore
- type GPUPass
- type GPUPassTiming
- type GPUPipelineArtifacts
- type GPUPipelineBindingSlot
- type GPUPipelineDesc
- type GPUPipelineSamplerPair
- type GPUPipelineUniformBlock
- type GPUPrimitiveState
- type GPUPrimitiveTopology
- type GPUResourceOp
- type GPUResourceOpKind
- type GPUSamplerDesc
- type GPUShaderStage
- type GPUShaderStageFlags
- type GPUSoftReadback
- type GPUSoftwareDevice
- func (d *GPUSoftwareDevice) Close()
- func (d *GPUSoftwareDevice) DebugEvents() []GPUDebugEvent
- func (d *GPUSoftwareDevice) Frames() []GPUFrame
- func (d *GPUSoftwareDevice) FramesInFlight() int
- func (d *GPUSoftwareDevice) LastError() error
- func (d *GPUSoftwareDevice) LastPassTimings() []GPUPassTiming
- func (d *GPUSoftwareDevice) ReadBuffer(id GPUID) ([]byte, bool)
- func (d *GPUSoftwareDevice) Resize(width, height int)
- func (d *GPUSoftwareDevice) ResourceLabel(id GPUID) string
- func (d *GPUSoftwareDevice) SetFrameHooks(beforePass, afterFrame func(GPUFrame))
- func (d *GPUSoftwareDevice) SetPipelined(enabled bool)
- func (d *GPUSoftwareDevice) SetReadbackHandler(fn func([]GPUSoftReadback, error))
- func (d *GPUSoftwareDevice) Size() (int, int)
- func (d *GPUSoftwareDevice) Submit(frame GPUFrame) ([]GPUSoftReadback, error)
- func (d *GPUSoftwareDevice) SurfaceImage() *image.RGBA
- func (d *GPUSoftwareDevice) WaitIdle()
- type GPUStencilFaceState
- type GPUStencilOperation
- type GPUStoreOp
- type GPUTextureCopy
- type GPUTextureDesc
- type GPUTextureDimension
- type GPUTextureFormat
- func (f GPUTextureFormat) BlockSize() (width, height uint32)
- func (f GPUTextureFormat) ByteSize(width, height uint32) uint64
- func (f GPUTextureFormat) BytesPerBlock() uint32
- func (f GPUTextureFormat) BytesPerPixel() uint32
- func (f GPUTextureFormat) HasStencil() bool
- func (f GPUTextureFormat) IsCompressed() bool
- func (f GPUTextureFormat) IsDepth() bool
- func (f GPUTextureFormat) IsDepthStencil() bool
- func (f GPUTextureFormat) IsExtended() bool
- func (f GPUTextureFormat) IsFloat() bool
- func (f GPUTextureFormat) IsImportOnly() bool
- func (f GPUTextureFormat) IsSRGB() bool
- func (f GPUTextureFormat) String() string
- type GPUTextureRegion
- type GPUTextureUsage
- type GPUVertexAttribute
- type GPUVertexBufferLayout
- type GPUVertexFormat
- type GPUVertexStepMode
- type GPUViewConfig
- type GameAchievement
- type GamePlayer
- type GamePlayerScope
- type GameScoreEntry
- type GameServices
- type GameTimeScope
- type GamepadFamily
- type GamepadSource
- type GamepadState
- type GeofenceOptions
- type GeofenceRegion
- type GeofenceSample
- type GeofenceState
- type Geometry
- type GeometryObserver
- type GeometrySnapshot
- type GeometrySource
- type GesturePhase
- type GlassEffect
- type Gradient
- type GradientCorner
- type GradientExtent
- type GradientKind
- type GradientPaint
- type GradientSpread
- type GradientStop
- type Granularity
- type Haptic
- type HapticEvent
- type HapticPattern
- type HapticSegment
- type HeaderSystemItem
- type HingeState
- type HotKeyState
- type Idiom
- type ImageConfig
- type ImageSampling
- type ImageScales
- type ImageSource
- type InputConfig
- type Interpolation
- type ItemKind
- type KeepAwake
- type KeyBinding
- type KeyUse
- type KeyboardAppearance
- type KeyboardDismissMode
- type KeyboardTaps
- type KeyboardType
- type Keyframe
- type KeyframeAnimation
- type Keyframes
- type LayoutAnimation
- type LayoutCurve
- type LayoutMotion
- func (m *LayoutMotion) Done() bool
- func (m *LayoutMotion) From() Bounds
- func (m *LayoutMotion) Retarget(to Bounds, tr LayoutTransition, now time.Duration)
- func (m *LayoutMotion) Shown() Bounds
- func (m *LayoutMotion) Step(now time.Duration) (Bounds, bool)
- func (m *LayoutMotion) Target() Bounds
- func (m *LayoutMotion) Transition() LayoutTransition
- func (m *LayoutMotion) Velocity() [4]float64
- type LayoutProperty
- type LayoutTransition
- type LazyCarets
- type Length
- type Lifecycle
- type LineCap
- type LineDash
- type LineJoin
- type LiveRegion
- type LocalService
- type LocaleSettings
- type LocationFix
- type LocationOptions
- type LowPowerMode
- type MathOp
- type Matrix3D
- type MediaCommand
- type MediaCommandKind
- type MemoryClipboard
- type MemorySecrets
- type MenuBarMode
- type MenuEntry
- type MenuIcon
- type MenuRole
- type MiniProgramCredential
- type ModalAnimation
- type ModalConfig
- type ModalPresentation
- type Modifiers
- type Monitor
- type MotionOptions
- type MotionSample
- type MotionSensors
- type MountBatch
- type MountItem
- type MouseButton
- type NativeBinding
- type NativeComponent
- type NativeComponents
- type NativeConfig
- type NativeContext
- type NativeEnabler
- type NativeFactory
- type Network
- type NetworkWatcher
- type NodeID
- type Notification
- type NotificationRepeat
- type NotificationScheduler
- type NotificationTimer
- type NowPlaying
- type NowPlayingUpdate
- type OS
- type OSVersion
- type ObjectPosition
- type Obstruction
- type OfferPaymentMode
- type OffscreenCanvas
- type Operand
- type Orientation
- type Outline
- type PageAddress
- type PageAddressChange
- type PageHead
- type Paint
- type PaintStyle
- type PanActivation
- type PanelDock
- type PanelFrameMotion
- type PasteBehavior
- type PasteEvent
- type PastedFile
- type Path
- func (p *Path) AddPath(q *Path) *Path
- func (p *Path) Arc(x, y, r, a0, a1 float32, ccw bool) *Path
- func (p *Path) ArcTo(x1, y1, x2, y2, r float32) *Path
- func (p *Path) ClosePath() *Path
- func (p *Path) CubicTo(x1, y1, x2, y2, x, y float32) *Path
- func (p *Path) Ellipse(x, y, rx, ry float32) *Path
- func (p *Path) EllipseArc(x, y, rx, ry, rotation, a0, a1 float32, ccw bool) *Path
- func (p *Path) LineTo(x, y float32) *Path
- func (p *Path) MoveTo(x, y float32) *Path
- func (p *Path) QuadTo(cx, cy, x, y float32) *Path
- func (p *Path) Rect(x, y, w, h float32) *Path
- func (p *Path) RoundRect(x, y, w, h, r float32) *Path
- func (p *Path) RoundRectCorners(x, y, w, h, topLeft, topRight, bottomRight, bottomLeft float32) *Path
- type PeriodUnit
- type PermissionCommand
- type PermissionRequest
- type PickEncoding
- type PickFormat
- type PickRequest
- type PickedFile
- type PictureInPictureConfig
- type PictureInPictureEvent
- type PictureInPictureState
- type Pictures
- type PlatformUnwrapper
- type Point
- type Pointer
- type PointerDelta
- type PointerEvents
- type PointerLock
- type Points
- type PositionAxis
- type PositionCodes
- type PreciseLocationAnswer
- type PreparedText
- type PressureSample
- type Product
- type ProductType
- type PromotionalOffer
- type PurchaseAnswer
- type PurchaseCommand
- type PurchaseRequest
- type QuickLookRequest
- type RSXform
- type Ran
- type Region
- type ResizeMode
- type ReturnKeyType
- type Ripple
- type Role
- type SVG
- type SavePreflights
- type SaveRequest
- type ScanRequest
- type ScannedCode
- type ScreenAnimation
- type ScreenConfig
- type ScrollBehavior
- func (b *ScrollBehavior) Deceleration() float32
- func (b *ScrollBehavior) Equal(o *ScrollBehavior) bool
- func (b *ScrollBehavior) RefreshInset() Points
- func (b *ScrollBehavior) RefreshThreshold() Points
- func (b *ScrollBehavior) SnapPoints(viewport, content Points) []Points
- func (b *ScrollBehavior) SnapTarget(offset, projected Points, velocity float32, viewport, content Points) (Points, bool)
- func (b *ScrollBehavior) Snaps() bool
- type ScrollConfig
- type ScrollEdge
- type ScrollHandle
- type ScrollHandleDrag
- type SecretAccessible
- type SecretItem
- type SecretStore
- type Segment
- type SegmentKind
- type Selectable
- type SelectedRange
- type SelectionHandle
- type SelectionModel
- func (m *SelectionModel) Bounds() (start, end TextPosition, ok bool)
- func (m *SelectionModel) Clear() bool
- func (m *SelectionModel) Drag(texts SelectionTexts, p Point) bool
- func (m *SelectionModel) Extent(texts SelectionTexts) Bounds
- func (m *SelectionModel) IsEmpty() bool
- func (m *SelectionModel) MoveHandle(texts SelectionTexts, h SelectionHandle, p Point) bool
- func (m *SelectionModel) Press(texts SelectionTexts, p Point, clicks int, extend bool) bool
- func (m *SelectionModel) Ranges(texts SelectionTexts) []SelectionRange
- func (m *SelectionModel) SelectAll(texts SelectionTexts) bool
- func (m *SelectionModel) SelectWordAt(texts SelectionTexts, p Point) bool
- func (m *SelectionModel) Set(texts SelectionTexts, anchor, focus TextPosition) bool
- func (m *SelectionModel) Text(texts SelectionTexts) string
- func (m *SelectionModel) TextsChanged(texts SelectionTexts) bool
- type SelectionRange
- type SelectionSpans
- type SelectionTexts
- type SensorAuthorization
- type SensorCommand
- type SensorGrant
- type SensorKind
- type SensorNumber
- type SensorPacket
- type SensorQuaternion
- type SensorReport
- type SensorRequest
- type SensorVector
- type Shader
- type ShaderEnabler
- type ShaderNode
- type ShaderProgram
- type ShaderRole
- type ShareRequest
- type SharedDelivery
- type SharedFile
- type SharedItem
- type Side
- type Size
- type SnapAlignment
- type SpeakCommand
- type SpeakEvent
- type SpeakRequest
- type SpeechCommand
- type SpeechEvent
- type SpeechPhase
- type SpeechRequest
- type SpringConfig
- type StatusBarConfig
- type StatusBarStyle
- type StepPosition
- type StepSample
- type StickyCell
- type StorageBackend
- type StorageChange
- type StorageOp
- type StyleTransition
- type SubmitBehavior
- type Subscription
- type SubscriptionOffer
- type SubscriptionPeriod
- type SurfaceConfig
- type SurfaceKind
- type SystemGestureEdge
- type SystemGestureOptions
- type TabBadge
- type TabBadges
- type TaskProgress
- type TaskProgressState
- type TextAlign
- type TextAttachment
- type TextBackground
- type TextBaseline
- type TextContent
- type TextDecoration
- type TextDecorationStyle
- type TextEngine
- type TextHitTester
- type TextLayout
- type TextLine
- type TextMetrics
- type TextPosition
- type TextRange
- type TextShadow
- type TextSpan
- type TextStyle
- type ThermalState
- type TimingConfig
- type TitleBarStyle
- type Touch
- type TouchGeometry
- type TouchTracker
- type Transaction
- type Transform
- type Transition
- type TransitionProperty
- type TrayConfig
- type TreeFile
- type Update
- type UpdateDownloadProgress
- type UpdateManaged
- type UpdatePreference
- type UpdaterState
- type VerticalAlign
- type VerticalBarEdge
- type VideoConfig
- type VideoEnabler
- type VideoHeaders
- type ViewGeometry
- type ViewKind
- type ViewPaint
- type ViewPaintKind
- type ViewProps
- type ViewStyle
- func (vs *ViewStyle) BorderWidths() Edges
- func (vs *ViewStyle) ClipBox(size Size) (x, y, w, h float64, radii [4][2]float64)
- func (vs *ViewStyle) Matrix(size Size) Matrix3D
- func (vs *ViewStyle) Radii(size Size) Corners
- func (vs *ViewStyle) Rim() (rim Color, inset Points, ok bool)
- func (vs *ViewStyle) Rounded() bool
- type Voice
- type WebCommand
- type WebConfig
- type WebCookie
- type WebCookieFilter
- type WebCookiesOp
- type WebCookiesRequest
- type WebDownload
- type WebDownloadState
- type WebFailure
- type WebInput
- type WebInputKind
- type WebMedia
- type WebNavigation
- type WebSameSite
- type WebSchemeHandler
- type WebSchemeRequest
- type WebSchemeResponse
- type WebSource
- type WebViewEnabler
- type WebWindowRequest
- type WidgetTest
- type WindowAction
- type WindowCommand
- type WindowConstraints
- type WindowControls
- type WindowControlsStyle
- type WindowDrag
- type WindowFrame
- type WindowLevel
- type WindowMaterial
- type WindowPlacement
- type WindowPointerEvents
- type WindowWorkspaces
- type Write
- type ZoomRequest
Constants ¶
const ( // ActionActivate replaces the press a screen reader's double tap or // VO-Space makes. ActionActivate = "activate" // ActionIncrement and ActionDecrement adjust an adjustable element: // a swipe up or down on iOS, TalkBack's volume keys, VO-Up and Down. ActionIncrement = "increment" ActionDecrement = "decrement" // ActionLongPress replaces a long press (Android). ActionLongPress = "longpress" // ActionExpand and ActionCollapse change an expandable element // (Android). ActionExpand = "expand" ActionCollapse = "collapse" // ActionEscape is VoiceOver's two-finger scrub on iOS, AXCancel on // macOS and Escape on the web. ActionEscape = "escape" // ActionMagicTap is VoiceOver's two-finger double tap (iOS). ActionMagicTap = "magicTap" )
Standard accessibility actions.
const ( AnimatedTransformMask uint16 = 1<<PropTranslateX | 1<<PropTranslateY | 1<<PropScale | 1<<PropScaleX | 1<<PropScaleY | 1<<PropRotate | 1<<PropRotateX | 1<<PropRotateY AnimatedShadowColorMask uint16 = 1<<PropShadowColor | 1<<PropShadowOpacity AnimatedShadowMask uint16 = AnimatedShadowColorMask | 1<<PropShadowRadius )
Bitmasks of AnimatedValues.Set for composite style properties.
const ( MaxSoundBytes = 8 << 20 MaxSoundDuration = 5 * time.Second MaxSounds = 64 MaxDecodedBytes = 16 << 20 MaxSoundVoices = 32 )
The default limits a sound is held to, from NSH: its encoded bytes, which the platform's reader checks before decoding; its decoded length, which the platform decodes no more of; the sounds one engine holds and their decoded bytes, which the core counts; and the playbacks at once, past which the platform stops the oldest.
const ( MaxGaplessLoopBytes = 32 << 20 MaxGaplessLoopDuration = 5 * time.Minute )
The limits on the track a looping player decodes into memory to repeat it without a gap where the platform's streaming player cannot (Linux and the web): its encoded bytes and its decoded length. A larger or longer track streams through a decoder of its own on Linux and loops with a seek at its end on the web.
const ( AudioNotAllowed = "not-allowed" AudioNetwork = "network" AudioDecode = "decode" AudioNotSupported = "not-supported" AudioQuotaExceeded = "quota-exceeded" AudioFailed = "failed" )
The errors a sound or a player fails with, named as NSH's, which follow the web's MediaError.
const ( AuthCancelled = "cancelled" AuthTimeout = "timeout" AuthFailed = "failed" )
The errors a session ends with.
const ( VideoPauseInterruption = iota VideoPauseRouteLost VideoPauseControls )
Why EventVideoPause says a video paused, as core.VideoPauseReason.
const ( // VideoErrorOther is any failure without a reason of its own. VideoErrorOther = iota // VideoErrorAlphaUnsupported is a local file that declares an alpha channel the platform's player cannot keep. VideoErrorAlphaUnsupported )
Why a video's EventError says it failed, in Index, as core.MediaErrorReason.
const ( // ModalityKeyboard is a key pressed, not a modifier alone: Tab, an // arrow, a shortcut or typing, from a hardware keyboard or a remote. ModalityKeyboard uint32 = iota + 1 // ModalityPointer is a mouse button, a pen or a finger going down. ModalityPointer )
What EventInputModality reports.
const ( // SavePreflightTimeout bounds the time a platform holds a chosen // destination awaiting the app's answer. SavePreflightTimeout = 5 * time.Second SavePreflightTimedOut = "the app did not approve the save before the deadline" NoSavePreflight = "this platform cannot check a destination before saving" )
const ( NoFileOpener = "this platform opens no files in other apps" NoFileRevealer = "this platform has no file manager" NoTrash = "the volume has no trash" NoInstaller = "core: update installer is unavailable" )
Reasons a platform gives when a file service is unavailable.
const ( // GamepadButtonCount is the number of buttons in the W3C Standard Gamepad layout. GamepadButtonCount = 17 // GamepadAxisCount is the number of analog stick axes in the W3C Standard Gamepad layout. GamepadAxisCount = 4 )
const ( GPUCubeFacePosX uint32 = 0 GPUCubeFaceNegX uint32 = 1 GPUCubeFacePosY uint32 = 2 GPUCubeFaceNegY uint32 = 3 GPUCubeFacePosZ uint32 = 4 GPUCubeFaceNegZ uint32 = 5 )
Canonical cubemap face layer indices (ArrayLayer 0..5), matching WebGPU, Metal, Direct3D, and OpenGL.
const ( GPUDefaultFramesInFlight = 2 GPUMinFramesInFlight = 2 GPUMaxFramesInFlight = 3 )
Frame-in-flight bounds for per-frame ring-buffer pipelining.
const ( AppleSignInCancelled = "cancelled" AppleSignInFailed = "failed" )
Why EventSignInWithApple's Text says a sign-in or a credential state failed, as core.AppleSignInError.
const ( AppleCredentialAuthorized = iota + 1 AppleCredentialRevoked AppleCredentialNotFound AppleCredentialTransferred )
The states of a Sign in with Apple credential, as core.AppleCredentialState.
const ( OverlayDenied = iota OverlayGranted )
OverlayPermission is what EventOverlayPermission answers an ItemOverlayPermission with, as core's.
const ( OverlayEndDenied = iota + 1 OverlayEndRevoked OverlayEndRemoved OverlayEndFailed )
Why EventWindowEnded says the platform ended an overlay, as core's OverlayEnd.
const ( BiometricNone = iota BiometricFace BiometricFingerprint )
Biometric kinds, as reported by an availability request.
const ( BiometricSuccess = iota + 1 BiometricFailure BiometricCancelled )
Biometric results, as reported by an authentication request.
const ( NotificationsNotAsked = iota NotificationsGranted NotificationsDenied )
NotificationPermission is what EventNotification answers an ItemNotificationPermission with, as core's.
const ( PermissionAccessibility = "accessibility" PermissionScreenRecording = "screen-recording" PermissionInputMonitoring = "input-monitoring" PermissionFullDiskAccess = "full-disk-access" PermissionAppManagement = "app-management" PermissionDeveloperTools = "developer-tools" PermissionAutomation = "automation" PermissionMicrophone = "microphone" PermissionCamera = "camera" PermissionContacts = "contacts" PermissionCalendars = "calendars" PermissionReminders = "reminders" PermissionPhotos = "photos" PermissionBluetooth = "bluetooth" PermissionMediaLibrary = "media-library" PermissionLocalNetwork = "local-network" // The sensors' permissions, which core asks the sensor service for (ItemSensor) rather than sending ItemPermission, except to open their settings or guide. PermissionLocation = "location" PermissionBackgroundLocation = "background-location" PermissionMotion = "motion" PermissionActivityRecognition = "activity-recognition" // PermissionNotifications is the notification service's permission, which core asks through ItemNotificationPermission rather than ItemPermission, except to open its settings or guide. PermissionNotifications = "notifications" )
The permissions an ItemPermission names (PermissionRequest.Name), as core.Permission's values.
const ( PermissionNotAsked = iota PermissionGranted PermissionDenied PermissionUnknown PermissionNotGated PermissionLimited )
The statuses EventPermission answers with (Index), as core.PermissionStatus.
const ( PictureInPictureStart uint32 = iota + 1 PictureInPictureStop PictureInPictureRestored )
const ( PurchaseCancelled = "cancelled" PurchasePending = "pending" PurchaseFailed = "failed" PurchaseNotFound = "notFound" )
Why a PurchaseAnswer has nothing to give, as core.PurchaseError.
const ( RefundSuccess = "success" RefundCancelled = "cancelled" )
const ( DecelerationNormal float32 = 0.998 DecelerationFast float32 = 0.99 )
Deceleration rates, as UIKit's.
const ( SoftEdgeBlur Points = 10 SoftEdgeTail Points = 24 HardEdgeBlur Points = 6.4 EdgeTint float32 = 0.8 HairlineWidth Points = 0.5 )
What a platform drawing an edge effect itself draws, alike everywhere: both edges lay the tint at EdgeTint under the bars; a soft edge blurs by SoftEdgeBlur at the side, down to nothing SoftEdgeTail past the bars, where its tint has eased out (SoftTint); a hard edge blurs by HardEdgeBlur under the bars and draws a hairline HairlineWidth wide past them. Blurs are a Gaussian's standard deviation, as CSS's blur() takes.
const ( UnblurredSoftTint float32 = 0.85 UnblurredHardTint float32 = 0.95 )
A platform that cannot blur what is behind a view, Linux, fades the content into the tint alone, more opaque: at UnblurredSoftTint under a soft edge's bars, and at UnblurredHardTint under a hard edge's.
const ( SpeakNotAllowed = "not-allowed" SpeakTextTooLong = "text-too-long" SpeakAudioBusy = "audio-busy" SpeakFailed = "synthesis-failed" )
The errors an utterance fails with, named as the Web Speech API's SpeechSynthesisErrorEvent's.
const ( SpeechNotAllowed = "not-allowed" SpeechNoSpeech = "no-speech" SpeechAudioCapture = "audio-capture" SpeechNetwork = "network" SpeechLanguageUnsupported = "language-not-supported" SpeechFailed = "failed" )
The errors a session ends with, named as the Web Speech API's.
const ( // WAVHeaderSize is the size in bytes of a standard 16-bit PCM RIFF/WAVE header. WAVHeaderSize = 44 // MaxWAVDataBytes is the most PCM payload a 32-bit RIFF/WAVE file can hold // (0xffffffff minus the 36 header bytes counted in the RIFF chunk size). MaxWAVDataBytes = uint32(0xffffffff - 36) )
const ( WebMobileUserAgentIPhone = "" /* 135-byte string literal not displayed */ WebMobileUserAgentAndroid = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s.0.0.0 Mobile Safari/537.36" )
The phones' user agents a Mobile web view presents without one of its own: Safari's on an iPhone, which WKWebView on macOS presents, and Chrome's on Android, with a Chrome major version in place of %s, which WebView2 presents with its own and WebKitGTK with WebMobileChromeVersion.
const AttachmentRune = '\uFFFC'
AttachmentRune stands in a text for an attachment, as the object replacement character does in attributed strings.
const CustomCursorHiDPIScale float32 = 1.5
CustomCursorHiDPIScale is the minimum display pixel ratio at which a CustomCursor selects its Image2x representation.
const DefaultImageCacheLimit int64 = 32 << 20
DefaultImageCacheLimit is the default maximum number of encoded image bytes kept in memory by the image cache (32 MiB).
const DefaultPickQuality = 0.9
DefaultPickQuality is the JPEG quality images are encoded at when the request gives none.
const FontMonospace = "monospace"
FontMonospace is the family name of the platform's fixed-pitch font, for code.
const FrameInterval = 16667 * time.Microsecond
FrameInterval is a frame at 60 Hz, in whole microseconds as NSH's: what an app assumes where the display's own pace is unknown. Sixty of them reach a second, so a second of frames counts 60.
const GPUDRMFormatModInvalid uint64 = 0x00ffffffffffffff
GPUDRMFormatModInvalid is DRM_FORMAT_MOD_INVALID: the DMA-BUF's layout is implied by its driver rather than named.
const MaxClipboardImage = 48 << 20
MaxClipboardImage is the most bytes of a PNG a clipboard read returns: a larger image is left out, since the app's memory may not hold it.
const MaxPicked = 100
MaxPicked is the most files one pick answers with.
const MaxURLLength = 16 << 10
MaxURLLength is the longest URL OpenURL opens, in bytes: a mailto: link with a body fits.
const NoCamera = "this device has no camera to take a photo with"
NoCamera is the EventPick Text of an ItemTakePhoto whose camera became unavailable before it could show, which core answers with ErrNoCamera.
const NoCapture = "this platform has no surface capture"
NoCapture is how a platform without runtime surface capture reports it.
const NoDirectoryPicker = "this platform has no folder picker"
NoDirectoryPicker is what a platform without a folder picker answers ItemPickDirectories with.
const NoScanCamera = "this device has no camera to scan a code with"
NoScanCamera says that the camera became unavailable before scanning.
const NoWebCookieDomains = "nsgo: this platform lists web view cookies only by URL"
NoWebCookieDomains is EventWebCookies' Text where the store lists cookies only by URL, as Android's CookieManager does.
const NoWebCookieStore = "nsgo: this platform has no web view cookie store"
NoWebCookieStore is EventWebCookies' Text where the platform has no store, as on the web and where Env.HasWebView is false.
const PictureInPictureEventName = "nsgo:picture-in-picture"
const SampleRate = 60
SampleRate is how many samples a second the samplers take: the frames of a 60 Hz display.
const ShaderBuiltinLanes = 3
ShaderBuiltinLanes is how many lanes a WGSL program's built-ins take before its uniforms: the time, the progress and the overflow.
ShareStageAge is how long a file Stage made stays before a later stage in the same directory removes it: long enough for the app the user chose to read it.
const Smoothing = 0.6
Smoothing is how far continuous corners ease into their edges: Figma's corner smoothing at 60%, which matches iOS's.
const SwitchComponent = "nsgo/switch"
SwitchComponent is the native component macOS and iOS register for core.SystemSwitch: NSSwitch or UISwitch. Its props are "checked", "disabled" and "size" ("small" or "large", which only macOS has); it emits "change" with the value the user chose.
const TabBarComponent = "nsgo/tab-bar"
TabBarComponent is the native component iOS and Android register for core.TabBar: the system's tab bar. Its props are "items", a list of {"title", "icon", "drawing"} maps, where "drawing" is an optional *Drawing of the tab's SVG that iOS and Android show when "icon" names no SF Symbol or drawable, "selectedIndex", "edge" ("bottom", "leading" or "trailing"), and "tint", the selected tab's Color as a number (0: the system's); it emits "change" with the index the user chose.
const WebMobileChromeVersion = "157"
WebMobileChromeVersion is the Chrome major version Android Chrome's user agent names where the engine has none of its own: WebKitGTK's, and WebView2's when its own user agent names none. Sites may treat a browser many versions old as unsupported, so update it with the iPhone's user agent now and then: Chrome 157 was current in November 2026, and a new major version ships every four weeks.
Variables ¶
var ( // PaintNone paints nothing. PaintNone = Paint{/* contains filtered or unexported fields */} // PaintCurrentColor paints with the text color, CSS's currentColor. PaintCurrentColor = Paint{/* contains filtered or unexported fields */} )
var ( ErrDiskSpaceNotDeclared = errors.New("nsgo: disk space requires NSPrivacyAccessedAPICategoryDiskSpace in apple.privacy.accessed_apis") )
var ( // ErrGameServicesUnsupported is returned on platforms without a native game service backend (Windows, Linux, Web, watchOS, mini programs). ErrGameServicesUnsupported = errors.New("gameservices: not supported on this platform") ErrGameServicesUnavailable = errors.New("gameservices: platform game service is unavailable") // ErrGameServicesUnauthenticated is returned when an operation requires a signed-in player and none is authenticated. ErrGameServicesUnauthenticated = errors.New("gameservices: player is not authenticated") // ErrGameServicesCancelled is returned when the user cancels a platform game service sign-in flow. ErrGameServicesCancelled = errors.New("gameservices: sign-in was cancelled") )
Sentinel errors returned by package gameservices and its platform backends.
var ( MinContent = Length{/* contains filtered or unexported fields */} MaxContent = Length{/* contains filtered or unexported fields */} FitContent = Length{/* contains filtered or unexported fields */} )
The intrinsic sizes, for widths and heights: the narrowest a box gets without overflowing (its longest word), the widest its content asks for (no wrapping), and the widest it asks for up to the space it has.
var ( Linear = Curve{} Ease = Curve{0.25, 0.1, 0.25, 1} EaseIn = Curve{0.42, 0, 1, 1} EaseOut = Curve{0, 0, 0.58, 1} EaseInOut = Curve{0.42, 0, 0.58, 1} )
The standard curves, as CSS names them.
var Applied func(b *MountBatch, took time.Duration)
Applied, which nsgo dev -devtools sets, hears how long a platform took to apply each batch on its main thread; nil measures nothing.
var AssetPacks struct { Ready func(context.Context, string) (bool, error) Open func(string, string) (io.ReadCloser, error) }
AssetPacks is the platform's file and availability access for store packs. A backend initializes it only on a supported platform.
var Auto = Points(float32(math.NaN()))
Auto marks a length the layout computes, such as a text engine's unbounded width. Styles use Length instead.
var AutoMinimum = Length{/* contains filtered or unexported fields */}
AutoMinimum is CSS's automatic minimum, for a minimum size: a flex item keeps its content's size, where an unset minimum is 0, as in Yoga.
var BlobFile func(url, name string) File
BlobFile, set by the web backend, is the file the page's blob: URL url (without its fragment) stands for, named name: the Blob a drop made it for, with its size, type and time, or else one read by fetching url.
var DefaultViewStyle = ViewStyle{Opacity: 1}
DefaultViewStyle is the style of a view no style changes: opaque and nothing else. Backends create views in it, and the core sends a new view's style only when it differs, as it sends no empty ViewProps and no empty EventMask.
var ErrAudioOutputUnsupported = errors.New("nsgo: audio: PCM output is unavailable")
ErrAudioOutputUnsupported reports a platform without pull PCM output.
var ErrClipboardQuota = errors.New("clipboard representations exceed 48 MiB")
ErrDownloadUnavailable is the reply on a platform without a download host.
var ErrNoSecretStore = errors.New("the system has no secure store")
ErrNoSecretStore is what a SecretStore answers where the system has no secure store to keep secrets in, such as a Linux session without a Secret Service; core reports it as core.ErrSecretsUnavailable.
var Identity3D = Matrix3D{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}
Identity3D changes nothing.
var IdentityColorMatrix = ColorMatrix{1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0}
IdentityColorMatrix changes nothing.
var ImageScaleValues = [...]float32{1, 1.5, 2, 3, 4}
ImageScaleValues are the pixel densities an image asset can ship in, as its file name's suffix says ("@1.5x" to "@4x"; the file without one is 1x).
var KeyboardCurve = Curve{0.38, 0.7, 0.125, 1}
KeyboardCurve is UIKit's keyboard curve, as near as a cubic Bézier comes; Android's runtime uses the IME's interpolator instead.
var PageSchemes = []string{"about", "blob", "data"}
PageSchemes are the schemes of the pages a page makes itself, which Schemes holds: about:, blob: and data:.
var ResolvePageAddress func(raw, page, base string) (string, error)
ResolvePageAddress is the browser's URL parser/serializer when linked. Native and headless graphs use core's URL implementation instead.
var TraceCauses bool
TraceCauses has commits record what they followed from in MountBatch.Causes: nsgo dev -trace and nsgo test -trace set it. While it is unset, a signal's write and a computation's run cost one check of it.
var UpdateDownload func(context.Context, Update, string, func(UpdateDownloadProgress)) (string, error)
UpdateDownload stages a verified update through the platform's HTTP client. The download runs independently of the app's surfaces.
Functions ¶
func AllowsHost ¶
AllowsHost reports whether one of patterns allows host: "*" any, "*.example.com" its subdomains, else the host itself. Hosts compare in lower case.
func AnswerPermission ¶
func AnswerPermission(id uint32, r PermissionRequest, status func(name string) int, dispatch func(Event))
AnswerPermission answers ItemPermission id where nothing asks, opens settings or guides: a check, a request and a guide hear status of the permission at once, opening the settings that none opened, and a stop nothing.
func AppKitKeyCode ¶
AppKitKeyCode returns the physical code for an NSEvent key code.
func Apply ¶
func Apply(b *MountBatch, apply func(*MountBatch))
Apply applies b with apply, timing it for Applied while one is set: what each backend calls where it applies a batch.
func AudioLoopStart ¶
AudioLoopStart keeps a loop's start inside a finite track. An offset at or beyond the end falls back to the start of the track.
func AudioPanGains ¶
AudioPanGains splits pan, from -1 (full left) to 1 (full right) with 0 centered, into left and right channel gains from 0 to 1 using a cosine balance curve: (1, 1) at 0, (1, 0) at -1 and (0, 1) at 1, for backends whose stereo voices take per-channel gains.
func AudioType ¶
AudioType is the media type the first bytes of a sound or a player's Data say they are, for decoders that go by a file's name or type, as NSH names bytes the app gives: audio/wav, audio/aiff, audio/x-caf, audio/flac, audio/ogg, audio/mp4, audio/mpeg or audio/aac, and application/octet-stream for none of these.
func AuthRedirectURI ¶ added in v0.2.0
func AuthRedirectURI(r AuthRequest) string
AuthRedirectURI is the redirect of a session that the system catches by its scheme, r being its AuthStart: scheme:/path for an app's own scheme, https://host/path for an HTTPS one.
func AutomationTarget ¶
AutomationTarget splits a macOS Automation permission key targeting a specific app ("automation:<bundleID>").
func BindGamepadSource ¶
func BindGamepadSource(key any, src GamepadSource) func()
BindGamepadSource binds src to key (the root scope of a headless test app) and returns a function that removes the binding.
func CheckURL ¶
CheckURL reports why OpenURL would refuse u: it must be absolute, at most MaxURLLength bytes, without spaces or control characters, a web address with a host, and of a scheme that opens another app, not javascript:, data:, blob:, file:, about: or asset:.
func ClampHotspotPixels ¶
ClampHotspotPixels converts a logical-point hotspot to pixel coordinates for a bitmap of pixW × pixH pixels at the given image density (1 for 1x, 2 for 2x), clamped strictly to [0, pixW-1] × [0, pixH-1].
func ClipUTF16 ¶
ClipUTF16 cuts s to at most max UTF-16 units, never inside a character; max 0 or less keeps all of it.
func CloudStorageConnected ¶
func CloudStorageConnected() bool
CloudStorageConnected reports whether a cloud storage runtime bridge is connected.
func ConnectCloudStorage ¶
func ConnectCloudStorage(send func([]byte))
ConnectCloudStorage registers the Android backend's sender for package cloud messages, draining any queued messages first. A nil send disconnects it.
func ConnectDownloads ¶
func ConnectDownloads(send func(DownloadCommand) error)
ConnectDownloads installs the process's platform download host.
func ConnectGameServices ¶
func ConnectGameServices(send func([]byte))
ConnectGameServices connects the Android backend's sender for package gameservices messages, flushing any queued messages first. Passing nil disconnects the sender.
func ConnectGamepadRumble ¶
ConnectGamepadRumble registers the host platform's rumble handler (Android's pipe writer).
func ConnectLiveUpdates ¶
func ConnectLiveUpdates(send func([]byte))
ConnectLiveUpdates is the Android backend's: send carries package widget's messages to the runtime, those that waited first.
func ConnectRecordings ¶
func ConnectRecordings(send func([]byte))
ConnectRecordings is the recorder's, the Android backend's or nsgotest's fake microphone's: send carries package microphone's messages, those that waited first. A nil send disconnects the recorder, and messages wait for the next.
func ConnectWidgetTest ¶
func ConnectWidgetTest[E, A, C, O, D any](host *WidgetTest[E, A, C, O, D]) (func(), bool)
ConnectWidgetTest installs host until the returned function disconnects it. The second result is false while a test already owns the widget services.
func CopiedText ¶
CopiedText is what a copy of text's bytes from to to takes: its hidden spans left out, and each attachment the copy takes whole replaced by its span's Copy, or left out without one.
func CopyPixels ¶ added in v0.2.0
CopyPixels returns a copy of img's pixels in a buffer of its own, at the origin with rows of 4 bytes a pixel, as the core hands them to a platform; nil for nil.
func DiscoveryTXT ¶
DiscoveryTXT encodes DNS-SD's length-prefixed TXT strings in key order.
func DisplayTime ¶
DisplayTime returns the time a display frame stamped stamp has on time.Now's base, given now, the platform clock's reading that stamp counts on (CACurrentMediaTime, System.nanoTime, performance.now, g_get_monotonic_time). now is read just before this call, but on any goroutine and however long after the frame callback, as Android reads it on its serve goroutine after the pipe: a delay before the reading shrinks stamp-now by as much as it moves time.Now on and cancels out, so the result keeps the display's cadence and Go's monotonic reading whatever delays the frame on its way to the engine (engine.Engine.FrameAt).
func EdgeLine ¶
EdgeLine returns the line of a gradient across a band from side s, from the side to the band's other end, in fractions of the band.
func FileURLPath ¶ added in v0.2.0
FileURLPath is the local path a parsed file: URL names, for core.FileFromURL and the image loader alike. On Windows /C:/ names a drive, with no host or localhost, and any other host a UNC share (the share \\localhost\C$ is written file://localhost/C$); elsewhere only localhost may be its host. The path is the URL's decoded path, with backslashes on Windows.
func FindKey ¶
func FindKey(keymap []KeyBinding, names []string, focus KeyUse, repeat bool) (id uint32, consumed bool)
FindKey says what a key press does with keymap: names are the press's normalized names (with "mod" and with the literal modifier), focus the keys the view with the keyboard focus uses itself (FocusKeyUse, KeyUseText alone for a backend that knows only whether a text input or web view has it), and repeat whether it is a held key's auto-repeat. A binding takes no press from a focused text input or web view unless InText, nor from a focused control whose keys it Yields. It returns the ID of the binding that fires, or 0, and whether the press is consumed: a binding fires, or a held key's repeat is taken by a binding that fires once.
func FolderFS ¶
func FolderFS(src FolderSource, root FolderEntry) fs.FS
FolderFS reads the folder root through src. It remembers each listing to find what a name opens, and lists a folder afresh whenever it is read.
func GPUMipLevels ¶
GPUMipLevels returns the number of mipmap levels in a full chain from width x height down to 1x1.
func GPUMipSize ¶
GPUMipSize returns the dimensions of mipLevel for a base texture of width x height (clamped to a minimum of 1x1).
func GameServicesConnected ¶
func GameServicesConnected() bool
GameServicesConnected reports whether a game services runtime bridge is connected.
func GeometryBounds ¶
func GeometryBounds(views map[NodeID]ViewGeometry) map[NodeID]Bounds
GeometryBounds projects every view's border box through its native ancestors, flattening each viewport as IntoView does in reverse. It includes transforms, perspective, native frame motion, sticky shifts and scrolling supplied in views. Invalid or undisplayed planes have no finite box.
func HasSpanCursor ¶
HasSpanCursor reports whether any span names a cursor, so a backend knows the cursor under a still pointer may change with the text.
func HasTouchScrollHandle ¶
func HasTouchScrollHandle(env Environment) bool
HasTouchScrollHandle reports whether env is an iOS or Android touch device (phone or tablet, excluding tvOS, watchOS, and web simulations) that shows native touch-draggable scroll handles.
func HearCloudStorage ¶
func HearCloudStorage(fn func([]byte))
HearCloudStorage registers package cloud's handler for runtime reports, delivering any queued reports first.
func HearDownloads ¶
func HearDownloads(fn func(DownloadProgress)) func()
HearDownloads registers a listener of the host's reports. The callback runs on the host's receiver and must return promptly.
func HearGameServices ¶
func HearGameServices(fn func([]byte))
HearGameServices registers package gameservices' report handler, delivering any reports that arrived before registration first.
func HearLiveUpdates ¶
func HearLiveUpdates(fn func([]byte))
HearLiveUpdates is package widget's: fn hears the runtime's reports, those that waited first.
func HearRecordings ¶
func HearRecordings(fn func([]byte))
HearRecordings is package microphone's: fn hears the recorder's reports, those that waited first. It runs on the goroutine that reports, which it must not hold up.
func HostCovers ¶
HostCovers reports whether pattern covers other, a host or a pattern.
func ImageExtension ¶
ImageExtension returns the extension of an image of type mime, or "".
func ImagePixelAt ¶
ImagePixelAt maps p to the bitmap pixel in the fitted image, whose first row is at the top. Points outside the fitted image miss.
func InnerRadii ¶
InnerRadii returns the radii of the padding box inside borders of widths (top, right, bottom, left) around a box with fitted corners: each corner less the widths of the sides it joins, elliptical where they differ, as CSS shrinks them.
func IntersectHosts ¶
IntersectHosts returns the patterns allowing what both a and b allow.
func IntersectSchemes ¶ added in v0.2.0
IntersectSchemes returns the PageSchemes both lists name, in any case, in PageSchemes' order; an empty list names none.
func IsStandardAction ¶
IsStandardAction reports whether name is one of the standard actions, which platforms map to their own gestures rather than list as custom actions.
func KeepAllLanguage ¶
KeepAllLanguage returns language with the BCP 47 Unicode line-break word extension lw-keepall added when KeepAllWords(language) is true and no explicit lw keyword is already set, preserving any other extensions and private-use subtags.
func KeepAllWordRanges ¶
KeepAllWordRanges returns the byte ranges [start, end] of words in text that should not break internally under CSS's word-break: keep-all: contiguous letter, digit and CJK runs of at least two runes containing at least one Hangul, Han or Kana character.
func KeepAllWords ¶
KeepAllWords reports whether language breaks lines between words rather than inside words of CJK scripts, as Korean does under CSS's word-break: keep-all.
func KeyOf ¶
KeyOf is what EventKeyPress reports for an edit inserting text: the text, or "Enter" for a line break.
func LanguageTag ¶ added in v0.2.0
LanguageTag is tag with '_' as '-', as BCP 47 writes it: Android's and Linux's locales use '_'.
func LimitEdit ¶
LimitEdit is what a field with maxLength keeps of an edit replacing replaced units of text with insert: insert cut to the room left, as the platforms' own limits do. ok is false when nothing of a non-empty insert fits.
func MIMEForFile ¶
MIMEForFile returns the media type a file name's extension says, application/octet-stream for one it does not know.
func MIMEForName ¶
MIMEForName returns the image type a file name's extension says, or "".
func MenuRoleUnsupported ¶
MenuRoleUnsupported reports whether os's menus leave out an item of role, which then takes no key: Windows and Linux leave out macOS's own roles (About, Hide, Hide Others, Show All, Services and Bring All to Front), and the Speech items where nothing speaks (speak, Env.CanSpeak).
func MenuShortcutKey ¶
MenuShortcutKey returns an item's shortcut, or its role's when it has none, normalized as key bindings are.
func NextClockRepeat ¶
func NextClockRepeat(hour, minute, second int, weekday time.Weekday, r NotificationRepeat, now time.Time) time.Time
NextClockRepeat returns the first wall time strictly after now matching hour:minute:second (and weekday for NotificationWeekly) in now's location. Constructing the date from calendar offsets avoids wall-clock drift across daylight saving transitions.
func NextNotificationRepeat ¶
NextNotificationRepeat returns the first wall time strictly after now matching at's clock reading (in at's location), and at's weekday for NotificationWeekly, evaluated in now's location. It returns the zero time for NotificationOnce or an unknown repeat.
func NormalizeFramesInFlight ¶
NormalizeFramesInFlight clamps n to [GPUMinFramesInFlight, GPUMaxFramesInFlight], defaulting zero or negative values to GPUDefaultFramesInFlight.
func NormalizeKey ¶
NormalizeKey returns key lowercased with its modifiers in the order mod, ctrl, alt, shift, meta; "cmd" and "command" are meta, "option" is alt, "control" is ctrl and the key "return" is "enter".
func Painted ¶ added in v0.2.0
func Painted(kind ViewKind, style *ViewStyle, events EventMask, drag WindowDrag) bool
Painted reports whether a view takes the pointer in a window that takes it only where it draws something (WindowPointerPainted): a view that hears the pointer or drags the window, of a kind that draws its whole frame, such as a text, an image or an input, or a container whose style fills or edges it. Shadows and outlines, drawn around the frame, do not count. macOS and Windows ask it of the innermost view the pointer reaches, by its pointer events, and of the views that view is in; Linux, which gives its surface an input region rather than following the pointer, of every view, by its bounds within what clips it.
func ParseDiscoveryTXT ¶
ParseDiscoveryTXT reads DNS-SD attributes, preserving the first value for each key.
func ParseWAVHeader ¶
ParseWAVHeader validates a 44-byte 16-bit PCM RIFF/WAVE header written by WAVHeader and returns its sample rate, channel count and PCM data size.
func PhonePermission ¶
PhonePermission is whether a phone's or a watch's system keeps the permission name, PermissionUnknown for one it keeps, for the backends that cannot tell it yet: the ones only Macs keep are PermissionUnavailable.
func PickedName ¶
PickedName returns name without its directories and with the extension of mime (IMG_0042.HEIC as a JPEG is IMG_0042.jpg); a name without a stem becomes image.
func PlaceWindow ¶
func PlaceWindow(anchor Bounds, size Size, area Bounds, side WindowPlacement) (Point, WindowPlacement)
PlaceWindow returns the top-left corner of a panel of size placed beside anchor in area, a display's visible frame, and the side it took: side, below for WindowPlaceDefault, unless the panel overflows area there and fits on the opposite side. Along the side it is centered on anchor, and either way it is kept inside area, at its top-left corner when it is larger.
func PressesAt ¶
PressesAt reports whether a pressable text takes a press on byte offset i (-1 off its glyphs): a text with links takes only those on a link, as the core gives it no press of its own then.
func RasterStep ¶
RasterStep is how many times its pixels a layer scaled by scale draws its content at: 1 up to its own size, then in steps of a half up to 4, so its text and drawings stay sharp while a zoom redraws them only as it passes a step.
func Reach ¶
Reach reports what a point p, in the coordinates of a view's parent's content, may reach of a view at frame with props: the view itself, by its bounds and HitSlop, and its children, by its bounds and area, the one ItemOverflow gave it. Platforms that hit-test their own views ask it on the way down.
func ReachView ¶ added in v0.2.0
func ReachView(size Size, props *ViewProps, area Bounds, transformed bool, p Point) (self, children bool)
ReachView is Reach for p in a view's viewport, its transform already undone, with the area and transformed flag ItemOverflow gave the view. A view whose children may be transformed has its children searched at any point, since a child or its animation can draw anywhere; the others keep the search to their bounds and layout area, so a hit test skips untransformed subtrees the point cannot reach. Hit slop extends only the view itself, in its own coordinates.
func ReadAssetFile ¶
ReadAssetFile reads a resource without following symlinks outside root.
func RecordingsConnected ¶
func RecordingsConnected() bool
RecordingsConnected says whether a recorder is connected.
func RecordingsDir ¶
func RecordingsDir() string
RecordingsDir returns the app's recordings directory, or "" if no engine has configured one.
func RefusedNavigation ¶
RefusedNavigation is the message of EventError for a navigation Navigable refused.
func ReportCloudStorage ¶
func ReportCloudStorage(report []byte)
ReportCloudStorage hands a runtime report to package cloud.
func ReportDownload ¶
func ReportDownload(progress DownloadProgress)
ReportDownload delivers a change or a snapshot requested by Go.
func ReportGameServices ¶
func ReportGameServices(report []byte)
ReportGameServices delivers a report from the Android runtime to package gameservices.
func ReportGamepadAxis ¶
ReportGamepadAxis updates a single axis on a connected controller.
func ReportGamepadButton ¶
ReportGamepadButton updates a single button on a connected controller.
func ReportGamepadConnect ¶
ReportGamepadConnect records that a game controller connected on the host platform.
func ReportGamepadConnectInfo ¶
ReportGamepadConnectInfo records that a game controller connected on the host platform with its USB vendor/product IDs and rumble capability.
func ReportGamepadDisconnect ¶
func ReportGamepadDisconnect(id int)
ReportGamepadDisconnect records that a game controller disconnected on the host platform.
func ReportGamepadState ¶
func ReportGamepadState(id int, buttons [GamepadButtonCount]float32, axes [GamepadAxisCount]float32)
ReportGamepadState replaces the buttons and axes of a connected controller.
func ReportLiveUpdate ¶
func ReportLiveUpdate(report []byte)
ReportLiveUpdate is the Android backend's: it hands package widget a report of the runtime.
func ReportRecording ¶
func ReportRecording(report []byte)
ReportRecording is the recorder's: it hands package microphone a report.
func RubberBand ¶
RubberBand resists x past lo and hi as a scroll view's edge resists a drag, with UIKit's constant: past a bound it moves less the farther it goes, never more than dimension, the size of what moves.
func SampleDecay ¶
func SampleDecay(from float64, c DecayConfig) []float64
SampleDecay returns a decay from from, as SampleSpring does.
func SampleEasing ¶
SampleEasing returns e at n evenly spaced fractions from 0 to 1, both included, as the platforms evaluate it.
func SampleSpring ¶
func SampleSpring(from, to float64, c SpringConfig) []float64
SampleSpring returns a spring from from to to, as the platforms run it, at SampleRate until it rests: the drivers' own code, stepped like frames.
func ScrollHandleEnabled ¶
func ScrollHandleEnabled(c *ScrollConfig) bool
ScrollHandleEnabled reports whether a scroll view configured with c may show a touch-draggable scroll handle: its indicator is shown, scrolling is enabled, and it is a single-axis (non-zooming) scroll view.
func SendCloudStorage ¶
func SendCloudStorage(msg []byte)
SendCloudStorage sends package cloud's msg to the connected Android runtime.
func SendDownload ¶
func SendDownload(command DownloadCommand) error
SendDownload forwards a command when the platform has a download host.
func SendGameServices ¶
func SendGameServices(msg []byte)
SendGameServices sends package gameservices' msg to the connected Android runtime bridge, queuing it until ConnectGameServices connects.
func SendGamepadRumble ¶
SendGamepadRumble forwards a rumble command (or stop when duration <= 0) to the host platform's registered handler, if any.
func SendLiveUpdate ¶
func SendLiveUpdate(msg []byte)
SendLiveUpdate sends package widget's msg to the Android runtime, once the backend has connected.
func SendRecording ¶
func SendRecording(msg []byte)
SendRecording sends package microphone's msg to the recorder, once one has connected.
func SetAnimatedProp ¶
func SetAnimatedProp(c NativeComponent, b NativeBinding, num float64, col Color)
SetAnimatedProp hands component c an animated prop's value, as ChangedNatives reports it.
func SetRecordingsDir ¶
func SetRecordingsDir(dir string)
SetRecordingsDir sets the app's recordings directory (DataDir/recordings), which package microphone uses for local WAV recordings on macOS, iOS, Windows and Linux.
func ShownText ¶
ShownText is text as screen readers read it: its hidden spans left out, and its attachments, in order, read as labels say, separated from the text around them by a space; one past the labels is left out. A span's Copy is never read: a formula reads as its spoken label, not its TeX.
func SniffImage ¶
SniffImage returns the media type an image's bytes start with, or "" for a format it does not know.
func SpeakScale ¶ added in v0.2.0
SpeakScale maps a request's rate or pitch, 0.5 to 2 with 1 the voice's own and 0 standing for 1, onto a platform's scale: from at 0.5, mid at 1 and to at 2, linearly on each side of mid.
func SplitFilters ¶
func SplitFilters(filters []Filter) (m ColorMatrix, ok bool, blur Points, shadows []BoxShadow)
SplitFilters returns what platforms that cannot chain filters draw of filters: their color filters as one matrix (ok false when there are none), the widest blur and the drop shadows.
func TintImagePixels ¶
TintImagePixels multiplies src's channels by tint and writes dst in the same layout. Both slices hold four-byte pixels, and may be the same slice. Premultiplied colors also take tint's alpha.
func USBKeyCode ¶
USBKeyCode returns the physical code for a keyboard-page HID usage.
func USKeyName ¶
USKeyName is the unmodified logical key name for a physical code on the US layout, for nsgotest's headless keyboard.
func UTF16Offset ¶
UTF16Offset converts a UTF-16 offset in s to a byte offset, clamped to s.
func UTF16Units ¶
UTF16Units converts a byte offset in s to UTF-16 units.
func UprightEmoji ¶
func UprightEmoji(t *AttributedText)
UprightEmoji gives the color emoji of t's italic runs spans of their own that are not italic: emoji fonts have no italic face, and Chrome and Android would slant them where WebKit and CoreText keep them upright, as every platform does here.
func ValidateClipboardItems ¶
func ValidateClipboardItems(items []ClipboardItem) error
ValidateClipboardItems checks the total byte quota and each item's format names.
func ValidateCompressedTextureUpload ¶
func ValidateCompressedTextureUpload(format GPUTextureFormat, width, height, originX, originY uint32, layout GPUDataLayout, dataLen int) error
ValidateCompressedTextureUpload validates that a compressed texture upload has block-aligned origin/extent, valid BytesPerRow stride, and sufficient bytes.
func VisibleText ¶
VisibleText is text with its hidden spans left out, its attachments' places kept.
func WAVHeader ¶
func WAVHeader(rate, channels int, dataBytes uint32) [WAVHeaderSize]byte
WAVHeader returns the 44-byte RIFF/WAVE header for dataBytes of 16-bit little-endian signed linear PCM at rate hertz and channels (1 or 2).
func WatchPlatformGamepads ¶
func WatchPlatformGamepads(fn func()) func()
WatchPlatformGamepads registers fn to be called when controllers connect or disconnect on the platform bridge.
func WebBridge ¶
WebBridge is the script a platform runs at the start of every page before the app's, given post, the JavaScript expression of a function that sends its string argument to the app.
func WebEvaluateAnswer ¶
WebEvaluateAnswer decodes what WebEvaluateScript posted after its marker: the result as JSON, or the error the script threw.
func WebEvaluateFailure ¶
WebEvaluateFailure is what a page posts when the script after marker threw message, as WebEvaluateAnswer decodes it.
func WebEvaluateMarker ¶
WebEvaluateMarker returns the marker of a script WebEvaluateScript made, for a backend that has no page to run it in and answers it with WebEvaluateFailure instead.
func WebEvaluateScript ¶
WebEvaluateScript is the script that runs script in a page as an expression and posts its answer through the bridge, marker first: its result as JSON, a promise's once settled, or what it threw (decoded by WebEvaluateAnswer).
func WebMIME ¶
WebMIME returns the media type a web scheme response should use. It first trusts the URL's extension, then applies the small signature set browsers use for responses without one. The fallback is always a valid media type.
func WebMessageScript ¶
WebMessageScript is the script WebPostMessage runs in the page.
func WebMobileScript ¶
WebMobileScript is the script a backend runs in every frame before a page's own for WebConfig.Mobile. With emulate, as WebKit's desktop backends have it, the page sees a touch screen without hover, with navigator.platform reporting platform, and the mouse's drags reach it as touches; either way wheel and trackpad scrolls that nothing would scroll reach it as swipes.
func WebOrigin ¶
WebOrigin is the origin of the page at rawURL as browsers write one: scheme://host, with the port when it is not the scheme's own, in lower case, such as "https://example.com" or "app://bundle". A blob: URL has the origin of the URL it holds and every file: URL "file://"; a URL with no host, such as about:blank or a data: URL, or one that does not parse, has an opaque origin, written "null". No URL ("") has no origin ("").
func WebUserAgent ¶
WebUserAgent appends suffix to base with one separating space.
func WinKeyCode ¶
WinKeyCode returns the physical code for a set-1 scan code with its extended 0xe0 prefix, when applicable.
func WriteTrace ¶
WriteTrace prints batch b, which a commit that took took made, as traces show it: a line with label, the items and the commit's time, then a line per item. nsgo test -trace labels batches by their step, nsgo dev -trace by their commit.
func XKBKeyCode ¶
XKBKeyCode returns the physical code for an XKB hardware key code.
Types ¶
type AccessibilityAction ¶
type AccessibilityAction struct {
// Name is a standard action (ActionActivate and the others), which
// the screen reader performs with its own gesture or key, or a custom
// action's name.
Name string
// Label is what a custom action is called in the screen reader's
// actions menu; Name when empty.
Label string
}
AccessibilityAction is an action assistive technology offers on an element; OnAccessibilityAction receives its Name.
type AccessibilityValue ¶
type AccessibilityValue struct {
// Min, Max and Now are a range, when Max is above Min: a slider's or
// a progress bar's.
Min, Max, Now float32
// NoNow leaves a range without its current value, as an indeterminate
// progress bar's.
NoNow bool
// Text is read instead of Now, or alone without a range.
Text string
}
AccessibilityValue is a range's or a textual element's value (accessibilityValue). The zero value is no value.
func (AccessibilityValue) IsRange ¶
func (v AccessibilityValue) IsRange() bool
IsRange reports whether v is a range.
type Accessible ¶
type Accessible uint8
Accessible says whether a view is one element for assistive technology.
const ( // AccessibleAuto leaves it to the platform: views with a role, a // label or a press handler are elements. AccessibleAuto Accessible = iota // AccessibleYes makes the view one element: its descendants are not // exposed separately, and without a label it reads their text. AccessibleYes // AccessibleNo makes the view no element; its descendants still are. AccessibleNo )
type ActivityAlert ¶
ActivityAlert is the alert that accompanies a Live Activity update.
type ActivityConfidence ¶
type ActivityConfidence uint8
ActivityConfidence is unknown, low, medium or high, in that order.
const ( ActivityConfidenceUnknown ActivityConfidence = iota ActivityConfidenceLow ActivityConfidenceMedium ActivityConfidenceHigh )
type ActivityKinds ¶
type ActivityKinds uint16
ActivityKinds is a set: providers can report stationary and automotive together.
const ( ActivityStationary ActivityKinds = 1 << iota ActivityWalking ActivityRunning ActivityCycling ActivityAutomotive ActivityUnknown )
type ActivitySample ¶
type ActivitySample struct {
Kinds ActivityKinds
Confidence ActivityConfidence
Timestamp time.Time
Gap bool
Dropped uint64
}
ActivitySample reports the provider's classification without inferring one from acceleration.
type Affinity ¶
type Affinity uint8
Affinity says which line a caret offset is on where one offset is two places on screen: the end of a wrapped line and the start of the next.
type AlertAction ¶
AlertAction is one button of an alert.
type AlertConfig ¶
type AlertConfig struct {
Title string
Message string
Actions []AlertAction
// Sheet presents the actions as an action sheet from the bottom
// (UIAlertController's; a list dialog on Android) instead of an alert.
Sheet bool
// Cancelable lets Escape, back and a press outside close it without
// an action, answered with -1.
Cancelable bool
// ID numbers the alert; the engine sets it.
ID uint32
}
AlertConfig is a native alert: a title, a message and its buttons.
type AndroidEventMapper ¶
AndroidEventMapper is implemented by an Android component that receives the listener callbacks of its view itself, to emit what it likes; without it each callback is emitted as is.
type AndroidPropMapper ¶
type AndroidPropMapper interface {
ViewProps(name string, value any) []AndroidViewProp
}
AndroidPropMapper is implemented by an Android component that chooses the setter calls a prop makes, in order; without it each prop calls its own setter with its value.
type AndroidViewProp ¶
AndroidViewProp is one setter call on a component's view: set<Name>(Value), Name's first letter upper-cased.
type AnimatedArg ¶
type AnimatedArg interface {
// AnimatedNodeID is the node's ID in the animation graph; 0 binds
// nothing.
AnimatedNodeID() uint32
}
AnimatedArg is an animated node a drawing binds an argument to.
type AnimatedProp ¶
type AnimatedProp uint8
AnimatedProp is a view property an animated node drives.
const ( PropOpacity AnimatedProp = iota PropTranslateX PropTranslateY PropScale PropScaleX PropScaleY PropRotate PropBackground PropBorderColor PropShadowColor PropShadowRadius // PropShadowOpacity multiplies the shadow color's alpha. PropShadowOpacity // PropTextColor colors a text's whole content, its spans included. PropTextColor // PropRotateX and PropRotateY turn the view out of its plane, in // degrees. PropRotateX PropRotateY // PropCount is the number of animated props. PropCount )
type AnimatedPropSetter ¶
type AnimatedPropSetter interface {
SetAnimatedNumber(name string, v float64)
SetAnimatedColor(name string, c Color)
}
AnimatedPropSetter is implemented by a component that takes its animated props as numbers and colors, on the main thread on the frames they change; without it SetProp receives them, a number as a float64 and a color as a Color.
type AnimatedValues ¶
type AnimatedValues struct {
// Set holds a bit for each bound AnimatedProp.
Set uint16
Opacity float32
TranslateX, TranslateY Points
Scale, ScaleX, ScaleY float32
Rotate float32
Background Color
BorderColor Color
ShadowColor Color
ShadowRadius Points
ShadowOpacity float32
// TextColor colors a text's whole content.
TextColor Color
RotateX, RotateY float32
}
AnimatedValues are the bound properties of a view, as the animator last evaluated them.
func (AnimatedValues) Apply ¶
func (v AnimatedValues) Apply(vs ViewStyle) ViewStyle
Apply returns vs with the bound properties in place of its own, for backends that draw from a ViewStyle.
func (AnimatedValues) Has ¶
func (v AnimatedValues) Has(p AnimatedProp) bool
Has reports whether p is bound.
type Animation ¶
type Animation struct {
Kind AnimationKind
// Value is the node a Timing, Spring or Decay moves; To where Timing
// and Spring take it.
Value uint32
To float64
Timing TimingConfig
Spring SpringConfig
Decay DecayConfig
// Steps are a composite's animations.
Steps []*Animation
// Delay is Delay's wait and Stagger's interval.
Delay time.Duration
// Iterations is Loop's count; 0 repeats forever. NoReset starts each
// iteration where the last ended, rather than with its values back
// at their start.
Iterations int
NoReset bool
// FrameRate caps how many times a second the whole run moves its
// values, on the animation StartAnimation is given; 0 is every frame
// the display has.
FrameRate float64
}
Animation is a description of how values move: Timing, Spring and Decay move one value, and Sequence, Parallel, Stagger, Delay and Loop compose them. StartAnimation runs it on the platform.
type AnimationKind ¶
type AnimationKind uint8
AnimationKind is what an Animation does.
const ( AnimationTiming AnimationKind = iota + 1 AnimationSpring AnimationDecay AnimationSequence AnimationParallel AnimationStagger AnimationDelay AnimationLoop )
type AnimationOp ¶
type AnimationOp struct {
Kind AnimationOpKind
Node uint32
Value float64
Input uint32
Interpolation *Interpolation
Math MathOp
A, B Operand
Min, Max float64
// Snap makes a diff clamp settle at a bound when its scroll view
// rests.
Snap bool
// ID names a run or a read.
ID uint32
Animation *Animation
// Endless marks a run its owner starts again whenever it ends, as a
// shader's clock is, so Ending does not wait for it.
Endless bool
View NodeID
Prop AnimatedProp
X, Y uint32
}
AnimationOp is one change to the animation graph.
type AnimationOpKind ¶
type AnimationOpKind uint8
AnimationOpKind is a change to the animation graph.
const ( // AnimCreateValue makes value Node at Value. AnimCreateValue AnimationOpKind = iota + 1 // AnimCreateInterpolate makes Node map Input through Interpolation. AnimCreateInterpolate // AnimCreateMath makes Node combine A and B with Math. AnimCreateMath // AnimCreateDiffClamp makes Node follow Input's changes within Min // and Max; with Snap it settles at its nearer bound when the scroll // view its input follows comes to rest. AnimCreateDiffClamp // AnimSet, AnimSetOffset, AnimFlattenOffset, AnimExtractOffset and // AnimStopValue change value Node. AnimSet AnimSetOffset AnimFlattenOffset AnimExtractOffset AnimStopValue // AnimRead answers ID with value Node's value in an EventAnimation. AnimRead // AnimStart runs Animation as ID; its end is an EventAnimation. AnimStart // AnimStop ends run ID early. AnimStop // AnimBind makes Node drive Prop of View; Node 0 unbinds it. AnimBind // AnimBindPan has drags on View set values X and Y to their // translation, and AnimBindScroll has scroll view View set them to its // offset. AnimBindPan AnimBindScroll // AnimRelease drops Node. AnimRelease // AnimBindPinch has pinches on View scale value Node, and // AnimBindRotation has rotations on View turn it, in radians. AnimBindPinch AnimBindRotation // AnimReset ends run ID unfinished, if it runs, and puts the values // it moves back where they were when it started. AnimReset // AnimForgetRun drops what the animator keeps of run ID for a reset. AnimForgetRun // AnimBindPull has vertical scroll view View set value Node to how // far it is pulled past its top: 0 at rest, the room kept above the // content while it refreshes. AnimBindPull // AnimCreateRubberBand makes Node follow Input but resist it past Min // and Max, never by more than Value, the size of what moves // (RubberBand). AnimCreateRubberBand )
type Animator ¶
type Animator struct {
// contains filtered or unexported fields
}
Animator evaluates the animation graph on a platform's main thread, as NSH's does: backends feed it each ItemAnimation, step it once a frame while it runs, and apply the values it gives each bound view. It is pure Go and touches no view, so every backend shares it.
Drivers are closed-form functions of the time since they started, so the result does not depend on the frame rate or dropped frames. Not safe for concurrent use.
func NewAnimator ¶
NewAnimator returns an animator that reports finished runs and reads through report, for the backend to dispatch to the engine.
func (*Animator) Apply ¶
func (a *Animator) Apply(ops []AnimationOp)
Apply applies a batch's changes to the graph.
func (*Animator) BindCanvas ¶
BindCanvas has nodes drive the arguments of canvas view's drawing that slots name, replacing what it bound before (Drawing.Slots). ChangedCanvases reports the view next.
func (*Animator) BindNative ¶
func (a *Animator) BindNative(view NodeID, bindings []NativeBinding)
BindNative has animated nodes drive props of native view's component, replacing what it bound before (NativeConfig.Bindings). ChangedNatives hands every bound value over next.
func (*Animator) BindShader ¶
func (a *Animator) BindShader(view NodeID, nodes []ShaderNode)
BindShader has nodes drive lanes of shader view's uniforms, replacing what it bound before (Shader.Nodes). ChangedShaders reports the view next.
func (*Animator) CanvasBound ¶
CanvasBound reports whether view's drawing has bound arguments.
func (*Animator) CanvasOps ¶
CanvasOps returns d's ops with the arguments view binds set to their nodes' values, d.Ops itself when it binds none. The slice is reused by the next call for the view.
func (*Animator) Changed ¶
func (a *Animator) Changed(fn func(view NodeID, v AnimatedValues))
Changed calls fn with each bound view whose values may have changed since the last call, and their values.
func (*Animator) ChangedCanvases ¶
ChangedCanvases calls fn with each canvas view whose bound arguments changed since the last call, for the backend to draw again.
func (*Animator) ChangedNatives ¶
func (a *Animator) ChangedNatives(fn func(view NodeID, b NativeBinding, num float64, col Color))
ChangedNatives calls fn with each bound prop of a native view whose value changed since it last handed it over: a number, or a color when the binding's node outputs one. Backends pass them to SetAnimatedProp.
func (*Animator) ChangedShaders ¶
ChangedShaders calls fn with each shader view whose bound lanes changed since the last call, for the backend to draw again.
func (*Animator) Ending ¶
Ending reports whether something runs that ends on its own: an animation without an endless loop that is not marked Endless, or a settling clamp. Tests wait for it before they look.
func (*Animator) FrameRate ¶
FrameRate returns the frames a second the running animations need, 0 when one needs every frame the display has, for a backend to slow its frame clock.
func (*Animator) Generation ¶
Generation changes whenever a value may have changed, for backends that place what values drive, such as sticky cells, when it does.
func (*Animator) Gesture ¶
Gesture moves the values bound to ev's gesture, a pan, pinch or rotation on ev.ID, before the platform reports it: from where they were as it began, so a gesture grabs a value an animation is moving where it is. A pan's start and end report the bound values in ev.Values. It reports whether a value moved, to draw.
func (*Animator) Pull ¶
Pull sets the value bound to scroll view view's pull to distance, how far it is pulled past its top.
func (*Animator) Running ¶
Running reports whether an animation runs, or a snapping diff clamp settles, so the backend keeps its frame callback.
func (*Animator) Settle ¶
Settle starts the snapping diff clamps that follow scroll view view's values toward their nearer bound, as the view comes to rest: the platform calls it where it reports a scroll's end. Max is the nearer bound only once the clamp's input reached it, so a header near the top of the content shows.
func (*Animator) ShaderLanes ¶
ShaderLanes writes the values of view's bound lanes into lanes, which hold its Shader.Lanes; a lane beyond them is left out.
func (*Animator) Step ¶
Step advances the running animations to now, a monotonic time. A run with a frame rate moves only when its next frame is due, so a clock faster than the run changes nothing in between.
func (*Animator) StickyShift ¶
func (a *Animator) StickyShift(c StickyCell, offset Points) Points
StickyShift is c.StickyShift with the cell's inset the value its node has, as backends place a cell bound to an animated node. A nil animator keeps the inset c was laid out with.
func (*Animator) Touch ¶
Touch has Changed report view's values again, as a backend needs after it drew the view's own style over them.
type Appearance ¶
type Appearance uint8
Appearance is the light or dark appearance an app asks for, or the system's.
const ( // AppearanceSystem follows the system's appearance. AppearanceSystem Appearance = iota AppearanceLight AppearanceDark )
type AppleCredential ¶ added in v0.2.0
type AppleCredential struct {
User, IdentityToken, AuthorizationCode, Email string
GivenName, FamilyName, MiddleName, NamePrefix, NameSuffix, Nickname string
}
AppleCredential is what EventSignInWithApple answers a sign-in with, as core.AppleCredential.
type AppleSignInRequest ¶ added in v0.2.0
AppleSignInRequest is an ItemSignInWithApple's request, as core.AppleSignInOptions: the scopes it asks for and Nonce, which the core hashes as the request carries it, "" for none.
type AtlasSprite ¶
AtlasSprite is one source rectangle, its transform and opacity.
type AtlasSprites ¶
type AtlasSprites []AtlasSprite
AtlasSprites holds the immutable records of one DrawAtlas operation.
type AttributedText ¶
type AttributedText struct {
Text string
Style TextStyle
// Spans style byte ranges of Text over Style, in order, without gaps
// or overlaps where they cover it.
Spans []TextSpan
// MaxLines limits the lines shown, cutting the rest as Ellipsize
// says; 0 shows every line.
MaxLines int
Ellipsize EllipsizeMode
// Shadow is drawn behind the whole text's glyphs. It is drawing only:
// it changes no line.
Shadow TextShadow
// Attachments are views inside the text, in order: each takes the
// place of an AttachmentRune of Text, which a span styles.
Attachments []TextAttachment
// Origin is, for a text an engine cut from another (Cut, CutToFit,
// CutRest), the index of each attachment in the text it was cut
// from, so the engine reports where they went by the app's indices.
Origin []int
}
AttributedText is styled text for a TextEngine.
func (*AttributedText) Cut ¶
func (t *AttributedText) Cut(head bool, front, back int) AttributedText
Cut returns t with the characters between keep runes from its start and keep from its end replaced by an ellipsis, "Lorem…dolor", or with only the last keep runes after one when head is set, "…sum dolor". The ellipsis takes the style of the first character it replaces, and attachments cut out are dropped. The result is one line, clipped. Engines that cannot ellipsize a line's head or middle themselves search for the most characters that still fit.
func (*AttributedText) CutRest ¶
func (t *AttributedText) CutRest(start int, fits func(*AttributedText) bool) AttributedText
CutRest returns t with its lines before the one starting at byte start as they are, then its rest cut at its head or middle, as Ellipsize says, into the most characters with which fits reports the rest fits on one line: what CoreText does to a several-line text's last line, for engines that ellipsize a head or middle only on one line. A line break joins the two, and the result clips at MaxLines.
func (*AttributedText) CutToFit ¶
func (t *AttributedText) CutToFit(fits func(*AttributedText) bool) AttributedText
CutToFit returns t cut at its head or middle, as its Ellipsize says, keeping the most characters with which fits reports true.
func (*AttributedText) Equal ¶
func (a *AttributedText) Equal(b *AttributedText) bool
Equal reports whether a and b lay out and draw the same.
func (*AttributedText) HasHidden ¶
func (t *AttributedText) HasHidden() bool
HasHidden reports whether a span of t is hidden.
type AudioCommand ¶
type AudioCommand uint8
AudioCommand is what an ItemAudio asks of a sound or a player.
const ( // AudioLoad has the platform read sound Count's Source, failing with AudioQuotaExceeded past MaxBytes, and decode at most MaxDuration of it into memory, reporting AudioLoaded or AudioFailure. AudioLoad AudioCommand = iota // AudioPlay starts a playback of sound Count at Volume, Rate and Pan over those playing. A nonzero Playback gets AudioPlaybackEnded when it stops. AudioPlay // AudioStop stops every playback of sound Count. AudioStop // AudioUnload frees sound Count, its playbacks stopped. Nothing is reported of it after this. AudioUnload // AudioOpen makes player Count for Source, with Volume, Rate, Loop, Session and ProgressInterval, starting at Position. It loads nothing: another command follows it in the same batch. AudioOpen // AudioPreload has player Count load without playing, reporting AudioOpened once it knows its duration. AudioPreload // AudioResume plays player Count from where it is, loading it first if it has not or failed, and reports AudioPlaying. After AudioEnded it plays from the start, unless an AudioSeek came since. AudioResume // AudioPause pauses player Count, reporting AudioPaused. AudioPause // AudioSeek moves player Count to Position, clamped to its duration, once it can seek, and reports AudioProgress from there. AudioSeek // AudioSet changes player Count's Volume, Rate and Loop. AudioSet // AudioClose stops and frees player Count. Nothing is reported of it after this. AudioClose // AudioReadLatency reads the current output route's latency. AudioReadLatency // AudioPlaybackSet updates Playback's volume and rate. AudioPlaybackSet // AudioPlaybackStop stops Playback alone. AudioPlaybackStop )
func (AudioCommand) String ¶
func (c AudioCommand) String() string
String returns the command's name, as traces print it: load, play, ...
type AudioEvent ¶
type AudioEvent struct {
Phase AudioPhase
Playback uint32
Duration, Position time.Duration
// Latency is the output route's latency in AudioLatency, zero when unknown.
Latency time.Duration
// Bytes is a loaded sound's decoded size, which the core counts against MaxDecodedBytes, and Cut says it was longer than the MaxDuration decoded.
Bytes int64
Cut bool
// Buffering is AudioBuffer's.
Buffering bool
// Seeks counts the AudioSeeks the player applied and Laps the times a looping one started over, so the core drops a report from before the last seek and lets the position go back only with one of them.
Seeks, Laps uint32
// Error is one of the Audio errors and Message the platform's words.
Error, Message string
}
AudioEvent is an EventAudio's report.
type AudioOutput ¶
type AudioOutput interface {
Start() error
Pause()
Close()
Flush() int
Position() (int64, time.Time)
Latency() time.Duration
Underruns() int
}
AudioOutput is a pull PCM stream owned by the app's scope.
type AudioOutputConfig ¶
type AudioOutputConfig struct {
SampleRate, Channels int
Latency time.Duration
Render func([]float32) int
Interrupt func(error)
}
AudioOutputConfig describes the client's interleaved stream.
type AudioOutputFactory ¶
type AudioOutputFactory interface {
OpenAudioOutput(AudioOutputConfig) (AudioOutput, error)
}
AudioOutputFactory opens a stream for the audio package. It is optional on platforms whose UI and app engine run in the same process.
type AudioPhase ¶
type AudioPhase uint8
AudioPhase is what an EventAudio reports of a sound or a player.
const ( // AudioLoaded says a sound decoded: Duration, Bytes and Cut. AudioLoaded AudioPhase = iota // AudioOpened says a player knows its Duration, 0 for a live stream. AudioOpened // AudioPlaying says a player plays. AudioPlaying // AudioPaused says a player paused, the app's Pause or the system's, such as an interruption or the app leaving the foreground. AudioPaused // AudioProgress says where a playing player is, every ProgressInterval and after a seek: Position, Duration, Seeks and Laps. The core reports the position once more as a player pauses or ends, so a platform need not. AudioProgress // AudioBuffer says whether a player waits for data (Buffering). AudioBuffer // AudioEnded says a player played to its end; never while it loops. AudioEnded // AudioFailure says a sound did not load or a player failed, with Error and Message. A player plays nothing more until a command loads it again. AudioFailure // AudioLatency reports the output route's latency. AudioLatency // AudioPlaybackEnded reports a sound playback's completion, stop, eviction, or failure to start. AudioPlaybackEnded )
type AudioRequest ¶
type AudioRequest struct {
Command AudioCommand
// Playback identifies one playback of the sound named by Count. Zero plays without tracking it.
Playback uint32
// Source is AudioLoad's and AudioOpen's: an "asset:" path in the app's resources, a file path or file: URL, a data: URL, an http(s) URL, or Data. A platform reads it as it reads an image's.
Source ImageSource
// MaxBytes, MaxDecodedBytes and MaxDuration bound AudioLoad.
MaxBytes, MaxDecodedBytes int64
MaxDuration time.Duration
// MaxPlaybacks bounds AudioPlay; a Restricted playback is also held to MaxSoundVoices among the restricted playbacks on the same output.
MaxPlaybacks int
Restricted bool
// Volume runs from 0 to 1, Rate from 0.5 to 2 and Pan from -1 (full left) to 1 (full right); AudioPlay's, with Volume and Rate AudioPlaybackSet's, AudioOpen's and AudioSet's too.
Volume, Rate, Pan float32
// StartAt is AudioPlay's scheduled start in the engine clock's time.
StartAt time.Time
// Loop repeats a playback of a sound or a player. A player uses LoopStart from AudioOpen and sends no AudioEnded while it loops.
Loop bool
LoopStart time.Duration
// Session is a player's: what it does to other apps' audio while it plays. Sounds mix with other apps' audio.
Session AudioSession
// ProgressInterval is the time between a playing player's AudioProgress reports, at least 16 milliseconds.
ProgressInterval time.Duration
// Position is AudioOpen's and AudioSeek's.
Position time.Duration
}
AudioRequest is an ItemAudio's request. Count numbers the sound or the player, from one counter of the process, so a sound's and a player's are never the same.
type AudioSession ¶
type AudioSession uint8
AudioSession is what a video's sound does to the rest of the device's audio while it plays, as NSH's audioSession.
const ( // AudioSessionDefault leaves the app's audio settings to decide: on // iOS the device's silent mode silences it. AudioSessionDefault AudioSession = iota // AudioSessionPlayback plays in iOS's silent mode as speech, pausing // other apps' audio until it pauses, ends or goes; Android holds the // audio focus while it plays. AudioSessionPlayback // AudioSessionMixWithOthers plays in iOS's silent mode as speech, with // other apps' audio going on. AudioSessionMixWithOthers )
type AuthCommand ¶ added in v0.2.0
type AuthCommand uint8
AuthCommand is what an ItemAuthSession asks of its session.
const ( // AuthStart prepares the session's redirect, which the platform reports with AuthRedirect: Scheme, Host and Path say what the provider redirects to, Ephemeral whether the session shares no cookies with the browser. AuthStart AuthCommand = iota // AuthOpen opens URL, the authorization URL the app built for the redirect, and ends the session with AuthEnded once the provider redirects or the session ends otherwise. AuthOpen // AuthCancel ends the session at once, reporting nothing more. AuthCancel )
type AuthEvent ¶ added in v0.2.0
type AuthEvent struct {
Phase AuthPhase
Redirect string
// OpenLinks says EventOpenLinks carries this redirect's callback rather than a native session reporting AuthEnded. The core claims that URI across the app's surfaces until the session ends.
OpenLinks bool
// Callback is the URL the provider redirected to, query and fragment included.
Callback string
// Error is one of the Auth errors, "" for none, and Message what the platform said of a failure.
Error string
Message string
}
AuthEvent is an EventAuthSession's report.
type AuthPhase ¶ added in v0.2.0
type AuthPhase uint8
AuthPhase is what an EventAuthSession reports of its session.
type AuthRequest ¶ added in v0.2.0
type AuthRequest struct {
Command AuthCommand
// Scheme is the app's callback scheme, "https" with Host for an HTTPS callback; "" for a loopback redirect where the platform serves one.
Scheme string
Host string
// Path is the redirect's path, starting with "/".
Path string
Ephemeral bool
// URL is AuthOpen's authorization URL.
URL string
}
AuthRequest is an ItemAuthSession's request.
type AutoCapitalize ¶
type AutoCapitalize uint8
AutoCapitalize is a field's automatic capitalization; sentences are the default.
const ( AutoCapitalizeSentences AutoCapitalize = iota AutoCapitalizeNone AutoCapitalizeWords AutoCapitalizeCharacters )
type AutoComplete ¶
type AutoComplete uint8
AutoComplete says what a field holds, for the system's autofill and suggestions: React Native's autoComplete, which iOS maps to its textContentType.
const ( // AutoCompleteDefault lets the platform decide. AutoCompleteDefault AutoComplete = iota AutoCompleteOff AutoCompleteUsername // AutoCompletePassword is an existing password. AutoCompletePassword // AutoCompleteNewPassword is a password being chosen. AutoCompleteNewPassword // AutoCompleteOneTimeCode is a code from a text message or e-mail. AutoCompleteOneTimeCode AutoCompleteEmail AutoCompleteTel AutoCompleteName AutoCompleteGivenName AutoCompleteFamilyName AutoCompleteMiddleName AutoCompleteNickname AutoCompleteOrganization // AutoCompleteStreetAddress is every line of a street address. AutoCompleteStreetAddress AutoCompleteAddressLine1 AutoCompleteAddressLine2 AutoCompleteCity // AutoCompleteRegion is a state or region. AutoCompleteRegion AutoCompletePostalCode AutoCompleteCountry AutoCompleteCreditCardNumber AutoCompleteCreditCardExpiration AutoCompleteCreditCardSecurityCode AutoCompleteCreditCardName AutoCompleteURL AutoCompleteBirthdate )
func (AutoComplete) String ¶
func (a AutoComplete) String() string
String returns the HTML autocomplete token, empty for the default.
type BackdropMaterial ¶
type BackdropMaterial uint8
BackdropMaterial is the system material iOS draws a backdrop blur with, from the thinnest. macOS draws its closest material for one other than BackdropUltraThin, and blurs by the radius for that.
const ( BackdropUltraThin BackdropMaterial = iota BackdropThin BackdropRegular BackdropThick BackdropChrome )
type BackgroundMotionOptions ¶
type BackgroundMotionOptions struct {
Motion MotionOptions
Duration time.Duration
NotificationTitle, NotificationBody string
}
BackgroundMotionOptions requests a finite live stream. The OS may expire its execution lease earlier; it never records after this app terminates.
type BlendMode ¶
type BlendMode uint8
BlendMode is how a view's pixels mix with what is drawn behind it, as CSS's mix-blend-mode.
const ( BlendNormal BlendMode = iota BlendMultiply BlendScreen BlendOverlay BlendDarken BlendLighten BlendColorDodge BlendColorBurn BlendHardLight BlendSoftLight BlendDifference BlendExclusion BlendHue BlendSaturation BlendColor BlendLuminosity BlendPlusLighter // BlendPlusDarker is a linear burn: the sum of the colors less white. BlendPlusDarker )
type BlurLevel ¶
BlurLevel is a step of a soft edge's blur, which grows toward the side: what is under it blurred, shown wholly from the side to Full of the way across the band, and fading out from there to nothing at Gone. Blur adds to the levels drawn before it, whose blurs it reads, as variances add up; Total is the whole blur where it shows wholly, for a platform whose levels each read the content alone.
func SoftEdgeLevels ¶
func SoftEdgeLevels() []BlurLevel
SoftEdgeLevels returns the levels of a soft edge's blur, from the finest, as MyGo's progressive blurs: their blurs double from one level to the next up to SoftEdgeBlur, and between two a pixel shows both mixed, which the eye takes for a blur between them.
type BorderStyle ¶
type BorderStyle uint8
BorderStyle is how a border or an outline is drawn. The zero value is solid.
const ( BorderSolid BorderStyle = iota + 1 // BorderDashed draws dashes three widths long, three apart. BorderDashed // BorderDotted draws round dots a width across, a width apart. BorderDotted // BorderNone and BorderHidden draw no border, and layout gives it // no width, whatever the widths say. BorderNone BorderHidden )
type Bounds ¶
Bounds is a rectangle: its origin relative to the parent's and its size.
func CanvasDamage ¶
CanvasDamage returns the part of a canvas that playing after instead of before changes, in the canvas's points, as NSH's DamageScan: before and after are one drawing's ops with its bound arguments at two moments, so they differ only in those arguments. It replays both for their geometry (the transform and the path, line widths, joins and caps, shadows) and adds up the bounds of the painting ops that changed or paint with state that did (the transform, the path, the alpha, the paint, the line's settings, the shadow), under both. Bounds are conservative: curves by their control points, arcs by their circle, strokes by half their width times the transform's largest scale, times the miter limit at miter joins or √2 at square caps, shadows by twice their blur past their offset, text by 1.5 em per character and 1.5 em above and below its baseline. It reports false where only a full redraw is right: a changed clip, changed painting under a composite operation other than source-over, which changes pixels outside its shape, an image at its natural size, or bounds that are not finite. A platform that redraws the area replays the whole drawing clipped to it, so the pixels are those of a full redraw.
func CaretRect ¶
func CaretRect(l TextLayout, c Caret) (Bounds, bool)
CaretRect returns the caret at c in l; false when l has no lines or does not hit-test.
func HairlineRect ¶
HairlineRect returns where a hard edge's hairline is in its band of size band: along the band's other end, outside it.
func LerpBounds ¶
LerpBounds interpolates a frame from a to b at progress p, never to a negative size.
func PointBounds ¶
PointBounds encloses a projected border box's four corners. A box with a point at infinity has no finite outline.
func RangeRects ¶
func RangeRects(l TextLayout, start, end int, out []Bounds) []Bounds
RangeRects appends to out the boxes of the UTF-16 range from start to end in l.
type BoxShadow ¶
BoxShadow is one shadow of a view's box, as one of CSS's box-shadow layers: its shape is the box's, grown by Spread, moved by Offset and blurred by Blur, CSS's blur radius (twice the Gaussian's standard deviation). An inset shadow falls inside the box, over its background, from the edges inwards.
type CanvasEnabler ¶
type CanvasEnabler interface {
EnableCanvas()
}
CanvasEnabler is implemented by backends whose canvas drawing links on demand.
type CanvasGradient ¶
type CanvasGradient struct {
// Radial makes a radial gradient from the focal circle (X1, Y1, R1)
// to the outer circle (X2, Y2, R2), as the web's
// createRadialGradient. Conic makes one around (X1, Y1), offset 0 at
// Angle radians from the x axis and the offsets turning clockwise, as
// createConicGradient. Otherwise offset 0 is at (X1, Y1) and offset 1
// at (X2, Y2).
Radial, Conic bool
X1, Y1, R1 float32
X2, Y2, R2 float32
Angle float32
// Transform is a, b, c, d, e, f, as SVG's matrix(): it maps (x, y) to
// (a*x + c*y + e, b*x + d*y + f). All zeros is the identity.
Transform [6]float32
Spread GradientSpread
// Stops are in increasing offsets from 0 to 1, with unpremultiplied
// colors; between them colors are interpolated.
Stops []GradientStop
}
CanvasGradient is a linear, radial or conic color gradient that DrawFillGradient and DrawStrokeGradient paint with. Its points are in gradient space, which Transform maps into the coordinates of the fill or stroke that uses it.
func CanvasConic ¶
func CanvasConic(angle, x, y float32, stops ...GradientStop) *CanvasGradient
CanvasConic returns a gradient around (x, y) starting at angle radians.
func CanvasLinear ¶
func CanvasLinear(x0, y0, x1, y1 float32, stops ...GradientStop) *CanvasGradient
CanvasLinear returns a gradient from (x0, y0) to (x1, y1).
func CanvasRadial ¶
func CanvasRadial(x0, y0, r0, x1, y1, r1 float32, stops ...GradientStop) *CanvasGradient
CanvasRadial returns a gradient from the circle (x0, y0, r0) to the circle (x1, y1, r1).
func (*CanvasGradient) At ¶
func (g *CanvasGradient) At(t float64) Color
At returns g's color at offset t, its stops clamped and interpolated in unpremultiplied sRGB, for players that sample gradients themselves.
func (*CanvasGradient) Matrix ¶
func (g *CanvasGradient) Matrix() [6]float32
Matrix returns g's transform, the identity for all zeros.
type CanvasMesh ¶
type CanvasMesh struct {
Vertices []CanvasVertex
}
CanvasMesh is an immutable triangle list. Every three vertices form a triangle. Vertices are kept behind a pointer so DrawOp is comparable.
type CanvasNode ¶
type CanvasNode struct {
// Bounds is where it is in the canvas, in the canvas's own points,
// whatever the transform.
Bounds Bounds
Role Role
Label string
TestID string
Selected bool
}
CanvasNode is a named part of a drawing, such as a chart's bar or a grid's cell: assistive technology and tests see it as a child of the canvas, and a press on it presses at its center.
type CanvasSplit ¶
type CanvasSplit struct {
// At is the first op a slot binds, len(Ops) when none is bound.
At int
// Path says the current path the ops before At build is still used
// from At on: by a clip before At, or by an op from At on before a
// DrawBeginPath starts anew. A path begun anew just before At is
// empty there and is not.
Path bool
}
CanvasSplit is where a drawing's static part ends, as NSH's first_animated and prefix_path_needed: what the ops before At paint is the same whatever its bound arguments hold. A backend may keep those pixels and, when the arguments change, play only the painting from At on over them; the ops before At still set the state.
func SplitCanvas ¶
func SplitCanvas(d *Drawing) CanvasSplit
SplitCanvas returns where d's static part ends.
func (CanvasSplit) Skips ¶
func (s CanvasSplit) Skips(i int, op *DrawOp) bool
Skips reports whether a player drawing over the kept static part leaves out op i: one before At that paints, or that builds a path no op from At on uses.
func (CanvasSplit) Static ¶
func (s CanvasSplit) Static(d *Drawing) bool
Static reports whether d has a static part worth keeping: some ops before At paint, and some from At on do too.
type CanvasVertex ¶
CanvasVertex is one corner of a triangle. Position is in canvas points. TexCoord is in image points, as in DrawImageFrom. Color multiplies the sampled texture. Its zero value is opaque white; RGB(0xffffff) is also white and RGBA(0xffffff, 0) is transparent.
type Caret ¶
Caret is a caret position in a text: a UTF-16 offset and the side it is on.
func HitTest ¶
func HitTest(l TextLayout, p Point) Caret
HitTest returns the caret nearest p in l, the start of the text when l does not hit-test.
type CaretCluster ¶
type CaretCluster struct {
Start, End int
Left, Right Points
// RTL says they run right to left: they start at Right.
RTL bool
}
CaretCluster is where characters that take one caret stop at each end (a grapheme cluster, or a ligature) sit on their line: UTF-16 offsets and their left and right edges.
type CaretLayout ¶
type CaretLayout []CaretLine
CaretLayout hit-tests the lines an engine read from its layout, so every engine answers as the others do.
func (CaretLayout) CaretRect ¶
func (cl CaretLayout) CaretRect(c Caret) (Bounds, bool)
CaretRect implements TextHitTester.
func (CaretLayout) HitTest ¶
func (cl CaretLayout) HitTest(p Point) Caret
HitTest implements TextHitTester.
func (CaretLayout) RangeRects ¶
func (cl CaretLayout) RangeRects(start, end int, out []Bounds) []Bounds
RangeRects implements TextHitTester.
type CaretLine ¶
type CaretLine struct {
// Start and End are the UTF-16 offsets of its first character and
// past its last, its line break included.
Start, End int
// Box is the line box: as high as the line, from its left edge to its
// right, in the content box.
Box Bounds
// RTL says the line runs right to left: it ends at its left.
RTL bool
// Clusters are its characters' places in logical order, without its
// line break.
Clusters []CaretCluster
}
CaretLine is a laid-out line as CaretLayout hit-tests it.
type Causes ¶
type Causes struct {
Writes []Write
Memos, Renders, Effects int
// App is how long the app's code ran before the commit, its handlers, timers and effects, and Layout how long the commit laid the tree out; a trace's took is the commit's whole.
App, Layout time.Duration
// Ran are the computations that ran, by kind and the line that made them, the longest first; they are named only while DevTools record sites (devtools.Enabled).
Ran []Ran
}
Causes are what a commit followed from: the signal writes since the graph's last commit, grouped by the line that made them, and the computations that ran.
type Channel ¶
type Channel uint8
Channel is what a shader lane reads of a node: its number, or its color's red, green, blue or alpha, from 0 to 1.
type ClipboardImage ¶
type ClipboardImage struct {
// PNG is the image encoded as a PNG, which an ImageSource's Data
// shows.
PNG []byte
// Size is its size in pixels.
Size Size
// TooLarge is the bytes of a PNG over MaxClipboardImage, left out of
// PNG.
TooLarge int
// Err says why the image the clipboard holds could not be read.
Err string
}
ClipboardImage is an image read from the clipboard, or why the one it holds was not.
func ClipboardPNG ¶
func ClipboardPNG(data []byte) *ClipboardImage
ClipboardPNG is ReadClipboardImage of a PNG whose size it reads, which fails for data that is no PNG.
func ReadClipboardImage ¶
func ReadClipboardImage(png []byte, size Size, err error) *ClipboardImage
ReadClipboardImage is a platform's answer to a ClipboardReadImage from what converting the clipboard's image to a PNG gave: nil when there was nothing to convert.
type ClipboardItem ¶
type ClipboardItem struct {
Representations []ClipboardRepresentation
}
ClipboardItem is one native clipboard item, in the order its formats are offered.
func CloneClipboardItems ¶
func CloneClipboardItems(items []ClipboardItem) []ClipboardItem
type ClipboardRead ¶
type ClipboardRead uint8
ClipboardRead is what an ItemReadClipboard asks of the clipboard.
const ( // ClipboardReadText reads its plain text, "" when it has none. ClipboardReadText ClipboardRead = iota // ClipboardReadHasText reports whether it holds text, without reading it, // so iOS shows no paste notice. ClipboardReadHasText // ClipboardReadImage reads its image as a PNG. ClipboardReadImage // ClipboardReadHasImage reports whether it holds an image, without // reading it. ClipboardReadHasImage // ClipboardReadFiles reads the file: URLs of the local files it holds, // such as files copied in a file manager. ClipboardReadFiles // ClipboardReadItems reads the clipboard's native byte representations. ClipboardReadItems // ClipboardReadChangeCount reads the platform's clipboard sequence number. ClipboardReadChangeCount // ClipboardReadFormats reads native format names without copying payloads. ClipboardReadFormats )
type ClipboardRepresentation ¶
ClipboardRepresentation is the bytes supplied for a platform's native format.
type ClipboardResult ¶
type ClipboardResult struct {
Items []ClipboardItem
Formats []string
ChangeCount int64
Err error
}
ClipboardResult is an EventClipboard for the item, write or change-count request.
type Clock ¶ added in v0.2.0
type Clock struct {
// contains filtered or unexported fields
}
Clock is a surface's frame clock: the animator's time base, the frames the display shows, and the monitor that reads them.
A backend gives it the time its display reports and a way to wake the surface, and keeps no clock of its own: Step moves the animation graph, BeginFrame and EndFrame time the work between two refreshes, and Watched says whether the display has to keep running while nothing animates.
func NewClockAt ¶ added in v0.2.0
NewClockAt returns the clock of animator a's surface counting from epoch, as a backend that already keeps one does.
func (*Clock) BeginFrame ¶ added in v0.2.0
BeginFrame marks the start of the work a frame costs.
func (*Clock) EndFrame ¶ added in v0.2.0
EndFrame closes the frame the work since BeginFrame belongs to, at the refresh now, dirty saying whether the work changed what the screen shows.
period is the display's own period where the platform knows it, and 0 where the clock has to measure the interval between refreshes.
type CodeKind ¶
type CodeKind uint8
CodeKind is a kind of code ItemScanCode reads: a QR code by default.
type Color ¶
type Color uint32
Color is an sRGB color packed as 0xRRGGBBAA, the wire form of mount items. Its zero value is unset: no background, or text color inherited from the parent.
const CurrentColor Color = 0x00000001
CurrentColor, in a style's colors other than the text color itself, is the text color the view has: its own, else the one it inherits, else the engine's default text color, as CSS's currentColor. It never draws as itself.
func MixColors ¶
func MixColors(a, b Color, t float32, space ColorSpace) Color
MixColors returns the color t of the way from a to b, mixed in space with premultiplied alpha, as CSS's gradients and color-mix() mix.
func ParseColor ¶
ParseColor reads a CSS color: hex, rgb(), rgba(), hsl(), hsla(), a color name, transparent or currentColor, which is CurrentColor, as is a color-mix() of it a mark ResolveCurrent reads.
func ResolveCurrent ¶
ResolveCurrent returns c with CurrentColor, or the marks of its mixes, replaced by color.
func (Color) Components ¶
Components returns the red, green, blue and alpha channels from 0 to 1.
type ColorMatrix ¶
type ColorMatrix [20]float32
ColorMatrix is a 4×5 color matrix in rows, over unpremultiplied red, green, blue and alpha from 0 to 1 and a constant 1, as SVG's feColorMatrix.
func (ColorMatrix) Then ¶
func (m ColorMatrix) Then(n ColorMatrix) ColorMatrix
Then returns the matrix that applies m, then n.
type ColorSpace ¶
type ColorSpace uint8
ColorSpace is where a gradient's colors mix between stops.
const ( // ColorSpaceOklab, the zero value, mixes perceptually, without the // grey middle sRGB gives complementary colors; Tailwind's gradients // mix in it. ColorSpaceOklab ColorSpace = iota // ColorSpaceSRGB mixes the channels, as CSS's gradients of plain // colors do. ColorSpaceSRGB ColorSpaceLinearSRGB // ColorSpaceOklch mixes lightness, chroma and hue, the hue the // shorter way round. ColorSpaceOklch )
type ColorStop ¶
ColorStop is a color at a place along a gradient: a percentage of its line (of a turn for a conic gradient) or a length from its start. An auto At, the zero value, spreads the stop evenly between its neighbors.
type CompositeOp ¶
type CompositeOp uint8
CompositeOp is how drawing mixes with what the canvas holds, as the web's globalCompositeOperation: Porter and Duff's operators, then the blend modes.
const ( CompositeSourceOver CompositeOp = iota CompositeSourceIn CompositeSourceOut CompositeSourceAtop CompositeDestinationOver CompositeDestinationIn CompositeDestinationOut CompositeDestinationAtop CompositeLighter CompositeCopy CompositeXor CompositeMultiply CompositeScreen CompositeOverlay CompositeDarken CompositeLighten CompositeColorDodge CompositeColorBurn CompositeHardLight CompositeSoftLight CompositeDifference CompositeExclusion CompositeHue CompositeSaturation CompositeColor CompositeLuminosity )
func (CompositeOp) Blend ¶
func (c CompositeOp) Blend() (BlendMode, bool)
Blend returns the blend mode of a blend operator, which mixes colors and composites as source-over.
func (CompositeOp) Name ¶
func (c CompositeOp) Name() string
Name returns the operator's name on the web.
func (CompositeOp) Unbounded ¶
func (c CompositeOp) Unbounded() bool
Unbounded reports whether the operator changes the canvas outside what is drawn, clearing it there: source-in, source-out, destination-in, destination-atop and copy. Players that composite only where a shape covers draw it into a layer of the whole canvas first.
type Corners ¶
type Corners struct{ TopLeft, TopRight, BottomRight, BottomLeft Points }
Corners holds a radius per corner of a box. Right to left, the core swaps left and right, as it swaps the other sides.
func (Corners) Fit ¶
Fit scales the radii down, all by one factor, until adjacent ones fit along the sides of a box of size, as CSS does with border-radius, and clamps negative ones to 0.
type Cursor ¶
type Cursor uint8
Cursor is the pointer's look over a view (cursor). Auto leaves the look to the view under it or its nearest ancestor that names one; a pressable view's Auto is a pointer on the web.
const ( CursorAuto Cursor = iota CursorDefault CursorPointer CursorText CursorWait CursorProgress CursorHelp CursorCrosshair CursorMove CursorGrab CursorGrabbing CursorNotAllowed CursorZoomIn CursorZoomOut CursorColResize CursorRowResize CursorNone // CursorNwseResize and CursorNeswResize are the diagonal resizes: // top left to bottom right, and top right to bottom left. CursorNwseResize CursorNeswResize )
func SpanCursor ¶
SpanCursor returns the cursor a span names over byte offset i (-1 off the text's glyphs), and false where none does.
type Curve ¶
type Curve struct{ X1, Y1, X2, Y2 float32 }
Curve is an easing curve: CSS's cubic Bézier from (0,0) to (1,1) through two control points. Its zero value is linear.
type CustomCursor ¶
type CustomCursor struct {
Image ImageSource
Image2x ImageSource
Hotspot Point
Fallback Cursor
}
CustomCursor describes an image-based pointer cursor on desktops and the web. Image is the 1x bitmap or vector asset; Image2x is an optional 2x HiDPI image selected automatically when the display scale is at least 1.5. Hotspot is the active point in logical points from the top-left corner, clamped to the image's bounds. Fallback is the named cursor shown when the image is empty or cannot be loaded, and the CSS fallback keyword on the web.
func (*CustomCursor) EffectiveFallback ¶
func (c *CustomCursor) EffectiveFallback(named Cursor) Cursor
EffectiveFallback returns the named fallback cursor for c: c.Fallback when set, otherwise named.
func (*CustomCursor) Empty ¶
func (c *CustomCursor) Empty() bool
Empty reports whether c has neither a 1x nor a 2x cursor image.
func (*CustomCursor) Equal ¶
func (c *CustomCursor) Equal(o *CustomCursor) bool
Equal reports whether c and o specify the same custom cursor.
func (*CustomCursor) Key ¶
func (c *CustomCursor) Key() string
Key returns a cache key identifying c's images, hotspot and fallback.
func (*CustomCursor) LogicalSize ¶
func (c *CustomCursor) LogicalSize() Size
LogicalSize returns the cursor's logical size in points when it can be determined from Image/Image2x metadata, Pixels, or a PNG header without decoding pixel data; zero when unknown.
func (*CustomCursor) SelectSource ¶
func (c *CustomCursor) SelectSource(scale float32) (src ImageSource, is2x bool)
SelectSource picks the ImageSource to use for a display with pixel ratio scale, returning the chosen source and whether it is the 2x HiDPI image. When scale >= 1.5 and Image2x is non-empty, Image2x is chosen; otherwise Image is chosen, falling back to Image2x if Image is empty.
type DecayConfig ¶
type DecayConfig struct {
Velocity float64
Deceleration float64
Clamp bool
Min, Max float64
Bounce float64
}
DecayConfig slows a value from Velocity (units per second; the value's current velocity when 0) by Deceleration per millisecond (0.998 when 0). With Clamp it stays within Min and Max: it stops at a bound, or bounces off it keeping Bounce of its speed.
type DirectoriesRequest ¶
type DirectoriesRequest struct {
// Limit is the most folders the user picks: 1 for a single pick, at
// most MaxPicked.
Limit int
// Title is the dialog's title or message where the target has one.
Title string
// Button is the dialog's accept button label where the target has one.
Button string
// Start is the folder the dialog opens in when it exists.
Start string
}
DirectoriesRequest is a folder pick as the platform carries it out.
type Directory ¶
type Directory struct {
// Name is its name as the user saw it.
Name string
// Path is where it is on disk, "" on Android and the web, where FS
// reads it.
Path string
// FS reads a folder that has no Path.
FS fs.FS
}
Directory is a folder the user picked, which reads what it holds as an fs.FS: names are slash-separated inside it, "." for itself.
func FinishDirectories ¶
func FinishDirectories(r DirectoriesRequest, dirs []Directory) []Directory
FinishDirectories returns dirs as the app gets them: at most r.Limit, each with a name.
type DiscoveryOp ¶
type DiscoveryOp uint8
DiscoveryOp selects a local service discovery operation.
const ( DiscoveryAdvertise DiscoveryOp = iota + 1 DiscoveryBrowse DiscoveryStop )
type DiscoveryReply ¶
type DiscoveryReply struct {
Service LocalService
Removed bool
Error string
}
DiscoveryReply reports a resolved service, its removal, or an operation error.
type DiscoveryRequest ¶
type DiscoveryRequest struct {
Op DiscoveryOp
Service LocalService
}
DiscoveryRequest starts or stops an operation identified by the item's Count.
type DiskSpace ¶
type DiskSpace struct {
// Total is the capacity the system reports.
Total int64
// Available is what the app could write for a user-requested operation.
Available int64
// Opportunistic is what the app could use for prefetching or caches.
Opportunistic int64
}
DiskSpace is the byte counts answered by ItemDiskSpace.
type DiskSpaceResult ¶
DiskSpaceResult is an EventDiskSpace's data.
type DisplayClock ¶
type DisplayClock struct {
// contains filtered or unexported fields
}
DisplayClock brings the stamps of a display whose clock Go cannot read to time.Now's base, as a HarmonyOS web view gets its host's frames over an asynchronous bridge. It keeps the least difference seen between a stamp's arrival and the stamp, the bridge's quickest delivery, so the frames' times keep the display's cadence, never lie ahead of their arrival, and settle on that delivery as quicker ones come.
type DisplayInfo ¶
type DisplayInfo struct {
ID string
Frame Bounds
VisibleFrame Bounds
Scale float32
Main bool
// RefreshRate is the active mode's rate in Hz, or the panel rate when
// the platform reports only that. Zero means the rate is unavailable.
RefreshRate float64
// MaxRefreshRate is the panel's maximum when the platform reports it.
MaxRefreshRate float64
// RefreshRateEstimated marks a rate measured from browser frame callbacks.
RefreshRateEstimated bool
// HDR reports whether the display is currently accepting HDR output
// (extended dynamic range / HDR mode active).
HDR bool
// HDRSupported reports whether the display is capable of HDR output, even
// when HDR mode is currently off in OS settings.
HDRSupported bool
// HDRHeadroom is the display's current peak luminance relative to SDR
// reference white (1.0 for SDR; > 1.0 when HDR headroom is active, such as
// Apple EDR headroom or MaxLuminance / SDRWhiteLevel). Zero means
// unavailable.
HDRHeadroom float32
// SDRWhiteLevel is the display's reference SDR white luminance in nits
// (cd/m²), or zero when unavailable.
SDRWhiteLevel float32
// MaxLuminance is the display's peak HDR luminance in nits (cd/m²), or
// zero when unavailable.
MaxLuminance float32
}
DisplayInfo describes a display in the platform's screen coordinate space. Frame is its whole area; VisibleFrame is the area available to windows. Scale is device pixels per point, and Main marks the primary display.
type DownloadCommand ¶
DownloadCommand is a process-wide request for the background transfer host.
type DownloadProgress ¶
DownloadProgress describes a durable transfer or an update to one running now.
type DrawKind ¶
type DrawKind uint8
DrawKind is a drawing operation.
const ( DrawSave DrawKind = iota + 1 DrawRestore DrawTranslate // X, Y DrawScale // X, Y DrawRotate // A radians DrawBeginPath DrawMoveTo // X, Y DrawLineTo // X, Y DrawQuadTo // X1, Y1 (control), X, Y DrawCubicTo // X1, Y1, X2, Y2 (controls), X, Y DrawArc // X, Y (center), R, A0, A1 (radians), CCW DrawRect // X, Y, W, H DrawRoundRect // X, Y, W, H, R DrawEllipse // X, Y (center), RX, RY DrawClosePath DrawFill // the current path with the fill paint, by EvenOdd's rule DrawStroke // the current path with the stroke settings DrawClip // to the current path, by EvenOdd's rule DrawFillColor // Color, the fill until the next DrawFillGradient DrawStrokeColor // Color, the stroke until the next DrawStrokeGradient DrawLineWidth // W DrawLineCap // Cap DrawLineJoin // Join DrawAlpha // A, the global alpha // DrawFillText draws Text in Font with its baseline starting at X+X1, // Y+Y1: X, Y is the point the app gave and X1, Y1 how far the // recorder moved the text from it for TextAlign and TextBaseline. DrawFillText DrawClear // X, Y, W, H to transparent // DrawFillGradient makes Gradient the fill until the next // DrawFillColor. A recording always sets a fill color before it, the // gradient's first, so a player that does not paint gradients fills // with that color instead. DrawFillGradient // DrawStrokeGradient makes Gradient the stroke until the next // DrawStrokeColor, after a stroke color as DrawFillGradient is. DrawStrokeGradient // DrawTransform multiplies the transform by the matrix with columns // (X1, Y1), (X2, Y2) and (X, Y): the web's transform(a, b, c, d, e, // f) with a, b = X1, Y1, c, d = X2, Y2 and e, f = X, Y. DrawTransform // DrawSetTransform replaces the transform with that matrix, from the // canvas's own coordinates. DrawSetTransform // DrawComposite sets how later drawing mixes with the canvas // (Composite). DrawComposite // DrawLineDash sets the stroke's dashes (Dash; nil or empty is // solid) and DrawLineDashOffset where they start (W). DrawLineDash DrawLineDashOffset // DrawMiterLimit sets how far a miter join reaches, in line widths // (W). DrawMiterLimit // DrawShadow sets the shadow of later drawing: Color (transparent is // none), offset X, Y and blur R, in the canvas's own coordinates, // whatever the transform. DrawShadow // DrawStrokeText draws Text as DrawFillText does, stroked with the // stroke settings. DrawStrokeText // DrawImage draws Image into the rectangle X, Y, W, H, at its natural // size when W and H are 0, from the part X1, Y1, X2 (width), Y2 // (height) of it in its own points, all of it when X2 and Y2 are 0. // The platform loads the image and draws again once it has it. DrawImage // DrawTextAlign and DrawTextBaseline record the TextAlign and // TextBaseline later texts take. The recorder places the texts with // them, so players skip these. DrawTextAlign DrawTextBaseline // DrawVertices draws Image through Mesh, with its bounds in X, Y, W, H. DrawVertices // DrawAtlas draws a list of sprites from Image, in Atlas's order. DrawAtlas )
func (DrawKind) BuildsPath ¶
BuildsPath reports whether an op of kind k adds to the current path or closes it.
type DrawOp ¶
type DrawOp struct {
Kind DrawKind
X, Y, X1, Y1, X2, Y2 float32
W, H, R, A, A0, A1, RY float32
CCW bool
Color Color
Cap LineCap
Join LineJoin
Text string
Font Font
// EvenOdd fills or clips by the even-odd rule instead of the nonzero
// one.
EvenOdd bool
Gradient *CanvasGradient
Composite CompositeOp
Dash *LineDash
Image *ImageSource
Sampling ImageSampling
Mesh *CanvasMesh
Atlas *AtlasSprites
// Tinted multiplies a DrawImage's source channels by Color before it composites.
Tinted bool
// TextAlign and TextBaseline are what a text op was placed with.
TextAlign TextAlign
TextBaseline TextBaseline
}
DrawOp is one operation; Kind says which fields it uses.
type Drawing ¶
type Drawing struct {
Ops []DrawOp
// Slots bind arguments of Ops to animated nodes: the platform plays
// the ops with the nodes' values in their place, and plays them again
// when one changes, with no work on the engine.
Slots []DrawSlot
// Nodes are named parts of what it draws, which assistive technology
// and tests see as the canvas's children.
Nodes []CanvasNode
// ViewPaints name the ops whose value is their canvas view's paint
// (FillFromView and the like), which the core sets before the platform
// plays the drawing.
ViewPaints []ViewPaint
// contains filtered or unexported fields
}
Drawing is a recording of 2D drawing operations, modeled on the web's CanvasRenderingContext2D: a current path, fill and stroke settings, and a transform, saved and restored as a stack. Once handed to the platform it never changes.
Methods that need the path or the transform so far (ArcTo, EllipseArc, FillPath, the queries) replay the operations recorded since they last looked, so a drawing that never asks pays nothing for them.
func NewDrawing ¶
func NewDrawing(text TextEngine) *Drawing
NewDrawing returns an empty drawing that measures text with text, as the core records a Canvas's: MeasureText, TextMetrics and the alignment of texts ask it.
func (*Drawing) Arc ¶
Arc adds an arc of radius r around (x, y) from angle a0 to a1, joined to the path by a line.
func (*Drawing) ArcTo ¶
ArcTo adds an arc of radius r touching the line from the current point to (x1, y1) and the line from there to (x2, y2), joined to the path by a line, as the web's arcTo.
func (*Drawing) Bind ¶
func (d *Drawing) Bind(arg DrawArg, node AnimatedArg) *Drawing
Bind has the platform play the last operation's argument arg with the value of node, every frame it changes, in place of the one recorded. The queries and the text placement read the recorded value.
func (*Drawing) ClipEvenOdd ¶
ClipEvenOdd clips by the even-odd rule.
func (*Drawing) ClipPath ¶
ClipPath clips later drawing to p by rule, leaving the current path as it is.
func (*Drawing) DrawAtlas ¶
func (d *Drawing) DrawAtlas(img ImageSource, rects []Bounds, xforms []RSXform, alphas []float32) *Drawing
DrawAtlas draws tiles from img in one operation, in the order given. Source bounds are in the image's own points, as with DrawImageFrom. Each corresponding transform acts on a tile starting at (0, 0) at its source size. Alpha multiplies the drawing's alpha, defaulting to 1 for entries absent from alphas. Rectangles and transforms are paired up to the shorter slice. Invalid rectangles and transforms are skipped. The drawing keeps a copy of the sprite data.
func (*Drawing) DrawImage ¶
func (d *Drawing) DrawImage(img ImageSource, x, y float32) *Drawing
DrawImage draws img at (x, y) at its natural size.
func (*Drawing) DrawImageFrom ¶
func (d *Drawing) DrawImageFrom(img ImageSource, sx, sy, sw, sh, x, y, w, h float32) *Drawing
DrawImageFrom draws the part sx, sy, sw, sh of img, in its own points, stretched into the rectangle x, y, w, h.
func (*Drawing) DrawImageIn ¶
func (d *Drawing) DrawImageIn(img ImageSource, x, y, w, h float32) *Drawing
DrawImageIn draws img stretched into the rectangle x, y, w, h.
func (*Drawing) DrawSVG ¶
DrawSVG draws svg at (x, y) at its intrinsic size, respecting its preserveAspectRatio and leaving the drawing's state and current path unchanged. Every currentColor takes the drawing's current fill color (or black when none is set), and <text> elements are measured and drawn by the platform's text engine.
func (*Drawing) DrawSVGIn ¶
DrawSVGIn draws svg fitted into the rectangle (x, y, w, h), respecting its preserveAspectRatio and leaving the drawing's state and current path unchanged. Every currentColor takes the drawing's current fill color (or black when none is set), and <text> elements are measured and drawn by the platform's text engine.
func (*Drawing) DrawTintedImage ¶
func (d *Drawing) DrawTintedImage(img ImageSource, tint Color, x, y float32) *Drawing
DrawTintedImage draws img at its natural size, multiplying each image channel by tint's corresponding sRGB or opacity channel before compositing.
func (*Drawing) DrawTintedImageFrom ¶
func (d *Drawing) DrawTintedImageFrom(img ImageSource, tint Color, sx, sy, sw, sh, x, y, w, h float32) *Drawing
DrawTintedImageFrom draws a part of img with the same tint as DrawTintedImage.
func (*Drawing) DrawTintedImageIn ¶
func (d *Drawing) DrawTintedImageIn(img ImageSource, tint Color, x, y, w, h float32) *Drawing
DrawTintedImageIn draws img into a rectangle with the same tint as DrawTintedImage.
func (*Drawing) DrawVertices ¶
func (d *Drawing) DrawVertices(img ImageSource, vertices []CanvasVertex) *Drawing
DrawVertices draws a textured triangle list as one operation. It copies vertices so the caller can reuse its slice on the next frame. Nonfinite and zero-area triangles are ignored, as are trailing vertices that do not make a triangle.
func (*Drawing) Ellipse ¶
Ellipse adds the whole ellipse around (x, y) with radii rx and ry, as a subpath of its own.
func (*Drawing) EllipseArc ¶
EllipseArc adds an arc of the ellipse around (x, y) with radii rx and ry turned by rotation, from angle a0 to a1, joined to the path by a line, as the web's ellipse. Its curves are cubic Béziers.
func (*Drawing) FillBackgroundFromView ¶
FillBackgroundFromView fills the current path with the canvas view's background, Background and Gradients, placed over area as over a box of that size, as CSS's clip-path shows a box's background. The view then draws no background of its own, so a canvas that takes it draws it once, inside its shapes; one with nothing to fill yet records this over an empty path, so its view never shows the background as a box.
func (*Drawing) FillEvenOdd ¶
FillEvenOdd fills the current path by the even-odd rule.
func (*Drawing) FillFromView ¶
FillFromView fills with the canvas view's Fill style, inherited as CSS inherits it, or with initial where no view sets one.
func (*Drawing) FillRect ¶
FillRect fills a rectangle with the fill paint, leaving the current path as it is.
func (*Drawing) FillText ¶
FillText draws text at (x, y), placed by the text alignment and baseline: its baseline's start, by default.
func (*Drawing) HasBackground ¶
HasBackground reports whether d fills shapes with its view's background, which the view then does not draw.
func (*Drawing) IsPointInPath ¶
IsPointInPath reports whether the point (x, y), in the canvas's own points, is inside the current path by rule, as the web's isPointInPath. After Draw returns, a kept drawing answers from all it recorded, so press handlers can hit-test its shapes. Bound arguments count as recorded.
func (*Drawing) IsPointInStroke ¶
IsPointInStroke reports whether the point is on the current path's stroke with the line width, caps and transform in effect; joins count as round and dashes as solid.
func (*Drawing) LineDashFromView ¶
LineDashFromView dashes lines as the canvas view's StrokeDash style says, solid where no view sets one.
func (*Drawing) LineWidthFromView ¶
LineWidthFromView sets the line width to the canvas view's StrokeWidth style, 1 where no view sets one.
func (*Drawing) MeasureText ¶
MeasureText returns the advance width of text in font, its trailing white space included, as a browser's measureText counts it.
func (*Drawing) Node ¶
func (d *Drawing) Node(n CanvasNode) *Drawing
Node names a part of the drawing for assistive technology and tests.
func (*Drawing) Painted ¶
func (d *Drawing) Painted(p *PaintStyle, current Color) *Drawing
Painted returns d with its view paints set from p, current being the view's text color, or d itself when it takes none.
func (*Drawing) PathContains ¶
PathContains reports whether the point is inside p under the current transform, by rule.
func (*Drawing) ResetTransform ¶
ResetTransform goes back to the canvas's own coordinates.
func (*Drawing) RoundRectCorners ¶
func (d *Drawing) RoundRectCorners(x, y, w, h, topLeft, topRight, bottomRight, bottomLeft float32) *Drawing
RoundRectCorners adds a rectangle with a radius for each corner, from the top left one clockwise, scaled down together where they overlap, as the web's roundRect.
func (*Drawing) SetComposite ¶
func (d *Drawing) SetComposite(c CompositeOp) *Drawing
SetComposite sets how later drawing mixes with the canvas.
func (*Drawing) SetFillColor ¶
func (*Drawing) SetFillGradient ¶
func (d *Drawing) SetFillGradient(g *CanvasGradient) *Drawing
SetFillGradient fills with g until the next SetFillColor.
func (*Drawing) SetImageSmoothing ¶
SetImageSmoothing selects how subsequent image draws scale raster images. Smoothing is on by default. Save and Restore keep this setting.
func (*Drawing) SetLineCap ¶
func (*Drawing) SetLineDash ¶
SetLineDash dashes strokes with lengths of dash and gap in turn, an odd list repeated to make it even; none is solid.
func (*Drawing) SetLineDashOffset ¶
SetLineDashOffset starts the dashes offset into their pattern.
func (*Drawing) SetLineJoin ¶
func (*Drawing) SetLineWidth ¶
func (*Drawing) SetMiterLimit ¶
SetMiterLimit sets how far miter joins reach, in line widths; 10 by default.
func (*Drawing) SetShadow ¶
SetShadow shadows later drawing in color, offset by dx, dy and blurred by blur (twice the Gaussian's deviation), in the canvas's own points whatever the transform. A transparent color draws none.
func (*Drawing) SetStrokeColor ¶
func (*Drawing) SetStrokeGradient ¶
func (d *Drawing) SetStrokeGradient(g *CanvasGradient) *Drawing
SetStrokeGradient strokes with g until the next SetStrokeColor.
func (*Drawing) SetTextAlign ¶
SetTextAlign sets where later texts sit along the point they are drawn at: start and left put it at their left end, end and right at their right end, center at their middle.
func (*Drawing) SetTextBaseline ¶
func (d *Drawing) SetTextBaseline(b TextBaseline) *Drawing
SetTextBaseline sets which line of later texts the point they are drawn at sits on.
func (*Drawing) SetTransform ¶
SetTransform replaces the transform with that matrix, as the web's setTransform.
func (*Drawing) StrokeContains ¶
StrokeContains reports whether the point is on p's stroke under the current transform and line style.
func (*Drawing) StrokeFromView ¶
StrokeFromView strokes with the canvas view's Stroke style, or with initial where no view sets one.
func (*Drawing) StrokePath ¶
StrokePath strokes p, leaving the current path as it is.
func (*Drawing) StrokeRect ¶
StrokeRect strokes a rectangle, leaving the current path as it is.
func (*Drawing) StrokeText ¶
StrokeText draws text's outline with the stroke settings, placed as FillText places it.
func (*Drawing) TextMetrics ¶
func (d *Drawing) TextMetrics(text string, font Font) TextMetrics
TextMetrics measures text in font with the platform's text engine, as its first line lays it out; without one it approximates: every character 0.6 of the font size wide, an ascent of 0.8 and a descent of 0.2 of it.
type Easing ¶
type Easing struct {
Kind EasingKind
// Mode turns a curve around; Bézier curves ignore it.
Mode EaseMode
// Bezier is EasingBezier's curve.
Bezier Curve
// Param is Poly's exponent, Elastic's bounciness and Back's
// overshoot; 0 takes React Native's default. It is Steps's count.
Param float64
// Steps is where EasingSteps jumps, as CSS's steps().
Steps StepPosition
}
Easing is how a timing animation or an interpolation segment progresses: a cubic Bézier, or one of React Native's curves. Its zero value is linear.
type EasingKind ¶
type EasingKind uint8
EasingKind is an easing's shape.
const ( EasingBezier EasingKind = iota EasingQuad EasingCubic EasingPoly EasingSin EasingCircle EasingExp EasingElastic EasingBack EasingBounce // EasingSteps jumps through Param equal steps, as CSS's steps(). EasingSteps )
type EdgeColors ¶
type EdgeColors struct{ Top, Right, Bottom, Left Color }
EdgeColors is a color for each side of a box.
func AllColors ¶
func AllColors(c Color) EdgeColors
AllColors returns edge colors of the same color on every side.
func (EdgeColors) Or ¶
func (e EdgeColors) Or(c Color) EdgeColors
Or returns e with its unset sides c.
type EdgeEffect ¶
type EdgeEffect uint8
EdgeEffect is how a scroll view's side sets the views over it, its bars, apart from the content scrolling under them, as iOS 26's scroll edge effects do.
const ( // EdgeEffectAutomatic is soft under the bars; iOS 26 and later also // draw their own under their system bars. EdgeEffectAutomatic EdgeEffect = iota // EdgeEffectSoft blurs the content under the bars progressively, most // at the side, and fades it into the background it scrolls over. EdgeEffectSoft // EdgeEffectHard frosts the content under the bars evenly, with a // hairline along their far edge. EdgeEffectHard // EdgeEffectHidden draws none, under system bars too. EdgeEffectHidden )
type Edges ¶
type Edges struct{ Top, Right, Bottom, Left Points }
Edges holds a length per side.
func (Edges) Horizontal ¶
Horizontal returns the left and right edges together.
type EditAction ¶
type EditAction uint32
EditAction is an editing action of an input's touch edit menu (ItemEditMenu, EventEditAction).
const ( // EditCut cuts the selection. EditCut EditAction = 1 << iota // EditCopy copies the selection. EditCopy // EditPaste pastes from the clipboard through the input's own paste. EditPaste // EditSelectAll selects the whole document or field. EditSelectAll )
type Effects ¶
type Effects struct {
// Shadows are drawn under the box, or inside it over the background
// when inset; the first on top, as CSS orders them.
Shadows []BoxShadow
// Gradients are drawn over the background, under the border, the
// first on top.
Gradients []GradientPaint
// Filters change what the view and its children draw, in order.
Filters []Filter
// BackdropFilters change what is behind the view, under its
// background; platforms draw their blur.
BackdropFilters []Filter
// Mask, when set, is drawn as much as its alpha says, backdrop
// included.
Mask *GradientPaint
}
Effects are the rarer parts of a view's look. They travel behind a pointer, so ViewStyle stays comparable: the core sends the same pointer while they stay Equal.
func (*Effects) BackdropBlur ¶
BackdropBlur is the blur radius of the backdrop filters, 0 for none.
type EllipsizeMode ¶
type EllipsizeMode uint8
EllipsizeMode is where a text cut by its line limit loses the rest.
const ( // EllipsizeTail ends the last line with an ellipsis: "Lorem ips…". // It is the default. EllipsizeTail EllipsizeMode = iota + 1 // EllipsizeHead starts it with one, "…sum dolor", and EllipsizeMiddle // puts one in its middle, "Lorem…dolor". Platforms do it on a single // line; on several lines some cut only the last one's end. EllipsizeHead EllipsizeMiddle // EllipsizeClip cuts the text without an ellipsis. EllipsizeClip )
type Environment ¶
type Environment struct {
// CanSetPageHead says the surface owns the browser document's head. False for embedded surfaces, native targets and simulated test hosts without a document; independent of which OS a web app imitates.
CanSetPageHead bool
// Network is connectivity when a platform or test supplies it with its environment.
Network *Network
// DeviceName is the name the user gave the device, empty where the platform keeps it private (core.Env.DeviceName).
DeviceName string
// DeviceModel is the device's hardware model, empty where it names none (core.Env.DeviceModel).
DeviceModel string
// Displays are the displays the platform reports, in screen coordinates.
Displays []DisplayInfo
// DisplayID names the surface's current display in Displays.
DisplayID string
// SafeArea is the part of each edge that system bars, notches and
// rounded corners cover.
SafeArea Edges
// TitleBar is what a hidden desktop title bar still covers: its
// height on top, its buttons on the left or right.
TitleBar Edges
// WindowMaterial is the material behind the window's content; None
// when the window is opaque.
WindowMaterial WindowMaterial
// WindowTransparent is whether the surface's window or panel draws nothing of its own now: a panel opened with SurfaceConfig.Transparent, or a window opened so or made so by WindowSetTransparent; false where the platform could not make it so, and for any other surface. CanMakeWindowsTransparent is whether a window could be.
WindowTransparent bool
// Maximized is whether the window is maximized or zoomed, so an
// app-drawn maximize button can show restore.
Maximized bool
// FullScreen is whether the window fills its screen in full screen.
FullScreen bool
// Minimized is whether the surface's window is minimized, an embedded surface's host window; false without desktop windows and where the compositor reports no minimized state.
Minimized bool
// WindowFrame is where the window is and how large, as WindowSetFrame
// takes them; zero without a window, and a position only where the
// platform knows one (Move).
WindowFrame WindowFrame
// KeyboardHeight is how much of the bottom the software keyboard
// covers; KeyboardDuration is how long it takes to move.
KeyboardHeight Points
KeyboardDuration time.Duration
Dark bool
// FontScale multiplies text sizes, as the user's text size setting
// asks; 0 means 1.
FontScale float32
ReduceMotion bool
// IncreaseContrast says the user asked the system for stronger contrast.
IncreaseContrast bool
ScreenReader bool
// ScreenColor says ItemPickScreenColor works here.
ScreenColor bool
// Speech says ItemSpeech recognizes speech here, Speak that ItemSpeak speaks text, Audio that ItemAudio plays sounds and players, Gamepads that package gamepad reads game controllers, GPU that KindGPU views can create a GPU device here.
Speech bool
Speak bool
Audio bool
Gamepads bool
GPU bool
// AudioSchedule says ItemAudio honors AudioPlay's StartAt.
AudioSchedule bool
// AudioPlaybackControls says sound playbacks can be addressed and report when they end.
AudioPlaybackControls bool
// HapticPatterns reports support for playing timed haptic events.
HapticPatterns bool
// ClipboardItems says the clipboard supports native representations and a change count.
ClipboardItems bool
// NowPlaying reports ItemNowPlaying support on this platform.
NowPlaying bool
// Camera says ItemTakePhoto shows a camera here.
Camera bool
// ScanCode says ItemScanCode shows a camera that reads codes here.
ScanCode bool
// DiscoverServices says the target can advertise and browse DNS-SD services.
DiscoverServices bool
// CanSendInput says Ref.SendInput can deliver trusted input to web views.
CanSendInput bool
// CanLockPointer says ItemPointerLock can capture relative motion.
CanLockPointer bool
// CanLookUp says ItemLookUp can show the system dictionary panel.
CanLookUp bool
// CanQuickLook says ItemQuickLook can show the system's file preview panel.
CanQuickLook bool
// CanDockPanels says the backend can attach panels to a display's usable edge.
CanDockPanels bool
// CanSetWindowLevel says WindowSetLevel reaches the window's stacking, and CanPlaceWindows that WindowSetFrame's position moves it; false without a desktop window of the surface's own (an embedded view, the app's own hidden surface, a tray icon), the first for an Android overlay, which has no level, and the second on Linux, whose window manager or compositor places windows.
CanSetWindowLevel bool
CanPlaceWindows bool
// CanSetWindowWorkspaces says WindowSetWorkspaces reaches the window's workspaces: on macOS, and on X11 where the window manager lists _NET_WM_DESKTOP in _NET_SUPPORTED; false without a desktop window of the surface's own (an embedded view, the app's own hidden surface, a tray icon, an unmanaged X11 panel), on Windows, which has no public API for it, on Wayland, phones and the web.
CanSetWindowWorkspaces bool
// HasWebView says this target provides a web view host.
HasWebView bool
// SignInWithApple says ItemSignInWithApple and ItemAppleCredentialState reach Sign in with Apple here.
SignInWithApple bool
// MiniProgramSignIn says ItemMiniProgramSignIn reaches the host login API.
MiniProgramSignIn bool
// Purchases says ItemPurchase reaches the platform's store here.
Purchases bool
// CanRequestReview says ItemRequestReview can ask the platform's store to show an in-app rating prompt.
CanRequestReview bool
// CloudStorage says package cloud has a cloud storage backend available here: an Apple device signed into iCloud, Android with Google Play Games saved games, or a test app whose in-memory cloud store is enabled.
CloudStorage bool
// CanUseGameServices says package gameservices reaches a platform game service here: Game Center on macOS, iOS and tvOS where GameKit loads, and Google Play Games Services on Android where available; false on watchOS, Windows, Linux, the web and mini programs.
CanUseGameServices bool
// ScheduledNotifications says ItemShowNotification schedules a notification for a later At, natively where the platform offers a schedule or while the app runs elsewhere.
ScheduledNotifications bool
// CanMakeWindowsTransparent says SurfaceConfig.Transparent and WindowSetTransparent show what is behind the surface's window wherever the app draws nothing, and CanSkipTaskbar that SurfaceConfig.SkipTaskbar and WindowSetSkipTaskbar keep it off the taskbar; both false without a desktop window of the surface's own (an embedded view, the app's own hidden surface, a panel, a tray icon), and where the platform or session has no way (see desktop.CanMakeWindowsTransparent and desktop.CanSkipTaskbar).
CanMakeWindowsTransparent bool
CanSkipTaskbar bool
// VerticalBarEdge is the edge the system chose for a vertical bar where it may place one, as iOS 27.1 does; Unspecified elsewhere. It is not geometry: Tree.Resize reports that.
VerticalBarEdge VerticalBarEdge
// RTL lays the app out right to left.
RTL bool
// PixelRatio is device pixels per point; 0 means 1.
PixelRatio float32
// Locale is a BCP 47 language tag, such as "en-US".
Locale string
// LocaleSettings are how the user reads weeks, times and measures,
// apart from the language, where the platform says.
LocaleSettings LocaleSettings
OS OS
// OSVersion is the system's version: major and minor on Apple
// platforms, Windows and Linux (the kernel's), Android's API level
// as Major, and zero on the web.
OSVersion OSVersion
Idiom Idiom
// Pointer is the precision of the primary pointing device when the platform reports it directly (such as CSS's pointer media query on the web); zero derives it from Idiom.
Pointer Pointer
// Simulated is whether OS and Idiom are ones the platform imitates rather than runs on, as a web build does for --nsgo-os, or whose native parts it lacks, as a mini program on its device's OS: the app's own views take that OS's paths, while its native components, system header, menus and window functions are absent.
Simulated bool
// AppleKeyboard says a browser or a mini program runs on an Apple platform, where "mod" is Command as on macOS and iOS.
AppleKeyboard bool
// KeyCodeNames maps physical positions to unmodified key names on the current keyboard layout, where the platform provides the map.
KeyCodeNames map[string]string
// HeaderHeight and LargeHeaderHeight are the heights of the system
// header a platform draws over screens, without the status bar, and
// with a large title. 0 where screens show their Header instead.
HeaderHeight, LargeHeaderHeight Points
// Lifecycle is whether the app is in use: the window's, an embedded
// surface's the host window's.
Lifecycle Lifecycle
// ThermalState and LowPowerMode describe system power constraints.
ThermalState ThermalState
LowPowerMode LowPowerMode
// AppClip says the app runs as an iOS App Clip, and OpenedURL is the link that last invoked the iOS or Android app, or the current address of a whole-page web app; "" when none was supplied.
AppClip bool
OpenedURL string
// PageURL and PageBaseURL initialize the application address when the surface owns its browser history. Empty on other surfaces and targets.
PageURL, PageBaseURL string
// LaunchedAtLogin says the system started this run as a login item. It stays the same throughout the run, including subsequent reopens.
LaunchedAtLogin bool
// FrontmostApp is the application in front on the desktop, the app itself included, and CanReadFrontmostApp says the platform follows it: on macOS, Windows, X11 and supported Wayland compositors. FrontmostApp is zero where CanReadFrontmostApp is false.
FrontmostApp FrontmostAppInfo
CanReadFrontmostApp bool
// CustomCursor says the platform shows image-based custom cursors (Style.CursorImage): true on macOS, Windows, Linux and the web; false on touch platforms.
CustomCursor bool
}
Environment is what the platform reports about where the app runs. The surface size is not part of it: Tree.Resize reports that.
func Pinned ¶
func Pinned(env Environment, pin func(Environment) Environment) Environment
Pinned is env as pin, a test's pinned preferences, has it, or env itself without a pin: what a backend renders with while it keeps the system's environment for later changes.
func (Environment) Equal ¶
func (e Environment) Equal(other Environment) bool
Equal reports whether two platform environments have the same values. Environment includes a slice of displays, so it cannot use ==.
func (*Environment) FocusesViews ¶ added in v0.2.0
func (e *Environment) FocusesViews() bool
FocusesViews reports whether the platform supports keyboard focus on ordinary views beside text inputs. On mobile platforms this includes explicit Ref.Focus requests without changing how touches focus.
type Event ¶
type Event struct {
Kind EventKind
ID NodeID
Text string
Count uint32
Point Point
// Page is a pointer's position in the root view, the surface or the
// modal, and Modifiers the keys held.
Page Point
Modifiers Modifiers
// Button is the mouse button a mouse event holds down.
Button MouseButton
Size Size
// Loaded and Total are an image's bytes loaded and expected.
Loaded, Total int64
Index int
// Phase, Velocity and Value are a gesture's.
Phase GesturePhase
Velocity Point
Value float32
// Position and PagePosition are the current point of a pan in its view
// and page coordinates. Point remains the pan's translation.
Position, PagePosition Point
Navigation *WebNavigation
// Origin is the origin of the frame that posted a web view's message, as WebOrigin writes it, URL that frame's URL, and MainFrame whether that frame is the page's top one. A backend that cannot tell a frame's origin delivers the top frame's messages alone.
Origin string
URL string
MainFrame bool
// Time, Duration, Buffering and RateChangeable are a video's.
Time, Duration time.Duration
Buffering bool
RateChangeable bool
// URIs are the file: URLs of dropped files.
URIs []string
// Data is what a native component emitted.
Data any
// Ranges are what each text of a selection area has selected, in
// document order (EventSelectionChange), nil on a platform that
// does not report them.
Ranges []SelectedRange
// Repeat is whether EventKeyDown's key is a held key's auto-repeat.
Repeat bool
// KeyCode is the physical position of an EventKeyDown or EventKeyUp, named as KeyboardEvent.code. It is empty when the position is unknown.
KeyCode string
// Forced is whether EventQuitRequest was issued by the system to end its session.
Forced bool
// Finished is whether an animation ran to its end, or the platform
// closed a modal.
Finished bool
// Insets are what system UI covers of a modal (EventModalSize).
Insets Edges
// Touches are EventTouch's fingers.
Touches []Touch
// TouchGeometry is the platform's presentation snapshot for these touches. Without one, core uses the committed layout and static transforms.
TouchGeometry *TouchGeometry
// Values are the values a pan moves as it begins and ends
// (Animator.Gesture).
Values Point
// Delta and Precise are a wheel's (EventWheel).
Delta Point
Precise bool
}
Event is one report from the platform to the engine.
func AuthEnd ¶ added in v0.2.0
AuthEnd is the event ending session id with err, one of the Auth errors, and message.
func CaptureResult ¶
CaptureResult answers a capture request with the PNG or an error.
func DiskSpaceEvent ¶
DiskSpaceEvent answers ItemDiskSpace count.
func NoAuthSession ¶ added in v0.2.0
NoAuthSession is how a platform without auth sessions answers an ItemAuthSession: its start ends unavailable, and the rest needs no answer. ok reports whether there is an event to dispatch.
func NoBiometric ¶
NoBiometric is how a platform without biometric authentication answers a biometric request: no kind for availability, unavailable for authentication.
func NoNotification ¶ added in v0.2.0
NoNotification is how a platform that shows no notifications answers ItemNotificationPermission and ItemShowNotification: the permission is unavailable, and the notification is not shown.
func NoPackageInstaller ¶
NoPackageInstaller answers a package install on a platform without one.
func NoSensor ¶ added in v0.2.0
NoSensor is the explicit answer of a backend with no sensor provider.
func NoWebCookies ¶ added in v0.2.0
NoWebCookies is the answer of a platform without a store to it.
func SaveResult ¶
func SaveResult(r SaveRequest, id uint32, path string) Event
SaveResult writes what r saves to path and returns the answer to the app's request. It is a function, not a method, so core's SaveRequest alias does not reach driver.Event.
type EventKind ¶
type EventKind uint8
EventKind is what a platform reports about a view.
const ( // EventPress is a completed press: tap, click or accessibility action. EventPress EventKind = iota + 1 // EventPressDown and EventPressUp bracket a press as it happens. EventPressDown EventPressUp // EventLongPress is a press held past the platform's delay. // // The four press events carry the position in the view (Point) and in // its root view (Page), the Modifiers held when the press began and // the click count (Count), where the platform knows them. EventLongPress // EventMouseEnter and EventMouseLeave follow a pointer over a view: // Point, Page, Modifiers and Button as EventMouseMove's, where the // platform knows them. EventMouseEnter EventMouseLeave // EventFocus and EventBlur follow keyboard focus. EventFocus EventBlur // EventChangeText carries a text field's text after a user edit // (Text) and the edit's number (Count). EventChangeText // EventSubmitEditing is Return in a text field (Text). EventSubmitEditing // EventScroll carries a scroll view's or multiline input's offset (Point), the ItemScrollTo and ItemScrollBy items it applied since it was made (Count), its zoom scale (Value) when it zooms, and for a multiline input optionally its scrollable content size relative to its frame (Size). EventScroll // EventLoadStart, EventProgress (Loaded, Total), EventLoad (Size, the source's pixels), EventError (Text) and EventLoadEnd follow an image view's loading. A web view reports EventLoadStart and EventLoad with its Navigation, and EventError with the URL in Navigation and a *WebFailure in Data when the platform supplies a domain and code. A video reports EventLoadStart, EventLoad (Duration and Size, in points), EventProgress (Time and Duration) and EventError, with why it failed in Index (VideoErrorOther, ...). EventLoadStart EventProgress EventLoad EventError EventLoadEnd // EventPressOutside is a press starting outside the overlay ID, at // Point in surface points. EventPressOutside // EventBack is Escape, the back button or gesture, or the browser's // back; the engine routes it to the topmost overlay, modal or stack. // With the ID of a screen it is that screen's header's back button or // swipe, which goes to the screen's stack while the screen is on top. EventBack // EventAlert answers ItemAlert Count with the button at Index, or -1. EventAlert // EventClipboard answers ItemReadClipboard Count with what it read: // the Text, the image in Data (a *ClipboardImage, nil for none), the // files' URIs, or whether the clipboard has text or an image // (Finished). EventClipboard // EventContextMenu is a secondary click (right click, control click) // on ID at Point in the view's coordinates and Page in its root // view's, with the Modifiers held. EventContextMenu // EventKey is a key press matching a binding of the keymap, Count the ID of the binding FindKey chose (KeyBinding.ID): the engine runs that binding if it still lives and may fire, and no other in its place. EventKey // EventPan follows an active pan: its phase (Phase), translation // (Point) and velocity (Velocity). EventPan // EventPinch and EventRotation follow a pinch's scale and a rotation's // angle in radians (Value) with their phase (Phase) and velocity // (Velocity.X). EventPinch EventRotation // EventMenu is an application menu item chosen (Count, its ID). EventMenu // EventMessage carries what a web view's page posted (Text), with the Origin and URL of the frame that posted it and whether that frame is the page's top one (MainFrame). EventMessage // (Navigation). EventNavigationStateChange // EventEnd is a video reaching its end, also when it repeats. EventEnd // EventBuffer is a video starting or stopping waiting for data // (Buffering). EventBuffer // EventFileDragEnter and EventFileDragLeave follow files dragged over // the view that would receive them, and EventFileDrop delivers them // (URIs). EventFileDragEnter EventFileDragLeave EventFileDrop // EventNative is an event a native view's component emitted: its // name (Text) and Data. EventNative // EventNativeSize is the size a native view's component asks for // (Size). EventNativeSize // EventAnimation reports an animation's end or a value read (Count, // the request), with Finished and the value's Value. EventAnimation // EventScrollDragStart and EventScrollDragEnd bracket the user // dragging a scroll view, its content or its scroll bar, and // EventMomentumStart and EventMomentumEnd the glide or snap after; // each carries the offset (Point), the scrolls applied (Count) and // zoom scale (Value) as EventScroll does. EventScrollDragStart EventScrollDragEnd EventMomentumStart EventMomentumEnd // EventRefresh is the user pulling a refreshable scroll view past // its top; the platform shows its spinner until a config says else. EventRefresh // EventImageInfo answers ItemImageInfo Count with the image's Size in // pixels, or the error in Text. EventImageInfo // EventSelectionChange carries a text field's selection after the user moved it: Index to Count, in UTF-16 units. On a selection area it carries the selected text as a copy gives it (Text) and the box of the texts its selection touches, in the area (Point and Size), no Text and no Size for no selection; the platform sends it again when either changes, or when the ranges do. Ranges is what each text of the area has selected, in document order, nil on a platform that does not report them. EventSelectionChange // EventKeyPress is a key typed in a text field (Text: what it enters, // "Backspace" or "Enter"). EventKeyPress // EventCompositionChange follows an input method's composition in a // text field: the text being composed (Text) as it starts and // changes, then its end (Finished), after the EventChangeText of the // text it commits. EventCompositionChange // EventAccessibilityAction is an action assistive technology // performed on ID, by name (Text). EventAccessibilityAction // EventRequestClose asks to close the modal ID for the reason Text // ("swipe" for an iOS sheet); Finished says the platform closed it. EventRequestClose // EventModalSize is the Size and Insets of a modal the platform // presents at a size of its own, such as an iOS sheet. EventModalSize // EventMouseMove is the mouse moving over the view, with or without a // button down, or a modifier key changing while it rests there with // none down: Point, Page and Modifiers as EventContextMenu's, and // Button. Android's runtime numbers it EVENT_HOVER_MOVE. EventMouseMove // EventDownload reports a download of a web view that asked for them // (Data, a *WebDownload). EventDownload // EventTouch reports the fingers on the surface (Touches, with their // PagePosition and Changed) as one goes down (Phase GestureBegan), // moves (GestureChanged), lifts (GestureEnded) or the system takes // them (GestureCancelled), at Time. Platforms send it while a view's // mask has it, with no ID, or with the ID of the view a finger went // down on, which then starts its path; a mouse is finger 0. EventTouch // EventCaretMove is where a focused input's caret is: Point and Size // in the input's view. EventCaretMove // EventPaste is what the user pasted into an input (Data, a // *PasteEvent), before the text it inserts is reported. EventPaste // EventScreenHeader is the height of a screen's system header bar (Value), its large title shown, as the platform measured it; the status bar above it is the core's to add. Size.Width, when positive, is the room the bar leaves for its TitleView between its ends. EventScreenHeader // EventOpenURL answers ItemOpenURL Count with whether the URL opened // (Finished). EventOpenURL // EventPick answers ItemPickImages or ItemTakePhoto Count with the files picked or the photo taken (Data, a []PickedFile), none when the user cancelled, and ItemScanCode Count with the code read (Data, a *ScannedCode), none when the user closed the scanner; a photo or a scan that failed says why in Text. EventPick // EventMenuClosed answers ItemPopupMenu Count once its menu closed, // after the EventMenu of an item chosen. EventMenuClosed // EventBackStarted says a back gesture began, before its EventBack or // EventBackCancelled: the engine answers with ItemBackPreview and lays // the screen it would uncover out under the one it pops. EventBackStarted // EventBackCancelled says the back gesture EventBackStarted announced // was given up. EventBackCancelled // EventScrollEnd says a scroll view came to rest: a drag that set // nothing in motion ended, or a glide, a snap, an animated scroll or // the wheel's turns did; with the offset as EventScroll's. EventScrollEnd // EventWheel is a mouse wheel's turn or a touchpad's scroll over a // view at Point, moving the content by Delta, with the Modifiers held. // Precise marks a touch surface's, whose gesture reports its Phase; // a wheel's turns are GestureChanged. A gesture let go where the // platform has no momentum of its own ends with its Velocity. EventWheel // EventFiles answers ItemPickFiles Count with the files picked (Data, // a []File), ItemPickDirectories Count with the folders picked (a // []Directory), none when the user cancelled, ItemSaveFile Count // with whether the file was saved (Finished) and, on desktops, the // path it was saved at (a string), ItemOpenFile Count with // whether an app opened the file, ItemShare Count with whether the // share sheet showed, ItemInstallPackage Count with whether Linux // installed the package or Android opened the installer, // ItemCanInstallPackages Count with whether the // app may install packages and ItemInstallSettings Count with whether // the setting opened (all Finished). ItemCapture returns the PNG in Data ([]byte); Text is what failed. EventFiles // EventModalShown and EventModalDismissed report that the platform // finished presenting modal ID and taking it away, where it says so. EventModalShown EventModalDismissed // EventScreenInsets reports what covers screen ID's content (Insets): // its header and the system's bars, where the platform measures them. EventScreenInsets // EventWindowClose reports that the user asked to close the surface's // window; the core closes it unless the app keeps it. EventWindowClose // EventWindowHidden reports that the platform hid the surface's // window, as a panel hides when it loses the focus. EventWindowHidden // EventReopen reports that the user opened the app again while it // ran: from the Dock, or by launching it a second time. EventReopen // EventOpenFiles reports files the system asks the app to open (Data, // a []string of paths): from the Finder, or named when it launched. EventOpenFiles // EventTray reports a click on tray icon Count: Index 0 for the // primary button, 1 for the secondary. Data is the icon's Bounds in // desktop screen points when the system supplies them, nil otherwise. EventTray // EventHotKey reports the global shortcut whose ID is Count. EventHotKey // EventLaunchAtLogin answers ItemLaunchAtLogin Count with whether the // system starts the app at login (Finished). EventLaunchAtLogin // EventSpeech reports speech session Count (Data, a *SpeechEvent). EventSpeech // EventUpdate answers ItemCheckForUpdates Count: Finished when the // platform's own updater showed what it found, else Data, an *Update. EventUpdate // EventInputModality reports what the user gave the surface input // with last (Count, ModalityKeyboard or ModalityPointer), before the // focus moves it causes: the core shows the focus (focus-visible:) by // it. EventInputModality // EventNotification answers ItemNotificationPermission and // ItemShowNotification Count. EventNotification // EventNotificationPress reports that the user pressed the // notification whose ID is Text, the one that started the app // included. EventNotificationPress // EventBiometric answers an ItemBiometricAvailability or // ItemBiometricAuthenticate request: Index is a kind or result. EventBiometric // EventQuitRequest delivers a user or system quit request. Count identifies the request the app answers with ItemQuitResponse. Forced marks a system session ending, which does not wait for the answer. EventQuitRequest // EventOverlayPermission answers ItemOverlayPermission Count with the permission as Index. EventOverlayPermission // EventWindowEnded reports that the platform ended the surface's window itself, for the reason Index (OverlayEndDenied, ...), as Android ends an overlay it refuses or removes and iOS a scene the system discards: the core closes it, and OnClosing has no say. EventWindowEnded // EventPermission answers ItemPermission Count, after the kinds Android's Protocol.java mirrors: Index is the permission's status (PermissionNotAsked, ...), and Finished says whether PermissionOpenSettings opened the settings. EventPermission // EventAudio reports sound or player Count (Data, an *AudioEvent). EventAudio // EventWindowPlacementFailed reports that a panel could not be placed at the requested screen rectangle. Text explains the platform reason. It is appended so Android's wire event numbers stay compatible. EventWindowPlacementFailed // EventHotKeyState answers global shortcut Count of the latest ItemHotKeys with its registration state, a HotKeyState, in Index, after the kinds Android's Protocol.java mirrors so that they keep their values. EventHotKeyState // EventAuthSession reports auth session Count (Data, an *AuthEvent). EventAuthSession // EventOpenLinks reports links of the app's own URL schemes the system asks the app to open (Data, a []string of URLs): clicked elsewhere, or the one it launched to open. The browser reports address traversals as *PageAddressChange through the same application hand-off. EventOpenLinks // EventSignInWithApple answers ItemSignInWithApple or ItemAppleCredentialState Count: Data an *AppleCredential or Index a credential's state, else Text why it failed (AppleSignInCancelled, ...). EventSignInWithApple // EventDockMenu reports the app icon menu's item Count chosen, after the kinds Android's Protocol.java mirrors. EventDockMenu // EventSpeak reports utterance Count's end, or answers ItemSpeak Count's SpeakVoices (Data, a *SpeakEvent). EventSpeak // EventSensor delivers a SensorReport or a coalesced SensorPacket. EventSensor // EventPurchase answers ItemPurchase Count with Data, a *PurchaseAnswer. EventPurchase // EventPurchaseUpdate reports a transaction the store made or changed outside a purchase the app asked for (Data, a *Transaction): a renewal, a purchase approved after Ask to Buy, one made on another device or a refund, and at launch those the app has not finished. EventPurchaseUpdate // EventWebCookies answers ItemWebCookies Count, Text why it failed (NoWebCookieStore where the platform has no store) and Data the []WebCookie a WebCookiesList picked. EventWebCookies // EventOpenScene reports that the platform connected a scene beyond the ones the app shows, which it numbers Count, as iPadOS connects one for each window the user opens: the core opens a SurfaceScene showing the main view, whose ItemOpenSurface names Count as its Scene for the platform to attach. EventOpenScene // EventKeyUp reports a key coming up that went down while view ID had the keyboard focus, or with ID 0 one that went down while no view hearing keys had it, after its EventKeyDown: Text is the name the down reported, Modifiers the keys still held, the released one not among them, and Repeat false. The platform reports it asynchronously (Engine.Dispatch), as an up cannot be consumed, for each down it reported, wherever the focus has gone since, and an up for every key still held when the window loses the focus. It names a view but is never in a mask: a view that hears keys has EventKeyDown's bit, which a kind past 63 could not have, as Android's runtime shifts a kind into a 64-bit mask. EventKeyUp // EventMouseUp reports a mouse button coming up (Button, Count the consecutive click count, Point in the view, Page in its root view, Modifiers the keys held) on the view its down went to (ID), or with ID 0 when no view hearing mouse buttons was under the pointer, and for every held button when the window loses focus (with zero Count and Modifiers). Like EventKeyUp, it is never in a mask: a view that hears mouse buttons has EventMouseDown's bit, which a kind past 63 could not have. EventMouseUp // EventGPU reports a GPU view lifecycle, resize, error, or readback event for view ID (Data, a *GPUEvent). It is never in an EventMask. EventGPU // EventSavePreflight asks the app to check the save destination in Text // for ItemSaveFile Count. ItemSavePreflightAnswer allows or refuses it. EventSavePreflight // EventDiskSpace answers ItemDiskSpace Count with a DiskSpaceResult in Data. It is never used in an EventMask. EventDiskSpace // EventDiscovery reports local service operation Count with a *DiscoveryReply in Data. EventDiscovery EventShared // EventCursorPoint answers ItemCursorPoint Count. Finished reports availability, and Point is in desktop screen coordinates. EventCursorPoint // EventPointerDelta carries a PointerDelta from the lock numbered Count. EventPointerDelta // EventPointerUnlocked says the lock numbered Count was released or refused. EventPointerUnlocked // EventEditAction is an action chosen from the edit menu ItemEditMenu opened on input ID (Count is the EditAction: EditCut, EditCopy or EditSelectAll; Paste runs the input's own EventPaste). Like EventKeyUp and EventMouseUp, it is never in a view's EventMask. EventEditAction // EventMiniProgramSignIn answers ItemMiniProgramSignIn Count, Data a *MiniProgramCredential, or Text a stable failure code. EventMiniProgramSignIn // EventMediaCommand carries a MediaCommand in Data for publication Count. It has no EventMask bit. EventMediaCommand )
EventKeyDown reports a key going down on view ID, which has the keyboard focus, before the keymap matches it: Text is the key's name as NormalizeKey writes it without modifiers ("k", "space", "f5", or "shift", "ctrl", "alt" and "meta" for a modifier pressed alone), Modifiers the keys held, the pressed one included, and Repeat whether it is a held key's auto-repeat. Its bit in a view's mask means the view hears keys, going down and coming up (EventKeyUp). The platform asks the engine synchronously (Engine.DispatchKeyDown) and takes the key from the keymap and the view when the view's handler consumes it. Where no view that hears keys has the focus and the surface asked for held keys (MountItem.HeldKeys), it reports the down asynchronously with ID 0 and consumes nothing. An EventMask has no room for another kind, so it shares EventKey's, a binding's press that names no view and so is never in a view's mask: a binding's press has a Count, and a key down has an ID, or neither when no view hears it.
const EventMouseDown EventKind = EventAlert
EventMouseDown reports a mouse button going down on view ID (Button, Count the consecutive click count, Point in the view, Page in its root view, Modifiers the keys held), or with ID 0 when no view under the pointer hears mouse buttons and the surface asked for held mouse buttons (MountItem.HeldMouseButtons). Its bit in a view's mask means the view hears mouse buttons, going down and coming up (EventMouseUp). An EventMask has no room for another kind, so it shares EventAlert's, an answer that names no view and never carries a Button: a mouse button down always has Button != MouseButtonNone.
const EventVideoPause EventKind = EventImageInfo
EventVideoPause reports that the platform paused video ID, not the app's Paused: Index is why (VideoPauseInterruption, ...). An EventMask has no room for another kind, so it shares EventImageInfo's, an answer that names no view and is never in a mask; Android's Protocol.java mirrors it.
const EventVideoPlay EventKind = EventMenuClosed
EventVideoPlay reports that the platform played video ID, not the app's Paused. It shares EventMenuClosed's kind as EventVideoPause shares EventImageInfo's.
EventWebOpenWindow carries a WebWindowRequest in Data. A web view and a video use the same bit for different events.
type Extrapolate ¶
type Extrapolate uint8
Extrapolate is what an interpolation does outside its input range; 0 clamps.
const ( // ExtrapolateClamp keeps the first or last output. ExtrapolateClamp Extrapolate = iota + 1 // ExtrapolateExtend continues the first or last segment. ExtrapolateExtend // ExtrapolateIdentity returns the input unchanged. ExtrapolateIdentity )
type Family ¶
type Family struct {
Kind FamilyKind
Name string
}
Family is a family of a fontFamily list.
func FontFamilies ¶
FontFamilies reads a fontFamily value, most preferred first, as CSS lists families: names separated by commas, each trimmed and unquoted (`Inter, "Noto Sans SC", sans-serif`). A quoted name runs to its closing quote, commas and all, and is always a family's name. Text is set in the first family a platform has, and a character that family lacks in the next that has it.
type FamilyKind ¶
type FamilyKind uint8
FamilyKind is what a family of a fontFamily list names.
const ( // FamilyNamed is a family installed or registered by the app. FamilyNamed FamilyKind = iota // FamilySystem is the system font: system-ui, sans-serif and their // kind. FamilySystem FamilySerif FamilyMonospace // FamilyRounded is the system's rounded font, where it has one. FamilyRounded )
type File ¶
type File struct {
// Name is its name as the user saw it.
Name string
// MIME is its media type, application/octet-stream when nothing says.
MIME string
Size int64
// Modified is when it last changed, zero when the platform does not
// say.
Modified time.Time
// Path is where it is on disk, "" on the web, where Opener reads it.
Path string
// Temporary says Path is a copy the platform made in the app's own
// storage, as iOS and Android do, which the app deletes once it is
// done with it; elsewhere Path is the user's file.
Temporary bool
// Opener opens a file that has no Path.
Opener func() (io.ReadCloser, error)
}
File is a file the user picked.
func FinishFiles ¶
func FinishFiles(r FilesRequest, files []File) []File
FinishFiles returns files as the app gets them: at most r.Limit, each with a name, a type and, for one on disk, its size and modification time.
type FilesRequest ¶
type FilesRequest struct {
// Limit is the most files the user picks: 1 for a single pick, at
// most MaxPicked.
Limit int
// Title is the dialog's title or message where the target has one.
Title string
// Button is the dialog's accept button label where the target has one.
Button string
// TypesName names Types in the filter menu where the target has one.
TypesName string
// Start is the folder the dialog opens in when it exists.
Start string
// Types are the files offered: lower-case media types
// (application/pdf), families (image/*) and extensions (.zip). None
// offers every file.
Types []string
}
FilesRequest is a file pick as the platform carries it out.
func (FilesRequest) Extensions ¶
func (r FilesRequest) Extensions() (exts []string, any bool)
Extensions returns r's types as extensions without dots, for dialogs that filter only by them: a media type becomes the extensions of its files, and any reports that one has none, so the dialog must offer every file.
func (FilesRequest) MIMETypes ¶
func (r FilesRequest) MIMETypes() (types []string, any bool)
MIMETypes returns r's types as media types, for pickers that filter only by them: an extension becomes its type, and any reports that one has none, so the picker must offer every file.
type Filter ¶
type Filter struct {
Kind FilterKind
// Amount is the function's argument: the blur's radius in points,
// hue rotation's degrees, opacity's alpha, otherwise a factor, where
// 1 leaves brightness, contrast and saturation as they are and gives
// the full effect of grayscale, invert and sepia.
Amount float32
// Shadow is a drop shadow's offset, blur and color.
Shadow BoxShadow
}
Filter is one of CSS's filter functions. Filters apply in order; the constructors in core make them.
func (Filter) Matrix ¶
func (f Filter) Matrix() (ColorMatrix, bool)
Matrix returns the color matrix of a color filter, as CSS's Filter Effects define them, and false for a blur or a drop shadow.
type FilterKind ¶
type FilterKind uint8
FilterKind is which filter function a Filter is.
const ( FilterBlur FilterKind = iota + 1 FilterBrightness FilterContrast FilterGrayscale FilterHueRotate FilterInvert FilterOpacity FilterSaturate FilterSepia // FilterDropShadow draws a shadow of what the view draws, in its // shape rather than its box's. FilterDropShadow )
type FolderEntry ¶
type FolderEntry struct {
Name string
Dir bool
Size int64
Modified time.Time
// Handle is what the platform reads it by: a document's ID on
// Android, a handle on the web.
Handle any
}
FolderEntry is a file or folder a folder holds, as its platform lists it.
type FolderSource ¶
type FolderSource interface {
// List lists the folder e at name.
List(name string, e FolderEntry) ([]FolderEntry, error)
// Open opens the file e at name.
Open(name string, e FolderEntry) (io.ReadSeekCloser, error)
}
FolderSource is how a platform reads a folder without a path. Names are slash-separated inside the folder, "." for itself.
type Font ¶
type Font struct {
// Family is a font family name; empty is the system font, and
// FontMonospace the platform's fixed-pitch font.
Family string
// Language is the text's BCP 47 tag, which picks the glyph forms of characters several languages share, such as Han, and the fallback fonts and line breaking where the platform's text stack takes it; empty is the platform's own choice.
Language string
Size Points
Weight FontWeight
Italic bool
// Variant turns on OpenType features: small capitals and the forms
// and widths of figures.
Variant FontVariant
}
Font is what a text engine needs to pick a font.
type FontExtent ¶
type FontExtent struct {
// Ascent and Descent reach above and below the baseline; both are
// positive.
Ascent, Descent Points
XHeight Points
}
FontExtent is the vertical metrics of the font around an attachment: its placeholder's.
type FontRegistrar ¶
FontRegistrar is a TextEngine that registers fonts as the app runs, as a TSX module's imports do: RegisterFont makes the families of the font file data (TrueType, OpenType or a collection) available to the text it prepares from then on. A platform that loads a font later tells the engine (FontsChanged), which prepares its text and records its canvases again.
type FontVariant ¶
type FontVariant uint8
FontVariant is a set of OpenType features, as CSS's font-variant-caps and font-variant-numeric set them; the values combine.
const ( // FontVariantNormal is a variant that turns no feature on: a style // sets it to undo an inherited variant. Engines ignore it. FontVariantNormal FontVariant = 1 << iota // FontSmallCaps draws lowercase letters as small capitals (smcp). FontSmallCaps // FontOldstyleNums draws figures that rise and fall as lowercase // letters do (onum); FontLiningNums draws them at the capitals' // height (lnum). FontOldstyleNums FontLiningNums // FontTabularNums gives every figure the same width (tnum), so a // changing value keeps its place; FontProportionalNums gives each its // own (pnum). FontTabularNums FontProportionalNums )
func (FontVariant) Tags ¶
func (v FontVariant) Tags() []string
Tags returns the OpenType tags of the features v turns on.
type FontWeight ¶
type FontWeight uint16
FontWeight is a CSS font weight from 100 to 900; 0 is unset.
const ( FontWeightLight FontWeight = 300 FontWeightNormal FontWeight = 400 FontWeightMedium FontWeight = 500 FontWeightSemibold FontWeight = 600 FontWeightBold FontWeight = 700 )
type FrameRateRange ¶
type FrameRateRange struct {
Minimum, Maximum, Preferred float32
}
FrameRateRange is the surface's requested display rate in Hz.
type FrontmostAppInfo ¶ added in v0.2.0
type FrontmostAppInfo struct {
// ID is the macOS bundle identifier, else the executable's path; a packaged Windows app's AUMID, else its executable's path; on X11 the GTK application ID, else WM_CLASS; or the Wayland application ID. "" where the platform will not say, as Windows for a process it refuses to open.
ID string
// Name is the app's display name: macOS's localized name, a packaged Windows app's shell display name, else its executable's file description or file name; WM_CLASS on X11; or the desktop entry's name on Wayland, falling back to its application ID.
Name string
// PID is its process ID, 0 when unknown.
PID int
// FullScreen is whether its frontmost window is in full screen, not merely maximized.
FullScreen bool
}
FrontmostAppInfo is the application in front on the desktop.
type GPUAddressMode ¶
type GPUAddressMode uint8
GPUAddressMode selects texture coordinate wrapping behavior.
const ( GPUAddressClampToEdge GPUAddressMode = iota GPUAddressRepeat GPUAddressMirrorRepeat )
type GPUBindGroupDesc ¶
type GPUBindGroupDesc struct {
Label string
Layout GPUID
Entries []GPUBindGroupEntry
}
GPUBindGroupDesc describes a bind group instance.
type GPUBindGroupEntry ¶
type GPUBindGroupEntry struct {
Binding uint32
Buffer GPUID
Offset uint64
Size uint64
Texture GPUID
Sampler GPUID
}
GPUBindGroupEntry binds a buffer, texture, or sampler to a slot.
type GPUBindGroupLayoutDesc ¶
type GPUBindGroupLayoutDesc struct {
Label string
Entries []GPUBindGroupLayoutEntry
}
GPUBindGroupLayoutDesc describes a bind group layout.
type GPUBindGroupLayoutEntry ¶
type GPUBindGroupLayoutEntry struct {
Binding uint32
Visibility GPUShaderStageFlags
Type GPUBindingType
HasDynamicOffset bool
}
GPUBindGroupLayoutEntry describes one binding slot in a bind group layout.
type GPUBindingType ¶
type GPUBindingType uint8
GPUBindingType classifies an entry in a bind group layout.
const ( GPUBindingUniform GPUBindingType = iota GPUBindingStorageRead GPUBindingTexture GPUBindingSampler GPUBindingComparisonSampler GPUBindingStorage GPUBindingStorageTexture )
type GPUBlendComponent ¶
type GPUBlendComponent struct {
SrcFactor GPUBlendFactor
DstFactor GPUBlendFactor
Operation GPUBlendOperation
}
GPUBlendComponent describes one channel (color or alpha) blend equation.
type GPUBlendFactor ¶
type GPUBlendFactor uint8
GPUBlendFactor specifies a source or destination blend multiplier.
const ( GPUBlendZero GPUBlendFactor = iota GPUBlendOne GPUBlendSrc GPUBlendOneMinusSrc GPUBlendSrcAlpha GPUBlendOneMinusSrcAlpha GPUBlendDst GPUBlendOneMinusDst GPUBlendDstAlpha GPUBlendOneMinusDstAlpha GPUBlendConstant GPUBlendOneMinusConstant )
type GPUBlendOperation ¶
type GPUBlendOperation uint8
GPUBlendOperation specifies how blended source and destination terms combine.
const ( GPUBlendAdd GPUBlendOperation = iota GPUBlendSubtract GPUBlendReverseSubtract GPUBlendMin GPUBlendMax )
type GPUBlendState ¶
type GPUBlendState struct {
Color GPUBlendComponent
Alpha GPUBlendComponent
}
GPUBlendState configures color and alpha blending for a color target.
type GPUBufferDesc ¶
type GPUBufferDesc struct {
Label string
Size uint64
Usage GPUBufferUsage
Data []byte
}
GPUBufferDesc describes a GPU buffer allocation.
type GPUBufferUsage ¶
type GPUBufferUsage uint32
GPUBufferUsage is a bitmask of permitted uses for a GPU buffer.
const ( GPUBufferVertex GPUBufferUsage = 1 << iota GPUBufferIndex GPUBufferUniform GPUBufferStorage GPUBufferCopySrc GPUBufferCopyDst GPUBufferIndirect )
type GPUColorAttachment ¶
type GPUColorAttachment struct {
Texture GPUID
ResolveTarget GPUID
MipLevel uint32
ArrayLayer uint32
LoadOp GPULoadOp
StoreOp GPUStoreOp
ClearColor Color
}
GPUColorAttachment configures one color target of a render pass. Texture == 0 targets the view's swapchain drawable.
type GPUColorSpace ¶
type GPUColorSpace uint8
GPUColorSpace selects the color space and transfer function of a GPU view's swapchain.
const ( // GPUColorSpaceDefault selects the platform's default SDR swapchain color space (sRGB). GPUColorSpaceDefault GPUColorSpace = iota // GPUColorSpaceSRGB is standard sRGB (Rec. 709 primaries, sRGB transfer, [0, 1] range). GPUColorSpaceSRGB // GPUColorSpaceExtendedLinearSRGB is linear-light extended-range sRGB / scRGB // (Rec. 709 primaries, linear transfer, 1.0 = SDR reference white, values > 1.0 for HDR). GPUColorSpaceExtendedLinearSRGB // GPUColorSpaceHDR10PQ is BT.2020 primaries with SMPTE ST 2084 (PQ) transfer. GPUColorSpaceHDR10PQ // GPUColorSpaceHDR10HLG is BT.2020 primaries with Hybrid Log-Gamma (HLG) transfer. GPUColorSpaceHDR10HLG // GPUColorSpaceDisplayP3 is Display P3 primaries with sRGB transfer. GPUColorSpaceDisplayP3 )
func (GPUColorSpace) IsHDR ¶
func (c GPUColorSpace) IsHDR() bool
IsHDR reports whether c is an HDR / extended dynamic range color space.
func (GPUColorSpace) String ¶
func (c GPUColorSpace) String() string
String returns a human-readable identifier for c.
type GPUColorTargetState ¶
type GPUColorTargetState struct {
Format GPUTextureFormat
Blend *GPUBlendState
WriteMask GPUColorWriteMask
}
GPUColorTargetState describes one color attachment output of a render pipeline.
type GPUColorWriteMask ¶
type GPUColorWriteMask uint8
GPUColorWriteMask selects which color channels a render pipeline writes.
const ( GPUColorWriteRed GPUColorWriteMask = 1 << iota GPUColorWriteGreen GPUColorWriteBlue GPUColorWriteAlpha // GPUColorWriteNone disables all color writes. It is a separate bit because a zero mask means GPUColorWriteAll; backends only test the four channel bits. GPUColorWriteNone GPUColorWriteAll = GPUColorWriteRed | GPUColorWriteGreen | GPUColorWriteBlue | GPUColorWriteAlpha )
type GPUCommand ¶
type GPUCommand struct {
Kind GPUCommandKind
ID GPUID
Slot uint32
Offset uint64
IndexFormat GPUIndexFormat
DynamicOffsets []uint32
Label string
// Viewport / BlendConstant floats
F0, F1, F2, F3, F4, F5 float32
// Scissor / BaseVertex signed ints
I0, I1, I2, I3 int32
// Draw counts / first indices / stencil ref
U0, U1, U2, U3 uint32
}
GPUCommand is one encoded command inside a GPUPass.
type GPUCommandKind ¶
type GPUCommandKind uint8
GPUCommandKind identifies a render-pass or compute-pass command.
const ( GPUCmdSetViewport GPUCommandKind = iota + 1 GPUCmdSetScissor GPUCmdSetPipeline GPUCmdSetBindGroup GPUCmdSetVertexBuffer GPUCmdSetIndexBuffer GPUCmdSetStencilReference GPUCmdSetBlendConstant GPUCmdDraw GPUCmdDrawIndexed GPUCmdDrawInstanced GPUCmdDrawIndexedInstanced GPUCmdPushDebugGroup GPUCmdPopDebugGroup GPUCmdInsertDebugMarker GPUCmdSetComputePipeline GPUCmdDispatch GPUCmdDispatchIndirect )
type GPUCompareFunc ¶
type GPUCompareFunc uint8
GPUCompareFunc selects a depth, stencil, or shadow-sampler comparison function.
const ( GPUCompareUndefined GPUCompareFunc = iota GPUCompareNever GPUCompareLess GPUCompareEqual GPUCompareLessEqual GPUCompareGreater GPUCompareNotEqual GPUCompareGreaterEqual GPUCompareAlways )
type GPUComputePipelineDesc ¶
type GPUComputePipelineDesc struct {
Label string
Compute GPUShaderStage
Layouts []GPUID
}
GPUComputePipelineDesc describes an immutable compute pipeline.
type GPUCopyOp ¶
type GPUCopyOp struct {
Kind GPUCopyOpKind
SrcID GPUID
DstID GPUID
SrcOffset uint64
DstOffset uint64
Size uint64
SrcLayout GPUDataLayout
SrcTex GPUTextureCopy
DstTex GPUTextureCopy
Width uint32
Height uint32
Layers uint32
}
GPUCopyOp describes a buffer/texture copy recorded on an encoder.
type GPUCopyOpKind ¶
type GPUCopyOpKind uint8
GPUCopyOpKind identifies a GPU copy command outside a render pass.
const ( GPUCopyBufferToBuffer GPUCopyOpKind = iota + 1 GPUCopyBufferToTexture GPUCopyTextureToTexture )
type GPUCullMode ¶
type GPUCullMode uint8
GPUCullMode specifies which faces are culled during rasterization.
const ( GPUCullNone GPUCullMode = iota GPUCullFront GPUCullBack )
type GPUDMABufPlane ¶
GPUDMABufPlane is one plane of a DMA-BUF: its file descriptor, byte offset and row pitch.
type GPUDataLayout ¶
GPUDataLayout describes linear pixel data layout in a Go byte slice or buffer.
type GPUDebugEvent ¶
GPUDebugEvent records a debug label, group, or marker observed by GPUSoftwareDevice during resource creation or command execution.
type GPUDebugOp ¶
type GPUDebugOp struct {
Kind GPUDebugOpKind
Label string
PassIndex int
}
GPUDebugOp records an encoder-level debug group boundary or marker positioned relative to the frame's Passes slice (PassIndex is the pass index at which the op was recorded).
type GPUDebugOpKind ¶
type GPUDebugOpKind uint8
GPUDebugOpKind identifies an encoder-level debug group or marker command.
const ( GPUDebugPushGroup GPUDebugOpKind = iota + 1 GPUDebugPopGroup GPUDebugInsertMarker )
type GPUDepthStencilAttachment ¶
type GPUDepthStencilAttachment struct {
Texture GPUID
DepthLoadOp GPULoadOp
DepthStoreOp GPUStoreOp
ClearDepth float32
StencilLoadOp GPULoadOp
StencilStoreOp GPUStoreOp
ClearStencil uint32
}
GPUDepthStencilAttachment configures the depth/stencil target of a render pass. Texture == 0 targets the view's automatic swapchain depth buffer.
type GPUDepthStencilState ¶
type GPUDepthStencilState struct {
Format GPUTextureFormat
DepthWrite bool
DepthCompare GPUCompareFunc
StencilFront GPUStencilFaceState
StencilBack GPUStencilFaceState
StencilReadMask uint32
StencilWriteMask uint32
DepthBias int32
DepthBiasSlopeScale float32
DepthBiasClamp float32
}
GPUDepthStencilState configures depth and stencil testing, writing, and depth bias.
type GPUDeviceLostReason ¶
type GPUDeviceLostReason uint8
GPUDeviceLostReason describes why a GPU device was lost.
const ( GPULostUnknown GPUDeviceLostReason = iota GPULostReset GPULostDestroyed GPULostOutOfMemory GPULostDeviceRemoved GPULostContextLost GPULostSurfaceDestroyed )
func (GPUDeviceLostReason) String ¶
func (r GPUDeviceLostReason) String() string
String returns a human-readable name for r.
type GPUErrorCode ¶
type GPUErrorCode uint8
GPUErrorCode classifies a GPU validation or runtime error.
const ( GPUErrorNone GPUErrorCode = iota GPUErrorUnsupported GPUErrorInvalidDescriptor GPUErrorShaderCompile GPUErrorOutOfMemory GPUErrorDeviceLost GPUErrorFailed )
type GPUEvent ¶
type GPUEvent struct {
Kind GPUEventKind
Generation uint32
Width int
Height int
SurfaceFormat GPUTextureFormat
SurfaceColorSpace GPUColorSpace
FramesInFlight int
Limits GPULimits
Features GPUFeatures
LostReason GPUDeviceLostReason
ErrorCode GPUErrorCode
Message string
ReadbackID uint64
Pixels []byte
PassTimings []GPUPassTiming
FrameIndex uint64
FrameSlot int
FenceID uint64
}
GPUEvent is the payload carried in Event.Data for EventGPU.
type GPUEventKind ¶
type GPUEventKind uint8
GPUEventKind identifies an asynchronous report from a GPU backend to core.
const ( GPUEventDeviceReady GPUEventKind = iota + 1 GPUEventDeviceLost GPUEventResize GPUEventError GPUEventReadback GPUEventPassTimings GPUEventFrameComplete )
type GPUExternalTextureDesc ¶
type GPUExternalTextureDesc struct {
Label string
Kind GPUExternalTextureKind
Width uint32
Height uint32
Format GPUTextureFormat
// D3D11: the shared NT handle, the plane of a planar texture (0 luma, 1 chroma for NV12 and P010), and the keyed mutex to hold while reading it.
Handle uintptr
Plane uint32
KeyedMutex bool
AcquireKey uint64
ReleaseKey uint64
// DMA-BUF: the plane's single-plane DRM fourcc, its format modifier (GPUDRMFormatModInvalid for none) and its one plane.
FourCC uint32
Modifier uint64
Planes []GPUDMABufPlane
}
GPUExternalTextureDesc describes a texture imported from GPU memory another API or device owns. The imported texture is a sampled 2D texture of Width x Height texels in Format.
type GPUExternalTextureKind ¶
type GPUExternalTextureKind uint8
GPUExternalTextureKind identifies the GPU memory a GPUOpImportTexture opens.
const ( GPUExternalD3D11Shared GPUExternalTextureKind = iota + 1 // GPUExternalDMABuf is a Linux DMA-BUF imported through EGL_EXT_image_dma_buf_import. GPUExternalDMABuf )
type GPUFeatures ¶
type GPUFeatures struct {
StorageBuffers bool
StorageTextures bool
Compute bool
MSAA4x bool
Depth32Float bool
Anisotropy bool
TimestampQueries bool
TextureCompressionBC bool
TextureCompressionETC2 bool
TextureCompressionASTC bool
// CompressedFormats optionally enumerates the exact compressed formats supported by the device. When empty, supported formats are derived from TextureCompressionBC, TextureCompressionETC2, and TextureCompressionASTC.
CompressedFormats []GPUTextureFormat
// ExtendedFormats reports support for GPUFormatBGRA8UnormSRGB, GPUFormatRG11B10Float, GPUFormatR32Float, GPUFormatRGBA32Float and GPUFormatStencil8.
ExtendedFormats bool
// StencilTest reports support for pipeline stencil testing (GPUDepthStencilState stencil faces and masks).
StencilTest bool
// MipmapGeneration reports support for GPUOpGenerateMipmaps (box-filtered mip chains generated on the device).
MipmapGeneration bool
// ImportD3D11Shared and ImportDMABuf report support for GPUOpImportTexture of each GPUExternalTextureKind.
ImportDMABuf bool
}
GPUFeatures reports optional GPU capabilities supported by the active device.
func DefaultSoftwareGPUFeatures ¶
func DefaultSoftwareGPUFeatures() GPUFeatures
DefaultSoftwareGPUFeatures returns the capabilities supported by the pure-Go headless software GPU device.
func (GPUFeatures) SupportedCompressedFormats ¶
func (f GPUFeatures) SupportedCompressedFormats() []GPUTextureFormat
SupportedCompressedFormats returns the deduplicated list of compressed texture formats supported by f.
func (GPUFeatures) SupportsCompressedFormat ¶
func (f GPUFeatures) SupportsCompressedFormat(fm GPUTextureFormat) bool
SupportsCompressedFormat reports whether f supports the compressed format fm.
func (GPUFeatures) SupportsImport ¶
func (f GPUFeatures) SupportsImport(kind GPUExternalTextureKind) bool
SupportsImport reports whether f supports GPUOpImportTexture of kind.
type GPUFilterMode ¶
type GPUFilterMode uint8
GPUFilterMode selects texture minification, magnification, or mipmap filtering.
const ( GPUFilterNearest GPUFilterMode = iota GPUFilterLinear )
type GPUFrame ¶
type GPUFrame struct {
SurfaceID uint32
ViewID NodeID
Generation uint32
FrameIndex uint64
FrameSlot int
FenceID uint64
OnComplete func() // optional callback invoked once the backend finishes this frame
Ops []GPUResourceOp
Copies []GPUCopyOp
Passes []GPUPass
DebugOps []GPUDebugOp
Present bool
}
GPUFrame is one off-commit batch of GPU resource operations, copy commands, and render passes submitted directly to a platform backend without triggering a UI view-tree commit.
type GPUFrontFace ¶
type GPUFrontFace uint8
GPUFrontFace specifies the winding order considered front-facing.
const ( GPUFrontCCW GPUFrontFace = iota GPUFrontCW )
type GPUID ¶
type GPUID uint64
GPUID uniquely identifies a retained GPU resource (buffer, texture, sampler, bind group layout, bind group, or pipeline) within a GPU surface.
type GPUIndexFormat ¶
type GPUIndexFormat uint8
GPUIndexFormat specifies the element width of an index buffer.
const ( GPUIndexUint16 GPUIndexFormat = iota GPUIndexUint32 )
type GPULimits ¶
type GPULimits struct {
MaxTextureDimension2D uint32
MaxBufferSize uint64
MaxUniformBufferSize uint64
MaxStorageBufferBindingSize uint64
MaxBindGroups uint32
MaxVertexBuffers uint32
MaxVertexAttributes uint32
MinUniformBufferAlignment uint32
MaxComputeWorkgroupSizeX uint32
MaxComputeWorkgroupSizeY uint32
MaxComputeWorkgroupSizeZ uint32
MaxComputeInvocationsPerGroup uint32
MaxComputeWorkgroupsPerDim uint32
// MaxColorAttachments is the number of color targets a pipeline and render pass may use (multiple render targets). 0 means 1.
MaxColorAttachments uint32
MaxTextureArrayLayers uint32
}
GPULimits reports device capability limits.
func DefaultGPULimits ¶
func DefaultGPULimits() GPULimits
DefaultGPULimits returns conservative portable GPU limits.
func DefaultSoftwareGPULimits ¶
func DefaultSoftwareGPULimits() GPULimits
DefaultSoftwareGPULimits returns the limits of the pure-Go headless software GPU device, which renders up to four color targets.
type GPULoadOp ¶
type GPULoadOp uint8
GPULoadOp specifies what happens to an attachment at the start of a render pass.
type GPULoadStore ¶
type GPULoadStore = GPUStoreOp
GPULoadStore is an alias for GPUStoreOp to keep constant iota clean.
const ( GPUStoreStore GPULoadStore = iota GPUStoreDiscard )
type GPUPass ¶
type GPUPass struct {
Label string
TimingLabel string
TimestampQueryID GPUID
IsCompute bool
ColorAttachments []GPUColorAttachment
DepthStencil *GPUDepthStencilAttachment
Commands []GPUCommand
}
GPUPass is one render pass or compute pass recorded in a GPUFrame.
type GPUPassTiming ¶
GPUPassTiming reports the measured GPU execution duration of one render pass.
type GPUPipelineArtifacts ¶
type GPUPipelineArtifacts struct {
MSLSource string `json:"msl_source,omitempty"`
MSLVertexEntry string `json:"msl_vertex_entry,omitempty"`
MSLFragmentEntry string `json:"msl_fragment_entry,omitempty"`
MSLSlots []GPUPipelineBindingSlot `json:"msl_slots,omitempty"`
HLSLVertexSource string `json:"hlsl_vertex_source,omitempty"`
HLSLPixelSource string `json:"hlsl_pixel_source,omitempty"`
HLSLVertexEntry string `json:"hlsl_vertex_entry,omitempty"`
HLSLPixelEntry string `json:"hlsl_pixel_entry,omitempty"`
HLSLRegisters []GPUPipelineBindingSlot `json:"hlsl_registers,omitempty"`
GLSLVertexSource string `json:"glsl_vertex_source,omitempty"`
GLSLFragmentSource string `json:"glsl_fragment_source,omitempty"`
GLSLUniformBlocks []GPUPipelineUniformBlock `json:"glsl_uniform_blocks,omitempty"`
GLSLSamplerPairs []GPUPipelineSamplerPair `json:"glsl_sampler_pairs,omitempty"`
GLESVertexSource string `json:"gles_vertex_source,omitempty"`
GLESFragmentSource string `json:"gles_fragment_source,omitempty"`
GLESUniformBlocks []GPUPipelineUniformBlock `json:"gles_uniform_blocks,omitempty"`
GLESSamplerPairs []GPUPipelineSamplerPair `json:"gles_sampler_pairs,omitempty"`
WGSLSource string `json:"wgsl_source,omitempty"`
}
GPUPipelineArtifacts holds precompiled portable target shader sources and binding tables persisted by gpu.PipelineCache so backends skip recompilation across launches and avoid first-draw hitches.
type GPUPipelineBindingSlot ¶
type GPUPipelineBindingSlot struct {
Group uint32 `json:"group"`
Binding uint32 `json:"binding"`
Kind uint8 `json:"kind"`
Slot uint32 `json:"slot"`
}
GPUPipelineBindingSlot records a compiled target shader resource binding slot (Metal buffer/texture/sampler slot or HLSL b/t/s register).
type GPUPipelineDesc ¶
type GPUPipelineDesc struct {
Label string
Vertex GPUShaderStage
Fragment GPUShaderStage
Layouts []GPUID
VertexBuffers []GPUVertexBufferLayout
Primitive GPUPrimitiveState
DepthStencil *GPUDepthStencilState
Targets []GPUColorTargetState
SampleCount int
CacheKey string
CachedArtifacts *GPUPipelineArtifacts
}
GPUPipelineDesc describes an immutable render pipeline.
type GPUPipelineSamplerPair ¶
type GPUPipelineSamplerPair struct {
Name string `json:"name"`
Unit uint32 `json:"unit"`
TextureGroup uint32 `json:"texture_group"`
TextureBinding uint32 `json:"texture_binding"`
SamplerGroup uint32 `json:"sampler_group"`
SamplerBinding uint32 `json:"sampler_binding"`
}
GPUPipelineSamplerPair records a synthesized GLSL combined sampler pair.
type GPUPipelineUniformBlock ¶
type GPUPipelineUniformBlock struct {
Group uint32 `json:"group"`
Binding uint32 `json:"binding"`
BlockName string `json:"block_name"`
Slot uint32 `json:"slot"`
}
GPUPipelineUniformBlock records a compiled GLSL uniform block slot.
type GPUPrimitiveState ¶
type GPUPrimitiveState struct {
Topology GPUPrimitiveTopology
FrontFace GPUFrontFace
CullMode GPUCullMode
}
GPUPrimitiveState configures primitive assembly and face culling.
type GPUPrimitiveTopology ¶
type GPUPrimitiveTopology uint8
GPUPrimitiveTopology specifies how vertices are assembled into primitives.
const ( GPUTopologyTriangleList GPUPrimitiveTopology = iota GPUTopologyTriangleStrip GPUTopologyLineList GPUTopologyLineStrip GPUTopologyPointList )
type GPUResourceOp ¶
type GPUResourceOp struct {
Kind GPUResourceOpKind
ID GPUID
Offset uint64
Data []byte
Buffer *GPUBufferDesc
Texture *GPUTextureDesc
Sampler *GPUSamplerDesc
BindGroupLayout *GPUBindGroupLayoutDesc
BindGroup *GPUBindGroupDesc
Pipeline *GPUPipelineDesc
ComputePipeline *GPUComputePipelineDesc
External *GPUExternalTextureDesc
TextureDst GPUTextureCopy
DataLayout GPUDataLayout
ReadbackID uint64
ReadbackSize uint64
ReadbackRegion GPUTextureRegion
ReadbackSurface bool
}
GPUResourceOp is one resource creation, update, destruction, or readback op.
type GPUResourceOpKind ¶
type GPUResourceOpKind uint8
GPUResourceOpKind identifies a retained GPU resource lifecycle or upload op.
const ( GPUOpCreateBuffer GPUResourceOpKind = iota + 1 GPUOpWriteBuffer GPUOpDestroyBuffer GPUOpCreateTexture GPUOpWriteTexture GPUOpDestroyTexture GPUOpCreateSampler GPUOpDestroySampler GPUOpCreateBindGroupLayout GPUOpDestroyBindGroupLayout GPUOpCreateBindGroup GPUOpDestroyBindGroup GPUOpCreatePipeline GPUOpDestroyPipeline GPUOpReadTexture // Compute ops are appended after GPUOpReadTexture so the numeric op kinds already on the Android wire (internal/platform/android/gpu.go) keep their values. GPUOpCreateComputePipeline GPUOpDestroyComputePipeline GPUOpReadBuffer GPUOpGenerateMipmaps // GPUOpImportTexture opens External as the texture ID; GPUOpDestroyTexture releases it. GPUOpImportTexture )
type GPUSamplerDesc ¶
type GPUSamplerDesc struct {
Label string
MinFilter GPUFilterMode
MagFilter GPUFilterMode
MipmapFilter GPUFilterMode
AddressU GPUAddressMode
AddressV GPUAddressMode
AddressW GPUAddressMode
MinLOD float32
MaxLOD float32
Compare GPUCompareFunc
MaxAnisotropy uint16
}
GPUSamplerDesc describes a GPU texture sampler.
type GPUShaderStage ¶
GPUShaderStage pairs a compiled shaderir.Program with an entry point name.
type GPUShaderStageFlags ¶
type GPUShaderStageFlags uint8
GPUShaderStageFlags specifies which shader stages can see a binding.
const ( GPUStageVertex GPUShaderStageFlags = 1 << iota GPUStageFragment GPUStageCompute GPUStageAll = GPUStageVertex | GPUStageFragment | GPUStageCompute )
type GPUSoftReadback ¶
GPUSoftReadback holds the completed CPU pixels of a GPUOpReadTexture op.
type GPUSoftwareDevice ¶
type GPUSoftwareDevice struct {
// contains filtered or unexported fields
}
GPUSoftwareDevice is a deterministic pure-Go software 3D GPU rasterizer and shaderir interpreter used by headless nsgotest and unit tests.
func NewGPUSoftwareDevice ¶
func NewGPUSoftwareDevice(width, height int, cfg GPUViewConfig) *GPUSoftwareDevice
NewGPUSoftwareDevice creates a software GPU device for a surface of width x height pixels.
func (*GPUSoftwareDevice) Close ¶
func (d *GPUSoftwareDevice) Close()
Close flushes pending work and stops any pipelined worker goroutine.
func (*GPUSoftwareDevice) DebugEvents ¶
func (d *GPUSoftwareDevice) DebugEvents() []GPUDebugEvent
DebugEvents returns a copy of all debug labels, groups, and markers observed by this software device.
func (*GPUSoftwareDevice) Frames ¶
func (d *GPUSoftwareDevice) Frames() []GPUFrame
Frames returns all GPUFrames submitted to this device, oldest first.
func (*GPUSoftwareDevice) FramesInFlight ¶
func (d *GPUSoftwareDevice) FramesInFlight() int
FramesInFlight returns the normalized frame-in-flight count configured on d.
func (*GPUSoftwareDevice) LastError ¶
func (d *GPUSoftwareDevice) LastError() error
LastError returns the most recent execution error recorded by d.
func (*GPUSoftwareDevice) LastPassTimings ¶
func (d *GPUSoftwareDevice) LastPassTimings() []GPUPassTiming
LastPassTimings returns a copy of the pass timings measured during the most recent Submit call.
func (*GPUSoftwareDevice) ReadBuffer ¶
func (d *GPUSoftwareDevice) ReadBuffer(id GPUID) ([]byte, bool)
ReadBuffer returns a copy of buffer id's contents, if present.
func (*GPUSoftwareDevice) Resize ¶
func (d *GPUSoftwareDevice) Resize(width, height int)
Resize reallocates the swapchain color, depth, and stencil buffers for a new pixel size.
func (*GPUSoftwareDevice) ResourceLabel ¶
func (d *GPUSoftwareDevice) ResourceLabel(id GPUID) string
ResourceLabel returns the debug label recorded for resource id, if any.
func (*GPUSoftwareDevice) SetFrameHooks ¶
func (d *GPUSoftwareDevice) SetFrameHooks(beforePass, afterFrame func(GPUFrame))
SetFrameHooks installs optional callbacks invoked on the GPU execution thread immediately before a frame's render passes run (after resource ops/copies) and immediately after the frame completes (before signaling its completion fence).
func (*GPUSoftwareDevice) SetPipelined ¶
func (d *GPUSoftwareDevice) SetPipelined(enabled bool)
SetPipelined toggles background GPU-worker execution. When enabled, Submit enqueues frames onto a dedicated GPU worker goroutine and returns immediately, allowing the caller to overlap CPU frame N+1 ring-buffer writes with GPU frame N rasterization while frame-slot fences guard slot reuse.
func (*GPUSoftwareDevice) SetReadbackHandler ¶
func (d *GPUSoftwareDevice) SetReadbackHandler(fn func([]GPUSoftReadback, error))
SetReadbackHandler installs an optional callback invoked with completed readbacks or execution errors when running in pipelined mode.
func (*GPUSoftwareDevice) Size ¶
func (d *GPUSoftwareDevice) Size() (int, int)
Size returns the current swapchain dimensions in pixels.
func (*GPUSoftwareDevice) Submit ¶
func (d *GPUSoftwareDevice) Submit(frame GPUFrame) ([]GPUSoftReadback, error)
Submit executes all resource ops, copies, and render passes in frame. When SetPipelined(true) is active, Submit enqueues frame onto the GPU worker goroutine and returns immediately without blocking the caller.
func (*GPUSoftwareDevice) SurfaceImage ¶
func (d *GPUSoftwareDevice) SurfaceImage() *image.RGBA
SurfaceImage returns an independent RGBA snapshot of the swapchain color buffer.
func (*GPUSoftwareDevice) WaitIdle ¶
func (d *GPUSoftwareDevice) WaitIdle()
WaitIdle waits until all in-flight frames submitted in pipelined mode complete.
type GPUStencilFaceState ¶
type GPUStencilFaceState struct {
Compare GPUCompareFunc
FailOp GPUStencilOperation
DepthFailOp GPUStencilOperation
PassOp GPUStencilOperation
}
GPUStencilFaceState configures stencil comparison and update operations for one winding face.
type GPUStencilOperation ¶
type GPUStencilOperation uint8
GPUStencilOperation specifies how a stencil buffer value updates after stencil/depth testing.
const ( GPUStencilKeep GPUStencilOperation = iota GPUStencilZero GPUStencilReplace GPUStencilInvert GPUStencilIncrementClamp GPUStencilDecrementClamp GPUStencilIncrementWrap GPUStencilDecrementWrap )
type GPUStoreOp ¶
type GPUStoreOp uint8
GPUStoreOp specifies what happens to an attachment at the end of a render pass.
type GPUTextureCopy ¶
type GPUTextureCopy struct {
Texture GPUID
MipLevel uint32
ArrayLayer uint32
OriginX uint32
OriginY uint32
}
GPUTextureCopy identifies a subresource and origin within a GPU texture.
type GPUTextureDesc ¶
type GPUTextureDesc struct {
Label string
Dimension GPUTextureDimension
Width uint32
Height uint32
Layers uint32
MipLevels uint32
SampleCount int
Format GPUTextureFormat
Usage GPUTextureUsage
}
GPUTextureDesc describes a GPU texture allocation.
type GPUTextureDimension ¶
type GPUTextureDimension uint8
GPUTextureDimension is the dimensionality of a GPU texture.
const ( GPUDim2D GPUTextureDimension = iota GPUDimCube GPUDim2DArray )
type GPUTextureFormat ¶
type GPUTextureFormat uint8
GPUTextureFormat identifies the pixel or depth/stencil layout of a GPU texture.
const ( GPUFormatUndefined GPUTextureFormat = iota GPUFormatRGBA8Unorm GPUFormatRGBA8UnormSRGB GPUFormatBGRA8Unorm GPUFormatRG8Unorm GPUFormatR8Unorm GPUFormatRGBA16Float GPUFormatDepth24Plus GPUFormatDepth24PlusStencil8 GPUFormatDepth32Float GPUFormatBC1RGBAUnorm GPUFormatBC1RGBAUnormSRGB GPUFormatBC3RGBAUnorm GPUFormatBC3RGBAUnormSRGB GPUFormatBC7RGBAUnorm GPUFormatBC7RGBAUnormSRGB GPUFormatETC2RGB8Unorm GPUFormatETC2RGBA8Unorm GPUFormatASTC4x4Unorm GPUFormatASTC4x4UnormSRGB // The extended formats below are appended so the numeric values above, which the Android backend sends over the wire, keep their meaning. Devices accept them only when GPUFeatures.ExtendedFormats is set. GPUFormatBGRA8UnormSRGB GPUFormatRG11B10Float GPUFormatR32Float GPUFormatRGBA32Float GPUFormatStencil8 // The 16-bit normalized formats below exist only for imported textures, such as the planes of a P010 video frame; no device creates them (IsImportOnly). GPUFormatR16Unorm GPUFormatRG16Unorm // GPUFormatRGB10A2Unorm is a 10-bit-per-channel RGB + 2-bit alpha normalized format used for HDR10 (PQ/HLG) swapchains and render targets. GPUFormatRGB10A2Unorm )
func (GPUTextureFormat) BlockSize ¶
func (f GPUTextureFormat) BlockSize() (width, height uint32)
BlockSize returns the compression block dimensions (width, height) in texels. Uncompressed non-undefined formats return (1, 1); undefined/unknown returns (0, 0).
func (GPUTextureFormat) ByteSize ¶
func (f GPUTextureFormat) ByteSize(width, height uint32) uint64
ByteSize returns the tightly-packed byte size required for a 2D image of width x height texels in format f (0 for depth or undefined formats).
func (GPUTextureFormat) BytesPerBlock ¶
func (f GPUTextureFormat) BytesPerBlock() uint32
BytesPerBlock returns the encoded byte size of one texel block. For uncompressed color formats it equals BytesPerPixel; for depth/undefined it is 0.
func (GPUTextureFormat) BytesPerPixel ¶
func (f GPUTextureFormat) BytesPerPixel() uint32
BytesPerPixel returns the texel stride in bytes for uncompressed color formats (0 for compressed, depth, stencil, or undefined formats).
func (GPUTextureFormat) HasStencil ¶
func (f GPUTextureFormat) HasStencil() bool
HasStencil reports whether f carries a stencil aspect.
func (GPUTextureFormat) IsCompressed ¶
func (f GPUTextureFormat) IsCompressed() bool
IsCompressed reports whether f is a block-compressed GPU texture format.
func (GPUTextureFormat) IsDepth ¶
func (f GPUTextureFormat) IsDepth() bool
IsDepth reports whether f carries a depth aspect.
func (GPUTextureFormat) IsDepthStencil ¶
func (f GPUTextureFormat) IsDepthStencil() bool
IsDepthStencil reports whether f is a depth, stencil, or combined depth-stencil format.
func (GPUTextureFormat) IsExtended ¶
func (f GPUTextureFormat) IsExtended() bool
IsExtended reports whether f is one of the extended formats gated by GPUFeatures.ExtendedFormats.
func (GPUTextureFormat) IsFloat ¶
func (f GPUTextureFormat) IsFloat() bool
IsFloat reports whether f is a floating-point color format (HDR/unclamped).
func (GPUTextureFormat) IsImportOnly ¶
func (f GPUTextureFormat) IsImportOnly() bool
IsImportOnly reports whether f is a format only imported textures have (GPUOpImportTexture).
func (GPUTextureFormat) IsSRGB ¶
func (f GPUTextureFormat) IsSRGB() bool
IsSRGB reports whether f stores sRGB-encoded RGB channels decoded to linear on sample.
func (GPUTextureFormat) String ¶
func (f GPUTextureFormat) String() string
String returns a human-readable identifier for f.
type GPUTextureRegion ¶
type GPUTextureRegion struct {
MipLevel uint32
ArrayLayer uint32
X, Y uint32
Width uint32
Height uint32
}
GPUTextureRegion selects a rectangular region of a texture for CPU readback.
type GPUTextureUsage ¶
type GPUTextureUsage uint32
GPUTextureUsage is a bitmask of permitted uses for a GPU texture.
const ( GPUTextureSampled GPUTextureUsage = 1 << iota GPUTextureRenderAttachment GPUTextureCopySrc GPUTextureCopyDst GPUTextureStorage )
type GPUVertexAttribute ¶
type GPUVertexAttribute struct {
Format GPUVertexFormat
Offset uint64
Location uint32
}
GPUVertexAttribute describes one vertex attribute within a vertex buffer.
type GPUVertexBufferLayout ¶
type GPUVertexBufferLayout struct {
Stride uint64
StepMode GPUVertexStepMode
StepRate uint32 // 0 defaults to 1 for GPUStepInstance (advance once per StepRate instances)
Attributes []GPUVertexAttribute
}
GPUVertexBufferLayout describes one vertex buffer slot in a render pipeline.
type GPUVertexFormat ¶
type GPUVertexFormat uint8
GPUVertexFormat specifies the component layout of a vertex attribute.
const ( GPUVertexFloat32 GPUVertexFormat = iota + 1 GPUVertexFloat32x2 GPUVertexFloat32x3 GPUVertexFloat32x4 GPUVertexSint32 GPUVertexSint32x2 GPUVertexSint32x3 GPUVertexSint32x4 GPUVertexUint32 GPUVertexUint32x2 GPUVertexUint32x3 GPUVertexUint32x4 GPUVertexUnorm8x4 )
func (GPUVertexFormat) ByteSize ¶
func (f GPUVertexFormat) ByteSize() uint64
ByteSize returns the size of one attribute element in bytes.
type GPUVertexStepMode ¶
type GPUVertexStepMode uint8
GPUVertexStepMode specifies whether a vertex buffer advances per vertex or per instance.
const ( GPUStepVertex GPUVertexStepMode = iota GPUStepInstance )
type GPUViewConfig ¶
type GPUViewConfig struct {
ColorFormat GPUTextureFormat
ColorSpace GPUColorSpace
DepthFormat GPUTextureFormat
SampleCount int
FramesInFlight int
}
GPUViewConfig is the mount configuration for a KindGPU view (ItemGPU).
type GameAchievement ¶
GameAchievement describes an achievement's reported completion progress.
type GamePlayer ¶
GamePlayer identifies the local player signed into a platform game service.
type GamePlayerScope ¶
type GamePlayerScope uint8
GamePlayerScope selects which players a leaderboard score query includes.
const ( // GamePlayersGlobal queries scores across all players. GamePlayersGlobal GamePlayerScope = iota // GamePlayersFriends queries scores among the local player's friends. GamePlayersFriends )
func (GamePlayerScope) String ¶
func (s GamePlayerScope) String() string
String returns the scope's name: global or friends.
type GameScoreEntry ¶
type GameScoreEntry struct {
LeaderboardID string
PlayerID string
DisplayName string
Score int64
Rank int
}
GameScoreEntry is one ranked score row returned for a leaderboard query.
type GameServices ¶
type GameServices interface {
Authenticate(done func(GamePlayer, error))
ReportAchievement(id string, percent float64, done func(error))
SubmitScore(leaderboardID string, score int64, done func(error))
ShowAchievements()
ShowLeaderboard(leaderboardID string)
LoadScores(leaderboardID string, scope GamePlayerScope, timeScope GameTimeScope, limit int, done func([]GameScoreEntry, error))
}
GameServices is a per-app platform game services backend, such as nsgotest's isolated in-memory fake. Package gameservices validates arguments, clamps achievement percentages to 0..100, checks core.Env.CanUseGameServices and marshals all callbacks back onto the engine goroutine via core.Scope.Post.
type GameTimeScope ¶
type GameTimeScope uint8
GameTimeScope selects the time window for leaderboard score queries.
const ( // GameTimeAllTime queries all-time leaderboard scores. GameTimeAllTime GameTimeScope = iota // GameTimeWeek queries scores recorded in the current week. GameTimeWeek // GameTimeToday queries scores recorded today. GameTimeToday )
func (GameTimeScope) String ¶
func (s GameTimeScope) String() string
String returns the scope's name: allTime, week or today.
type GamepadFamily ¶
type GamepadFamily uint8
GamepadFamily identifies a game controller's physical button-label family.
const ( GamepadFamilyGeneric GamepadFamily = iota GamepadFamilyXbox GamepadFamilyPlayStation GamepadFamilyNintendo )
func (GamepadFamily) String ¶
func (f GamepadFamily) String() string
String returns the family's lowercase name: generic, xbox, playstation or nintendo.
type GamepadSource ¶
type GamepadSource interface {
// Poll returns a snapshot of all currently connected controllers, sorted by ID.
Poll() []GamepadState
// Watch invokes onChange when a controller connects or disconnects. The returned
// stop function unregisters the watcher and is safe to call more than once.
Watch(onChange func()) (stop func())
// Rumble drives controller id's low-frequency (left/heavy) and high-frequency
// (right/light) motors for duration, replacing any running rumble.
Rumble(id int, lowFreq, highFreq float32, duration time.Duration)
// StopRumble stops any running rumble on controller id.
StopRumble(id int)
}
GamepadSource reads connected game controllers and drives rumble motors for an app or headless test host.
func GamepadSourceFor ¶
func GamepadSourceFor(key any) GamepadSource
GamepadSourceFor returns the synthetic GamepadSource bound to key, or nil if none.
type GamepadState ¶
type GamepadState struct {
ID int
Name string
VendorID uint16
ProductID uint16
Family GamepadFamily
CanRumble bool
Buttons [GamepadButtonCount]float32
Axes [GamepadAxisCount]float32
}
GamepadState is one connected game controller's state in the W3C Standard Gamepad layout.
func PollPlatformGamepads ¶
func PollPlatformGamepads() []GamepadState
PollPlatformGamepads returns a sorted snapshot of controllers reported through the platform bridge.
type GeofenceOptions ¶
type GeofenceOptions struct {
Regions []GeofenceRegion
Background bool
NotificationTitle, NotificationBody string
}
GeofenceOptions chooses at most twenty regions and explicit background policy.
type GeofenceRegion ¶
GeofenceRegion is a WGS 84 circle whose identifier is local to its stream.
type GeofenceSample ¶
type GeofenceSample struct {
Region string
State GeofenceState
Timestamp time.Time
Gap bool
Dropped uint64
}
GeofenceSample is the latest observed state of one region. Dropped counts replaced deliveries for that region; Unknown never means Outside.
type GeofenceState ¶
type GeofenceState uint8
const ( GeofenceUnknown GeofenceState = iota GeofenceInside GeofenceOutside )
type Geometry ¶
type Geometry struct {
// Regions are the usable regions, ordered by frame position: top to bottom, then left to right.
Regions []Region
// Obstructions are the folds and hinges on the surface, in the same order.
Obstructions []Obstruction
// State is how far the device's hinge is open, whether or not an obstruction lies on the surface, as on a display that shows no fold open flat or an outer display while the device is closed; HingeUnknown on a device without a hinge, or before the platform reports one.
State HingeState
// Angle is the hinge's angle in radians, where the platform reports one, as HasAngle says.
Angle float32
HasAngle bool
}
Geometry is how a surface's display divides it: the regions an app can lay out in and the folds and hinges between them, in surface points, measured at the size it travels with (Engine.Resize, Tree.Resize). The zero value is the one-region form of a surface without a fold, which Divide returns for no obstructions.
func Divide ¶
func Divide(size Size, obstructions []Obstruction) Geometry
Divide returns the geometry of a surface of size that obstructions lie on, in surface points: the obstructions within the surface, clipped to it, and the regions those that separate it and cross it from edge to edge leave on either side of their frames. An obstruction that does not divide the surface, such as one that occludes without separating, reserves its frame in the regions it lies in. Frames outside the surface, and those without length, are left out. The hinge's state is left unknown, for the caller to set.
type GeometryObserver ¶
type GeometryObserver struct {
Version uint64
// contains filtered or unexported fields
}
GeometryObserver coalesces native-thread snapshots. A surface only builds them while Active; a new applied version is reported even if no box moved.
func (*GeometryObserver) Active ¶
func (g *GeometryObserver) Active() bool
func (*GeometryObserver) Begin ¶
func (g *GeometryObserver) Begin(version uint64)
func (*GeometryObserver) End ¶
func (g *GeometryObserver) End()
func (*GeometryObserver) Notify ¶
func (g *GeometryObserver) Notify(snapshot GeometrySnapshot)
func (*GeometryObserver) Observe ¶
func (g *GeometryObserver) Observe(report func(GeometrySnapshot))
type GeometrySnapshot ¶
type GeometrySnapshot struct {
Version uint64
Bounds map[NodeID]Bounds
Matrices map[NodeID]Matrix3D
Sizes map[NodeID]Size
}
GeometrySnapshot is the surface's displayed bounds after Version's commit was applied; zero predates the first diagnostic barrier. Bounds are immutable, unclipped, in surface points.
func ProjectGeometry ¶
func ProjectGeometry(views map[NodeID]ViewGeometry) GeometrySnapshot
ProjectGeometry projects native viewports and retains their local-to-surface matrices and sizes for transformed audit outlines and picking.
type GeometrySource ¶
type GeometrySource interface {
ObserveGeometry(report func(GeometrySnapshot))
}
GeometrySource reports presentation geometry for DevTools. ObserveGeometry must not block the engine; it reports on the native thread after mounts and animation/scroll frames. A nil report ends observation.
type GesturePhase ¶
type GesturePhase uint8
GesturePhase is where a gesture is in its course.
const ( // GestureBegan is the first report, once the platform recognized it. GestureBegan GesturePhase = iota + 1 // GestureChanged follows each move. GestureChanged // GestureEnded is the last report of a gesture that completed. GestureEnded // GestureCancelled is the last report of one the system took away, // such as by a scroll view or an incoming call. GestureCancelled )
type GlassEffect ¶
type GlassEffect uint8
GlassEffect is Apple's Liquid Glass, drawn in place of the backdrop blur where the system has it (iOS and macOS 26).
const ( GlassNone GlassEffect = iota GlassRegular GlassClear )
type Gradient ¶
type Gradient struct {
Kind GradientKind
// Angle points a linear gradient, in degrees clockwise from up, as
// CSS's angles: 90 runs left to right, 180 top to bottom. ToCorner,
// when set, points it at a corner instead, along the angle that
// depends on the box's shape. A conic gradient starts at Angle.
Angle float32
ToCorner GradientCorner
// Circle makes a radial gradient a circle rather than an ellipse of
// the box's proportions; Extent is how far it reaches.
Circle bool
Extent GradientExtent
// Center is where radial and conic gradients start; its zero value is
// the box's center, and its percentages are of the box's size.
Center ObjectPosition
// Stops are the colors, at least one, in order.
Stops []ColorStop
// Repeating repeats the stops past the last, as repeating-*-gradient().
Repeating bool
// Space is where colors mix between stops.
Space ColorSpace
}
Gradient is a gradient image, as CSS's linear-gradient(), radial-gradient() and conic-gradient() and their repeating forms. A view draws its Gradients over its Background, the first on top.
type GradientCorner ¶
type GradientCorner uint8
GradientCorner points a linear gradient at a corner: CSS's "to top right".
const ( ToTopLeft GradientCorner = iota + 1 ToTopRight ToBottomRight ToBottomLeft )
type GradientExtent ¶
type GradientExtent uint8
GradientExtent is how far a radial gradient's last stop reaches.
const ( // ExtentFarthestCorner, the zero value, reaches the farthest corner, // as CSS's default. ExtentFarthestCorner GradientExtent = iota ExtentClosestSide ExtentClosestCorner ExtentFarthestSide )
type GradientKind ¶
type GradientKind uint8
GradientKind is a gradient's geometry.
const ( // GradientLinear runs along a line through the box's center. GradientLinear GradientKind = iota // GradientRadial spreads out from Center to its Extent. GradientRadial // GradientConic turns around Center, the stops at fractions of a turn. GradientConic )
type GradientPaint ¶
type GradientPaint struct {
Kind GradientKind
// X0, Y0 to X1, Y1 is a linear gradient's line, from its first stop to
// its last.
X0, Y0, X1, Y1 float32
// CX, CY is the center of radial and conic gradients; RX and RY are a
// radial gradient's radii, where its last stop is.
CX, CY, RX, RY float32
// Angle is where a conic gradient's first stop is, in degrees
// clockwise from up.
Angle float32
Stops []GradientStop
}
GradientPaint is a gradient resolved against a box, what platforms draw. Its geometry is in fractions of the box's width and height, so it stretches with the box, and its stops run from 0 to 1, sorted, repeats laid out and mixed so that platforms can blend each pair of stops channel by channel in sRGB, unpremultiplied, and pad past the ends.
func (*GradientPaint) ColorAt ¶
func (p *GradientPaint) ColorAt(t float32) Color
ColorAt returns the gradient's color at fraction t of its line, as platforms blend it: for those that draw a gradient pixel by pixel.
func (*GradientPaint) Equal ¶
func (p *GradientPaint) Equal(o *GradientPaint) bool
Equal reports whether two paints draw the same.
type GradientSpread ¶
type GradientSpread uint8
GradientSpread is how a CanvasGradient paints beyond offsets 0 and 1.
const ( SpreadPad GradientSpread = iota // the end colors continue SpreadReflect // the gradient repeats, mirrored SpreadRepeat // the gradient repeats )
type GradientStop ¶
GradientStop is a color at an offset of a gradient.
type Granularity ¶
type Granularity uint8
Granularity is what a press, drag or extension selects by.
const ( // ByCharacter is a press and drag. ByCharacter Granularity = iota // ByWord is a double click or a long press, then drags by words. ByWord // ByParagraph is a triple click: a whole text. ByParagraph )
type HapticEvent ¶
HapticEvent is one pulse of a pattern. At is relative to the start. A zero Duration makes a transient. Intensity and Sharpness range from 0 to 1.
type HapticPattern ¶
type HapticPattern []HapticEvent
HapticPattern lists the timed events to play together.
type HapticSegment ¶
HapticSegment is one constant-amplitude interval of an Android or web waveform.
func HapticWaveform ¶
func HapticWaveform(pattern HapticPattern) []HapticSegment
HapticWaveform divides the pattern into intervals. A transient is a 20 ms pulse on a vibrator, and overlapping events take the stronger amplitude. Amplitude zero is a pause.
type HeaderSystemItem ¶
type HeaderSystemItem uint8
HeaderSystemItem is a button iOS draws in a navigation bar in UIKit's own look, its symbol or label.
const ( HeaderItemAdd HeaderSystemItem = iota + 1 HeaderItemDone HeaderItemClose HeaderItemEdit HeaderItemCompose HeaderItemSearch HeaderItemTrash HeaderItemSave HeaderItemCancel )
type HingeState ¶
type HingeState uint8
HingeState is how far a fold or hinge is open.
const ( HingeUnknown HingeState = iota HingeClosed HingeHalfOpen // HingeOpen is open as far as the device goes, which Android calls flat. HingeOpen )
type HotKeyState ¶
type HotKeyState uint8
HotKeyState is the platform's answer to a global shortcut registration.
const ( // HotKeyPending says the platform has not answered the latest registration. HotKeyPending HotKeyState = iota // HotKeyRegistered says the shortcut is active. HotKeyRegistered // HotKeyTaken says another registration owns the combination. HotKeyTaken // HotKeyUnsupported says the key or the current session cannot provide a global shortcut. HotKeyUnsupported )
func (HotKeyState) String ¶
func (s HotKeyState) String() string
type Idiom ¶
type Idiom uint8
Idiom is the kind of device, which decides how components present.
const ( IdiomPhone Idiom = iota IdiomTablet // IdiomDesktop is a desktop window, or a browser with a mouse and a // wide page. IdiomDesktop // IdiomMac is an iPhone or iPad app running on a Mac. IdiomMac // IdiomTV is a television, such as Android TV. IdiomTV // IdiomWatch is a watch: Apple Watch. IdiomWatch )
type ImageConfig ¶
type ImageConfig struct {
Source ImageSource
Placeholder ImageSource
ResizeMode ResizeMode
Sampling ImageSampling
BlurRadius Points
FadeDuration time.Duration
HitTestAlpha float32
// Position is the style's ObjectPosition: where the fitted image sits
// (ResizeMode.Fit). It travels with the image, not the ViewStyle.
Position ObjectPosition
}
ImageConfig is an image view's source and look.
func (ImageConfig) Same ¶
func (a ImageConfig) Same(b ImageConfig) bool
Same reports whether a and b show the same image the same way.
type ImageSampling ¶
type ImageSampling uint8
ImageSampling selects how a raster image is sampled when scaled.
const ( ImageSamplingSmooth ImageSampling = iota ImageSamplingNearest )
type ImageScales ¶
type ImageScales uint8
ImageScales is a set of ImageScaleValues: the variants an image asset ships in.
func (ImageScales) Pick ¶
func (set ImageScales) Pick(ratio float32) float32
Pick returns the scale to load at ratio, as React Native picks: the smallest at least the ratio, else the largest; 0 for an empty set.
type ImageSource ¶
type ImageSource struct {
URI string
Data []byte
// Pixels, when set, is the image itself, premultiplied as image.RGBA is: nothing loads or decodes, and the view fires no load events and fades nothing in. The core copies it when the commit that carries a new Pixels or Version runs, so the app may write the next frame into the same buffer from then on, from its next RequestAnimationFrame callback for one. Without Size it measures its pixels in points. An Image's Source, a canvas's images and a Shader's Images take pixels; a Placeholder, which shows while a source loads, ignores them.
Pixels *image.RGBA
// Offscreen, when set, is a recorded 2D drawing that platforms render once into a retained offscreen surface keyed by (ID, Version) and reuse across frames without re-executing its drawing operations. Like Pixels, it loads nothing and fires no load events.
Offscreen *OffscreenCanvas
// Version tells frames written into the same Pixels apart: the same Pixels with another Version is shown again in place, the previous frame staying until the new one is drawn. For Offscreen it mirrors Offscreen.Version.
Version uint64
// Size is the image's size in points, when known up front.
Size Size
// Scales are the pixel densities an "asset:" image ships in (a.png,
// a@2x.png, ...): the core mounts the one for the screen's pixel
// ratio. Empty for a single file.
Scales ImageScales
// Variants, for a source whose variants are not asset: files (a TSX
// bundle's data: URLs), are the URIs of the scales past 1x by scale.
Variants map[float32]string
}
ImageSource is where an image comes from: a URI (https, file path, file:, data:), bytes, such as a file embedded with go:embed, pixels the app draws, or a retained offscreen canvas drawing.
func (ImageSource) Density ¶
func (s ImageSource) Density() float32
Density returns the pixels a point of the image s names has: an offscreen canvas's backing scale, the density an "asset:" file's name gives (a@2x.png is 2), else 1.
func (ImageSource) Empty ¶ added in v0.2.0
func (s ImageSource) Empty() bool
Empty reports whether s names no image.
func (ImageSource) Key ¶
func (s ImageSource) Key() string
Key returns a string naming the image s loads, for caches: its URI, a digest of its bytes, an offscreen canvas's ID and version, or where its pixels are and their version. Bytes are named by what they hold, not where: a collected buffer's address can come back in a new buffer of the same length, which must not be handed the image cached for the old one (#738).
func (ImageSource) Same ¶
func (s ImageSource) Same(o ImageSource) bool
Same reports whether s and o load the same image: inline data must be the same bytes, not equal ones, pixels the same buffer at the same Version, and offscreen canvases the same ID and Version.
type InputConfig ¶
type InputConfig struct {
Style TextStyle
Placeholder string
Masked bool
Readonly bool
Disabled bool
KeyboardType KeyboardType
// Content is where the text goes in the view: inside padding and border.
Content Bounds
// Padding surrounds Content inside the border. A multi-line editor
// scrolls in the padding box, its text inset by Padding.
Padding Edges
// Accessory is the InputAccessoryView that rides above the keyboard
// while the field has focus, or 0; AccessoryID is the ID the field
// names it by, which tests read.
Accessory NodeID
AccessoryID string
// Multiline takes several lines in a multi-line control.
Multiline bool
// MaxLength caps what the user enters, in UTF-16 units; 0 sets none.
MaxLength int
// SubmitBehavior is as set; platforms read Submit.
SubmitBehavior SubmitBehavior
ReturnKey ReturnKeyType
AutoCapitalize AutoCapitalize
NoAutoCorrect bool
AutoComplete AutoComplete
// KeyboardAppearance is iOS's.
KeyboardAppearance KeyboardAppearance
// PlaceholderColor is 0 for the platform's: the text color at half
// strength where the platform styles placeholders itself.
PlaceholderColor Color
// SelectionColor colors the selection and CaretColor the caret, which
// takes SelectionColor without one; 0 is the platform's.
SelectionColor Color
CaretColor Color
// AccentColor is the accent of the input's theme, for what the
// platform draws around it, such as an input method's candidates.
AccentColor Color
HideCaret bool
// HideIndicator hides a multiline input's native scroll bar.
HideIndicator bool
// PasteBehavior says whether a paste inserts its text.
PasteBehavior PasteBehavior
}
InputConfig is a text field's look and behavior.
func (*InputConfig) Caret ¶
func (c *InputConfig) Caret() Color
Caret is the color of the caret: CaretColor, or else SelectionColor.
func (*InputConfig) Highlight ¶
func (c *InputConfig) Highlight() Color
Highlight is what selected text shows on: SelectionColor, at 30% when it is opaque, as a translucent one already says its strength; 0 is the platform's.
func (*InputConfig) Submit ¶
func (c *InputConfig) Submit() SubmitBehavior
Submit is what Return does, as SubmitBehavior and Multiline say together, as NSH's InputConfig::submit: never SubmitBehaviorDefault, and SubmitBehaviorNewline only when multiline. Platforms read only this. A multiline field that submits still takes a line break from Shift, Option or Alt with Return on hardware keyboards, and a Return that commits an input method's composition never submits.
type Interpolation ¶
type Interpolation struct {
// Input is increasing; Output (numbers) or Colors has one entry for
// each.
Input []float64
Output []float64
Colors []Color
// ExtrapolateLeft and ExtrapolateRight say what happens outside
// Input; Extrapolate sets both.
Extrapolate, ExtrapolateLeft, ExtrapolateRight Extrapolate
// Easing curves each segment.
Easing Easing
}
Interpolation maps a node through piecewise-linear ranges.
type ItemKind ¶
type ItemKind uint8
ItemKind is what a mount item does.
const ( // ItemCreate makes a detached view of Kind for ID. ItemCreate ItemKind = iota + 1 // ItemInsert inserts or moves ID into Parent, below sibling Before // (on top when 0). Siblings rather than indices, so views a platform // adds of its own cannot shift positions. ItemInsert // ItemRemove detaches ID from its parent and keeps it. ItemRemove // ItemDelete detaches and destroys ID; its ID may be created again // later in the same batch. ItemDelete // ItemFrame moves and sizes ID relative to its parent (Frame). ItemFrame // ItemViewStyle sets what any view draws (ViewStyle). ItemViewStyle // ItemText sets a text view's content (Text). ItemText // ItemInput configures a text field (Input). ItemInput // ItemInputValue sets a text field's value (Value) unless the user // edited it after the edit numbered Count. ItemInputValue // ItemEvents sets which events the view reports (Events). ItemEvents // ItemViewProps sets accessibility and identity (ViewProps). ItemViewProps // ItemScrollConfig configures a scroll view (Scroll). ItemScrollConfig // ItemScrollContent sets the size of a scroll view's content (Size). ItemScrollContent // ItemFocus moves keyboard focus to ID. ItemFocus // ItemBlur takes keyboard focus away from ID. ItemBlur // ItemImage sets an image view's source and look (Image). ItemImage // ItemModal configures a modal (Modal). ItemModal // ItemAlert shows a native alert (Alert); the platform answers with // EventAlert. ItemAlert // ItemDismissKeyboard takes focus away from the focused text field. ItemDismissKeyboard // ItemScrollTo scrolls ID (a scroll view or multiline input) to Point (its content's offset, UIKit's contentOffset: ContentInset makes it negative at the start), animated when Animated; the platform clamps it and reports EventScroll. Platforms count the ItemScrollTo and ItemScrollBy items they applied to each view and report the count with // its offsets. ItemScrollTo // ItemCanvas replaces a canvas's drawing (Drawing), in the view's // coordinates. ItemCanvas // ItemSetClipboard puts Value on the clipboard. ItemSetClipboard // ItemReadClipboard asks for what Clipboard names; the platform // answers with EventClipboard carrying Count. ItemReadClipboard // ItemAnnounce has the screen reader say Value. ItemAnnounce // ItemInputSource selects the keyboard input source named Value, or // with none goes back to the one it replaced, where the platform lets // an app. ItemInputSource // ItemKeymap replaces the surface's keyboard shortcuts (Keys), and whether it reports every key going down and up (HeldKeys); the platform consumes matching key presses and reports EventKey. ItemKeymap // ItemStatusBar sets the status bar (StatusBar): the layers of // settings merged. ItemStatusBar // ItemTitle sets the window's or page's title (Value). ItemTitle // ItemBackUnhandled says nothing took the last EventBack: Android // leaves the app, as its back button does; others ignore it. ItemBackUnhandled // ItemWindow asks the desktop window to change (Window); platforms // without one ignore it. ItemWindow // ItemMenu replaces the application menu (Menu; nil restores the // platform's); a chosen item is reported with EventMenu. ItemMenu // ItemWeb configures a web view (Web). ItemWeb // ItemWebCommand has a web view do WebCommand, with Value for the message or script and Data for commands such as WebLoad. ItemWebCommand // ItemVideo configures a video (Video). ItemVideo // ItemVideoSeek jumps a video to Time. ItemVideoSeek // ItemNative names a native view's component and sets its changed // props (Native). ItemNative // ItemNativeCommand has a native view's component run the command // Value with Data. ItemNativeCommand // ItemAnimation changes the native animation graph (Animation), after // the batch's views exist. ItemAnimation // ItemZoomTo zooms a zoomable scroll view (Zoom), animated when // Animated; the platform clamps it and reports EventScroll. ItemZoomTo // ItemImageInfo loads Image's Source, keeping its bytes for the views // that show it next; the platform answers with EventImageInfo carrying // Count. ItemImageInfo // ItemSelection selects Selection in text field ID, after the batch's // value; the platform clamps it to the text. ItemSelection // ItemScrollBy moves scroll view ID's offset by Point without // clamping it, carrying a drag or glide in flight along, so the // visible content stays in place as rows above it change size. ItemScrollBy // ItemStickyCells replaces the sticky cells of scroll view ID // (Sticky): on every scroll the platform moves each along the main // axis by clamp(offset - Start, 0, End - Start) from its frame. ItemStickyCells // ItemAccessibilityLabel changes the label (Value) of a view whose // ViewProps were sent before, and nothing else: a label following app // state changes alone, so the rest is not sent again. ItemAccessibilityLabel // ItemAccessibilityFocus moves the screen reader's focus to ID. ItemAccessibilityFocus // ItemScreen configures a screen's system header (Screen) on the // platforms that report header heights, before the screen is // inserted and when it changes. ItemScreen // ItemOverflow gives the area ID's children cover outside its bounds by their layout frames (Frame, in its own coordinates), or zero Bounds when they stay inside, for platforms to look for a touch's target there; see Reach. Transformed says a child, or one of theirs, has been drawn transformed and may show anywhere, so a hit test looks in the children wherever the point is; see ReachView. Sent only when either changes. ItemOverflow // ItemBlockNative stops the scroll views around ID, the touch // responder, from taking the touches until they end, or lets them // again with no ID. ItemBlockNative // ItemShader sets a shader view's program and uniforms (Shader), or a // view's effect, transition or screen shader (Shader.Role), nil // Shader taking it away. ItemShader // ItemSetClipboardImage puts the encoded image Data ([]byte) on the // clipboard. ItemSetClipboardImage // ItemOpenURL opens Value outside the app; the platform answers with // EventOpenURL carrying Count. ItemOpenURL // ItemPickImages shows the system's photo picker for Pick; the // platform answers with EventPick carrying Count. ItemPickImages // ItemAppearance shows the app in Appearance whatever the system's, // native chrome included. ItemAppearance // ItemPopupMenu shows Menu as the platform's context menu at Point, // in the root's points; desktops report a chosen item with EventMenu // and answer with EventMenuClosed carrying Count. ItemPopupMenu // ItemQuit ends the app: desktops close the window and return from // Run, Android finishes its activity; iOS and the web ignore it. On // says the app restarts, which nsgo.Run does once Run returns. ItemQuit // ItemBackPreview answers EventBackStarted with the screen a back now // pops (ID), for the platform to move it with the gesture; 0 when back // goes elsewhere first or nothing pops. ItemBackPreview // ItemHistory is how many entries back can go through (Count): the // screens above each stack's first and the modals shown. The web // keeps that many browser history entries; others ignore it. ItemHistory // ItemPickFiles shows the system's file picker for Files; the // platform answers with EventFiles carrying Count. ItemPickFiles // ItemSaveFile shows the system's save dialog for Save and saves the // file where the user chose; the platform answers with EventFiles // carrying Count. ItemSaveFile // ItemDirection says whether the app lays out right to left (RTL), as // the language it shows is written, whatever the system's, and that // language (Language), and whether the app forces it (Forced, // Scope.SetLocale): on its first commit and when any changes. // Platforms whose own motion follows a direction, as iOS's navigation, // take it, those that draw menus label them in the language, and // standalone apps apply a forced one to what the system says in the // app (from the next launch on Apple platforms, and immediately on // Android 13+, Windows and Linux). ItemDirection // ItemPickScreenColor lets the user pick a color on the screen: the // system's color sampler or the browser's EyeDropper, answered with // EventFiles Count, Finished with the color in Data, a Color. Sent only // where the environment says ScreenColor. ItemPickScreenColor // ItemPickDirectories shows the system's folder picker for // Directories; the platform answers with EventFiles carrying Count. ItemPickDirectories // ItemOpenFile opens the file Open in the app the system associates // with it; the platform answers with EventFiles carrying Count. ItemOpenFile // answers with EventFiles carrying Count once it shows. ItemShare // ItemInstallPackage hands Open to the platform's package installer. // EventFiles carrying Count reports when Linux finishes or when // Android opens the system installer for the user to confirm. ItemInstallPackage // ItemCanInstallPackages asks whether the user lets the app install // packages; Android answers with EventFiles carrying Count. ItemCanInstallPackages // ItemInstallSettings opens the system's setting that lets the app // install packages; Android answers with EventFiles carrying Count. ItemInstallSettings // ItemOpenSurface opens a window, a panel or a tray icon's view // (Surface) for the tree the core numbered Surface.ID, which the // platform attaches to the engine (engine.Engine.Attach). Only the // app's own surface, the first, is sent it. ItemOpenSurface // ItemTray adds, changes or removes a tray icon (Tray); the app's own // surface is sent it, and EventTray reports its clicks. ItemTray // ItemTrayMenu shows Menu at the place of tray icon Tray.ID, numbered // Count as ItemPopupMenu's menus are. ItemTrayMenu // ItemHotKeys replaces the app's global shortcuts (Keys, each with its ID), which fire whichever app has the focus with EventHotKey. The platform answers each key with EventHotKeyState once it knows whether the key registered. ItemHotKeys // ItemDock shows the app in the Dock and the app switcher (On), or // leaves it to its tray icon and windows. ItemDock // ItemSetLaunchAtLogin has the system start the app as the user logs // in (On), or no more. ItemSetLaunchAtLogin // ItemLaunchAtLogin asks whether the system starts the app at login; // the platform answers with EventLaunchAtLogin carrying Count. ItemLaunchAtLogin // ItemShaderTransition starts view ID's shader transition, or a // page's or a dialog's (ShaderTransition, ShaderNav): it comes first in // its batch, so the platform pictures what the view shows before the // batch as the transition's first side. ItemShaderTransition // ItemShaderInput says what view ID's shader pictures changed in the // batch, so the platform pictures it again once the batch is applied: // an effect's or a transition's children, a screen shader's surface. ItemShaderInput // ItemSpeech starts, stops or aborts speech session Count (Speech); // the platform reports it with EventSpeech carrying Count. ItemSpeech // ItemTakePhoto shows the system's camera to take one photo, prepared // as Pick says; the platform answers with EventPick carrying Count, // Text saying what failed. Sent only where the environment says // Camera. ItemTakePhoto // ItemMatch has view ID, which the batch creates and inserts, move and // resize from the frame view Before shows, which the batch deletes, // on the batch's LayoutAnimation Update instead of appearing with its // Create; Before stops showing at once (View.MatchID). It comes after // the round's inserts and before its deletes, so both views are in // place, and only in a batch whose LayoutAnimation has an Update. ItemMatch // ItemCheckForUpdates asks the platform's updater for a newer version // of the app, in the background when On; the platform answers with // EventUpdate carrying Count. ItemCheckForUpdates // ItemHaptic plays haptic feedback Count (a Haptic) where the device // has it and the user allows it. ItemHaptic // ItemNotificationPermission asks whether the app may show // notifications, with the system's prompt when On; the platform // answers with EventNotification carrying Count and the permission as // Index (a NotificationPermission). ItemNotificationPermission // ItemShowNotification shows Notification, or schedules it for its At, replacing one of its ID, shown or pending; the platform answers with EventNotification carrying Count, Finished when the system took it. ItemShowNotification // ItemCloseNotification removes the notification whose ID is Value, shown or pending, and every notification ShowNotification showed when Value is empty (core.Scope.CloseNotifications). ItemCloseNotification // ItemBadge shows Count on the app's icon; 0 clears it. ItemBadge // ItemBiometricAvailability asks whether an enrolled biometric can be // used; the platform answers with EventBiometric and its kind in Index. ItemBiometricAvailability // ItemBiometricAuthenticate asks the user to authenticate with the // reason in Value; the platform answers with EventBiometric and its // result in Index. ItemBiometricAuthenticate // ItemQuitResponse answers EventQuitRequest Count, after the kinds Android's Protocol.java mirrors so that they keep their values. On permits the platform's pending termination request; false cancels it. ItemQuitResponse // ItemOverlayPermission asks whether the app may show windows over other apps, Android's SYSTEM_ALERT_WINDOW, opening the system's setting for the app when On; the platform answers with EventOverlayPermission carrying Count and the permission as Index (an OverlayPermission), after the setting once the app is back in front. ItemOverlayPermission // ItemPermission, after the kinds Android's Protocol.java mirrors, carries Permission, a request numbered Count about one of the system's permissions; the platform answers each one but PermissionStopGuide with EventPermission carrying Count, the status as Index. ItemPermission // ItemRevealFile shows Open in the system file manager, selected. ItemRevealFile // ItemTrashFile moves Open to the system Trash or Recycle Bin. ItemTrashFile // ItemKeepAwake takes a power assertion described by Awake and identified // by Count; ItemReleaseAwake releases the assertion identified by Count. ItemKeepAwake ItemReleaseAwake // ItemTaskProgress, after the kinds Android's Protocol.java mirrors, sets the app's task progress bar to Progress. ItemTaskProgress // ItemAudio asks of sound or player Count what Audio says; the platform reports it with EventAudio carrying Count. The core sends none where the environment says no Audio. ItemAudio // ItemAuthSession asks of auth session Count what Auth says; the platform reports it with EventAuthSession carrying Count. ItemAuthSession // ItemSignInWithApple shows Sign in with Apple's sheet for AppleSignIn; the platform answers with EventSignInWithApple carrying Count, Data an *AppleCredential once the user signs in, else Text the AppleSignIn error. The core sends none where the environment says no SignInWithApple. ItemSignInWithApple // ItemAppleCredentialState asks the state of the Sign in with Apple credential of the user whose ID is Value; the platform answers with EventSignInWithApple carrying Count, Index the state (AppleCredentialAuthorized, ...), else Text the AppleSignIn error. The core sends none where the environment says no SignInWithApple. ItemAppleCredentialState // ItemDockMenu, after the kinds Android's Protocol.java mirrors, replaces the app icon's menu (Menu; nil removes it); a chosen item is reported with EventDockMenu. ItemDockMenu // ItemRecentFile records Value in the platform's recent documents, or clears the app's when On. ItemRecentFile // ItemSpeak asks the platform's speech synthesizer what Speak says, of utterance or request Count; the platform reports it with EventSpeak carrying Count. The core sends none where the environment says no Speak. ItemSpeak // ItemSensor starts, stops or queries sensor session Count. ItemSensor // ItemPurchase asks the platform's store what Purchase says; the platform answers with EventPurchase carrying Count and Data a *PurchaseAnswer. The core sends none where the environment says no Purchases. ItemPurchase // ItemWebCookies sets, lists or clears what Cookies asks of the persistent store the app's web views share; the platform answers with EventWebCookies carrying Count, Text why it failed and, for a list, Data. ItemWebCookies // ItemLookUp shows the platform's dictionary panel for Value, drawn over Frame, a box in the surface. ItemLookUp // ItemPictureInPicture configures a detached custom-content tree. ItemPictureInPicture // ItemPictureInPictureCommand starts, stops or acknowledges restoration. ItemPictureInPictureCommand // ItemScanCode shows the system's camera to read one code of the kinds Scan asks for; the platform answers with EventPick carrying Count and Data the *ScannedCode read, none when the user closed it, Text saying what failed. Sent only where the environment says ScanCode. ItemScanCode // ItemQuickLook shows the system's file preview panel on QuickLook's Paths, starting at its Index. Sent only where the environment says CanQuickLook. ItemQuickLook // ItemOrientation asks the app to use the Orientation mask in Count, or the platform default when zero. ItemOrientation // ItemKeepImage pins the canvas image cache entry named by Value // (ImageSource.Key) so it stays out of LRU eviction while kept; // ItemReleaseImage releases one pin of Value, letting it be evicted once // its count reaches zero. ItemKeepImage ItemReleaseImage // ItemReleaseOffscreen releases the cached offscreen surface for OffscreenID. ItemReleaseOffscreen // ItemRequestReview asks the platform's store to show an in-app rating prompt. Sent only where the environment says CanRequestReview. ItemRequestReview // ItemGPU configures a KindGPU view's swapchain color/depth formats and sample count (GPU). ItemGPU // ItemSavePreflightAnswer answers EventSavePreflight Count. On permits // the write and Value holds the reason for a refusal. ItemSavePreflightAnswer // ItemSaveFilePreflight is ItemSaveFile with preflight on Android's pipe. // It keeps the existing save item's wire format unchanged. ItemSaveFilePreflight // ItemDiskSpace asks for the capacity of the volume containing Value, answered by EventDiskSpace carrying Count. ItemDiskSpace // ItemDiscovery starts or stops a DNS-SD operation numbered by Count. ItemDiscovery // ItemSystemGestures replaces the surface's gesture deferrals with SystemGestures. ItemSystemGestures // ItemCursorPoint asks for the desktop pointer position and receives EventCursorPoint with the same Count. ItemCursorPoint // ItemPointerLock captures relative motion for ID, numbered Count. // On requests a lock. A false On releases the matching request. ItemPointerLock // ItemHapticPattern replaces the current haptic pattern, or stops it when empty. ItemHapticPattern // ItemPageHead replaces the web document's scoped title and description. Sent only to a web backend; an embedded app leaves its host's head alone. ItemPageHead // ItemEditMenu opens or closes the platform's touch edit menu on input ID (UIEditMenuInteraction on iOS, a floating ActionMode on Android), anchored clear of Frame in the surface's points and offering the EditAction bits in Count; Count 0 closes any edit menu open on the input. Choosing Cut, Copy or Select All reports EventEditAction on ID with that action in Count; Paste runs the input's own paste (EventPaste). ItemEditMenu // ItemImageCacheLimit sets the maximum number of encoded image bytes kept in memory (Bytes). Negative values are clamped to zero by the core. ItemImageCacheLimit // ItemMiniProgramSignIn asks for a platform login code, answered by EventMiniProgramSignIn. On permits a host-account prompt on Douyin. Sent only where MiniProgramSignIn is available. ItemMiniProgramSignIn // ItemAppClipOverlay presents (On) or dismisses the calling scope's full-app recommendation. Count identifies its owner request and Value is bottom or bottom-raised. iOS App Clips alone send it. ItemAppClipOverlay // ItemSetClipboardItems replaces the clipboard with Data ([]ClipboardItem). When Count is nonzero, EventClipboard reports the outcome. ItemSetClipboardItems // ItemNowPlaying replaces the app's publication (NowPlaying), or clears it when nil. ItemNowPlaying // ItemCapture requests a PNG of ID, or of the surface for zero. EventFiles answers Count with the bytes. ItemCapture )
type KeyBinding ¶
type KeyBinding struct {
// Key is normalized, as NormalizeKey writes it.
Key string
// InText fires it while a text input or a web view has the keyboard
// focus.
InText bool
// Repeat fires it again on the auto-repeats of a held key; else they
// are consumed and fire nothing.
Repeat bool
// Yields are the focused controls it gives its key to, a subset of what KeyUsedBy says for the key: it takes no press while such a control has the keyboard focus, which an older binding of the key or the control then takes.
Yields KeyUse
// ID names the binding: an in-app binding's (ItemKeymap), which EventKey reports when the platform matches it, or a global shortcut's (ItemHotKeys), which EventHotKey reports. The engine never gives an in-app ID to another binding, so a press matched by a keymap that has since changed runs the binding it matched or none.
ID uint32
// Title and Group are localized names for keyboard shortcut discovery.
Title, Group string
// Priority asks UIKit to deliver an eligible command before text or
// focus movement, as a binding with an explicit When takes the key.
Priority bool
}
KeyBinding is one binding of the keymap the platform matches key presses against, on the main thread.
func KeyCommands ¶
func KeyCommands(keymap []KeyBinding, focus KeyUse, names func(string) []string) []KeyBinding
KeyCommands returns the titled bindings that currently win their key's physical press. names gives the platform's spellings for the same press.
func (KeyBinding) FiresOver ¶
func (b KeyBinding) FiresOver(focus KeyUse) bool
FiresOver reports whether the binding takes a press while the view with the keyboard focus uses the keys focus says: not from a text input or web view unless InText, nor from a control whose keys it Yields.
type KeyUse ¶
type KeyUse uint8
KeyUse is a set of the keys a focused view uses itself, by the kind of view.
const ( // KeyUsePress is Return and Space, which press a focused pressable view. KeyUsePress KeyUse = 1 << iota // KeyUseAdjust is the arrows, Page Up, Page Down, Home and End, which move a focused slider or spin button. KeyUseAdjust // KeyUseSelect is the arrows, Page Up, Page Down, Home and End, which move the selection or the focus in a focused tab bar, radio group, list, menu or tree. KeyUseSelect // KeyUseText is the keys a focused text input or web view edits with; InText says whether a binding fires over it. KeyUseText )
func FocusKeyUse ¶
FocusKeyUse returns the keys a focused view uses itself, by its kind, its role and whether it takes presses: a text input or web view its editing keys, a pressable view Return and Space, a slider or spin button its adjusting keys, and a tab bar, radio group, list, menu or tree and their items their moving keys. Each backend's focused view and nsgotest's are read the same way.
type KeyboardAppearance ¶
type KeyboardAppearance uint8
KeyboardAppearance is the look of iOS's keyboard; the default follows the app's appearance.
type KeyboardDismissMode ¶
type KeyboardDismissMode uint8
KeyboardDismissMode is whether dragging a scroll view dismisses the software keyboard.
type KeyboardTaps ¶
type KeyboardTaps uint8
KeyboardTaps is what a tap in a scroll view does while the software keyboard shows.
const ( // KeyboardTapsNever dismisses the keyboard, and the tap reaches // nothing else. KeyboardTapsNever KeyboardTaps = iota // KeyboardTapsAlways never dismisses it. KeyboardTapsAlways // KeyboardTapsHandled dismisses it unless something handles the tap. KeyboardTapsHandled )
type KeyboardType ¶
type KeyboardType uint8
KeyboardType picks a software keyboard.
const ( KeyboardDefault KeyboardType = iota KeyboardEmail KeyboardNumber KeyboardDecimal KeyboardPhone KeyboardURL )
type Keyframe ¶
type Keyframe struct {
Offset float32
Opacity float32
Scale float32
Rotate float32
TranslateY float32
Easing Curve
}
Keyframe is one step of a keyframe animation: at Offset of each cycle the view's opacity is multiplied by Opacity, it is scaled by Scale, turned Rotate degrees and moved down TranslateY times its height, on top of its own transform, and Easing takes it to the next step.
type KeyframeAnimation ¶
type KeyframeAnimation struct {
Keyframes Keyframes
Duration time.Duration
Delay time.Duration
Easing Curve
Iterations int
}
KeyframeAnimation runs Keyframes over a view on the platform's frame clock, with no work for the engine per frame. Its zero Duration and Easing are the keyframes' own (Tailwind's); a zero Iterations repeats forever.
type Keyframes ¶
type Keyframes uint8
Keyframes are a keyframe animation's steps: Tailwind's animate-spin, animate-ping, animate-pulse and animate-bounce.
const ( // KeyframesSpin turns the view once a second, for loading indicators. KeyframesSpin Keyframes = iota + 1 // KeyframesPing scales the view to twice its size as it fades out, as // a radar ping or a notification badge's halo. KeyframesPing // KeyframesPulse fades the view to half and back every two seconds, // for skeleton loaders. KeyframesPulse // KeyframesBounce drops the view a quarter of its height and back. KeyframesBounce )
type LayoutAnimation ¶
type LayoutAnimation struct {
Create, Update, Delete *LayoutTransition
}
LayoutAnimation animates the frame changes, insertions and removals of one commit on the platform, as React Native's LayoutAnimation does. Create animates the views the commit inserts, Update those whose frame changes, Delete those it removes; a nil phase leaves its changes instant.
type LayoutCurve ¶
type LayoutCurve uint8
LayoutCurve is how a layout change progresses.
const ( LayoutLinear LayoutCurve = iota LayoutEaseIn LayoutEaseOut LayoutEaseInEaseOut // LayoutSpring springs by its physics (Response and DampingRatio), running until it settles rather than for a duration. LayoutSpring // LayoutKeyboard is the software keyboard's own curve, timed from // when the keyboard started to move where the platform knows it. LayoutKeyboard // LayoutBezier follows Bezier, a style transition's easing. LayoutBezier )
type LayoutMotion ¶
type LayoutMotion struct {
// contains filtered or unexported fields
}
LayoutMotion tracks a view's frame moving under a LayoutTransition. For LayoutSpring, all four frame components (x, y, width, height) evolve independently by exact spring physics until they settle, and Retarget preserves the last frame's position and velocity so mid-flight changes flow smoothly without snapping or restarting from zero velocity.
func StartLayoutMotion ¶
func StartLayoutMotion(from, to Bounds, tr LayoutTransition, now time.Duration) LayoutMotion
StartLayoutMotion starts a frame motion from from to to under tr at clock time now.
func (*LayoutMotion) Done ¶
func (m *LayoutMotion) Done() bool
Done reports whether m has settled at its target.
func (*LayoutMotion) Retarget ¶
func (m *LayoutMotion) Retarget(to Bounds, tr LayoutTransition, now time.Duration)
Retarget redirects m to a new target frame to under tr at clock time now. It first advances m to now so the new motion begins from m's exact current position and (when tr is LayoutSpring) current velocity.
func (*LayoutMotion) Shown ¶
func (m *LayoutMotion) Shown() Bounds
Shown is the frame m last evaluated.
func (*LayoutMotion) Step ¶
func (m *LayoutMotion) Step(now time.Duration) (Bounds, bool)
Step advances m to clock time now, returning the shown frame and whether the motion has finished.
func (*LayoutMotion) Target ¶
func (m *LayoutMotion) Target() Bounds
Target is the frame m moves toward.
func (*LayoutMotion) Transition ¶
func (m *LayoutMotion) Transition() LayoutTransition
Transition is the LayoutTransition driving m.
func (*LayoutMotion) Velocity ¶
func (m *LayoutMotion) Velocity() [4]float64
Velocity is the last evaluated velocity (x, y, width, height) in points per second.
type LayoutProperty ¶
type LayoutProperty uint8
LayoutProperty is what appearing and disappearing views animate.
const ( // LayoutOpacity fades them. LayoutOpacity LayoutProperty = iota // LayoutScale grows and shrinks them from their center. LayoutScale )
type LayoutTransition ¶
type LayoutTransition struct {
Curve LayoutCurve
// Response is LayoutSpring's undamped natural period, as gpui-base's Spring: stiffness k = (2π/Response)², mass 1. When Curve is LayoutSpring, the spring runs by its physics until it settles rather than for Duration. When Response is 0 and Duration is positive, Response is derived from Duration and the damping ratio so duration-based spring configs settle in about that time; when both are 0, Response defaults to 500 ms.
Response time.Duration
// DampingRatio is LayoutSpring's damping ratio (ζ): < 1 underdamped (overshoots), 1 critically damped, > 1 overdamped. When 0, Damping is used if positive, else 1 (critically damped).
DampingRatio float64
// Damping is LayoutSpring's damping ratio when DampingRatio is 0, kept for React Native-style spring configs.
Damping float32
// Bezier is LayoutBezier's curve.
Bezier Curve
// Property is what appearing and disappearing views animate.
Property LayoutProperty
Duration time.Duration
Delay time.Duration
}
LayoutTransition is how one kind of change animates.
func (*LayoutTransition) At ¶
func (tr *LayoutTransition) At(elapsed time.Duration) (float64, bool)
At returns the transition's progress at elapsed time since the change, and whether it is done. A spring may overshoot 1 and runs until it settles rather than stopping at Duration.
func (*LayoutTransition) End ¶
func (tr *LayoutTransition) End() time.Duration
End is when the transition is done: Delay + Duration for timed curves, or Delay plus the unit-step settling time for LayoutSpring.
type LazyCarets ¶
type LazyCarets struct {
// contains filtered or unexported fields
}
LazyCarets builds a CaretLayout once, when hit testing first asks, and guards the native layout it reads from against its release: an engine embeds it, calls Set with the function that reads the lines while the layout is alive, and Drop as it releases it.
func (*LazyCarets) CaretRect ¶
func (l *LazyCarets) CaretRect(c Caret) (Bounds, bool)
CaretRect implements TextHitTester.
func (*LazyCarets) Drop ¶
func (l *LazyCarets) Drop()
Drop forgets the native layout: lines not read yet stay empty.
func (*LazyCarets) HitTest ¶
func (l *LazyCarets) HitTest(p Point) Caret
HitTest implements TextHitTester.
func (*LazyCarets) Lines ¶
func (l *LazyCarets) Lines() CaretLayout
Lines returns the lines, read on first use.
func (*LazyCarets) RangeRects ¶
func (l *LazyCarets) RangeRects(start, end int, out []Bounds) []Bounds
RangeRects implements TextHitTester.
func (*LazyCarets) Set ¶
func (l *LazyCarets) Set(read func() CaretLayout)
Set has l read its lines with read, the first time they are asked for.
type Length ¶
type Length struct {
// contains filtered or unexported fields
}
Length is a style's length. Its zero value is auto: the layout decides.
type Lifecycle ¶
type Lifecycle uint8
Lifecycle is whether the app is in use, as NSH's lifecycle() reads it.
const ( // LifecycleActive is an app that shows and has the focus: on desktops // one of its windows is the active one. LifecycleActive Lifecycle = iota // LifecycleInactive is an app that shows without the focus, as behind // another app's window, an incoming call or the app switcher. LifecycleInactive // LifecycleBackground is an app none of which shows: hidden, // minimized, covered where the system reports it, or in the // background on phones. LifecycleBackground )
type LineDash ¶
type LineDash []float32
LineDash is the lengths of a stroke's dashes and gaps in turn, an even number of them.
type LiveRegion ¶
type LiveRegion uint8
LiveRegion says how screen readers announce changes of a view's label and text (accessibilityLiveRegion). Android and the web announce them natively; macOS and iOS announce a changed label or text themselves.
const ( LiveRegionNone LiveRegion = iota // LiveRegionPolite is announced when the user is idle. LiveRegionPolite // LiveRegionAssertive interrupts what is being read. LiveRegionAssertive )
type LocalService ¶
type LocalService struct {
// Name is the instance label and Type is a service type such as _example._tcp.
Name, Type string
// Host is the resolved DNS hostname or IP address. It is set when browsing.
Host string
// Port is the listening port in host byte order.
Port int
// TXT holds the service's attributes. Keys are case-insensitive.
TXT map[string]string
}
LocalService is a DNS-SD instance on the local network.
type LocaleSettings ¶
type LocaleSettings struct {
FirstDayOfWeek int
HourCycle string
MeasurementSystem string
TemperatureUnit string
Region string
}
LocaleSettings are the regional preferences the user set, in Intl's names: FirstDayOfWeek 1 for Monday to 7 for Sunday (ISO 8601), HourCycle "h11", "h12", "h23" or "h24", MeasurementSystem "metric", "us" or "uk", TemperatureUnit "celsius" or "fahrenheit"; zero where the platform does not say, which Region decides, else the locale's region (i18n.Regional). Region is the region whose formats the user chose apart from the language, such as Linux's LC_TIME, an ISO 3166 code.
type LocationFix ¶ added in v0.2.0
type LocationFix struct {
Latitude, Longitude float64
Altitude, MSLAltitude, HorizontalAccuracy, VerticalAccuracy SensorNumber
Speed, Course SensorNumber
Timestamp time.Time
Monotonic time.Duration
HasMonotonic bool
Cached bool
Approximate bool
Age time.Duration
Gap bool
Dropped uint64
}
LocationFix is a copied WGS 84 fix. Timestamp is wall time; Monotonic is time since boot where available. Altitude is ellipsoidal, MSLAltitude is above mean sea level. Distances are meters, speed m/s and course degrees. Approximate says the user allowed the app only an approximate location as the fix came: Apple's reduced accuracy, or Android's coarse location without the fine one.
type LocationOptions ¶ added in v0.2.0
type LocationOptions struct {
Accuracy, Distance float64
Interval, MaxAge, Timeout time.Duration
Background bool
NotificationTitle, NotificationBody string
}
LocationOptions are explicit provider settings. A zero MaxAge refuses cached fixes. Background requires a separately granted capability and a native background declaration; NotificationTitle and Body name Android's foreground-service notification. Timeout defaults to 30 seconds for Locate.
type LowPowerMode ¶
type LowPowerMode uint8
LowPowerMode says whether the system's energy-saving mode is on.
const ( LowPowerUnknown LowPowerMode = iota LowPowerOff LowPowerOn )
type Matrix3D ¶
type Matrix3D [16]float64
Matrix3D is a 4×4 transform of column vectors, stored column by column as CSS's matrix3d() lists it and Core Animation's CATransform3D lays it out: a point (x, y, z) maps to (M[0]x + M[4]y + M[8]z + M[12], ...) divided by M[3]x + M[7]y + M[11]z + M[15].
func ChildPerspective ¶
ChildPerspective returns the matrix a parent's perspective of depth d puts before the transform of a child whose top left is at offset from the parent's, seen from the parent's center of size: CSS's perspective with its default origin.
func MatrixFromQuad ¶
MatrixFromQuad maps a viewport to its four projected border corners. It recovers a planar homography, including perspective, without guessing the native animation's parameters or its start time.
func Perspective3D ¶
Perspective3D sees the plane z = 0 from d away, as CSS's perspective().
func (Matrix3D) Affine ¶
Affine reports whether m is a 2D transform, and its a, b, c, d, e, f as SVG's matrix() lists them.
type MediaCommand ¶
type MediaCommand struct {
Kind MediaCommandKind
Position time.Duration // for MediaSeek
}
MediaCommand is a request from a system transport control.
type MediaCommandKind ¶
type MediaCommandKind uint8
MediaCommandKind identifies a system transport control.
const ( MediaPlay MediaCommandKind = iota + 1 MediaPause MediaTogglePlayPause MediaStop MediaNext MediaPrevious MediaSeek MediaSkipForward MediaSkipBackward )
type MemoryClipboard ¶
type MemoryClipboard struct {
Text string
Image []byte // PNG
Files []string
Items []ClipboardItem
ChangeCount int64
}
MemoryClipboard is a clipboard of a test's own: it takes the clipboard items an app sends and answers its reads, so the machine's clipboard is never touched.
type MemorySecrets ¶ added in v0.2.0
type MemorySecrets struct {
// contains filtered or unexported fields
}
MemorySecrets is a secure store of a test's own, in memory, so the machine's keychain is never touched. The zero value is empty and ready.
func (*MemorySecrets) DeleteSecret ¶ added in v0.2.0
func (m *MemorySecrets) DeleteSecret(item SecretItem) error
func (*MemorySecrets) Items ¶ added in v0.2.0
func (m *MemorySecrets) Items() map[SecretItem]string
Items returns a copy of what the store holds, each item with the Accessible it was last written with.
func (*MemorySecrets) ReadSecret ¶ added in v0.2.0
func (m *MemorySecrets) ReadSecret(item SecretItem) (string, bool, error)
func (*MemorySecrets) WriteSecret ¶ added in v0.2.0
func (m *MemorySecrets) WriteSecret(item SecretItem, value string) error
type MenuBarMode ¶
type MenuBarMode uint8
MenuBarMode says when Windows and Linux show the menu bar the window draws for the application menu. macOS's menu bar is the system's and always shows.
const ( // MenuBarShown always shows it, above the app. MenuBarShown MenuBarMode = iota // MenuBarAutoHide shows it once Alt is pressed and released alone, // until Alt alone, a press elsewhere or a chosen item hides it again, // as Windows and GNOME apps do. F10 and Alt with a menu's mnemonic // still open a menu, and the bar shows while it is open. MenuBarAutoHide )
type MenuEntry ¶
type MenuEntry struct {
ID uint32
Label string
Icon MenuIcon
Shortcut string
Role MenuRole
Disabled bool
Checkable bool
Checked bool
Radio bool
Separator bool
Items []MenuEntry
// NotInText leaves the shortcut to a text input or a web view with
// the keyboard focus: the key goes to it rather than choosing the
// item.
NotInText bool
}
MenuEntry is a MenuItem as an ItemMenu carries it: the item's handler replaced by an ID the platform reports with EventMenu (0: none), its shortcut normalized and its role's label filled in. A role item without a shortcut takes its role's, which the platform fills in.
func MenuShortcut ¶ added in v0.2.0
func MenuShortcut(entries []MenuEntry, names []string, os OS, editing, speak bool) (MenuEntry, bool)
MenuShortcut finds the enabled item of entries or of their enabled submenus that takes a shortcut of names where the focus is, a role's own where it has none, as the platforms read them: on a Mac every item's, elsewhere all but the editing roles', whose keys the focused field handles itself, and on Windows and Linux none whose role their menus leave out (MenuRoleUnsupported, with speak saying whether the platform can speak). On a Mac the first such item in menu order takes the key, as AppKit's menu does; Windows and Linux try the press's names in order and take the first item registered for that spelling. A disabled item takes nothing, and on a Mac it keeps the key from the items after it too, as AppKit stops at the first key equivalent that matches. While editing (a text input or web view has the focus), a NotInText item takes nothing and keeps its key from the items after it, since each desktop stops at it: macOS disables it during the key press, and Windows and Linux keep the first item of each shortcut. Linux offers no key pressed without Control, Alt or a logo key to the menu while editing.
type MenuIcon ¶
type MenuIcon struct {
// Data is encoded image bytes (PNG, JPEG, GIF, WebP or SVG).
Data []byte
// Source is an ImageSource (asset, file or data URI, bytes or Pixels).
Source ImageSource
// SVG is a parsed vector icon, such as lucide.Folder().
SVG *SVG
// Template draws a monochrome icon in the menu's text color.
Template bool
}
MenuIcon is an icon shown beside a native menu item on macOS, Windows and Linux. Data holds encoded image bytes (PNG, JPEG, GIF, WebP or SVG), as TrayConfig.Icon takes; Source holds any ImageSource (asset, file or data URI, bytes or Pixels); SVG holds a parsed vector icon such as lucide.Folder(). When more than one is set, SVG takes precedence over Data, and Data over Source. Template draws a monochrome icon in the menu's text color, adapting to light and dark appearance (and selection on macOS); a monochrome SVG icon is treated as a template by default.
func (MenuIcon) Clone ¶
Clone returns a copy of m whose byte slices, pixel buffer and variant map do not alias m's.
func (MenuIcon) IsTemplate ¶
IsTemplate reports whether m should be tinted with the menu's text color: Template is set, or SVG uses currentColor exclusively.
type MenuRole ¶
type MenuRole uint8
MenuRole is a standard menu item the platform carries out, labelling it and giving it its usual shortcut when the item has none of its own. The app is not told when it is chosen.
const ( MenuRoleNone MenuRole = iota // MenuAbout, MenuHide, MenuHideOthers and MenuShowAll are macOS's. MenuAbout MenuHide MenuHideOthers MenuShowAll MenuQuit // The edit roles act on the focused text field. MenuUndo MenuRedo MenuCut MenuCopy MenuPaste MenuSelectAll MenuMinimize MenuZoom MenuToggleFullScreen MenuClose // MenuPasteAndMatchStyle pastes the clipboard's text without its style, and MenuDelete removes the selection, in the focused text field or web view. MenuPasteAndMatchStyle MenuDelete // MenuStartSpeaking reads the focused text field's selection aloud and MenuStopSpeaking stops it, on macOS and, where they speak, Windows and Linux. MenuBringAllToFront is macOS's. MenuStartSpeaking MenuStopSpeaking MenuBringAllToFront // MenuServices, MenuWindowMenu and MenuHelpMenu mark an item holding a submenu as macOS's Services menu, which AppKit fills, its Window menu, which lists the app's windows, and its Help menu, which gets the help search field, whatever their titles. MenuServices is macOS's; elsewhere the other two hold ordinary submenus, and are left out with no items. MenuServices MenuWindowMenu MenuHelpMenu )
func (MenuRole) EditsText ¶
EditsText reports whether r is an editing action whose key the focused text field handles itself, which it then leaves to the field. MenuPasteAndMatchStyle is not: no field handles its key, so the menu does.
func (MenuRole) HoldsMenu ¶ added in v0.2.0
HoldsMenu reports whether r marks an item holding a submenu (MenuServices, MenuWindowMenu, MenuHelpMenu), which it is even with no items.
type MiniProgramCredential ¶
type MiniProgramCredential struct {
Platform, Code string
}
MiniProgramCredential is EventMiniProgramSignIn's short-lived code. The application exchanges it on its server, using Platform's own login API.
type ModalAnimation ¶
type ModalAnimation uint8
ModalAnimation is how a modal appears.
const ( ModalSlide ModalAnimation = iota ModalFade ModalNone )
func (ModalAnimation) Duration ¶
func (a ModalAnimation) Duration() time.Duration
Duration is how long a modal takes to appear or go with a, as the platforms present it: what its component waits before it reports the modal shown or gone.
type ModalConfig ¶
type ModalConfig struct {
Animation ModalAnimation
// Presentation, NoCloseOnSwipe and Orientations are iOS's. A sheet
// reports its size with EventModalSize, its swipes with
// EventRequestClose.
Presentation ModalPresentation
NoCloseOnSwipe bool
Orientations Orientation
// NoCloseOnEscape and NoCloseOnBackdropPress are the app's: the
// core and base keep the modal on those, and tests read them, as
// StatusBarTranslucent, Android's, which the core lays the modal out
// by.
NoCloseOnEscape, NoCloseOnBackdropPress bool
StatusBarTranslucent bool
}
ModalConfig is how a modal appears and goes.
type ModalPresentation ¶
type ModalPresentation uint8
ModalPresentation is how a modal covers the screen on iOS.
const ( // ModalFullScreen covers the whole screen with the modal's own look. ModalFullScreen ModalPresentation = iota // ModalPageSheet is the system's sheet, which leaves the content // behind it in sight. ModalPageSheet // ModalFormSheet is a smaller sheet, centered on large screens. ModalFormSheet )
type Modifiers ¶
type Modifiers struct {
Control, Alt, Shift bool
// Platform is Command on Apple platforms, the Windows or Super key
// elsewhere.
Platform bool
}
Modifiers are the modifier keys held during an event.
type Monitor ¶ added in v0.2.0
type Monitor interface {
// RecordWork records the main thread's work on a frame, and whether the
// frame changed what the screen shows.
RecordWork(cost time.Duration, dirty bool)
// Vsync records a display refresh at at, interval after the previous.
Vsync(at time.Time, interval time.Duration)
}
Monitor reads what a surface's frames cost: engine.PerfMonitor implements it, and a backend installs one only when the app runs with --nsgo-fps.
A Clock reports to it, so a backend never times a frame itself.
type MotionOptions ¶ added in v0.2.0
type MotionOptions struct {
Sensors MotionSensors
Interval time.Duration
}
MotionOptions chooses sensors and a sample interval (10 ms to one second). Zero Sensors requests accelerometer; zero Interval requests 20 ms.
type MotionSample ¶ added in v0.2.0
type MotionSample struct {
Sensor MotionSensors
Vector, Gravity, UserAcceleration, RotationRate SensorVector
Attitude SensorQuaternion
HeadingReferenced bool
Timestamp, Interval time.Duration
Accuracy int
Gap bool
Dropped uint64
}
MotionSample contains one sensor's latest reading, never fabricated axes. Timestamp is monotonic time in the provider's clock. Accuracy is -1 if unknown, otherwise 0 (unreliable) through 3 (high). Dropped counts replaced samples since the previous delivery, including native provider back-pressure.
type MotionSensors ¶ added in v0.2.0
type MotionSensors uint8
MotionSensors is a set of raw sensors and the fused device-motion sensor.
const ( SensorAccelerometer MotionSensors = 1 << iota SensorGyroscope SensorMagnetometer SensorDeviceMotion )
type MountBatch ¶
type MountBatch struct {
Root NodeID
Items []MountItem
// GeometryVersion identifies the committed tree for DevTools' native geometry snapshots. Zero when no displayed geometry was requested.
GeometryVersion uint64
// LayoutAnimation, when set, animates the batch's frame changes,
// insertions and removals on the platform (Scope.AnimateLayout).
LayoutAnimation *LayoutAnimation
// Sent is when the engine handed the batch to the platform, for the
// performance monitor's latency reading; the zero time when no monitor
// measures.
Sent time.Time
// Causes are what the commit followed from, recorded while TraceCauses is set; nil otherwise.
Causes *Causes
}
MountBatch is one commit's changes, applied in order on the main thread. Root is the view the platform shows in its surface.
type MountItem ¶
type MountItem struct {
Kind ItemKind
Head *PageHead // ItemPageHead
ID NodeID
View ViewKind // ItemCreate
Parent NodeID // ItemInsert
Before NodeID // ItemInsert
Frame Bounds // ItemFrame
Size Size // ItemScrollContent
Value string // ItemInputValue
Count uint32 // ItemInputValue
// Address is ItemHistory's optional application address, applied after reconciling Count's navigation depth. Push asks for an entry of its own.
Address *PageAddress
// Transition, when set, moves an ItemFrame's view from where it shows
// to Frame, as a batch's LayoutAnimation Update does, which wins.
Transition *LayoutTransition
// Point and Animated are ItemScrollTo's.
Point Point
Animated bool
// Transformed is ItemOverflow's.
Transformed bool
// Clipboard is what an ItemReadClipboard reads.
Clipboard ClipboardRead
// Appearance is ItemAppearance's, RTL, Language and Forced
// ItemDirection's.
Appearance Appearance
RTL bool
Language string
Forced bool
Events EventMask
ViewStyle *ViewStyle
Text *TextContent
Input *InputConfig
ViewProps *ViewProps
Scroll *ScrollConfig
Image *ImageConfig
Modal *ModalConfig
Alert *AlertConfig
Drawing *Drawing
Shader *Shader
GPU *GPUViewConfig
// Keys are ItemKeymap's bindings, oldest first; see FindKey.
Keys []KeyBinding
// HeldKeys is ItemKeymap's ask for every key going down and up on the surface, not only those of a focused view that hears keys: the platform reports a down no such view hears with ID 0 (EventKeyDown) and its up (EventKeyUp), for core.KeysDown. It leaves out keys typed while a text input or a web view has the focus or an input method composes, as for a view's keys.
HeldKeys bool
// HeldMouseButtons is ItemKeymap's ask for every mouse button going down and up on the surface, not only those on a view that hears mouse buttons: the platform reports a button press no such view hears with ID 0 (EventMouseDown) and its release (EventMouseUp), for core.MouseButtonsDown.
HeldMouseButtons bool
Window *WindowCommand
Menu []MenuEntry
Web *WebConfig
// WebCommand is ItemWebCommand's.
WebCommand WebCommand
PictureInPicture *PictureInPictureConfig
Video *VideoConfig
Time time.Duration // ItemVideoSeek
Native *NativeConfig
// Data is ItemNativeCommand's argument.
Data any
Animation []AnimationOp
Zoom *ZoomRequest
// Selection is ItemSelection's range.
Selection TextRange
// Sticky are ItemStickyCells' cells.
Sticky []StickyCell
StatusBar *StatusBarConfig
Screen *ScreenConfig
// Pick is ItemPickImages' and ItemTakePhoto's request.
Pick *PickRequest
// Scan is ItemScanCode's request.
Scan *ScanRequest
// Discovery is ItemDiscovery's request.
Discovery *DiscoveryRequest
// Sensor is an ItemSensor's request, Speech an ItemSpeech's, Audio an ItemAudio's.
Sensor *SensorRequest
Speech *SpeechRequest
Audio *AudioRequest
// HapticPattern is the timed feedback ItemHapticPattern plays.
HapticPattern *HapticPattern
// NowPlaying is the app's publication (ItemNowPlaying).
NowPlaying *NowPlayingUpdate
// Auth is an ItemAuthSession's request.
Auth *AuthRequest
// Cookies is an ItemWebCookies' request.
Cookies *WebCookiesRequest
// AppleSignIn is an ItemSignInWithApple's request.
AppleSignIn *AppleSignInRequest
// Speak is an ItemSpeak's request.
Speak *SpeakRequest
// Purchase is an ItemPurchase's request.
Purchase *PurchaseRequest
// Notification is what ItemShowNotification shows.
Notification *Notification
// Permission is an ItemPermission's request.
Permission *PermissionRequest
// Awake is ItemKeepAwake's power assertion.
Awake *KeepAwake
// Progress is ItemTaskProgress's state.
Progress *TaskProgress
// Files is ItemPickFiles' request, Save ItemSaveFile's,
// Directories ItemPickDirectories', Open ItemOpenFile's and
// ItemInstallPackage's and Share ItemShare's.
Files *FilesRequest
Save *SaveRequest
Directories *DirectoriesRequest
Open *SharedFile
// QuickLook is ItemQuickLook's request.
QuickLook *QuickLookRequest
// SystemGestures is ItemSystemGestures' complete surface preference.
SystemGestures *SystemGestureOptions
// Surface is ItemOpenSurface's window, Tray ItemTray's icon, and On
// ItemDock's and ItemSetLaunchAtLogin's choice and whether
// ItemCheckForUpdates checks in the background.
Surface *SurfaceConfig
Tray *TrayConfig
// UpdatePreference changes updater settings instead of checking its feed.
UpdatePreference *UpdatePreference
On bool
// OffscreenID is the resource ID of an ItemReleaseOffscreen.
OffscreenID uint64
// Bytes is ItemImageCacheLimit's memory budget in bytes.
Bytes int64
}
MountItem is one change to the native views. Kind says which fields are set; the large groups are pointers so items stay small.
type MouseButton ¶
type MouseButton uint8
MouseButton is a button of the mouse; the zero value is none.
const ( MouseButtonNone MouseButton = iota MouseButtonLeft MouseButtonRight MouseButtonMiddle MouseButtonBack MouseButtonForward )
func (MouseButton) String ¶
func (b MouseButton) String() string
String names the mouse button for logs and diagnostics.
type NativeBinding ¶
NativeBinding binds a component's prop Name to animated node Node; Color says the node outputs a color.
type NativeComponent ¶
type NativeComponent interface {
// View is the view that fills the box: an NSView or UIView pointer as
// a uintptr on Apple platforms, a child HWND on Windows, a GtkWidget
// pointer on Linux, a DOM element (syscall/js.Value) on the web, and
// on Android the name of a View class the runtime builds by
// reflection.
View() any
// SetProp sets a prop; nil removes it.
SetProp(name string, value any)
// Command runs a command Ref.Command sent.
Command(name string, args any)
// Close releases the component when its element goes.
Close()
}
NativeComponent is one Native element's platform view. Its methods run on the main thread.
type NativeComponents ¶
type NativeComponents map[string]NativeFactory
NativeComponents are the components an app registers with its platform, by name.
type NativeConfig ¶
type NativeConfig struct {
Component string
Props map[string]any
// Bindings, when Bind is set, replace the props animated nodes drive,
// which the platform's Animator hands the component on the frames
// they change.
Bind bool
Bindings []NativeBinding
}
NativeConfig is what ItemNative sends: the component's name and the props that changed since the last item, nil for one removed. The first item of a view carries all of them.
type NativeContext ¶
type NativeContext struct {
// contains filtered or unexported fields
}
NativeContext is how a component talks back to its element. Its methods may be called from any goroutine.
func NewNativeContext ¶
func NewNativeContext(emit func(name string, data any), size func(Size)) *NativeContext
NewNativeContext returns the context a platform hands a factory: emit reports an event, size the size the component asks for.
func (*NativeContext) Emit ¶
func (c *NativeContext) Emit(name string, data any)
Emit sends an event to the element's OnEvent.
func (*NativeContext) SetSize ¶
func (c *NativeContext) SetSize(s Size)
SetSize asks for a size: the element measures to it where its style leaves a dimension open, as an image does to its natural size. A dimension of 0 asks for the other alone.
type NativeEnabler ¶
type NativeEnabler interface {
EnableNative()
}
NativeEnabler is implemented by backends whose native-component bridge links on demand.
type NativeFactory ¶
type NativeFactory func(cx *NativeContext) NativeComponent
NativeFactory makes a component's view for one Native element, on the platform's main thread; nil leaves the box empty.
type Network ¶
type Network struct {
// Online says the system considers a network route usable.
Online bool
// Expensive says the system considers that route metered or expensive.
Expensive bool
}
Network is the device's connectivity as its system reports it.
type NetworkWatcher ¶
type NetworkWatcher interface {
// WatchNetwork returns the initial state and a stop function, or nil
// when unsupported. Changes can arrive on any goroutine.
WatchNetwork(changed func(Network)) (initial Network, stop func())
}
NetworkWatcher supplies connectivity when an app reads its network state. Keeping its method behind an interface lets apps that never read that state leave the native watcher out of their binary.
type NodeID ¶
type NodeID uint32
NodeID identifies a view of one tree. IDs start at 1, stay dense and are reused after a Delete.
type Notification ¶
type Notification struct {
ID, Title, Body string
Silent bool
At time.Time
Repeat NotificationRepeat
}
Notification is a system notification (ItemShowNotification), as core.Notification. At is when it shows, zero for now; core sends a later one only where Environment.ScheduledNotifications says so, and with Repeat, At is the first time it shows, after now, and its clock reading in At's location the time of day it shows again, in the device's time zone.
type NotificationRepeat ¶ added in v0.2.0
type NotificationRepeat uint8
NotificationRepeat is how a scheduled notification shows again, as core's.
const ( NotificationOnce NotificationRepeat = iota NotificationDaily NotificationWeekly )
type NotificationScheduler ¶
type NotificationScheduler struct {
// Fire runs outside the scheduler's lock when a scheduled notification comes due. nextAt is the next scheduled time for repeating notifications and zero for NotificationOnce. Async handlers can check Canceled(n.ID, seq) before delivering.
Fire func(n Notification, nextAt time.Time, seq uint64)
// Now returns the current wall time; defaults to time.Now.
Now func() time.Time
// AfterFunc schedules fn to run after d; defaults to time.AfterFunc.
AfterFunc func(d time.Duration, fn func()) NotificationTimer
// MaxStep caps each timer wait so suspend/resume, wall-clock jumps and JavaScript's 32-bit setTimeout limit are handled without drift. Zero uses one minute; a negative duration disables chunking.
MaxStep time.Duration
// contains filtered or unexported fields
}
NotificationScheduler keeps scheduled notifications in memory while the app runs, invoking Fire as each wall time arrives and re-arming daily and weekly repeats. It is safe for concurrent use.
func (*NotificationScheduler) Cancel ¶
func (s *NotificationScheduler) Cancel(id string) bool
Cancel cancels the pending notification called id, or every pending notification when id is empty. It reports whether any pending notification was removed.
func (*NotificationScheduler) Canceled ¶
func (s *NotificationScheduler) Canceled(id string, seq uint64) bool
Canceled reports whether the scheduled notification with id and sequence seq has since been canceled, replaced, cleared or closed.
func (*NotificationScheduler) Close ¶
func (s *NotificationScheduler) Close()
Close stops every pending timer and prevents future scheduling or delivery.
func (*NotificationScheduler) Pending ¶
func (s *NotificationScheduler) Pending() []Notification
Pending returns a snapshot of the currently pending notifications, sorted by scheduled time then ID.
func (*NotificationScheduler) Schedule ¶
func (s *NotificationScheduler) Schedule(n Notification) (uint64, bool)
Schedule schedules n for its At (and repeats for Daily/Weekly), replacing any pending notification with the same ID. It returns the entry's sequence number and whether it was scheduled.
type NotificationTimer ¶
type NotificationTimer interface {
Stop() bool
}
NotificationTimer is a cancellable timer used by NotificationScheduler.
type NowPlaying ¶
type NowPlaying struct {
Title, Artist, Album string
Artwork *ImageSource
Duration, Position time.Duration
Rate float32
Commands []MediaCommandKind
}
NowPlaying is the metadata the platform presents for an app's media.
func CloneNowPlaying ¶
func CloneNowPlaying(info NowPlaying) NowPlaying
CloneNowPlaying snapshots mutable artwork and command data.
type NowPlayingUpdate ¶
type NowPlayingUpdate struct {
Info NowPlaying
At time.Time
HandlesCommands bool
}
NowPlayingUpdate is what ItemNowPlaying publishes. At anchors Position, and HandlesCommands says a live callback can take the listed commands.
type OSVersion ¶
type OSVersion struct {
Major, Minor int
}
OSVersion is an operating system's version.
type ObjectPosition ¶
type ObjectPosition struct {
X, Y PositionAxis
}
ObjectPosition is where an image sits in its view once its ResizeMode has sized it, as CSS's object-position places it. The parts of a covering image that overflow are cropped. The zero value centers it.
func (ObjectPosition) Place ¶
func (p ObjectPosition) Place(box, content Size) Point
Place returns the top left corner of content of the given size placed in a box of size.
type Obstruction ¶
type Obstruction struct {
Frame Bounds
// Horizontal is an obstruction between a region above and one below; else it is vertical, between a region on the left and one on the right.
Horizontal bool
// Occluding says the pixels under it are not shown or touched.
Occluding bool
// Separating says the regions on either side read as logically apart.
Separating bool
// State is how far this fold or hinge is open, as the platform reports it for each; Geometry.State is the device's.
State HingeState
// Angle is the hinge's angle in radians, where the platform reports one, as HasAngle says.
Angle float32
HasAngle bool
}
Obstruction is a fold or a hinge: its frame, its orientation and three properties that vary apart.
type OfferPaymentMode ¶ added in v0.2.0
type OfferPaymentMode string
OfferPaymentMode is how a subscription offer is paid.
const ( OfferFreeTrial OfferPaymentMode = "freeTrial" OfferPayAsYouGo OfferPaymentMode = "payAsYouGo" OfferPayUpFront OfferPaymentMode = "payUpFront" )
type OffscreenCanvas ¶
type OffscreenCanvas struct {
ID uint64
Version uint64
// Size is the logical size in points.
Size Size
// Scale is the backing pixels per point; values <= 0 default to 1.
Scale float32
// Drawing holds the recorded operations to render into the offscreen
// surface.
Drawing *Drawing
}
OffscreenCanvas is a recorded 2D drawing that platforms render once into an offscreen surface keyed by (ID, Version) and reuse as an image source across later frames until Version changes or ItemReleaseOffscreen releases ID. Once handed to the platform it never changes.
func (*OffscreenCanvas) EffectiveScale ¶
func (o *OffscreenCanvas) EffectiveScale() float32
EffectiveScale returns o's backing pixels per point, defaulting to 1 when Scale is not positive or finite.
func (*OffscreenCanvas) PixelSize ¶
func (o *OffscreenCanvas) PixelSize() (int, int)
PixelSize returns the backing bitmap dimensions in pixels (width, height), or (0, 0) when o is nil or has a non-positive logical size.
func (*OffscreenCanvas) Same ¶
func (o *OffscreenCanvas) Same(other *OffscreenCanvas) bool
Same reports whether o and other refer to the same offscreen canvas at the same version.
type Orientation ¶
type Orientation uint8
Orientation is a set of interface orientations.
const ( OrientationPortrait Orientation = 1 << iota OrientationPortraitUpsideDown OrientationLandscapeLeft OrientationLandscapeRight OrientationLandscape = OrientationLandscapeLeft | OrientationLandscapeRight )
type Outline ¶
type Outline struct {
Width Points
Offset Points
Color Color
// Style is solid when 0; none and hidden draw nothing.
Style BorderStyle
}
Outline is a line around a view's border box, outside layout, Offset away from it (inside when negative), following its corners.
type PageAddress ¶
type PageAddress struct {
URL string
Push bool
// Set distinguishes an explicit application write from the address carried passively while acknowledging a navigation depth.
Set bool
}
PageAddress accompanies ItemHistory without changing its navigation depth.
type PageAddressChange ¶
PageAddressChange is EventOpenLinks' browser traversal payload. Depth is the navigation depth of the landed entry; an empty Reason updates quietly.
type PageHead ¶
PageHead is the merged metadata of the visible web.Head components. An unset field restores the page's original value; a set empty one clears it.
type Paint ¶
type Paint struct {
// contains filtered or unexported fields
}
Paint is what SVG's paint properties, Fill and Stroke, paint with: a color, nothing or the text color. The zero Paint is unset, so the property inherits.
type PaintStyle ¶
type PaintStyle struct {
Fill, Stroke Paint
// StrokeWidth is the line width; 0 is unset, CSS's initial 1.
StrokeWidth Points
// StrokeDash is the dashes and gaps in turn, repeated when odd; nil is
// unset and empty solid, as are lengths adding up to 0.
StrokeDash []Points
// Background and Gradients are the view's own background, which
// FillBackgroundFromView fills with.
Background Color
Gradients []Gradient
}
PaintStyle is the SVG paint properties a canvas view inherits.
type PanActivation ¶
PanActivation decides on the main thread when a drag on a view becomes its pan, so it can share touches with the scroll views around it, as react-native-gesture-handler's offsets do. A fail offset passed first leaves the touch to others; an active offset passed activates the pan. With no active offset the pan activates after 10 points either way. Zero fields are unset.
func (PanActivation) Decide ¶
func (a PanActivation) Decide(d Point) int
Decide returns whether a drag translated by d activates the pan (1), fails it (-1) or is undecided (0). Platforms call it on each move until it decides.
type PanelDock ¶
type PanelDock struct {
Edge WindowPlacement
Display string
Margin Points
}
PanelDock attaches a panel to an output's usable edge. A default Edge leaves the panel's placement unchanged; Display is an optional display ID.
type PanelFrameMotion ¶
type PanelFrameMotion struct {
// contains filtered or unexported fields
}
PanelFrameMotion eases a desktop panel between two frames in its backend's native coordinates. The zero value is idle; the backend owns the frame clock.
func (*PanelFrameMotion) Active ¶
func (m *PanelFrameMotion) Active() bool
Active reports whether a destination still needs frames.
func (*PanelFrameMotion) Start ¶
func (m *PanelFrameMotion) Start(from, to Bounds, now time.Time) bool
Start moves from the frame currently shown, leaving an identical active destination alone. It reports whether frames are needed.
func (*PanelFrameMotion) Step ¶
Step returns the frame at now, or false if idle. The last sample is exactly the requested destination even when the display skipped frames.
func (*PanelFrameMotion) Stop ¶
func (m *PanelFrameMotion) Stop()
Stop leaves the panel where it was last placed.
type PasteBehavior ¶
type PasteBehavior uint8
PasteBehavior says whether an input inserts the text the user pastes.
const ( // PasteInsert inserts it, as inputs do. PasteInsert PasteBehavior = iota // PasteReport only reports it with OnPaste, for the app to handle. PasteReport )
type PasteEvent ¶
type PasteEvent struct {
// HTML is the same content with its formatting when the clipboard holds it (public.html on macOS and iOS, CF_HTML on Windows, text/html on Linux and the web, ClipData.Item.getHtmlText on Android).
HTML string
Text string
Files []PastedFile
URIs []string
}
PasteEvent is what the user pasted into an input, read from the clipboard as they pasted: its HTML when the clipboard holds it, its plain text (empty without any), files with their bytes, such as an image copied in another app, and the file: URLs of local files copied in a file manager.
type PastedFile ¶
PastedFile is a file the clipboard held: its name when it has one, its MIME type and its bytes.
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path is a path to fill, stroke or clip with, as the web's Path2D: it records MoveTo, LineTo and the shapes in its own coordinates, which take the drawing's transform where it is used. Its arcs of ellipses and per-corner rectangles are cubic Béziers.
func MustParsePath ¶
MustParsePath is ParsePath for path data that is part of the program: it panics when the data is in error.
func ParsePath ¶
ParsePath reads SVG path data ("M 0 0 L 10 10 Z") into a path. It understands every command of SVG 1.1's path grammar; arcs become cubic curves.
func (*Path) Arc ¶
Arc adds an arc of radius r around (x, y) from angle a0 to a1, joined to the path by a line.
func (*Path) EllipseArc ¶
EllipseArc adds an arc of an ellipse as Drawing.EllipseArc does.
func (*Path) RoundRectCorners ¶
func (p *Path) RoundRectCorners(x, y, w, h, topLeft, topRight, bottomRight, bottomLeft float32) *Path
RoundRectCorners adds a rectangle as Drawing.RoundRectCorners does.
type PeriodUnit ¶ added in v0.2.0
type PeriodUnit string
PeriodUnit is a unit of a subscription's period.
const ( PeriodDay PeriodUnit = "day" PeriodWeek PeriodUnit = "week" PeriodMonth PeriodUnit = "month" PeriodYear PeriodUnit = "year" )
type PermissionCommand ¶
type PermissionCommand uint8
PermissionCommand is what an ItemPermission asks.
const ( // PermissionCheck answers the status without asking the user. PermissionCheck PermissionCommand = iota // PermissionAsk shows the system's prompt where it has one and has not asked yet, then answers the status. PermissionAsk // PermissionOpenSettings opens the page of the system's settings that gives the permission; EventPermission's Finished says whether one opened. PermissionOpenSettings // PermissionGuide opens the settings and guides the user there; it is answered once, as the guide ends, with the status then. PermissionGuide // PermissionStopGuide ends the guide whose request was Count, which still answers its own request; it is not answered itself. PermissionStopGuide )
type PermissionRequest ¶
type PermissionRequest struct {
Command PermissionCommand
// Name is the permission's key, one of the Permission* keys; "" for PermissionStopGuide.
Name string
// App is the path of the app PermissionGuide holds out to drag, and AppName what it calls it; "" for the defaults.
App, AppName string
}
PermissionRequest is an ItemPermission's.
type PickEncoding ¶
type PickEncoding uint8
PickEncoding is what a platform does with one picked image.
const ( // PickKeep keeps its bytes as they are. PickKeep PickEncoding = iota // PickPNG decodes it, its orientation applied, scales it to fit // MaxDimension and encodes it as a PNG: an image that was a PNG. PickPNG // PickJPEG does the same and encodes a JPEG at the request's quality. PickJPEG )
type PickFormat ¶
type PickFormat uint8
PickFormat says which formats picked images come in.
const ( // PickCompatible keeps JPEG, PNG, GIF and WebP as they are and turns // any other format, such as HEIC or TIFF, into JPEG. PickCompatible PickFormat = iota // PickCurrent keeps the format the image is stored in, unless it is // encoded again to scale it or for a quality. PickCurrent )
type PickRequest ¶
type PickRequest struct {
// Limit is the most images the user picks: 1 for a single pick, at
// most MaxPicked.
Limit int
// MaxDimension scales images whose longer side has more pixels down
// to it, encoding them again; 0 keeps their size.
MaxDimension int
// Quality is the JPEG quality images are encoded at, from 0 to 1;
// 0 means DefaultPickQuality and keeps JPEGs that need no other
// change as they are.
Quality float32
// Format says which formats images come in.
Format PickFormat
}
PickRequest is a pick as the platform carries it out.
func (PickRequest) DialogExtensions ¶
func (r PickRequest) DialogExtensions() []string
DialogExtensions returns the file extensions a desktop's open dialog offers for r when the backend reads files as they are: only the formats every platform shows unless r keeps the current format.
func (PickRequest) Encoding ¶
func (r PickRequest) Encoding(mime string, size Size) PickEncoding
Encoding returns what to do with an image of type mime whose pixels are size, its orientation applied.
func (PickRequest) JPEGQuality ¶
func (r PickRequest) JPEGQuality() float32
JPEGQuality returns the quality JPEGs are encoded at, from 0 to 1.
func (PickRequest) ScaledSize ¶
func (r PickRequest) ScaledSize(size Size) Size
ScaledSize returns the size an image of size pixels is scaled to: its longer side at most MaxDimension, its aspect ratio kept.
type PickedFile ¶
type PickedFile struct {
// Name has an extension that matches MIME (IMG_0042.jpg).
Name string
// MIME is its media type (image/jpeg).
MIME string
Data []byte
// Size is its size in pixels as it shows, its orientation applied.
Size Size
// Modified is when it last changed, zero when the platform does not
// say.
Modified time.Time
}
PickedFile is an image the user picked.
func FinishPick ¶
func FinishPick(r PickRequest, files []PickedFile, size func(data []byte) (Size, error)) []PickedFile
FinishPick returns files as the app gets them: at most r.Limit, each with a type, a name matching it and, when size reads it, a size.
type PictureInPictureConfig ¶
type PictureInPictureConfig struct {
Size Size
Paused bool
Duration time.Duration // zero is a live stream
Position time.Duration
Automatically bool
}
PictureInPictureConfig describes a custom-content session, whose view is a detached layout root. Video sessions use VideoConfig instead.
type PictureInPictureEvent ¶
type PictureInPictureEvent struct {
State PictureInPictureState
Action string // restore, play, pause, skip
Time time.Duration
Token uint32
}
PictureInPictureEvent uses EventNative, independent of EventMask's fixed-size input bits. Action is empty for state updates.
type PictureInPictureState ¶
type PictureInPictureState struct {
Supported, Possible, Active bool
Error string
FrameInterval time.Duration
}
PictureInPictureState is the native session's state. Possible says whether the platform can start it now; Unsupported is distinct from failure.
type Pictures ¶
type Pictures uint8
Pictures is a set of pictures a WGSL program reads, its textures in this order.
type PlatformUnwrapper ¶
type PlatformUnwrapper interface {
UnwrapPlatform() any
}
PlatformUnwrapper returns the wrapped backend platform so core can reach its optional feature enablers without the wrapper referencing them.
type Point ¶
type Point struct{ X, Y Points }
Point is a position in points.
func ClampHotspot ¶
ClampHotspot clamps hotspot (in logical points from top-left) to [0, size-1]. When a dimension of size is <= 0 (unknown), that axis is only clamped to >= 0.
type Pointer ¶
type Pointer uint8
Pointer is the precision of the device's primary pointing device, matching CSS's pointer media feature (fine, coarse or none). The zero value derives it from Idiom.
const ( // PointerUnspecified derives the pointer precision from Idiom. PointerUnspecified Pointer = iota // PointerFine is an accurate pointing device, such as a mouse or trackpad. PointerFine // PointerCoarse is a limited-accuracy pointing device, such as a finger on a touchscreen. PointerCoarse // PointerNone is a device with no primary pointing device, such as a TV remote. PointerNone )
type PointerDelta ¶
type PointerDelta struct{ X, Y float64 }
PointerDelta is a relative movement in the platform's input units.
type PointerEvents ¶
type PointerEvents uint8
PointerEvents says which of a view and its children take touches and the pointer.
const ( // PointerEventsAuto lets the view and its children take them. PointerEventsAuto PointerEvents = iota // PointerEventsNone lets neither take them: they reach what is below. PointerEventsNone // PointerEventsBoxNone lets only the children take them. PointerEventsBoxNone // PointerEventsBoxOnly lets only the view take them, never its // children. PointerEventsBoxOnly // PointerEventsOn is auto in a style, where 0 is unset: it stops a // none the view inherits. The core sends it as PointerEventsAuto. PointerEventsOn )
type PointerLock ¶
PointerLock identifies a request for native relative motion.
func (PointerLock) Motion ¶
func (p PointerLock) Motion(dx, dy float64) Event
func (PointerLock) Unlocked ¶
func (p PointerLock) Unlocked() Event
type Points ¶
type Points float32
Points is a length in platform-independent points (iOS points, Android dp, CSS pixels at a zoom of 1).
RefreshPull is how far past its top a released pull refreshes with the platform's spinner, and RefreshSpace the room the spinner keeps above the content while refreshing.
const ( // ScrollHandleInset is the distance from the scroll view's trailing edge // (right for vertical, bottom for horizontal) to the visual handle. ScrollHandleInset Points = 3 // ScrollHandleMargin keeps the handle clear of both ends of the scroll // axis. ScrollHandleMargin Points = 4 // ScrollHandleThickness is the visual thickness of the handle at rest, // and ScrollHandleActiveThickness its thickness while dragged. ScrollHandleThickness Points = 6 ScrollHandleActiveThickness Points = 10 // ScrollHandleMinLength is the shortest visual handle along the scroll // axis (clamped to half the track on very small scroll views so travel // stays positive). ScrollHandleMinLength Points = 44 // ScrollHandleGrabThickness is the width of the touch-grab strip along // the trailing edge. ScrollHandleGrabThickness Points = 32 // ScrollHandleGrabSlop extends the touch-grab target past both ends of // the visual handle along the scroll axis. ScrollHandleGrabSlop Points = 8 )
const DefaultFontSize Points = 14
DefaultFontSize is the font size of text no ancestor sizes: 14, as NSH's and MyGo's text defaults.
const DefaultPanSlop Points = 10
DefaultPanSlop is the distance a drag moves before it activates a pan without active offsets.
type PositionAxis ¶
PositionAxis is an ObjectPosition along one axis: Offset from the start edge (left, top), or from the end edge (right, bottom) when FromEnd. A percentage is of the free space, the view's size less the image's, so Pct(0) is the start, Pct(50) the center and Pct(100) the end; an auto Offset, the zero value, is the center.
func (PositionAxis) Resolve ¶
func (a PositionAxis) Resolve(free Points) Points
Resolve returns where content starts along the axis, from the start edge, given the free space: the box's size less the content's.
type PositionCodes ¶
type PositionCodes struct {
USB, XKB, Windows, Mac uint16
}
PositionCodes are a physical position's codes on each platform: its keyboard-page HID usage (iOS and the USB column), XKB key code (Linux; Android's and HarmonyOS's Linux input code is 8 less), Windows set-1 scan code with its 0xe0 prefix, and AppKit key code, 0xffff where a Mac keyboard has none.
func KeyPositionCodes ¶
func KeyPositionCodes(code string) (PositionCodes, bool)
KeyPositionCodes returns the platform codes of a physical position named as KeyboardEvent.code, for test hosts that press a position.
type PreciseLocationAnswer ¶
type PreciseLocationAnswer struct {
Full bool
}
PreciseLocationAnswer reports the authorization after an explicit accuracy request; it contains no position. Full=false is an allowed approximate grant.
type PreparedText ¶
type PreparedText interface {
// Measure returns the size of the text wrapped at maxWidth (Auto: no
// wrapping).
Measure(maxWidth Points) Size
// Layout returns the text laid out in size, for the main thread to
// draw.
Layout(size Size) TextLayout
// Release frees what the prepared text holds.
Release()
}
PreparedText is text a TextEngine shaped.
type PressureSample ¶
type PressureSample struct {
Pascals float64
RelativeAltitude SensorNumber
Timestamp, Interval time.Duration
Gap bool
Dropped uint64
}
PressureSample reports absolute pressure in pascals. RelativeAltitude, when available, is meters from the provider's start, not an absolute elevation.
type Product ¶ added in v0.2.0
type Product struct {
ID string
Type ProductType
// Title and Description are the product's display name and description, DisplayPrice its price as the store formats it for the user's storefront, which apps show as it is. Price is the same amount as a decimal number, "4.99", and CurrencyCode its ISO 4217 currency.
Title, Description string
DisplayPrice string
Price string
CurrencyCode string
// Subscription is an auto-renewable subscription's, nil for other products.
Subscription *Subscription
}
Product is what the store sells, in the user's storefront's language and currency.
type ProductType ¶ added in v0.2.0
type ProductType string
ProductType is what kind of thing a product sells, named as StoreKit 2 names it.
const ( ProductConsumable ProductType = "consumable" ProductNonConsumable ProductType = "nonConsumable" ProductAutoRenewable ProductType = "autoRenewable" ProductNonRenewable ProductType = "nonRenewable" )
type PromotionalOffer ¶ added in v0.2.0
type PromotionalOffer struct {
// ID is the offer's identifier in App Store Connect, KeyID the ID of the key that signed it.
ID, KeyID string
// Nonce is the UUID the server signed, in lowercase, Signature the signature's bytes and Timestamp the signing time in milliseconds since the Unix epoch.
Nonce string
Signature []byte
Timestamp int64
}
PromotionalOffer is a subscription's promotional offer as a purchase takes it, signed by the app's server with its In-App Purchase key: StoreKit's Product.PurchaseOption.promotionalOffer.
type PurchaseAnswer ¶ added in v0.2.0
type PurchaseAnswer struct {
// Error is why there is no answer ("" when there is one), and Message what the platform said of a failure.
Error, Message string
// Products answer PurchaseProducts, Transaction PurchaseBuy and Transactions PurchaseEntitlements.
Products []Product
Transaction *Transaction
Transactions []Transaction
// RefundStatus is the result of PurchaseRefund: "success" or "cancelled".
RefundStatus string
}
PurchaseAnswer is what EventPurchase answers an ItemPurchase with.
type PurchaseCommand ¶ added in v0.2.0
type PurchaseCommand uint8
PurchaseCommand is what an ItemPurchase asks of the platform's store.
const ( // PurchaseProducts looks up the products of IDs; the answer's Products hold those the store knows. PurchaseProducts PurchaseCommand = iota // PurchaseBuy buys Product with AccountToken, Quantity and Offer; the answer's Transaction is the purchase, else Error says why there is none. PurchaseBuy // PurchaseFinish finishes the unfinished transaction whose ID is Transaction. PurchaseFinish // PurchaseEntitlements asks for the transactions that entitle the user now; the answer's Transactions hold them. PurchaseEntitlements // PurchaseSync has the store bring the user's transactions up to date, signing them in to their account where it must. PurchaseSync // PurchaseManageSubscriptions opens the store's subscription management UI. PurchaseManageSubscriptions // PurchaseRefund asks the store to begin a refund request for Transaction. PurchaseRefund )
func (PurchaseCommand) String ¶ added in v0.2.0
func (c PurchaseCommand) String() string
String returns the command's name, as traces print it.
type PurchaseRequest ¶ added in v0.2.0
type PurchaseRequest struct {
Command PurchaseCommand
// IDs are PurchaseProducts' product IDs.
IDs []string
// Product is the ID of the product PurchaseBuy buys, AccountToken the UUID tying the purchase to the app's user ("" for none), Quantity how many, at least 1, and Offer the promotional offer it takes, nil for none.
Product string
AccountToken string
Quantity int
Offer *PromotionalOffer
// Transaction is the ID of the transaction PurchaseFinish finishes.
Transaction string
}
PurchaseRequest is an ItemPurchase's request.
type QuickLookRequest ¶
QuickLookRequest is an ItemQuickLook's files, regular files the core checked, and the index of the one shown first, within them.
type RSXform ¶
RSXform is a scaled rotation followed by a translation. The sprite's local origin is its top-left corner. SCos and SSin are the cosine and sine of the rotation multiplied by the scale. TX and TY are in canvas points. RSXform{SCos: 1} is the identity.
type Region ¶
type Region struct {
Frame Bounds
// SafeArea is the part of each of the region's edges that system bars, notches and rounded corners cover: the surface's safe area where it falls in the region, which core fills in from the environment.
SafeArea Edges
// Reserved is the part of the region an obstruction that does not divide it takes, such as a fold whose pixels do not show, which the app must not place content across; empty when there is none.
Reserved Bounds
}
Region is a part of the surface an app can lay out in.
type ResizeMode ¶
type ResizeMode uint8
ResizeMode fits an image or a video into its view. The zero value is the element's default: Cover for an image, Contain for a video, as in NSH. Platforms receive the resolved mode.
const ( // Cover fills the view, cropping what overflows. Cover ResizeMode = iota + 1 // Contain fits the whole image, leaving space. Contain // Stretch fills the view, distorting the image. Stretch // Center keeps the image's natural size, cropped where it is larger // than the view (CSS's object-fit: none). Center // ScaleDown keeps the natural size, shrunk to fit where it is larger // than the view (CSS's object-fit: scale-down, React Native's center). ScaleDown )
func (ResizeMode) Fit ¶
func (m ResizeMode) Fit(natural, box Size, pos ObjectPosition) Bounds
Fit returns where an image of natural size, in points, goes in a view of size box: scaled as m scales it (Center keeps the natural size, as CSS's none; ScaleDown shrinks an image larger than the box, as CSS's scale-down), then placed at pos. The rectangle may reach outside the box, which crops it. An image without a size fills the box. Every backend fits images and videos with it, as NSH's ResizeMode::fit.
type ReturnKeyType ¶
type ReturnKeyType uint8
ReturnKeyType labels the software keyboard's return key.
const ( ReturnKeyDefault ReturnKeyType = iota ReturnKeyDone ReturnKeyGo ReturnKeyNext ReturnKeySearch ReturnKeySend )
type Ripple ¶
type Ripple struct {
// Color is the ripple's; 0 takes the theme's.
Color Color
// Borderless spreads it past the view's shape.
Borderless bool
// Radius is 0 for the platform's.
Radius Points
// Foreground draws it over the view's content, else behind it.
Foreground bool
}
Ripple is Android's ripple over a view while it is pressed.
type Role ¶
type Role uint8
Role is a view's accessibility role.
const ( RoleNone Role = iota RoleButton RoleLink RoleHeader RoleImage RoleCheckbox RoleSwitch RoleRadio RoleTab RoleText RoleTextField RoleRadioGroup RoleTabList RoleMenu RoleMenuItem RoleDialog RoleAlert // RoleAdjustable is a slider: its Value is a range that the // increment and decrement actions adjust. RoleAdjustable // RoleProgressBar shows progress, its Value a range. RoleProgressBar // RoleTable is a table of the app's rows; RoleGrid one whose cells // the user selects and moves between. RoleRowGroup holds a header's, // a body's or a footer's rows, RoleRow a row's cells, and // RoleColumnHeader and RoleCell are a row's cells. RoleTable RoleGrid RoleRowGroup RoleRow RoleColumnHeader RoleCell // RoleListbox holds RoleOptions the user picks from, as a select's // popup does. RoleListbox RoleOption // RoleGroup, RoleRegion and RoleNavigation are parts of a page, the // last two landmarks. RoleGroup RoleRegion // RoleTree holds RoleTreeItems. RoleTree RoleTreeItem RoleToolbar // RoleMenuItemCheckbox and RoleMenuItemRadio are menu items with a // checked state. RoleMenuItemCheckbox RoleMenuItemRadio // RoleSpinButton is a field for a number: its Value is what it reads // as, between its bounds, and its actions step it. RoleSpinButton // RoleCombobox picks a value from a list it opens, as a select's // trigger. RoleCombobox // RoleAlertDialog is a dialog that asks for an answer to what it // says, as a confirmation, ARIA's alertdialog; RoleDialog is any // other. RoleAlertDialog // RoleStatus is advisory information that changes, such as "Saved" or "3 rows selected", ARIA's status; the core makes it a polite live region by default. RoleStatus // RoleSearchField is a text field used to filter or find content, ARIA's searchbox. RoleSearchField )
type SVG ¶
type SVG struct {
// contains filtered or unexported fields
}
SVG is a parsed SVG document: vector shapes and text that stay sharp at any size. An Icon or SVGView draws one as a view, Drawing.DrawSVG and Drawing.DrawSVGIn draw one on a canvas, and the image decoders rasterize SVG files with it.
ParseSVG reads static drawings, icons, logos and illustrations: path, rect, circle, ellipse, line, polyline, polygon, text and tspan inside svg, g, a, switch and use elements, with fills, strokes, stroke widths, caps, joins and dashes, fill and clip rules, opacities, transforms, linear and radial gradients, clip paths, markers and preserveAspectRatio. A color may be none, currentColor, a hex color, rgb(), rgba(), hsl(), hsla() or a CSS color name. Groups pass these to their children, and presentation attributes, the style attribute and simple style sheets (type, class and id selectors) set them. Text elements emit native DrawFillText and DrawStrokeText operations, laid out and drawn by the platform's own text engine.
Images, patterns, masks, filters and animations are not read: an SVG is a drawing, not a page. ParseSVG reads only the document, never a file or URL it names.
func (*SVG) Draw ¶
Draw records the document's shapes and text into d, fitted in box according to its preserveAspectRatio (centered uniformly by default) and painted in color: every currentColor becomes color, and a zero color is black.
func (*SVG) Monochrome ¶
Monochrome reports whether every painted operation in s uses currentColor (Color 0) with no gradients, as icon packs such as lucide do.
type SavePreflights ¶
type SavePreflights struct {
// contains filtered or unexported fields
}
SavePreflights holds a desktop surface's pending save decisions and delivers engine answers to the waiting dialog or save worker.
func (*SavePreflights) Answer ¶
func (p *SavePreflights) Answer(it MountItem)
Answer passes the engine's decision to the matching attempt once.
func (*SavePreflights) Check ¶
func (p *SavePreflights) Check(id, attempt uint32, path string, dispatch func(Event)) (approved bool, reason string)
Check asks the engine about one candidate and waits up to the decision deadline. A dialog that can retry numbers its attempts from one. A one-shot chooser uses zero.
func (*SavePreflights) Save ¶
func (p *SavePreflights) Save(r SaveRequest, id uint32, path string, dispatch func(Event))
Save finishes a chosen save on a background goroutine. The destination is opened only after an approval if the request needs a preflight check.
type SaveRequest ¶
type SaveRequest struct {
// Name is a file name without directories, never empty.
Name string
MIME string
// Start is the absolute starting directory, or empty for the system's.
Start string
Path string
Data []byte
// Preflight asks the platform to report the destination before writing.
Preflight bool
}
SaveRequest is a save as the platform carries it out: the file the dialog suggests and what goes in it, the file at Path or else Data.
func (SaveRequest) Open ¶
func (r SaveRequest) Open() (io.ReadCloser, error)
Open opens what r saves.
func (SaveRequest) SaveTo ¶
func (r SaveRequest) SaveTo(path string) error
SaveTo writes what r saves to path through a temporary file beside it, so a write that fails leaves path as it was.
func (SaveRequest) Stage ¶
func (r SaveRequest) Stage(dir string) (string, error)
Stage returns a file named r.Name, in a new directory under dir, that holds what r saves, for platforms that save only files on disk under the name they show: a link to Path where the system allows one, else a copy. The caller removes the directory once the save ended.
type ScanRequest ¶
type ScanRequest struct {
Kinds []CodeKind
}
ScanRequest is ItemScanCode's request: the kinds of code to read, a QR code alone when empty.
func (ScanRequest) Wants ¶
func (r ScanRequest) Wants(k CodeKind) bool
Wants reports whether r reads codes of kind k.
type ScannedCode ¶
ScannedCode is a code ItemScanCode read: its kind and the text it holds.
type ScreenAnimation ¶
type ScreenAnimation uint8
ScreenAnimation is how a screen of a stack enters and leaves: a push takes the pushed screen's, a pop the popped one's. ScreenDefault is the platform's, a slide where it animates screens.
const ( ScreenDefault ScreenAnimation = iota ScreenSlide ScreenFade ScreenNone )
type ScreenConfig ¶
type ScreenConfig struct {
Title string
// HeaderHidden hides the header; HeaderHeight is then 0.
HeaderHidden bool
HeaderTransparent bool
LargeTitle bool
// TitleFont and LargeTitleFont override the native title fonts; zero fields keep their platform defaults.
TitleFont, LargeTitleFont Font
// RightWithLargeTitle moves Android's trailing view beside its large title, returning to the toolbar as the header collapses.
RightWithLargeTitle bool
// CanGoBack says a screen is below; BackHidden hides the back button
// to it, and BackTitle is its label.
CanGoBack bool
BackHidden bool
BackTitle string
// OwnBackTitle is the screen's own HeaderBackTitle: the label of the
// back button to it on the screen above, which that screen's
// BackTitle shows.
OwnBackTitle string
// NoPopOnSwipe turns the swipe back off, as NoPopOnBack does with the
// back button's popping: a press still reports EventBack.
NoPopOnSwipe bool
NoPopOnBack bool
// Background, TitleColor and TintColor are the header's colors; 0
// keeps the platform's.
Background, TitleColor, TintColor Color
// Left, Right and TitleView are the header views, each a layout root that no view holds, or 0. Left and Right take their content's size; TitleView expands to fill the room between the bar's ends when TitleFills is set and otherwise takes its content's size bounded by that room.
Left, Right, TitleView NodeID
TitleFills bool
// Header is the screen's own header, which a platform without a
// native one would show; the native header leaves it unused.
Header NodeID
// RightSystemItem, with a Right view, is the UIKit button iOS shows
// in Right's place; a press on it presses Right's first view that
// takes presses.
RightSystemItem HeaderSystemItem
// RightSymbols, with a Right view, are the UIKit buttons iOS shows in
// its place, a line each of an SF Symbol's name, a tab and its label. A
// press on one presses that of Right's views that take presses.
RightSymbols string
// HeaderHeight is the area the header covers from the screen's top:
// the bar and the part of the status bar the screen reaches under.
HeaderHeight Points
// Animation is how the screen enters and leaves.
Animation ScreenAnimation
}
ScreenConfig is a screen's system header, which the platform draws over the top of the screen's view, HeaderHeight tall.
type ScrollBehavior ¶
type ScrollBehavior struct {
// Paging stops at multiples of the viewport.
Paging bool
// SnapToInterval stops at multiples of this length; 0 turns it off.
SnapToInterval Points
// SnapToOffsets stops at these offsets.
SnapToOffsets []Points
// SnapToAlignment is the point of a SnapToInterval item that aligns
// with the viewport.
SnapToAlignment SnapAlignment
// DisableIntervalMomentum moves a fling one snap point at most.
DisableIntervalMomentum bool
// DecelerationRate is the velocity a fling keeps per millisecond:
// DecelerationNormal, DecelerationFast or between; 0 is the
// platform's.
DecelerationRate float32
// NoScroll keeps the user from scrolling it (React Native's
// scrollEnabled false); the app still can.
NoScroll bool
// NoBounces stops drags at the edges instead of rubber banding.
NoBounces bool
// ContentInset is room around the content that scrolls with it.
ContentInset Edges
// KeyboardDismissMode is whether dragging dismisses the software
// keyboard.
KeyboardDismissMode KeyboardDismissMode
// KeyboardShouldPersistTaps is whether a tap while the software
// keyboard shows dismisses it.
KeyboardShouldPersistTaps KeyboardTaps
// RefreshIndicator is the height of the app's own pull-to-refresh
// indicator, drawn from a pull value, which replaces the platform's
// spinner: a pull refreshes once it reaches it, and refreshing keeps
// it above the content. 0 shows the platform's spinner.
RefreshIndicator Points
}
ScrollBehavior is how a scroll view scrolls, as NSH's Scrollable props (React Native's ScrollView props) say: Scroll's Behavior. Its zero value scrolls freely, bounces and decelerates as the platform does.
func (*ScrollBehavior) Deceleration ¶
func (b *ScrollBehavior) Deceleration() float32
Deceleration returns the velocity a fling keeps per millisecond: DecelerationRate, else DecelerationFast when it snaps and DecelerationNormal otherwise.
func (*ScrollBehavior) Equal ¶
func (b *ScrollBehavior) Equal(o *ScrollBehavior) bool
Equal reports whether b and o scroll the same.
func (*ScrollBehavior) RefreshInset ¶
func (b *ScrollBehavior) RefreshInset() Points
RefreshInset is the room kept above the content while it refreshes: the app's indicator's height, or the spinner's.
func (*ScrollBehavior) RefreshThreshold ¶
func (b *ScrollBehavior) RefreshThreshold() Points
RefreshThreshold is how far past the top a released pull refreshes: the app's indicator's height, or the spinner's distance.
func (*ScrollBehavior) SnapPoints ¶
func (b *ScrollBehavior) SnapPoints(viewport, content Points) []Points
SnapPoints returns the offsets, in order, a view snapping or paging along a viewport and content of those lengths stops at, or none when it does not snap. Backends without SnapTarget's hook, such as the web's CSS scroll snapping, mark them.
func (*ScrollBehavior) SnapTarget ¶
func (b *ScrollBehavior) SnapTarget(offset, projected Points, velocity float32, viewport, content Points) (Points, bool)
SnapTarget returns the snap point a fling ends at, as React Native's, and false when the view neither snaps nor pages. All values are along the main axis: offset is where the drag ended, projected where the fling would glide to (Projected), velocity its speed in points per millisecond (positive: the offset grows), for a viewport and content of those lengths. Pages, and DisableIntervalMomentum, move one snap point; other snapping rounds the projected offset in the fling's direction. Platforms call it, or Android's port, as the user lets go.
func (*ScrollBehavior) Snaps ¶
func (b *ScrollBehavior) Snaps() bool
Snaps reports whether flings end at snap points: snapping or paging.
type ScrollConfig ¶
type ScrollConfig struct {
Horizontal bool
// HideIndicator hides the scroll bar.
HideIndicator bool
Behavior ScrollBehavior
// HeaderInset is the part of Behavior.ContentInset's top that a
// transparent or large system header covers, which a large title
// collapses into as the content scrolls under it.
HeaderInset Points
// Refreshable says the app listens for EventRefresh: pulling the
// content down past its top refreshes. Refreshing shows the spinner;
// a config after EventRefresh says whether the app keeps it.
Refreshable bool
Refreshing bool
// MinZoomScale and MaxZoomScale bound pinches (1 and at least
// MinZoomScale); the content zooms when Zooms. ZoomScale is the app's
// scale, which the platform zooms to when it changes.
MinZoomScale, MaxZoomScale float32
ZoomScale float32
// NoBouncesZoom stops pinches at the limits; NoPinchZoom ignores
// pinches; CenterContent centers content smaller than the viewport.
NoBouncesZoom bool
NoPinchZoom bool
CenterContent bool
// Edges are the effects at its sides, in the order of Edges: top,
// right, bottom, left.
Edges [4]ScrollEdge
}
ScrollConfig configures a scroll view.
func (*ScrollConfig) ClampZoom ¶
func (c *ScrollConfig) ClampZoom(z float32) float32
ClampZoom returns z within c's zoom scales.
func (*ScrollConfig) Equal ¶
func (c *ScrollConfig) Equal(o *ScrollConfig) bool
Equal reports whether c and o configure a scroll view the same.
func (*ScrollConfig) Zooms ¶
func (c *ScrollConfig) Zooms() bool
Zooms reports whether the content zooms: MaxZoomScale above MinZoomScale.
type ScrollEdge ¶
type ScrollEdge struct {
Effect EdgeEffect
// Extent is how far into the scroll view the bars over this side
// reach from it, 0 without bars; Bars are their views, which iOS 26
// shapes its effect under (UIScrollEdgeElementContainerInteraction).
Extent Points
Bars []NodeID
// Tint is the background the content scrolls over, which the effect
// fades it into, and Line a hard edge's hairline.
Tint, Line Color
}
ScrollEdge is a scroll view's effect at one of its sides (ScrollConfig.Edges).
func (*ScrollEdge) Band ¶
func (e *ScrollEdge) Band() Points
Band returns how far from its side the drawn effect reaches: a soft edge's past the bars by SoftEdgeTail, 0 for none.
func (*ScrollEdge) Drawn ¶
func (e *ScrollEdge) Drawn() EdgeEffect
Drawn returns the effect a platform drawing it itself draws: soft for an automatic side with bars, and none without bars.
func (*ScrollEdge) Equal ¶
func (e *ScrollEdge) Equal(o *ScrollEdge) bool
Equal reports whether e and o draw the same.
func (*ScrollEdge) SoftTint ¶
func (e *ScrollEdge) SoftTint(most float32) []GradientStop
SoftTint returns the stops of a soft edge's tint across its band, from its side: most of the background SoftEdgeTail short of the bars' end, easing out from there to nothing at the band's end. Its ends ease as smoothstep's do, so no line shows where the tint begins to fade.
type ScrollHandle ¶
ScrollHandle computes the geometry and touch-scrub mapping of a phone scroll view's draggable handle along its active axis.
func (ScrollHandle) ActiveRect ¶
func (h ScrollHandle) ActiveRect() (rect Bounds, travel Points, ok bool)
ActiveRect returns the expanded visual rectangle of the handle while the user drags it, its travel distance along the track, and false when the content fits.
func (ScrollHandle) BeginDrag ¶
func (h ScrollHandle) BeginDrag(p Point) (ScrollHandleDrag, bool)
BeginDrag starts dragging the handle from p (in scroll view viewport coordinates), or returns false when the handle cannot travel.
func (ScrollHandle) Contains ¶
func (h ScrollHandle) Contains(p Point) bool
Contains reports whether p (in scroll view viewport coordinates) hits the handle's touch target.
func (ScrollHandle) GrabRect ¶
func (h ScrollHandle) GrabRect() (Bounds, bool)
GrabRect returns the touch hit-test rectangle around the handle in the scroll view's viewport coordinates, or false when the content fits.
type ScrollHandleDrag ¶
type ScrollHandleDrag struct {
// contains filtered or unexported fields
}
ScrollHandleDrag tracks a finger scrubbing a phone scroll handle along its active axis.
func (ScrollHandleDrag) Offset ¶
func (d ScrollHandleDrag) Offset(p Point) Point
Offset returns the scroll view's content offset for a finger at p (in scroll view viewport coordinates), clamped to the scrollable content range.
func (*ScrollHandleDrag) Shift ¶
func (d *ScrollHandleDrag) Shift(by Points)
Shift adjusts an active drag by a relative scroll (ItemScrollBy) so continuing to drag stays anchored to the same content.
type SecretAccessible ¶ added in v0.2.0
type SecretAccessible uint8
SecretAccessible says when Apple platforms let the app read a secret, as kSecAttrAccessible does; the zero value leaves it to the system, which reads it only while the device is unlocked. Other platforms keep no such setting.
const ( SecretAccessibleDefault SecretAccessible = iota // SecretWhenUnlocked is kSecAttrAccessibleWhenUnlocked. SecretWhenUnlocked // SecretAfterFirstUnlock is kSecAttrAccessibleAfterFirstUnlock, which background work reads while the device is locked. SecretAfterFirstUnlock // SecretWhenUnlockedThisDeviceOnly is kSecAttrAccessibleWhenUnlockedThisDeviceOnly: neither backups nor iCloud Keychain take it to another device. SecretWhenUnlockedThisDeviceOnly // SecretAfterFirstUnlockThisDeviceOnly is kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly. SecretAfterFirstUnlockThisDeviceOnly // SecretWhenPasscodeSetThisDeviceOnly is kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly: only while the device has a passcode, and gone when it is removed. SecretWhenPasscodeSetThisDeviceOnly )
type SecretItem ¶ added in v0.2.0
type SecretItem struct {
// Service and Account name it: an Apple generic password's kSecAttrService and kSecAttrAccount, a Windows generic credential's target "Service/Account", the Secret Service's service and account attributes, and on Android the key of its ciphertext.
Service, Account string
// AccessGroup is the Apple keychain access group it is in, "" for the app's default.
AccessGroup string
// Accessible is when Apple platforms let the app read it, set as it is written.
Accessible SecretAccessible
}
SecretItem names a secret in the platform's secure store.
type SecretStore ¶ added in v0.2.0
type SecretStore interface {
// ReadSecret returns the value of item, ok false without one.
ReadSecret(item SecretItem) (value string, ok bool, err error)
// WriteSecret keeps value as item's, replacing what it held.
WriteSecret(item SecretItem, value string) error
// DeleteSecret removes item; removing one that is not there is no failure.
DeleteSecret(item SecretItem) error
}
SecretStore is where a platform keeps an app's secrets (core.Secrets). Its methods may be called on any goroutine and may wait for the system, as a keychain asking the user or Android's runtime does.
type Segment ¶
type Segment struct {
Kind SegmentKind
P [3][2]float64
}
Segment is one step of an outline, in points.
func EllipticRect ¶
func EllipticRect(out []Segment, x, y, w, h float64, radii [4][2]float64, continuous, reverse bool) []Segment
EllipticRect is RoundedRect with each corner's radius along the horizontal and the vertical edge, clockwise from the top left, already fitted: the inner edge of a border whose sides differ.
func RoundedRect ¶
func RoundedRect(out []Segment, x, y, w, h float64, corners Corners, continuous, reverse bool) []Segment
RoundedRect returns the outline of the rectangle at x, y of size w, h with corners, fitted with Corners.Fit first, appending to out. It runs clockwise on screen (y down) from the top edge, or counterclockwise when reverse, which makes a hole under the non-zero rule. Continuous corners are a circular arc between two cubic transitions spreading the curvature over (1 + Smoothing) times the radius of each edge, as NSH's shape module draws them; where the box is too small they shrink to circular corners, so pills stay pills.
type SegmentKind ¶
type SegmentKind uint8
SegmentKind is what a Segment of an outline does.
const ( // SegmentMove starts the outline at P[0]. SegmentMove SegmentKind = iota // SegmentLine draws a straight line to P[0]. SegmentLine // SegmentCubic draws a cubic Bézier through the control points P[0] // and P[1] to P[2]. SegmentCubic // SegmentClose closes the outline. SegmentClose )
type Selectable ¶
type Selectable uint8
Selectable says whether the user can select a text.
const ( // SelectableAuto selects the text with its selection area when it is // in one. Elsewhere only the web selects it, on desktops, as a page's // text. SelectableAuto Selectable = iota // SelectableOn selects the text, alone when it is in no area. SelectableOn // SelectableOff keeps the text out of selections, its area's too. SelectableOff )
type SelectedRange ¶
SelectedRange is what one text of an area has selected, as an EventSelectionChange reports it: the text's NodeID and the UTF-16 offsets from Start to End.
type SelectionHandle ¶
type SelectionHandle uint8
SelectionHandle is one of the two ends of a selection, for touch handles.
const ( HandleStart SelectionHandle = iota HandleEnd )
type SelectionModel ¶
type SelectionModel struct {
// contains filtered or unexported fields
}
SelectionModel is the selection of one area: an anchor where it started and a focus where it goes, extended by words or paragraphs after a double or triple click. Its zero value selects nothing. Methods that change it report whether the selection changed, so the backend redraws only then.
func (*SelectionModel) Bounds ¶
func (m *SelectionModel) Bounds() (start, end TextPosition, ok bool)
Bounds returns the selection's start and end in document order, and false without a selection.
func (*SelectionModel) Drag ¶
func (m *SelectionModel) Drag(texts SelectionTexts, p Point) bool
Drag moves the focus to p while the pointer is pressed, by the press's granularity.
func (*SelectionModel) Extent ¶
func (m *SelectionModel) Extent(texts SelectionTexts) Bounds
Extent is the box of the texts the selection touches, for EventSelectionChange; no Size without a selection.
func (*SelectionModel) IsEmpty ¶
func (m *SelectionModel) IsEmpty() bool
IsEmpty reports whether nothing is selected: no selection, or an empty one.
func (*SelectionModel) MoveHandle ¶
func (m *SelectionModel) MoveHandle(texts SelectionTexts, h SelectionHandle, p Point) bool
MoveHandle moves the end h to p and keeps the other; they swap when one passes the other. From then on the selection goes by characters.
func (*SelectionModel) Press ¶
func (m *SelectionModel) Press(texts SelectionTexts, p Point, clicks int, extend bool) bool
Press is a pointer press at p: one click puts the anchor there, with nothing selected until a drag, two select the word, three the whole text. With extend (Shift) it extends the selection from its anchor to p instead, by the current granularity.
func (*SelectionModel) Ranges ¶
func (m *SelectionModel) Ranges(texts SelectionTexts) []SelectionRange
Ranges returns what each text has selected, in order, leaving out empty ranges: what the backend highlights.
func (*SelectionModel) SelectAll ¶
func (m *SelectionModel) SelectAll(texts SelectionTexts) bool
SelectAll selects every text of the area.
func (*SelectionModel) SelectWordAt ¶
func (m *SelectionModel) SelectWordAt(texts SelectionTexts, p Point) bool
SelectWordAt selects the word at p, as a long press on a touch screen does.
func (*SelectionModel) Set ¶
func (m *SelectionModel) Set(texts SelectionTexts, anchor, focus TextPosition) bool
Set selects from anchor to focus, in document order, clamping each end to its text. Tests inject a precise selection with it; the platforms' gestures build one instead. It reports whether the selection changed.
func (*SelectionModel) Text ¶
func (m *SelectionModel) Text(texts SelectionTexts) string
Text returns the selected text as a copy gives it (CopiedText): each text's selected part, hidden spans left out and each attachment (U+FFFC) the selection holds whole as its span's Copy, or left out without one, texts on one row (their frames overlap vertically) joined by a tab and the others by a line break.
func (*SelectionModel) TextsChanged ¶
func (m *SelectionModel) TextsChanged(texts SelectionTexts) bool
TextsChanged updates the selection to texts, the new list: each end follows its text by key, offsets are clamped to what is there, and a selection whose text is gone is cleared.
type SelectionRange ¶
type SelectionRange struct {
Text, Start, End int
}
SelectionRange is what one text has selected: UTF-16 offsets from Start to End.
type SelectionSpans ¶
SelectionSpans is what SelectionTexts whose texts have spans also tell: text i's spans, whose hidden ones a copy leaves out and whose Copy it takes in place of the attachment each styles.
type SelectionTexts ¶
type SelectionTexts interface {
// Len is how many texts take part.
Len() int
// Content is text i's content.
Content(i int) string
// Frame is text i's content box.
Frame(i int) Bounds
// OffsetAt is the UTF-16 offset of text i nearest p, a point inside
// its frame: where a click there puts the caret.
OffsetAt(i int, p Point) int
// Key is a stable identity of text i, such as its NodeID, so a
// selection follows its texts when others come or go before them.
Key(i int) uint64
}
SelectionTexts is what a backend knows of the texts of one area, in document order (the area's subtree, depth first). Coordinates are the area's, scroll offsets of the views between applied.
type SensorAuthorization ¶ added in v0.2.0
type SensorAuthorization uint8
SensorAuthorization is a provider's current authorization, without prompting, which core answers as a core.PermissionStatus.
const ( SensorNotAsked SensorAuthorization = iota SensorGranted SensorDenied SensorRestricted )
type SensorCommand ¶ added in v0.2.0
type SensorCommand uint8
SensorCommand is an ItemSensor's operation; starts never prompt.
const ( SensorReadPermission SensorCommand = iota SensorRequestPermission SensorLocate SensorWatchLocation SensorWatchMotion SensorStop SensorWatchSteps SensorWatchActivity SensorWatchPressure SensorWatchGeofences SensorRequestPreciseLocation SensorWatchBackgroundMotion )
type SensorGrant ¶ added in v0.2.0
type SensorGrant struct {
Authorization SensorAuthorization
}
SensorGrant answers SensorReadPermission and SensorRequestPermission.
type SensorKind ¶ added in v0.2.0
type SensorKind uint8
SensorKind identifies a provider and its separately requested authorization: core.PermissionLocation, PermissionBackgroundLocation, PermissionMotion and PermissionActivityRecognition.
const ( SensorLocation SensorKind = iota SensorBackgroundLocation SensorMotion SensorSteps SensorActivity SensorPressure SensorGeofences // SensorActivityPermission is the fitness authorization used by steps and activity. SensorActivityPermission )
type SensorNumber ¶ added in v0.2.0
SensorNumber distinguishes a missing measurement from a measured zero.
type SensorPacket ¶ added in v0.2.0
type SensorPacket struct {
// contains filtered or unexported fields
}
SensorPacket coalesces samples before they enter the engine's mailbox. Each stream has one packet and at most one queued wake-up. Errors and permission answers use separate events and cannot replace a sample.
func (*SensorPacket) Offer ¶ added in v0.2.0
func (p *SensorPacket) Offer(r SensorReport) bool
Offer keeps the newest sample and says whether a wake-up must be queued.
func (*SensorPacket) Take ¶ added in v0.2.0
func (p *SensorPacket) Take() (SensorReport, bool)
Take copies and consumes the pending sample.
type SensorQuaternion ¶ added in v0.2.0
type SensorQuaternion struct{ X, Y, Z, W float64 }
SensorQuaternion rotates the device frame into east-north-up world axes when HeadingReferenced, or an arbitrary horizontal frame otherwise.
type SensorReport ¶ added in v0.2.0
type SensorReport struct {
Generation uint32
Grant *SensorGrant
Location *LocationFix
Motion *MotionSample
Steps *StepSample
Activity *ActivitySample
Pressure *PressureSample
Geofence *GeofenceSample
Precise *PreciseLocationAnswer
Error string
End bool
}
SensorReport is a provider result. Errors are stable codes without data.
type SensorRequest ¶ added in v0.2.0
type SensorRequest struct {
Command SensorCommand
Kind SensorKind
Generation uint32
Location LocationOptions
Motion MotionOptions
Geofences GeofenceOptions
BackgroundMotion BackgroundMotionOptions
// Purpose is the declared temporary-accuracy purpose key on Apple platforms.
Purpose string
}
SensorRequest is scoped by Count and Generation. A restart uses a new generation, so samples queued before a pause cannot enter a resumed stream.
type SensorVector ¶ added in v0.2.0
type SensorVector struct{ X, Y, Z float64 }
SensorVector is a measurement in the right-handed natural device frame: x right, y up, z out of the screen. Acceleration is m/s², rotation rad/s, magnetic field µT. A face-up device at rest reads +9.80665 on z.
type Shader ¶
type Shader struct {
Program *ShaderProgram
// Lanes are the program's own uniforms, after those the platform
// sets, lane by lane in the order they are declared: a vector's
// components, a matrix's columns and an array's elements in turn.
// An int, uint or bool lane takes the value's integer part.
Lanes []float64
// Nodes are the lanes animated nodes drive over Lanes, which the
// platform reads from its Animator each frame they change.
Nodes []ShaderNode
// Images are what the program's image0At to image3At read, in order. The platform loads each as an image view does and draws the view again once it has them; one it lacks reads as transparent. An image of Pixels is the core's copy, a new one for each version (CopyPixels), which the platform uploads into a texture it keeps for the view and updates in place, uploading nothing while the copy stays the same.
Images []ImageSource
// Role is what the shader draws: a shader view's fill, or over a
// view's children, the surface or a change of pages. A WGSL program
// reads the pictures Pictures names, which the platform takes of
// the views the role says.
Role ShaderRole
Pictures Pictures
// Overflow is how far beyond each side of the view the shader draws,
// and its pictures reach, in points.
Overflow float64
// Running is whether a transition runs: the shader draws over the
// children from the picture taken as it started (ItemShaderTransition)
// to what they show, hiding them, until a Shader that is not Running
// ends it. Backwards takes the first picture as the side the change
// goes to, sample_to, as a pop or a dismissal does.
Running, Backwards bool
}
Shader is what a shader view draws (ItemShader): Program with the values of its uniforms.
type ShaderEnabler ¶
type ShaderEnabler interface {
EnableShaders()
}
ShaderEnabler is implemented by backends whose shader handling links on demand.
type ShaderNode ¶
ShaderNode binds lane Lane of a shader's uniforms to animated node Node: its number, or one channel of the color it outputs.
type ShaderProgram ¶
type ShaderProgram struct {
IR *shaderir.Program
// WGSL is set for a program written in WGSL (package shader/wgsl):
// its first lanes are the built-ins (ShaderBuiltinLanes) and its
// textures the pictures (Pictures), not images.
WGSL bool
}
ShaderProgram is a fragment shader an app compiled: the program the core checked, so platforms translate it for their GPU without linking the compiler. Each translates it once and keeps the result while the program is in use. Once handed to the platform it never changes, so platforms key what they made from it by its pointer.
type ShaderRole ¶
type ShaderRole uint8
ShaderRole is what a shader draws.
const ( // ShaderFill fills a shader view's box under its children. ShaderFill ShaderRole = iota // ShaderEffect draws the view's children through the shader, over // them and in their place; they still take input. ShaderEffect // ShaderTransition draws the view's children as they change, while // Running, and shows them as they are between changes. ShaderTransition // ShaderScreen and ShaderScreenTransition do the same with the whole // surface, which a view of no size in it holds. ShaderScreen ShaderScreenTransition // dialog comes or goes (on the surface's root view), while Running: // sample_from the lower side and sample_to the upper. ShaderNav )
func (ShaderRole) Covers ¶
func (r ShaderRole) Covers() bool
Covers reports whether r draws a whole surface.
func (ShaderRole) Transitions ¶
func (r ShaderRole) Transitions() bool
Transitions reports whether r draws a change while Running.
type ShareRequest ¶
type ShareRequest struct {
// as on macOS and iPads, in the root's points; zero for the root's
// center.
From Bounds
}
ShareRequest is a share as the platform carries it out: files, text, or both, for the system's share sheet.
type SharedDelivery ¶
type SharedDelivery struct {
}
SharedDelivery keeps a durable incoming share until an app handler has received it. Acknowledge runs on the engine goroutine after the callback; a backend must schedule any disk I/O elsewhere.
type SharedFile ¶
type SharedFile struct {
Path string
// on the web; Path takes precedence when set.
Data []byte
// gave another; the core fills it in.
Name string
MIME string
}
SharedFile is a file the app hands another app: one it opens in the app the system associates with it, or one of a share.
func (SharedFile) Stage ¶
func (f SharedFile) Stage(dir string) (string, error)
Stage returns a path to f under its Name, for platforms that hand files on by path and show a file's own name: Path itself when its name is Name, else a link to it, or a copy of Path or Data where the system allows none, in a new directory under dir. Directories a stage made over ShareStageAge ago go first.
type SharedItem ¶
type SharedItem struct {
SharedItem is text or a file copied from an incoming share.
type SnapAlignment ¶
type SnapAlignment uint8
SnapAlignment is where a snapped item sits in the viewport.
const ( SnapStart SnapAlignment = iota SnapCenter SnapEnd )
type SpeakCommand ¶ added in v0.2.0
type SpeakCommand uint8
SpeakCommand is what an ItemSpeak asks of the platform's speech synthesizer.
const ( // SpeakStart speaks Text in the voice the request names, utterance Count, stopping the one speaking; the platform reports EventSpeak with Count once it finished, was stopped or failed. SpeakStart SpeakCommand = iota // SpeakStop stops utterance Count where it is, if it is the one speaking. SpeakStop // SpeakVoices asks for the voices installed; the platform answers EventSpeak with Count and the voices. SpeakVoices )
func (SpeakCommand) String ¶ added in v0.2.0
func (c SpeakCommand) String() string
String returns the command's name, as traces print it: start, stop, voices.
type SpeakEvent ¶ added in v0.2.0
type SpeakEvent struct {
// Stopped says the utterance was stopped before it finished, and Error, one of the Speak errors, why it failed; neither when it finished.
Stopped bool
Error string
// Voices are SpeakVoices' answer.
Voices []Voice
}
SpeakEvent is an EventSpeak's report: an utterance's end, or the voices SpeakVoices asked for.
type SpeakRequest ¶ added in v0.2.0
type SpeakRequest struct {
Command SpeakCommand
// Text is what SpeakStart says.
Text string
// Lang is a BCP 47 tag, the app's locale when the app gives none, and Voice a voice's ID from SpeakVoices, "" for the platform's default voice of Lang. A Voice the platform does not have fails with SpeakVoiceUnavailable.
Lang, Voice string
// Rate and Pitch run from 0.5 to 2, 1 being the voice's own; core clamps them.
Rate, Pitch float32
}
SpeakRequest is an ItemSpeak's request.
type SpeechCommand ¶
type SpeechCommand uint8
SpeechCommand is what an ItemSpeech asks of its session.
const ( // SpeechStart starts recognizing in Lang, the system's language when // empty. SpeechStart SpeechCommand = iota // SpeechStop has the recognizer finish: a last final result, then // the end. SpeechStop // SpeechAbort ends the session at once, reporting nothing more. SpeechAbort )
type SpeechEvent ¶
type SpeechEvent struct {
Phase SpeechPhase
// Text is the whole transcript so far, and Final whether the
// recognizer will not change it.
Text string
Final bool
// Error is one of the Speech errors, "" for none.
Error string
}
SpeechEvent is an EventSpeech's report.
type SpeechPhase ¶
type SpeechPhase uint8
SpeechPhase is what an EventSpeech reports of its session.
const ( // SpeechStarted says the recognizer listens. SpeechStarted SpeechPhase = iota // SpeechResult carries the whole transcript so far. SpeechResult // SpeechEnded ends the session with the last transcript, and Error // when it failed. A platform reports it once, last. SpeechEnded )
type SpeechRequest ¶
type SpeechRequest struct {
Command SpeechCommand
// Lang is a BCP 47 tag for SpeechStart.
Lang string
// Interim reports results before they are final.
Interim bool
}
SpeechRequest is an ItemSpeech's request.
type SpringConfig ¶
SpringConfig is a damped spring's: Stiffness 100, Damping 10 and Mass 1 when 0. Velocity, in units per second, replaces the value's current velocity when it is not 0.
type StatusBarConfig ¶
type StatusBarConfig struct {
// Style is never StatusBarInherit.
Style StatusBarStyle
Hidden bool
Animated bool
Immersive bool
}
StatusBarConfig is the status bar the platform shows (ItemStatusBar).
type StatusBarStyle ¶
type StatusBarStyle uint8
StatusBarStyle is the color of a phone's status bar content.
const ( // StatusBarInherit keeps the style of the layers below. StatusBarInherit StatusBarStyle = iota // StatusBarAuto follows the appearance: dark content on light. StatusBarAuto StatusBarDark StatusBarLight )
type StepPosition ¶
type StepPosition uint8
StepPosition is where a steps easing jumps, as CSS's step positions.
const ( // JumpEnd holds each step to its end: steps(n, end), the default. JumpEnd StepPosition = iota // JumpStart jumps at each step's start. JumpStart // JumpNone holds the first and the last value a step each. JumpNone // JumpBoth jumps at the start and the end. JumpBoth )
type StepSample ¶
type StepSample struct {
Count uint64
Since, Timestamp time.Time
Distance, FloorsAscended, FloorsDescended SensorNumber
Gap bool
Dropped uint64
}
StepSample counts steps in the provider's observation window. A restarted provider starts another window; Since and Gap make that boundary explicit.
type StickyCell ¶
type StickyCell struct {
Cell NodeID
Start, End Points
// Node, when set, is the animated node the cell's inset from the
// viewport's start follows, in place of Inset, which Start counts.
Node uint32
Inset Points
}
StickyCell is a sticky list cell and its travel, in its scroll view's main-axis offsets: from Start it moves with the offset, as far as End (which may be infinite). End below Start pins to the viewport's end, with a negative shift back toward the content's start.
func (StickyCell) StickyShift ¶
func (c StickyCell) StickyShift(offset Points) Points
StickyShift is how far a sticky cell moves from its frame along the main axis at offset.
type StorageBackend ¶
type StorageBackend interface {
// Load returns the entries kept, read once when the app first uses
// its storage. An error leaves the app with none, logged.
Load() (map[string]string, error)
// Write keeps change. It is called in order, on the goroutine of the
// graph that made the change; a backend that blocks writes elsewhere.
Write(change StorageChange)
}
StorageBackend is where a platform keeps an app's entries: a file in the app's data directory, the browser's localStorage.
type StorageChange ¶
StorageChange is a change to the entries, for the backend to keep.
type StyleTransition ¶
type StyleTransition struct {
// contains filtered or unexported fields
}
StyleTransition steps a subset of ViewStyle properties on a backend's frame clock from one style to another.
func StartStyleTransition ¶
func StartStyleTransition(prev *StyleTransition, prevStyle, nextStyle ViewStyle, now time.Duration, props TransitionProperty, anim AnimatedValues) *StyleTransition
StartStyleTransition starts, keeps or retargets a transition over props from prevStyle to nextStyle at now, ignoring differences covered by anim. It returns nil when nextStyle carries no transition for props or no unbound property in props changed.
func (*StyleTransition) At ¶
func (st *StyleTransition) At(now time.Duration) (ViewStyle, bool)
At returns the style shown at now and whether the transition has finished.
func (*StyleTransition) Props ¶
func (st *StyleTransition) Props() TransitionProperty
Props returns the transition property groups st steps.
type SubmitBehavior ¶
type SubmitBehavior uint8
SubmitBehavior is what Return does in a text field.
const ( // SubmitBehaviorDefault inserts a line break in a multiline field, // and blurs and submits in a single line. SubmitBehaviorDefault SubmitBehavior = iota // SubmitBehaviorSubmit reports OnSubmit and keeps the focus. SubmitBehaviorSubmit // SubmitBehaviorBlurAndSubmit reports OnSubmit and takes the focus // away. SubmitBehaviorBlurAndSubmit // SubmitBehaviorNewline inserts a line break in a multiline field; a // single line blurs and submits. SubmitBehaviorNewline )
type Subscription ¶ added in v0.2.0
type Subscription struct {
// GroupID is its subscription group's, and Period how long each renewal lasts.
GroupID string
Period SubscriptionPeriod
// IntroductoryOffer is the offer new subscribers get, nil for none; Offers are its promotional offers.
IntroductoryOffer *SubscriptionOffer
Offers []SubscriptionOffer
}
Subscription is what an auto-renewable subscription's product says of it.
type SubscriptionOffer ¶ added in v0.2.0
type SubscriptionOffer struct {
// ID is a promotional offer's identifier, "" for the introductory offer.
ID string
// DisplayPrice is what each period costs as the store formats it, Period each period's length, PeriodCount how many periods it lasts and PaymentMode how it is paid.
DisplayPrice string
Period SubscriptionPeriod
PeriodCount int
PaymentMode OfferPaymentMode
}
SubscriptionOffer is an offer of an auto-renewable subscription.
type SubscriptionPeriod ¶ added in v0.2.0
type SubscriptionPeriod struct {
Unit PeriodUnit
Value int
}
SubscriptionPeriod is Value of Unit, such as 1 month.
type SurfaceConfig ¶
type SurfaceConfig struct {
// ID numbers the surface's tree, which the platform attaches.
ID uint32
Kind SurfaceKind
// Parent is the ID of the window this is a child of, or zero.
Parent uint32
// Title is a window's; empty is the app's name.
Title string
// Width and Height are the content's size in points; zero is the
// platform's default.
Width, Height Points
// Frame, when it moves, places a window instead of centering it,
// kept on a screen (WindowFrame.OnScreen).
Frame WindowFrame
// Hidden opens it without showing it, as panels open.
Hidden bool
// Focusable, Passive and Accessible are a SurfaceOverlay's input modes: it takes the focus as well as touches, lets touches through to the apps below instead, or shows its content to screen readers.
Focusable, Passive, Accessible bool
// Material is the material behind the content (WindowSetMaterial).
Material WindowMaterial
// Constraints limit a window (WindowSetConstraints).
Constraints WindowConstraints
// HideOnBlur hides a panel as it loses the focus, reported with
// EventWindowHidden.
HideOnBlur bool
// NoActivate keeps a panel from ever taking the keyboard or activating the app, shown, focused or clicked.
NoActivate bool
// Dock attaches a panel to a display's usable edge instead of an anchor rectangle.
Dock PanelDock
// PointerEvents is where a window or a panel takes the pointer (WindowSetPointerEvents).
PointerEvents WindowPointerEvents
// Transparent opens a window without a background or frame, showing what is behind it wherever the app draws nothing (WindowSetTransparent), or has a panel draw nothing of its own, no background, frame or shadow, so only what the app draws shows; the platform reports whether either is so in Environment.WindowTransparent.
Transparent bool
// NoShadow opens a window without the system's shadow (WindowSetShadow).
NoShadow bool
// SkipTaskbar keeps a window off the Windows taskbar and Alt+Tab, the X11 task list, and macOS's Window menu and Cmd+` (WindowSetSkipTaskbar).
SkipTaskbar bool
// Tray is the tray icon a SurfaceTrayIcon draws.
Tray uint32
// Scene is the platform's number for the scene a SurfaceScene shows in, EventOpenScene's Count.
Scene uint32
// Workspaces are the workspaces a window shows on (WindowSetWorkspaces).
Workspaces WindowWorkspaces
// Main is set for the main window, which SetMainView opens: the window a test host's model follows.
Main bool
}
SurfaceConfig is a window, a panel or a tray icon's view the app opens (ItemOpenSurface).
type SurfaceKind ¶
type SurfaceKind uint8
SurfaceKind is what an opened surface shows in.
const ( // SurfaceWindow is a window of the platform's own chrome. SurfaceWindow SurfaceKind = iota // SurfacePanel is a borderless window that floats over the others, which takes the keyboard without activating the app where the platform can: a tray icon's or a launcher's; or, with NoActivate, never takes it. SurfacePanel // SurfaceTrayIcon is the view a tray icon draws itself with // (TrayConfig.View), in the macOS menu bar or rasterized on Windows. SurfaceTrayIcon // SurfaceOverlay is a window over other apps on Android // (mobile.OpenOverlay): it takes touches but not the focus unless // Focusable, none when Passive, and hides from screen readers unless // Accessible. The platform reports the frame it applied in its // environment's WindowFrame, and ends it with EventWindowEnded. SurfaceOverlay // SurfaceScene is a scene the platform connected beyond the app's first, as iPadOS connects one for each window the user opens (EventOpenScene): it shows the app's main view, and the platform ends it with EventWindowEnded as the system discards the scene. SurfaceScene )
type SystemGestureEdge ¶
type SystemGestureEdge uint8
SystemGestureEdge is a mask of physical screen edges, in UIKit's UIRectEdge order.
const ( GestureEdgeTop SystemGestureEdge = 1 << iota GestureEdgeLeft GestureEdgeBottom GestureEdgeRight )
type SystemGestureOptions ¶
type SystemGestureOptions struct {
// IOSEdges asks UIKit to defer system gestures at these physical edges.
IOSEdges SystemGestureEdge
// AndroidRects gives Android exclusion rectangles in surface points.
AndroidRects []Bounds
}
SystemGestureOptions is what ItemSystemGestures sets on a surface.
type TabBadges ¶
TabBadges is the tab bar's independently updated badge prop. Language is the app's language, for the platform's badge announcements.
type TaskProgress ¶
type TaskProgress struct {
State TaskProgressState
Value float64
// Call numbers the SetTaskProgress call that sent it, from 1 in the order the app made the calls. A platform that shows one progress for several surfaces, as the Dock tile, a Linux launcher entry and the progress Windows windows show from surfaces without a button, ignores a call older than the one it shows: the surfaces commit in their own order, not in the order of the calls.
Call uint64
}
TaskProgress is the progress shown on an app icon or taskbar button.
func (TaskProgress) BarFraction ¶
func (p TaskProgress) BarFraction() float64
BarFraction is the fraction a bar drawn for p fills where the platform has no indeterminate or cleared state of its own, as the Dock tile and Unity's LauncherEntry: none for no progress, half for an indeterminate task, which a snapshot cannot animate, and Value otherwise.
type TaskProgressState ¶
type TaskProgressState uint8
TaskProgressState is the state of an app task's platform progress bar.
const ( TaskProgressNone TaskProgressState = iota TaskProgressNormal TaskProgressIndeterminate TaskProgressPaused TaskProgressError )
type TextAlign ¶
type TextAlign uint8
TextAlign aligns lines of text.
const ( TextAlignStart TextAlign = iota + 1 TextAlignCenter TextAlignEnd // TextAlignJustify stretches every line but a paragraph's last to the // box's width, aligned to the start. TextAlignJustify // TextAlignLeft and TextAlignRight keep their sides right to left, // where the others follow the direction. The core sends them as // TextAlignStart or TextAlignEnd, by the text's direction. TextAlignLeft TextAlignRight )
type TextAttachment ¶
type TextAttachment struct {
// Offset is the byte offset of its AttachmentRune.
Offset int
Size Size
Align VerticalAlign
// Descent is how far an attachment aligned to the baseline reaches below it: the height of its own baseline above its bottom, as a formula's. 0 puts its bottom on the baseline; other aligns ignore it.
Descent Points
}
TextAttachment is a view inside a text, sized by layout before the text is prepared. Every engine places it with the same rule: its top Ascent above the baseline, its line reserving Extent, so a line grows where an attachment reaches past the font around it.
func (TextAttachment) Ascent ¶
func (a TextAttachment) Ascent(font FontExtent) Points
Ascent returns how far a's top is above the baseline of a line in font, below it when negative: CSS's vertical-align for a replaced inline box.
func (TextAttachment) Extent ¶
func (a TextAttachment) Extent(font FontExtent) (above, below Points)
Extent returns what a's line reserves for it above and below the baseline, each at least 0. Engines give the placeholder these metrics and draw its top Ascent above the baseline.
type TextBackground ¶
type TextBackground struct {
Color Color
// Radius rounds each line's box, at most to half its painted height.
Radius Points
// Top and Bottom inset the box in points or as a percentage of its height.
Top, Bottom Length
}
TextBackground is the background of a span. It changes only drawing.
func (TextBackground) VerticalBounds ¶
func (bg TextBackground) VerticalBounds(height Points) (top, bottom Points)
VerticalBounds returns the background's top and bottom offsets from the top of a box of the given height. A band with bottom <= top is empty.
type TextBaseline ¶
type TextBaseline uint8
TextBaseline is the line of a text that the point it is drawn at sits on, as the web's textBaseline.
const ( BaselineAlphabetic TextBaseline = iota BaselineTop BaselineHanging BaselineMiddle BaselineIdeographic BaselineBottom )
type TextContent ¶
type TextContent struct {
// Text is the plain text, for accessibility.
Text string
// Layout is the platform's TextLayout, ready to draw. The platform
// owns it from now on and releases the one it replaces.
Layout TextLayout
// Content is where Layout goes in the view: inside padding and border.
Content Bounds
// Style, Spans, Shadow, MaxLines and Ellipsize are the text's, as it
// was prepared, for tests to read; platforms draw Layout and read
// Spans' links for presses.
Style TextStyle
Spans []TextSpan
Shadow TextShadow
MaxLines int
Ellipsize EllipsizeMode
}
TextContent is a text view's content, laid out by the engine.
type TextDecoration ¶
type TextDecoration uint8
TextDecoration draws lines on text; the values combine.
const ( TextDecorationNone TextDecoration = 1 << iota TextDecorationUnderline // underline TextDecorationLineThrough // strikethrough )
type TextDecorationStyle ¶
type TextDecorationStyle uint8
TextDecorationStyle is how a text's decoration lines are drawn; the zero value is solid.
const ( DecorationSolid TextDecorationStyle = iota + 1 DecorationDouble DecorationDotted DecorationDashed DecorationWavy )
type TextEngine ¶
type TextEngine interface {
// Prepare shapes text once; the result measures it at any number of
// widths and lays it out at its final size.
Prepare(text *AttributedText) PreparedText
}
TextEngine prepares text for layout. The engine calls it on its own goroutine, so implementations must not touch main-thread-only objects.
type TextHitTester ¶
type TextHitTester interface {
// HitTest returns the caret nearest p: on the line at p's height (the
// first line above the text, the last below it), at the character
// edge nearest p's x. A point past the end of a wrapped line gives the
// line's end, Upstream, so the caret stays on that line.
HitTest(p Point) Caret
// CaretRect returns the caret at c: a box of no width as high as its
// line, at the edge of the characters c stands between; false when
// the layout has no lines.
CaretRect(c Caret) (Bounds, bool)
// RangeRects appends to out the line-high boxes covering the
// characters from UTF-16 offset start to end: per line, one box per
// run of adjacent characters (several where bidirectional text splits
// the range), and through the line's end where the range goes on past
// it. out is the caller's, so a selection drawn often reuses it.
RangeRects(start, end int, out []Bounds) []Bounds
}
TextHitTester is a TextLayout that knows where its characters are. Its methods are safe on the engine goroutine and the main thread, also after the layout was released: what they read before stays, and a layout released unread answers as an empty text.
type TextLayout ¶
type TextLayout interface {
Release()
}
TextLayout is a platform's laid-out text, drawn on the main thread and released there when replaced or deleted.
type TextLine ¶
type TextLine struct {
// Text is its characters, from byte Start to byte End of the text.
Text string
Start, End int
// Bounds is its box in the text's content box: its typographic width
// and its height.
Bounds Bounds
// Ascender and Descender reach above and below its baseline;
// CapHeight and XHeight are the heights of its font's capitals and
// lowercase letters.
Ascender, Descender Points
CapHeight, XHeight Points
}
TextLine is a line of laid-out text, as Text.OnTextLayout reports it.
type TextMetrics ¶
type TextMetrics struct {
Width, Ascent, Descent, LineHeight float32
}
TextMetrics are a text's measurements in a font: its advance width, and how far its font reaches above and below the baseline, as the line it is laid out on reports them.
type TextPosition ¶
type TextPosition struct {
Text, Offset int
}
TextPosition is a place in the texts of an area: a text, by its index in document order, and a UTF-16 offset in it.
type TextRange ¶
type TextRange struct {
Start, End int
}
TextRange is a selection in a text field, in UTF-16 units as the platforms' text APIs count; Start equals End for a caret.
type TextShadow ¶
type TextShadow struct {
Color Color
Offset Point
// Radius blurs it, as a view's ShadowRadius does.
Radius Points
}
TextShadow is a shadow behind a text's glyphs; a zero Color is none.
type TextSpan ¶
type TextSpan struct {
Start, End int
Style TextStyle
// Cursor is the pointer's look over the span's visible characters, ahead of the text view's own; Auto leaves the view's.
Cursor Cursor
// Link marks a span with a press handler: a press on it reports
// EventPress with Index set to a byte offset inside it.
Link bool
// Hidden hides the span in place, as CSS's visibility: hidden on an inline element: its characters lay out as visible ones, but each engine skips its glyphs, decoration lines and shadow as it draws, they take no press, and copies and screen readers leave them out. It changes no line.
Hidden bool
// Background is drawn behind the span's characters: a box per line between the font's ascent and descent, behind the selection and glyphs.
Background TextBackground
// Copy is what a copy takes in place of the attachment the span styles, as a formula copies as its TeX; empty leaves the attachment out. Screen readers read the attachment's label instead (ShownText).
Copy string
}
TextSpan styles the bytes from Start to End of an AttributedText.
type TextStyle ¶
type TextStyle struct {
Font Font
Color Color
// LineHeight is the height of a line; 0 is the font's.
LineHeight Points
LetterSpacing Points
// Align places lines; TextAlignStart is the left, or the right when
// RTL.
Align TextAlign
// RTL makes the paragraphs' base direction right to left, for the
// order of mixed-direction runs and where lines start.
RTL bool
Decoration TextDecoration
// DecorationStyle is how Decoration's lines are drawn, solid when 0;
// DecorationColor colors them, Color when 0.
DecorationStyle TextDecorationStyle
DecorationColor Color
// DecorationThickness is how thick Decoration's lines are, the
// font's when 0.
DecorationThickness Points
// UnderlineOffset is how far below the baseline an underline's top
// is; auto is where the font puts it.
UnderlineOffset Length
// Transform is the core's TextTransform, which it applied to the
// text already: platforms draw the text as given, tests read it.
Transform uint8
}
TextStyle is resolved text style: nothing in it is unset.
type ThermalState ¶
type ThermalState uint8
ThermalState is the system's current thermal pressure.
const ( ThermalUnknown ThermalState = iota ThermalNominal ThermalFair ThermalSerious ThermalCritical )
type TimingConfig ¶
TimingConfig is a timing animation's: Duration (500 ms when 0) along Easing, after Delay.
type TitleBarStyle ¶
type TitleBarStyle uint8
TitleBarStyle is whether the system draws the window's title bar.
const ( // TitleBarDefault is the system's title bar, above the app. TitleBarDefault TitleBarStyle = iota // TitleBarHidden lets the app fill the window up to its top edge and // draw its own title bar. The system's window controls stay, in the // area Env.TitleBar reports. TitleBarHidden )
type Touch ¶
type Touch struct {
// ID tells the finger while it is down.
ID int
// Position is in the view hearing the event, PagePosition in the
// surface.
Position Point
PagePosition Point
// Changed says the event is about this finger: it went down, moved
// or lifted.
Changed bool
}
Touch is one finger of a TouchEvent.
type TouchGeometry ¶ added in v0.2.0
TouchGeometry captures the presentation coordinates when touches arrive, before the engine handles them or their views move again. Positions follow the order of Event.Touches; Targets names each changed finger's initial view.
type TouchTracker ¶ added in v0.2.0
type TouchTracker struct {
// contains filtered or unexported fields
}
TouchTracker keeps the listening paths for a native touch sequence. The paths survive a finger lifting while another remains: the responder may still belong to that finger's path. No geometry is cached between reports.
func (*TouchTracker) Capture ¶ added in v0.2.0
func (t *TouchTracker) Capture(e *Event, hit func(Point) NodeID, parent func(NodeID) (NodeID, EventMask), position func(NodeID, Point) (Point, bool))
Capture snapshots the native hit test and local positions for e. parent returns a view's native parent and event mask, and position converts a surface point using the view's current presentation, returning false for a view that has gone. Call on the platform thread before dispatching e.
type Transaction ¶ added in v0.2.0
type Transaction struct {
// ID is the transaction's, which finishing names, and OriginalID that of the purchase a renewal or a restore goes back to; ProductID and ProductType are what was bought.
ID, OriginalID string
ProductID string
ProductType ProductType
// PurchaseDate is when it was bought or renewed, ExpirationDate when a subscription's period ends and RevocationDate when the store refunded or revoked it, each zero for none.
PurchaseDate, ExpirationDate, RevocationDate time.Time
Quantity int
// AccountToken is the UUID the purchase was made with, "" for none.
AccountToken string
Transaction is a purchase the store recorded.
type Transform ¶
type Transform struct {
TranslateX, TranslateY Points
// TranslateXPercent and TranslateYPercent move the view by percentages
// of its own width and height, which the core adds to TranslateX and
// TranslateY each time the size changes.
TranslateXPercent, TranslateYPercent float32
// Scale scales both axes; ScaleX and ScaleY one each. 0 is unset (1).
Scale, ScaleX, ScaleY float32
// Rotate is in degrees, clockwise. RotateX and RotateY turn the view
// out of its plane around the horizontal and vertical axes, which
// shows depth only with a Perspective, its own or its parent's.
Rotate, RotateX, RotateY float32
// RotateZ turns the view in its plane after RotateX and RotateY: the
// transform property's rotateZ, where Rotate is CSS's rotate property,
// which goes before them.
RotateZ float32
// SkewX and SkewY slant the view along each axis, in degrees.
SkewX, SkewY float32
// Perspective is the distance the view is seen from, for its own
// rotations out of its plane; 0 is none.
Perspective Points
// Then is a matrix applied after all of those, for what they cannot
// say: functions in an order of the app's, as CSS's transform lists.
// Its zero value is none.
Then Matrix3D
}
Transform moves, scales, rotates and skews a view without changing its layout, around its transform origin (its center unless the style says), in CSS's order: perspective, translate, rotate, rotateX, rotateY, skew, then scale. The zero value changes nothing.
func (Transform) AxisAligned ¶
AxisAligned reports whether t only translates and scales in the view's plane, without rotation, skew, perspective or depth.
func (Transform) InPlane ¶
InPlane returns what t does in the view's plane as one translation, rotation and scale around the view's origin, for platforms that have only those: Then joins the rest, and its depth and shear are lost.
func (Transform) Matrix ¶
Matrix returns t as a matrix acting around origin, a point in the view's own coordinates (its top left at 0, 0).
func (Transform) RasterScale ¶
RasterScale is the largest magnitude scale factor t applies along either axis in the view's plane, folding Then in when set.
type Transition ¶
type Transition struct {
Duration time.Duration
Delay time.Duration
Easing Curve
// Properties lists what animates; every property but
// TransitionLayout when 0.
Properties TransitionProperty
}
Transition animates a view's look when its style changes: the platform runs it on the main thread, with no work for the engine per frame.
func (Transition) Layout ¶
func (t Transition) Layout() *LayoutTransition
Layout returns how t moves a view's frame (TransitionLayout).
type TransitionProperty ¶
type TransitionProperty uint8
TransitionProperty is a set of animatable properties.
const ( TransitionOpacity TransitionProperty = 1 << iota TransitionBackground TransitionTransform TransitionBorder TransitionShadow // TransitionLayout moves and resizes the view from where it shows // when a change to its own style changes its frame. Its children take // their new frames inside it at once. TransitionLayout )
type TrayConfig ¶
type TrayConfig struct {
ID uint32
// Icon is the icon as PNG, drawn in the menu bar's colors when
// Template, on macOS.
Icon []byte
Template bool
// Title is text beside the icon, on macOS.
Title string
Tooltip string
// View, when set, is the SurfaceTrayIcon the icon draws itself with.
View uint32
// Removed takes the icon away.
Removed bool
}
TrayConfig is a tray icon (ItemTray).
type TreeFile ¶
type TreeFile struct {
Path string
Size int64
Modified time.Time
Open func() (io.ReadSeekCloser, error)
}
TreeFile is a file of a folder the platform lists whole, as the web's <input webkitdirectory> does: its path, slash-separated inside the folder, and how it opens.
type Update ¶
type Update struct {
// Restart identifies a prepared platform update applied by restarting, including platforms whose updater exposes no version label.
Restart bool
App, Current string
Version, URL, Notes string
Download, Signature, SHA256, Key string
Size int64
Managed UpdateManaged
Store string
Err string
}
Update is what a platform's updater with no windows of its own found (EventUpdate): the app's name and running version, and a newer version with the page and verified download that gets it, Version empty when the running one is the newest, or why it could not check.
type UpdateDownloadProgress ¶
type UpdateDownloadProgress struct{ Loaded, Total int64 }
UpdateDownloadProgress reports bytes received by a platform update downloader.
type UpdateManaged ¶
type UpdateManaged uint8
UpdateManaged identifies who updates this installed copy, without a feed request.
const ( UpdateManagedSelf UpdateManagedPage UpdateManagedDevelopment UpdateManagedChannel UpdateManagedStore )
type UpdatePreference ¶
type UpdatePreference struct{ AutomaticChecks, AutomaticDownloads *bool }
UpdatePreference changes one preference through ItemCheckForUpdates instead of checking the feed. Nil leaves that preference alone.
type UpdaterState ¶
type UpdaterState struct {
Managed UpdateManaged
Store string
NativePreferences bool
AutomaticChecks, AutomaticDownloads bool
Available, Notes string
LastCheck time.Time
}
UpdaterState is the updater's latest snapshot. NativePreferences means the platform updater owns persistence and the schedule; otherwise package updater does.
type VerticalAlign ¶
type VerticalAlign uint8
VerticalAlign is where an attachment sits in its line, as CSS's vertical-align places a replaced inline box, against the font of the text around it. Its line grows to hold it wherever it reaches past that font.
const ( // VerticalAlignBaseline puts its bottom on the baseline, or its own baseline where it has one (TextAttachment.Descent); it is the default. VerticalAlignBaseline VerticalAlign = iota + 1 // VerticalAlignTextTop puts its top at the font's ascent. VerticalAlignTextTop // VerticalAlignTextBottom puts its bottom at the font's descent. VerticalAlignTextBottom // VerticalAlignMiddle puts its middle half the font's x height above // the baseline. VerticalAlignMiddle )
type VerticalBarEdge ¶
type VerticalBarEdge uint8
VerticalBarEdge is the edge where the system places a vertical bar.
const ( // VerticalBarUnspecified is a system without a preferred edge, or one that places no vertical bar. VerticalBarUnspecified VerticalBarEdge = iota VerticalBarLeading VerticalBarTrailing )
func (VerticalBarEdge) String ¶
func (e VerticalBarEdge) String() string
String returns the edge's name: "unspecified", "leading" or "trailing".
type VideoConfig ¶
type VideoConfig struct {
Source string
Headers *VideoHeaders
Paused bool
Muted bool
Volume float32
Rate float32
Repeat bool
ResizeMode ResizeMode
HitTestAlpha float32
Controls bool
PictureInPicture bool
AutoPictureInPicture bool
ProgressInterval time.Duration
AudioSource string
AudioSession AudioSession
}
VideoConfig is everything a video plays with (ItemVideo), with the defaults applied: Volume in 0 to 1, Rate above 0, a ResizeMode and ProgressInterval at least 16 milliseconds.
type VideoEnabler ¶
type VideoEnabler interface {
EnableVideo()
}
VideoEnabler is implemented by backends whose video player links on demand.
type VideoHeaders ¶
type VideoHeaders struct {
// contains filtered or unexported fields
}
VideoHeaders is a snapshot of the HTTP headers for a video source. Keeping it behind a pointer lets playback-only updates compare a VideoConfig without rebuilding or comparing its headers.
func NewVideoHeaders ¶
func NewVideoHeaders(fields map[string]string) *VideoHeaders
NewVideoHeaders copies the fields so a mount batch can keep them.
func (*VideoHeaders) All ¶
func (h *VideoHeaders) All(yield func(name, value string) bool)
All yields the header names and values in unspecified order.
func (*VideoHeaders) Len ¶
func (h *VideoHeaders) Len() int
Len returns how many request headers the snapshot holds.
type ViewGeometry ¶
ViewGeometry places a view in its native parent. Matrix acts in its viewport before Frame places it; Offset scrolls its children.
type ViewKind ¶
type ViewKind uint8
ViewKind is the kind of native view a node mounts.
const ( // KindView is a container: background, border, corners and presses. KindView ViewKind = iota + 1 // KindText draws a TextLayout the engine prepared. KindText // KindInput is the platform's text field. KindInput // KindScroll scrolls its children; ItemScrollContent sizes them. KindScroll // KindImage shows an image the platform loads (ItemImage). KindImage // KindModal is a layer covering the root view or an outer modal, // presented when inserted and dismissed when removed (ItemModal). KindModal // KindCanvas plays a Drawing (ItemCanvas). KindCanvas // KindWeb hosts the platform's web view, filling it (ItemWeb). KindWeb // KindVideo hosts the platform's video player, filling it (ItemVideo). KindVideo // KindNative hosts a view of a component the app registered, filling // it (ItemNative). KindNative // KindShader fills itself with a fragment shader on the GPU // (ItemShader). KindShader // KindGPU hosts a native 3D GPU-backed surface (ItemGPU, docs/architecture/gpu.md). KindGPU )
type ViewPaint ¶
type ViewPaint struct {
Op int
Kind ViewPaintKind
// Initial is what a fill or stroke paints with where no view sets
// one.
Initial Paint
// Area is the box a background is placed over.
Area Bounds
}
ViewPaint is an op of a drawing whose value is its view's paint.
type ViewPaintKind ¶
type ViewPaintKind uint8
ViewPaintKind is the paint property a ViewPaint takes.
const ( ViewFill ViewPaintKind = iota ViewStroke ViewStrokeWidth ViewStrokeDash // ViewBackground fills with the view's background: a fill the core // expands into one for its color and one for each gradient. ViewBackground )
type ViewProps ¶
type ViewProps struct {
Role Role
// Href is the browser address of a link; other backends ignore it.
Href string
// Level is a heading's or a tree item's level, from 1; 0 for none.
Level int
Label string
// LabelledBy lists the visible elements naming this view. The slice is immutable, keeping ViewProps comparable. Label is the resolved name too, for backends without a native relationship API.
LabelledBy *[]NodeID
// LabelFor is the control this visible label activates. LabelPress says EventPress exists only to forward that activation: backends must not infer a button role or a Tab stop from it.
LabelFor NodeID
LabelPress bool
// Description says more about the element, read after its name, as
// ARIA's aria-description; Hint says what activating it does.
Description string
Hint string
Disabled bool
// Selected, Checked and Indeterminate (mixed) are reported to
// assistive technology, and Expanded when Expandable.
Selected bool
// MultiSelectable says a RoleGrid, RoleListbox or RoleTree permits selecting more than one of its items.
MultiSelectable bool
// SelectionItem says the view is one item in a selectable collection; it stays true when the item is not currently selected.
SelectionItem bool
Checked bool
Indeterminate bool
// Pressed is a toggle that is on and Busy an element still loading;
// Invalid a field whose content the app rejected (aria-invalid).
Pressed bool
Busy bool
Invalid bool
Expandable bool
Expanded bool
// Value is a range's or a textual element's value.
Value AccessibilityValue
// Accessible makes the view one element, or none.
Accessible Accessible
// ElementsHidden hides the view and its subtree from assistive
// technology.
ElementsHidden bool
LiveRegion LiveRegion
// Actions are the actions offered to assistive technology, reported
// with EventAccessibilityAction. The list is shared and never changed,
// so ViewProps stay comparable; read it with ActionList.
Actions *[]AccessibilityAction
TestID string
// WindowDrag, PanActivation and selections are decided on the main
// thread.
WindowDrag WindowDrag
PanActivation PanActivation
// PanScrollHandoff: the view's pan shares a drag with the scroll view
// inside it where the drag starts, on iOS (View.PanScrollHandoff).
PanScrollHandoff bool
// SelectionArea is a view's, Selectable and SelectionColor a text's.
SelectionArea bool
Selectable Selectable
SelectionColor Color
// NoFocus keeps a pressable view out of the Tab stops, and Focusable
// makes a Tab stop of a view that takes no presses.
NoFocus, Focusable bool
// TabAfter is a shown dialog overlay's place in the Tab order, the
// view it follows, before that view's children: the native view
// right before it where the app put it, as WAI-ARIA's non-modal
// popups follow their trigger. Backends that order Tab themselves
// take it; the toolkits ordering it by their own trees (AppKit's key
// view loop, the browser's DOM) leave the overlay where it is.
TabAfter NodeID
// Topmost marks a Topmost overlay hoisted above modals on its host.
Topmost bool
// Appearance is the one its subtree forces (Scope.SetSubtreeAppearance),
// for the platform's views in it; AppearanceSystem follows the window.
Appearance Appearance
// PointerEvents, HitSlop and DelayLongPress are the view's; a zero
// DelayLongPress is the platform's 500 ms.
PointerEvents PointerEvents
HitSlop Edges
DelayLongPress time.Duration
// Ripple is Android's press ripple, nil for none. It is shared and
// never changed, as Actions is.
Ripple *Ripple
}
ViewProps is a view's accessibility and identity.
func (*ViewProps) ActionList ¶
func (p *ViewProps) ActionList() []AccessibilityAction
ActionList returns p's actions.
func (*ViewProps) FocusStop ¶ added in v0.2.0
FocusStop reports whether a non-input view takes keyboard focus. Platforms also require it to be mounted, visible and in the active modal.
type ViewStyle ¶
type ViewStyle struct {
Background Color
// CornerRadius rounds every corner, unless Corners is set: then each
// corner has its own radius. Platforms fit radii that do not fit
// with Corners.Fit.
CornerRadius Points
Corners Corners
// ContinuousCorners eases the corners into the edges (RoundedRect)
// instead of drawing quarter circles.
ContinuousCorners bool
// BorderWidth and BorderColor are the border on every side, unless
// Borders is set: then each side has its width there and its color
// in BorderColors.
BorderWidth Points
BorderColor Color
Borders Edges
BorderColors EdgeColors
// BorderStyle dashes or dots the border; 0 is solid.
BorderStyle BorderStyle
Outline Outline
Opacity float32
// Clip clips children to the padding box, inside the border, with its corners (ClipBox).
Clip bool
ShadowColor Color
ShadowOffset Point
ShadowRadius Points
// TintColor recolors an image's opaque pixels; 0 keeps its colors.
TintColor Color
// Cursor is the pointer's look over the view; Auto inherits the
// nearest ancestor's, and a pressable view's is a pointer on the web.
Cursor Cursor
// CursorImage is an optional custom cursor image over the view; it
// travels behind a pointer so ViewStyle stays comparable, and the core
// keeps the same pointer while Equal.
CursorImage *CustomCursor
// Transform moves, scales and rotates the view around its transform
// origin without moving its children's frames; hit testing follows
// it. The core has resolved its percentages.
Transform Transform
// Origin is where the transform acts, from the view's center, and
// OriginZ how far toward the viewer.
Origin Point
OriginZ Points
// BackfaceHidden hides the view while its rotations turn its back to
// the viewer.
BackfaceHidden bool
// ChildPerspective, when set, is the depth children's rotations out
// of the plane are seen from, at the view's center (ChildPerspective
// the function).
ChildPerspective Points
BlendMode BlendMode
// Material and Glass are how iOS draws a backdrop blur, and macOS one of a material other than BackdropUltraThin or of glass.
Material BackdropMaterial
// Elevation is Android's: how high the view floats, which casts the
// system's shadow under it where the style casts none.
Elevation Points
Glass GlassEffect
// GlassInteractive lets Liquid Glass answer presses on platforms that support it (macOS 27 and iOS 26).
GlassInteractive bool
// Effects are shadows, gradients, filters and masks, nil without any.
Effects *Effects
// Transition, when it has a duration, animates the change from the
// previous ViewStyle to this one.
Transition Transition
// Animation runs keyframes over the view while it is set; a change
// starts it again.
Animation KeyframeAnimation
// Hidden hides the view and its children (display none, visibility
// hidden).
Hidden bool
}
ViewStyle is everything a platform draws for a view itself.
func MixStyles ¶
func MixStyles(from, to ViewStyle, t float64, props TransitionProperty) ViewStyle
MixStyles returns the style shown t of the way from from to to, moving only the properties props lists and taking to's for the rest.
func (*ViewStyle) BorderWidths ¶
BorderWidths returns the border's width on each side.
func (*ViewStyle) ClipBox ¶
ClipBox returns where Clip clips the children of a view of size: its padding box, inside its border, with the radii of its corners there, each the fitted radius less the widths of the sides it joins, elliptical where they differ, as CSS clips overflow (InnerRadii).
func (*ViewStyle) Matrix ¶
Matrix returns the view's transform for a box of size, around its origin.
func (*ViewStyle) Rim ¶
Rim is how a rounded view with a fill and one solid border, either of them opaque, keeps the fill from showing past it. Drawn as CSS says, both reach the box's edge, and an edge pixel a curve covers partly takes the fill's color before the border's. So the fill stops inset under the border, and the border is rim, what it shows over the fill, the outer edge being the border's alone. Inset most of the border's width, a line one pixel wide keeps the two apart too, and the rest closes the seam inside. Browsers do the same for CSS; ok is false where nothing needs it or the border must let what is under it show.
type Voice ¶ added in v0.2.0
type Voice struct {
// ID names it in a SpeakRequest; Name is what the platform calls it, and Lang the BCP 47 tag of the language it speaks.
ID, Name, Lang string
}
Voice is a voice installed on the platform.
type WebCommand ¶
type WebCommand uint8
WebCommand is what ItemWebCommand asks a web view to do.
const ( WebReload WebCommand = iota + 1 WebGoBack WebGoForward WebStopLoading // WebPostMessage dispatches a MessageEvent carrying Value on the // page's window. WebPostMessage // WebInjectJavaScript runs Value in the page. WebInjectJavaScript // WebSendInput gives the page Data, a *WebInput, as the user's own // input. WebSendInput // WebLoad loads the WebSource in Data, even when it equals the current source. The current WebConfig's request headers still apply. WebLoad )
type WebConfig ¶
type WebConfig struct {
Source WebSource
InjectedJavaScript string
InjectedJavaScriptBeforeContent string
UserAgent string
UserAgentSuffix string
// Headers are sent with the initial URL request where the platform
// supports custom request headers. HTML sources do not make one.
Headers map[string]string
// Incognito keeps website data in memory for this view. Platforms read
// this when the native view is first made.
Incognito bool
// SchemeHandlers are app-owned URL schemes and their responders.
// Platforms read them when the native view is first made.
SchemeHandlers map[string]WebSchemeHandler
NoScroll bool
NoJavaScript bool
// Muted silences web audio or suspends playback, where supported.
Muted bool
// PinchZoom enables the platform web view's pinch magnification where it has a setting for it. Platforms without one keep their native behavior.
PinchZoom bool
BackForwardGestures bool
// Mobile presents the page as a phone sees it on desktop platforms: a phone's user agent unless UserAgent is set, touch support and touches from the mouse. Platforms load the source again when it changes.
Mobile bool
// DownloadDir is where the view saves what its pages download, a
// directory of its own for each (<id>/<file name>); "" saves nothing.
DownloadDir string
// Restricted has the platform refuse the top-level navigations
// Navigable refuses, as they start, reporting EventError.
Restricted bool
// Hosts are the hosts Navigable allows, space-separated patterns:
// "*", "*.example.com" or a host.
Hosts string
// Schemes are the PageSchemes Navigable allows, space-separated in lower case.
Schemes string
// Media is what the pages may capture through getUserMedia; the
// platform refuses the rest as the page asks.
Media WebMedia
}
WebConfig is everything a web view loads and allows (ItemWeb). Platforms load the source again when it or the scripts change.
func (*WebConfig) Navigable ¶
Navigable reports whether a restricted view's page may navigate to rawURL at its top level: a page of its own making (PageSchemes) whose scheme Schemes allows, an http or https one of a host Hosts allows, or one of a scheme the app serves (SchemeHandlers). Other schemes, file: among them, are refused.
func (*WebConfig) OpenWindowEvent ¶
func (c *WebConfig) OpenWindowEvent(r WebWindowRequest) Event
OpenWindowEvent routes a new-window request through the page's navigation policy. The backend always suppresses creation of the new window.
func (*WebConfig) SourceNavigable ¶ added in v0.2.0
SourceNavigable reports whether a restricted view may start the app's own load of its Source, at rawURL: as Navigable, except that a page of PageSchemes is the app's and not held to Schemes. A backend asks it for its own loads and trusted reloads or history traversals of app-owned entries, and Navigable for page-created navigations.
type WebCookie ¶ added in v0.2.0
type WebCookie struct {
Name, Value string
// Domain is the host the cookie goes to, and with a leading dot (".example.com") every host under it too, as a Set-Cookie Domain attribute makes it.
Domain string
// Path is the path the cookie goes to, and what is under it; "" is "/".
Path string
// Expires is when the store drops the cookie, which Apple platforms, Windows and Android bring to at most 400 days on; zero for a session cookie, which goes as the app ends.
Expires time.Time
Secure, HTTPOnly bool
SameSite WebSameSite
}
WebCookie is a cookie of the store the app's web views share, as core.WebCookie.
func FilterWebCookies ¶
func FilterWebCookies(cookies []WebCookie, f WebCookieFilter, now time.Time) []WebCookie
FilterWebCookies returns the cookies of cookies that f picks and that have not expired at now, in the order of their host, path and name: those a platform lists whole, as Apple's, Windows' and Linux's stores do, go through it.
func (WebCookie) CookiePath ¶ added in v0.2.0
CookiePath is c's Path, "/" when it has none.
func (WebCookie) Host ¶ added in v0.2.0
Host is the host c goes to, its Domain without the leading dot, in lower case.
func (WebCookie) HostOnly ¶ added in v0.2.0
HostOnly reports whether c goes only to its host, not the hosts under it.
func (WebCookie) SetCookie ¶ added in v0.2.0
SetCookie is c as a Set-Cookie header's value writes it, the attributes in the order browsers write them: Android's CookieManager reads one. The domain goes only for a cookie its hosts under share, as a host-only cookie has none; a session cookie has no Expires.
type WebCookieFilter ¶
type WebCookieFilter struct {
URL, Domain string
}
WebCookieFilter picks cookies of the store, as core.WebCookieFilter: those a request to URL would send, or those of Domain and every host under it; the zero filter picks all. Core sends at most one of them, URL an http or https URL with a host and Domain a host in lower case without a leading dot.
type WebCookiesOp ¶
type WebCookiesOp uint8
WebCookiesOp is what an ItemWebCookies does with the store.
const ( // WebCookiesSet adds or replaces the request's Cookies; the answer carries no Data. WebCookiesSet WebCookiesOp = iota // WebCookiesList answers with the cookies Filter picks, HttpOnly ones included, as the event's Data, a []WebCookie. WebCookiesList // WebCookiesClear removes everything the store holds: cookies, local and session storage, IndexedDB, service workers and caches. WebCookiesClear )
type WebCookiesRequest ¶ added in v0.2.0
type WebCookiesRequest struct {
Op WebCookiesOp
// Cookies are what WebCookiesSet adds, replacing those of the same name, domain and path.
Cookies []WebCookie
// Filter picks the cookies WebCookiesList answers with.
Filter WebCookieFilter
// Schemes are the app schemes the calling scope serves, which Windows registers if the request is what starts WebView2's environment, as a web view's would.
Schemes []string
}
WebCookiesRequest is an ItemWebCookies' request of the persistent store: Op says what it does with it.
type WebDownload ¶
type WebDownload struct {
State WebDownloadState
ID string
URL string
Filename string
Path string
Bytes int64
Message string
}
WebDownload is a download of a web view: its State, and where it is saved. Bytes is what it wrote once finished, and Message why it failed.
type WebDownloadState ¶
type WebDownloadState uint8
WebDownloadState is how far a WebDownload got.
const ( WebDownloadStarted WebDownloadState = iota WebDownloadFinished WebDownloadFailed )
type WebFailure ¶ added in v0.2.0
WebFailure identifies the platform error behind an EventError. Domain is empty for an error the engine produced itself, such as a refused navigation.
type WebInput ¶
type WebInput struct {
Kind WebInputKind
// Point is a click's, in CSS pixels from the viewport's top left, as
// getBoundingClientRect reports.
Point Point
// Text is what WebInputText types.
Text string
// Key is what WebInputKey presses, as KeyboardEvent.key names it:
// Enter, Tab, Escape or Backspace.
Key string
}
WebInput is input a web view's page takes as the user's hands give it: its events are trusted (isTrusted), which no script it runs can make.
type WebInputKind ¶
type WebInputKind uint8
WebInputKind is what a WebInput gives.
const ( // WebInputClick is a primary click at Point. WebInputClick WebInputKind = iota // WebInputText types Text into what has the page's focus. WebInputText // WebInputKey presses and releases Key. WebInputKey )
type WebMedia ¶
type WebMedia uint8
WebMedia is a set of the devices a web view's pages may capture.
type WebSameSite ¶ added in v0.2.0
type WebSameSite uint8
WebSameSite is a cookie's SameSite attribute.
const ( // WebSameSiteDefault leaves the attribute out, so the platform's default for a cookie without one applies, which differs: Chromium's web views, on Windows and Android, take it as Lax. WebSameSiteDefault WebSameSite = iota WebSameSiteLax WebSameSiteStrict // WebSameSiteNone sends the cookie with requests from other sites too, which every platform allows only for a Secure cookie. WebSameSiteNone )
type WebSchemeHandler ¶
type WebSchemeHandler func(*WebSchemeRequest) *WebSchemeResponse
WebSchemeHandler answers a request for a URL of a scheme the app serves: nil is 404, an empty body. It runs on the platform's UI thread.
type WebSchemeRequest ¶
type WebSchemeRequest struct {
URL string
// Method is the request's HTTP method in upper case, such as GET or
// OPTIONS. It is empty where the platform reports none.
Method string
// Headers are the request's, nil where the platform gives none.
Headers map[string]string
}
WebSchemeRequest is a request for a URL of a scheme the app serves (WebConfig.SchemeHandlers).
func (*WebSchemeRequest) Header ¶
func (r *WebSchemeRequest) Header(name string) string
Header returns the value of request header name, matched without case.
type WebSchemeResponse ¶
WebSchemeResponse is what a WebSchemeHandler answers: Status as HTTP's (0 is 200), the response's Headers and its Body. The response's Content-Type is Headers's when it names one, else what the platform infers from the request's URL and Body.
func (*WebSchemeResponse) Header ¶
func (r *WebSchemeResponse) Header(name string) string
Header returns the value of response header name, matched without case.
type WebSource ¶
WebSource is what a web view shows: the page at Src, or HTML, whose relative links resolve against BaseURL, instead when it is set. With neither Src nor HTML it loads about:blank, with the usual load events (ResolveWebSource).
func ResolveWebSource ¶ added in v0.2.0
ResolveWebSource is the source a backend loads for s: s itself, or about:blank for a source with neither Src nor HTML, whose BaseURL then has nothing to resolve. Core resolves sources before sending a WebConfig or WebLoad to any backend.
func (WebSource) Origin ¶
Origin is the origin of the page the source loads, as WebOrigin writes it: Src's, or for HTML, BaseURL's, which is "null" without one. An empty source loads about:blank, whose origin is "null".
func (WebSource) Shows ¶
Shows reports whether rawURL is the page s loads, which tells apart the pages of an opaque origin ("null"), as every one of them has the same: HTML without a base URL is at about:blank (about:srcdoc on the web), other HTML at BaseURL and a Src at itself, fragments aside. A page the view went to, such as a data: URL a frame sent it to, is not.
type WebViewEnabler ¶
type WebViewEnabler interface {
EnableWebView()
}
WebViewEnabler is implemented by backends whose web view links on demand.
type WebWindowRequest ¶
WebWindowRequest is a request by the page to open a URL in a new window.
type WidgetTest ¶
type WidgetTest[Entry, Activity, Content, Options, Dismissal any] struct { Update func(kind string, entries []Entry) error Available func() bool StartActivity func(Activity, Content, Options) error UpdateActivity func(Activity, Content, *ActivityAlert) error EndActivity func(Activity, *Content, Dismissal) error Activities func() []Activity ActivitiesEnabled func() bool }
WidgetTest is the test backend for the widget package's process-wide services. Its type parameters keep widget's values out of the driver.
func CurrentWidgetTest ¶
func CurrentWidgetTest[E, A, C, O, D any]() *WidgetTest[E, A, C, O, D]
CurrentWidgetTest is the test backend for these widget types, or nil.
type WindowAction ¶
type WindowAction uint8
WindowAction is what an ItemWindow asks of the window.
const ( // WindowSetTitleBar shows or hides the title bar (TitleBar, Height). WindowSetTitleBar WindowAction = iota + 1 WindowMinimize // WindowToggleMaximize maximizes the window, or restores it. WindowToggleMaximize WindowToggleFullScreen // WindowClose closes the window as its close button does. WindowClose // WindowSetFrame moves and sizes the window (Frame). WindowSetFrame // WindowSetLevel puts the window at Level. WindowSetLevel // WindowOrderFront brings the window to the front of its level, showing it, and activates the app; a panel without the focus (SurfaceConfig.NoActivate) comes to the front alone. WindowOrderFront // WindowSetMenuBar says when Windows and Linux show the menu bar // (MenuBar). WindowSetMenuBar // WindowSetControls places or hides the window controls of a hidden // title bar (Controls). WindowSetControls // WindowSetMaterial puts Material behind the window's content. WindowSetMaterial // WindowSetConstraints limits the window's size and what the user may // do to it (Constraints). WindowSetConstraints // WindowShow shows a hidden window without activating the app; a panel shows beside AnchorBounds when Placement is set, else under tray icon Anchor when that is set, and takes the keyboard unless SurfaceConfig.NoActivate keeps it from it. WindowShow // WindowHide hides the window, keeping it and its views. WindowHide // WindowDestroy closes an opened surface's window for good: its tree // is gone. WindowDestroy // WindowSetAnchor places a panel beside AnchorBounds on Placement's side, moving it at once if it shows, and keeps the placement for later shows; it changes neither whether it shows nor the focus. WindowSetAnchor // WindowSetWorkspaces puts the window on the workspaces Workspaces says. WindowSetWorkspaces // WindowSetPointerEvents says where the window takes the pointer (PointerEvents). WindowSetPointerEvents // WindowSetTransparent makes a window transparent when On, without a background or frame, or gives it back both (SurfaceConfig.Transparent). WindowSetTransparent // WindowSetShadow gives a window the system's shadow when On, or takes it away (SurfaceConfig.NoShadow). WindowSetShadow // WindowSetSkipTaskbar keeps a window off the taskbar when On, or puts it back (SurfaceConfig.SkipTaskbar). WindowSetSkipTaskbar // WindowFitSize sizes a panel's content to Frame's Width and Height, the size its content takes (core.PanelOptions.FitContent), keeping the edge it is placed by: one that shows stays beside the rectangle or under the tray icon it was placed at, else keeps its top edge. It changes neither whether it shows nor the focus. WindowFitSize // WindowSetFullScreen enters or leaves full screen (On, DisplayID). WindowSetFullScreen )
type WindowCommand ¶
type WindowCommand struct {
Action WindowAction
TitleBar TitleBarStyle
// Height is the custom title bar's height, in which the platform
// centers its window controls; 0 is the platform's.
Height Points
Frame WindowFrame
Level WindowLevel
MenuBar MenuBarMode
Controls WindowControls
Material WindowMaterial
// Constraints are what WindowSetConstraints sets.
Constraints WindowConstraints
// Anchor is the tray icon WindowShow shows a panel under.
Anchor uint32
// AnchorBounds is the rectangle, in the screen coordinates of DisplayInfo, that WindowShow and WindowSetAnchor place a panel beside, on Placement's side; WindowPlaceDefault places none.
AnchorBounds Bounds
Placement WindowPlacement
// Workspaces are what WindowSetWorkspaces sets.
Workspaces WindowWorkspaces
// PointerEvents is what WindowSetPointerEvents sets.
PointerEvents WindowPointerEvents
// DisplayID is the desktop display WindowSetFullScreen enters on. Empty uses the window's current display.
DisplayID string
// On is what WindowSetTransparent, WindowSetShadow, WindowSetSkipTaskbar and WindowSetFullScreen set.
On bool
}
WindowCommand is an ItemWindow's request.
type WindowConstraints ¶
type WindowConstraints struct {
MinWidth, MinHeight Points
MaxWidth, MaxHeight Points
// NoResize keeps the user from resizing the window, and so from
// maximizing it; WindowSetFrame still sizes it.
NoResize bool
// NoMinimize keeps the window from minimizing.
NoMinimize bool
// NoMaximize keeps the window from maximizing, and on macOS, where
// the same button goes full screen, from full screen.
NoMaximize bool
}
WindowConstraints limit a window's content size, in points, and what the user may do to it; the zero value limits nothing. A size of 0 has no limit, and a maximum under the minimum takes the minimum. Full screen goes past the sizes.
func (WindowConstraints) Clamp ¶
func (c WindowConstraints) Clamp(size Size) Size
Clamp returns size within c's sizes, which c.Normalized returned.
func (WindowConstraints) Normalized ¶
func (c WindowConstraints) Normalized() WindowConstraints
Normalized returns c with its negative sizes 0, its maximums at least its minimums and NoResize implying NoMaximize.
type WindowControls ¶
type WindowControls struct {
// Hidden takes the controls away for the app to draw its own, which
// call MinimizeWindow, ToggleMaximize and CloseWindow; Env.TitleBar
// then reports no width at its ends.
Hidden bool
// Style chooses Windows' caption-button geometry and colors. It is ignored on macOS and Linux.
Style WindowControlsStyle
// TrafficLights puts the top left corner of macOS's close button
// this far from the window's top left corner, in points, the other
// two after it. A zero X keeps them 16 points in, and a zero Y
// centers them in the title bar.
TrafficLights Point
// Offset moves the traffic lights this far from where TrafficLights
// puts them, so they follow what moves beside them without the app
// knowing their size.
Offset Point
}
WindowControls is how a hidden title bar shows the system's window controls: macOS's traffic lights and the caption buttons NSGo draws on Windows. Linux draws none.
type WindowControlsStyle ¶
type WindowControlsStyle uint8
WindowControlsStyle chooses the appearance of caption buttons a desktop backend draws in a hidden title bar.
const ( // WindowControlsDefault keeps NSGo's compact caption buttons. WindowControlsDefault WindowControlsStyle = iota // WindowControlsSystem uses the host desktop's full-width caption buttons. WindowControlsSystem )
type WindowDrag ¶
type WindowDrag uint8
WindowDrag marks a view as a handle that moves the desktop window, or keeps a view inside such a handle clickable. The nearest view that sets it decides; inputs and views with press or gesture handlers nearer than it stay clickable either way.
const ( // WindowDragInherit follows the views around it. WindowDragInherit WindowDrag = iota // WindowDragOn drags the window, and a double click zooms it as the // system's title bar does. WindowDragOn // WindowDragOff keeps presses on the view for the app. WindowDragOff )
type WindowFrame ¶
type WindowFrame struct {
X, Y Points
Move bool
Width, Height Points
// Animated eases frames of visible panels on macOS and Windows, unless
// reduced motion is on. Other macOS windows use AppKit's resize animation.
Animated bool
}
WindowFrame is where a window moves and how large it becomes, in points. X and Y place its top left corner from the main screen's top left, y growing down, on every platform; without Move the corner stays where it is, so a window that changes height keeps its top edge. Width and Height are its outer size, borders and title bar included (the default size GTK keeps on Linux); 0 keeps the current one.
func DockWindow ¶
func DockWindow(size Size, displays []DisplayInfo, dock PanelDock) (WindowFrame, bool)
DockWindow places a fixed-size panel along the selected display's usable edge, centered on the other axis. An absent explicit display is unavailable.
func (WindowFrame) OnScreen ¶
func (f WindowFrame) OnScreen(screens []Bounds) WindowFrame
OnScreen returns f when one of screens, the usable areas of the connected screens in f's coordinates, shows enough of its top edge to drag it, as a screen that went away does not. Else f shrinks to fit the first screen and centers on it.
func (WindowFrame) Within ¶
func (f WindowFrame) Within(area Bounds) WindowFrame
Within returns f kept wholly in area, as an overlay keeps to the screen's usable area: no larger than it, and moved in where it pokes out; one that does not move centers on it.
type WindowLevel ¶
type WindowLevel uint8
WindowLevel is where a window stacks among the others.
const ( // WindowLevelNormal is the level of ordinary windows. WindowLevelNormal WindowLevel = iota // WindowLevelFloating stays above normal windows, as a palette does. WindowLevelFloating // WindowLevelDesktop sits with the desktop's icons on macOS, on every space and out of Mission Control; Windows puts the window at the bottom of the others, where activating it raises it again, and X11 below the others (_NET_WM_STATE_BELOW). WindowLevelDesktop )
type WindowMaterial ¶
type WindowMaterial uint8
WindowMaterial is a translucent material behind a desktop window's content, where the app draws nothing opaque. macOS shows a system vibrancy material; Windows 11 22H2 and later shows Mica, Acrylic or Mica Alt, choosing the closest backdrop for the other names. Other platforms keep the window opaque.
The window starts with nsgo.WindowMaterial's and changes it with WindowSetMaterial; Windows shows one only in a window started with one. Env.WindowMaterial reports the one the window actually shows. What the app draws over the material decides how much shows: a view with an opaque background hides it, and one with no background, or a translucent one, lets it through.
const ( // WindowMaterialNone keeps the window opaque. WindowMaterialNone WindowMaterial = iota // The materials of window areas. WindowMaterialWindow WindowMaterialContent WindowMaterialSidebar WindowMaterialHeader WindowMaterialTitlebar WindowMaterialUnderWindow WindowMaterialUnderPage // The materials of transient surfaces: menus, popovers, HUD windows, // sheets, tooltips, selections and full-screen UI. WindowMaterialMenu WindowMaterialPopover WindowMaterialHUD WindowMaterialSheet WindowMaterialTooltip WindowMaterialSelection WindowMaterialFullScreenUI // Windows 11's system backdrops. Mica and Tabbed use the under-window // material on macOS; Acrylic uses the HUD one. WindowMaterialMica WindowMaterialAcrylic WindowMaterialTabbed )
type WindowPlacement ¶
type WindowPlacement uint8
WindowPlacement is the side of an anchor rectangle a panel goes on (core.Window.ShowAt), kept apart from core.Placement so that the platforms do not depend on core.
const ( // WindowPlaceDefault places the panel at no rectangle. WindowPlaceDefault WindowPlacement = iota WindowPlaceBottom WindowPlaceTop WindowPlaceLeft WindowPlaceRight )
type WindowPointerEvents ¶ added in v0.2.0
type WindowPointerEvents uint8
WindowPointerEvents is where a desktop window takes the pointer, by CSS's pointer-events names: everywhere, nowhere, or only where it draws something, the pointer going through to what is below it elsewhere.
const ( // WindowPointerAuto takes the pointer everywhere in the window. WindowPointerAuto WindowPointerEvents = iota // WindowPointerNone takes it nowhere: presses, scrolls and hovering go through to what is below. WindowPointerNone // WindowPointerPainted takes it only where a view under it is Painted. WindowPointerPainted )
type WindowWorkspaces ¶ added in v0.2.0
type WindowWorkspaces uint8
WindowWorkspaces are the workspaces a window shows on: macOS's Spaces, the virtual desktops of Windows and Linux.
const ( // WindowWorkspacesCurrent keeps the window on the workspace it opened on, as windows are. WindowWorkspacesCurrent WindowWorkspaces = iota // WindowWorkspacesAll shows it on every workspace, and over other apps' full screen spaces on macOS. WindowWorkspacesAll )
type Write ¶
Write is the signal writes one line made: the app's line, as dir/file.go:line, or for writes NSGo made of its own, as an animation's, NSGo's function that made them.
type ZoomRequest ¶
ZoomRequest is ItemZoomTo's: the scale to zoom to, and the content point (unzoomed) to show in the middle of the viewport, or nil to keep the middle where it is.
Source Files
¶
- accessibility.go
- address.go
- animated.go
- animator.go
- assetpacks.go
- assets.go
- atlas.go
- audio.go
- audiooutput.go
- auth.go
- canvas.go
- canvas_damage.go
- canvas_path.go
- canvas_split.go
- canvas_tint.go
- canvas_track.go
- canvas_vertices.go
- capture.go
- clipboard.go
- clock.go
- cloud.go
- cursor.go
- discovery.go
- diskspace.go
- doc.go
- downloads.go
- effects.go
- emoji.go
- env.go
- events.go
- features.go
- files.go
- fileurl.go
- focus.go
- fold.go
- folder.go
- fontfamily.go
- frametime.go
- gamepad.go
- gameservices.go
- geometry.go
- gpu.go
- gpu_compressed.go
- gpu_software.go
- gradient.go
- haptics.go
- hittest.go
- input.go
- keycodes.go
- keys.go
- kindnames_gen.go
- layoutspring.go
- liveupdates.go
- matrix.go
- miniprogramsignin.go
- mix.go
- mount.go
- native.go
- notifications.go
- nowplaying.go
- offscreen.go
- openurl.go
- paneldock.go
- panelframe.go
- permissions.go
- picker.go
- pip.go
- pointer.go
- pointerlock.go
- purchases.go
- recordings.go
- rolenames.go
- savepreflight.go
- scan.go
- scroll.go
- scrollhandle.go
- secrets.go
- selection.go
- sensorext.go
- sensors.go
- services.go
- shader.go
- shape.go
- speak.go
- speech.go
- style.go
- svg.go
- svg_markers.go
- svg_paint.go
- svg_shapes.go
- svg_text.go
- systemgestures.go
- text.go
- touch.go
- trace.go
- updater.go
- videoheaders.go
- visual_geometry.go
- wav.go
- webcookie.go
- webmime.go
- webmobile.go
- webview.go
- widgettest.go