Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "index"

Index

Variables

Functions

Object literals

Variables

Const FN

FN: "function" = "function"

Const STR

STR: "string" = "string"

Functions

Const createTree

  • createTree(_: Partial<HDOMOpts>, canvas: HTMLCanvasElement, tree: any): void

Const diffTree

  • diffTree(opts: Partial<HDOMOpts>, parent: HTMLCanvasElement, prev: any[], curr: any[], child: number): void
  • internal

    Parameters

    • opts: Partial<HDOMOpts>
    • parent: HTMLCanvasElement
    • prev: any[]
    • curr: any[]
    • child: number

    Returns void

Const normalizeTree

  • normalizeTree(opts: Partial<HDOMOpts>, tree: any): any

Object literals

Const IMPL

IMPL: object

createElement

createElement: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

createTextElement

createTextElement: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

createTree

createTree: createTree

diffTree

diffTree: diffTree

getChild

getChild: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

getElementById

getElementById: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

hydrateTree

hydrateTree: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

normalizeTree

normalizeTree: normalizeTree

removeAttribs

removeAttribs: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

removeChild

removeChild: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

replaceChild

replaceChild: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

setAttrib

setAttrib: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

setContent

setContent: () => void = NO_OP

Type declaration

    • (): void
    • Returns void

Const canvas

canvas: object

Special HTML5 canvas component which injects a branch-local hdom implementation for virtual SVG-like shape components / elements. These elements are then translated into canvas draw commands during the hdom update process.

The canvas component automatically adjusts its size for HDPI displays by adding CSS width & height properties and pre-scaling the drawing context accordingly before shapes are processed.

Shape components are expressed in standard hiccup syntax, however with the following restrictions:

  • Shape component objects with life cycle methods are only partially supported, i.e. only the {@link @thi.ng/hdom#ILifecycle.render} & {@link @thi.ng/hdom#ILifecycle.release} methods are used (Note, for performance reasons release methods are ignored by default. If your shape tree contains stateful components which use the release life cycle method, you'll need to explicitly enable the canvas component's __release attribute by setting it to true).
  • Currently no event listeners can be assigned to shapes (ignored), though this is planned for a future version. The canvas element itself can of course have event handlers as usual.

All embedded component functions receive the user context object just like normal hdom components.

For best performance, it's recommended to ensure all resulting shapes elements are provided in already normalized hiccup format (i.e. [tag, {attribs}, ...]). That way the __normalize: false control attribute can be added either to the canvas component itself (or to individual shapes / groups), and if present, will skip normalization of all children.

param

hdom user context (ignored)

param

canvas attribs

param

shape components

render

  • render(_: any, attribs: any, ...body: any[]): any[]

Generated using TypeDoc