gradum-kit - v0.1.0
    Preparing search index...

    Class GradumProxiedElement<ElementTag, ViewType, DataType, ModelType, EmitterType>

    GradumProxiedElement

    GradumProxiedElement class, similar to GradumElement but containing an HTML element instead of being one.

    Type Parameters

    Index
    • Type Parameters

      • ElementTag extends
            | "symbol"
            | "animate"
            | "animateMotion"
            | "animateTransform"
            | "circle"
            | "clipPath"
            | "defs"
            | "desc"
            | "ellipse"
            | "feBlend"
            | "feColorMatrix"
            | "feComponentTransfer"
            | "feComposite"
            | "feConvolveMatrix"
            | "feDiffuseLighting"
            | "feDisplacementMap"
            | "feDistantLight"
            | "feDropShadow"
            | "feFlood"
            | "feFuncA"
            | "feFuncB"
            | "feFuncG"
            | "feFuncR"
            | "feGaussianBlur"
            | "feImage"
            | "feMerge"
            | "feMergeNode"
            | "feMorphology"
            | "feOffset"
            | "fePointLight"
            | "feSpecularLighting"
            | "feSpotLight"
            | "feTile"
            | "feTurbulence"
            | "filter"
            | "foreignObject"
            | "g"
            | "image"
            | "line"
            | "linearGradient"
            | "marker"
            | "mask"
            | "metadata"
            | "mpath"
            | "path"
            | "pattern"
            | "polygon"
            | "polyline"
            | "radialGradient"
            | "rect"
            | "set"
            | "stop"
            | "svg"
            | "switch"
            | "text"
            | "textPath"
            | "tspan"
            | "use"
            | "view"
            | (keyof HTMLElementTagNameMap)
            | (keyof MathMLElementTagNameMap)
            | (keyof GradumElementTagNameMap) =
            | "symbol"
            | "animate"
            | "animateMotion"
            | "animateTransform"
            | "circle"
            | "clipPath"
            | "defs"
            | "desc"
            | "ellipse"
            | "feBlend"
            | "feColorMatrix"
            | "feComponentTransfer"
            | "feComposite"
            | "feConvolveMatrix"
            | "feDiffuseLighting"
            | "feDisplacementMap"
            | "feDistantLight"
            | "feDropShadow"
            | "feFlood"
            | "feFuncA"
            | "feFuncB"
            | "feFuncG"
            | "feFuncR"
            | "feGaussianBlur"
            | "feImage"
            | "feMerge"
            | "feMergeNode"
            | "feMorphology"
            | "feOffset"
            | "fePointLight"
            | "feSpecularLighting"
            | "feSpotLight"
            | "feTile"
            | "feTurbulence"
            | "filter"
            | "foreignObject"
            | "g"
            | "image"
            | "line"
            | "linearGradient"
            | "marker"
            | "mask"
            | "metadata"
            | "mpath"
            | "path"
            | "pattern"
            | "polygon"
            | "polyline"
            | "radialGradient"
            | "rect"
            | "set"
            | "stop"
            | "svg"
            | "switch"
            | "text"
            | "textPath"
            | "tspan"
            | "use"
            | "view"
            | (keyof HTMLElementTagNameMap)
            | (keyof MathMLElementTagNameMap)
            | (keyof GradumElementTagNameMap)
      • ViewType extends GradumView<
            object,
            GradumModel<any, any, any, any, any>,
            GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
        > = GradumView<
            any,
            any,
            GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
        >

        The element's view type, if initializing MVC.

      • DataType extends object = object

        The element's data type, if initializing MVC.

      • ModelType extends GradumModel<any, any, any, any, any> = GradumModel<any, any, any, any, any>

        The element's model type, if initializing MVC.

      • EmitterType extends GradumEmitter<GradumModel<any, any, any, any, any>, KeyType> = GradumEmitter<any, KeyType>

        The element's emitter type, if initializing MVC.

      Returns GradumProxiedElement<ElementTag, ViewType, DataType, ModelType, EmitterType>

    defaultProperties: GradumElementProperties = ...

    Default properties assigned to a new instance.

    properties: GradumProxiedProperties<
        ElementTag,
        ViewType,
        DataType,
        ModelType,
        EmitterType,
    >
    initialized: boolean

    Whether the element was initialized already or not.

    defaultFeedforwardProperties: GradumElementProperties

    The properties passed on to children created through feedforward, letting a parent seed its descendants with shared defaults.

    view: ViewType

    The view (if any) of the element.

    model: ModelType

    The model (if any) of the element.

    emitter: GradumEmitter

    The emitter (if any) of the element.

    data: DataType

    The main data block (if any) attached to the element, taken from its model (if any).

    dataId: string

    The ID of the main data block (if any) of the element, taken from its model (if any).

    dataIndex: number

    The numerical index of the main data block (if any) of the element, taken from its model (if any).

    dataSize: number

    The size (number) of the main data block (if any) of the element, taken from its model (if any).

    operators: GradumOperator<
        object,
        GradumView<
            any,
            any,
            GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
        >,
        GradumModel<any, any, any, any, any>,
        GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
    >[]

    The operators (if any) attached to the element's MVC structure.

    handlers: GradumHandler<GradumModel<any, any, any, any, any>>[]

    The handlers (if any) attached to the element's model. Returns an empty array if no model is set.

    interactors: GradumInteractor<
        object,
        GradumView<
            any,
            any,
            GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
        >,
        GradumModel<any, any, any, any, any>,
        GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
    >[]

    The interactors (if any) attached to the element's MVC structure.

    tools: GradumTool<
        object,
        GradumView<
            any,
            any,
            GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
        >,
        GradumModel<any, any, any, any, any>,
        GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
    >[]

    The tools (if any) attached to the element's MVC structure.

    constrainers: GradumConstrainer<
        object,
        GradumView<
            any,
            any,
            GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
        >,
        GradumModel<any, any, any, any, any>,
        GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
    >[]

    The constrainers (if any) attached to the element's MVC structure.

    unsetDefaultClasses: boolean

    Whether to set the default CSS classes defined in the static config on the element or not. Setting it will accordingly add/remove the CSS classes from the element.

    shadowDOM: boolean

    Whether the element renders its children into a shadow root. Assigning true attaches one if the element does not already have it.

    defaultClasses: string | string[]

    The CSS classes applied to every instance of this element class. Assigning a new value swaps the previous classes out for the new ones, unless unsetDefaultClasses is set.

    • get element(): ValidElement<ElementTag>

      Returns ValidElement<ElementTag>

      The HTML (or other) element wrapped inside this instance.

    • Function

      create

      Type Parameters

      • This extends { prototype: GradumProxiedElement }
      • ElementTag extends
            | "symbol"
            | "animate"
            | "animateMotion"
            | "animateTransform"
            | "circle"
            | "clipPath"
            | "defs"
            | "desc"
            | "ellipse"
            | "feBlend"
            | "feColorMatrix"
            | "feComponentTransfer"
            | "feComposite"
            | "feConvolveMatrix"
            | "feDiffuseLighting"
            | "feDisplacementMap"
            | "feDistantLight"
            | "feDropShadow"
            | "feFlood"
            | "feFuncA"
            | "feFuncB"
            | "feFuncG"
            | "feFuncR"
            | "feGaussianBlur"
            | "feImage"
            | "feMerge"
            | "feMergeNode"
            | "feMorphology"
            | "feOffset"
            | "fePointLight"
            | "feSpecularLighting"
            | "feSpotLight"
            | "feTile"
            | "feTurbulence"
            | "filter"
            | "foreignObject"
            | "g"
            | "image"
            | "line"
            | "linearGradient"
            | "marker"
            | "mask"
            | "metadata"
            | "mpath"
            | "path"
            | "pattern"
            | "polygon"
            | "polyline"
            | "radialGradient"
            | "rect"
            | "set"
            | "stop"
            | "svg"
            | "switch"
            | "text"
            | "textPath"
            | "tspan"
            | "use"
            | "view"
            | (keyof HTMLElementTagNameMap)
            | (keyof MathMLElementTagNameMap)
            | (keyof GradumElementTagNameMap) =
            | "symbol"
            | "animate"
            | "animateMotion"
            | "animateTransform"
            | "circle"
            | "clipPath"
            | "defs"
            | "desc"
            | "ellipse"
            | "feBlend"
            | "feColorMatrix"
            | "feComponentTransfer"
            | "feComposite"
            | "feConvolveMatrix"
            | "feDiffuseLighting"
            | "feDisplacementMap"
            | "feDistantLight"
            | "feDropShadow"
            | "feFlood"
            | "feFuncA"
            | "feFuncB"
            | "feFuncG"
            | "feFuncR"
            | "feGaussianBlur"
            | "feImage"
            | "feMerge"
            | "feMergeNode"
            | "feMorphology"
            | "feOffset"
            | "fePointLight"
            | "feSpecularLighting"
            | "feSpotLight"
            | "feTile"
            | "feTurbulence"
            | "filter"
            | "foreignObject"
            | "g"
            | "image"
            | "line"
            | "linearGradient"
            | "marker"
            | "mask"
            | "metadata"
            | "mpath"
            | "path"
            | "pattern"
            | "polygon"
            | "polyline"
            | "radialGradient"
            | "rect"
            | "set"
            | "stop"
            | "svg"
            | "switch"
            | "text"
            | "textPath"
            | "tspan"
            | "use"
            | "view"
            | (keyof HTMLElementTagNameMap)
            | (keyof MathMLElementTagNameMap)
            | (keyof GradumElementTagNameMap)
      • ViewType extends GradumView<
            object,
            GradumModel<any, any, any, any, any>,
            GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
        > = GradumView<
            any,
            any,
            GradumEmitter<GradumModel<any, any, any, any, any>, KeyType>,
        >
      • DataType extends object = object
      • ModelType extends GradumModel<any, any, any, any, any> = GradumModel<any, any, any, any, any>
      • EmitterType extends GradumEmitter<GradumModel<any, any, any, any, any>, KeyType> = GradumEmitter<any, KeyType>

      Parameters

      Returns This["prototype"] & GradumProxiedElement<
          ElementTag,
          ViewType,
          DataType,
          ModelType,
          EmitterType,
      >

      The created instance.

      Instantiate this class with the given properties. Defaults declared by every class in the inheritance chain are applied first, nearest ancestor last, so a subclass' defaultProperties win over its parent's. The return type follows the class it is called on, so a subclass gets its own type back.

    • Protected Function

      Parameters

      • properties: object

        Properties to set on the new instance, defaults already merged in.

      Returns object

      The created instance.

      customCreate

      The construction step behind create. Override it to change how instances of a class are built — to route through a factory, or to wrap the instance — while keeping the default-merging that create performs.

    • Protected Function

      setupChangedCallbacks

      Returns void

      Setup method intended to initialize change listeners and callbacks. Called on initialize().

    • Protected Function

      setupUIElements

      Returns void

      Setup method intended to initialize all direct sub-elements attached to this element, and store them in fields. Called on initialize().

    • Protected Function

      setupUILayout

      Returns void

      Setup method to create the layout structure of the element by adding all created sub-elements to this element's child tree. Called on initialize().

    • Protected Function

      setupUIListeners

      Returns void

      Setup method to initialize and define all input/DOM event listeners of the element. Called on initialize().

    • Function

      destroy

      Returns this

      Itself, allowing for method chaining.

      Destroys the node by removing it from the document and removing all its bound listeners.

    • Function

      initialize

      Returns void

      Initializes the element. It sets up the UI by calling the methods setupUIElements, setupUILayout, setupUIListeners, and setupChangedCallbacks (in this order, if they are defined). This function is called automatically in .setProperties() and when instantiating an element via element(). It is called only once per element (as it checks with the reflected initialized flag).

    • Function

      feedforward

      Parameters

      • Optionalproperties: FeedforwardProperties

        Properties to feed forward. Defaults to defaultFeedforwardProperties.

      Returns this

      Itself, allowing for method chaining.

      Push this element's feedforward properties down to its children, so newly added descendants pick up the same defaults.

    • Function

      clone

      Parameters

      Returns this

      The cloned element.

      Create a copy of this element. By default the copy carries the same properties and children but none of the bound listeners.