editor

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EdgeEditData

type EdgeEditData struct {
	SessionID string
	BasePath  string
	EdgeID    string
	Edge      *dot.Edge
}

EdgeEditData holds the data passed to the edge_edit_form template partial.

type NodeEditData

type NodeEditData struct {
	SessionID string
	BasePath  string
	NodeID    string
	Node      *dot.Node
}

NodeEditData holds the data passed to the node_edit_form template partial.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server holds the chi router, session store, and parsed templates. The templates field holds the shared partials. The landingTmpl and editorTmpl fields hold page-specific template sets that each define their own "content" block.

func NewServer

func NewServer(store *Store, templateDir string, staticDir string) *Server

NewServer creates a Server with all routes configured and templates parsed.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface, delegating to the chi router.

type Session

type Session struct {
	ID          string
	Graph       *dot.Graph
	RawDOT      string
	Diagnostics []dot.Diagnostic
	UndoStack   []string
	RedoStack   []string
	CreatedAt   time.Time
	LastAccess  time.Time
	// contains filtered or unexported fields
}

func (*Session) AddEdge

func (sess *Session) AddEdge(from, to string, attrs map[string]string) error

AddEdge adds a new edge to the graph

func (*Session) AddNode

func (sess *Session) AddNode(id string, attrs map[string]string) error

AddNode adds a new node to the graph

func (*Session) RLock

func (sess *Session) RLock()

RLock acquires a read lock for safe concurrent reads of session data.

func (*Session) RUnlock

func (sess *Session) RUnlock()

RUnlock releases a read lock.

func (*Session) Redo

func (sess *Session) Redo() error

Redo restores a previously undone state

func (*Session) RemoveEdge

func (sess *Session) RemoveEdge(edgeID string) error

RemoveEdge removes an edge by its stable ID

func (*Session) RemoveNode

func (sess *Session) RemoveNode(nodeID string) error

RemoveNode removes a node and its associated edges

func (*Session) Undo

func (sess *Session) Undo() error

Undo restores the previous DOT state

func (*Session) UpdateDOT

func (sess *Session) UpdateDOT(rawDOT string) error

UpdateDOT replaces the current DOT content with new DOT

func (*Session) UpdateEdge

func (sess *Session) UpdateEdge(edgeID string, attrs map[string]string) error

UpdateEdge updates attributes of an existing edge

func (*Session) UpdateGraphAttrs

func (sess *Session) UpdateGraphAttrs(attrs map[string]string) error

UpdateGraphAttrs updates graph-level attributes

func (*Session) UpdateNode

func (sess *Session) UpdateNode(nodeID string, attrs map[string]string) error

UpdateNode updates attributes of an existing node

func (*Session) Validate

func (sess *Session) Validate()

Validate re-runs the linter and updates diagnostics under lock.

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(maxSessions int, ttl time.Duration) *Store

NewStore creates a new session store

func (*Store) Cleanup

func (s *Store) Cleanup()

Cleanup removes sessions older than TTL

func (*Store) Create

func (s *Store) Create(rawDOT string) (*Session, error)

Create creates a new session from DOT source

func (*Store) Get

func (s *Store) Get(id string) (*Session, bool)

Get retrieves a session by ID and updates its LastAccess time

func (*Store) StartCleanup

func (s *Store) StartCleanup(interval time.Duration) func()

StartCleanup starts a background cleanup goroutine and returns a stop function

type TemplateData

type TemplateData struct {
	Session        *Session
	SessionID      string
	BasePath       string
	ProjectPath    string
	BuildStartPath string
	DotFixPath     string
	Error          string
}

TemplateData holds the data passed to HTML templates for rendering pages and partials.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL