snabbdom

  • Version 3.3.1
  • Published
  • 386 kB
  • No dependencies
  • MIT license

Install

npm i snabbdom
yarn add snabbdom
pnpm add snabbdom

Overview

A virtual DOM library with focus on simplicity, modularity, powerful features and performance.

Index

Variables

variable attributesModule

const attributesModule: Partial<{
pre: PreHook;
create: CreateHook;
update: UpdateHook;
destroy: DestroyHook;
remove: RemoveHook;
post: PostHook;
}>;

    variable classModule

    const classModule: Partial<{
    pre: PreHook;
    create: CreateHook;
    update: UpdateHook;
    destroy: DestroyHook;
    remove: RemoveHook;
    post: PostHook;
    }>;

      variable datasetModule

      const datasetModule: Partial<{
      pre: PreHook;
      create: CreateHook;
      update: UpdateHook;
      destroy: DestroyHook;
      remove: RemoveHook;
      post: PostHook;
      }>;

        variable eventListenersModule

        const eventListenersModule: Partial<{
        pre: PreHook;
        create: CreateHook;
        update: UpdateHook;
        destroy: DestroyHook;
        remove: RemoveHook;
        post: PostHook;
        }>;

          variable htmlDomApi

          const htmlDomApi: DOMAPI;

            variable propsModule

            const propsModule: Partial<{
            pre: PreHook;
            create: CreateHook;
            update: UpdateHook;
            destroy: DestroyHook;
            remove: RemoveHook;
            post: PostHook;
            }>;

              variable styleModule

              const styleModule: Partial<{
              pre: PreHook;
              create: CreateHook;
              update: UpdateHook;
              destroy: DestroyHook;
              remove: RemoveHook;
              post: PostHook;
              }>;

                variable thunk

                const thunk: ThunkFn;

                  Functions

                  function array

                  array: (arg: any) => arg is any[];

                    function attachTo

                    attachTo: (target: Element, vnode: VNode) => VNode;

                      function fragment

                      fragment: (children: VNodeChildren) => VNode;
                      • Modifiers

                        • @experimental

                      function Fragment

                      Fragment: (data: { key?: Key } | null, ...children: JsxVNodeChildren[]) => VNode;

                        function h

                        h: {
                        (sel: string): VNode;
                        (sel: string, data: VNodeData): VNode;
                        (sel: string, children: VNodeChildren): VNode;
                        (sel: string, data: VNodeData, children: VNodeChildren): VNode;
                        };

                          function init

                          init: (
                          modules: Array<Partial<Module>>,
                          domApi?: DOMAPI,
                          options?: Options
                          ) => (oldVnode: VNode | Element | DocumentFragment, vnode: VNode) => VNode;

                            function jsx

                            jsx: typeof jsx;
                            • jsx/tsx compatible factory function see: https://www.typescriptlang.org/docs/handbook/jsx.html#factory-functions

                            function primitive

                            primitive: (s: any) => s is string | number;

                              function toVNode

                              toVNode: (node: Node, domApi?: DOMAPI) => VNode;

                                function vnode

                                vnode: (
                                sel: string | undefined,
                                data: any | undefined,
                                children: Array<VNode | string> | undefined,
                                text: string | undefined,
                                elm: Element | DocumentFragment | Text | undefined
                                ) => VNode;

                                  Interfaces

                                  interface AttachData

                                  interface AttachData {}

                                    property placeholder

                                    placeholder?: any;

                                      property real

                                      real?: Node;

                                        index signature

                                        [key: string]: any;

                                          index signature

                                          [i: number]: any;

                                            interface DOMAPI

                                            interface DOMAPI {}

                                              property appendChild

                                              appendChild: (node: Node, child: Node) => void;

                                                property createComment

                                                createComment: (text: string) => Comment;

                                                  property createDocumentFragment

                                                  createDocumentFragment?: () => DocumentFragment;
                                                  • Make it required when the fragment is considered stable.

                                                    Modifiers

                                                    • @experimental

                                                  property createElement

                                                  createElement: (tagName: any, options?: ElementCreationOptions) => HTMLElement;

                                                    property createElementNS

                                                    createElementNS: (
                                                    namespaceURI: string,
                                                    qualifiedName: string,
                                                    options?: ElementCreationOptions
                                                    ) => Element;

                                                      property createTextNode

                                                      createTextNode: (text: string) => Text;

                                                        property getTextContent

                                                        getTextContent: (node: Node) => string | null;

                                                          property insertBefore

                                                          insertBefore: (
                                                          parentNode: Node,
                                                          newNode: Node,
                                                          referenceNode: Node | null
                                                          ) => void;

                                                            property isComment

                                                            isComment: (node: Node) => node is Comment;

                                                              property isDocumentFragment

                                                              isDocumentFragment?: (node: Node) => node is DocumentFragment;
                                                              • Make it required when the fragment is considered stable.

                                                                Modifiers

                                                                • @experimental

                                                              property isElement

                                                              isElement: (node: Node) => node is Element;

                                                                property isText

                                                                isText: (node: Node) => node is Text;

                                                                  property nextSibling

                                                                  nextSibling: (node: Node) => Node | null;

                                                                    property parentNode

                                                                    parentNode: (node: Node) => Node | null;

                                                                      property removeChild

                                                                      removeChild: (node: Node, child: Node) => void;

                                                                        property setTextContent

                                                                        setTextContent: (node: Node, text: string | null) => void;

                                                                          property tagName

                                                                          tagName: (elm: Element) => string;

                                                                            interface Hooks

                                                                            interface Hooks {}

                                                                              property create

                                                                              create?: CreateHook;

                                                                                property destroy

                                                                                destroy?: DestroyHook;

                                                                                  property init

                                                                                  init?: InitHook;

                                                                                    property insert

                                                                                    insert?: InsertHook;

                                                                                      property post

                                                                                      post?: PostHook;

                                                                                        property postpatch

                                                                                        postpatch?: PostPatchHook;

                                                                                          property pre

                                                                                          pre?: PreHook;

                                                                                            property prepatch

                                                                                            prepatch?: PrePatchHook;

                                                                                              property remove

                                                                                              remove?: RemoveHook;

                                                                                                property update

                                                                                                update?: UpdateHook;

                                                                                                  interface Thunk

                                                                                                  interface Thunk extends VNode {}

                                                                                                    property data

                                                                                                    data: ThunkData;

                                                                                                      interface ThunkData

                                                                                                      interface ThunkData extends VNodeData {}

                                                                                                        property args

                                                                                                        args: any[];

                                                                                                          property fn

                                                                                                          fn: () => VNode;

                                                                                                            interface ThunkFn

                                                                                                            interface ThunkFn {}

                                                                                                              call signature

                                                                                                              (sel: string, fn: (...args: any[]) => any, args: any[]): Thunk;

                                                                                                                call signature

                                                                                                                (sel: string, key: any, fn: (...args: any[]) => any, args: any[]): Thunk;

                                                                                                                  interface VNode

                                                                                                                  interface VNode {}

                                                                                                                    property children

                                                                                                                    children: Array<VNode | string> | undefined;

                                                                                                                      property data

                                                                                                                      data: VNodeData | undefined;

                                                                                                                        property elm

                                                                                                                        elm: Node | undefined;

                                                                                                                          property key

                                                                                                                          key: Key | undefined;

                                                                                                                            property sel

                                                                                                                            sel: string | undefined;

                                                                                                                              property text

                                                                                                                              text: string | undefined;

                                                                                                                                interface VNodeData

                                                                                                                                interface VNodeData {}

                                                                                                                                  property args

                                                                                                                                  args?: any[];

                                                                                                                                    property attachData

                                                                                                                                    attachData?: AttachData;

                                                                                                                                      property attrs

                                                                                                                                      attrs?: Attrs;

                                                                                                                                        property class

                                                                                                                                        class?: Classes;

                                                                                                                                          property dataset

                                                                                                                                          dataset?: Dataset;

                                                                                                                                            property fn

                                                                                                                                            fn?: () => VNode;

                                                                                                                                              property hook

                                                                                                                                              hook?: Hooks;

                                                                                                                                                property is

                                                                                                                                                is?: string;

                                                                                                                                                  property key

                                                                                                                                                  key?: Key;

                                                                                                                                                    property ns

                                                                                                                                                    ns?: string;

                                                                                                                                                      property on

                                                                                                                                                      on?: On;

                                                                                                                                                        property props

                                                                                                                                                        props?: Props;

                                                                                                                                                          property style

                                                                                                                                                          style?: VNodeStyle;

                                                                                                                                                            index signature

                                                                                                                                                            [key: string]: any;

                                                                                                                                                              Type Aliases

                                                                                                                                                              type ArrayOrElement

                                                                                                                                                              type ArrayOrElement<T> = T | T[];

                                                                                                                                                                type Attrs

                                                                                                                                                                type Attrs = Record<string, string | number | boolean>;

                                                                                                                                                                  type Classes

                                                                                                                                                                  type Classes = Record<string, boolean>;

                                                                                                                                                                    type CreateHook

                                                                                                                                                                    type CreateHook = (emptyVNode: VNode, vNode: VNode) => any;

                                                                                                                                                                      type Dataset

                                                                                                                                                                      type Dataset = Record<string, string>;

                                                                                                                                                                        type DestroyHook

                                                                                                                                                                        type DestroyHook = (vNode: VNode) => any;

                                                                                                                                                                          type FunctionComponent

                                                                                                                                                                          type FunctionComponent = (
                                                                                                                                                                          props: {
                                                                                                                                                                          [prop: string]: any;
                                                                                                                                                                          } | null,
                                                                                                                                                                          children?: VNode[]
                                                                                                                                                                          ) => VNode;

                                                                                                                                                                            type InitHook

                                                                                                                                                                            type InitHook = (vNode: VNode) => any;

                                                                                                                                                                              type InsertHook

                                                                                                                                                                              type InsertHook = (vNode: VNode) => any;

                                                                                                                                                                                type JsxVNodeChild

                                                                                                                                                                                type JsxVNodeChild = VNode | string | number | boolean | undefined | null;

                                                                                                                                                                                  type JsxVNodeChildren

                                                                                                                                                                                  type JsxVNodeChildren = ArrayOrElement<JsxVNodeChild>;

                                                                                                                                                                                    type Key

                                                                                                                                                                                    type Key = string | number | symbol;

                                                                                                                                                                                      type Module

                                                                                                                                                                                      type Module = Partial<{
                                                                                                                                                                                      pre: PreHook;
                                                                                                                                                                                      create: CreateHook;
                                                                                                                                                                                      update: UpdateHook;
                                                                                                                                                                                      destroy: DestroyHook;
                                                                                                                                                                                      remove: RemoveHook;
                                                                                                                                                                                      post: PostHook;
                                                                                                                                                                                      }>;

                                                                                                                                                                                        type On

                                                                                                                                                                                        type On = {
                                                                                                                                                                                        [N in keyof HTMLElementEventMap]?:
                                                                                                                                                                                        | Listener<HTMLElementEventMap[N]>
                                                                                                                                                                                        | Array<Listener<HTMLElementEventMap[N]>>;
                                                                                                                                                                                        } & {
                                                                                                                                                                                        [event: string]: Listener<any> | Array<Listener<any>>;
                                                                                                                                                                                        };

                                                                                                                                                                                          type PostHook

                                                                                                                                                                                          type PostHook = () => any;

                                                                                                                                                                                            type PostPatchHook

                                                                                                                                                                                            type PostPatchHook = (oldVNode: VNode, vNode: VNode) => any;

                                                                                                                                                                                              type PreHook

                                                                                                                                                                                              type PreHook = () => any;

                                                                                                                                                                                                type PrePatchHook

                                                                                                                                                                                                type PrePatchHook = (oldVNode: VNode, vNode: VNode) => any;

                                                                                                                                                                                                  type Props

                                                                                                                                                                                                  type Props = Record<string, any>;

                                                                                                                                                                                                    type RemoveHook

                                                                                                                                                                                                    type RemoveHook = (vNode: VNode, removeCallback: () => void) => any;

                                                                                                                                                                                                      type UpdateHook

                                                                                                                                                                                                      type UpdateHook = (oldVNode: VNode, vNode: VNode) => any;

                                                                                                                                                                                                        type VNodeChildElement

                                                                                                                                                                                                        type VNodeChildElement =
                                                                                                                                                                                                        | VNode
                                                                                                                                                                                                        | string
                                                                                                                                                                                                        | number
                                                                                                                                                                                                        | String
                                                                                                                                                                                                        | Number
                                                                                                                                                                                                        | undefined
                                                                                                                                                                                                        | null;

                                                                                                                                                                                                          type VNodeChildren

                                                                                                                                                                                                          type VNodeChildren = ArrayOrElement<VNodeChildElement>;

                                                                                                                                                                                                            type VNodes

                                                                                                                                                                                                            type VNodes = VNode[];

                                                                                                                                                                                                              type VNodeStyle

                                                                                                                                                                                                              type VNodeStyle = Record<string, string> & {
                                                                                                                                                                                                              delayed?: Record<string, string>;
                                                                                                                                                                                                              remove?: Record<string, string>;
                                                                                                                                                                                                              };

                                                                                                                                                                                                                Namespaces

                                                                                                                                                                                                                namespace jsx

                                                                                                                                                                                                                namespace jsx {}

                                                                                                                                                                                                                  Package Files (18)

                                                                                                                                                                                                                  Dependencies (0)

                                                                                                                                                                                                                  No dependencies.

                                                                                                                                                                                                                  Dev Dependencies (31)

                                                                                                                                                                                                                  Peer Dependencies (0)

                                                                                                                                                                                                                  No peer dependencies.

                                                                                                                                                                                                                  Badge

                                                                                                                                                                                                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/snabbdom.

                                                                                                                                                                                                                  • Markdown
                                                                                                                                                                                                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/snabbdom)
                                                                                                                                                                                                                  • HTML
                                                                                                                                                                                                                    <a href="https://www.jsdocs.io/package/snabbdom"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>