diff --git a/dist/composi.js.map b/dist/composi.js.map
index f74a323..77f2c0c 100644
--- a/dist/composi.js.map
+++ b/dist/composi.js.map
@@ -1 +1 @@
-{"version":3,"file":"composi.js","sources":["../lib/utils/patchElementHelpers/getKey.js","../lib/utils/mixin.js","../lib/utils/setProp.js","../lib/utils/setPropHelpers/handleXlinkHref.js","../lib/utils/setPropHelpers/handleDangerouslySetInnerHTML.js","../lib/utils/setPropHelpers/handleClassName.js","../lib/utils/setPropHelpers/handleStyles.js","../lib/utils/patchElementHelpers/removeElement.js","../lib/utils/patchElementHelpers/removeChildren.js","../lib/utils/patchElementHelpers/createNewElement.js","../lib/utils/patchElementHelpers/createElement.js","../lib/utils/patchElement.js","../lib/utils/patchElementHelpers/updateElement.js","../lib/utils/patchElementHelpers/trackOldElements.js","../lib/utils/patchElementHelpers/removeOldChild.js","../lib/utils/patchElementHelpers/removeOldKeyedElements.js","../lib/patch.js","../lib/utils/rAF.js","../lib/utils/componentHelpers/isObject.js","../lib/utils/componentHelpers/updateComponent.js","../lib/utils/componentHelpers/isSameNode.js","../lib/utils/componentHelpers/eventWhitelist.js","../lib/component.js","../lib/utils/componentHelpers/handleSetState.js","../lib/utils/componentHelpers/unmountComponent.js","../lib/h.js","../lib/mount.js","../lib/utils/fragmentError.js","../lib/render.js","../lib/fragment.js"],"sourcesContent":["/**\n * @description Function to get a node's key.\n * @param {Object} node A virtual node.\n * @returns {string | number | null} key.\n */\nexport const getKey = node => (node ? node.key : null)\n","/**\n * @description A function to merge two objects together. The properties of the second object will overwrite any matching properties in the first object.\n * @param {Object} obj1 The first object to merge.\n * @param {Object} obj2 The second object to merge.\n * @returns {Object} Returns a new object of the second object merged with the first.\n */\nexport function mixin(obj1, obj2) {\n const result = {}\n for (let i in obj1) {\n result[i] = obj1[i]\n }\n for (let i in obj2) {\n result[i] = obj2[i]\n }\n return result\n}\n","import { handleStyles } from './setPropHelpers/handleStyles'\nimport { handleClassName } from './setPropHelpers/handleClassName'\nimport { handleDangerouslySetInnerHTML } from './setPropHelpers/handleDangerouslySetInnerHTML'\nimport { handleXlinkHref } from './setPropHelpers/handleXlinkHref'\n\n/**\n * @description Function to set properties and attributes on element.\n * @param {HTMLElement} element The element to set props on.\n * @param {string} prop The property/attribute.\n * @param {string} value The value of the prop.\n * @param {string} oldValue The original value of the prop.\n * @param {boolean} isSVG Whether this is SVG or not\n * @returns {void} undefined\n */\nexport function setProp(element, prop, value, oldValue, isSVG) {\n // Do not add these as node attributes:\n if (\n prop === 'key' ||\n prop === 'onComponentDidMount' ||\n prop === 'onComponentDidUpdate' ||\n prop === 'onComponentWillUnmount'\n ) {\n return\n } else if (prop === 'style' && typeof value !== 'string') {\n handleStyles(element, prop, value, oldValue)\n } else {\n // Convert camel case props to lower case:\n prop = prop.toLowerCase()\n\n // Handle cases where 'className' is used:\n prop = handleClassName(prop)\n\n // Allow setting innerHTML:\n handleDangerouslySetInnerHTML(element, prop, value)\n\n if (prop in element && prop !== 'list' && !isSVG) {\n element[prop] = value == (null || 'no') ? '' : value\n } else if (\n value != null &&\n value !== 'null' &&\n value !== 'false' &&\n value !== 'no' &&\n value !== 'off'\n ) {\n // Support SVG 'xlink:href' property:\n if (prop === 'xlink-href') {\n handleXlinkHref(element, prop, value)\n } else {\n if (value === 'true') value = ''\n // Set prop as attribute, except dangerouslySetInnerHTML:\n if (prop !== 'dangerouslysetinnerhtml')\n element.setAttribute(prop, value)\n }\n }\n\n if (\n value == null ||\n value === 'null' ||\n value === 'undefined' ||\n value === 'false' ||\n value === 'no' ||\n value === 'off'\n ) {\n element.removeAttribute(prop)\n }\n }\n}\n","/**\n * @description Enable setting xlink href value for browser that only support SVG 1.0.\n * @param {HTMLElement} element\n * @param {string} prop\n * @param {string | number | boolean | any[] | Object} value\n * @returns {void} undefined\n */\nexport function handleXlinkHref(element, prop, value) {\n element.setAttributeNS('http://www.w3.org/1999/xlink', 'href', value)\n element.setAttribute('href', value)\n}\n","/**\n * @description Enable setting innerHTML as a prop.\n * @param {HTMLElement} element\n * @param {string} prop\n * @param {string | number | boolean | any[] | Object} value\n * @returns {void} undefined\n */\nexport function handleDangerouslySetInnerHTML(element, prop, value) {\n if (prop === 'dangerouslysetinnerhtml') {\n element.innerHTML = value\n }\n}\n","/**\n * @description Handle converting 'className' to 'class'.\n * @param {string} prop\n * @returns {string} string\n */\nexport function handleClassName(prop) {\n if (prop === 'classname') {\n prop = 'class'\n }\n return prop\n}\n","import { mixin } from '../mixin'\n\n/**\n * @description Handle styles defined as object literals.\n * @param {HTMLElement} element\n * @param {string} prop\n * @param {string | number | boolean | any[] | Object} value\n * @param {string | number | boolean | any[] | Object} oldValue\n * @returns {void} undefined\n */\nexport function handleStyles(element, prop, value, oldValue) {\n for (let i in mixin(oldValue, value)) {\n const style = value == null || value[i] == null ? '' : value[i]\n if (i[0] === '-') {\n element[prop].setProperty(i, style)\n } else {\n element[prop][i] = style\n }\n }\n}\n","import { removeChildren } from './removeChildren'\n\n/**\n * @description Function to remove element from DOM.\n * @param {Node} parent The containing element in which the component resides.\n * @param {Node} element The parent of the element to remove.\n * @namespace {Node} node The element to remove.\n * @property {Object} node.props\n * @returns {void} undefined\n */\nexport const removeElement = (parent, element, node) => {\n parent.removeChild(removeChildren(element, node))\n if (node && node.props && node.props['onComponentDidUnmount']) {\n node.props['onComponentDidUnmount'].call(\n node.props['onComponentDidUnmount'],\n parent\n )\n }\n}\n","/**\n * @description A function to remove the children of a node.\n * @param {Node} element The parent of the node whose children will be removed.\n * @namespace {Node} node The node whose children will be removed.\n * @property {Object} node.props\n * @returns {Node} element The parent of the removed nodes.\n */\nexport function removeChildren(element, node) {\n const props = node.props\n if (props) {\n for (let i = 0; i < node.children.length; i++) {\n removeChildren(element.childNodes[i], node.children[i])\n }\n }\n return element\n}\n","import { createElement } from '../patchElementHelpers/createElement'\nimport { removeElement} from '../patchElementHelpers/removeElement'\n\n/**\n * @description When oldNode does not exist or node.type is different, create a new element.\n * @param {Node} node \n * @param {boolean} isSVG \n * @param {Node} parent \n * @param {Node} element \n * @param {Node} oldNode \n * @returns {Node} Node\n */\nexport function createNewElement(node, isSVG, parent, element, oldNode) {\n const newElement = createElement(node, isSVG)\n if (parent) {\n parent.insertBefore(newElement, element)\n if (oldNode != null) {\n removeElement(parent, element, oldNode)\n }\n }\n element = newElement\n return element\n}\n","import { setProp } from '../setProp'\n\n/**\n * @description Function to convert hyperscript/JSX into DOM nodes.\n * @param {Object | string} node A node to create. This may be a hyperscript function or a JSX tag which gets converted to hyperscript during transpilation.\n * @param {boolean} [isSVG] Whether the node is SVG or not.\n * @returns {Node} An element created from a virtual dom object.\n */\nexport function createElement(node, isSVG) {\n let element\n if (typeof node === 'number') node = node.toString()\n if (typeof node === 'string') {\n element = document.createTextNode(node)\n } else if ((isSVG = isSVG || node.type === 'svg')) {\n element = document.createElementNS('http://www.w3.org/2000/svg', node.type)\n } else {\n element = document.createElement(node.type)\n }\n /**\n * @property {Object} node.props A virtual node stored on the node.\n */\n const props = node.props\n if (props) {\n for (let i = 0; i < node.children.length; i++) {\n element.appendChild(createElement(node.children[i], isSVG))\n }\n\n for (let prop in props) {\n setProp(element, prop, props[prop], null, isSVG)\n }\n }\n\n return element\n}\n","import { getKey } from './patchElementHelpers/getKey'\nimport { updateElement } from './patchElementHelpers/updateElement'\nimport { removeElement } from './patchElementHelpers/removeElement'\nimport { createNewElement } from './patchElementHelpers/createNewElement'\nimport { removeOldChild } from './patchElementHelpers/removeOldChild'\nimport { trackOldElements } from './patchElementHelpers/trackOldElements'\nimport { removeOldKeyedElements } from './patchElementHelpers/removeOldKeyedElements'\n\n/**\n * @description A function to diff and patch a DOM node with a virtual node.\n * @param {Node} parent The parent node of the elment being patched.\n * @param {HTMLElement | Node} element The element being patched.\n * @param {Object} oldNode A virtual dom newNode from the previous patch.\n * @param {Object} newNode The current virtual dom node.\n * @param {boolean} [isSVG] Whether we are dealing with an SVG element or not.\n * @returns {Node} element The patched element.\n */\nexport function patchElement(parent, element, oldNode, newNode, isSVG) {\n // Short circuit patch if VNodes are identical\n if (newNode === oldNode) {\n return\n } else if (oldNode == null || oldNode.type !== newNode.type) {\n element = createNewElement(newNode, isSVG, parent, element, oldNode)\n } else if (oldNode.type == null) {\n element.nodeValue = newNode\n } else {\n updateElement(\n element,\n oldNode.props,\n newNode.props,\n (isSVG = isSVG || newNode.type === 'svg')\n )\n\n const oldKeyed = {}\n const newKeyed = {}\n const oldElements = []\n const oldChildren = oldNode.children\n const children = newNode.children\n\n trackOldElements(element, oldElements, oldChildren, oldKeyed)\n\n let i = 0\n let j = 0\n\n while (j < children.length) {\n let oldKey = getKey(oldChildren[i])\n let newKey = getKey(children[j])\n\n if (newKeyed[oldKey]) {\n i++\n continue\n }\n\n if (newKey != null && newKey === getKey(oldChildren[i + 1])) {\n if (oldKey == null) {\n removeElement(element, oldElements[i], oldChildren[i])\n }\n i++\n continue\n }\n\n if (newKey == null) {\n if (oldKey == null) {\n patchElement(\n element,\n oldElements[i],\n oldChildren[i],\n children[j],\n isSVG\n )\n j++\n }\n i++\n } else {\n const keyedNode = oldKeyed[newKey] || []\n\n if (oldKey === newKey) {\n patchElement(element, keyedNode[0], keyedNode[1], children[j], isSVG)\n i++\n } else if (keyedNode[0]) {\n patchElement(\n element,\n element.insertBefore(keyedNode[0], oldElements[i]),\n keyedNode[1],\n children[j],\n isSVG\n )\n } else {\n patchElement(element, oldElements[i], null, children[j], isSVG)\n }\n\n newKeyed[newKey] = children[j]\n j++\n }\n }\n\n removeOldChild(element, oldChildren, oldElements, i)\n removeOldKeyedElements(element, oldKeyed, newKeyed)\n }\n return element\n}\n","import { mixin } from '../mixin'\nimport { setProp } from '../setProp'\n\n/**\n * @description A function to update an element based on a virtual dom node.\n * @param {HTMLElement} element\n * @param {import('../../h').VNode} oldProps The original props used to create the element.\n * @param {import('../../h').VNode} props New props generated by the virtual dom.\n * @param {boolean} isSVG Whether we are dealing with SVG or not.\n * @function {function(element: Node, oldProps: VNode, props: VNode,isSVG: boolean): void}\n * @returns {void} undefined\n */\nexport function updateElement(element, oldProps, props, isSVG) {\n for (let prop in mixin(oldProps, props)) {\n if (\n props[prop] !==\n (prop === 'value' || prop === 'checked' ? element[prop] : oldProps[prop])\n ) {\n setProp(element, prop, props[prop], oldProps[prop], isSVG)\n }\n }\n // Handle lifecycle hook:\n if (element['mounted'] && props && props['onComponentDidUpdate']) {\n props['onComponentDidUpdate'].call(\n props['onComponentDidUpdate'],\n oldProps,\n props,\n element\n )\n }\n}\n","import { getKey } from '../patchElementHelpers/getKey'\n\n/**\n * @description Update values for old element and key.\n * @param {Node} element \n * @param {Node[]} oldElements\n * @param {Node[]} oldChildren\n * @param {Object} oldKeyed \n * @returns {void} undefined\n */\nexport function trackOldElements(element, oldElements, oldChildren, oldKeyed) {\n for (let i = 0; i < oldChildren.length; i++) {\n oldElements[i] = element.childNodes[i]\n\n const oldKey = getKey(oldChildren[i])\n if (oldKey != null) {\n oldKeyed[oldKey] = [oldElements[i], oldChildren[i]]\n }\n }\n}\n","import {removeElement} from '../patchElementHelpers/removeElement'\nimport {getKey} from '../patchElementHelpers/getKey'\n\n/**\n * Function to remove oldChild element when patching.\n * @param {Node} element \n * @param {any[]} oldChildren\n * @param {Node[]} oldElements\n * @param {number} i \n * @returns {void} undefined\n */\nexport function removeOldChild(element, oldChildren, oldElements, i) {\n while (i < oldChildren.length) {\n if (getKey(oldChildren[i]) == null) {\n removeElement(element, oldElements[i], oldChildren[i])\n }\n i++\n } \n}\n","import { removeElement } from '../patchElementHelpers/removeElement'\n\n/**\n * @description Remove old keyed elements.\n * @param {Node} element \n * @param {Object} oldKeyed \n * @param {Object} newKeyed \n * @returns {void} undefined\n */\nexport function removeOldKeyedElements(element, oldKeyed, newKeyed) {\n for (let k in oldKeyed) {\n if (!newKeyed[k]) {\n removeElement(element, oldKeyed[k][0], oldKeyed[k][1])\n }\n }\n}\n","import { patchElement } from './utils/patchElement'\n\n/**\n * @description A function to patch a virtual node against a DOM element, updating it in the most efficient manner possible.\n * @param {() => import('./h').VNode} node A function that returns a virtual node. This may be a JSX tag, which gets converted into a function, or a hyperscript function.\n * @param {Node} [element] The element to patch.\n * @returns {Node} The updated element.\n */\nexport function patch(node, element) {\n if (element) {\n patchElement(element.parentNode, element, element && element['vnode'], node)\n } else {\n element = patchElement(null, null, null, node)\n }\n\n element['vnode'] = node\n\n return element\n}\n","/**\n * @description A cross-browser normalization/polyfill for requestAnimationFrame.\n * @param {Function} cb A callback to execute.\n * @returns {any} The result of the callback.\n */\nexport const rAF =\n (window && window.requestAnimationFrame) ||\n (window && window['msRequestAnimationFrame']) ||\n function(cb) {\n return setTimeout(cb, 16)\n }\n","/**\n * @description A function to test where something is an object literal or not. Used by Component setState.\n * @param {Object} obj An object literal to test.\n * @returns boolean\n */\nexport function isObject(obj) {\n if (Array.isArray(obj)) return false\n else if (typeof obj === 'object') return true\n else return false\n}\n","import { isSameNode } from './isSameNode'\nimport { patch } from '../../patch'\n\n/**\n * @description This function updates an already rendered component. In doing so it checks to see if user provided data as an argument to this function. If data was provided, it uses that to render the component. Otherwise it checks if the component has state. If true, the function uses that to render the component. If no data was provided and the component is stateless, nothing will happen.\n * @param {boolean | number | string | Object | any[]} data\n * @param {import('../../component').Component} component \n */\nexport function updateComponent(data, component) {\n if (!component.render) return\n\n // If componentShouldUpdate is set to false,\n // render one time only.\n // All other updates will be ignored.\n if (!component.componentShouldUpdate && component.mounted) return\n\n // If data is 0 or non-boolean, use,\n // else use component state.\n let __data = component.state\n if (data !== true && data) __data = data\n\n if (component.container && typeof component.container === 'string') {\n component.selector = component.container\n component.container = document.querySelector(component.container)\n }\n\n // Create virtual dom and check if component id\n // already exists in document.\n /**\n * @type {Object | null}\n */\n const vdom = component.render(__data)\n let elem\n if (vdom && vdom.props && vdom.props.id && component.container) {\n elem = component.container && component.container.querySelector(`#${vdom.props.id}`)\n }\n\n // If component element id already exists in DOM,\n // remove it before rendering the component.\n if (elem && !component.mounted) {\n elem.parentNode.removeChild(elem)\n }\n\n // Capture old node to use with isSameNode if component is already mounted:\n const __oldNode = component.element && component.element.vnode\n\n // Short circuit update if VNodes are identical:\n if (isSameNode(__oldNode, __data, component)) return\n\n /**\n * @property {HTMLElement} element The base element of the rendered component. You can use component as the base for comopnent instance specific DOM queries or event registration.\n */\n component.element = patch(component.render(__data), component.element)\n if (!component.mounted) {\n component.componentWillMount && component.componentWillMount()\n if (!component.container || component.container.nodeType !== 1) {\n console.error(\n 'The container for a class component is not a valid DOM node. Check the selector provided for the class to make sure it is a valid CSS selector and that the container exists in the DOM. You might be targeting a nonexistent node.'\n )\n }\n component.container.appendChild(component.element)\n component.mounted = true\n component.componentDidMount && component.componentDidMount()\n return\n }\n\n component.componentWillUpdate && component.componentWillUpdate()\n component.componentDidUpdate && component.componentDidUpdate()\n}\n","/**\n * @description A function to test whether the data provided for updating a component creates a new virtual node or not.\n * @param {import('../../h').VNode} oldNode The previous virtual node of a component.\n * @param {*} data Data to be used when rendering a new virtual node for a component.\n * @param {import('../../component').Component} component A reference to the component being used.\n */\nexport function isSameNode(oldNode, data, component) {\n if (\n component &&\n JSON.stringify(oldNode) === JSON.stringify(component.render(data))\n ) {\n return true\n }\n return false\n}\n","/**\n * @description Array of events to remove when a component is unmounted.\n * @type {string[]} eventWhitelist \n */\nexport const eventWhitelist = [\n 'change',\n 'click',\n 'dblclick',\n 'input',\n 'keydown',\n 'keypress',\n 'keyup',\n 'mousedown',\n 'mouseleave',\n 'mouseout',\n 'mouseover',\n 'mouseup',\n 'pointercancel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'select',\n 'submit',\n 'touchcancel',\n 'touchend',\n 'touchmove',\n 'touchstart'\n]","import { rAF } from './utils/rAF'\nimport { handleSetState } from './utils/componentHelpers/handleSetState'\nimport { updateComponent } from './utils/componentHelpers/updateComponent'\nimport { unmountComponent } from './utils/componentHelpers/unmountComponent'\n\n/**\n * @description This is a Time object used as a key to create a pseudo-private property in the Component class for holding state.\n * @type {Object} dataStore A Date object to use as pseudo-private key to store the component's state.\n */\nconst dataStore = new Date().getTime()\n\n/**\n * @description Component can be instantiated with the new keyword, or extended to create a custom version of the class.\n * @class Class to create a component.\n * @example New instance of Component class:\n * const title = new Component({\n * container: 'header',\n * state: 'World',\n * render: message =>
Hello, {message}!
\n * })\n * @example Extending Component class:\n * class UserList extends Component {\n * constructor(props) {\n * super(props)\n * this.state = users\n * this.container = 'section'\n * }\n * render(users) {\n * return (\n * \n * {\n * users.map(user => - {user.name}
)\n * }\n *
\n * )\n * }\n * }\n */\nexport class Component {\n /**\n * @constructor\n * @description Constructor for Component class.\n * @property {state} [props.state] The state object of the component. This can be of type boolean, string, number, object or array.\n * @property {string} selector A CSS selector describing the DOM container in which to render the component.\n * @property {HTMLElement} container The DOM node in which the component is rendered.\n * @property {boolean} componentShouldUpdate A flag to determine whether a component can render or not. Setting this to false allows you to maipulate a component's state without triggering and automatic render. After setting to true, you may need to execute `update()` on a component instance to force render it.\n * @property {boolean} mounted A boolean flag that tracks whether a component has been mounted in the DOM or not. This is used internally by Composi, do not touch!\n * @property {Node} element The root or base element of a component's DOM tree. You can use it to register events or as the basis of a component-specific DOM query.\n * @method componentWillMount A callback that is called before a component is mounted in the DOM.\n * @method componentDidMount A callback that is called after a component is mounted in the DOM. Use this to register events, query the component DOM, etc.\n * @method componentWillUpdate A callback that is called before a component is updated. This is not called the first time a component is rendered.\n * @method componentDidUpdate A callback that is called after a component is updated. This is not called the first time a component is rendered.\n * @method componentWillUnmount A callback that is called before a component is unmounted from the DOM. Use this for any environmental cleanup.\n * @method render A method that returns nodes to render to the DOM.¸\n * @method update A method that renders the component template with provided data to the DOM. Data may be provided directly as the primary argument, or it can be derived from the component's state. Data provided as an argument will override use of component state.\n * @method unmount A method to unmount a component from the DOM. This deletes the DOM tree structure starting from the component's base element, and sets the component instance properties to null.\n * @constructs Component\n */\n constructor(props) {\n if (!props) props = {}\n /**\n * @property {Object} props An object literal of options passed to the class constructor during initialization.\n */\n this.props = props\n /**\n * @property {string | HTMLElement} container The HTML element in which the component gets rendered. This can be a CSS selector describing the container or a DOM node reference.\n */\n this.selector = props.container || 'body'\n\n if (props.render) {\n /**\n * @property {Function} render A method to convert markup into DOM nodes to inject in the document. The method itself gets provided at init time by a function provided by the user as an argument, or in the case of extending, a method defined directly on the class extension.\n */\n this.render = props.render\n }\n\n if (props.state) {\n /**\n * @property {boolean | number | string | Object | any[]}\n */\n this.state = props.state\n }\n\n if (this.selector) {\n /**\n * @property {HTMLElement} container The HTML element in which the component gets rendered.\n */\n this.container = document.querySelector(this.selector)\n }\n\n /**\n * @property {boolean} componentShouldUpdate Determines whether a component should update. Set `componentShouldUpdate` to `false`, make changes, then set `componentShouldUpdate` to `true` and update component with `update` method.\n */\n this.componentShouldUpdate = true\n\n /**\n * @property {boolean} mounted Indicates whether a component is mounted in the DOM or not. This is used internally, so do not change!\n */\n this.mounted = false\n\n /**\n * @property {HTMLElement} this.element\n * @property {Object} this.element.vnode\n */\n this.element = null\n\n if (props.componentWillMount)\n /**\n * @property {() => void} componentWillMount A method to execute before the component mounts. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentWillMount = props.componentWillMount\n\n if (props.componentDidMount)\n /**\n * @property {() => void} componentDidMount A method to execute after the component mounts. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentDidMount = props.componentDidMount\n\n if (props.componentWillUpdate)\n /**\n * @property {() => void} componentWillUpdate A method to execute before the component updates. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentWillUpdate = props.componentWillUpdate\n\n if (props.componentDidUpdate)\n /**\n * @property {() => void} componentDidUpdate -A method to execute after the component updates. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentDidUpdate = props.componentDidUpdate\n\n if (props.componentWillUnmount)\n /**\n * @property {() => void} componentWillUnmount A method to execute before the component unmounts. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentWillUnmount = props.componentWillUnmount\n }\n\n /**\n * @method A method to execute before the component mounts.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentWillMount(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to execute after the component mounts.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentDidMount(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to execute before the component updates.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentWillUpdate(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to execute after the component updates.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentDidUpdate(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to execute after the component updates.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentWillUnmount(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to create a virtual node from data and markup. The returned virtual node will get converted into a node that gets injected in the DOM.\n * @param {*} data\n */\n render(data) {\n return data\n }\n /** End of type stubs */\n\n /**\n * @method This is getter to access the component's state using the pseudo-private key dataStore.\n * @returns {boolean | number | string | Object | any[]} The component's state\n */\n get state() {\n return this[dataStore]\n }\n\n /**\n * @method This is a setter to define the component's state. It uses the dataStore object as a pseudo-private key. It uses requestAnimationFrame to throttle component updates to avoid layout thrashing.\n * @param {string | number | boolean | Object | any[]} data Data to set as component state.\n * @returns {void} undefined\n */\n set state(data) {\n this[dataStore] = data\n rAF(() => this.update())\n }\n\n /**\n * @method Method to set a component's state. This accepts simple types or Objects. If updating an array, you can pass in the data and the position (number) in the array to update. Optionally you can pass a callback, which receives the state as its argument. You need to return the state changes in order to update the component's state.\n * @example\n * this.setState(true)\n * this.setState(0)\n * this.setState({name: 'Joe'})\n * this.setState([1,2,3])\n * this.setState(prevState => prevState + 1)\n * @param {string | number | boolean | Object | any[] | Function} data The data to set. If a callback is passed as the argument to execute, it gets passed the previous state as its argument. You need to make sure the callback returns the final state or the component will not update.\n * @returns {void} undefined\n */\n setState(data) {\n handleSetState(data, this)\n }\n\n /**\n * @method Function to render component after data changes.\n * If data is passed as argument, it will be used.\n * Otherwise state will be used.\n * @param {boolean | number | string | Object | any[]} [data] By default, data will be the component's current state, otherwise, if data is provided as an argument, that will be used, overriding the state.\n * @returns {void} undefined\n */\n update(data) {\n updateComponent(data, this)\n }\n\n /**\n * @method Method to destroy a component.\n * First unbind events.\n * Then remove component element from DOM.\n * Also null out component properties.\n * @returns {void} undefined\n */\n unmount() {\n unmountComponent(this)\n }\n}\n","import { mixin } from '../mixin'\nimport { isObject } from '../componentHelpers/isObject'\n\n/**\n * @function A helper function for the Component class. This sets state on the class component provided.\n * @param {*} data Data to use as state.\n * @param {import('../../component').Component} component A reference to the component to use.\n */\nexport function handleSetState(data, component) {\n if (typeof data === 'function') {\n const state = data.call(component, component.state)\n if (state) component.state = state\n } else if (isObject(component.state) && isObject(data)) {\n const state = component.state\n component.state = mixin(state, data)\n } else {\n component.state = data\n }\n}","import { eventWhitelist } from './eventWhitelist'\n\n/**\n * @description This function will unmount the provided component. Doing so it unregisters a whitelist of events, deletes the base element of the component from the DOM, and sets the component instance properties to null.\n * @param {import('../../component').Component} component \n */\nexport function unmountComponent(component) {\n if (!component.element) return\n component.componentWillUnmount && component.componentWillUnmount()\n eventWhitelist.map(event => {\n component.element.removeEventListener(event, component)\n })\n component.container.removeChild(component.element)\n component.container = null\n for (let key in component) {\n delete component[key]\n }\n delete component.state\n component.update = null\n component.unmount = null\n}\n","// import {vnode} from './utils/vnode'\n/**\n * @typedef {Object} VNode;\n * @property {string | Function} VNode.type;\n * @property {any[]} VNode.children;\n * @property {string | number | null} VNode.key;\n * @property {Object. } VNode.props;\n */\n/**\n * @description Hyperscript function. Enables definition of HTML/SVG using functions.\n * @param {string | Function} type A tag name or function.\n * @param {Object} [props] An Object literal of key-value pairs.\n * @param {any[]} children An array of strings or other arrays.\n * @returns {VNode} VNode An object literal of type, props and children.\n *\n * @example Virtual node with string as content:\n * const title = h('h1', {class: 'main-title'}, 'This is the Titel!')\n * @example Virtual node with children:\n * const list = h(\n * 'ul',\n * {class: 'list'},\n * [\n * h('li', {}, 'One'),\n * h('li', {}, 'Two'),\n * h('li', {}, 'Three')\n * ]\n * )\n */\nexport function h(type, props, ...children) {\n const nodes = []\n const childNodes = []\n let length = children.length\n props = props || {}\n let key = props.key || null\n\n // Remove key from props if present:\n delete props.key\n\n while (length-- > 0) nodes.push(children[length])\n\n while (nodes.length) {\n const node = nodes.pop()\n if (node && node.pop) {\n for (length = node.length; length--; ) {\n nodes.push(node[length])\n }\n } else if (node != null && node !== true && node !== false) {\n childNodes.push(node)\n }\n }\n\n children = childNodes\n\n if (typeof type === 'function') {\n return type(props || {}, childNodes)\n } else {\n return {\n type,\n props,\n children,\n key\n }\n }\n}\n","import { patch } from './patch'\nimport { FragmentError } from './utils/fragmentError'\n\n/**\n * @description A function to create and inject a virtual node into the document. The node will be appended to the container. The first argument can be either a JSX tag or an h function. After mounting, use the render function and the element returned by mount to udate the DOM.\n * @example Insert Title tag into section:\n * const title = mount(, 'section').\n * // Update the node with new prop value and reference to DOM from mount:\n * render(, title)\n * @param {Object | Function} tag A JSX tag or hyperscript function to render.\n * @param {Node | string} [container] The element into which the tag will be rendered.\n * @param {HTMLElement} [elementToHydrate] A server-rendered element to hydrate during initial load.\n * @returns {Node} The base element of the rendered tag.\n */\nexport const mount = (tag, container, elementToHydrate) => {\n container = typeof container === 'string' && document.querySelector(container)\n if (!container) container = document.body\n if (Array.isArray(tag)) throw new FragmentError()\n const element = patch(tag)\n if (tag.props && tag.props['onComponentDidMount']) {\n tag.props['onComponentDidMount'].call(\n tag.props['onComponentDidMount'],\n element\n )\n }\n element['mounted'] = true\n if (elementToHydrate) {\n if (typeof elementToHydrate === 'string') {\n elementToHydrate = document.querySelector(elementToHydrate)\n }\n if (elementToHydrate.nextElementSibling) {\n elementToHydrate.parentNode.insertBefore(\n element,\n elementToHydrate.nextElementSibling\n )\n elementToHydrate.parentNode.removeChild(elementToHydrate)\n return element\n } else {\n elementToHydrate.parentNode.appendChild(element)\n elementToHydrate.parentNode.removeChild(elementToHydrate)\n return element\n }\n } else {\n return container.appendChild(element)\n }\n}\n","/**\n * Class to throw error message when attempting to insert Fragement tag directly into DOM.\n */\nexport class FragmentError {\n constructor() {\n this.message = 'Cannot insert Fragment tag directly into DOM.'\n this.toString = function() {\n return this.message\n }\n }\n}\n","import { patch } from './patch'\n\n/**\n * @description A function to update a functional component already mounted in the DOM. The first argument can be either a JSX tag or an h function.\n * @example Update Title tag into section:\n * const element = mount(, 'section')\n * // Pass the captured element to the render function:\n * render(, 'header')\n * @param {Function} tag A JSX tag or hyperscript function to render.\n * @param {Node} [element] The element in the DOM which will be updated.\n * @returns {Node} The base element of the rendered tag.\n */\nexport function render(tag, element) {\n return patch(tag, element)\n}\n","/**\n * @description A tag to enable returning sibling elements. This is useful for returning list items to render in a list or table cells to render in a table row.\n * @example\n * \n * A\n * B\n * C\n * \n * Or functionally:\n * Fragment(null, [\n * h('li', {}, 'A'),\n * h('li', {}, 'B'),\n * h('li', {}, 'C')\n * ])\n * @param {Object} [props] When using Fragment as a function, props is the first argument. Provide either null or {} as the value for props.\n * @param {import('./h').VNode[]} [children] The siblings to return with the Fragment. This will be an array of sibling elements.\n * @returns {import('./h').VNode[]} An array of virtual nodes.\n */\nexport const Fragment = (props, children) => children\n"],"names":["getKey","node","key","mixin","obj1","obj2","result","i","setProp","element","prop","value","oldValue","isSVG","style","setProperty","toLowerCase","innerHTML","setAttributeNS","setAttribute","removeAttribute","removeElement","parent","removeChild","removeChildren","props","children","length","childNodes","call","createNewElement","oldNode","newElement","createElement","toString","document","createTextNode","type","createElementNS","appendChild","insertBefore","patchElement","newNode","nodeValue","oldProps","oldKeyed","newKeyed","oldElements","oldChildren","oldKey","j","newKey","keyedNode","k","patch","parentNode","rAF","window","requestAnimationFrame","cb","setTimeout","isObject","obj","Array","isArray","updateComponent","data","component","render","componentShouldUpdate","mounted","__data","state","container","selector","querySelector","vdom","elem","id","__oldNode","vnode","JSON","stringify","componentWillMount","nodeType","error","componentDidMount","componentWillUpdate","componentDidUpdate","eventWhitelist","dataStore","Date","getTime","Component","this","componentWillUnmount","map","removeEventListener","event","update","unmount","_this","nodes","push","pop","tag","elementToHydrate","body","message","nextElementSibling"],"mappings":"0LAKA,IAAaA,EAAS,mBAASC,EAAOA,EAAKC,IAAM,MCCjD,SAAgBC,EAAMC,EAAMC,OACpBC,SACD,IAAIC,KAAKH,IACLG,GAAKH,EAAKG,OAEd,IAAIA,KAAKF,IACLE,GAAKF,EAAKE,UAEZD,ECAT,SAAgBE,EAAQC,EAASC,EAAMC,EAAOC,EAAUC,GCPxD,IAAgCJ,EAAeE,ECAcA,ECF7BD,EHYnB,QAATA,GACS,wBAATA,GACS,yBAATA,GACS,2BAATA,IAGkB,UAATA,GAAqC,iBAAVC,EIbxC,SAA6BF,EAASC,EAAMC,EAAOC,OAC5C,IAAIL,KAAKJ,EAAMS,EAAUD,GAAQ,KAC9BG,EAAiB,MAATH,GAA6B,MAAZA,EAAMJ,GAAa,GAAKI,EAAMJ,GAChD,MAATA,EAAE,KACIG,GAAMK,YAAYR,EAAGO,KAErBJ,GAAMH,GAAKO,IJQRL,EAASC,EAAMC,EAAOC,MAG5BF,EAAKM,cGrBD,eADiBN,EHyBLA,OGvBhB,SDAkDC,EF0BZA,EEzBlC,+BCCND,KHwByBD,EExBtBQ,UAAYN,GF0BhBD,KAAQD,GAAoB,SAATC,IAAoBG,IACjCH,GAA0B,MAAlBC,EAA0B,GAAKA,EAEtC,MAATA,GACU,SAAVA,GACU,UAAVA,GACU,OAAVA,GACU,QAAVA,IAGa,eAATD,GCtCqCC,EDuCRA,GCvCPF,EDuCRA,GCtCdS,eAAe,+BAAgC,OAAQP,KACvDQ,aAAa,OAAQR,KDuCT,SAAVA,IA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,MAAMC,QAAQyC,GAAM,MAAM,ICb9B,4BACOG,QAAU,qDACV1E,SAAW,kBACP4D,KAAKc,cDWVnG,EAAU6C,EAAMmD,UAClBA,EAAIhF,OAASgF,EAAIhF,MAAJ,uBACXA,MAAJ,oBAAiCI,KAC/B4E,EAAIhF,MAAJ,oBACAhB,KAGJ,SAAqB,EACjBiG,GAC8B,iBAArBA,MACUvE,SAASwC,cAAc+B,IAExCA,EAAiBG,sBACFtD,WAAWf,aAC1B/B,EACAiG,EAAiBG,sBAEFtD,WAAWhC,YAAYmF,GACjCjG,MAEU8C,WAAWhB,YAAY9B,KACvB8C,WAAWhC,YAAYmF,GACjCjG,IAGFgE,EAAUlC,YAAY9B,aE/BjC,SAAuBgG,EAAKhG,UACnB6C,EAAMmD,EAAKhG,6BCKI,SAACgB,EAAOC,UAAaA"}
\ No newline at end of file
+{"version":3,"file":"composi.js","sources":["../lib/utils/patchElementHelpers/getKey.js","../lib/utils/mixin.js","../lib/utils/setProp.js","../lib/utils/setPropHelpers/handleXlinkHref.js","../lib/utils/setPropHelpers/handleDangerouslySetInnerHTML.js","../lib/utils/setPropHelpers/handleClassName.js","../lib/utils/setPropHelpers/handleStyles.js","../lib/utils/patchElementHelpers/removeElement.js","../lib/utils/patchElementHelpers/removeChildren.js","../lib/utils/patchElementHelpers/createNewElement.js","../lib/utils/patchElementHelpers/createElement.js","../lib/utils/patchElement.js","../lib/utils/patchElementHelpers/updateElement.js","../lib/utils/patchElementHelpers/trackOldElements.js","../lib/utils/patchElementHelpers/removeOldChild.js","../lib/utils/patchElementHelpers/removeOldKeyedElements.js","../lib/patch.js","../lib/utils/rAF.js","../lib/utils/componentHelpers/isObject.js","../lib/utils/componentHelpers/updateComponent.js","../lib/utils/componentHelpers/isSameNode.js","../lib/utils/componentHelpers/eventWhitelist.js","../lib/component.js","../lib/utils/componentHelpers/handleSetState.js","../lib/utils/componentHelpers/unmountComponent.js","../lib/h.js","../lib/mount.js","../lib/utils/fragmentError.js","../lib/render.js","../lib/fragment.js"],"sourcesContent":["/**\n * @description Function to get a node's key.\n * @param {Object} node A virtual node.\n * @returns {string | number | null} key.\n */\nexport const getKey = node => (node ? node.key : null)\n","/**\n * @description A function to merge two objects together. The properties of the second object will overwrite any matching properties in the first object.\n * @param {Object.} obj1 The first object to merge.\n * @param {Object.} obj2 The second object to merge.\n * @returns {Object.} Returns a new object of the second object merged with the first.\n */\nexport function mixin(obj1, obj2) {\n const result = {}\n for (let i in obj1) {\n result[i] = obj1[i]\n }\n for (let i in obj2) {\n result[i] = obj2[i]\n }\n return result\n}\n","import { handleStyles } from './setPropHelpers/handleStyles'\nimport { handleClassName } from './setPropHelpers/handleClassName'\nimport { handleDangerouslySetInnerHTML } from './setPropHelpers/handleDangerouslySetInnerHTML'\nimport { handleXlinkHref } from './setPropHelpers/handleXlinkHref'\n\n/**\n * @description Function to set properties and attributes on element.\n * @param {Node} element The element to set props on.\n * @param {string} prop The property/attribute.\n * @param {string | number | boolean} value The value of the prop.\n * @param {string | number | boolean} oldValue The original value of the prop.\n * @param {boolean} isSVG Whether this is SVG or not\n * @returns {void} undefined\n */\nexport function setProp(element, prop, value, oldValue, isSVG) {\n // Do not add these as node attributes:\n if (\n prop === 'key' ||\n prop === 'onComponentDidMount' ||\n prop === 'onComponentDidUpdate' ||\n prop === 'onComponentWillUnmount'\n ) {\n return\n } else if (prop === 'style' && typeof value !== 'string') {\n handleStyles(element, prop, value, oldValue)\n } else {\n // Convert camel case props to lower case:\n prop = prop.toLowerCase()\n\n // Handle cases where 'className' is used:\n prop = handleClassName(prop)\n\n // Allow setting innerHTML:\n handleDangerouslySetInnerHTML(element, prop, value)\n\n if (prop in element && prop !== 'list' && !isSVG) {\n element[prop] = value == (null || 'no') ? '' : value\n } else if (\n value != null &&\n value !== 'null' &&\n value !== 'false' &&\n value !== 'no' &&\n value !== 'off'\n ) {\n // Support SVG 'xlink:href' property:\n if (prop === 'xlink-href') {\n handleXlinkHref(element, prop, value)\n } else {\n if (value === 'true') value = ''\n // Set prop as attribute, except dangerouslySetInnerHTML:\n if (prop !== 'dangerouslysetinnerhtml')\n element['setAttribute'](prop, value)\n }\n }\n\n if (\n value == null ||\n value === 'null' ||\n value === 'undefined' ||\n value === 'false' ||\n value === 'no' ||\n value === 'off'\n ) {\n element['removeAttribute'](prop)\n }\n }\n}\n","/**\n * @description Enable setting xlink href value for browser that only support SVG 1.0.\n * @param {Node} element\n * @param {string} prop\n * @param {string | number | boolean | any[] | Object} value\n * @returns {void} undefined\n */\nexport function handleXlinkHref(element, prop, value) {\n element['setAttributeNS']('http://www.w3.org/1999/xlink', 'href', value)\n element['setAttribute']('href', value)\n}\n","/**\n * @description Enable setting innerHTML as a prop.\n * @param {Node} element\n * @param {string} prop\n * @param {string | number | boolean | any[] | Object} value\n * @returns {void} undefined\n */\nexport function handleDangerouslySetInnerHTML(element, prop, value) {\n if (prop === 'dangerouslysetinnerhtml') {\n element['innerHTML'] = value\n }\n}\n","/**\n * @description Handle converting 'className' to 'class'.\n * @param {string} prop\n * @returns {string} string\n */\nexport function handleClassName(prop) {\n if (prop === 'classname') {\n prop = 'class'\n }\n return prop\n}\n","import { mixin } from '../mixin'\n\n/**\n * @description Handle styles defined as object literals.\n * @param {Node} element\n * @param {string} prop\n * @param {any} value\n * @param {any} oldValue\n * @returns {void} undefined\n */\nexport function handleStyles(element, prop, value, oldValue) {\n for (let i in mixin(oldValue, value)) {\n const style = value == null || value[i] == null ? '' : value[i]\n if (i[0] === '-') {\n element[prop].setProperty(i, style)\n } else {\n element[prop][i] = style\n }\n }\n}\n","import { removeChildren } from './removeChildren'\n\n/**\n * @description Function to remove element from DOM.\n * @param {Node} parent The containing element in which the component resides.\n * @param {Node} element The parent of the element to remove.\n * @namespace {Node} node The element to remove.\n * @property {Object.} node.props\n * @returns {void} undefined\n */\nexport const removeElement = (parent, element, node) => {\n parent.removeChild(removeChildren(element, node))\n if (node && node.props && node.props['onComponentDidUnmount']) {\n node.props['onComponentDidUnmount'].call(\n node.props['onComponentDidUnmount'],\n parent\n )\n }\n}\n","/**\n * @description A function to remove the children of a node.\n * @param {Node} element The parent of the node whose children will be removed.\n * @namespace {Node} node The node whose children will be removed.\n * @property {Object} node.props\n * @returns {Node} element The parent of the removed nodes.\n */\nexport function removeChildren(element, node) {\n const props = node.props\n if (props) {\n for (let i = 0; i < node.children.length; i++) {\n removeChildren(element.childNodes[i], node.children[i])\n }\n }\n return element\n}\n","import { createElement } from '../patchElementHelpers/createElement'\nimport { removeElement} from '../patchElementHelpers/removeElement'\n\n/**\n * @description When oldNode does not exist or node.type is different, create a new element.\n * @param {Node} node \n * @param {boolean} isSVG \n * @param {Node} parent \n * @param {Node} element \n * @param {Node} oldNode \n * @returns {Node} Node\n */\nexport function createNewElement(node, isSVG, parent, element, oldNode) {\n const newElement = createElement(node, isSVG)\n if (parent) {\n parent.insertBefore(newElement, element)\n if (oldNode != null) {\n removeElement(parent, element, oldNode)\n }\n }\n element = newElement\n return element\n}\n","import { setProp } from '../setProp'\n\n/**\n * @description Function to convert hyperscript/JSX into DOM nodes.\n * @param {string | number | Object} node A node to create. This may be a hyperscript function or a JSX tag which gets converted to hyperscript during transpilation.\n * @param {boolean} [isSVG] Whether the node is SVG or not.\n * @returns {Node} An element created from a virtual dom object.\n */\nexport function createElement(node, isSVG) {\n let element\n if (typeof node === 'number') node = node.toString()\n if (typeof node === 'string') {\n element = document.createTextNode(node)\n } else if ((isSVG = isSVG || node.type === 'svg')) {\n element = document.createElementNS('http://www.w3.org/2000/svg', node.type)\n } else {\n element = document.createElement(node.type)\n }\n /**\n * @property {Object} node.props A virtual node stored on the node.\n */\n const props = node.props\n if (props) {\n for (let i = 0; i < node.children.length; i++) {\n element.appendChild(createElement(node.children[i], isSVG))\n }\n\n for (let prop in props) {\n setProp(element, prop, props[prop], null, isSVG)\n }\n }\n\n return element\n}\n","import { getKey } from './patchElementHelpers/getKey'\nimport { updateElement } from './patchElementHelpers/updateElement'\nimport { removeElement } from './patchElementHelpers/removeElement'\nimport { createNewElement } from './patchElementHelpers/createNewElement'\nimport { removeOldChild } from './patchElementHelpers/removeOldChild'\nimport { trackOldElements } from './patchElementHelpers/trackOldElements'\nimport { removeOldKeyedElements } from './patchElementHelpers/removeOldKeyedElements'\n\n/**\n * @description A function to diff and patch a DOM node with a virtual node.\n * @param {Node} parent The parent node of the elment being patched.\n * @param {Node} element The element being patched.\n * @param {Object} oldNode A virtual dom newNode from the previous patch.\n * @param {Object} newNode The current virtual dom node.\n * @param {boolean} [isSVG] Whether we are dealing with an SVG element or not.\n * @returns {Node} element The patched element.\n */\nexport function patchElement(parent, element, oldNode, newNode, isSVG) {\n // Short circuit patch if VNodes are identical\n if (newNode === oldNode) {\n return\n } else if (oldNode == null || oldNode.type !== newNode.type) {\n element = createNewElement(newNode, isSVG, parent, element, oldNode)\n } else if (oldNode.type == null) {\n element.nodeValue = newNode\n } else {\n updateElement(\n element,\n oldNode.props,\n newNode.props,\n (isSVG = isSVG || newNode.type === 'svg')\n )\n\n const oldKeyed = {}\n const newKeyed = {}\n const oldElements = []\n const oldChildren = oldNode.children\n const children = newNode.children\n\n trackOldElements(element, oldElements, oldChildren, oldKeyed)\n\n let i = 0\n let j = 0\n\n while (j < children.length) {\n let oldKey = getKey(oldChildren[i])\n let newKey = getKey(children[j])\n\n if (newKeyed[oldKey]) {\n i++\n continue\n }\n\n if (newKey != null && newKey === getKey(oldChildren[i + 1])) {\n if (oldKey == null) {\n removeElement(element, oldElements[i], oldChildren[i])\n }\n i++\n continue\n }\n\n if (newKey == null) {\n if (oldKey == null) {\n patchElement(\n element,\n oldElements[i],\n oldChildren[i],\n children[j],\n isSVG\n )\n j++\n }\n i++\n } else {\n const keyedNode = oldKeyed[newKey] || []\n\n if (oldKey === newKey) {\n patchElement(element, keyedNode[0], keyedNode[1], children[j], isSVG)\n i++\n } else if (keyedNode[0]) {\n patchElement(\n element,\n element.insertBefore(keyedNode[0], oldElements[i]),\n keyedNode[1],\n children[j],\n isSVG\n )\n } else {\n patchElement(element, oldElements[i], null, children[j], isSVG)\n }\n\n newKeyed[newKey] = children[j]\n j++\n }\n }\n\n removeOldChild(element, oldChildren, oldElements, i)\n removeOldKeyedElements(element, oldKeyed, newKeyed)\n }\n return element\n}\n","import { mixin } from '../mixin'\nimport { setProp } from '../setProp'\n\n/**\n * @description A function to update an element based on a virtual dom node.\n * @param {Node} element\n * @param {Object} oldProps The original props used to create the element.\n * @param {Object} props New props generated by the virtual dom.\n * @param {boolean} isSVG Whether we are dealing with SVG or not.\n * @function {function(element: Node, oldProps: VNode, props: VNode,isSVG: boolean): void}\n * @returns {void} undefined\n */\nexport function updateElement(element, oldProps, props, isSVG) {\n for (let prop in mixin(oldProps, props)) {\n if (\n props[prop] !==\n (prop === 'value' || prop === 'checked' ? element[prop] : oldProps[prop])\n ) {\n setProp(element, prop, props[prop], oldProps[prop], isSVG)\n }\n }\n // Handle lifecycle hook:\n if (element['mounted'] && props && props['onComponentDidUpdate']) {\n props['onComponentDidUpdate'].call(\n props['onComponentDidUpdate'],\n oldProps,\n props,\n element\n )\n }\n}\n","import { getKey } from '../patchElementHelpers/getKey'\n\n/**\n * @description Update values for old element and key.\n * @param {Node} element \n * @param {Node[]} oldElements\n * @param {Node[]} oldChildren\n * @param {Object.} oldKeyed \n * @returns {void} undefined\n */\nexport function trackOldElements(element, oldElements, oldChildren, oldKeyed) {\n for (let i = 0; i < oldChildren.length; i++) {\n oldElements[i] = element.childNodes[i]\n\n const oldKey = getKey(oldChildren[i])\n if (oldKey != null) {\n oldKeyed[oldKey] = [oldElements[i], oldChildren[i]]\n }\n }\n}\n","import {removeElement} from '../patchElementHelpers/removeElement'\nimport {getKey} from '../patchElementHelpers/getKey'\n\n/**\n * Function to remove oldChild element when patching.\n * @param {Node} element \n * @param {any[]} oldChildren\n * @param {Node[]} oldElements\n * @param {number} i \n * @returns {void} undefined\n */\nexport function removeOldChild(element, oldChildren, oldElements, i) {\n while (i < oldChildren.length) {\n if (getKey(oldChildren[i]) == null) {\n removeElement(element, oldElements[i], oldChildren[i])\n }\n i++\n } \n}\n","import { removeElement } from '../patchElementHelpers/removeElement'\n\n/**\n * @description Remove old keyed elements.\n * @param {Node} element \n * @param {Object.} oldKeyed\n * @param {Object.} newKeyed\n * @returns {void} undefined\n */\nexport function removeOldKeyedElements(element, oldKeyed, newKeyed) {\n for (let k in oldKeyed) {\n if (!newKeyed[k]) {\n removeElement(element, oldKeyed[k][0], oldKeyed[k][1])\n }\n }\n}\n","import { patchElement } from './utils/patchElement'\n\n/**\n * @description A function to patch a virtual node against a DOM element, updating it in the most efficient manner possible.\n * @param {() => import('./h').VNode} node A function that returns a virtual node. This may be a JSX tag, which gets converted into a function, or a hyperscript function.\n * @param {Node} [element] The element to patch.\n * @returns {Node} The updated element.\n */\nexport function patch(node, element) {\n if (element) {\n patchElement(element.parentNode, element, element && element['vnode'], node)\n } else {\n element = patchElement(null, null, null, node)\n }\n\n element['vnode'] = node\n\n return element\n}\n","/**\n * @description A cross-browser normalization/polyfill for requestAnimationFrame.\n * @param {Function} cb A callback to execute.\n * @returns {number} The request id, that uniquely identifies the entry in the browser's callback list.\n */\nexport const rAF =\n (window && window.requestAnimationFrame) ||\n (window && window['msRequestAnimationFrame']) ||\n function(cb) {\n return setTimeout(cb, 16)\n }\n","/**\n * @description A function to test where something is an object literal or not. Used by Component setState.\n * @param {Object.} obj An object literal to test.\n * @returns boolean\n */\nexport function isObject(obj) {\n if (Array.isArray(obj)) return false\n else if (typeof obj === 'object') return true\n else return false\n}\n","import { isSameNode } from './isSameNode'\nimport { patch } from '../../patch'\n\n/**\n * @description This function updates an already rendered component. In doing so it checks to see if user provided data as an argument to this function. If data was provided, it uses that to render the component. Otherwise it checks if the component has state. If true, the function uses that to render the component. If no data was provided and the component is stateless, nothing will happen.\n * @param {boolean | number | string | Object. | any[]} data\n * @param {import('../../component').Component} component \n */\nexport function updateComponent(data, component) {\n if (!component.render) return\n\n // If componentShouldUpdate is set to false,\n // render one time only.\n // All other updates will be ignored.\n if (!component.componentShouldUpdate && component.mounted) return\n\n // If data is 0 or non-boolean, use,\n // else use component state.\n let __data = component.state\n if (data !== true && data) __data = data\n\n if (component.container && typeof component.container === 'string') {\n component.selector = component.container\n component.container = document.querySelector(component.container)\n }\n\n // Create virtual dom and check if component id\n // already exists in document.\n /**\n * @type {Object. | null}\n */\n const vdom = component.render(__data)\n let elem\n if (vdom && vdom.props && vdom.props.id && component.container) {\n elem = component.container && component.container.querySelector(`#${vdom.props.id}`)\n }\n\n // If component element id already exists in DOM,\n // remove it before rendering the component.\n if (elem && !component.mounted) {\n elem.parentNode.removeChild(elem)\n }\n\n // Capture old node to use with isSameNode if component is already mounted:\n const __oldNode = component.element && component.element.vnode\n\n // Short circuit update if VNodes are identical:\n if (isSameNode(__oldNode, __data, component)) return\n\n /**\n * @property {HTMLElement} element The base element of the rendered component. You can use component as the base for comopnent instance specific DOM queries or event registration.\n */\n component.element = patch(component.render(__data), component.element)\n if (!component.mounted) {\n component.componentWillMount && component.componentWillMount()\n if (!component.container || component.container.nodeType !== 1) {\n console.error(\n 'The container for a class component is not a valid DOM node. Check the selector provided for the class to make sure it is a valid CSS selector and that the container exists in the DOM. You might be targeting a nonexistent node.'\n )\n }\n component.container.appendChild(component.element)\n component.mounted = true\n component.componentDidMount && component.componentDidMount()\n return\n }\n\n component.componentWillUpdate && component.componentWillUpdate()\n component.componentDidUpdate && component.componentDidUpdate()\n}\n","/**\n * @description A function to test whether the data provided for updating a component creates a new virtual node or not.\n * @param {import('../../h').VNode} oldNode The previous virtual node of a component.\n * @param {*} data Data to be used when rendering a new virtual node for a component.\n * @param {import('../../component').Component} component A reference to the component being used.\n */\nexport function isSameNode(oldNode, data, component) {\n if (\n component &&\n JSON.stringify(oldNode) === JSON.stringify(component.render(data))\n ) {\n return true\n }\n return false\n}\n","/**\n * @description Array of events to remove when a component is unmounted.\n * @type {string[]} eventWhitelist \n */\nexport const eventWhitelist = [\n 'change',\n 'click',\n 'dblclick',\n 'input',\n 'keydown',\n 'keypress',\n 'keyup',\n 'mousedown',\n 'mouseleave',\n 'mouseout',\n 'mouseover',\n 'mouseup',\n 'pointercancel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'select',\n 'submit',\n 'touchcancel',\n 'touchend',\n 'touchmove',\n 'touchstart'\n]\n","import { rAF } from './utils/rAF'\nimport { handleSetState } from './utils/componentHelpers/handleSetState'\nimport { updateComponent } from './utils/componentHelpers/updateComponent'\nimport { unmountComponent } from './utils/componentHelpers/unmountComponent'\n\n/**\n * @description This is a numeric value derived from the Date object used as a key to create a pseudo-private property in the Component class for holding state.\n * @type {number} dataStore A numeric value to use as pseudo-private key to store the component's state.\n */\nconst dataStore = new Date().getTime()\n\n/**\n * @description Component can be instantiated with the new keyword, or extended to create a custom version of the class.\n * @class Class to create a component.\n * @example New instance of Component class:\n * const title = new Component({\n * container: 'header',\n * state: 'World',\n * render: message => Hello, {message}!
\n * })\n * @example Extending Component class:\n * class UserList extends Component {\n * constructor(props) {\n * super(props)\n * this.state = users\n * this.container = 'section'\n * }\n * render(users) {\n * return (\n * \n * {\n * users.map(user => - {user.name}
)\n * }\n *
\n * )\n * }\n * }\n */\nexport class Component {\n /**\n * @constructor\n * @description Constructor for Component class.\n * @property {state} [props.state] The state object of the component. This can be of type boolean, string, number, object or array.\n * @property {string} selector A CSS selector describing the DOM container in which to render the component.\n * @property {HTMLElement} container The DOM node in which the component is rendered.\n * @property {boolean} componentShouldUpdate A flag to determine whether a component can render or not. Setting this to false allows you to maipulate a component's state without triggering and automatic render. After setting to true, you may need to execute `update()` on a component instance to force render it.\n * @property {boolean} mounted A boolean flag that tracks whether a component has been mounted in the DOM or not. This is used internally by Composi, do not touch!\n * @property {Node} element The root or base element of a component's DOM tree. You can use it to register events or as the basis of a component-specific DOM query.\n * @method componentWillMount A callback that is called before a component is mounted in the DOM.\n * @method componentDidMount A callback that is called after a component is mounted in the DOM. Use this to register events, query the component DOM, etc.\n * @method componentWillUpdate A callback that is called before a component is updated. This is not called the first time a component is rendered.\n * @method componentDidUpdate A callback that is called after a component is updated. This is not called the first time a component is rendered.\n * @method componentWillUnmount A callback that is called before a component is unmounted from the DOM. Use this for any environmental cleanup.\n * @method render A method that returns nodes to render to the DOM.¸\n * @method update A method that renders the component template with provided data to the DOM. Data may be provided directly as the primary argument, or it can be derived from the component's state. Data provided as an argument will override use of component state.\n * @method unmount A method to unmount a component from the DOM. This deletes the DOM tree structure starting from the component's base element, and sets the component instance properties to null.\n * @constructs Component\n */\n constructor(props) {\n if (!props) props = {}\n /**\n * @property {Object} props An object literal of options passed to the class constructor during initialization.\n */\n this.props = props\n /**\n * @property {string | HTMLElement} container The HTML element in which the component gets rendered. This can be a CSS selector describing the container or a DOM node reference.\n */\n this.selector = props.container || 'body'\n\n if (props.render) {\n /**\n * @property {Function} render A method to convert markup into DOM nodes to inject in the document. The method itself gets provided at init time by a function provided by the user as an argument, or in the case of extending, a method defined directly on the class extension.\n */\n this.render = props.render\n }\n\n if (props.state) {\n /**\n * @property {boolean | number | string | Object | any[]}\n */\n this.state = props.state\n }\n\n if (this.selector) {\n /**\n * @property {HTMLElement} container The HTML element in which the component gets rendered.\n */\n this.container = document.querySelector(this.selector)\n }\n\n /**\n * @property {boolean} componentShouldUpdate Determines whether a component should update. Set `componentShouldUpdate` to `false`, make changes, then set `componentShouldUpdate` to `true` and update component with `update` method.\n */\n this.componentShouldUpdate = true\n\n /**\n * @property {boolean} mounted Indicates whether a component is mounted in the DOM or not. This is used internally, so do not change!\n */\n this.mounted = false\n\n /**\n * @property {HTMLElement} this.element\n * @property {Object} this.element.vnode\n */\n this.element = null\n\n if (props.componentWillMount)\n /**\n * @property {() => void} componentWillMount A method to execute before the component mounts. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentWillMount = props.componentWillMount\n\n if (props.componentDidMount)\n /**\n * @property {() => void} componentDidMount A method to execute after the component mounts. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentDidMount = props.componentDidMount\n\n if (props.componentWillUpdate)\n /**\n * @property {() => void} componentWillUpdate A method to execute before the component updates. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentWillUpdate = props.componentWillUpdate\n\n if (props.componentDidUpdate)\n /**\n * @property {() => void} componentDidUpdate -A method to execute after the component updates. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentDidUpdate = props.componentDidUpdate\n\n if (props.componentWillUnmount)\n /**\n * @property {() => void} componentWillUnmount A method to execute before the component unmounts. The callback gets a reference to the component instance as its argument.\n * @returns {void} undefined\n */\n this.componentWillUnmount = props.componentWillUnmount\n }\n\n /**\n * @method A method to execute before the component mounts.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentWillMount(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to execute after the component mounts.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentDidMount(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to execute before the component updates.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentWillUpdate(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to execute after the component updates.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentDidUpdate(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to execute after the component updates.\n * @param {() => void} [cb] A callback to execute.\n * @returns {void} undefined\n */\n componentWillUnmount(cb) {\n if (cb && typeof cb === 'function') {\n cb.call(cb, this)\n }\n }\n\n /**\n * @method A method to create a virtual node from data and markup. The returned virtual node will get converted into a node that gets injected in the DOM.\n * @param {*} data\n */\n render(data) {\n return data\n }\n /** End of type stubs */\n\n /**\n * @method This is getter to access the component's state using the pseudo-private key dataStore.\n * @returns {boolean | number | string | Object | any[]} The component's state\n */\n get state() {\n return this[dataStore]\n }\n\n /**\n * @method This is a setter to define the component's state. It uses the dataStore object as a pseudo-private key. It uses requestAnimationFrame to throttle component updates to avoid layout thrashing.\n * @param {string | number | boolean | Object | any[]} data Data to set as component state.\n * @returns {void} undefined\n */\n set state(data) {\n this[dataStore] = data\n rAF(() => this.update())\n }\n\n /**\n * @method Method to set a component's state. This accepts simple types or Objects. If updating an array, you can pass in the data and the position (number) in the array to update. Optionally you can pass a callback, which receives the state as its argument. You need to return the state changes in order to update the component's state.\n * @example\n * this.setState(true)\n * this.setState(0)\n * this.setState({name: 'Joe'})\n * this.setState([1,2,3])\n * this.setState(prevState => prevState + 1)\n * @param {string | number | boolean | Object | any[] | Function} data The data to set. If a callback is passed as the argument to execute, it gets passed the previous state as its argument. You need to make sure the callback returns the final state or the component will not update.\n * @returns {void} undefined\n */\n setState(data) {\n handleSetState(data, this)\n }\n\n /**\n * @method Function to render component after data changes.\n * If data is passed as argument, it will be used.\n * Otherwise state will be used.\n * @param {boolean | number | string | Object | any[]} [data] By default, data will be the component's current state, otherwise, if data is provided as an argument, that will be used, overriding the state.\n * @returns {void} undefined\n */\n update(data) {\n updateComponent(data, this)\n }\n\n /**\n * @method Method to destroy a component.\n * First unbind events.\n * Then remove component element from DOM.\n * Also null out component properties.\n * @returns {void} undefined\n */\n unmount() {\n unmountComponent(this)\n }\n}\n","import { mixin } from '../mixin'\nimport { isObject } from '../componentHelpers/isObject'\n\n/**\n * @function A helper function for the Component class. This sets state on the class component provided.\n * @param {*} data Data to use as state.\n * @param {import('../../component').Component} component A reference to the component to use.\n */\nexport function handleSetState(data, component) {\n if (typeof data === 'function') {\n const state = data.call(component, component.state)\n if (state) component.state = state\n } else if (isObject(component.state) && isObject(data)) {\n const state = component.state\n component.state = mixin(state, data)\n } else {\n component.state = data\n }\n}","import { eventWhitelist } from './eventWhitelist'\n\n/**\n * @description This function will unmount the provided component. Doing so it unregisters a whitelist of events, deletes the base element of the component from the DOM, and sets the component instance properties to null.\n * @param {import('../../component').Component} component \n */\nexport function unmountComponent(component) {\n if (!component.element) return\n component.componentWillUnmount && component.componentWillUnmount()\n eventWhitelist.map(event => {\n component.element.removeEventListener(event, component)\n })\n component.container.removeChild(component.element)\n component.container = null\n for (let key in component) {\n delete component[key]\n }\n delete component.state\n component.update = null\n component.unmount = null\n}\n","// import {vnode} from './utils/vnode'\n/**\n * @typedef {Object} VNode;\n * @property {string | Function} VNode.type;\n * @property {any[]} VNode.children;\n * @property {string | number | null} VNode.key;\n * @property {Object. } VNode.props;\n */\n/**\n * @description Hyperscript function. Enables definition of HTML/SVG using functions.\n * @param {string | Function} type A tag name or function.\n * @param {Object} [props] An Object literal of key-value pairs.\n * @param {any[]} children An array of strings or other arrays.\n * @returns {VNode} VNode An object literal of type, props and children.\n *\n * @example Virtual node with string as content:\n * const title = h('h1', {class: 'main-title'}, 'This is the Titel!')\n * @example Virtual node with children:\n * const list = h(\n * 'ul',\n * {class: 'list'},\n * [\n * h('li', {}, 'One'),\n * h('li', {}, 'Two'),\n * h('li', {}, 'Three')\n * ]\n * )\n */\nexport function h(type, props, ...children) {\n const nodes = []\n const childNodes = []\n let length = children.length\n props = props || {}\n let key = props.key || null\n\n // Remove key from props if present:\n delete props.key\n\n while (length-- > 0) nodes.push(children[length])\n\n while (nodes.length) {\n const node = nodes.pop()\n if (node && node.pop) {\n for (length = node.length; length--; ) {\n nodes.push(node[length])\n }\n } else if (node != null && node !== true && node !== false) {\n childNodes.push(node)\n }\n }\n\n children = childNodes\n\n if (typeof type === 'function') {\n return type(props || {}, childNodes)\n } else {\n return {\n type,\n props,\n children,\n key\n }\n }\n}\n","import { patch } from './patch'\nimport { FragmentError } from './utils/fragmentError'\n\n/**\n * @description A function to create and inject a virtual node into the document. The node will be appended to the container. The first argument can be either a JSX tag or an h function. After mounting, use the render function and the element returned by mount to udate the DOM.\n * @example Insert Title tag into section:\n * const title = mount(, 'section').\n * // Update the node with new prop value and reference to DOM from mount:\n * render(, title)\n * @param {Object | Function} tag A JSX tag or hyperscript function to render.\n * @param {Node | string} [container] The element into which the tag will be rendered.\n * @param {HTMLElement} [elementToHydrate] A server-rendered element to hydrate during initial load.\n * @returns {Node} The base element of the rendered tag.\n */\nexport const mount = (tag, container, elementToHydrate) => {\n container = typeof container === 'string' && document.querySelector(container)\n if (!container) container = document.body\n if (Array.isArray(tag)) throw new FragmentError()\n const element = patch(tag)\n if (tag.props && tag.props['onComponentDidMount']) {\n tag.props['onComponentDidMount'].call(\n tag.props['onComponentDidMount'],\n element\n )\n }\n element['mounted'] = true\n if (elementToHydrate) {\n if (typeof elementToHydrate === 'string') {\n elementToHydrate = document.querySelector(elementToHydrate)\n }\n if (elementToHydrate.nextElementSibling) {\n elementToHydrate.parentNode.insertBefore(\n element,\n elementToHydrate.nextElementSibling\n )\n elementToHydrate.parentNode.removeChild(elementToHydrate)\n return element\n } else {\n elementToHydrate.parentNode.appendChild(element)\n elementToHydrate.parentNode.removeChild(elementToHydrate)\n return element\n }\n } else {\n return container.appendChild(element)\n }\n}\n","/**\n * Class to throw error message when attempting to insert Fragement tag directly into DOM.\n */\nexport class FragmentError {\n constructor() {\n this.message = 'Cannot insert Fragment tag directly into DOM.'\n this.toString = function() {\n return this.message\n }\n }\n}\n","import { patch } from './patch'\n\n/**\n * @description A function to update a functional component already mounted in the DOM. The first argument can be either a JSX tag or an h function.\n * @example Update Title tag into section:\n * const element = mount(, 'section')\n * // Pass the captured element to the render function:\n * render(, 'header')\n * @param {() => import('./h').VNode} tag A JSX tag or hyperscript function to render.\n * @param {Node} [element] The element in the DOM which will be updated.\n * @returns {Node} The base element of the rendered tag.\n */\nexport function render(tag, element) {\n return patch(tag, element)\n}\n","/**\n * @description A tag to enable returning sibling elements. This is useful for returning list items to render in a list or table cells to render in a table row.\n * @example\n * \n * A\n * B\n * C\n * \n * Or functionally:\n * Fragment(null, [\n * h('li', {}, 'A'),\n * h('li', {}, 'B'),\n * h('li', {}, 'C')\n * ])\n * @param {Object} [props] When using Fragment as a function, props is the first argument. Provide either null or {} as the value for props.\n * @param {import('./h').VNode[]} [children] The siblings to return with the Fragment. This will be an array of sibling elements.\n * @returns {import('./h').VNode[]} An array of virtual nodes.\n */\nexport const Fragment = (props, children) => children\n"],"names":["getKey","node","key","mixin","obj1","obj2","result","i","setProp","element","prop","value","oldValue","isSVG","style","setProperty","toLowerCase","removeElement","parent","removeChild","removeChildren","props","children","length","childNodes","call","createNewElement","oldNode","newElement","createElement","toString","document","createTextNode","type","createElementNS","appendChild","insertBefore","patchElement","newNode","nodeValue","oldProps","oldKeyed","newKeyed","oldElements","oldChildren","oldKey","j","newKey","keyedNode","k","patch","parentNode","rAF","window","requestAnimationFrame","cb","setTimeout","isObject","obj","Array","isArray","updateComponent","data","component","render","componentShouldUpdate","mounted","__data","state","container","selector","querySelector","vdom","elem","id","__oldNode","vnode","JSON","stringify","componentWillMount","nodeType","error","componentDidMount","componentWillUpdate","componentDidUpdate","eventWhitelist","dataStore","Date","getTime","Component","this","componentWillUnmount","map","removeEventListener","event","update","unmount","_this","nodes","push","pop","tag","elementToHydrate","body","message","nextElementSibling"],"mappings":"0LAKA,IAAaA,EAAS,mBAASC,EAAOA,EAAKC,IAAM,MCCjD,SAAgBC,EAAMC,EAAMC,OACpBC,SACD,IAAIC,KAAKH,IACLG,GAAKH,EAAKG,OAEd,IAAIA,KAAKF,IACLE,GAAKF,EAAKE,UAEZD,ECAT,SAAgBE,EAAQC,EAASC,EAAMC,EAAOC,EAAUC,GCPxD,IAAgCJ,EAAeE,ECAcA,ECF7BD,EHYnB,QAATA,GACS,wBAATA,GACS,yBAATA,GACS,2BAATA,IAGkB,UAATA,GAAqC,iBAAVC,EIbxC,SAA6BF,EAASC,EAAMC,EAAOC,OAC5C,IAAIL,KAAKJ,EAAMS,EAAUD,GAAQ,KAC9BG,EAAiB,MAATH,GAA6B,MAAZA,EAAMJ,GAAa,GAAKI,EAAMJ,GAChD,MAATA,EAAE,KACIG,GAAMK,YAAYR,EAAGO,KAErBJ,GAAM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B,EAAMnB,IAENqB,KAAW,KAAS4E,KAAK7E,EAASC,IAEzC,KAAO2E,EAAM3E,QAAQ,KACbtB,EAAOiG,EAAME,SACfnG,GAAQA,EAAKmG,QACV7E,EAAStB,EAAKsB,OAAQA,OACnB4E,KAAKlG,EAAKsB,SAED,MAARtB,IAAyB,IAATA,IAA0B,IAATA,KAC/BkG,KAAKlG,YAITuB,EAES,mBAATS,EACFA,EAAKZ,MAAaG,8CCxCR,SAAC6E,EAAKhC,EAAWiC,SACH,iBAAdjC,GAA0BtC,SAASwC,cAAcF,MACpDA,EAAYtC,SAASwE,MACjC5C,MAAMC,QAAQyC,GAAM,MAAM,ICb9B,4BACOG,QAAU,qDACV1E,SAAW,kBACP4D,KAAKc,cDWV/F,EAAUyC,EAAMmD,UAClBA,EAAIhF,OAASgF,EAAIhF,MAAJ,uBACXA,MAAJ,oBAAiCI,KAC/B4E,EAAIhF,MAAJ,oBACAZ,KAGJ,SAAqB,EACjB6F,GAC8B,iBAArBA,MACUvE,SAASwC,cAAc+B,IAExCA,EAAiBG,sBACFtD,WAAWf,aAC1B3B,EACA6F,EAAiBG,sBAEFtD,WAAWhC,YAAYmF,GACjC7F,MAEU0C,WAAWhB,YAAY1B,KACvB0C,WAAWhC,YAAYmF,GACjC7F,IAGF4D,EAAUlC,YAAY1B,aE/BjC,SAAuB4F,EAAK5F,UACnByC,EAAMmD,EAAK5F,6BCKI,SAACY,EAAOC,UAAaA"}
\ No newline at end of file
diff --git a/lib/component.js b/lib/component.js
index 6383425..0b20967 100644
--- a/lib/component.js
+++ b/lib/component.js
@@ -4,8 +4,8 @@ import { updateComponent } from './utils/componentHelpers/updateComponent'
import { unmountComponent } from './utils/componentHelpers/unmountComponent'
/**
- * @description This is a Time object used as a key to create a pseudo-private property in the Component class for holding state.
- * @type {Object} dataStore A Date object to use as pseudo-private key to store the component's state.
+ * @description This is a numeric value derived from the Date object used as a key to create a pseudo-private property in the Component class for holding state.
+ * @type {number} dataStore A numeric value to use as pseudo-private key to store the component's state.
*/
const dataStore = new Date().getTime()
diff --git a/lib/h.js b/lib/h.js
index cc6eca8..a056319 100755
--- a/lib/h.js
+++ b/lib/h.js
@@ -4,7 +4,7 @@
* @property {string | Function} VNode.type;
* @property {any[]} VNode.children;
* @property {string | number | null} VNode.key;
- * @property {Object. } VNode.props;
+ * @property {Object. } VNode.props;
*/
/**
* @description Hyperscript function. Enables definition of HTML/SVG using functions.
diff --git a/lib/render.js b/lib/render.js
index f4fdcd2..02ddf1b 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -6,7 +6,7 @@ import { patch } from './patch'
* const element = mount(, 'section')
* // Pass the captured element to the render function:
* render(, 'header')
- * @param {Function} tag A JSX tag or hyperscript function to render.
+ * @param {() => import('./h').VNode} tag A JSX tag or hyperscript function to render.
* @param {Node} [element] The element in the DOM which will be updated.
* @returns {Node} The base element of the rendered tag.
*/
diff --git a/lib/utils/componentHelpers/eventWhitelist.js b/lib/utils/componentHelpers/eventWhitelist.js
index 5170007..d93f645 100644
--- a/lib/utils/componentHelpers/eventWhitelist.js
+++ b/lib/utils/componentHelpers/eventWhitelist.js
@@ -25,4 +25,4 @@ export const eventWhitelist = [
'touchend',
'touchmove',
'touchstart'
-]
\ No newline at end of file
+]
diff --git a/lib/utils/componentHelpers/isObject.js b/lib/utils/componentHelpers/isObject.js
index 5f1b0a9..3a0ce54 100644
--- a/lib/utils/componentHelpers/isObject.js
+++ b/lib/utils/componentHelpers/isObject.js
@@ -1,6 +1,6 @@
/**
* @description A function to test where something is an object literal or not. Used by Component setState.
- * @param {Object} obj An object literal to test.
+ * @param {Object.} obj An object literal to test.
* @returns boolean
*/
export function isObject(obj) {
diff --git a/lib/utils/componentHelpers/updateComponent.js b/lib/utils/componentHelpers/updateComponent.js
index b9e014f..0a42051 100644
--- a/lib/utils/componentHelpers/updateComponent.js
+++ b/lib/utils/componentHelpers/updateComponent.js
@@ -3,7 +3,7 @@ import { patch } from '../../patch'
/**
* @description This function updates an already rendered component. In doing so it checks to see if user provided data as an argument to this function. If data was provided, it uses that to render the component. Otherwise it checks if the component has state. If true, the function uses that to render the component. If no data was provided and the component is stateless, nothing will happen.
- * @param {boolean | number | string | Object | any[]} data
+ * @param {boolean | number | string | Object. | any[]} data
* @param {import('../../component').Component} component
*/
export function updateComponent(data, component) {
@@ -27,7 +27,7 @@ export function updateComponent(data, component) {
// Create virtual dom and check if component id
// already exists in document.
/**
- * @type {Object | null}
+ * @type {Object. | null}
*/
const vdom = component.render(__data)
let elem
diff --git a/lib/utils/mixin.js b/lib/utils/mixin.js
index 3e93138..719ae4b 100644
--- a/lib/utils/mixin.js
+++ b/lib/utils/mixin.js
@@ -1,8 +1,8 @@
/**
* @description A function to merge two objects together. The properties of the second object will overwrite any matching properties in the first object.
- * @param {Object} obj1 The first object to merge.
- * @param {Object} obj2 The second object to merge.
- * @returns {Object} Returns a new object of the second object merged with the first.
+ * @param {Object.} obj1 The first object to merge.
+ * @param {Object.} obj2 The second object to merge.
+ * @returns {Object.} Returns a new object of the second object merged with the first.
*/
export function mixin(obj1, obj2) {
const result = {}
diff --git a/lib/utils/patchElement.js b/lib/utils/patchElement.js
index 1536b20..2cfb70c 100755
--- a/lib/utils/patchElement.js
+++ b/lib/utils/patchElement.js
@@ -9,7 +9,7 @@ import { removeOldKeyedElements } from './patchElementHelpers/removeOldKeyedElem
/**
* @description A function to diff and patch a DOM node with a virtual node.
* @param {Node} parent The parent node of the elment being patched.
- * @param {HTMLElement | Node} element The element being patched.
+ * @param {Node} element The element being patched.
* @param {Object} oldNode A virtual dom newNode from the previous patch.
* @param {Object} newNode The current virtual dom node.
* @param {boolean} [isSVG] Whether we are dealing with an SVG element or not.
diff --git a/lib/utils/patchElementHelpers/createElement.js b/lib/utils/patchElementHelpers/createElement.js
index 954c05f..65edea0 100755
--- a/lib/utils/patchElementHelpers/createElement.js
+++ b/lib/utils/patchElementHelpers/createElement.js
@@ -2,7 +2,7 @@ import { setProp } from '../setProp'
/**
* @description Function to convert hyperscript/JSX into DOM nodes.
- * @param {Object | string} node A node to create. This may be a hyperscript function or a JSX tag which gets converted to hyperscript during transpilation.
+ * @param {string | number | Object} node A node to create. This may be a hyperscript function or a JSX tag which gets converted to hyperscript during transpilation.
* @param {boolean} [isSVG] Whether the node is SVG or not.
* @returns {Node} An element created from a virtual dom object.
*/
diff --git a/lib/utils/patchElementHelpers/removeElement.js b/lib/utils/patchElementHelpers/removeElement.js
index d9fe6af..7880ee6 100755
--- a/lib/utils/patchElementHelpers/removeElement.js
+++ b/lib/utils/patchElementHelpers/removeElement.js
@@ -5,7 +5,7 @@ import { removeChildren } from './removeChildren'
* @param {Node} parent The containing element in which the component resides.
* @param {Node} element The parent of the element to remove.
* @namespace {Node} node The element to remove.
- * @property {Object} node.props
+ * @property {Object.} node.props
* @returns {void} undefined
*/
export const removeElement = (parent, element, node) => {
diff --git a/lib/utils/patchElementHelpers/removeOldKeyedElements.js b/lib/utils/patchElementHelpers/removeOldKeyedElements.js
index d5d3dd2..202c28b 100644
--- a/lib/utils/patchElementHelpers/removeOldKeyedElements.js
+++ b/lib/utils/patchElementHelpers/removeOldKeyedElements.js
@@ -3,8 +3,8 @@ import { removeElement } from '../patchElementHelpers/removeElement'
/**
* @description Remove old keyed elements.
* @param {Node} element
- * @param {Object} oldKeyed
- * @param {Object} newKeyed
+ * @param {Object.} oldKeyed
+ * @param {Object.} newKeyed
* @returns {void} undefined
*/
export function removeOldKeyedElements(element, oldKeyed, newKeyed) {
diff --git a/lib/utils/patchElementHelpers/trackOldElements.js b/lib/utils/patchElementHelpers/trackOldElements.js
index 5f5be46..314c2aa 100644
--- a/lib/utils/patchElementHelpers/trackOldElements.js
+++ b/lib/utils/patchElementHelpers/trackOldElements.js
@@ -5,7 +5,7 @@ import { getKey } from '../patchElementHelpers/getKey'
* @param {Node} element
* @param {Node[]} oldElements
* @param {Node[]} oldChildren
- * @param {Object} oldKeyed
+ * @param {Object.} oldKeyed
* @returns {void} undefined
*/
export function trackOldElements(element, oldElements, oldChildren, oldKeyed) {
diff --git a/lib/utils/patchElementHelpers/updateElement.js b/lib/utils/patchElementHelpers/updateElement.js
index 2a27837..b277521 100755
--- a/lib/utils/patchElementHelpers/updateElement.js
+++ b/lib/utils/patchElementHelpers/updateElement.js
@@ -3,9 +3,9 @@ import { setProp } from '../setProp'
/**
* @description A function to update an element based on a virtual dom node.
- * @param {HTMLElement} element
- * @param {import('../../h').VNode} oldProps The original props used to create the element.
- * @param {import('../../h').VNode} props New props generated by the virtual dom.
+ * @param {Node} element
+ * @param {Object} oldProps The original props used to create the element.
+ * @param {Object} props New props generated by the virtual dom.
* @param {boolean} isSVG Whether we are dealing with SVG or not.
* @function {function(element: Node, oldProps: VNode, props: VNode,isSVG: boolean): void}
* @returns {void} undefined
diff --git a/lib/utils/rAF.js b/lib/utils/rAF.js
index 82cddbb..ef5b883 100644
--- a/lib/utils/rAF.js
+++ b/lib/utils/rAF.js
@@ -1,7 +1,7 @@
/**
* @description A cross-browser normalization/polyfill for requestAnimationFrame.
* @param {Function} cb A callback to execute.
- * @returns {any} The result of the callback.
+ * @returns {number} The request id, that uniquely identifies the entry in the browser's callback list.
*/
export const rAF =
(window && window.requestAnimationFrame) ||
diff --git a/lib/utils/setProp.js b/lib/utils/setProp.js
index 883919b..21a739c 100755
--- a/lib/utils/setProp.js
+++ b/lib/utils/setProp.js
@@ -5,10 +5,10 @@ import { handleXlinkHref } from './setPropHelpers/handleXlinkHref'
/**
* @description Function to set properties and attributes on element.
- * @param {HTMLElement} element The element to set props on.
+ * @param {Node} element The element to set props on.
* @param {string} prop The property/attribute.
- * @param {string} value The value of the prop.
- * @param {string} oldValue The original value of the prop.
+ * @param {string | number | boolean} value The value of the prop.
+ * @param {string | number | boolean} oldValue The original value of the prop.
* @param {boolean} isSVG Whether this is SVG or not
* @returns {void} undefined
*/
@@ -49,7 +49,7 @@ export function setProp(element, prop, value, oldValue, isSVG) {
if (value === 'true') value = ''
// Set prop as attribute, except dangerouslySetInnerHTML:
if (prop !== 'dangerouslysetinnerhtml')
- element.setAttribute(prop, value)
+ element['setAttribute'](prop, value)
}
}
@@ -61,7 +61,7 @@ export function setProp(element, prop, value, oldValue, isSVG) {
value === 'no' ||
value === 'off'
) {
- element.removeAttribute(prop)
+ element['removeAttribute'](prop)
}
}
}
diff --git a/lib/utils/setPropHelpers/handleDangerouslySetInnerHTML.js b/lib/utils/setPropHelpers/handleDangerouslySetInnerHTML.js
index cadfe37..52eee90 100644
--- a/lib/utils/setPropHelpers/handleDangerouslySetInnerHTML.js
+++ b/lib/utils/setPropHelpers/handleDangerouslySetInnerHTML.js
@@ -1,12 +1,12 @@
/**
* @description Enable setting innerHTML as a prop.
- * @param {HTMLElement} element
+ * @param {Node} element
* @param {string} prop
* @param {string | number | boolean | any[] | Object} value
* @returns {void} undefined
*/
export function handleDangerouslySetInnerHTML(element, prop, value) {
if (prop === 'dangerouslysetinnerhtml') {
- element.innerHTML = value
+ element['innerHTML'] = value
}
}
diff --git a/lib/utils/setPropHelpers/handleStyles.js b/lib/utils/setPropHelpers/handleStyles.js
index f903411..ea65b36 100644
--- a/lib/utils/setPropHelpers/handleStyles.js
+++ b/lib/utils/setPropHelpers/handleStyles.js
@@ -2,10 +2,10 @@ import { mixin } from '../mixin'
/**
* @description Handle styles defined as object literals.
- * @param {HTMLElement} element
+ * @param {Node} element
* @param {string} prop
- * @param {string | number | boolean | any[] | Object} value
- * @param {string | number | boolean | any[] | Object} oldValue
+ * @param {any} value
+ * @param {any} oldValue
* @returns {void} undefined
*/
export function handleStyles(element, prop, value, oldValue) {
diff --git a/lib/utils/setPropHelpers/handleXlinkHref.js b/lib/utils/setPropHelpers/handleXlinkHref.js
index 5f33915..c826821 100644
--- a/lib/utils/setPropHelpers/handleXlinkHref.js
+++ b/lib/utils/setPropHelpers/handleXlinkHref.js
@@ -1,11 +1,11 @@
/**
* @description Enable setting xlink href value for browser that only support SVG 1.0.
- * @param {HTMLElement} element
+ * @param {Node} element
* @param {string} prop
* @param {string | number | boolean | any[] | Object} value
* @returns {void} undefined
*/
export function handleXlinkHref(element, prop, value) {
- element.setAttributeNS('http://www.w3.org/1999/xlink', 'href', value)
- element.setAttribute('href', value)
+ element['setAttributeNS']('http://www.w3.org/1999/xlink', 'href', value)
+ element['setAttribute']('href', value)
}
diff --git a/package-lock.json b/package-lock.json
index 04000e2..e51da3f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "composi",
- "version": "2.4.6",
+ "version": "2.4.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 65edda6..56528c6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "composi",
- "version": "2.4.6",
+ "version": "2.4.7",
"description": "A JavaScript library for creating websites, PWAs and hybrid apps.",
"main": "index.js",
"scripts": {