Palette
    Preparing search index...

    Class Template

    A renderable template from an HTMLTemplateElement

    Leverages a simple syntax to provide accessors to template data from one of four categories, based on use case:

    `@` -> The `attr` namespace (the host element's attributes)
    `$` -> The `state` namespace (the host element's reactive state)
    `*` -> The `data` namespace (the host element's computed data)
    `#` -> The `item` namespace (list item access with ::each)

    Bind attributes to a value using the :attribute syntax:

    <div :id="$id" :class="@classname"></div>
    
    Index

    Constructors

    Properties

    Methods

    Constructors

    • Parameters

      • template: HTMLTemplateElement

      Returns Template

    Properties

    cache: { clear: () => void; setCapacity: (maxSize: number) => void } = ...

    Properties related to the global Template build cache.

    This is not something typically needed for general app development, but allows for advanced configuration to tune the caching system if need be.

    Cache sizes default to 500 HTML Template Fragments and compiled Palette templates (includes nested templates like lists) to cover most application needs without using much memory.

    Type Declaration

    • clear: () => void

      Wipe all cached templates and HTML fragments

    • setCapacity: (maxSize: number) => void

      the default cache capacity of 500 items per cache

      General caching guidance:

      • 95% of the time, 500 works fine
      • For very large applications, up to 1000 is reasonable
      • For smaller apps, dropping down to 100 - 250 may save memory

      Ultimately the impact will be minimal unless your app has very specific rendering needs.

    Methods

    • Create a full copy of this template for use in rendering to another root

      Returns Template

    • Returns HTMLTemplateElement

      An HTMLTemplateElement representing this template

    • Render this template into a target host element.

      Parameters

      Returns void

      If no context is provided, the root element is used as the context, which allows for accessing nested properties of the host element itself.