Options
All
  • Public
  • Public/Protected
  • All
Menu

Module nexwidget

Index

Type aliases

AddPendingTaskEvent: CustomEvent<AddPendingTaskEventDetails>
AddPendingTaskEventDetails: { task: Promise<unknown> }

Type declaration

  • task: Promise<unknown>
Constructor<T>: new (...args: any[]) => T

Type parameters

  • T = {}

Type declaration

    • new (...args: any[]): T
    • Parameters

      • Rest ...args: any[]

      Returns T

HTMLTemplateResult: TemplateResult<typeof HTML_RESULT>
SVGTemplateResult: TemplateResult<typeof SVG_RESULT>
SanitizerFactory: (node: Node, name: string, type: "property" | "attribute") => ValueSanitizer

Type declaration

    • (node: Node, name: string, type: "property" | "attribute"): ValueSanitizer
    • Used to sanitize any value before it is written into the DOM. This can be used to implement a security policy of allowed and disallowed values in order to prevent XSS attacks.

      One way of using this callback would be to check attributes and properties against a list of high risk fields, and require that values written to such fields be instances of a class which is safe by construction. Closure's Safe HTML Types is one implementation of this technique ( https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md). The TrustedTypes polyfill in API-only mode could also be used as a basis for this technique (https://github.com/WICG/trusted-types).

      Parameters

      • node: Node

        The HTML node (usually either a #text node or an Element) that is being written to. Note that this is just an exemplar node, the write may take place against another instance of the same class of node.

      • name: string

        The name of an attribute or property (for example, 'href').

      • type: "property" | "attribute"

        Indicates whether the write that's about to be performed will be to a property or a node.

      Returns ValueSanitizer

      A function that will sanitize this class of writes.

TemplateResult<T>: { _$litType$: T; strings: TemplateStringsArray; values: unknown[] }

The return type of the template tag functions.

Type parameters

  • T: ResultType = ResultType

Type declaration

  • _$litType$: T
  • strings: TemplateStringsArray
  • values: unknown[]
ValueSanitizer: (value: unknown) => unknown

Type declaration

    • (value: unknown): unknown
    • A function which can sanitize values that will be written to a specific kind of DOM sink.

      See SanitizerFactory.

      Parameters

      • value: unknown

        The value to sanitize. Will be the actual value passed into the lit-html template literal, so this could be of any type.

      Returns unknown

      The value to write to the DOM. Usually the same as the input value, unless sanitization is needed.

WidgetAnimation: { keyframes: Keyframe[]; options?: KeyframeAnimationOptions } | null
WidgetAttributeType: "string" | "number" | "boolean"
WidgetAttributes<T>: { key: keyof T["prototype"] & string; type: WidgetAttributeType }[]

Type parameters

WidgetReactives<T>: (keyof T["prototype"] & string)[]

Type parameters

WidgetTemplate: TemplateResult | string | number | typeof nothing | typeof noChange

Variables

noChange: unique symbol

A sentinel value that signals that a value was handled by a directive and should not be written to the DOM.

nothing: unique symbol

A sentinel value that signals a ChildPart to fully clear its content.

const button = html`${
user.isAdmin
? html`<button>DELETE</button>`
: nothing
}`;

Prefer using nothing over other falsy values as it provides a consistent behavior between various expression binding contexts.

In child expressions, undefined, null, '', and nothing all behave the same and render no nodes. In attribute expressions, nothing removes the attribute, while undefined and null will render an empty string. In property expressions nothing becomes undefined.

render: { createSanitizer: SanitizerFactory; _testOnlyClearSanitizerFactoryDoNotCallOrElse: any; setSanitizer: any }

Type declaration

    • Renders a value, usually a lit-html TemplateResult, to the container.

      Parameters

      • value: unknown
      • container: HTMLElement | DocumentFragment
      • Optional options: RenderOptions

      Returns RootPart

  • createSanitizer: SanitizerFactory
  • _testOnlyClearSanitizerFactoryDoNotCallOrElse:function
    • _testOnlyClearSanitizerFactoryDoNotCallOrElse(): void
    • Returns void

  • setSanitizer:function
    • Parameters

      Returns void

Functions

  • addPendingTask<T>(emitter: EventTarget, task: Promise<T>): Promise<T>
  • css(strings: TemplateStringsArray): CSSStyleSheet
  • html(strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<1>
  • Interprets a template literal as an HTML template that can efficiently render to and update a container.

    const header = (title: string) => html`<h1>${title}</h1>`;
    

    The html tag returns a description of the DOM to render as a value. It is lazy, meaning no work is done until the template is rendered. When rendering, if a template comes from the same expression as a previously rendered result, it's efficiently updated instead of replaced.

    Parameters

    • strings: TemplateStringsArray
    • Rest ...values: unknown[]

    Returns TemplateResult<1>

  • svg(strings: TemplateStringsArray, ...values: unknown[]): TemplateResult<2>
  • Interprets a template literal as an SVG template that can efficiently render to and update a container.

    Parameters

    • strings: TemplateStringsArray
    • Rest ...values: unknown[]

    Returns TemplateResult<2>

Generated using TypeDoc