snabbdom
- Version 3.6.2
- Published
- 130 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
Functions
Interfaces
Type Aliases
Namespaces
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<Props>): VNode; (sel: string, children: VNodeChildren): VNode; (sel: string, data: VNodeData<Props>, children: VNodeChildren): VNode;};
function init
init: ( modules: Array<Partial<Module>>, domApi?: DOMAPI, options?: Options) => (oldVnode: VNode | Element | DocumentFragment, vnode: VNode) => VNode;
function jsx
jsx: ( tag: string | FunctionComponent, data: VNodeData | null, ...children: JsxVNodeChildren[]) => VNode;
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?: () => SnabbdomFragment;
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 ThunkData
interface ThunkData extends VNodeData {}
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 {}
interface VNodeData
interface VNodeData<VNodeProps = Props> {}
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?: VNodeProps;
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 Options
type Options = { experimental?: { fragments?: boolean; };};
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 = ElementStyle & Record<string, string> & { delayed?: ElementStyle & Record<string, string>; remove?: ElementStyle & Record<string, string>; };
Namespaces
namespace jsx
namespace jsx {}
interface IntrinsicElements
interface IntrinsicElements extends HtmlElements {}
index signature
[elemName: string]: VNodeData;
type Element
type Element = VNode;
type ElementProperties
type ElementProperties<T> = { [Property in WritableKeys<T> as T[Property] extends | string | number | null | undefined ? Property : never]?: T[Property];};
type HtmlElements
type HtmlElements = { [Property in keyof HTMLElementTagNameMap]: VNodeData< VNodeProps<HTMLElementTagNameMap[Property]> >;};
type IfEquals
type IfEquals<X, Y, Output> = (<T>() => T extends X ? 1 : 2) extends < T>() => T extends Y ? 1 : 2 ? Output : never;
type VNodeProps
type VNodeProps<T> = ElementProperties<T> & Props;
type WritableKeys
type WritableKeys<T> = { [P in keyof T]-?: IfEquals< { [Q in P]: T[P]; }, { -readonly [Q in P]: T[P]; }, P >;}[keyof T];
Package Files (18)
- build/h.d.ts
- build/helpers/attachto.d.ts
- build/hooks.d.ts
- build/htmldomapi.d.ts
- build/index.d.ts
- build/init.d.ts
- build/is.d.ts
- build/jsx.d.ts
- build/modules/attributes.d.ts
- build/modules/class.d.ts
- build/modules/dataset.d.ts
- build/modules/eventlisteners.d.ts
- build/modules/module.d.ts
- build/modules/props.d.ts
- build/modules/style.d.ts
- build/thunk.d.ts
- build/tovnode.d.ts
- build/vnode.d.ts
Dependencies (0)
No dependencies.
Dev Dependencies (25)
- @esm-bundle/chai
- @release-it/conventional-changelog
- @types/chai
- @types/mocha
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- @web/dev-server-esbuild
- @web/test-runner
- @web/test-runner-browserstack
- commithelper
- conventional-changelog-angular
- eslint
- eslint-config-prettier
- eslint-plugin-import
- eslint-plugin-markdown
- eslint-plugin-node
- husky
- lint-staged
- mocha
- prettier
- release-it
- replace-in-file
- serve
- ts-add-js-extension
- typescript
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto 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>
- Updated .
Package analyzed in 4521 ms. - Missing or incorrect documentation? Open an issue for this package.