Documentation ¶
Overview ¶
Package dom provides basic UX controls in FUSS
Index ¶
- Constants
- func DataUrl(data []byte, mimeType string) string
- type AFunc
- type Background
- type Border
- type Borders
- type BoxShadow
- type BoxShadows
- type ButtonFunc
- type CheckboxEditFunc
- type Direction
- type Driver
- type Element
- type Event
- type EventHandler
- type FixedFunc
- type FocusableFunc
- type Font
- type ImgFunc
- type LabelViewFunc
- type LiveTextEditFunc
- type Margins
- type Padding
- type Props
- type RunFunc
- type Size
- type StretchFunc
- type Styles
- type TextEditFunc
- type TextEditOFunc
- type TextEditOptions
- type TextInputFunc
- type TextViewFunc
- type VRunFunc
Constants ¶
const FlexNone = -1
FlexNone should be used for a zero grow/shrink
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Background ¶
type Background struct {
Color string
}
Background configures the background css property
type Borders ¶
type Borders struct { Raw string Radius Size Width Size Color string Style string Left, Right, Top, Bottom Border }
Borders represents all borders
type BoxShadows ¶
type BoxShadows struct {
B1, B2, B3, B4, B5 BoxShadow
}
BoxShadows implements multiple box shadow elements
func (BoxShadows) String ¶
func (b BoxShadows) String() string
String returns a stringified version of the box shadow
type ButtonFunc ¶
type ButtonFunc = func(key interface{}, styles Styles, onClick *EventHandler, children ...Element) Element
ButtonFunc implements a button control.
func NewButton ¶
func NewButton() (update ButtonFunc, closeAll func())
NewButton is the constructor for ButtonFunc
type CheckboxEditFunc ¶
type CheckboxEditFunc = func(key interface{}, styles Styles, checked *streams.Bool, id string) Element
CheckboxEditFunc represents a checkbox control.
func NewCheckboxEdit ¶
func NewCheckboxEdit() (update CheckboxEditFunc, closeAll func())
NewCheckboxEdit is the constructor for CheckboxEditFunc
type Driver ¶
Driver represents the interface to be implemented by drivers. This allows testing in non-browser environments
func RegisterDriver ¶
RegisterDriver allows drivers to register their concrete implementation
type Element ¶
type Element interface { // SetProp updates the prop to the provided value SetProp(key string, value interface{}) // Children returns a readonly slice of children Children() []Element // RemoveChild remove a child element at the provided index RemoveChild(index int) // InsertChild inserts a child element at the provided index InsertChild(index int, elt Element) // Close releases any resources held by this resource Close() }
Element represents a raw DOM element to be implemented by a driver
func NewElement ¶
NewElement creates a new element using the registered driver.
While the children can be specified here, they can also be modified via AddChild/RemoveChild APIs
type Event ¶
type Event interface { // CreatedEpochNano is the time when the event fired in UnixNano EpochNano() int64 // Value is applicable for input/change events only // TODO: migrate this to a ChangeEvent interface Value() string }
Event is to be implemennted by the driver
type EventHandler ¶
type EventHandler struct {
Handle func(Event)
}
EventHandler is struct to hold a callback function
This is needed simply to make Props be comparable (which makes it easier to see if anything has changed)
type FocusableFunc ¶
type FocusableFunc = func(key interface{}, eh *EventHandler, children ...Element) Element
FocusableFunc defines the shape of a control which can receive focus and be selected by clicks.
This is different from a checbox or input in that there are no specific "values" available and it also does not expose actual keyboard events.
Note that there is no programmatic way to focus this element
func NewFocusable ¶
func NewFocusable() (update FocusableFunc, closeAll func())
NewFocusable is the constructor for FocusableFunc
type LabelViewFunc ¶
LabelViewFunc represents a label control.
func NewLabelView ¶
func NewLabelView() (update LabelViewFunc, closeAll func())
NewLabelView is the constructor for LabelViewFunc
type LiveTextEditFunc ¶
type LiveTextEditFunc = func(key interface{}, styles Styles, text *streams.S16, placeholder string) Element
LiveTextEdit provides continuous changes as user keeps typing
func NewLiveTextEdit ¶
func NewLiveTextEdit() (update LiveTextEditFunc, closeAll func())
NewLiveTextEdit is the constructor for LiveTextEditFunc
type Props ¶
type Props struct { Styles Tag string Checked bool Type string TextContent string ID string For string Href string Src string Placeholder string OnChange *EventHandler OnClick *EventHandler OnFocus *EventHandler OnInput *EventHandler }
Props represents the props of an element
type Size ¶
Size represents a string, percent or numeric values. If an explicit zero value is needed, it is best to use the string form
type StretchFunc ¶
StretchFunc represents a non-shrinkable container
func NewStretch ¶
func NewStretch() (update StretchFunc, closeAll func())
NewStretch is the constructor for StretchFunc
type Styles ¶
type Styles struct { Background Background Color string Width, Height Size OverflowX, OverflowY string Borders Borders Margins Margins Padding Padding AlignItems string // TODO add enum TextAlign string // TODO add enum BoxShadows BoxShadows Font Font FlexDirection Direction // FlexGrow and FlexShrink should not be set to zero. // For actual zero value, use FlexNone instead FlexGrow, FlexShrink int }
Styles represents a set of CSS Styles
type TextEditFunc ¶
TextEditFunc represents a text edit control.
func NewTextEdit ¶
func NewTextEdit() (update TextEditFunc, closeAll func())
NewTextEdit is the constructor for TextEditFunc
type TextEditOFunc ¶
type TextEditOFunc = func(key interface{}, opt TextEditOptions) Element
TextEditOFunc is like TextEditFunc but with extended options
func NewTextEditO ¶
func NewTextEditO() (update TextEditOFunc, closeAll func())
NewTextEditO is the constructor for TextEditOFunc
type TextEditOptions ¶
TextEditOptions configures a TextEditO control
type TextInputFunc ¶
type TextInputFunc = func(key interface{}, styles Styles, eh *EventHandler, id, placeholder string) Element
TextInput calls the callback when user submits input
func NewTextInput ¶
func NewTextInput() (update TextInputFunc, closeAll func())
NewTextInput is the constructor for TextInputFunc
type TextViewFunc ¶
TextViewFunc represeentns a text view control
func NewTextView ¶
func NewTextView() (update TextViewFunc, closeAll func())
NewTextView is the constructor for TextViewFunc
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package html implements a basic html driver for dom It uses "golang.org/x/net/html" as the basis
|
Package html implements a basic html driver for dom It uses "golang.org/x/net/html" as the basis |
Package js implements a basic gopherjs driver for dom
|
Package js implements a basic gopherjs driver for dom |