## Index

### Functions

- addAttributes
- addKeys
- addToData
- applyDefaults
- findParent
- getArea
- getBodyStyle
- getGhostStyle
- getIndex
- getIntersection
- getParentNode
- removeAttribute
- replaceNode
- updateGhostStyle

## Functions

### addAttributes

- addAttributes(e: VNode, newAttr: object): VNode

- - Defined in src/helpers.ts:156

  Adds the given attribute savely to the VNode

  #### Parameters

  - ##### e: VNode

  - ##### newAttr: object

    - ##### [attr: string]: any

  #### Returns VNode

  the newly created VNode

### addKeys

- addKeys(node: VNode, key?: string): VNode

- - Defined in src/helpers.ts:34

  Adds keys to the VNodes to make them able to swap

  #### Parameters

  - ##### node: VNode

    the root VNode

  - ##### Default value key: string = Math.random().toString()

  #### Returns VNode

  a new VNode with the keys

### addToData

- addToData(node: VNode, additions: object): VNode

- - Defined in src/helpers.ts:187

  Adds the given additions savely to the VNode

  #### Parameters

  - ##### node: VNode

    the VNode to add the additions on

  - ##### additions: object

    - ##### [key: string]: any

  #### Returns VNode

  the newly created VNode

### applyDefaults

- applyDefaults(options: SortableOptions, root: VNode): SortableOptions

- - Defined in src/helpers.ts:12

  Takes the maybe undefined options and fills them with defaults

  #### Parameters

  - ##### options: SortableOptions

    the options, can be undefined

  - ##### root: VNode

  #### Returns SortableOptions

  the non-null options filled with default

### findParent

- findParent(node: Element, selector: string): Element

- - Defined in src/helpers.ts:139

  Finds the parent element that matches the given selector

  #### Parameters

  - ##### node: Element

    the current element

  - ##### selector: string

    a valid CSS selector

  #### Returns Element

  the searched parent or undefined if not found

### getArea

- getArea(intersection: Intersection): number

- - Defined in src/helpers.ts:223

  Calculates the area of the given rectangle

  #### Parameters

  - ##### intersection: Intersection

  #### Returns number

### getBodyStyle

- getBodyStyle(): string

- - Defined in src/helpers.ts:127

  Prevents the page from randomly selecting text when dragging

  #### Returns string

  the content of the style attribute

### getGhostStyle

- getGhostStyle(event: MouseEvent, mouseOffset: MouseOffset, item: Element): string

- - Defined in src/helpers.ts:102

  Gets the correct style attribute value for the given parameters

  #### Parameters

  - ##### event: MouseEvent

    the mouse event that was triggered

  - ##### mouseOffset: MouseOffset

    the offset of the item

  - ##### item: Element

  #### Returns string

  the style value

### getIndex

- getIndex(node: any): number

- - Defined in src/helpers.ts:90

  Returns the index of the element in the parent's children array

  #### Parameters

  - ##### node: any

  #### Returns number

  the index

### getIntersection

- getIntersection(e1: Element, e2: Element): Intersection

- - Defined in src/helpers.ts:205

  Calculates the intersection of two elements

  #### Parameters

  - ##### e1: Element

    the first element

  - ##### e2: Element

    the first element

  #### Returns Intersection

  the intersection or undefined if there is no intersecton

### getParentNode

- getParentNode(root: VNode, selector: string): VNode

- - Defined in src/helpers.ts:52

  Returns a parent VNode that has a children matching the selector. Currently only works with simple class selector

  #### Parameters

  - ##### root: VNode

    the parent VNode

  - ##### selector: string

    a valid CSS selector

  #### Returns VNode

  The searched parent node or undefined if none was found

### removeAttribute

- removeAttribute(node: VNode, attributeName: string): VNode

- - Defined in src/helpers.ts:168

  Removes the given attribute from the VNode

  #### Parameters

  - ##### node: VNode

    the VNode

  - ##### attributeName: string

    the name of the attribute

  #### Returns VNode

  a new VNode without the attribute

### replaceNode

- replaceNode(root: VNode, selector: string, replacement: VNode): VNode

- - Defined in src/helpers.ts:73

  Replaces the node matching the selector with the replacement

  #### Parameters

  - ##### root: VNode

    the root VNode

  - ##### selector: string

    a valid CSS selector for the replacement

  - ##### replacement: VNode

    the new VNode

  #### Returns VNode

  a new root VNode with the replacement applied

### updateGhostStyle

- updateGhostStyle(event: MouseEvent, mouseOffset: MouseOffset, ghost: Element): string

- - Defined in src/helpers.ts:114

  Returns the updated style for this ghost element

  #### Parameters

  - ##### event: MouseEvent

  - ##### mouseOffset: MouseOffset

  - ##### ghost: Element

  #### Returns string

Generated using TypeDoc