Documentation
¶
Index ¶
- func ComponentNameFromPath(path string) string
- func EventFieldName(name string) string
- func EventMethodName(name string) string
- func EventName(event Event) (string, bool)
- func GeneratedConstructorName(componentName string) string
- func GeneratedFieldName() string
- func GeneratedTypeName(componentName string) string
- func Parse(source []byte, componentName string) (*File, []Diagnostic)
- func ParseBlock(block *sfc.Block, componentName string) (*File, []Diagnostic)
- func ParseSFC(file *sfc.File) (*File, []Diagnostic)
- func PropFieldName(name string) string
- func PropGetterName(name string) string
- func PropOKName(name string) string
- func StateFieldName(name string) string
- func StateGetterName(name string) string
- func StateSetterName(name string) string
- type Allocation
- type Component
- type Diagnostic
- type Event
- type Field
- type FieldKind
- type File
- type Import
- type Method
- type Parameter
- type Prop
- type State
- type Struct
- type TypeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComponentNameFromPath ¶
ComponentNameFromPath returns the PascalCase component name for a .tue path.
func EventFieldName ¶
EventFieldName returns the hidden generated event callback field.
func EventMethodName ¶
EventMethodName returns the generated component event method.
func GeneratedConstructorName ¶
GeneratedConstructorName returns the generated backing initializer.
func GeneratedFieldName ¶
func GeneratedFieldName() string
GeneratedFieldName returns the hidden generated component field.
func GeneratedTypeName ¶
GeneratedTypeName returns the hidden generated storage type for componentName.
func Parse ¶
func Parse(source []byte, componentName string) (*File, []Diagnostic)
Parse parses Go script source with positions relative to the start of source.
func ParseBlock ¶
func ParseBlock(block *sfc.Block, componentName string) (*File, []Diagnostic)
ParseBlock parses a script block returned by the SFC parser.
func ParseSFC ¶
func ParseSFC(file *sfc.File) (*File, []Diagnostic)
ParseSFC parses the script block from an SFC file and derives the component name from the file basename.
func PropFieldName ¶
PropFieldName returns the hidden generated prop getter field.
func PropGetterName ¶
PropGetterName returns the generated effective-value prop accessor.
func PropOKName ¶
PropOKName returns the generated prop accessor that reports parent supply.
func StateFieldName ¶
StateFieldName returns the hidden generated reactive state field.
func StateGetterName ¶
StateGetterName returns the generated state getter.
func StateSetterName ¶
StateSetterName returns the generated state setter.
Types ¶
type Allocation ¶
Allocation describes the generated-code construction shape for a component.
type Component ¶
type Component struct {
Name string
GeneratedType string
Span sfc.Span
NameSpan sfc.Span
Props []Prop
Events []Event
States []State
LocalFields []Field
Computed []Field
Resources []Field
Methods []Method
Init *Method
Allocation Allocation
}
Component is component metadata extracted from the expected component struct.
type Diagnostic ¶
Diagnostic is a source-mapped script extraction diagnostic.
type Event ¶
type Event struct {
Name string
GoName string
Parameters []Parameter
Span sfc.Span
NameSpan sfc.Span
}
Event is a parent callback declared by a Comp marker.
func (Event) FunctionType ¶
FunctionType returns the Go callback type represented by the event.
type Field ¶
type Field struct {
Kind FieldKind
Name string
Exported bool
Type string
ValueType string
Tag string
Span sfc.Span
NameSpan sfc.Span
TypeSpan sfc.Span
TagSpan sfc.Span
}
Field is a named field on the component struct.
type File ¶
type File struct {
Path string
PackageName string
PackageSpan sfc.Span
Imports []Import
Types []TypeInfo
Structs []Struct
Component *Component
}
File is the extracted component view of one Go script block.
type Method ¶
type Method struct {
Name string
ReceiverName string
PointerReceiver bool
ImplicitGetter bool
StateGetter bool
Parameters []Parameter
Results []Parameter
Span sfc.Span
NameSpan sfc.Span
ReceiverSpan sfc.Span
}
Method is a method declared on the component type.
func (Method) ParameterTypes ¶
ParameterTypes returns the method parameter types in declaration order.
func (Method) ResultTypes ¶
ResultTypes returns the method result types in declaration order.
type Prop ¶
type Prop struct {
Name string
GoName string
Type string
Required bool
Span sfc.Span
NameSpan sfc.Span
TypeSpan sfc.Span
}
Prop is a parent-provided value declared by a Comp marker.
type State ¶
type State struct {
Name string
GoName string
Type string
Span sfc.Span
NameSpan sfc.Span
TypeSpan sfc.Span
}
State is generated reactive state declared by a Comp marker.