Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deku

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deku - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

test/component/send.js

2

bower.json
{
"name": "deku",
"version": "0.0.13",
"version": "0.0.14",
"main": "dist/deku.js"
}
{
"name": "deku",
"version": "0.0.13",
"version": "0.0.14",
"dependencies": {

@@ -5,0 +5,0 @@ "component/each": "0.2.5",

@@ -1,1 +0,1 @@

!function(t){"object"==typeof exports?module.exports=t("1"):"function"==typeof define&&define.amd?define(function(){return t("1")}):this.deku=t("1")}(function t(e,n,r){function o(t){if(n[t])return n[t].exports;if(e[t])return i(t,o);throw new Error('cannot find module "'+t+'"')}function i(o,i){var a=n[o]={exports:{}},s=e[o],u=s[2],c=s[0];return c.call(a.exports,function(t){var n=e[o][1][t];return i(n?n:t)},a,a.exports,t,e,n,r),u&&(n[u]=n[o]),n[o].exports}var a=function(){return this}();for(var s in r)r[s]?a[r[s]]=o(s):o(s);return o.duo=!0,o.cache=n,o.modules=e,o}({1:[function(t,e,n){n.component=t("./lib/component"),n.dom=t("./lib/virtual").node},{"./lib/component":2,"./lib/virtual":3}],2:[function(t,e){function n(t){function e(){return this instanceof e?void o(this):u(e,arguments[0],arguments[1])}return t=t||{},"function"==typeof t&&(t={render:t}),t.displayName&&(e.displayName=t.displayName,delete t.displayName),r(e,a,i.prototype),r(e.prototype,s,t,i.prototype),e}var r=t("sindresorhus/object-assign"),o=t("segmentio/bind-all"),i=t("component/emitter"),a=t("./statics"),s=t("./protos"),u=t("../virtual").node;e.exports=n},{"sindresorhus/object-assign":4,"segmentio/bind-all":5,"component/emitter":6,"./statics":7,"./protos":8,"../virtual":3}],4:[function(t,e){"use strict";function n(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=Object.assign||function(t){for(var e,r,o,i=n(t),a=1;a<arguments.length;a++){r=arguments[a],o=Object.keys(Object(r));for(var s=0;s<o.length;s++)try{i[o[s]]=r[o[s]]}catch(u){void 0===e&&(e=u)}}if(e)throw e;return i}},{}],5:[function(t,e){try{var n=t("bind"),r=t("type")}catch(o){var n=t("bind-component"),r=t("type-component")}e.exports=function(t){for(var e in t){var o=t[e];"function"===r(o)&&(t[e]=n(t,t[e]))}return t}},{bind:9,type:10}],9:[function(t,e){var n=[].slice;e.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return e.apply(t,r.concat(n.call(arguments)))}}},{}],10:[function(t,e){var n=Object.prototype.toString;e.exports=function(t){switch(n.call(t)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===t?"null":void 0===t?"undefined":t!==t?"nan":t&&1===t.nodeType?"element":(t=t.valueOf?t.valueOf():Object.prototype.valueOf.apply(t),typeof t)}},{}],6:[function(t,e){function n(t){return t?r(t):void 0}function r(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks[t];if(n){n=n.slice(0);for(var r=0,o=n.length;o>r;++r)n[r].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],7:[function(t,e,n){var r=t("../renderer/string"),o=t("../entity"),i=t("../scene");if("undefined"!=typeof window)var a=t("../renderer/html");n.use=function(t){if("function"==typeof t)t(this);else for(var e in t)this.prototype[e]=t[e];return this},n.render=function(t,e){if(!a)throw new Error("You can only render a DOM tree in the browser. Use renderString instead.");var n=new a(t),r=new o(this,e),s=new i(n,r);return s},n.renderString=function(t){var e=new o(this,t);return r(e)}},{"../renderer/string":11,"../entity":12,"../scene":13,"../renderer/html":14}],11:[function(t,e){function n(t){var e=t.render();return r(e.root,e)}function r(t,e){e.getPath(t);if("text"===t.type)return t.data;if("element"===t.type){for(var i=t.children,s=t.attributes,u=t.tagName,c="<"+u+o(s)+">",p=0,h=i.length;h>p;p++)c+=r(i[p],e);return c+="</"+u+">"}if("component"===t.type)return n(new a(t.component,t.props));throw new Error("Invalid type")}function o(t){var e="";for(var n in t)e+=i(n,t[n]);return e}function i(t,e){return" "+t+'="'+e+'"'}var a=(t("../../virtual"),t("../../entity"));e.exports=n},{"../../virtual":3,"../../entity":12}],3:[function(t,e,n){function r(t,e,n){2!==arguments.length||"string"!=typeof e&&!Array.isArray(e)||(n=e,e={}),n=n||[],e=e||{},Array.isArray(n)||(n=[n]),n=n.map(o);var r=e.key;delete e.key;var s;return s="function"==typeof t?i(t,e,r,n):a(t,e,r,n),s.id=(++c).toString(32),s}function o(t,e){if(("string"==typeof t||"number"==typeof t)&&(t=s(String(t))),Array.isArray(t))throw new Error("Child node cant be an array. This can happen if you try to use props.children like a node.");return t.index=e,t}var i=t("./component"),a=t("./element"),s=t("./text"),u=t("./tree");n.node=r,n.tree=u;var c=0},{"./component":15,"./element":16,"./text":17,"./tree":18}],15:[function(t,e){e.exports=function(t,e,n,r){var o={};return o.key=n,o.props=e,o.type="component",o.component=t,o.props.children=r||[],o}},{}],16:[function(t,e){function n(t){t.style&&(t.style=r(t.style)),t.data&&(t=o(t)),t["class"]&&(t["class"]=i(t["class"]));for(var e in t)t[e]===!1&&delete t[e];return t}function r(t){if("object"!==u(t))return t;var e="";for(var n in t){var r=t[n];e+=n+":"+r+";"}return e}function o(t){if("object"!==u(t.data))return t;for(var e in t.data)t["data-"+e]=t.data[e];return delete t.data,t}function i(t){if("object"===u(t)){var e=[];for(var n in t)t[n]&&e.push(n);t=e}if("array"===u(t)){if(0===t.length)return;t=t.join(" ")}return t}function a(t){var e={};for(var n in c){var r=c[n],o=t[n];o&&(e[r]=o,delete t[n])}return e}function s(t,e){if(!t)return"div";var n=t.split(/([\.#]?[a-zA-Z0-9_:-]+)/),r="div";return n.filter(Boolean).forEach(function(t){var n=t.charAt(0);"."===n?e["class"]=((e["class"]||"")+" "+t.substring(1,t.length)).trim():"#"===n?e.id=t.substring(1,t.length):r=t}),r}var u=t("component/type"),c={onBlur:"blur",onChange:"change",onClick:"click",onContextMenu:"contextmenu",onCopy:"copy",onCut:"cut",onDoubleClick:"dblclick",onDrag:"drag",onDragEnd:"dragend",onDragEnter:"dragenter",onDragExit:"dragexit",onDragLeave:"dragleave",onDragOver:"dragover",onDragStart:"dragstart",onDrop:"drop",onFocus:"focus",onInput:"input",onKeyDown:"keydown",onKeyUp:"keyup",onMouseDown:"mousedown",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onPaste:"paste",onScroll:"scroll",onSubmit:"submit",onTouchCancel:"touchcancel",onTouchEnd:"touchend",onTouchMove:"touchmove",onTouchStart:"touchstart"};e.exports=function(t,e,r,o){var i={};return i.type="element",i.attributes=n(e),i.events=a(e),i.tagName=s(t,e),i.children=o||[],i.key=r,i}},{"component/type":10}],17:[function(t,e){e.exports=function(t){var e={};return e.type="text",e.data=String(t),e}},{}],18:[function(t,e){function n(t){this.root=t,this.paths={},this.nodes={},this.components={},this.parse(t)}e.exports=function(t){return new n(t)},n.prototype.getPath=function(t){return this.paths[t.id]},n.prototype.getNode=function(t){return this.nodes[t]},n.prototype.parse=function(t,e){e=e||"0",this.paths[t.id]=e,this.nodes[e]=t,"component"===t.type&&(this.components[e]=t),t.children&&t.children.forEach(function(t,n){this.parse(t,e+"."+(t.key||n))},this)}},{}],12:[function(t,e){function n(t,e){this.id=(++u).toString(32),this.type=t,this.component=new t,this.component.on("change",this.setState.bind(this)),this.props=e||{},this.state=this.component.initialState(this.props),this.children={},this.current=this.render(),this.previous=null,this.dirty=!1,this.lifecycle=null,this._pendingProps=null,this._pendingState=null,this._propsReplaced=!1}var r=t("sindresorhus/object-assign"),o=t("component/emitter"),i=t("jkroso/equals"),a=t("component/each"),s=t("../virtual"),u=0;e.exports=n,o(n.prototype),n.prototype.render=function(){this.lifecycle="rendering";var t=this.component.render(this.props,this.state);return this.lifecycle=null,t||(t=s.node("noscript")),s.tree(t)},n.prototype.setProps=function(t,e){e&&this.once("update",e),this._pendingProps=r(this._pendingProps||{},t),this.propsChanged(t),this.invalidate()},n.prototype.replaceProps=function(t,e){e&&this.once("update",e),this._propsReplaced=!0,this._pendingProps=t,this.propsChanged(t),this.invalidate()},n.prototype.setState=function(t,e){if("beforeUpdate"===this.lifecycle)throw new Error("You can't call setState in the beforeUpdate hook. Use the propsChanged hook instead.");if("rendering"===this.lifecycle)throw new Error("You can't call setState in the render hook. This method must remain pure.");e&&this.once("update",e),this._pendingState=r(this._pendingState||{},t),this.invalidate()},n.prototype.invalidate=function(){this.dirty=!0,this.scene&&(this.scene.dirty=!0)},n.prototype.addChild=function(t,e,r){var o=new n(e,r);return this.children[t]=o,o.addToScene(this.scene),o},n.prototype.getChild=function(t){return this.children[t]},n.prototype.getPath=function(t){return this.current.getPath(t)},n.prototype.addToScene=function(t){this.scene=t},n.prototype.removeChild=function(t){var e=this.children[t];return e.scene=null,delete this.children[t],e},n.prototype.shouldUpdate=function(t,e){return e&&!i(e,this.props)?!0:t&&!i(t,this.state)?!0:!1},n.prototype.update=function(){var t;this._propsReplaced?(t=this._pendingProps,this._propsReplaced=!1):t=r({},this.props,this._pendingProps);var e=r({},this.state,this._pendingState);if(!this.shouldUpdate(e,t))return!1;this.beforeUpdate(e,t);this.state,this.props;return this.state=e,this.props=t||this.props,this._pendingState=null,this._pendingProps=null,delete this.state.__force__,!0},n.prototype.setCurrent=function(t){this.previous=this.current,this.current=t,this.dirty=!1},n.prototype.remove=function(){this.off(),a(this.children,function(t,e){e.remove()}),this.children={}},n.prototype.beforeUpdate=function(t,e){this.lifecycle="beforeUpdate",this.component.beforeUpdate(this.props,this.state,e,t),this.type.emit("beforeUpdate",this.component,this.props,this.state,e,t),this.lifecycle=null},n.prototype.afterUpdate=function(t,e){this.emit("update"),this.component.afterUpdate(this.props,this.state,e,t),this.type.emit("afterUpdate",this.component,this.props,this.state,e,t)},n.prototype.beforeUnmount=function(t){this.component.beforeUnmount(t,this.props,this.state),this.type.emit("beforeUnmount",this.component,t,this.props,this.state)},n.prototype.afterUnmount=function(){this.component.afterUnmount(this.props,this.state),this.type.emit("afterUnmount",this.component,this.props,this.state)},n.prototype.beforeMount=function(){this.component.beforeMount(this.props,this.state),this.type.emit("beforeMount",this.component,this.props,this.state)},n.prototype.afterMount=function(t){this.component.afterMount(t,this.props,this.state),this.type.emit("afterMount",this.component,t,this.props,this.state)},n.prototype.propsChanged=function(t){this.component.propsChanged(t,this.props,this.state),this.type.emit("propsChanged",this.component,t,this.props,this.state)}},{"sindresorhus/object-assign":4,"component/emitter":6,"jkroso/equals":19,"component/each":20,"../virtual":3}],19:[function(t,e){function n(t,e,n){if(t===e)return!0;var r=u[s(t)],o=u[s(e)];return r&&r===o?r(t,e,n):!1}function r(t){return function(e,n,r){if(!r)return t(e,n,[]);for(var o,i=r.length;o=r[--i];)if(o[0]===e&&o[1]===n)return!0;return t(e,n,r)}}function o(t,e,r){var o=t.length;if(o!==e.length)return!1;for(r.push([t,e]);o--;)if(!n(t[o],e[o],r))return!1;return!0}function i(t,e,r){if("function"==typeof t.equal)return r.push([t,e]),t.equal(e,r);var o=a(t),i=a(e),s=o.length;if(s!==i.length)return!1;for(o.sort(),i.sort();s--;)if(o[s]!==i[s])return!1;for(r.push([t,e]),s=o.length;s--;){var u=o[s];if(!n(t[u],e[u],r))return!1}return!0}function a(t){var e=[];for(var n in t)"constructor"!==n&&e.push(n);return e}var s=t("type"),u={};u.number=function(t,e){return t!==t&&e!==e},u["function"]=function(t,e,r){return t.toString()===e.toString()&&u.object(t,e,r)&&n(t.prototype,e.prototype)},u.date=function(t,e){return+t===+e},u.regexp=function(t,e){return t.toString()===e.toString()},u.element=function(t,e){return t.outerHTML===e.outerHTML},u.textnode=function(t,e){return t.textContent===e.textContent},u.arguments=u.array=r(o),u.object=r(i),e.exports=n},{type:21}],21:[function(t,e,n){var r={}.toString,o="undefined"!=typeof window?window.Node:Function;e.exports=n=function(t){var e=typeof t;if("object"!=e)return e;if(e=i[r.call(t)])return e;if(t instanceof o)switch(t.nodeType){case 1:return"element";case 3:return"text-node";case 9:return"document";case 11:return"document-fragment";default:return"dom-node"}};var i=n.types={"[object Function]":"function","[object Date]":"date","[object RegExp]":"regexp","[object Arguments]":"arguments","[object Array]":"array","[object String]":"string","[object Null]":"null","[object Undefined]":"undefined","[object Number]":"number","[object Boolean]":"boolean","[object Object]":"object","[object Text]":"text-node","[object Uint8Array]":"bit-array","[object Uint16Array]":"bit-array","[object Uint32Array]":"bit-array","[object Uint8ClampedArray]":"bit-array","[object Error]":"error","[object FormData]":"form-data","[object File]":"file","[object Blob]":"blob"}},{}],20:[function(t,e){function n(t,e,n){for(var r=0;r<t.length;++r)e.call(n,t.charAt(r),r)}function r(t,e,n){for(var r in t)u.call(t,r)&&e.call(n,r,t[r])}function o(t,e,n){for(var r=0;r<t.length;++r)e.call(n,t[r],r)}try{var i=t("type")}catch(a){var i=t("component-type")}var s=t("to-function"),u=Object.prototype.hasOwnProperty;e.exports=function(t,e,a){switch(e=s(e),a=a||this,i(t)){case"array":return o(t,e,a);case"object":return"number"==typeof t.length?o(t,e,a):r(t,e,a);case"string":return n(t,e,a)}}},{type:22,"component-type":22,"to-function":23}],22:[function(t,e){var n=Object.prototype.toString;e.exports=function(t){switch(n.call(t)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}return null===t?"null":void 0===t?"undefined":t&&1===t.nodeType?"element":t===Object(t)?"object":typeof t}},{}],23:[function(t,e){function n(t){switch({}.toString.call(t)){case"[object Object]":return a(t);case"[object Function]":return t;case"[object String]":return i(t);case"[object RegExp]":return o(t);default:return r(t)}}function r(t){return function(e){return t===e}}function o(t){return function(e){return t.test(e)}}function i(t){return/^ *\W+/.test(t)?new Function("_","return _ "+t):new Function("_","return "+s(t))}function a(t){var e={};for(var o in t)e[o]="string"==typeof t[o]?r(t[o]):n(t[o]);return function(t){if("object"!=typeof t)return!1;for(var n in e){if(!(n in t))return!1;if(!e[n](t[n]))return!1}return!0}}function s(t){var e=c(t);if(!e.length)return"_."+t;var n,r,o;for(r=0;r<e.length;r++)o=e[r],n="_."+o,n="('function' == typeof "+n+" ? "+n+"() : "+n+")",t=u(o,t,n);return t}function u(t,e,n){return e.replace(new RegExp("(\\.)?"+t,"g"),function(t,e){return e?t:n})}var c;try{c=t("props")}catch(p){c=t("component-props")}e.exports=n},{props:24,"component-props":24}],24:[function(t,e){function n(t){return t.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(a,"").match(/[$a-zA-Z_]\w*/g)||[]}function r(t,e,n){var r=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return t.replace(r,function(t){return"("==t[t.length-1]?n(t):~e.indexOf(t)?n(t):t})}function o(t){for(var e=[],n=0;n<t.length;n++)~e.indexOf(t[n])||e.push(t[n]);return e}function i(t){return function(e){return t+e}}var a=/\b(this|Array|Date|Object|Math|JSON)\b/g;e.exports=function(t,e){var a=o(n(t));return e&&"string"==typeof e&&(e=i(e)),e?r(t,a,e):a}},{}],13:[function(t,e){function n(t,e){this.tick=this.update.bind(this),this.renderer=t,this.dirty=!0,this.entity=e,e.addToScene(this),this.update(),this.resume()}var r=t("./loop"),o=t("component/emitter");e.exports=n,o(n.prototype),n.prototype.update=function(){this.dirty&&(this.dirty=!1,this.renderer.render(this.entity),this.emit("update"))},n.prototype.setProps=function(t,e){e&&this.once("update",e),this.entity.setProps(t);var n=this;return"undefined"!=typeof Promise?new Promise(function(t){n.once("update",function(){t()})}):void 0},n.prototype.replaceProps=function(t,e){e&&this.once("update",e),this.entity.replaceProps(t);var n=this;return"undefined"!=typeof Promise?new Promise(function(t){n.once("update",function(){t()})}):void 0},n.prototype.remove=function(){this.pause(),this.renderer.clear()},n.prototype.resume=function(){r.on("tick",this.tick)},n.prototype.pause=function(){r.off("tick",this.tick)}},{"./loop":25,"component/emitter":6}],25:[function(t,e){function n(t){i.emit("tick",t),r(n)}var r=t("component/raf"),o=t("component/emitter"),i=new o;r(n),e.exports=i},{"component/raf":26,"component/emitter":6}],26:[function(t,e,n){function r(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-o)),r=setTimeout(t,n);return o=e,r}n=e.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||r;var o=(new Date).getTime(),i=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.clearTimeout;n.cancel=function(t){i.call(window,t)}},{}],14:[function(t,e){function n(t){this.container=t,this.events=new r(t),this.elements={},this.rendered=null}var r=t("./interactions"),o=t("component/each"),i=t("./diff");e.exports=n,n.prototype.render=function(t){return this.rendered!==t?(this.clear(),this.mountEntity(t,this.container),void(this.rendered=t)):void this.update(t)},n.prototype.update=function(t){if(!t.dirty)return this.updateChildren(t);var e=t.state,n=t.props,r=t.update();if(!r)return this.updateChildren(t);var o=t.render();i(t,o,this.getElement(t.id),this),t.setCurrent(o),this.updateEvents(t),this.updateChildren(t),t.afterUpdate(e,n)},n.prototype.updateChildren=function(t){for(var e in t.children)this.update(t.children[e])},n.prototype.clear=function(){this.rendered&&(this.unmountEntity(this.rendered),this.rendered=null)},n.prototype.mountEntity=function(t,e){var n=this.addEntity(t,e);return t.beforeMount(),e.appendChild(n),this.updateEvents(t),t.afterMount(n),n},n.prototype.unmountEntity=function(t){var e=this.getElement(t.id);e&&(t.beforeUnmount(e),e.parentNode&&e.parentNode.removeChild(e),this.unmountChildren(t),this.removeEvents(t),t.afterUnmount(),t.remove(),delete this.elements[t.id])},n.prototype.unmountChildren=function(t){var e=this;o(t.children,function(n,r){t.removeChild(n),e.unmountEntity(r)})},n.prototype.getElement=function(t){return this.elements[t]},n.prototype.updateEvents=function(t){var e=this;this.events.unbind(t.id),o(t.current.nodes,function(n,r){"element"===r.type&&o(r.events,function(r,o){e.events.bind(t.id,n,r,function(e){o.call(t.component,e,t.props,t.state)})})})},n.prototype.removeEvents=function(t){this.events.unbind(t.id)},n.prototype.addEntity=function(t,e){var n=this.createElement(t.current.root,t.current,t,e);return this.elements[t.id]=n,n},n.prototype.createElement=function(t,e,n,r){var o=e.getPath(t),i=r||document.createDocumentFragment();if(!o)throw new Error("Node does not exist in the entity");if("text"===t.type)return i.appendChild(document.createTextNode(t.data)),i;if("element"===t.type){var a=document.createElement(t.tagName),s=t.children;for(var u in t.attributes)a.setAttribute(u,t.attributes[u]);a.__path__=o,a.__entity__=n.id;for(var c=0,p=s.length;p>c;c++)this.createElement(s[c],e,n,a);return i.appendChild(a),a}if("component"===t.type){var h=n.addChild(o,t.component,t.props);return this.mountEntity(h,i)}}},{"./interactions":27,"component/each":20,"./diff":28}],27:[function(t,e){function n(t){this.el=t,this.handlers={},this.handle=r.bind(this),this.resume()}function r(t){var e=t.target,n=(this.handlers,i.get(this.handlers,[e.__entity__,e.__path__,t.type]));n&&n(t)}var o=(t("component/delegate"),t("component/per-frame")),i=t("./keypath"),a=["blur","change","click","contextmenu","copy","cut","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","dragstart","drop","focus","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","paste","scroll","submit","touchcancel","touchend","touchmove","touchstart","wheel"];e.exports=n,n.prototype.bind=function(t,e,n,r){i.set(this.handlers,[t,e,n],o(r))},n.prototype.unbind=function(t){delete this.handlers[t]},n.prototype.resume=function(){a.forEach(function(t){this.el.addEventListener(t,this.handle,!0)},this)},n.prototype.pause=function(){a.forEach(function(t){this.el.removeEventListener(t,this.handle)},this)},n.prototype.remove=function(){this.handlers={},this.pause()}},{"component/delegate":29,"component/per-frame":30,"./keypath":31}],29:[function(t,e,n){var r=t("closest"),o=t("event");n.bind=function(t,e,n,i,a){return o.bind(t,n,function(n){var o=n.target||n.srcElement;n.delegateTarget=r(o,e,!0,t),n.delegateTarget&&i.call(t,n)},a)},n.unbind=function(t,e,n,r){o.unbind(t,e,n,r)}},{closest:32,event:33}],32:[function(t,e){var n=t("matches-selector");e.exports=function(t,e,r,o){for(t=r?{parentNode:t}:t,o=o||document;(t=t.parentNode)&&t!==document;){if(n(t,e))return t;if(t===o)return}}},{"matches-selector":34}],34:[function(t,e){function n(t,e){if(!t||1!==t.nodeType)return!1;if(i)return i.call(t,e);for(var n=r.all(e,t.parentNode),o=0;o<n.length;++o)if(n[o]==t)return!0;return!1}var r=t("query"),o=Element.prototype,i=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector;e.exports=n},{query:35}],35:[function(t,e,n){function r(t,e){return e.querySelector(t)}n=e.exports=function(t,e){return e=e||document,r(t,e)},n.all=function(t,e){return e=e||document,e.querySelectorAll(t)},n.engine=function(t){if(!t.one)throw new Error(".one callback required");if(!t.all)throw new Error(".all callback required");return r=t.one,n.all=t.all,n}},{}],33:[function(t,e,n){var r=window.addEventListener?"addEventListener":"attachEvent",o=window.removeEventListener?"removeEventListener":"detachEvent",i="addEventListener"!==r?"on":"";n.bind=function(t,e,n,o){return t[r](i+e,n,o||!1),n},n.unbind=function(t,e,n,r){return t[o](i+e,n,r||!1),n}},{}],30:[function(t,e){function n(t){var e,n=!1;return function(){return n?e:(n=!0,r(function(){n=!1}),e=t.apply(this,arguments))}}var r=t("raf");e.exports=n},{raf:36}],36:[function(t,e,n){function r(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-o)),r=setTimeout(t,n);return o=e,r}n=e.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||r;var o=(new Date).getTime(),i=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout;n.cancel=function(t){i.call(window,t)}},{}],31:[function(t,e,n){n.get=function(t,e){for(var n=e,r=t;n.length;){var o=n.shift();r=r[o],void 0===r&&(n.length=0)}return r},n.set=function(t,e,n){for(var r=e,o=t,i=r.pop();r.length;){var a=r.shift();o[a]||(o[a]={}),o=o[a]}o[i]=n}},{}],28:[function(t,e){function n(t,e,n,o){r(t.current.root,e.root,{entity:t,nextTree:e,renderer:o,el:n,path:"0",id:t.id,isRoot:!0})}function r(t,e,n){return t.type!==e.type?c(t,e,n):"text"===e.type?o(t,e,n):"component"===e.type?s(t,e,n):"element"===e.type?u(t,e,n):void 0}function o(t,e,n){e.data!==t.data&&(n.el.data=e.data)}function i(t,e,n){for(var o=h(t.children,e.children),i=n.el,a=-1,s=0;s<o.length;s++){a+=1;var u=o[s],c=u[0],f=u[1];null!=c?null!=f?r(c,f,{el:i.childNodes[a],entity:n.entity,nextTree:n.nextTree,renderer:n.renderer,isRoot:!1,path:n.path+"."+a}):(p(c,n),"component"!=c.type&&i.removeChild(i.childNodes[a]),a-=1):n.renderer.createElement(f,n.nextTree,n.entity,i)}}function a(t,e,n){var r=e.attributes,o=t.attributes;for(var i in r){var a=r[i];o[i]&&o[i]===a||n.el.setAttribute(i,a)}for(var s in o)r[s]||n.el.removeAttribute(s)}function s(t,e,n){if(e.component!==t.component)return c(t,e,n);var r=n.entity.getChild(n.path);r.replaceProps(e.props)}function u(t,e,n){return e.tagName!==t.tagName?c(t,e,n):(a(t,e,n),void i(t,e,n))}function c(t,e,n){var r=n.el,o=r.parentNode;p(t,n),r.parentNode&&r.parentNode.removeChild(r);var i=n.renderer.createElement(e,n.nextTree,n.entity);o.insertBefore(i,o.childNodes[t.index])}function p(t,e){if("component"===t.type){var n=e.entity.current.getPath(t),r=e.entity.removeChild(n);return void e.renderer.unmountEntity(r)}t.children&&t.children.forEach(function(t){p(t,e)},this)}function h(){var t=Array.prototype.slice.call(arguments,0);return t.reduce(function(t,e){return t.length>e.length?t:e},[]).map(function(e,n){return t.map(function(t){return t[n]})})}t("jkroso/equals");e.exports=n},{"jkroso/equals":19}],8:[function(t,e,n){t("sindresorhus/object-assign");n.setState=function(t,e){this.emit("change",t,e)},n.invalidate=function(){this.emit("change",{__force__:!0})},n.render=function(){return null},n.initialState=function(){return{}},n.beforeMount=function(){},n.afterMount=function(){},n.beforeUpdate=function(){},n.afterUpdate=function(){},n.beforeUnmount=function(){},n.afterUnmount=function(){},n.propsChanged=function(){}},{"sindresorhus/object-assign":4}]},{},{1:""}));
!function(t){"object"==typeof exports?module.exports=t("1"):"function"==typeof define&&define.amd?define(function(){return t("1")}):this.deku=t("1")}(function t(e,n,r){function o(t){if(n[t])return n[t].exports;if(e[t])return i(t,o);throw new Error('cannot find module "'+t+'"')}function i(o,i){var s=n[o]={exports:{}},a=e[o],u=a[2],c=a[0];return c.call(s.exports,function(t){var n=e[o][1][t];return i(n?n:t)},s,s.exports,t,e,n,r),u&&(n[u]=n[o]),n[o].exports}var s=function(){return this}();for(var a in r)r[a]?s[r[a]]=o(a):o(a);return o.duo=!0,o.cache=n,o.modules=e,o}({1:[function(t,e,n){n.component=t("./lib/component"),n.dom=t("./lib/virtual").node},{"./lib/component":2,"./lib/virtual":3}],2:[function(t,e){function n(t){function e(){return this instanceof e?void o(this):u(e,arguments[0],arguments[1])}return t=t||{},"function"==typeof t&&(t={render:t}),t.displayName&&(e.displayName=t.displayName,delete t.displayName),r(e,s,i.prototype),r(e.prototype,a,t,i.prototype),e}var r=t("sindresorhus/object-assign"),o=t("segmentio/bind-all"),i=t("component/emitter"),s=t("./statics"),a=t("./protos"),u=t("../virtual").node;e.exports=n},{"sindresorhus/object-assign":4,"segmentio/bind-all":5,"component/emitter":6,"./statics":7,"./protos":8,"../virtual":3}],4:[function(t,e){"use strict";function n(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=Object.assign||function(t){for(var e,r,o,i=n(t),s=1;s<arguments.length;s++){r=arguments[s],o=Object.keys(Object(r));for(var a=0;a<o.length;a++)try{i[o[a]]=r[o[a]]}catch(u){void 0===e&&(e=u)}}if(e)throw e;return i}},{}],5:[function(t,e){try{var n=t("bind"),r=t("type")}catch(o){var n=t("bind-component"),r=t("type-component")}e.exports=function(t){for(var e in t){var o=t[e];"function"===r(o)&&(t[e]=n(t,t[e]))}return t}},{bind:9,type:10}],9:[function(t,e){var n=[].slice;e.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return e.apply(t,r.concat(n.call(arguments)))}}},{}],10:[function(t,e){var n=Object.prototype.toString;e.exports=function(t){switch(n.call(t)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===t?"null":void 0===t?"undefined":t!==t?"nan":t&&1===t.nodeType?"element":(t=t.valueOf?t.valueOf():Object.prototype.valueOf.apply(t),typeof t)}},{}],6:[function(t,e){function n(t){return t?r(t):void 0}function r(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks[t];if(n){n=n.slice(0);for(var r=0,o=n.length;o>r;++r)n[r].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],7:[function(t,e,n){var r=t("../renderer/string"),o=t("../entity"),i=t("../scene");if("undefined"!=typeof window)var s=t("../renderer/html");n.use=function(t){if("function"==typeof t)t(this);else for(var e in t)this.prototype[e]=t[e];return this},n.render=function(t,e){if(!s)throw new Error("You can only render a DOM tree in the browser. Use renderString instead.");var n=new s(t),r=new o(this,e),a=new i(n,r);return a},n.renderString=function(t){var e=new o(this,t);return r(e)}},{"../renderer/string":11,"../entity":12,"../scene":13,"../renderer/html":14}],11:[function(t,e){function n(t){var e=t.render();return r(e.root,e)}function r(t,e){e.getPath(t);if("text"===t.type)return t.data;if("element"===t.type){for(var i=t.children,a=t.attributes,u=t.tagName,c="<"+u+o(a)+">",p=0,h=i.length;h>p;p++)c+=r(i[p],e);return c+="</"+u+">"}if("component"===t.type)return n(new s(t.component,t.props));throw new Error("Invalid type")}function o(t){var e="";for(var n in t)e+=i(n,t[n]);return e}function i(t,e){return" "+t+'="'+e+'"'}var s=(t("../../virtual"),t("../../entity"));e.exports=n},{"../../virtual":3,"../../entity":12}],3:[function(t,e,n){function r(t,e,n){2!==arguments.length||"string"!=typeof e&&!Array.isArray(e)||(n=e,e={}),n=n||[],e=e||{},Array.isArray(n)||(n=[n]),n=n.map(o);var r=e.key;delete e.key;var a;return a="function"==typeof t?i(t,e,r,n):s(t,e,r,n),a.id=(++c).toString(32),a}function o(t,e){if(("string"==typeof t||"number"==typeof t)&&(t=a(String(t))),Array.isArray(t))throw new Error("Child node cant be an array. This can happen if you try to use props.children like a node.");return t.index=e,t}var i=t("./component"),s=t("./element"),a=t("./text"),u=t("./tree");n.node=r,n.tree=u;var c=0},{"./component":15,"./element":16,"./text":17,"./tree":18}],15:[function(t,e){e.exports=function(t,e,n,r){var o={};return o.key=n,o.props=e,o.type="component",o.component=t,o.props.children=r||[],o}},{}],16:[function(t,e){function n(t){t.style&&(t.style=r(t.style)),t.data&&(t=o(t)),t["class"]&&(t["class"]=i(t["class"]));for(var e in t)t[e]===!1&&delete t[e];return t}function r(t){if("object"!==u(t))return t;var e="";for(var n in t){var r=t[n];e+=n+":"+r+";"}return e}function o(t){if("object"!==u(t.data))return t;for(var e in t.data)t["data-"+e]=t.data[e];return delete t.data,t}function i(t){if("object"===u(t)){var e=[];for(var n in t)t[n]&&e.push(n);t=e}if("array"===u(t)){if(0===t.length)return;t=t.join(" ")}return t}function s(t){var e={};for(var n in c){var r=c[n],o=t[n];o&&(e[r]=o,delete t[n])}return e}function a(t,e){if(!t)return"div";var n=t.split(/([\.#]?[a-zA-Z0-9_:-]+)/),r="div";return n.filter(Boolean).forEach(function(t){var n=t.charAt(0);"."===n?e["class"]=((e["class"]||"")+" "+t.substring(1,t.length)).trim():"#"===n?e.id=t.substring(1,t.length):r=t}),r}var u=t("component/type"),c={onBlur:"blur",onChange:"change",onClick:"click",onContextMenu:"contextmenu",onCopy:"copy",onCut:"cut",onDoubleClick:"dblclick",onDrag:"drag",onDragEnd:"dragend",onDragEnter:"dragenter",onDragExit:"dragexit",onDragLeave:"dragleave",onDragOver:"dragover",onDragStart:"dragstart",onDrop:"drop",onFocus:"focus",onInput:"input",onKeyDown:"keydown",onKeyUp:"keyup",onMouseDown:"mousedown",onMouseMove:"mousemove",onMouseOut:"mouseout",onMouseOver:"mouseover",onMouseUp:"mouseup",onPaste:"paste",onScroll:"scroll",onSubmit:"submit",onTouchCancel:"touchcancel",onTouchEnd:"touchend",onTouchMove:"touchmove",onTouchStart:"touchstart"};e.exports=function(t,e,r,o){var i={};return i.type="element",i.attributes=n(e),i.events=s(e),i.tagName=a(t,e),i.children=o||[],i.key=r,i}},{"component/type":10}],17:[function(t,e){e.exports=function(t){var e={};return e.type="text",e.data=String(t),e}},{}],18:[function(t,e){function n(t){this.root=t,this.paths={},this.nodes={},this.components={},this.parse(t)}e.exports=function(t){return new n(t)},n.prototype.getPath=function(t){return this.paths[t.id]},n.prototype.getNode=function(t){return this.nodes[t]},n.prototype.parse=function(t,e){e=e||"0",this.paths[t.id]=e,this.nodes[e]=t,"component"===t.type&&(this.components[e]=t),t.children&&t.children.forEach(function(t,n){this.parse(t,e+"."+(t.key||n))},this)}},{}],12:[function(t,e){function n(t,e){this.id=(++u).toString(32),this.type=t,this.component=new t,this.component.on("change",this.setState.bind(this)),this.component.on("send",this.send.bind(this)),this.props=e||{},this.state=this.component.initialState(this.props),this.children={},this.current=this.render(),this.previous=null,this.dirty=!1,this.lifecycle=null,this._pendingProps=null,this._pendingState=null,this._propsReplaced=!1}var r=t("sindresorhus/object-assign"),o=t("component/emitter"),i=t("jkroso/equals"),s=t("component/each"),a=t("../virtual"),u=0;e.exports=n,o(n.prototype),n.prototype.send=function(t,e){this.scene.send(t,e)},n.prototype.render=function(){this.lifecycle="rendering";var t=this.component.render(this.props,this.state);return this.lifecycle=null,t||(t=a.node("noscript")),a.tree(t)},n.prototype.setProps=function(t,e){e&&this.once("update",e),this._pendingProps=r(this._pendingProps||{},t),this.propsChanged(t),this.invalidate()},n.prototype.replaceProps=function(t,e){e&&this.once("update",e),this._propsReplaced=!0,this._pendingProps=t,this.propsChanged(t),this.invalidate()},n.prototype.setState=function(t,e){if("beforeUpdate"===this.lifecycle)throw new Error("You can't call setState in the beforeUpdate hook. Use the propsChanged hook instead.");if("rendering"===this.lifecycle)throw new Error("You can't call setState in the render hook. This method must remain pure.");e&&this.once("update",e),this._pendingState=r(this._pendingState||{},t),this.invalidate()},n.prototype.invalidate=function(){this.dirty=!0,this.scene&&(this.scene.dirty=!0)},n.prototype.addChild=function(t,e,r){var o=new n(e,r);return this.children[t]=o,o.addToScene(this.scene),o},n.prototype.getChild=function(t){return this.children[t]},n.prototype.getPath=function(t){return this.current.getPath(t)},n.prototype.addToScene=function(t){this.scene=t},n.prototype.removeChild=function(t){var e=this.children[t];return e.scene=null,delete this.children[t],e},n.prototype.shouldUpdate=function(t,e){return e&&!i(e,this.props)?!0:t&&!i(t,this.state)?!0:!1},n.prototype.update=function(){var t;this._propsReplaced?(t=this._pendingProps,this._propsReplaced=!1):t=r({},this.props,this._pendingProps);var e=r({},this.state,this._pendingState);if(!this.shouldUpdate(e,t))return!1;this.beforeUpdate(e,t);this.state,this.props;return this.state=e,this.props=t||this.props,this._pendingState=null,this._pendingProps=null,delete this.state.__force__,!0},n.prototype.setCurrent=function(t){this.previous=this.current,this.current=t,this.dirty=!1},n.prototype.remove=function(){this.off(),s(this.children,function(t,e){e.remove()}),this.children={}},n.prototype.beforeUpdate=function(t,e){this.lifecycle="beforeUpdate",this.component.beforeUpdate(this.props,this.state,e,t),this.type.emit("beforeUpdate",this.component,this.props,this.state,e,t),this.lifecycle=null},n.prototype.afterUpdate=function(t,e){this.emit("update"),this.component.afterUpdate(this.props,this.state,e,t),this.type.emit("afterUpdate",this.component,this.props,this.state,e,t)},n.prototype.beforeUnmount=function(t){this.component.beforeUnmount(t,this.props,this.state),this.type.emit("beforeUnmount",this.component,t,this.props,this.state)},n.prototype.afterUnmount=function(){this.component.afterUnmount(this.props,this.state),this.type.emit("afterUnmount",this.component,this.props,this.state)},n.prototype.beforeMount=function(){this.component.beforeMount(this.props,this.state),this.type.emit("beforeMount",this.component,this.props,this.state)},n.prototype.afterMount=function(t){this.component.afterMount(t,this.props,this.state),this.type.emit("afterMount",this.component,t,this.props,this.state)},n.prototype.propsChanged=function(t){this.component.propsChanged(t,this.props,this.state),this.type.emit("propsChanged",this.component,t,this.props,this.state)}},{"sindresorhus/object-assign":4,"component/emitter":6,"jkroso/equals":19,"component/each":20,"../virtual":3}],19:[function(t,e){function n(t,e,n){if(t===e)return!0;var r=u[a(t)],o=u[a(e)];return r&&r===o?r(t,e,n):!1}function r(t){return function(e,n,r){if(!r)return t(e,n,[]);for(var o,i=r.length;o=r[--i];)if(o[0]===e&&o[1]===n)return!0;return t(e,n,r)}}function o(t,e,r){var o=t.length;if(o!==e.length)return!1;for(r.push([t,e]);o--;)if(!n(t[o],e[o],r))return!1;return!0}function i(t,e,r){if("function"==typeof t.equal)return r.push([t,e]),t.equal(e,r);var o=s(t),i=s(e),a=o.length;if(a!==i.length)return!1;for(o.sort(),i.sort();a--;)if(o[a]!==i[a])return!1;for(r.push([t,e]),a=o.length;a--;){var u=o[a];if(!n(t[u],e[u],r))return!1}return!0}function s(t){var e=[];for(var n in t)"constructor"!==n&&e.push(n);return e}var a=t("type"),u={};u.number=function(t,e){return t!==t&&e!==e},u["function"]=function(t,e,r){return t.toString()===e.toString()&&u.object(t,e,r)&&n(t.prototype,e.prototype)},u.date=function(t,e){return+t===+e},u.regexp=function(t,e){return t.toString()===e.toString()},u.element=function(t,e){return t.outerHTML===e.outerHTML},u.textnode=function(t,e){return t.textContent===e.textContent},u.arguments=u.array=r(o),u.object=r(i),e.exports=n},{type:21}],21:[function(t,e,n){var r={}.toString,o="undefined"!=typeof window?window.Node:Function;e.exports=n=function(t){var e=typeof t;if("object"!=e)return e;if(e=i[r.call(t)])return e;if(t instanceof o)switch(t.nodeType){case 1:return"element";case 3:return"text-node";case 9:return"document";case 11:return"document-fragment";default:return"dom-node"}};var i=n.types={"[object Function]":"function","[object Date]":"date","[object RegExp]":"regexp","[object Arguments]":"arguments","[object Array]":"array","[object String]":"string","[object Null]":"null","[object Undefined]":"undefined","[object Number]":"number","[object Boolean]":"boolean","[object Object]":"object","[object Text]":"text-node","[object Uint8Array]":"bit-array","[object Uint16Array]":"bit-array","[object Uint32Array]":"bit-array","[object Uint8ClampedArray]":"bit-array","[object Error]":"error","[object FormData]":"form-data","[object File]":"file","[object Blob]":"blob"}},{}],20:[function(t,e){function n(t,e,n){for(var r=0;r<t.length;++r)e.call(n,t.charAt(r),r)}function r(t,e,n){for(var r in t)u.call(t,r)&&e.call(n,r,t[r])}function o(t,e,n){for(var r=0;r<t.length;++r)e.call(n,t[r],r)}try{var i=t("type")}catch(s){var i=t("component-type")}var a=t("to-function"),u=Object.prototype.hasOwnProperty;e.exports=function(t,e,s){switch(e=a(e),s=s||this,i(t)){case"array":return o(t,e,s);case"object":return"number"==typeof t.length?o(t,e,s):r(t,e,s);case"string":return n(t,e,s)}}},{type:22,"component-type":22,"to-function":23}],22:[function(t,e){var n=Object.prototype.toString;e.exports=function(t){switch(n.call(t)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}return null===t?"null":void 0===t?"undefined":t&&1===t.nodeType?"element":t===Object(t)?"object":typeof t}},{}],23:[function(t,e){function n(t){switch({}.toString.call(t)){case"[object Object]":return s(t);case"[object Function]":return t;case"[object String]":return i(t);case"[object RegExp]":return o(t);default:return r(t)}}function r(t){return function(e){return t===e}}function o(t){return function(e){return t.test(e)}}function i(t){return/^ *\W+/.test(t)?new Function("_","return _ "+t):new Function("_","return "+a(t))}function s(t){var e={};for(var o in t)e[o]="string"==typeof t[o]?r(t[o]):n(t[o]);return function(t){if("object"!=typeof t)return!1;for(var n in e){if(!(n in t))return!1;if(!e[n](t[n]))return!1}return!0}}function a(t){var e=c(t);if(!e.length)return"_."+t;var n,r,o;for(r=0;r<e.length;r++)o=e[r],n="_."+o,n="('function' == typeof "+n+" ? "+n+"() : "+n+")",t=u(o,t,n);return t}function u(t,e,n){return e.replace(new RegExp("(\\.)?"+t,"g"),function(t,e){return e?t:n})}var c;try{c=t("props")}catch(p){c=t("component-props")}e.exports=n},{props:24,"component-props":24}],24:[function(t,e){function n(t){return t.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(s,"").match(/[$a-zA-Z_]\w*/g)||[]}function r(t,e,n){var r=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return t.replace(r,function(t){return"("==t[t.length-1]?n(t):~e.indexOf(t)?n(t):t})}function o(t){for(var e=[],n=0;n<t.length;n++)~e.indexOf(t[n])||e.push(t[n]);return e}function i(t){return function(e){return t+e}}var s=/\b(this|Array|Date|Object|Math|JSON)\b/g;e.exports=function(t,e){var s=o(n(t));return e&&"string"==typeof e&&(e=i(e)),e?r(t,s,e):s}},{}],13:[function(t,e){function n(t,e){this._pendingMessages=[],this.messages=new o,this.tick=this.update.bind(this),this.renderer=t,this.dirty=!0,this.entity=e,e.addToScene(this),this.update(),this.resume()}var r=t("./loop"),o=t("component/emitter");e.exports=n,o(n.prototype),n.prototype.send=function(t,e){this._pendingMessages.push({name:t,data:e})},n.prototype.onMessage=function(t,e){this.messages.on(t,e)},n.prototype.flush=function(){var t=this.messages;this._pendingMessages.forEach(function(e){t.emit(e.name,e.data)})},n.prototype.update=function(){this.flush(),this.dirty&&(this.dirty=!1,this.renderer.render(this.entity),this.emit("update"))},n.prototype.setProps=function(t,e){e&&this.once("update",e),this.entity.setProps(t);var n=this;return"undefined"!=typeof Promise?new Promise(function(t){n.once("update",function(){t()})}):void 0},n.prototype.replaceProps=function(t,e){e&&this.once("update",e),this.entity.replaceProps(t);var n=this;return"undefined"!=typeof Promise?new Promise(function(t){n.once("update",function(){t()})}):void 0},n.prototype.remove=function(){this.pause(),this.renderer.clear(),this._pendingMessages=[]},n.prototype.resume=function(){r.on("tick",this.tick)},n.prototype.pause=function(){r.off("tick",this.tick)}},{"./loop":25,"component/emitter":6}],25:[function(t,e){function n(t){i.emit("tick",t),r(n)}var r=t("component/raf"),o=t("component/emitter"),i=new o;r(n),e.exports=i},{"component/raf":26,"component/emitter":6}],26:[function(t,e,n){function r(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-o)),r=setTimeout(t,n);return o=e,r}n=e.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||r;var o=(new Date).getTime(),i=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.clearTimeout;n.cancel=function(t){i.call(window,t)}},{}],14:[function(t,e){function n(t){this.container=t,this.events=new r(t),this.elements={},this.rendered=null}var r=t("./interactions"),o=t("component/each"),i=t("./diff");e.exports=n,n.prototype.render=function(t){return this.rendered!==t?(this.clear(),this.mountEntity(t,this.container),void(this.rendered=t)):void this.update(t)},n.prototype.update=function(t){if(!t.dirty)return this.updateChildren(t);var e=t.state,n=t.props,r=t.update();if(!r)return this.updateChildren(t);var o=t.render();i(t,o,this.getElement(t.id),this),t.setCurrent(o),this.updateEvents(t),this.updateChildren(t),t.afterUpdate(e,n)},n.prototype.updateChildren=function(t){for(var e in t.children)this.update(t.children[e])},n.prototype.clear=function(){this.rendered&&(this.unmountEntity(this.rendered),this.rendered=null)},n.prototype.mountEntity=function(t,e){var n=this.addEntity(t,e);return t.beforeMount(),e.appendChild(n),this.updateEvents(t),t.afterMount(n),n},n.prototype.unmountEntity=function(t){var e=this.getElement(t.id);e&&(t.beforeUnmount(e),e.parentNode&&e.parentNode.removeChild(e),this.unmountChildren(t),this.removeEvents(t),t.afterUnmount(),t.remove(),delete this.elements[t.id])},n.prototype.unmountChildren=function(t){var e=this;o(t.children,function(n,r){t.removeChild(n),e.unmountEntity(r)})},n.prototype.getElement=function(t){return this.elements[t]},n.prototype.updateEvents=function(t){var e=this;this.events.unbind(t.id),o(t.current.nodes,function(n,r){"element"===r.type&&o(r.events,function(r,o){e.events.bind(t.id,n,r,function(e){o.call(t.component,e,t.props,t.state)})})})},n.prototype.removeEvents=function(t){this.events.unbind(t.id)},n.prototype.addEntity=function(t,e){var n=this.createElement(t.current.root,t.current,t,e);return this.elements[t.id]=n,n},n.prototype.createElement=function(t,e,n,r){var o=e.getPath(t),i=r||document.createDocumentFragment();if(!o)throw new Error("Node does not exist in the entity");if("text"===t.type)return i.appendChild(document.createTextNode(t.data)),i;if("element"===t.type){var s=document.createElement(t.tagName),a=t.children;for(var u in t.attributes)s.setAttribute(u,t.attributes[u]);s.__path__=o,s.__entity__=n.id;for(var c=0,p=a.length;p>c;c++)this.createElement(a[c],e,n,s);return i.appendChild(s),s}if("component"===t.type){var h=n.addChild(o,t.component,t.props);return this.mountEntity(h,i)}}},{"./interactions":27,"component/each":20,"./diff":28}],27:[function(t,e){function n(t){this.el=t,this.handlers={},this.handle=r.bind(this),this.resume()}function r(t){var e=t.target,n=(this.handlers,i.get(this.handlers,[e.__entity__,e.__path__,t.type]));n&&n(t)}var o=(t("component/delegate"),t("component/per-frame")),i=t("./keypath"),s=["blur","change","click","contextmenu","copy","cut","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","dragstart","drop","focus","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","paste","scroll","submit","touchcancel","touchend","touchmove","touchstart","wheel"];e.exports=n,n.prototype.bind=function(t,e,n,r){i.set(this.handlers,[t,e,n],o(r))},n.prototype.unbind=function(t){delete this.handlers[t]},n.prototype.resume=function(){s.forEach(function(t){this.el.addEventListener(t,this.handle,!0)},this)},n.prototype.pause=function(){s.forEach(function(t){this.el.removeEventListener(t,this.handle)},this)},n.prototype.remove=function(){this.handlers={},this.pause()}},{"component/delegate":29,"component/per-frame":30,"./keypath":31}],29:[function(t,e,n){var r=t("closest"),o=t("event");n.bind=function(t,e,n,i,s){return o.bind(t,n,function(n){var o=n.target||n.srcElement;n.delegateTarget=r(o,e,!0,t),n.delegateTarget&&i.call(t,n)},s)},n.unbind=function(t,e,n,r){o.unbind(t,e,n,r)}},{closest:32,event:33}],32:[function(t,e){var n=t("matches-selector");e.exports=function(t,e,r,o){for(t=r?{parentNode:t}:t,o=o||document;(t=t.parentNode)&&t!==document;){if(n(t,e))return t;if(t===o)return}}},{"matches-selector":34}],34:[function(t,e){function n(t,e){if(!t||1!==t.nodeType)return!1;if(i)return i.call(t,e);for(var n=r.all(e,t.parentNode),o=0;o<n.length;++o)if(n[o]==t)return!0;return!1}var r=t("query"),o=Element.prototype,i=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector;e.exports=n},{query:35}],35:[function(t,e,n){function r(t,e){return e.querySelector(t)}n=e.exports=function(t,e){return e=e||document,r(t,e)},n.all=function(t,e){return e=e||document,e.querySelectorAll(t)},n.engine=function(t){if(!t.one)throw new Error(".one callback required");if(!t.all)throw new Error(".all callback required");return r=t.one,n.all=t.all,n}},{}],33:[function(t,e,n){var r=window.addEventListener?"addEventListener":"attachEvent",o=window.removeEventListener?"removeEventListener":"detachEvent",i="addEventListener"!==r?"on":"";n.bind=function(t,e,n,o){return t[r](i+e,n,o||!1),n},n.unbind=function(t,e,n,r){return t[o](i+e,n,r||!1),n}},{}],30:[function(t,e){function n(t){var e,n=!1;return function(){return n?e:(n=!0,r(function(){n=!1}),e=t.apply(this,arguments))}}var r=t("raf");e.exports=n},{raf:36}],36:[function(t,e,n){function r(t){var e=(new Date).getTime(),n=Math.max(0,16-(e-o)),r=setTimeout(t,n);return o=e,r}n=e.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||r;var o=(new Date).getTime(),i=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout;n.cancel=function(t){i.call(window,t)}},{}],31:[function(t,e,n){n.get=function(t,e){for(var n=e,r=t;n.length;){var o=n.shift();r=r[o],void 0===r&&(n.length=0)}return r},n.set=function(t,e,n){for(var r=e,o=t,i=r.pop();r.length;){var s=r.shift();o[s]||(o[s]={}),o=o[s]}o[i]=n}},{}],28:[function(t,e){function n(t,e,n,o){r(t.current.root,e.root,{entity:t,nextTree:e,renderer:o,el:n,path:"0",id:t.id,isRoot:!0})}function r(t,e,n){return t.type!==e.type?c(t,e,n):"text"===e.type?o(t,e,n):"component"===e.type?a(t,e,n):"element"===e.type?u(t,e,n):void 0}function o(t,e,n){e.data!==t.data&&(n.el.data=e.data)}function i(t,e,n){for(var o=h(t.children,e.children),i=n.el,s=-1,a=0;a<o.length;a++){s+=1;var u=o[a],c=u[0],f=u[1];null!=c?null!=f?r(c,f,{el:i.childNodes[s],entity:n.entity,nextTree:n.nextTree,renderer:n.renderer,isRoot:!1,path:n.path+"."+s}):(p(c,n),"component"!=c.type&&i.removeChild(i.childNodes[s]),s-=1):n.renderer.createElement(f,n.nextTree,n.entity,i)}}function s(t,e,n){var r=e.attributes,o=t.attributes;for(var i in r){var s=r[i];o[i]&&o[i]===s||n.el.setAttribute(i,s)}for(var a in o)r[a]||n.el.removeAttribute(a)}function a(t,e,n){if(e.component!==t.component)return c(t,e,n);var r=n.entity.getChild(n.path);r.replaceProps(e.props)}function u(t,e,n){return e.tagName!==t.tagName?c(t,e,n):(s(t,e,n),void i(t,e,n))}function c(t,e,n){var r=n.el,o=r.parentNode;p(t,n),r.parentNode&&r.parentNode.removeChild(r);var i=n.renderer.createElement(e,n.nextTree,n.entity);o.insertBefore(i,o.childNodes[t.index])}function p(t,e){if("component"===t.type){var n=e.entity.current.getPath(t),r=e.entity.removeChild(n);return void e.renderer.unmountEntity(r)}t.children&&t.children.forEach(function(t){p(t,e)},this)}function h(){var t=Array.prototype.slice.call(arguments,0);return t.reduce(function(t,e){return t.length>e.length?t:e},[]).map(function(e,n){return t.map(function(t){return t[n]})})}t("jkroso/equals");e.exports=n},{"jkroso/equals":19}],8:[function(t,e,n){t("sindresorhus/object-assign");n.setState=function(t,e){this.emit("change",t,e)},n.invalidate=function(){this.emit("change",{__force__:!0})},n.send=function(t,e){this.emit("send",t,e)},n.render=function(){return null},n.initialState=function(){return{}},n.beforeMount=function(){},n.afterMount=function(){},n.beforeUpdate=function(){},n.afterUpdate=function(){},n.beforeUnmount=function(){},n.afterUnmount=function(){},n.propsChanged=function(){}},{"sindresorhus/object-assign":4}]},{},{1:""}));
0.0.14 / 2015-01-21
==================
* Add .send and .onMessage methods. You can call this.send(name, payload) within components and listen for those events on the scene with scene.onMessage(name, fn);
0.0.13 / 2015-01-20

@@ -3,0 +8,0 @@ ==================

@@ -35,2 +35,15 @@

/**
* Send a message
*
* @param {String} name
* @param {Mixed} data
*
* @return {void}
*/
exports.send = function(name, data){
this.emit('send', name, data);
};
/**
* Default render. Renders a noscript tag by

@@ -37,0 +50,0 @@ * default so nothing shows up in the DOM.

@@ -38,2 +38,3 @@

this.component.on('change', this.setState.bind(this));
this.component.on('send', this.send.bind(this));
this.props = props || {};

@@ -58,2 +59,15 @@ this.state = this.component.initialState(this.props);

/**
* Send a message to the scene
*
* @param {String} name
* @param {Mixed} data
*
* @return {void}
*/
Entity.prototype.send = function(name, data){
this.scene.send(name, data);
};
/**
* Get an updated version of the virtual tree.

@@ -60,0 +74,0 @@ *

@@ -26,2 +26,4 @@

function Scene(renderer, entity) {
this._pendingMessages = [];
this.messages = new Emitter();
this.tick = this.update.bind(this);

@@ -39,2 +41,39 @@ this.renderer = renderer;

/**
* Push a message to the queue
*
* @api private
*
* @return {void}
*/
Scene.prototype.send = function(name, data){
this._pendingMessages.push({ name: name, data: data });
};
/**
* Listen for messages
*
* @param {String} name
* @param {Function} fn
*
* @api public
*/
Scene.prototype.onMessage = function(name, fn){
this.messages.on(name, fn);
};
/**
* Flush all messages from the queue
*
* @api private
*/
Scene.prototype.flush = function(){
var messages = this.messages;
this._pendingMessages.forEach(function(message){
messages.emit(message.name, message.data);
});
};
/**
* Schedule this component to be updated on the next frame.

@@ -47,2 +86,3 @@ *

Scene.prototype.update = function(){
this.flush();
if (!this.dirty) return;

@@ -109,2 +149,3 @@ this.dirty = false;

this.renderer.clear();
this._pendingMessages = [];
};

@@ -111,0 +152,0 @@

{
"name": "deku",
"version": "0.0.13",
"version": "0.0.14",
"repository": "segmentio/deku",

@@ -5,0 +5,0 @@ "description": "Create view components using a virtual DOM",

@@ -269,2 +269,3 @@ var trigger = require('adamsanderson/trigger-event');

});

@@ -34,2 +34,3 @@ mocha.setup({globals: ['hasCert']});

require('./component/state');
require('./component/send');
require('./component/update-elements');

@@ -36,0 +37,0 @@ require('./component/update-text');

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc