Documentation
¶
Overview ¶
Package core is what NSGo apps are written with: elements, styles, the reactive graph and regions, the services an app asks for, and the shadow tree that turns them into mount items, laid out and with text prepared.
The values it shares with the platforms, such as geometry, colors and configurations, are defined in driver, the platform protocol, and aliased here, so apps import core alone. It never imports a platform package or cgo, so it builds and tests headless on every OS.
Index ¶
- Constants
- Variables
- func ActivateFocused(cx *Scope) bool
- func AppRoot(app func(cx *Scope)) func(cx *Scope) Node
- func AssetPackReady(ctx context.Context, name string) (bool, error)
- func CallAutomationTool(*Scope, context.Context, string, json.RawMessage) (json.RawMessage, error)
- func CheckURL(u string) error
- func DownloadUpdate(ctx context.Context, update UpdateCheck, dir string, ...) (string, error)
- func EditsText(key string) bool
- func ErrorCode(err error) string
- func FormatSelection(blocks []SelectionBlock) (markdown, html string)
- func From[T comparable](cx *Scope, initial T, subscribe func(set func(T)) (stop func())) func() T
- func FromFunc[T any](cx *Scope, initial T, equal func(a, b T) bool, ...) func() T
- func InsetsFunc(cx *Scope) func() Edges
- func InstallUpdate(cx *Scope, path string, done func(error))
- func InstallUpdateInBackground(cx *Scope, update UpdateCheck, dir string, ...)
- func KeyCodeHeld(cx *Scope, code string) bool
- func KeyCodeLabel(cx *Scope, code string) string
- func KeyCodesDown(cx *Scope) []string
- func KeyHeld(cx *Scope, key string) bool
- func KeyLabel(key string, os OS, apple bool) string
- func KeysDown(cx *Scope) []string
- func MouseButtonHeld(cx *Scope, button MouseButton) bool
- func MoveFocus(cx *Scope, dir FocusDirection, wrap bool) bool
- func NewSelector[K comparable](cx *Scope, source func() K) (is func(key K) bool)
- func OpenAssetPackFile(name, path string) (io.ReadCloser, error)
- func ParseEnvLength(s string) (EnvInset, Points, error)
- func ProjectDecay(from float64, c DecayConfig) float64
- func ProvideInsets(cx *Scope, insets func() Edges)
- func RegisterAutomationTool(*Scope, AutomationTool) error
- func Restarting() bool
- func RubberBandClamp(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 SetBundledThirdPartyNotices(text string)
- func SetLanguageMatch(match func(locale string) string)
- func SetUpdaterAutomaticChecks(cx *Scope, on bool)
- func SetUpdaterAutomaticDownloads(cx *Scope, on bool)
- func SystemSwitchAvailable(cx *Scope) bool
- func ThirdPartyNotices() string
- func TriggerBack(cx *Scope)
- func UTF16Len(s string) int
- func UTF16Offset(s string, units int) int
- func UnknownClasses(s string) []string
- func Untracked[T any](cx *Scope, fn func() T) (v T)
- type Access
- type AccessRequest
- type AccessWebSchemes
- type AccessibilityAction
- type AccessibilityValue
- type Accessible
- type ActivityConfidence
- type ActivityKinds
- type ActivitySample
- type Affinity
- type AlertAction
- type AlertConfig
- type AlertRole
- type Align
- type AndroidEventMapper
- type AndroidModalProps
- type AndroidPropMapper
- type AndroidScreenProps
- type AndroidViewProp
- type AndroidViewProps
- type AnimatedArg
- type AnimatedNode
- func Add(a, b AnimatedNode) AnimatedNode
- func DiffClamp(in AnimatedNode, min, max float64) AnimatedNode
- func Div(a, b AnimatedNode) AnimatedNode
- func Interpolate(in AnimatedNode, r Interpolation) AnimatedNode
- func Mod(a, b AnimatedNode) AnimatedNode
- func Mul(a, b AnimatedNode) AnimatedNode
- func Resist(in AnimatedNode, min, max, dimension float64) AnimatedNode
- func SnappingDiffClamp(in AnimatedNode, min, max float64) AnimatedNode
- func Sub(a, b AnimatedNode) AnimatedNode
- type AnimatedPropSetter
- type AnimatedStyle
- type AnimatedValue
- func (n *AnimatedValue) AnimatedNodeID() uint32
- func (v *AnimatedValue) ExtractOffset()
- func (v *AnimatedValue) FlattenOffset()
- func (v *AnimatedValue) Read(cx *Scope, fn func(float64))
- func (v *AnimatedValue) Set(x float64)
- func (v *AnimatedValue) SetOffset(x float64)
- func (v *AnimatedValue) Stop()
- type AnimatedXY
- type Animation
- func AtFrameRate(a *Animation, rate float64) *Animation
- func Decay(v *AnimatedValue, c DecayConfig) *Animation
- func Delay(d time.Duration) *Animation
- func Loop(a *Animation, iterations int) *Animation
- func LoopOn(a *Animation, iterations int) *Animation
- func Parallel(steps ...*Animation) *Animation
- func Sequence(steps ...*Animation) *Animation
- func Spring(v *AnimatedValue, to float64, c SpringConfig) *Animation
- func Stagger(interval time.Duration, steps ...*Animation) *Animation
- func Timing(v *AnimatedValue, to float64, c TimingConfig) *Animation
- func ValueKeyframes(v *AnimatedValue, t KeyframeTiming, stops ...KeyframeStop) *Animation
- type AnimationKind
- type AnimationRun
- type AppClipOverlayPosition
- type AppInfo
- type AppURLChange
- type AppURLOptions
- type Appearance
- type AppleCredential
- type AppleCredentialState
- type AppleSignInError
- type AppleSignInOptions
- type ApproxLayout
- func (l *ApproxLayout) Attachment(i int) (Bounds, bool)
- func (l *ApproxLayout) CaretRect(c Caret) (Bounds, bool)
- func (l *ApproxLayout) HitTest(p Point) Caret
- func (l *ApproxLayout) RangeRects(start, end int, out []Bounds) []Bounds
- func (*ApproxLayout) Release()
- func (l *ApproxLayout) TextLines() []TextLine
- type ApproxTextEngine
- type AtlasSprite
- type AtlasSprites
- type AttachmentLayout
- type AttributedText
- type AudioError
- type AudioOutput
- type AudioOutputConfig
- type AudioPlayer
- func (p *AudioPlayer) Close()
- func (p *AudioPlayer) Duration() time.Duration
- func (p *AudioPlayer) Pause()
- func (p *AudioPlayer) Play(done func(error))
- func (p *AudioPlayer) Position() time.Duration
- func (p *AudioPlayer) Preload()
- func (p *AudioPlayer) Seek(position time.Duration)
- func (p *AudioPlayer) SetLoop(loop bool)
- func (p *AudioPlayer) SetMuted(muted bool)
- func (p *AudioPlayer) SetRate(r float32)
- func (p *AudioPlayer) SetVolume(v float32)
- func (p *AudioPlayer) State() AudioPlayerState
- type AudioPlayerOptions
- type AudioPlayerState
- type AudioSession
- type AudioSource
- type AuthError
- type AuthSessionOptions
- type AutoCapitalize
- type AutoComplete
- type AutomationTool
- type BackdropMaterial
- type BackgroundMotionOptions
- type BiometricKind
- type BiometricResult
- type BlendMode
- type BorderCurve
- type BorderStyle
- type Bounds
- type BoxShadow
- type BoxSizing
- type Canvas
- type CanvasGradient
- type CanvasMesh
- type CanvasNode
- type CanvasVertex
- type Caret
- type CaretEvent
- type Catch
- type ClipboardImage
- type ClipboardItem
- type ClipboardRepresentation
- type Clock
- type CloudChangeEvent
- type CloudChangeReason
- type CloudConflict
- type CloudConflictError
- type CloudStore
- type CodeKind
- type Collection
- func (c *Collection[K, T]) At(i int) (T, bool)
- func (c *Collection[K, T]) Delete(k K) bool
- func (c *Collection[K, T]) Get(k K) (T, bool)
- func (c *Collection[K, T]) Items() []T
- func (c *Collection[K, T]) KeyAt(i int) K
- func (c *Collection[K, T]) Keys() []K
- func (c *Collection[K, T]) Len() int
- func (c *Collection[K, T]) Replace(items []T)
- func (c *Collection[K, T]) Set(item T)
- func (c *Collection[K, T]) Update(k K, fn func(T) T) bool
- type Color
- type ColorMatrix
- type ColorSpace
- type ColorStop
- type CompositeOp
- type Composition
- type Constant
- type ContextMenuEvent
- type Corners
- type CrashReport
- type Cursor
- type Curve
- type CustomCursor
- type DataStyle
- type DecayConfig
- type DesktopViewProps
- type Directory
- type DiskSpace
- type Display
- type DisplayInfo
- type DownloadOptions
- type DownloadProgress
- type DownloadRequest
- type DownloadState
- type DownloadTask
- type DrawArg
- type DrawKind
- type DrawOp
- type DrawSlot
- type Drawing
- type Dynamic
- type EaseMode
- type Easing
- type EasingKind
- type EdgeBar
- type EdgeColors
- type EdgeEffect
- type EdgeEffects
- type Edges
- type EditAction
- type Effects
- type Element
- type EllipsizeMode
- type EmBox
- type Env
- func (e *Env) AppClip() bool
- func (e *Env) Appearance() Appearance
- func (e *Env) AppleKeys() bool
- func (e *Env) CanDiscoverServices() bool
- func (e *Env) CanDockPanels() bool
- func (e *Env) CanLockPointer() bool
- func (e *Env) CanLookUp() bool
- func (e *Env) CanMakeWindowsTransparent() bool
- func (e *Env) CanPickScreenColor() bool
- func (e *Env) CanPlaceWindows() bool
- func (e *Env) CanPlayAudio() bool
- func (e *Env) CanPlayHapticPattern() bool
- func (e *Env) CanPurchase() bool
- func (e *Env) CanQuickLook() bool
- func (e *Env) CanRecognizeSpeech() bool
- func (e *Env) CanRequestReview() bool
- func (e *Env) CanScanCode() bool
- func (e *Env) CanScheduleAudio() bool
- func (e *Env) CanScheduleNotifications() bool
- func (e *Env) CanSendInput() bool
- func (e *Env) CanSetWindowLevel() bool
- func (e *Env) CanSetWindowWorkspaces() bool
- func (e *Env) CanShowNowPlaying() bool
- func (e *Env) CanSignInMiniProgram() bool
- func (e *Env) CanSignInWithApple() bool
- func (e *Env) CanSkipTaskbar() bool
- func (e *Env) CanSpeak() bool
- func (e *Env) CanTakePhoto() bool
- func (e *Env) CanUseCloudStorage() bool
- func (e *Env) CanUseGameServices() bool
- func (e *Env) Dark() bool
- func (e *Env) Desktop() bool
- func (e *Env) DeviceModel() string
- func (e *Env) DeviceName() string
- func (e *Env) Display() DisplayInfo
- func (e *Env) Displays() []DisplayInfo
- func (e *Env) FontScale() float32
- func (e *Env) FullScreen() bool
- func (e *Env) Geometry() Geometry
- func (e *Env) HasWebView() bool
- func (e *Env) Idiom() Idiom
- func (e *Env) IncreaseContrast() bool
- func (e *Env) KeyboardDuration() time.Duration
- func (e *Env) KeyboardHeight() Points
- func (e *Env) Language() string
- func (e *Env) LaunchedAtLogin() bool
- func (e *Env) Lifecycle() Lifecycle
- func (e *Env) Locale() string
- func (e *Env) LocaleSettings() LocaleSettings
- func (e *Env) LowPowerMode() LowPowerMode
- func (e *Env) Maximized() bool
- func (e *Env) Minimized() bool
- func (e *Env) Network() Network
- func (e *Env) OS() OS
- func (e *Env) OSVersion() OSVersion
- func (e *Env) OpenedURL() string
- func (e *Env) PixelRatio() float32
- func (e *Env) Pointer() Pointer
- func (e *Env) RTL() bool
- func (e *Env) ReduceMotion() bool
- func (e *Env) SafeArea() Edges
- func (e *Env) ScreenReader() bool
- func (e *Env) Simulated() bool
- func (e *Env) SupportsCustomCursor() bool
- func (e *Env) SupportsGPU() bool
- func (e *Env) SupportsGamepads() bool
- func (e *Env) ThermalState() ThermalState
- func (e *Env) TitleBar() Edges
- func (e *Env) VerticalBarEdge() VerticalBarEdge
- func (e *Env) Window() Size
- func (e *Env) WindowFrame() WindowFrame
- func (e *Env) WindowMaterial() WindowMaterial
- func (e *Env) WindowTransparent() bool
- type EnvEdges
- type EnvInset
- type Environment
- type Error
- type Extrapolate
- type File
- type FillRule
- type Filter
- func Blur(radius Points) Filter
- func Brightness(f float32) Filter
- func Contrast(f float32) Filter
- func DropShadow(offset Point, blur Points, c Color) Filter
- func Fade(f float32) Filter
- func Grayscale(f float32) Filter
- func HueRotate(degrees float32) Filter
- func Invert(f float32) Filter
- func ParseFilters(s string) ([]Filter, error)
- func Saturate(f float32) Filter
- func Sepia(f float32) Filter
- type FilterKind
- type FlexDirection
- type FlexWrap
- type FocusDirection
- type Font
- type FontExtent
- type FontStyle
- type FontVariant
- type FontWeight
- type FrameRateRange
- type FrontmostAppInfo
- type Func
- type GPUSurface
- type GPUView
- type GameAchievement
- type GamePlayer
- type GamePlayerScope
- type GameScoreEntry
- type GameServices
- type GameTimeScope
- type GeofenceOptions
- type GeofenceRegion
- type GeofenceSample
- type GeofenceState
- type Geometry
- type GestureEvent
- type GesturePhase
- type GlassEffect
- type Gradient
- type GradientCorner
- type GradientExtent
- type GradientKind
- type GradientPaint
- type GradientSpread
- type GradientStop
- type GridFlow
- type GridLines
- type GridPlacement
- type GridTracks
- type Group
- type GroupStyle
- type Haptic
- type HapticEvent
- type HapticPattern
- type HeaderSymbol
- type HeaderSystemItem
- type HingeState
- type HintChange
- type HintTooltip
- type History
- func (h *History[T]) Break()
- func (h *History[T]) CanRedo() bool
- func (h *History[T]) CanUndo() bool
- func (h *History[T]) Clear()
- func (h *History[T]) Get() T
- func (h *History[T]) GetUntracked() T
- func (h *History[T]) Group(fn func())
- func (h *History[T]) Redo() bool
- func (h *History[T]) Set(v T)
- func (h *History[T]) Undo() bool
- func (h *History[T]) Update(fn func(T) T)
- type HistoryBehavior
- type HistoryOptions
- type Holder
- type Host
- func (h *Host) Handle(name string, fn func(call *HostCall))
- func (h *Host) HandleDefault(fn func(call *HostCall))
- func (h *Host) HandleOpenURL(fn func(url string, answer func(handled bool)))
- func (h *Host) RemoveHandler(name string)
- func (h *Host) Send(name string, data any) error
- func (h *Host) SetParams(params map[string]any) error
- type HostCall
- type HotKey
- type HotKeyState
- type IOSInputProps
- type IOSModalProps
- type IOSScreenProps
- type IOSViewProps
- type Icon
- type Idiom
- type Image
- type ImageSampling
- type ImageScales
- type ImageSource
- type Importance
- type Input
- type InputAccessoryView
- type Interpolation
- type Justify
- type KeepAwakeOptions
- type Key
- type KeyEvent
- type KeyOptions
- type KeyWhen
- type KeyboardAppearance
- type KeyboardDismissMode
- type KeyboardTaps
- type KeyboardType
- type Keyframe
- type KeyframeAnimation
- type KeyframeStop
- type KeyframeTiming
- type Keyframes
- type LayoutAnimation
- type LayoutAudit
- type LayoutCurve
- type LayoutDirection
- type LayoutProperty
- type LayoutTransition
- type Length
- type Lifecycle
- type LineCap
- type LineDash
- type LineJoin
- type LineLayout
- type List
- type ListAlignment
- type ListPosition
- type ListRow
- type ListViewport
- type LiveRegion
- type LocalService
- type LocaleSettings
- type LocationFix
- type LocationOptions
- type LowPowerMode
- type ManualClock
- type Matrix3D
- type MediaCommand
- type MediaCommandKind
- type MediaError
- type MediaErrorReason
- type Memo
- type MemorySecrets
- type MenuBarMode
- type MenuIcon
- type MenuItem
- type MenuRole
- type MenuWhen
- type MiniProgramCredential
- type MiniProgramPlatform
- type MiniProgramSignInError
- type MiniProgramSignInOptions
- type Modal
- type ModalAnimation
- type ModalPresentation
- type Modifiers
- type Motion
- type MotionChannel
- type MotionKind
- type MotionOptions
- type MotionPreset
- type MotionSample
- type MotionSensors
- type MotionSpec
- type MotionTrack
- type MouseButton
- type MouseButtonEvent
- type MouseEvent
- type Native
- type NativeComponent
- type NativeComponents
- type NativeContext
- type NativeFactory
- type Network
- type Node
- type NodeID
- type Notification
- type NotificationPermission
- type NotificationRepeat
- type NowPlaying
- type OS
- type OSVersion
- type ObjectPosition
- type Obstruction
- type OfferPaymentMode
- type OffscreenCanvas
- type OffscreenImage
- func (o *OffscreenImage) ID() uint64
- func (o *OffscreenImage) Invalidate()
- func (o *OffscreenImage) Release()
- func (o *OffscreenImage) Released() bool
- func (o *OffscreenImage) Resize(size Size, scale float64)
- func (o *OffscreenImage) Scale() float64
- func (o *OffscreenImage) Size() Size
- func (o *OffscreenImage) Source() ImageSource
- func (o *OffscreenImage) Version() uint64
- type Opacity
- type Orientation
- type Outline
- type Overflow
- type Overlay
- type OverlayEnd
- type OverlayOptions
- type OverlayPermission
- type OverlayPosition
- type Paint
- type PaintStyle
- type Palette
- type PanActivation
- type PanEvent
- type PanGesture
- type PanelDock
- type PanelOptions
- type PanicError
- type PartStates
- type PasteBehavior
- type PasteEvent
- type PastedFile
- type Path
- type PeriodUnit
- type Permission
- type PermissionGuideOptions
- type PermissionStatus
- type PersistOptions
- type Persisted
- type PhotoOptions
- type PhysicalBorders
- type PhysicalEdges
- type PickDirectoriesOptions
- type PickFilesOptions
- type PickFormat
- type PickOptions
- type PickedFile
- type PictureInPicture
- type PictureInPictureState
- type Placement
- type Playback
- type PlaybackDirection
- type Point
- type Pointer
- type PointerEvents
- type PointerHit
- type Points
- type Position
- type PositionAxis
- type PreparedText
- type Presence
- type PresenceOf
- type PressEvent
- type PressureSample
- type Product
- type ProductType
- type PromotionalOffer
- type PurchaseError
- type PurchaseOptions
- type QuitRequest
- type RSXform
- type Ref
- func (r *Ref) Before(other *Ref) bool
- func (r *Ref) Blur()
- func (r *Ref) Bounds() (Bounds, bool)
- func (r *Ref) CloseEditMenu()
- func (r *Ref) Command(name string, args any)
- func (r *Ref) ContentBounds() (Bounds, bool)
- func (r *Ref) ContentBox() (Bounds, bool)
- func (r *Ref) Evaluate(script string, done func(json string, err error))
- func (r *Ref) Focus()
- func (r *Ref) Frame() (Bounds, bool)
- func (r *Ref) GoBack()
- func (r *Ref) GoForward()
- func (r *Ref) HitTest(p Point) (Point, bool)
- func (r *Ref) HoldsFocus() bool
- func (r *Ref) InjectJavaScript(script string)
- func (r *Ref) ListPosition() (ListPosition, bool)
- func (r *Ref) Load(src WebSource)
- func (r *Ref) LockPointer() (unlock func())
- func (r *Ref) Measure(done func(frame, page Bounds, ok bool))
- func (r *Ref) OpenEditMenu(bounds Bounds, actions EditAction)
- func (r *Ref) PostMessage(data string)
- func (r *Ref) Reload()
- func (r *Ref) Reveal(opts RevealOptions)
- func (r *Ref) RevealBox(box Bounds, opts RevealOptions)
- func (r *Ref) ScrollTo(at Point, animated bool)
- func (r *Ref) ScrollToEnd(animated bool)
- func (r *Ref) ScrollToIndex(index int, animated bool)
- func (r *Ref) ScrollToIndexAt(index int, viewPosition float32, viewOffset Points, animated bool)
- func (r *Ref) Seek(position time.Duration)
- func (r *Ref) SendInput(in WebInput)
- func (r *Ref) SetAccessibilityFocus()
- func (r *Ref) SetSelection(start, end int)
- func (r *Ref) StartPictureInPicture()
- func (r *Ref) StopLoading()
- func (r *Ref) StopPictureInPicture()
- func (r *Ref) TextCaretAt(p Point) (offset int, upstream, ok bool)
- func (r *Ref) TextCaretBox(offset int, upstream bool) (Bounds, bool)
- func (r *Ref) TextRangeBoxes(start, end int) []Bounds
- func (r *Ref) ZoomTo(scale float32, center *Point, animated bool)
- type RefundStatus
- type Region
- type ResizeMode
- type Resource
- type ResourceInfo
- type ResourceState
- type Responder
- type ResponderEvent
- type ReturnKeyType
- type RevealOptions
- type Ripple
- type Role
- type RootOptions
- type SVG
- type SVGView
- type SaveOptions
- type ScanOptions
- type ScannedCode
- type Scope
- func (cx *Scope) Abort()
- func (cx *Scope) AddRecentFile(path string)
- func (cx *Scope) AdvertiseService(service LocalService, onError func(error)) (stop func(), err error)
- func (cx *Scope) AfterFunc(d time.Duration, fn func()) (stop func() bool)
- func (cx *Scope) Animate(d time.Duration, curve Curve, step func(progress float64)) (stop func())
- func (cx *Scope) AnimateLayout(a LayoutAnimation)
- func (cx *Scope) Announce(text string)
- func (cx *Scope) AppURL() string
- func (cx *Scope) AppleCredentialState(user string, done func(AppleCredentialState, error))
- func (cx *Scope) AudioOutputLatency(done func(latency time.Duration, known bool))
- func (cx *Scope) AuthSession(url func(redirect string) string, opts AuthSessionOptions, ...) (cancel func())
- func (cx *Scope) AuthenticateBiometric(reason string, done func(BiometricResult))
- func (cx *Scope) Batch(fn func())
- func (cx *Scope) BeginWork() func()
- func (cx *Scope) BindWebHead(title, description func() string)
- func (cx *Scope) BiometricAvailability(done func(BiometricKind))
- func (cx *Scope) BrowseServices(serviceType string, found func(ServiceEvent)) (stop func(), err error)
- func (cx *Scope) CacheDir() string
- func (cx *Scope) CallHost(name string, data any, done func(result any, err error))
- func (cx *Scope) CallHostTimeout(name string, data any, timeout time.Duration, done func(result any, err error))
- func (cx *Scope) CanInstallPackages(done func(allowed bool))
- func (cx *Scope) CanReadFrontmostApp() bool
- func (cx *Scope) Capture(target *Ref, done func(png []byte, err error))
- func (cx *Scope) CheckAccess(req AccessRequest) error
- func (cx *Scope) CheckForUpdates(background bool, done func(UpdateCheck))
- func (cx *Scope) Child() *Scope
- func (cx *Scope) Cleanup(fn func())
- func (cx *Scope) ClearNowPlaying()
- func (cx *Scope) ClearRecentFiles()
- func (cx *Scope) ClearWebsiteData(done func(err error))
- func (cx *Scope) ClipboardChangeCount(done func(int64))
- func (cx *Scope) ClipboardFormats(done func([]string))
- func (cx *Scope) CloseNotification(id string)
- func (cx *Scope) CloseNotifications()
- func (cx *Scope) CloseWindow()
- func (cx *Scope) CloudStore() CloudStore
- func (cx *Scope) Confine()
- func (cx *Scope) Context() context.Context
- func (cx *Scope) CrashReports() ([]CrashReport, error)
- func (cx *Scope) CurrentEntitlements(done func([]Transaction, error))
- func (cx *Scope) CurrentWindow() *Window
- func (cx *Scope) CursorPoint(done func(Point, bool))
- func (cx *Scope) Dark() bool
- func (cx *Scope) DataDir() string
- func (cx *Scope) DeferSystemGestures(opts SystemGestureOptions) (release func())
- func (cx *Scope) DiskSpace(done func(DiskSpace, error))
- func (cx *Scope) DismissKeyboard()
- func (cx *Scope) Dispose()
- func (cx *Scope) Disposed() bool
- func (cx *Scope) Download(req DownloadRequest, destination string, opts DownloadOptions) (DownloadTask, error)
- func (cx *Scope) Effect(fn func()) (stop func())
- func (cx *Scope) Env() *Env
- func (cx *Scope) ExitApp()
- func (cx *Scope) FinishTransaction(id string, done func(error))
- func (cx *Scope) FrontmostApp() FrontmostAppInfo
- func (cx *Scope) GuidePermission(p Permission, opts PermissionGuideOptions, done func(PermissionStatus)) (stop func())
- func (cx *Scope) HasClipboardImage(done func(bool))
- func (cx *Scope) HasClipboardText(done func(bool))
- func (cx *Scope) HasHost() bool
- func (cx *Scope) HasTree() bool
- func (cx *Scope) Hiding() bool
- func (cx *Scope) HostParams() map[string]any
- func (cx *Scope) ImageSize(src ImageSource, done func(pixels Size, err error))
- func (cx *Scope) InstallPackage(path string, done func(started bool, err error))
- func (cx *Scope) KeepAwake(reason string, opts KeepAwakeOptions) (release func())
- func (cx *Scope) KeepImage(src ImageSource) (release func())
- func (cx *Scope) KeyLabel(key string) string
- func (cx *Scope) LaunchAtLogin(done func(on bool))
- func (cx *Scope) LoadSound(src AudioSource, done func(*Sound, error))
- func (cx *Scope) Locate(opts LocationOptions, done func(LocationFix, error)) (*SensorStream, error)
- func (cx *Scope) LogsDir() string
- func (cx *Scope) LookUp(text string, in *Ref, at Bounds) bool
- func (cx *Scope) MainWindow() *Window
- func (cx *Scope) ManageSubscriptions(done func(error))
- func (cx *Scope) MeasureText(text string, font Font) TextMetrics
- func (cx *Scope) MinimizeWindow()
- func (cx *Scope) NewAudioOutput(conf AudioOutputConfig) (*AudioOutput, error)
- func (cx *Scope) NewAudioPlayer(src AudioSource, opts AudioPlayerOptions) *AudioPlayer
- func (cx *Scope) NewOffscreenImage(size Size, scale float64, draw func(*Drawing)) *OffscreenImage
- func (cx *Scope) NewTray(opts TrayOptions) *Tray
- func (cx *Scope) NotificationPermission(done func(NotificationPermission))
- func (cx *Scope) Now() time.Time
- func (cx *Scope) ObserveWork(active func(bool))
- func (cx *Scope) OnAppURLChange(fn func(AppURLChange)) func()
- func (cx *Scope) OnBackPress(fn func() bool)
- func (cx *Scope) OnDownloadUpdate(fn func(DownloadProgress))
- func (cx *Scope) OnExit(exit func(done func()))
- func (cx *Scope) OnHostEvent(name string, fn func(data any))
- func (cx *Scope) OnKey(key string, fn func())
- func (cx *Scope) OnKeyWith(key string, opts KeyOptions, fn func())
- func (cx *Scope) OnMediaCommand(fn func(MediaCommand))
- func (cx *Scope) OnNetworkChange(fn func(Network))
- func (cx *Scope) OnNotificationPress(fn func(id string))
- func (cx *Scope) OnOpenFiles(fn func(paths []string))
- func (cx *Scope) OnOpenLinks(fn func(links []string))
- func (cx *Scope) OnPurchaseUpdate(fn func(Transaction))
- func (cx *Scope) OnQuit(fn func(ctx context.Context))
- func (cx *Scope) OnQuitRequest(fn func(*QuitRequest))
- func (cx *Scope) OnReopen(fn func())
- func (cx *Scope) OnShared(fn func([]SharedItem))
- func (cx *Scope) OpenFile(f SharedFile, done func(opened bool, err error))
- func (cx *Scope) OpenInstallSettings(done func(opened bool))
- func (cx *Scope) OpenOverlay(opts OverlayOptions, content func(cx *Scope) Node) *Window
- func (cx *Scope) OpenPanel(opts PanelOptions, content func(cx *Scope) Node) *Window
- func (cx *Scope) OpenPermissionSettings(p Permission, done func(opened bool))
- func (cx *Scope) OpenURL(u string, done func(opened bool))
- func (cx *Scope) OpenWindow(opts WindowOptions, content func(cx *Scope) Node) *Window
- func (cx *Scope) OrderFront()
- func (cx *Scope) OverlayPermission(done func(OverlayPermission))
- func (cx *Scope) Palette() Palette
- func (cx *Scope) PauseTracking() (resume func())
- func (cx *Scope) PermissionStatus(p Permission, done func(PermissionStatus))
- func (cx *Scope) PickDirectories(o PickDirectoriesOptions, done func(dirs []Directory, err error))
- func (cx *Scope) PickFiles(o PickFilesOptions, done func(files []File, err error))
- func (cx *Scope) PickImages(o PickOptions, done func(files []PickedFile))
- func (cx *Scope) PickScreenColor(done func(c Color, ok bool))
- func (cx *Scope) PlayHaptic(h Haptic)
- func (cx *Scope) PlayHapticPattern(pattern HapticPattern)
- func (cx *Scope) PopupMenu(items []MenuItem, at Point, closed func())
- func (cx *Scope) Post(fn func())
- func (cx *Scope) PostHost(name string, data any)
- func (cx *Scope) PrefetchImage(src ImageSource, done func(ok bool))
- func (cx *Scope) Present() bool
- func (cx *Scope) Products(ids []string, done func([]Product, error))
- func (cx *Scope) ProvideAccess(a Access)
- func (cx *Scope) ProvideHost(h *Host)
- func (cx *Scope) ProvideSecrets(name string)
- func (cx *Scope) ProvideStorage(name string, quota int)
- func (cx *Scope) Purchase(product string, opts PurchaseOptions, done func(Transaction, error))
- func (cx *Scope) QuickLook(paths []string, index int) bool
- func (cx *Scope) Quit()
- func (cx *Scope) Quitting() bool
- func (cx *Scope) ReadAsset(uri string, done func(data []byte, err error))
- func (cx *Scope) ReadClipboard(done func(text string))
- func (cx *Scope) ReadClipboardFiles(done func(uris []string))
- func (cx *Scope) ReadClipboardImage(done func(img ClipboardImage, ok bool, err error))
- func (cx *Scope) ReadClipboardItems(done func([]ClipboardItem, error))
- func (cx *Scope) RegisterFont(data []byte) error
- func (cx *Scope) RegisterHotKey(key string, fn func()) *HotKey
- func (cx *Scope) RenderEffect(fn func())
- func (cx *Scope) RequestAnimationFrame(fn func(at time.Time)) (stop func())
- func (cx *Scope) RequestNotificationPermission(done func(NotificationPermission))
- func (cx *Scope) RequestOrientation(mask Orientation)
- func (cx *Scope) RequestOverlayPermission(done func(OverlayPermission))
- func (cx *Scope) RequestPermission(p Permission, done func(PermissionStatus))
- func (cx *Scope) RequestPreciseLocation(purpose string, done func(full bool, err error)) (*SensorStream, error)
- func (cx *Scope) RequestQuit()
- func (cx *Scope) RequestRefund(transactionID string, done func(RefundStatus, error))
- func (cx *Scope) RequestRestart()
- func (cx *Scope) RequestReview()
- func (cx *Scope) ResolveImage(src ImageSource) ImageSource
- func (cx *Scope) Restart()
- func (cx *Scope) RestoreInputSource()
- func (cx *Scope) RevealFile(path string, done func(error))
- func (cx *Scope) Run(fn func())
- func (cx *Scope) RunFrame()
- func (cx *Scope) RunFrameAt(at time.Time)
- func (cx *Scope) SaveFile(o SaveOptions, done func(saved bool, path string, err error))
- func (cx *Scope) ScanCode(o ScanOptions, done func(code *ScannedCode, err error))
- func (cx *Scope) Secrets() Secrets
- func (cx *Scope) SelectInputSource(id string)
- func (cx *Scope) ServeScheme(scheme string, handler func(url string) []byte) error
- func (cx *Scope) ServeSchemeRequest(scheme string, handler func(*WebSchemeRequest) *WebSchemeResponse) error
- func (cx *Scope) SetAppURL(raw string, options ...AppURLOptions) error
- func (cx *Scope) SetAppearance(a Appearance)
- func (cx *Scope) SetApplicationMenu(items []MenuItem)
- func (cx *Scope) SetBadge(count int)
- func (cx *Scope) SetClipboard(text string)
- func (cx *Scope) SetClipboardImage(data []byte)
- func (cx *Scope) SetDockMenu(items []MenuItem)
- func (cx *Scope) SetDockVisible(on bool)
- func (cx *Scope) SetFullScreen(on bool, displayID ...string)
- func (cx *Scope) SetImageCacheLimit(maxBytes int64)
- func (cx *Scope) SetLaunchAtLogin(on bool)
- func (cx *Scope) SetLocale(locale string)
- func (cx *Scope) SetMainView(view func(cx *Scope) Node)
- func (cx *Scope) SetMainWindow(w *Window)
- func (cx *Scope) SetMenuBar(mode MenuBarMode)
- func (cx *Scope) SetNowPlaying(info NowPlaying)
- func (cx *Scope) SetPreferredFrameRate(rate FrameRateRange)
- func (cx *Scope) SetScrollbars(m ScrollbarMaker)
- func (cx *Scope) SetShutdownMode(m ShutdownMode)
- func (cx *Scope) SetSkipTaskbar(on bool)
- func (cx *Scope) SetSoundLimits(limits SoundLimits) error
- func (cx *Scope) SetStatusBar(patch StatusBarSetting)
- func (cx *Scope) SetSubtreeAppearance(a Appearance)
- func (cx *Scope) SetTaskProgress(p TaskProgress)
- func (cx *Scope) SetTheme(t *Theme)
- func (cx *Scope) SetTitle(title string)
- func (cx *Scope) SetTitleBar(style TitleBarStyle, height Points)
- func (cx *Scope) SetWebCookies(cookies []WebCookie, done func(err error))
- func (cx *Scope) SetWindowConstraints(c WindowConstraints)
- func (cx *Scope) SetWindowControls(c WindowControls)
- func (cx *Scope) SetWindowFrame(f WindowFrame)
- func (cx *Scope) SetWindowLevel(level WindowLevel)
- func (cx *Scope) SetWindowMaterial(m WindowMaterial)
- func (cx *Scope) SetWindowPointerEvents(p WindowPointerEvents)
- func (cx *Scope) SetWindowShadow(on bool)
- func (cx *Scope) SetWindowTransparent(on bool)
- func (cx *Scope) SetWindowWorkspaces(w WindowWorkspaces)
- func (cx *Scope) Share(o ShareOptions, done func(shown bool, err error))
- func (cx *Scope) ShowAlert(a AlertConfig, done func(index int))
- func (cx *Scope) ShowAppClipOverlay(position AppClipOverlayPosition) (dismiss func())
- func (cx *Scope) ShowNotification(n Notification, done func(shown bool)) error
- func (cx *Scope) SignInMiniProgram(opts MiniProgramSignInOptions, done func(MiniProgramCredential, error))
- func (cx *Scope) SignInWithApple(opts AppleSignInOptions, done func(AppleCredential, error))
- func (cx *Scope) Speak(text string, voice Voice, done func(stopped bool, err error)) error
- func (cx *Scope) StartAnimation(a *Animation, done func(finished bool)) *AnimationRun
- func (cx *Scope) StartSpeech(opts SpeechOptions) (*SpeechSession, error)
- func (cx *Scope) StopSpeaking()
- func (cx *Scope) Storage() Storage
- func (cx *Scope) Store() *Store
- func (cx *Scope) SyncPurchases(done func(error))
- func (cx *Scope) TakePhoto(o PhotoOptions, done func(photo *PickedFile, err error))
- func (cx *Scope) Theme() *Theme
- func (cx *Scope) ToggleFullScreen()
- func (cx *Scope) ToggleMaximize()
- func (cx *Scope) TrashFile(path string, done func(trashedAt string, err error))
- func (cx *Scope) Tween(from, to float64, c TimingConfig, update func(float64), ...) *AnimationRun
- func (cx *Scope) Untrack(fn func())
- func (cx *Scope) UpdateActive() bool
- func (cx *Scope) UserDir(dir StandardDir) (string, error)
- func (cx *Scope) Voices(lang string, done func([]VoiceInfo))
- func (cx *Scope) WallTime() time.Time
- func (cx *Scope) WatchActivity(sample func(ActivitySample), failed func(error)) (*SensorStream, error)
- func (cx *Scope) WatchBackgroundMotion(opts BackgroundMotionOptions, sample func(MotionSample), failed func(error)) (*SensorStream, error)
- func (cx *Scope) WatchGeofences(opts GeofenceOptions, sample func(GeofenceSample), failed func(error)) (*SensorStream, error)
- func (cx *Scope) WatchLocation(opts LocationOptions, sample func(LocationFix), failed func(error)) (*SensorStream, error)
- func (cx *Scope) WatchMotion(opts MotionOptions, sample func(MotionSample), failed func(error)) (*SensorStream, error)
- func (cx *Scope) WatchPressure(sample func(PressureSample), failed func(error)) (*SensorStream, error)
- func (cx *Scope) WatchScroll(target func() *Ref, fn func(ScrollEvent))
- func (cx *Scope) WatchSteps(sample func(StepSample), failed func(error)) (*SensorStream, error)
- func (cx *Scope) WebCookies(f WebCookieFilter, done func(cookies []WebCookie, err error))
- func (cx *Scope) WriteClipboardItems(items []ClipboardItem, done ...func(error))
- type Screen
- type ScreenAnimation
- type ScreenEffect
- type ScreenTransition
- type Scroll
- type ScrollAlignment
- type ScrollBehavior
- type ScrollEvent
- type ScrollbarMaker
- type SecretAccessible
- type SecretItem
- type SecretStore
- type Secrets
- type Selectable
- type SelectedText
- type SelectionAlign
- type SelectionBlock
- type SelectionBlockKind
- type SelectionInline
- type SelectionInlineKind
- type SensorError
- type SensorNumber
- type SensorQuaternion
- type SensorStream
- type SensorVector
- type ServiceEvent
- type Shader
- type ShaderEffect
- type ShaderProgram
- type ShaderTransition
- type ShareOptions
- type SharedFile
- type SharedItem
- type Show
- type ShutdownMode
- type Sides
- type Signal
- type Size
- type SnapAlignment
- type Sound
- type SoundLimits
- type SoundVoice
- type Span
- type SpeakError
- type SpeechError
- type SpeechOptions
- type SpeechSession
- type SpringConfig
- type Stack
- type StandardDir
- type StatusBarSetting
- type StatusBarStyle
- type StepPosition
- type StepSample
- type Storage
- type StorageBackend
- type StorageChange
- type StorageFullError
- type StorageOp
- type Store
- type Style
- type SubmitBehavior
- type Subscription
- type SubscriptionOffer
- type SubscriptionPeriod
- type Suggest
- type SuggestOptions
- type Suspense
- type SystemClock
- type SystemGestureEdge
- type SystemGestureOptions
- type SystemSwitch
- type TabBadge
- type TabBar
- type TabBarEdge
- type TabBarItem
- type Tailwind
- type TaskProgress
- type TaskProgressState
- type Text
- type TextAlign
- type TextAlignVertical
- type TextAttachment
- type TextBackground
- type TextBaseline
- type TextDecoration
- type TextDecorationStyle
- type TextEngine
- type TextLayout
- type TextLine
- type TextMetrics
- type TextRange
- type TextSelection
- type TextShadow
- type TextSpan
- type TextStyle
- type TextTransform
- type Theme
- type ThermalState
- type TimingConfig
- type TitleBarStyle
- type Toggle
- type Tokens
- type Touch
- type TouchClaim
- type TouchEvent
- type TouchPhase
- type Transaction
- type Transform
- type TransformKind
- type TransformStep
- type Transition
- type TransitionProperty
- type TransitionShader
- type Tray
- type TrayOptions
- type Tree
- func (t *Tree) Changed() bool
- func (t *Tree) Closed() bool
- func (t *Tree) Commit() *driver.MountBatch
- func (t *Tree) CommitShared() *driver.MountBatch
- func (t *Tree) Dispatch(ev driver.Event)
- func (t *Tree) FontsChanged()
- func (t *Tree) Forget()
- func (t *Tree) FramePending() bool
- func (t *Tree) Graph() int
- func (t *Tree) HitTest(p Point) NodeID
- func (t *Tree) ID() uint32
- func (t *Tree) KeyDown(ev driver.Event) bool
- func (t *Tree) Language() string
- func (t *Tree) Mount(app func(cx *Scope) Node)
- func (t *Tree) Pacing() bool
- func (t *Tree) PendingTransitionEnds() bool
- func (t *Tree) PreferredFrameRate() FrameRateRange
- func (t *Tree) PressAt(ev driver.Event)
- func (t *Tree) Remount()
- func (t *Tree) Resize(size Size, g Geometry)
- func (t *Tree) RunFrameAt(at time.Time)
- func (t *Tree) SetAppearance(a Appearance)
- func (t *Tree) SetDevGeometrySource(watch func(func(driver.GeometrySnapshot)))
- func (t *Tree) SetEnvironment(env Environment)
- func (t *Tree) SetGPUSubmitter(fn func(driver.GPUFrame))
- func (t *Tree) SetTokens(tokens Tokens)
- func (t *Tree) SetViewPacing(on bool)
- func (t *Tree) Size() Size
- func (t *Tree) Surfaces() []*Tree
- func (t *Tree) Window() *Window
- type Uniforms
- type UpdateCheck
- type UpdateDownloadProgress
- type UpdateHighlights
- type UpdatePhase
- type UpdaterManaged
- type UpdaterState
- type UserSelect
- type VerticalAlign
- type VerticalBarEdge
- type Video
- type VideoInfo
- type VideoPauseReason
- type View
- type ViewPaint
- type ViewPaintKind
- type ViewToken
- type ViewabilityConfig
- type ViewableItems
- type Visibility
- type VisibleContentPosition
- type Voice
- type VoiceInfo
- type WebCookie
- type WebCookieFilter
- type WebDownload
- type WebDownloadState
- type WebError
- type WebInput
- type WebInputKind
- type WebMedia
- type WebMessage
- type WebNavigation
- type WebSameSite
- type WebSchemeHandler
- type WebSchemeRequest
- type WebSchemeResponse
- type WebSource
- type WebView
- type WebViewProps
- type WebWindowRequest
- type WheelEvent
- type WhiteSpace
- type Window
- func (w *Window) Close()
- func (w *Window) Closed() bool
- func (w *Window) Focus()
- func (w *Window) Hide()
- func (w *Window) MoveTo(anchor Bounds, placement Placement) error
- func (w *Window) OnClosing(cx *Scope, fn func(*WindowClosing))
- func (w *Window) OnPlacementError(cx *Scope, fn func(error))
- func (w *Window) Show()
- func (w *Window) ShowAt(anchor Bounds, placement Placement) error
- func (w *Window) Toggle()
- func (w *Window) Visible() bool
- type WindowClosing
- type WindowConstraints
- type WindowControls
- type WindowControlsStyle
- type WindowDrag
- type WindowFrame
- type WindowLevel
- type WindowMaterial
- type WindowOptions
- type WindowPlacement
- type WindowPointerEvents
- type WindowWorkspaces
- type WritingDirection
Constants ¶
const ( // AccessNetwork is fetch and the images and videos loaded from the // network, by URL. AccessNetwork = "network" // AccessWebView is the pages a web view shows, by URL, with AccessInput the trusted input Ref.SendInput gives them, with AccessMedia the devices WebView.Media lets them capture, and with AccessCookies the cookies SetWebCookies writes and WebCookies lists, by a URL each goes to, "" standing for the whole store WebCookies lists and ClearWebsiteData clears. AccessWebView = "webview" // AccessOpenURL is OpenURL, by URL. AccessOpenURL = "openUrl" // AccessClipboard is reading and writing the system clipboard. AccessClipboard = "clipboard" // AccessPicker is the system's photo, camera and file pickers, and its code scanner. AccessPicker = "picker" // AccessSpeech is the microphone and the speech recognizer. AccessSpeech = "speech" // AccessTextToSpeech is speaking text aloud with the system's voices (Speak), refused with SpeakNotAllowed, and listing them (Voices). AccessTextToSpeech = "textToSpeech" // AccessStatusBar is setting the status bar. AccessStatusBar = "statusBar" // AccessNotifications is system notifications and the app's badge. AccessNotifications = "notifications" // AccessBiometrics is Face ID, Touch ID and device biometric unlock. AccessBiometrics = "biometrics" // AccessSignInWithApple is Sign in with Apple and its credentials' states. AccessSignInWithApple = "signInWithApple" // AccessPurchases is in-app purchases: the store's products, buying them, their transactions and updates. AccessPurchases = "purchases" // AccessSecrets is the app's secure store (Scope.Secrets), with Resource the service of a refused item. AccessSecrets = "secrets" // AccessPermissions is checking, asking for and opening the settings of the system's permissions, by the permission's key (AccessRequest.Resource), and guiding the user to give them. AccessPermissions = "permissions" // AccessOverlay is windows over other apps on Android (OpenOverlay), and desktop windows that let the pointer through to them (SetWindowPointerEvents), which TSX packages cannot declare. AccessOverlay = "overlay" // AccessAudio is the audio package's sounds and players, refused with AudioNotAllowed. AccessAudio = "audio" // AccessGamepad is reading connected game controllers and their per-frame input (package gamepad). AccessGamepad = "gamepad" // AccessAuthSession is signing in through the system's authentication session (AuthSession). AccessAuthSession = "authSession" // AccessMiniProgramSignIn permits requesting a mini program host login code. AccessMiniProgramSignIn = "miniProgramSignIn" // AccessHost is the host's handlers, by name (CallHost, PostHost). AccessHost = "host" // AccessLocation is the location fixes Locate and WatchLocation give and PermissionLocation, AccessBackgroundLocation a stream that goes on in the background and PermissionBackgroundLocation, and AccessMotion raw/fitness samples and their PermissionMotion and PermissionActivityRecognition grants. AccessLocation = "location" AccessBackgroundLocation = "backgroundLocation" AccessMotion = "motion" // AccessBackgroundMotion permits explicit finite background motion streams. AccessBackgroundMotion = "backgroundMotion" // AccessFrontmostApp is the application in front on the desktop (Scope.FrontmostApp and Scope.CanReadFrontmostApp), as it says what else the user runs. AccessFrontmostApp = "frontmostApp" // AccessServiceDiscovery is DNS-SD advertising and browsing by service type. AccessServiceDiscovery = "serviceDiscovery" // AccessCursorPoint is the pointer position outside the app's windows (desktop.CursorPoint). AccessCursorPoint = "cursorPoint" )
The capabilities Access is asked for, by NSH's keys.
const ( AccessInput = "input" AccessMedia = "media" AccessCookies = "cookies" )
AccessInput is AccessRequest.Method for a web view's trusted input, AccessMedia for the devices its pages capture, and AccessCookies for writing, listing or clearing the store every web view of the app shares, which no TSX capability grants.
const ( // EdgeEffectAutomatic is soft under the bars. EdgeEffectAutomatic = driver.EdgeEffectAutomatic EdgeEffectSoft = driver.EdgeEffectSoft EdgeEffectHard = driver.EdgeEffectHard // EdgeEffectHidden draws none. EdgeEffectHidden = driver.EdgeEffectHidden )
const ( BorderSolid = driver.BorderSolid BorderDashed = driver.BorderDashed BorderDotted = driver.BorderDotted BorderNone = driver.BorderNone BorderHidden = driver.BorderHidden )
const ( GradientLinear = driver.GradientLinear GradientRadial = driver.GradientRadial GradientConic = driver.GradientConic )
const ( ToTopLeft = driver.ToTopLeft ToTopRight = driver.ToTopRight ToBottomRight = driver.ToBottomRight ToBottomLeft = driver.ToBottomLeft )
const ( ExtentFarthestCorner = driver.ExtentFarthestCorner ExtentClosestSide = driver.ExtentClosestSide ExtentClosestCorner = driver.ExtentClosestCorner ExtentFarthestSide = driver.ExtentFarthestSide )
const ( ColorSpaceOklab = driver.ColorSpaceOklab ColorSpaceSRGB = driver.ColorSpaceSRGB ColorSpaceLinearSRGB = driver.ColorSpaceLinearSRGB ColorSpaceOklch = driver.ColorSpaceOklch )
const ( FilterBlur = driver.FilterBlur FilterBrightness = driver.FilterBrightness FilterContrast = driver.FilterContrast FilterGrayscale = driver.FilterGrayscale FilterHueRotate = driver.FilterHueRotate FilterInvert = driver.FilterInvert FilterOpacity = driver.FilterOpacity FilterSaturate = driver.FilterSaturate FilterSepia = driver.FilterSepia FilterDropShadow = driver.FilterDropShadow )
const ( BlendNormal = driver.BlendNormal BlendMultiply = driver.BlendMultiply BlendScreen = driver.BlendScreen BlendOverlay = driver.BlendOverlay BlendDarken = driver.BlendDarken BlendLighten = driver.BlendLighten BlendColorDodge = driver.BlendColorDodge BlendColorBurn = driver.BlendColorBurn BlendHardLight = driver.BlendHardLight BlendSoftLight = driver.BlendSoftLight BlendDifference = driver.BlendDifference BlendExclusion = driver.BlendExclusion BlendHue = driver.BlendHue BlendSaturation = driver.BlendSaturation BlendColor = driver.BlendColor BlendLuminosity = driver.BlendLuminosity BlendPlusLighter = driver.BlendPlusLighter BlendPlusDarker = driver.BlendPlusDarker )
const ( BackdropUltraThin = driver.BackdropUltraThin BackdropThin = driver.BackdropThin BackdropRegular = driver.BackdropRegular BackdropThick = driver.BackdropThick BackdropChrome = driver.BackdropChrome )
const ( GlassNone = driver.GlassNone GlassRegular = driver.GlassRegular GlassClear = driver.GlassClear )
const ( KeyframesSpin = driver.KeyframesSpin KeyframesPing = driver.KeyframesPing KeyframesPulse = driver.KeyframesPulse KeyframesBounce = driver.KeyframesBounce )
const ( // CodeAccessDenied says the capabilities do not grant what was asked, // Error's Permission and Resource saying which and of what. CodeAccessDenied = "ERR_ACCESS_DENIED" CodeUnavailable = "ERR_FEATURE_UNAVAILABLE_ON_PLATFORM" // CodeQuotaExceeded says a runtime quota ran out: calls waiting at // once, storage. CodeQuotaExceeded = "ERR_NSH_QUOTA_EXCEEDED" // CodeHostError says the embedding app answered with an error. CodeHostError = "ERR_NSH_HOST_ERROR" // CodeTimedOut says an answer did not come in time. CodeTimedOut = "ETIMEDOUT" // CodeNotFound and CodeDenied are what the system answered: never // the capabilities, which are CodeAccessDenied. CodeNotFound = "ENOENT" CodeDenied = "EACCES" )
The stable codes of failures an app can handle, NSH's and Node's: the message is for people and may change.
const ( // ImageSamplingSmooth keeps the platform's smooth scaling filter. ImageSamplingSmooth = driver.ImageSamplingSmooth // ImageSamplingNearest scales raster images without blending neighboring pixels. ImageSamplingNearest = driver.ImageSamplingNearest )
const ( // EditCut cuts the selection. EditCut = driver.EditCut // EditCopy copies the selection. EditCopy = driver.EditCopy // EditPaste pastes from the clipboard through the input's own paste. EditPaste = driver.EditPaste // EditSelectAll selects the whole document or field. EditSelectAll = driver.EditSelectAll )
const ( MediaPlay = driver.MediaPlay MediaPause = driver.MediaPause MediaTogglePlayPause = driver.MediaTogglePlayPause MediaStop = driver.MediaStop MediaNext = driver.MediaNext MediaPrevious = driver.MediaPrevious MediaSeek = driver.MediaSeek MediaSkipForward = driver.MediaSkipForward MediaSkipBackward = driver.MediaSkipBackward )
const ( MouseButtonNone = driver.MouseButtonNone MouseButtonLeft = driver.MouseButtonLeft MouseButtonRight = driver.MouseButtonRight MouseButtonMiddle = driver.MouseButtonMiddle MouseButtonBack = driver.MouseButtonBack MouseButtonForward = driver.MouseButtonForward )
The mouse buttons of a MouseEvent or MouseButtonEvent; none is the zero value.
const ( ProductConsumable = driver.ProductConsumable ProductNonConsumable = driver.ProductNonConsumable ProductAutoRenewable = driver.ProductAutoRenewable ProductNonRenewable = driver.ProductNonRenewable )
The kinds of product.
const ( PeriodDay = driver.PeriodDay PeriodWeek = driver.PeriodWeek PeriodMonth = driver.PeriodMonth PeriodYear = driver.PeriodYear )
The units of a subscription's period.
const ( OfferFreeTrial = driver.OfferFreeTrial OfferPayAsYouGo = driver.OfferPayAsYouGo OfferPayUpFront = driver.OfferPayUpFront )
How an offer is paid.
const ( CodeQR = driver.CodeQR CodeAztec = driver.CodeAztec CodeDataMatrix = driver.CodeDataMatrix CodePDF417 = driver.CodePDF417 // CodeEAN13 is also a UPC-A code, which reads as an EAN-13 with a leading 0. CodeEAN13 = driver.CodeEAN13 CodeEAN8 = driver.CodeEAN8 CodeUPCE = driver.CodeUPCE CodeCode128 = driver.CodeCode128 CodeCode39 = driver.CodeCode39 CodeCode93 = driver.CodeCode93 CodeITF = driver.CodeITF )
The kinds of code ScanCode reads.
const ( SecretAccessibleDefault = driver.SecretAccessibleDefault SecretWhenUnlocked = driver.SecretWhenUnlocked SecretAfterFirstUnlock = driver.SecretAfterFirstUnlock SecretWhenUnlockedThisDeviceOnly = driver.SecretWhenUnlockedThisDeviceOnly SecretAfterFirstUnlockThisDeviceOnly = driver.SecretAfterFirstUnlockThisDeviceOnly SecretWhenPasscodeSetThisDeviceOnly = driver.SecretWhenPasscodeSetThisDeviceOnly )
const ( ActivityStationary = driver.ActivityStationary ActivityWalking = driver.ActivityWalking ActivityRunning = driver.ActivityRunning ActivityCycling = driver.ActivityCycling ActivityAutomotive = driver.ActivityAutomotive ActivityUnknown = driver.ActivityUnknown ActivityConfidenceUnknown = driver.ActivityConfidenceUnknown ActivityConfidenceLow = driver.ActivityConfidenceLow ActivityConfidenceMedium = driver.ActivityConfidenceMedium ActivityConfidenceHigh = driver.ActivityConfidenceHigh GeofenceUnknown = driver.GeofenceUnknown GeofenceInside = driver.GeofenceInside GeofenceOutside = driver.GeofenceOutside )
const ( SensorAccelerometer = driver.SensorAccelerometer SensorGyroscope = driver.SensorGyroscope SensorMagnetometer = driver.SensorMagnetometer SensorDeviceMotion = driver.SensorDeviceMotion )
const ( OSMacOS = driver.OSMacOS OSIOS = driver.OSIOS OSAndroid = driver.OSAndroid OSWindows = driver.OSWindows OSLinux = driver.OSLinux OSWeb = driver.OSWeb )
const ( IdiomPhone = driver.IdiomPhone IdiomTablet = driver.IdiomTablet IdiomDesktop = driver.IdiomDesktop IdiomMac = driver.IdiomMac IdiomTV = driver.IdiomTV IdiomWatch = driver.IdiomWatch )
const ( PointerUnspecified = driver.PointerUnspecified PointerFine = driver.PointerFine PointerCoarse = driver.PointerCoarse PointerNone = driver.PointerNone )
const ( WebInputClick = driver.WebInputClick WebInputText = driver.WebInputText WebInputKey = driver.WebInputKey )
const ( LifecycleActive = driver.LifecycleActive LifecycleInactive = driver.LifecycleInactive LifecycleBackground = driver.LifecycleBackground ThermalUnknown = driver.ThermalUnknown ThermalNominal = driver.ThermalNominal ThermalFair = driver.ThermalFair ThermalSerious = driver.ThermalSerious ThermalCritical = driver.ThermalCritical LowPowerUnknown = driver.LowPowerUnknown LowPowerOff = driver.LowPowerOff LowPowerOn = driver.LowPowerOn )
const ( HingeUnknown = driver.HingeUnknown HingeClosed = driver.HingeClosed HingeHalfOpen = driver.HingeHalfOpen HingeOpen = driver.HingeOpen )
const ( VerticalBarUnspecified = driver.VerticalBarUnspecified VerticalBarLeading = driver.VerticalBarLeading VerticalBarTrailing = driver.VerticalBarTrailing )
const ( WindowLevelNormal = driver.WindowLevelNormal WindowLevelFloating = driver.WindowLevelFloating WindowLevelDesktop = driver.WindowLevelDesktop )
const ( WindowWorkspacesCurrent = driver.WindowWorkspacesCurrent WindowWorkspacesAll = driver.WindowWorkspacesAll )
const ( WindowPointerAuto = driver.WindowPointerAuto WindowPointerNone = driver.WindowPointerNone WindowPointerPainted = driver.WindowPointerPainted )
const ( MenuBarShown = driver.MenuBarShown MenuBarAutoHide = driver.MenuBarAutoHide )
const ( AppearanceSystem = driver.AppearanceSystem AppearanceLight = driver.AppearanceLight AppearanceDark = driver.AppearanceDark )
const ( PickCompatible = driver.PickCompatible PickCurrent = driver.PickCurrent )
const ( SubmitBehaviorDefault = driver.SubmitBehaviorDefault SubmitBehaviorSubmit = driver.SubmitBehaviorSubmit SubmitBehaviorBlurAndSubmit = driver.SubmitBehaviorBlurAndSubmit SubmitBehaviorNewline = driver.SubmitBehaviorNewline )
const ( ReturnKeyDefault = driver.ReturnKeyDefault ReturnKeyDone = driver.ReturnKeyDone ReturnKeyGo = driver.ReturnKeyGo ReturnKeyNext = driver.ReturnKeyNext ReturnKeySearch = driver.ReturnKeySearch ReturnKeySend = driver.ReturnKeySend )
const ( AutoCapitalizeSentences = driver.AutoCapitalizeSentences AutoCapitalizeNone = driver.AutoCapitalizeNone AutoCapitalizeWords = driver.AutoCapitalizeWords AutoCapitalizeCharacters = driver.AutoCapitalizeCharacters )
const ( AutoCompleteDefault = driver.AutoCompleteDefault AutoCompleteOff = driver.AutoCompleteOff AutoCompleteUsername = driver.AutoCompleteUsername AutoCompletePassword = driver.AutoCompletePassword AutoCompleteNewPassword = driver.AutoCompleteNewPassword AutoCompleteOneTimeCode = driver.AutoCompleteOneTimeCode AutoCompleteEmail = driver.AutoCompleteEmail AutoCompleteTel = driver.AutoCompleteTel AutoCompleteName = driver.AutoCompleteName AutoCompleteGivenName = driver.AutoCompleteGivenName AutoCompleteFamilyName = driver.AutoCompleteFamilyName AutoCompleteMiddleName = driver.AutoCompleteMiddleName AutoCompleteNickname = driver.AutoCompleteNickname AutoCompleteOrganization = driver.AutoCompleteOrganization AutoCompleteStreetAddress = driver.AutoCompleteStreetAddress AutoCompleteAddressLine1 = driver.AutoCompleteAddressLine1 AutoCompleteAddressLine2 = driver.AutoCompleteAddressLine2 AutoCompleteCity = driver.AutoCompleteCity AutoCompleteRegion = driver.AutoCompleteRegion AutoCompletePostalCode = driver.AutoCompletePostalCode AutoCompleteCountry = driver.AutoCompleteCountry AutoCompleteCreditCardNumber = driver.AutoCompleteCreditCardNumber AutoCompleteCreditCardExpiration = driver.AutoCompleteCreditCardExpiration AutoCompleteCreditCardSecurityCode = driver.AutoCompleteCreditCardSecurityCode AutoCompleteCreditCardName = driver.AutoCompleteCreditCardName AutoCompleteURL = driver.AutoCompleteURL AutoCompleteBirthdate = driver.AutoCompleteBirthdate )
const ( DrawSave = driver.DrawSave DrawRestore = driver.DrawRestore DrawTranslate = driver.DrawTranslate DrawScale = driver.DrawScale DrawRotate = driver.DrawRotate DrawBeginPath = driver.DrawBeginPath DrawMoveTo = driver.DrawMoveTo DrawLineTo = driver.DrawLineTo DrawQuadTo = driver.DrawQuadTo DrawCubicTo = driver.DrawCubicTo DrawArc = driver.DrawArc DrawRect = driver.DrawRect DrawRoundRect = driver.DrawRoundRect DrawEllipse = driver.DrawEllipse DrawClosePath = driver.DrawClosePath DrawFill = driver.DrawFill DrawStroke = driver.DrawStroke DrawClip = driver.DrawClip DrawFillColor = driver.DrawFillColor DrawStrokeColor = driver.DrawStrokeColor DrawLineWidth = driver.DrawLineWidth DrawLineCap = driver.DrawLineCap DrawLineJoin = driver.DrawLineJoin DrawAlpha = driver.DrawAlpha DrawFillText = driver.DrawFillText DrawClear = driver.DrawClear DrawFillGradient = driver.DrawFillGradient DrawStrokeGradient = driver.DrawStrokeGradient DrawTransform = driver.DrawTransform DrawSetTransform = driver.DrawSetTransform DrawComposite = driver.DrawComposite DrawLineDash = driver.DrawLineDash DrawLineDashOffset = driver.DrawLineDashOffset DrawMiterLimit = driver.DrawMiterLimit DrawShadow = driver.DrawShadow DrawStrokeText = driver.DrawStrokeText DrawImage = driver.DrawImage DrawTextAlign = driver.DrawTextAlign DrawTextBaseline = driver.DrawTextBaseline DrawVertices = driver.DrawVertices DrawAtlas = driver.DrawAtlas )
const ( ArgX = driver.ArgX ArgY = driver.ArgY ArgX1 = driver.ArgX1 ArgY1 = driver.ArgY1 ArgX2 = driver.ArgX2 ArgY2 = driver.ArgY2 ArgW = driver.ArgW ArgH = driver.ArgH ArgR = driver.ArgR ArgA = driver.ArgA ArgA0 = driver.ArgA0 ArgA1 = driver.ArgA1 ArgRY = driver.ArgRY ArgColor = driver.ArgColor )
const ( CompositeSourceOver = driver.CompositeSourceOver CompositeSourceIn = driver.CompositeSourceIn CompositeSourceOut = driver.CompositeSourceOut CompositeSourceAtop = driver.CompositeSourceAtop CompositeDestinationOver = driver.CompositeDestinationOver CompositeDestinationIn = driver.CompositeDestinationIn CompositeDestinationOut = driver.CompositeDestinationOut CompositeDestinationAtop = driver.CompositeDestinationAtop CompositeLighter = driver.CompositeLighter CompositeCopy = driver.CompositeCopy CompositeXor = driver.CompositeXor CompositeMultiply = driver.CompositeMultiply CompositeScreen = driver.CompositeScreen CompositeOverlay = driver.CompositeOverlay CompositeDarken = driver.CompositeDarken CompositeLighten = driver.CompositeLighten CompositeColorDodge = driver.CompositeColorDodge CompositeColorBurn = driver.CompositeColorBurn CompositeHardLight = driver.CompositeHardLight CompositeSoftLight = driver.CompositeSoftLight CompositeDifference = driver.CompositeDifference CompositeExclusion = driver.CompositeExclusion CompositeHue = driver.CompositeHue CompositeSaturation = driver.CompositeSaturation CompositeColor = driver.CompositeColor CompositeLuminosity = driver.CompositeLuminosity )
const ( BaselineAlphabetic = driver.BaselineAlphabetic BaselineTop = driver.BaselineTop BaselineHanging = driver.BaselineHanging BaselineMiddle = driver.BaselineMiddle BaselineIdeographic = driver.BaselineIdeographic BaselineBottom = driver.BaselineBottom )
const ( NonZero = driver.NonZero EvenOdd = driver.EvenOdd )
const ( JumpEnd = driver.JumpEnd JumpStart = driver.JumpStart JumpNone = driver.JumpNone JumpBoth = driver.JumpBoth )
const ( CapButt = driver.CapButt CapRound = driver.CapRound CapSquare = driver.CapSquare )
const ( JoinMiter = driver.JoinMiter JoinRound = driver.JoinRound JoinBevel = driver.JoinBevel )
const ( AlertDefault = driver.AlertDefault AlertCancel = driver.AlertCancel AlertDestructive = driver.AlertDestructive )
const ( KeyboardDefault = driver.KeyboardDefault KeyboardEmail = driver.KeyboardEmail KeyboardNumber = driver.KeyboardNumber KeyboardDecimal = driver.KeyboardDecimal KeyboardPhone = driver.KeyboardPhone KeyboardURL = driver.KeyboardURL )
const ( RoleNone = driver.RoleNone RoleButton = driver.RoleButton RoleLink = driver.RoleLink RoleHeader = driver.RoleHeader RoleImage = driver.RoleImage RoleCheckbox = driver.RoleCheckbox RoleSwitch = driver.RoleSwitch RoleRadio = driver.RoleRadio RoleTab = driver.RoleTab RoleText = driver.RoleText RoleTextField = driver.RoleTextField RoleRadioGroup = driver.RoleRadioGroup RoleTabList = driver.RoleTabList RoleMenu = driver.RoleMenu RoleMenuItem = driver.RoleMenuItem // RoleMenuItemCheckbox and RoleMenuItemRadio are menu items with a // checked state. RoleMenuItemCheckbox = driver.RoleMenuItemCheckbox RoleMenuItemRadio = driver.RoleMenuItemRadio // RoleListbox holds RoleOptions the user picks from. RoleListbox = driver.RoleListbox RoleOption = driver.RoleOption // RoleGroup, RoleRegion and RoleNavigation are parts of a page. RoleGroup = driver.RoleGroup RoleRegion = driver.RoleRegion // RoleTree holds RoleTreeItems. RoleTree = driver.RoleTree RoleTreeItem = driver.RoleTreeItem RoleToolbar = driver.RoleToolbar RoleDialog = driver.RoleDialog // RoleAlertDialog is a dialog asking for an answer, a confirmation. RoleAlertDialog = driver.RoleAlertDialog RoleAlert = driver.RoleAlert // RoleStatus is advisory information that changes, such as a save or upload status, and a polite live region by default. RoleStatus = driver.RoleStatus // RoleSearchField is an Input used to search or filter content. RoleSearchField = driver.RoleSearchField RoleAdjustable = driver.RoleAdjustable // RoleSpinButton is a field for a number, stepped with its actions. RoleSpinButton = driver.RoleSpinButton // RoleCombobox picks a value from a list it opens. RoleCombobox = driver.RoleCombobox RoleProgressBar = driver.RoleProgressBar // RoleTable and RoleGrid are a table and an interactive one, around // RoleRowGroup, RoleRow, RoleColumnHeader and RoleCell. RoleTable = driver.RoleTable RoleGrid = driver.RoleGrid RoleRowGroup = driver.RoleRowGroup RoleRow = driver.RoleRow RoleColumnHeader = driver.RoleColumnHeader RoleCell = driver.RoleCell )
const ( PasteInsert = driver.PasteInsert PasteReport = driver.PasteReport )
const ( DecelerationFast = driver.DecelerationFast ActionActivate = driver.ActionActivate ActionIncrement = driver.ActionIncrement ActionDecrement = driver.ActionDecrement ActionEscape = driver.ActionEscape ActionMagicTap = driver.ActionMagicTap FontMonospace = driver.FontMonospace )
const ( SnapStart = driver.SnapStart SnapCenter = driver.SnapCenter SnapEnd = driver.SnapEnd )
const ( KeyboardTapsNever = driver.KeyboardTapsNever KeyboardTapsAlways = driver.KeyboardTapsAlways KeyboardTapsHandled = driver.KeyboardTapsHandled )
const ( LiveRegionNone = driver.LiveRegionNone LiveRegionPolite = driver.LiveRegionPolite LiveRegionAssertive = driver.LiveRegionAssertive )
const ( PointerEventsAuto = driver.PointerEventsAuto PointerEventsNone = driver.PointerEventsNone PointerEventsBoxNone = driver.PointerEventsBoxNone PointerEventsBoxOnly = driver.PointerEventsBoxOnly PointerEventsOn = driver.PointerEventsOn )
const ( ExtrapolateClamp = driver.ExtrapolateClamp ExtrapolateExtend = driver.ExtrapolateExtend ExtrapolateIdentity = driver.ExtrapolateIdentity )
const ( EasingBezier = driver.EasingBezier EasingQuad = driver.EasingQuad EasingCubic = driver.EasingCubic EasingPoly = driver.EasingPoly EasingSin = driver.EasingSin EasingCircle = driver.EasingCircle EasingExp = driver.EasingExp EasingElastic = driver.EasingElastic EasingBack = driver.EasingBack EasingBounce = driver.EasingBounce EasingSteps = driver.EasingSteps )
const ( EaseModeIn = driver.EaseModeIn EaseModeOut = driver.EaseModeOut EaseModeInOut = driver.EaseModeInOut )
const ( AnimationTiming = driver.AnimationTiming AnimationSpring = driver.AnimationSpring AnimationDecay = driver.AnimationDecay AnimationSequence = driver.AnimationSequence AnimationParallel = driver.AnimationParallel AnimationStagger = driver.AnimationStagger AnimationDelay = driver.AnimationDelay AnimationLoop = driver.AnimationLoop )
const ( CursorAuto = driver.CursorAuto CursorDefault = driver.CursorDefault CursorPointer = driver.CursorPointer CursorText = driver.CursorText CursorWait = driver.CursorWait CursorProgress = driver.CursorProgress CursorHelp = driver.CursorHelp CursorCrosshair = driver.CursorCrosshair CursorMove = driver.CursorMove CursorGrab = driver.CursorGrab CursorGrabbing = driver.CursorGrabbing CursorNotAllowed = driver.CursorNotAllowed CursorZoomIn = driver.CursorZoomIn CursorZoomOut = driver.CursorZoomOut CursorColResize = driver.CursorColResize CursorRowResize = driver.CursorRowResize CursorNwseResize = driver.CursorNwseResize CursorNeswResize = driver.CursorNeswResize CursorNone = driver.CursorNone )
const ( TitleBarDefault = driver.TitleBarDefault TitleBarHidden = driver.TitleBarHidden )
const ( // WindowControlsDefault draws NSGo's compact rounded caption buttons on Windows. WindowControlsDefault = driver.WindowControlsDefault // WindowControlsSystem draws Windows 11's full-height caption buttons, flush with the window's edge. WindowControlsSystem = driver.WindowControlsSystem )
const ( WindowDragInherit = driver.WindowDragInherit WindowDragOn = driver.WindowDragOn WindowDragOff = driver.WindowDragOff )
const ( WindowMaterialNone = driver.WindowMaterialNone WindowMaterialWindow = driver.WindowMaterialWindow WindowMaterialContent = driver.WindowMaterialContent WindowMaterialSidebar = driver.WindowMaterialSidebar WindowMaterialHeader = driver.WindowMaterialHeader WindowMaterialTitlebar = driver.WindowMaterialTitlebar WindowMaterialUnderWindow = driver.WindowMaterialUnderWindow WindowMaterialUnderPage = driver.WindowMaterialUnderPage WindowMaterialMenu = driver.WindowMaterialMenu WindowMaterialPopover = driver.WindowMaterialPopover WindowMaterialHUD = driver.WindowMaterialHUD WindowMaterialSheet = driver.WindowMaterialSheet WindowMaterialTooltip = driver.WindowMaterialTooltip WindowMaterialSelection = driver.WindowMaterialSelection WindowMaterialFullScreenUI = driver.WindowMaterialFullScreenUI WindowMaterialMica = driver.WindowMaterialMica WindowMaterialAcrylic = driver.WindowMaterialAcrylic WindowMaterialTabbed = driver.WindowMaterialTabbed )
const ( MenuRoleNone = driver.MenuRoleNone MenuAbout = driver.MenuAbout MenuHide = driver.MenuHide MenuHideOthers = driver.MenuHideOthers MenuShowAll = driver.MenuShowAll MenuQuit = driver.MenuQuit MenuUndo = driver.MenuUndo MenuRedo = driver.MenuRedo MenuCut = driver.MenuCut MenuCopy = driver.MenuCopy MenuPaste = driver.MenuPaste MenuSelectAll = driver.MenuSelectAll MenuMinimize = driver.MenuMinimize MenuZoom = driver.MenuZoom MenuToggleFullScreen = driver.MenuToggleFullScreen MenuClose = driver.MenuClose MenuPasteAndMatchStyle = driver.MenuPasteAndMatchStyle MenuDelete = driver.MenuDelete MenuStartSpeaking = driver.MenuStartSpeaking MenuStopSpeaking = driver.MenuStopSpeaking MenuBringAllToFront = driver.MenuBringAllToFront MenuServices = driver.MenuServices MenuWindowMenu = driver.MenuWindowMenu MenuHelpMenu = driver.MenuHelpMenu )
const ( SelectableAuto = driver.SelectableAuto SelectableOn = driver.SelectableOn SelectableOff = driver.SelectableOff )
const ( AudioSessionDefault = driver.AudioSessionDefault AudioSessionPlayback = driver.AudioSessionPlayback AudioSessionMixWithOthers = driver.AudioSessionMixWithOthers )
const ( Cover = driver.Cover Contain = driver.Contain Stretch = driver.Stretch Center = driver.Center ScaleDown = driver.ScaleDown )
const ( ModalFullScreen = driver.ModalFullScreen ModalPageSheet = driver.ModalPageSheet ModalFormSheet = driver.ModalFormSheet )
const ( OrientationPortrait = driver.OrientationPortrait OrientationPortraitUpsideDown = driver.OrientationPortraitUpsideDown OrientationLandscapeLeft = driver.OrientationLandscapeLeft OrientationLandscapeRight = driver.OrientationLandscapeRight OrientationLandscape = driver.OrientationLandscape )
const ( ScreenDefault = driver.ScreenDefault ScreenSlide = driver.ScreenSlide ScreenFade = driver.ScreenFade ScreenNone = driver.ScreenNone ModalSlide = driver.ModalSlide ModalFade = driver.ModalFade ModalNone = driver.ModalNone )
const ( TransitionOpacity = driver.TransitionOpacity TransitionBackground = driver.TransitionBackground TransitionTransform = driver.TransitionTransform TransitionBorder = driver.TransitionBorder TransitionShadow = driver.TransitionShadow TransitionLayout = driver.TransitionLayout )
const ( GestureBegan = driver.GestureBegan GestureChanged = driver.GestureChanged GestureEnded = driver.GestureEnded GestureCancelled = driver.GestureCancelled )
const ( DefaultPanSlop = driver.DefaultPanSlop DefaultFontSize = driver.DefaultFontSize )
const ( StatusBarInherit = driver.StatusBarInherit StatusBarAuto = driver.StatusBarAuto StatusBarDark = driver.StatusBarDark StatusBarLight = driver.StatusBarLight )
const ( FontWeightLight = driver.FontWeightLight FontWeightNormal = driver.FontWeightNormal FontWeightMedium = driver.FontWeightMedium FontWeightSemibold = driver.FontWeightSemibold FontWeightBold = driver.FontWeightBold )
const ( TextAlignStart = driver.TextAlignStart TextAlignCenter = driver.TextAlignCenter TextAlignEnd = driver.TextAlignEnd TextAlignLeft = driver.TextAlignLeft TextAlignRight = driver.TextAlignRight TextAlignJustify = driver.TextAlignJustify )
const ( VerticalAlignBaseline = driver.VerticalAlignBaseline VerticalAlignTextTop = driver.VerticalAlignTextTop VerticalAlignTextBottom = driver.VerticalAlignTextBottom VerticalAlignMiddle = driver.VerticalAlignMiddle )
const ( TextDecorationNone = driver.TextDecorationNone TextDecorationUnderline = driver.TextDecorationUnderline TextDecorationLineThrough = driver.TextDecorationLineThrough )
const ( HeaderItemAdd = driver.HeaderItemAdd HeaderItemDone = driver.HeaderItemDone HeaderItemClose = driver.HeaderItemClose HeaderItemEdit = driver.HeaderItemEdit HeaderItemCompose = driver.HeaderItemCompose HeaderItemSearch = driver.HeaderItemSearch HeaderItemTrash = driver.HeaderItemTrash HeaderItemSave = driver.HeaderItemSave HeaderItemCancel = driver.HeaderItemCancel )
const ( FontVariantNormal = driver.FontVariantNormal FontSmallCaps = driver.FontSmallCaps FontOldstyleNums = driver.FontOldstyleNums FontLiningNums = driver.FontLiningNums FontTabularNums = driver.FontTabularNums FontProportionalNums = driver.FontProportionalNums )
const ( DecorationSolid = driver.DecorationSolid DecorationDouble = driver.DecorationDouble DecorationDotted = driver.DecorationDotted DecorationDashed = driver.DecorationDashed DecorationWavy = driver.DecorationWavy )
const ( EllipsizeTail = driver.EllipsizeTail EllipsizeHead = driver.EllipsizeHead EllipsizeMiddle = driver.EllipsizeMiddle EllipsizeClip = driver.EllipsizeClip )
const ( AccessibleAuto = driver.AccessibleAuto AccessibleYes = driver.AccessibleYes AccessibleNo = driver.AccessibleNo )
const ( SpreadPad = driver.SpreadPad SpreadReflect = driver.SpreadReflect SpreadRepeat = driver.SpreadRepeat )
const ( LayoutLinear = driver.LayoutLinear LayoutEaseIn = driver.LayoutEaseIn LayoutEaseOut = driver.LayoutEaseOut LayoutEaseInEaseOut = driver.LayoutEaseInEaseOut LayoutSpring = driver.LayoutSpring LayoutKeyboard = driver.LayoutKeyboard )
const ( LayoutOpacity = driver.LayoutOpacity LayoutScale = driver.LayoutScale )
const ( Downstream = driver.Downstream Upstream = driver.Upstream )
const ( SideTop Sides = 1 << iota SideRight SideBottom SideLeft // SidesHorizontal and SidesVertical are left and right, top and bottom. SidesHorizontal = SideLeft | SideRight SidesVertical = SideTop | SideBottom SidesAll = SidesHorizontal | SidesVertical )
const ( GestureEdgeTop = driver.GestureEdgeTop GestureEdgeLeft = driver.GestureEdgeLeft GestureEdgeBottom = driver.GestureEdgeBottom GestureEdgeRight = driver.GestureEdgeRight )
The physical edges for mobile.DeferSystemGestures.
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 = driver.WebSameSiteDefault WebSameSiteLax = driver.WebSameSiteLax WebSameSiteStrict = driver.WebSameSiteStrict // WebSameSiteNone sends the cookie with requests from other sites too, which needs Secure. WebSameSiteNone = driver.WebSameSiteNone )
The SameSite attributes of a WebCookie.
const ( WebMicrophone = driver.WebMicrophone WebCamera = driver.WebCamera )
const ( WebDownloadStarted = driver.WebDownloadStarted WebDownloadFinished = driver.WebDownloadFinished WebDownloadFailed = driver.WebDownloadFailed )
How far a WebDownload got.
const ( // HotKeyPending is the core's part of desktop.HotKeyPending. HotKeyPending = driver.HotKeyPending // HotKeyRegistered is the core's part of desktop.HotKeyRegistered. HotKeyRegistered = driver.HotKeyRegistered // HotKeyTaken is the core's part of desktop.HotKeyTaken. HotKeyTaken = driver.HotKeyTaken // HotKeyUnsupported is the core's part of desktop.HotKeyUnsupported. HotKeyUnsupported = driver.HotKeyUnsupported )
const CurrentColor = driver.CurrentColor
CurrentColor, in a style's colors other than Color, is the text color the view has: its own, else the one it inherits, else its subtree's Palette.Text, as CSS's currentColor. It is the one color value set aside: it never draws as itself.
const DefaultImageCacheLimit int64 = driver.DefaultImageCacheLimit
DefaultImageCacheLimit is the default retained image byte budget (32 MiB).
const Forever = -1
Forever is the Iterations of keyframes that repeat until stopped.
const HostCallTimeout = 30 * time.Second
HostCallTimeout is how long CallHost waits for the host's answer.
const HostInbox = 256
HostInbox is how many events a Host or an app keeps for later: those sent while no app runs, and those of names no listener hears yet. Past it the oldest are dropped.
const MaxClipboardImage = driver.MaxClipboardImage
MaxClipboardImage is the most bytes of a PNG ReadClipboardImage gives.
const MaxPicked = driver.MaxPicked
MaxPicked is the most images, files or folders one PickImages, PickFiles or PickDirectories answers with.
const MaxURLLength = driver.MaxURLLength
MaxURLLength is the longest URL OpenURL opens, in bytes: a mailto: link with a body fits.
const NoLineLimit = -1
NoLineLimit, as a style's NumberOfLines, lifts a limit a text has.
const QuitTimeout = 200 * time.Millisecond
QuitTimeout is how long the engine waits for the work of the OnQuit handlers as the app quits, at most, as GPUI's shutdown timeout. The platform's main thread waits for the engine meanwhile, so it stays short.
const StorageQuota = 5 << 20
StorageQuota is the most an app may keep, in UTF-8 bytes of its keys and values.
Variables ¶
var ( // LayoutEaseInEaseOutPreset eases every change in and out over 300 ms. LayoutEaseInEaseOutPreset = allLayout(driver.LayoutTransition{Curve: driver.LayoutEaseInEaseOut, Duration: 300 * time.Millisecond}) // LayoutLinearPreset moves every change at constant speed over 500 ms. LayoutLinearPreset = allLayout(driver.LayoutTransition{Curve: driver.LayoutLinear, Duration: 500 * time.Millisecond}) // LayoutSpringPreset springs frames (response 250 ms, damping ratio 0.4) until they settle and fades views linearly. LayoutSpringPreset = LayoutAnimation{ Create: &driver.LayoutTransition{Curve: driver.LayoutLinear, Duration: 700 * time.Millisecond}, Update: &driver.LayoutTransition{Curve: driver.LayoutSpring, Response: 250 * time.Millisecond, DampingRatio: 0.4}, Delete: &driver.LayoutTransition{Curve: driver.LayoutLinear, Duration: 700 * time.Millisecond}, } )
React Native's presets.
var ( ErrCloudUnavailable = errors.New("cloud: storage unavailable") // ErrCloudNotFound reports that a requested key or file does not exist in cloud storage. ErrCloudNotFound = errors.New("cloud: not found") // ErrCloudConflict reports that a cloud file or key has conflicting local and remote versions that must be resolved. ErrCloudConflict = errors.New("cloud: conflict") )
Sentinel errors shared between package cloud and nsgotest's in-memory cloud store.
var ( MinContent = driver.MinContent MaxContent = driver.MaxContent FitContent = driver.FitContent )
The intrinsic sizes, for Width, Height and their limits: the narrowest a box gets without overflowing (its longest word), the widest its content asks for (no wrapping), and that up to the space it has.
var ( PositionStart = PositionAxis{Offset: Pct(0)} PositionCenter = PositionAxis{Offset: Pct(50)} PositionEnd = PositionAxis{Offset: Pct(100)} )
Positions along an axis.
var ( Linear = driver.Linear Ease = driver.Ease EaseIn = driver.EaseIn EaseOut = driver.EaseOut EaseInOut = driver.EaseInOut Auto = driver.Auto // PaintNone paints nothing; PaintCurrentColor paints with the text // color. PaintNone = driver.PaintNone PaintCurrentColor = driver.PaintCurrentColor )
var AutoMinimum = driver.AutoMinimum
AutoMinimum is CSS's automatic minimum, for MinWidth and MinHeight: a flex item keeps its content's size, where an unset minimum is 0.
var ErrAssetNotFound = errors.New("core: bundled asset not found")
ErrAssetNotFound means the app does not ship a file at the requested asset URL.
ErrAssetsUnavailable means the app's host cannot read bundled asset files.
var ErrAudioOutputUnsupported = driver.ErrAudioOutputUnsupported
ErrAudioOutputUnsupported is audio.ErrUnsupported, returned where the platform has no pull PCM output.
ErrDiscoveryUnavailable means the target does not provide DNS-SD.
ErrDiskSpaceUnavailable is returned where the platform has no disk space service.
ErrDownloadUnavailable is returned where the platform has no transfer host.
var ErrHostTimeout = errors.New("core: the host did not answer in time")
ErrHostTimeout is the error a call the host did not answer in time fails with.
var ErrNoCamera = errors.New("core: no camera to take a photo with")
ErrNoCamera is TakePhoto's failure where Env.CanTakePhoto is false.
var ErrNoHostHandler = errors.New("core: the host has no handler")
ErrNoHostHandler is the error a call to a name the host handles no longer, or never did, fails with.
var ErrNoScanner = errors.New("core: no camera to scan a code with")
ErrNoScanner is ScanCode's failure where Env.CanScanCode is false.
var ErrNoTrash = errors.New("core: the volume has no trash")
ErrNoTrash is what TrashFile answers when the item's volume has no Trash or Recycle Bin, or its Recycle Bin would not keep the item, such as a file larger than the bin on Windows, which leaves the item where it was.
var ErrNotDeclared = driver.ErrDiskSpaceNotDeclared
ErrNotDeclared is returned by DiskSpace on Apple targets unless the app declares NSPrivacyAccessedAPICategoryDiskSpace in its privacy settings.
var ErrNotification = errors.New("nsgo: a notification needs an ID and a title, and a repeated one a time")
ErrNotification is ShowNotification's error for a notification without an ID or a title, or with a Repeat it does not know or no At to repeat.
ErrSecretsUnavailable is what Secrets fails with where the platform has no secure store, such as the web, or a Linux session without a Secret Service: NSGo never keeps a secret in plain storage instead.
ErrUserDirUnavailable means the platform has no such folder of the user's that an app reaches by path.
Functions ¶
func ActivateFocused ¶
ActivateFocused activates the currently focused view in cx's tree as Return or Space does (press down, up and press on a pressable view; submit on a text input). It is the core's part of package gamepad's focus navigation (gamepad.EnableFocusNavigation) and reports whether a focused view was activated.
func AppRoot ¶
AppRoot is the root view nsgo.Run mounts for app, which opens its views itself: app runs once, and the root shows what SetMainView sets, unless the platform opens windows, where it stays empty.
func AssetPackReady ¶
AssetPackReady is mobile's query for whether a store pack is available locally.
func CallAutomationTool ¶
func CallAutomationTool(*Scope, context.Context, string, json.RawMessage) (json.RawMessage, error)
CallAutomationTool is automation's call, unavailable in this build.
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 DownloadUpdate ¶
func DownloadUpdate(ctx context.Context, update UpdateCheck, dir string, progress func(UpdateDownloadProgress)) (string, error)
DownloadUpdate stages an update through the platform's HTTP client.
func EditsText ¶
EditsText reports whether a text input with the keyboard focus uses the normalized key itself: keys that type, move the caret or delete, and select all, cut, copy, paste, undo and redo. A binding of it fires in text inputs only with KeyAlways.
func FormatSelection ¶
func FormatSelection(blocks []SelectionBlock) (markdown, html string)
FormatSelection serializes selection blocks as Markdown and HTML: the core's part of base/textview's Document.Markdown and Document.HTML.
func From ¶
func From[T comparable](cx *Scope, initial T, subscribe func(set func(T)) (stop func())) func() T
From returns an accessor of the latest value a source outside the graph delivers, as Solid's from does: a subscription to a store, a socket or a file watcher. subscribe runs once, untracked, with set, which any goroutine may call; it returns stop, which runs when the current owner is disposed. A value set while subscribe runs, as a source handing its current value does, is the accessor's at once; values that arrive before the graph takes them coalesce, the latest winning, and a value equal to the one held changes nothing.
Its values reach the graph through Post, so the graph needs a host: an engine or a test driver.
func FromFunc ¶
func FromFunc[T any](cx *Scope, initial T, equal func(a, b T) bool, subscribe func(set func(T)) (stop func())) func() T
FromFunc returns an accessor as From does that compares values with equal; with a nil equal every value notifies, as slices and maps need.
func InsetsFunc ¶
InsetsFunc returns what reads Insets of cx's place, found now and tracked as it is called, wherever that is.
func InstallUpdate ¶
InstallUpdate is the core's part of updater.Install. It hands a verified package to the platform's installer and reports completion or handoff.
func InstallUpdateInBackground ¶
func InstallUpdateInBackground(cx *Scope, update UpdateCheck, dir string, done func(app *Scope, path string, err error))
InstallUpdateInBackground is the core's part of the Update action of package updater's alert on Linux and Android: off the graph's goroutine it streams and verifies update's package into dir (DownloadUpdate), within updateDownloadTimeout, reporting download progress to UpdaterStatus and SetTaskProgress, then hands it to the platform's installer (InstallUpdate). The work belongs to the app's root scope rather than cx, so it finishes though the scope that offered the update is disposed meanwhile; done runs on the graph's goroutine under the root scope, which it is given, with the package's path and what failed, nil once Linux's installer finished or Android's installer started.
func KeyCodeHeld ¶
KeyCodeHeld reports whether a physical position is held on cx's window.
func KeyCodeLabel ¶
KeyCodeLabel returns the display label for a physical position. It uses the active layout where the platform provides it and the last recorded key on this surface otherwise. An unknown label is empty.
func KeyCodesDown ¶
KeyCodesDown returns the physical positions held on cx's window, sorted. It tracks changes as KeysDown does and omits keys with unknown positions.
func KeyHeld ¶
KeyHeld reports whether key is held on cx's window, a tracked read of KeysDown's keys: key is one name, as OnKey writes it ("left", "space", "shift"), "mod" being "meta" where the platform modifier is Command (Env.AppleKeys) and "ctrl" elsewhere, or several joined by "+" ("shift+a"), held together.
func KeyLabel ¶
KeyLabel is key as menus and hints show it: ⌃⌥⇧⌘K where "mod" is Command (apple), else Ctrl+Alt+Shift+K, with "meta" as Win on Windows, Meta on the web and Super elsewhere.
func KeysDown ¶
KeysDown returns the names of the keys held on cx's window, sorted, as KeyEvent.Key names them: "shift" for either Shift, "left", "space", "a". It is a tracked read, so what reads it renders again as a key goes down or comes up but not as a held key repeats, and a RequestAnimationFrame callback, which runs untracked, reads the same keys, as a game's frame loop polls them. A key held as the window loses the keyboard focus comes up then.
The first read on a window asks its platform for every key, not only those a focused view that hears keys (View.OnKeyDown) has, and that stays on for the life of the window; a key already held then is unknown until it is pressed again. Keys typed while a text input or a web view has the focus, or while an input method composes, are never held. macOS, Windows, Linux, the web, iOS and Android with a hardware keyboard report them; HarmonyOS, watchOS and mini programs do not, so none is ever held there.
func MouseButtonHeld ¶
func MouseButtonHeld(cx *Scope, button MouseButton) bool
MouseButtonHeld reports whether button is held on cx's window, a tracked read of MouseButtonsDown's buttons. MouseButtonNone is never held.
func MoveFocus ¶
func MoveFocus(cx *Scope, dir FocusDirection, wrap bool) bool
MoveFocus moves keyboard focus across the active focus stops in cx's tree — the same enabled, visible text inputs, pressable views and Focusable views Tab reaches, scoped to the topmost modal when one shows — in dir.
Directional moves (Up, Down, Left, Right) pick the nearest stop in that direction by layout geometry; when no stop has been laid out yet they fall back to Tab order. When wrap is true and no stop lies further in dir, focus wraps in Tab order.
MoveFocus is the core's part of package gamepad's focus navigation (gamepad.EnableFocusNavigation). It reports whether focus moved.
func NewSelector ¶
func NewSelector[K comparable](cx *Scope, source func() K) (is func(key K) bool)
NewSelector returns is, which reports whether source gives key, as Solid's createSelector does. A computation that calls is subscribes to its key alone, so when source moves from a to b only the readers of a and b run again, however many rows ask: a list's selected row. source is tracked; its value is compared with ==.
func OpenAssetPackFile ¶
func OpenAssetPackFile(name, path string) (io.ReadCloser, error)
OpenAssetPackFile is mobile's read-only access to a file in an available store pack.
func ParseEnvLength ¶
ParseEnvLength reads a length of CSS's environment variables: env(safe-area-inset-*) or env(keyboard-inset-height), alone or in a calc() that adds lengths to it, as an inset and the points added. A variable's fallback is ignored, as every platform has its value.
func ProjectDecay ¶
func ProjectDecay(from float64, c DecayConfig) float64
ProjectDecay returns where Decay with c brings a value from from to rest: where a fling released at c.Velocity lands, to snap from before it starts. A clamped one stops at the bound it passes, whatever its bounce.
func ProvideInsets ¶ added in v0.2.0
ProvideInsets makes insets, read tracked, what content built under cx keeps clear of (Insets, EnvSafeArea), screens below it included: a component that keeps its own part of the safe area clear, such as ui.TabShell's drawn tab bar, takes that part away from its content.
func RegisterAutomationTool ¶
func RegisterAutomationTool(*Scope, AutomationTool) error
RegisterAutomationTool is automation's registration, inactive in this build.
func Restarting ¶
func Restarting() bool
Restarting reports whether the app asked to restart before it quit, for nsgo.Run.
func RubberBandClamp ¶
RubberBandClamp 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. Resist is the node that does it on the frame clock.
func SampleDecay ¶
func SampleDecay(from float64, c DecayConfig) []float64
SampleDecay returns where Decay takes a value from from, as SampleSpring does.
func SampleEasing ¶
SampleEasing returns e at n evenly spaced fractions from 0 to 1, both included, as the platform evaluates it: for drawing the curve.
func SampleSpring ¶
func SampleSpring(from, to float64, c SpringConfig) []float64
SampleSpring returns where Spring takes a value from from to to, 60 times a second until it rests, from the platforms' own code.
func SetBundledThirdPartyNotices ¶
func SetBundledThirdPartyNotices(text string)
SetBundledThirdPartyNotices records the notices during initialization. Only the nsgo tool's generated main package calls it.
func SetLanguageMatch ¶
SetLanguageMatch sets how the language the app shows follows its locale: package i18n's SetApp sets its catalog's match, nil none. It is set as the program initializes, for every app it runs.
func SetUpdaterAutomaticChecks ¶
SetUpdaterAutomaticChecks is the core's part of updater.SetAutomaticChecks.
func SetUpdaterAutomaticDownloads ¶
SetUpdaterAutomaticDownloads is the core's part of updater.SetAutomaticDownloads.
func SystemSwitchAvailable ¶
SystemSwitchAvailable reports whether the platform has a SystemSwitch: macOS, iOS (not a watch), or Android's Material 3 switch, or a web build that runs as them.
func ThirdPartyNotices ¶
func ThirdPartyNotices() string
ThirdPartyNotices returns the license notices collected by nsgo build. It returns an empty string when the app was built without a notice file.
func TriggerBack ¶
func TriggerBack(cx *Scope)
TriggerBack dispatches Back in cx's tree through the same chain Escape, Android's back button and tvOS's Menu button use (overlays, modals, Scope.OnBackPress handlers and navigation stacks). It is the core's part of package gamepad's focus navigation (gamepad.EnableFocusNavigation).
func UTF16Offset ¶
UTF16Offset returns the UTF-8 byte offset at units in s, clamped to a complete UTF-16 code point.
func UnknownClasses ¶
UnknownClasses returns the classes of s that are no utility of Tailwind's default theme, in order: what an element would log and ignore. A tool checks classes written for it with it before they draw.
Types ¶
type Access ¶
type Access interface {
// Allows reports whether req is granted. It is called on the engine's goroutine, so it may read only what does not change.
Allows(req AccessRequest) bool
// WebHosts are the hosts a web view's pages may navigate to at the top level: "*", "*.example.com" or a host. The platform refuses navigations to other http and https hosts, and to other schemes but the pages' own (AccessWebSchemes) and the app's (Scope.ServeScheme), as they start.
WebHosts() []string
}
Access says what code under a scope may reach (NSH's nsh_core::access): a host gives it to code it did not write, such as a plugin, with Scope.ProvideAccess. Without one, as for an app's own code, everything is allowed. Core checks it where each request is made, whoever makes it, so a Go component showing the code's data is held to it too: images, videos and web views refused show nothing and report OnError, and the services fail as AccessDenied or answer as the system would with nothing there.
Allows is asked about a web view's source, not about where its pages go: the platform decides those as they start, from WebHosts and, for the about:, blob: and data: pages a page makes itself, AccessWebSchemes.
Elements are held by the Access of the owner that rendered them, services by the running owner's, the one whose render, effect, handler or Run is running, or outside one by that of the scope they are called on. A Host's handlers run outside the owner that called them, so they are held to the scope they call services on.
type AccessRequest ¶
type AccessRequest struct {
// Permission is the capability asked for: AccessNetwork, ...
Permission string
// Resource is what is asked of it: a URL, a host handler's name, or
// with AccessMedia "microphone" or "camera"; "" for a capability
// with none.
Resource string
// Method is a network request's HTTP method, AccessInput for a web view's trusted input, AccessMedia for what its pages capture, or AccessCookies for a cookie the web views' store takes.
Method string
}
AccessRequest is what Access is asked for.
type AccessWebSchemes ¶ added in v0.2.0
AccessWebSchemes is an Access that also says which pages of their own making a web view's pages may navigate to at the top level, by scheme: "about", "blob" and "data"; other names are ignored. The platform refuses the rest as they start, as it refuses hosts WebHosts leaves out, but for an about: page on Linux, which WebKitGTK shows before the app can tell the top level's navigation from a frame's: it is refused as it commits, posts nothing, reports no load start or navigation state, and the view goes back to the page before it. An Access without WebSchemes allows all three; one whose WebSchemes returns nil allows none. The app's own sources, WebView.Source and what Ref.Load loads, and the schemes it serves (Scope.ServeScheme) are not held to it, nor are a page's frames, nor, on the native backends, Ref.Reload, GoBack and GoForward taking the view to such a source's page again. A page reloading itself or stepping through its history is held to it, but on Android, which checks neither, and on Apple platforms for a reload of the app's source. On the web, where a web view is an iframe whose navigations the page cannot see, neither WebHosts nor WebSchemes holds its pages.
type AccessibilityAction ¶
type AccessibilityAction = driver.AccessibilityAction
AccessibilityAction is an action assistive technology offers on an element; OnAccessibilityAction receives its Name.
type AccessibilityValue ¶
type AccessibilityValue = driver.AccessibilityValue
AccessibilityValue is a range's or a textual element's value (accessibilityValue).
type Accessible ¶
type Accessible = driver.Accessible
Accessible says whether a view is one element for assistive technology.
type ActivityConfidence ¶
type ActivityConfidence = driver.ActivityConfidence
ActivityConfidence is the provider's unknown, low, medium or high confidence.
type ActivityKinds ¶
type ActivityKinds = driver.ActivityKinds
ActivityKinds is a set of native activity classifications.
type ActivitySample ¶
type ActivitySample = driver.ActivitySample
ActivitySample reports native activity flags and confidence.
type Affinity ¶
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 AlertConfig ¶
type AlertConfig = driver.AlertConfig
AlertConfig is a native alert: a title, a message and its buttons.
type Align ¶
type Align uint8
Align places children on the cross axis (align-items, align-self, align-content) and grid items along the row (justify-items, justify-self). Start and end are React Native's flex-start and flex-end.
type AndroidEventMapper ¶
type AndroidEventMapper = driver.AndroidEventMapper
AndroidEventMapper is implemented by an Android component that receives the listener callbacks of its view itself.
type AndroidModalProps ¶
type AndroidModalProps struct {
// StatusBarTranslucent lets the content reach under Android's status
// bar; otherwise the modal starts below it.
StatusBarTranslucent bool
}
AndroidModalProps are a Modal's props only Android has.
type AndroidPropMapper ¶
type AndroidPropMapper = driver.AndroidPropMapper
AndroidPropMapper is implemented by an Android component that chooses the setter calls a prop makes, in order.
type AndroidScreenProps ¶
type AndroidScreenProps struct {
// HeaderRightWithLargeTitle places HeaderRight beside the expanded title, moving it into the compact bar as the large title collapses.
HeaderRightWithLargeTitle bool
}
AndroidScreenProps are base.NavPage's Android header options, carried by Screen.
type AndroidViewProp ¶
type AndroidViewProp = driver.AndroidViewProp
AndroidViewProp is one setter call on a component's view: set<Name>(Value), Name's first letter upper-cased.
type AndroidViewProps ¶
type AndroidViewProps struct {
// Ripple spreads from the touch while the view is pressed; it shows
// on views that take presses. Keep one value for the view's life.
Ripple *Ripple
// Elevation lifts the view, which casts the system's shadow below it.
Elevation Points
}
AndroidViewProps are a View's props only Android has.
type AnimatedArg ¶
type AnimatedArg = driver.AnimatedArg
AnimatedArg is an animated node a drawing binds an argument to.
type AnimatedNode ¶
type AnimatedNode interface {
// AnimatedNodeID is the node's ID in the platform's graph, which a
// Drawing binds arguments to.
AnimatedNodeID() uint32
// contains filtered or unexported methods
}
AnimatedNode is a value of the animation graph: an AnimatedValue or a node derived from others.
func Add ¶
func Add(a, b AnimatedNode) AnimatedNode
Add returns a + b. One of them may be a Constant; so for Sub, Mul, Div and Mod.
func DiffClamp ¶
func DiffClamp(in AnimatedNode, min, max float64) AnimatedNode
DiffClamp follows the changes of in but stays within min and max, as a header that hides as content scrolls up and shows as it scrolls down.
func Div ¶
func Div(a, b AnimatedNode) AnimatedNode
func Interpolate ¶
func Interpolate(in AnimatedNode, r Interpolation) AnimatedNode
Interpolate returns a node that maps in through r. Its output is a color when r has Colors.
func Mod ¶
func Mod(a, b AnimatedNode) AnimatedNode
func Mul ¶
func Mul(a, b AnimatedNode) AnimatedNode
func Resist ¶
func Resist(in AnimatedNode, min, max, dimension float64) AnimatedNode
Resist follows in but resists it past min and max as RubberBandClamp does, on the frame clock: bound to a view's translation with in a value PanValues drags, it slows the drag at its ends with no commit per move. in keeps the unresisted value, which a pan's end reports to snap back from.
func SnappingDiffClamp ¶
func SnappingDiffClamp(in AnimatedNode, min, max float64) AnimatedNode
SnappingDiffClamp is DiffClamp that settles at its nearer bound in 200 ms, easing out, when the scroll view whose offset its input follows comes to rest, so a header is never left half hidden. It settles at max only once its input reached max; scrolling again ends the settling where it is.
func Sub ¶
func Sub(a, b AnimatedNode) AnimatedNode
type AnimatedPropSetter ¶
type AnimatedPropSetter = driver.AnimatedPropSetter
AnimatedPropSetter is implemented by a native component that takes its animated props as numbers and colors.
type AnimatedStyle ¶
type AnimatedStyle struct {
Opacity AnimatedNode
TranslateX, TranslateY AnimatedNode
Scale, ScaleX, ScaleY AnimatedNode
// Rotate is in degrees, clockwise.
Rotate AnimatedNode
// Background, BorderColor and ShadowColor take color
// interpolations.
Background, BorderColor, ShadowColor AnimatedNode
ShadowRadius AnimatedNode
// ShadowOpacity multiplies the shadow color's alpha.
ShadowOpacity AnimatedNode
// TextColor colors a text's whole content, its spans included.
TextColor AnimatedNode
// RotateX and RotateY turn the view out of its plane, in degrees.
RotateX, RotateY AnimatedNode
// StickyInset is how far a sticky view pins from its scroll view's
// start, in place of its Top (Left across).
StickyInset AnimatedNode
}
AnimatedStyle binds a view's properties to animated nodes, over its style. The platform writes them every frame they change.
type AnimatedValue ¶
type AnimatedValue struct {
// contains filtered or unexported fields
}
AnimatedValue is a number the platform animates. Bind it to a view through Style.Animated, or derive other nodes from it.
func NewAnimatedValue ¶
func NewAnimatedValue(cx *Scope, v float64) *AnimatedValue
NewAnimatedValue returns a value starting at v, released with the current owner.
func (*AnimatedValue) AnimatedNodeID ¶
func (n *AnimatedValue) AnimatedNodeID() uint32
AnimatedNodeID implements AnimatedNode.
func (*AnimatedValue) ExtractOffset ¶
func (v *AnimatedValue) ExtractOffset()
ExtractOffset moves the value into the offset and resets it to 0.
func (*AnimatedValue) FlattenOffset ¶
func (v *AnimatedValue) FlattenOffset()
FlattenOffset adds the offset into the value and resets it to 0.
func (*AnimatedValue) Read ¶
func (v *AnimatedValue) Read(cx *Scope, fn func(float64))
Read asks the platform for the value, with its offset, and passes it to fn under the current owner.
func (*AnimatedValue) Set ¶
func (v *AnimatedValue) Set(x float64)
Set jumps the value to v, stopping its animation.
func (*AnimatedValue) SetOffset ¶
func (v *AnimatedValue) SetOffset(x float64)
SetOffset sets what is added to the value, as a drag's start.
func (*AnimatedValue) Stop ¶
func (v *AnimatedValue) Stop()
Stop stops the value's animation where it is.
type AnimatedXY ¶
type AnimatedXY struct{ X, Y *AnimatedValue }
AnimatedXY are the values a drag or a scroll view moves.
type Animation ¶
Animation is a description of how values move: Timing, Spring and Decay move one value, and Sequence, Parallel, Stagger, Delay and Loop compose them.
func AtFrameRate ¶
AtFrameRate has a move its values at most rate times a second, on the animation StartAnimation runs, and returns it. What loops for as long as work lasts, such as a pulsing dot, wants this: a compositor redraws at the rate anything on screen moves, however small, and at 120 Hz that costs the system far more than the animation shows. Reserve the display's full rate for what follows a finger or travels across the window.
func Decay ¶
func Decay(v *AnimatedValue, c DecayConfig) *Animation
Decay slows v down from a velocity, as a fling.
func Loop ¶
Loop runs a again each time it ends, with its values back at their start, iterations times; forever when 0. LoopOn starts each iteration where the last ended.
func Spring ¶
func Spring(v *AnimatedValue, to float64, c SpringConfig) *Animation
Spring moves v to to on a damped spring.
func Timing ¶
func Timing(v *AnimatedValue, to float64, c TimingConfig) *Animation
Timing moves v to to over c.Duration.
func ValueKeyframes ¶
func ValueKeyframes(v *AnimatedValue, t KeyframeTiming, stops ...KeyframeStop) *Animation
ValueKeyframes moves v through stops as t says, as CSS keyframes and the Web Animations API do: each iteration starts at its first stop, so a loop that ends where it starts never jumps, and the value stays where the last iteration leaves it.
type AnimationKind ¶
type AnimationKind = driver.AnimationKind
AnimationKind is what an Animation does.
type AnimationRun ¶
type AnimationRun struct {
// contains filtered or unexported fields
}
AnimationRun is an animation StartAnimation runs on the platform, or a Tween.
func (*AnimationRun) Reset ¶
func (r *AnimationRun) Reset()
Reset ends the run, unfinished if it still runs, and puts the values it moves back where they were as it started.
func (*AnimationRun) Stop ¶
func (r *AnimationRun) Stop()
Stop ends the run where its values are, unfinished.
type AppClipOverlayPosition ¶
type AppClipOverlayPosition uint8
AppClipOverlayPosition implements mobile.AppClipOverlayPosition.
const ( AppClipOverlayBottom AppClipOverlayPosition = iota AppClipOverlayBottomRaised )
Positions for mobile.ShowAppClipOverlay.
type AppInfo ¶
type AppInfo struct {
// ID and Name are nsgo.yaml's id and name.
ID, Name string
// Version is nsgo.yaml's version, and Build the build's number:
// build_number, else Version. Both are "" where nsgo.yaml has none.
Version, Build string
// Development is true unless nsgo build built the app: under nsgo dev,
// nsgo test and a plain go build.
Development bool
}
AppInfo is the app's identity as nsgo.yaml gives it.
type AppURLChange ¶
type AppURLChange struct{ URL, Reason string }
AppURLChange reports an address reached by browser navigation or a hash edit. Reason is "back", "forward" or "address". Application writes do not notify these handlers; they update the tracked AppURL immediately.
type AppURLOptions ¶
type AppURLOptions struct{ History HistoryBehavior }
AppURLOptions chooses how the browser records an application address.
type Appearance ¶
type Appearance = driver.Appearance
Appearance is the light or dark appearance an app asks for, or the system's.
type AppleCredential ¶ added in v0.2.0
type AppleCredential struct {
// User is the user's stable ID for the app's team, the same on each sign-in and what AppleCredentialState asks about.
User string
// IdentityToken is a JSON Web Token Apple signed, for the app's server to verify, and AuthorizationCode a short-lived code the server exchanges for tokens.
IdentityToken, AuthorizationCode string
// Email, which may be a private relay address, and the name's parts are given only on the user's first sign-in to the app and only as AppleSignInOptions asked for them; "" otherwise, so keep them then.
Email string
GivenName, FamilyName, MiddleName, NamePrefix, NameSuffix, Nickname string
}
AppleCredential is what a sign-in with Apple answers.
type AppleCredentialState ¶ added in v0.2.0
type AppleCredentialState uint8
AppleCredentialState is the state of a user's Sign in with Apple credential for the app.
const ( // AppleCredentialAuthorized: the user is signed in to the app with Apple. AppleCredentialAuthorized AppleCredentialState = driver.AppleCredentialAuthorized // AppleCredentialRevoked: the user stopped using Sign in with Apple with the app, so it signs them out. AppleCredentialRevoked AppleCredentialState = driver.AppleCredentialRevoked // AppleCredentialNotFound: no credential of the user is known for the app. AppleCredentialNotFound AppleCredentialState = driver.AppleCredentialNotFound // AppleCredentialTransferred: the app moved to another team, and the user's ID with it, which the app's server migrates. AppleCredentialTransferred AppleCredentialState = driver.AppleCredentialTransferred )
func (AppleCredentialState) String ¶ added in v0.2.0
func (s AppleCredentialState) String() string
String returns the state's name in TSX: "authorized", "revoked", "notFound" or "transferred"; "" for the zero state.
type AppleSignInError ¶ added in v0.2.0
type AppleSignInError string
AppleSignInError is why Sign in with Apple answered without a credential or a state.
const ( // AppleSignInCancelled: the user closed the sheet, which is no failure. AppleSignInCancelled AppleSignInError = driver.AppleSignInCancelled // AppleSignInFailed: the system refused or could not answer, as it does for an app not signed with the entitlement (nsgo.yaml's apple.sign_in_with_apple) or a device signed in to no Apple Account. AppleSignInFailed AppleSignInError = driver.AppleSignInFailed AppleSignInUnavailable AppleSignInError = driver.AppleSignInUnavailable )
func (AppleSignInError) Error ¶ added in v0.2.0
func (e AppleSignInError) Error() string
type AppleSignInOptions ¶ added in v0.2.0
type AppleSignInOptions struct {
// FullName and Email ask for the user's name and email, which Apple gives only the first time the user signs in to the app.
FullName, Email bool
// Nonce goes into the request as its SHA-256, in lowercase hex, which the identity token's nonce claim then holds, so the app's server, which knows Nonce, can tell the token was made for this sign-in. "" sends none.
Nonce string
}
AppleSignInOptions are what SignInWithApple asks for.
type ApproxLayout ¶
ApproxLayout is the TextLayout of ApproxTextEngine: the text's lines.
func (*ApproxLayout) Attachment ¶
func (l *ApproxLayout) Attachment(i int) (Bounds, bool)
Attachment implements AttachmentLayout.
func (*ApproxLayout) CaretRect ¶
func (l *ApproxLayout) CaretRect(c Caret) (Bounds, bool)
CaretRect returns the caret at c, as high as its line.
func (*ApproxLayout) HitTest ¶
func (l *ApproxLayout) HitTest(p Point) Caret
HitTest returns the caret nearest p in the layout's content box.
func (*ApproxLayout) RangeRects ¶
func (l *ApproxLayout) RangeRects(start, end int, out []Bounds) []Bounds
RangeRects appends to out the boxes covering UTF-16 offsets start to end.
func (*ApproxLayout) TextLines ¶
func (l *ApproxLayout) TextLines() []TextLine
TextLines implements LineLayout.
type ApproxTextEngine ¶
type ApproxTextEngine struct{}
ApproxTextEngine measures text without a platform: every character is 0.6 of the font size wide, lines are 1.2 of it tall, and lines wrap at spaces. Its font's ascent is the line, its descent 0 and its x height half the font size. Headless tests use it.
func (ApproxTextEngine) Prepare ¶
func (ApproxTextEngine) Prepare(t *driver.AttributedText) driver.PreparedText
Prepare implements TextEngine.
type AtlasSprite ¶
type AtlasSprite = driver.AtlasSprite
AtlasSprite is a recorded source rectangle, transform and opacity.
type AtlasSprites ¶
type AtlasSprites = driver.AtlasSprites
AtlasSprites is the sprite list recorded by a DrawAtlas operation.
type AttachmentLayout ¶
type AttachmentLayout interface {
// Attachment returns the box of attachment i in the content box, or
// false when the line limit cut it off.
Attachment(i int) (Bounds, bool)
}
AttachmentLayout is a TextLayout of text with attachments. The engine asks it where each went after laying the text out.
type AttributedText ¶
type AttributedText = driver.AttributedText
type AudioError ¶
type AudioError string
AudioError is why a sound or a player failed, named as NSH's codes, which follow the web's MediaError: the core's part of audio.Error, which apps use. A failure that says more is one wrapped with the platform's words, which errors.Is and errors.As find.
const ( // AudioNotAllowed: the current owner's Access refuses AccessAudio, or AccessNetwork for an http(s) source; or, on the web, the browser refused to play before a user gesture. AudioNotAllowed AudioError = driver.AudioNotAllowed // AudioNetwork: the source could not be fetched. AudioNetwork AudioError = driver.AudioNetwork // AudioDecode: the source is in a format the platform cannot read. AudioDecode AudioError = driver.AudioDecode // AudioNotSupported: the source is none the platform plays, such as one with neither a URI nor bytes. AudioNotSupported AudioError = driver.AudioNotSupported // AudioQuotaExceeded: a sound would exceed an encoded size, duration, sound count, or decoded size limit. AudioQuotaExceeded AudioError = driver.AudioQuotaExceeded AudioUnavailable AudioError = driver.AudioUnavailable // AudioFailed: the platform failed otherwise, such as a player whose output went away. AudioFailed AudioError = driver.AudioFailed )
func (AudioError) Error ¶
func (e AudioError) Error() string
type AudioOutput ¶
type AudioOutput struct {
// contains filtered or unexported fields
}
AudioOutput is the core's part of audio.Output. The scope that opened it closes it on disposal.
func (*AudioOutput) Close ¶
func (o *AudioOutput) Close()
Close stops rendering and releases the output. Calling it again has no effect.
func (*AudioOutput) Flush ¶
func (o *AudioOutput) Flush() int
Flush discards frames the renderer produced that have not reached the device and reports how many were discarded. Position never counts the discarded frames.
func (*AudioOutput) Latency ¶
func (o *AudioOutput) Latency() time.Duration
Latency reports the buffer latency the backend is using, or zero before it renders.
func (*AudioOutput) Position ¶
func (o *AudioOutput) Position() (frames int64, at time.Time)
Position returns the monotonic number of frames that reached the device and the corresponding host time. The time is zero before the first frame.
func (*AudioOutput) Start ¶
func (o *AudioOutput) Start() error
Start starts or resumes the output. It returns an error if the device cannot start.
func (*AudioOutput) Underruns ¶
func (o *AudioOutput) Underruns() int
Underruns counts callbacks whose Render filled fewer frames than requested.
type AudioOutputConfig ¶
type AudioOutputConfig struct {
// SampleRate is the client's sample rate in hertz. Channels is 1 or 2.
SampleRate, Channels int
// Latency is a buffer duration hint. A zero value chooses the device's defaults.
Latency time.Duration
// Render fills interleaved Float32 samples in [-1, 1] and returns the number of frames written. It runs on the audio thread, never concurrently with itself. It must not block, allocate, use the graph or call Output methods. The buffer belongs to the callback. If Render returns fewer frames, the remainder is silent and the output counts one underrun.
Render func(buf []float32) int
// OnInterrupt reports a paused output after an interruption, route change or device error. It runs on the engine goroutine. Start resumes output.
OnInterrupt func(error)
}
AudioOutputConfig is the core's part of audio.OutputConfig.
type AudioPlayer ¶
type AudioPlayer struct {
// contains filtered or unexported fields
}
AudioPlayer plays long audio, streamed and decoded as it plays: the core's part of audio.Player, which apps use. Its methods are called on the engine's goroutine, and all but the getters are commands in the batch of the turn that calls them.
func (*AudioPlayer) Close ¶
func (p *AudioPlayer) Close()
Close stops the player and releases the platform's; its callbacks, Play's among them, never run after it. Calling it again does nothing.
func (*AudioPlayer) Duration ¶
func (p *AudioPlayer) Duration() time.Duration
Duration returns how long the player plays, 0 until it loaded and for a stream without one.
func (*AudioPlayer) Play ¶
func (p *AudioPlayer) Play(done func(error))
Play plays the player from where it is, loading it first if needed, and calls done, when not nil, once it plays or with why it cannot, an AudioError. Where the platform plays no audio it fails at once with AudioUnavailable, without asking it.
func (*AudioPlayer) Position ¶
func (p *AudioPlayer) Position() time.Duration
Position returns where the player is, as its last report or seek said.
func (*AudioPlayer) Preload ¶
func (p *AudioPlayer) Preload()
Preload has the platform load the player without playing it, so that Play starts at once.
func (*AudioPlayer) Seek ¶
func (p *AudioPlayer) Seek(position time.Duration)
Seek moves the player to position, clamped to its duration once it is known. Paused, or before it loaded, it applies once the platform can seek, and Play starts from there.
func (*AudioPlayer) SetLoop ¶
func (p *AudioPlayer) SetLoop(loop bool)
SetLoop repeats playback from the configured LoopStart at the end, with no OnEnd.
func (*AudioPlayer) SetMuted ¶
func (p *AudioPlayer) SetMuted(muted bool)
SetMuted silences or restores the player without changing its volume or playback state.
func (*AudioPlayer) SetRate ¶
func (p *AudioPlayer) SetRate(r float32)
SetRate sets the playback speed, from 0.5 to 2; 0 is 1, as Video's, and other values are clamped.
func (*AudioPlayer) SetVolume ¶
func (p *AudioPlayer) SetVolume(v float32)
SetVolume sets the volume, from 0 to 1; 0 is 1, as Video's, and other values are clamped.
func (*AudioPlayer) State ¶
func (p *AudioPlayer) State() AudioPlayerState
State returns where the player is.
type AudioPlayerOptions ¶
type AudioPlayerOptions struct {
// LoopStart is where playback returns when looping is enabled. The first pass starts normally. Zero loops the full track.
LoopStart time.Duration
// OnLoad runs once the player knows its duration, 0 for a stream without one.
OnLoad func(duration time.Duration)
// OnProgress receives the position and the duration every ProgressInterval while the player plays, and once more as it pauses or ends. The position goes back only with a seek or a loop starting over.
OnProgress func(position, duration time.Duration)
// ProgressInterval is the time between OnProgress calls: 250 milliseconds when 0, and at least 16, as Video's.
ProgressInterval time.Duration
// OnBuffer receives whether playback waits for data.
OnBuffer func(buffering bool)
// OnEnd runs each time the player plays to its end; never while it loops.
OnEnd func()
// OnError receives why the player failed, an AudioError.
OnError func(err error)
// AudioSession is what the player does to other apps' audio while it plays: by default it mixes with them and, on iOS, the Ring/Silent switch silences it; with AudioSessionPlayback or AudioSessionMixWithOthers it plays in silent mode, the first pausing other apps' audio.
AudioSession AudioSession
}
AudioPlayerOptions are an AudioPlayer's: the core's part of audio.PlayerOptions, which apps use. Its callbacks run on the engine's goroutine, in a later turn than what caused them.
type AudioPlayerState ¶
type AudioPlayerState uint8
AudioPlayerState is where an AudioPlayer is, as the core follows it from the platform's events: the core's part of audio.PlayerState, which apps use.
const ( // AudioPlayerIdle: nothing asked of it yet. AudioPlayerIdle AudioPlayerState = iota // AudioPlayerLoading: loading its source, or waiting for data as it plays. AudioPlayerLoading // AudioPlayerPlaying: playing. AudioPlayerPlaying // AudioPlayerPaused: loaded, not playing; paused by the app or by the system, as for a call. AudioPlayerPaused // AudioPlayerEnded: played to its end; Play starts it over. AudioPlayerEnded // AudioPlayerFailed: it failed and plays nothing until Play or Preload loads it again. AudioPlayerFailed )
func (AudioPlayerState) String ¶
func (s AudioPlayerState) String() string
String returns the state's name: idle, loading, playing, paused, ended or failed.
type AudioSession ¶
type AudioSession = driver.AudioSession
AudioSession is what a video's sound does to the rest of the device's audio while it plays.
type AudioSource ¶
AudioSource is what a sound or a player plays, as an image's source says what it shows: the core's part of audio.Source, which apps use. URI is an "asset:" path in the app's resources, a file path or file: URL, a data: URL or an http(s) URL; Data, when set, is the bytes of a file, such as one embedded with go:embed, whose format their first bytes say.
type AuthError ¶ added in v0.2.0
type AuthError string
AuthError is why an auth session ended without its callback.
const ( // AuthCancelled: the user closed the session, or the app cancelled it. AuthCancelled AuthError = driver.AuthCancelled AuthUnavailable AuthError = driver.AuthUnavailable // AuthTimeout: AuthSessionOptions.Timeout passed first. AuthTimeout AuthError = driver.AuthTimeout // AuthFailed: the session or its options failed; the error wraps it with what failed. AuthFailed AuthError = driver.AuthFailed )
type AuthSessionOptions ¶ added in v0.2.0
type AuthSessionOptions struct {
// Scheme is the app's own callback scheme, such as "com.example.app": the redirect is scheme:/path. Windows and Linux need it registered in nsgo.yaml's url_schemes; macOS's, iOS's and watchOS's system session catches it without registration. "https" with Host catches an HTTPS redirect to the app's associated domain, from iOS 17.4, macOS 14.4 and watchOS 10.4. Without one, desktops serve a loopback redirect, http://127.0.0.1:port/path on a random port, and the web one on the page's origin.
Scheme string
Host string
// Path is the redirect's path, "/" when empty. Platforms treat it as decoded text, escape it and resolve dot segments before reporting the redirect.
Path string
// Ephemeral asks the session to share no cookies or data with the user's browser (prefersEphemeralWebBrowserSession), where the platform can.
Ephemeral bool
// Timeout ends the session with AuthTimeout after it, 0 never. A loopback session cannot tell that the user closed the browser's tab, so give it a timeout or a way to cancel.
Timeout time.Duration
}
AuthSessionOptions say what redirect an auth session catches.
type AutoCapitalize ¶
type AutoCapitalize = driver.AutoCapitalize
AutoCapitalize is a field's automatic capitalization; sentences are the default.
type AutoComplete ¶
type AutoComplete = driver.AutoComplete
AutoComplete says what a field holds, for the system's autofill and suggestions: React Native's autoComplete, which iOS maps to its textContentType.
type AutomationTool ¶
type AutomationTool struct {
Name string
Description string
InputSchema json.RawMessage
Handler func(context.Context, json.RawMessage) (any, error)
}
AutomationTool is automation's declaration of an app-owned MCP tool.
type BackdropMaterial ¶
type BackdropMaterial = driver.BackdropMaterial
BackdropMaterial is the system material iOS draws a backdrop blur with. macOS draws its closest material for one other than BackdropUltraThin, the zero value, and blurs by the radius for that.
type BackgroundMotionOptions ¶
type BackgroundMotionOptions = driver.BackgroundMotionOptions
BackgroundMotionOptions bounds a live motion stream and its execution lease.
type BiometricKind ¶
type BiometricKind uint8
BiometricKind says which enrolled biometric the system can use.
const ( BiometricNone BiometricKind = iota BiometricFace BiometricFingerprint )
type BiometricResult ¶
type BiometricResult uint8
BiometricResult is the result of AuthenticateBiometric.
const ( BiometricSuccess BiometricResult = iota + 1 BiometricFailure BiometricCancelled )
type BorderCurve ¶
type BorderCurve uint8
BorderCurve is the shape of rounded corners.
const ( BorderCurveCircular BorderCurve = iota + 1 BorderCurveContinuous )
type BorderStyle ¶
type BorderStyle = driver.BorderStyle
BorderStyle is how a border or an outline is drawn; the zero value is solid.
type BoxShadow ¶
BoxShadow is one of CSS's box-shadow layers: the box's shape grown by Spread, moved by Offset and blurred by Blur (CSS's blur radius), inside the box when Inset.
func ParseBoxShadows ¶
ParseBoxShadows reads a CSS box-shadow list; none is no shadows.
type Canvas ¶
type Canvas struct {
Draw func(d *Drawing, size Size)
// Class is Tailwind CSS classes, as View's.
Class string
ClassFunc func() string
Style Style
StyleFunc func() Style
OnPress func(PressEvent)
OnLayout func(Bounds)
Ref *Ref
// Label names the drawing for assistive technology, which reads it as an image; LabelFunc follows what it reads, as Text's does.
Label string
LabelFunc func() string
TestID string
// Em sizes the canvas where its style sets no size, in ems of the font size it inherits, scaled by the user's text size setting as text is: Em.Width wide and Em.Ascent+Em.Descent high, so it grows with the text around it as an icon does. In a text's attachment aligned to the baseline (VerticalAlignBaseline), its baseline, Em.Descent ems above its bottom, sits on the line's, and the text's NoFontScaling and MaxFontSizeMultiplier hold it too. AdjustsFontSizeToFit shrinks its font-relative size with the text. EmFunc follows what it reads, laying the canvas out again; base/formula sizes its formulas so.
Em EmBox
EmFunc func() EmBox
// MeasureEm measures a width-aware em canvas, such as base/formula's display math, at width in points (Auto when unconstrained) and the resolved, scaled font size. It returns its box in ems without drawing. Em or EmFunc may supply its preferred box. Reads are tracked; the callback also runs during layout, so it must not change signals.
MeasureEm func(width, fontSize Points) EmBox
}
Canvas draws what Draw records, at the canvas's size, again whenever a signal Draw read, the size or the available fonts change. The platform plays the recording on the main thread; Draw itself runs on the engine.
The Drawing measures text with the platform's text engine (MeasureText, TextMetrics) and answers hit tests (IsPointInPath, IsPointInStroke) during Draw and after it, so OnPress can test the shapes of the last drawing Draw was given. Arguments bound to animated nodes (Drawing.Bind) redraw on the platform's frame clock without a commit, and Drawing.Node names parts of the drawing for assistive technology and tests.
A drawing that fills shapes with its view's background (Drawing.FillBackgroundFromView) takes the canvas's Background and Gradients, which the view then does not draw.
type CanvasGradient ¶
type CanvasGradient = driver.CanvasGradient
CanvasGradient is a linear, radial or conic color gradient that a Drawing fills and strokes with.
func CanvasConic ¶
func CanvasConic(angle, x, y float32, stops ...GradientStop) *CanvasGradient
CanvasConic returns a canvas gradient around (x, y) from angle radians, turning clockwise.
func CanvasLinear ¶
func CanvasLinear(x0, y0, x1, y1 float32, stops ...GradientStop) *CanvasGradient
CanvasLinear returns a canvas gradient from (x0, y0) to (x1, y1).
func CanvasRadial ¶
func CanvasRadial(x0, y0, r0, x1, y1, r1 float32, stops ...GradientStop) *CanvasGradient
CanvasRadial returns a canvas gradient from the circle (x0, y0, r0) to the circle (x1, y1, r1).
type CanvasMesh ¶
type CanvasMesh = driver.CanvasMesh
CanvasMesh is the triangle list a DrawVertices op recorded, in DrawOp.Mesh.
type CanvasNode ¶
type CanvasNode = driver.CanvasNode
CanvasNode is a named part of a drawing, which assistive technology and tests see as a child of the canvas.
type CanvasVertex ¶
type CanvasVertex = driver.CanvasVertex
CanvasVertex is a corner of a triangle drawn by Drawing.DrawVertices.
type CaretEvent ¶
CaretEvent is where an input's caret is: Bounds in the input's view, as wide as the platform draws the caret and as tall as its line, and PageBounds the same in the surface, which an Overlay's AnchorBounds takes. Empty Bounds mean the platform could not place it yet.
type Catch ¶
type Catch struct {
Try func(cx *Scope) Node
Fallback func(cx *Scope, err error, reset func()) Node
}
Catch builds Try and, when it or anything under it panics, Fallback instead, disposing what failed before its bindings can run again. Calling reset builds Try again.
type ClipboardImage ¶
type ClipboardImage = driver.ClipboardImage
ClipboardImage is an image read from the clipboard: a PNG and its size in pixels.
type ClipboardItem ¶
type ClipboardItem = driver.ClipboardItem
ClipboardItem holds the native representations of one clipboard item.
type ClipboardRepresentation ¶
type ClipboardRepresentation = driver.ClipboardRepresentation
ClipboardRepresentation holds a native format name and its bytes.
type Clock ¶
type Clock interface {
Now() time.Time
// AfterFunc calls f on its own goroutine after d, unless stop is
// called first; stop reports whether it prevented the call.
AfterFunc(d time.Duration, f func()) (stop func() bool)
}
Clock is the time a graph's timers run on. Go cannot hook time globally, so tests inject a ManualClock where an app would use the system's.
type CloudChangeEvent ¶
type CloudChangeEvent struct {
Keys []string
Files []string
Reason CloudChangeReason
}
CloudChangeEvent describes keys and files changed externally in cloud storage.
type CloudChangeReason ¶
type CloudChangeReason uint8
CloudChangeReason explains why an external cloud storage change arrived.
const ( // CloudChangeServer reports data updated from another device or the server. CloudChangeServer CloudChangeReason = iota // CloudChangeInitialSync reports values downloaded on initial sync after install or sign-in. CloudChangeInitialSync // CloudChangeQuotaViolation reports that the cloud key-value store exceeded its quota. CloudChangeQuotaViolation // CloudChangeAccount reports that the signed-in cloud account changed. CloudChangeAccount )
func (CloudChangeReason) String ¶
func (r CloudChangeReason) String() string
String returns a human-readable name for the change reason.
type CloudConflict ¶
type CloudConflict struct {
Name string
Local []byte
Remote []byte
LocalTime time.Time
RemoteTime time.Time
Resolve func(chosen []byte) error
}
CloudConflict describes a conflicting remote version of a cloud file or key and provides Resolve to commit the winning bytes.
type CloudConflictError ¶
type CloudConflictError struct {
Key string
Local []byte
Remote []byte
LocalTime time.Time
RemoteTime time.Time
}
CloudConflictError describes a conflict between local and remote versions of a cloud key or file. It unwraps to ErrCloudConflict.
func (*CloudConflictError) Error ¶
func (e *CloudConflictError) Error() string
func (*CloudConflictError) Unwrap ¶
func (e *CloudConflictError) Unwrap() error
type CloudStore ¶
type CloudStore interface {
Available() bool
Get(key string) ([]byte, error)
Set(key string, value []byte) error
Delete(key string) error
Keys() ([]string, error)
ReadFile(name string) ([]byte, error)
WriteFile(name string, data []byte) error
DeleteFile(name string) error
ListFiles() ([]string, error)
WatchChanges(onChange func(CloudChangeEvent)) (stop func())
OnConflict(resolve func(CloudConflict)) (stop func())
}
CloudStore is an optional per-app cloud storage backend (RootOptions.Cloud), used by nsgotest to give each test app an isolated in-memory cloud store. When nil, package cloud uses the native platform backend.
type Collection ¶
type Collection[K comparable, T any] struct { // contains filtered or unexported fields }
Collection holds items by key, in order, each in a signal of its own, as a Solid store holds an array: a computation that reads one item follows that item alone, and one that reads the order follows only insertions, removals and moves. A list's rows read their own items, so changing one item runs one row where a signal of the whole slice runs them all.
Like a signal's, its methods belong to the graph's goroutine.
func NewCollection ¶
func NewCollection[K, T comparable](cx *Scope, key func(T) K, items []T) *Collection[K, T]
NewCollection returns a collection of items, keyed by key; an item set equal to the one held changes nothing. Two items with the same key panic.
func NewCollectionFunc ¶
func NewCollectionFunc[K comparable, T any](cx *Scope, key func(T) K, equal func(a, b T) bool, items []T) *Collection[K, T]
NewCollectionFunc returns a collection as NewCollection does that compares items with equal; with a nil equal every item set notifies its readers, as items holding slices or maps need.
func (*Collection[K, T]) At ¶
func (c *Collection[K, T]) At(i int) (T, bool)
At returns the item at i, following the order and that item, and whether i is in range, as a list's row reads its item: unlike KeyAt it never panics.
func (*Collection[K, T]) Delete ¶
func (c *Collection[K, T]) Delete(k K) bool
Delete removes the item keyed k, and reports whether the collection held one.
func (*Collection[K, T]) Get ¶
func (c *Collection[K, T]) Get(k K) (T, bool)
Get returns the item keyed k, following that item alone, and whether the collection holds one; without one it follows the order, to see one added.
func (*Collection[K, T]) Items ¶
func (c *Collection[K, T]) Items() []T
Items returns the items in order, following the order and every item.
func (*Collection[K, T]) KeyAt ¶
func (c *Collection[K, T]) KeyAt(i int) K
KeyAt returns the key of the item at i, following the order; it panics when i is out of range, as a slice does.
func (*Collection[K, T]) Keys ¶
func (c *Collection[K, T]) Keys() []K
Keys returns the keys in order, following the order. The slice is the collection's: it does not change, and must not be changed.
func (*Collection[K, T]) Len ¶
func (c *Collection[K, T]) Len() int
Len returns the number of items, following the order.
func (*Collection[K, T]) Replace ¶
func (c *Collection[K, T]) Replace(items []T)
Replace makes the collection hold items, in their order, as Solid's reconcile does: an item whose key it held replaces that item, notifying its readers only when it differs, items with new keys are added, the others removed, and the order notifies only when it changes. Two items with the same key panic.
func (*Collection[K, T]) Set ¶
func (c *Collection[K, T]) Set(item T)
Set replaces the item with item's key, or adds item at the end.
func (*Collection[K, T]) Update ¶
func (c *Collection[K, T]) Update(k K, fn func(T) T) bool
Update replaces the item keyed k with what fn returns for it, and reports whether the collection held one. fn must keep the item's key.
type Color ¶
Color is an sRGB color packed as 0xRRGGBBAA, the wire form of mount items.
const Transparent Color = 0x00000100
Transparent is a color that draws nothing but, unlike 0, is set: a border Transparent colors draws none, where one left 0 draws in the text color.
func ParseColor ¶
ParseColor reads a CSS color, as a host's Tokens give them: hex ("#e11d48", "#fff8"), rgb(), rgba(), hsl(), hsla(), a color name or transparent.
type ColorMatrix ¶
type ColorMatrix = driver.ColorMatrix
ColorMatrix is a 4×5 color matrix in rows, as SVG's feColorMatrix.
type ColorSpace ¶
type ColorSpace = driver.ColorSpace
ColorSpace is where a gradient's colors mix between stops.
type CompositeOp ¶
type CompositeOp = driver.CompositeOp
CompositeOp is how drawing mixes with what a canvas holds, as the web's globalCompositeOperation.
type Composition ¶
type Composition struct {
// Composing is false once the composition ended.
Composing bool
// Text is what is being composed; empty once it ended.
Text string
}
Composition is an input method's composition in a text field.
type Constant ¶
type Constant float64
Constant is a fixed operand for Add, Sub, Mul, Div and Mod.
func (Constant) AnimatedNodeID ¶
AnimatedNodeID implements AnimatedNode: a constant is no node.
type ContextMenuEvent ¶
ContextMenuEvent is where a context menu was asked for. PagePosition is where a menu for it opens.
type CrashReport ¶
type CrashReport struct {
// Version and Build identify the app that crashed.
Version, Build string
// Platform is the operating system, such as darwin, ios, android or windows.
Platform string
// Kind is go, objective-c, java or seh.
Kind string
// Time is when the report was written.
Time time.Time
// contains filtered or unexported fields
}
CrashReport describes a diagnostic kept by an earlier process.
func (CrashReport) Acknowledge ¶
func (r CrashReport) Acknowledge() error
Acknowledge removes the report from the app's logs directory.
func (CrashReport) Open ¶
func (r CrashReport) Open() (io.ReadCloser, error)
Open opens the diagnostic text. The caller closes the reader when done.
type Curve ¶
Curve is an easing curve: CSS's cubic Bézier from (0,0) to (1,1) through two control points.
type CustomCursor ¶
type CustomCursor = driver.CustomCursor
CustomCursor describes an image-based pointer cursor on desktops and the web (Style.CursorImage).
type DataStyle ¶
DataStyle styles a node, or a group, that shows the data-* attribute Name (PartStates.Data).
type DecayConfig ¶
type DecayConfig = driver.DecayConfig
DecayConfig slows a value from Velocity (units per second; the value's current velocity when 0) by Deceleration per millisecond (0.998 when 0).
type DesktopViewProps ¶
type DesktopViewProps struct {
// WindowDrag makes the view a handle that moves the desktop window.
WindowDrag WindowDrag
}
DesktopViewProps are a View's props only the desktops have.
type Directory ¶
Directory is a folder the user picked, read as an fs.FS: its name, and where it is on disk where it has a path.
type DiskSpace ¶
DiskSpace gives the capacity and available space in bytes. On the web, it estimates the origin's storage quota and the portion still available.
type DisplayInfo ¶
type DisplayInfo = driver.DisplayInfo
DisplayInfo describes a display reported by Env.Display and Env.Displays.
type DownloadOptions ¶
type DownloadOptions struct {
CertificatePEM string
}
DownloadOptions configures a background download.
type DownloadProgress ¶
type DownloadProgress struct {
Task DownloadTask
Path string
State DownloadState
Loaded, Total int64
Error string
}
DownloadProgress reports a task, destination, state and byte counts.
type DownloadRequest ¶
DownloadRequest describes a GET request with optional HTTP headers.
type DownloadState ¶
type DownloadState string
DownloadState is the latest state of a background download.
const ( DownloadQueued DownloadState = "queued" DownloadRunning DownloadState = "running" DownloadPaused DownloadState = "paused" DownloadCompleted DownloadState = "completed" DownloadFailed DownloadState = "failed" DownloadCanceled DownloadState = "canceled" DownloadInterrupted DownloadState = "interrupted" )
type DownloadTask ¶
type DownloadTask string
DownloadTask identifies a download, including after the app restarts.
func (DownloadTask) Cancel ¶
func (t DownloadTask) Cancel()
Cancel asks the host to stop the task and remove its partial file.
func (DownloadTask) Forget ¶
func (t DownloadTask) Forget()
Forget removes the stored report of a finished task.
func (DownloadTask) OnUpdate ¶
func (t DownloadTask) OnUpdate(cx *Scope, fn func(DownloadProgress))
OnUpdate reports changes to this task on cx's engine.
func (DownloadTask) Pause ¶
func (t DownloadTask) Pause()
Pause asks the host to pause the task and retain its partial file.
func (DownloadTask) Resume ¶
func (t DownloadTask) Resume()
Resume asks the host to resume a paused task.
type Drawing ¶
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.
type Dynamic ¶
Dynamic builds its nodes again whenever what fn read changes. The nodes it built before go first, so their bindings never run against what replaced them.
type Easing ¶
Easing is how a timing animation or an interpolation segment progresses: a cubic Bézier, or one of React Native's curves.
func StepsEasing ¶
func StepsEasing(count int, position StepPosition) Easing
StepsEasing returns CSS's steps(count, position): count equal jumps.
type EdgeBar ¶
EdgeBar makes a view a bar over a side of the scroll view Scroll refers to, which content scrolls under: a header or a toolbar placed over it. The scroll view's edge effect at that side reaches as far as its bars do:
scroll := &core.Ref{}
core.View{Children: []core.Node{
core.Scroll{Ref: scroll, EdgeEffects: core.EdgeEffects{Top: core.EdgeEffectSoft}, ...},
core.View{EdgeBar: core.EdgeBar{Scroll: scroll, Side: core.SideTop},
Style: core.Style{Position: core.Absolute, Top: core.Pt(0), Left: core.Pt(0), Right: core.Pt(0)}, ...},
}}
type EdgeColors ¶
type EdgeColors = driver.EdgeColors
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.
type EdgeEffect ¶
type EdgeEffect = driver.EdgeEffect
EdgeEffect is how a scroll view's side sets the views over it, its bars (View.EdgeBar), apart from the content scrolling under them, as iOS 26's scroll edge effects do: Scroll.EdgeEffects.
A soft edge blurs the content more toward the side, as far as the bars reach and a little past them, and fades it into the background it scrolls over; a hard edge frosts it evenly under the bars, with a hairline along them. All but Linux blur by a radius that grows toward the side; Linux only fades the content into the background.
type EdgeEffects ¶
type EdgeEffects struct {
Top, Right, Bottom, Left EdgeEffect
}
EdgeEffects are a scroll view's edge effects, by side.
type Edges ¶
Edges holds a length per side.
type EditAction ¶
type EditAction = driver.EditAction
EditAction is an editing action of an input's touch edit menu (Ref.OpenEditMenu, Input.OnEditAction).
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element is an element built one change at a time, as nsh-core's operations (ops.rs) build what NSH's renderer runs: the tsx package's. It is made detached, shows where it is inserted into another element or mounted as a Node, and is released with the owner it was made under.
func NewElement ¶
NewElement returns a detached element whose props are props: a View, a Text, a Scroll, an Input or an Image. Its functions are read when it is made and on each Set, never bound: the tsx runtime binds what changes itself. With nil props it is a region, whose children lay out as its parent's.
func (*Element) Insert ¶
Insert puts child among e's children before before, at the end when before is nil or not e's, moving it from where it was.
func (*Element) Mount ¶
Mount shows node in region element e, built under e's owner: Go components among an element's children.
func (*Element) Release ¶
func (e *Element) Release()
Release takes the element out and frees it, with what Go code mounted in it; the elements among its children only leave it.
type EllipsizeMode ¶
type EllipsizeMode = driver.EllipsizeMode
EllipsizeMode is where a text cut by its line limit loses the rest.
type EmBox ¶
type EmBox struct {
Width, Ascent, Descent float32
}
EmBox is a canvas's natural size in ems of its font size (Canvas.Em): Width wide, reaching Ascent above its baseline and Descent below it.
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env is the environment as signals, one per part, so a binding runs again only when a part it read changes.
func (*Env) AppClip ¶
AppClip reports whether the app runs as an iOS App Clip: the core's part of mobile.IsAppClip, which apps use.
func (*Env) Appearance ¶
func (e *Env) Appearance() Appearance
Appearance returns the appearance Scope.SetAppearance forces, or AppearanceSystem.
func (*Env) AppleKeys ¶
AppleKeys reports whether shortcuts follow Apple's conventions: "mod" is Command and labels use ⌘.
func (*Env) CanDiscoverServices ¶
CanDiscoverServices reports whether this target supports local DNS-SD.
func (*Env) CanDockPanels ¶
CanDockPanels reports whether desktop.PanelOptions.Dock can attach a panel to a display's usable edge. Wayland needs gtk4-layer-shell and a compositor implementing layer-shell; an explicit display must still be connected.
func (*Env) CanLockPointer ¶
CanLockPointer reports whether the surface supports Ref.LockPointer.
func (*Env) CanLookUp ¶ added in v0.2.0
CanLookUp reports whether desktop.LookUp can show the system dictionary panel.
func (*Env) CanMakeWindowsTransparent ¶ added in v0.2.0
CanMakeWindowsTransparent reports whether the scope's desktop window shows what is behind it while transparent (WindowOptions.Transparent, SetWindowTransparent): the core's part of desktop.CanMakeWindowsTransparent, which apps use.
func (*Env) CanPickScreenColor ¶
CanPickScreenColor reports whether Scope.PickScreenColor works here: macOS, Windows, Linux where the desktop Screenshot portal is available, and browsers with an EyeDropper.
func (*Env) CanPlaceWindows ¶ added in v0.2.0
CanPlaceWindows reports whether SetWindowFrame places the scope's window where it says, an Android overlay's included: the core's part of desktop.CanPlaceWindows, which apps use.
func (*Env) CanPlayAudio ¶
CanPlayAudio reports whether the platform plays the audio package's sounds and players; elsewhere they fail with AudioUnavailable without asking it.
func (*Env) CanPlayHapticPattern ¶
CanPlayHapticPattern reports whether the platform can play timed haptics.
func (*Env) CanPurchase ¶ added in v0.2.0
CanPurchase reports whether Scope.Products, Purchase and the other in-app purchase services reach a store here: the App Store on macOS, iOS and tvOS, in a build nsgo.yaml's apple.purchases gives StoreKit.
func (*Env) CanQuickLook ¶
CanQuickLook reports whether desktop.QuickLook can show the system's file preview panel.
func (*Env) CanRecognizeSpeech ¶
CanRecognizeSpeech reports whether Scope.StartSpeech recognizes speech here: macOS and iOS (not tvOS or watchOS).
func (*Env) CanRequestReview ¶
CanRequestReview reports whether Scope.RequestReview can ask the platform's store for an in-app rating prompt here.
func (*Env) CanScanCode ¶
CanScanCode reports whether Scope.ScanCode shows a camera that reads codes here: macOS and iOS devices with a camera (not the simulator), Android devices with one whose app's manifest asks for CAMERA (nsgo.yaml's android.permissions), Windows machines with a camera, Linux desktops with the Camera portal and GStreamer pipewiresrc, and browsers with getUserMedia and BarcodeDetector.
func (*Env) CanScheduleAudio ¶
CanScheduleAudio reports whether the platform schedules audio.Sound playback at a requested time.
func (*Env) CanScheduleNotifications ¶ added in v0.2.0
CanScheduleNotifications reports whether a Notification with a later At or a Repeat is scheduled here: natively (also after the app closes) on macOS, iOS and watchOS in an app bundle, Android and Windows, and while the app or page runs on Linux and the web where Notification is available. Elsewhere (tvOS and mini programs) ShowNotification answers false for one without asking the platform.
func (*Env) CanSendInput ¶
CanSendInput reports whether Ref.SendInput can give a web view's page trusted input here. macOS supports this through AppKit; other backends currently drop it.
func (*Env) CanSetWindowLevel ¶ added in v0.2.0
CanSetWindowLevel reports whether SetWindowLevel stacks the scope's desktop window: the core's part of desktop.CanSetWindowLevel, which apps use.
func (*Env) CanSetWindowWorkspaces ¶ added in v0.2.0
CanSetWindowWorkspaces reports whether SetWindowWorkspaces puts the scope's desktop window on the workspaces it names: the core's part of desktop.CanSetWindowWorkspaces, which apps use.
func (*Env) CanShowNowPlaying ¶
CanShowNowPlaying reports whether the system presents the app's Now Playing information.
func (*Env) CanSignInMiniProgram ¶
CanSignInMiniProgram reports whether SignInMiniProgram reaches the host login API.
func (*Env) CanSignInWithApple ¶ added in v0.2.0
CanSignInWithApple reports whether Scope.SignInWithApple and Scope.AppleCredentialState reach Sign in with Apple here: macOS, iOS and tvOS.
func (*Env) CanSkipTaskbar ¶ added in v0.2.0
CanSkipTaskbar reports whether WindowOptions.SkipTaskbar and SetSkipTaskbar keep the scope's desktop window off the taskbar: the core's part of desktop.CanSkipTaskbar, which apps use.
func (*Env) CanSpeak ¶ added in v0.2.0
CanSpeak reports whether Scope.Speak speaks text here: macOS, iOS, tvOS, Android, Windows, the web where the browser has speechSynthesis, and Linux where speech-dispatcher is installed. Elsewhere an utterance fails with SpeakUnavailable without asking the platform.
func (*Env) CanTakePhoto ¶
CanTakePhoto reports whether Scope.TakePhoto shows a camera here: iOS and Android devices with one, HarmonyOS, mobile mini programs, browsers on touch screens, and the desktops where Scope.ScanCode has a camera: macOS and Windows machines with one, and Linux desktops with the Camera portal and GStreamer pipewiresrc.
func (*Env) CanUseCloudStorage ¶
CanUseCloudStorage reports whether package cloud has an available cloud storage backend 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.
func (*Env) CanUseGameServices ¶
CanUseGameServices reports whether 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. Elsewhere gameservices calls answer ErrUnsupported without asking the platform.
func (*Env) Dark ¶
Dark reports whether the app shows dark: the appearance Scope.SetAppearance forces, else the system's.
func (*Env) DeviceModel ¶ added in v0.2.0
DeviceModel returns the device's hardware model: its model identifier on Apple's platforms, such as "iPhone15,2" or "Mac15,7", its maker and model on Android, such as "Google Pixel 8", and the firmware's product name on Windows and Linux; it is empty on the web and where the hardware names none.
func (*Env) DeviceName ¶ added in v0.2.0
DeviceName returns the name the user gave the device, such as "Ada's MacBook Pro", as the system's settings show it; it is empty on the web and where the platform keeps it private, as iOS does from apps without Apple's user-assigned device name entitlement.
func (*Env) Display ¶
func (e *Env) Display() DisplayInfo
Display reports the window's current display. Bindings that read it follow changes to that display and moves to a different one. It returns the zero DisplayInfo where the platform has no current display.
func (*Env) Displays ¶
func (e *Env) Displays() []DisplayInfo
Displays returns the reported displays in screen coordinates. Frame is the whole display, VisibleFrame is the area available to windows, Scale is device pixels per point, and Main marks the primary display. It is empty where the platform has no display information.
func (*Env) FullScreen ¶
FullScreen reports whether the window is in full screen: the core's part of desktop.FullScreen, which apps use.
func (*Env) Geometry ¶
Geometry returns how a fold or hinge divides the surface: its usable regions, each with the safe area that falls in it, and the obstructions between them, in the surface's coordinates and measured at Window's size, which it changes with; and how far the device's hinge is open (State, Angle), whether or not an obstruction lies on the surface, as on a cover display or a screen opened flat. A surface without a fold, as on every target but Android and iOS 27.1, has one region, no obstructions and HingeUnknown. Core lays nothing out by it: an app or component reads it and chooses its own panes.
func (*Env) HasWebView ¶
HasWebView reports whether this target provides the native or browser web view host used by WebView.
func (*Env) IncreaseContrast ¶ added in v0.2.0
IncreaseContrast reports whether the user asked the system for stronger contrast, such as macOS Increase Contrast or a Windows contrast theme.
func (*Env) KeyboardDuration ¶
KeyboardDuration returns how long the keyboard takes to move.
func (*Env) KeyboardHeight ¶
KeyboardHeight returns how much of the bottom the keyboard covers.
func (*Env) Language ¶
Language returns the language the app shows: of its catalogs' languages, the one that suits Locale best, as SetLanguageMatch says; "" for an app without catalogs. Package i18n's Language, which apps use, reads it.
func (*Env) LaunchedAtLogin ¶ added in v0.2.0
LaunchedAtLogin reports whether the system started this run as a login item: the core's part of desktop.LaunchedAtLogin, which apps use.
func (*Env) Lifecycle ¶
Lifecycle returns whether the app is in use: active, inactive (shown without the focus) or in the background. On desktops it is the window's the scope is in, a minimized or covered window's in the background while the others show, and the app's own scope's is every window's together.
func (*Env) Locale ¶
Locale returns the locale the app runs in, a BCP 47 tag: the one Scope.SetLocale forces, else the embedding host's, else the user's.
func (*Env) LocaleSettings ¶
func (e *Env) LocaleSettings() LocaleSettings
LocaleSettings returns how the user reads weeks, times and measures, apart from the language, where the platform says: zero where it does not. Package i18n's Regional fills them in from the locale's region.
func (*Env) LowPowerMode ¶
func (e *Env) LowPowerMode() LowPowerMode
LowPowerMode reports whether the system's energy-saving mode is on, or LowPowerUnknown when the system does not report it.
func (*Env) Maximized ¶
Maximized reports whether the window is maximized or zoomed: the core's part of desktop.Maximized, which apps use.
func (*Env) Minimized ¶
Minimized reports whether the window is minimized: the core's part of desktop.Minimized, which apps use.
func (*Env) Network ¶
Network reports the device's connectivity. A platform that cannot report it defaults to Online. Bindings that read it follow changes.
func (*Env) OSVersion ¶
OSVersion returns the system's version: Android's API level as its major, zero on the web.
func (*Env) OpenedURL ¶
OpenedURL returns the link that last opened the app, "" when none did: the core's part of mobile.OpenedURL, which apps use.
func (*Env) PixelRatio ¶
PixelRatio returns device pixels per point.
func (*Env) Pointer ¶
Pointer returns the precision of the primary pointing device, matching CSS's pointer media feature (PointerFine, PointerCoarse or PointerNone): what the platform reports directly, as the web's pointer media query does, else derived from Idiom (fine on desktops and Macs, none on TVs, coarse on touch devices).
func (*Env) RTL ¶
RTL reports whether the app lays out right to left: as the language it shows is written (Language), else the locale it forces, else as the system lays out.
func (*Env) ReduceMotion ¶
ReduceMotion reports whether the user asked for less motion.
func (*Env) ScreenReader ¶
ScreenReader reports whether a screen reader is running.
func (*Env) Simulated ¶
Simulated reports whether the app runs as another OS than the platform's, as a web build does for --nsgo-os, or on an OS whose native parts it cannot reach, as a mini program does: OS is that one's, but none of its native parts are there, so the app's own views stand in for its system header, tab bar, menus and window.
func (*Env) SupportsCustomCursor ¶
SupportsCustomCursor reports whether the platform shows image-based custom cursors (Style.CursorImage): true on macOS, Windows, Linux and the web; false on touch platforms such as iOS and Android.
func (*Env) SupportsGPU ¶
SupportsGPU reports whether this target and device can host a gpu.View (docs/architecture/gpu.md).
func (*Env) SupportsGamepads ¶
SupportsGamepads reports whether package gamepad reads game controllers here: macOS, iOS, Windows, Linux, Android and the web.
func (*Env) ThermalState ¶
func (e *Env) ThermalState() ThermalState
ThermalState returns the system's thermal pressure, or ThermalUnknown when the system does not report it.
func (*Env) TitleBar ¶
TitleBar returns what a hidden desktop title bar covers: the core's part of desktop.TitleBar, which apps use.
func (*Env) VerticalBarEdge ¶
func (e *Env) VerticalBarEdge() VerticalBarEdge
VerticalBarEdge returns the edge the system chose for a vertical bar, such as a tab bar drawn down a side, where it may place one, as iOS 27.1 does; VerticalBarUnspecified elsewhere.
func (*Env) WindowFrame ¶
func (e *Env) WindowFrame() WindowFrame
WindowFrame returns where the window is and how large: the core's part of desktop.Frame, which apps use.
func (*Env) WindowMaterial ¶
func (e *Env) WindowMaterial() WindowMaterial
WindowMaterial returns the material behind the window's content, or WindowMaterialNone when the window is opaque: the core's part of desktop.ShowsMaterial, which apps use.
func (*Env) WindowTransparent ¶ added in v0.2.0
WindowTransparent reports whether the scope's window or panel draws nothing of its own now, no background, frame or shadow, so what is behind it shows wherever the content draws nothing: a panel opened with PanelOptions.Transparent, or a window opened with WindowOptions.Transparent or made so by SetWindowTransparent, where the platform could. It is the core's part of desktop.Transparent, which apps use. CanMakeWindowsTransparent is whether a window could be; this is whether it is. Where it is false, give the content a background of its own.
type EnvEdges ¶
type EnvEdges struct{ Top, Right, Bottom, Left EnvInset }
EnvEdges are the environment's terms on each edge of a padding or a margin. Right to left, a term follows its edge's swap and takes the inset of the edge it lands on.
type EnvInset ¶
type EnvInset uint8
EnvInset is a value of the environment a padding or margin adds to its length, as CSS's env() in NSH's styles: the safe area's inset on the edge, or the software keyboard's height. The node follows it as it changes, the keyboard's moves animating with the keyboard natively.
const ( EnvNone EnvInset = iota // EnvSafeArea is the inset on the edge of the root view the node renders in (Insets): the surface's safe area, a dialog's, a page's below its header, or a tab section's above a drawn tab bar. EnvSafeArea // EnvKeyboard is the software keyboard's height over the surface, 0 // while it is hidden or on a hardware keyboard. As a view's bottom // padding or margin it keeps the content above the keyboard. EnvKeyboard )
type Environment ¶
type Environment = driver.Environment
Environment is what the platform reports about where the app runs.
type Error ¶
type Error struct {
Code string
Message string
// Permission is the capability a refusal lacks and Resource the path,
// URL or name asked for, with CodeAccessDenied.
Permission, Resource string
// Err is what failed underneath, if anything.
Err error
}
Error is a failure with a stable Code.
func AccessDenied ¶
AccessDenied is the failure of what a capability does not grant.
func Unavailable ¶
Unavailable is the failure of what this platform does not do.
type Extrapolate ¶
type Extrapolate = driver.Extrapolate
Extrapolate is what an interpolation does outside its input range; 0 clamps.
type File ¶
File is a file the user picked: its name, type, size, modification time and where it is on disk.
func FileFromURL ¶
FileFromURL returns the file a URL from OnFileDrop, ReadClipboardFiles or a PasteEvent names, for File.Open to read. A file: URL names a local file, which has its path, size and modification time; the web's blob: URL, whose fragment is the file's name, names a file the page holds, which has no path, and has its size, type and time when the page made the URL from a drop. A folder, a file that is not there, a file: URL with a remote host outside Windows, a blob: URL off the web and every other scheme return an error.
type Filter ¶
Filter is one of CSS's filter functions; Blur, Brightness and the other constructors make them.
func Blur ¶
Blur blurs what a view draws (in Filters) or what is behind it (in BackdropFilters) by radius, CSS's blur().
func Brightness ¶
Brightness multiplies the colors by f: 0 is black, 1 unchanged.
func DropShadow ¶
DropShadow draws a shadow of what the view draws, in its shape rather than its box's: offset, blur radius and color.
func ParseFilters ¶
ParseFilters reads a CSS filter list; none is no filters.
type FilterKind ¶
type FilterKind = driver.FilterKind
FilterKind is which filter function a Filter is.
type FlexDirection ¶
type FlexDirection uint8
FlexDirection is the main axis of a container, as in CSS.
const ( // Column lays children out top to bottom, the default as in React Native. Column FlexDirection = iota + 1 Row ColumnReverse RowReverse )
type FocusDirection ¶
type FocusDirection uint8
FocusDirection is the direction MoveFocus moves keyboard focus in: the core's part of package gamepad's focus navigation (gamepad.EnableFocusNavigation).
const ( FocusDirNone FocusDirection = iota FocusDirUp FocusDirDown FocusDirLeft FocusDirRight FocusDirNext FocusDirPrev )
type FontExtent ¶
type FontExtent = driver.FontExtent
type FontVariant ¶
type FontVariant = driver.FontVariant
FontVariant is a set of OpenType features, as CSS's font-variant-caps and font-variant-numeric set them; the values combine.
type FontWeight ¶
type FontWeight = driver.FontWeight
FontWeight is a CSS font weight from 100 to 900; 0 is unset.
type FrameRateRange ¶
type FrameRateRange struct {
Minimum, Maximum, Preferred float32
}
FrameRateRange requests a display rate in Hz for a surface. A zero range follows the display. Use Preferred alone to request one rate. Within a range, omitted bounds take Preferred's value, and an omitted Preferred uses Maximum, or Minimum if Maximum is also omitted.
type FrontmostAppInfo ¶ added in v0.2.0
type FrontmostAppInfo = driver.FrontmostAppInfo
FrontmostAppInfo is the application in front on the desktop, which Scope.FrontmostApp returns: the core's part of desktop.FrontmostAppInfo.
type GPUSurface ¶
type GPUSurface struct {
// contains filtered or unexported fields
}
GPUSurface connects a mounted gpu.View to its owning Tree and platform off-commit GPU submission hook. This is core's part of gpu.Device.
func (*GPUSurface) Disposed ¶
func (s *GPUSurface) Disposed() bool
Disposed reports whether the owning GPU view has unmounted.
func (*GPUSurface) NextID ¶
func (s *GPUSurface) NextID() uint64
NextID allocates a process-wide monotonic GPU resource identifier.
func (*GPUSurface) Submit ¶
func (s *GPUSurface) Submit(frame any)
Submit sends an off-commit driver.GPUFrame directly to the platform backend without marking the shadow tree dirty or producing a MountBatch. Frames are dropped while the owning surface is in LifecycleBackground so platforms like iOS (Metal) never receive background GPU work.
func (*GPUSurface) SurfaceID ¶
func (s *GPUSurface) SurfaceID() uint32
SurfaceID returns the owning surface's ID.
func (*GPUSurface) ViewID ¶
func (s *GPUSurface) ViewID() NodeID
ViewID returns the mounted KindGPU view's NodeID.
type GPUView ¶
type GPUView struct {
ColorFormat uint8
ColorSpace uint8
DepthFormat uint8
SampleCount int
FramesInFlight int
// OnMount runs on the engine goroutine once the KindGPU node is allocated.
OnMount func(surf *GPUSurface)
// OnEvent receives platform GPU events (*driver.GPUEvent) on the engine goroutine.
OnEvent func(ev any)
Class string
Style Style
StyleFunc func() Style
Children []Node
OnPress func(PressEvent)
OnLayout func(Bounds)
Ref *Ref
Label string
LabelFunc func() string
TestID string
}
GPUView is core's host element for package gpu's View (docs/architecture/gpu.md). Apps construct views via package gpu rather than using GPUView directly.
type GameAchievement ¶
type GameAchievement = driver.GameAchievement
GameServices, GamePlayer, GameAchievement, GameScoreEntry, GameTimeScope and GamePlayerScope are the core's part of package gameservices and nsgotest's per-app fake, which apps use through package gameservices.
type GamePlayer ¶
type GamePlayer = driver.GamePlayer
GameServices, GamePlayer, GameAchievement, GameScoreEntry, GameTimeScope and GamePlayerScope are the core's part of package gameservices and nsgotest's per-app fake, which apps use through package gameservices.
type GamePlayerScope ¶
type GamePlayerScope = driver.GamePlayerScope
GameServices, GamePlayer, GameAchievement, GameScoreEntry, GameTimeScope and GamePlayerScope are the core's part of package gameservices and nsgotest's per-app fake, which apps use through package gameservices.
type GameScoreEntry ¶
type GameScoreEntry = driver.GameScoreEntry
GameServices, GamePlayer, GameAchievement, GameScoreEntry, GameTimeScope and GamePlayerScope are the core's part of package gameservices and nsgotest's per-app fake, which apps use through package gameservices.
type GameServices ¶
type GameServices = driver.GameServices
GameServices, GamePlayer, GameAchievement, GameScoreEntry, GameTimeScope and GamePlayerScope are the core's part of package gameservices and nsgotest's per-app fake, which apps use through package gameservices.
func GameServicesOf ¶
func GameServicesOf(cx *Scope) GameServices
GameServicesOf returns the per-app game services backend supplied to RootOptions.GameServices (such as nsgotest's fake), or nil when none was configured so package gameservices uses the platform backend. It is the core's part of package gameservices, which apps use.
type GameTimeScope ¶
type GameTimeScope = driver.GameTimeScope
GameServices, GamePlayer, GameAchievement, GameScoreEntry, GameTimeScope and GamePlayerScope are the core's part of package gameservices and nsgotest's per-app fake, which apps use through package gameservices.
type GeofenceOptions ¶
type GeofenceOptions = driver.GeofenceOptions
GeofenceOptions chooses circles and an explicit background policy.
type GeofenceRegion ¶
type GeofenceRegion = driver.GeofenceRegion
GeofenceRegion is a WGS 84 circle with a stream-local identifier.
type GeofenceSample ¶
type GeofenceSample = driver.GeofenceSample
GeofenceSample is the latest state for one monitored region.
type GeofenceState ¶
type GeofenceState = driver.GeofenceState
GeofenceState is unknown, inside or outside.
type GestureEvent ¶
type GestureEvent struct {
Phase GesturePhase
Value float32
Velocity float32
// Position is the gesture's center in the view, where the fingers
// are or the pointer over a touchpad is; a rotation's is the origin.
Position Point
}
GestureEvent is a pinch or a rotation: its amount since it began and how fast that changes per second. A pinch's amount is its scale, 1 when it begins; a rotation's is an angle in radians, clockwise.
type GesturePhase ¶
type GesturePhase = driver.GesturePhase
GesturePhase is where a gesture is in its course.
type Gradient ¶
Gradient is a linear, radial or conic gradient image, as CSS's.
func ConicGradient ¶
ConicGradient returns a gradient around the center, starting at angle in degrees clockwise from up, through stops spread evenly over a turn.
func LinearGradient ¶
LinearGradient returns a gradient along angle, in degrees clockwise from up (90 runs left to right), through stops spread evenly.
func ParseGradients ¶
ParseGradients reads a CSS background-image list of linear-, radial- and conic-gradient() and their repeating forms; none is no gradients.
func RadialGradient ¶
RadialGradient returns an elliptical gradient from the center out to the farthest corner, through stops spread evenly.
type GradientCorner ¶
type GradientCorner = driver.GradientCorner
GradientCorner points a linear gradient at a corner.
type GradientExtent ¶
type GradientExtent = driver.GradientExtent
GradientExtent is how far a radial gradient's last stop reaches.
type GradientPaint ¶
type GradientPaint = driver.GradientPaint
GradientPaint is a gradient resolved against a box, what platforms draw.
type GradientSpread ¶
type GradientSpread = driver.GradientSpread
GradientSpread is how a CanvasGradient paints beyond offsets 0 and 1.
type GradientStop ¶
type GradientStop = driver.GradientStop
GradientStop is a color at an offset of a Gradient.
type GridFlow ¶
type GridFlow uint8
GridFlow is the CSS grid-auto-flow property: how a grid places items that do not say where they go.
type GridLines ¶
type GridLines struct{ Start, End GridPlacement }
GridLines is where a grid item starts and ends on one axis. The zero value is auto: the grid places the item.
func ParseGridLines ¶
ParseGridLines reads grid-row or grid-column: a placement, or a start and an end apart by a slash ("1 / 3", "span 2", "header / footer").
type GridPlacement ¶
type GridPlacement struct {
// contains filtered or unexported fields
}
GridPlacement is one end of a grid item's row or column: a line, a span of tracks, or a named line. The zero value is auto.
func GridLine ¶
func GridLine(n int) GridPlacement
GridLine places an item at line n, counting from 1; negative lines count from the end of the explicit grid.
func GridNamed ¶
func GridNamed(name string, n int) GridPlacement
GridNamed places an item at the nth line called name (the first when n is 0); with a span it spans until the nth such line.
func ParseGridPlacement ¶
func ParseGridPlacement(s string) (GridPlacement, error)
ParseGridPlacement reads one end of a grid item: auto, a line, "span n", a line's name, or a name and which of its lines ("a 2").
func (GridPlacement) Span ¶
func (p GridPlacement) Span(n int) GridPlacement
Span returns p spanning n named lines rather than placed at one.
func (GridPlacement) String ¶
func (p GridPlacement) String() string
String returns p in CSS syntax.
type GridTracks ¶
type GridTracks string
GridTracks is a list of grid tracks in CSS syntax: lengths in px, percentages, fr, auto, min-content, max-content, fit-content(…), minmax(…, …), repeat(n | auto-fill | auto-fit, …) and [line names], as in "repeat(auto-fill, minmax(100px, 1fr))". A list layout cannot parse has no tracks. The zero value is unset: none.
func (GridTracks) Valid ¶
func (g GridTracks) Valid() bool
Valid reports whether layout can parse the tracks.
type GroupStyle ¶
type GroupStyle struct {
Name string
Hover, Focus, Active, Selected, Checked, Indeterminate, Disabled *Style
FocusWithin, AriaBusy, AriaChecked, Expanded, Pressed, AriaSelected *Style
FocusVisible, AriaInvalid *Style
// Data are styles of data-* attributes of the group, sorted by name.
Data []DataStyle
}
GroupStyle styles a node by the states of its nearest group: the nearest ancestor whose Group is Name, or any group when Name is empty, as Tailwind's group-hover and its kin do.
type Haptic ¶
type Haptic uint8
Haptic is feedback the device plays under the user's finger: the core's part of mobile.Haptic, which apps use.
const ( // HapticSelection is a selection changing: a picker's value, a // segment, a slider's step. HapticSelection Haptic = iota + 1 // HapticLight to HapticRigid are elements colliding, by their weight // and give. HapticLight HapticMedium HapticHeavy HapticSoft HapticRigid // HapticSuccess, HapticWarning and HapticError are a task ending so. HapticSuccess HapticWarning HapticError )
The haptics, as iOS's feedback generators name them: a selection changing, an impact of a weight, and a task's outcome.
type HapticEvent ¶
type HapticEvent = driver.HapticEvent
HapticEvent is the core's part of mobile.HapticEvent.
type HapticPattern ¶
type HapticPattern = driver.HapticPattern
HapticPattern is the core's part of mobile.HapticPattern.
type HeaderSymbol ¶
type HeaderSymbol struct{ Name, Label string }
HeaderSymbol is a button of iOS's header: Name is its SF Symbol, and Label what assistive technology reads.
type HeaderSystemItem ¶
type HeaderSystemItem = driver.HeaderSystemItem
HeaderSystemItem is a button iOS draws in a navigation bar in UIKit's own look, its symbol or label.
type HingeState ¶
type HingeState = driver.HingeState
HingeState is how far a fold or hinge is open.
type HintChange ¶
type HintChange uint8
HintChange is what happened to a tooltip's view.
const ( // HintHover is the pointer coming onto the view. HintHover HintChange = iota + 1 // HintLeave is the pointer leaving it or pressing it. HintLeave // HintFocus is the keyboard moving the focus onto it or into it. HintFocus // HintBlur is that focus leaving it. HintBlur )
type HintTooltip ¶
type HintTooltip interface {
Node
Hint(cx *Scope, anchor *Ref) (tip Node, change func(HintChange))
}
A HintTooltip is a View's Tooltip that decides itself when it shows, as base.Tooltip does: Hint mounts it against the view anchor names, and change tells it what the pointer and the keyboard's focus did.
type History ¶
type History[T any] struct { // contains filtered or unexported fields }
History is a value with the steps it took, to undo and redo: a document, a canvas or a form the app's Edit menu and keys walk back through. Only its own Set and Update record steps. Its value, CanUndo and CanRedo are signals.
Like a signal's, its methods belong to the graph's goroutine.
func NewHistory ¶
func NewHistory[T comparable](cx *Scope, v T, opts HistoryOptions) *History[T]
NewHistory returns a history starting at v; setting a value equal to the current one records nothing.
func NewHistoryFunc ¶
func NewHistoryFunc[T any](cx *Scope, v T, equal func(a, b T) bool, opts HistoryOptions) *History[T]
NewHistoryFunc returns a history as NewHistory does that compares values with equal; with a nil equal every Set records a step, as slices and maps need.
func (*History[T]) Break ¶
func (h *History[T]) Break()
Break ends the latest step, so the next change starts a step of its own however soon it comes: a word typed, a selection moved.
func (*History[T]) CanRedo ¶
CanRedo reports whether Redo has a step to go forward, subscribing the running computation.
func (*History[T]) CanUndo ¶
CanUndo reports whether Undo has a step to go back, subscribing the running computation.
func (*History[T]) Clear ¶
func (h *History[T]) Clear()
Clear forgets every step, keeping the value: a document just saved or opened.
func (*History[T]) Get ¶
func (h *History[T]) Get() T
Get returns the value, subscribing the running computation.
func (*History[T]) GetUntracked ¶
func (h *History[T]) GetUntracked() T
GetUntracked returns the value without subscribing.
func (*History[T]) Group ¶
func (h *History[T]) Group(fn func())
Group runs fn, making every change it sets one step, as a paste or a replace-all is.
func (*History[T]) Redo ¶
Redo goes forward to the value the latest Undo left, and reports whether there was one.
func (*History[T]) Set ¶
func (h *History[T]) Set(v T)
Set makes v the value as a step that Undo goes back from, merged into the latest step within Merge of it or within a running Group, and drops the steps undone.
type HistoryBehavior ¶
type HistoryBehavior uint8
HistoryBehavior chooses whether SetAppURL replaces or pushes an address.
const ( HistoryReplace HistoryBehavior = iota HistoryPush )
type HistoryOptions ¶
type HistoryOptions struct {
// Limit is the most steps it keeps, dropping the oldest first; 0 keeps 100, and a negative limit every step.
Limit int
// Merge makes a change within this long of the latest step's last part of that step, as typing groups into one undo; 0 makes each change a step.
Merge time.Duration
}
HistoryOptions are how a History records its steps.
type Holder ¶
type Holder struct {
// contains filtered or unexported fields
}
A Holder keeps content built while the places that show it come and go, so it moves between parts of the tree with its state (its signals, a field's text, a scroll offset, a web view's page) instead of being built again. It is NSH's render keys (core/renders.rs), where the core moves what JS rendered for a key into the last placeholder placing it.
func NewHolder ¶
NewHolder returns a holder of what content builds, which it builds when a place first shows it. Unlike what code usually creates, the content belongs to cx itself rather than to the owner running, so it outlives the places that show it: until cx goes or Dispose.
func (*Holder) Dispose ¶
func (h *Holder) Dispose()
Dispose discards the content; places show nothing after it.
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host is the channel between an app and the host app that embeds it, without a view between them: launch parameters, events the host sends, and the host's functions the app calls. A host makes one for each view and keeps it across the apps the view runs, one at a time (RootOptions.Host). Its methods are safe to call from any goroutine.
Values cross it as JSON does, so iOS and Android hosts see the same: what Send, SetParams and HostCall.Resolve take is encoded and decoded again, maps becoming map[string]any and numbers float64.
func (*Host) Handle ¶
Handle has fn answer the app's calls and posts of name (Scope.CallHost, Scope.PostHost), replacing the handler it had. fn runs on the app's goroutine, so it must not block: it answers the call once, then or later from any goroutine. It runs outside the owner that called, so the services it calls are held to the Access of the scope it calls them on, as when it answers later through Scope.Post: a plugin's Access does not hold the app's scope.
func (*Host) HandleDefault ¶
HandleDefault has fn answer the calls and posts of every name without a handler of its own, as Handle's handlers do, for a host that looks names up itself, such as a web page's. nil removes it.
func (*Host) HandleOpenURL ¶
HandleOpenURL has fn see the URLs the app opens (Scope.OpenURL) before the platform does, once they pass CheckURL, so the host routes its own links through its own router. fn runs on the app's goroutine and must not block; it calls answer once, from any goroutine: true takes the URL, and the app hears it opened; false hands it to the platform. nil removes the handler.
func (*Host) RemoveHandler ¶
RemoveHandler removes the handler of name: calls of it fail at once.
type HostCall ¶
type HostCall struct {
// Name is the handler's name; Data what the app sent, as JSON
// decodes it.
Name string
Data any
// contains filtered or unexported fields
}
HostCall is one call or post of the app's to a host's handler.
type HotKey ¶
type HotKey struct {
// contains filtered or unexported fields
}
HotKey is the core's part of desktop.HotKey: a global shortcut's registration, whose State follows the platform's answers.
func (*HotKey) State ¶
func (h *HotKey) State() HotKeyState
State returns the registration state and subscribes the running computation to it. It is Pending until the platform answers, and again each time the app's set of shortcuts changes and the platform registers them anew; where the platform has no global shortcuts it is Unsupported from the start.
type HotKeyState ¶
type HotKeyState = driver.HotKeyState
HotKeyState is the core's part of desktop.HotKeyState: the answer to a global shortcut registration.
type IOSInputProps ¶
type IOSInputProps struct {
// KeyboardAppearance picks iOS's light or dark keyboard.
KeyboardAppearance KeyboardAppearance
}
IOSInputProps are an Input's props only iOS has.
type IOSModalProps ¶
type IOSModalProps struct {
// SupportedOrientations are the orientations iOS allows while the
// modal shows; 0 keeps the app's.
SupportedOrientations Orientation
}
IOSModalProps are a Modal's props only iOS has.
type IOSScreenProps ¶
type IOSScreenProps struct {
// HeaderRightSystemItem shows UIKit's own bar button, in the system's
// look, at the header's end in place of HeaderRight's views. A press
// on it presses HeaderRight's first view that takes presses, so keep
// one there; it is what the other platforms show.
HeaderRightSystemItem HeaderSystemItem
// HeaderRightSymbols shows UIKit's own bar buttons, each on glass of
// its own, in place of HeaderRight's views, none while it returns none.
// A press on one presses that of HeaderRight's views that take presses,
// in order: keep one there for each.
HeaderRightSymbols func() []HeaderSymbol
}
IOSScreenProps are a Screen's props only iOS has.
type IOSViewProps ¶
type IOSViewProps struct {
// BackdropMaterial is the system material iOS draws the view's backdrop blur with. macOS draws its closest material for one other than BackdropUltraThin, and blurs by the radius for that.
BackdropMaterial BackdropMaterial
}
IOSViewProps are a View's props only iOS has.
type Icon ¶
type Icon struct {
// Class is Tailwind CSS classes, as View's: size-6 sizes it and
// text-* colors it.
Class string
SVG *SVG
SVGFunc func() *SVG
Style Style
StyleFunc func() Style
OnPress func(PressEvent)
OnLayout func(Bounds)
Ref *Ref
Label string
LabelFunc func() string
TestID string
// contains filtered or unexported fields
}
Icon draws an SVG — an icon, a logo, an illustration — in the text color it inherits, so a theme colors it as it colors text: its shapes scale to the icon's size and stay sharp.
An icon is as high as the inherited font size, keeping the SVG's aspect ratio, unless Style sets a size. Its drawing is fitted and centered in the icon's box, whose aspect ratio a non-square box does not change.
core.Icon{SVG: lucide.Search(), Style: core.Style{FontSize: 20}, Label: "Search"}
An icon is a decoration assistive technology does not see unless Label names it.
type Image ¶
type Image struct {
// Class is Tailwind CSS classes, as View's.
Class string
Source ImageSource
SourceFunc func() ImageSource
Placeholder ImageSource
ResizeMode ResizeMode
Sampling ImageSampling
BlurRadius Points
FadeDuration time.Duration // 0 is the platform's
// HitTestAlpha is the minimum picture opacity, from 0 to 1, at which
// a painted window takes the pointer on macOS and Windows. Zero
// counts the whole image view.
HitTestAlpha float32
Style Style
StyleFunc func() Style
OnLoadStart func()
// OnProgress receives bytes loaded and the total, 0 when unknown.
OnProgress func(loaded, total int64)
// OnLoad receives the source's size in pixels.
OnLoad func(pixels Size)
OnError func(err error)
OnLoadEnd func()
OnPress func(PressEvent)
OnLayout func(Bounds)
Ref *Ref
Label string
LabelFunc func() string
// ElementsHidden hides it from assistive technology, as a part of a
// control that says it for it.
ElementsHidden bool
TestID string
}
Image shows a picture the platform loads, decodes and caches. Layout knows only the size Source declares: one dimension derives the other, and an image without one is 0 by 0 until its style sizes it.
type ImageSampling ¶
type ImageSampling = driver.ImageSampling
ImageSampling selects the filter used when scaling raster images.
type ImageScales ¶
type ImageScales = driver.ImageScales
ImageScales is a set of ImageScaleValues: the variants an image asset ships in.
func ScalesOf ¶
func ScalesOf(scales ...float32) ImageScales
ScalesOf returns the set of scales, leaving out any that is not one of ImageScaleValues.
type ImageSource ¶
type ImageSource = driver.ImageSource
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 (Pixels and Version), or a retained offscreen canvas drawing (Offscreen).
func PickImageScale ¶
func PickImageScale(s ImageSource, ratio float32) ImageSource
PickImageScale returns s as the platform loads it at ratio: an "asset:" image with scales names the variant they pick, a source with Variants names the variant's URI, and a URI with a query or fragment, which no file name has, stays. Scales and Variants are cleared.
type Importance ¶
type Importance uint8
Importance is importantForAccessibility, Android's name for Accessible and AccessibilityElementsHidden in one prop.
const ( // ImportantAuto leaves it to the view's other props. ImportantAuto Importance = iota // ImportantYes is Accessible. ImportantYes // ImportantNo makes the view no element; its descendants still are. ImportantNo // ImportantNoHideDescendants hides the view and its subtree. ImportantNoHideDescendants )
type Input ¶
type Input struct {
// Class is Tailwind CSS classes, as View's.
Class string
Value func() string
DefaultValue string
Placeholder string
// PlaceholderFunc replaces Placeholder and may change.
PlaceholderFunc func() string
// Masked hides the characters, for passwords.
Masked bool
Readonly bool
Disabled func() bool
KeyboardType KeyboardType
// AutoFocus focuses the field as it mounts; under a confined owner, only as Scope.Confine allows.
AutoFocus bool
// Multiline wraps the text in lines and grows with them unless its
// style sizes it; Return inserts a line break unless SubmitBehavior
// says else.
Multiline bool
// HideIndicator hides a multiline field's native scroll bar.
HideIndicator bool
// Bar draws a multiline field's scroll bar in place of the platform's indicator, over the app's (Scope.SetScrollbars).
Bar ScrollbarMaker
// MaxLength caps the text the user enters, in UTF-16 units; 0 sets
// no cap.
MaxLength int
// ReturnKeyType labels the software keyboard's return key.
ReturnKeyType ReturnKeyType
SubmitBehavior SubmitBehavior
AutoCapitalize AutoCapitalize
// NoAutoCorrect turns the system's autocorrection off.
NoAutoCorrect bool
// AutoComplete says what the field holds, for the system's autofill.
AutoComplete AutoComplete
// InputSource is the keyboard input source to select each time the
// field takes the focus, as Scope.SelectInputSource names it
// ("com.apple.keylayout.ABC" for Latin text on macOS), restored as it
// loses the focus unless the user chose another meanwhile or
// KeepInputSource. A source that is not enabled changes nothing.
InputSource string
KeepInputSource bool
// IOS holds the props only iOS has.
IOS IOSInputProps
// HideCaret draws no caret.
HideCaret bool
// SelectedRange, when set, selects its range whenever it changes.
SelectedRange func() TextRange
// InputAccessoryViewID names the InputAccessoryView shown above the
// software keyboard while the field has focus.
InputAccessoryViewID string
// Suggest follows a trigger query in the field, such as a mention after "@", for a list beside it, base.SuggestList. What it accepts sets the field's text, through OnChange when Value controls it, and puts the caret after it; it needs no Ref.
Suggest *Suggest
// NoFontScaling and MaxFontSizeMultiplier limit the user's text size
// setting for the field's text, as Text's do.
NoFontScaling bool
MaxFontSizeMultiplier float32
Style Style
StyleFunc func() Style
OnChange func(text string)
// OnSubmit runs on Return, as SubmitBehavior says.
OnSubmit func(text string)
// OnFocus and OnBlur follow the focus to and from the field; a focused field that leaves the tree hears OnBlur once, after the commit that removed it, or before the next view's OnFocus when the platform reports that first.
OnFocus func()
OnBlur func()
// OnSelectionChange receives the selection, or the caret, as the user
// moves it.
OnSelectionChange func(TextRange)
// OnKeyPress receives each key the user types: the text it enters,
// "Backspace" or "Enter".
OnKeyPress func(key string)
// OnCompositionChange follows an input method composing text: as the
// composition starts and changes, and as it ends, after the OnChange
// of the text it commits. While one lasts, the field holds a Value the
// app sets and shows it when the composition ends, unless the user
// edited the text since.
OnCompositionChange func(Composition)
// OnContentSizeChange receives the size of the value's text, wrapped
// at the content width when Multiline, after a layout that changed
// it. An empty field's is one empty line's.
OnContentSizeChange func(Size)
// OnCaretMove receives where the caret is while the input has the
// focus, whenever it moves: with the selection, and when the text
// scrolls or wraps again. Something that opens at the caret, such as
// an @-mention's suggestions, anchors to its PageBounds.
OnCaretMove func(CaretEvent)
// OnPaste receives what the user pastes, before the text it inserts
// is reported; PasteBehavior PasteReport keeps the text out. Images
// and files are never inserted, nor the text naming pasted files.
OnPaste func(PasteEvent)
// OnEditAction receives Cut, Copy or Select All chosen from the edit menu Ref.OpenEditMenu opened on the input; Paste runs OnPaste.
OnEditAction func(EditAction)
PasteBehavior PasteBehavior
// OnScroll receives a multiline field's scroll offset as its text scrolls.
OnScroll func(ScrollEvent)
OnLayout func(Bounds)
Ref *Ref
Label string
LabelFunc func() string
// LabelledBy names the input from visible elements, as a View's.
LabelledBy []*Ref
// AccessibilityDescription and Invalid are a View's: what the field
// expects, and that the app rejected its content.
AccessibilityDescription string
AccessibilityDescriptionFunc func() string
Invalid func() bool
// Role is what it is for assistive technology, a text field when 0; RoleSearchField keeps it a text field that reads as a search field.
Role Role
// ReadonlyFunc and KeyboardTypeFunc are Readonly and KeyboardType
// following what they read.
ReadonlyFunc func() bool
KeyboardTypeFunc func() KeyboardType
// AccessibilityValue, AccessibilityActions and OnAccessibilityAction
// are as a View's, for a field that is a spin button.
AccessibilityValue func() AccessibilityValue
AccessibilityActions []AccessibilityAction
AccessibilityActionsFunc func() []AccessibilityAction
OnAccessibilityAction func(name string)
// Expanded is a View's, for a field that opens a list.
Expanded func() bool
TestID string
}
Input is the platform's text field, a single line unless Multiline: the core's part of base.Input, which apps use. With Value it is controlled: the app updates the value in OnChange. Its style's PlaceholderColor colors the placeholder and SelectionColor the caret and the selection.
type InputAccessoryView ¶
type InputAccessoryView struct {
// ID is what inputs name in InputAccessoryViewID.
ID string
Style Style
StyleFunc func() Style
Children []Node
TestID string
}
InputAccessoryView is the core's part of mobile.InputAccessoryView, which apps use: a bar iOS and Android show above the software keyboard, as React Native's.
func (InputAccessoryView) Render ¶
func (a InputAccessoryView) Render(*Scope) Node
Render implements Node.
type Interpolation ¶
type Interpolation = driver.Interpolation
Interpolation maps a node through piecewise-linear ranges.
type KeepAwakeOptions ¶
type KeepAwakeOptions struct {
Display bool
}
KeepAwakeOptions control a power assertion. Display keeps the display on as well as preventing idle sleep; false keeps only the computer awake.
type Key ¶
type Key[T any] struct { // contains filtered or unexported fields }
Key is a context key: a value an owner provides to everything below it. Declare one as a package-level variable.
type KeyEvent ¶ added in v0.2.0
type KeyEvent struct {
// Key names the key as OnKey does, without modifiers: "k", "1", "space", "enter", "f5", "left", "escape"; a modifier pressed alone is "shift", "ctrl", "alt" or "meta", which is Command on macOS and the Windows or Super key elsewhere. A letter or a digit is the one the keyboard layout types unshifted.
Key string
// Code identifies the physical position as KeyboardEvent.code does, such as KeyW, ArrowLeft or ShiftRight. It is empty when unavailable.
Code string
// Modifiers are the modifier keys held: going down, the one pressed alone included; coming up, those still held, the one released not among them.
Modifiers Modifiers
// Repeat is whether the press is a held key's auto-repeat, which iOS never reports; it is false for a key coming up.
Repeat bool
}
KeyEvent is a key going down on a hardware keyboard while a view has the keyboard focus (View.OnKeyDown), or coming up after it went down there (View.OnKeyUp).
func (KeyEvent) Shortcut ¶ added in v0.2.0
Shortcut returns the press in OnKey's and desktop.RegisterHotKey's form, with each modifier by its own name, as driver.NormalizeKey writes it: "ctrl+shift+k" or "alt+space" on Windows and Linux, "shift+meta+k" for Command+Shift+K on macOS. A modifier pressed alone is "".
type KeyOptions ¶
type KeyOptions struct {
When KeyWhen
// Repeat fires it again on the auto-repeats of a held key.
Repeat bool
// OverModals keeps it firing while a modal its owner's views are not in covers them, for an app-wide shortcut such as a menu's.
OverModals bool
// YieldsToMenu leaves the key to the application menu while an enabled item takes the same shortcut where the focus is on macOS, Windows and Linux, which show the menu, for a default shortcut an app's menu may take over. An item that leaves its shortcut to a focused text input or web view (MenuNotEditing) does not suppress the binding, nor do the items after it with the same shortcut, which the desktops never reach past it, and on Linux no item takes a key pressed without Control, Alt or a logo key from a focused input or web view. Else a binding takes its key before the menu does.
YieldsToMenu bool
// AllSurfaces binds the key in every surface of the app rather than only the one it is bound in: the app's own and each window, panel and tray view it opens, those it opens later too, for an app-wide shortcut. In the surface it is bound in it is as OnKey says; in each other one it comes before that surface's own bindings, so one of the same key there wins over it, whenever it was made, and rests while a modal shows there unless OverModals keeps it. It rests in all of them while what its owner shows is hidden in the surface it is bound in, a modal covering it there aside, so a component's shortcut does not run while the user cannot see the component; one bound at the app's root, which shows nothing, fires everywhere. It ends in all of them as its owner goes. Where the platform opens no windows it is OnKey's.
AllSurfaces bool
// Title gives a shortcut's localized name in the iOS keyboard menu.
// A nil function or an empty title leaves the shortcut out of the menu.
Title func() string
// Group gives the localized title of the shortcut's iPadOS menu.
Group func() string
}
KeyOptions are how a binding fires.
type KeyWhen ¶
type KeyWhen uint8
KeyWhen says when a binding fires.
const ( // KeyAuto fires it unless the view with the keyboard focus uses the key itself: a text input or a web view the keys EditsText reports, a view that takes presses (a button, a menu row, a switch) Return and Space, a slider or spin button the arrows, Page Up, Page Down, Home and End, and a tab bar, radio group, list, menu or tree, or one of their items, the same keys to move in it. Modified keys, such as Shift+Space, are none of these but a text input's. KeyAuto KeyWhen = iota // KeyAlways fires it wherever the keyboard focus is. KeyAlways // KeyNotEditing fires it only while no text input or web view has the keyboard focus, and takes its key from any other focused view: a control binds its own keys with it while it has the focus, as a select does Return while its trigger keeps the focus, where KeyAuto would leave them to the control. KeyNotEditing )
type KeyboardAppearance ¶
type KeyboardAppearance = driver.KeyboardAppearance
KeyboardAppearance is the look of iOS's keyboard; the default follows the app's appearance.
const ( KeyboardAppearanceDefault KeyboardAppearance = iota KeyboardAppearanceLight KeyboardAppearanceDark )
type KeyboardDismissMode ¶
type KeyboardDismissMode = driver.KeyboardDismissMode
KeyboardDismissMode is whether dragging a scroll view dismisses the software keyboard.
const ( KeyboardDismissNone KeyboardDismissMode = iota // KeyboardDismissOnDrag dismisses it as a drag starts. KeyboardDismissOnDrag // KeyboardDismissInteractive follows the finger dragging down into // it (iOS; on drag elsewhere). KeyboardDismissInteractive )
type KeyboardTaps ¶
type KeyboardTaps = driver.KeyboardTaps
KeyboardTaps is what a tap in a scroll view does while the software keyboard shows.
type KeyframeAnimation ¶
type KeyframeAnimation = driver.KeyframeAnimation
KeyframeAnimation runs Keyframes over a view on the platform.
type KeyframeStop ¶
type KeyframeStop struct {
Value float64
// contains filtered or unexported fields
}
KeyframeStop is where a value is at a point of a keyframe animation: Stops spreads values evenly, StopAt places one, and Eased curves the segment that starts at it.
func StopAt ¶
func StopAt(offset, value float64) KeyframeStop
StopAt returns value at offset, from 0 to 1, of an iteration.
func Stops ¶
func Stops(values ...float64) []KeyframeStop
Stops returns values as keyframe stops spread evenly through an iteration, the first at its start and the last at its end.
func (KeyframeStop) Eased ¶
func (s KeyframeStop) Eased(e Easing) KeyframeStop
Eased returns s with e curving the segment from it to the next stop.
func (KeyframeStop) Offset ¶
func (s KeyframeStop) Offset() (float64, bool)
Offset returns where s is in an iteration, from 0 to 1, and whether it was placed there rather than spread evenly.
type KeyframeTiming ¶
type KeyframeTiming struct {
Duration time.Duration
Delay time.Duration
Easing Easing
Iterations int
Direction PlaybackDirection
}
KeyframeTiming is how keyframes play, as CSS's animation-duration, -delay, -timing-function, -iteration-count and -direction: Duration (300 ms when 0) an iteration, Easing for the segments without one of their own, Iterations (once when 0, Forever) and the Direction they play in, after Delay. During the delay the value already holds the first keyframe, as CSS's animation-fill-mode backwards does.
type LayoutAnimation ¶
type LayoutAnimation = driver.LayoutAnimation
LayoutAnimation animates the frame changes, insertions and removals of one commit on the platform, as React Native's LayoutAnimation does.
type LayoutAudit ¶
LayoutAudit is what DevTools' layout audit shows as it starts (UpdateHighlights.Layout): every view's border, padding and margin boxes, and a grid of Grid points, at least 4, or none for 0. One that shows anything, as nsgo dev -layout's does, binds auditKey to show and hide the audit; the zero LayoutAudit shows nothing and binds no key, so the audit shows only when DevTools show it, with the boxes.
type LayoutCurve ¶
type LayoutCurve = driver.LayoutCurve
LayoutCurve is how a layout change progresses.
type LayoutDirection ¶
type LayoutDirection uint8
LayoutDirection is the direction a node's content flows in.
const ( DirectionLTR LayoutDirection = iota + 1 DirectionRTL )
type LayoutProperty ¶
type LayoutProperty = driver.LayoutProperty
LayoutProperty is what appearing and disappearing views animate.
type LayoutTransition ¶
type LayoutTransition = driver.LayoutTransition
LayoutTransition is how one kind of change animates.
type Length ¶
Length is a style's length.
type LineLayout ¶
type LineLayout interface {
TextLines() []TextLine
}
LineLayout is a TextLayout that reports its lines. The core asks it only when the text has an OnTextLayout handler, on the engine side, before the layout goes to the main thread; the core fills Text in.
type List ¶
type List struct {
Count func() int
// Key returns row i's identity, a comparable value such as an ID.
// With it, rows that stay keep their cells and sizes as rows come and
// go, and rows inserted or removed above the viewport keep the
// visible rows in place.
Key func(i int) any
// Row builds a cell's content; row says which row it shows.
Row func(cx *Scope, row ListRow) Node
// EstimatedSize is a row's expected size along the list; 50 when 0.
EstimatedSize Points
// NumColumns lays that many rows side by side across the list, each
// line of rows as long as its longest.
NumColumns int
Horizontal bool
HideIndicator bool
// Bar draws its scroll bar, over the app's (Scope.SetScrollbars).
Bar ScrollbarMaker
// Inverted puts row 0 at the end (a chat): the list starts scrolled
// to the end and keeps its distance from it as content changes. With
// OnLoadMoreAtStart it does so only while row 0 shows; scrolled away,
// rows arriving at row 0's end keep the visible rows in place.
Inverted bool
// Alignment is where the list rests: at its start, or with
// ListAlignEnd at its end, as a chat without inverting its rows: it
// opens there before its first frame, keeps there as rows come,
// measure or shrink, stops following while scrolled away and follows
// again once back, and holds content shorter than its viewport at its
// end. An inverted list, or one in its parent's viewport, ignores it.
Alignment ListAlignment
// MaintainVisibleContentPosition, when set, follows the end of a list
// that is not inverted while it is within AutoscrollToBottomThreshold
// of it, as content grows or the viewport shrinks.
MaintainVisibleContentPosition *VisibleContentPosition
// Gap separates rows, ColumnGap columns; the style's padding is the
// content's.
Gap Points
ColumnGap Points
Header Node
// Empty shows while Count is 0.
Empty Node
// Separator builds what goes after each row but the last (before it
// in an inverted list), in the row's cell.
Separator func(cx *Scope) Node
// StickyHeaderIndices stick those rows to the viewport's start, at
// StickyHeaderOffset from it, while scrolled past, until the next one
// pushes them out; one column, not inverted. The platform pins them on
// every scroll.
StickyHeaderIndices []int
StickyHeaderIndicesFunc func() []int
StickyHeaderOffset Points
// StickyHeaderOffsetValue, when set, is the animated value the
// headers' offset follows in place of StickyHeaderOffset, as a header
// above the list hides and shows.
StickyHeaderOffsetValue AnimatedNode
// InitialScrollIndex is the row the list starts scrolled to.
InitialScrollIndex int
// OnViewableItemsChange receives the viewable rows when they change,
// by ViewabilityConfig's rules.
OnViewableItemsChange func(ViewableItems)
ViewabilityConfig ViewabilityConfig
// OnLoadMore runs when the viewport comes within LoadMoreThreshold
// viewports of the content's end (1 when 0), once per count: also as
// the list opens, so a first page shorter than that asks for the next.
OnLoadMore func()
LoadMoreThreshold float32
// OnLoadMoreAtStart is its counterpart at item 0's end, for a list
// opened at an old item that loads what comes before it, within
// LoadMoreAtStartThreshold viewports (1 when 0). It runs once per
// approach: again after the viewport left that zone, or when the count
// changed while it stayed there, and never before the user or a
// scroll command moved the list.
OnLoadMoreAtStart func()
LoadMoreAtStartThreshold float32
// Viewport is what the list scrolls in: a scroll view of its own, or
// with ListViewportParent the nearest scroll view around it on its
// axis (or its screen, modal or overlay), which scrolls it with what
// else it holds. Fixed when the list mounts.
Viewport ListViewport
// Behavior, ContentOffset, the scroll events, OnRefresh,
// Refreshing, PullValue and OffsetValues are Scroll's, for the list's
// scroll view. In its parent's viewport they are ignored, as are Inverted
// and MaintainVisibleContentPosition.
Behavior ScrollBehavior
BehaviorFunc func() ScrollBehavior
ContentOffset Point
OnScroll func(ScrollEvent)
ScrollEventThrottle time.Duration
OnScrollDragStart func(ScrollEvent)
OnScrollDragEnd func(ScrollEvent)
OnMomentumStart func(ScrollEvent)
OnMomentumEnd func(ScrollEvent)
// OnScrollEnd hears the list come to rest, as Scroll's.
OnScrollEnd func(ScrollEvent)
OnRefresh func()
Refreshing func() bool
PullValue *AnimatedValue
OffsetValues AnimatedXY
OnLayout func(Bounds)
// Class is Tailwind CSS classes, as View's; its padding, as the
// style's, is the content's.
Class string
Style Style
StyleFunc func() Style
Ref *Ref
TestID string
}
List renders a long run of rows lazily, as NSH's <List>: only the rows within a viewport of the visible ones are mounted, each in a cell that is reused for another row when it scrolls away. A cell's content is built once; its ListRow changes, so the content's bindings update instead of it being rebuilt. Row sizes start as an estimate and are corrected as rows are laid out, so offsets, columns, sticky rows and viewability are all decided in the core.
Every scroll view prop of Scroll a list takes (Behavior, the scroll events, refreshing, OffsetValues) applies to its scroll view. Keep a row's state in the app's data, keyed by Key, not in the row's scope, which moves to other rows.
type ListAlignment ¶
type ListAlignment uint8
ListAlignment is where a List rests.
const ( ListAlignStart ListAlignment = iota ListAlignEnd )
type ListPosition ¶
ListPosition is where a list's viewport starts among its rows: the row it starts in, from the side row 0 is on, and how far past that row's start, as GPUI's ListOffset.
type ListRow ¶
type ListRow struct {
// contains filtered or unexported fields
}
ListRow is the row a list cell shows, as signals, so content reading it follows the cell to its next row.
type ListViewport ¶
type ListViewport uint8
ListViewport is what a list scrolls in.
const ( // ListViewportOwn is a scroll view of the list's own. ListViewportOwn ListViewport = iota // ListViewportParent lays the list out at its full length in its // parent and renders the rows near the viewport of the scroll view // around it. ListViewportParent )
type LiveRegion ¶
type LiveRegion = driver.LiveRegion
LiveRegion says how screen readers announce changes of a view's label and text (accessibilityLiveRegion).
type LocalService ¶
type LocalService driver.LocalService
LocalService is a DNS-SD instance. Name, Type, Port and TXT describe an advertisement. A discovered instance also has its DNS hostname or IP address in Host.
type LocaleSettings ¶
type LocaleSettings = driver.LocaleSettings
LocaleSettings are the user's regional preferences: Env.LocaleSettings.
type LocationFix ¶ added in v0.2.0
type LocationFix = driver.LocationFix
LocationFix is a WGS 84 fix, with optional measurements and provider times.
type LocationOptions ¶ added in v0.2.0
type LocationOptions = driver.LocationOptions
LocationOptions chooses accuracy, distance, caching and background policy.
type LowPowerMode ¶
type LowPowerMode = driver.LowPowerMode
LowPowerMode is the system's energy-saving setting.
type ManualClock ¶
type ManualClock struct {
// contains filtered or unexported fields
}
ManualClock moves only when Advance is called. It is safe for concurrent use.
func NewManualClock ¶
func NewManualClock(start time.Time) *ManualClock
NewManualClock returns a clock reading start.
func (*ManualClock) Advance ¶
func (c *ManualClock) Advance(d time.Duration)
Advance moves the clock by d, calling the timers that come due on the way in order, each at its own time.
func (*ManualClock) AfterFunc ¶
func (c *ManualClock) AfterFunc(d time.Duration, f func()) func() bool
func (*ManualClock) Jump ¶
func (c *ManualClock) Jump(d time.Duration)
Jump moves the clock ahead by d at once, as a machine waking from sleep: each timer due by then runs once, in order, at the end; timers those set run on later moves.
func (*ManualClock) Now ¶
func (c *ManualClock) Now() time.Time
func (*ManualClock) SetWallTime ¶
func (c *ManualClock) SetWallTime(t time.Time)
SetWallTime sets the wall time the app reads (Scope.WallTime, a TSX app's Date) to t, in t's location, moving no timer: the clock's own time goes on.
func (*ManualClock) WallTime ¶
func (c *ManualClock) WallTime() time.Time
WallTime is the wall time the app reads: Now, unless SetWallTime set it apart, in the location of the time it was given.
type MediaCommand ¶
type MediaCommand = driver.MediaCommand
MediaCommand is a request from a system media control. Position is the requested playback time for MediaSeek.
type MediaCommandKind ¶
type MediaCommandKind = driver.MediaCommandKind
MediaCommandKind identifies a system media control.
type MediaError ¶
type MediaError struct {
Message string
Reason MediaErrorReason
}
MediaError is a video that failed to open or play. Message is the platform's words; Reason says why for the failures an app can act on.
func (*MediaError) Error ¶
func (e *MediaError) Error() string
type MediaErrorReason ¶ added in v0.2.0
type MediaErrorReason uint8
MediaErrorReason says why a video failed (MediaError.Reason).
const ( // MediaErrorOther is any failure without a reason of its own: a missing file, a network error, a codec the platform lacks. MediaErrorOther MediaErrorReason = iota // MediaErrorAlphaUnsupported is a local file that declares an alpha channel the platform's player cannot keep, so it did not play rather than show an opaque picture; an app can decode such a clip itself and draw its frames with their alpha. MediaErrorAlphaUnsupported )
func (MediaErrorReason) String ¶ added in v0.2.0
func (r MediaErrorReason) String() string
String names a media error reason for logs and diagnostics.
type Memo ¶
type Memo[T any] struct { // contains filtered or unexported fields }
Memo caches a computed value and notifies its readers only when the value changes.
func NewMemo ¶
func NewMemo[T comparable](cx *Scope, fn func() T) *Memo[T]
NewMemo returns a memo of fn, computed now and again when what fn read changes.
func NewMemoFunc ¶
NewMemoFunc returns a memo that compares values with equal; with a nil equal every computation notifies.
func (*Memo[T]) Get ¶
func (m *Memo[T]) Get() T
Get returns the value, recomputing it first if needed, and subscribes the running computation to it.
func (*Memo[T]) GetUntracked ¶
func (m *Memo[T]) GetUntracked() T
GetUntracked returns the up-to-date value without subscribing.
type MemorySecrets ¶ added in v0.2.0
type MemorySecrets = driver.MemorySecrets
SecretItem names a secret in the platform's secure store, SecretStore is where a platform keeps secrets (RootOptions.Secrets), and MemorySecrets is one in memory, which tests keep theirs in (nsgotest.App.Secrets).
type MenuBarMode ¶
type MenuBarMode = driver.MenuBarMode
MenuBarMode says when Windows and Linux show the menu bar.
type MenuIcon ¶
MenuIcon is core's part of desktop.MenuIcon, an icon shown beside a native menu item on macOS, Windows and Linux.
type MenuItem ¶
type MenuItem struct {
Label string
// Icon is an optional icon shown beside the item in native menus on macOS, Windows and Linux.
Icon MenuIcon
// Shortcut is in OnKey's form, such as "mod+n".
Shortcut string
Role MenuRole
Disabled bool
Checkable bool
Checked bool
// Radio makes the item checkable and shows it as one of a group of choices, a radio on Windows and Linux; the app still says which item is Checked.
Radio bool
Separator bool
Items []MenuItem
// When says whether the shortcut chooses the item while a text input
// or a web view has the keyboard focus.
When MenuWhen
// OnSelect runs when the item is chosen, by a click or its shortcut. An editing Role (MenuUndo through MenuSelectAll, MenuPasteAndMatchStyle and MenuDelete) goes to the focused field or web view first, and Copy and Select All to selected text, so OnSelect runs when none of them takes it: Select All selecting the app's own items, as Finder's does. For every other Role, OnSelect replaces the standard role action, so an item with MenuQuit or MenuMinimize and OnSelect runs the callback without quitting or minimizing.
OnSelect func()
}
MenuItem is one item of a menu: an action, a submenu when it has Items, or a line between groups when Separator. Apps name it desktop.MenuItem.
type MenuRole ¶
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.
type MenuWhen ¶
type MenuWhen uint8
MenuWhen says when a menu item's shortcut chooses it while a text input or a web view has the keyboard focus.
type MiniProgramCredential ¶
type MiniProgramCredential struct {
Platform MiniProgramPlatform
Code string
}
MiniProgramCredential is a short-lived login code for the app's server to exchange through Platform's API. It is not a verified identity or an access token.
type MiniProgramPlatform ¶
type MiniProgramPlatform string
MiniProgramPlatform names the host that issued a MiniProgramCredential.
const ( MiniProgramWeChat MiniProgramPlatform = "wechat" MiniProgramQQ MiniProgramPlatform = "qq" MiniProgramAlipay MiniProgramPlatform = "alipay" MiniProgramDouyin MiniProgramPlatform = "douyin" )
type MiniProgramSignInError ¶
type MiniProgramSignInError string
MiniProgramSignInError is why a mini program returned no login code.
const ( MiniProgramSignInCancelled MiniProgramSignInError = "cancelled" MiniProgramSignInFailed MiniProgramSignInError = "failed" // MiniProgramSignInNotSignedIn means Douyin returned only an anonymous // device code. It does not identify a signed-in user. MiniProgramSignInNotSignedIn MiniProgramSignInError = "notSignedIn" )
func (MiniProgramSignInError) Error ¶
func (e MiniProgramSignInError) Error() string
type MiniProgramSignInOptions ¶
type MiniProgramSignInOptions struct {
// Prompt permits Douyin to show its host-account login when not signed in.
// False asks silently. WeChat, QQ and Alipay use their basic login APIs.
Prompt bool
}
MiniProgramSignInOptions configure SignInMiniProgram.
type Modal ¶
type Modal struct {
Animation ModalAnimation
// TransitionShader, when set, is how it comes and goes instead,
// where the platform draws it.
TransitionShader *TransitionShader
// Presentation is how it covers the screen on iOS; other platforms
// ignore it and cover the host.
Presentation ModalPresentation
// NoCloseOnSwipe keeps an iOS sheet from being swiped away; the swipe
// still asks to close it ("swipe"). NoCloseOnEscape and
// NoCloseOnBackdropPress say a dialog over it stays on those, which
// its component decides (base.Dialog).
NoCloseOnSwipe bool
NoCloseOnEscape, NoCloseOnBackdropPress bool
// IOS and Android hold the props only iOS, or only Android, has.
IOS IOSModalProps
Android AndroidModalProps
// StatusBar is set over the app's status bar while the modal is in
// the tree.
StatusBar StatusBarSetting
StatusBarFunc func() StatusBarSetting
// Class is Tailwind CSS classes, as View's.
Class string
Style Style
StyleFunc func() Style
Children []Node
// OnRequestClose receives Escape or back ("cancel") while the modal is the topmost, and an iOS sheet's swipe ("swipe"); the app decides whether to remove it, except that back takes a confined owner's away regardless (Scope.Confine). A sheet swiped away has left the screen already and stays hidden until the app removes it.
OnRequestClose func(reason string)
// OnShown and OnDismissed receive the platform's reports that it finished presenting the modal and taking it away (EventModalShown, EventModalDismissed). A removed modal whose platform has not reported it gone a second after its animation gets OnDismissed from the core instead, once.
OnShown, OnDismissed func()
Role Role
Label string
LabelFunc func() string
TestID string
}
Modal covers its host, the surface or an outer modal, with a layer of its own laid out at the host's size: the core's part of base.Dialog, which apps use. Mounting it presents it, and removing it dismisses it. A confined owner's mounts only as Scope.Confine allows, else nothing shows.
type ModalAnimation ¶
type ModalAnimation = driver.ModalAnimation
ModalAnimation is how a modal appears.
type ModalPresentation ¶
type ModalPresentation = driver.ModalPresentation
ModalPresentation is how a modal covers the screen on iOS.
type Motion ¶
type Motion struct {
// contains filtered or unexported fields
}
Motion moves a view's opacity and transform through MotionSpecs: bind its Style, then Play. It has no look of its own: it only moves what the app styled.
func NewMotion ¶
func NewMotion(cx *Scope, enter *MotionSpec) *Motion
NewMotion returns a motion with every channel at rest, or where enter starts, which it then plays: an entrance shows its first frame, never the view at rest. The motion's values go with the current owner.
func (*Motion) Animation ¶
func (m *Motion) Animation(spec MotionSpec, reduced bool) *Animation
Animation returns spec as an animation of the motion's values, not started, to compose: Parallel over its tracks. With reduced, each channel lands where it ends at once.
func (*Motion) Exit ¶
func (m *Motion) Exit(spec MotionSpec)
Exit plays spec as the motion's view leaves the Presence branch it is in (Scope.OnExit), which keeps the view until spec ends: a sheet or a toast built with an exit leaves with it, whatever removes it.
func (*Motion) Play ¶
func (m *Motion) Play(spec MotionSpec, done func(finished bool)) *AnimationRun
Play runs spec on the motion's values, landing where it ends at once when the user asked for reduced motion, and calls done as StartAnimation does.
func (*Motion) Style ¶
func (m *Motion) Style() *AnimatedStyle
Style returns what binds the motion to a view: its Style.Animated.
func (*Motion) Value ¶
func (m *Motion) Value(c MotionChannel) *AnimatedValue
Value returns the value of channel c, to derive other nodes from.
type MotionChannel ¶
type MotionChannel uint8
MotionChannel is what a motion moves: the opacity of a view and the parts of its transform.
const ( MotionOpacity MotionChannel = iota MotionTranslateX MotionTranslateY MotionRotate MotionRotateX MotionRotateY MotionScale MotionScaleX MotionScaleY )
type MotionKind ¶
type MotionKind uint8
MotionKind is what a preset is for.
const ( // MotionEnter brings a view in: it starts hidden or away and ends at // rest. MotionEnter MotionKind = iota // MotionExit takes a view out: it starts at rest and ends hidden or // away. MotionExit // MotionAttention draws the eye: it starts and ends at rest. MotionAttention // MotionLoop repeats until stopped. MotionLoop )
type MotionOptions ¶ added in v0.2.0
type MotionOptions = driver.MotionOptions
MotionOptions chooses a sensor set and sample interval.
type MotionPreset ¶
type MotionPreset uint8
MotionPreset is a ready-made motion, as NSH's: entrances, exits, attention seekers and loops. Distances are in points, sized for controls and cards.
const ( FadeIn MotionPreset = iota FadeInUp FadeInDown FadeInLeft FadeInRight ZoomIn PopIn BounceIn SlideInUp SlideInDown FlipInX FlipInY FadeOut FadeOutUp FadeOutDown FadeOutLeft FadeOutRight ZoomOut PopOut SlideOutDown SlideOutUp Shake HeadShake Wiggle Swing Pulse Heartbeat RubberBand Jello Tada Jump Flash Spin Float Breathe Sway Bob Glow )
func MotionPresets ¶
func MotionPresets() []MotionPreset
MotionPresets lists every preset, in order.
func (MotionPreset) Kind ¶
func (p MotionPreset) Kind() MotionKind
Kind returns what the preset is for.
func (MotionPreset) Name ¶
func (p MotionPreset) Name() string
Name returns the preset's name, as NSH's JS names it: "fadeIn", "shake".
func (MotionPreset) Spec ¶
func (p MotionPreset) Spec() MotionSpec
Spec returns the preset's motion, to play or change.
type MotionSample ¶ added in v0.2.0
type MotionSample = driver.MotionSample
MotionSample is one sensor's latest sample and its dropped-sample count.
type MotionSensors ¶ added in v0.2.0
type MotionSensors = driver.MotionSensors
MotionSensors is a set of raw and fused device sensors.
type MotionSpec ¶
type MotionSpec struct {
Tracks []MotionTrack
Timing KeyframeTiming
}
MotionSpec is several channels of a view through keyframes with one timing: a preset's (MotionPreset.Spec) or the app's own.
type MotionTrack ¶
type MotionTrack struct {
Channel MotionChannel
Stops []KeyframeStop
}
MotionTrack is a channel through keyframe stops.
type MouseButton ¶
type MouseButton = driver.MouseButton
MouseButton is a button of the mouse held in a MouseEvent.
func MouseButtonsDown ¶
func MouseButtonsDown(cx *Scope) []MouseButton
MouseButtonsDown returns the mouse buttons currently held on cx's window, in button order (Left, Right, Middle, Back, Forward). It is a tracked read, so what reads it renders again as a button goes down or comes up, and a RequestAnimationFrame callback, which runs untracked, reads the same buttons, as a game's frame loop polls them. A button still held as the window loses focus comes up then.
The first read on a window asks its platform for every mouse button press and release, not only those on a view with OnMouseDown or OnMouseUp, and that stays on for the life of the window; a button already held then is unknown until it is pressed again. macOS, Windows, Linux and the web report them; mobile targets do not, so none is ever held there.
type MouseButtonEvent ¶
type MouseButtonEvent struct {
// Position is in the view, its transforms undone.
Position Point
// PagePosition is in the root view the view is in: the surface, or
// its modal.
PagePosition Point
// Modifiers are the modifier keys held.
Modifiers Modifiers
// Button is the mouse button that went down or came up.
Button MouseButton
// Clicks counts consecutive clicks of the button at the same place:
// 1 for a click, 2 for a double click, and 0 when a held button is
// released because the window lost focus.
Clicks int
}
MouseButtonEvent is a mouse button going down on a view (View.OnMouseDown) or coming up after going down there (View.OnMouseUp).
type MouseEvent ¶
type MouseEvent struct {
Position Point
PagePosition Point
Modifiers Modifiers
// PressedButton is the button held down, none as the mouse hovers.
PressedButton MouseButton
}
MouseEvent is where the mouse is over a view, as GPUI's MouseMoveEvent says, or was last when it leaves.
type Native ¶
type Native struct {
// Component is the registered name.
Component string
// Props are the component's own props; PropsFunc, when set, replaces
// them, again when what it reads changes. A prop that goes away is
// set to nil. Values cross to Android as JSON. A prop whose value is
// an AnimatedNode is bound to it instead: the platform's frame clock
// hands the component its number or color on the frames it changes,
// with no work for the engine (driver.AnimatedPropSetter).
Props map[string]any
PropsFunc func() map[string]any
Style Style
StyleFunc func() Style
// OnEvent receives what the component emits.
OnEvent func(name string, data any)
OnPress func(PressEvent)
OnLayout func(Bounds)
Ref *Ref
Label string
LabelFunc func() string
LabelledBy []*Ref
Invalid func() bool
TestID string
}
Native shows a view of a component the app registered with its platform by name (nsgo.Component), filling the element's box. Props reach the component's SetProp when they change, events it emits reach OnEvent, and Ref.Command runs its commands. An unknown name shows an empty box.
type NativeComponent ¶
type NativeComponent = driver.NativeComponent
NativeComponent is one Native element's platform view.
type NativeComponents ¶
type NativeComponents = driver.NativeComponents
NativeComponents are the components an app registers with its platform, by name.
type NativeContext ¶
type NativeContext = driver.NativeContext
NativeContext is how a component talks back to its element.
type NativeFactory ¶
type NativeFactory = driver.NativeFactory
NativeFactory makes a component's view for one Native element, on the platform's main thread; nil leaves the box empty.
type Network ¶
Network is the device's connectivity as the system reports it. Online describes the network route and cannot predict whether a server will answer.
type Node ¶
Node is what a tree is made of: a host element (View, Text, Input, Scroll), a region (Group, Dynamic, Show, Each, Catch) or a component.
A component is any type whose Render returns its nodes; its fields are its props. Render runs once, under a scope of the component's own, and signals keep what it returned up to date. Host elements and regions return themselves.
func AfterEachRow ¶ added in v0.2.0
AfterEachRow returns a copy of node, an Each, that builds after's node after each of its rows, from the node the row built and under the row's scope, so it moves and goes with its row. For any other node it returns node and false. ui.FormSection hangs a hairline below each row of an Each with it.
func Each ¶
func Each[T any, K comparable](items func() []T, key func(T) K, row func(cx *Scope, item func() T, index func() int) Node) Node
Each builds a row per item, matched to items by key: a row whose key stays is kept and moved, its item and index updated; rows are built for new keys and disposed for keys gone. An item of plain values (numbers, strings, and arrays and structs of them) updates its row only when it changes; any other item, which may point at what changed, every time the items are read again. Go methods cannot take type parameters, so Each is a function.
type Notification ¶
type Notification struct {
// ID is the app's name for it: showing another with the same ID replaces it, shown or still to show, CloseNotification removes it and a press reports it. Keep in it what the press opens ("chat:42"), as a press can start the app anew.
ID string
// Title and Body are its text.
Title, Body string
// Silent shows it without the system's sound or vibration.
Silent bool
// At, when later than now (Scope.WallTime), schedules it to show then, where Env.CanScheduleNotifications says the platform does (whether the app runs or not on macOS, iOS, watchOS, Android and Windows, and while the app or page runs on Linux and the web); zero or earlier shows it at once.
At time.Time
// Repeat shows it again and again, at At's time of day, its clock reading in At's location, which the device keeps to in its own time zone, and for NotificationWeekly on At's weekday: first at the next such time after now, whatever At's date. It needs At.
Repeat NotificationRepeat
}
Notification is a system notification (ShowNotification).
type NotificationPermission ¶
type NotificationPermission uint8
NotificationPermission is whether the app may show notifications.
const ( // NotificationsNotAsked is the user not asked yet: // RequestNotificationPermission shows the system's prompt. NotificationsNotAsked NotificationPermission = iota // NotificationsGranted lets the app show them. NotificationsGranted // NotificationsDenied keeps the app from showing them; only the // system's settings change it. NotificationsDenied // such as a macOS app run outside its bundle, or code its Access does // not grant AccessNotifications. NotificationsUnavailable )
func (NotificationPermission) String ¶
func (p NotificationPermission) String() string
String returns NSH's name of p: "default", "granted", "denied" or "unavailable".
type NotificationRepeat ¶ added in v0.2.0
type NotificationRepeat uint8
NotificationRepeat is how often a scheduled notification shows (Notification.Repeat).
const ( // NotificationOnce shows it once. NotificationOnce NotificationRepeat = iota // NotificationDaily shows it every day at At's time of day. NotificationDaily // NotificationWeekly shows it every week on At's weekday at its time of day. NotificationWeekly )
type NowPlaying ¶
type NowPlaying = driver.NowPlaying
NowPlaying describes the app's current media for system controls. Duration is zero for a live stream. Position is measured when SetNowPlaying is called. Rate is zero while paused and one at normal speed. Commands lists the controls to offer. Artwork is optional.
type ObjectPosition ¶
type ObjectPosition = driver.ObjectPosition
ObjectPosition is where an image sits in its view once its ResizeMode has sized it, as CSS's object-position places it.
func ParseObjectPosition ¶
func ParseObjectPosition(s string) (ObjectPosition, error)
ParseObjectPosition reads CSS's <position>: one value, two, or four (edges with offsets).
type Obstruction ¶
type Obstruction = driver.Obstruction
Obstruction is a fold or a hinge on a surface.
type OfferPaymentMode ¶ added in v0.2.0
type OfferPaymentMode = driver.OfferPaymentMode
OfferPaymentMode is how an offer is paid: OfferFreeTrial, OfferPayAsYouGo or OfferPayUpFront.
type OffscreenCanvas ¶
type OffscreenCanvas = driver.OffscreenCanvas
OffscreenCanvas is a recorded 2D drawing snapshot attached to an ImageSource by OffscreenImage.Source.
type OffscreenImage ¶
type OffscreenImage struct {
// contains filtered or unexported fields
}
OffscreenImage is a retained 2D drawing that platforms render once into an offscreen image surface and reuse across later frames without re-executing its drawing operations.
Source returns an ImageSource directly usable in Drawing.DrawImage, Drawing.DrawImageIn, Drawing.DrawImageFrom, Drawing.DrawAtlas, and Image. The offscreen drawing is recorded lazily on first use and re-recorded only when Invalidate or Resize is called (or when newly registered fonts become available). Call Release to drop the cached surface early; it is also released automatically when the scope that created it is disposed.
func (*OffscreenImage) ID ¶
func (o *OffscreenImage) ID() uint64
ID returns the unique identifier of this offscreen image resource.
func (*OffscreenImage) Invalidate ¶
func (o *OffscreenImage) Invalidate()
Invalidate marks the offscreen image dirty so its drawing is re-recorded and re-rendered on the next frame that uses it. Multiple invalidations before the next commit coalesce into one re-render.
func (*OffscreenImage) Release ¶
func (o *OffscreenImage) Release()
Release frees the offscreen image and instructs the platform to drop its cached surface. Calling Release more than once is safe.
func (*OffscreenImage) Released ¶
func (o *OffscreenImage) Released() bool
Released reports whether Release has been called (directly or through scope disposal).
func (*OffscreenImage) Resize ¶
func (o *OffscreenImage) Resize(size Size, scale float64)
Resize changes the logical size and backing scale (pixels per point; <= 0 defaults to the display pixel ratio or 1) and marks the offscreen image dirty when either changes.
func (*OffscreenImage) Scale ¶
func (o *OffscreenImage) Scale() float64
Scale returns the backing pixel scale (pixels per point).
func (*OffscreenImage) Size ¶
func (o *OffscreenImage) Size() Size
Size returns the logical size of the offscreen image in points.
func (*OffscreenImage) Source ¶
func (o *OffscreenImage) Source() ImageSource
Source returns an ImageSource representing this offscreen image. Reading Source inside a Canvas.Draw or Image.SourceFunc subscribes that view to Invalidate, Resize, and Release. While clean, repeated calls return the same snapshot without re-running the draw callback.
func (*OffscreenImage) Version ¶
func (o *OffscreenImage) Version() uint64
Version returns the version of the most recently recorded snapshot, or 0 before Source has recorded the drawing.
type Opacity ¶
type Opacity struct {
// contains filtered or unexported fields
}
Opacity is a node's opacity from 0 to 1. Its zero value is unset, which is opaque; make one with Alpha.
type Orientation ¶
type Orientation = driver.Orientation
Orientation is a set of interface orientations.
type Overlay ¶
type Overlay struct {
Anchor *Ref
// AnchorContent places it against the box around what Anchor holds
// rather than Anchor's own: a popup's trigger, a view its column
// stretches around the app's element.
AnchorContent bool
// AnchorBounds, when set and Anchor is not, places the overlay beside
// the bounds it returns in the surface, again when they change: an
// input's caret (CaretEvent.PageBounds), or a point.
AnchorBounds func() Bounds
Placement Placement
// Align places the overlay along the anchor's side; centered when 0.
Align Align
// Offset is the gap to the anchor; Margin keeps the overlay off the
// edges of its host.
Offset, Margin Points
// Cover, while CoverShown holds, names a view inside the overlay to
// lay over the anchor, a select's selected row over its trigger: the
// overlay starts where the anchor does, the view centered on it, then
// moves to stay in its host. Its frame in the overlay is kept while
// the overlay keeps its size and the view its place in its parent, so
// the overlay stays put while its rows scroll. Without the view it
// goes on its side as usual.
Cover *Ref
CoverShown func() bool
// Class is Tailwind CSS classes, as View's.
Class string
ClassFunc func() string
Style Style
StyleFunc func() Style
Children []Node
// PointerEvents says which of the overlay and its children take
// touches and the pointer: None for a tooltip, BoxNone for a layer
// that passes presses through around its content.
PointerEvents PointerEvents
// OnPressOutside receives presses outside the overlay and its anchor.
OnPressOutside func(at Point)
// OnCancel receives Escape or back while it is the topmost overlay
// that listens.
OnCancel func()
// OnMouseEnter and OnMouseLeave are View's.
OnMouseEnter, OnMouseLeave func(MouseEvent)
// OnPosition reports where an anchored overlay went, again when it
// moves or its room changes.
OnPosition func(OverlayPosition)
// HoldToRoom keeps an anchored overlay no taller than the room on the
// side it goes, which the core picks at the overlay's natural height:
// the side where it fits whole, else the one with more room. What it
// holds scrolls past that, as a menu's items do.
HoldToRoom bool
// Topmost keeps the overlay above the other overlays and modals its host holds, those shown after it too: a developer's layer over the app, as DevTools' overlay (UpdateHighlights). Topmost overlays stay in the order they came in, and the root view's that listen for cancel hear Escape and back before its modals do.
Topmost bool
// OnTransitionEnd is View's.
OnTransitionEnd func()
// Ref names the overlay's view: its bounds.
Ref *Ref
Role Role
Label string
LabelFunc func() string
TestID string
}
Overlay floats its children above everything in the nearest Modal or the surface, or a confined owner's in its frame when that is nearer (Scope.Confine), outside the flow: placed beside Anchor on Placement, or by its style's Top, Right, Bottom and Left without one. It never closes itself; the app removes it.
type OverlayEnd ¶
type OverlayEnd uint8
OverlayEnd is why the platform closed an overlay itself, which OverlayOptions.OnEnd hears.
const ( // OverlayEndDenied is an overlay opened without the permission: no window showed. OverlayEndDenied OverlayEnd = iota + 1 OverlayEndUnavailable // OverlayEndRevoked is the user taking the permission away while it showed. OverlayEndRevoked // OverlayEndRemoved is the system or the user stopping the service that kept it. OverlayEndRemoved // OverlayEndFailed is the platform failing to show it or to start its service, as Android refuses a foreground service it does not allow. OverlayEndFailed )
func (OverlayEnd) String ¶
func (e OverlayEnd) String() string
String returns "denied", "unavailable", "revoked", "removed" or "failed".
type OverlayOptions ¶
type OverlayOptions struct {
// Width and Height are the content's size in points; 320 by 180 when either is zero.
Width, Height Points
// Frame, when it moves, opens the overlay there at its size instead of centered. The platform keeps every frame on the screen's usable area and reports the one it applied in the overlay's Env.WindowFrame; its content moves and resizes it with SetWindowFrame, as desktop.SetWindowFrame does a window.
Frame WindowFrame
// Hidden opens it without showing it, for Window.Show.
Hidden bool
// Focusable lets it take the focus, which text input needs; by default it takes touches and the keys stay with the app in front.
Focusable bool
// Passive lets every touch through to the apps below it, at most at the window opacity Android lets touches pass through (0.8 by default); it takes none and never the focus.
Passive bool
// Accessible shows its content to screen readers, which it is hidden from by default.
Accessible bool
// OnEnd hears, once, that the platform closed the overlay itself and why, as the overlay's owner hears it; Window.Close and its owner going do not call it.
OnEnd func(OverlayEnd)
}
OverlayOptions are an overlay's: the core's part of mobile.OverlayOptions, which apps use.
type OverlayPermission ¶
type OverlayPermission uint8
OverlayPermission is whether the app may show windows over other apps, Android's special access to draw over them: the core's part of mobile.OverlayPermission's answer, in NotificationPermission's words without its not asked, as the special access has no such state.
const ( // OverlayDenied keeps the app from showing overlays until the user grants it in the system's settings (RequestOverlayPermission). OverlayDenied OverlayPermission = iota // OverlayGranted lets the app show them. OverlayGranted OverlayUnavailable )
func (OverlayPermission) String ¶
func (p OverlayPermission) String() string
String returns "denied", "granted" or "unavailable".
type OverlayPosition ¶
OverlayPosition is where an anchored overlay went: the side of its anchor, its frame in its host and the room on that side inside the safe area less its margin, what a menu may grow to.
type Paint ¶
Paint is what 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 = driver.PaintStyle
PaintStyle is the SVG paint properties a canvas view inherits.
type Palette ¶
type Palette struct {
// Background is the page; Surface a card or control on it, under
// the pointer and held down.
Background, Surface, SurfaceHover, SurfacePressed Color
Border Color
Text, TextMuted Color
// Accent is the accent fill, AccentText what is drawn on it.
Accent, AccentHover, AccentPressed, AccentText Color
Danger, Warning, Success Color
// Selection is selected text's, Focus a focus ring's and Scrollbar a
// scroll indicator's.
Selection, Focus, Scrollbar Color
// Colors are roles by name past the ones above, such as "inset".
Colors map[string]Color
}
Palette is a theme's colors in one appearance. Its roles are NSGo's; Colors holds the ones a component library or an app adds, by name.
func (*Palette) Color ¶
Color returns the role named name: a field's name in lower camel case ("surfaceHover") or one of Colors, and whether the palette has it.
func (*Palette) ColorNames ¶
ColorNames are the names Color takes: the roles' and Colors', sorted.
type PanActivation ¶
type PanActivation = driver.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.
type PanEvent ¶
type PanEvent struct {
Phase GesturePhase
Translation Point
Velocity Point
// Position is the finger's point in the view; PagePosition is that point
// in the view's page. Both are reported for every phase.
Position, PagePosition Point
// Values are the PanValues as the pan begins and ends: a drag may grab
// them mid animation, which a snap after it starts from.
Values Point
}
PanEvent is a drag: its translation since it began and its velocity, in points and points per second.
type PanGesture ¶
type PanGesture struct {
// Position is the centroid in the surface, Origin where it was as the
// gesture began, and Delta how far it moved since.
Position, Origin, Delta Point
// Velocity is the centroid's, in points per second, smoothed over a
// few moves.
Velocity Point
// Touches counts the fingers down.
Touches int
// contains filtered or unexported fields
}
PanGesture follows the centroid of the fingers down, since the first went down or since the responder was granted.
type PanelDock ¶
type PanelDock struct {
// Edge is PlaceTop, PlaceBottom, PlaceLeft or PlaceRight; PlaceDefault disables docking.
Edge Placement
// Display is an Env.Displays ID, empty for the primary display. A missing explicit display is reported to Window.OnPlacementError.
Display string
// Margin is the distance from the usable edge in points; negative or nonfinite values become zero.
Margin Points
}
PanelDock is the core's part of desktop.PanelDock, which apps use to keep a panel centered along a display's usable edge. Its zero value is undocked.
type PanelOptions ¶
type PanelOptions struct {
// Width and Height are the content's size in points, 360 by 420 when either is zero; with FitContent, its largest.
Width, Height Points
// FitContent sizes the panel to its content, as an overlay sizes, up to Width and Height: before it first shows, and again as the content grows or shrinks, keeping the edge it is placed by, the side of what ShowAt placed it beside, the top under a tray icon or elsewhere.
FitContent bool
// Transparent has the panel draw nothing of its own: no background, no system frame and no shadow, so only what the content draws shows, its own corners and BoxShadow inside the panel's bounds. Env.WindowTransparent, read in the panel, reports whether the platform could; where it could not, as Linux without a compositor, the panel keeps its background.
Transparent bool
// HideOnBlur hides the panel as it loses the focus, as a tray icon's
// panel or a launcher does.
HideOnBlur bool
// NoActivate keeps the panel from ever taking the keyboard or activating the app, shown, focused or clicked, so the app the user types in keeps its focus and caret, as an input method's candidate window or an on-screen keyboard needs. Focus and Toggle then only bring it to the front, and HideOnBlur never hides it, as it never has the focus to lose. Linux supports this on X11 and on a Wayland panel with Dock and layer-shell; an ordinary Wayland toplevel may take focus as it shows.
NoActivate bool
// Dock keeps the panel at a screen edge through Show, Focus, Toggle and content resizing. A docked panel cannot use ShowAt or MoveTo. Wayland needs gtk4-layer-shell and a supporting compositor; an unavailable dock is reported to Window.OnPlacementError and stays hidden.
Dock PanelDock
// Material is the material behind the content (WindowMaterial).
Material WindowMaterial
// PointerEvents is where the panel takes the pointer (SetWindowPointerEvents), from its first frame.
PointerEvents WindowPointerEvents
}
PanelOptions are a panel's: the core's part of desktop.PanelOptions, which apps use.
type PanicError ¶
PanicError is a panic recovered from app code or an engine's fault boundary.
func (*PanicError) Error ¶
func (e *PanicError) Error() string
func (*PanicError) Unwrap ¶
func (e *PanicError) Unwrap() error
Unwrap returns the panic's value when it is an error.
type PartStates ¶
type PartStates struct {
Checked, Indeterminate, Selected, Disabled bool
// Invalid applies aria-invalid styles without reporting a separate accessible state.
Invalid bool
// Focused styles the part as focused while the keyboard is on the
// control around it: a tree's row, a code input's cell.
Focused bool
// Data are the data-* attributes the part shows, without their
// prefix, as a calendar's day shows range-start: its data-*: classes
// and data styles read them, and those of views inside it when it is
// a group.
Data []string
}
PartStates are the states a part of a control is styled in: its Style's Checked, Indeterminate, Selected, Disabled and Invalid merge in while they hold.
type PasteBehavior ¶
type PasteBehavior = driver.PasteBehavior
PasteBehavior says whether an input inserts the text the user pastes.
type PasteEvent ¶
type PasteEvent = driver.PasteEvent
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, which FileFromURL opens.
type PastedFile ¶
type PastedFile = driver.PastedFile
PastedFile is a file the clipboard held: its name when it has one, its MIME type and its bytes.
type Path ¶
Path is a path to fill, stroke or clip with, as the web's Path2D.
func MustParsePath ¶
MustParsePath is ParsePath for path data that is part of the program: it panics when the data is in error.
type PeriodUnit ¶ added in v0.2.0
type PeriodUnit = driver.PeriodUnit
PeriodUnit is PeriodDay, PeriodWeek, PeriodMonth or PeriodYear.
type Permission ¶
type Permission string
Permission is something the system keeps for the user to give apps, named by its key. The app checks it (Scope.PermissionStatus), asks for it with the system's prompt (Scope.RequestPermission), opens the page of the system's settings that gives it (Scope.OpenPermissionSettings) and, on desktops, guides the user there (desktop.GuidePermission).
const ( // PermissionAccessibility is controlling the computer through the accessibility API, on macOS, which names it Device Control and Data Access from macOS 27. PermissionAccessibility Permission = driver.PermissionAccessibility // PermissionScreenRecording is capturing the screen and its audio, on macOS, which tells a change only after the app starts again. PermissionScreenRecording Permission = driver.PermissionScreenRecording // PermissionInputMonitoring is reading the keyboard and the mouse while other apps are in front, on macOS. PermissionInputMonitoring Permission = driver.PermissionInputMonitoring // PermissionFullDiskAccess is the files macOS protects, which it tells by reading one. PermissionFullDiskAccess Permission = driver.PermissionFullDiskAccess // PermissionAppManagement is changing other apps, on macOS, which never tells it (PermissionUnknown). PermissionAppManagement Permission = driver.PermissionAppManagement // PermissionDeveloperTools is running software that does not meet the system's security policy, on macOS, which never tells it (PermissionUnknown). PermissionDeveloperTools Permission = driver.PermissionDeveloperTools // PermissionAutomation is automating another app through Apple Events on macOS; PermissionAutomationOf names the target app by its bundle ID, as macOS grants Automation per target app. Bare PermissionAutomation opens Privacy & Security's Automation pane and checks as PermissionUnknown. Asking needs NSAppleEventsUsageDescription in apple.info. PermissionAutomation Permission = driver.PermissionAutomation // PermissionMicrophone is recording; asking needs NSMicrophoneUsageDescription in apple.info and RECORD_AUDIO in android.permissions. PermissionMicrophone Permission = driver.PermissionMicrophone // PermissionCamera is the camera; asking needs NSCameraUsageDescription in apple.info and CAMERA in android.permissions. PermissionCamera Permission = driver.PermissionCamera // PermissionContacts is the user's contacts; asking needs NSContactsUsageDescription in apple.info. On iOS 18 and later, partial access reads as PermissionLimited. PermissionContacts Permission = driver.PermissionContacts // PermissionCalendars is the user's calendars; asking needs NSCalendarsFullAccessUsageDescription from macOS 14 and iOS 17, NSCalendarsUsageDescription before, and READ_CALENDAR and WRITE_CALENDAR in android.permissions. PermissionCalendars Permission = driver.PermissionCalendars // PermissionReminders is the user's reminders; asking needs NSRemindersFullAccessUsageDescription from macOS 14 and iOS 17, NSRemindersUsageDescription before. PermissionReminders Permission = driver.PermissionReminders // PermissionPhotos is the user's photo library; asking needs NSPhotoLibraryUsageDescription in apple.info. Partial access reads as PermissionLimited. PermissionPhotos Permission = driver.PermissionPhotos // PermissionBluetooth is Bluetooth devices; asking needs NSBluetoothAlwaysUsageDescription in apple.info and BLUETOOTH_CONNECT (API 31+) or BLUETOOTH (API 28–30) in android.permissions. PermissionBluetooth Permission = driver.PermissionBluetooth // PermissionMediaLibrary is Media & Apple Music: iOS tells and asks it (NSAppleMusicUsageDescription), Android tells and asks READ_MEDIA_AUDIO (API 33+) or READ_EXTERNAL_STORAGE (API 28–32) in android.permissions, and macOS never tells it. PermissionMediaLibrary Permission = driver.PermissionMediaLibrary // PermissionLocalNetwork is finding and connecting to devices on the local network, which iOS and tvOS keep from 14 and macOS from 15: until the user allows it, a connection to a device there fails. The system never tells it, so checking answers PermissionUnknown until a request in this run has learned it. Asking advertises and browses a Bonjour service of NSGo's own, which shows the system's prompt, waits up to two minutes for the user and needs NSLocalNetworkUsageDescription in apple.info, with which nsgo build lists that service in NSBonjourServices. Android, Windows and Linux answer PermissionNotGated, as macOS does before 15 and for a program another, such as a terminal, starts and answers for. PermissionLocalNetwork Permission = driver.PermissionLocalNetwork // PermissionLocation is the device's location while the app shows (Locate, WatchLocation): asking needs NSLocationWhenInUseUsageDescription, or NSLocationUsageDescription on macOS, and on Android ACCESS_COARSE_LOCATION, with ACCESS_FINE_LOCATION for a precise one, in android.permissions. Whether the user allowed only an approximate location shows on each fix (LocationFix.Approximate). PermissionLocation Permission = driver.PermissionLocation // PermissionBackgroundLocation is a location stream going on in the background (LocationOptions.Background): on Apple platforms PermissionLocation with UIBackgroundModes' location, and on Android also ACCESS_BACKGROUND_LOCATION where android.permissions lists it, which Android 11 and later give only on the app's page of the settings, which asking opens. Ask for it after PermissionLocation. PermissionBackgroundLocation Permission = driver.PermissionBackgroundLocation // PermissionMotion covers accelerometer, gyroscope, magnetometer and fused readings (WatchMotion). Apple requires NSMotionUsageDescription on iOS and watchOS from 27.2. Android grants it. Mobile browsers can ask for it from a user gesture. PermissionMotion Permission = driver.PermissionMotion // PermissionNotifications is showing system notifications (ShowNotification) and, on iOS and once used on macOS, the app's icon badge: checking and asking follow NotificationPermission and RequestNotificationPermission under AccessNotifications, and OpenPermissionSettings opens the system's notification settings where the platform has a page for them. PermissionNotifications Permission = driver.PermissionNotifications // PermissionActivityRecognition authorizes steps and fitness classifications: NSMotionUsageDescription on Apple and ACTIVITY_RECOGNITION on Android 29+. It is separate from Android raw sensors, which need no runtime permission. PermissionActivityRecognition Permission = driver.PermissionActivityRecognition )
func PermissionAutomationOf ¶
func PermissionAutomationOf(bundleID string) Permission
PermissionAutomationOf returns the macOS Automation permission for controlling the app with bundleID (such as "com.apple.finder"), checked and asked through AEDeterminePermissionToAutomateTarget. An empty bundleID returns PermissionAutomation.
func Permissions ¶
func Permissions() []Permission
Permissions returns every Permission, in the order of macOS's Privacy & Security, then the sensors' and notifications.
type PermissionGuideOptions ¶
type PermissionGuideOptions struct {
// App is the path of the app the user drags into System Settings' list. Empty means this app: its bundle, or its executable outside one, as under nsgo dev, where macOS charges what the app does to the terminal that started it instead. Code under an Access must leave it empty.
App string
// Name is what the guide calls the app: App's name without its extension when empty.
Name string
}
PermissionGuideOptions are desktop.GuidePermission's.
type PermissionStatus ¶
type PermissionStatus uint8
PermissionStatus is whether the app has a Permission.
const ( // PermissionNotAsked is the user not asked yet: RequestPermission shows the system's prompt. macOS never reports it for Accessibility, Screen Recording and Input Monitoring, which are PermissionDenied until granted. PermissionNotAsked PermissionStatus = driver.PermissionNotAsked // PermissionGranted is the app having it. PermissionGranted PermissionStatus = driver.PermissionGranted // PermissionDenied is the user or an administrator having refused it; only the system's settings change it. PermissionDenied PermissionStatus = driver.PermissionDenied // PermissionUnknown is a permission the system keeps but cannot tell without asking, or that the platform's backend cannot tell yet. PermissionUnknown PermissionStatus = driver.PermissionUnknown // PermissionNotGated is a permission the system does not keep from this app, which may use what it guards: on Linux outside a sandbox, and on Windows for all but the microphone, the camera and notifications. PermissionNotGated PermissionStatus = driver.PermissionNotGated PermissionUnavailable PermissionStatus = driver.PermissionUnavailable // PermissionLimited is partial access granted by the user, such as selected photos or selected contacts on Apple platforms. Allowed reports true. PermissionLimited PermissionStatus = driver.PermissionLimited )
func (PermissionStatus) Allowed ¶
func (s PermissionStatus) Allowed() bool
Allowed reports whether the app may use what the permission guards: PermissionGranted, PermissionLimited or PermissionNotGated.
func (PermissionStatus) String ¶
func (s PermissionStatus) String() string
String returns "prompt", "granted", "limited", "denied", "unknown", "not-gated" or "unavailable".
type PersistOptions ¶
type PersistOptions struct {
// Version is the version of the value's form the app writes; 0 for a form that never changed.
Version int
// Migrate turns the JSON of a value written at an older version into the JSON of the current form. Without it, or when it fails, an older value reads as the default.
Migrate func(version int, data json.RawMessage) (json.RawMessage, error)
}
PersistOptions are how a Persisted reads entries an older version of the app wrote.
type Persisted ¶
type Persisted[T any] struct { // contains filtered or unexported fields }
Persisted is a typed value the app's storage keeps under a key as JSON, read as a signal is: it follows the entry, as the app sets it here or elsewhere and as other graphs of the app change it, and decodes it once per change.
Like a signal's, its methods belong to the graph's goroutine.
func NewPersisted ¶
func NewPersisted[T any](cx *Scope, key string, def T, opts PersistOptions) *Persisted[T]
NewPersisted returns the value the current owner's storage keeps under key, def when it holds none or what it holds does not decode. It reads the storage Scope.Storage returns, so a partition Scope.ProvideStorage gives holds it.
func (*Persisted[T]) Err ¶
Err returns why the entry the storage holds reads as the default: it does not decode, it is at a version the app cannot read, or its migration failed; nil when it reads as stored or there is none. It subscribes the running computation.
func (*Persisted[T]) Get ¶
func (p *Persisted[T]) Get() T
Get returns the value, subscribing the running computation to its entry.
func (*Persisted[T]) Reset ¶
func (p *Persisted[T]) Reset()
Reset removes the entry, so the value reads as the default.
type PhotoOptions ¶
type PhotoOptions struct {
// MaxDimension scales a photo whose longer side has more pixels down
// to it; 0 keeps its size.
MaxDimension int
// Quality is the quality the JPEG is encoded at, from 0 (smallest) to
// 1; 0 means 0.9.
Quality float32
}
PhotoOptions say how TakePhoto prepares the photo taken.
type PhysicalBorders ¶
type PhysicalBorders struct {
Widths, Colors Sides
// Corners has SideLeft for the left corners and SideRight for the
// right ones.
Corners Sides
}
PhysicalBorders are the parts of a style's border that stay on their sides right to left (Style.PhysicalBorders).
type PhysicalEdges ¶
type PhysicalEdges struct {
Margin, Padding, Inset Sides
}
PhysicalEdges are the sides of a style's box that stay on their sides right to left (Style.PhysicalEdges).
type PickDirectoriesOptions ¶
type PickDirectoriesOptions struct {
// Multiple lets the user pick several folders, at most Limit (0: up
// to MaxPicked).
Multiple bool
Limit int
// Title, Button and Start are hints as in PickFilesOptions.
Title string
Button string
Start string
}
PickDirectoriesOptions say how PickDirectories picks folders.
type PickFilesOptions ¶
type PickFilesOptions struct {
// Multiple lets the user pick several files, at most Limit (0: up to
// MaxPicked).
Multiple bool
Limit int
// Types are the files offered: media types (application/pdf), families (image/*) and extensions (.zip); none offers every file.
Types []string
// TypesName names Types in the type menu of the pickers that have one, Windows' and Linux's; "" shows the English "Files", or on Windows "All files" where every file is offered.
TypesName string
// Title, Button and Start are hints a platform without the setting ignores, each "" for the system's own: Title says what the picker is for, as its title or, on macOS, whose sheets have none, its message; Button labels the button that picks; Start is the absolute path of the folder it opens in, ignored where no such folder exists. macOS, Windows and Linux take all three, iOS only Start, Android and the web none.
Title string
Button string
Start string
}
PickFilesOptions say which files PickFiles offers.
type PickFormat ¶
type PickFormat = driver.PickFormat
PickFormat says which formats picked images come in.
type PickOptions ¶
type PickOptions struct {
// Multiple lets the user pick several images, at most Limit (0: up
// to MaxPicked).
Multiple bool
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 quality JPEGs are encoded at, from 0 (smallest) to
// 1; 0 means 0.9, and keeps JPEGs that need no other change as they
// are.
Quality float32
// Format says which formats images come in: by default JPEG, PNG, GIF
// and WebP as they are and anything else, such as HEIC, as JPEG.
Format PickFormat
}
PickOptions say how PickImages picks and prepares images.
type PickedFile ¶
type PickedFile = driver.PickedFile
PickedFile is an image the user picked: its name, type, bytes, size in pixels and modification time.
type PictureInPicture ¶
type PictureInPicture struct {
Size Size
Paused bool
PausedFunc func() bool
Position time.Duration
PositionFunc func() time.Duration
Duration time.Duration
Automatically bool
Children []Node
Ref *Ref
TestID string
OnState func(PictureInPictureState)
OnRestore func()
OnPlay func()
OnPause func()
OnSkip func(time.Duration)
}
PictureInPicture is core's implementation of mobile.PictureInPicture, which apps use. Its content has a layout root of its own and occupies no space where it is declared. Deleting it stops its session.
func (PictureInPicture) Render ¶
func (p PictureInPicture) Render(*Scope) Node
type PictureInPictureState ¶
type PictureInPictureState = driver.PictureInPictureState
PictureInPictureState is a video's or mobile.PictureInPicture's native session state. Supported=false means this platform cannot provide PiP; Possible becomes true when the content and system are ready to start.
type Playback ¶
type Playback struct {
// contains filtered or unexported fields
}
Playback is the core's part of audio.Playback, which apps use to control one play of a Sound. Call its methods on the engine's goroutine.
func (*Playback) Ended ¶
Ended reports whether playback finished, was stopped or evicted, or could not start. Reading it tracks the state in the current reactive scope.
type PlaybackDirection ¶
type PlaybackDirection uint8
PlaybackDirection is which way the iterations of keyframes play, as CSS's animation-direction.
const ( PlayNormal PlaybackDirection = iota PlayReverse PlayAlternate PlayAlternateReverse )
type Pointer ¶
Pointer is the precision of the primary pointing device, matching CSS's pointer media feature: Env.Pointer.
type PointerEvents ¶
type PointerEvents = driver.PointerEvents
PointerEvents says which of a view and its children take touches and the pointer.
type PointerHit ¶
PointerHit is a reference reached by a committed-geometry pointer hit test. Position is in that reference's element.
func HitTest ¶
func HitTest(p Point, refs ...*Ref) []PointerHit
HitTest returns the supplied references reached by p in surface points, innermost first. Live references must be in one surface; references from a different surface than the first live one are ignored. One tree walk follows committed transforms, scrolling, clipping, pointer events and stacking; disabled subtrees and views below a modal receive nothing. base/dragdrop uses the batch form to avoid walking the tree again for every registered target. Native animations between commits are not sampled by this query.
type Points ¶
Points is a length in platform-independent points (iOS points, Android dp, CSS pixels at a zoom of 1).
const Zero Points = math.SmallestNonzeroFloat32
Zero is a length of no points that, unlike 0, is set, as Transparent is a color: Padding: All(Zero) takes away the padding a style under it gives, where 0 would leave it. It works in Margin, Padding, Borders, BorderWidth, CornerRadius and the gaps, and a view lays it out and draws it as 0.
type Position ¶
type Position uint8
Position says how a node is placed in its parent.
const ( // Relative nodes flow in their parent; Top and Left offset them. Relative Position = iota + 1 // Absolute nodes leave the flow and are placed by Top, Right, Bottom // and Left in the padding box of their nearest positioned ancestor. Absolute // Static nodes flow in their parent and ignore Top, Right, Bottom and // Left, so absolute nodes inside them are placed by an ancestor. Static // Fixed nodes leave the flow and are placed by Top, Right, Bottom and // Left in the root view, or the modal they are in, whatever scrolls. Fixed // Sticky nodes flow as relative ones, then stick in the nearest scroll view around them: Top (Left in a horizontal one) from its start, or Bottom (Right) from its end when the start inset is auto. Travel stays inside their parent's content. They draw above their siblings with the same ZIndex. Sticky )
type PositionAxis ¶
type PositionAxis = driver.PositionAxis
PositionAxis is an ObjectPosition along one axis: Offset from the start edge (left, top), or from the end edge (right, bottom) when FromEnd.
type PreparedText ¶
type PreparedText = driver.PreparedText
type Presence ¶
type Presence struct {
When func() bool
Then func(cx *Scope) Node
Else func(cx *Scope) Node
Wait bool
}
Presence is Show whose branches leave with their exits, as gpui-base's Presence and Motion's AnimatePresence: when When changes, the branch it held stays in the region, before the one built for the new value, until every exit its parts registered with Scope.OnExit has called done. A branch whose parts registered none goes at once, as Show's does.
A leaving branch never comes back: if When changes back before it is gone, a new branch is built beside it. With Wait, the new branch is built only once the branches leaving are gone, as AnimatePresence's wait mode, so in-flow content never shows twice.
type PresenceOf ¶
type PresenceOf[K comparable] struct { Key func() K Content func(cx *Scope, key K) Node Wait bool MaxLeaving int }
PresenceOf is Presence keyed by a comparable value: a change of Key's value sends the branch Content built for the old value away through its exits and builds one for the new value. With Wait, the new branch waits until every leaving branch is gone. MaxLeaving bounds the branches leaving at once, the oldest going at once past it; 0 sets no bound.
type PressEvent ¶
type PressEvent struct {
// Position is in the pressed view, its transforms undone; for a
// pressed span, in its text's view.
Position Point
// PagePosition is in the root view the view is in: the surface, or
// its modal.
PagePosition Point
Modifiers Modifiers
// Clicks counts consecutive clicks on the same view at the same place: 1 for a click,
// 2 for a double click.
Clicks int
// Keyboard is set when the last input was a key, as Return or Space
// pressing the focused view: a menu opened so focuses its first item.
Keyboard bool
}
PressEvent is where the pointer was at a press. Backends that know them report the modifier keys held when the press began and the click count; a keyboard press keeps its modifiers where the platform reports them. Keyboard and assistive-technology presses are at the view's origin with one click.
type PressureSample ¶
type PressureSample = driver.PressureSample
PressureSample reports pascals and optional relative altitude in meters.
type Product ¶ added in v0.2.0
Product is what the store sells, in the user's storefront's language and currency: show DisplayPrice as it is and never a price of the app's own, as stores price each storefront themselves.
type ProductType ¶ added in v0.2.0
type ProductType = driver.ProductType
ProductType is what kind of thing a product sells: ProductConsumable, ProductNonConsumable, ProductAutoRenewable or ProductNonRenewable.
type PromotionalOffer ¶ added in v0.2.0
type PromotionalOffer = driver.PromotionalOffer
PromotionalOffer is a subscription's promotional offer as a purchase takes it, which the app's server signs with its In-App Purchase key.
type PurchaseError ¶ added in v0.2.0
type PurchaseError string
PurchaseError is why an in-app purchase service answered without what it was asked for. A failure the platform explains wraps PurchaseFailed with its words, so test it with errors.Is.
const ( // PurchaseCancelled: the user closed the store's sheet, which is no failure. PurchaseCancelled PurchaseError = driver.PurchaseCancelled // PurchasePending: the purchase waits for someone's approval, as Ask to Buy's, or for the user to act outside the app; its transaction comes later through OnPurchaseUpdate. PurchasePending PurchaseError = driver.PurchasePending // PurchaseFailed: the store refused or could not answer, such as for a product it does not sell, a network error or a device that may not make payments. PurchaseFailed PurchaseError = driver.PurchaseFailed // PurchaseNotFound: no unfinished transaction has the ID FinishTransaction was given, as one already finished has not. PurchaseNotFound PurchaseError = driver.PurchaseNotFound PurchasesUnavailable PurchaseError = driver.PurchasesUnavailable )
func (PurchaseError) Error ¶ added in v0.2.0
func (e PurchaseError) Error() string
type PurchaseOptions ¶ added in v0.2.0
type PurchaseOptions struct {
// AccountToken is a UUID of the app's own that ties the purchase to its user, which the transaction and the store's notifications to the app's server carry: StoreKit's appAccountToken. "" sends none.
AccountToken string
// Quantity is how many of a consumable to buy; 0 is 1.
Quantity int
// Offer is the promotional offer a subscription is bought with, nil for none; an introductory offer the user is eligible for applies without one.
Offer *PromotionalOffer
}
PurchaseOptions are what Purchase buys with.
type QuitRequest ¶
type QuitRequest struct {
// contains filtered or unexported fields
}
QuitRequest is the core's part of desktop.QuitRequest, which apps use for user and system requests to quit.
func (*QuitRequest) Cancel ¶
func (q *QuitRequest) Cancel()
Cancel keeps the app running. It has an effect in a user quit's request handler.
func (*QuitRequest) Canceled ¶ added in v0.2.0
func (q *QuitRequest) Canceled() bool
Canceled reports whether a handler canceled the quit: what a test of a handler reads.
func (*QuitRequest) Defer ¶
func (q *QuitRequest) Defer() func(quit bool)
Defer keeps a user quit pending and returns a one-shot answer. quit true proceeds with quitting; false cancels it. The returned function is safe to call from another goroutine. Call it in every case: until it is called, a later user quit request waits for this one's answer. A handler that panics after Defer, without having answered, cancels the request, and the function it got then does nothing. For a forced request, Defer returns a function that does nothing.
func (*QuitRequest) Forced ¶
func (q *QuitRequest) Forced() bool
Forced reports whether the system is ending the session, as at logout, restart or shutdown.
type Ref ¶
type Ref struct {
// contains filtered or unexported fields
}
Ref refers to a mounted element: an overlay's anchor, focus, its bounds. Its zero value is ready to use; pass its address in an element's Ref field.
Its focus, blur, scroll, zoom and reveal requests do nothing while the element is in a Holder's content that no place shows, and those still queued when it leaves the tree are dropped; placing the content again does not replay them.
func FocusedRef ¶
FocusedRef returns a reference to the element with the keyboard focus in cx's tree, as the platform last reported it, or nil when none has it; it is not tracked. The reference works while that element stays mounted, so what takes the focus without a trigger, such as a find bar a key opens, can give it back as it closes.
func (*Ref) Before ¶
Before reports whether r's view comes before other's in tree order, the order Tab goes through them; views not mounted come last.
func (*Ref) Bounds ¶
Bounds returns the element's frame in surface points after the last commit, and false while it is not mounted.
func (*Ref) CloseEditMenu ¶
func (r *Ref) CloseEditMenu()
CloseEditMenu closes any edit menu Ref.OpenEditMenu opened on the input.
func (*Ref) ContentBounds ¶
ContentBounds is the box around what the view holds, in the surface, its own frame while it holds nothing, and false while it is not mounted.
func (*Ref) ContentBox ¶
ContentBox returns the layout content box in the view's own coordinates, excluding padding and borders, and false while unmounted. It is tracked: a layout or padding change reruns a function that reads it. base/textview uses it to constrain display attachments to their scroll viewport.
func (*Ref) Evaluate ¶
Evaluate runs script in the web view's page, as an expression, and calls done on the engine's goroutine, while the web view lives, with its result as JSON, or the error it threw: a promise it returns is awaited, undefined is null, and what JSON cannot hold (a function, a cycle) is an error. The answer comes through the page's channel to the app, as OnMessage's, on every backend with web views. A page that leaves first ends it with an error, as does a view with NoJavaScript, and a view that goes never answers.
func (*Ref) Focus ¶
func (r *Ref) Focus()
Focus moves keyboard focus to a text field or, on desktops, the web, Android and iOS/tvOS, an enabled pressable or Focusable view. Plain, hidden and NoFocus views and views below a modal do not take focus. Under a confined owner it does only as Scope.Confine allows. It does nothing in unplaced Holder content, with no focus deferred until it is placed again.
func (*Ref) Frame ¶
Frame returns the element's frame in its parent after the last commit, as OnLayout receives it, and false while it is not mounted.
func (*Ref) GoBack ¶
func (r *Ref) GoBack()
GoBack goes back in the web view's history. On native targets, going back to the page of the app's own source is not held to AccessWebSchemes.
func (*Ref) GoForward ¶
func (r *Ref) GoForward()
GoForward goes forward in the web view's history. On native targets, going forward to the page of the app's own source is not held to AccessWebSchemes.
func (*Ref) HitTest ¶
HitTest reports whether p, in surface points, reaches the element or one of its descendants and returns p in its coordinates, using HitTest's committed geometry and interaction boundaries.
func (*Ref) HoldsFocus ¶
HoldsFocus reports whether the keyboard focus is on the element or inside it, as the platform last reported it; it is not tracked.
func (*Ref) InjectJavaScript ¶
InjectJavaScript runs script in the web view's page.
func (*Ref) ListPosition ¶
func (r *Ref) ListPosition() (ListPosition, bool)
ListPosition reads where the element, a List, has its viewport start among its rows after the last commit, from the list's own row positions: ScrollToIndexAt(p.Index, 0, -p.Offset, false) brings a list made anew back there. In a header before the first row the index is 0 and the offset negative; false for a list without rows, or no list.
func (*Ref) Load ¶ added in v0.2.0
Load loads src in the web view, as a new Source would, even when it is the source the view already shows: the page loads with the view's Headers, and a source Access refuses reaches OnError and loads nothing. It navigates the view, as a link does, and leaves the source alone: Source or SourceFunc's next change loads again, a change to the scripts or headers loads the source again, and messages come by default from the source's origin, not src's.
func (*Ref) LockPointer ¶
func (r *Ref) LockPointer() (unlock func())
LockPointer asks the platform to confine and hide the pointer until the returned function runs, Escape is pressed, the window loses focus or the view disappears. OnPointerDelta reports relative motion while the view owns the lock. In a browser, ask from a user gesture.
func (*Ref) Measure ¶
Measure calls done with the element's frame in its parent and in the surface once the changes made so far are laid out, after the next commit; ok is false while it is not mounted.
func (*Ref) OpenEditMenu ¶
func (r *Ref) OpenEditMenu(bounds Bounds, actions EditAction)
OpenEditMenu opens the platform's touch edit menu on the element, a focused text input, anchored clear of bounds in the surface's points and offering actions (a bitmask of EditCut, EditCopy, EditPaste and EditSelectAll). On iOS and Android, choosing Cut, Copy or Select All runs Input.OnEditAction, and choosing Paste runs Input.OnPaste. Passing 0 closes any edit menu open on the input.
func (*Ref) PostMessage ¶
PostMessage dispatches a MessageEvent carrying data on the web view's page.
func (*Ref) Reload ¶
func (r *Ref) Reload()
Reload loads the web view's page again. On native targets, reloading the page of the app's own source is not held to AccessWebSchemes.
func (*Ref) Reveal ¶
func (r *Ref) Reveal(opts RevealOptions)
Reveal scrolls every scroll view around the element until it shows, innermost first, each clamped to its content: at the commit, with that commit's layout, so a view made in the same turn is revealed where it lands. The word is NSH's (`reveal`), as GPUI Kit's `reveal_item`; the alignments are physical, as NSH's.
func (*Ref) RevealBox ¶
func (r *Ref) RevealBox(box Bounds, opts RevealOptions)
RevealBox scrolls every scroll view around the element until box, in the element's frame as TextRangeBoxes gives a text's ranges, shows, as Reveal shows the whole element: a match in a long line of code reaches its column, not only the code's block.
func (*Ref) ScrollTo ¶
ScrollTo scrolls the element, a Scroll, List or multiline Input, so its content's offset is at.
func (*Ref) ScrollToEnd ¶
ScrollToEnd scrolls the element, a Scroll, List or multiline Input, to the end of its content. A list keeps following the end as the rows there are measured, until the user scrolls away.
func (*Ref) ScrollToIndex ¶
ScrollToIndex scrolls the element, a List, so row index is at the start of its viewport.
func (*Ref) ScrollToIndexAt ¶
ScrollToIndexAt scrolls the element, a List, so row index is at viewPosition of its viewport (0 its start, 0.5 its middle, 1 its end), viewOffset before it. Sizes of rows never shown are estimates, so the list keeps following the row as the rows around it are measured, until the user scrolls away or the rows change.
func (*Ref) Seek ¶
Seek jumps the video r names to position. In the update that unpauses a video that played to its end, the video plays again from position.
func (*Ref) SendInput ¶
SendInput gives the web view's page input as the user's own, whose events are trusted and carry user activation, which no script the page runs can make: a click, typed text or a key. It takes the keyboard focus first. It does nothing where Env.CanSendInput is false.
func (*Ref) SetAccessibilityFocus ¶
func (r *Ref) SetAccessibilityFocus()
SetAccessibilityFocus moves the screen reader's focus to the element, as after a change the user should hear about first. The web and desktops move the keyboard focus with it, to a field at least, so under a confined owner it does only as Scope.Confine allows.
func (*Ref) SetSelection ¶
SetSelection selects start to end, in UTF-16 units, in the element, a text field; equal offsets place the caret.
func (*Ref) StartPictureInPicture ¶
func (r *Ref) StartPictureInPicture()
StartPictureInPicture starts the video or mobile.PictureInPicture r names. The native state callback reports success or a distinct failure. Calling it while active is idempotent. It must follow a user action.
func (*Ref) StopLoading ¶
func (r *Ref) StopLoading()
StopLoading stops the web view's page loading.
func (*Ref) StopPictureInPicture ¶
func (r *Ref) StopPictureInPicture()
StopPictureInPicture ends r's session, if it is active.
func (*Ref) TextCaretAt ¶
TextCaretAt returns the caret nearest p, a point in the text's frame, after the last commit: its UTF-16 offset, and upstream when it stays at the end of a wrapped line. False while the text is not laid out.
func (*Ref) TextCaretBox ¶
TextCaretBox returns the caret's box at UTF-16 offset, a box of no width as tall as its line, in the text's frame; upstream takes the earlier line where one offset is at both.
func (*Ref) TextRangeBoxes ¶
TextRangeBoxes returns the line-high boxes of the UTF-16 range from start to end, in the text's frame.
type RefundStatus ¶
type RefundStatus string
RefundStatus is the result of a refund request.
const ( RefundSuccess RefundStatus = driver.RefundSuccess RefundCancelled RefundStatus = driver.RefundCancelled )
type ResizeMode ¶
type ResizeMode = driver.ResizeMode
ResizeMode fits an image or a video into its view.
type Resource ¶
type Resource[T any] struct { // contains filtered or unexported fields }
Resource is a value loaded on another goroutine from a source, loaded again when the source changes or on Refetch, as NSH's resource and Solid's createResource are. Its value, error and state are signals: bindings that read them follow its loads. Only the latest load counts: a newer one cancels the context of the one running, and so does the owner's disposal.
Like a signal's, its methods belong to the graph's goroutine.
func NewResource ¶
func NewResource[S, T any](cx *Scope, source func() (S, bool), fetch func(ctx context.Context, source S, info ResourceInfo) (T, error)) *Resource[T]
NewResource returns a resource that loads fetch(ctx, s) whenever source gives a new s with ok true, and on Refetch. source is tracked and runs on the graph's goroutine; with ok false the resource loads nothing, as for a user not signed in yet, and a nil source loads once with S's zero value. fetch runs on a goroutine of its own, so it may block on the network or the disk; ctx is cancelled when a newer load starts or the owner is disposed, and the result of a load that no longer counts is dropped. A panic in fetch fails the load with a *PanicError and goes to the nearest Catch, as a panic in app code does.
Its results reach the graph through Post, so the graph needs a host: an engine or a test driver.
func NewResourceWithValue ¶
func NewResourceWithValue[S, T any](cx *Scope, value T, source func() (S, bool), fetch func(ctx context.Context, source S, info ResourceInfo) (T, error)) *Resource[T]
NewResourceWithValue returns a resource as NewResource does that holds value until its first load ends, which is a refresh (TSX's initialValue).
func (*Resource[T]) Err ¶
Err returns the last load's error, nil once a load gave a value; it subscribes the running computation.
func (*Resource[T]) Get ¶
Get returns the latest value, kept while loading again and after a failure, with ok false before the first; it subscribes the running computation, and has a Suspense around it wait while the first value loads.
func (*Resource[T]) Loading ¶
Loading reports whether a load runs; it subscribes the running computation.
func (*Resource[T]) Mutate ¶
func (r *Resource[T]) Mutate(v T)
Mutate sets the value with no load, as an optimistic update does, and clears the last error; a load still running replaces it when it ends.
func (*Resource[T]) Refetch ¶
func (r *Resource[T]) Refetch()
Refetch loads the resource again from the same source, as a retry or a pull to refresh does, keeping the value meanwhile. A resource whose source is not set stays as it is.
func (*Resource[T]) State ¶
func (r *Resource[T]) State() ResourceState
State returns where the resource is; it subscribes the running computation.
type ResourceInfo ¶
type ResourceInfo struct {
// Refetching says Refetch started the load: the source did not change.
Refetching bool
}
ResourceInfo is what a load is told besides its source.
type ResourceState ¶
type ResourceState uint8
ResourceState is where a Resource is (NSH's ResourceState).
const ( // ResourceUnresolved has nothing loaded and nothing loading: its source is not set. ResourceUnresolved ResourceState = iota // ResourcePending is loading, with no value yet. ResourcePending // ResourceReady has a value, and nothing loading. ResourceReady // ResourceRefreshing is loading again, with the last value kept. ResourceRefreshing // ResourceErrored says the last load failed. ResourceErrored )
func (ResourceState) Loading ¶
func (s ResourceState) Loading() bool
Loading reports whether a load runs.
func (ResourceState) String ¶
func (s ResourceState) String() string
String returns its name in TSX: "unresolved", "pending", "ready", "refreshing" or "errored".
type Responder ¶
type Responder struct {
// Claims are asked in order.
Claims []TouchClaim
// Keep refuses to hand the touches to a view that claims them later;
// OnTerminationRequest, when set, is asked instead each time one does.
Keep bool
OnTerminationRequest func(ResponderEvent) bool
// OnGrant: the view became the responder. OnReject: it claimed, but
// the responder kept the touches.
OnGrant, OnReject func(ResponderEvent)
// BlockNative, when set, decides after OnGrant whether the scroll
// views around stop taking the touches, over the claim's LetNative.
BlockNative func(ResponderEvent) bool
// OnStart, OnMove and OnEnd follow the fingers while it is the
// responder.
OnStart, OnMove, OnEnd func(ResponderEvent)
// OnRelease: the last finger lifted. OnTerminate: another view or the
// system took the touches.
OnRelease, OnTerminate func(ResponderEvent)
}
Responder makes a view take part in the touch responder, React Native's: it claims the touches as its Claims say, and as the responder hears where they go.
type ResponderEvent ¶
type ResponderEvent struct {
// Position is in the view hearing it, PagePosition in the surface.
Position Point
PagePosition Point
Time time.Duration
Gesture PanGesture
}
ResponderEvent is what a responder or a claim hears: the finger the event is about and the gesture.
type ReturnKeyType ¶
type ReturnKeyType = driver.ReturnKeyType
ReturnKeyType labels the software keyboard's return key.
type RevealOptions ¶
type RevealOptions struct {
Vertical, Horizontal ScrollAlignment
Animated bool
// Margin is kept clear at the outermost scroll view's edges, for the bars that cover them, such as a find bar over a transcript.
Margin Edges
}
RevealOptions say where Reveal puts a view along vertical and horizontal scroll views, and whether the scrolls animate.
type RootOptions ¶
type RootOptions struct {
// CheckCommits compares incremental commits with a full layout and panics on changes the incremental pass missed. Tests enable it; performance measurements leave it off for their own graph. In a native test build (nsgotest or nsgocheck, not WebAssembly) it also records the goroutine that calls NewRoot as the graph's owner and panics when another goroutine writes to the graph, commits it or runs code in it; a development build (nsgodev) checks every native graph whatever this says.
CheckCommits bool
// Post runs fn on the graph's goroutine later. It must be safe to
// call from any goroutine and must not block.
Post func(fn func())
// Clock schedules timers; the system's when nil.
Clock Clock
// Report receives failures no Catch handles; they are dropped when nil.
Report func(error)
// RequestFrame tells the host that the app waits for the next display frame: it calls Scope.RunFrame, or Scope.RunFrameAt with the display's time for the frame, when that frame begins, and is not asked again until then. It runs on the graph's goroutine, so it must not block. A host without display frames leaves it nil, and the callbacks wait.
RequestFrame func()
// RequestSurfaceFrame is RequestFrame for a host with independent displays. It calls Tree.RunFrameAt for the surface named by id.
RequestSurfaceFrame func(id uint32)
// SetFrameRate updates the host's preferred display rate for the surface, if the host can change it. It must not block.
SetFrameRate func(id uint32, rate FrameRateRange)
// Storage keeps the app's entries; a store in memory when nil.
Storage *Store
// Secrets is the platform's secure store, which Scope.Secrets keeps secrets in; nil where there is none, so Secrets fails with ErrSecretsUnavailable.
Secrets SecretStore
// NetworkWatcher supplies network state when the app first reads it.
NetworkWatcher interface {
WatchNetwork(changed func(Network)) (initial Network, stop func())
}
// ReadAsset reads a slash-separated resource path on a worker goroutine; nil where the host cannot read bundled files.
ReadAsset func(context.Context, string) ([]byte, error)
// Updater is the initial state of package updater, supplied by the platform.
Updater UpdaterState
// GameServices is a per-app game services backend (such as nsgotest's fake) for package gameservices; nil uses the platform backend.
GameServices GameServices
// Cloud is an optional per-app cloud storage backend for package cloud, used by nsgotest to isolate each test app's in-memory cloud store. Nil uses the platform backend.
Cloud CloudStore
// DataDir, CacheDir and LogsDir are the app's directories, "" where the target has none.
DataDir, CacheDir, LogsDir string
// UserDir answers Scope.UserDir with a folder's absolute path, "" where the platform has none; nil where it has none of them.
UserDir func(StandardDir) string
// Host is the channel to the host app that embeds the app: its
// parameters, events, handlers and URL handler. The graph attaches to
// it until its root is disposed.
Host *Host
// Windows, set where the platform opens windows, are the main
// window's options (SetMainView): the first tree is then the app's
// own surface, which shows no view.
Windows *WindowOptions
// HotKeys, set where the platform registers global shortcuts but opens no windows, sends RegisterHotKey's shortcuts to the first tree, as a platform that opens windows has them sent to the app's own surface. The platform answers each with EventHotKeyState; elsewhere RegisterHotKey's handles are unsupported at once.
HotKeys bool
// Tray is set where the platform supports app-level tray icons without
// opening additional windows.
Tray bool
}
RootOptions connect a graph to its host, an engine or a test driver.
type SVG ¶
SVG is a parsed SVG document: vector shapes that stay sharp at any size.
func MustParseSVG ¶
MustParseSVG is ParseSVG for documents that are part of the program, such as embedded icons: it panics when one is in error.
type SVGView ¶
type SVGView struct {
// Class is Tailwind CSS classes, as View's.
Class string
SVG *SVG
SVGFunc func() *SVG
Style Style
StyleFunc func() Style
OnPress func(PressEvent)
OnLayout func(Bounds)
Ref *Ref
Label string
LabelFunc func() string
TestID string
}
SVGView draws an SVG document as authored, as an <svg> written inline in a web page: in its own colors, sized by its width and height, else its viewBox, where Style sets no size. Its shapes are vectors, sharp at any size, and currentColor is the text color it inherits.
type SaveOptions ¶
type SaveOptions struct {
// Name is the file name the dialog suggests; Path's when empty.
Name string
// MIME is its media type; Name's extension says when empty.
MIME string
// Start is the absolute path of an existing folder to open in the save
// dialog on macOS, Windows, Linux and iOS. An empty or unusable path
// leaves the choice to the system.
Start string
Path string
Data []byte
// Preflight asks the platform to check the chosen destination before saving.
// Setting Accept also requests this check.
Preflight bool
// Accept runs on the engine's goroutine after the user chooses where to
// save. A nil return approves the destination. If it returns an error,
// SaveFile leaves the destination untouched. On macOS, Windows and
// Linux's in-process GTK chooser, the dialog stays open for another choice.
// Cancelling after a refusal reports the refused destination and error. Elsewhere a refusal
// completes the save with that destination and error.
// Android passes the chosen tree URI with the app's file name in its
// name query parameter. The web has no destination path and skips Accept.
Accept func(path string) error
}
SaveOptions say what SaveFile saves: the file at Path, or else Data.
type ScanOptions ¶
type ScanOptions struct {
// Kinds are the kinds of code to read; a QR code alone when empty.
Kinds []CodeKind
}
ScanOptions say which codes ScanCode reads.
type ScannedCode ¶
type ScannedCode = driver.ScannedCode
ScannedCode is a code ScanCode read: its kind and the text it holds.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope owns what is created under it: memos, effects, cleanups, child scopes and the views of its elements. Components receive one as cx.
Go has no goroutine-local state, so cx is how code finds its graph. While the graph runs code, reactive primitives (Effect, Memo, Cleanup, AfterFunc, Context, Child, Key.Provide and event registrations) belong to the innermost running owner, whichever cx the code captured, so closures inside an Effect clean up when the Effect runs again; use Scope.Run to switch the running owner when calling those from another handler. Explicit-lifetime resources and surfaces (OpenWindow, OpenPanel, NewTray, OpenOverlay, NewAudioPlayer, LoadSound, NewHolder and Post) instead belong to cx itself, so passing a longer-lived scope such as the app's from an OnPress handler keeps them alive after the button's scope goes.
func FrameState ¶
FrameState returns the root scope of cx's graph, the display frame sequence number, and whether a display frame's callbacks are currently running: the core's part of package gamepad's per-frame snapshot, which apps reach through gamepad.Pads and gamepad.State.
func (*Scope) Abort ¶ added in v0.2.0
func (cx *Scope) Abort()
Abort implements internal/engine's fault shutdown: stop scheduling work, then dispose the graph and cancel its resources. Only a root may abort. Cleanups still run, but cannot restart effects on a partially committed tree.
func (*Scope) AddRecentFile ¶ added in v0.2.0
AddRecentFile is the core's part of desktop.AddRecentFile, which apps use. A relative path is taken from the working directory.
func (*Scope) AdvertiseService ¶
func (cx *Scope) AdvertiseService(service LocalService, onError func(error)) (stop func(), err error)
AdvertiseService publishes service on the local network while the current scope is alive. Call stop on the engine goroutine to end the advertisement. A later platform failure reaches onError on the engine goroutine, if supplied.
func (*Scope) AfterFunc ¶
AfterFunc runs fn on the graph's goroutine after d, unless the current owner is disposed first or stop is called. stop reports whether it stopped the timer before fn ran, and may be called on any goroutine. A timer that has fired or been stopped keeps nothing on its owner, so re-arming one under a long-lived scope, as a debounce or a repeating tick does, does not grow it.
func (*Scope) Animate ¶
Animate calls step with the eased progress from 0 to 1 once a display frame for d, on the graph's goroutine, ending with exactly 1, unless the current owner is disposed or stop is called first. Each step's changes commit as one batch, so prefer a style Transition for what a platform can animate itself.
func (*Scope) AnimateLayout ¶
func (cx *Scope) AnimateLayout(a LayoutAnimation)
AnimateLayout animates the changes of the next commit that has any with a: views move and resize, and appear and go, on the platform.
func (*Scope) Announce ¶
Announce has the screen reader say text. A confined owner's is said only as Scope.Confine allows, else dropped.
func (*Scope) AppURL ¶
AppURL reads the app's address as a tracked value. On the web this is the page address before the app renders. Elsewhere it is the last link opened with the app or the value SetAppURL kept. A confined subtree reads none.
func (*Scope) AppleCredentialState ¶ added in v0.2.0
func (cx *Scope) AppleCredentialState(user string, done func(AppleCredentialState, error))
AppleCredentialState answers done with the state of user's credential, the ID an AppleCredential gave, or with an AppleSignInError: check it as the app starts, to sign out a user who revoked it. An empty user is AppleCredentialNotFound without asking the platform. It is held as SignInWithApple is.
func (*Scope) AudioOutputLatency ¶
AudioOutputLatency implements audio.OutputLatency. An unavailable route returns zero with known false.
func (*Scope) AuthSession ¶ added in v0.2.0
func (cx *Scope) AuthSession(url func(redirect string) string, opts AuthSessionOptions, done func(callback string, err error)) (cancel func())
AuthSession signs the user in with an OAuth provider in the system's authentication session (RFC 8252): it prepares the redirect opts say, asks url for the authorization URL to open with it, which is the redirect_uri the URL names, and calls done once with the URL the provider redirected to, its query holding the code and state, or with an AuthError: AuthCancelled when the user closes the session. The app makes the PKCE verifier and the state and checks them. macOS, iOS and watchOS open ASWebAuthenticationSession, Android a Custom Tab for a declared app scheme; desktops otherwise open the default browser and catch the registered scheme or serve an empty one on loopback, and the web a popup. Elsewhere, or for a redirect a platform cannot catch, done hears AuthUnavailable. cancel ends the session with AuthCancelled; a session outlives the owner that started it, done running under the root then, as other answers do. Reusing a browser callback URI cancels its previous session; distinct callback URIs can wait together.
func (*Scope) AuthenticateBiometric ¶
func (cx *Scope) AuthenticateBiometric(reason string, done func(BiometricResult))
AuthenticateBiometric asks the user to authenticate with reason, which the prompt shows and must not be empty: an empty one answers BiometricFailure without a prompt. It never falls back to a passcode; the app chooses that separately.
func (*Scope) Batch ¶
func (cx *Scope) Batch(fn func())
Batch runs fn and then the effects its writes scheduled, once each.
func (*Scope) BeginWork ¶
func (cx *Scope) BeginWork() func()
BeginWork implements tsx's explicit JavaScript-entry spans. It switches engine work to this scope's nearest observer and returns its restore function, or nil when attribution did not change. Call the restore function before running unrelated work. Both calls belong to the engine goroutine.
func (*Scope) BindWebHead ¶
BindWebHead is the core's part of web.Head, which apps use: bind each non-nil field to the current owner's lifetime. Native and confined owners have no document metadata to change.
func (*Scope) BiometricAvailability ¶
func (cx *Scope) BiometricAvailability(done func(BiometricKind))
BiometricAvailability answers whether an enrolled biometric is available, and which kind it is. It does not show a system prompt.
func (*Scope) BrowseServices ¶
func (cx *Scope) BrowseServices(serviceType string, found func(ServiceEvent)) (stop func(), err error)
BrowseServices reports the services of serviceType as they appear or disappear. A failure ends browsing and reports an event with Err set. Call stop on the engine goroutine. Disposal of the current scope also stops browsing.
func (*Scope) CacheDir ¶
CacheDir returns the directory for files the app can make again, which the system may delete when space runs low; "" on the web.
func (*Scope) CallHost ¶
CallHost calls the embedding host's handler of name with data (any value JSON encodes) and has done hear its answer on the app's goroutine, unless the current owner is disposed first. It fails at once without a host or a handler of name, and after HostCallTimeout without an answer.
func (*Scope) CallHostTimeout ¶
func (cx *Scope) CallHostTimeout(name string, data any, timeout time.Duration, done func(result any, err error))
CallHostTimeout is CallHost waiting timeout for the answer; 0 waits without a deadline.
func (*Scope) CanInstallPackages ¶
CanInstallPackages is the core's part of mobile.CanInstallPackages, which apps use: it asks Android whether the user lets the app install packages.
func (*Scope) CanReadFrontmostApp ¶ added in v0.2.0
CanReadFrontmostApp is the core's part of desktop.CanReadFrontmostApp, which apps use: whether FrontmostApp follows the application in front, read tracked, false where the platform does not or the current owner's Access refuses AccessFrontmostApp. Asking logs no refusal.
func (*Scope) Capture ¶
Capture asks for a PNG of what the target shows in its surface. A nil target captures the surface that owns cx. The callback runs on the engine goroutine. Its PNG can be used in ImageSource.Data or saved for Share. A confined view or an owner held to Access cannot capture their host.
func (*Scope) CheckAccess ¶
func (cx *Scope) CheckAccess(req AccessRequest) error
CheckAccess returns AccessDenied when the current owner's Access refuses req, for the requests core does not make itself, such as a fetch of tsx's. Call it on the graph's goroutine, as it reads the current owner; Scope.Post enters the receiving scope on that goroutine.
func (*Scope) CheckForUpdates ¶
func (cx *Scope) CheckForUpdates(background bool, done func(UpdateCheck))
CheckForUpdates is the core's part of updater.Check and updater.CheckInBackground, which apps use: it asks the platform's updater for a newer version of the app, quietly when background, and done hears its answer. A platform with no updater, such as the web, never answers.
func (*Scope) Cleanup ¶
func (cx *Scope) Cleanup(fn func())
Cleanup registers fn to run when the current owner is disposed or runs again, last registered first, as testing.T.Cleanup does. Readers of what fn writes run once the disposal, or the owner's new run, is over, never against a half-disposed tree.
func (*Scope) ClearNowPlaying ¶
func (cx *Scope) ClearNowPlaying()
ClearNowPlaying removes the app's system media information and controls.
func (*Scope) ClearRecentFiles ¶ added in v0.2.0
func (cx *Scope) ClearRecentFiles()
ClearRecentFiles is the core's part of desktop.ClearRecentFiles, which apps use.
func (*Scope) ClearWebsiteData ¶
ClearWebsiteData removes everything the store every web view of the app shares holds, cookies, local and session storage, IndexedDB, service workers and caches, and calls done on the engine's goroutine once it is gone, so that a page loaded after it starts signed out and with empty storage: an app's "sign out of every site" or "clear browsing data". A page a web view shows keeps what it already read until it loads again. It works whether or not a web view is shown, and leaves Incognito web views alone, which keep their data in memory. Apple platforms remove all of WKWebsiteDataStore's default store's website data types, Windows clears the WebView2 profile's browsing data (ClearBrowsingDataAll), through a hidden web view while none shows, Linux clears the app's WebKitGTK network session's website data manager, and Android removes CookieManager's cookies and WebStorage's data, which leaves the HTTP cache of web views. Where the platform has no store, as on HarmonyOS, on the web and where Env.HasWebView is false, done gets an Unavailable error. Code an Access holds needs the webview capability's cookies (AccessCookies) for "".
func (*Scope) ClipboardChangeCount ¶
ClipboardChangeCount calls done with the platform's clipboard sequence number, or -1 if unavailable. Compare counts for equality because a native sequence can wrap.
func (*Scope) ClipboardFormats ¶
ClipboardFormats calls done with native format names currently offered by the clipboard, without copying their payloads. It answers an empty slice when the clipboard is empty or the platform cannot name its formats.
func (*Scope) CloseNotification ¶
CloseNotification removes the notification called id, if it still shows, or keeps it from showing if it is scheduled.
func (*Scope) CloseNotifications ¶
func (cx *Scope) CloseNotifications()
CloseNotifications removes every notification ShowNotification showed or scheduled, also those earlier runs left where the system keeps them: on macOS, iOS, watchOS, Windows and Android. Linux and the web reach only those this run showed or scheduled. It leaves the app's other notifications alone, such as Android's Live Updates and its foreground services', and the badge.
func (*Scope) CloseWindow ¶
func (cx *Scope) CloseWindow()
CloseWindow is the core's part of desktop.CloseWindow, which apps use.
func (*Scope) CloudStore ¶
func (cx *Scope) CloudStore() CloudStore
CloudStore returns the per-app cloud storage backend passed in RootOptions.Cloud, or nil when the app uses the platform backend. It is core's part of package cloud, which apps use.
func (*Scope) Confine ¶
func (cx *Scope) Confine()
Confine holds what the current owner shows, whoever makes it, to its place in the window, as a browser holds a cross-origin frame. Its key bindings (OnKey) and back handlers (OnBackPress) fire only while the keyboard focus is on a view it owns, itself or through the owners below it: never while the focus is elsewhere or nowhere, so what it shows cannot take the keys or back presses of the views around it; a press they leave goes on to the others, as if they were not there. Its views draw and take input only within its frame, the nearest view around them it does not own, which clips them: its overlays and Fixed views are hosted, sized and placed there rather than in the root view or a modal, and its overlays take back only under the focus rule above. Give it a view of its own, as tsx's sandbox does, or the views beside it in that frame stay within its reach. What a frame cannot hold, and the focus, wait for the user: a Ref's Focus and SetAccessibilityFocus, an input's AutoFocus, DismissKeyboard, a Modal, ShowAlert, PopupMenu, LookUp and Announce act only while the focus is already in its views or the user's input just landed on one (confinedMay), else they are refused, and the first refusal of each kind logs; a modal so shown stays and hears back wherever the focus is, and back takes it away whether or not it removes the modal. Its navigation stacks pop on back only under the focus rule above. Confine it before it renders. tsx's sandbox confines a bundle's scope.
func (*Scope) Context ¶
Context returns a context cancelled when the current owner is disposed or runs again; pass it to work the owner starts on other goroutines.
func (*Scope) CrashReports ¶
func (cx *Scope) CrashReports() ([]CrashReport, error)
CrashReports lists the app's pending crash reports, oldest first. It returns an empty list on targets without a logs directory.
func (*Scope) CurrentEntitlements ¶ added in v0.2.0
func (cx *Scope) CurrentEntitlements(done func([]Transaction, error))
CurrentEntitlements answers done with the latest transaction of each product the user is entitled to now: non-consumables, subscriptions in their period and non-renewing subscriptions, refunded and revoked ones left out. Read them as the app starts to unlock what the user bought, on this device or another. It is held and unavailable as Products is.
func (*Scope) CurrentWindow ¶
CurrentWindow is the core's part of desktop.CurrentWindow, which apps use: the window cx is in, nil in the app's own scope or where the platform opens no windows.
func (*Scope) CursorPoint ¶
CursorPoint is the core's part of desktop.CursorPoint, which apps use to read the pointer in desktop screen coordinates.
func (*Scope) Dark ¶
Dark reports whether cx's subtree shows dark: as the nearest SetSubtreeAppearance forces it, else as the app shows (Env.Dark).
func (*Scope) DataDir ¶
DataDir returns the directory the app keeps its files in: Application Support on Apple platforms, %APPDATA% on Windows, the files directory on Android and HarmonyOS, each with a directory of the app's own. It is "" on the web, which has none.
func (*Scope) DeferSystemGestures ¶
func (cx *Scope) DeferSystemGestures(opts SystemGestureOptions) (release func())
DeferSystemGestures implements mobile.DeferSystemGestures on the scope's surface.
func (*Scope) DiskSpace ¶
DiskSpace reports the room on the volume containing DataDir. Available counts space the system can free on demand where the platform reports it. Opportunistic equals Available where there is no separate figure for caches and prefetching. The query is asynchronous and done runs on the engine goroutine.
func (*Scope) DismissKeyboard ¶
func (cx *Scope) DismissKeyboard()
DismissKeyboard takes focus away from the focused text field, hiding the software keyboard. Under a confined owner it does only as Scope.Confine allows.
func (*Scope) Dispose ¶
func (cx *Scope) Dispose()
Dispose disposes everything the scope owns, runs its cleanups and cancels its Context.
func (*Scope) Download ¶
func (cx *Scope) Download(req DownloadRequest, destination string, opts DownloadOptions) (DownloadTask, error)
Download starts writing req to an absolute, app-accessible path. The task belongs to the app and keeps running when cx is disposed. It stages a partial file beside destination, then atomically publishes the result.
func (*Scope) Effect ¶
func (cx *Scope) Effect(fn func()) (stop func())
Effect runs fn after the current batch and again whenever what it read changes, until the current owner is disposed or stop is called.
func (*Scope) Env ¶
Env returns the environment of the window cx is in: its size, scale and safe area are the window's, and what the app forces is every window's.
func (*Scope) ExitApp ¶
func (cx *Scope) ExitApp()
ExitApp is the core's part of mobile.ExitApp, which apps use: it leaves the app as Android's back button does when nothing takes it.
func (*Scope) FinishTransaction ¶ added in v0.2.0
FinishTransaction tells the store the app delivered what the transaction whose ID is id bought, and answers done: nil, or PurchaseNotFound when no unfinished transaction has the ID. Finish each transaction Purchase, OnPurchaseUpdate or CurrentEntitlements gives once its server verified it: the store hands an unfinished one to the app again at each launch, and refunds an unfinished purchase after some days. It is held and unavailable as Products is.
func (*Scope) FrontmostApp ¶ added in v0.2.0
func (cx *Scope) FrontmostApp() FrontmostAppInfo
FrontmostApp is the core's part of desktop.FrontmostApp, which apps use: the application in front, read tracked, zero where the platform does not follow it (CanReadFrontmostApp) or the current owner's Access refuses AccessFrontmostApp.
func (*Scope) GuidePermission ¶
func (cx *Scope) GuidePermission(p Permission, opts PermissionGuideOptions, done func(PermissionStatus)) (stop func())
GuidePermission is the core's part of desktop.GuidePermission, which apps use. One guide shows at a time: a new one ends the one before, and the current owner's going ends it as stop does. done runs once, with the status as it ends, under the root once the owner is gone.
func (*Scope) HasClipboardImage ¶
HasClipboardImage calls done with whether the clipboard holds an image, without reading it.
func (*Scope) HasClipboardText ¶
HasClipboardText calls done with whether the clipboard holds text, without reading it, so iOS shows no paste notice.
func (*Scope) Hiding ¶
Hiding runs the OnQuit handlers as Quitting does but keeps them, for an app the system hides and may end without a word: a page the browser keeps in its back-forward cache, or a watchOS app in the background. It may show the app again, which runs them again at its next hide or quit.
func (*Scope) HostParams ¶
HostParams returns the parameters the embedding host gave the app before it started (Host.SetParams): an empty map without a host or any.
func (*Scope) ImageSize ¶
func (cx *Scope) ImageSize(src ImageSource, done func(pixels Size, err error))
ImageSize calls done with the size in pixels of the image src names, as Image's OnLoad reports it, or the error loading or reading it (NSH's Image.getSize). The platform loads it as an Image would, the variant of an "asset:" source with Scales included, and keeps its bytes for the views that show it next. A source with Pixels loads nothing: done is called at once with the buffer's size.
func (*Scope) InstallPackage ¶
InstallPackage is the core's part of mobile.InstallPackage, which apps use: it hands the APK at path to Android's package installer.
func (*Scope) KeepAwake ¶
func (cx *Scope) KeepAwake(reason string, opts KeepAwakeOptions) (release func())
KeepAwake keeps the computer from idle sleep until release is called or the current scope is disposed. The reason is shown by platforms that list power assertions. Releasing more than once is safe.
func (*Scope) KeepImage ¶
func (cx *Scope) KeepImage(src ImageSource) (release func())
KeepImage pins src in the platform's canvas image cache so it is not evicted while kept, until release is called or the current scope is disposed. Keeping the same source more than once requires each release before it may be evicted again. Releasing more than once is safe. Empty and Pixels sources are not cached by key and return a no-op release.
func (*Scope) KeyLabel ¶
KeyLabel is key as the platform the app runs on shows it, as core.KeyLabel says.
func (*Scope) LaunchAtLogin ¶
LaunchAtLogin is the core's part of desktop.LaunchAtLogin, which apps use: done hears whether the system starts the app at login.
func (*Scope) LoadSound ¶
func (cx *Scope) LoadSound(src AudioSource, done func(*Sound, error))
LoadSound has the platform read and decode src into memory once and calls done with the sound or why not, an AudioError: the core's part of audio.LoadSound, which apps use. A source this engine's surface already holds, the same URI or bytes of the same digest, shares its decoded sound. The sound belongs to cx itself rather than the running owner, so loading with the app's scope from a handler keeps it until cx goes or Close is called; done, which runs in a later turn, never runs once cx went.
func (*Scope) Locate ¶ added in v0.2.0
func (cx *Scope) Locate(opts LocationOptions, done func(LocationFix, error)) (*SensorStream, error)
Locate waits for a new provider fix unless MaxAge explicitly allows a cached one, under PermissionLocation, which it never asks for. It waits through background pauses and stops after one fix. The default foreground timeout is 30 seconds; Stop cancels silently.
func (*Scope) LogsDir ¶ added in v0.2.0
LogsDir returns the directory for the app's log files, where the platform's tools look for them: ~/Library/Logs/<id> on macOS, %LOCALAPPDATA%\<id>\Logs on Windows (inside CacheDir, so an app that empties its cache must spare Logs), $XDG_STATE_HOME/<id> on Linux (~/.local/state by default), and logs in DataDir on Android, iOS and watchOS. A host's data directory and nsgotest move it with DataDir. It is "" on the web, which has none. Standalone release builds keep crash reports under crashes in this directory.
func (*Scope) LookUp ¶ added in v0.2.0
LookUp is the core's part of desktop.LookUp, which apps use: it shows the platform's dictionary panel for text at at, a box in the view in refers to (the surface's without in), as a TextSelection's Bounds is in its view. It reports whether it asked the platform: false for blank text, an in that is not mounted, where Env.CanLookUp is false, and for a confined owner as Scope.Confine allows a PopupMenu.
func (*Scope) MainWindow ¶
MainWindow is the core's part of desktop.MainWindow, which apps use.
func (*Scope) ManageSubscriptions ¶
ManageSubscriptions opens the store's subscription-management UI. It is available where the app's purchases library is available and must be called from a user action. The callback is called once with any platform error.
func (*Scope) MeasureText ¶
func (cx *Scope) MeasureText(text string, font Font) TextMetrics
MeasureText returns the advance width and the metrics of text's first line in font, laid out by the platform's text engine as a canvas measures it (Drawing.TextMetrics): a column fitted to its widest text, a monospaced font's character width. In a reactive function it follows changes to the available fonts.
func (*Scope) MinimizeWindow ¶
func (cx *Scope) MinimizeWindow()
MinimizeWindow is the core's part of desktop.MinimizeWindow, which apps use.
func (*Scope) NewAudioOutput ¶
func (cx *Scope) NewAudioOutput(conf AudioOutputConfig) (*AudioOutput, error)
NewAudioOutput opens a paused PCM stream for audio.NewOutput.
func (*Scope) NewAudioPlayer ¶
func (cx *Scope) NewAudioPlayer(src AudioSource, opts AudioPlayerOptions) *AudioPlayer
NewAudioPlayer makes a player of src, loading nothing until Play or Preload: the core's part of audio.NewPlayer, which apps use. The player belongs to cx itself rather than the running owner, so creating one with the app's scope from a button or row handler keeps it playing after that handler's scope goes, closing only when cx goes or Close is called.
func (*Scope) NewOffscreenImage ¶
func (cx *Scope) NewOffscreenImage(size Size, scale float64, draw func(*Drawing)) *OffscreenImage
NewOffscreenImage creates a retained offscreen image of logical size and backing scale (pixels per point; values <= 0 default to the current display pixel ratio, or 1 when unavailable) whose contents are recorded by draw. The offscreen image is automatically released when cx is disposed.
func (*Scope) NewTray ¶
func (cx *Scope) NewTray(opts TrayOptions) *Tray
NewTray is the core's part of desktop.NewTray, which apps use: it adds a tray icon, the macOS menu bar's or the Windows notification area's, which cx keeps. It returns nil once cx is disposed.
func (*Scope) NotificationPermission ¶
func (cx *Scope) NotificationPermission(done func(NotificationPermission))
NotificationPermission answers done with whether the app may show notifications, without asking the user. On macOS checking uses the notification center as asking does, so from then on the app's Dock badge shows only while the user allows its badges.
func (*Scope) Now ¶
Now returns the time on the graph's clock: the system's, or a test's manual clock.
func (*Scope) ObserveWork ¶
ObserveWork implements tsx's engine-time accounting for this scope and its descendants. active runs on the engine goroutine when owned reactive, mounting, commit or layout work starts or stops. Nested work is counted once; work belonging to another observer or an unobserved scope pauses it. Install it once, before building the scope's views. Disposal removes it.
func (*Scope) OnAppURLChange ¶
func (cx *Scope) OnAppURLChange(fn func(AppURLChange)) func()
OnAppURLChange observes browser back, forward and address changes while cx lives. Its returned function unsubscribes. Read AppURL for the initial address; changes made before subscribing are not queued.
func (*Scope) OnBackPress ¶
OnBackPress runs fn when back is pressed (Escape, the back button or gesture, the browser's back) while the current owner lives and the user can see what it shows, as for OnKey: after the overlays and modals, which take it first, and before the navigation stacks, the newest handler first. fn returns true to take it; when none does, the top stack pops, else the platform goes back itself.
func (*Scope) OnDownloadUpdate ¶
func (cx *Scope) OnDownloadUpdate(fn func(DownloadProgress))
OnDownloadUpdate reports saved and live transfers while the current owner lives.
func (*Scope) OnExit ¶
func (cx *Scope) OnExit(exit func(done func()))
OnExit has exit play when the Presence branch cx is in leaves: exit starts what the part does to leave, such as a Motion's exit, and calls done once it ends, which it may do at once. The branch goes once every exit registered in it has called done. Outside a Presence, exit never runs and the part goes with its branch at once.
func (*Scope) OnHostEvent ¶
OnHostEvent calls fn with each event of name the embedding host sends (Host.Send), until the current owner is disposed. Events sent before the app had a listener of name are kept for it: the first listener hears them, in order, once the code adding it has run.
func (*Scope) OnKey ¶
OnKey runs fn when key is pressed, while the current owner lives and the user can see what it shows. key names modifiers and a key joined by "+": "mod+s" (Command on Apple platforms, Control elsewhere), "ctrl+shift+z", "alt+left", "escape", "enter", "f5", "a". Of the bindings of a key that fire where the focus is, the newest wins, and only it runs. It fires once while the key is held, and not while the view with the keyboard focus uses the key itself, a text input its editing keys, a button Return and Space, a slider or a tab bar its arrows (KeyAuto); OnKeyWith says else. A control that binds its own keys while it has the focus binds them with KeyNotEditing, or the focus it holds would keep them from it.
What the owner shows are the views of the nearest owner at or above it that has any. The binding rests while none of them shows: in a Holder's content no place shows, under a DisplayNone view such as a navigation stack's screen below the top, in a dismissed modal. While a modal is shown it rests too if any of them is outside the topmost modal, as the page under a dialog is, unless KeyOptions.OverModals. It fires again once they show, without binding it again.
func (*Scope) OnKeyWith ¶
func (cx *Scope) OnKeyWith(key string, opts KeyOptions, fn func())
OnKeyWith is OnKey firing as opts say.
func (*Scope) OnMediaCommand ¶
func (cx *Scope) OnMediaCommand(fn func(MediaCommand))
OnMediaCommand handles commands on the engine goroutine while its owner lives. The most recently registered live handler takes them. Without a handler the publication offers no controls.
func (*Scope) OnNetworkChange ¶
OnNetworkChange calls fn on the graph's goroutine only when the network state changes, until the scope is disposed.
func (*Scope) OnNotificationPress ¶
OnNotificationPress runs fn, while the current owner lives, with the ID of a notification the user pressed, which brings the app to the front. Presses that came before any handler, as the one that started the app, go to the first one registered.
func (*Scope) OnOpenFiles ¶
OnOpenFiles is the core's part of desktop.OnOpenFiles, which apps use: fn runs, while the current owner lives, with the paths of files the system asks the app to open. Files that came before any handler, as those the app launched to open, go to the first one registered.
func (*Scope) OnOpenLinks ¶ added in v0.2.0
OnOpenLinks is the core's part of desktop.OnOpenLinks and mobile.OnOpenLinks, which apps use: fn runs, while the current owner lives, with the links of the app's own URL schemes the system asks it to open. Links that came before any handler, as one the app launched to open, go to the first one registered.
func (*Scope) OnPurchaseUpdate ¶ added in v0.2.0
func (cx *Scope) OnPurchaseUpdate(fn func(Transaction))
OnPurchaseUpdate runs fn, while the current owner lives, with each transaction the store makes or changes outside a Purchase call: a renewal, a purchase approved after Ask to Buy or completed outside the app, one made on another device, a refund or a revocation, and as the app starts each transaction it has not finished. Transactions that came before any handler go to the first one registered, so register it as the app starts. Code whose Access does not grant AccessPurchases hears none.
func (*Scope) OnQuit ¶
OnQuit runs fn, while the current owner lives, as the app quits, however it stops: its own Quit, the last window closing, the Dock's or the system's quit, the runtime ending on Android, a host removing its view. A page hiding on the web and a watchOS app going to the background run it too, as the system may end either unheard, and keep it for the next time in case the app shows again. fn cleans up, such as saving a draft or closing a connection; it cannot keep the app running. The handlers run on the engine goroutine, oldest first, with one context that ends QuitTimeout after the first starts: a handler may wait on it for its own goroutines' work, and the engine ends once they return or the time is up.
func (*Scope) OnQuitRequest ¶
func (cx *Scope) OnQuitRequest(fn func(*QuitRequest))
OnQuitRequest is the core's part of desktop.OnQuitRequest. On desktop it runs fn while the current owner lives, when the user asks the app to quit or the system ends the session. Handlers run newest first. A user request goes on to the next handler until one cancels or defers it, or all accept it. A forced request cannot be canceled or deferred. Scope.Quit and Restart remain immediate.
func (*Scope) OnReopen ¶
func (cx *Scope) OnReopen(fn func())
OnReopen is the core's part of desktop.OnReopen, which apps use: fn runs, while the current owner lives, when the user opens the app again while it runs, from the Dock or by launching it a second time. With no handler the main window shows and takes the focus.
func (*Scope) OnShared ¶
func (cx *Scope) OnShared(fn func([]SharedItem))
OnShared is the core's part of mobile.OnShared.
func (*Scope) OpenFile ¶
func (cx *Scope) OpenFile(f SharedFile, done func(opened bool, err error))
OpenFile opens the file f names in the app the system associates with its type, the user choosing where several are: NSWorkspace on macOS, the shell on Windows, GtkFileLauncher on Linux, a document interaction's options on iOS and Intent.ACTION_VIEW on Android. On macOS, Windows and Linux f may name a folder, which opens in the file manager; phones have none to open it in, and answer an error. done, when not nil, learns whether an app opened it: false with no error when none opens its type, and the error when the file is missing or the platform failed. On Android the file is in the app's own storage, such as DataDir and CacheDir, and the app opening it reads it through a content URI the runtime grants it, until its activity finishes; the file stays the app's to keep there that long and to delete. The web opens no files.
func (*Scope) OpenInstallSettings ¶
OpenInstallSettings is the core's part of mobile.OpenInstallSettings, which apps use: it opens Android's setting that lets the app install packages.
func (*Scope) OpenOverlay ¶
func (cx *Scope) OpenOverlay(opts OverlayOptions, content func(cx *Scope) Node) *Window
OpenOverlay is the core's part of mobile.OpenOverlay, which apps use: it opens an overlay over other apps showing content, a tree of its own that belongs to cx and closes as cx goes. The app has one overlay at a time: it returns nil while another is open, once cx is disposed, off Android and where Access does not grant AccessOverlay. Without the permission the platform ends it at once (OverlayEndDenied).
func (*Scope) OpenPanel ¶
func (cx *Scope) OpenPanel(opts PanelOptions, content func(cx *Scope) Node) *Window
OpenPanel is the core's part of desktop.OpenPanel, which apps use: it opens a hidden panel showing content, for Show, Toggle or a tray icon to show. It belongs to cx, as OpenWindow does. It returns nil where the platform opens no windows or once cx is disposed.
func (*Scope) OpenPermissionSettings ¶
func (cx *Scope) OpenPermissionSettings(p Permission, done func(opened bool))
OpenPermissionSettings opens the page of the system's settings that gives p, and answers done, when not nil, with whether one opened: Privacy & Security at p's pane on macOS, the app's page in Settings on iOS and Android, and the microphone's or the camera's page of Privacy & security on Windows. Elsewhere it answers false.
func (*Scope) OpenURL ¶
OpenURL opens u outside the app: a web page in the browser, a mailto: or tel: link in its app, any scheme another app registered. An embedding host's handler (Host.HandleOpenURL) takes it first. done, when not nil, learns whether it opened: false for a URL CheckURL refuses, or one no app handles.
func (*Scope) OpenWindow ¶
func (cx *Scope) OpenWindow(opts WindowOptions, content func(cx *Scope) Node) *Window
OpenWindow is the core's part of desktop.OpenWindow, which apps use: it opens a window showing content, which belongs to cx and closes when cx goes. The scope a batch owns while it builds content is not cx: a window belongs to the scope the app opened it on, so rebuilding a panel or a page does not close a window opened from that code, and an app closing its window scope still closes its windows. It returns nil where the platform opens no windows or once cx is disposed.
func (*Scope) OrderFront ¶
func (cx *Scope) OrderFront()
OrderFront is the core's part of desktop.OrderFront, which apps use.
func (*Scope) OverlayPermission ¶
func (cx *Scope) OverlayPermission(done func(OverlayPermission))
OverlayPermission is the core's part of mobile.OverlayPermission, which apps use: done hears whether the app may show overlays, without asking the user.
func (*Scope) Palette ¶
Palette returns the colors of cx's subtree: its theme's palette in the appearance it shows, with the host's tokens over it. A binding that reads it runs again when any of them changes.
func (*Scope) PauseTracking ¶
func (cx *Scope) PauseTracking() (resume func())
PauseTracking stops subscribing the running computation to what is read until resume is called: for code that runs within a computation without belonging to it, as a promise's continuation the tsx package's VM runs as a JS call returns.
func (*Scope) PermissionStatus ¶
func (cx *Scope) PermissionStatus(p Permission, done func(PermissionStatus))
PermissionStatus answers done with whether the app has p, without asking the user.
func (*Scope) PickDirectories ¶
func (cx *Scope) PickDirectories(o PickDirectoriesOptions, done func(dirs []Directory, err error))
PickDirectories shows the system's folder picker and calls done with the folders the user picked, or none when they cancelled; err says what failed. Each is the user's own folder, which the app reads as an fs.FS: NSOpenPanel on macOS, IFileOpenDialog on Windows, GtkFileDialog, through the desktop portal where there is one, on Linux and UIDocumentPickerViewController on iOS give its path; Android's document tree picker and the web's folder picker give none, so the Directory reads through the platform and the app reads it off the engine's goroutine. Android and the web pick one folder. The pickers need no permission.
func (*Scope) PickFiles ¶
func (cx *Scope) PickFiles(o PickFilesOptions, done func(files []File, err error))
PickFiles shows the system's file picker and calls done with the files the user picked, as they are, or none when they cancelled; err says what failed. Each is a file on disk the app opens and streams: the user's own on desktops, a copy in the app's storage on iOS and Android (File.Temporary) that is the app's to delete, and none on the web, where File.Open reads it. The pickers need no permission.
func (*Scope) PickImages ¶
func (cx *Scope) PickImages(o PickOptions, done func(files []PickedFile))
PickImages shows the system's photo picker and calls done with the images the user picked, in the order picked, prepared as o says, or none when they cancelled: PHPickerViewController on iOS, Android's photo picker, an open panel on the desktops and a file chooser on the web. The mobile pickers need no permission.
func (*Scope) PickScreenColor ¶
PickScreenColor lets the user pick a color anywhere on the screen and calls done with it, or with false when they cancel or the platform has no way to (Env.CanPickScreenColor). base.ColorEyeDropper is its button.
func (*Scope) PlayHaptic ¶
PlayHaptic is the core's part of mobile.PlayHaptic, which apps use: it plays h on iOS and Android, and does nothing elsewhere.
func (*Scope) PlayHapticPattern ¶
func (cx *Scope) PlayHapticPattern(pattern HapticPattern)
PlayHapticPattern is the core's part of mobile.PlayHapticPattern. A new pattern replaces one already playing. An empty pattern stops it.
func (*Scope) PopupMenu ¶
PopupMenu is the core's part of desktop.PopupMenu, which apps use. A confined owner shows one only as Scope.Confine allows, else closed runs at once.
func (*Scope) Post ¶
func (cx *Scope) Post(fn func())
Post runs fn later on the graph's goroutine, under cx and in one batch. It is safe to call from any goroutine; fn does not run if cx is disposed first.
func (*Scope) PostHost ¶
PostHost sends data to the embedding host's handler of name, which has nothing to answer. Without a host or a handler it is dropped.
func (*Scope) PrefetchImage ¶
func (cx *Scope) PrefetchImage(src ImageSource, done func(ok bool))
PrefetchImage loads the image src names ahead of showing it, keeping its bytes for the views that show it next (NSH's Image.prefetch), and calls done, when not nil, with whether it loaded.
func (*Scope) Present ¶
Present reports whether the Presence branch cx is in is shown, false once it started leaving: a part reads it to stop taking presses as it goes. Outside a Presence it is true.
func (*Scope) Products ¶ added in v0.2.0
Products answers done with the products of ids the store sells, in the store's order, leaving out IDs it does not know; no IDs answer none without asking. Their prices are the store's, formatted for the user's storefront. Where the platform has no store, as Env.CanPurchase says, it answers PurchasesUnavailable without asking. Code whose Access does not grant AccessPurchases gets AccessDenied.
func (*Scope) ProvideAccess ¶
ProvideAccess holds the current owner and what it owns to a: what they render and the services they call, until the owner is disposed. An owner below with an Access of its own is held to both.
func (*Scope) ProvideHost ¶
ProvideHost has the current owner and what it owns reach h in place of the app's host, until the owner is disposed: CallHost, PostHost, OnHostEvent, HostParams and the URLs OpenURL offers h's handler. nil leaves them with no host. A host app gives each view of code it did not write a channel of its own this way (tsx.View).
func (*Scope) ProvideSecrets ¶ added in v0.2.0
ProvideSecrets gives the current owner and what it owns a partition of the app's secrets, name's: their Secrets keep their items under a service of their own, the app's own Service and the partition's name, and cannot name another service or access group. A host app gives code it did not write a partition of its own this way (tsx.View), as ProvideStorage does its storage.
func (*Scope) ProvideStorage ¶
ProvideStorage gives the current owner and what it owns a partition of the app's storage, name's, in place of the whole: its keys are only theirs, the app's own Storage neither lists nor clears them, and they hold at most quota bytes, 0 for no quota of their own; they count against the app's StorageQuota too. A host app gives code it did not write a partition of its own this way (tsx.View).
func (*Scope) Purchase ¶ added in v0.2.0
func (cx *Scope) Purchase(product string, opts PurchaseOptions, done func(Transaction, error))
Purchase buys the product whose ID is product through the store's sheet, from the app's own button, and answers done once: with the transaction, which the app's server verifies before the app delivers what was bought and finishes it, or with a PurchaseError, PurchaseCancelled when the user closes the sheet and PurchasePending while the purchase waits for approval, whose transaction comes through OnPurchaseUpdate. An AccountToken that is no UUID fails without asking. It is held and unavailable as Products is.
func (*Scope) QuickLook ¶
QuickLook is the core's part of desktop.QuickLook, which apps use: it shows the system's file preview panel on paths, starting at index, clamped to the list. It reports whether it asked the platform: false for an empty list, a path that is not a regular file, where Env.CanQuickLook is false, and for a confined owner as Scope.Confine allows a PopupMenu.
func (*Scope) Quit ¶
func (cx *Scope) Quit()
Quit ends the app: desktops close the window, the app's last, and return from nsgo.Run; Android finishes the app's activity. iOS apps do not quit themselves, and the web leaves the page open.
func (*Scope) Quitting ¶
Quitting runs the OnQuit handlers of the graph whose root cx is, for the engine as it stops, and reports whether there were any. Each runs once: a second call runs none.
func (*Scope) ReadAsset ¶
ReadAsset reads the bytes of a file in the app's resources, named by an asset: URL such as asset:maps/level.bin. It calls done later on the engine's goroutine, unless the owner that asked was disposed or ran again. A missing file returns ErrAssetNotFound, which errors.Is matches.
func (*Scope) ReadClipboard ¶
ReadClipboard calls done with the clipboard's text, "" when it holds none. On iOS, reading it may show the system's paste notice.
func (*Scope) ReadClipboardFiles ¶
ReadClipboardFiles calls done with the file: URLs of the local files on the clipboard, such as files copied in a file manager, which FileFromURL opens, none when it holds none.
func (*Scope) ReadClipboardImage ¶
func (cx *Scope) ReadClipboardImage(done func(img ClipboardImage, ok bool, err error))
ReadClipboardImage calls done with the clipboard's image as a PNG, or ok false when it holds none. An image it cannot read, or whose PNG is over MaxClipboardImage bytes (CodeQuotaExceeded), fails. On iOS, reading it may show the system's paste notice.
func (*Scope) ReadClipboardItems ¶
func (cx *Scope) ReadClipboardItems(done func([]ClipboardItem, error))
ReadClipboardItems calls done with a snapshot of the clipboard's native format names and bytes. The combined bytes are limited to 48 MiB. A platform without representation access reports CodeUnavailable.
func (*Scope) RegisterFont ¶
RegisterFont registers the font file data (TrueType, OpenType or a collection) with the platform, so text finds its families as a Style's FontFamily names them, as nsgo.Fonts' are, and prepares the text shown and records the canvases shown again once the font is available: call it before the text that uses it shows. Without a platform that registers fonts as the app runs (a headless test's) it does nothing.
func (*Scope) RegisterHotKey ¶
RegisterHotKey is the core's part of desktop.RegisterHotKey, which apps use: fn runs when key, in OnKey's form, is pressed whichever app has the focus, while the current owner lives. The handle it returns says whether the platform registered it.
func (*Scope) RenderEffect ¶
func (cx *Scope) RenderEffect(fn func())
RenderEffect runs fn now and again, before the app's effects, whenever what it read changes, as element bindings do: the tsx package's bindings (NSH's render effects).
func (*Scope) RequestAnimationFrame ¶
RequestAnimationFrame calls fn once, on the graph's goroutine, when the next display frame begins, with the frame's time: the display's own where the platform gives one, so the difference between two frames' times is the display's frame length rather than when the graph got to each, and the graph clock's otherwise. The time is on the graph clock's base, never precedes the previous frame's, and may lie a frame ahead of Scope.Now where it is when the frame will show. The core asks the host for that frame when the first callback waits (RootOptions.RequestFrame), and the host calls RunFrame or RunFrameAt when it begins. A host without display frames never does, so the callback waits.
stop cancels the wait, and a callback whose owner is disposed does not run. A callback that wants every frame registers again from within fn:
var loop func(at time.Time)
loop = func(at time.Time) {
move(at)
cx.RequestAnimationFrame(loop)
}
cx.RequestAnimationFrame(loop)
func (*Scope) RequestNotificationPermission ¶
func (cx *Scope) RequestNotificationPermission(done func(NotificationPermission))
RequestNotificationPermission asks the user to let the app show notifications, with the system's prompt the first time, and answers done with the permission. Ask as the user does something that needs them: browsers refuse a prompt the user did not cause, and iOS and Android ask only once. An iOS app's badge needs it too, as does a macOS app's once it checks or asks for the permission or shows a notification.
func (*Scope) RequestOrientation ¶
func (cx *Scope) RequestOrientation(mask Orientation)
RequestOrientation asks iOS, Android, HarmonyOS or the browser to show the app in one of the given interface orientations while the current scope lives. The newest live request wins. When none remains, the system applies its usual orientation policy. A zero mask makes no request. On iOS a presented modal's SupportedOrientations takes precedence. On the web, enter full screen from a press to let the browser lock orientation. Refusals go to the browser log.
func (*Scope) RequestOverlayPermission ¶
func (cx *Scope) RequestOverlayPermission(done func(OverlayPermission))
RequestOverlayPermission is the core's part of mobile.RequestOverlayPermission, which apps use: it opens the system's setting that lets the app show overlays and done hears the permission as the app comes back to the front, or at once where there is nothing to ask. Call it as the user does something that needs it.
func (*Scope) RequestPermission ¶
func (cx *Scope) RequestPermission(p Permission, done func(PermissionStatus))
RequestPermission asks the user for p with the system's prompt, where it has one and has not asked yet, and answers done with the status then. Ask as the user does something that needs it. An Apple build whose Info.plist lacks p's usage description answers PermissionUnavailable and logs the key it needs, as the system would end the app as it asks. macOS lists the app under Accessibility, Screen Recording and Input Monitoring as it asks, and answers before the user turns it on there, which desktop.GuidePermission waits for.
func (*Scope) RequestPreciseLocation ¶
func (cx *Scope) RequestPreciseLocation(purpose string, done func(full bool, err error)) (*SensorStream, error)
RequestPreciseLocation explicitly asks for a temporary full-accuracy location grant. purpose is an Apple NSLocationTemporaryUsageDescriptionDictionary key; Android asks for its declared fine-location permission. It returns authorization, not a position, and a denied accuracy upgrade may answer full=false without revoking approximate location. Disposal suppresses the pending answer.
func (*Scope) RequestQuit ¶
func (cx *Scope) RequestQuit()
RequestQuit is the core's part of desktop.RequestQuit.
func (*Scope) RequestRefund ¶
func (cx *Scope) RequestRefund(transactionID string, done func(RefundStatus, error))
RequestRefund asks the store to begin a refund request for transactionID. The callback receives RefundSuccess when the request was submitted or RefundCancelled when the user closes the store UI.
func (*Scope) RequestRestart ¶
func (cx *Scope) RequestRestart()
RequestRestart is the core's part of desktop.RequestRestart. It asks the quit request handlers before restarting, leaving the app running when a handler cancels and waiting when one defers its answer.
func (*Scope) RequestReview ¶
func (cx *Scope) RequestReview()
RequestReview asks the platform's store for an in-app rating where Env.CanRequestReview is true. The store decides when to show the prompt and reports no result. Under a confined owner, Scope.Confine applies.
func (*Scope) ResolveImage ¶
func (cx *Scope) ResolveImage(src ImageSource) ImageSource
ResolveImage returns src as core mounts it at the screen's current pixel ratio, for a tool that must act on the file an image really shows: the URI is the variant the scales pick, and Scales and Variants are cleared. It reads the pixel ratio tracked, so the caller runs again when the window moves to a screen of another ratio.
func (*Scope) Restart ¶
func (cx *Scope) Restart()
Restart is the core's part of desktop.Restart, which apps use: the app quits as Quit ends it, and nsgo.Run starts it again.
func (*Scope) RestoreInputSource ¶
func (cx *Scope) RestoreInputSource()
RestoreInputSource goes back to the source SelectInputSource replaced, unless the user chose another since.
func (*Scope) RevealFile ¶
RevealFile is the core's part of desktop.RevealFile, which apps use: it opens the file manager with the file or folder at path selected, and answers an error when the path is missing or the platform has no file manager.
func (*Scope) Run ¶
func (cx *Scope) Run(fn func())
Run runs fn untracked with cx owning what it creates, whichever owner runs now, as Solid's runWithOwner: the tsx package's roots and rows (NSH's with_root). A panic goes to the nearest Catch above cx.
func (*Scope) RunFrame ¶
func (cx *Scope) RunFrame()
RunFrame runs the callbacks waiting for the display frame that begins now. A host with one clock calls it once per RootOptions.RequestFrame.
func (*Scope) RunFrameAt ¶
RunFrameAt is RunFrame for a frame stamped by the display on the graph clock's base. The zero time uses the graph clock's now.
func (*Scope) SaveFile ¶
func (cx *Scope) SaveFile(o SaveOptions, done func(saved bool, path string, err error))
SaveFile shows the system's save dialog and copies the file o names to where the user chose, streaming it, then calls done with whether it was saved, false with no error when they cancelled, and on desktops the path it was saved at, which an app saves to directly next time. A save that fails leaves nothing where the user chose, or the file that was there. The web has no files on disk, so it saves Data: a save picker where the browser has one, else a download, which counts as saved. An iOS or HarmonyOS save requiring preflight reports an error.
func (*Scope) ScanCode ¶
func (cx *Scope) ScanCode(o ScanOptions, done func(code *ScannedCode, err error))
ScanCode shows the camera for the user to point at a code, and calls done with the first one it reads of the kinds o asks for, as the camera sees it, or with nil when the user closes it; err says what failed, such as a refused permission or ErrNoScanner. macOS and iOS read codes with AVFoundation's metadata output and need NSCameraUsageDescription in the app's Info.plist. On macOS the preview appears in an AppKit sheet when the app has a visible window. On iOS it fills the screen. Android shows Camera2's preview and reads its frames in Go, every kind but PDF417, and needs CAMERA in the app's manifest (nsgo.yaml's android.permissions). Windows (MediaCapture) and Linux (the desktop Camera portal with GStreamer pipewiresrc) show the preview in a modal over the window and read its frames in Go, as Android does; the web shows it over the page and reads it with getUserMedia and BarcodeDetector. A code holds whatever whoever printed it chose, so treat its text as untrusted input.
func (*Scope) Secrets ¶ added in v0.2.0
Secrets returns the app's secure store under its own service, or under its partition's (ProvideSecrets). Code whose Access does not grant AccessSecrets gets one that fails with AccessDenied.
func (*Scope) SelectInputSource ¶
SelectInputSource selects the enabled keyboard input source of id, as Input's InputSource does, remembering the one it replaces. An id is the platform's: a Text Input Sources ID on macOS ("com.apple.keylayout.ABC"), a keyboard layout ID on Windows ("00000409"), and a Fcitx 5 input method ("keyboard-us") or an IBus engine ("xkb:us::eng") on Linux. Phones and the web ignore it.
func (*Scope) ServeScheme ¶
ServeScheme registers an app-owned URL scheme for web views created under cx: cx and what it owns, where the nearest scope serving a scheme answers it, and no other subtree or window. A web view serves the schemes registered before its native view is made; the handler runs on the platform's UI thread and returns the response body, which every request answers with status 200 whatever its method, as ServeSchemeRequest's handler of WebSchemeResponse{Body: handler(url)}. The response's content type is inferred from the URL and bytes by the native backend. It refuses the schemes web views handle themselves, such as http, ws or javascript.
func (*Scope) ServeSchemeRequest ¶
func (cx *Scope) ServeSchemeRequest(scheme string, handler func(*WebSchemeRequest) *WebSchemeResponse) error
ServeSchemeRequest registers an app-owned URL scheme for web views created under cx, as ServeScheme does, whose handler sees the request — its URL, its method where the platform reports one and its headers where it gives them — and answers its status, headers and body: status as HTTP's, 405 for a method the scheme refuses among them, with 0 for 200 and a nil response for 404, an empty body. The response's content type is the response's Content-Type header, else what the native backend infers from the URL and body. As WebKit checks them, a scheme's cross-origin fetches also need the response's Access-Control-Allow-Origin header; WebView2 lets no page of another scheme request it.
func (*Scope) SetAppURL ¶
func (cx *Scope) SetAppURL(raw string, options ...AppURLOptions) error
SetAppURL sets the app's address, replacing the browser entry by default. HistoryPush asks for a new entry; a navigation push in the same commit supplies that entry instead. Relative addresses resolve against the page's base and must stay on its origin. No navigation or network request occurs. Other targets keep the address. Confined subtrees cannot change it.
func (*Scope) SetAppearance ¶
func (cx *Scope) SetAppearance(a Appearance)
SetAppearance shows the app light or dark whatever the system's appearance, or follows it again with AppearanceSystem: Env.Dark reports the one shown, and the platform's own chrome, such as title bars, alerts, menus, system headers and the views it hosts, follows.
func (*Scope) SetApplicationMenu ¶
SetApplicationMenu is the core's part of desktop.SetApplicationMenu, which apps use.
func (*Scope) SetBadge ¶
SetBadge shows count on the app's icon, and 0 or less clears it: the Dock's on macOS, which needs the user to allow the app's badges once it checks or asks for the notification permission or shows a notification, the Home Screen's on iOS, which needs the notification permission, the taskbar button's on Windows, the launcher's on Linux where it follows Unity's LauncherEntry API, such as Ubuntu's dock, Plasma and Dash to Dock, and an installed web app's. Android has no count to set: launchers mark an app whose notifications show, and count goes with those shown after it. Elsewhere nothing happens.
func (*Scope) SetClipboard ¶
SetClipboard puts text on the system clipboard, replacing what it holds.
func (*Scope) SetClipboardImage ¶
SetClipboardImage puts the image data encodes on the system clipboard, replacing what it holds: PNG, JPEG, GIF or WebP bytes, as ReadClipboardImage gives them or an ImageSource holds them.
func (*Scope) SetDockMenu ¶ added in v0.2.0
SetDockMenu is the core's part of desktop.SetDockMenu, which apps use. The menu belongs to the current owner, and replaces the one any surface set before.
func (*Scope) SetDockVisible ¶
SetDockVisible is the core's part of desktop.SetDockVisible, which apps use: on macOS it shows the app in the Dock and the app switcher, or leaves it to its tray icon and windows.
func (*Scope) SetFullScreen ¶
SetFullScreen is the core's part of desktop.SetFullScreen, which apps use.
func (*Scope) SetImageCacheLimit ¶
SetImageCacheLimit bounds the unkept bytes retained by each platform image cache. Negative values become zero, disabling unkept retention. Encoded caches count source bytes; browser sources of unknown length and shader textures count four bytes per pixel. KeepImage pins, loads under way and the current drawing pass may exceed the limit. This is not a cap on decoded pixels or process memory.
func (*Scope) SetLaunchAtLogin ¶
SetLaunchAtLogin is the core's part of desktop.SetLaunchAtLogin, which apps use: the system starts the app as the user logs in, or no more.
func (*Scope) SetLocale ¶
SetLocale makes the app run in locale, a BCP 47 tag, whatever the user's or the host's: the language it shows, its formats and its direction follow. "" follows theirs again. The app keeps the choice for later launches itself, as in its storage.
func (*Scope) SetMainView ¶
SetMainView is the core's part of nsgo.SetMainView, which apps use: it shows view in the main window, which it opens where the platform opens windows, or in the app's one surface elsewhere. A later call replaces the view.
func (*Scope) SetMainWindow ¶
SetMainWindow is the core's part of desktop.SetMainWindow, which apps use: the window ShutdownOnMainWindowClose follows and the Dock shows again.
func (*Scope) SetMenuBar ¶
func (cx *Scope) SetMenuBar(mode MenuBarMode)
SetMenuBar is the core's part of desktop.SetMenuBar, which apps use.
func (*Scope) SetNowPlaying ¶
func (cx *Scope) SetNowPlaying(info NowPlaying)
SetNowPlaying replaces the app's system media information. Call it when playback, position or rate changes. The system advances the published position between calls. Artwork is copied before returning. On a platform without Env.CanShowNowPlaying this does nothing.
func (*Scope) SetPreferredFrameRate ¶
func (cx *Scope) SetPreferredFrameRate(rate FrameRateRange)
SetPreferredFrameRate changes the rate wanted by RequestAnimationFrame on the current surface. A zero range restores its usual display rate. The platform may deliver a slower rate. An invalid range is ignored.
func (*Scope) SetScrollbars ¶
func (cx *Scope) SetScrollbars(m ScrollbarMaker)
SetScrollbars is the core's part of base.SetScrollbarTheme, which apps use: m draws the bar of every scroll view, list and multiline input of the surface that shows its indicator and has no bar of its own; nil gives them the platform's back.
func (*Scope) SetShutdownMode ¶
func (cx *Scope) SetShutdownMode(m ShutdownMode)
SetShutdownMode is the core's part of desktop.SetShutdownMode, which apps use.
func (*Scope) SetSkipTaskbar ¶ added in v0.2.0
SetSkipTaskbar is the core's part of desktop.SetSkipTaskbar, which apps use.
func (*Scope) SetSoundLimits ¶
func (cx *Scope) SetSoundLimits(limits SoundLimits) error
SetSoundLimits implements audio.SetSoundLimits. Restricted scopes cannot change the engine's limits.
func (*Scope) SetStatusBar ¶
func (cx *Scope) SetStatusBar(patch StatusBarSetting)
SetStatusBar patches the app's default system bars, under the screens' and modals' settings, with the fields patch sets. It is the core's part of mobile.Immersive.
func (*Scope) SetSubtreeAppearance ¶
func (cx *Scope) SetSubtreeAppearance(a Appearance)
SetSubtreeAppearance shows cx and everything it builds from now on light or dark whatever the appearance above it, the platform's views in it too where the platform scopes appearance to a view; AppearanceSystem follows the one above again. Scope.SetAppearance forces the app's.
func (*Scope) SetTaskProgress ¶
func (cx *Scope) SetTaskProgress(p TaskProgress)
SetTaskProgress shows p on the taskbar button of the scope's window on Windows, or on the app's icon on macOS and Linux. On Windows, a scope whose surface has no button, such as the app's own scope where it opens its windows, a panel or a tray icon's view, sets the progress every window of the app shows while it sets none of its own. Android, iOS and the web ignore it. Where one indicator shows the progress of several windows, the latest call wins, whichever window's changes commit first. Repeating the value the same window sent last sends nothing, unless another window changed the progress since.
func (*Scope) SetTheme ¶
SetTheme gives cx and everything it builds from now on theme t; a nil t takes back what an earlier call gave, so the theme above shows. Called at the app's root it is the app's theme; a deeper call wins for its subtree, so a sidebar or a panel can take another. A theme changed after it is set is not followed: set a changed copy instead.
func (*Scope) SetTitleBar ¶
func (cx *Scope) SetTitleBar(style TitleBarStyle, height Points)
SetTitleBar is the core's part of desktop.SetTitleBar, which apps use.
func (*Scope) SetWebCookies ¶ added in v0.2.0
SetWebCookies adds cookies to the store every web view of the app shares, replacing those of the same name, domain and path, HttpOnly ones included, which page scripts can neither read nor write, and calls done on the engine's goroutine once the store holds them, so that a page loaded after it sends them: an app carries a sign-in into its web views this way. An Expires in the past removes the same name, domain and path. It works whether or not a web view is shown. The store is the persistent one: a cookie with an Expires outlives the app, and an Incognito web view never sees these, but on Android, which keeps one cookie store per app. Apple platforms write WKWebsiteDataStore's default store, Windows the WebView2 profile the app's web views share, through a hidden web view while none shows, Linux the app's WebKitGTK network session and Android CookieManager. Where the platform has no store, as on HarmonyOS, on the web and where Env.HasWebView is false, done gets an Unavailable error, and a cookie no platform would take, such as one without a name or a domain, SameSite None without Secure, or a "__Secure-" or "__Host-" name without what its prefix needs, fails before any is written. Code an Access holds needs the webview capability's cookies (AccessCookies) for each cookie's URL.
func (*Scope) SetWindowConstraints ¶
func (cx *Scope) SetWindowConstraints(c WindowConstraints)
SetWindowConstraints is the core's part of desktop.SetWindowConstraints, which apps use.
func (*Scope) SetWindowControls ¶
func (cx *Scope) SetWindowControls(c WindowControls)
SetWindowControls is the core's part of desktop.SetWindowControls, which apps use.
func (*Scope) SetWindowFrame ¶
func (cx *Scope) SetWindowFrame(f WindowFrame)
SetWindowFrame is the core's part of desktop.SetWindowFrame, which apps use.
func (*Scope) SetWindowLevel ¶
func (cx *Scope) SetWindowLevel(level WindowLevel)
SetWindowLevel is the core's part of desktop.SetWindowLevel, which apps use.
func (*Scope) SetWindowMaterial ¶
func (cx *Scope) SetWindowMaterial(m WindowMaterial)
SetWindowMaterial is the core's part of desktop.SetWindowMaterial, which apps use.
func (*Scope) SetWindowPointerEvents ¶ added in v0.2.0
func (cx *Scope) SetWindowPointerEvents(p WindowPointerEvents)
SetWindowPointerEvents is the core's part of desktop.SetWindowPointerEvents, which apps use.
func (*Scope) SetWindowShadow ¶ added in v0.2.0
SetWindowShadow is the core's part of desktop.SetWindowShadow, which apps use.
func (*Scope) SetWindowTransparent ¶ added in v0.2.0
SetWindowTransparent is the core's part of desktop.SetWindowTransparent, which apps use.
func (*Scope) SetWindowWorkspaces ¶ added in v0.2.0
func (cx *Scope) SetWindowWorkspaces(w WindowWorkspaces)
SetWindowWorkspaces is the core's part of desktop.SetWindowWorkspaces, which apps use.
func (*Scope) Share ¶
func (cx *Scope) Share(o ShareOptions, done func(shown bool, err error))
Share shows the system's share sheet for what o names, for the user to send it to another app: UIActivityViewController on iOS, NSSharingServicePicker on macOS, an Intent.ACTION_SEND chooser on Android, the Share UI (IDataTransferManagerInterop) on Windows, the desktop portal's OpenURI chooser or the file manager on Linux, and navigator.share on the web. Disk files go by path or content URI, never through the platform's bridge, so large ones cost nothing more; on the web, and anywhere else a file is held in memory, SharedFile.Data carries its bytes. done, when not nil, learns whether the sheet showed (or on the web and Linux portal, completed rather than being cancelled), with the error when it did not: a missing file, or a platform or browser without a share sheet. That it showed says nothing of what the app the user chose did with what it received. On Android the files are in the app's own storage, such as DataDir and CacheDir, and the app chosen reads them through content URIs the runtime grants it, until its activity finishes; the files stay the app's to keep there that long and to delete.
func (*Scope) ShowAlert ¶
func (cx *Scope) ShowAlert(a AlertConfig, done func(index int))
ShowAlert is the core's part of base.ShowAlertDialog, which apps use: it shows a native alert and calls done with the index of the button chosen, or -1 when it was dismissed without one. done runs even when the owner that showed the alert is gone, such as a closed menu. A confined owner shows one only as Scope.Confine allows, else done gets -1 at once.
func (*Scope) ShowAppClipOverlay ¶
func (cx *Scope) ShowAppClipOverlay(position AppClipOverlayPosition) (dismiss func())
ShowAppClipOverlay implements mobile.ShowAppClipOverlay. Its request belongs to the current owner and is dismissed as that owner ends.
func (*Scope) ShowNotification ¶
func (cx *Scope) ShowNotification(n Notification, done func(shown bool)) error
ShowNotification shows n, also while the app is in front, or schedules it for its At or Repeat, and answers done, when not nil, with whether the system took it: false without the permission, and for a scheduled one where Env.CanScheduleNotifications is false. It returns ErrNotification, calling no done, for n without an ID or a title, or with a Repeat but no At.
func (*Scope) SignInMiniProgram ¶
func (cx *Scope) SignInMiniProgram(opts MiniProgramSignInOptions, done func(MiniProgramCredential, error))
SignInMiniProgram asks WeChat, QQ or Douyin for a login code, or Alipay for an auth_base authorization code. The app sends the credential to its server for exchange; it keeps app secrets there. It does not open an OAuth URL or call AuthSession's URL builder. Other targets answer MiniProgramSignInUnavailable. AccessMiniProgramSignIn holds the request, and done runs once under its owner.
func (*Scope) SignInWithApple ¶ added in v0.2.0
func (cx *Scope) SignInWithApple(opts AppleSignInOptions, done func(AppleCredential, error))
SignInWithApple shows the system's Sign in with Apple sheet, from the app's own button, and answers done once: with the credential, or with an AppleSignInError, AppleSignInCancelled when the user closes the sheet. macOS, iOS and tvOS show it to an app signed with the com.apple.developer.applesignin entitlement, which nsgo build claims when nsgo.yaml's apple.sign_in_with_apple is set; elsewhere it answers AppleSignInUnavailable without asking the platform. Code whose Access does not grant AccessSignInWithApple gets AccessDenied.
func (*Scope) Speak ¶ added in v0.2.0
Speak speaks text aloud in voice, one utterance at a time in an engine: a new one stops the one speaking, and so do StopSpeaking and the end of the scope that spoke it. done, which may be nil, runs once, after Speak returns, when the utterance finished, with stopped when it was stopped first, or with a SpeakError when it failed. macOS, iOS and tvOS speak with AVSpeechSynthesizer, Android with TextToSpeech, Windows with SpeechSynthesizer, Linux with speech-dispatcher and the web with speechSynthesis; elsewhere it fails with SpeakUnavailable (Env.CanSpeak). It returns an error only for a voice's Lang that is no language tag, without calling done.
func (*Scope) StartAnimation ¶
func (cx *Scope) StartAnimation(a *Animation, done func(finished bool)) *AnimationRun
StartAnimation runs a on the platform and calls done, if not nil, under the current owner with whether it ran to its end, once. Stopping or resetting it, a value's Set or Stop, or another animation of one of its values ends it early. The owner going stops it.
func (*Scope) StartSpeech ¶
func (cx *Scope) StartSpeech(opts SpeechOptions) (*SpeechSession, error)
StartSpeech recognizes what the user says, one session at a time: a new one aborts the one running, and the scope that started it going aborts it too. macOS and iOS recognize with the Speech framework (Info.plist declaring NSMicrophoneUsageDescription and NSSpeechRecognitionUsageDescription), Android with SpeechRecognizer (android.permissions declaring RECORD_AUDIO), Windows with WinRT's Windows.Media.SpeechRecognition, and the web with SpeechRecognition where the browser exposes it; elsewhere the session ends with SpeechUnavailable. It fails only for a Lang that is no language tag.
func (*Scope) StopSpeaking ¶ added in v0.2.0
func (cx *Scope) StopSpeaking()
StopSpeaking stops the utterance the engine speaks, whose done hears it stopped; it does nothing when none is spoken.
func (*Scope) Storage ¶
Storage returns the app's storage: the host's Store, or one in memory for the graph's life when the host gave none.
func (*Scope) Store ¶
Store returns the graph's Store, the host's or the one in memory Storage makes, which a host may pass to another root's RootOptions.Storage so its graphs share the app's entries, quota and persistence. It is the whole store, not the partition ProvideStorage gives the current owner.
func (*Scope) SyncPurchases ¶ added in v0.2.0
SyncPurchases has the store bring the user's transactions up to date, which it does on its own otherwise, and answers done: nil, then CurrentEntitlements answers what it found, or a PurchaseError, PurchaseCancelled when the user declines to sign in. Call it only from a Restore Purchases button the user presses, as it may ask them to sign in to their account. It is held and unavailable as Products is.
func (*Scope) TakePhoto ¶
func (cx *Scope) TakePhoto(o PhotoOptions, done func(photo *PickedFile, err error))
TakePhoto shows the system's camera for the user to take one photo and calls done with it, a JPEG turned upright and prepared as o says, or with nil when they cancelled; err says what failed, such as a refused permission or ErrNoCamera. iOS shows UIImagePickerController and needs NSCameraUsageDescription in the app's Info.plist; Android starts the camera app, and the web a file chooser that offers it. The desktops show ScanCode's camera preview with a button that takes the photo: macOS in an AppKit sheet with AVCapturePhotoOutput, needing NSCameraUsageDescription as iOS does, and Windows (MediaCapture) and Linux (the desktop Camera portal with GStreamer pipewiresrc) in a modal over the window, encoding the frame shown as the JPEG.
func (*Scope) Theme ¶
Theme returns the theme of cx's subtree: the nearest SetTheme's, else DefaultTheme. Host tokens reach its colors through Palette. A binding that reads it runs again when it changes.
func (*Scope) ToggleFullScreen ¶
func (cx *Scope) ToggleFullScreen()
ToggleFullScreen is the core's part of desktop.ToggleFullScreen, which apps use.
func (*Scope) ToggleMaximize ¶
func (cx *Scope) ToggleMaximize()
ToggleMaximize is the core's part of desktop.ToggleMaximize, which apps use.
func (*Scope) TrashFile ¶
TrashFile is the core's part of desktop.TrashFile, which apps use: it moves the file or folder at path to the user's Trash or Recycle Bin, and never deletes it permanently, answering ErrNoTrash where it cannot be recycled. trashedAt is the item's path in the trash where the platform reports it, and "" elsewhere, such as on Linux.
func (*Scope) Tween ¶
func (cx *Scope) Tween(from, to float64, c TimingConfig, update func(float64), done func(finished bool)) *AnimationRun
Tween calls update with numbers from from to to on each display frame, over c's duration after its delay, eased as Timing moves a value: for what the animation graph cannot draw, such as a figure counting up in a text. It calls done, if not nil, under the current owner with whether it reached to, once, as StartAnimation does. It counts as an animation that ends, so an nsgotest step that starts it waits for to; under reduced motion it calls update with from, then to, at once. Its run's Stop leaves the number where it is and Reset gives update from again; the owner going stops it.
func (*Scope) Untrack ¶
func (cx *Scope) Untrack(fn func())
Untrack runs fn without subscribing the running computation to what it reads.
func (*Scope) UpdateActive ¶
UpdateActive reports whether an in-app update download or install is currently running for this app (package updater), without subscribing.
func (*Scope) UserDir ¶
func (cx *Scope) UserDir(dir StandardDir) (string, error)
UserDir returns the absolute path of the user's folder dir, as the system names it now; the folder may not exist yet (desktop.UserDir).
func (*Scope) Voices ¶ added in v0.2.0
Voices answers with the voices installed that speak lang, a BCP 47 tag that matches itself and the tags under it ("en" matches "en-US" and "en-GB"), or with every voice when lang is "", sorted by language and name, so an app can tell the user to install a voice it lacks. Where Env.CanSpeak is false, or the current owner's Access refuses AccessTextToSpeech, it answers with none without asking the platform.
func (*Scope) WallTime ¶
WallTime returns the date and time the app shows: Now, local time on the system's clock, unless a test's manual clock set its wall time apart (ManualClock.SetWallTime), in the location of the time it was given.
func (*Scope) WatchActivity ¶
func (cx *Scope) WatchActivity(sample func(ActivitySample), failed func(error)) (*SensorStream, error)
WatchActivity follows native fitness classifications under AccessMotion and PermissionActivityRecognition. It does not infer walking or driving from raw acceleration; a platform with no classifier reports SensorNotAvailable.
func (*Scope) WatchBackgroundMotion ¶
func (cx *Scope) WatchBackgroundMotion(opts BackgroundMotionOptions, sample func(MotionSample), failed func(error)) (*SensorStream, error)
WatchBackgroundMotion requests a live motion stream with an explicit duration, held separately by AccessMotion and AccessBackgroundMotion. Apple may expire its execution lease sooner. Android requires an explicitly declared foreground service and a notification title. It stops with its scope and never records after process termination. Duration or early OS lease expiry answers SensorTimedOut; it is not CMSensorRecorder's uncancellable recording.
func (*Scope) WatchGeofences ¶
func (cx *Scope) WatchGeofences(opts GeofenceOptions, sample func(GeofenceSample), failed func(error)) (*SensorStream, error)
WatchGeofences monitors up to twenty WGS 84 circles under AccessLocation and PermissionLocation. Background also requires AccessBackgroundLocation and the platform's background authorization/declarations. Stop removes only its regions; no subscription is restored after process death. The OS can wake an app for a registered region; callbacks belong only to the scope that created it. Samples are latest state per region.
func (*Scope) WatchLocation ¶ added in v0.2.0
func (cx *Scope) WatchLocation(opts LocationOptions, sample func(LocationFix), failed func(error)) (*SensorStream, error)
WatchLocation starts a stream under PermissionLocation, which it never asks for. Foreground streams pause in background and mark their first resumed fix with Gap. Background streams require AccessLocation and AccessBackgroundLocation, the platform's declaration and PermissionBackgroundLocation; they never restart a killed process.
func (*Scope) WatchMotion ¶ added in v0.2.0
func (cx *Scope) WatchMotion(opts MotionOptions, sample func(MotionSample), failed func(error)) (*SensorStream, error)
WatchMotion starts raw or fused sensors at the requested interval, clamped to 10 ms–1 s, under PermissionMotion, which it never asks for. Zero requests accelerometer at 20 ms. Samples use natural device axes, with +9.80665 m/s² on z face-up, and report dropped samples. Motion always pauses in background; it never keeps a process alive.
func (*Scope) WatchPressure ¶
func (cx *Scope) WatchPressure(sample func(PressureSample), failed func(error)) (*SensorStream, error)
WatchPressure follows barometric pressure in pascals and optional relative altitude under AccessMotion. Apple requires the Motion & Fitness grant (PermissionActivityRecognition); Android needs no runtime permission. It never invents altitude from pressure and never prompts for authorization.
func (*Scope) WatchScroll ¶
func (cx *Scope) WatchScroll(target func() *Ref, fn func(ScrollEvent))
WatchScroll has fn hear where the scroll view or list target returns is whenever its offset, viewport or content changes, from the first time it is laid out, as long as cx lives. target is read in each commit, so a ref bound later in the same render is found once it is mounted. The report follows the commit, or the platform's event, that moved it.
func (*Scope) WatchSteps ¶
func (cx *Scope) WatchSteps(sample func(StepSample), failed func(error)) (*SensorStream, error)
WatchSteps follows the provider's cumulative steps in an explicit observation window, under AccessMotion and PermissionActivityRecognition. It never prompts. A lifecycle restart starts a new Since window and marks its first sample Gap.
func (*Scope) WebCookies ¶
func (cx *Scope) WebCookies(f WebCookieFilter, done func(cookies []WebCookie, err error))
WebCookies lists the cookies of the store every web view of the app shares that f picks, HttpOnly ones included, which page scripts cannot read, and calls done with them on the engine's goroutine, in the order of their host, path and name; an app reads the cookies of a sign-in made in its web views this way, to call the site from Go or to show where the user is signed in. It works whether or not a web view is shown, and reads the persistent store alone, so an Incognito web view's cookies are never among them. Apple platforms, Windows and Linux list each cookie with every field, filtering in Go; Android's CookieManager answers only the names and values a URL would send, so there a URL filter fills Domain with the URL's host and leaves the other fields empty, and a Domain filter or the zero one gets an Unavailable error. Where the platform has no store, as on HarmonyOS, on the web and where Env.HasWebView is false, done gets an Unavailable error too. Code an Access holds needs the webview capability's cookies (AccessCookies) for the filter's URL, for "https://" and the domain, or for "" to list the whole store.
func (*Scope) WriteClipboardItems ¶
func (cx *Scope) WriteClipboardItems(items []ClipboardItem, done ...func(error))
WriteClipboardItems replaces the clipboard with items, or clears it when items is empty. An optional done callback receives the result when the platform finishes. The bytes are copied before the call returns.
type Screen ¶
type Screen struct {
Title string
TitleFunc func() string
Header Node
// HeaderLeft, HeaderRight and HeaderTitle are views the system header shows at its start, at its end and in place of the title. HeaderLeft and HeaderRight take their content's size; HeaderTitle fills the room the bar leaves between its ends when its views grow or take a percentage width, and otherwise takes its content's size bounded by that room.
HeaderLeft, HeaderRight, HeaderTitle Node
// IOS and Android hold what only their platform's header has.
IOS IOSScreenProps
Android AndroidScreenProps
// HeaderHidden hides the system header.
HeaderHidden bool
// HeaderTransparent lays the content out under a header without a
// background.
HeaderTransparent bool
// HeaderLargeTitle shows a collapsing large title on iOS and Android.
HeaderLargeTitle bool
// HeaderBackHidden hides the back button.
HeaderBackHidden bool
// HeaderBackTitle labels the back button leading back to this screen;
// its title by default.
HeaderBackTitle string
HeaderStyle Style
HeaderStyleFunc func() Style
// HeaderTitleStyle and HeaderLargeTitleStyle set the system header's compact and expanded title fonts: FontFamily, FontSize, FontWeight and FontStyle. Unset fields keep the platform's defaults. The Func forms merge over their static styles as the graph changes.
HeaderTitleStyle, HeaderLargeTitleStyle Style
HeaderTitleStyleFunc, HeaderLargeTitleStyleFunc func() Style
// HeaderClass gives the system header its colors as classes: bg-*, text-* for the title, tint-* for the buttons. HeaderStyle wins over them. The header has no siblings: peer-* variants are logged and ignored.
HeaderClass string
// Animation is how the screen enters and leaves (iOS slides it by
// default).
Animation ScreenAnimation
// TransitionShader, when set, is how it enters and leaves instead,
// where the platform draws it.
TransitionShader *TransitionShader
// StatusBar is set over the app's status bar while the screen is in
// the tree and not popped.
StatusBar StatusBarSetting
StatusBarFunc func() StatusBarSetting
// Class is Tailwind CSS classes, as View's.
Class string
Style Style
StyleFunc func() Style
Children []Node
// NoPopOnBack keeps the screen when back is pressed;
// NoPopOnBackFunc, when set, says so as the graph changes.
NoPopOnBack bool
NoPopOnBackFunc func() bool
// NoPopOnSwipe turns off iOS's swipe from the leading edge back to
// the screen below; NoPopOnSwipeFunc, when set, as the graph changes.
NoPopOnSwipe bool
NoPopOnSwipeFunc func() bool
// OnBackPress receives every back press while the screen is on top.
OnBackPress func()
// OnDismiss reports that the user popped the screen; remove it.
OnDismiss func()
TestID string
}
Screen is one page of a Stack, filling it: the core's part of base.NavPage, which apps use.
On iOS and Android the platform draws the system header, a navigation bar or a toolbar: Title, the header views, a back button to the screen below, and HeaderStyle's Background, Color (the title's) and TintColor (the buttons'). The content is laid out below it. Elsewhere Header, when set, is drawn at the top and the header options are ignored.
type ScreenAnimation ¶
type ScreenAnimation = driver.ScreenAnimation
ScreenAnimation is how a screen of a stack enters and leaves.
type ScreenEffect ¶
type ScreenEffect struct {
Program *ShaderProgram
Uniforms Uniforms
UniformsFunc func() Uniforms
Progress float64
ProgressFunc func() float64
ProgressNode AnimatedNode
MaxSampleOffset float64
Paused bool
PausedFunc func() bool
}
ScreenEffect draws the whole surface through a WGSL program, which reads it with sample_content(uv). It takes no space and has no children; dialogs a platform presents in windows of their own are outside it.
type ScreenTransition ¶
type ScreenTransition struct {
Program *ShaderProgram
NoFallback bool
Uniforms Uniforms
UniformsFunc func() Uniforms
Value func() any
Duration time.Duration
MaxSampleOffset float64
Paused bool
PausedFunc func() bool
}
ScreenTransition draws the whole surface through a WGSL program as it changes, when Value's result changes, as ShaderTransition does its children.
func (ScreenTransition) Render ¶
func (e ScreenTransition) Render(*Scope) Node
Render implements Node.
type Scroll ¶
type Scroll struct {
// Class is Tailwind CSS classes, as View's.
Class string
Horizontal bool
// NoShrink keeps the scroll view from shrinking below its requested size.
NoShrink bool
HideIndicator bool
// Bar draws its scroll bar in place of the platform's indicator, over
// the app's (Scope.SetScrollbars).
Bar ScrollbarMaker
// Behavior is how it scrolls: paging, snapping, deceleration,
// bounces, insets and the keyboard.
Behavior ScrollBehavior
BehaviorFunc func() ScrollBehavior
// ContentOffset is where it starts.
ContentOffset Point
// EdgeEffects set the bars over its sides (View.EdgeBar) apart from
// the content scrolling under them (EdgeEffect).
EdgeEffects EdgeEffects
Style Style
StyleFunc func() Style
Children []Node
// OnScroll receives where it is as it scrolls, at most once a turn,
// and at most once per ScrollEventThrottle when that is set: then the
// latest offset waits for the interval to pass.
OnScroll func(ScrollEvent)
ScrollEventThrottle time.Duration
// OnScrollDragStart and OnScrollDragEnd bracket the user dragging it
// (its content or its scroll bar); OnMomentumStart and
// OnMomentumEnd the glide or snap after. A glide a new drag catches
// ends with OnMomentumEnd.
OnScrollDragStart func(ScrollEvent)
OnScrollDragEnd func(ScrollEvent)
OnMomentumStart func(ScrollEvent)
OnMomentumEnd func(ScrollEvent)
// OnScrollEnd hears it come to rest: a drag that set nothing in
// motion ended, or a glide, a snap, an animated scroll or the wheel's
// turns did.
OnScrollEnd func(ScrollEvent)
// OnRefresh makes it refreshable: pulling the content down past its
// top calls it and shows the platform's spinner while Refreshing
// returns true. Set Refreshing in OnRefresh, clear it when done.
// Behavior.RefreshIndicator replaces the spinner with the app's own
// indicator, which PullValue animates.
OnRefresh func()
Refreshing func() bool
// PullValue follows how far the content is pulled past its top on
// the platform's main thread: 0 at rest, the indicator's room while
// it refreshes. Draw an indicator of the app's own over the top of
// the scroll view with styles bound to it.
PullValue *AnimatedValue
// MaxZoomScale above MinZoomScale (both 1 when 0) lets pinches zoom
// the content, which then scrolls both ways. ZoomScale is the scale
// it starts at, and ZoomScaleFunc zooms to its value when it
// changes; the user's zoom stays otherwise. NoBouncesZoom stops
// pinches at the limits, NoPinchZoom ignores them, and CenterContent
// centers content smaller than the viewport.
MinZoomScale float32
MaxZoomScale float32
ZoomScale float32
ZoomScaleFunc func() float32
NoBouncesZoom bool
NoPinchZoom bool
CenterContent bool
// OffsetValues follow the offset on the platform's main thread, in
// the same frame as it scrolls.
OffsetValues AnimatedXY
OnLayout func(Bounds)
Ref *Ref
// Role and Label are what it is for assistive technology, as a list
// box's, and Busy says it is still loading.
Role Role
Label string
LabelFunc func() string
Busy func() bool
TestID string
}
Scroll scrolls its children, laid out as a column (or a row when Horizontal) as long as they need. Like React Native's ScrollView, it shrinks to fit its parent (FlexShrink 1) unless its style says else; NoShrink keeps it at its requested size when its parent is short.
type ScrollAlignment ¶
type ScrollAlignment uint8
ScrollAlignment is where Reveal puts a view along a scroll view's axis.
const ( // ScrollAlignDefault is the axis's own: ScrollAlignStart vertically, // ScrollAlignNearest horizontally. ScrollAlignDefault ScrollAlignment = iota ScrollAlignStart ScrollAlignCenter ScrollAlignEnd // ScrollAlignNearest scrolls the least that shows it, and not at all // while it shows whole. ScrollAlignNearest )
type ScrollBehavior ¶
type ScrollBehavior = driver.ScrollBehavior
ScrollBehavior is how a scroll view scrolls, as NSH's Scrollable props (React Native's ScrollView props) say: Scroll's Behavior.
type ScrollEvent ¶
type ScrollEvent struct {
// Offset is the content's offset, UIKit's contentOffset: negative
// past the start, as ContentInset allows.
Offset Point
// ContentSize is the content's size, zoomed.
ContentSize Size
// Size is the scroll view's.
Size Size
// ZoomScale is how far the content is zoomed; 1 unzoomed.
ZoomScale float32
// Stale says the platform reported Offset before applying a scroll
// the app asked for (Ref.ScrollTo, ScrollToEnd): the content is on
// its way elsewhere, and Offset is not where the user moved it.
Stale bool
}
ScrollEvent is where a scroll view is: what its scroll, drag and momentum events report.
type ScrollbarMaker ¶
type ScrollbarMaker interface {
// Scrollbar is the bar of target, or nil to keep the platform's
// indicator.
Scrollbar(cx *Scope, target *Ref, horizontal bool) Node
}
ScrollbarMaker makes a scroll view's bar: base.ScrollbarTheme's.
type SecretAccessible ¶ added in v0.2.0
type SecretAccessible = driver.SecretAccessible
SecretAccessible says when Apple platforms let the app read a secret, Apple's kSecAttrAccessible; the zero value leaves it to the system, which reads it only while the device is unlocked. Other platforms ignore it.
type SecretItem ¶ added in v0.2.0
type SecretItem = driver.SecretItem
SecretItem names a secret in the platform's secure store, SecretStore is where a platform keeps secrets (RootOptions.Secrets), and MemorySecrets is one in memory, which tests keep theirs in (nsgotest.App.Secrets).
type SecretStore ¶ added in v0.2.0
type SecretStore = driver.SecretStore
SecretItem names a secret in the platform's secure store, SecretStore is where a platform keeps secrets (RootOptions.Secrets), and MemorySecrets is one in memory, which tests keep theirs in (nsgotest.App.Secrets).
type Secrets ¶ added in v0.2.0
type Secrets struct {
// Service names the items with the account: kSecAttrService on Apple platforms, the first part of the generic credential's target "Service/Account" on Windows, the service attribute on Linux. Scope.Secrets sets it to the app's ID (App().ID), else its executable's name.
Service string
// AccessGroup is the keychain access group of the items on Apple platforms, "" for the app's default. On macOS one keeps the items in the data protection keychain rather than the login keychain, which needs a signed app whose keychain-access-groups entitlement lists the group.
AccessGroup string
// Accessible is when iOS, tvOS and watchOS, and macOS's data protection keychain (AccessGroup), let the app read an item it writes; macOS's login keychain ignores it, as other platforms do.
Accessible SecretAccessible
// contains filtered or unexported fields
}
Secrets is the app's secure store: strings by account under a service, which the platform protects, unlike Storage's plain file. It keeps them as generic passwords of the keychain on macOS, iOS, tvOS and watchOS, generic credentials of the Credential Manager on Windows, items of the Secret Service on Linux and values encrypted with a key of the Android Keystore in the app's private files on Android; elsewhere, as on the web, every call fails with ErrSecretsUnavailable.
Service, AccessGroup and Accessible name and protect the items, so an app keeps reading what an earlier build, or another framework, wrote with the same ones. Its methods may run on any goroutine, and as the system may make them wait, as a keychain asking the user to allow a read does, an app may call them off the engine's.
func (Secrets) Delete ¶ added in v0.2.0
Delete removes what is kept for account; deleting what is not there is no failure.
type Selectable ¶
type Selectable = driver.Selectable
Selectable says whether the user can select a text.
type SelectedText ¶
SelectedText is what one text of a selection has, in a TextSelection's Ranges: the Ref the Text carried, nil without one, and the UTF-16 offsets of its content the selection holds, from Start to End.
type SelectionAlign ¶
type SelectionAlign uint8
SelectionAlign is a table column's alignment for Markdown and HTML serialization; the core's part of base/textview's ColumnAlign.
const ( SelectionAlignNone SelectionAlign = iota SelectionAlignLeft SelectionAlignCenter SelectionAlignRight )
type SelectionBlock ¶
type SelectionBlock struct {
Kind SelectionBlockKind
// Level is 1 to 6 for SelectionBlockHeading.
Level int
// Ordered, Start and Loose are for SelectionBlockList.
Ordered bool
Start int
Loose bool
// Index is the 0-based item index for SelectionBlockListItem, or the 1-based number for SelectionBlockFootnote.
Index int
// Task and Done are for task items in SelectionBlockListItem.
Task bool
Done bool
// Alert is the GitHub alert kind ("NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION") for SelectionBlockQuote, and Title its display title.
Alert string
Title string
// Language and Meta are for SelectionBlockCode.
Language string
Meta string
// Align is the column alignments for SelectionBlockTable.
Align []SelectionAlign
// Header, Row, Col and ColSpan are for SelectionBlockTableCell.
Header bool
Row int
Col int
ColSpan int
// Label is the footnote label for SelectionBlockFootnote.
Label string
// TeX is the raw formula for SelectionBlockMath.
TeX string
// Inlines describes the rich inline tree of a Text node's content, aligned with its rendered UTF-16 offsets.
Inlines []SelectionInline
// Children holds nested blocks for FormatSelection; mounted Views use their tree children instead.
Children []SelectionBlock
}
SelectionBlock describes a View's or Text's semantic block structure for serializing a TextSelection to Markdown and HTML: the core's part of base/textview's document blocks, which base/textview sets on its views and texts.
type SelectionBlockKind ¶
type SelectionBlockKind uint8
SelectionBlockKind identifies the semantic block role of a View or Text when serializing a TextSelection to Markdown and HTML; base/textview sets it on the blocks it renders.
const ( // SelectionBlockAuto infers formatting from a Text's spans and styles. SelectionBlockAuto SelectionBlockKind = iota // SelectionBlockParagraph is a paragraph of inline content. SelectionBlockParagraph // SelectionBlockHeading is a heading of Level 1 to 6. SelectionBlockHeading // SelectionBlockQuote is a blockquote, or a GitHub alert when Alert is set. SelectionBlockQuote // SelectionBlockList is an ordered or unordered list container. SelectionBlockList // SelectionBlockListItem is one item of a list. SelectionBlockListItem // SelectionBlockCode is a fenced or preformatted code block. SelectionBlockCode // SelectionBlockTable is a table container. SelectionBlockTable // SelectionBlockTableCell is a header or body cell of a table. SelectionBlockTableCell // SelectionBlockDetails is a disclosure (<details>). SelectionBlockDetails // SelectionBlockSummary is a disclosure's summary (<summary>). SelectionBlockSummary // SelectionBlockMath is a display math formula block. SelectionBlockMath // SelectionBlockFootnote is a footnote definition block. SelectionBlockFootnote // SelectionBlockRule is a thematic break (--- / <hr>). SelectionBlockRule // SelectionBlockIgnore marks decorative views or texts (list markers, alert titles, disclosure arrows, footnote numbers, code actions) that belong to their container's markup and are omitted from Markdown and HTML output. SelectionBlockIgnore )
type SelectionInline ¶
type SelectionInline struct {
Kind SelectionInlineKind
// Text is the leaf text (plain text, code, keyboard, math TeX, or image alt).
Text string
// URL is the link target for SelectionInlineLink or image src for SelectionInlineImage.
URL string
// Title is the optional title for SelectionInlineLink or SelectionInlineImage.
Title string
// Label and Index identify a footnote for SelectionInlineFootnoteRef.
Label string
Index int
// Color is the optional background color for SelectionInlineMark.
Color Color
// UTF16Len, when > 0, overrides the UTF-16 code units this leaf occupies in the rendered Text (e.g. 1 for an AttachmentRune).
UTF16Len int
// Children are nested inline nodes for formatting wrappers and links.
Children []SelectionInline
}
SelectionInline is one node in a Text's rich inline tree for selection serialization: the core's part of base/textview's Inline nodes. Leaf nodes occupy UTF16Len UTF-16 code units in the rendered Text (defaulting to the UTF-16 length of Text when UTF16Len is 0); formatting wrappers and links wrap Children.
type SelectionInlineKind ¶
type SelectionInlineKind uint8
SelectionInlineKind identifies an inline element inside a Text node for serializing a TextSelection to Markdown and HTML; base/textview sets it.
const ( SelectionInlineText SelectionInlineKind = iota SelectionInlineStrong SelectionInlineEmphasis SelectionInlineStrikethrough SelectionInlineUnderline SelectionInlineMark SelectionInlineSuperscript SelectionInlineSubscript SelectionInlineSmall SelectionInlineCode SelectionInlineKeyboard SelectionInlineMath SelectionInlineLink SelectionInlineImage SelectionInlineBreak SelectionInlineFootnoteRef // SelectionInlineSkip occupies UTF-16 code units in the rendered Text (such as a streaming caret or hidden span) and emits nothing. SelectionInlineSkip )
type SensorError ¶ added in v0.2.0
type SensorError string
SensorError is a stable provider failure; it never contains location data.
const ( SensorNotAllowed SensorError = "not-allowed" SensorNotAvailable SensorError = "unavailable" SensorTimedOut SensorError = "timeout" SensorFailed SensorError = "failed" SensorNotConfigured SensorError = "not-configured" )
func (SensorError) Error ¶ added in v0.2.0
func (e SensorError) Error() string
type SensorNumber ¶ added in v0.2.0
type SensorNumber = driver.SensorNumber
SensorNumber is a measurement with an explicit availability flag.
type SensorQuaternion ¶ added in v0.2.0
type SensorQuaternion = driver.SensorQuaternion
SensorQuaternion rotates device axes into world axes.
type SensorStream ¶ added in v0.2.0
type SensorStream struct {
// contains filtered or unexported fields
}
SensorStream owns a pending location or a live stream. Its callbacks run on the engine goroutine only while its scope is alive.
func (*SensorStream) Stop ¶ added in v0.2.0
func (s *SensorStream) Stop()
Stop cancels this request and its provider; queued answers are ignored.
func (*SensorStream) Stopped ¶ added in v0.2.0
func (s *SensorStream) Stopped() bool
Stopped reports cancellation, completion or a terminal provider failure.
type SensorVector ¶ added in v0.2.0
type SensorVector = driver.SensorVector
SensorVector is a vector in the natural device frame, in SI units (µT for magnetism).
type ServiceEvent ¶
type ServiceEvent struct {
Service LocalService
Removed bool
Err error
}
ServiceEvent reports a discovered service, its removal, or a browse failure.
type Shader ¶
type Shader struct {
Program *ShaderProgram
Uniforms Uniforms
UniformsFunc func() Uniforms
// Paused stops a WGSL program's clock, nsh.time; PausedFunc, when
// set, says so as the graph changes.
Paused bool
PausedFunc func() bool
// Images are what the program's image0At to image3At read, in order, loaded as an Image loads its source. Pixels are copied once per Version as an Image's are, and the platform updates the image's texture in place.
Images []ImageSource
ImagesFunc func() []ImageSource
// Class is Tailwind CSS classes, as View's.
Class string
Style Style
StyleFunc func() Style
// Children draw over the shader.
Children []Node
OnPress func(PressEvent)
OnLayout func(Bounds)
Ref *Ref
// Label names what the shader shows for assistive technology, which
// skips an unlabeled shader as a decoration.
Label string
LabelFunc func() string
TestID string
}
Shader fills its box with a fragment shader, which the GPU runs for each pixel: an animated background, a gradient no style describes. It draws again when its size, its uniforms or the animated nodes they hold change; a platform without a GPU path for shaders yet leaves it empty.
type ShaderEffect ¶
type ShaderEffect struct {
Program *ShaderProgram
Uniforms Uniforms
UniformsFunc func() Uniforms
// Progress is nsh.progress; ProgressFunc, when set, follows the graph,
// and ProgressNode, when set, moves it on the platform's frame clock.
Progress float64
ProgressFunc func() float64
ProgressNode AnimatedNode
// MaxSampleOffset is how far beyond each side of the box, in points,
// the shader draws and its pictures reach (nsh.overflow).
MaxSampleOffset float64
// Paused stops nsh.time; PausedFunc follows the graph.
Paused bool
PausedFunc func() bool
Class string
Style Style
StyleFunc func() Style
Children []Node
OnLayout func(Bounds)
Ref *Ref
TestID string
}
ShaderEffect draws its children through a WGSL program, which reads what they draw with sample_content(uv): over them and in their place, while they still take touches, the pointer and focus. Without a Program the children show as they are.
type ShaderProgram ¶
type ShaderProgram struct {
// contains filtered or unexported fields
}
ShaderProgram is a fragment shader written in Go's syntax: Ebitengine's Kage language, as MyGo's shaders are. The source is a Go file of package main whose function Fragment returns the color of a pixel, premultiplied:
package main
var Time float
func Fragment(dst vec4, pos vec2) vec4 {
v := 0.5 + 0.5*sin(pos.x/20+Time)
return vec4(v, v, 1, 1)
}
dst is the pixel's center in pixels from the shader view's top left corner, and pos the same point in points. The language has the types bool, int, uint, float, vec2 to vec4, ivec2 to ivec4, uvec2 to uvec4, mat2 to mat4 and arrays of them, GLSL's built-in functions (sin, mix, smoothstep, dot, ...), functions of its own, if, and for loops. Exported variables at the package level are uniforms, which Shader.Uniforms sets. rectSize returns the view's size in points, and pixelScale the pixels a point. image0At(pos) to image3At(pos) read Shader.Images at a position in their pixels, premultiplied and transparent outside them, and image0Size() to image3Size() give their sizes in pixels.
Each platform translates the program for its GPU once, the first time a view shows it.
A program may be written in WGSL instead (CompileWGSL), as TSX apps write theirs and as effects and transitions need.
func CompileShader ¶
func CompileShader(src string) (*ShaderProgram, error)
CompileShader compiles a shader's source, as ShaderProgram describes it. Its errors give the source's lines.
func CompileWGSL ¶
func CompileWGSL(src string) (*ShaderProgram, error)
CompileWGSL compiles a shader written in WGSL, as NSH's are: it defines
fn shade(uv: vec2f) -> vec4f
the straight (not premultiplied) sRGB color of the point uv of the view's box, 0 to 1 from its top left corner, with whatever helpers and consts it needs. It reads nsh.size (the box in points), nsh.time (seconds since the shader appeared, standing still while paused), nsh.scale (pixels a point), nsh.progress (an effect's progress or how far a transition is, 0 to 1) and nsh.overflow (MaxSampleOffset). When it declares struct Uniforms, of f32, i32, u32, vec2f, vec3f, vec4f and array<vec4f, N> members in at most 4096 bytes, it reads them through uniforms, which Uniforms sets by name. sample_content, sample_backdrop, sample_from and sample_to read what an effect or a transition pictures at a point of the box, straight, transparent outside the picture.
Its errors give the source's lines and columns. A source compiles once for the process, as an app sets the same one again.
func MustCompileShader ¶
func MustCompileShader(src string) *ShaderProgram
MustCompileShader is CompileShader for a source that is part of the program, such as a package variable's: it panics when it does not compile.
func MustCompileWGSL ¶
func MustCompileWGSL(src string) *ShaderProgram
MustCompileWGSL is CompileWGSL for a source that is part of the program: it panics when it does not compile.
func (*ShaderProgram) HasUniform ¶
func (p *ShaderProgram) HasUniform(name string) bool
func (*ShaderProgram) UniformLanes ¶
func (p *ShaderProgram) UniformLanes(name string) (lane, n int, ok bool)
HasUniform reports whether the program has a uniform named name, which Uniforms may set. UniformLanes returns where a uniform lies in a shader's lanes and how many lanes it takes, so a test can read it without knowing the order its program declares its uniforms in. The lane indexes Shader.Lanes as the platform receives it.
type ShaderTransition ¶
type ShaderTransition struct {
Program *ShaderProgram
NoFallback bool
Uniforms Uniforms
UniformsFunc func() Uniforms
// Value runs the transition when its result changes; compare by ==.
Value func() any
// Duration is how long a transition runs, 300 ms when 0.
Duration time.Duration
MaxSampleOffset float64
Paused bool
PausedFunc func() bool
Class string
Style Style
StyleFunc func() Style
Children []Node
OnLayout func(Bounds)
Ref *Ref
TestID string
}
ShaderTransition shows its children as they are, and draws them through a WGSL program as they change: when Value's result changes (not its first), sample_from(uv) is a picture of what they showed, sample_to(uv) what they show, and nsh.progress goes from 0 to 1 over Duration. Without a Program it cross-fades, unless NoFallback.
func (ShaderTransition) Render ¶
func (e ShaderTransition) Render(*Scope) Node
Render implements Node.
type ShareOptions ¶
type ShareOptions struct {
Text string
// popover, on macOS and iPads; nil points at the root's center.
Anchor *Ref
}
ShareOptions say what Share shares: files, text, or both.
type SharedFile ¶
type SharedFile = driver.SharedFile
SharedFile is a file the app hands another app, with OpenFile or Share: its path on disk (or, for Share, its bytes in Data), and the name the other app sees and its type, which Path's name and extension say when empty.
type SharedItem ¶
type SharedItem = driver.SharedItem
SharedItem is the core's part of mobile.SharedItem.
type Show ¶
Show builds Then while When is true and Else otherwise. Each branch is built only when When changes, and goes before its bindings can run again, so a binding in Then never runs once When has turned false.
type ShutdownMode ¶
type ShutdownMode uint8
ShutdownMode says when a desktop app ends by itself: the core's part of desktop.SetShutdownMode, which apps use. Scope.Quit ends it in any mode.
const ( // ShutdownOnLastWindowClose ends the app as its last window closes; // panels and tray icons do not count. ShutdownOnLastWindowClose ShutdownMode = iota // ShutdownOnMainWindowClose ends it as its main window closes. ShutdownOnMainWindowClose // ShutdownOnExplicit keeps the app running when its windows close, as a tray app does. ShutdownOnExplicit )
type Signal ¶
type Signal[T any] struct { // contains filtered or unexported fields }
Signal is a value computations subscribe to by reading it.
func NewSignal ¶
func NewSignal[T comparable](cx *Scope, v T) *Signal[T]
NewSignal returns a signal holding v. Setting an equal value does nothing.
func NewSignalFunc ¶
NewSignalFunc returns a signal holding v that compares values with equal; with a nil equal every Set notifies, as slices and maps need.
func (*Signal[T]) Get ¶
func (s *Signal[T]) Get() T
Get returns the value and subscribes the running computation to it.
func (*Signal[T]) GetUntracked ¶
func (s *Signal[T]) GetUntracked() T
GetUntracked returns the value without subscribing.
type SnapAlignment ¶
type SnapAlignment = driver.SnapAlignment
SnapAlignment is where a snapped item sits in the viewport.
type Sound ¶
type Sound struct {
// contains filtered or unexported fields
}
Sound is a short sound decoded into memory, played any number of times, overlapping: the core's part of audio.Sound, which apps use. Its methods are called on the engine's goroutine.
func (*Sound) Close ¶
func (s *Sound) Close()
Close lets the sound go: the decoded audio goes with the last Sound over it. Calling it again does nothing.
func (*Sound) Play ¶
func (s *Sound) Play(v SoundVoice) *Playback
Play starts a playback of the sound, over those playing, within a frame: it is a command in the batch of the turn that calls it. It returns the playback, to change, stop or watch alone; one of a closed sound, or on a backend that cannot address playbacks, is already ended. A playback that cannot be heard, the device muted or one the backend drops at its limit, is no error.
type SoundLimits ¶
type SoundLimits struct {
MaxEncodedBytes int64 // 8 MiB for one encoded sound
MaxDuration time.Duration // 5 seconds for one decoded sound
MaxSounds int // 64 loaded or loading sources
MaxDecodedBytes int64 // 16 MiB of decoded sound across sources
MaxPlaybacks int // 32 simultaneous playbacks per native output
}
SoundLimits sets an engine's limits for audio.Sound. A zero field takes the default. The load budgets cover every surface of the engine.
type SoundVoice ¶
type SoundVoice struct {
Volume, Rate, Pan float32
// StartAt schedules this playback on the clock returned by audio.Now. A zero or past time plays as soon as possible.
StartAt time.Time
// Loop repeats this playback until its Playback or the sound stops, or the sound closes.
Loop bool
// Muted starts the playback at zero volume, which its Playback's SetVolume can raise.
Muted bool
}
SoundVoice is how a playback of a sound plays: the core's part of audio.Voice, which apps use. Volume runs from 0 to 1 and Rate from 0.5 to 2, with 0 as 1 for both, as Video's; Pan runs from -1 (full left) to 1 (full right), with 0 centered. Other values are clamped, and NaN takes the default.
type Span ¶
type Span struct {
// Class is Tailwind CSS classes under Style, as View's, except that a span has no siblings: peer-* variants are logged and ignored.
Class string
Content string
ContentFunc func() string
// Style's text fields merge over the Text's. Background and CornerRadius draw a box behind the span's characters on each line, and BackgroundInsetTop and BackgroundInsetBottom inset that box vertically. Cursor overrides the containing Text's cursor over these characters when it is not Auto.
Style Style
StyleFunc func() Style
// OnPress and OnLongPress take the presses on the span's characters,
// over the Text's.
OnPress func(PressEvent)
OnLongPress func(PressEvent)
// Attachment, when set, is a view in the text's lines in place of Content: laid out at its content size, it wraps with the words around it and takes its own presses. Style is then its view's style, and Style.VerticalAlign places it in its line, else the VerticalAlign of the one view Attachment makes; aligned to the baseline, the first text line inside the view supplies its baseline, and an Em canvas puts its own baseline on the line's (Canvas.Em). Content is then what copying text takes in its place, as a formula copies as its TeX, and without it a copy leaves the attachment out; screen readers read the attachment's labels instead. When a Text's SpansFunc runs again, each attachment the new spans hold again, with the same Class and Style, keeps its view, whatever text lies around it and wherever it moves among the others; only the new ones are made, and those the spans no longer hold go. An attachment is the same as the same pointer, or as an equal value of a type that compares; a Func, or a struct holding a func or a slice, as View does, is never the same, so a SpansFunc that should keep such an attachment's view gives a pointer to it, made once.
Attachment Node
}
Span is a run of a Text with a style of its own.
type SpeakError ¶ added in v0.2.0
type SpeakError string
SpeakError is why an utterance failed, named as the Web Speech API's SpeechSynthesisErrorEvent's errors.
const ( // SpeakNotAllowed: the current owner's Access refuses AccessTextToSpeech, or the platform refused to speak, as a browser does before the user's first gesture. SpeakNotAllowed SpeakError = driver.SpeakNotAllowed SpeakLanguageUnavailable SpeakError = driver.SpeakLanguageUnavailable SpeakVoiceUnavailable SpeakError = driver.SpeakVoiceUnavailable // SpeakTextTooLong: the text is longer than the platform speaks at once, as Android's engines' limit, 4000 characters by default. SpeakTextTooLong SpeakError = driver.SpeakTextTooLong // SpeakAudioBusy: the platform's audio output could not be had, such as iOS's audio session. SpeakAudioBusy SpeakError = driver.SpeakAudioBusy SpeakUnavailable SpeakError = driver.SpeakUnavailable // SpeakFailed: the synthesizer failed otherwise. SpeakFailed SpeakError = driver.SpeakFailed )
func (SpeakError) Error ¶ added in v0.2.0
func (e SpeakError) Error() string
type SpeechError ¶
type SpeechError string
SpeechError is why a speech session ended without its transcript, named as the Web Speech API's errors.
const ( // SpeechNotAllowed: the user or the system refused the microphone or // the recognizer. SpeechNotAllowed SpeechError = driver.SpeechNotAllowed // SpeechNoSpeech: nothing was said. SpeechNoSpeech SpeechError = driver.SpeechNoSpeech // SpeechAudioCapture: the microphone could not record. SpeechAudioCapture SpeechError = driver.SpeechAudioCapture // SpeechNetwork: the recognizer needed the network. SpeechNetwork SpeechError = driver.SpeechNetwork // SpeechLanguageUnsupported: the recognizer has no model for the // language. SpeechLanguageUnsupported SpeechError = driver.SpeechLanguageUnsupported // (Env.CanRecognizeSpeech). SpeechUnavailable SpeechError = driver.SpeechUnavailable // SpeechFailed: the recognizer failed otherwise. SpeechFailed SpeechError = driver.SpeechFailed )
func (SpeechError) Error ¶
func (e SpeechError) Error() string
type SpeechOptions ¶
type SpeechOptions struct {
// Lang is the BCP 47 tag of the language spoken; "" is the app's
// locale.
Lang string
// Interim reports results before they are final.
Interim bool
// OnStart runs once the recognizer listens.
OnStart func()
// OnResult runs with the whole transcript so far, and whether the
// recognizer will not change it.
OnResult func(text string, final bool)
// OnEnd runs once, last, with the last transcript and why it ended
// early: a SpeechError, nil when it finished or was stopped or
// aborted.
OnEnd func(text string, err error)
}
SpeechOptions are a speech session's, as NSH's Speech.start takes them.
type SpeechSession ¶
type SpeechSession struct {
// contains filtered or unexported fields
}
SpeechSession is speech being recognized, from the microphone.
func (*SpeechSession) Abort ¶
func (s *SpeechSession) Abort()
Abort ends the session at once with the transcript so far.
func (*SpeechSession) Ended ¶
func (s *SpeechSession) Ended() bool
Ended reports whether the session ended.
func (*SpeechSession) Stop ¶
func (s *SpeechSession) Stop()
Stop has the recognizer finish what it heard: a last final result, then the end.
func (*SpeechSession) Text ¶
func (s *SpeechSession) Text() string
Text returns the transcript so far.
type SpringConfig ¶
type SpringConfig = driver.SpringConfig
SpringConfig is a damped spring's: Stiffness 100, Damping 10 and Mass 1 when 0.
type Stack ¶
Stack shows the last of its screens: the core's part of base.Nav's Stack, which apps use. Pushing is adding a screen, popping is removing it. Back pops the top screen, which reports OnDismiss and stays hidden until the app removes it.
type StandardDir ¶
type StandardDir uint8
StandardDir names one of the user's standard folders (desktop.StandardDir).
const ( DocumentsDir StandardDir = iota + 1 DownloadsDir DesktopDir PicturesDir MusicDir // VideosDir is macOS's Movies. VideosDir )
type StatusBarSetting ¶
type StatusBarSetting struct {
Foreground StatusBarStyle
Hidden Toggle
// Immersive hides the status and navigation bars on Android, and the status bar, navigation bar and navigation indicator on HarmonyOS. On iOS it hides the status bar and lets UIKit hide the home indicator. Other targets ignore it.
Immersive Toggle
// Animated animates the change to this layer's settings.
Animated Toggle
}
StatusBarSetting is one layer of the system bars' settings. Fields left at their zero values keep the settings below.
type StatusBarStyle ¶
type StatusBarStyle = driver.StatusBarStyle
StatusBarStyle is the color of a phone's status bar content.
type StepPosition ¶
type StepPosition = driver.StepPosition
StepPosition is where a steps easing jumps, as CSS's step positions.
type StepSample ¶
type StepSample = driver.StepSample
StepSample counts steps in the provider's explicit observation window.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is the app's key-value storage: strings by string key, kept on the device and shared by every graph of the app. Reads are synchronous, as the entries are in memory, and reading in a computation subscribes it to changes, the app's own and other graphs'. Use it where the app's code runs: components, handlers, effects and posted functions.
type StorageBackend ¶
type StorageBackend interface {
// Load returns the entries kept, read once when the store is first used.
// An error starts the store empty and is logged.
Load() (map[string]string, error)
// Write keeps change. Calls are serialized in change order, on the
// goroutine that made each change. A backend that blocks writes elsewhere.
Write(change StorageChange)
}
StorageBackend keeps a host's entries for NewStore.
type StorageChange ¶
StorageChange is a change to the entries, for the backend to keep.
type StorageFullError ¶
type StorageFullError struct {
// Bytes is what the storage would have held, and Quota the most it
// may.
Bytes, Quota int
}
StorageFullError refuses a value that would grow the storage past its quota: StorageQuota, or a partition's (Scope.ProvideStorage).
func (*StorageFullError) Error ¶
func (e *StorageFullError) Error() string
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds an app's entries in memory, loaded from its backend on first use. Graphs given the same Store share its entries and quota, and each sees the others' changes through its signals. Hosts make one per app with NewStore and pass it in RootOptions.
func NewStore ¶
func NewStore(backend StorageBackend) *Store
NewStore returns a store kept by backend, or only in memory when backend is nil.
type Style ¶
type Style struct {
// Layout, with React Native's defaults: a column flexbox, items that
// do not shrink and stretch on the cross axis, border-box sizes, no
// automatic minimum sizes. Grid and block layout are CSS's.
Display Display
Position Position
Direction FlexDirection
Wrap FlexWrap
JustifyContent Justify
AlignItems Align
AlignSelf Align
AlignContent Align
// JustifyItems and JustifySelf align grid items (and block children)
// along the row.
JustifyItems Align
JustifySelf Align
FlexGrow float32
FlexShrink float32
FlexBasis Length
Width, Height Length
MinWidth, MinHeight Length
MaxWidth, MaxHeight Length
// AspectRatio is width divided by height; 0 is unset.
AspectRatio float32
// BoxSizing says whether sizes include padding and borders, which they
// do unless it is ContentBox.
BoxSizing BoxSizing
// Top, Right, Bottom and Left place an absolutely positioned node in
// its parent, or offset a relative one. Right to left, left and right
// swap, as in React Native, so they are its start and end, as are the
// left and right of margins, paddings, borders and corners.
Top, Right, Bottom, Left Length
// RowByDefault lays a flex container out in a row unless a Direction
// says otherwise, as CSS's display: flex, wherever it was written.
RowByDefault bool
// PhysicalEdges marks the sides of Margin, Padding and the insets that
// stay on their sides right to left, as CSS's left and right.
PhysicalEdges PhysicalEdges
// LayoutDirection lays the node and what it holds out left to right
// or right to left, over the app's direction; the zero value inherits
// the parent's.
LayoutDirection LayoutDirection
// ZIndex stacks the node above its siblings with lower ones, keeping
// the order of equals; it changes neither layout nor what sees the
// node first in the tree.
ZIndex int
Margin Edges
// AutoMargin makes the margins on those sides auto: they take the free
// space, centering a node between two of them.
AutoMargin Sides
Padding Edges
// MarginPercent and PaddingPercent mark the sides whose Margin and
// Padding are percentages of the containing block's width, as CSS's.
MarginPercent, PaddingPercent Sides
// PaddingEnv and MarginEnv add the safe area's insets or the software
// keyboard's height to the padding and margin on their edges.
PaddingEnv, MarginEnv EnvEdges
// Gap separates children; RowGap and ColumnGap override it per axis.
Gap, RowGap, ColumnGap Points
// GridTemplateColumns and GridTemplateRows are a grid's tracks in CSS
// syntax, such as "repeat(3, 1fr)" or "[full-start] 100px minmax(0, 1fr)";
// GridAutoColumns and GridAutoRows size the tracks it adds.
GridTemplateColumns, GridTemplateRows GridTracks
GridAutoColumns, GridAutoRows GridTracks
GridAutoFlow GridFlow
// GridRow and GridColumn place the node in its parent grid.
GridRow, GridColumn GridLines
// Look.
Background Color
// BackgroundInsetTop and BackgroundInsetBottom inset a Span's background from the top and bottom of each line's box. They take points or a percentage of the box's height. A zero or negative inset leaves that edge in place.
BackgroundInsetTop, BackgroundInsetBottom Length
// Gradients are drawn over Background, the first on top. A state
// style that sets Background and no Gradients replaces them, so press
// feedback shows.
Gradients []Gradient
CornerRadius Points
// CornerRadii, when set, gives each corner its own radius instead of
// CornerRadius.
CornerRadii Corners
// BorderCurve Continuous eases the corners into their edges, as iOS's
// continuous corners and Figma's corner smoothing do; pills stay pills.
BorderCurve BorderCurve
// BorderWidth is the width of the border on every side. Borders, when
// set, gives each side's width to layout instead.
BorderWidth Points
Borders Edges
// BorderColor is the border's color, the text color while 0, as CSS's
// currentColor: Transparent draws none.
BorderColor Color
// BorderColors, when set, colors each side; a side left 0 takes
// BorderColor.
BorderColors EdgeColors
// PhysicalBorders marks the sides of Borders, BorderColors and
// CornerRadii that stay where their names say right to left, as CSS's
// border-left does, where the others are starts and ends.
PhysicalBorders PhysicalBorders
// BorderStyle dashes or dots the border; BorderNone and BorderHidden
// take it away, in layout too.
BorderStyle BorderStyle
// OutlineWidth draws a line around the border box, OutlineOffset away
// (inside when negative), following its corners, outside layout.
OutlineWidth Points
OutlineOffset Points
OutlineColor Color
OutlineStyle BorderStyle
Opacity Opacity
// Visibility Hidden hides the node and what it holds from sight, the
// pointer and screen readers, keeping its place in layout.
Visibility Visibility
// Overflow Hidden clips children inside the node's border, to its padding box with each corner's radius less the widths of the sides it joins, as CSS does, and keeps their overflow out of an enclosing scroll view's content. The node's own outer shadows and outline stay outside the clip, as in CSS, on Android, Windows, Linux, the web and Apple, there including corners of different radii and zoomed scroll content. HarmonyOS clips at the node's bounds, under its border.
// OverflowX and OverflowY override it per axis.
Overflow Overflow
OverflowX, OverflowY Overflow
// ShadowColor, ShadowOffset and ShadowRadius are React Native's
// shadow: ShadowRadius is the blur's standard deviation.
ShadowColor Color
ShadowOffset Point
ShadowRadius Points
// Shadows are CSS's box shadows, the first on top; Ring makes
// Tailwind's rings.
Shadows []BoxShadow
// Filters change what the node and its children draw, in order.
Filters []Filter
// BackdropFilters change what is behind the node, seen through its background, as CSS's backdrop-filter does: Blur frosts it by its radius, and brightness, contrast, grayscale, hue rotation, invert, opacity, saturate and sepia change its colors; a drop shadow draws nothing. A blur without color filters on iOS draws the system material a view's IOS.BackdropMaterial names; a blur with a material other than BackdropUltraThin draws that material on iOS and AppKit's closest one on macOS, leaving color filters out. Android draws the blur and color filters from Android 12 and only the background before it. GlassEffect draws Liquid Glass in its place on iOS and macOS 26; give a glass view a blur to fall back to. GlassInteractive turns on the system's press response for Liquid Glass on macOS 27 and iOS 26.
BackdropFilters []Filter
GlassEffect GlassEffect
GlassInteractive bool
// Mask draws the node, backdrop included, as much as the gradient's
// alpha says.
Mask *Gradient
// BlendMode mixes the node's pixels with what is drawn behind it.
BlendMode BlendMode
// TintColor recolors an image's opaque pixels.
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 sets an image-based custom cursor over the view on
// desktops and the web (Env.SupportsCustomCursor). When set, it takes
// precedence over Cursor on the same view; if its images are empty or
// cannot be loaded, Fallback (or Cursor, else the platform default) is
// shown. Ignored on touch platforms.
CursorImage *CustomCursor
// ObjectPosition places an image in its view once ResizeMode has
// sized it; centered when unset.
ObjectPosition ObjectPosition
// VerticalAlign places an attachment in its text's line, set on the
// span or on the attachment's view.
VerticalAlign VerticalAlign
// Transform is CSS's translate, rotate and scale, each set on its own
// by Merge, and the fixed functions of its transform property.
Transform Transform
// Transforms is CSS's transform as a list, its functions in the order
// they are given, after Transform; it replaces Transform's functions
// as it merges (ParseTransform reads the CSS).
Transforms []TransformStep
// TransformOrigin is where Transform acts: its zero value is the
// center, and its percentages are of the node's size.
TransformOrigin ObjectPosition
// TransformOriginZ moves the origin toward the viewer, CSS's third
// transform-origin value.
TransformOriginZ Points
// Perspective is the depth children's rotations out of their plane
// are seen from, at this node's center, as CSS's perspective.
Perspective Points
// BackfaceHidden hides the node while its rotations turn its back to
// the viewer.
BackfaceHidden bool
// Transition animates changes of the look on the platform.
Transition Transition
// Animation runs keyframes over the node on the platform, on top of
// its transform and opacity; Spin, Ping, Pulse and Bounce make
// Tailwind's.
Animation KeyframeAnimation
// Animated binds properties to animated values the platform moves
// every frame, over the ones above.
Animated *AnimatedStyle
// Color is the text color, inherited by descendants that set none. Without an explicit color above, it follows the subtree's Palette.Text, including changes of theme, appearance and host tokens.
Color Color
// FontFamily names a font family or a CSS list of them, each used for
// the characters those before it lack; empty is the system font, and
// FontMonospace the system's fixed-pitch font.
FontFamily string
// Language is the text's BCP 47 tag ("ja", "zh-Hant"), which picks the glyph forms of characters languages share, such as Han, and the fallback fonts and line breaking where the platform takes it. Empty inherits it, and the root's is the language the app shows (Env.Language), else its locale.
Language string
FontSize Points
FontWeight FontWeight
FontStyle FontStyle
// FontVariant turns on small capitals and the forms and widths of
// figures; FontVariantNormal undoes an inherited one. A node's
// variant replaces its parent's.
FontVariant FontVariant
// LineHeight is the height of each line. LineHeightMultiple is one in
// multiples of the font size, which descendants inherit as a multiple
// of theirs; LineHeightEm is one too, resolved where it is set and
// inherited as a length. Whichever the nearest node sets wins.
LineHeight Points
LineHeightMultiple float32
LineHeightEm float32
// LetterSpacing is the room added after each character;
// LetterSpacingEm is one in multiples of the font size, resolved
// where it is set, as LineHeightEm. The one set last wins.
LetterSpacing Points
LetterSpacingEm float32
TextAlign TextAlign
TextDecoration TextDecoration
// TextDecorationStyle draws the decoration's lines solid, double,
// dotted, dashed or wavy; TextDecorationColor colors them, the text's
// color when 0.
TextDecorationStyle TextDecorationStyle
TextDecorationColor Color
// TextDecorationThickness is how thick the decoration's lines are,
// and TextUnderlineOffset how far below the baseline an underline's
// top is; percentages are of the font size, and auto is the font's.
TextDecorationThickness Length
TextUnderlineOffset Length
// TextTransform changes the case of the characters, as written in the
// text it is set on.
TextTransform TextTransform
// TextShadowColor, TextShadowOffset and TextShadowRadius draw a shadow
// behind a text's glyphs, the text's own style's for its whole block.
// An offset or radius without a color is black at a third of opacity.
TextShadowColor Color
TextShadowOffset Point
TextShadowRadius Points
// TextAlignVertical moves text shorter than its box down within it.
TextAlignVertical TextAlignVertical
// SelectionColor is the highlight of selected text, and an input's
// caret without a CaretColor; 0 is the platform's, but for an input,
// which takes its theme's Selection and Accent.
SelectionColor Color
// CaretColor is an input's caret, as CSS's caret-color, but for the
// inputs inside the view: it is not inherited. iOS tints the selection
// with it too.
CaretColor Color
// PlaceholderColor colors an input's placeholder; 0 is the platform's.
PlaceholderColor Color
// Fill, Stroke, StrokeWidth and StrokeDash are SVG's paint properties,
// inherited as CSS inherits them. Views draw nothing with them; a
// canvas's drawing paints with them where it takes its view's paint
// (Drawing.FillFromView and the like), so a component's shapes follow
// the app's styles. A StrokeWidth of 0 is unset; a StrokeDash that is
// empty but not nil is solid.
Fill, Stroke Paint
StrokeWidth Points
StrokeDash []Points
// WhiteSpace NoWrap keeps text on one line per paragraph, overflowing
// its box.
WhiteSpace WhiteSpace
// UserSelect lets the user select the texts inside, unless a text's
// own Selectable says otherwise.
UserSelect UserSelect
// NumberOfLines limits a text's lines over its MaxLines, and
// TextOverflow says where it is cut over its EllipsizeMode;
// NoLineLimit lifts a limit, as line-clamp-none does.
NumberOfLines int
TextOverflow EllipsizeMode
// PointerEvents says which of the view and its children take the
// pointer, over the element's own. PointerEventsNone is inherited, as
// CSS's none: a view inside it takes the pointer again with
// PointerEventsOn, or either of the box values, which are the view's
// alone.
PointerEvents PointerEvents
// ObjectFit fits an image or a video to its view, over its own
// ResizeMode.
ObjectFit ResizeMode
// WritingDirection is the base direction of text, which orders runs of
// mixed directions and says where TextAlignStart is; the zero value is
// the layout direction.
WritingDirection WritingDirection
// Group makes the node a group, named so, whose states the GroupStyle
// of nodes inside it follows.
Group string
// GroupStyle merges styles over the rest while the nearest group
// around the node is in their states, under the node's own states.
GroupStyle *GroupStyle
// State styles merge over the rest while the node is in the state, in NSH's order of precedence, lowest first: checked, indeterminate and selected, which the app sets; FocusWithin, while the focus is on the node or inside it; hovered, focused (text fields) and pressed, which the platform reports (pressed only for a node with a press handler or a responder holding the touch: Active alone never makes a node pressable or a Tab stop); the aria-* states of its accessibility state, busy, checked, expanded, invalid, pressed (a toggle that is on, not a press) and selected; the data-* attributes a control's parts show; then disabled over all. While the node is disabled only Disabled applies of its own, as NSH's state styles; its classes' variants (checked:, hover:, ...) apply.
Hover, Focus, Active, Selected, Checked, Indeterminate, Disabled *Style
FocusWithin, AriaBusy, AriaChecked, Expanded, Pressed, AriaSelected *Style
FocusVisible, AriaInvalid *Style
// Data are styles of data-* attributes, sorted by name.
Data []DataStyle
}
Style is a node's layout, look and text. Every field's zero value means unset, so styles compose with Merge and text fields inherit from the parent as in CSS. A style with nothing set draws nothing: NSGo has no look of its own.
type SubmitBehavior ¶
type SubmitBehavior = driver.SubmitBehavior
SubmitBehavior is what Return does in a text field.
type Subscription ¶ added in v0.2.0
type Subscription = driver.Subscription
Subscription is what an auto-renewable subscription's product says of it: its group, its period and its offers.
type SubscriptionOffer ¶ added in v0.2.0
type SubscriptionOffer = driver.SubscriptionOffer
SubscriptionOffer is an introductory or promotional offer of a subscription.
type SubscriptionPeriod ¶ added in v0.2.0
type SubscriptionPeriod = driver.SubscriptionPeriod
SubscriptionPeriod is how long a subscription or an offer's period lasts, Value of Unit.
type Suggest ¶
type Suggest struct {
// contains filtered or unexported fields
}
Suggest follows a trigger query in a text field, such as a mention after "@", and replaces it with the text a list beside the field accepts. It holds no rows: base.SuggestList shows them. Pass it to the field's Input.Suggest. It is created in the field's owner scope and is safe on that scope's engine goroutine, like signals and the rest of the reactive graph.
func NewSuggest ¶
func NewSuggest(cx *Scope, o SuggestOptions) *Suggest
NewSuggest creates a suggestion state for a field in cx's scope.
func (*Suggest) Accept ¶
Accept replaces the trigger and the query with text, puts the caret after it and closes the query, dismissing the trigger as Close does, so a text that starts with the trigger, such as "@alice", does not reopen it. An uncontrolled field takes the text itself, a controlled one through its OnChange.
func (*Suggest) Anchor ¶
Anchor is the caret's latest page bounds, suitable for Overlay.AnchorBounds.
func (*Suggest) Close ¶
func (s *Suggest) Close()
Close ends an active query without changing the field. It stays closed on the trigger it closed, however the query grows or the caret moves within it, until that match ends or a trigger starts elsewhere.
func (*Suggest) Composing ¶
Composing reports whether an input method composes in the field, when a list leaves the keys to it.
type SuggestOptions ¶
type SuggestOptions struct {
// Trigger starts a query, "@" when empty.
Trigger string
// AllowSpaces lets a query contain spaces.
AllowSpaces bool
// AllowedPrefixes are what may precede Trigger besides a line's start, a space when nil.
AllowedPrefixes []string
// OnOpen and OnClose hear a query start and end.
OnOpen, OnClose func()
}
SuggestOptions tune a Suggest.
type Suspense ¶
Suspense shows Fallback while a resource that Content reads loads its first value, as Solid's Suspense does, and Content once none does. Content stays mounted, hidden and out of layout meanwhile, so what it reads keeps it suspended until the resources are ready, and it shows at once then. A resource loading again, with a value already (ResourceRefreshing), keeps Content shown rather than going back to Fallback, as does one read outside a computation, as in a handler. A Suspense inside Content takes what is read under it.
type SystemClock ¶
type SystemClock struct{}
SystemClock is the system's time.
func (SystemClock) Now ¶
func (SystemClock) Now() time.Time
type SystemGestureEdge ¶
type SystemGestureEdge = driver.SystemGestureEdge
SystemGestureEdge implements mobile.SystemGestureEdge.
type SystemGestureOptions ¶
type SystemGestureOptions = driver.SystemGestureOptions
SystemGestureOptions implements mobile.SystemGestureOptions.
type SystemSwitch ¶
type SystemSwitch struct {
Ref *Ref
LabelledBy []*Ref
Invalid func() bool
Checked func() bool
Disabled func() bool
// OnChange receives the value the user chose, which the native component reports as its "change" event with a bool: a test reports one with nsgotest's Emit(selector, "change", value), or flips the switch with Press.
OnChange func(checked bool)
// Size is macOS's control size, "small" or "large", else the regular
// one; UISwitch has one size.
Size string
Label string
LabelFunc func() string
Style Style
TestID string
}
SystemSwitch is the platform's own switch, NSSwitch on macOS, UISwitch on iOS and Material 3's framework switch on Android, native components they register; ui.Switch's SwitchSystem variant shows it there. Elsewhere it shows nothing, and SystemSwitchAvailable says whether it shows. The switch shows the user's choice at once, as the system's does, and its size is the system's where the style leaves it open.
type TabBadge ¶
TabBadge is the mark at a tab's icon corner. Text takes precedence over Dot; the zero value clears the badge. Apps name it mobile.TabBadge.
type TabBar ¶
type TabBar struct {
Items []TabBarItem
ItemsFunc func() []TabBarItem
// Selected is the selected tab's index; one past the tabs selects
// none. The bar shows the user's choice at once, as the system's does.
Selected func() int
OnChange func(index int)
// Edge places the tab bar along the bottom (the default), the leading
// or trailing edge (drawn vertically), or lets the system choose via
// Env.VerticalBarEdge (TabBarAutomatic). EdgeFunc binds it reactively.
Edge TabBarEdge
EdgeFunc func() TabBarEdge
// Label names the bar as a group for assistive technology.
Label string
LabelFunc func() string
Style Style
TestID string
}
TabBar is the core's part of mobile.TabBar, which apps use: the system's tab bar, a native component iOS and Android register. The selected tab takes the theme's accent. Android also reads palette roles for the bar, idle tabs, selected tab and indicator.
type TabBarEdge ¶
type TabBarEdge uint8
TabBarEdge is the edge along which a TabBar lays out its tabs. Apps name it mobile.TabBarEdge.
const ( // TabBarBottom is the default horizontal bottom tab bar. TabBarBottom TabBarEdge = iota // TabBarLeading places the tab bar vertically along the leading edge (left in LTR, right in RTL). TabBarLeading // TabBarTrailing places the tab bar vertically along the trailing edge (right in LTR, left in RTL). TabBarTrailing // TabBarAutomatic follows the edge the system chose (Env.VerticalBarEdge), falling back to TabBarBottom when it is VerticalBarUnspecified. TabBarAutomatic )
func (TabBarEdge) Resolve ¶
func (e TabBarEdge) Resolve(env *Env) TabBarEdge
Resolve returns the concrete edge (TabBarBottom, TabBarLeading or TabBarTrailing) for env: TabBarAutomatic reads env.VerticalBarEdge when env is non-nil and falls back to TabBarBottom when unspecified.
func (TabBarEdge) String ¶
func (e TabBarEdge) String() string
String returns the edge's name: "bottom", "leading", "trailing" or "automatic".
type TabBarItem ¶
type TabBarItem struct {
Title string
// Icon is the platform's name for an icon: an SF Symbol on iOS
// ("house"), and on Android a drawable of the app or, prefixed
// "android:", of the system ("android:ic_menu_search").
Icon string
// SVG is the tab's icon on iOS and Android where Icon names no SF Symbol or drawable, fitted into 24 points and tinted by the bar as a system icon is.
SVG *SVG
Badge TabBadge
}
TabBarItem is one tab of a TabBar. Apps name it mobile.TabBarItem.
type Tailwind ¶
type Tailwind struct {
// contains filtered or unexported fields
}
Tailwind is Tailwind CSS 4's default theme extended for the classes of a theme's subtree (Theme.Tailwind), as NSH's nsh.json tailwind extends an app's.
func ParseTailwind ¶
ParseTailwind reads an extension of Tailwind's default theme, an entry with an existing name replacing the default's:
colors: { brand: { 500: "#7c3aed", DEFAULT: "#6d28d9" }, accent: "#f59e0b" }
spacing: 4
breakpoints: { tablet: 600 }
fontFamily: { display: Inter }
fontSize: { huge: [48, 1.1] }
fontWeight: { heavy: 850 }
radius: { card: 14 }
shadow: { card: "0 2px 8px rgb(0 0 0 / 0.12)" }
tracking: { label: 0.08 }
leading: { dense: 1.15 }
blur: { glass: 20 }
aspect: { photo: 1.5 }
ease: { snappy: [0.2, 0, 0, 1] }
container: { content: 680 }
insetShadow, dropShadow, perspective and rem take their scales too. Lengths are points; an unknown key is an error. JSON is YAML, so NSH's tailwind object reads as it is.
type TaskProgress ¶
type TaskProgress struct {
State TaskProgressState
Value float64
}
TaskProgress is how far a task has gone on the app's icon. Value is a fraction from 0 to 1 for Normal, Paused and Error; it is ignored for the other states.
type TaskProgressState ¶
type TaskProgressState uint8
TaskProgressState says what a task progress indicator shows.
const ( // TaskProgressNone clears the indicator. TaskProgressNone TaskProgressState = iota // TaskProgressNormal shows Value as a completed fraction. TaskProgressNormal // TaskProgressIndeterminate shows that the task has no fraction yet. TaskProgressIndeterminate // TaskProgressPaused shows a paused task. Windows and macOS give it a paused color. TaskProgressPaused // TaskProgressError shows a task that failed. Windows and macOS give it an error color. TaskProgressError )
type Text ¶
type Text struct {
// Class is Tailwind CSS classes, as View's.
Class string
ClassFunc func() string
Content string
ContentFunc func() string
Style Style
StyleFunc func() Style
// MaxLines limits the lines shown, cutting the rest as EllipsizeMode
// says: an ellipsis at the last line's end by default.
MaxLines int
EllipsizeMode EllipsizeMode
// NoFontScaling keeps the text's sizes whatever the user's text size
// setting; MaxFontSizeMultiplier, when 1 or more, caps the setting's
// multiplier for it.
NoFontScaling bool
MaxFontSizeMultiplier float32
// AdjustsFontSizeToFit shrinks the text's fonts, line heights and letter spacing, and font-relative attachments such as Canvas.Em, down to MinimumFontScale of them (at least 0.1), until it fits its box and MaxLines.
AdjustsFontSizeToFit bool
MinimumFontScale float32
// Spans, when set, are the text: runs in order, each styled over the
// Text's style. A span with OnPress is a link; a press on another
// span is the Text's OnPress.
Spans []Span
// SpansFunc's spans are the text again whenever what it reads changes, as a code editor's rows recolor as their highlighting comes: runs of text with their classes, styles and presses, and attachments.
SpansFunc func() []Span
// Selectable lets the user select and copy the text; the highlight is
// the style's SelectionColor.
Selectable Selectable
// SelectionBlock and SelectionBlockFunc describe this text's semantic block and inline structure for serializing a TextSelection to Markdown and HTML; base/textview sets them on its texts.
SelectionBlock *SelectionBlock
SelectionBlockFunc func() *SelectionBlock
// PointerEvents says whether the text takes the pointer, as View's.
PointerEvents PointerEvents
OnPress func(PressEvent)
// OnLongPress runs when the text is held, after DelayLongPress's
// 500 ms.
OnLongPress func(PressEvent)
OnLayout func(Bounds)
// OnTextLayout receives the text's lines each time it is laid out
// anew, after the commit.
OnTextLayout func(lines []TextLine)
Ref *Ref
Role Role
// AccessibilityLevel is a heading's level, from 1, as a View's.
AccessibilityLevel func() int
// Label replaces the text for assistive technology.
Label string
LabelFunc func() string
// LabelFor and LabelledBy are a View's label associations.
LabelFor *Ref
LabelledBy []*Ref
Hint string
HintFunc func() string
// LiveRegion has screen readers announce the text as it changes; a RoleStatus text is a polite one when 0.
LiveRegion LiveRegion
TestID string
}
Text is a run of text the engine lays out and the platform draws.
type TextAlignVertical ¶
type TextAlignVertical uint8
TextAlignVertical is where text shorter than its box sits in it.
const ( TextAlignVerticalTop TextAlignVertical = iota + 1 TextAlignVerticalCenter TextAlignVerticalBottom )
type TextAttachment ¶
type TextAttachment = driver.TextAttachment
TextAttachment is a view inside a text, which FontExtent's font around it places on its line.
type TextBackground ¶
type TextBackground = driver.TextBackground
type TextBaseline ¶
type TextBaseline = driver.TextBaseline
TextBaseline is the line of a canvas text that the point it is drawn at sits on.
type TextDecoration ¶
type TextDecoration = driver.TextDecoration
TextDecoration draws lines on text; the values combine.
type TextDecorationStyle ¶
type TextDecorationStyle = driver.TextDecorationStyle
TextDecorationStyle is how a text's decoration lines are drawn; the zero value is solid.
type TextEngine ¶
type TextEngine = driver.TextEngine
TextEngine shapes, measures and lays out text: a platform's, or ApproxTextEngine's without one. PreparedText is what it shapes from an AttributedText, a TextLayout what it lays out to draw.
type TextLayout ¶
type TextLayout = driver.TextLayout
type TextMetrics ¶
type TextMetrics = driver.TextMetrics
TextMetrics are a text's measurements in a font.
type TextRange ¶
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 TextSelection ¶ added in v0.2.0
type TextSelection struct {
// Text is the selected text as a copy gives it: texts on one row joined by a tab and the others by a line break.
Text string
// Markdown is the selection as Markdown, preserving the block and inline structure of TextViews and styled texts in the area; empty without a selection.
Markdown string
// HTML is the selection as HTML, preserving the block and inline structure of TextViews and styled texts in the area; empty without a selection.
HTML string
// Bounds is the box of the texts the selection touches, in the view: no Size without a selection. Ref.Bounds of the view gives the surface's.
Bounds Bounds
// Ranges is what each text of the view has selected, in the view's document order: the UTF-16 offsets of each one's content it holds, with the text's Ref to tell texts of the same content apart. It is nil on a platform that does not report it; Text and Bounds alone then say only what a copy and a menu do.
Ranges []SelectedText
}
TextSelection is the selection of a Selectable view, as OnTextSelection receives it.
type TextShadow ¶
type TextShadow = driver.TextShadow
TextShadow is a shadow behind a text's glyphs.
type TextStyle ¶
TextStyle is a text's resolved style, TextSpan a byte range of it styled over it, and TextBackground what a span draws behind its characters.
type TextTransform ¶
type TextTransform uint8
TextTransform changes the case of text as it is laid out.
const ( TextTransformNone TextTransform = iota + 1 TextTransformUppercase TextTransformLowercase // TextTransformCapitalize upper-cases the first letter or digit of // each word. TextTransformCapitalize )
func (TextTransform) Apply ¶
func (x TextTransform) Apply(s string) string
Apply returns s in the case x asks for.
type Theme ¶
type Theme struct {
Light, Dark Palette
Radius Points
Sans, Mono string
// Tokens are the theme's design tokens that are no colors, by name:
// lengths ("12px") and font families, as a shadcn/ui theme file's
// theme section names them.
Tokens map[string]string
// Tailwind is the Tailwind theme the subtree's classes resolve
// against; nil is Tailwind's default.
Tailwind *Tailwind
}
Theme is a look in both appearances: a palette for each, the corner radius components start from and font families, empty for the system's. Scope.SetTheme gives it to a subtree; treat a theme given as read-only.
func DefaultTheme ¶
func DefaultTheme() *Theme
DefaultTheme returns NSGo's theme, which a tree shows until the app sets one: neutral grays with a blue accent. Its Colors hold shadcn/ui's tokens, which theme files and classes name, and the roles package ui's components read (ui.Colors): insets and tracks recess with the text's color, fields take the border, hairlines a fainter text color, light is the inverse of the page.
func ParseTheme ¶
ParseTheme reads a theme file over DefaultTheme: radius, sans and mono, and light and dark maps of role names, as Palette.Color names them, to CSS colors. YAML reads JSON as well.
radius: 8 light: accent: "#007aff" inset: "#f1f1f1" dark: accent: "#0a84ff"
It reads a shadcn/ui theme file too, as NSH's apps name theirs: the CSS variables of cssVars' theme, light and dark sections, where a value may name another (var(--brand)) and dark's go over light's. A variable that is a color is a role of the palettes; the others are Tokens, radius and font-sans and font-mono setting Radius, Sans and Mono too.
type ThermalState ¶
type ThermalState = driver.ThermalState
ThermalState is the thermal pressure the system reports.
type TimingConfig ¶
type TimingConfig = driver.TimingConfig
TimingConfig is a timing animation's: Duration (500 ms when 0) along Easing, after Delay.
type TitleBarStyle ¶
type TitleBarStyle = driver.TitleBarStyle
TitleBarStyle is whether the system draws the window's title bar.
type Toggle ¶
type Toggle uint8
Toggle is an option a layer turns on or off, or leaves to the layers below.
type Tokens ¶
Tokens are colors an embedding host themes the app with, by the role names of Palette.Color ("accent", "inset"), written as CSS writes them. They go over every theme's palette (Scope.Palette): Values in both appearances, and Dark's over them where a subtree shows dark. A value that is no color is dropped.
type TouchClaim ¶
type TouchClaim struct {
// OnMove claims as a finger moves (onMoveShouldSetResponder) rather
// than as one goes down (onStartShouldSetResponder).
OnMove bool
// Capture asks the view before the views inside it.
Capture bool
// Ask decides with the gesture whether to claim; nil claims.
Ask func(ResponderEvent) bool
// LetNative lets the scroll views around go on taking the touches;
// by default a responder stops them.
LetNative bool
// OnPan claims as the platform activates the view's pan by its
// PanActivation, deciding on the main thread so the scroll views
// around share the touch until then. A view with such a claim is the
// responder exactly while its pan is active: its other claims are not
// asked.
OnPan bool
}
TouchClaim is when a view asks to become the touch responder.
type TouchEvent ¶
type TouchEvent struct {
Phase TouchPhase
// Time is since an arbitrary origin.
Time time.Duration
Touches []Touch
// contains filtered or unexported fields
}
TouchEvent is the fingers on the surface as one of them changes. An end or a cancel lists the fingers that lifted too.
func (TouchEvent) StopPropagation ¶
func (e TouchEvent) StopPropagation()
StopPropagation keeps the views after this one on the path from hearing the event.
type TouchPhase ¶
type TouchPhase uint8
TouchPhase is what happened to the fingers of a TouchEvent.
const ( // TouchStart is fingers going down (the changed ones). TouchStart TouchPhase = iota + 1 // TouchMove is fingers moving. TouchMove // TouchEnd is fingers lifting (the changed ones). TouchEnd // TouchCancel is the system or a native gesture, such as a scroll // view, taking the touches. TouchCancel )
type Transaction ¶ added in v0.2.0
type Transaction = driver.Transaction
Transaction is a purchase the store recorded. Send Signed, the store's JWS, to the app's server to verify, deliver what was bought, then finish it with FinishTransaction; until then the store hands it to the app again at each launch.
type Transform ¶
Transform moves, scales and rotates a view without changing its layout, around its center: translate, then rotate, then scale.
type TransformKind ¶
type TransformKind uint8
TransformKind is a function of CSS's transform property.
const ( TransformTranslateX TransformKind = iota + 1 TransformTranslateY TransformScaleX TransformScaleY TransformRotate TransformRotateX TransformRotateY TransformSkewX TransformSkewY TransformPerspective )
type TransformStep ¶
type TransformStep struct {
Kind TransformKind
Value float32
Percent bool
}
TransformStep is one function of a transform list: Value is in points, degrees or a factor, and for Percent a translation's percentage of the view's own size.
func ParseTransform ¶
func ParseTransform(s string) ([]TransformStep, error)
ParseTransform reads CSS's transform: its functions, or none, which is an empty list.
type Transition ¶
type Transition = driver.Transition
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.
type TransitionProperty ¶
type TransitionProperty = driver.TransitionProperty
TransitionProperty is a set of animatable properties.
type TransitionShader ¶
type TransitionShader struct {
Program *ShaderProgram
Uniforms Uniforms
Duration time.Duration
}
TransitionShader is a WGSL program a page (Screen) or a dialog (Modal) comes and goes through instead of its Animation: sample_from(uv) is the lower side (the page under it, the surface without the dialog), sample_to(uv) the upper, and nsh.progress goes from 0 to 1 as it comes and from 1 to 0 as it goes, over Duration (350 ms when 0). When the user asks for less motion, or where the platform cannot draw it, the page or the dialog takes its own Animation.
type Tray ¶
type Tray struct {
// contains filtered or unexported fields
}
Tray is a tray icon: the core's part of desktop.Tray, which apps use. Its methods do nothing on a nil Tray, which NewTray returns where the platform has no tray support.
func (*Tray) ClickBounds ¶
ClickBounds is the core's part of desktop.Tray.ClickBounds, which apps use: the icon's screen rectangle reported by its latest native click, in the coordinates of Env.Displays and Window.ShowAt. Read it in OnClick or Menu to place a popup. It is unavailable before a click, after Remove, and where the system reports no icon rectangle, such as Linux's StatusNotifierItem.
func (*Tray) SetTooltip ¶
SetTooltip sets what shows as the pointer rests on the icon.
type TrayOptions ¶
type TrayOptions struct {
// Icon is the icon as PNG; Template draws it in the menu bar's
// colors on macOS, as its own icons are.
Icon []byte
Template bool
// View draws the icon instead, Width points wide (22 by default) and
// as tall as the menu bar, so it can change and move: on macOS. Windows rasterizes the view at the notification area's icon size.
View func(cx *Scope) Node
Width Points
// Title is text beside the icon, on macOS; Tooltip shows on hover.
Title, Tooltip string
// Panel shows under the icon on a primary click, and hides on the
// next.
Panel *Window
// OnClick runs on a primary click without a Panel.
OnClick func()
// Menu returns the menu a secondary click shows, and a primary click
// without a Panel or OnClick.
Menu func() []MenuItem
}
TrayOptions are a tray icon's: the core's part of desktop.TrayOptions, which apps use.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is the shadow tree of one surface. Commit turns its changes into a MountBatch. It is not safe for concurrent use: the engine owns it.
func NewTree ¶
func NewTree(root *Scope, text driver.TextEngine) *Tree
NewTree returns an empty tree under root, laying text out with text.
func (*Tree) Closed ¶
Closed reports whether an opened surface closed: the platform destroys its window, and the engine forgets it.
func (*Tree) Commit ¶
func (t *Tree) Commit() *driver.MountBatch
Commit resolves styles, prepares text, lays the tree out and returns what changed since the last commit, or nil when nothing did. Changes that OnLayout handlers make go into the same batch.
func (*Tree) CommitShared ¶
func (t *Tree) CommitShared() *driver.MountBatch
CommitShared is Commit for a platform that applies a batch before the next commit, as the web does on its one thread: the batch's items are the tree's own, until the next commit writes over them, so a commit copies nothing. A busy table's commit copied half a megabyte, which Go's collector paid for on the page's thread.
func (*Tree) FontsChanged ¶
func (t *Tree) FontsChanged()
FontsChanged prepares every text and records every canvas again, with fonts the platform made available since they were prepared.
func (*Tree) FramePending ¶
FramePending reports whether the surface awaits its first or next display frame, so an attaching host can start its clock.
func (*Tree) Graph ¶
Graph numbers the tree's graph within the process while devtools.Enabled, 0 otherwise (internal/devtools).
func (*Tree) HitTest ¶
HitTest returns the innermost pressable view at p in surface points, for platforms that draw their own views.
func (*Tree) ID ¶
ID numbers an opened surface's tree, which ItemOpenSurface names; the first tree's is 0.
func (*Tree) KeyDown ¶ added in v0.2.0
KeyDown dispatches EventKeyDown ev to its view's OnKeyDown, as Dispatch does, and reports whether the handler consumed the key, for the platform that waits to know whether the keymap and the view still take it (Engine.DispatchKeyDown).
func (*Tree) Language ¶
Language returns the language the app shows (Env.Language): of its catalogs' languages, the one that suits the locale best, "" for an app without catalogs. The engine reads it for platform services that take a language only as they start, as WinSparkle does.
func (*Tree) Pacing ¶
Pacing reports whether views wait for display frames to be made, or lists to bind the rest of their windows.
func (*Tree) PendingTransitionEnds ¶ added in v0.2.0
PendingTransitionEnds reports whether a live view waits for its style transition to end before its OnTransitionEnd runs. It is nsgotest's: a step takes frames until it is false.
func (*Tree) PreferredFrameRate ¶
func (t *Tree) PreferredFrameRate() FrameRateRange
PreferredFrameRate gives the host the rate requested for this surface.
func (*Tree) PressAt ¶
PressAt dispatches ev as a press on the innermost pressable view at its Page, in surface points, with its Point in that view.
func (*Tree) Remount ¶
func (t *Tree) Remount()
Remount makes the next driver.MountBatch recreate this tree's native views without rerunning its components or disposing their scopes. The platform must discard the old native tree before applying that batch, retaining its process resources and animation graph.
func (*Tree) Resize ¶
Resize sets the surface size the root fills and the fold geometry measured at it (Env.Geometry), in one batch, so what reads either sees both new. A geometry without regions is divided at size; the zero Geometry is a surface without a fold. A new geometry at the same size still applies.
func (*Tree) RunFrameAt ¶
RunFrameAt dispatches a frame to this tree only. A host with independent clocks calls it for the surface named by RootOptions.RequestSurfaceFrame.
func (*Tree) SetAppearance ¶
func (t *Tree) SetAppearance(a Appearance)
SetAppearance forces the appearance the app shows, as Scope.SetAppearance does: a host sets the one the app starts in.
func (*Tree) SetDevGeometrySource ¶
func (t *Tree) SetDevGeometrySource(watch func(func(driver.GeometrySnapshot)))
SetDevGeometrySource connects internal/devtools to the platform's displayed geometry. The engine installs it; observation starts only when bounds are read and ends when the tree goes. Callbacks may arrive on the native thread.
func (*Tree) SetEnvironment ¶
func (t *Tree) SetEnvironment(env Environment)
SetEnvironment records what the platform reports about where the app runs.
func (*Tree) SetGPUSubmitter ¶
SetGPUSubmitter connects the off-commit GPU frame submission hook for this surface. Called by internal/engine and nsgotest; never by apps.
func (*Tree) SetTokens ¶
SetTokens gives the app the host's tokens, from now on: what reads Env.Token runs again.
func (*Tree) SetViewPacing ¶
SetViewPacing turns pacing views over frames on, as it starts, or off, as a test host does so its steps reach every view: what waits is made in the next commit.
type Uniforms ¶
Uniforms are the values of a shader's uniform variables, by name. A value is a number (any of Go's integer or float kinds, or a bool), an AnimatedNode, a Color, or a slice of numbers or nodes or of any of these ([]any), which fill the uniform's lanes in turn: a vector's components, a matrix's columns, an array's elements. A Color fills four lanes, red, green, blue and alpha from 0 to 1, not premultiplied, or three for a vec3. Lanes left out are 0.
An AnimatedNode's lane follows the node on the platform's frame clock, with no engine work per frame: a Loop of a Timing makes a clock, and a value Set with each pointer move puts a glow under the pointer.
type UpdateCheck ¶
type UpdateCheck struct {
// Shown says the platform's own updater showed what it found in its
// windows, as Sparkle on macOS and WinSparkle on Windows do: they
// offer the newer version, install it and restart the app. Version metadata arrives separately through updater.Status; capability is still set.
Shown bool
// Restart is updater's signal that the platform has an update ready to apply by restarting. Version may be empty when the platform hides it.
Restart bool
// Managed and Store are updater.CapabilityOf's synchronous capability.
Managed UpdaterManaged
Store string
// App and Current are the app's name and running version.
App, Current string
// Version is the newer version found, "" when Current is the newest or Restart is true and the platform exposes no version label, and URL the page that gets it: the App Store's on iOS, the release's elsewhere.
Version, URL string
// Notes are Version's release notes as plain text, "" when its feed has none.
Notes string
// Download is the signed package for Version, when this target can
// install it itself. Signature and SHA256 authenticate its bytes; Key is
// the public Ed25519 key from the app's update configuration.
Download, Signature, SHA256, Key string
Size int64
// Err says why the updater could not check.
Err error
}
UpdateCheck is what the platform's updater answers CheckForUpdates with.
type UpdateDownloadProgress ¶
type UpdateDownloadProgress struct{ Loaded, Total int64 }
UpdateDownloadProgress reports bytes received by DownloadUpdate.
type UpdateHighlights ¶
type UpdateHighlights struct {
// NoUpdates starts it without outlining commits, which DevTools turn on (devtools.Surface.Highlight): the dev client sets it without -highlight.
NoUpdates bool
// Layout is what the layout audit shows as it starts: nsgo dev -layout's. DevTools show and hide it, and so does Mod+Alt+Shift+L when Layout configures bounds or a grid (LayoutAudit).
Layout LayoutAudit
// LayoutHidden starts the layout audit hidden even when Layout sets bounds or a grid (such as a window opened after the user hid a -layout audit), keeping Layout's boxes, grid and Mod+Alt+Shift+L binding ready for when it shows again.
LayoutHidden bool
}
UpdateHighlights is DevTools' overlay: it outlines for a moment each view a commit of its surface changed, as React DevTools' highlight updates and Flutter's repaint rainbow do, so work an update did not need shows, and holds the layout audit, which outlines every view's boxes with a grid and a ruler. It draws above the app's overlays and modals (Overlay.Topmost) and leaves its own views out. nsgo's dev client mounts it over every surface under nsgo dev -highlight, -layout and -devtools; it needs a host, an engine or a test driver, and shows nothing without one.
func (UpdateHighlights) Render ¶
func (h UpdateHighlights) Render(*Scope) Node
Render implements Node.
type UpdatePhase ¶
type UpdatePhase uint8
UpdatePhase is what an in-app update is doing on Linux and Android (package updater).
const ( // UpdateIdle says no update is downloading or installing. UpdateIdle UpdatePhase = iota // UpdateDownloading says an update package is streaming to disk. UpdateDownloading // UpdateInstalling says the verified package has been handed to the // platform installer. UpdateInstalling )
type UpdaterManaged ¶
type UpdaterManaged uint8
UpdaterManaged is the core's part of updater.Managed, which apps use.
const ( UpdaterUnavailable UpdaterManaged = UpdaterManaged(driver.UpdateManagedUnavailable) // UpdaterSelf is the core's part of updater.ManagedSelf. UpdaterSelf UpdaterManaged = UpdaterManaged(driver.UpdateManagedSelf) // UpdaterPage is the core's part of updater.ManagedPage. UpdaterPage UpdaterManaged = UpdaterManaged(driver.UpdateManagedPage) // UpdaterDevelopment is the core's part of updater.ManagedDevelopment. UpdaterDevelopment UpdaterManaged = UpdaterManaged(driver.UpdateManagedDevelopment) // UpdaterChannel is the core's part of updater.ManagedChannel. UpdaterChannel UpdaterManaged = UpdaterManaged(driver.UpdateManagedChannel) // UpdaterStore is the core's part of updater.ManagedStore. UpdaterStore UpdaterManaged = UpdaterManaged(driver.UpdateManagedStore) )
type UpdaterState ¶
type UpdaterState struct {
Managed UpdaterManaged
Store string
NativePreferences bool
AutomaticChecks, AutomaticDownloads bool
Available, Notes string
LastCheck time.Time
Phase UpdatePhase
Loaded, Total int64
}
UpdaterState is the core's part of updater.State. NativePreferences identifies a platform updater that owns its preferences and schedule. Phase, Loaded and Total follow an in-app update's download and install on Linux and Android (InstallUpdateInBackground), which the core tracks itself.
func UpdaterStatus ¶
func UpdaterStatus(cx *Scope) UpdaterState
UpdaterStatus is the core's tracked read for updater.Status.
func (UpdaterState) Fraction ¶
func (s UpdaterState) Fraction() float64
Fraction is the download's progress from 0 to 1, or 0 when Total is unknown or no bytes have arrived yet.
type UserSelect ¶
type UserSelect uint8
UserSelect says whether the user may select text.
const ( UserSelectText UserSelect = iota + 1 UserSelectNone )
type VerticalAlign ¶
type VerticalAlign = driver.VerticalAlign
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.
type VerticalBarEdge ¶
type VerticalBarEdge = driver.VerticalBarEdge
VerticalBarEdge is the edge where the system places a vertical bar: Env.VerticalBarEdge.
type Video ¶
type Video struct {
// Source is a URL, a file path or an "asset:" path in the app's resources.
Source string
SourceFunc func() string
// Headers supplies HTTP request headers for the source on Android and
// for direct HTTP media on Linux, macOS, iOS and tvOS. On Apple, it
// also applies to a direct HTTP AudioSource file. Its fields are copied
// when the video mounts.
Headers map[string]string
// Paused applies when the source opens and when its value changes. A non-repeating video stays at its end through other prop changes: set Paused true then false to replay it from the start, or from where its built-in controls scrubbed it back to, or Seek before the end, which plays on from there when Paused is false.
Paused bool
PausedFunc func() bool
Muted bool
MutedFunc func() bool
// Volume runs from 0 to 1; 0 plays at full volume, and Muted
// silences the video.
Volume float32
VolumeFunc func() float32
// Rate is the playback speed; 0 plays at 1. VideoInfo.RateChangeable tells whether the loaded source supports changing speed.
Rate float32
RateFunc func() float32
// Repeat starts the video over when it ends.
Repeat bool
ResizeMode ResizeMode
ResizeModeFunc func() ResizeMode
Controls bool
// HitTestAlpha is the minimum video opacity, from 0 to 1, at which a
// painted macOS window takes the pointer. It applies to videos
// without Controls or an asset track transform once a frame is decoded.
// Zero counts the whole video view.
HitTestAlpha float32
// PictureInPicture enables video Picture in Picture on iOS, tvOS, macOS, Android and supporting web browsers: Ref.StartPictureInPicture and StopPictureInPicture start and stop it, and on iOS and tvOS the video holds the playback audio session from then on, paused or not. Other targets report Supported false through OnPictureInPicture. What the PiP window plays and pauses is reported by OnPlay and OnPause.
PictureInPicture bool
// AutoPictureInPicture lets the platform start PiP on its own as the app goes to the background while the video plays.
AutoPictureInPicture bool
// OnPictureInPicture receives the session's state as it changes: whether the platform supports PiP, whether it can start now, whether it is active, and why a start failed.
OnPictureInPicture func(PictureInPictureState)
// OnPictureInPictureRestore runs when the user returns to the app from the PiP window, so the app can show the video's page again; the system restores its interface once the commit that follows is applied.
OnPictureInPictureRestore func()
// ProgressInterval is the time between OnProgress calls while the
// video plays: 250 milliseconds when 0, and at least 16.
ProgressInterval time.Duration
// AudioSource replaces the original sound with a separate audio track
// for a finite video on macOS, iOS and tvOS. It accepts the same paths
// and URLs as Source. Both tracks start together and seek together.
AudioSource string
// AudioSession is what the sound does to other apps' audio while it plays: by default the app's settings decide, and on iOS the device's silent mode silences it; a video of speech, as an audiobook's, plays in silent mode with AudioSessionPlayback or AudioSessionMixWithOthers. AudioSessionFunc changes it as the video plays: iOS holds the new session before letting the old go, so playback goes on without a gap, and Android opens the source again.
AudioSession AudioSession
AudioSessionFunc func() AudioSession
// Class is Tailwind CSS classes, as View's.
Class string
Style Style
StyleFunc func() Style
// OnLoadStart is called when a source starts opening, and OnLoad once
// its duration and size are known.
OnLoadStart func()
OnLoad func(VideoInfo)
// OnProgress receives the position and duration while the video
// plays, and once more when it pauses or ends.
OnProgress func(position, duration time.Duration)
// OnEnd is called each time the video reaches its end, before a
// repeating one starts over.
OnEnd func()
// OnBuffer receives whether playback waits for data.
OnBuffer func(buffering bool)
// OnPause reports that the platform paused the video, not the app: its built-in controls, or the system for an interruption or a lost audio output. The video stays paused until Paused changes, or the controls or the system play it again (OnPlay); an app that shows its own play state sets Paused to true, and then false to play again.
OnPause func(VideoPauseReason)
// OnPlay reports that the platform played the video, not the app: its built-in controls, or the system as an interruption that paused it ends. The video plays on until Paused changes, even while Paused is true.
OnPlay func()
OnError func(err error)
OnPress func(PressEvent)
OnLayout func(Bounds)
Ref *Ref
Label string
LabelFunc func() string
TestID string
}
Video plays a video in the platform's player, filling the view: the picture fits it by ResizeMode, and Controls shows playback controls. It plays unless Paused; Ref.Seek jumps to a time.
A video with an alpha channel shows what is behind its transparent pixels where the platform decodes the alpha: HEVC with alpha in a QuickTime or MPEG-4 file on macOS (iOS uses the same player layer but is unchecked), and VP8 or VP9 with alpha in WebM on Linux with GStreamer's codecalpha plug-in (gst-plugins-bad). On macOS, iOS, Windows and Linux, a local file whose alpha the platform cannot keep (WebM with alpha on Apple platforms; any clip with alpha on Windows, until a Windows machine has checked what Media Foundation's decoders output for it; HEVC with alpha on Linux, and VP8 or VP9 with alpha there without codecalpha) reports OnError, a *MediaError whose Reason is MediaErrorAlphaUnsupported, instead of showing an opaque picture. Android and the web, and a remote source anywhere, play such clips as their decoder outputs them, which may be opaque. With Controls, AVKit's player draws black behind the picture.
type VideoInfo ¶
type VideoInfo struct {
Duration time.Duration
// Size is the picture's natural size in points.
Size Size
// RateChangeable reports whether the backend can change this source's playback speed. Linux requires a seekable stream, GstPlay and GStreamer's scaletempo filter.
RateChangeable bool
}
VideoInfo is what a video reports when it loads. Duration is 0 for a stream without one, such as a live broadcast.
type VideoPauseReason ¶ added in v0.2.0
type VideoPauseReason uint8
VideoPauseReason says why the platform paused a video (Video.OnPause).
const ( // VideoPauseInterruption is the system's: a call, Siri, another app taking the audio, or the app going to the background. VideoPauseInterruption VideoPauseReason = iota // VideoPauseRouteLost is the audio's output going away, such as headphones unplugged. VideoPauseRouteLost // VideoPauseControls is the platform's built-in controls (Controls), its Picture in Picture window or Control Center. VideoPauseControls )
func (VideoPauseReason) String ¶ added in v0.2.0
func (r VideoPauseReason) String() string
String names a video pause reason for logs and diagnostics.
type View ¶
type View struct {
// Class is Tailwind CSS classes ("flex-row gap-4 p-4 bg-white
// dark:bg-zinc-900"), meaning what they mean in Tailwind CSS 4, under
// Style; an unknown class is logged once.
Class string
ClassFunc func() string
Style Style
StyleFunc func() Style
Children []Node
// OnPress runs on a completed press: tap, click or accessibility
// action. Pressable views capture presses on their descendants.
OnPress func(PressEvent)
OnLongPress func(PressEvent)
OnPressDown func(PressEvent)
OnPressUp func(PressEvent)
// OnMouseEnter and OnMouseLeave follow the mouse over the view or a
// view inside it, as the DOM's events do, OnMouseLeave saying where it
// was last. OnMouseMove hears it move there, with or without a button
// down (PressedButton), and a modifier key change while it rests
// there with none down. Touches never hover.
OnMouseEnter func(MouseEvent)
OnMouseLeave func(MouseEvent)
OnMouseMove func(MouseEvent)
// OnMouseDown hears any mouse button (left, right, middle, back or
// forward) going down over the view on desktops and the web. Unlike
// OnPress, it does not turn the view into a keyboard focus stop.
OnMouseDown func(MouseButtonEvent)
// OnMouseUp hears a mouse button coming up after going down on the
// view (or released over it), including when a held button is cleared
// because the window lost focus (Clicks is 0 then). It reports where
// OnMouseDown does.
OnMouseUp func(MouseButtonEvent)
// OnPointerDelta hears relative movement to the right and down while
// the view holds a pointer lock (Ref.LockPointer).
OnPointerDelta func(dx, dy float64)
// OnContextMenu receives a secondary click in the view.
OnContextMenu func(ContextMenuEvent)
// OnTouch hears the fingers on the surface while one that went down
// on the view or inside it is down, from the innermost view out, after
// OnTouchCapture from the outermost in, as the DOM's events capture
// and bubble; TouchEvent.StopPropagation ends the round. Responder
// makes the view take part in the touch responder.
OnTouch func(TouchEvent)
OnTouchCapture func(TouchEvent)
Responder *Responder
// NoFocus keeps a view that takes presses out of the keyboard focus's Tab stops on desktops and the web: a backdrop that closes a popover, rows a list moves through with the arrow keys.
NoFocus bool
// Focusable, when set, says whether the view is a Tab stop on desktops and the web, over NoFocus and whether it takes presses, following what it reads: a chart in a pressable card takes keys while focused without taking presses of its own, and a group of radios keeps one of them a stop. Return and Space press a stop only when it takes presses.
Focusable func() bool
// Follow names the view whose frame this absolutely positioned view
// follows, nil for none: along its parent's main axis it spans that
// view's frame, a view inside its parent, inside its own margins on
// that axis, and across it its own layout stands, as a tab list's
// indicator does. The core places it, so a layout that moves the
// other view moves it in the same batch, and FollowTransition runs
// when it moves to another view.
Follow func() *Ref
FollowTransition *LayoutTransition
// MatchID makes the view one with a view of the same ID that the
// commit inserting it removes, as SwiftUI's matchedGeometryEffect and
// Motion's layoutId: under Scope.AnimateLayout's Update, it moves and
// resizes from the frame the removed view showed, which leaves at
// once, rather than appearing with Create. A thumbnail and the page
// it opens into share one, so the picture travels between them.
MatchID string
// OnFocus and OnBlur follow the keyboard focus to and from a view that takes presses or is Focusable, on desktops and the web; a click presses without focusing. A focused view that leaves the tree hears OnBlur once, after the commit that removed it, or before the next view's OnFocus when the platform reports that first.
OnFocus func()
OnBlur func()
// OnKeyDown hears each key going down on a hardware keyboard while the view itself has the keyboard focus, as a Tab stop, before the keymap's bindings and the view's own Return and Space do, a modifier pressed alone included; returning true consumes the key, so no binding fires and the view does not press, as a shortcut recorder takes Command+S without the app's Save running. Global shortcuts (desktop.RegisterHotKey) take their keys before the app sees them. It reports on macOS, Windows, Linux, the web, where the browser keeps the shortcuts it gives no page, and tvOS; Android, iPhone and iPad do not report it.
OnKeyDown func(KeyEvent) bool
// OnKeyUp hears a key coming up that went down while the view itself had the keyboard focus, as OnKeyDown hears it, whether or not OnKeyDown consumed the down and wherever the focus has gone since; a key still held as the window loses the focus comes up then. Its Modifiers are the keys still held, a modifier released alone not among them, and Repeat is false. It reports where OnKeyDown does.
OnKeyUp func(KeyEvent)
// OnFocusIn and OnFocusOut hear the keyboard focus come to the view or a view inside it from elsewhere, and leave them: a move inside the view is neither, as CSS's :focus-within sees it. A view that stays hears OnFocusOut as the focused view inside it leaves the tree.
OnFocusIn, OnFocusOut func()
// PointerEvents says which of the view and its children take
// touches and the pointer.
PointerEvents PointerEvents
// HitSlop extends where the view takes touches beyond its bounds.
HitSlop Edges
// HitSlopFunc is HitSlop following what it reads.
HitSlopFunc func() Edges
// DelayLongPress is how long a press is held to be a long press; 0
// is 500 ms.
DelayLongPress time.Duration
// OnLayout receives the view's frame after each layout that moves or
// sizes it.
OnLayout func(Bounds)
// OnTransitionEnd runs once a change to the view's style or classes
// has had its transition's time: its new style's Transition.Delay and
// Duration after the commit that sends it, at once without a duration
// or while the user asks for reduced motion. A later change starts it
// over. The core times it, so it runs whether or not anything moved.
OnTransitionEnd func()
// OnPan follows a drag on the view, once PanActivation activates it;
// an active pan takes the touch from presses and scroll views.
OnPan func(PanEvent)
PanActivation PanActivation
// PanScrollHandoff lets a vertical pan share a drag with the scroll
// view inside the view where it starts, on iOS, as a bottom sheet's
// does: the drag scrolls it back to its top first, and only what goes
// on past that moves the pan. Other platforms leave the drag to the
// scroll view.
PanScrollHandoff bool
// OnPinch follows a two-finger pinch (a trackpad's on desktops);
// OnRotation a two-finger rotation.
OnPinch func(GestureEvent)
OnRotation func(GestureEvent)
// OnWheel takes the mouse wheel's turns and touchpads' scrolls over
// the view, before the scroll views around it, for what pans and
// zooms itself, such as a canvas; content that scrolls takes a
// Scroll. A scroll view inside the view takes its own first. Turns
// with Control held stay pinches where the platform makes them one.
OnWheel func(WheelEvent)
// PanValues are animated values a drag on the view moves on the
// platform's main thread, by its translation from where they were as
// it began, with no engine work per move. They need no OnPan.
PanValues AnimatedXY
// PinchValue is scaled by pinches on the view, and RotationValue turned
// by rotations, in radians, on the main thread as PanValues are: from
// where they were as the gesture began. They need no OnPinch or
// OnRotation.
PinchValue *AnimatedValue
RotationValue *AnimatedValue
// OnFileDrop receives the URLs of files dropped on the view from another app, on desktops and the web: file: URLs on desktops, and on the web, which hides paths, blob: URLs with each file's name as the fragment; FileFromURL opens either. OnFileDragEnter and OnFileDragLeave follow them while they are dragged over it. The innermost view with OnFileDrop under the pointer takes them, unless it is Disabled.
OnFileDrop func(uris []string)
OnFileDragEnter func()
OnFileDragLeave func()
// IOS, Android and Desktop hold the props only iOS, Android or the
// desktops have; other platforms ignore them.
IOS IOSViewProps
Android AndroidViewProps
Desktop DesktopViewProps
// Web holds the document semantics only the web backend has.
Web WebViewProps
// EdgeBar, when its Scroll is set, makes the view a bar over that
// scroll view's side, which the scroll view's edge effect sets apart
// from the content scrolling under it (Scroll.EdgeEffects).
EdgeBar EdgeBar
// Selectable makes the texts inside select together, as a web page's
// do: one selection runs from a place in one text to a place in
// another, across views. On desktops it is made by dragging, a double
// click (a word) or a triple click (a whole text), and extended by
// Shift-clicks; on touch screens by a long press. Cmd or Ctrl+A
// selects the view's texts, Cmd or Ctrl+C copies and Escape clears.
// Texts with SelectableOff stay out, and a selectable view inside
// another is part of the outer one. The highlight is each text's
// SelectionColor.
Selectable bool
// OnTextSelection, with Selectable, receives the selection as the user moves it: its plain text, Markdown, HTML and the box of the texts it touches, in the view; empty strings and no Size when it clears. Its Ranges, where the platform reports them, hold what each text has selected: a text's Ref and the UTF-16 offsets of its content, for telling texts of the same content apart.
OnTextSelection func(TextSelection)
// SelectionBlock and SelectionBlockFunc describe this view's semantic block role for serializing a TextSelection to Markdown and HTML; base/textview sets them on container blocks.
SelectionBlock *SelectionBlock
SelectionBlockFunc func() *SelectionBlock
Ref *Ref
// Disabled stops presses and is reported to assistive technology.
Disabled func() bool
Selected func() bool
// MultiSelectable tells assistive technology that this grid, listbox or tree permits more than one selected item.
MultiSelectable bool
// SelectionItem says this view is an item in a selectable collection, independently of whether Selected is true.
SelectionItem func() bool
Checked func() bool
// Indeterminate is neither checked nor unchecked, as a "select all"
// over a partial selection.
Indeterminate func() bool
// PartStates styles the view in the states it returns without
// reporting them, as a part of a control in them: a checkbox's
// indicator follows the checkbox. Assistive technology hears the
// states from the control alone.
PartStates func() PartStates
// Pressed is a toggle that is on, for screen readers and pressed
// styles; Busy an element still loading.
Pressed, Busy func() bool
// ShowsExpanded shows the view's Expanded state to the views it holds
// directly, for their styles, as a popup's trigger does to the app's
// content; screen readers hear this view alone.
ShowsExpanded bool
// Expanded makes the element expandable, as a disclosure or a menu
// button, and expanded while it returns true.
Expanded func() bool
// Expandable, with Expanded, says whether the element expands at all,
// as a tree's row that may be a folder or a leaf.
Expandable func() bool
Role Role
// AccessibilityLevel is the element's level for assistive technology,
// from 1: a heading's among the page's, a tree item's depth.
AccessibilityLevel func() int
// Label is what assistive technology reads.
Label string
LabelFunc func() string
// LabelFor makes this view a visible label for the referenced control: pressing it focuses the control and runs its press action. The label follows the control's Disabled and Invalid states. References must be mounted in the same tree and confinement scope.
LabelFor *Ref
// LabelledBy names the view from these visible elements, in order, ahead of Label. Without it or Label, LabelFor labels name a control in tree order. Missing, hidden, repeated and cyclic references are ignored. LabelledBy alone does not forward presses.
LabelledBy []*Ref
// Hint says what activating the element does, read after its label.
Hint string
HintFunc func() string
// AccessibilityDescription says more about the element, read after
// its label and before Hint, as ARIA's aria-description: a dialog's
// message, what a field expects.
AccessibilityDescription string
AccessibilityDescriptionFunc func() string
// Invalid marks a field or control whose content or value the app rejected, for screen readers and the aria-invalid: styles (ARIA's aria-invalid).
Invalid func() bool
// AccessibilityValue is a range's or a textual element's value, as
// a slider's or a progress bar's.
AccessibilityValue func() AccessibilityValue
// AccessibilityActions are the actions assistive technology offers
// on the element: the standard ones (ActionActivate, ActionIncrement,
// ...) through the screen reader's own gestures, others in its
// actions menu. OnAccessibilityAction receives their names.
AccessibilityActions []AccessibilityAction
AccessibilityActionsFunc func() []AccessibilityAction
OnAccessibilityAction func(name string)
// Accessible makes the view one element: its descendants are not
// exposed separately, and without a label it reads their text.
Accessible bool
ImportantForAccessibility Importance
// AccessibilityElementsHidden hides the view and its subtree from
// assistive technology while it returns true, as content behind a
// drawer.
AccessibilityElementsHidden func() bool
// LiveRegion has screen readers announce changes of the label and text inside the view; a RoleStatus view is a polite one when 0, and reads its whole text.
LiveRegion LiveRegion
// Tooltip shows above the view, 4 points away, once the pointer has
// rested on it for half a second on desktops, until the pointer leaves
// or presses; it never takes the pointer. The keyboard moving the
// focus onto the view or into it shows it at once, in every idiom,
// until the focus leaves or Escape is pressed; a press that focuses
// it leaves it to the pointer. Touch screens show none otherwise. A
// HintTooltip (base.Tooltip) decides itself when and where it shows.
Tooltip Node
TestID string
}
View is a container. Its look is its style; it has none of its own.
type ViewPaintKind ¶
type ViewPaintKind = driver.ViewPaintKind
ViewPaintKind is the paint property a ViewPaint takes.
type ViewToken ¶
ViewToken is a row in ViewableItems: its index, its Key (nil without List.Key) and whether it is viewable.
type ViewabilityConfig ¶
type ViewabilityConfig struct {
// ViewAreaCoveragePercentThreshold is the percent of the viewport a
// row must cover; it wins over ItemVisiblePercentThreshold.
ViewAreaCoveragePercentThreshold float32
// ItemVisiblePercentThreshold is the percent of a row that must be
// visible.
ItemVisiblePercentThreshold float32
// MinimumViewTime is how long rows must stay viewable before they
// are reported.
MinimumViewTime time.Duration
}
ViewabilityConfig is when a row counts as viewable. Without a threshold any visible point counts.
type ViewableItems ¶
ViewableItems is what OnViewableItemsChange reports: the viewable rows and the rows that became or stopped being viewable since the last report.
type Visibility ¶
type Visibility uint8
Visibility says whether a node is seen while it keeps its place.
const ( VisibilityVisible Visibility = iota + 1 VisibilityHidden )
type VisibleContentPosition ¶
type VisibleContentPosition struct {
// AutoscrollToBottomThreshold is how near the end the list must be
// to follow it.
AutoscrollToBottomThreshold Points
}
VisibleContentPosition is List.MaintainVisibleContentPosition's.
type Voice ¶ added in v0.2.0
Voice is how Speak speaks: in the language Lang, a BCP 47 tag ("en-US", "ja-JP", "zh-TW"), "" being the app's locale; in the voice ID names, one of Voices' IDs, "" being the platform's default voice for Lang; at Rate and Pitch, from 0.5 to 2 with 1 the voice's own, 0 standing for 1 and other values clamped.
type VoiceInfo ¶ added in v0.2.0
VoiceInfo is a voice installed on the platform: the ID Voice takes, the name the platform gives it and the BCP 47 tag of its language.
type WebCookie ¶ added in v0.2.0
WebCookie is a cookie of the store the app's web views share: its name and value, the Domain and Path it goes to, when it Expires (zero for a session cookie, which goes as the app ends; Apple platforms, Windows and Android keep one at most 400 days, as browsers do), whether it goes only over HTTPS (Secure) and stays out of page scripts' reach (HTTPOnly), and its SameSite attribute. Domain is a host, which alone takes the cookie, or with a leading dot (".example.com") the host and every host under it, as a Set-Cookie Domain attribute makes it; Path "" is "/".
type WebCookieFilter ¶
type WebCookieFilter = driver.WebCookieFilter
WebCookieFilter picks cookies of the store the app's web views share: those a request to URL, an http or https URL, would send, by their domain, path and Secure, or those of Domain, a host, and every host under it. The zero filter picks all; a filter takes one or the other.
type WebDownload ¶
type WebDownload = driver.WebDownload
WebDownload is a download of a web view, which OnDownload follows.
type WebDownloadState ¶
type WebDownloadState = driver.WebDownloadState
WebDownloadState is how far a WebDownload got.
type WebError ¶
type WebError struct {
URL string
Message string
// Domain and Code are the platform's: NSError's domain and code on Apple platforms, the GError domain's name and its code on Linux, COREWEBVIEW2_WEB_ERROR_STATUS and its value, or HRESULT and the HRESULT of a navigation WebView2 refused, on Windows, and android.webkit.WebViewClient and WebResourceError's error code on Android. Both are empty for a source or navigation Access refused (the web reports none).
Domain string
Code int
}
WebError is a page that failed to load, or a navigation the platform refused; URL is the page's, when known.
type WebInput ¶
WebInput is input a web view's page takes as the user's own (Ref.SendInput): WebClick, WebText or WebKey.
func WebClick ¶
WebClick is a primary click at x, y in CSS pixels from the page's viewport, as getBoundingClientRect reports them.
type WebMessage ¶
WebMessage is what a web view's page posted, and the page's origin: scheme://host, with the port when it is not the scheme's own, in lower case ("https://example.com", "app://bundle"), "file://" for a file and "null" for a page without an origin of its own, such as HTML without a base URL.
type WebNavigation ¶
type WebNavigation = driver.WebNavigation
WebNavigation is a web view's page and history.
type WebSameSite ¶ added in v0.2.0
type WebSameSite = driver.WebSameSite
WebSameSite is a WebCookie's SameSite attribute.
type WebSchemeHandler ¶
type WebSchemeHandler = driver.WebSchemeHandler
WebSchemeHandler answers a request for a URL of a scheme the app serves.
type WebSchemeRequest ¶
type WebSchemeRequest = driver.WebSchemeRequest
WebSchemeRequest is a request for a URL of a scheme the app serves (Scope.ServeSchemeRequest).
type WebSchemeResponse ¶
type WebSchemeResponse = driver.WebSchemeResponse
WebSchemeResponse is what a scheme handler answers: its status, headers and body.
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 and reports the usual load and navigation events, clearing any previous page.
type WebView ¶
type WebView struct {
// Source loads about:blank when neither Src nor HTML is set, clearing the previous page and reporting the usual load and navigation events.
Source WebSource
// The page loads again when SourceFunc's source changes.
SourceFunc func() WebSource
// InjectedJavaScript runs after each page loads, and
// InjectedJavaScriptBeforeContent before each page's own scripts.
InjectedJavaScript string
InjectedJavaScriptBeforeContent string
// InjectedJavaScriptBeforeContentFunc, when set, gives the script before each page's own scripts in place of InjectedJavaScriptBeforeContent. When its script changes, the view loads its source again with the new script, as when SourceFunc's source changes, replacing the page it shows, one the user or Ref.Load navigated to included.
InjectedJavaScriptBeforeContentFunc func() string
// UserAgent replaces the platform's.
UserAgent string
// UserAgentSuffix is appended after a space to UserAgent, or to the platform's own user agent when UserAgent is empty, such as Version/26.0 Safari/605.1.15 for sites that want Safari's in WKWebView. Apple platforms add it to their own user agent only as the native view is first made, so changing it afterwards takes effect there only with UserAgent set. HarmonyOS, the web and mini programs ignore it, as they do UserAgent.
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, apart from the app's other web views, on Apple platforms, Windows and Linux. Android has one cookie store and one set of website data per app, so there it only keeps the view from the HTTP cache, DOM storage and saved form data. It is read when the native view is first made; changing it afterwards has no effect.
Incognito bool
// NoScroll keeps the user from scrolling the page; NoJavaScript keeps
// pages from running scripts.
NoScroll bool
NoJavaScript bool
// Muted silences the entire web view on Windows and Linux, including frames and Web Audio. macOS 12 and iOS 15 or later suspend media playback until cleared. Other hosts keep their usual playback. The setting persists across navigations. MutedFunc updates it in place.
Muted bool
MutedFunc func() bool
// PinchZoom lets the user magnify the page with a pinch: a trackpad's on macOS, a touchpad's or a touch screen's on Windows, where it also allows Ctrl with the wheel or with + and -, as a touchpad's pinch reaches the page as Ctrl with the wheel, and a touch screen's on Android. Without it the page keeps its size on those platforms. iOS zooms as the page's viewport says, and WebKitGTK on Linux and the browser on the web keep their own handling, having no switch for it.
PinchZoom bool
// BackForwardGestures lets swipes go back and forward where the
// platform has them (iOS, macOS trackpads).
BackForwardGestures bool
// Mobile shows the page as a phone sees it on Windows, macOS and Linux, for sites such as YouTube's Shorts that give their swipe-driven layout only to phones: the page gets a phone's user agent unless UserAgent is set, sees a touch screen without hover (navigator.maxTouchPoints, ontouchstart, and matchMedia's pointer: coarse and hover: none), and a drag with the mouse's primary button reaches it as a finger's touches, as does a wheel or trackpad scroll that nothing under it would scroll. Windows emulates Android Chrome through WebView2's DevTools protocol, as Chrome's device mode does, so stylesheets and native scrolling follow too. macOS, presenting iPhone Safari, and Linux, presenting Android Chrome, run a script before each page's own that makes the touch events, which pages see as untrusted, and pans what a drag the page leaves alone is over; stylesheets' media queries keep the desktop's pointer there. Phones, the web and mini programs show pages as they are.
Mobile bool
// Media is what the pages may capture through getUserMedia:
// WebMicrophone, WebCamera or both. The system still asks the user
// for each device once, and a page asking for one Media leaves out is
// refused. Packages declare their use: NSMicrophoneUsageDescription
// and NSCameraUsageDescription in nsgo.yaml's apple.info, without
// which Apple's platforms refuse the page, and RECORD_AUDIO and
// CAMERA in android.permissions. It applies to the pages' next
// requests, and on the web to the next page loaded.
Media WebMedia
// Class is Tailwind CSS classes, as View's.
Class string
Style Style
StyleFunc func() Style
// OnLoadStart, OnLoad and OnNavigationStateChange receive the page's
// state as it starts loading, finishes and navigates.
OnLoadStart func(WebNavigation)
OnLoad func(WebNavigation)
OnNavigationStateChange func(WebNavigation)
// OnOpenWindow receives a page's new-window request on macOS, iOS,
// Windows and Linux. It may load the URL in this view or open it
// elsewhere. The platform creates no window, even without a callback.
OnOpenWindow func(WebWindowRequest)
// OnError receives a *WebError. A load cut short, by StopLoading, a new source, another navigation or a download it turned into, is no error.
OnError func(err error)
// MessageOrigins are the origins whose pages reach OnMessage and OnMessageFrom, written as WebMessage.Origin is ("https://example.com"), or "*" for any. Without them only pages of the source's own origin do: Src's, or for HTML BaseURL's, and "null" for HTML without one. "null" is the origin of every page without one of its own, a data: URL a frame sent the view to as much as the source's HTML, so "null", by default or listed, lets in only the source's page; "*" lets in every page. Only the page posts, never a frame in it, on every platform; a frame reaches the app through the page, with window.parent.postMessage, whose event tells the page the frame's origin.
MessageOrigins []string
// OnMessage receives what the page posted, as a string, and OnMessageFrom with the origin of the page that posted it.
OnMessage func(data string)
OnMessageFrom func(WebMessage)
// OnDownload follows what the page downloads, which only a web view
// with one saves, to downloads/<id>/ in the app's data directory:
// files WebKit cannot show and links that ask for a download, on
// Apple platforms, Linux, Windows and Android.
OnDownload func(WebDownload)
OnLayout func(Bounds)
Ref *Ref
Label string
LabelFunc func() string
TestID string
}
WebView shows a web page in the platform's web view, which fills the view and takes its own pointer, wheel and keyboard input. Pages reach the app with window.nsgo.postMessage(data), which OnMessage and OnMessageFrom receive from the pages MessageOrigins allows; Ref.PostMessage dispatches a MessageEvent on the page's window.
type WebViewProps ¶
type WebViewProps struct {
// Href gives a link its browser address. Ordinary presses still use OnPress; a middle click or modified click opens the browser's link.
Href string
HrefFunc func() string
}
WebViewProps are a View's props only the web has.
type WebWindowRequest ¶
type WebWindowRequest = driver.WebWindowRequest
WebWindowRequest is a page's request to open a URL in a new window. UserInitiated reports when the platform associates it with user input.
type WheelEvent ¶
type WheelEvent struct {
// Position is the pointer's place in the view.
Position Point
Delta Point
Modifiers Modifiers
// Touchpad marks a touch surface's scroll, a Magic Mouse's included:
// what a canvas pans by where a wheel's notches zoom it.
Touchpad bool
// Phase is a touchpad's gesture: GestureBegan as the fingers start,
// GestureChanged as they move, GestureEnded as they lift. Where the
// system carries the content on after them, as macOS and the web do,
// its momentum reports more GestureChanged and a GestureEnded of its
// own. A wheel's notches are GestureChanged.
Phase GesturePhase
// Velocity, on GestureEnded, is how fast the fingers moved the content
// as they lifted, in points a second, where the platform's momentum
// does not follow them; the view carries it on itself (Decay).
Velocity Point
}
WheelEvent is a turn of the mouse wheel or a scroll on a touchpad over a view (View.OnWheel). Delta is how far it moves the content, positive right and down: a wheel's notch counts its lines at 40 points on macOS, iOS and the web, 33 on Windows and Linux, as browsers scroll about 100 points a notch.
type WhiteSpace ¶
type WhiteSpace uint8
WhiteSpace says whether text wraps.
const ( WhiteSpaceNormal WhiteSpace = iota + 1 WhiteSpaceNoWrap )
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is a window or a panel the app opened: the core's part of desktop.Window, which apps use. Its methods do nothing on a nil Window, which OpenWindow returns where the platform opens no windows, or once it closed.
func (*Window) Close ¶
func (w *Window) Close()
Close closes the window for good, as its owner going does, without asking OnClosing.
func (*Window) Focus ¶
func (w *Window) Focus()
Focus shows the window in front of the others and activates the app; a panel with PanelOptions.NoActivate comes to the front without the keyboard or activating it.
func (*Window) MoveTo ¶
MoveTo places a panel beside anchor as ShowAt does, without showing, hiding or focusing it: a panel that shows moves there at once, as one following a caret does, and a hidden one goes there when it next shows. It returns an unavailable error for a window that is not a panel.
func (*Window) OnClosing ¶
func (w *Window) OnClosing(cx *Scope, fn func(*WindowClosing))
OnClosing runs fn when the user asks to close the window, newest first, while the current owner of cx lives; fn may cancel the close.
func (*Window) OnPlacementError ¶
OnPlacementError runs fn, under cx, when the platform cannot place the panel where ShowAt, MoveTo or PanelOptions.Dock asked: the panel stays hidden and the app may show something else instead.
func (*Window) Show ¶
func (w *Window) Show()
Show shows the window: a window without taking the focus from another app; a panel where ShowAt or MoveTo last placed it, else at its platform's default spot, taking the keyboard, without activating the app where the platform can, unless PanelOptions.NoActivate keeps it from the keyboard.
func (*Window) ShowAt ¶
ShowAt shows a panel beside anchor, a rectangle in the desktop's screen coordinates (those of Env.Displays and SetWindowFrame) such as a text caret's, on placement's side of it, below for PlaceDefault: it flips to the opposite side when only that one fits on the display that holds anchor's center, and is clamped into that display's visible frame when neither does. A zero-sized anchor is a point, such as the pointer's. Show, Focus and Toggle keep the placement until a tray icon shows the panel under itself. It returns an unavailable error for a window that is not a panel; a platform that cannot place it, Linux on Wayland, reports so to OnPlacementError and leaves it hidden.
func (*Window) Toggle ¶
func (w *Window) Toggle()
Toggle hides the window if it shows, else shows and focuses it.
func (*Window) Visible ¶
Visible reports whether the window shows, tracked: what the app's own Show, Hide and Focus calls, and a panel that hides as it loses the focus, made it. A window the user minimizes, or an app the user hides, stays visible here; desktop.Minimized and Env.Lifecycle in the window's content say so.
type WindowClosing ¶
type WindowClosing struct {
// contains filtered or unexported fields
}
WindowClosing is a close the user asked for, as with the window's close button: the core's part of desktop.WindowClosing, which apps use.
func (*WindowClosing) Cancel ¶
func (c *WindowClosing) Cancel()
Cancel keeps the window open, as an app that hides it instead does.
func (*WindowClosing) Canceled ¶ added in v0.2.0
func (c *WindowClosing) Canceled() bool
Canceled reports whether a handler canceled the close: what a test of a handler reads.
type WindowConstraints ¶
type WindowConstraints = driver.WindowConstraints
WindowConstraints limit a window's size and what the user may do to it.
type WindowControls ¶
type WindowControls = driver.WindowControls
WindowControls is how a hidden title bar shows the system's window controls: hidden, or macOS's traffic lights moved.
type WindowControlsStyle ¶
type WindowControlsStyle = driver.WindowControlsStyle
WindowControlsStyle chooses the appearance of Windows caption buttons.
type WindowDrag ¶
type WindowDrag = driver.WindowDrag
WindowDrag marks a view as a handle that moves the desktop window, or keeps a view inside such a handle clickable.
type WindowFrame ¶
type WindowFrame = driver.WindowFrame
WindowFrame is where a window moves and how large it becomes, in points from the main screen's top left.
type WindowLevel ¶
type WindowLevel = driver.WindowLevel
WindowLevel is where a window stacks among the others.
type WindowMaterial ¶
type WindowMaterial = driver.WindowMaterial
WindowMaterial is a translucent material behind a desktop window's content, where the app draws nothing opaque.
type WindowOptions ¶
type WindowOptions struct {
// Title is the window's; empty is the app's name.
Title string
// Width and Height are the content's size in points; zero is the
// main window's (nsgo.WindowSize).
Width, Height Points
// Frame, when it moves, opens the window there at its size instead of
// centered, as an app restoring a window does: Width and Height give
// way to it, and a window no screen would show opens centered.
Frame WindowFrame
// Key, when set, finds a window opened with the same key and still
// open: OpenWindow shows and focuses it instead of opening another.
Key string
// Parent is an open window of the same app. Closing it closes this
// window too. On desktops it stays above its parent and follows its
// visibility. On macOS it also centers over it when Frame is unset
// and follows its full screen.
Parent *Window
// Hidden opens the window without showing it.
Hidden bool
// Material is the material behind the content (WindowMaterial).
Material WindowMaterial
// Constraints limit the window's size, which Width and Height keep
// to, and what the user may do to it.
Constraints WindowConstraints
// Workspaces are the workspaces the window shows on (desktop.SetWindowWorkspaces).
Workspaces WindowWorkspaces
// PointerEvents is where the window takes the pointer (SetWindowPointerEvents), from its first frame.
PointerEvents WindowPointerEvents
// Transparent leaves the window without a background or frame: what is behind it shows wherever the app draws nothing, as for a desktop pet or a widget, and WindowDrag views move it. desktop.SetWindowTransparent changes it later, which on Windows needs a window opened transparent; desktop.CanMakeWindowsTransparent says in the window's scope whether what is behind it shows; where it does not, the window stays opaque. desktop.Transparent says whether the window is transparent now.
Transparent bool
// NoShadow drops the system's shadow around the window; on Windows only a transparent window has none.
NoShadow bool
// SkipTaskbar keeps the window off the Windows taskbar and Alt+Tab, off the task list on X11, and out of macOS's Window menu and Cmd+`; the Dock is the app's (desktop.SetDockVisible), and Wayland has no such hint (desktop.CanSkipTaskbar).
SkipTaskbar bool
}
WindowOptions are a window's: the core's part of desktop.WindowOptions, which apps use.
type WindowPlacement ¶
type WindowPlacement = driver.WindowPlacement
WindowPlacement is the side of a screen rectangle where a panel goes.
type WindowPointerEvents ¶ added in v0.2.0
type WindowPointerEvents = driver.WindowPointerEvents
WindowPointerEvents is where a desktop window takes the pointer: the core's part of desktop.WindowPointerEvents, which apps use.
type WindowWorkspaces ¶ added in v0.2.0
type WindowWorkspaces = driver.WindowWorkspaces
WindowWorkspaces are the workspaces a window shows on.
type WritingDirection ¶
type WritingDirection uint8
WritingDirection is the base direction of a text's paragraphs.
const ( WritingLTR WritingDirection = iota + 1 WritingRTL // WritingAuto takes the direction of the text's first strong // character, as HTML's dir="auto". WritingAuto )
Source Files
¶
- access.go
- accessibility.go
- accessory.go
- animated.go
- app.go
- appclip.go
- applesignin.go
- appurl.go
- assetpacks.go
- assets.go
- audio.go
- audiooutput.go
- audioplayback.go
- audit.go
- authsession.go
- automationtool.go
- automationtool_off.go
- awake.go
- biometric.go
- canvas.go
- capture.go
- causes.go
- classes.go
- classrelations.go
- classselector.go
- clipboard.go
- clock.go
- cloud.go
- collection.go
- commit.go
- crashreport.go
- css.go
- desktop.go
- dev_geometry.go
- devdrawn.go
- devtools.go
- discovery.go
- diskspace.go
- doc.go
- download.go
- edge.go
- effects.go
- element.go
- env.go
- envinset.go
- errors.go
- features.go
- fileurl.go
- flow.go
- focus.go
- follow.go
- frame.go
- from.go
- gameservices.go
- gpu.go
- grid.go
- haptics.go
- highlights.go
- history.go
- hit.go
- hoist.go
- holder.go
- host.go
- icon.go
- image.go
- input.go
- keys.go
- labels.go
- layout.go
- list.go
- liststate.go
- measure.go
- miniprogramsignin.go
- motion.go
- native.go
- nav.go
- network.go
- notices.go
- notifications.go
- nowplaying.go
- offscreen.go
- ops.go
- orientation.go
- overlay.go
- ownership_release.go
- pace.go
- pagehead.go
- parsecache.go
- peers.go
- permissions.go
- persisted.go
- pip.go
- platformprops.go
- pointer.go
- pointerlock.go
- presence.go
- purchases.go
- quit.go
- reactive.go
- remount.go
- resource.go
- reveal.go
- scan.go
- scroll.go
- scrollbars.go
- secrets.go
- selection_format.go
- selection_text.go
- selector.go
- sensorext.go
- sensors.go
- services.go
- shader.go
- shader_compile.go
- shadereffect.go
- shared.go
- speak.go
- speech.go
- statusbar.go
- storage.go
- style.go
- suggest.go
- suspense.go
- systemgestures.go
- systemswitch.go
- tabbar.go
- tailwind.go
- tailwind_extend.go
- tailwind_palette.go
- tailwind_theme.go
- tailwind_utilities.go
- taskprogress.go
- text.go
- textfit.go
- theme.go
- tooltip.go
- touch.go
- transform.go
- tree.go
- twins.go
- updater.go
- updates.go
- userdirs.go
- video.go
- webcookie.go
- webscheme.go
- webview.go
- window.go
- work.go