Documentation
¶
Overview ¶
Package scene builds independently owned protobuf snapshots for GPUI. It contains no client, native runtime or reactive graph dependency.
Index ¶
- Constants
- func Ptr[T any](value T) *T
- type Accessibility
- type AccessibleRole
- type Action
- type Alignment
- type Bounds
- type Color
- type ColorScheme
- type ConditionalStyle
- type Cursor
- type Display
- type DragData
- type DrawCommand
- type DrawCommandPath
- type DrawCommandRect
- type DrawPath
- type DrawRect
- type Drawing
- type Edges
- type Element
- type EventBinding
- type FlexDirection
- type FocusTarget
- type Handle
- type InputState
- type Interaction
- type Justification
- type KeyBinding
- type Length
- type Modifiers
- type Node
- func Canvas(id uint64, commands ...*DrawCommand) *Node
- func Div(id uint64, children ...*Node) *Node
- func Embedded(id, instance uint64) *Node
- func FromProto(element *Element) *Node
- func Image(id uint64, resource *Handle) *Node
- func Text(id uint64, text string) *Node
- func TextInput(id uint64, value InputState, options TextInputOptions) *Node
- func UniformList(id uint64, rowHeight float32, rows ...*Node) *Node
- func (n *Node) Accessible(label string, metadata *Accessibility) *Node
- func (n *Node) Animate(animation *OpacityAnimation) *Node
- func (n *Node) BindKey(keystroke string, action *Action, handlerID uint64) *Node
- func (n *Node) BindKeyWithContext(keystroke, predicate string, action *Action, handlerID uint64) *Node
- func (n *Node) Focusable(tabIndex int32) *Node
- func (n *Node) Hover(style *Style) *Node
- func (n *Node) Interact(options *Interaction) *Node
- func (n *Node) OnAction(name string, handlerID uint64) *Node
- func (n *Node) OnClick(handlerID uint64) *Node
- func (n *Node) Proto() *Element
- func (n *Node) StopPropagation() *Node
- func (n *Node) Style(style *Style) *Node
- func (n *Node) When(conditions ...*ConditionalStyle) *Node
- type OpacityAnimation
- type Overflow
- type PathStep
- type PathVerb
- type Point
- type Position
- type Shadow
- type Size
- type Style
- type TextAlignment
- type TextChanged
- type TextInputOptions
Constants ¶
const ( FlexUnspecified = pb.FlexDirection_FLEX_DIRECTION_UNSPECIFIED FlexRow = pb.FlexDirection_FLEX_DIRECTION_ROW FlexColumn = pb.FlexDirection_FLEX_DIRECTION_COLUMN )
FlexDirection values use concise application-facing names.
const ( AlignUnspecified = pb.Alignment_ALIGNMENT_UNSPECIFIED AlignStart = pb.Alignment_ALIGNMENT_START AlignCenter = pb.Alignment_ALIGNMENT_CENTER AlignEnd = pb.Alignment_ALIGNMENT_END AlignStretch = pb.Alignment_ALIGNMENT_STRETCH )
Alignment values use concise application-facing names.
const ( JustifyUnspecified = pb.Justification_JUSTIFICATION_UNSPECIFIED JustifyStart = pb.Justification_JUSTIFICATION_START JustifyCenter = pb.Justification_JUSTIFICATION_CENTER JustifyEnd = pb.Justification_JUSTIFICATION_END JustifySpaceBetween = pb.Justification_JUSTIFICATION_SPACE_BETWEEN )
Justification values use concise application-facing names.
const ( OverflowUnspecified = pb.Overflow_OVERFLOW_UNSPECIFIED OverflowVisible = pb.Overflow_OVERFLOW_VISIBLE OverflowHidden = pb.Overflow_OVERFLOW_HIDDEN OverflowScroll = pb.Overflow_OVERFLOW_SCROLL )
Overflow values use concise application-facing names.
const ( CursorUnspecified = pb.Cursor_CURSOR_UNSPECIFIED CursorArrow = pb.Cursor_CURSOR_ARROW CursorPointer = pb.Cursor_CURSOR_POINTER )
Cursor values use concise application-facing names.
const ( PositionUnspecified = pb.Position_POSITION_UNSPECIFIED PositionRelative = pb.Position_POSITION_RELATIVE PositionAbsolute = pb.Position_POSITION_ABSOLUTE )
Position values use concise application-facing names.
const ( DisplayUnspecified = pb.Display_DISPLAY_UNSPECIFIED DisplayFlex = pb.Display_DISPLAY_FLEX DisplayGrid = pb.Display_DISPLAY_GRID DisplayNone = pb.Display_DISPLAY_NONE )
Display values use concise application-facing names.
const ( ColorSchemeUnspecified = pb.ColorScheme_COLOR_SCHEME_UNSPECIFIED ColorSchemeLight = pb.ColorScheme_COLOR_SCHEME_LIGHT ColorSchemeDark = pb.ColorScheme_COLOR_SCHEME_DARK )
ColorScheme values use concise application-facing names.
const ( TextAlignUnspecified = pb.TextAlignment_TEXT_ALIGNMENT_UNSPECIFIED TextAlignLeft = pb.TextAlignment_TEXT_ALIGNMENT_LEFT TextAlignCenter = pb.TextAlignment_TEXT_ALIGNMENT_CENTER TextAlignRight = pb.TextAlignment_TEXT_ALIGNMENT_RIGHT )
TextAlignment values use concise application-facing names.
const ( RoleUnspecified = pb.AccessibleRole_ACCESSIBLE_ROLE_UNSPECIFIED RoleGeneric = pb.AccessibleRole_ACCESSIBLE_ROLE_GENERIC RoleButton = pb.AccessibleRole_ACCESSIBLE_ROLE_BUTTON RoleCheckbox = pb.AccessibleRole_ACCESSIBLE_ROLE_CHECKBOX RoleTextInput = pb.AccessibleRole_ACCESSIBLE_ROLE_TEXT_INPUT RoleText = pb.AccessibleRole_ACCESSIBLE_ROLE_TEXT RoleList = pb.AccessibleRole_ACCESSIBLE_ROLE_LIST RoleListItem = pb.AccessibleRole_ACCESSIBLE_ROLE_LIST_ITEM RoleLink = pb.AccessibleRole_ACCESSIBLE_ROLE_LINK RoleImage = pb.AccessibleRole_ACCESSIBLE_ROLE_IMAGE RoleSlider = pb.AccessibleRole_ACCESSIBLE_ROLE_SLIDER RoleDialog = pb.AccessibleRole_ACCESSIBLE_ROLE_DIALOG )
AccessibleRole values use concise application-facing names.
const ( PathUnspecified = pb.PathVerb_PATH_VERB_UNSPECIFIED PathMove = pb.PathVerb_PATH_VERB_MOVE PathLine = pb.PathVerb_PATH_VERB_LINE PathQuadratic = pb.PathVerb_PATH_VERB_QUADRATIC PathCubic = pb.PathVerb_PATH_VERB_CUBIC PathClose = pb.PathVerb_PATH_VERB_CLOSE )
PathVerb values use concise application-facing names.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Accessibility ¶
type Accessibility = pb.Accessibility
Interaction and accessibility values configure native behavior declaratively.
type AccessibleRole ¶
type AccessibleRole = pb.AccessibleRole
Interaction and accessibility values configure native behavior declaratively.
type Bounds ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type Color ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type ColorScheme ¶ added in v0.0.2
type ColorScheme = pb.ColorScheme
Style values retain optional-field presence and generated enum methods.
type ConditionalStyle ¶ added in v0.0.2
type ConditionalStyle = pb.ConditionalStyle
Style values retain optional-field presence and generated enum methods.
type DrawCommand ¶
type DrawCommand = pb.DrawCommand
Drawing values include the exported oneof cases used to construct commands.
type DrawCommandPath ¶
type DrawCommandPath = pb.DrawCommand_Path
Drawing values include the exported oneof cases used to construct commands.
type DrawCommandRect ¶
type DrawCommandRect = pb.DrawCommand_Rect
Drawing values include the exported oneof cases used to construct commands.
type Edges ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type Element ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type EventBinding ¶
type EventBinding = pb.EventBinding
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type FlexDirection ¶
type FlexDirection = pb.FlexDirection
Style values retain optional-field presence and generated enum methods.
type FocusTarget ¶
type FocusTarget = pb.FocusTarget
Interaction and accessibility values configure native behavior declaratively.
type Handle ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type InputState ¶
InputState mirrors a native text field on the application's state-owning goroutine. Its zero value is an empty field. Reset is an explicit Go edit; Accept acknowledges native edits without disturbing selection or IME state.
func (*InputState) Accept ¶
func (s *InputState) Accept(change *TextChanged) bool
func (*InputState) Reset ¶
func (s *InputState) Reset(value string)
type Interaction ¶
type Interaction = pb.Interaction
Interaction and accessibility values configure native behavior declaratively.
type Justification ¶
type Justification = pb.Justification
Style values retain optional-field presence and generated enum methods.
type KeyBinding ¶
type KeyBinding = pb.KeyBinding
Interaction and accessibility values configure native behavior declaratively.
type Length ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type Modifiers ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a builder for a protobuf element snapshot. Builders are mutable and should remain on their owner's goroutine. Proto returns an independent copy.
func Canvas ¶
func Canvas(id uint64, commands ...*DrawCommand) *Node
Canvas submits local-coordinate drawing commands to GPUI. Paths are filled when stroke_width is zero, otherwise stroked. No Go paint callback is used.
func Embedded ¶
Embedded places a native view owned by a host extension, such as an embedded Zed editor. Each instance can appear once per view. The backend must support the embedded-views capability.
func FromProto ¶
FromProto copies a caller-supplied element. Unsupported models are rejected by the bridge, rather than silently discarded.
func TextInput ¶
func TextInput(id uint64, value InputState, options TextInputOptions) *Node
TextInput builds a single-line editable field. Style its container with width, padding, colors, and borders as for any other Node. Newlines are normalized to spaces for native typing/paste. Input values are limited to 64 KiB. Reuse the same element ID to retain focus and selection.
func UniformList ¶
UniformList virtualizes native layout/painting. Go supplies all row snapshots up front; this is not a paging protocol. The normal snapshot limits apply.
func (*Node) Accessible ¶
func (n *Node) Accessible(label string, metadata *Accessibility) *Node
func (*Node) Animate ¶
func (n *Node) Animate(animation *OpacityAnimation) *Node
func (*Node) BindKey ¶
BindKey attaches a native shortcut to this node's subtree. Chords use GPUI's native multi-stroke matching. The node is made focusable automatically.
func (*Node) BindKeyWithContext ¶
func (n *Node) BindKeyWithContext(keystroke, predicate string, action *Action, handlerID uint64) *Node
BindKeyWithContext adds a shortcut with a GPUI keymap predicate, evaluated against Interaction.KeyContext on the native focus path.
func (*Node) Hover ¶
Hover adds a partial style refinement applied by GPUI while hovered. It does not require a Go event or another view snapshot.
func (*Node) Interact ¶
func (n *Node) Interact(options *Interaction) *Node
func (*Node) StopPropagation ¶
func (*Node) When ¶ added in v0.0.2
func (n *Node) When(conditions ...*ConditionalStyle) *Node
When sets refinements that GPUI applies while the window matches each one's width range and color scheme, without a Go event or another snapshot. The backend needs the conditional-styles capability.
type OpacityAnimation ¶
type OpacityAnimation = pb.OpacityAnimation
Style values retain optional-field presence and generated enum methods.
type Point ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type Size ¶
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.
type TextAlignment ¶
type TextAlignment = pb.TextAlignment
Style values retain optional-field presence and generated enum methods.
type TextChanged ¶
type TextChanged = pb.TextChanged
Snapshot values are aliases of the wire types, preserving protobuf methods and identity.