package document
Variables
Debug
Functions
TransformHTML
Types
Document
struct
type Document struct {
Elements []*Element
TopElements []*Element
HeadElements []*Element
Debug struct {
ReloadEventId events.Id
}
// Has unexported fields. }
DocumentFromHTMLString
func DocumentFromHTMLString(uiMan *ui.Manager, htmlStr string, withData any, funcMap map[string]func(*Element)) *Document
Document.Activate
Document.AddChildElement
Document.ApplyStyles
Document.Clean
Document.Deactivate
Document.Destroy
Document.DupicateElement
DupicateElement will create a duplicate of a given element, nesting it under the same parent as the given element (at the end). If you wish to just duplicate an element and use one of the Insert functions, then use Element.Clone followed by an Insert function instead
Document.GetElementById
Document.GetElementsByClass
Document.GetElementsByGroup
Document.GetElementsByTagName
Document.InsertElementAfter
InsertElementAfter inserts the given element elm into the document after the specified element after. It handles the removal of elm from its current parent if it has one, and then inserts it into the children of after's parent at the correct position. The function ensures that elm is properly added to the document's element list and updates all necessary caches and styles after the insertion.
Parameters: - elm: the element to be inserted - after: the element after which elm should be inserted
Preconditions: - Both elm and after must not be nil (enforced by debug.Ensure)
Document.InsertElementBefore
InsertElementBefore inserts the given element elm into the document before the specified element before. It handles the removal of elm from its current parent if it has one, and then inserts it into the children of before's parent at the correct position. The function ensures that elm is properly added to the document's element list and updates all necessary caches and styles after the insertion.
Parameters: - elm: the element to be inserted - before: the element before which elm should be inserted
Preconditions: - Both elm and before must not be nil (enforced by debug.Ensure)
Document.IsActive
Document.RemoveElement
RemoveElement removes the specified element from the document by first recursively removing all child elements, then removing the element from its parent's children list, destroying the UI entity, and updating the document's element caches. Finally, it reapplies all document styles.
Parameters: - elm: pointer to the Element to be removed from the document
The function performs the following operations: 1. Recursively removes all child elements starting from the last child 2. Removes the element from its parent's Children list if it has a parent 3. Destroys the UI entity associated with the element 4. Updates the parent's layout dirty flag 5. Removes the element from document's indexed elements 6. Applies all document styles to reflect changes
Document.SetElementClasses
SetElementClasses updates the class list of the given element and applies style changes to the entire document. It calls SetElementClassesWithoutApply to update classes, then applies all styles in the document.
Parameters: - elm: pointer to the Element whose classes will be updated - classes: variadic string parameters representing the new class names
Document.SetElementClassesWithoutApply
SetElementClassesWithoutApply updates the class list of the given element without applying styles. It removes the element from its previous class lists, sets the new classes, and updates the document's classElements map to reflect the new class assignments.
Parameters: - elm: pointer to the Element whose classes will be updated - classes: variadic string parameters representing the new class names
The function performs the following operations: 1. Sorts both the input classes and existing element classes 2. Returns early if classes are identical 3. Removes element from previous class lists in classElements map 4. Sets the new class list on the element 5. Adds element to the appropriate class lists in classElements map
Document.SetupStylizer
Element
struct
type Element struct {
Type html.NodeType
Data string
UI *ui.UI
UIPanel *ui.Panel
Parent weak.Pointer[Element]
Children []*Element
StyleRules []rules.Rule
UIEventIds [ui.EventTypeEnd][]events.Id
// Has unexported fields.
}
NewHTML
Element.Attribute
Element.Body
Element.ClassList
Element.Clone
Element.EnforceColor
Element.FindElementById
Element.FindElementByTag
Element.FindElementLabelById
Element.FindElementsByTag
Element.HasClass
Element.Head
Element.Html
Element.IndexOfChild
Element.InnerLabel
Element.IsButton
Element.IsImage
Element.IsInput
Element.IsSelect
Element.IsSelectOption
Element.IsText
Element.Root
Element.SetAttribute
SetAttribute sets an attribute on the HTML element. If the attribute key is "class", it parses the value as space-separated class names and sets them using SetClasses. Otherwise, it updates the existing attribute or adds a new one to the element's attribute list.
Element.SetClasses
Element.UnEnforceColor
Stylizer
interface
TemplateIndexedAny
struct