modifier

package
v0.1.88 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugModifier

func DebugModifier(m Modifier) string

DebugModifier returns a formatted string representation of the Modifier chain for debugging purposes.

func Fold

func Fold[T any](c ModifierChain, initial T, operation func(T, Modifier) T) T

Fold Alias for FoldIn, FoldIn processes elements from right to left (tail to head)

func FoldIn

func FoldIn[T any](c ModifierChain, initial T, operation func(T, Modifier) T) T

FoldIn processes elements from right to left (tail to head)

func FoldOut

func FoldOut[T any](c ModifierChain, initial T, operation func(T, Modifier) T) T

FoldOut processes elements from left to right (head to tail)

Types

type Chain

type Chain interface {
	// Fold folds the modifier chain, alias for FoldIn
	Fold(initial interface{}, operation func(interface{}, Modifier) interface{}) interface{}

	FoldIn(initial interface{}, operation func(interface{}, Modifier) interface{}) interface{}

	FoldOut(initial interface{}, operation func(interface{}, Modifier) interface{}) interface{}

	// Any returns true if any element matches the predicate
	Any(predicate func(Modifier) bool) bool
}

type ChainNode

type ChainNode = node.ChainNode

type Element

type Element interface {
	// Create creates a new Chain Node instance
	Create() Node

	// Update updates an existing Chain node for efficiency
	Update(node Node)

	// Equals checks if this element is equivalent to another
	// used during filter operations like Modifier.Any
	Equals(other Element) bool
}

Element represents a modifier that can be applied to create a Node

func NewElement

func NewElement(
	createFunc func() Node,
	updateFunc func(Node),
	equalsFunc func(Element) bool,
) Element

type ElementStore

type ElementStore interface {
	SetElement(string, Element) ElementStore
	GetElement(string) maybe.Maybe[Element]
}
var EmptyElementStore ElementStore = NewElementStore()

func NewElementStore

func NewElementStore() ElementStore

type InspectableModifier

type InspectableModifier interface {
	Modifier
	InspectorInfo() *InspectorInfo
	Unwrap() Modifier
}

func NewInspectableModifier

func NewInspectableModifier(m Modifier, inspectorInfo *InspectorInfo) InspectableModifier

type InspectorInfo

type InspectorInfo struct {
	Name       string
	Properties map[string]any
}

func NewInspectorInfo

func NewInspectorInfo(name string, props map[string]any) *InspectorInfo

type Modifier

type Modifier interface {
	// Then chains this modifier with another
	Then(other Modifier) Modifier
	AsChain() ModifierChain
}

The base type of the NodeModifiers Modifier represents a chain of modifier elements

var EmptyModifier Modifier = &emptyModifier{}

EmptyModifier is the empty modifier that does nothing.

func NewModifier

func NewModifier(element Element) Modifier

func Then

func Then(modifier Modifier, other Modifier) Modifier

Then is a helper function to chain modifiers.

func UnwrapModifier

func UnwrapModifier(m Modifier) Modifier

UnwrapModifier extracts the underlying Modifier from wrapper types

type ModifierAwareComposer

type ModifierAwareComposer interface {
	Modifier(func(modifier Modifier) Modifier)
}

type ModifierChain

type ModifierChain interface {
	Modifier
	Chain
}

func NewChain

func NewChain(head Modifier, tail ModifierChain) ModifierChain

Constructor

type ModifierElement

type ModifierElement interface {
	Modifier
	Element
}

type ModifierElementChain

type ModifierElementChain interface {
	Modifier
	Element
	Chain
}

type Node

type Node = node.Node

type TreeNode

type TreeNode = node.TreeNode

Jump to

Keyboard shortcuts

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