Documentation
¶
Overview ¶
Package uicompiler lowers KartUI UI sources into presentation assets and typed client bindings. It never evaluates user Go expressions during build.
Index ¶
- func DecodeSource(source string, data []byte) (ui.Template, error)
- func DecodeSourceWithTheme(source string, data []byte, theme Theme) (ui.Template, error)
- func ReadSource(directory, source string) ([]byte, error)
- type Binding
- type Component
- func Compile(source string, data []byte) (Component, error)
- func CompileWithTheme(source string, data []byte, theme Theme) (Component, error)
- func Load(directory string, entries []Source) ([]Component, error)
- func LoadProjectWithTheme(directory string, entries []Source, layoutEntries []LayoutSource, ...) ([]Component, error)
- func LoadWithTheme(directory string, entries []Source, themeSource string) ([]Component, error)
- type Diagnostic
- type Layout
- type LayoutSource
- type Parameter
- type Source
- type SourceError
- type SourceLocation
- type Theme
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeSource ¶
DecodeSource compiles .kui authoring or validates a KUI1 binary asset. Only the bounded binary asset is embedded; markup never ships loose.
func DecodeSourceWithTheme ¶
func ReadSource ¶
Types ¶
type Component ¶
type Component struct {
Name, Source, Asset string
Local bool
Composition, ChildFactory, Conditional, SourceFactory bool
Setup, Preamble string
Back string
Parameters []Parameter
Bindings []Binding
Template ui.Template
// contains filtered or unexported fields
}
func Compile ¶
Compile accepts one .kui single-file component with optional Go setup and indented styles.
func CompileWithTheme ¶
CompileWithTheme resolves style tokens into the bounded presentation asset.
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 (*Component) Diagnostics ¶ added in v0.0.5
func (component *Component) Diagnostics() []Diagnostic
Diagnostics returns a copy of the component's bounded style warnings.
func (*Component) StaticTemplate ¶ added in v0.0.5
StaticTemplate returns a strictly validated presentation-only template. Keeping the component also lets build tools report its style diagnostics.
func (*Component) StyleWarnings ¶ added in v0.0.5
StyleWarnings returns build-time diagnostics for ignored styles. The compiler does not write to stderr; callers decide where warnings should be displayed.
type Diagnostic ¶ added in v0.0.5
type Diagnostic struct {
SourceLocation
Message string
}
Diagnostic describes an ignored authoring style. Locations refer to original source files, including layout files, rather than generated compiler input.
func (Diagnostic) String ¶ added in v0.0.5
func (diagnostic Diagnostic) String() string
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 Source ¶
type Source struct{ Name, Source string }
Source identifies a named UI document without depending on a build tool.
type SourceError ¶ added in v0.0.5
type SourceError struct {
SourceLocation
Message string
Cause error
}
SourceError preserves the validation cause while identifying authored input. Callers can use errors.As to obtain its location and errors.Is for the cause.
func (*SourceError) Error ¶ added in v0.0.5
func (failure *SourceError) Error() string
func (*SourceError) Unwrap ¶ added in v0.0.5
func (failure *SourceError) Unwrap() error
type SourceLocation ¶ added in v0.0.5
SourceLocation identifies a one-based byte column in an authored source file.
func (SourceLocation) String ¶ added in v0.0.5
func (location SourceLocation) String() string
type Theme ¶
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 ¶
ParseTheme accepts a bounded theme.toml with a built-in base and typed groups.
func (Theme) ImageNames ¶
ImageNames returns the statically referenced project textures in a theme.