api

package
v0.1.94 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyModifier = ui.EmptyModifier

Deprecated: use ui.EmptyModifier

Functions

This section is empty.

Types

type Composable

type Composable func(Composer) Composer

type Composition = func(Composable) Composable

type Composer

type Composer interface {
	// frame time
	TimeNow() time.Time

	// --
	GetID() Identifier
	GetPath() NodePath

	modifier.ModifierAwareComposer

	// -- Composition Locals
	StartProviders(values []ProvidedValue) Composer
	EndProviders() Composer
	Consume(key interface{}) interface{}

	// -- id management
	GenerateID() Identifier

	EmitSlot(k string, v any) Composer

	TreeBuilderComposer
	GioLayoutNodeAwareComposer

	state.SupportState

	WithComposable(composable Composable) Composer

	If(condition bool, ifTrue Composable, ifFalse Composable) Composable
	IfLazy(condition bool, ifTrue func() Composable, ifFalse func() Composable) Composable

	When(condition bool, ifTrue Composable) Composable
	WhenLazy(condition bool, ifTrue func() Composable) Composable

	Else(condition bool, ifFalse Composable) Composable
	ElseLazy(condition bool, ifFalse func() Composable) Composable

	Sequence(contents ...Composable) Composable

	// Control Flow
	Key(key any, content Composable) Composable
	Range(count int, fn func(int) Composable) Composable

	// frame lifecycle
	lifecycle.FrameLifecycleAware
}

Public API of the composer

type ComposerOption added in v0.1.94

type ComposerOption func(*ComposerOptions)

func ComposerWithLifecycleTriggerReceivers added in v0.1.94

func ComposerWithLifecycleTriggerReceivers(
	startFrameTriggerReceiver func(trigger func()),
	endFrameTriggerReceiver func(trigger func()),
) ComposerOption

func ComposerWithStore added in v0.1.94

func ComposerWithStore(store state.PersistentState) ComposerOption

func ComposerWithTimeNow added in v0.1.94

func ComposerWithTimeNow(now time.Time) ComposerOption

type ComposerOptions added in v0.1.94

type ComposerOptions struct {
	TimeNowFunc func() time.Time
	Store       state.PersistentState

	StartFrameTriggerReceiver func(trigger func())
	EndFrameTriggerReceiver   func(trigger func())
}

func DefaultComposerOptions added in v0.1.94

func DefaultComposerOptions() ComposerOptions

type GioLayoutNodeAwareComposer

type GioLayoutNodeAwareComposer interface {
	//Should this not just emit the constructor to a known key in the slottble?
	SetWidgetConstructor(constructor layoutnode.LayoutNodeWidgetConstructor)
}

UI Specific awareness

type Identifier

type Identifier = idApi.Identifier

compose-identifier.api.Identifier

type LayoutNode

type LayoutNode = layoutnode.LayoutNode

type MutableValue

type MutableValue = state.MutableValue

type NodePath

type NodePath = node.NodePath

type ProvidedValue

type ProvidedValue struct {
	CompositionLocal interface{}
	Value            interface{}
}

ProvidedValue pairs a CompositionLocal with a value.

type TreeBuilderComposer

type TreeBuilderComposer interface {
	StartBlock(key string) Composer
	EndBlock() Composer
	Build() LayoutNode
}

Jump to

Keyboard shortcuts

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