Comparing version 0.7.10 to 0.7.11
/*! | ||
* inferno-component v0.7.10 | ||
* inferno-component v0.7.11 | ||
* (c) 2016 Dominic Gannaway | ||
@@ -7,325 +7,278 @@ * Released under the MIT License. | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.InfernoComponent = factory()); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.InfernoComponent = factory()); | ||
}(this, function () { 'use strict'; | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
function isNullOrUndefined(obj) { | ||
return obj === void 0 || obj === null; | ||
} | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function isInvalidNode(obj) { | ||
return obj === null || obj === false || obj === void 0; | ||
} | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function createNullNode() { | ||
return { | ||
null: true, | ||
dom: document.createTextNode('') | ||
}; | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
function constructDefaults(string, object, value) { | ||
/* eslint no-return-assign: 0 */ | ||
string.split(',').forEach(function (i) { | ||
return object[i] = value; | ||
}); | ||
} | ||
babelHelpers.extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
var xlinkNS = 'http://www.w3.org/1999/xlink'; | ||
var xmlNS = 'http://www.w3.org/XML/1998/namespace'; | ||
var strictProps = {}; | ||
var booleanProps = {}; | ||
var namespaces = {}; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
constructDefaults('xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type', namespaces, xlinkNS); | ||
constructDefaults('xml:base,xml:lang,xml:space', namespaces, xmlNS); | ||
constructDefaults('volume,value', strictProps, true); | ||
constructDefaults('muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate', booleanProps, true); | ||
return target; | ||
}; | ||
var screenWidth = window.screen.width; | ||
var screenHeight = window.screen.height; | ||
var scrollX = 0; | ||
var scrollY = 0; | ||
var lastScrollTime = 0; | ||
babelHelpers.inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
window.onscroll = function (e) { | ||
scrollX = window.scrollX; | ||
scrollY = window.scrollY; | ||
lastScrollTime = performance.now(); | ||
}; | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
window.resize = function (e) { | ||
scrollX = window.scrollX; | ||
scrollY = window.scrollY; | ||
screenWidth = window.screen.width; | ||
screenHeight = window.screen.height; | ||
lastScrollTime = performance.now(); | ||
}; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
function Lifecycle() { | ||
this._listeners = []; | ||
this.scrollX = null; | ||
this.scrollY = null; | ||
this.screenHeight = screenHeight; | ||
this.screenWidth = screenWidth; | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
Lifecycle.prototype = { | ||
refresh: function refresh() { | ||
this.scrollX = window.scrollX; | ||
this.scrollY = window.scrollY; | ||
}, | ||
addListener: function addListener(callback) { | ||
this._listeners.push(callback); | ||
}, | ||
trigger: function trigger() { | ||
for (var i = 0; i < this._listeners.length; i++) { | ||
this._listeners[i](); | ||
} | ||
} | ||
}; | ||
babelHelpers; | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function isNullOrUndefined(obj) { | ||
return obj === void 0 || obj === null; | ||
} | ||
var createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function isInvalidNode(obj) { | ||
return obj === null || obj === false || obj === void 0; | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
function createNullNode() { | ||
return { | ||
null: true, | ||
dom: document.createTextNode('') | ||
}; | ||
} | ||
var noOp = 'Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.'; | ||
function constructDefaults(string, object, value) { | ||
/* eslint no-return-assign: 0 */ | ||
string.split(',').forEach(function (i) { | ||
return object[i] = value; | ||
}); | ||
} | ||
// Copy of the util from dom/util, otherwise it makes massive bundles | ||
function getActiveNode() { | ||
return document.activeElement; | ||
} | ||
var xlinkNS = 'http://www.w3.org/1999/xlink'; | ||
var xmlNS = 'http://www.w3.org/XML/1998/namespace'; | ||
var strictProps = {}; | ||
var booleanProps = {}; | ||
var namespaces = {}; | ||
// Copy of the util from dom/util, otherwise it makes massive bundles | ||
function resetActiveNode(activeNode) { | ||
if (activeNode !== document.body && document.activeElement !== activeNode) { | ||
activeNode.focus(); // TODO: verify are we doing new focus event, if user has focus listener this might trigger it | ||
} | ||
} | ||
constructDefaults('xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type', namespaces, xlinkNS); | ||
constructDefaults('xml:base,xml:lang,xml:space', namespaces, xmlNS); | ||
constructDefaults('volume,value', strictProps, true); | ||
constructDefaults('muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate', booleanProps, true); | ||
function queueStateChanges(component, newState, callback) { | ||
for (var stateKey in newState) { | ||
component._pendingState[stateKey] = newState[stateKey]; | ||
} | ||
if (!component._pendingSetState) { | ||
component._pendingSetState = true; | ||
applyState(component, false, callback); | ||
} else { | ||
var pendingState = component._pendingState; | ||
var oldState = component.state; | ||
var screenWidth = window.screen.width; | ||
var screenHeight = window.screen.height; | ||
var scrollX = 0; | ||
var scrollY = 0; | ||
var lastScrollTime = 0; | ||
component.state = Object.assign({}, oldState, pendingState); | ||
component._pendingState = {}; | ||
} | ||
} | ||
window.onscroll = function (e) { | ||
scrollX = window.scrollX; | ||
scrollY = window.scrollY; | ||
lastScrollTime = performance.now(); | ||
}; | ||
function applyState(component, force, callback) { | ||
if (!component._deferSetState || force) { | ||
component._pendingSetState = false; | ||
var pendingState = component._pendingState; | ||
var oldState = component.state; | ||
var nextState = Object.assign({}, oldState, pendingState); | ||
window.resize = function (e) { | ||
scrollX = window.scrollX; | ||
scrollY = window.scrollY; | ||
screenWidth = window.screen.width; | ||
screenHeight = window.screen.height; | ||
lastScrollTime = performance.now(); | ||
}; | ||
component._pendingState = {}; | ||
var nextNode = component._updateComponent(oldState, nextState, component.props, component.props, force); | ||
function Lifecycle() { | ||
this._listeners = []; | ||
this.scrollX = null; | ||
this.scrollY = null; | ||
this.screenHeight = screenHeight; | ||
this.screenWidth = screenWidth; | ||
} | ||
if (isInvalidNode(nextNode)) { | ||
nextNode = createNullNode(); | ||
} | ||
var lastNode = component._lastNode; | ||
var parentDom = lastNode.dom.parentNode; | ||
Lifecycle.prototype = { | ||
refresh: function refresh() { | ||
this.scrollX = window.scrollX; | ||
this.scrollY = window.scrollY; | ||
}, | ||
addListener: function addListener(callback) { | ||
this._listeners.push(callback); | ||
}, | ||
trigger: function trigger() { | ||
for (var i = 0; i < this._listeners.length; i++) { | ||
this._listeners[i](); | ||
} | ||
} | ||
}; | ||
var activeNode = getActiveNode(); | ||
var subLifecycle = new Lifecycle(); | ||
component._patch(lastNode, nextNode, parentDom, subLifecycle, component.context, component, null); | ||
component._lastNode = nextNode; | ||
component._parentNode.dom = nextNode.dom; | ||
var noOp = 'Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.'; | ||
subLifecycle.trigger(); | ||
if (!isNullOrUndefined(callback)) { | ||
callback(); | ||
} | ||
resetActiveNode(activeNode); | ||
} | ||
} | ||
// Copy of the util from dom/util, otherwise it makes massive bundles | ||
function getActiveNode() { | ||
return document.activeElement; | ||
} | ||
var Component = function () { | ||
function Component(props) { | ||
classCallCheck(this, Component); | ||
// Copy of the util from dom/util, otherwise it makes massive bundles | ||
function resetActiveNode(activeNode) { | ||
if (activeNode !== document.body && document.activeElement !== activeNode) { | ||
activeNode.focus(); // TODO: verify are we doing new focus event, if user has focus listener this might trigger it | ||
} | ||
} | ||
/** @type {object} */ | ||
this.props = props || {}; | ||
function queueStateChanges(component, newState, callback) { | ||
for (var stateKey in newState) { | ||
component._pendingState[stateKey] = newState[stateKey]; | ||
} | ||
if (!component._pendingSetState) { | ||
component._pendingSetState = true; | ||
applyState(component, false, callback); | ||
} else { | ||
var pendingState = component._pendingState; | ||
var oldState = component.state; | ||
/** @type {object} */ | ||
this.state = {}; | ||
component.state = Object.assign({}, oldState, pendingState); | ||
component._pendingState = {}; | ||
} | ||
} | ||
/** @type {object} */ | ||
this.refs = {}; | ||
this._blockSetState = false; | ||
this._deferSetState = false; | ||
this._pendingSetState = false; | ||
this._pendingState = {}; | ||
this._parentNode = null; | ||
this._lastNode = null; | ||
this._unmounted = true; | ||
this.context = {}; | ||
this._patch = null; | ||
this._parentComponent = null; | ||
} | ||
function applyState(component, force, callback) { | ||
if (!component._deferSetState || force) { | ||
component._pendingSetState = false; | ||
var pendingState = component._pendingState; | ||
var oldState = component.state; | ||
var nextState = Object.assign({}, oldState, pendingState); | ||
createClass(Component, [{ | ||
key: 'render', | ||
value: function render() {} | ||
}, { | ||
key: 'forceUpdate', | ||
value: function forceUpdate(callback) { | ||
if (this._unmounted) { | ||
throw Error(noOp); | ||
} | ||
applyState(this, true, callback); | ||
} | ||
}, { | ||
key: 'setState', | ||
value: function setState(newState, callback) { | ||
if (this._unmounted) { | ||
throw Error(noOp); | ||
} | ||
if (this._blockSetState === false) { | ||
queueStateChanges(this, newState, callback); | ||
} else { | ||
throw Error('Inferno Warning: Cannot update state via setState() in componentWillUpdate()'); | ||
} | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() {} | ||
}, { | ||
key: 'componentWillMount', | ||
value: function componentWillMount() {} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() {} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() {} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate() { | ||
return true; | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() {} | ||
}, { | ||
key: 'componentWillUpdate', | ||
value: function componentWillUpdate() {} | ||
}, { | ||
key: 'getChildContext', | ||
value: function getChildContext() {} | ||
}, { | ||
key: '_updateComponent', | ||
value: function _updateComponent(prevState, nextState, prevProps, nextProps, force) { | ||
if (this._unmounted === true) { | ||
this._unmounted = false; | ||
return false; | ||
} | ||
if (!isNullOrUndefined(nextProps) && isNullOrUndefined(nextProps.children)) { | ||
nextProps.children = prevProps.children; | ||
} | ||
if (prevProps !== nextProps || prevState !== nextState || force) { | ||
if (prevProps !== nextProps) { | ||
this._blockSetState = true; | ||
this.componentWillReceiveProps(nextProps); | ||
this._blockSetState = false; | ||
} | ||
var shouldUpdate = this.shouldComponentUpdate(nextProps, nextState); | ||
component._pendingState = {}; | ||
var nextNode = component._updateComponent(oldState, nextState, component.props, component.props, force); | ||
if (shouldUpdate !== false) { | ||
this._blockSetState = true; | ||
this.componentWillUpdate(nextProps, nextState); | ||
this._blockSetState = false; | ||
this.props = nextProps; | ||
this.state = nextState; | ||
var node = this.render(); | ||
if (isInvalidNode(nextNode)) { | ||
nextNode = createNullNode(); | ||
} | ||
var lastNode = component._lastNode; | ||
var parentDom = lastNode.dom.parentNode; | ||
this.componentDidUpdate(prevProps, prevState); | ||
return node; | ||
} | ||
} | ||
return false; | ||
} | ||
}]); | ||
return Component; | ||
}(); | ||
var activeNode = getActiveNode(); | ||
var subLifecycle = new Lifecycle(); | ||
component._patch(lastNode, nextNode, parentDom, subLifecycle, component.context, component, null); | ||
component._lastNode = nextNode; | ||
component._parentNode.dom = nextNode.dom; | ||
return Component; | ||
subLifecycle.trigger(); | ||
if (!isNullOrUndefined(callback)) { | ||
callback(); | ||
} | ||
resetActiveNode(activeNode); | ||
} | ||
} | ||
var Component = function () { | ||
function Component(props) { | ||
babelHelpers.classCallCheck(this, Component); | ||
/** @type {object} */ | ||
this.props = props || {}; | ||
/** @type {object} */ | ||
this.state = {}; | ||
/** @type {object} */ | ||
this.refs = {}; | ||
this._blockSetState = false; | ||
this._deferSetState = false; | ||
this._pendingSetState = false; | ||
this._pendingState = {}; | ||
this._parentNode = null; | ||
this._lastNode = null; | ||
this._unmounted = true; | ||
this.context = {}; | ||
this._patch = null; | ||
this._parentComponent = null; | ||
} | ||
babelHelpers.createClass(Component, [{ | ||
key: 'render', | ||
value: function render() {} | ||
}, { | ||
key: 'forceUpdate', | ||
value: function forceUpdate(callback) { | ||
if (this._unmounted) { | ||
throw Error(noOp); | ||
} | ||
applyState(this, true, callback); | ||
} | ||
}, { | ||
key: 'setState', | ||
value: function setState(newState, callback) { | ||
if (this._unmounted) { | ||
throw Error(noOp); | ||
} | ||
if (this._blockSetState === false) { | ||
queueStateChanges(this, newState, callback); | ||
} else { | ||
throw Error('Inferno Warning: Cannot update state via setState() in componentWillUpdate()'); | ||
} | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() {} | ||
}, { | ||
key: 'componentWillMount', | ||
value: function componentWillMount() {} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() {} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() {} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate() { | ||
return true; | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() {} | ||
}, { | ||
key: 'componentWillUpdate', | ||
value: function componentWillUpdate() {} | ||
}, { | ||
key: 'getChildContext', | ||
value: function getChildContext() {} | ||
}, { | ||
key: '_updateComponent', | ||
value: function _updateComponent(prevState, nextState, prevProps, nextProps, force) { | ||
if (this._unmounted === true) { | ||
this._unmounted = false; | ||
return false; | ||
} | ||
if (!isNullOrUndefined(nextProps) && isNullOrUndefined(nextProps.children)) { | ||
nextProps.children = prevProps.children; | ||
} | ||
if (prevProps !== nextProps || prevState !== nextState || force) { | ||
if (prevProps !== nextProps) { | ||
this._blockSetState = true; | ||
this.componentWillReceiveProps(nextProps); | ||
this._blockSetState = false; | ||
} | ||
var shouldUpdate = this.shouldComponentUpdate(nextProps, nextState); | ||
if (shouldUpdate !== false) { | ||
this._blockSetState = true; | ||
this.componentWillUpdate(nextProps, nextState); | ||
this._blockSetState = false; | ||
this.props = nextProps; | ||
this.state = nextState; | ||
var node = this.render(); | ||
this.componentDidUpdate(prevProps, prevState); | ||
return node; | ||
} | ||
} | ||
return false; | ||
} | ||
}]); | ||
return Component; | ||
}(); | ||
return Component; | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.InfernoComponent=t()}(this,function(){"use strict";function e(e){return void 0===e||null===e}function t(e){return null===e||e===!1||void 0===e}function n(){return{"null":!0,dom:document.createTextNode("")}}function o(e,t,n){e.split(",").forEach(function(e){return t[e]=n})}function i(){this._listeners=[],this.scrollX=null,this.scrollY=null,this.screenHeight=w,this.screenWidth=m}function r(){return document.activeElement}function l(e){e!==document.body&&document.activeElement!==e&&e.focus()}function s(e,t,n){for(var o in t)e._pendingState[o]=t[o];if(e._pendingSetState){var i=e._pendingState,r=e.state;e.state=Object.assign({},r,i),e._pendingState={}}else e._pendingSetState=!0,a(e,!1,n)}function a(o,s,a){if(!o._deferSetState||s){o._pendingSetState=!1;var u=o._pendingState,c=o.state,p=Object.assign({},c,u);o._pendingState={};var f=o._updateComponent(c,p,o.props,o.props,s);t(f)&&(f=n());var d=o._lastNode,h=d.dom.parentNode,m=r(),w=new i;o._patch(d,f,h,w,o.context,o,null),o._lastNode=f,o._parentNode.dom=f.dom,w.trigger(),e(a)||a(),l(m)}}var u={};u.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},u.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},u.createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},u.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t};var c="http://www.w3.org/1999/xlink",p="http://www.w3.org/XML/1998/namespace",f={},d={},h={};o("xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type",h,c),o("xml:base,xml:lang,xml:space",h,p),o("volume,value",f,!0),o("muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate",d,!0);var m=window.screen.width,w=window.screen.height,y=0,v=0,_=0;window.onscroll=function(e){y=window.scrollX,v=window.scrollY,_=performance.now()},window.resize=function(e){y=window.scrollX,v=window.scrollY,m=window.screen.width,w=window.screen.height,_=performance.now()},i.prototype={refresh:function(){this.scrollX=window.scrollX,this.scrollY=window.scrollY},addListener:function(e){this._listeners.push(e)},trigger:function(){for(var e=0;e<this._listeners.length;e++)this._listeners[e]()}};var S="Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.",b=function(){function t(e){u.classCallCheck(this,t),this.props=e||{},this.state={},this.refs={},this._blockSetState=!1,this._deferSetState=!1,this._pendingSetState=!1,this._pendingState={},this._parentNode=null,this._lastNode=null,this._unmounted=!0,this.context={},this._patch=null,this._parentComponent=null}return u.createClass(t,[{key:"render",value:function(){}},{key:"forceUpdate",value:function(e){if(this._unmounted)throw Error(S);a(this,!0,e)}},{key:"setState",value:function(e,t){if(this._unmounted)throw Error(S);if(this._blockSetState!==!1)throw Error("Inferno Warning: Cannot update state via setState() in componentWillUpdate()");s(this,e,t)}},{key:"componentDidMount",value:function(){}},{key:"componentWillMount",value:function(){}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(){}},{key:"shouldComponentUpdate",value:function(){return!0}},{key:"componentWillReceiveProps",value:function(){}},{key:"componentWillUpdate",value:function(){}},{key:"getChildContext",value:function(){}},{key:"_updateComponent",value:function(t,n,o,i,r){if(this._unmounted===!0)return this._unmounted=!1,!1;if(!e(i)&&e(i.children)&&(i.children=o.children),o!==i||t!==n||r){o!==i&&(this._blockSetState=!0,this.componentWillReceiveProps(i),this._blockSetState=!1);var l=this.shouldComponentUpdate(i,n);if(l!==!1){this._blockSetState=!0,this.componentWillUpdate(i,n),this._blockSetState=!1,this.props=i,this.state=n;var s=this.render();return this.componentDidUpdate(o,t),s}}return!1}}]),t}();return b}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.InfernoComponent=t()}(this,function(){"use strict";function e(e){return void 0===e||null===e}function t(e){return null===e||e===!1||void 0===e}function n(){return{"null":!0,dom:document.createTextNode("")}}function o(e,t,n){e.split(",").forEach(function(e){return t[e]=n})}function i(){this._listeners=[],this.scrollX=null,this.scrollY=null,this.screenHeight=m,this.screenWidth=h}function r(){return document.activeElement}function l(e){e!==document.body&&document.activeElement!==e&&e.focus()}function a(e,t,n){for(var o in t)e._pendingState[o]=t[o];if(e._pendingSetState){var i=e._pendingState,r=e.state;e.state=Object.assign({},r,i),e._pendingState={}}else e._pendingSetState=!0,s(e,!1,n)}function s(o,a,s){if(!o._deferSetState||a){o._pendingSetState=!1;var u=o._pendingState,c=o.state,d=Object.assign({},c,u);o._pendingState={};var p=o._updateComponent(c,d,o.props,o.props,a);t(p)&&(p=n());var f=o._lastNode,h=f.dom.parentNode,m=r(),w=new i;o._patch(f,p,h,w,o.context,o,null),o._lastNode=p,o._parentNode.dom=p.dom,w.trigger(),e(s)||s(),l(m)}}var u="http://www.w3.org/1999/xlink",c="http://www.w3.org/XML/1998/namespace",d={},p={},f={};o("xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type",f,u),o("xml:base,xml:lang,xml:space",f,c),o("volume,value",d,!0),o("muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate",p,!0);var h=window.screen.width,m=window.screen.height,w=0,v=0,_=0;window.onscroll=function(e){w=window.scrollX,v=window.scrollY,_=performance.now()},window.resize=function(e){w=window.scrollX,v=window.scrollY,h=window.screen.width,m=window.screen.height,_=performance.now()},i.prototype={refresh:function(){this.scrollX=window.scrollX,this.scrollY=window.scrollY},addListener:function(e){this._listeners.push(e)},trigger:function(){for(var e=0;e<this._listeners.length;e++)this._listeners[e]()}};var S=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},g=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),k="Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.",y=function(){function t(e){S(this,t),this.props=e||{},this.state={},this.refs={},this._blockSetState=!1,this._deferSetState=!1,this._pendingSetState=!1,this._pendingState={},this._parentNode=null,this._lastNode=null,this._unmounted=!0,this.context={},this._patch=null,this._parentComponent=null}return g(t,[{key:"render",value:function(){}},{key:"forceUpdate",value:function(e){if(this._unmounted)throw Error(k);s(this,!0,e)}},{key:"setState",value:function(e,t){if(this._unmounted)throw Error(k);if(this._blockSetState!==!1)throw Error("Inferno Warning: Cannot update state via setState() in componentWillUpdate()");a(this,e,t)}},{key:"componentDidMount",value:function(){}},{key:"componentWillMount",value:function(){}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(){}},{key:"shouldComponentUpdate",value:function(){return!0}},{key:"componentWillReceiveProps",value:function(){}},{key:"componentWillUpdate",value:function(){}},{key:"getChildContext",value:function(){}},{key:"_updateComponent",value:function(t,n,o,i,r){if(this._unmounted===!0)return this._unmounted=!1,!1;if(!e(i)&&e(i.children)&&(i.children=o.children),o!==i||t!==n||r){o!==i&&(this._blockSetState=!0,this.componentWillReceiveProps(i),this._blockSetState=!1);var l=this.shouldComponentUpdate(i,n);if(l!==!1){this._blockSetState=!0,this.componentWillUpdate(i,n),this._blockSetState=!1,this.props=i,this.state=n;var a=this.render();return this.componentDidUpdate(o,t),a}}return!1}}]),t}();return y}); |
/*! | ||
* inferno-create-element v0.7.10 | ||
* inferno-create-element v0.7.11 | ||
* (c) 2016 Dominic Gannaway | ||
@@ -7,286 +7,221 @@ * Released under the MIT License. | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.InfernoCreateElement = factory()); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.InfernoCreateElement = factory()); | ||
}(this, function () { 'use strict'; | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
function isArray(obj) { | ||
return obj instanceof Array; | ||
} | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function isNullOrUndefined(obj) { | ||
return obj === void 0 || obj === null; | ||
} | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function isInvalidNode(obj) { | ||
return obj === null || obj === false || obj === void 0; | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
function isFunction(obj) { | ||
return typeof obj === 'function'; | ||
} | ||
babelHelpers.extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
function isAttrAnEvent(attr) { | ||
return attr[0] === 'o' && attr[1] === 'n' && attr.length > 3; | ||
} | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
function isAttrAHook(hook) { | ||
return hook === 'onCreated' || hook === 'onAttached' || hook === 'onWillDetach' || hook === 'onWillUpdate' || hook === 'onDidUpdate'; | ||
} | ||
return target; | ||
}; | ||
function isAttrAComponentHook(hook) { | ||
return hook === 'onComponentWillMount' || hook === 'onComponentDidMount' || hook === 'onComponentWillUnmount' || hook === 'onComponentShouldUpdate' || hook === 'onComponentWillUpdate' || hook === 'onComponentDidUpdate'; | ||
} | ||
babelHelpers.inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
function VNode(blueprint) { | ||
this.bp = blueprint; | ||
this.dom = null; | ||
this.instance = null; | ||
this.tag = null; | ||
this.children = null; | ||
this.style = null; | ||
this.className = null; | ||
this.attrs = null; | ||
this.events = null; | ||
this.hooks = null; | ||
this.key = null; | ||
this.clipData = null; | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
VNode.prototype = { | ||
setAttrs: function setAttrs(attrs) { | ||
this.attrs = attrs; | ||
return this; | ||
}, | ||
setTag: function setTag(tag) { | ||
this.tag = tag; | ||
return this; | ||
}, | ||
setStyle: function setStyle(style) { | ||
this.style = style; | ||
return this; | ||
}, | ||
setClassName: function setClassName(className) { | ||
this.className = className; | ||
return this; | ||
}, | ||
setChildren: function setChildren(children) { | ||
this.children = children; | ||
return this; | ||
}, | ||
setHooks: function setHooks(hooks) { | ||
this.hooks = hooks; | ||
return this; | ||
}, | ||
setEvents: function setEvents(events) { | ||
this.events = events; | ||
return this; | ||
}, | ||
setKey: function setKey(key) { | ||
this.key = key; | ||
return this; | ||
} | ||
}; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
function createVNode(bp) { | ||
return new VNode(bp); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
babelHelpers; | ||
function createAttrsAndEvents(props, tag) { | ||
var events = null; | ||
var hooks = null; | ||
var attrs = null; | ||
var className = null; | ||
var style = null; | ||
function isArray(obj) { | ||
return obj instanceof Array; | ||
} | ||
if (!isNullOrUndefined(props)) { | ||
if (isArray(props)) { | ||
return props; | ||
} | ||
for (var prop in props) { | ||
if (prop === 'className') { | ||
className = props[prop]; | ||
} else if (prop === 'style') { | ||
style = props[prop]; | ||
} else if (isAttrAHook(prop) && !isFunction(tag)) { | ||
if (isNullOrUndefined(hooks)) { | ||
hooks = {}; | ||
} | ||
hooks[prop.substring(2).toLowerCase()] = props[prop]; | ||
delete props[prop]; | ||
} else if (isAttrAnEvent(prop) && !isFunction(tag)) { | ||
if (isNullOrUndefined(events)) { | ||
events = {}; | ||
} | ||
events[prop.toLowerCase()] = props[prop]; | ||
delete props[prop]; | ||
} else if (isAttrAComponentHook(prop) && isFunction(tag)) { | ||
if (isNullOrUndefined(hooks)) { | ||
hooks = {}; | ||
} | ||
hooks['c' + prop.substring(3)] = props[prop]; | ||
delete props[prop]; | ||
} else if (!isFunction(tag)) { | ||
if (isNullOrUndefined(attrs)) { | ||
attrs = {}; | ||
} | ||
attrs[prop] = props[prop]; | ||
} else { | ||
attrs = props; | ||
} | ||
} | ||
} | ||
return { attrs: attrs, events: events, className: className, style: style, hooks: hooks }; | ||
} | ||
function isNullOrUndefined(obj) { | ||
return obj === void 0 || obj === null; | ||
} | ||
function createChild(_ref) { | ||
var tag = _ref.tag; | ||
var attrs = _ref.attrs; | ||
var children = _ref.children; | ||
var className = _ref.className; | ||
var style = _ref.style; | ||
var events = _ref.events; | ||
var hooks = _ref.hooks; | ||
function isInvalidNode(obj) { | ||
return obj === null || obj === false || obj === void 0; | ||
} | ||
if (tag === void 0 && !isNullOrUndefined(attrs) && !attrs.tpl && !isNullOrUndefined(children) && children.length === 0) { | ||
return null; | ||
} | ||
var key = !isNullOrUndefined(attrs) && !isNullOrUndefined(attrs.key) ? attrs.key : void 0; | ||
function isFunction(obj) { | ||
return typeof obj === 'function'; | ||
} | ||
if (!isNullOrUndefined(children) && children.length === 0) { | ||
children = null; | ||
} else if (!isInvalidNode(children)) { | ||
children = isArray(children) && children.length === 1 ? createChildren(children[0]) : createChildren(children); | ||
} | ||
function isAttrAnEvent(attr) { | ||
return attr[0] === 'o' && attr[1] === 'n' && attr.length > 3; | ||
} | ||
if (key !== void 0) { | ||
delete attrs.key; | ||
} | ||
var attrsAndEvents = createAttrsAndEvents(attrs, tag); | ||
var vNode = createVNode(); | ||
function isAttrAHook(hook) { | ||
return hook === 'onCreated' || hook === 'onAttached' || hook === 'onWillDetach' || hook === 'onWillUpdate' || hook === 'onDidUpdate'; | ||
} | ||
className = className || attrsAndEvents.className; | ||
style = style || attrsAndEvents.style; | ||
function isAttrAComponentHook(hook) { | ||
return hook === 'onComponentWillMount' || hook === 'onComponentDidMount' || hook === 'onComponentWillUnmount' || hook === 'onComponentShouldUpdate' || hook === 'onComponentWillUpdate' || hook === 'onComponentDidUpdate'; | ||
} | ||
vNode.tag = tag || null; | ||
vNode.attrs = attrsAndEvents.attrs || null; | ||
vNode.events = attrsAndEvents.events || events; | ||
vNode.hooks = attrsAndEvents.hooks || hooks; | ||
vNode.children = children === void 0 ? null : children; | ||
vNode.key = key === void 0 ? null : key; | ||
vNode.className = className === void 0 ? null : className; | ||
vNode.style = style === void 0 ? null : style; | ||
function VNode(blueprint) { | ||
this.bp = blueprint; | ||
this.dom = null; | ||
this.instance = null; | ||
this.tag = null; | ||
this.children = null; | ||
this.style = null; | ||
this.className = null; | ||
this.attrs = null; | ||
this.events = null; | ||
this.hooks = null; | ||
this.key = null; | ||
this.clipData = null; | ||
} | ||
return vNode; | ||
} | ||
VNode.prototype = { | ||
setAttrs: function setAttrs(attrs) { | ||
this.attrs = attrs; | ||
return this; | ||
}, | ||
setTag: function setTag(tag) { | ||
this.tag = tag; | ||
return this; | ||
}, | ||
setStyle: function setStyle(style) { | ||
this.style = style; | ||
return this; | ||
}, | ||
setClassName: function setClassName(className) { | ||
this.className = className; | ||
return this; | ||
}, | ||
setChildren: function setChildren(children) { | ||
this.children = children; | ||
return this; | ||
}, | ||
setHooks: function setHooks(hooks) { | ||
this.hooks = hooks; | ||
return this; | ||
}, | ||
setEvents: function setEvents(events) { | ||
this.events = events; | ||
return this; | ||
}, | ||
setKey: function setKey(key) { | ||
this.key = key; | ||
return this; | ||
} | ||
}; | ||
function createChildren(children) { | ||
var childrenDefined = !isNullOrUndefined(children); | ||
if (childrenDefined && isArray(children)) { | ||
var newChildren = []; | ||
function createVNode(bp) { | ||
return new VNode(bp); | ||
} | ||
for (var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
if (!isNullOrUndefined(child) && (typeof child === 'undefined' ? 'undefined' : _typeof(child)) === 'object') { | ||
if (isArray(child)) { | ||
if (child.length > 0) { | ||
newChildren.push(createChildren(child)); | ||
} else { | ||
newChildren.push(null); | ||
} | ||
} else { | ||
newChildren.push(createChild(child)); | ||
} | ||
} else { | ||
newChildren.push(child); | ||
} | ||
} | ||
return newChildren; | ||
} else if (childrenDefined && (typeof children === 'undefined' ? 'undefined' : _typeof(children)) === 'object') { | ||
return children.dom === void 0 ? createChild(children) : children; | ||
} | ||
return children; | ||
} | ||
function createAttrsAndEvents(props, tag) { | ||
var events = null; | ||
var hooks = null; | ||
var attrs = null; | ||
var className = null; | ||
var style = null; | ||
function createElement(tag, props) { | ||
for (var _len = arguments.length, children = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
children[_key - 2] = arguments[_key]; | ||
} | ||
if (!isNullOrUndefined(props)) { | ||
if (isArray(props)) { | ||
return props; | ||
} | ||
for (var prop in props) { | ||
if (prop === 'className') { | ||
className = props[prop]; | ||
} else if (prop === 'style') { | ||
style = props[prop]; | ||
} else if (isAttrAHook(prop) && !isFunction(tag)) { | ||
if (isNullOrUndefined(hooks)) { | ||
hooks = {}; | ||
} | ||
hooks[prop.substring(2).toLowerCase()] = props[prop]; | ||
delete props[prop]; | ||
} else if (isAttrAnEvent(prop) && !isFunction(tag)) { | ||
if (isNullOrUndefined(events)) { | ||
events = {}; | ||
} | ||
events[prop.toLowerCase()] = props[prop]; | ||
delete props[prop]; | ||
} else if (isAttrAComponentHook(prop) && isFunction(tag)) { | ||
if (isNullOrUndefined(hooks)) { | ||
hooks = {}; | ||
} | ||
hooks['c' + prop.substring(3)] = props[prop]; | ||
delete props[prop]; | ||
} else if (!isFunction(tag)) { | ||
if (isNullOrUndefined(attrs)) { | ||
attrs = {}; | ||
} | ||
attrs[prop] = props[prop]; | ||
} else { | ||
attrs = props; | ||
} | ||
} | ||
} | ||
return { attrs: attrs, events: events, className: className, style: style, hooks: hooks }; | ||
} | ||
return createChild({ tag: tag, attrs: props, children: children }); | ||
} | ||
function createChild(_ref) { | ||
var tag = _ref.tag; | ||
var attrs = _ref.attrs; | ||
var children = _ref.children; | ||
var className = _ref.className; | ||
var style = _ref.style; | ||
var events = _ref.events; | ||
var hooks = _ref.hooks; | ||
return createElement; | ||
if (tag === void 0 && !isNullOrUndefined(attrs) && !attrs.tpl && !isNullOrUndefined(children) && children.length === 0) { | ||
return null; | ||
} | ||
var key = !isNullOrUndefined(attrs) && !isNullOrUndefined(attrs.key) ? attrs.key : void 0; | ||
if (!isNullOrUndefined(children) && children.length === 0) { | ||
children = null; | ||
} else if (!isInvalidNode(children)) { | ||
children = isArray(children) && children.length === 1 ? createChildren(children[0]) : createChildren(children); | ||
} | ||
if (key !== void 0) { | ||
delete attrs.key; | ||
} | ||
var attrsAndEvents = createAttrsAndEvents(attrs, tag); | ||
var vNode = createVNode(); | ||
className = className || attrsAndEvents.className; | ||
style = style || attrsAndEvents.style; | ||
vNode.tag = tag || null; | ||
vNode.attrs = attrsAndEvents.attrs || null; | ||
vNode.events = attrsAndEvents.events || events; | ||
vNode.hooks = attrsAndEvents.hooks || hooks; | ||
vNode.children = children === void 0 ? null : children; | ||
vNode.key = key === void 0 ? null : key; | ||
vNode.className = className === void 0 ? null : className; | ||
vNode.style = style === void 0 ? null : style; | ||
return vNode; | ||
} | ||
function createChildren(children) { | ||
var childrenDefined = !isNullOrUndefined(children); | ||
if (childrenDefined && isArray(children)) { | ||
var newChildren = []; | ||
for (var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
if (!isNullOrUndefined(child) && (typeof child === 'undefined' ? 'undefined' : babelHelpers.typeof(child)) === 'object') { | ||
if (isArray(child)) { | ||
if (child.length > 0) { | ||
newChildren.push(createChildren(child)); | ||
} else { | ||
newChildren.push(null); | ||
} | ||
} else { | ||
newChildren.push(createChild(child)); | ||
} | ||
} else { | ||
newChildren.push(child); | ||
} | ||
} | ||
return newChildren; | ||
} else if (childrenDefined && (typeof children === 'undefined' ? 'undefined' : babelHelpers.typeof(children)) === 'object') { | ||
return children.dom === void 0 ? createChild(children) : children; | ||
} | ||
return children; | ||
} | ||
function createElement(tag, props) { | ||
for (var _len = arguments.length, children = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { | ||
children[_key - 2] = arguments[_key]; | ||
} | ||
return createChild({ tag: tag, attrs: props, children: children }); | ||
} | ||
return createElement; | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.InfernoCreateElement=n()}(this,function(){"use strict";function t(t){return t instanceof Array}function n(t){return void 0===t||null===t}function e(t){return null===t||t===!1||void 0===t}function o(t){return"function"==typeof t}function r(t){return"o"===t[0]&&"n"===t[1]&&t.length>3}function l(t){return"onCreated"===t||"onAttached"===t||"onWillDetach"===t||"onWillUpdate"===t||"onDidUpdate"===t}function i(t){return"onComponentWillMount"===t||"onComponentDidMount"===t||"onComponentWillUnmount"===t||"onComponentShouldUpdate"===t||"onComponentWillUpdate"===t||"onComponentDidUpdate"===t}function u(t){this.bp=t,this.dom=null,this.instance=null,this.tag=null,this.children=null,this.style=null,this.className=null,this.attrs=null,this.events=null,this.hooks=null,this.key=null,this.clipData=null}function s(t){return new u(t)}function a(e,u){var s=null,a=null,f=null,c=null,h=null;if(!n(e)){if(t(e))return e;for(var p in e)"className"===p?c=e[p]:"style"===p?h=e[p]:l(p)&&!o(u)?(n(a)&&(a={}),a[p.substring(2).toLowerCase()]=e[p],delete e[p]):r(p)&&!o(u)?(n(s)&&(s={}),s[p.toLowerCase()]=e[p],delete e[p]):i(p)&&o(u)?(n(a)&&(a={}),a["c"+p.substring(3)]=e[p],delete e[p]):o(u)?f=e:(n(f)&&(f={}),f[p]=e[p])}return{attrs:f,events:s,className:c,style:h,hooks:a}}function f(o){var r=o.tag,l=o.attrs,i=o.children,u=o.className,f=o.style,h=o.events,p=o.hooks;if(void 0===r&&!n(l)&&!l.tpl&&!n(i)&&0===i.length)return null;var d=n(l)||n(l.key)?void 0:l.key;n(i)||0!==i.length?e(i)||(i=c(t(i)&&1===i.length?i[0]:i)):i=null,void 0!==d&&delete l.key;var y=a(l,r),v=s();return u=u||y.className,f=f||y.style,v.tag=r||null,v.attrs=y.attrs||null,v.events=y.events||h,v.hooks=y.hooks||p,v.children=void 0===i?null:i,v.key=void 0===d?null:d,v.className=void 0===u?null:u,v.style=void 0===f?null:f,v}function c(e){var o=!n(e);if(o&&t(e)){for(var r=[],l=0;l<e.length;l++){var i=e[l];n(i)||"object"!==("undefined"==typeof i?"undefined":p.typeof(i))?r.push(i):t(i)?i.length>0?r.push(c(i)):r.push(null):r.push(f(i))}return r}return o&&"object"===("undefined"==typeof e?"undefined":p.typeof(e))&&void 0===e.dom?f(e):e}function h(t,n){for(var e=arguments.length,o=Array(e>2?e-2:0),r=2;e>r;r++)o[r-2]=arguments[r];return f({tag:t,attrs:n,children:o})}var p={};return p.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},p.classCallCheck=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},p.createClass=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),p.extends=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},p.inherits=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)},p.possibleConstructorReturn=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?t:n},u.prototype={setAttrs:function(t){return this.attrs=t,this},setTag:function(t){return this.tag=t,this},setStyle:function(t){return this.style=t,this},setClassName:function(t){return this.className=t,this},setChildren:function(t){return this.children=t,this},setHooks:function(t){return this.hooks=t,this},setEvents:function(t){return this.events=t,this},setKey:function(t){return this.key=t,this}},h}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.InfernoCreateElement=n()}(this,function(){"use strict";function t(t){return t instanceof Array}function n(t){return void 0===t||null===t}function e(t){return null===t||t===!1||void 0===t}function o(t){return"function"==typeof t}function l(t){return"o"===t[0]&&"n"===t[1]&&t.length>3}function i(t){return"onCreated"===t||"onAttached"===t||"onWillDetach"===t||"onWillUpdate"===t||"onDidUpdate"===t}function s(t){return"onComponentWillMount"===t||"onComponentDidMount"===t||"onComponentWillUnmount"===t||"onComponentShouldUpdate"===t||"onComponentWillUpdate"===t||"onComponentDidUpdate"===t}function u(t){this.bp=t,this.dom=null,this.instance=null,this.tag=null,this.children=null,this.style=null,this.className=null,this.attrs=null,this.events=null,this.hooks=null,this.key=null,this.clipData=null}function r(t){return new u(t)}function a(e,u){var r=null,a=null,f=null,h=null,c=null;if(!n(e)){if(t(e))return e;for(var d in e)"className"===d?h=e[d]:"style"===d?c=e[d]:i(d)&&!o(u)?(n(a)&&(a={}),a[d.substring(2).toLowerCase()]=e[d],delete e[d]):l(d)&&!o(u)?(n(r)&&(r={}),r[d.toLowerCase()]=e[d],delete e[d]):s(d)&&o(u)?(n(a)&&(a={}),a["c"+d.substring(3)]=e[d],delete e[d]):o(u)?f=e:(n(f)&&(f={}),f[d]=e[d])}return{attrs:f,events:r,className:h,style:c,hooks:a}}function f(o){var l=o.tag,i=o.attrs,s=o.children,u=o.className,f=o.style,c=o.events,d=o.hooks;if(void 0===l&&!n(i)&&!i.tpl&&!n(s)&&0===s.length)return null;var y=n(i)||n(i.key)?void 0:i.key;n(s)||0!==s.length?e(s)||(s=h(t(s)&&1===s.length?s[0]:s)):s=null,void 0!==y&&delete i.key;var p=a(i,l),m=r();return u=u||p.className,f=f||p.style,m.tag=l||null,m.attrs=p.attrs||null,m.events=p.events||c,m.hooks=p.hooks||d,m.children=void 0===s?null:s,m.key=void 0===y?null:y,m.className=void 0===u?null:u,m.style=void 0===f?null:f,m}function h(e){var o=!n(e);if(o&&t(e)){for(var l=[],i=0;i<e.length;i++){var s=e[i];n(s)||"object"!==("undefined"==typeof s?"undefined":d(s))?l.push(s):t(s)?s.length>0?l.push(h(s)):l.push(null):l.push(f(s))}return l}return o&&"object"===("undefined"==typeof e?"undefined":d(e))&&void 0===e.dom?f(e):e}function c(t,n){for(var e=arguments.length,o=Array(e>2?e-2:0),l=2;e>l;l++)o[l-2]=arguments[l];return f({tag:t,attrs:n,children:o})}u.prototype={setAttrs:function(t){return this.attrs=t,this},setTag:function(t){return this.tag=t,this},setStyle:function(t){return this.style=t,this},setClassName:function(t){return this.className=t,this},setChildren:function(t){return this.children=t,this},setHooks:function(t){return this.hooks=t,this},setEvents:function(t){return this.events=t,this},setKey:function(t){return this.key=t,this}};var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t};return c}); |
/*! | ||
* inferno-dom v0.7.10 | ||
* inferno-dom v0.7.11 | ||
* (c) 2016 Dominic Gannaway | ||
@@ -12,73 +12,2 @@ * Released under the MIT License. | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
babelHelpers.extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
babelHelpers.inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
babelHelpers; | ||
function addChildrenToProps(children, props) { | ||
@@ -85,0 +14,0 @@ if (!isNullOrUndefined(children)) { |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.InfernoDOM=n()}(this,function(){"use strict";function e(e,t){if(!l(e)){var r=n(e);(r&&e.length>0||!r)&&(t=t?Object.assign({},t,{children:e}):{children:e})}return t}function n(e){return e instanceof Array}function t(e){return void 0!==e.prototype.render}function r(e){return"string"==typeof e||"number"==typeof e}function l(e){return void 0===e||null===e}function o(e){return null===e||e===!1||void 0===e}function i(e){return"function"==typeof e}function a(e){return"string"==typeof e}function s(e){return e instanceof Promise}function c(e,n,t){e.splice(e.indexOf(n),1,t)}function d(e,t){if(!o(e))if(n(e))for(var r=0;r<e.length;r++){var l=e[r];if(!o(l)){if(l===t)return!0;if(l.children)return d(l.children,t)}}else{if(e===t)return!0;if(e.children)return d(e.children,t)}return!1}function u(e,n){var t=n.props.children;return d(t,e)?u(e,n._parentComponent):n}function f(e,n,t,r,o){if(void 0!==n){var i=e.key,a=null===i?n.pools.nonKeyed:n.pools.keyed[i];if(!l(a)){var s=a.pop();if(!l(s))return oe(s,e,null,t,r,o,!0,n.isSVG),e.dom}}return null}function h(e){var n=e.bp;if(!l(n)){var t=e.key,r=n.pools;if(null===t){var o=r.nonKeyed;o&&o.push(e)}else{var i=r.keyed;(i[t]||(i[t]=[])).push(e)}return!0}return!1}function p(e,t,r,l,i,a){if(n(e))return z(e,t);if(o(e))return null;var s=e.bp;if(Ne){var c=f(e,s,r,l,i);if(null!==c)return null!==t&&t.appendChild(c),c}return void 0===s?y(e,t,r,l,i,a):m(e,s,t,r,l,i)}function v(e){"select"===e.tag&&I(e)}function m(e,n,t,r,l,o){var i=e.tag;if(n.isComponent===!0)return x(e,i,e.attrs||{},e.hooks,e.children,o,t,r,l);var a=E(n.tag,n.isSVG);switch(e.dom=a,n.hasHooks===!0&&R(e.hooks,r,a),n.lazy===!0&&pe(e,r,a),n.childrenType){case 1:U(e.children,a,!0);break;case 2:p(e.children,a,r,l,o);break;case 3:C(e,e.children,a,r,l,o);break;case 4:b(e.children,a,r,l,o);break;case 5:w(e,e.children,a,r,l,o)}if(n.hasAttrs===!0){v(e);var s=e.attrs;if(null===n.attrKeys){var c=Object.keys(s);n.attrKeys=n.attrKeys?n.attrKeys.concat(c):c}var d=n.attrKeys;_(e,s,d,a,o)}if(n.hasClassName===!0&&(a.className=e.className),n.hasStyle===!0&&ie(null,e.style,a),n.hasEvents===!0){var u=e.events;null===n.eventKeys&&(n.eventKeys=Object.keys(u));var f=n.eventKeys;N(u,f,a)}return null!==t&&t.appendChild(a),a}function y(e,n,t,r,s,c){var d=e.tag;if(null===d)return z(e,n);if(i(d))return x(e,d,e.attrs||{},e.hooks,e.children,s,n,t,r);if(!a(d)||""===d)throw Error("Inferno Error: Expected function or string for element tag type");"svg"===d&&(c=!0);var u=E(d,c),f=e.children,h=e.attrs,p=e.events,m=e.hooks,y=e.className,g=e.style;return e.dom=u,l(m)||R(m,t,u),o(f)||w(e,f,u,t,r,s,c),l(h)||(v(e),_(e,h,Object.keys(h),u,s)),l(y)||(u.className=y),l(g)||ie(null,g,u),l(p)||N(p,Object.keys(p),u),null!==n&&n.appendChild(u),u}function g(e,n,t,r,l,i,a){var s=A();t&&t.push(s),e.then(function(e){var d=p(e,null,r,l,i,a);null===n||o(d)||n.replaceChild(d,s),t&&c(t,s,d)}),n.appendChild(s)}function b(e,n,t,r,l){for(var o=0;o<e.length;o++)p(e[o],n,t,r,l)}function C(e,t,i,a,c,d,u){for(var f=null,h=!1,v=!1,m=0;m<t.length;m++){var y=t[m];if(r(y))h=!0,f=f||[],f.push(U(y,i,!1));else if(!l(y)&&n(y)){var b=X();h=!0,C(e,y,b,a,c,d,u),j(i,b),f=f||[],f.push(b)}else if(s(y))g(y,i,f,a,c,d,u);else{var w=p(y,i,a,c,d,u);h||!v&&!l(y)&&l(y.key)?(h=!0,f=f||[],f.push(w)):o(y)?(h=!0,f=f||[],f.push(w)):v===!1&&(v=!0)}}null!==f&&f.length>1&&h===!0&&(e.domChildren=f)}function w(e,t,l,o,i,a,c){n(t)?C(e,t,l,o,i,a,c):r(t)?U(t,l,!0):s(t)?g(t,l,null,o,i,a,c):p(t,l,o,i,a,c)}function k(e,n,t){!o(e)&&a(n)&&(e.refs[n]=t)}function N(e,n,t){for(var r=0;r<n.length;r++){var l=n[r];t[l]=e[l]}}function x(n,r,i,a,s,c,d,u,f){i=e(s,i);var h=void 0;if(t(r)){var v=new r(i);v._patch=oe,!l(c)&&i.ref&&k(c,i.ref,v);var m=v.getChildContext();l(m)||(f=Object.assign({},f,m)),v.context=f,v._unmounted=!1,v._parentNode=n,c&&(v._parentComponent=c),v._pendingSetState=!0,v.componentWillMount();var y=v.render();v._pendingSetState=!1,o(y)?(v._lastNode=S(),h=v._lastNode.dom):(h=p(y,null,u,f,v,!1),v._lastNode=y,v.componentDidMount()),null===d||o(h)||d.appendChild(h),n.dom=h,n.instance=v}else{l(a)||(l(a.componentWillMount)||a.componentWillMount(null,i),l(a.componentDidMount)||u.addListener(function(){a.componentDidMount(h,i)}));var g=r(i,f);h=p(g,null,u,f,null,!1),n.instance=g,null===d||o(h)||d.appendChild(h),n.dom=h}return h}function _(e,n,t,r,l){for(var o=0;o<t.length;o++){var i=t[o];"ref"===i?k(u(e,l),n[i],r):se(i,null,n[i],r)}}function O(e){return!l(e.append)}function j(e,n,t){l(t)?O(n)?n.append(e):e.appendChild(n):O(n)?n.insert(e,t):O(t)?e.insertBefore(n,t.childNodes[0]||t.dom):e.insertBefore(n,t)}function S(){return{"null":!0,dom:document.createTextNode("")}}function T(e,n,t){l(t)?e.appendChild(n):e.insertBefore(n,t)}function E(e,n){var t=void 0;return t=n===!0?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function U(e,n,t){if(null===n)return document.createTextNode(e);if(t){if(""!==e)return n.textContent=e,n.firstChild;var r=document.createTextNode("");return n.appendChild(r),r}var l=document.createTextNode(e);return n.appendChild(l),l}function D(e,n,t,r,o,i,a){var s=null,c=e._lastNode;l(c)||(s=e,e=c),K(e);var d=p(n,null,r,o,i,a);n.dom=d,M(t,d,e.dom),null!==s&&(s._lastNode=n)}function M(e,n,t){O(t)?t.replaceWith(n):e.replaceChild(n,t)}function K(e){if(!o(e)&&!r(e)){var t=e.instance,i=null,a=null;l(t)||(i=t.hooks,a=t.children,void 0!==t.render&&(t.componentWillUnmount(),t._unmounted=!0,K(t._lastNode)));var s=e.hooks||i;l(s)||(l(s.willDetach)||s.willDetach(e.dom),l(s.componentWillUnmount)||s.componentWillUnmount(e.dom,s));var c=e.children||a;if(!l(c))if(n(c))for(var d=0;d<c.length;d++)K(c[d]);else K(c)}}function A(){return document.createTextNode("")}function V(e,n){var t=e.dom;t===n?t.innerHTML="":(n.removeChild(t),Ne&&h(e)),K(e)}function B(e,n,t){for(var r=n||Object.keys(e),l=0;l<r.length;l++){var o=r[l];t[o]=null}}function H(e,n,t){for(var r=0;r<n.length;r++)e.insertBefore(n[r],t)}function W(){return document.activeElement}function Y(e,n){if(Ne){var t=n.length;if(t>5)for(var r=0;t>r;r++){var l=n[r];o(l)||h(l)}}e.textContent=""}function L(e){null!==e&&e!==document.body&&document.activeElement!==e&&e.focus()}function X(){var e=[],n=document.createTextNode(""),t=null,r={dom:n,childNodes:e,appendChild:function(r){e.push(r),t&&t.insertBefore(r,n)},removeChild:function(n){t&&t.removeChild(n),e.splice(e.indexOf(n),1)},insertBefore:function(n,r){t&&t.insertBefore(n,r),e.splice(e.indexOf(r),0,n)},replaceChild:function(n,r){t.replaceChild(n,r),c(e,r,n)},append:function(r){r.appendChild(n),t=r,H(t,e,n)},insert:function(r,l){r.insertBefore(n,l),t=r,H(t,e,n)},remove:function(){t.removeChild(n);for(var r=0;r<e.length;r++)t.removeChild(e[r]);t=null},replaceWith:function(r){t.replaceChild(r,n);for(var l=0;l<e.length;l++)t.removeChild(e[l]);t=null},getElementsByTagName:null};return Object.defineProperty(r,"parentNode",{get:function(){return t}}),Object.defineProperty(r,"firstChild",{get:function(){return e[0]}}),r}function P(e,n){return n.length&&!l(n[0])&&!l(n[0].key)||e.length&&!l(e[0])&&!l(e[0].key)}function G(e,n){if("option"===e.tag){var t=e.attrs&&e.attrs.value;n[t]?(e.attrs=e.attrs||{},e.attrs.selected="selected",e.dom.selected=!0):e.dom.selected=!1}else for(var r=0,l=e.children.length;l>r;r++)G(e.children[r],n)}function I(e){var t=e.attrs&&e.attrs.value,r={};if(n(t))for(var l=0,o=t.length;o>l;l++)r[t[l]]=t[l];else r[t]=t;for(var i=0,a=e.children.length;a>i;i++)G(e.children[i],r);e.attrs&&e.attrs[t]&&delete e.attrs.value}function z(e,n){var t=A();return null!==n&&n.appendChild(t),o(e)||(e.dom=t),t}function R(e,n,t){l(e.created)||e.created(t),l(e.attached)||n.addListener(function(){e.attached(t)})}function q(e){var n=e.attrs.value;l(n)||(e.dom.value=n)}function F(e,n){if("input"===e){var t=n.attrs.type;if("text"===t)q(n);else if("checkbox"===t||"radio"===t){var r=n.attrs.checked;n.dom.checked=!!r}}else"textarea"===e&&q(n)}function J(e,t,i,a,s,c,d){var u=t.children,f=e.children;if(f!==u){var h=null;e.domChildren&&(h=t.domChildren=e.domChildren),o(f)?r(u)?re(i,f,u):l(u)||(n(u)?C(t,u,i,a,s,c,d):p(u,i,a,s,c,d)):o(u)?Y(i,f):n(f)?n(u)?null===h&&f.length>1?ue(f,u,i,a,s,c,d):P(f,u)?ue(f,u,i,a,s,c,d):de(f,u,i,h||(t.domChildren=[]),a,s,c,0,d):de(f,[u],i,h||[],a,s,c,0):n(u)?de([f],u,i,h||(t.domChildren=[i.firstChild]),a,s,c,0,d):r(u)?re(i,f,u):r(f)?oe(f,u,i,a,s,c,null,d):oe(f,u,i,a,s,c,!0,d)}}function Q(e,n,t,r){e&&(a(n)&&delete e.refs[n],a(t)&&(e.refs[t]=r))}function Z(e,n,t,r,o){var i=n.events,a=e.events,s=!l(i),c=!l(a);s?c?ae(a,i,t,r,o):N(i,r,o):c&&B(a,t,o)}function $(e,n,t,r,o,i){"select"===e.tag&&I(n);var a=n.attrs,s=e.attrs,c=l(a),d=!l(s);if(!c)for(var f=r||Object.keys(a),h=f.length,p=0;h>p;p++){var v=f[p],m=d&&s[v],y=a[v];m!==y&&("ref"===v?Q(i,m,y,o):se(v,m,y,o))}if(d)for(var g=t||Object.keys(s),b=g.length,C=0;b>C;C++){var w=g[C];(c||l(a[w]))&&("ref"===w?Q(u(node,i),s[w],null,o):o.removeAttribute(w))}}function ee(e,n,r,i,a,s,c,d,u){var f=void 0;i.hasHooks===!0&&(f=n.hooks,f&&!l(f.willUpdate)&&f.willUpdate(e.dom));var h=n.tag||i.tag,v=e.tag||r.tag;if(v!==h)if(r.isComponent===!0){var m=e.instance;i.isComponent===!0?D(e,n,a,s,c,d,!1):t(v)?ne(m._lastNode,n,a,s,c,d,i.isSVG):ne(m,n,a,s,c,d,i.isSVG)}else D(e,n,a,s,c,d,i.isSVG);else if(l(v))n.dom=e.dom;else if(r.isComponent===!0){if(i.isComponent===!0){var y=e.instance;if(!l(y)&&y._unmounted){var g=x(n,v,n.attrs||{},n.hooks,n.children,y,a,s,c);null!==a&&M(a,g,e.dom)}else n.instance=y,n.dom=e.dom,ce(!0,n,n.tag,r,i,y,e.attrs||{},n.attrs||{},n.hooks,n.children,a,s,c)}}else{var b=e.dom,w=r.childrenType,k=i.childrenType;if(n.dom=b,i.lazy===!0&&u===!1){var N=e.clipData;if(null===s.scrollY&&s.refresh(),n.clipData=N,(N.pending===!0||N.top-s.scrollY>s.screenHeight)&&ge(N,b,e,n,a,s))return;if(N.bottom<s.scrollY&&ge(N,b,e,n,a,s))return}if(w>0||k>0)if(5===k||5===w)J(e,n,b,s,c,d);else{var _=e.children,O=n.children;0===w||o(_)?k>2?C(n,O,b,s,c,d):p(O,b,s,c,d):0===k||o(O)?w>2?Y(b,_):V(_,b):_!==O&&(4===w&&4===k?ue(_,O,b,s,c,d):2===w&&2===k?oe(_,O,b,s,c,d,!0,!1):1===w&&1===k?re(b,_,O):J(e,n,b,s,c,d))}if(r.hasAttrs!==!0&&i.hasAttrs!==!0||$(e,n,r.attrKeys,i.attrKeys,b,d),r.hasEvents!==!0&&i.hasEvents!==!0||Z(e,n,r.eventKeys,i.eventKeys,b),r.hasClassName===!0||i.hasClassName===!0){var j=n.className;e.className!==j&&(l(j)?b.removeAttribute("class"):b.className=j)}if(r.hasStyle===!0||i.hasStyle===!0){var S=n.style;e.style!==S&&ie(e.style,S,b)}i.hasHooks!==!0||l(f.didUpdate)||f.didUpdate(b),F(h,n)}}function ne(e,n,r,o,a,c,d){if(s(n))n.then(function(n){oe(e,n,r,o,a,c,null,!1)});else{var u=n.hooks,f=!l(u);f&&!l(u.willUpdate)&&u.willUpdate(e.dom);var h=n.tag||(l(n.bp)?null:n.bp.tag),p=e.tag||(l(e.bp)?null:e.bp.tag);if("svg"===h&&(d=!0),p!==h){var v=e.instance;i(p)?i(h)?D(e,n,r,o,a,c,d):t(p)?ne(v._lastNode,n,r,o,a,c,d):ne(v,n,r,o,a,c,d):D(v||e,n,r,o,a,c,d)}else if(l(p))n.dom=e.dom;else if(i(p)){if(i(h)){var m=e._instance;if(!l(m)&&m._unmounted){var y=x(n,p,n.attrs||{},n.hooks,n.children,m,r,o,a);null!==r&&M(r,y,e.dom)}else n.instance=e.instance,n.dom=e.dom,ce(!1,n,n.tag,null,null,n.instance,e.attrs||{},n.attrs||{},n.hooks,n.children,r,o,a)}}else{var g=e.dom,b=n.className,C=n.style;n.dom=g,J(e,n,g,o,a,c,d),$(e,n,null,null,g,c),Z(e,n,null,null,g),e.className!==b&&(l(b)?g.removeAttribute("class"):g.className=b),e.style!==C&&ie(e.style,C,g),f&&!l(u.didUpdate)&&u.didUpdate(g),F(h,n)}}}function te(e,n,t){e.split(",").forEach(function(e){return n[e]=t})}function re(e,n,t){r(n)?e.firstChild.nodeValue=t:e.textContent=t}function le(e,n,t,r,l,o,i,a){var s=e.bp,c=n.bp;void 0===s||void 0===c?ne(e,n,t,r,l,o,i):ee(e,n,s,c,t,r,l,o,a)}function oe(e,n,t,i,a,s,c,d){if(null!==c)le(e,n,t,i,a,s,d,!1);else if(o(e))p(n,t,i,a,s,d);else if(o(n))V(e,t);else if(r(e))if(r(n))t.firstChild.nodeValue=n;else{var u=p(n,null,i,a,s,d);n.dom=u,M(t,u,t.firstChild)}else if(r(n)){var f=document.createTextNode(n);M(t,f,e.dom)}else if(l(n.null))le(e,n,t,i,a,s,d,!1);else{var h=void 0;e.dom&&(K(e),h=e.dom),M(t,n.dom,h)}}function ie(e,n,t){if(a(n))t.style.cssText=n;else if(l(e)){if(!l(n))for(var r=Object.keys(n),o=0;o<r.length;o++){var i=r[o];t.style[i]=n[i]}}else if(l(n))t.removeAttribute("style");else{for(var s=Object.keys(n),c=0;c<s.length;c++){var d=s[c];t.style[d]=n[d]}for(var u=Object.keys(e),f=0;f<u.length;f++){var h=u[f];l(n[h])&&(t.style[h]="")}}}function ae(e,n,t,r,o){for(var i=r||Object.keys(n),a=0;a<i.length;a++){var s=i[a],c=e[s],d=n[s];c!==d&&(o[s]=d)}for(var u=t||Object.keys(e),f=0;f<u.length;f++){var h=u[f];l(n[h])&&(o[h]=null)}}function se(e,n,t,r){if("dangerouslySetInnerHTML"===e){var o=n&&n.__html,i=t&&t.__html;if(l(i))throw new Error("Inferno Error: dangerouslySetInnerHTML requires an object with a __html propety containing the innerHTML content");o!==i&&(r.innerHTML=i)}else if(Oe[e])r[e]=null===t?"":t;else if(je[e])r[e]=!!t;else{var a=Se[e];t===!1||l(t)?void 0!==a?r.removeAttributeNS(a,e):r.removeAttribute(e):void 0!==a?r.setAttributeNS(a,e,t===!0?e:t):r.setAttribute(e,t===!0?e:t)}}function ce(n,r,i,a,s,c,d,u,f,h,p,v,m){if(u=e(h,u),t(i)){var y=c.props,g=c.state,b=c.state,C=c.getChildContext();l(C)||(m=Object.assign({},m,C)),c.context=m;var w=c._updateComponent(g,b,y,u);o(w)||(oe(c._lastNode,w,p,v,m,c,null,!1),r.dom=w.dom,c._lastNode=w)}else{var k=!0,N=n&&s.hasHooks===!0||!l(f);if(N&&!l(f.componentShouldUpdate)&&(k=f.componentShouldUpdate(r.dom,d,u)),k!==!1){N&&!l(f.componentWillUpdate)&&f.componentWillUpdate(r.dom,d,u);var x=i(u,m);o(x)||(x.dom=r.dom,oe(c,x,p,v,m,null,null,!1),r.instance=x,N&&!l(f.componentDidUpdate)&&f.componentDidUpdate(r.dom,d,u))}}}function de(e,t,i,a,s,c,d,u,f){var h=void 0===i.append,v=e.length,m=t.length,y=v===m;if(y===!1)if(v>m)for(;v!==m;){var g=e[v-1];o(g)||(i.removeChild(a[v-1+u]),h&&a.splice(v-1+u,1),K(g),v--,e.pop())}else for(;v!==m;){var b=t[v],C=void 0;e.push(b),C=r(b)?document.createTextNode(b):p(b,null,s,c,d,f),o(C)||j(i,C),h&&(1===v&&a.push(i.firstChild),a.splice(v+u,0,C)),v++}for(var w=0;m>w;w++){var k=e[w],N=t[w],x=w+u;if(k===N&&o(k))u--;else if(o(N)){if(!o(k))if(n(k)&&0===k.length)for(var _=0;_<k.length;_++)V(k[_],i);else{var O=a[x];l(O)&&x--,i.removeChild(a[x]),h&&(a.splice(x,1),u--),K(k)}}else if(o(k))if(r(N)){var S=document.createTextNode(N),T=a[x];if(l(T)){var E=a[x+1];j(i,S,E),h&&a.splice(x,1,S)}else j(i,S,T),h&&a.splice(x,0,S)}else{var U=p(N,null,s,c,d,f),D=a[x];if(l(D)){var A=a[x+1];j(i,U,A),h&&a.splice(x,1,U)}else j(i,U,D),h&&a.splice(x,0,U)}else if(r(N))if(1===v)r(k)?void 0===i.getElementsByTagName?i.nodeValue=N:i.firstChild.nodeValue=N:(K(k),i.textContent=N);else{var B=document.createTextNode(N),H=a[x];l(H)?i.nodeValue=B.nodeValue:r(k)?H.nodeValue=N:void 0===H.append?(h&&a.splice(x,1,B),M(i,B,H)):(j(i,B,H.firstChild),H.remove(),a.splice(0,a.length,B)),K(k)}else if(n(N))if(P(k,N))ue(k,N,a[x],s,c,d,f);else if(n(k)){var W=a[x];if(void 0===W.append)if(N.length>1&&1===k.length){var Y=X();Y.insert(i,W),Y.appendChild(W),h&&a.splice(x,1,Y),de(k,N,Y,Y.childNodes,s,c,d,0,f)}else de(k,N,i,a,s,c,d,0,f);else de(k,N,a[x],a[x].childNodes,s,c,d,0,f)}else if(N.length>1){var L=X();L.appendChild(i.firstChild),j(i,L,i.firstChild),h&&a.splice(x,1,L),de([k],N,L,L.childNodes,s,c,d,w,f)}else de([k],N,i,a,s,c,d,w,f);else n(k)?de(k,[N],a,a[x].childNodes,s,c,d,0,f):(oe(k,N,i,s,c,d,null,f),a[x]=N.dom)}}function ue(e,n,t,r,l,o,i){for(var a=e.length,s=n.length,c=void 0,d=a-1,u=s-1,f=0,h=0,v=null,m=null,y=null,g=null,b=void 0,C=void 0,w=0,k=void 0,N=void 0;d>=f&&u>=h&&(m=n[h],v=e[f],m.key===v.key);)oe(v,m,t,r,l,o,!0,i),h++,f++;for(;d>=f&&u>=h&&(y=n[u],g=e[d],y.key===g.key);)oe(g,y,t,r,l,o,!0,i),u--,d--;for(;d>=f&&u>=h&&(y=n[u],v=e[f],y.key===v.key);)C=s>u+1?n[u+1].dom:null,oe(v,y,t,r,l,o,!0,i),T(t,y.dom,C),u--,f++;for(;d>=f&&u>=h&&(m=n[h],g=e[d],m.key===g.key);)C=e[f].dom,oe(g,m,t,r,l,o,!0,i),T(t,m.dom,C),h++,d--;if(f>d){if(u>=h)for(C=s>u+1?n[u+1].dom:null;u>=h;h++)T(t,p(n[h],null,r,l,o,i),C)}else if(h>u)for(;d>=f;)V(e[f++],t);else{var x=d-f+1,_=u-h+1,O=new Array(_);for(c=0;_>c;c++)O[c]=-1;var j=!1,S=0;if(16>=x*_)for(c=f;d>=c;c++){var E=!0;for(g=e[c],b=h;u>=b;b++)if(y=n[b],g.key===y.key){O[b-h]=c,w>b?j=!0:w=b,oe(g,y,t,r,l,o,!0,i),E=!1;break}E&&(V(g,t),S++)}else{var U=new Map;for(c=h;u>=c;c++)N=n[c],U.set(N.key,c);for(c=d;c>=f;c--)g=e[c],b=U.get(g.key),void 0===b?(V(g,t),S++):(y=n[b],O[b-h]=c,w>b?j=!0:w=b,oe(g,y,t,r,l,o,!0,i))}if(j){var D=fe(O);for(b=D.length-1,c=_-1;c>=0;c--)-1===O[c]?(k=c+h,C=s>k+1?n[k+1].dom:null,T(t,p(n[k],null,r,l,o,i),C)):0>b||c!==D[b]?(k=c+h,C=s>k+1?n[k+1].dom:null,T(t,n[k].dom,C)):b--}else if(x-S!==_)for(c=_-1;c>=0;c--)-1===O[c]&&(k=c+h,C=s>k+1?n[k+1].dom:null,T(t,p(n[k],null,r,l,o,i),C))}}function fe(e){var n=e.slice(0),t=[];t.push(0);var r=void 0,l=void 0,o=void 0,i=void 0,a=void 0;for(r=0;r<e.length;r++)if(-1!==e[r])if(l=t[t.length-1],e[l]<e[r])n[r]=l,t.push(r);else{for(o=0,i=t.length-1;i>o;)a=(o+i)/2|0,e[t[a]]<e[r]?o=a+1:i=a;e[r]<e[t[o]]&&(o>0&&(n[r]=t[o-1]),t[o]=r)}for(o=t.length,i=t[o-1];o-- >0;)t[o]=i,i=n[i];return t}function he(){this._listeners=[],this.scrollX=null,this.scrollY=null,this.screenHeight=Ee,this.screenWidth=Te}function pe(e,n,t){n.addListener(function(){var r=t.getBoundingClientRect();null===n.scrollY&&n.refresh(),e.clipData={top:r.top+n.scrollY,left:r.left+n.scrollX,bottom:r.bottom+n.scrollY,right:r.right+n.scrollX,pending:!1}})}function ve(e){le(e.lastNode,e.nextNode,e.parentDom,e.lifecycle,null,null,!1,!0),e.clipData.pending=!1}function me(){Ae=!0,setTimeout(ye,100)}function ye(){Ke.forEach(ve),Ke.clear(),Ae=!1}function ge(e,n,t,r,l,o){if(performance.now()>Me+2e3){var i=Ke.get(n);return void 0===i?Ke.set(n,{lastNode:t,nextNode:r,parentDom:l,clipData:e,lifecycle:o}):i.nextNode=r,e.pending=!0,Ae===!1&&me(),!0}return ye(),!1}function be(e){for(var n=0;n<Ve.length;n++){var t=Ve[n];if(t.dom===e)return t}return null}function Ce(e){for(var n=0;n<Ve.length;n++){var t=Ve[n];if(t===e)return void Ve.splice(n,1)}}function we(e,n){var t=be(n),r=new he;if(null===t)p(e,n,r,{},null,!1),r.trigger(),Ve.push({node:e,dom:n});else{var l=W();oe(t.node,e,n,r,{},null,null,!1),r.trigger(),null===e&&Ce(t),t.node=e,L(l)}}var ke={};ke.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},ke.classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},ke.createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),ke.extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},ke.inherits=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)},ke.possibleConstructorReturn=function(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n};var Ne=!0,xe="http://www.w3.org/1999/xlink",_e="http://www.w3.org/XML/1998/namespace",Oe={},je={},Se={};te("xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type",Se,xe),te("xml:base,xml:lang,xml:space",Se,_e),te("volume,value",Oe,!0),te("muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate",je,!0);var Te=window.screen.width,Ee=window.screen.height,Ue=0,De=0,Me=0;window.onscroll=function(e){Ue=window.scrollX,De=window.scrollY,Me=performance.now()},window.resize=function(e){Ue=window.scrollX,De=window.scrollY,Te=window.screen.width,Ee=window.screen.height,Me=performance.now()},he.prototype={refresh:function(){this.scrollX=window.scrollX,this.scrollY=window.scrollY},addListener:function(e){this._listeners.push(e)},trigger:function(){for(var e=0;e<this._listeners.length;e++)this._listeners[e]()}};var Ke=new Map,Ae=!1,Ve=[],Be={render:we};return Be}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.InfernoDOM=n()}(this,function(){"use strict";function e(e,t){if(!r(e)){var l=n(e);(l&&e.length>0||!l)&&(t=t?Object.assign({},t,{children:e}):{children:e})}return t}function n(e){return e instanceof Array}function t(e){return void 0!==e.prototype.render}function l(e){return"string"==typeof e||"number"==typeof e}function r(e){return void 0===e||null===e}function o(e){return null===e||e===!1||void 0===e}function i(e){return"function"==typeof e}function a(e){return"string"==typeof e}function s(e){return e instanceof Promise}function d(e,n,t){e.splice(e.indexOf(n),1,t)}function c(e,t){if(!o(e))if(n(e))for(var l=0;l<e.length;l++){var r=e[l];if(!o(r)){if(r===t)return!0;if(r.children)return c(r.children,t)}}else{if(e===t)return!0;if(e.children)return c(e.children,t)}return!1}function u(e,n){var t=n.props.children;return c(t,e)?u(e,n._parentComponent):n}function f(e,n,t,l,o){if(void 0!==n){var i=e.key,a=null===i?n.pools.nonKeyed:n.pools.keyed[i];if(!r(a)){var s=a.pop();if(!r(s))return oe(s,e,null,t,l,o,!0,n.isSVG),e.dom}}return null}function h(e){var n=e.bp;if(!r(n)){var t=e.key,l=n.pools;if(null===t){var o=l.nonKeyed;o&&o.push(e)}else{var i=l.keyed;(i[t]||(i[t]=[])).push(e)}return!0}return!1}function v(e,t,l,r,i,a){if(n(e))return P(e,t);if(o(e))return null;var s=e.bp;if(Ne){var d=f(e,s,l,r,i);if(null!==d)return null!==t&&t.appendChild(d),d}return void 0===s?g(e,t,l,r,i,a):m(e,s,t,l,r,i)}function p(e){"select"===e.tag&&z(e)}function m(e,n,t,l,r,o){var i=e.tag;if(n.isComponent===!0)return x(e,i,e.attrs||{},e.hooks,e.children,o,t,l,r);var a=U(n.tag,n.isSVG);switch(e.dom=a,n.hasHooks===!0&&q(e.hooks,l,a),n.lazy===!0&&ve(e,l,a),n.childrenType){case 1:E(e.children,a,!0);break;case 2:v(e.children,a,l,r,o);break;case 3:k(e,e.children,a,l,r,o);break;case 4:C(e.children,a,l,r,o);break;case 5:w(e,e.children,a,l,r,o)}if(n.hasAttrs===!0){p(e);var s=e.attrs;if(null===n.attrKeys){var d=Object.keys(s);n.attrKeys=n.attrKeys?n.attrKeys.concat(d):d}var c=n.attrKeys;_(e,s,c,a,o)}if(n.hasClassName===!0&&(a.className=e.className),n.hasStyle===!0&&ie(null,e.style,a),n.hasEvents===!0){var u=e.events;null===n.eventKeys&&(n.eventKeys=Object.keys(u));var f=n.eventKeys;b(u,f,a)}return null!==t&&t.appendChild(a),a}function g(e,n,t,l,s,d){var c=e.tag;if(null===c)return P(e,n);if(i(c))return x(e,c,e.attrs||{},e.hooks,e.children,s,n,t,l);if(!a(c)||""===c)throw Error("Inferno Error: Expected function or string for element tag type");"svg"===c&&(d=!0);var u=U(c,d),f=e.children,h=e.attrs,v=e.events,m=e.hooks,g=e.className,y=e.style;return e.dom=u,r(m)||q(m,t,u),o(f)||w(e,f,u,t,l,s,d),r(h)||(p(e),_(e,h,Object.keys(h),u,s)),r(g)||(u.className=g),r(y)||ie(null,y,u),r(v)||b(v,Object.keys(v),u),null!==n&&n.appendChild(u),u}function y(e,n,t,l,r,i,a){var s=A();t&&t.push(s),e.then(function(e){var c=v(e,null,l,r,i,a);null===n||o(c)||n.replaceChild(c,s),t&&d(t,s,c)}),n.appendChild(s)}function C(e,n,t,l,r){for(var o=0;o<e.length;o++)v(e[o],n,t,l,r)}function k(e,t,i,a,d,c,u){for(var f=null,h=!1,p=!1,m=0;m<t.length;m++){var g=t[m];if(l(g))h=!0,f=f||[],f.push(E(g,i,!1));else if(!r(g)&&n(g)){var C=X();h=!0,k(e,g,C,a,d,c,u),O(i,C),f=f||[],f.push(C)}else if(s(g))y(g,i,f,a,d,c,u);else{var w=v(g,i,a,d,c,u);h||!p&&!r(g)&&r(g.key)?(h=!0,f=f||[],f.push(w)):o(g)?(h=!0,f=f||[],f.push(w)):p===!1&&(p=!0)}}null!==f&&f.length>1&&h===!0&&(e.domChildren=f)}function w(e,t,r,o,i,a,d){n(t)?k(e,t,r,o,i,a,d):l(t)?E(t,r,!0):s(t)?y(t,r,null,o,i,a,d):v(t,r,o,i,a,d)}function N(e,n,t){!o(e)&&a(n)&&(e.refs[n]=t)}function b(e,n,t){for(var l=0;l<n.length;l++){var r=n[l];t[r]=e[r]}}function x(n,l,i,a,s,d,c,u,f){i=e(s,i);var h=void 0;if(t(l)){var p=new l(i);p._patch=oe,!r(d)&&i.ref&&N(d,i.ref,p);var m=p.getChildContext();r(m)||(f=Object.assign({},f,m)),p.context=f,p._unmounted=!1,p._parentNode=n,d&&(p._parentComponent=d),p._pendingSetState=!0,p.componentWillMount();var g=p.render();p._pendingSetState=!1,o(g)?(p._lastNode=j(),h=p._lastNode.dom):(h=v(g,null,u,f,p,!1),p._lastNode=g,p.componentDidMount()),null===c||o(h)||c.appendChild(h),n.dom=h,n.instance=p}else{r(a)||(r(a.componentWillMount)||a.componentWillMount(null,i),r(a.componentDidMount)||u.addListener(function(){a.componentDidMount(h,i)}));var y=l(i,f);h=v(y,null,u,f,null,!1),n.instance=y,null===c||o(h)||c.appendChild(h),n.dom=h}return h}function _(e,n,t,l,r){for(var o=0;o<t.length;o++){var i=t[o];"ref"===i?N(u(e,r),n[i],l):se(i,null,n[i],l)}}function T(e){return!r(e.append)}function O(e,n,t){r(t)?T(n)?n.append(e):e.appendChild(n):T(n)?n.insert(e,t):T(t)?e.insertBefore(n,t.childNodes[0]||t.dom):e.insertBefore(n,t)}function j(){return{"null":!0,dom:document.createTextNode("")}}function S(e,n,t){r(t)?e.appendChild(n):e.insertBefore(n,t)}function U(e,n){var t=void 0;return t=n===!0?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e)}function E(e,n,t){if(null===n)return document.createTextNode(e);if(t){if(""!==e)return n.textContent=e,n.firstChild;var l=document.createTextNode("");return n.appendChild(l),l}var r=document.createTextNode(e);return n.appendChild(r),r}function D(e,n,t,l,o,i,a){var s=null,d=e._lastNode;r(d)||(s=e,e=d),K(e);var c=v(n,null,l,o,i,a);n.dom=c,M(t,c,e.dom),null!==s&&(s._lastNode=n)}function M(e,n,t){T(t)?t.replaceWith(n):e.replaceChild(n,t)}function K(e){if(!o(e)&&!l(e)){var t=e.instance,i=null,a=null;r(t)||(i=t.hooks,a=t.children,void 0!==t.render&&(t.componentWillUnmount(),t._unmounted=!0,K(t._lastNode)));var s=e.hooks||i;r(s)||(r(s.willDetach)||s.willDetach(e.dom),r(s.componentWillUnmount)||s.componentWillUnmount(e.dom,s));var d=e.children||a;if(!r(d))if(n(d))for(var c=0;c<d.length;c++)K(d[c]);else K(d)}}function A(){return document.createTextNode("")}function V(e,n){var t=e.dom;t===n?t.innerHTML="":(n.removeChild(t),Ne&&h(e)),K(e)}function B(e,n,t){for(var l=n||Object.keys(e),r=0;r<l.length;r++){var o=l[r];t[o]=null}}function H(e,n,t){for(var l=0;l<n.length;l++)e.insertBefore(n[l],t)}function W(){return document.activeElement}function Y(e,n){if(Ne){var t=n.length;if(t>5)for(var l=0;t>l;l++){var r=n[l];o(r)||h(r)}}e.textContent=""}function L(e){null!==e&&e!==document.body&&document.activeElement!==e&&e.focus()}function X(){var e=[],n=document.createTextNode(""),t=null,l={dom:n,childNodes:e,appendChild:function(l){e.push(l),t&&t.insertBefore(l,n)},removeChild:function(n){t&&t.removeChild(n),e.splice(e.indexOf(n),1)},insertBefore:function(n,l){t&&t.insertBefore(n,l),e.splice(e.indexOf(l),0,n)},replaceChild:function(n,l){t.replaceChild(n,l),d(e,l,n)},append:function(l){l.appendChild(n),t=l,H(t,e,n)},insert:function(l,r){l.insertBefore(n,r),t=l,H(t,e,n)},remove:function(){t.removeChild(n);for(var l=0;l<e.length;l++)t.removeChild(e[l]);t=null},replaceWith:function(l){t.replaceChild(l,n);for(var r=0;r<e.length;r++)t.removeChild(e[r]);t=null},getElementsByTagName:null};return Object.defineProperty(l,"parentNode",{get:function(){return t}}),Object.defineProperty(l,"firstChild",{get:function(){return e[0]}}),l}function G(e,n){return n.length&&!r(n[0])&&!r(n[0].key)||e.length&&!r(e[0])&&!r(e[0].key)}function I(e,n){if("option"===e.tag){var t=e.attrs&&e.attrs.value;n[t]?(e.attrs=e.attrs||{},e.attrs.selected="selected",e.dom.selected=!0):e.dom.selected=!1}else for(var l=0,r=e.children.length;r>l;l++)I(e.children[l],n)}function z(e){var t=e.attrs&&e.attrs.value,l={};if(n(t))for(var r=0,o=t.length;o>r;r++)l[t[r]]=t[r];else l[t]=t;for(var i=0,a=e.children.length;a>i;i++)I(e.children[i],l);e.attrs&&e.attrs[t]&&delete e.attrs.value}function P(e,n){var t=A();return null!==n&&n.appendChild(t),o(e)||(e.dom=t),t}function q(e,n,t){r(e.created)||e.created(t),r(e.attached)||n.addListener(function(){e.attached(t)})}function R(e){var n=e.attrs.value;r(n)||(e.dom.value=n)}function F(e,n){if("input"===e){var t=n.attrs.type;if("text"===t)R(n);else if("checkbox"===t||"radio"===t){var l=n.attrs.checked;n.dom.checked=!!l}}else"textarea"===e&&R(n)}function J(e,t,i,a,s,d,c){var u=t.children,f=e.children;if(f!==u){var h=null;e.domChildren&&(h=t.domChildren=e.domChildren),o(f)?l(u)?le(i,f,u):r(u)||(n(u)?k(t,u,i,a,s,d,c):v(u,i,a,s,d,c)):o(u)?Y(i,f):n(f)?n(u)?null===h&&f.length>1?ue(f,u,i,a,s,d,c):G(f,u)?ue(f,u,i,a,s,d,c):ce(f,u,i,h||(t.domChildren=[]),a,s,d,0,c):ce(f,[u],i,h||[],a,s,d,0):n(u)?ce([f],u,i,h||(t.domChildren=[i.firstChild]),a,s,d,0,c):l(u)?le(i,f,u):l(f)?oe(f,u,i,a,s,d,null,c):oe(f,u,i,a,s,d,!0,c)}}function Q(e,n,t,l){e&&(a(n)&&delete e.refs[n],a(t)&&(e.refs[t]=l))}function Z(e,n,t,l,o){var i=n.events,a=e.events,s=!r(i),d=!r(a);s?d?ae(a,i,t,l,o):b(i,l,o):d&&B(a,t,o)}function $(e,n,t,l,o,i){"select"===e.tag&&z(n);var a=n.attrs,s=e.attrs,d=r(a),c=!r(s);if(!d)for(var f=l||Object.keys(a),h=f.length,v=0;h>v;v++){var p=f[v],m=c&&s[p],g=a[p];m!==g&&("ref"===p?Q(i,m,g,o):se(p,m,g,o))}if(c)for(var y=t||Object.keys(s),C=y.length,k=0;C>k;k++){var w=y[k];(d||r(a[w]))&&("ref"===w?Q(u(node,i),s[w],null,o):o.removeAttribute(w))}}function ee(e,n,l,i,a,s,d,c,u){var f=void 0;i.hasHooks===!0&&(f=n.hooks,f&&!r(f.willUpdate)&&f.willUpdate(e.dom));var h=n.tag||i.tag,p=e.tag||l.tag;if(p!==h)if(l.isComponent===!0){var m=e.instance;i.isComponent===!0?D(e,n,a,s,d,c,!1):t(p)?ne(m._lastNode,n,a,s,d,c,i.isSVG):ne(m,n,a,s,d,c,i.isSVG)}else D(e,n,a,s,d,c,i.isSVG);else if(r(p))n.dom=e.dom;else if(l.isComponent===!0){if(i.isComponent===!0){var g=e.instance;if(!r(g)&&g._unmounted){var y=x(n,p,n.attrs||{},n.hooks,n.children,g,a,s,d);null!==a&&M(a,y,e.dom)}else n.instance=g,n.dom=e.dom,de(!0,n,n.tag,l,i,g,e.attrs||{},n.attrs||{},n.hooks,n.children,a,s,d)}}else{var C=e.dom,w=l.childrenType,N=i.childrenType;if(n.dom=C,i.lazy===!0&&u===!1){var b=e.clipData;if(null===s.scrollY&&s.refresh(),n.clipData=b,(b.pending===!0||b.top-s.scrollY>s.screenHeight)&&ye(b,C,e,n,a,s))return;if(b.bottom<s.scrollY&&ye(b,C,e,n,a,s))return}if(w>0||N>0)if(5===N||5===w)J(e,n,C,s,d,c);else{var _=e.children,T=n.children;0===w||o(_)?N>2?k(n,T,C,s,d,c):v(T,C,s,d,c):0===N||o(T)?w>2?Y(C,_):V(_,C):_!==T&&(4===w&&4===N?ue(_,T,C,s,d,c):2===w&&2===N?oe(_,T,C,s,d,c,!0,!1):1===w&&1===N?le(C,_,T):J(e,n,C,s,d,c))}if(l.hasAttrs!==!0&&i.hasAttrs!==!0||$(e,n,l.attrKeys,i.attrKeys,C,c),l.hasEvents!==!0&&i.hasEvents!==!0||Z(e,n,l.eventKeys,i.eventKeys,C),l.hasClassName===!0||i.hasClassName===!0){var O=n.className;e.className!==O&&(r(O)?C.removeAttribute("class"):C.className=O)}if(l.hasStyle===!0||i.hasStyle===!0){var j=n.style;e.style!==j&&ie(e.style,j,C)}i.hasHooks!==!0||r(f.didUpdate)||f.didUpdate(C),F(h,n)}}function ne(e,n,l,o,a,d,c){if(s(n))n.then(function(n){oe(e,n,l,o,a,d,null,!1)});else{var u=n.hooks,f=!r(u);f&&!r(u.willUpdate)&&u.willUpdate(e.dom);var h=n.tag||(r(n.bp)?null:n.bp.tag),v=e.tag||(r(e.bp)?null:e.bp.tag);if("svg"===h&&(c=!0),v!==h){var p=e.instance;i(v)?i(h)?D(e,n,l,o,a,d,c):t(v)?ne(p._lastNode,n,l,o,a,d,c):ne(p,n,l,o,a,d,c):D(p||e,n,l,o,a,d,c)}else if(r(v))n.dom=e.dom;else if(i(v)){if(i(h)){var m=e._instance;if(!r(m)&&m._unmounted){var g=x(n,v,n.attrs||{},n.hooks,n.children,m,l,o,a);null!==l&&M(l,g,e.dom)}else n.instance=e.instance,n.dom=e.dom,de(!1,n,n.tag,null,null,n.instance,e.attrs||{},n.attrs||{},n.hooks,n.children,l,o,a)}}else{var y=e.dom,C=n.className,k=n.style;n.dom=y,J(e,n,y,o,a,d,c),$(e,n,null,null,y,d),Z(e,n,null,null,y),e.className!==C&&(r(C)?y.removeAttribute("class"):y.className=C),e.style!==k&&ie(e.style,k,y),f&&!r(u.didUpdate)&&u.didUpdate(y),F(h,n)}}}function te(e,n,t){e.split(",").forEach(function(e){return n[e]=t})}function le(e,n,t){l(n)?e.firstChild.nodeValue=t:e.textContent=t}function re(e,n,t,l,r,o,i,a){var s=e.bp,d=n.bp;void 0===s||void 0===d?ne(e,n,t,l,r,o,i):ee(e,n,s,d,t,l,r,o,a)}function oe(e,n,t,i,a,s,d,c){if(null!==d)re(e,n,t,i,a,s,c,!1);else if(o(e))v(n,t,i,a,s,c);else if(o(n))V(e,t);else if(l(e))if(l(n))t.firstChild.nodeValue=n;else{var u=v(n,null,i,a,s,c);n.dom=u,M(t,u,t.firstChild)}else if(l(n)){var f=document.createTextNode(n);M(t,f,e.dom)}else if(r(n.null))re(e,n,t,i,a,s,c,!1);else{var h=void 0;e.dom&&(K(e),h=e.dom),M(t,n.dom,h)}}function ie(e,n,t){if(a(n))t.style.cssText=n;else if(r(e)){if(!r(n))for(var l=Object.keys(n),o=0;o<l.length;o++){var i=l[o];t.style[i]=n[i]}}else if(r(n))t.removeAttribute("style");else{for(var s=Object.keys(n),d=0;d<s.length;d++){var c=s[d];t.style[c]=n[c]}for(var u=Object.keys(e),f=0;f<u.length;f++){var h=u[f];r(n[h])&&(t.style[h]="")}}}function ae(e,n,t,l,o){for(var i=l||Object.keys(n),a=0;a<i.length;a++){var s=i[a],d=e[s],c=n[s];d!==c&&(o[s]=c)}for(var u=t||Object.keys(e),f=0;f<u.length;f++){var h=u[f];r(n[h])&&(o[h]=null)}}function se(e,n,t,l){if("dangerouslySetInnerHTML"===e){var o=n&&n.__html,i=t&&t.__html;if(r(i))throw new Error("Inferno Error: dangerouslySetInnerHTML requires an object with a __html propety containing the innerHTML content");o!==i&&(l.innerHTML=i)}else if(_e[e])l[e]=null===t?"":t;else if(Te[e])l[e]=!!t;else{var a=Oe[e];t===!1||r(t)?void 0!==a?l.removeAttributeNS(a,e):l.removeAttribute(e):void 0!==a?l.setAttributeNS(a,e,t===!0?e:t):l.setAttribute(e,t===!0?e:t)}}function de(n,l,i,a,s,d,c,u,f,h,v,p,m){if(u=e(h,u),t(i)){var g=d.props,y=d.state,C=d.state,k=d.getChildContext();r(k)||(m=Object.assign({},m,k)),d.context=m;var w=d._updateComponent(y,C,g,u);o(w)||(oe(d._lastNode,w,v,p,m,d,null,!1),l.dom=w.dom,d._lastNode=w)}else{var N=!0,b=n&&s.hasHooks===!0||!r(f);if(b&&!r(f.componentShouldUpdate)&&(N=f.componentShouldUpdate(l.dom,c,u)),N!==!1){b&&!r(f.componentWillUpdate)&&f.componentWillUpdate(l.dom,c,u);var x=i(u,m);o(x)||(x.dom=l.dom,oe(d,x,v,p,m,null,null,!1),l.instance=x,b&&!r(f.componentDidUpdate)&&f.componentDidUpdate(l.dom,c,u))}}}function ce(e,t,i,a,s,d,c,u,f){var h=void 0===i.append,p=e.length,m=t.length,g=p===m;if(g===!1)if(p>m)for(;p!==m;){var y=e[p-1];o(y)||(i.removeChild(a[p-1+u]),h&&a.splice(p-1+u,1),K(y),p--,e.pop())}else for(;p!==m;){var C=t[p],k=void 0;e.push(C),k=l(C)?document.createTextNode(C):v(C,null,s,d,c,f),o(k)||O(i,k),h&&(1===p&&a.push(i.firstChild),a.splice(p+u,0,k)),p++}for(var w=0;m>w;w++){var N=e[w],b=t[w],x=w+u;if(N===b&&o(N))u--;else if(o(b)){if(!o(N))if(n(N)&&0===N.length)for(var _=0;_<N.length;_++)V(N[_],i);else{var T=a[x];r(T)&&x--,i.removeChild(a[x]),h&&(a.splice(x,1),u--),K(N)}}else if(o(N))if(l(b)){var j=document.createTextNode(b),S=a[x];if(r(S)){var U=a[x+1];O(i,j,U),h&&a.splice(x,1,j)}else O(i,j,S),h&&a.splice(x,0,j)}else{var E=v(b,null,s,d,c,f),D=a[x];if(r(D)){var A=a[x+1];O(i,E,A),h&&a.splice(x,1,E)}else O(i,E,D),h&&a.splice(x,0,E)}else if(l(b))if(1===p)l(N)?void 0===i.getElementsByTagName?i.nodeValue=b:i.firstChild.nodeValue=b:(K(N),i.textContent=b);else{var B=document.createTextNode(b),H=a[x];r(H)?i.nodeValue=B.nodeValue:l(N)?H.nodeValue=b:void 0===H.append?(h&&a.splice(x,1,B),M(i,B,H)):(O(i,B,H.firstChild),H.remove(),a.splice(0,a.length,B)),K(N)}else if(n(b))if(G(N,b))ue(N,b,a[x],s,d,c,f);else if(n(N)){var W=a[x];if(void 0===W.append)if(b.length>1&&1===N.length){var Y=X();Y.insert(i,W),Y.appendChild(W),h&&a.splice(x,1,Y),ce(N,b,Y,Y.childNodes,s,d,c,0,f)}else ce(N,b,i,a,s,d,c,0,f);else ce(N,b,a[x],a[x].childNodes,s,d,c,0,f)}else if(b.length>1){var L=X();L.appendChild(i.firstChild),O(i,L,i.firstChild),h&&a.splice(x,1,L),ce([N],b,L,L.childNodes,s,d,c,w,f)}else ce([N],b,i,a,s,d,c,w,f);else n(N)?ce(N,[b],a,a[x].childNodes,s,d,c,0,f):(oe(N,b,i,s,d,c,null,f),a[x]=b.dom)}}function ue(e,n,t,l,r,o,i){for(var a=e.length,s=n.length,d=void 0,c=a-1,u=s-1,f=0,h=0,p=null,m=null,g=null,y=null,C=void 0,k=void 0,w=0,N=void 0,b=void 0;c>=f&&u>=h&&(m=n[h],p=e[f],m.key===p.key);)oe(p,m,t,l,r,o,!0,i),h++,f++;for(;c>=f&&u>=h&&(g=n[u],y=e[c],g.key===y.key);)oe(y,g,t,l,r,o,!0,i),u--,c--;for(;c>=f&&u>=h&&(g=n[u],p=e[f],g.key===p.key);)k=s>u+1?n[u+1].dom:null,oe(p,g,t,l,r,o,!0,i),S(t,g.dom,k),u--,f++;for(;c>=f&&u>=h&&(m=n[h],y=e[c],m.key===y.key);)k=e[f].dom,oe(y,m,t,l,r,o,!0,i),S(t,m.dom,k),h++,c--;if(f>c){if(u>=h)for(k=s>u+1?n[u+1].dom:null;u>=h;h++)S(t,v(n[h],null,l,r,o,i),k)}else if(h>u)for(;c>=f;)V(e[f++],t);else{var x=c-f+1,_=u-h+1,T=new Array(_);for(d=0;_>d;d++)T[d]=-1;var O=!1,j=0;if(16>=x*_)for(d=f;c>=d;d++){var U=!0;for(y=e[d],C=h;u>=C;C++)if(g=n[C],y.key===g.key){T[C-h]=d,w>C?O=!0:w=C,oe(y,g,t,l,r,o,!0,i),U=!1;break}U&&(V(y,t),j++)}else{var E=new Map;for(d=h;u>=d;d++)b=n[d],E.set(b.key,d);for(d=c;d>=f;d--)y=e[d],C=E.get(y.key),void 0===C?(V(y,t),j++):(g=n[C],T[C-h]=d,w>C?O=!0:w=C,oe(y,g,t,l,r,o,!0,i))}if(O){var D=fe(T);for(C=D.length-1,d=_-1;d>=0;d--)-1===T[d]?(N=d+h,k=s>N+1?n[N+1].dom:null,S(t,v(n[N],null,l,r,o,i),k)):0>C||d!==D[C]?(N=d+h,k=s>N+1?n[N+1].dom:null,S(t,n[N].dom,k)):C--}else if(x-j!==_)for(d=_-1;d>=0;d--)-1===T[d]&&(N=d+h,k=s>N+1?n[N+1].dom:null,S(t,v(n[N],null,l,r,o,i),k))}}function fe(e){var n=e.slice(0),t=[];t.push(0);var l=void 0,r=void 0,o=void 0,i=void 0,a=void 0;for(l=0;l<e.length;l++)if(-1!==e[l])if(r=t[t.length-1],e[r]<e[l])n[l]=r,t.push(l);else{for(o=0,i=t.length-1;i>o;)a=(o+i)/2|0,e[t[a]]<e[l]?o=a+1:i=a;e[l]<e[t[o]]&&(o>0&&(n[l]=t[o-1]),t[o]=l)}for(o=t.length,i=t[o-1];o-- >0;)t[o]=i,i=n[i];return t}function he(){this._listeners=[],this.scrollX=null,this.scrollY=null,this.screenHeight=Se,this.screenWidth=je}function ve(e,n,t){n.addListener(function(){var l=t.getBoundingClientRect();null===n.scrollY&&n.refresh(),e.clipData={top:l.top+n.scrollY,left:l.left+n.scrollX,bottom:l.bottom+n.scrollY,right:l.right+n.scrollX,pending:!1}})}function pe(e){re(e.lastNode,e.nextNode,e.parentDom,e.lifecycle,null,null,!1,!0),e.clipData.pending=!1}function me(){Ke=!0,setTimeout(ge,100)}function ge(){Me.forEach(pe),Me.clear(),Ke=!1}function ye(e,n,t,l,r,o){if(performance.now()>De+2e3){var i=Me.get(n);return void 0===i?Me.set(n,{lastNode:t,nextNode:l,parentDom:r,clipData:e,lifecycle:o}):i.nextNode=l,e.pending=!0,Ke===!1&&me(),!0}return ge(),!1}function Ce(e){for(var n=0;n<Ae.length;n++){var t=Ae[n];if(t.dom===e)return t}return null}function ke(e){for(var n=0;n<Ae.length;n++){var t=Ae[n];if(t===e)return void Ae.splice(n,1)}}function we(e,n){var t=Ce(n),l=new he;if(null===t)v(e,n,l,{},null,!1),l.trigger(),Ae.push({node:e,dom:n});else{var r=W();oe(t.node,e,n,l,{},null,null,!1),l.trigger(),null===e&&ke(t),t.node=e,L(r)}}var Ne=!0,be="http://www.w3.org/1999/xlink",xe="http://www.w3.org/XML/1998/namespace",_e={},Te={},Oe={};te("xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type",Oe,be),te("xml:base,xml:lang,xml:space",Oe,xe),te("volume,value",_e,!0),te("muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate",Te,!0);var je=window.screen.width,Se=window.screen.height,Ue=0,Ee=0,De=0;window.onscroll=function(e){Ue=window.scrollX,Ee=window.scrollY,De=performance.now()},window.resize=function(e){Ue=window.scrollX,Ee=window.scrollY,je=window.screen.width,Se=window.screen.height,De=performance.now()},he.prototype={refresh:function(){this.scrollX=window.scrollX,this.scrollY=window.scrollY},addListener:function(e){this._listeners.push(e)},trigger:function(){for(var e=0;e<this._listeners.length;e++)this._listeners[e]()}};var Me=new Map,Ke=!1,Ae=[],Ve={render:we};return Ve}); |
/*! | ||
* inferno-router v0.7.10 | ||
* inferno-router v0.7.11 | ||
* (c) 2016 Dominic Gannaway | ||
@@ -7,667 +7,644 @@ * Released under the MIT License. | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.InfernoRouter = factory()); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.InfernoRouter = factory()); | ||
}(this, function () { 'use strict'; | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
function isArray(obj) { | ||
return obj instanceof Array; | ||
} | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function isNullOrUndefined(obj) { | ||
return obj === void 0 || obj === null; | ||
} | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function isInvalidNode(obj) { | ||
return obj === null || obj === false || obj === void 0; | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
function VNode(blueprint) { | ||
this.bp = blueprint; | ||
this.dom = null; | ||
this.instance = null; | ||
this.tag = null; | ||
this.children = null; | ||
this.style = null; | ||
this.className = null; | ||
this.attrs = null; | ||
this.events = null; | ||
this.hooks = null; | ||
this.key = null; | ||
this.clipData = null; | ||
} | ||
babelHelpers.extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
VNode.prototype = { | ||
setAttrs: function setAttrs(attrs) { | ||
this.attrs = attrs; | ||
return this; | ||
}, | ||
setTag: function setTag(tag) { | ||
this.tag = tag; | ||
return this; | ||
}, | ||
setStyle: function setStyle(style) { | ||
this.style = style; | ||
return this; | ||
}, | ||
setClassName: function setClassName(className) { | ||
this.className = className; | ||
return this; | ||
}, | ||
setChildren: function setChildren(children) { | ||
this.children = children; | ||
return this; | ||
}, | ||
setHooks: function setHooks(hooks) { | ||
this.hooks = hooks; | ||
return this; | ||
}, | ||
setEvents: function setEvents(events) { | ||
this.events = events; | ||
return this; | ||
}, | ||
setKey: function setKey(key) { | ||
this.key = key; | ||
return this; | ||
} | ||
}; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
function createVNode(bp) { | ||
return new VNode(bp); | ||
} | ||
return target; | ||
}; | ||
function createNullNode() { | ||
return { | ||
null: true, | ||
dom: document.createTextNode('') | ||
}; | ||
} | ||
babelHelpers.inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
function constructDefaults(string, object, value) { | ||
/* eslint no-return-assign: 0 */ | ||
string.split(',').forEach(function (i) { | ||
return object[i] = value; | ||
}); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var xlinkNS = 'http://www.w3.org/1999/xlink'; | ||
var xmlNS = 'http://www.w3.org/XML/1998/namespace'; | ||
var strictProps = {}; | ||
var booleanProps = {}; | ||
var namespaces = {}; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
constructDefaults('xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type', namespaces, xlinkNS); | ||
constructDefaults('xml:base,xml:lang,xml:space', namespaces, xmlNS); | ||
constructDefaults('volume,value', strictProps, true); | ||
constructDefaults('muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate', booleanProps, true); | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
var screenWidth = window.screen.width; | ||
var screenHeight = window.screen.height; | ||
var scrollX = 0; | ||
var scrollY = 0; | ||
var lastScrollTime = 0; | ||
babelHelpers; | ||
window.onscroll = function (e) { | ||
scrollX = window.scrollX; | ||
scrollY = window.scrollY; | ||
lastScrollTime = performance.now(); | ||
}; | ||
function isArray(obj) { | ||
return obj instanceof Array; | ||
} | ||
window.resize = function (e) { | ||
scrollX = window.scrollX; | ||
scrollY = window.scrollY; | ||
screenWidth = window.screen.width; | ||
screenHeight = window.screen.height; | ||
lastScrollTime = performance.now(); | ||
}; | ||
function isNullOrUndefined(obj) { | ||
return obj === void 0 || obj === null; | ||
} | ||
function Lifecycle() { | ||
this._listeners = []; | ||
this.scrollX = null; | ||
this.scrollY = null; | ||
this.screenHeight = screenHeight; | ||
this.screenWidth = screenWidth; | ||
} | ||
function isInvalidNode(obj) { | ||
return obj === null || obj === false || obj === void 0; | ||
Lifecycle.prototype = { | ||
refresh: function refresh() { | ||
this.scrollX = window.scrollX; | ||
this.scrollY = window.scrollY; | ||
}, | ||
addListener: function addListener(callback) { | ||
this._listeners.push(callback); | ||
}, | ||
trigger: function trigger() { | ||
for (var i = 0; i < this._listeners.length; i++) { | ||
this._listeners[i](); | ||
} | ||
} | ||
}; | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function VNode(blueprint) { | ||
this.bp = blueprint; | ||
this.dom = null; | ||
this.instance = null; | ||
this.tag = null; | ||
this.children = null; | ||
this.style = null; | ||
this.className = null; | ||
this.attrs = null; | ||
this.events = null; | ||
this.hooks = null; | ||
this.key = null; | ||
this.clipData = null; | ||
var createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
VNode.prototype = { | ||
setAttrs: function setAttrs(attrs) { | ||
this.attrs = attrs; | ||
return this; | ||
}, | ||
setTag: function setTag(tag) { | ||
this.tag = tag; | ||
return this; | ||
}, | ||
setStyle: function setStyle(style) { | ||
this.style = style; | ||
return this; | ||
}, | ||
setClassName: function setClassName(className) { | ||
this.className = className; | ||
return this; | ||
}, | ||
setChildren: function setChildren(children) { | ||
this.children = children; | ||
return this; | ||
}, | ||
setHooks: function setHooks(hooks) { | ||
this.hooks = hooks; | ||
return this; | ||
}, | ||
setEvents: function setEvents(events) { | ||
this.events = events; | ||
return this; | ||
}, | ||
setKey: function setKey(key) { | ||
this.key = key; | ||
return this; | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
function createVNode(bp) { | ||
return new VNode(bp); | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
function createNullNode() { | ||
return { | ||
null: true, | ||
dom: document.createTextNode('') | ||
}; | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
function constructDefaults(string, object, value) { | ||
/* eslint no-return-assign: 0 */ | ||
string.split(',').forEach(function (i) { | ||
return object[i] = value; | ||
}); | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
var xlinkNS = 'http://www.w3.org/1999/xlink'; | ||
var xmlNS = 'http://www.w3.org/XML/1998/namespace'; | ||
var strictProps = {}; | ||
var booleanProps = {}; | ||
var namespaces = {}; | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
constructDefaults('xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type', namespaces, xlinkNS); | ||
constructDefaults('xml:base,xml:lang,xml:space', namespaces, xmlNS); | ||
constructDefaults('volume,value', strictProps, true); | ||
constructDefaults('muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate', booleanProps, true); | ||
var noOp = 'Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.'; | ||
var screenWidth = window.screen.width; | ||
var screenHeight = window.screen.height; | ||
var scrollX = 0; | ||
var scrollY = 0; | ||
var lastScrollTime = 0; | ||
// Copy of the util from dom/util, otherwise it makes massive bundles | ||
function getActiveNode() { | ||
return document.activeElement; | ||
} | ||
window.onscroll = function (e) { | ||
scrollX = window.scrollX; | ||
scrollY = window.scrollY; | ||
lastScrollTime = performance.now(); | ||
}; | ||
// Copy of the util from dom/util, otherwise it makes massive bundles | ||
function resetActiveNode(activeNode) { | ||
if (activeNode !== document.body && document.activeElement !== activeNode) { | ||
activeNode.focus(); // TODO: verify are we doing new focus event, if user has focus listener this might trigger it | ||
} | ||
} | ||
window.resize = function (e) { | ||
scrollX = window.scrollX; | ||
scrollY = window.scrollY; | ||
screenWidth = window.screen.width; | ||
screenHeight = window.screen.height; | ||
lastScrollTime = performance.now(); | ||
}; | ||
function queueStateChanges(component, newState, callback) { | ||
for (var stateKey in newState) { | ||
component._pendingState[stateKey] = newState[stateKey]; | ||
} | ||
if (!component._pendingSetState) { | ||
component._pendingSetState = true; | ||
applyState(component, false, callback); | ||
} else { | ||
var pendingState = component._pendingState; | ||
var oldState = component.state; | ||
function Lifecycle() { | ||
this._listeners = []; | ||
this.scrollX = null; | ||
this.scrollY = null; | ||
this.screenHeight = screenHeight; | ||
this.screenWidth = screenWidth; | ||
} | ||
component.state = Object.assign({}, oldState, pendingState); | ||
component._pendingState = {}; | ||
} | ||
} | ||
Lifecycle.prototype = { | ||
refresh: function refresh() { | ||
this.scrollX = window.scrollX; | ||
this.scrollY = window.scrollY; | ||
}, | ||
addListener: function addListener(callback) { | ||
this._listeners.push(callback); | ||
}, | ||
trigger: function trigger() { | ||
for (var i = 0; i < this._listeners.length; i++) { | ||
this._listeners[i](); | ||
} | ||
} | ||
}; | ||
function applyState(component, force, callback) { | ||
if (!component._deferSetState || force) { | ||
component._pendingSetState = false; | ||
var pendingState = component._pendingState; | ||
var oldState = component.state; | ||
var nextState = Object.assign({}, oldState, pendingState); | ||
var noOp = 'Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.'; | ||
component._pendingState = {}; | ||
var nextNode = component._updateComponent(oldState, nextState, component.props, component.props, force); | ||
// Copy of the util from dom/util, otherwise it makes massive bundles | ||
function getActiveNode() { | ||
return document.activeElement; | ||
} | ||
if (isInvalidNode(nextNode)) { | ||
nextNode = createNullNode(); | ||
} | ||
var lastNode = component._lastNode; | ||
var parentDom = lastNode.dom.parentNode; | ||
// Copy of the util from dom/util, otherwise it makes massive bundles | ||
function resetActiveNode(activeNode) { | ||
if (activeNode !== document.body && document.activeElement !== activeNode) { | ||
activeNode.focus(); // TODO: verify are we doing new focus event, if user has focus listener this might trigger it | ||
} | ||
} | ||
var activeNode = getActiveNode(); | ||
var subLifecycle = new Lifecycle(); | ||
component._patch(lastNode, nextNode, parentDom, subLifecycle, component.context, component, null); | ||
component._lastNode = nextNode; | ||
component._parentNode.dom = nextNode.dom; | ||
function queueStateChanges(component, newState, callback) { | ||
for (var stateKey in newState) { | ||
component._pendingState[stateKey] = newState[stateKey]; | ||
} | ||
if (!component._pendingSetState) { | ||
component._pendingSetState = true; | ||
applyState(component, false, callback); | ||
} else { | ||
var pendingState = component._pendingState; | ||
var oldState = component.state; | ||
subLifecycle.trigger(); | ||
if (!isNullOrUndefined(callback)) { | ||
callback(); | ||
} | ||
resetActiveNode(activeNode); | ||
} | ||
} | ||
component.state = Object.assign({}, oldState, pendingState); | ||
component._pendingState = {}; | ||
} | ||
} | ||
var Component = function () { | ||
function Component(props) { | ||
classCallCheck(this, Component); | ||
function applyState(component, force, callback) { | ||
if (!component._deferSetState || force) { | ||
component._pendingSetState = false; | ||
var pendingState = component._pendingState; | ||
var oldState = component.state; | ||
var nextState = Object.assign({}, oldState, pendingState); | ||
/** @type {object} */ | ||
this.props = props || {}; | ||
component._pendingState = {}; | ||
var nextNode = component._updateComponent(oldState, nextState, component.props, component.props, force); | ||
/** @type {object} */ | ||
this.state = {}; | ||
if (isInvalidNode(nextNode)) { | ||
nextNode = createNullNode(); | ||
} | ||
var lastNode = component._lastNode; | ||
var parentDom = lastNode.dom.parentNode; | ||
/** @type {object} */ | ||
this.refs = {}; | ||
this._blockSetState = false; | ||
this._deferSetState = false; | ||
this._pendingSetState = false; | ||
this._pendingState = {}; | ||
this._parentNode = null; | ||
this._lastNode = null; | ||
this._unmounted = true; | ||
this.context = {}; | ||
this._patch = null; | ||
this._parentComponent = null; | ||
} | ||
var activeNode = getActiveNode(); | ||
var subLifecycle = new Lifecycle(); | ||
component._patch(lastNode, nextNode, parentDom, subLifecycle, component.context, component, null); | ||
component._lastNode = nextNode; | ||
component._parentNode.dom = nextNode.dom; | ||
createClass(Component, [{ | ||
key: 'render', | ||
value: function render() {} | ||
}, { | ||
key: 'forceUpdate', | ||
value: function forceUpdate(callback) { | ||
if (this._unmounted) { | ||
throw Error(noOp); | ||
} | ||
applyState(this, true, callback); | ||
} | ||
}, { | ||
key: 'setState', | ||
value: function setState(newState, callback) { | ||
if (this._unmounted) { | ||
throw Error(noOp); | ||
} | ||
if (this._blockSetState === false) { | ||
queueStateChanges(this, newState, callback); | ||
} else { | ||
throw Error('Inferno Warning: Cannot update state via setState() in componentWillUpdate()'); | ||
} | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() {} | ||
}, { | ||
key: 'componentWillMount', | ||
value: function componentWillMount() {} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() {} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() {} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate() { | ||
return true; | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() {} | ||
}, { | ||
key: 'componentWillUpdate', | ||
value: function componentWillUpdate() {} | ||
}, { | ||
key: 'getChildContext', | ||
value: function getChildContext() {} | ||
}, { | ||
key: '_updateComponent', | ||
value: function _updateComponent(prevState, nextState, prevProps, nextProps, force) { | ||
if (this._unmounted === true) { | ||
this._unmounted = false; | ||
return false; | ||
} | ||
if (!isNullOrUndefined(nextProps) && isNullOrUndefined(nextProps.children)) { | ||
nextProps.children = prevProps.children; | ||
} | ||
if (prevProps !== nextProps || prevState !== nextState || force) { | ||
if (prevProps !== nextProps) { | ||
this._blockSetState = true; | ||
this.componentWillReceiveProps(nextProps); | ||
this._blockSetState = false; | ||
} | ||
var shouldUpdate = this.shouldComponentUpdate(nextProps, nextState); | ||
subLifecycle.trigger(); | ||
if (!isNullOrUndefined(callback)) { | ||
callback(); | ||
} | ||
resetActiveNode(activeNode); | ||
} | ||
} | ||
if (shouldUpdate !== false) { | ||
this._blockSetState = true; | ||
this.componentWillUpdate(nextProps, nextState); | ||
this._blockSetState = false; | ||
this.props = nextProps; | ||
this.state = nextState; | ||
var node = this.render(); | ||
var Component = function () { | ||
function Component(props) { | ||
babelHelpers.classCallCheck(this, Component); | ||
this.componentDidUpdate(prevProps, prevState); | ||
return node; | ||
} | ||
} | ||
return false; | ||
} | ||
}]); | ||
return Component; | ||
}(); | ||
/** @type {object} */ | ||
this.props = props || {}; | ||
var ASYNC_STATUS = { | ||
pending: 'pending', | ||
fulfilled: 'fulfilled', | ||
rejected: 'rejected' | ||
}; | ||
/** @type {object} */ | ||
this.state = {}; | ||
var Route = function (_Component) { | ||
inherits(Route, _Component); | ||
/** @type {object} */ | ||
this.refs = {}; | ||
this._blockSetState = false; | ||
this._deferSetState = false; | ||
this._pendingSetState = false; | ||
this._pendingState = {}; | ||
this._parentNode = null; | ||
this._lastNode = null; | ||
this._unmounted = true; | ||
this.context = {}; | ||
this._patch = null; | ||
this._parentComponent = null; | ||
} | ||
function Route(props) { | ||
classCallCheck(this, Route); | ||
babelHelpers.createClass(Component, [{ | ||
key: 'render', | ||
value: function render() {} | ||
}, { | ||
key: 'forceUpdate', | ||
value: function forceUpdate(callback) { | ||
if (this._unmounted) { | ||
throw Error(noOp); | ||
} | ||
applyState(this, true, callback); | ||
} | ||
}, { | ||
key: 'setState', | ||
value: function setState(newState, callback) { | ||
if (this._unmounted) { | ||
throw Error(noOp); | ||
} | ||
if (this._blockSetState === false) { | ||
queueStateChanges(this, newState, callback); | ||
} else { | ||
throw Error('Inferno Warning: Cannot update state via setState() in componentWillUpdate()'); | ||
} | ||
} | ||
}, { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() {} | ||
}, { | ||
key: 'componentWillMount', | ||
value: function componentWillMount() {} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() {} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate() {} | ||
}, { | ||
key: 'shouldComponentUpdate', | ||
value: function shouldComponentUpdate() { | ||
return true; | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() {} | ||
}, { | ||
key: 'componentWillUpdate', | ||
value: function componentWillUpdate() {} | ||
}, { | ||
key: 'getChildContext', | ||
value: function getChildContext() {} | ||
}, { | ||
key: '_updateComponent', | ||
value: function _updateComponent(prevState, nextState, prevProps, nextProps, force) { | ||
if (this._unmounted === true) { | ||
this._unmounted = false; | ||
return false; | ||
} | ||
if (!isNullOrUndefined(nextProps) && isNullOrUndefined(nextProps.children)) { | ||
nextProps.children = prevProps.children; | ||
} | ||
if (prevProps !== nextProps || prevState !== nextState || force) { | ||
if (prevProps !== nextProps) { | ||
this._blockSetState = true; | ||
this.componentWillReceiveProps(nextProps); | ||
this._blockSetState = false; | ||
} | ||
var shouldUpdate = this.shouldComponentUpdate(nextProps, nextState); | ||
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Route).call(this, props)); | ||
if (shouldUpdate !== false) { | ||
this._blockSetState = true; | ||
this.componentWillUpdate(nextProps, nextState); | ||
this._blockSetState = false; | ||
this.props = nextProps; | ||
this.state = nextState; | ||
var node = this.render(); | ||
_this.state = { | ||
async: null | ||
}; | ||
return _this; | ||
} | ||
this.componentDidUpdate(prevProps, prevState); | ||
return node; | ||
} | ||
} | ||
return false; | ||
} | ||
}]); | ||
return Component; | ||
}(); | ||
createClass(Route, [{ | ||
key: 'async', | ||
value: function async() { | ||
var _this2 = this; | ||
var ASYNC_STATUS = { | ||
pending: 'pending', | ||
fulfilled: 'fulfilled', | ||
rejected: 'rejected' | ||
}; | ||
var async = this.props.async; | ||
var Route = function (_Component) { | ||
babelHelpers.inherits(Route, _Component); | ||
if (async) { | ||
this.setState({ | ||
async: { status: ASYNC_STATUS.pending } | ||
}); | ||
async(this.props.params).then(function (value) { | ||
_this2.setState({ | ||
async: { | ||
status: ASYNC_STATUS.fulfilled, | ||
value: value | ||
} | ||
}); | ||
}, this.reject).catch(this.reject); | ||
} | ||
} | ||
}, { | ||
key: 'reject', | ||
value: function reject(value) { | ||
this.setState({ | ||
async: { | ||
status: ASYNC_STATUS.rejected, | ||
value: value | ||
} | ||
}); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() { | ||
this.async(); | ||
} | ||
}, { | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
this.async(); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props; | ||
var component = _props.component; | ||
var params = _props.params; | ||
function Route(props) { | ||
babelHelpers.classCallCheck(this, Route); | ||
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Route).call(this, props)); | ||
return createVNode().setTag(component).setAttrs({ params: params, async: this.state.async }); | ||
} | ||
}]); | ||
return Route; | ||
}(Component); | ||
_this.state = { | ||
async: null | ||
}; | ||
return _this; | ||
} | ||
var EMPTY$1 = {}; | ||
babelHelpers.createClass(Route, [{ | ||
key: 'async', | ||
value: function async() { | ||
var _this2 = this; | ||
function segmentize(url) { | ||
return strip(url).split('/'); | ||
} | ||
var async = this.props.async; | ||
function strip(url) { | ||
return url.replace(/(^\/+|\/+$)/g, ''); | ||
} | ||
if (async) { | ||
this.setState({ | ||
async: { status: ASYNC_STATUS.pending } | ||
}); | ||
async(this.props.params).then(function (value) { | ||
_this2.setState({ | ||
async: { | ||
status: ASYNC_STATUS.fulfilled, | ||
value: value | ||
} | ||
}); | ||
}, this.reject).catch(this.reject); | ||
} | ||
} | ||
}, { | ||
key: 'reject', | ||
value: function reject(value) { | ||
this.setState({ | ||
async: { | ||
status: ASYNC_STATUS.rejected, | ||
value: value | ||
} | ||
}); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() { | ||
this.async(); | ||
} | ||
}, { | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
this.async(); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props; | ||
var component = _props.component; | ||
var params = _props.params; | ||
function convertToHashbang(url) { | ||
if (url.indexOf('#') === -1) { | ||
url = '/'; | ||
} else { | ||
var splitHashUrl = url.split('#!'); | ||
splitHashUrl.shift(); | ||
url = splitHashUrl.join(''); | ||
} | ||
return url; | ||
} | ||
// Thanks goes to Preact for this function: https://github.com/developit/preact-router/blob/master/src/util.js#L4 | ||
function exec(url, route) { | ||
var opts = arguments.length <= 2 || arguments[2] === void 0 ? EMPTY$1 : arguments[2]; | ||
return createVNode().setTag(component).setAttrs({ params: params, async: this.state.async }); | ||
} | ||
}]); | ||
return Route; | ||
}(Component); | ||
var reg = /(?:\?([^#]*))?(#.*)?$/, | ||
c = url.match(reg), | ||
matches = {}, | ||
ret = void 0; | ||
if (c && c[1]) { | ||
var p = c[1].split('&'); | ||
for (var i = 0; i < p.length; i++) { | ||
var r = p[i].split('='); | ||
matches[decodeURIComponent(r[0])] = decodeURIComponent(r.slice(1).join('=')); | ||
} | ||
} | ||
url = segmentize(url.replace(reg, '')); | ||
route = segmentize(route || ''); | ||
var max = Math.max(url.length, route.length); | ||
for (var _i = 0; _i < max; _i++) { | ||
if (route[_i] && route[_i].charAt(0) === ':') { | ||
var param = route[_i].replace(/(^\:|[+*?]+$)/g, ''), | ||
flags = (route[_i].match(/[+*?]+$/) || EMPTY$1)[0] || '', | ||
plus = ~flags.indexOf('+'), | ||
star = ~flags.indexOf('*'), | ||
val = url[_i] || ''; | ||
if (!val && !star && (flags.indexOf('?') < 0 || plus)) { | ||
ret = false; | ||
break; | ||
} | ||
matches[param] = decodeURIComponent(val); | ||
if (plus || star) { | ||
matches[param] = url.slice(_i).map(decodeURIComponent).join('/'); | ||
break; | ||
} | ||
} else if (route[_i] !== url[_i]) { | ||
ret = false; | ||
break; | ||
} | ||
} | ||
if (opts.default !== true && ret === false) { | ||
return false; | ||
} | ||
return matches; | ||
} | ||
var EMPTY$1 = {}; | ||
function pathRankSort(a, b) { | ||
var aAttr = a.attrs || EMPTY$1, | ||
bAttr = b.attrs || EMPTY$1; | ||
var diff = rank(aAttr.path) - rank(bAttr.path); | ||
return diff || aAttr.path.length - bAttr.path.length; | ||
} | ||
function segmentize(url) { | ||
return strip(url).split('/'); | ||
} | ||
function rank(url) { | ||
return (strip(url).match(/\/+/g) || '').length; | ||
} | ||
function strip(url) { | ||
return url.replace(/(^\/+|\/+$)/g, ''); | ||
} | ||
var Router = function (_Component) { | ||
inherits(Router, _Component); | ||
function convertToHashbang(url) { | ||
if (url.indexOf('#') === -1) { | ||
url = '/'; | ||
} else { | ||
var splitHashUrl = url.split('#!'); | ||
splitHashUrl.shift(); | ||
url = splitHashUrl.join(''); | ||
} | ||
return url; | ||
} | ||
function Router(props) { | ||
classCallCheck(this, Router); | ||
// Thanks goes to Preact for this function: https://github.com/developit/preact-router/blob/master/src/util.js#L4 | ||
function exec(url, route) { | ||
var opts = arguments.length <= 2 || arguments[2] === void 0 ? EMPTY$1 : arguments[2]; | ||
var _this = possibleConstructorReturn(this, Object.getPrototypeOf(Router).call(this, props)); | ||
var reg = /(?:\?([^#]*))?(#.*)?$/, | ||
c = url.match(reg), | ||
matches = {}, | ||
ret = void 0; | ||
if (c && c[1]) { | ||
var p = c[1].split('&'); | ||
for (var i = 0; i < p.length; i++) { | ||
var r = p[i].split('='); | ||
matches[decodeURIComponent(r[0])] = decodeURIComponent(r.slice(1).join('=')); | ||
} | ||
} | ||
url = segmentize(url.replace(reg, '')); | ||
route = segmentize(route || ''); | ||
var max = Math.max(url.length, route.length); | ||
for (var _i = 0; _i < max; _i++) { | ||
if (route[_i] && route[_i].charAt(0) === ':') { | ||
var param = route[_i].replace(/(^\:|[+*?]+$)/g, ''), | ||
flags = (route[_i].match(/[+*?]+$/) || EMPTY$1)[0] || '', | ||
plus = ~flags.indexOf('+'), | ||
star = ~flags.indexOf('*'), | ||
val = url[_i] || ''; | ||
if (!val && !star && (flags.indexOf('?') < 0 || plus)) { | ||
ret = false; | ||
break; | ||
} | ||
matches[param] = decodeURIComponent(val); | ||
if (plus || star) { | ||
matches[param] = url.slice(_i).map(decodeURIComponent).join('/'); | ||
break; | ||
} | ||
} else if (route[_i] !== url[_i]) { | ||
ret = false; | ||
break; | ||
} | ||
} | ||
if (opts.default !== true && ret === false) { | ||
return false; | ||
} | ||
return matches; | ||
} | ||
if (!props.history) { | ||
throw new Error('Inferno Error: "inferno-router" Router components require a "history" prop passed.'); | ||
} | ||
_this._didRoute = false; | ||
_this.state = { | ||
url: props.url || props.history.getCurrentUrl() | ||
}; | ||
return _this; | ||
} | ||
function pathRankSort(a, b) { | ||
var aAttr = a.attrs || EMPTY$1, | ||
bAttr = b.attrs || EMPTY$1; | ||
var diff = rank(aAttr.path) - rank(bAttr.path); | ||
return diff || aAttr.path.length - bAttr.path.length; | ||
} | ||
createClass(Router, [{ | ||
key: 'getChildContext', | ||
value: function getChildContext() { | ||
return { | ||
history: this.props.history, | ||
hashbang: this.props.hashbang | ||
}; | ||
} | ||
}, { | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
this.props.history.addRouter(this); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.props.history.removeRouter(this); | ||
} | ||
}, { | ||
key: 'routeTo', | ||
value: function routeTo(url) { | ||
this._didRoute = false; | ||
this.setState({ url: url }); | ||
return this._didRoute; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var children = isArray(this.props.children) ? this.props.children : [this.props.children]; | ||
var url = this.props.url || this.state.url; | ||
var wrapperComponent = this.props.component; | ||
var hashbang = this.props.hashbang; | ||
function rank(url) { | ||
return (strip(url).match(/\/+/g) || '').length; | ||
} | ||
children.sort(pathRankSort); | ||
var Router = function (_Component) { | ||
babelHelpers.inherits(Router, _Component); | ||
for (var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
var path = child.attrs.path; | ||
function Router(props) { | ||
babelHelpers.classCallCheck(this, Router); | ||
var params = exec(hashbang ? convertToHashbang(url) : url, path); | ||
var _this = babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(Router).call(this, props)); | ||
if (params) { | ||
if (wrapperComponent) { | ||
return createVNode().setTag(wrapperComponent).setChildren(child).setAttrs({ | ||
params: params | ||
}); | ||
} | ||
return child.setAttrs(Object.assign({}, { params: params }, child.attrs)); | ||
} | ||
} | ||
return wrapperComponent ? createVNode().setTag(wrapperComponent) : null; | ||
} | ||
}]); | ||
return Router; | ||
}(Component); | ||
if (!props.history) { | ||
throw new Error('Inferno Error: "inferno-router" Router components require a "history" prop passed.'); | ||
} | ||
_this._didRoute = false; | ||
_this.state = { | ||
url: props.url || props.history.getCurrentUrl() | ||
}; | ||
return _this; | ||
} | ||
function Link(_ref, _ref2) { | ||
var to = _ref.to; | ||
var children = _ref.children; | ||
var hashbang = _ref2.hashbang; | ||
var history = _ref2.history; | ||
babelHelpers.createClass(Router, [{ | ||
key: 'getChildContext', | ||
value: function getChildContext() { | ||
return { | ||
history: this.props.history, | ||
hashbang: this.props.hashbang | ||
}; | ||
} | ||
}, { | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
this.props.history.addRouter(this); | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.props.history.removeRouter(this); | ||
} | ||
}, { | ||
key: 'routeTo', | ||
value: function routeTo(url) { | ||
this._didRoute = false; | ||
this.setState({ url: url }); | ||
return this._didRoute; | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var children = isArray(this.props.children) ? this.props.children : [this.props.children]; | ||
var url = this.props.url || this.state.url; | ||
var wrapperComponent = this.props.component; | ||
var hashbang = this.props.hashbang; | ||
return createVNode().setAttrs({ | ||
href: hashbang ? history.getHashbangRoot() + convertToHashbang('#!' + to) : to | ||
}).setTag('a').setChildren(children); | ||
} | ||
children.sort(pathRankSort); | ||
var routers = []; | ||
for (var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
var path = child.attrs.path; | ||
function getCurrentUrl() { | ||
var url = typeof location !== 'undefined' ? location : EMPTY; | ||
var params = exec(hashbang ? convertToHashbang(url) : url, path); | ||
return '' + (url.pathname || '') + (url.search || '') + (url.hash || ''); | ||
} | ||
if (params) { | ||
if (wrapperComponent) { | ||
return createVNode().setTag(wrapperComponent).setChildren(child).setAttrs({ | ||
params: params | ||
}); | ||
} | ||
return child.setAttrs(Object.assign({}, { params: params }, child.attrs)); | ||
} | ||
} | ||
return wrapperComponent ? createVNode().setTag(wrapperComponent) : null; | ||
} | ||
}]); | ||
return Router; | ||
}(Component); | ||
function getHashbangRoot() { | ||
var url = typeof location !== 'undefined' ? location : EMPTY; | ||
function Link(_ref, _ref2) { | ||
var to = _ref.to; | ||
var children = _ref.children; | ||
var hashbang = _ref2.hashbang; | ||
var history = _ref2.history; | ||
return '' + (url.protocol + '//' || '') + (url.host || '') + (url.pathname || '') + (url.search || '') + '#!'; | ||
} | ||
return createVNode().setAttrs({ | ||
href: hashbang ? history.getHashbangRoot() + convertToHashbang('#!' + to) : to | ||
}).setTag('a').setChildren(children); | ||
} | ||
function routeTo(url) { | ||
var didRoute = false; | ||
for (var i = 0; i < routers.length; i++) { | ||
if (routers[i].routeTo(url) === true) { | ||
didRoute = true; | ||
} | ||
} | ||
return didRoute; | ||
} | ||
var routers = []; | ||
window.addEventListener('popstate', function () { | ||
return routeTo(getCurrentUrl()); | ||
}); | ||
function getCurrentUrl() { | ||
var url = typeof location !== 'undefined' ? location : EMPTY; | ||
var browserHistory = { | ||
addRouter: function addRouter(router) { | ||
routers.push(router); | ||
}, | ||
removeRouter: function removeRouter(router) { | ||
roouters.splice(routers.indexOf(router), 1); | ||
}, | ||
return '' + (url.pathname || '') + (url.search || '') + (url.hash || ''); | ||
} | ||
getCurrentUrl: getCurrentUrl, | ||
getHashbangRoot: getHashbangRoot | ||
}; | ||
function getHashbangRoot() { | ||
var url = typeof location !== 'undefined' ? location : EMPTY; | ||
var index = { | ||
Route: Route, | ||
Router: Router, | ||
Link: Link, | ||
browserHistory: browserHistory | ||
}; | ||
return '' + (url.protocol + '//' || '') + (url.pathname || '') + (url.search || '') + '#!'; | ||
} | ||
return index; | ||
function routeTo(url) { | ||
var didRoute = false; | ||
for (var i = 0; i < routers.length; i++) { | ||
if (routers[i].routeTo(url) === true) { | ||
didRoute = true; | ||
} | ||
} | ||
return didRoute; | ||
} | ||
window.addEventListener('popstate', function () { | ||
return routeTo(getCurrentUrl()); | ||
}); | ||
var browserHistory = { | ||
addRouter: function addRouter(router) { | ||
routers.push(router); | ||
}, | ||
removeRouter: function removeRouter(router) { | ||
roouters.splice(routers.indexOf(router), 1); | ||
}, | ||
getCurrentUrl: getCurrentUrl, | ||
getHashbangRoot: getHashbangRoot | ||
}; | ||
var index = { | ||
Route: Route, | ||
Router: Router, | ||
Link: Link, | ||
browserHistory: browserHistory | ||
}; | ||
return index; | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.InfernoRouter=e()}(this,function(){"use strict";function t(t){return t instanceof Array}function e(t){return void 0===t||null===t}function n(t){return null===t||t===!1||void 0===t}function o(t){this.bp=t,this.dom=null,this.instance=null,this.tag=null,this.children=null,this.style=null,this.className=null,this.attrs=null,this.events=null,this.hooks=null,this.key=null,this.clipData=null}function r(t){return new o(t)}function i(){return{"null":!0,dom:document.createTextNode("")}}function s(t,e,n){t.split(",").forEach(function(t){return e[t]=n})}function a(){this._listeners=[],this.scrollX=null,this.scrollY=null,this.screenHeight=U,this.screenWidth=O}function l(){return document.activeElement}function u(t){t!==document.body&&document.activeElement!==t&&t.focus()}function c(t,e,n){for(var o in e)t._pendingState[o]=e[o];if(t._pendingSetState){var r=t._pendingState,i=t.state;t.state=Object.assign({},i,r),t._pendingState={}}else t._pendingSetState=!0,h(t,!1,n)}function h(t,o,r){if(!t._deferSetState||o){t._pendingSetState=!1;var s=t._pendingState,c=t.state,h=Object.assign({},c,s);t._pendingState={};var p=t._updateComponent(c,h,t.props,t.props,o);n(p)&&(p=i());var f=t._lastNode,d=f.dom.parentNode,y=l(),m=new a;t._patch(f,p,d,m,t.context,t,null),t._lastNode=p,t._parentNode.dom=p.dom,m.trigger(),e(r)||r(),u(y)}}function p(t){return f(t).split("/")}function f(t){return t.replace(/(^\/+|\/+$)/g,"")}function d(t){if(-1===t.indexOf("#"))t="/";else{var e=t.split("#!");e.shift(),t=e.join("")}return t}function y(t,e){var n=arguments.length<=2||void 0===arguments[2]?A:arguments[2],o=/(?:\?([^#]*))?(#.*)?$/,r=t.match(o),i={},s=void 0;if(r&&r[1])for(var a=r[1].split("&"),l=0;l<a.length;l++){var u=a[l].split("=");i[decodeURIComponent(u[0])]=decodeURIComponent(u.slice(1).join("="))}t=p(t.replace(o,"")),e=p(e||"");for(var c=Math.max(t.length,e.length),h=0;c>h;h++)if(e[h]&&":"===e[h].charAt(0)){var f=e[h].replace(/(^\:|[+*?]+$)/g,""),d=(e[h].match(/[+*?]+$/)||A)[0]||"",y=~d.indexOf("+"),m=~d.indexOf("*"),v=t[h]||"";if(!v&&!m&&(d.indexOf("?")<0||y)){s=!1;break}if(i[f]=decodeURIComponent(v),y||m){i[f]=t.slice(h).map(decodeURIComponent).join("/");break}}else if(e[h]!==t[h]){s=!1;break}return n.default!==!0&&s===!1?!1:i}function m(t,e){var n=t.attrs||A,o=e.attrs||A,r=v(n.path)-v(o.path);return r||n.path.length-o.path.length}function v(t){return(f(t).match(/\/+/g)||"").length}function g(t,e){var n=t.to,o=t.children,i=e.hashbang,s=e.history;return r().setAttrs({href:i?s.getHashbangRoot()+d("#!"+n):n}).setTag("a").setChildren(o)}function w(){var t="undefined"!=typeof location?location:EMPTY;return""+(t.pathname||"")+(t.search||"")+(t.hash||"")}function b(){var t="undefined"!=typeof location?location:EMPTY;return""+(t.protocol+"//"||"")+(t.pathname||"")+(t.search||"")+"#!"}function k(t){for(var e=!1,n=0;n<X.length;n++)X[n].routeTo(t)===!0&&(e=!0);return e}var _={};_.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},_.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},_.createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),_.extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},_.inherits=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},_.possibleConstructorReturn=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},o.prototype={setAttrs:function(t){return this.attrs=t,this},setTag:function(t){return this.tag=t,this},setStyle:function(t){return this.style=t,this},setClassName:function(t){return this.className=t,this},setChildren:function(t){return this.children=t,this},setHooks:function(t){return this.hooks=t,this},setEvents:function(t){return this.events=t,this},setKey:function(t){return this.key=t,this}};var S="http://www.w3.org/1999/xlink",C="http://www.w3.org/XML/1998/namespace",x={},R={},j={};s("xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type",j,S),s("xml:base,xml:lang,xml:space",j,C),s("volume,value",x,!0),s("muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate",R,!0);var O=window.screen.width,U=window.screen.height,E=0,T=0,W=0;window.onscroll=function(t){E=window.scrollX,T=window.scrollY,W=performance.now()},window.resize=function(t){E=window.scrollX,T=window.scrollY,O=window.screen.width,U=window.screen.height,W=performance.now()},a.prototype={refresh:function(){this.scrollX=window.scrollX,this.scrollY=window.scrollY},addListener:function(t){this._listeners.push(t)},trigger:function(){for(var t=0;t<this._listeners.length;t++)this._listeners[t]()}};var P="Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.",N=function(){function t(e){_.classCallCheck(this,t),this.props=e||{},this.state={},this.refs={},this._blockSetState=!1,this._deferSetState=!1,this._pendingSetState=!1,this._pendingState={},this._parentNode=null,this._lastNode=null,this._unmounted=!0,this.context={},this._patch=null,this._parentComponent=null}return _.createClass(t,[{key:"render",value:function(){}},{key:"forceUpdate",value:function(t){if(this._unmounted)throw Error(P);h(this,!0,t)}},{key:"setState",value:function(t,e){if(this._unmounted)throw Error(P);if(this._blockSetState!==!1)throw Error("Inferno Warning: Cannot update state via setState() in componentWillUpdate()");c(this,t,e)}},{key:"componentDidMount",value:function(){}},{key:"componentWillMount",value:function(){}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(){}},{key:"shouldComponentUpdate",value:function(){return!0}},{key:"componentWillReceiveProps",value:function(){}},{key:"componentWillUpdate",value:function(){}},{key:"getChildContext",value:function(){}},{key:"_updateComponent",value:function(t,n,o,r,i){if(this._unmounted===!0)return this._unmounted=!1,!1;if(!e(r)&&e(r.children)&&(r.children=o.children),o!==r||t!==n||i){o!==r&&(this._blockSetState=!0,this.componentWillReceiveProps(r),this._blockSetState=!1);var s=this.shouldComponentUpdate(r,n);if(s!==!1){this._blockSetState=!0,this.componentWillUpdate(r,n),this._blockSetState=!1,this.props=r,this.state=n;var a=this.render();return this.componentDidUpdate(o,t),a}}return!1}}]),t}(),I={pending:"pending",fulfilled:"fulfilled",rejected:"rejected"},M=function(t){function e(t){_.classCallCheck(this,e);var n=_.possibleConstructorReturn(this,Object.getPrototypeOf(e).call(this,t));return n.state={async:null},n}return _.inherits(e,t),_.createClass(e,[{key:"async",value:function t(){var e=this,t=this.props.async;t&&(this.setState({async:{status:I.pending}}),t(this.props.params).then(function(t){e.setState({async:{status:I.fulfilled,value:t}})},this.reject).catch(this.reject))}},{key:"reject",value:function(t){this.setState({async:{status:I.rejected,value:t}})}},{key:"componentWillReceiveProps",value:function(){this.async()}},{key:"componentWillMount",value:function(){this.async()}},{key:"render",value:function(){var t=this.props,e=t.component,n=t.params;return r().setTag(e).setAttrs({params:n,async:this.state.async})}}]),e}(N),A={},Y=function(e){function n(t){_.classCallCheck(this,n);var e=_.possibleConstructorReturn(this,Object.getPrototypeOf(n).call(this,t));if(!t.history)throw new Error('Inferno Error: "inferno-router" Router components require a "history" prop passed.');return e._didRoute=!1,e.state={url:t.url||t.history.getCurrentUrl()},e}return _.inherits(n,e),_.createClass(n,[{key:"getChildContext",value:function(){return{history:this.props.history,hashbang:this.props.hashbang}}},{key:"componentWillMount",value:function(){this.props.history.addRouter(this)}},{key:"componentWillUnmount",value:function(){this.props.history.removeRouter(this)}},{key:"routeTo",value:function(t){return this._didRoute=!1,this.setState({url:t}),this._didRoute}},{key:"render",value:function(){var e=t(this.props.children)?this.props.children:[this.props.children],n=this.props.url||this.state.url,o=this.props.component,i=this.props.hashbang;e.sort(m);for(var s=0;s<e.length;s++){var a=e[s],l=a.attrs.path,u=y(i?d(n):n,l);if(u)return o?r().setTag(o).setChildren(a).setAttrs({params:u}):a.setAttrs(Object.assign({},{params:u},a.attrs))}return o?r().setTag(o):null}}]),n}(N),X=[];window.addEventListener("popstate",function(){return k(w())});var H={addRouter:function(t){X.push(t)},removeRouter:function(t){roouters.splice(X.indexOf(t),1)},getCurrentUrl:w,getHashbangRoot:b},D={Route:M,Router:Y,Link:g,browserHistory:H};return D}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.InfernoRouter=e()}(this,function(){"use strict";function t(t){return t instanceof Array}function e(t){return void 0===t||null===t}function n(t){return null===t||t===!1||void 0===t}function o(t){this.bp=t,this.dom=null,this.instance=null,this.tag=null,this.children=null,this.style=null,this.className=null,this.attrs=null,this.events=null,this.hooks=null,this.key=null,this.clipData=null}function r(t){return new o(t)}function i(){return{"null":!0,dom:document.createTextNode("")}}function s(t,e,n){t.split(",").forEach(function(t){return e[t]=n})}function a(){this._listeners=[],this.scrollX=null,this.scrollY=null,this.screenHeight=O,this.screenWidth=j}function u(){return document.activeElement}function l(t){t!==document.body&&document.activeElement!==t&&t.focus()}function c(t,e,n){for(var o in e)t._pendingState[o]=e[o];if(t._pendingSetState){var r=t._pendingState,i=t.state;t.state=Object.assign({},i,r),t._pendingState={}}else t._pendingSetState=!0,h(t,!1,n)}function h(t,o,r){if(!t._deferSetState||o){t._pendingSetState=!1;var s=t._pendingState,c=t.state,h=Object.assign({},c,s);t._pendingState={};var p=t._updateComponent(c,h,t.props,t.props,o);n(p)&&(p=i());var f=t._lastNode,d=f.dom.parentNode,m=u(),v=new a;t._patch(f,p,d,v,t.context,t,null),t._lastNode=p,t._parentNode.dom=p.dom,v.trigger(),e(r)||r(),l(m)}}function p(t){return f(t).split("/")}function f(t){return t.replace(/(^\/+|\/+$)/g,"")}function d(t){if(-1===t.indexOf("#"))t="/";else{var e=t.split("#!");e.shift(),t=e.join("")}return t}function m(t,e){var n=arguments.length<=2||void 0===arguments[2]?H:arguments[2],o=/(?:\?([^#]*))?(#.*)?$/,r=t.match(o),i={},s=void 0;if(r&&r[1])for(var a=r[1].split("&"),u=0;u<a.length;u++){var l=a[u].split("=");i[decodeURIComponent(l[0])]=decodeURIComponent(l.slice(1).join("="))}t=p(t.replace(o,"")),e=p(e||"");for(var c=Math.max(t.length,e.length),h=0;c>h;h++)if(e[h]&&":"===e[h].charAt(0)){var f=e[h].replace(/(^\:|[+*?]+$)/g,""),d=(e[h].match(/[+*?]+$/)||H)[0]||"",m=~d.indexOf("+"),v=~d.indexOf("*"),y=t[h]||"";if(!y&&!v&&(d.indexOf("?")<0||m)){s=!1;break}if(i[f]=decodeURIComponent(y),m||v){i[f]=t.slice(h).map(decodeURIComponent).join("/");break}}else if(e[h]!==t[h]){s=!1;break}return n.default!==!0&&s===!1?!1:i}function v(t,e){var n=t.attrs||H,o=e.attrs||H,r=y(n.path)-y(o.path);return r||n.path.length-o.path.length}function y(t){return(f(t).match(/\/+/g)||"").length}function g(t,e){var n=t.to,o=t.children,i=e.hashbang,s=e.history;return r().setAttrs({href:i?s.getHashbangRoot()+d("#!"+n):n}).setTag("a").setChildren(o)}function w(){var t="undefined"!=typeof location?location:EMPTY;return""+(t.pathname||"")+(t.search||"")+(t.hash||"")}function k(){var t="undefined"!=typeof location?location:EMPTY;return""+(t.protocol+"//"||"")+(t.host||"")+(t.pathname||"")+(t.search||"")+"#!"}function _(t){for(var e=!1,n=0;n<L.length;n++)L[n].routeTo(t)===!0&&(e=!0);return e}o.prototype={setAttrs:function(t){return this.attrs=t,this},setTag:function(t){return this.tag=t,this},setStyle:function(t){return this.style=t,this},setClassName:function(t){return this.className=t,this},setChildren:function(t){return this.children=t,this},setHooks:function(t){return this.hooks=t,this},setEvents:function(t){return this.events=t,this},setKey:function(t){return this.key=t,this}};var b="http://www.w3.org/1999/xlink",S="http://www.w3.org/XML/1998/namespace",x={},C={},R={};s("xlink:href,xlink:arcrole,xlink:actuate,xlink:role,xlink:titlef,xlink:type",R,b),s("xml:base,xml:lang,xml:space",R,S),s("volume,value",x,!0),s("muted,scoped,loop,open,checked,default,capture,disabled,selected,readonly,multiple,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate",C,!0);var j=window.screen.width,O=window.screen.height,U=0,E=0,T=0;window.onscroll=function(t){U=window.scrollX,E=window.scrollY,T=performance.now()},window.resize=function(t){U=window.scrollX,E=window.scrollY,j=window.screen.width,O=window.screen.height,T=performance.now()},a.prototype={refresh:function(){this.scrollX=window.scrollX,this.scrollY=window.scrollY},addListener:function(t){this._listeners.push(t)},trigger:function(){for(var t=0;t<this._listeners.length;t++)this._listeners[t]()}};var W=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},N=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),P=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},I=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},M="Inferno Error: Can only update a mounted or mounting component. This usually means you called setState() or forceUpdate() on an unmounted component. This is a no-op.",A=function(){function t(e){W(this,t),this.props=e||{},this.state={},this.refs={},this._blockSetState=!1,this._deferSetState=!1,this._pendingSetState=!1,this._pendingState={},this._parentNode=null,this._lastNode=null,this._unmounted=!0,this.context={},this._patch=null,this._parentComponent=null}return N(t,[{key:"render",value:function(){}},{key:"forceUpdate",value:function(t){if(this._unmounted)throw Error(M);h(this,!0,t)}},{key:"setState",value:function(t,e){if(this._unmounted)throw Error(M);if(this._blockSetState!==!1)throw Error("Inferno Warning: Cannot update state via setState() in componentWillUpdate()");c(this,t,e)}},{key:"componentDidMount",value:function(){}},{key:"componentWillMount",value:function(){}},{key:"componentWillUnmount",value:function(){}},{key:"componentDidUpdate",value:function(){}},{key:"shouldComponentUpdate",value:function(){return!0}},{key:"componentWillReceiveProps",value:function(){}},{key:"componentWillUpdate",value:function(){}},{key:"getChildContext",value:function(){}},{key:"_updateComponent",value:function(t,n,o,r,i){if(this._unmounted===!0)return this._unmounted=!1,!1;if(!e(r)&&e(r.children)&&(r.children=o.children),o!==r||t!==n||i){o!==r&&(this._blockSetState=!0,this.componentWillReceiveProps(r),this._blockSetState=!1);var s=this.shouldComponentUpdate(r,n);if(s!==!1){this._blockSetState=!0,this.componentWillUpdate(r,n),this._blockSetState=!1,this.props=r,this.state=n;var a=this.render();return this.componentDidUpdate(o,t),a}}return!1}}]),t}(),Y={pending:"pending",fulfilled:"fulfilled",rejected:"rejected"},X=function(t){function e(t){W(this,e);var n=I(this,Object.getPrototypeOf(e).call(this,t));return n.state={async:null},n}return P(e,t),N(e,[{key:"async",value:function t(){var e=this,t=this.props.async;t&&(this.setState({async:{status:Y.pending}}),t(this.props.params).then(function(t){e.setState({async:{status:Y.fulfilled,value:t}})},this.reject).catch(this.reject))}},{key:"reject",value:function(t){this.setState({async:{status:Y.rejected,value:t}})}},{key:"componentWillReceiveProps",value:function(){this.async()}},{key:"componentWillMount",value:function(){this.async()}},{key:"render",value:function(){var t=this.props,e=t.component,n=t.params;return r().setTag(e).setAttrs({params:n,async:this.state.async})}}]),e}(A),H={},D=function(e){function n(t){W(this,n);var e=I(this,Object.getPrototypeOf(n).call(this,t));if(!t.history)throw new Error('Inferno Error: "inferno-router" Router components require a "history" prop passed.');return e._didRoute=!1,e.state={url:t.url||t.history.getCurrentUrl()},e}return P(n,e),N(n,[{key:"getChildContext",value:function(){return{history:this.props.history,hashbang:this.props.hashbang}}},{key:"componentWillMount",value:function(){this.props.history.addRouter(this)}},{key:"componentWillUnmount",value:function(){this.props.history.removeRouter(this)}},{key:"routeTo",value:function(t){return this._didRoute=!1,this.setState({url:t}),this._didRoute}},{key:"render",value:function(){var e=t(this.props.children)?this.props.children:[this.props.children],n=this.props.url||this.state.url,o=this.props.component,i=this.props.hashbang;e.sort(v);for(var s=0;s<e.length;s++){var a=e[s],u=a.attrs.path,l=m(i?d(n):n,u);if(l)return o?r().setTag(o).setChildren(a).setAttrs({params:l}):a.setAttrs(Object.assign({},{params:l},a.attrs))}return o?r().setTag(o):null}}]),n}(A),L=[];window.addEventListener("popstate",function(){return _(w())});var $={addRouter:function(t){L.push(t)},removeRouter:function(t){roouters.splice(L.indexOf(t),1)},getCurrentUrl:w,getHashbangRoot:k},q={Route:X,Router:D,Link:g,browserHistory:$};return q}); |
/*! | ||
* inferno-server v0.7.10 | ||
* inferno-server v0.7.11 | ||
* (c) 2016 Dominic Gannaway | ||
@@ -7,219 +7,168 @@ * Released under the MIT License. | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.InfernoServer = factory()); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.InfernoServer = factory()); | ||
}(this, function () { 'use strict'; | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
function addChildrenToProps(children, props) { | ||
if (!isNullOrUndefined(children)) { | ||
var isChildrenArray = isArray(children); | ||
if (isChildrenArray && children.length > 0 || !isChildrenArray) { | ||
if (props) { | ||
props = Object.assign({}, props, { children: children }); | ||
} else { | ||
props = { | ||
children: children | ||
}; | ||
} | ||
} | ||
} | ||
return props; | ||
} | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function isArray(obj) { | ||
return obj instanceof Array; | ||
} | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function isStatefulComponent(obj) { | ||
return obj.prototype.render !== void 0; | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
function isStringOrNumber(obj) { | ||
return typeof obj === 'string' || typeof obj === 'number'; | ||
} | ||
babelHelpers.extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
function isNullOrUndefined(obj) { | ||
return obj === void 0 || obj === null; | ||
} | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
function isInvalidNode(obj) { | ||
return obj === null || obj === false || obj === void 0; | ||
} | ||
return target; | ||
}; | ||
function isFunction(obj) { | ||
return typeof obj === 'function'; | ||
} | ||
babelHelpers.inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
return target; | ||
}; | ||
babelHelpers; | ||
function renderComponent(Component, props, children, context) { | ||
props = addChildrenToProps(children, props); | ||
function addChildrenToProps(children, props) { | ||
if (!isNullOrUndefined(children)) { | ||
var isChildrenArray = isArray(children); | ||
if (isChildrenArray && children.length > 0 || !isChildrenArray) { | ||
if (props) { | ||
props = Object.assign({}, props, { children: children }); | ||
} else { | ||
props = { | ||
children: children | ||
}; | ||
} | ||
} | ||
} | ||
return props; | ||
} | ||
if (isStatefulComponent(Component)) { | ||
var instance = new Component(props); | ||
var childContext = instance.getChildContext(); | ||
function isArray(obj) { | ||
return obj instanceof Array; | ||
} | ||
if (!isNullOrUndefined(childContext)) { | ||
context = _extends({}, context, childContext); | ||
} | ||
instance.context = context; | ||
// Block setting state - we should render only once, using latest state | ||
instance._pendingSetState = true; | ||
instance.componentWillMount(); | ||
var node = instance.render(); | ||
instance._pendingSetState = false; | ||
return renderNode(node, context); | ||
} else { | ||
var _node = Component(props); | ||
return renderNode(_node, context); | ||
} | ||
} | ||
function isStatefulComponent(obj) { | ||
return obj.prototype.render !== void 0; | ||
} | ||
function renderChildren(children, context) { | ||
if (children && isArray(children)) { | ||
var childrenResult = []; | ||
var insertComment = false; | ||
function isStringOrNumber(obj) { | ||
return typeof obj === 'string' || typeof obj === 'number'; | ||
} | ||
for (var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
function isNullOrUndefined(obj) { | ||
return obj === void 0 || obj === null; | ||
} | ||
if (isStringOrNumber(child)) { | ||
if (insertComment === true) { | ||
childrenResult.push('<!-- -->'); | ||
} | ||
childrenResult.push(child); | ||
insertComment = true; | ||
} else { | ||
insertComment = false; | ||
childrenResult.push(renderNode(child, context)); | ||
} | ||
} | ||
return childrenResult.join(''); | ||
} else if (!isInvalidNode(children)) { | ||
if (isStringOrNumber(children)) { | ||
return children; | ||
} else { | ||
return renderNode(children, context) || ''; | ||
} | ||
} | ||
function isInvalidNode(obj) { | ||
return obj === null || obj === false || obj === void 0; | ||
} | ||
return ''; | ||
} | ||
function isFunction(obj) { | ||
return typeof obj === 'function'; | ||
} | ||
function renderNode(node, context) { | ||
if (!isInvalidNode(node)) { | ||
var _ret = function () { | ||
var tag = node.tag; | ||
var outputAttrs = []; | ||
function renderComponent(Component, props, children, context) { | ||
props = addChildrenToProps(children, props); | ||
if (isFunction(tag)) { | ||
return { | ||
v: renderComponent(tag, node.attrs, node.children, context) | ||
}; | ||
} | ||
if (!isNullOrUndefined(node.className)) { | ||
outputAttrs.push('class="' + node.className + '"'); | ||
} | ||
var attrs = node.attrs; | ||
if (isStatefulComponent(Component)) { | ||
var instance = new Component(props); | ||
var childContext = instance.getChildContext(); | ||
if (!isNullOrUndefined(attrs)) { | ||
(function () { | ||
var attrsKeys = Object.keys(attrs); | ||
if (!isNullOrUndefined(childContext)) { | ||
context = babelHelpers.extends({}, context, childContext); | ||
} | ||
instance.context = context; | ||
// Block setting state - we should render only once, using latest state | ||
instance._pendingSetState = true; | ||
instance.componentWillMount(); | ||
var node = instance.render(); | ||
instance._pendingSetState = false; | ||
return renderNode(node, context); | ||
} else { | ||
var _node = Component(props); | ||
return renderNode(_node, context); | ||
} | ||
} | ||
attrsKeys.forEach(function (attrsKey, i) { | ||
var attr = attrsKeys[i]; | ||
function renderChildren(children, context) { | ||
if (children && isArray(children)) { | ||
var childrenResult = []; | ||
var insertComment = false; | ||
outputAttrs.push(attr + '="' + attrs[attr] + '"'); | ||
}); | ||
})(); | ||
} | ||
for (var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
return { | ||
v: '<' + tag + (outputAttrs.length > 0 ? ' ' + outputAttrs.join(' ') : '') + '>' + renderChildren(node.children, context) + '</' + tag + '>' | ||
}; | ||
}(); | ||
if (isStringOrNumber(child)) { | ||
if (insertComment === true) { | ||
childrenResult.push('<!-- -->'); | ||
} | ||
childrenResult.push(child); | ||
insertComment = true; | ||
} else { | ||
insertComment = false; | ||
childrenResult.push(renderNode(child, context)); | ||
} | ||
} | ||
return childrenResult.join(''); | ||
} else if (!isInvalidNode(children)) { | ||
if (isStringOrNumber(children)) { | ||
return children; | ||
} else { | ||
return renderNode(children, context) || ''; | ||
} | ||
} | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
} | ||
} | ||
return ''; | ||
} | ||
function renderToString(node) { | ||
return renderNode(node, null); | ||
} | ||
function renderNode(node, context) { | ||
if (!isInvalidNode(node)) { | ||
var _ret = function () { | ||
var tag = node.tag; | ||
var outputAttrs = []; | ||
var index = { | ||
renderToString: renderToString | ||
}; | ||
if (isFunction(tag)) { | ||
return { | ||
v: renderComponent(tag, node.attrs, node.children, context) | ||
}; | ||
} | ||
if (!isNullOrUndefined(node.className)) { | ||
outputAttrs.push('class="' + node.className + '"'); | ||
} | ||
var attrs = node.attrs; | ||
return index; | ||
if (!isNullOrUndefined(attrs)) { | ||
(function () { | ||
var attrsKeys = Object.keys(attrs); | ||
attrsKeys.forEach(function (attrsKey, i) { | ||
var attr = attrsKeys[i]; | ||
outputAttrs.push(attr + '="' + attrs[attr] + '"'); | ||
}); | ||
})(); | ||
} | ||
return { | ||
v: '<' + tag + (outputAttrs.length > 0 ? ' ' + outputAttrs.join(' ') : '') + '>' + renderChildren(node.children, context) + '</' + tag + '>' | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === "object") return _ret.v; | ||
} | ||
} | ||
function renderToString(node) { | ||
return renderNode(node, null); | ||
} | ||
var index = { | ||
renderToString: renderToString | ||
}; | ||
return index; | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.InfernoServer=n()}(this,function(){"use strict";function e(e,t){if(!o(e)){var r=n(e);(r&&e.length>0||!r)&&(t=t?Object.assign({},t,{children:e}):{children:e})}return t}function n(e){return e instanceof Array}function t(e){return void 0!==e.prototype.render}function r(e){return"string"==typeof e||"number"==typeof e}function o(e){return void 0===e||null===e}function i(e){return null===e||e===!1||void 0===e}function u(e){return"function"==typeof e}function f(n,r,i,u){if(r=e(i,r),t(n)){var f=new n(r),c=f.getChildContext();o(c)||(u=s.extends({},u,c)),f.context=u,f._pendingSetState=!0,f.componentWillMount();var l=f.render();return f._pendingSetState=!1,a(l,u)}var p=n(r);return a(p,u)}function c(e,t){if(e&&n(e)){for(var o=[],u=!1,f=0;f<e.length;f++){var c=e[f];r(c)?(u===!0&&o.push("<!-- -->"),o.push(c),u=!0):(u=!1,o.push(a(c,t)))}return o.join("")}return i(e)?"":r(e)?e:a(e,t)||""}function a(e,n){if(!i(e)){var t=function(){var t=e.tag,r=[];if(u(t))return{v:f(t,e.attrs,e.children,n)};o(e.className)||r.push('class="'+e.className+'"');var i=e.attrs;return o(i)||!function(){var e=Object.keys(i);e.forEach(function(n,t){var o=e[t];r.push(o+'="'+i[o]+'"')})}(),{v:"<"+t+(r.length>0?" "+r.join(" "):"")+">"+c(e.children,n)+"</"+t+">"}}();if("object"===("undefined"==typeof t?"undefined":s.typeof(t)))return t.v}}function l(e){return a(e,null)}var s={};s.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s.classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},s.createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),s.extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},s.inherits=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(e,n):e.__proto__=n)},s.possibleConstructorReturn=function(e,n){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!=typeof n&&"function"!=typeof n?e:n};var p={renderToString:l};return p}); | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.InfernoServer=t()}(this,function(){"use strict";function n(n,e){if(!o(n)){var r=t(n);(r&&n.length>0||!r)&&(e=e?Object.assign({},e,{children:n}):{children:n})}return e}function t(n){return n instanceof Array}function e(n){return void 0!==n.prototype.render}function r(n){return"string"==typeof n||"number"==typeof n}function o(n){return void 0===n||null===n}function u(n){return null===n||n===!1||void 0===n}function i(n){return"function"==typeof n}function f(t,r,u,i){if(r=n(u,r),e(t)){var f=new t(r),c=f.getChildContext();o(c)||(i=p({},i,c)),f.context=i,f._pendingSetState=!0,f.componentWillMount();var l=f.render();return f._pendingSetState=!1,a(l,i)}var s=t(r);return a(s,i)}function c(n,e){if(n&&t(n)){for(var o=[],i=!1,f=0;f<n.length;f++){var c=n[f];r(c)?(i===!0&&o.push("<!-- -->"),o.push(c),i=!0):(i=!1,o.push(a(c,e)))}return o.join("")}return u(n)?"":r(n)?n:a(n,e)||""}function a(n,t){if(!u(n)){var e=function(){var e=n.tag,r=[];if(i(e))return{v:f(e,n.attrs,n.children,t)};o(n.className)||r.push('class="'+n.className+'"');var u=n.attrs;return o(u)||!function(){var n=Object.keys(u);n.forEach(function(t,e){var o=n[e];r.push(o+'="'+u[o]+'"')})}(),{v:"<"+e+(r.length>0?" "+r.join(" "):"")+">"+c(n.children,t)+"</"+e+">"}}();if("object"===("undefined"==typeof e?"undefined":s(e)))return e.v}}function l(n){return a(n,null)}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol?"symbol":typeof n},p=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n},d={renderToString:l};return d}); |
/*! | ||
* inferno-test-utils v0.7.10 | ||
* inferno-test-utils v0.7.11 | ||
* (c) 2016 Dominic Gannaway | ||
@@ -12,73 +12,2 @@ * Released under the MIT License. | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
babelHelpers.extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
babelHelpers.inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
babelHelpers; | ||
function shallowRender() {} | ||
@@ -85,0 +14,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.InfernoTestUtils=t()}(this,function(){"use strict";function e(){}function t(){}function n(){}var o={};o.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},o.createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),o.extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},o.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},o.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t};var r={shallowRender:e,deepRender:t,renderIntoDocument:n};return r}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.InfernoTestUtils=n()}(this,function(){"use strict";function e(){}function n(){}function t(){}var o={shallowRender:e,deepRender:n,renderIntoDocument:t};return o}); |
/*! | ||
* inferno v0.7.10 | ||
* inferno v0.7.11 | ||
* (c) 2016 Dominic Gannaway | ||
@@ -12,73 +12,2 @@ * Released under the MIT License. | ||
var babelHelpers = {}; | ||
babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; | ||
}; | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
babelHelpers.extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
babelHelpers.inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
babelHelpers; | ||
function isNullOrUndefined(obj) { | ||
@@ -85,0 +14,0 @@ return obj === void 0 || obj === null; |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Inferno=e()}(this,function(){"use strict";function t(t){return void 0===t||null===t}function e(t){return"o"===t[0]&&"n"===t[1]&&t.length>3}function n(t){this.bp=t,this.dom=null,this.instance=null,this.tag=null,this.children=null,this.style=null,this.className=null,this.attrs=null,this.events=null,this.hooks=null,this.key=null,this.clipData=null}function r(t){return new n(t)}function o(e,r){var o=e.tag||null,s=!(!o||void 0===o.arg),l=t(e.children)?null:e.children,i=!(!l||void 0===l.arg),u=e.attrs||null,a=!(!u||void 0===u.arg),c=e.hooks||null,f=!(!c||void 0===c.arg),h=e.events||null,y=!(!h||void 0===h.arg),p=void 0===e.key?null:e.key,d=!t(p)&&!t(p.arg),v=e.style||null,m=!(!v||void 0===v.arg),g=void 0===e.className?null:e.className,b=!(!g||void 0===g.arg),w={lazy:e.lazy||!1,dom:null,pools:{keyed:{},nonKeyed:[]},tag:s?null:o,className:""!==g&&g?g:null,style:""!==v&&v?v:null,isComponent:s,hasAttrs:a||!!u,hasHooks:f,hasEvents:y,hasStyle:m||!(""===v||!v),hasClassName:b||!(""===g||!g),childrenType:void 0===r?l?5:0:r,attrKeys:null,eventKeys:null,isSVG:e.isSVG||!1};return function(){var t=new n(w);return s===!0&&(t.tag=arguments[o.arg]),i===!0&&(t.children=arguments[l.arg]),a===!0?t.attrs=arguments[u.arg]:t.attrs=u,f===!0&&(t.hooks=arguments[c.arg]),y===!0&&(t.events=arguments[h.arg]),d===!0&&(t.key=arguments[p.arg]),m===!0?t.style=arguments[v.arg]:t.style=w.style,b===!0?t.className=arguments[g.arg]:t.className=w.className,t}}function s(t,e){var n=void 0;return n=e===!0?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function l(t,e,n){if(a){var r=s(t,n);return e&&i(e,r),r}return null}function i(n,r){for(var o=Object.keys(n),s=0;s<o.length;s++){var l=o[s],i=n[l];"className"===l?r.className=i:i===!0?r.setAttribute(l,l):t(i)||i===!1||e(l)||r.setAttribute(l,i)}}var u={};u.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},u.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},u.createClass=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u.extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},u.inherits=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},u.possibleConstructorReturn=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},n.prototype={setAttrs:function(t){return this.attrs=t,this},setTag:function(t){return this.tag=t,this},setStyle:function(t){return this.style=t,this},setClassName:function(t){return this.className=t,this},setChildren:function(t){return this.children=t,this},setHooks:function(t){return this.hooks=t,this},setEvents:function(t){return this.events=t,this},setKey:function(t){return this.key=t,this}};var a="undefined"!=typeof window&&window.document,c={createBlueprint:o,createVNode:r,universal:{createElement:l}};return c}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Inferno=e()}(this,function(){"use strict";function t(t){return void 0===t||null===t}function e(t){return"o"===t[0]&&"n"===t[1]&&t.length>3}function n(t){this.bp=t,this.dom=null,this.instance=null,this.tag=null,this.children=null,this.style=null,this.className=null,this.attrs=null,this.events=null,this.hooks=null,this.key=null,this.clipData=null}function s(t){return new n(t)}function l(e,s){var l=e.tag||null,r=!(!l||void 0===l.arg),i=t(e.children)?null:e.children,a=!(!i||void 0===i.arg),u=e.attrs||null,o=!(!u||void 0===u.arg),c=e.hooks||null,h=!(!c||void 0===c.arg),d=e.events||null,f=!(!d||void 0===d.arg),v=void 0===e.key?null:e.key,y=!t(v)&&!t(v.arg),g=e.style||null,m=!(!g||void 0===g.arg),p=void 0===e.className?null:e.className,N=!(!p||void 0===p.arg),k={lazy:e.lazy||!1,dom:null,pools:{keyed:{},nonKeyed:[]},tag:r?null:l,className:""!==p&&p?p:null,style:""!==g&&g?g:null,isComponent:r,hasAttrs:o||!!u,hasHooks:h,hasEvents:f,hasStyle:m||!(""===g||!g),hasClassName:N||!(""===p||!p),childrenType:void 0===s?i?5:0:s,attrKeys:null,eventKeys:null,isSVG:e.isSVG||!1};return function(){var t=new n(k);return r===!0&&(t.tag=arguments[l.arg]),a===!0&&(t.children=arguments[i.arg]),o===!0?t.attrs=arguments[u.arg]:t.attrs=u,h===!0&&(t.hooks=arguments[c.arg]),f===!0&&(t.events=arguments[d.arg]),y===!0&&(t.key=arguments[v.arg]),m===!0?t.style=arguments[g.arg]:t.style=k.style,N===!0?t.className=arguments[p.arg]:t.className=k.className,t}}function r(t,e){var n=void 0;return n=e===!0?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t)}function i(t,e,n){if(u){var s=r(t,n);return e&&a(e,s),s}return null}function a(n,s){for(var l=Object.keys(n),r=0;r<l.length;r++){var i=l[r],a=n[i];"className"===i?s.className=a:a===!0?s.setAttribute(i,i):t(a)||a===!1||e(i)||s.setAttribute(i,a)}}n.prototype={setAttrs:function(t){return this.attrs=t,this},setTag:function(t){return this.tag=t,this},setStyle:function(t){return this.style=t,this},setClassName:function(t){return this.className=t,this},setChildren:function(t){return this.children=t,this},setHooks:function(t){return this.hooks=t,this},setEvents:function(t){return this.events=t,this},setKey:function(t){return this.key=t,this}};var u="undefined"!=typeof window&&window.document,o={createBlueprint:l,createVNode:s,universal:{createElement:i}};return o}); |
{ | ||
"name": "inferno", | ||
"version": "0.7.10", | ||
"version": "0.7.11", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "An extremely fast, isomorphic JavaScript library for building modern user interfaces", |
141649
3091