uicompiler

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package uicompiler lowers KartUI UI sources into presentation assets and typed client bindings. It never evaluates user Go expressions during build.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeSource

func DecodeSource(source string, data []byte) (ui.Template, error)

DecodeSource preserves legacy JSON assets while accepting the new authoring format. Only the canonical bounded asset is embedded; markup never ships loose.

func DecodeSourceWithTheme

func DecodeSourceWithTheme(source string, data []byte, theme Theme) (ui.Template, error)

func ReadSource

func ReadSource(directory, source string) ([]byte, error)

Types

type Binding

type Binding struct {
	ID                                               uint32
	Text, DefaultText, Enabled, Visible, Rows, Click string
	Child, Props, Key, Loop                          string
}

type Component

type Component struct {
	Name, Source, Asset                    string
	Local                                  bool
	Composition, ChildFactory, Conditional bool

	Setup, Preamble string
	Back            string

	Parameters []Parameter
	Bindings   []Binding
	Template   ui.Template
	// contains filtered or unexported fields
}

func Compile

func Compile(source string, data []byte) (Component, error)

Compile accepts one KartUI component with optional Go imports/types and setup. Legacy exported scalar props remain supported; local models compile with the client.

func CompileWithTheme

func CompileWithTheme(source string, data []byte, theme Theme) (Component, error)

CompileWithTheme resolves style tokens into the bounded presentation asset.

func Load

func Load(directory string, entries []Source) ([]Component, error)

Load confines source resolution to the project, including symlinks.

func LoadProjectWithTheme

func LoadProjectWithTheme(
	directory string,
	entries []Source,
	layoutEntries []LayoutSource,
	themeSource string,
) ([]Component, error)

LoadProjectWithTheme compiles runtime components after loading build-time layouts.

func LoadWithTheme

func LoadWithTheme(directory string, entries []Source, themeSource string) ([]Component, error)

type Layout

type Layout struct {
	Name, Source, Style string
	// contains filtered or unexported fields
}

Layout is a build-time-only reusable panel tree. Its markup and scoped style are projected into each consuming component; no layout lookup ships at runtime.

type LayoutSource

type LayoutSource struct{ Source string }

LayoutSource identifies a build-time layout document.

type Parameter

type Parameter struct{ Name, Type string }

type Source

type Source struct{ Name, Source string }

Source identifies a named UI document without depending on a build tool.

type Theme

type Theme struct {
	Values map[string]string
	Images map[string]ui.Image
}

Theme contains build-time tokens and resolved asset references. The host never parses authoring TOML or performs theme-token lookups.

func DefaultTheme

func DefaultTheme() Theme

func ParseTheme

func ParseTheme(source string, data []byte) (Theme, error)

ParseTheme accepts a bounded theme.toml with a built-in base and typed groups.

func (Theme) ImageNames

func (theme Theme) ImageNames() []string

ImageNames returns the statically referenced project textures in a theme.

func (Theme) ResolveLevelImages

func (theme Theme) ResolveLevelImages(ids map[string]uint32, dimensions map[string][2]int) (Theme, error)

ResolveLevelImages binds a level-local theme to its stable texture IDs.

func (Theme) ValidateGameImages

func (theme Theme) ValidateGameImages(dimensions map[string][2]int) error

ValidateGameImages checks project declarations and nine-slice geometry.

Jump to

Keyboard shortcuts

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