Documentation
¶
Overview ¶
Package inspector captures snapshots of a running Kite application's DOM, layout fragments, and element styles for the DevTools inspector. Mini-plugins implement Extension and register with Inspector.RegisterExtension to contribute data to each snapshot.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionExtension ¶
type ActionExtension interface {
Extension
HandleAction(eng *engine.Engine, action string, params json.RawMessage) (any, error)
}
ActionExtension is an optional interface for extensions that handle interactive RPC actions dispatched from their mini-plugin UI (POST /extensions/{id}/action).
type BreakTokenSnapshot ¶
type BreakTokenSnapshot struct {
ChildIndex int `json:"childIndex"`
}
type ClusterSnapshot ¶
type Extension ¶
type Extension interface {
Name() string
Title() string
GetPayload(eng *engine.Engine) any
UIScript() []byte
}
Extension is implemented by all DevTools mini-plugins. Each extension provides its ID (Name), tab label (Title), snapshot payload (GetPayload), and frontend JavaScript module (UIScript, served at GET /extensions/{id}/plugin.js).
type ExtensionSnapshot ¶
type FragmentSnapshot ¶
type FragmentSnapshot struct {
Name string `json:"name"`
Offset geom.Point `json:"offset"`
Size geom.Size `json:"size"`
Clusters []ClusterSnapshot `json:"clusters,omitempty"`
BreakToken *BreakTokenSnapshot `json:"breakToken,omitempty"`
Children []*FragmentSnapshot `json:"children,omitempty"`
}
type Inspector ¶
type Inspector struct {
// contains filtered or unexported fields
}
func NewWithServerAddr ¶
NewWithServerAddr creates an Inspector associated with a bound server address.
func (*Inspector) GetExtension ¶
func (*Inspector) RegisterExtension ¶
func (*Inspector) ServerAddr ¶
ServerAddr returns the bound DevTools HTTP address, or "" when no server is running.
func (*Inspector) TakeSnapshot ¶
func (i *Inspector) TakeSnapshot() *InspectorPayload
type InspectorPayload ¶
type InspectorPayload struct {
DebugXRay bool `json:"debugXRay"`
DOM *NodeSnapshot `json:"dom"`
Overlays []*NodeSnapshot `json:"overlays,omitempty"`
Fragments *FragmentSnapshot `json:"fragments"`
OverlayFrags []*FragmentSnapshot `json:"overlayFragments,omitempty"`
Extensions []ExtensionSnapshot `json:"extensions,omitempty"`
}
type NodeSnapshot ¶
type NodeSnapshot struct {
Kind string `json:"kind"`
Name string `json:"name"`
ID string `json:"id,omitempty"`
Class string `json:"class,omitempty"`
IsUA bool `json:"isUA,omitempty"`
Rect geom.Rect `json:"rect"`
ScrollX int `json:"scrollX,omitempty"`
ScrollY int `json:"scrollY,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Text string `json:"text,omitempty"`
TextContent string `json:"textContent,omitempty"`
Computed *style.Computed `json:"computed,omitempty"`
Default style.Style `json:"default"`
Raw style.Style `json:"raw"`
Intrinsic style.Style `json:"intrinsic"`
Fragment *FragmentSnapshot `json:"fragment,omitempty"`
Children []*NodeSnapshot `json:"children,omitempty"`
}