Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MarkupLoader

Class for loading PAM markup and transforming it into a Phosphor widget.

PAM markup is relatively straight-forward, and is written in XML. A simple view might look like this:

 <BoxPanel>
     <Label BoxLayout.SizeBasis="10">Hello, world!</Label>
     <Image href="https://placekitten.com/g/300/300" />
 </BoxPanel>

This creates a BoxPanel with a Label and an Image. The Label has an "Attached Property" specified- BoxLayout.SizeBasis tells BoxLayout how big (in pixels) to make a particular widget.

Element attributes in lowercase (such as data attributes and HTML attrs) get copied to the DOM, so the img element of the Image widget above gets it's src set.

See the Builtin Reference for details on what is included with base PAM

Hierarchy

  • MarkupLoader

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Private factory

factory: WidgetFactory

Methods

Private instantiateWidgetForNode

  • instantiateWidgetForNode(node: Element): Widget
  • Parameters

    • node: Element

    Returns Widget

loadXml

  • loadXml(input: string): Widget
  • Load some PAML as XML, returning a valid Phosphor widget.

    Notes

    The loader walks through the XML tree, breadth-first, to create a widget matching the markup. For each element it encounters, it creates a corresponding widget using the WidgetFactory, and then sets any attached properties by looking for attributes that begin with an upper-case letter.

    Node attributes that begin with a lowercase letter are correspondingly set on the DOM, including data-attrs.

    Caveats

    Phosphor attached properties are hacked in right now, as most of them aren't publicly exposed.

    Parameters

    • input: string

    Returns Widget

Generated using TypeDoc