From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../architecture-examples/inferno/dist/bundle.js | 3248 ++++++++++++++++++++ .../architecture-examples/inferno/index.html | 18 + .../inferno/node_modules/todomvc-app-css/index.css | 376 +++ .../node_modules/todomvc-app-css/package.json | 59 + .../inferno/node_modules/todomvc-app-css/readme.md | 28 + .../inferno/node_modules/todomvc-common/base.css | 141 + .../inferno/node_modules/todomvc-common/base.js | 249 ++ .../node_modules/todomvc-common/package.json | 55 + .../inferno/node_modules/todomvc-common/readme.md | 15 + .../architecture-examples/inferno/package.json | 24 + .../architecture-examples/inferno/src/base.js | 49 + .../architecture-examples/inferno/src/index.js | 112 + .../architecture-examples/inferno/src/item.js | 58 + .../architecture-examples/inferno/src/model.js | 36 + .../architecture-examples/inferno/src/share.js | 58 + .../inferno/webpack.config.js | 31 + 16 files changed, 4557 insertions(+) create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/dist/bundle.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/index.html create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/index.css create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/package.json create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/readme.md create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/base.css create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/base.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/package.json create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/readme.md create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/package.json create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/base.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/index.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/item.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/model.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js create mode 100644 third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/webpack.config.js (limited to 'third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno') diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/dist/bundle.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/dist/bundle.js new file mode 100644 index 0000000000..2a55e97ddd --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/dist/bundle.js @@ -0,0 +1,3248 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "dist"; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _inferno = __webpack_require__(1); + + var _inferno2 = _interopRequireDefault(_inferno); + + var _infernoComponent = __webpack_require__(3); + + var _infernoComponent2 = _interopRequireDefault(_infernoComponent); + + var _share = __webpack_require__(5); + + var _base = __webpack_require__(6); + + var _model = __webpack_require__(7); + + var _model2 = _interopRequireDefault(_model); + + var _item = __webpack_require__(8); + + var _item2 = _interopRequireDefault(_item); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(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; } + + function _inherits(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; } + + var render = _inferno2.default.render; + + var model = new _model2.default(); + + var App = function (_Component) { + _inherits(App, _Component); + + function App() { + var _temp, _this, _ret; + + _classCallCheck(this, App); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.state = { + route: (0, _share.read)(), + todos: model.get() + }, _this.update = function (arr) { + return _this.setState({ todos: arr }); + }, _this.componentWillMount = function () { + window.onhashchange = function () { + return _this.setState({ route: (0, _share.read)() }); + }; + }, _this.add = function (e) { + if (e.which !== _share.ENTER) return; + + var val = e.target.value.trim(); + if (!val) return; + + e.target.value = ''; + _this.update(model.add(val)); + }, _this.edit = function (todo, val) { + val = val.trim(); + if (val.length) { + _this.update(model.put(todo, { title: val, editing: 0 })); + } else { + _this.remove(todo); + } + }, _this.focus = function (todo) { + return _this.update(model.put(todo, { editing: 1 })); + }, _this.blur = function (todo) { + return _this.update(model.put(todo, { editing: 0 })); + }, _this.remove = function (todo) { + return _this.update(model.del(todo)); + }, _this.toggleOne = function (todo) { + return _this.update(model.toggle(todo)); + }, _this.toggleAll = function (ev) { + return _this.update(model.toggleAll(ev.target.checked)); + }, _this.clearCompleted = function () { + return _this.update(model.clearCompleted()); + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + App.prototype.render = function render(_, _ref) { + var _this2 = this; + + var todos = _ref.todos, + route = _ref.route; + + var num = todos.length; + var shown = todos.filter(_share.filters[route]); + var numDone = todos.filter(_share.filters.completed).length; + var numAct = num - numDone; + + return _inferno2.default.createVNode(2, 'div', null, [_inferno2.default.createVNode(16, _base.Head, { + 'onEnter': this.add + }), num ? _inferno2.default.createVNode(2, 'section', { + 'className': 'main' + }, [_inferno2.default.createVNode(512, 'input', { + 'className': 'toggle-all', + 'type': 'checkbox', + 'checked': numAct === 0 + }, null, { + 'onClick': this.toggleAll + }), _inferno2.default.createVNode(2, 'ul', { + 'className': 'todo-list' + }, shown.map(function (t) { + return _inferno2.default.createVNode(16, _item2.default, { + 'data': t, + 'onBlur': function onBlur() { + return _this2.blur(t); + }, + 'onFocus': function onFocus() { + return _this2.focus(t); + }, + 'doDelete': function doDelete() { + return _this2.remove(t); + }, + 'doSave': function doSave(val) { + return _this2.edit(t, val); + }, + 'doToggle': function doToggle() { + return _this2.toggleOne(t); + } + }); + }))]) : null, numAct || numDone ? _inferno2.default.createVNode(16, _base.Foot, { + 'onClear': this.clearCompleted, + 'left': numAct, + 'done': numDone, + 'route': route + }) : null]); + }; + + return App; + }(_infernoComponent2.default); + + render(_inferno2.default.createVNode(16, App), document.getElementById('app')); + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(2); + + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + /*! + * inferno v1.0.0-beta32 + * (c) 2016 Dominic Gannaway + * Released under the MIT License. + */ + (function (global, factory) { + true ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.Inferno = global.Inferno || {}))); + }(this, (function (exports) { 'use strict'; + + var NO_OP = '$NO_OP'; + var ERROR_MSG = 'a runtime error occured! Use Inferno in development environment to find the error.'; + var isBrowser = typeof window !== 'undefined' && window.document; + + // this is MUCH faster than .constructor === Array and instanceof Array + // in Node 7 and the later versions of V8, slower in older versions though + var isArray = Array.isArray; + function isStatefulComponent(o) { + return !isUndefined(o.prototype) && !isUndefined(o.prototype.render); + } + function isStringOrNumber(obj) { + return isString(obj) || isNumber(obj); + } + function isNullOrUndef(obj) { + return isUndefined(obj) || isNull(obj); + } + function isInvalid(obj) { + return isNull(obj) || obj === false || isTrue(obj) || isUndefined(obj); + } + function isFunction(obj) { + return typeof obj === 'function'; + } + function isAttrAnEvent(attr) { + return attr[0] === 'o' && attr[1] === 'n' && attr.length > 3; + } + function isString(obj) { + return typeof obj === 'string'; + } + function isNumber(obj) { + return typeof obj === 'number'; + } + function isNull(obj) { + return obj === null; + } + function isTrue(obj) { + return obj === true; + } + function isUndefined(obj) { + return obj === undefined; + } + function isObject(o) { + return typeof o === 'object'; + } + function throwError(message) { + if (!message) { + message = ERROR_MSG; + } + throw new Error(("Inferno Error: " + message)); + } + function warning(condition, message) { + if (!condition) { + console.error(message); + } + } + var EMPTY_OBJ = {}; + + function cloneVNode(vNodeToClone, props) { + var _children = [], len = arguments.length - 2; + while ( len-- > 0 ) _children[ len ] = arguments[ len + 2 ]; + + var children = _children; + if (_children.length > 0 && !isNull(_children[0])) { + if (!props) { + props = {}; + } + if (_children.length === 1) { + children = _children[0]; + } + if (isUndefined(props.children)) { + props.children = children; + } + else { + if (isArray(children)) { + if (isArray(props.children)) { + props.children = props.children.concat(children); + } + else { + props.children = [props.children].concat(children); + } + } + else { + if (isArray(props.children)) { + props.children.push(children); + } + else { + props.children = [props.children]; + props.children.push(children); + } + } + } + } + children = null; + var flags = vNodeToClone.flags; + var events = vNodeToClone.events || (props && props.events) || null; + var newVNode; + if (isArray(vNodeToClone)) { + newVNode = vNodeToClone.map(function (vNode) { return cloneVNode(vNode); }); + } + else if (isNullOrUndef(props) && isNullOrUndef(children)) { + newVNode = Object.assign({}, vNodeToClone); + } + else { + var key = !isNullOrUndef(vNodeToClone.key) ? vNodeToClone.key : props.key; + var ref = vNodeToClone.ref || props.ref; + if (flags & 28 /* Component */) { + newVNode = createVNode(flags, vNodeToClone.type, Object.assign({}, vNodeToClone.props, props), null, events, key, ref, true); + } + else if (flags & 3970 /* Element */) { + children = (props && props.children) || vNodeToClone.children; + newVNode = createVNode(flags, vNodeToClone.type, Object.assign({}, vNodeToClone.props, props), children, events, key, ref, !children); + } + } + if (flags & 28 /* Component */) { + var newProps = newVNode.props; + if (newProps) { + var newChildren = newProps.children; + // we need to also clone component children that are in props + // as the children may also have been hoisted + if (newChildren) { + if (isArray(newChildren)) { + for (var i = 0; i < newChildren.length; i++) { + var child = newChildren[i]; + if (!isInvalid(child) && isVNode(child)) { + newProps.children[i] = cloneVNode(child); + } + } + } + else if (isVNode(newChildren)) { + newProps.children = cloneVNode(newChildren); + } + } + } + newVNode.children = null; + } + newVNode.dom = null; + return newVNode; + } + + function _normalizeVNodes(nodes, result, i) { + for (; i < nodes.length; i++) { + var n = nodes[i]; + if (!isInvalid(n)) { + if (Array.isArray(n)) { + _normalizeVNodes(n, result, 0); + } + else { + if (isStringOrNumber(n)) { + n = createTextVNode(n); + } + else if (isVNode(n) && n.dom) { + n = cloneVNode(n); + } + result.push(n); + } + } + } + } + function normalizeVNodes(nodes) { + var newNodes; + // we assign $ which basically means we've flagged this array for future note + // if it comes back again, we need to clone it, as people are using it + // in an immutable way + // tslint:disable + if (nodes['$']) { + nodes = nodes.slice(); + } + else { + nodes['$'] = true; + } + // tslint:enable + for (var i = 0; i < nodes.length; i++) { + var n = nodes[i]; + if (isInvalid(n)) { + if (!newNodes) { + newNodes = nodes.slice(0, i); + } + newNodes.push(n); + } + else if (Array.isArray(n)) { + var result = (newNodes || nodes).slice(0, i); + _normalizeVNodes(nodes, result, i); + return result; + } + else if (isStringOrNumber(n)) { + if (!newNodes) { + newNodes = nodes.slice(0, i); + } + newNodes.push(createTextVNode(n)); + } + else if (isVNode(n) && n.dom) { + if (!newNodes) { + newNodes = nodes.slice(0, i); + } + newNodes.push(cloneVNode(n)); + } + else if (newNodes) { + newNodes.push(cloneVNode(n)); + } + } + return newNodes || nodes; + } + function normalizeChildren(children) { + if (isArray(children)) { + return normalizeVNodes(children); + } + else if (isVNode(children) && children.dom) { + return cloneVNode(children); + } + return children; + } + function normalizeProps(vNode, props, children) { + if (!(vNode.flags & 28 /* Component */) && isNullOrUndef(children) && !isNullOrUndef(props.children)) { + vNode.children = props.children; + } + if (props.ref) { + vNode.ref = props.ref; + } + if (props.events) { + vNode.events = props.events; + } + if (!isNullOrUndef(props.key)) { + vNode.key = props.key; + } + } + function normalize(vNode) { + var props = vNode.props; + var children = vNode.children; + // convert a wrongly created type back to element + if (isString(vNode.type) && (vNode.flags & 28 /* Component */)) { + vNode.flags = 3970 /* Element */; + } + if (props) { + normalizeProps(vNode, props, children); + } + if (!isInvalid(children)) { + vNode.children = normalizeChildren(children); + } + if (props && !isInvalid(props.children)) { + props.children = normalizeChildren(props.children); + } + } + function createVNode(flags, type, props, children, events, key, ref, noNormalise) { + if (flags & 16 /* ComponentUnknown */) { + flags = isStatefulComponent(type) ? 4 /* ComponentClass */ : 8 /* ComponentFunction */; + } + var vNode = { + children: isUndefined(children) ? null : children, + dom: null, + events: events || null, + flags: flags || 0, + key: key === undefined ? null : key, + props: props || null, + ref: ref || null, + type: type + }; + if (!noNormalise) { + normalize(vNode); + } + return vNode; + } + function createVoidVNode() { + return createVNode(4096 /* Void */); + } + function createTextVNode(text) { + return createVNode(1 /* Text */, null, null, text); + } + function isVNode(o) { + return !!o.flags; + } + + var devToolsStatus = { + connected: false + }; + var internalIncrementer = { + id: 0 + }; + var componentIdMap = new Map(); + function getIncrementalId() { + return internalIncrementer.id++; + } + function sendToDevTools(global, data) { + var event = new CustomEvent('inferno.client.message', { + detail: JSON.stringify(data, function (key, val) { + if (!isNull(val) && !isUndefined(val)) { + if (key === '_vComponent' || !isUndefined(val.nodeType)) { + return; + } + else if (isFunction(val)) { + return ("$$f:" + (val.name)); + } + } + return val; + }) + }); + global.dispatchEvent(event); + } + function rerenderRoots() { + for (var i = 0; i < roots.length; i++) { + var root = roots[i]; + render(root.input, root.dom); + } + } + function initDevToolsHooks(global) { + global.__INFERNO_DEVTOOLS_GLOBAL_HOOK__ = roots; + global.addEventListener('inferno.devtools.message', function (message) { + var detail = JSON.parse(message.detail); + var type = detail.type; + switch (type) { + case 'get-roots': + if (!devToolsStatus.connected) { + devToolsStatus.connected = true; + rerenderRoots(); + sendRoots(global); + } + break; + default: + // TODO:? + break; + } + }); + } + function sendRoots(global) { + sendToDevTools(global, { type: 'roots', data: roots }); + } + + var Lifecycle = function Lifecycle() { + this.listeners = []; + this.fastUnmount = true; + }; + Lifecycle.prototype.addListener = function addListener (callback) { + this.listeners.push(callback); + }; + Lifecycle.prototype.trigger = function trigger () { + var this$1 = this; + + for (var i = 0; i < this.listeners.length; i++) { + this$1.listeners[i](); + } + }; + + function constructDefaults(string, object, value) { + /* eslint no-return-assign: 0 */ + string.split(',').forEach(function (i) { return object[i] = value; }); + } + var xlinkNS = 'http://www.w3.org/1999/xlink'; + var xmlNS = 'http://www.w3.org/XML/1998/namespace'; + var svgNS = 'http://www.w3.org/2000/svg'; + var strictProps = {}; + var booleanProps = {}; + var namespaces = {}; + var isUnitlessNumber = {}; + var skipProps = {}; + var dehyphenProps = { + textAnchor: 'text-anchor' + }; + var delegatedProps = {}; + 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,defaultValue,defaultChecked', strictProps, true); + constructDefaults('children,ref,key,selected,checked,value,multiple', skipProps, true); + constructDefaults('onClick,onMouseDown,onMouseUp,onMouseMove', delegatedProps, true); + constructDefaults('muted,scoped,loop,open,checked,default,capture,disabled,readonly,required,autoplay,controls,seamless,reversed,allowfullscreen,novalidate', booleanProps, true); + constructDefaults('animationIterationCount,borderImageOutset,borderImageSlice,borderImageWidth,boxFlex,boxFlexGroup,boxOrdinalGroup,columnCount,flex,flexGrow,flexPositive,flexShrink,flexNegative,flexOrder,gridRow,gridColumn,fontWeight,lineClamp,lineHeight,opacity,order,orphans,tabSize,widows,zIndex,zoom,fillOpacity,floodOpacity,stopOpacity,strokeDasharray,strokeDashoffset,strokeMiterlimit,strokeOpacity,strokeWidth,', isUnitlessNumber, true); + + var delegatedEvents = new Map(); + function handleEvent(name, lastEvent, nextEvent, dom) { + var delegatedRoots = delegatedEvents.get(name); + if (nextEvent) { + if (!delegatedRoots) { + delegatedRoots = { items: new Map(), count: 0, docEvent: null }; + var docEvent = attachEventToDocument(name, delegatedRoots); + delegatedRoots.docEvent = docEvent; + delegatedEvents.set(name, delegatedRoots); + } + if (!lastEvent) { + delegatedRoots.count++; + } + delegatedRoots.items.set(dom, nextEvent); + } + else if (delegatedRoots) { + if (delegatedRoots.items.has(dom)) { + delegatedRoots.count--; + delegatedRoots.items.delete(dom); + if (delegatedRoots.count === 0) { + document.removeEventListener(normalizeEventName(name), delegatedRoots.docEvent); + delegatedEvents.delete(name); + } + } + } + } + function dispatchEvent(event, dom, items, count, eventData) { + var eventsToTrigger = items.get(dom); + if (eventsToTrigger) { + count--; + // linkEvent object + eventData.dom = dom; + if (eventsToTrigger.event) { + eventsToTrigger.event(eventsToTrigger.data, event); + } + else { + eventsToTrigger(event); + } + if (eventData.stopPropagation) { + return; + } + } + var parentDom = dom.parentNode; + if (count > 0 && (parentDom || parentDom === document.body)) { + dispatchEvent(event, parentDom, items, count, eventData); + } + } + function normalizeEventName(name) { + return name.substr(2).toLowerCase(); + } + function attachEventToDocument(name, delegatedRoots) { + var docEvent = function (event) { + var eventData = { + stopPropagation: false, + dom: document + }; + // we have to do this as some browsers recycle the same Event between calls + // so we need to make the property configurable + Object.defineProperty(event, 'currentTarget', { + configurable: true, + get: function get() { + return eventData.dom; + } + }); + event.stopPropagation = function () { + eventData.stopPropagation = true; + }; + var count = delegatedRoots.count; + if (count > 0) { + dispatchEvent(event, event.target, delegatedRoots.items, count, eventData); + } + }; + document.addEventListener(normalizeEventName(name), docEvent); + return docEvent; + } + + function isCheckedType(type) { + return type === 'checkbox' || type === 'radio'; + } + function isControlled(props) { + var usesChecked = isCheckedType(props.type); + return usesChecked ? !isNullOrUndef(props.checked) : !isNullOrUndef(props.value); + } + function onTextInputChange(e) { + var vNode = this.vNode; + var events = vNode.events || EMPTY_OBJ; + var dom = vNode.dom; + if (events.onInput) { + events.onInput(e); + } + else if (events.oninput) { + events.oninput(e); + } + // the user may have updated the vNode from the above onInput events + // so we need to get it from the context of `this` again + applyValue(this.vNode, dom); + } + function onCheckboxChange(e) { + var vNode = this.vNode; + var events = vNode.events || EMPTY_OBJ; + var dom = vNode.dom; + if (events.onClick) { + events.onClick(e); + } + else if (events.onclick) { + events.onclick(e); + } + // the user may have updated the vNode from the above onClick events + // so we need to get it from the context of `this` again + applyValue(this.vNode, dom); + } + function handleAssociatedRadioInputs(name) { + var inputs = document.querySelectorAll(("input[type=\"radio\"][name=\"" + name + "\"]")); + [].forEach.call(inputs, function (dom) { + var inputWrapper = wrappers.get(dom); + if (inputWrapper) { + var props = inputWrapper.vNode.props; + if (props) { + dom.checked = inputWrapper.vNode.props.checked; + } + } + }); + } + function processInput(vNode, dom) { + var props = vNode.props || EMPTY_OBJ; + applyValue(vNode, dom); + if (isControlled(props)) { + var inputWrapper = wrappers.get(dom); + if (!inputWrapper) { + inputWrapper = { + vNode: vNode + }; + if (isCheckedType(props.type)) { + dom.onclick = onCheckboxChange.bind(inputWrapper); + dom.onclick.wrapped = true; + } + else { + dom.oninput = onTextInputChange.bind(inputWrapper); + dom.oninput.wrapped = true; + } + wrappers.set(dom, inputWrapper); + } + inputWrapper.vNode = vNode; + } + } + function applyValue(vNode, dom) { + var props = vNode.props || EMPTY_OBJ; + var type = props.type; + var value = props.value; + var checked = props.checked; + if (type !== dom.type && type) { + dom.type = type; + } + if (props.multiple !== dom.multiple) { + dom.multiple = props.multiple; + } + if (isCheckedType(type)) { + if (!isNullOrUndef(value)) { + dom.value = value; + } + dom.checked = checked; + if (type === 'radio' && props.name) { + handleAssociatedRadioInputs(props.name); + } + } + else { + if (!isNullOrUndef(value) && dom.value !== value) { + dom.value = value; + } + else if (!isNullOrUndef(checked)) { + dom.checked = checked; + } + } + } + + function isControlled$1(props) { + return !isNullOrUndef(props.value); + } + function updateChildOption(vNode, value) { + var props = vNode.props || EMPTY_OBJ; + var dom = vNode.dom; + // we do this as multiple may have changed + dom.value = props.value; + if ((isArray(value) && value.indexOf(props.value) !== -1) || props.value === value) { + dom.selected = true; + } + else { + dom.selected = props.selected || false; + } + } + function onSelectChange(e) { + var vNode = this.vNode; + var events = vNode.events || EMPTY_OBJ; + var dom = vNode.dom; + if (events.onChange) { + events.onChange(e); + } + else if (events.onchange) { + events.onchange(e); + } + // the user may have updated the vNode from the above onChange events + // so we need to get it from the context of `this` again + applyValue$1(this.vNode, dom); + } + function processSelect(vNode, dom) { + var props = vNode.props || EMPTY_OBJ; + applyValue$1(vNode, dom); + if (isControlled$1(props)) { + var selectWrapper = wrappers.get(dom); + if (!selectWrapper) { + selectWrapper = { + vNode: vNode + }; + dom.onchange = onSelectChange.bind(selectWrapper); + dom.onchange.wrapped = true; + wrappers.set(dom, selectWrapper); + } + selectWrapper.vNode = vNode; + } + } + function applyValue$1(vNode, dom) { + var props = vNode.props || EMPTY_OBJ; + if (props.multiple !== dom.multiple) { + dom.multiple = props.multiple; + } + var children = vNode.children; + var value = props.value; + if (isArray(children)) { + for (var i = 0; i < children.length; i++) { + updateChildOption(children[i], value); + } + } + else if (isVNode(children)) { + updateChildOption(children, value); + } + } + + function isControlled$2(props) { + return !isNullOrUndef(props.value); + } + function onTextareaInputChange(e) { + var vNode = this.vNode; + var events = vNode.events || EMPTY_OBJ; + var dom = vNode.dom; + if (events.onInput) { + events.onInput(e); + } + else if (events.oninput) { + events.oninput(e); + } + // the user may have updated the vNode from the above onInput events + // so we need to get it from the context of `this` again + applyValue$2(this.vNode, dom); + } + function processTextarea(vNode, dom) { + var props = vNode.props || EMPTY_OBJ; + applyValue$2(vNode, dom); + var textareaWrapper = wrappers.get(dom); + if (isControlled$2(props)) { + if (!textareaWrapper) { + textareaWrapper = { + vNode: vNode + }; + dom.oninput = onTextareaInputChange.bind(textareaWrapper); + dom.oninput.wrapped = true; + wrappers.set(dom, textareaWrapper); + } + textareaWrapper.vNode = vNode; + } + } + function applyValue$2(vNode, dom) { + var props = vNode.props || EMPTY_OBJ; + var value = props.value; + if (dom.value !== value) { + dom.value = value; + } + } + + var wrappers = new Map(); + function processElement(flags, vNode, dom) { + if (flags & 512 /* InputElement */) { + processInput(vNode, dom); + } + else if (flags & 2048 /* SelectElement */) { + processSelect(vNode, dom); + } + else if (flags & 1024 /* TextareaElement */) { + processTextarea(vNode, dom); + } + } + + function unmount(vNode, parentDom, lifecycle, canRecycle, shallowUnmount, isRecycling) { + var flags = vNode.flags; + if (flags & 28 /* Component */) { + unmountComponent(vNode, parentDom, lifecycle, canRecycle, shallowUnmount, isRecycling); + } + else if (flags & 3970 /* Element */) { + unmountElement(vNode, parentDom, lifecycle, canRecycle, shallowUnmount, isRecycling); + } + else if (flags & (1 /* Text */ | 4096 /* Void */)) { + unmountVoidOrText(vNode, parentDom); + } + } + function unmountVoidOrText(vNode, parentDom) { + if (parentDom) { + removeChild(parentDom, vNode.dom); + } + } + function unmountComponent(vNode, parentDom, lifecycle, canRecycle, shallowUnmount, isRecycling) { + var instance = vNode.children; + var flags = vNode.flags; + var isStatefulComponent$$1 = flags & 4; + var ref = vNode.ref; + var dom = vNode.dom; + if (!isRecycling) { + if (!shallowUnmount) { + if (isStatefulComponent$$1) { + var subLifecycle = instance._lifecycle; + if (!subLifecycle.fastUnmount) { + unmount(instance._lastInput, null, lifecycle, false, shallowUnmount, isRecycling); + } + } + else { + if (!lifecycle.fastUnmount) { + unmount(instance, null, lifecycle, false, shallowUnmount, isRecycling); + } + } + } + if (isStatefulComponent$$1) { + instance._ignoreSetState = true; + instance.componentWillUnmount(); + if (ref && !isRecycling) { + ref(null); + } + instance._unmounted = true; + findDOMNodeEnabled && componentToDOMNodeMap.delete(instance); + } + else if (!isNullOrUndef(ref)) { + if (!isNullOrUndef(ref.onComponentWillUnmount)) { + ref.onComponentWillUnmount(dom); + } + } + } + if (parentDom) { + var lastInput = instance._lastInput; + if (isNullOrUndef(lastInput)) { + lastInput = instance; + } + removeChild(parentDom, dom); + } + if (recyclingEnabled && !isStatefulComponent$$1 && (parentDom || canRecycle)) { + poolComponent(vNode); + } + } + function unmountElement(vNode, parentDom, lifecycle, canRecycle, shallowUnmount, isRecycling) { + var dom = vNode.dom; + var ref = vNode.ref; + var events = vNode.events; + if (!shallowUnmount && !lifecycle.fastUnmount) { + if (ref && !isRecycling) { + unmountRef(ref); + } + var children = vNode.children; + if (!isNullOrUndef(children)) { + unmountChildren$1(children, lifecycle, shallowUnmount, isRecycling); + } + } + if (!isNull(events)) { + for (var name in events) { + // do not add a hasOwnProperty check here, it affects performance + patchEvent(name, events[name], null, dom, lifecycle); + events[name] = null; + } + } + if (parentDom) { + removeChild(parentDom, dom); + } + if (recyclingEnabled && (parentDom || canRecycle)) { + poolElement(vNode); + } + } + function unmountChildren$1(children, lifecycle, shallowUnmount, isRecycling) { + if (isArray(children)) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (!isInvalid(child) && isObject(child)) { + unmount(child, null, lifecycle, false, shallowUnmount, isRecycling); + } + } + } + else if (isObject(children)) { + unmount(children, null, lifecycle, false, shallowUnmount, isRecycling); + } + } + function unmountRef(ref) { + if (isFunction(ref)) { + ref(null); + } + else { + if (isInvalid(ref)) { + return; + } + if (false) { + throwError('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'); + } + throwError(); + } + } + + function patch(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isRecycling) { + if (lastVNode !== nextVNode) { + var lastFlags = lastVNode.flags; + var nextFlags = nextVNode.flags; + if (nextFlags & 28 /* Component */) { + if (lastFlags & 28 /* Component */) { + patchComponent(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, nextFlags & 4 /* ComponentClass */, isRecycling); + } + else { + replaceVNode(parentDom, mountComponent(nextVNode, null, lifecycle, context, isSVG, nextFlags & 4 /* ComponentClass */), lastVNode, lifecycle, isRecycling); + } + } + else if (nextFlags & 3970 /* Element */) { + if (lastFlags & 3970 /* Element */) { + patchElement(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isRecycling); + } + else { + replaceVNode(parentDom, mountElement(nextVNode, null, lifecycle, context, isSVG), lastVNode, lifecycle, isRecycling); + } + } + else if (nextFlags & 1 /* Text */) { + if (lastFlags & 1 /* Text */) { + patchText(lastVNode, nextVNode); + } + else { + replaceVNode(parentDom, mountText(nextVNode, null), lastVNode, lifecycle, isRecycling); + } + } + else if (nextFlags & 4096 /* Void */) { + if (lastFlags & 4096 /* Void */) { + patchVoid(lastVNode, nextVNode); + } + else { + replaceVNode(parentDom, mountVoid(nextVNode, null), lastVNode, lifecycle, isRecycling); + } + } + else { + // Error case: mount new one replacing old one + replaceLastChildAndUnmount(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isRecycling); + } + } + } + function unmountChildren(children, dom, lifecycle, isRecycling) { + if (isVNode(children)) { + unmount(children, dom, lifecycle, true, false, isRecycling); + } + else if (isArray(children)) { + removeAllChildren(dom, children, lifecycle, false, isRecycling); + } + else { + dom.textContent = ''; + } + } + function patchElement(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isRecycling) { + var nextTag = nextVNode.type; + var lastTag = lastVNode.type; + if (lastTag !== nextTag) { + replaceWithNewNode(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isRecycling); + } + else { + var dom = lastVNode.dom; + var lastProps = lastVNode.props; + var nextProps = nextVNode.props; + var lastChildren = lastVNode.children; + var nextChildren = nextVNode.children; + var lastFlags = lastVNode.flags; + var nextFlags = nextVNode.flags; + var lastRef = lastVNode.ref; + var nextRef = nextVNode.ref; + var lastEvents = lastVNode.events; + var nextEvents = nextVNode.events; + nextVNode.dom = dom; + if (isSVG || (nextFlags & 128 /* SvgElement */)) { + isSVG = true; + } + if (lastChildren !== nextChildren) { + patchChildren(lastFlags, nextFlags, lastChildren, nextChildren, dom, lifecycle, context, isSVG, isRecycling); + } + if (!(nextFlags & 2 /* HtmlElement */)) { + processElement(nextFlags, nextVNode, dom); + } + if (lastProps !== nextProps) { + patchProps(lastProps, nextProps, dom, lifecycle, context, isSVG); + } + if (lastEvents !== nextEvents) { + patchEvents(lastEvents, nextEvents, dom, lifecycle); + } + if (nextRef) { + if (lastRef !== nextRef || isRecycling) { + mountRef(dom, nextRef, lifecycle); + } + } + } + } + function patchChildren(lastFlags, nextFlags, lastChildren, nextChildren, dom, lifecycle, context, isSVG, isRecycling) { + var patchArray = false; + var patchKeyed = false; + if (nextFlags & 64 /* HasNonKeyedChildren */) { + patchArray = true; + } + else if ((lastFlags & 32 /* HasKeyedChildren */) && (nextFlags & 32 /* HasKeyedChildren */)) { + patchKeyed = true; + patchArray = true; + } + else if (isInvalid(nextChildren)) { + unmountChildren(lastChildren, dom, lifecycle, isRecycling); + } + else if (isInvalid(lastChildren)) { + if (isStringOrNumber(nextChildren)) { + setTextContent(dom, nextChildren); + } + else { + if (isArray(nextChildren)) { + mountArrayChildren(nextChildren, dom, lifecycle, context, isSVG); + } + else { + mount(nextChildren, dom, lifecycle, context, isSVG); + } + } + } + else if (isStringOrNumber(nextChildren)) { + if (isStringOrNumber(lastChildren)) { + updateTextContent(dom, nextChildren); + } + else { + unmountChildren(lastChildren, dom, lifecycle, isRecycling); + setTextContent(dom, nextChildren); + } + } + else if (isArray(nextChildren)) { + if (isArray(lastChildren)) { + patchArray = true; + if (isKeyed(lastChildren, nextChildren)) { + patchKeyed = true; + } + } + else { + unmountChildren(lastChildren, dom, lifecycle, isRecycling); + mountArrayChildren(nextChildren, dom, lifecycle, context, isSVG); + } + } + else if (isArray(lastChildren)) { + removeAllChildren(dom, lastChildren, lifecycle, false, isRecycling); + mount(nextChildren, dom, lifecycle, context, isSVG); + } + else if (isVNode(nextChildren)) { + if (isVNode(lastChildren)) { + patch(lastChildren, nextChildren, dom, lifecycle, context, isSVG, isRecycling); + } + else { + unmountChildren(lastChildren, dom, lifecycle, isRecycling); + mount(nextChildren, dom, lifecycle, context, isSVG); + } + } + else if (isVNode(lastChildren)) { + } + else { + } + if (patchArray) { + if (patchKeyed) { + patchKeyedChildren(lastChildren, nextChildren, dom, lifecycle, context, isSVG, isRecycling); + } + else { + patchNonKeyedChildren(lastChildren, nextChildren, dom, lifecycle, context, isSVG, isRecycling); + } + } + } + function patchComponent(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isClass, isRecycling) { + var lastType = lastVNode.type; + var nextType = nextVNode.type; + var nextProps = nextVNode.props || EMPTY_OBJ; + var lastKey = lastVNode.key; + var nextKey = nextVNode.key; + if (lastType !== nextType) { + if (isClass) { + replaceWithNewNode(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isRecycling); + } + else { + var lastInput = lastVNode.children._lastInput || lastVNode.children; + var nextInput = createStatelessComponentInput(nextVNode, nextType, nextProps, context); + patch(lastInput, nextInput, parentDom, lifecycle, context, isSVG, isRecycling); + var dom = nextVNode.dom = nextInput.dom; + nextVNode.children = nextInput; + mountStatelessComponentCallbacks(nextVNode.ref, dom, lifecycle); + unmount(lastVNode, null, lifecycle, false, true, isRecycling); + } + } + else { + if (isClass) { + if (lastKey !== nextKey) { + replaceWithNewNode(lastVNode, nextVNode, parentDom, lifecycle, context, isSVG, isRecycling); + return false; + } + var instance = lastVNode.children; + if (instance._unmounted) { + if (isNull(parentDom)) { + return true; + } + replaceChild(parentDom, mountComponent(nextVNode, null, lifecycle, context, isSVG, nextVNode.flags & 4 /* ComponentClass */), lastVNode.dom); + } + else { + var defaultProps = nextType.defaultProps; + var lastProps = instance.props; + if (instance._devToolsStatus.connected && !instance._devToolsId) { + componentIdMap.set(instance._devToolsId = getIncrementalId(), instance); + } + lifecycle.fastUnmount = false; + if (!isUndefined(defaultProps)) { + copyPropsTo(lastProps, nextProps); + nextVNode.props = nextProps; + } + var lastState = instance.state; + var nextState = instance.state; + var childContext = instance.getChildContext(); + nextVNode.children = instance; + instance._isSVG = isSVG; + if (!isNullOrUndef(childContext)) { + childContext = Object.assign({}, context, childContext); + } + else { + childContext = context; + } + var lastInput$1 = instance._lastInput; + var nextInput$1 = instance._updateComponent(lastState, nextState, lastProps, nextProps, context, false); + var didUpdate = true; + instance._childContext = childContext; + if (isInvalid(nextInput$1)) { + nextInput$1 = createVoidVNode(); + } + else if (isArray(nextInput$1)) { + if (false) { + throwError('a valid Inferno VNode (or null) must be returned from a component render. You may have returned an array or an invalid object.'); + } + throwError(); + } + else if (nextInput$1 === NO_OP) { + nextInput$1 = lastInput$1; + didUpdate = false; + } + else if (isObject(nextInput$1) && nextInput$1.dom) { + nextInput$1 = cloneVNode(nextInput$1); + } + if (nextInput$1.flags & 28 /* Component */) { + nextInput$1.parentVNode = nextVNode; + } + else if (lastInput$1.flags & 28 /* Component */) { + lastInput$1.parentVNode = nextVNode; + } + instance._lastInput = nextInput$1; + instance._vNode = nextVNode; + if (didUpdate) { + var fastUnmount = lifecycle.fastUnmount; + var subLifecycle = instance._lifecycle; + lifecycle.fastUnmount = subLifecycle.fastUnmount; + patch(lastInput$1, nextInput$1, parentDom, lifecycle, childContext, isSVG, isRecycling); + subLifecycle.fastUnmount = lifecycle.unmount; + lifecycle.fastUnmount = fastUnmount; + instance.componentDidUpdate(lastProps, lastState); + findDOMNodeEnabled && componentToDOMNodeMap.set(instance, nextInput$1.dom); + } + nextVNode.dom = nextInput$1.dom; + } + } + else { + var shouldUpdate = true; + var lastProps$1 = lastVNode.props; + var nextHooks = nextVNode.ref; + var nextHooksDefined = !isNullOrUndef(nextHooks); + var lastInput$2 = lastVNode.children; + var nextInput$2 = lastInput$2; + nextVNode.dom = lastVNode.dom; + nextVNode.children = lastInput$2; + if (lastKey !== nextKey) { + shouldUpdate = true; + } + else { + if (nextHooksDefined && !isNullOrUndef(nextHooks.onComponentShouldUpdate)) { + shouldUpdate = nextHooks.onComponentShouldUpdate(lastProps$1, nextProps); + } + } + if (shouldUpdate !== false) { + if (nextHooksDefined && !isNullOrUndef(nextHooks.onComponentWillUpdate)) { + lifecycle.fastUnmount = false; + nextHooks.onComponentWillUpdate(lastProps$1, nextProps); + } + nextInput$2 = nextType(nextProps, context); + if (isInvalid(nextInput$2)) { + nextInput$2 = createVoidVNode(); + } + else if (isArray(nextInput$2)) { + if (false) { + throwError('a valid Inferno VNode (or null) must be returned from a component render. You may have returned an array or an invalid object.'); + } + throwError(); + } + else if (isObject(nextInput$2) && nextInput$2.dom) { + nextInput$2 = cloneVNode(nextInput$2); + } + if (nextInput$2 !== NO_OP) { + patch(lastInput$2, nextInput$2, parentDom, lifecycle, context, isSVG, isRecycling); + nextVNode.children = nextInput$2; + if (nextHooksDefined && !isNullOrUndef(nextHooks.onComponentDidUpdate)) { + lifecycle.fastUnmount = false; + nextHooks.onComponentDidUpdate(lastProps$1, nextProps); + } + nextVNode.dom = nextInput$2.dom; + } + } + if (nextInput$2.flags & 28 /* Component */) { + nextInput$2.parentVNode = nextVNode; + } + else if (lastInput$2.flags & 28 /* Component */) { + lastInput$2.parentVNode = nextVNode; + } + } + } + return false; + } + function patchText(lastVNode, nextVNode) { + var nextText = nextVNode.children; + var dom = lastVNode.dom; + nextVNode.dom = dom; + if (lastVNode.children !== nextText) { + dom.nodeValue = nextText; + } + } + function patchVoid(lastVNode, nextVNode) { + nextVNode.dom = lastVNode.dom; + } + function patchNonKeyedChildren(lastChildren, nextChildren, dom, lifecycle, context, isSVG, isRecycling) { + var lastChildrenLength = lastChildren.length; + var nextChildrenLength = nextChildren.length; + var commonLength = lastChildrenLength > nextChildrenLength ? nextChildrenLength : lastChildrenLength; + var i; + var nextNode = null; + var newNode; + // Loop backwards so we can use insertBefore + if (lastChildrenLength < nextChildrenLength) { + for (i = nextChildrenLength - 1; i >= commonLength; i--) { + var child = nextChildren[i]; + if (!isInvalid(child)) { + if (child.dom) { + nextChildren[i] = child = cloneVNode(child); + } + newNode = mount(child, null, lifecycle, context, isSVG); + insertOrAppend(dom, newNode, nextNode); + nextNode = newNode; + } + } + } + else if (nextChildrenLength === 0) { + removeAllChildren(dom, lastChildren, lifecycle, false, isRecycling); + } + else if (lastChildrenLength > nextChildrenLength) { + for (i = commonLength; i < lastChildrenLength; i++) { + var child$1 = lastChildren[i]; + if (!isInvalid(child$1)) { + unmount(lastChildren[i], dom, lifecycle, false, false, isRecycling); + } + } + } + for (i = commonLength - 1; i >= 0; i--) { + var lastChild = lastChildren[i]; + var nextChild = nextChildren[i]; + if (isInvalid(nextChild)) { + if (!isInvalid(lastChild)) { + unmount(lastChild, dom, lifecycle, true, false, isRecycling); + } + } + else { + if (nextChild.dom) { + nextChildren[i] = nextChild = cloneVNode(nextChild); + } + if (isInvalid(lastChild)) { + newNode = mount(nextChild, null, lifecycle, context, isSVG); + insertOrAppend(dom, newNode, nextNode); + nextNode = newNode; + } + else { + patch(lastChild, nextChild, dom, lifecycle, context, isSVG, isRecycling); + nextNode = nextChild.dom; + } + } + } + } + function patchKeyedChildren(a, b, dom, lifecycle, context, isSVG, isRecycling) { + var aLength = a.length; + var bLength = b.length; + var aEnd = aLength - 1; + var bEnd = bLength - 1; + var aStart = 0; + var bStart = 0; + var i; + var j; + var aNode; + var bNode; + var nextNode; + var nextPos; + var node; + if (aLength === 0) { + if (bLength !== 0) { + mountArrayChildren(b, dom, lifecycle, context, isSVG); + } + return; + } + else if (bLength === 0) { + removeAllChildren(dom, a, lifecycle, false, isRecycling); + return; + } + var aStartNode = a[aStart]; + var bStartNode = b[bStart]; + var aEndNode = a[aEnd]; + var bEndNode = b[bEnd]; + if (bStartNode.dom) { + b[bStart] = bStartNode = cloneVNode(bStartNode); + } + if (bEndNode.dom) { + b[bEnd] = bEndNode = cloneVNode(bEndNode); + } + // Step 1 + /* eslint no-constant-condition: 0 */ + outer: while (true) { + // Sync nodes with the same key at the beginning. + while (aStartNode.key === bStartNode.key) { + patch(aStartNode, bStartNode, dom, lifecycle, context, isSVG, isRecycling); + aStart++; + bStart++; + if (aStart > aEnd || bStart > bEnd) { + break outer; + } + aStartNode = a[aStart]; + bStartNode = b[bStart]; + if (bStartNode.dom) { + b[bStart] = bStartNode = cloneVNode(bStartNode); + } + } + // Sync nodes with the same key at the end. + while (aEndNode.key === bEndNode.key) { + patch(aEndNode, bEndNode, dom, lifecycle, context, isSVG, isRecycling); + aEnd--; + bEnd--; + if (aStart > aEnd || bStart > bEnd) { + break outer; + } + aEndNode = a[aEnd]; + bEndNode = b[bEnd]; + if (bEndNode.dom) { + b[bEnd] = bEndNode = cloneVNode(bEndNode); + } + } + // Move and sync nodes from right to left. + if (aEndNode.key === bStartNode.key) { + patch(aEndNode, bStartNode, dom, lifecycle, context, isSVG, isRecycling); + insertOrAppend(dom, bStartNode.dom, aStartNode.dom); + aEnd--; + bStart++; + aEndNode = a[aEnd]; + bStartNode = b[bStart]; + if (bStartNode.dom) { + b[bStart] = bStartNode = cloneVNode(bStartNode); + } + continue; + } + // Move and sync nodes from left to right. + if (aStartNode.key === bEndNode.key) { + patch(aStartNode, bEndNode, dom, lifecycle, context, isSVG, isRecycling); + nextPos = bEnd + 1; + nextNode = nextPos < b.length ? b[nextPos].dom : null; + insertOrAppend(dom, bEndNode.dom, nextNode); + aStart++; + bEnd--; + aStartNode = a[aStart]; + bEndNode = b[bEnd]; + if (bEndNode.dom) { + b[bEnd] = bEndNode = cloneVNode(bEndNode); + } + continue; + } + break; + } + if (aStart > aEnd) { + if (bStart <= bEnd) { + nextPos = bEnd + 1; + nextNode = nextPos < b.length ? b[nextPos].dom : null; + while (bStart <= bEnd) { + node = b[bStart]; + if (node.dom) { + b[bStart] = node = cloneVNode(node); + } + bStart++; + insertOrAppend(dom, mount(node, null, lifecycle, context, isSVG), nextNode); + } + } + } + else if (bStart > bEnd) { + while (aStart <= aEnd) { + unmount(a[aStart++], dom, lifecycle, false, false, isRecycling); + } + } + else { + aLength = aEnd - aStart + 1; + bLength = bEnd - bStart + 1; + var aNullable = a; + var sources = new Array(bLength); + // Mark all nodes as inserted. + for (i = 0; i < bLength; i++) { + sources[i] = -1; + } + var moved = false; + var pos = 0; + var patched = 0; + if ((bLength <= 4) || (aLength * bLength <= 16)) { + for (i = aStart; i <= aEnd; i++) { + aNode = a[i]; + if (patched < bLength) { + for (j = bStart; j <= bEnd; j++) { + bNode = b[j]; + if (aNode.key === bNode.key) { + sources[j - bStart] = i; + if (pos > j) { + moved = true; + } + else { + pos = j; + } + if (bNode.dom) { + b[j] = bNode = cloneVNode(bNode); + } + patch(aNode, bNode, dom, lifecycle, context, isSVG, isRecycling); + patched++; + aNullable[i] = null; + break; + } + } + } + } + } + else { + var keyIndex = new Map(); + for (i = bStart; i <= bEnd; i++) { + node = b[i]; + keyIndex.set(node.key, i); + } + for (i = aStart; i <= aEnd; i++) { + aNode = a[i]; + if (patched < bLength) { + j = keyIndex.get(aNode.key); + if (!isUndefined(j)) { + bNode = b[j]; + sources[j - bStart] = i; + if (pos > j) { + moved = true; + } + else { + pos = j; + } + if (bNode.dom) { + b[j] = bNode = cloneVNode(bNode); + } + patch(aNode, bNode, dom, lifecycle, context, isSVG, isRecycling); + patched++; + aNullable[i] = null; + } + } + } + } + if (aLength === a.length && patched === 0) { + removeAllChildren(dom, a, lifecycle, false, isRecycling); + while (bStart < bLength) { + node = b[bStart]; + if (node.dom) { + b[bStart] = node = cloneVNode(node); + } + bStart++; + insertOrAppend(dom, mount(node, null, lifecycle, context, isSVG), null); + } + } + else { + i = aLength - patched; + while (i > 0) { + aNode = aNullable[aStart++]; + if (!isNull(aNode)) { + unmount(aNode, dom, lifecycle, false, false, isRecycling); + i--; + } + } + if (moved) { + var seq = lis_algorithm(sources); + j = seq.length - 1; + for (i = bLength - 1; i >= 0; i--) { + if (sources[i] === -1) { + pos = i + bStart; + node = b[pos]; + if (node.dom) { + b[pos] = node = cloneVNode(node); + } + nextPos = pos + 1; + nextNode = nextPos < b.length ? b[nextPos].dom : null; + insertOrAppend(dom, mount(node, dom, lifecycle, context, isSVG), nextNode); + } + else { + if (j < 0 || i !== seq[j]) { + pos = i + bStart; + node = b[pos]; + nextPos = pos + 1; + nextNode = nextPos < b.length ? b[nextPos].dom : null; + insertOrAppend(dom, node.dom, nextNode); + } + else { + j--; + } + } + } + } + else if (patched !== bLength) { + for (i = bLength - 1; i >= 0; i--) { + if (sources[i] === -1) { + pos = i + bStart; + node = b[pos]; + if (node.dom) { + b[pos] = node = cloneVNode(node); + } + nextPos = pos + 1; + nextNode = nextPos < b.length ? b[nextPos].dom : null; + insertOrAppend(dom, mount(node, null, lifecycle, context, isSVG), nextNode); + } + } + } + } + } + } + // // https://en.wikipedia.org/wiki/Longest_increasing_subsequence + function lis_algorithm(a) { + var p = a.slice(0); + var result = []; + result.push(0); + var i; + var j; + var u; + var v; + var c; + for (i = 0; i < a.length; i++) { + if (a[i] === -1) { + continue; + } + j = result[result.length - 1]; + if (a[j] < a[i]) { + p[i] = j; + result.push(i); + continue; + } + u = 0; + v = result.length - 1; + while (u < v) { + c = ((u + v) / 2) | 0; + if (a[result[c]] < a[i]) { + u = c + 1; + } + else { + v = c; + } + } + if (a[i] < a[result[u]]) { + if (u > 0) { + p[i] = result[u - 1]; + } + result[u] = i; + } + } + u = result.length; + v = result[u - 1]; + while (u-- > 0) { + result[u] = v; + v = p[v]; + } + return result; + } + function patchProp(prop, lastValue, nextValue, dom, isSVG, lifecycle) { + if (skipProps[prop]) { + return; + } + if (booleanProps[prop]) { + dom[prop] = nextValue ? true : false; + } + else if (strictProps[prop]) { + var value = isNullOrUndef(nextValue) ? '' : nextValue; + if (dom[prop] !== value) { + dom[prop] = value; + } + } + else if (isAttrAnEvent(prop)) { + patchEvent(prop, lastValue, nextValue, dom, lifecycle); + } + else if (lastValue !== nextValue) { + if (isNullOrUndef(nextValue)) { + dom.removeAttribute(prop); + } + else if (prop === 'className') { + if (isSVG) { + dom.setAttribute('class', nextValue); + } + else { + dom.className = nextValue; + } + } + else if (prop === 'style') { + patchStyle(lastValue, nextValue, dom); + } + else if (prop === 'dangerouslySetInnerHTML') { + var lastHtml = lastValue && lastValue.__html; + var nextHtml = nextValue && nextValue.__html; + if (lastHtml !== nextHtml) { + if (!isNullOrUndef(nextHtml)) { + dom.innerHTML = nextHtml; + } + } + } + else if (prop !== 'childrenType' && prop !== 'ref' && prop !== 'key') { + var dehyphenProp = dehyphenProps[prop]; + var ns = namespaces[prop]; + if (ns) { + dom.setAttributeNS(ns, dehyphenProp || prop, nextValue); + } + else { + dom.setAttribute(dehyphenProp || prop, nextValue); + } + } + } + } + function patchEvents(lastEvents, nextEvents, dom, lifecycle) { + lastEvents = lastEvents || EMPTY_OBJ; + nextEvents = nextEvents || EMPTY_OBJ; + if (nextEvents !== EMPTY_OBJ) { + for (var name in nextEvents) { + // do not add a hasOwnProperty check here, it affects performance + patchEvent(name, lastEvents[name], nextEvents[name], dom, lifecycle); + } + } + if (lastEvents !== EMPTY_OBJ) { + for (var name$1 in lastEvents) { + // do not add a hasOwnProperty check here, it affects performance + if (isNullOrUndef(nextEvents[name$1])) { + patchEvent(name$1, lastEvents[name$1], null, dom, lifecycle); + } + } + } + } + function patchEvent(name, lastValue, nextValue, dom, lifecycle) { + if (lastValue !== nextValue) { + var nameLowerCase = name.toLowerCase(); + var domEvent = dom[nameLowerCase]; + // if the function is wrapped, that means it's been controlled by a wrapper + if (domEvent && domEvent.wrapped) { + return; + } + if (delegatedProps[name]) { + lifecycle.fastUnmount = false; + handleEvent(name, lastValue, nextValue, dom); + } + else { + dom[nameLowerCase] = nextValue; + } + } + } + function patchProps(lastProps, nextProps, dom, lifecycle, context, isSVG) { + lastProps = lastProps || EMPTY_OBJ; + nextProps = nextProps || EMPTY_OBJ; + if (nextProps !== EMPTY_OBJ) { + for (var prop in nextProps) { + // do not add a hasOwnProperty check here, it affects performance + var nextValue = nextProps[prop]; + var lastValue = lastProps[prop]; + if (isNullOrUndef(nextValue)) { + removeProp(prop, dom); + } + else { + patchProp(prop, lastValue, nextValue, dom, isSVG, lifecycle); + } + } + } + if (lastProps !== EMPTY_OBJ) { + for (var prop$1 in lastProps) { + // do not add a hasOwnProperty check here, it affects performance + if (isNullOrUndef(nextProps[prop$1])) { + removeProp(prop$1, dom); + } + } + } + } + // We are assuming here that we come from patchProp routine + // -nextAttrValue cannot be null or undefined + function patchStyle(lastAttrValue, nextAttrValue, dom) { + if (isString(nextAttrValue)) { + dom.style.cssText = nextAttrValue; + return; + } + for (var style in nextAttrValue) { + // do not add a hasOwnProperty check here, it affects performance + var value = nextAttrValue[style]; + if (isNumber(value) && !isUnitlessNumber[style]) { + dom.style[style] = value + 'px'; + } + else { + dom.style[style] = value; + } + } + if (!isNullOrUndef(lastAttrValue)) { + for (var style$1 in lastAttrValue) { + if (isNullOrUndef(nextAttrValue[style$1])) { + dom.style[style$1] = ''; + } + } + } + } + function removeProp(prop, dom) { + if (prop === 'className') { + dom.removeAttribute('class'); + } + else if (prop === 'value') { + dom.value = ''; + } + else if (prop === 'style') { + dom.style.cssText = null; + dom.removeAttribute('style'); + } + else if (delegatedProps[prop]) { + handleEvent(prop, null, null, dom); + } + else { + dom.removeAttribute(prop); + } + } + + var recyclingEnabled = true; + var componentPools = new Map(); + var elementPools = new Map(); + function disableRecycling() { + recyclingEnabled = false; + componentPools.clear(); + elementPools.clear(); + } + + function recycleElement(vNode, lifecycle, context, isSVG) { + var tag = vNode.type; + var key = vNode.key; + var pools = elementPools.get(tag); + if (!isUndefined(pools)) { + var pool = key === null ? pools.nonKeyed : pools.keyed.get(key); + if (!isUndefined(pool)) { + var recycledVNode = pool.pop(); + if (!isUndefined(recycledVNode)) { + patchElement(recycledVNode, vNode, null, lifecycle, context, isSVG, true); + return vNode.dom; + } + } + } + return null; + } + function poolElement(vNode) { + var tag = vNode.type; + var key = vNode.key; + var pools = elementPools.get(tag); + if (isUndefined(pools)) { + pools = { + nonKeyed: [], + keyed: new Map() + }; + elementPools.set(tag, pools); + } + if (isNull(key)) { + pools.nonKeyed.push(vNode); + } + else { + var pool = pools.keyed.get(key); + if (isUndefined(pool)) { + pool = []; + pools.keyed.set(key, pool); + } + pool.push(vNode); + } + } + function recycleComponent(vNode, lifecycle, context, isSVG) { + var type = vNode.type; + var key = vNode.key; + var pools = componentPools.get(type); + if (!isUndefined(pools)) { + var pool = key === null ? pools.nonKeyed : pools.keyed.get(key); + if (!isUndefined(pool)) { + var recycledVNode = pool.pop(); + if (!isUndefined(recycledVNode)) { + var flags = vNode.flags; + var failed = patchComponent(recycledVNode, vNode, null, lifecycle, context, isSVG, flags & 4 /* ComponentClass */, true); + if (!failed) { + return vNode.dom; + } + } + } + } + return null; + } + function poolComponent(vNode) { + var type = vNode.type; + var key = vNode.key; + var hooks = vNode.ref; + var nonRecycleHooks = hooks && (hooks.onComponentWillMount || + hooks.onComponentWillUnmount || + hooks.onComponentDidMount || + hooks.onComponentWillUpdate || + hooks.onComponentDidUpdate); + if (nonRecycleHooks) { + return; + } + var pools = componentPools.get(type); + if (isUndefined(pools)) { + pools = { + nonKeyed: [], + keyed: new Map() + }; + componentPools.set(type, pools); + } + if (isNull(key)) { + pools.nonKeyed.push(vNode); + } + else { + var pool = pools.keyed.get(key); + if (isUndefined(pool)) { + pool = []; + pools.keyed.set(key, pool); + } + pool.push(vNode); + } + } + + function mount(vNode, parentDom, lifecycle, context, isSVG) { + var flags = vNode.flags; + if (flags & 3970 /* Element */) { + return mountElement(vNode, parentDom, lifecycle, context, isSVG); + } + else if (flags & 28 /* Component */) { + return mountComponent(vNode, parentDom, lifecycle, context, isSVG, flags & 4 /* ComponentClass */); + } + else if (flags & 4096 /* Void */) { + return mountVoid(vNode, parentDom); + } + else if (flags & 1 /* Text */) { + return mountText(vNode, parentDom); + } + else { + if (false) { + throwError(("mount() expects a valid VNode, instead it received an object with the type \"" + (typeof vNode) + "\".")); + } + throwError(); + } + } + function mountText(vNode, parentDom) { + var dom = document.createTextNode(vNode.children); + vNode.dom = dom; + if (parentDom) { + appendChild(parentDom, dom); + } + return dom; + } + function mountVoid(vNode, parentDom) { + var dom = document.createTextNode(''); + vNode.dom = dom; + if (parentDom) { + appendChild(parentDom, dom); + } + return dom; + } + function mountElement(vNode, parentDom, lifecycle, context, isSVG) { + if (recyclingEnabled) { + var dom$1 = recycleElement(vNode, lifecycle, context, isSVG); + if (!isNull(dom$1)) { + if (!isNull(parentDom)) { + appendChild(parentDom, dom$1); + } + return dom$1; + } + } + var tag = vNode.type; + var flags = vNode.flags; + if (isSVG || (flags & 128 /* SvgElement */)) { + isSVG = true; + } + var dom = documentCreateElement(tag, isSVG); + var children = vNode.children; + var props = vNode.props; + var events = vNode.events; + var ref = vNode.ref; + vNode.dom = dom; + if (!isNull(children)) { + if (isStringOrNumber(children)) { + setTextContent(dom, children); + } + else if (isArray(children)) { + mountArrayChildren(children, dom, lifecycle, context, isSVG); + } + else if (isVNode(children)) { + mount(children, dom, lifecycle, context, isSVG); + } + } + if (!(flags & 2 /* HtmlElement */)) { + processElement(flags, vNode, dom); + } + if (!isNull(props)) { + for (var prop in props) { + // do not add a hasOwnProperty check here, it affects performance + patchProp(prop, null, props[prop], dom, isSVG, lifecycle); + } + } + if (!isNull(events)) { + for (var name in events) { + // do not add a hasOwnProperty check here, it affects performance + patchEvent(name, null, events[name], dom, lifecycle); + } + } + if (!isNull(ref)) { + mountRef(dom, ref, lifecycle); + } + if (!isNull(parentDom)) { + appendChild(parentDom, dom); + } + return dom; + } + function mountArrayChildren(children, dom, lifecycle, context, isSVG) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (!isInvalid(child)) { + if (child.dom) { + children[i] = child = cloneVNode(child); + } + mount(children[i], dom, lifecycle, context, isSVG); + } + } + } + function mountComponent(vNode, parentDom, lifecycle, context, isSVG, isClass) { + if (recyclingEnabled) { + var dom$1 = recycleComponent(vNode, lifecycle, context, isSVG); + if (!isNull(dom$1)) { + if (!isNull(parentDom)) { + appendChild(parentDom, dom$1); + } + return dom$1; + } + } + var type = vNode.type; + var props = vNode.props || EMPTY_OBJ; + var ref = vNode.ref; + var dom; + if (isClass) { + var defaultProps = type.defaultProps; + lifecycle.fastUnmount = false; + if (!isUndefined(defaultProps)) { + copyPropsTo(defaultProps, props); + vNode.props = props; + } + var instance = createStatefulComponentInstance(vNode, type, props, context, isSVG, devToolsStatus); + var input = instance._lastInput; + var fastUnmount = lifecycle.fastUnmount; + // we store the fastUnmount value, but we set it back to true on the lifecycle + // we do this so we can determine if the component render has a fastUnmount or not + lifecycle.fastUnmount = true; + instance._vNode = vNode; + vNode.dom = dom = mount(input, null, lifecycle, instance._childContext, isSVG); + // we now create a lifecycle for this component and store the fastUnmount value + var subLifecycle = instance._lifecycle = new Lifecycle(); + subLifecycle.fastUnmount = lifecycle.fastUnmount; + // we then set the lifecycle fastUnmount value back to what it was before the mount + lifecycle.fastUnmount = fastUnmount; + if (!isNull(parentDom)) { + appendChild(parentDom, dom); + } + mountStatefulComponentCallbacks(ref, instance, lifecycle); + findDOMNodeEnabled && componentToDOMNodeMap.set(instance, dom); + vNode.children = instance; + } + else { + var input$1 = createStatelessComponentInput(vNode, type, props, context); + vNode.dom = dom = mount(input$1, null, lifecycle, context, isSVG); + vNode.children = input$1; + mountStatelessComponentCallbacks(ref, dom, lifecycle); + if (!isNull(parentDom)) { + appendChild(parentDom, dom); + } + } + return dom; + } + function mountStatefulComponentCallbacks(ref, instance, lifecycle) { + if (ref) { + if (isFunction(ref)) { + ref(instance); + } + else { + if (false) { + throwError('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'); + } + throwError(); + } + } + if (!isNull(instance.componentDidMount)) { + lifecycle.addListener(function () { + instance.componentDidMount(); + }); + } + } + function mountStatelessComponentCallbacks(ref, dom, lifecycle) { + if (ref) { + if (!isNullOrUndef(ref.onComponentWillMount)) { + lifecycle.fastUnmount = false; + ref.onComponentWillMount(); + } + if (!isNullOrUndef(ref.onComponentDidMount)) { + lifecycle.fastUnmount = false; + lifecycle.addListener(function () { return ref.onComponentDidMount(dom); }); + } + } + } + function mountRef(dom, value, lifecycle) { + if (isFunction(value)) { + lifecycle.fastUnmount = false; + lifecycle.addListener(function () { return value(dom); }); + } + else { + if (isInvalid(value)) { + return; + } + if (false) { + throwError('string "refs" are not supported in Inferno 1.0. Use callback "refs" instead.'); + } + throwError(); + } + } + + function copyPropsTo(copyFrom, copyTo) { + for (var prop in copyFrom) { + if (isUndefined(copyTo[prop])) { + copyTo[prop] = copyFrom[prop]; + } + } + } + function createStatefulComponentInstance(vNode, Component, props, context, isSVG, devToolsStatus) { + if (isUndefined(context)) { + context = {}; + } + var instance = new Component(props, context); + instance.context = context; + if (instance.props === EMPTY_OBJ) { + instance.props = props; + } + instance._patch = patch; + instance._devToolsStatus = devToolsStatus; + if (findDOMNodeEnabled) { + instance._componentToDOMNodeMap = componentToDOMNodeMap; + } + var childContext = instance.getChildContext(); + if (!isNullOrUndef(childContext)) { + instance._childContext = Object.assign({}, context, childContext); + } + else { + instance._childContext = context; + } + instance._unmounted = false; + instance._pendingSetState = true; + instance._isSVG = isSVG; + instance.componentWillMount(); + instance._beforeRender && instance._beforeRender(); + var input = instance.render(props, instance.state, context); + instance._afterRender && instance._afterRender(); + if (isArray(input)) { + if (false) { + throwError('a valid Inferno VNode (or null) must be returned from a component render. You may have returned an array or an invalid object.'); + } + throwError(); + } + else if (isInvalid(input)) { + input = createVoidVNode(); + } + else { + if (input.dom) { + input = cloneVNode(input); + } + if (input.flags & 28 /* Component */) { + // if we have an input that is also a component, we run into a tricky situation + // where the root vNode needs to always have the correct DOM entry + // so we break monomorphism on our input and supply it our vNode as parentVNode + // we can optimise this in the future, but this gets us out of a lot of issues + input.parentVNode = vNode; + } + } + instance._pendingSetState = false; + instance._lastInput = input; + return instance; + } + function replaceLastChildAndUnmount(lastInput, nextInput, parentDom, lifecycle, context, isSVG, isRecycling) { + replaceVNode(parentDom, mount(nextInput, null, lifecycle, context, isSVG), lastInput, lifecycle, isRecycling); + } + function replaceVNode(parentDom, dom, vNode, lifecycle, isRecycling) { + var shallowUnmount = false; + // we cannot cache nodeType here as vNode might be re-assigned below + if (vNode.flags & 28 /* Component */) { + // if we are accessing a stateful or stateless component, we want to access their last rendered input + // accessing their DOM node is not useful to us here + unmount(vNode, null, lifecycle, false, false, isRecycling); + vNode = vNode.children._lastInput || vNode.children; + shallowUnmount = true; + } + replaceChild(parentDom, dom, vNode.dom); + unmount(vNode, null, lifecycle, false, shallowUnmount, isRecycling); + } + function createStatelessComponentInput(vNode, component, props, context) { + var input = component(props, context); + if (isArray(input)) { + if (false) { + throwError('a valid Inferno VNode (or null) must be returned from a component render. You may have returned an array or an invalid object.'); + } + throwError(); + } + else if (isInvalid(input)) { + input = createVoidVNode(); + } + else { + if (input.dom) { + input = cloneVNode(input); + } + if (input.flags & 28 /* Component */) { + // if we have an input that is also a component, we run into a tricky situation + // where the root vNode needs to always have the correct DOM entry + // so we break monomorphism on our input and supply it our vNode as parentVNode + // we can optimise this in the future, but this gets us out of a lot of issues + input.parentVNode = vNode; + } + } + return input; + } + function setTextContent(dom, text) { + if (text !== '') { + dom.textContent = text; + } + else { + dom.appendChild(document.createTextNode('')); + } + } + function updateTextContent(dom, text) { + dom.firstChild.nodeValue = text; + } + function appendChild(parentDom, dom) { + parentDom.appendChild(dom); + } + function insertOrAppend(parentDom, newNode, nextNode) { + if (isNullOrUndef(nextNode)) { + appendChild(parentDom, newNode); + } + else { + parentDom.insertBefore(newNode, nextNode); + } + } + function documentCreateElement(tag, isSVG) { + if (isSVG === true) { + return document.createElementNS(svgNS, tag); + } + else { + return document.createElement(tag); + } + } + function replaceWithNewNode(lastNode, nextNode, parentDom, lifecycle, context, isSVG, isRecycling) { + unmount(lastNode, null, lifecycle, false, false, isRecycling); + var dom = mount(nextNode, null, lifecycle, context, isSVG); + nextNode.dom = dom; + replaceChild(parentDom, dom, lastNode.dom); + } + function replaceChild(parentDom, nextDom, lastDom) { + if (!parentDom) { + parentDom = lastDom.parentNode; + } + parentDom.replaceChild(nextDom, lastDom); + } + function removeChild(parentDom, dom) { + parentDom.removeChild(dom); + } + function removeAllChildren(dom, children, lifecycle, shallowUnmount, isRecycling) { + dom.textContent = ''; + if (!lifecycle.fastUnmount) { + removeChildren(null, children, lifecycle, shallowUnmount, isRecycling); + } + } + function removeChildren(dom, children, lifecycle, shallowUnmount, isRecycling) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (!isInvalid(child)) { + unmount(child, dom, lifecycle, true, shallowUnmount, isRecycling); + } + } + } + function isKeyed(lastChildren, nextChildren) { + return nextChildren.length && !isNullOrUndef(nextChildren[0]) && !isNullOrUndef(nextChildren[0].key) + && lastChildren.length && !isNullOrUndef(lastChildren[0]) && !isNullOrUndef(lastChildren[0].key); + } + + function normaliseChildNodes(dom) { + var rawChildNodes = dom.childNodes; + var length = rawChildNodes.length; + var i = 0; + while (i < length) { + var rawChild = rawChildNodes[i]; + if (rawChild.nodeType === 8) { + if (rawChild.data === '!') { + var placeholder = document.createTextNode(''); + dom.replaceChild(placeholder, rawChild); + i++; + } + else { + dom.removeChild(rawChild); + length--; + } + } + else { + i++; + } + } + } + function hydrateComponent(vNode, dom, lifecycle, context, isSVG, isClass) { + var type = vNode.type; + var props = vNode.props || {}; + var ref = vNode.ref; + vNode.dom = dom; + if (isClass) { + var _isSVG = dom.namespaceURI === svgNS; + var defaultProps = type.defaultProps; + lifecycle.fastUnmount = false; + if (!isUndefined(defaultProps)) { + copyPropsTo(defaultProps, props); + vNode.props = props; + } + var instance = createStatefulComponentInstance(vNode, type, props, context, _isSVG, devToolsStatus); + var input = instance._lastInput; + var fastUnmount = lifecycle.fastUnmount; + // we store the fastUnmount value, but we set it back to true on the lifecycle + // we do this so we can determine if the component render has a fastUnmount or not + lifecycle.fastUnmount = true; + instance._vComponent = vNode; + instance._vNode = vNode; + hydrate(input, dom, lifecycle, instance._childContext, _isSVG); + var subLifecycle = instance._lifecycle = new Lifecycle(); + subLifecycle.fastUnmount = lifecycle.fastUnmount; + // we then set the lifecycle fastUnmount value back to what it was before the mount + lifecycle.fastUnmount = fastUnmount; + mountStatefulComponentCallbacks(ref, instance, lifecycle); + findDOMNodeEnabled && componentToDOMNodeMap.set(instance, dom); + vNode.children = instance; + } + else { + var input$1 = createStatelessComponentInput(vNode, type, props, context); + hydrate(input$1, dom, lifecycle, context, isSVG); + vNode.children = input$1; + vNode.dom = input$1.dom; + mountStatelessComponentCallbacks(ref, dom, lifecycle); + } + } + function hydrateElement(vNode, dom, lifecycle, context, isSVG) { + var tag = vNode.type; + var children = vNode.children; + var props = vNode.props; + var events = vNode.events; + var flags = vNode.flags; + if (isSVG || (flags & 128 /* SvgElement */)) { + isSVG = true; + } + if (dom.nodeType !== 1 || dom.tagName.toLowerCase() !== tag) { + var newDom = mountElement(vNode, null, lifecycle, context, isSVG); + vNode.dom = newDom; + replaceChild(dom.parentNode, newDom, dom); + } + else { + vNode.dom = dom; + if (children) { + hydrateChildren(children, dom, lifecycle, context, isSVG); + } + if (!(flags & 2 /* HtmlElement */)) { + processElement(flags, vNode, dom); + } + for (var prop in props) { + patchProp(prop, null, props[prop], dom, isSVG, lifecycle); + } + for (var name in events) { + patchEvent(name, null, events[name], dom, lifecycle); + } + } + } + function hydrateChildren(children, dom, lifecycle, context, isSVG) { + normaliseChildNodes(dom); + var domNodes = Array.prototype.slice.call(dom.childNodes); + var childNodeIndex = 0; + if (isArray(children)) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (isObject(child) && !isNull(child)) { + hydrate(child, domNodes[childNodeIndex++], lifecycle, context, isSVG); + } + } + } + else if (isObject(children)) { + hydrate(children, dom.firstChild, lifecycle, context, isSVG); + } + } + function hydrateText(vNode, dom) { + if (dom.nodeType === 3) { + var newDom = mountText(vNode, null); + vNode.dom = newDom; + replaceChild(dom.parentNode, newDom, dom); + } + else { + vNode.dom = dom; + } + } + function hydrateVoid(vNode, dom) { + vNode.dom = dom; + } + function hydrate(vNode, dom, lifecycle, context, isSVG) { + if (false) { + if (isInvalid(dom)) { + throwError("failed to hydrate. The server-side render doesn't match client side."); + } + } + var flags = vNode.flags; + if (flags & 28 /* Component */) { + return hydrateComponent(vNode, dom, lifecycle, context, isSVG, flags & 4 /* ComponentClass */); + } + else if (flags & 3970 /* Element */) { + return hydrateElement(vNode, dom, lifecycle, context, isSVG); + } + else if (flags & 1 /* Text */) { + return hydrateText(vNode, dom); + } + else if (flags & 4096 /* Void */) { + return hydrateVoid(vNode, dom); + } + else { + if (false) { + throwError(("hydrate() expects a valid VNode, instead it received an object with the type \"" + (typeof vNode) + "\".")); + } + throwError(); + } + } + function hydrateRoot(input, parentDom, lifecycle) { + if (parentDom && parentDom.nodeType === 1 && parentDom.firstChild) { + hydrate(input, parentDom.firstChild, lifecycle, {}, false); + return true; + } + return false; + } + + // rather than use a Map, like we did before, we can use an array here + // given there shouldn't be THAT many roots on the page, the difference + // in performance is huge: https://esbench.com/bench/5802a691330ab09900a1a2da + var roots = []; + var componentToDOMNodeMap = new Map(); + var findDOMNodeEnabled = false; + function enableFindDOMNode() { + findDOMNodeEnabled = true; + } + function findDOMNode(ref) { + if (!findDOMNodeEnabled) { + if (false) { + throwError('findDOMNode() has been disabled, use enableFindDOMNode() enabled findDOMNode(). Warning this can significantly impact performance!'); + } + throwError(); + } + var dom = ref && ref.nodeType ? ref : null; + return componentToDOMNodeMap.get(ref) || dom; + } + function getRoot(dom) { + for (var i = 0; i < roots.length; i++) { + var root = roots[i]; + if (root.dom === dom) { + return root; + } + } + return null; + } + function setRoot(dom, input, lifecycle) { + roots.push({ + dom: dom, + input: input, + lifecycle: lifecycle + }); + } + function removeRoot(root) { + for (var i = 0; i < roots.length; i++) { + if (roots[i] === root) { + roots.splice(i, 1); + return; + } + } + } + var documentBody = isBrowser ? document.body : null; + function render(input, parentDom) { + if (documentBody === parentDom) { + if (false) { + throwError('you cannot render() to the "document.body". Use an empty element as a container instead.'); + } + throwError(); + } + if (input === NO_OP) { + return; + } + var root = getRoot(parentDom); + if (isNull(root)) { + var lifecycle = new Lifecycle(); + if (!isInvalid(input)) { + if (input.dom) { + input = cloneVNode(input); + } + if (!hydrateRoot(input, parentDom, lifecycle)) { + mount(input, parentDom, lifecycle, {}, false); + } + lifecycle.trigger(); + setRoot(parentDom, input, lifecycle); + } + } + else { + var lifecycle$1 = root.lifecycle; + lifecycle$1.listeners = []; + if (isNullOrUndef(input)) { + unmount(root.input, parentDom, lifecycle$1, false, false, false); + removeRoot(root); + } + else { + if (input.dom) { + input = cloneVNode(input); + } + patch(root.input, input, parentDom, lifecycle$1, {}, false, false); + } + lifecycle$1.trigger(); + root.input = input; + } + if (devToolsStatus.connected) { + sendRoots(window); + } + } + function createRenderer() { + var parentDom; + return function renderer(lastInput, nextInput) { + if (!parentDom) { + parentDom = lastInput; + } + render(nextInput, parentDom); + }; + } + + function linkEvent(data, event) { + return { data: data, event: event }; + } + + if (isBrowser) { + window.process = { + env: { + NODE_ENV: 'development' + } + }; + initDevToolsHooks(window); + } + + if (false) { + var testFunc = function testFn() {}; + warning( + (testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, + 'It looks like you\'re using a minified copy of the development build ' + + 'of Inferno. When deploying Inferno apps to production, make sure to use ' + + 'the production build which skips development warnings and is faster. ' + + 'See http://infernojs.org for more details.' + ); + } + + // we duplicate it so it plays nicely with different module loading systems + var index = { + linkEvent: linkEvent, + // core shapes + createVNode: createVNode, + + // cloning + cloneVNode: cloneVNode, + + // used to shared common items between Inferno libs + NO_OP: NO_OP, + EMPTY_OBJ: EMPTY_OBJ, + + //DOM + render: render, + findDOMNode: findDOMNode, + createRenderer: createRenderer, + disableRecycling: disableRecycling, + enableFindDOMNode: enableFindDOMNode + }; + + exports['default'] = index; + exports.linkEvent = linkEvent; + exports.createVNode = createVNode; + exports.cloneVNode = cloneVNode; + exports.NO_OP = NO_OP; + exports.EMPTY_OBJ = EMPTY_OBJ; + exports.render = render; + exports.findDOMNode = findDOMNode; + exports.createRenderer = createRenderer; + exports.disableRecycling = disableRecycling; + exports.enableFindDOMNode = enableFindDOMNode; + + Object.defineProperty(exports, '__esModule', { value: true }); + + }))); + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(4); + + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + /*! + * inferno-component v1.0.0-beta32 + * (c) 2016 Dominic Gannaway + * Released under the MIT License. + */ + (function (global, factory) { + true ? module.exports = factory(__webpack_require__(2)) : + typeof define === 'function' && define.amd ? define(['inferno'], factory) : + (global.Inferno = global.Inferno || {}, global.Inferno.Component = factory(global.Inferno)); + }(this, (function (inferno) { 'use strict'; + + var ERROR_MSG = 'a runtime error occured! Use Inferno in development environment to find the error.'; + + + // this is MUCH faster than .constructor === Array and instanceof Array + // in Node 7 and the later versions of V8, slower in older versions though + var isArray = Array.isArray; + + + function isNullOrUndef(obj) { + return isUndefined(obj) || isNull(obj); + } + function isInvalid(obj) { + return isNull(obj) || obj === false || isTrue(obj) || isUndefined(obj); + } + function isFunction(obj) { + return typeof obj === 'function'; + } + + + + function isNull(obj) { + return obj === null; + } + function isTrue(obj) { + return obj === true; + } + function isUndefined(obj) { + return obj === undefined; + } + + function throwError(message) { + if (!message) { + message = ERROR_MSG; + } + throw new Error(("Inferno Error: " + message)); + } + + var Lifecycle = function Lifecycle() { + this.listeners = []; + this.fastUnmount = true; + }; + Lifecycle.prototype.addListener = function addListener (callback) { + this.listeners.push(callback); + }; + Lifecycle.prototype.trigger = function trigger () { + var this$1 = this; + + for (var i = 0; i < this.listeners.length; i++) { + this$1.listeners[i](); + } + }; + + var noOp = ERROR_MSG; + if (false) { + 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 componentCallbackQueue = new Map(); + // when a components root VNode is also a component, we can run into issues + // this will recursively look for vNode.parentNode if the VNode is a component + function updateParentComponentVNodes(vNode, dom) { + if (vNode.flags & 28 /* Component */) { + var parentVNode = vNode.parentVNode; + if (parentVNode) { + parentVNode.dom = dom; + updateParentComponentVNodes(parentVNode, dom); + } + } + } + // this is in shapes too, but we don't want to import from shapes as it will pull in a duplicate of createVNode + function createVoidVNode() { + return inferno.createVNode(4096 /* Void */); + } + function addToQueue(component, force, callback) { + // TODO this function needs to be revised and improved on + var queue = componentCallbackQueue.get(component); + if (!queue) { + queue = []; + componentCallbackQueue.set(component, queue); + Promise.resolve().then(function () { + applyState(component, force, function () { + for (var i = 0; i < queue.length; i++) { + queue[i](); + } + }); + componentCallbackQueue.delete(component); + component._processingSetState = false; + }); + } + if (callback) { + queue.push(callback); + } + } + function queueStateChanges(component, newState, callback) { + if (isFunction(newState)) { + newState = newState(component.state); + } + for (var stateKey in newState) { + component._pendingState[stateKey] = newState[stateKey]; + } + if (!component._pendingSetState) { + if (component._processingSetState || callback) { + addToQueue(component, false, callback); + } + else { + component._pendingSetState = true; + component._processingSetState = true; + applyState(component, false, callback); + component._processingSetState = false; + } + } + else { + component.state = Object.assign({}, component.state, component._pendingState); + component._pendingState = {}; + } + } + function applyState(component, force, callback) { + if ((!component._deferSetState || force) && !component._blockRender) { + component._pendingSetState = false; + var pendingState = component._pendingState; + var prevState = component.state; + var nextState = Object.assign({}, prevState, pendingState); + var props = component.props; + var context = component.context; + component._pendingState = {}; + var nextInput = component._updateComponent(prevState, nextState, props, props, context, force); + var didUpdate = true; + if (isInvalid(nextInput)) { + nextInput = createVoidVNode(); + } + else if (isArray(nextInput)) { + if (false) { + throwError('a valid Inferno VNode (or null) must be returned from a component render. You may have returned an array or an invalid object.'); + } + throwError(); + } + else if (nextInput === inferno.NO_OP) { + nextInput = component._lastInput; + didUpdate = false; + } + var lastInput = component._lastInput; + var parentDom = lastInput.dom.parentNode; + component._lastInput = nextInput; + if (didUpdate) { + var subLifecycle = component._lifecycle; + if (!subLifecycle) { + subLifecycle = new Lifecycle(); + } + else { + subLifecycle.listeners = []; + } + component._lifecycle = subLifecycle; + var childContext = component.getChildContext(); + if (!isNullOrUndef(childContext)) { + childContext = Object.assign({}, context, component._childContext, childContext); + } + else { + childContext = Object.assign({}, context, component._childContext); + } + component._patch(lastInput, nextInput, parentDom, subLifecycle, childContext, component._isSVG, false); + subLifecycle.trigger(); + component.componentDidUpdate(props, prevState); + } + var vNode = component._vNode; + var dom = vNode.dom = nextInput.dom; + var componentToDOMNodeMap = component._componentToDOMNodeMap; + componentToDOMNodeMap && componentToDOMNodeMap.set(component, nextInput.dom); + updateParentComponentVNodes(vNode, dom); + if (!isNullOrUndef(callback)) { + callback(); + } + } + } + var Component$1 = function Component$1(props, context) { + this.state = {}; + this.refs = {}; + this._processingSetState = false; + this._blockRender = false; + this._ignoreSetState = false; + this._blockSetState = false; + this._deferSetState = false; + this._pendingSetState = false; + this._pendingState = {}; + this._lastInput = null; + this._vNode = null; + this._unmounted = true; + this._devToolsStatus = null; + this._devToolsId = null; + this._lifecycle = null; + this._childContext = null; + this._patch = null; + this._isSVG = false; + this._componentToDOMNodeMap = null; + /** @type {object} */ + this.props = props || inferno.EMPTY_OBJ; + /** @type {object} */ + this.context = context || {}; + if (!this.componentDidMount) { + this.componentDidMount = null; + } + }; + Component$1.prototype.render = function render (nextProps, nextState, nextContext) { + }; + Component$1.prototype.forceUpdate = function forceUpdate (callback) { + if (this._unmounted) { + throw Error(noOp); + } + applyState(this, true, callback); + }; + Component$1.prototype.setState = function setState (newState, callback) { + if (this._unmounted) { + throw Error(noOp); + } + if (!this._blockSetState) { + if (!this._ignoreSetState) { + queueStateChanges(this, newState, callback); + } + } + else { + if (false) { + throwError('cannot update state via setState() in componentWillUpdate().'); + } + throwError(); + } + }; + Component$1.prototype.componentWillMount = function componentWillMount () { + }; + Component$1.prototype.componentDidMount = function componentDidMount () { + }; + Component$1.prototype.componentWillUnmount = function componentWillUnmount () { + }; + Component$1.prototype.componentDidUpdate = function componentDidUpdate (prevProps, prevState, prevContext) { + }; + Component$1.prototype.shouldComponentUpdate = function shouldComponentUpdate (nextProps, nextState, context) { + return true; + }; + Component$1.prototype.componentWillReceiveProps = function componentWillReceiveProps (nextProps, context) { + }; + Component$1.prototype.componentWillUpdate = function componentWillUpdate (nextProps, nextState, nextContext) { + }; + Component$1.prototype.getChildContext = function getChildContext () { + }; + Component$1.prototype._updateComponent = function _updateComponent (prevState, nextState, prevProps, nextProps, context, force) { + if (this._unmounted === true) { + if (false) { + throwError(noOp); + } + throwError(); + } + if ((prevProps !== nextProps || nextProps === inferno.EMPTY_OBJ) || prevState !== nextState || force) { + if (prevProps !== nextProps || nextProps === inferno.EMPTY_OBJ) { + this._blockRender = true; + this.componentWillReceiveProps(nextProps, context); + this._blockRender = false; + if (this._pendingSetState) { + nextState = Object.assign({}, nextState, this._pendingState); + this._pendingSetState = false; + this._pendingState = {}; + } + } + var shouldUpdate = this.shouldComponentUpdate(nextProps, nextState, context); + if (shouldUpdate !== false || force) { + this._blockSetState = true; + this.componentWillUpdate(nextProps, nextState, context); + this._blockSetState = false; + this.props = nextProps; + var state = this.state = nextState; + this.context = context; + this._beforeRender && this._beforeRender(); + var render = this.render(nextProps, state, context); + this._afterRender && this._afterRender(); + return render; + } + } + return inferno.NO_OP; + }; + + return Component$1; + + }))); + + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports.read = read; + exports.assign = assign; + exports.isEqual = isEqual; + /** + * Shared funcs/values + */ + + var ENTER = exports.ENTER = 13; + var ESCAPE = exports.ESCAPE = 27; + + var filters = exports.filters = { + all: function all(t) { + return true; + }, + active: function active(t) { + return !t.completed; + }, + completed: function completed(t) { + return t.completed; + } + }; + + /** + * Read the `location.hash` value + * @return {String} + */ + function read() { + return location.hash.replace('#/', '') || 'all'; + } + + /** + * Modified `Object.assign` shim + * - always writes to new object + * @return {Object} + */ + function assign() { + var src = void 0; + var tar = {}; + for (var s = 0; s < arguments.length; s++) { + src = Object(arguments[s]); + for (var k in src) { + tar[k] = src[k]; + } + } + return tar; + } + + /** + * Are two Objects equal values? + * @param {Object} a + * @param {Object} b + * @return {Boolean} + */ + function isEqual(a, b) { + // Create arrays of property names + var aProps = Object.getOwnPropertyNames(a); + var bProps = Object.getOwnPropertyNames(b); + + if (aProps.length !== bProps.length) return false; + + for (var i = 0; i < aProps.length; i++) { + var k = aProps[i]; + if (a[k] !== b[k]) return false; + } + + return true; + } + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.links = undefined; + exports.Head = Head; + exports.Foot = Foot; + + var _inferno = __webpack_require__(1); + + var _inferno2 = _interopRequireDefault(_inferno); + + var _share = __webpack_require__(5); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * Stateless Header component + */ + function Head(_ref) { + var onEnter = _ref.onEnter; + + return _inferno2.default.createVNode(2, 'header', { + 'className': 'header' + }, [_inferno2.default.createVNode(2, 'h1', null, 'todos'), _inferno2.default.createVNode(512, 'input', { + 'className': 'new-todo', + 'autofocus': true, + 'autocomplete': 'off', + 'placeholder': 'What needs to be done?' + }, null, { + 'onkeydown': onEnter + })]); + } + + var links = exports.links = [{ hash: '#/', name: 'All' }, { hash: '#/active', name: 'Active' }, { hash: '#/completed', name: 'Completed' }]; + + /** + * Stateless Footer component + */ + function Foot(_ref2) { + var left = _ref2.left, + done = _ref2.done, + route = _ref2.route, + onClear = _ref2.onClear; + + return _inferno2.default.createVNode(2, 'footer', { + 'className': 'footer' + }, [_inferno2.default.createVNode(2, 'span', { + 'className': 'todo-count' + }, [_inferno2.default.createVNode(2, 'strong', null, left), ' ', left > 1 ? 'items' : 'item', ' left']), _inferno2.default.createVNode(2, 'ul', { + 'className': 'filters' + }, links.map(function (_ref3) { + var hash = _ref3.hash, + name = _ref3.name; + return _inferno2.default.createVNode(2, 'li', null, _inferno2.default.createVNode(2, 'a', { + 'href': hash, + 'className': name.toLowerCase() === route ? 'selected' : '' + }, name)); + })), done > 0 ? _inferno2.default.createVNode(2, 'button', { + 'className': 'clear-completed' + }, 'Clear completed', { + 'onClick': onClear + }) : null]); + } + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _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; }; + + var _share = __webpack_require__(5); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var STOR = {}; + var STOR_ID = 'todos-inferno'; + + var Model = function Model() { + var _this = this; + + _classCallCheck(this, Model); + + this.get = function () { + return _this.data = JSON.parse(STOR[STOR_ID] || '[]'); + }; + + this.set = function (arr) { + _this.data = arr || _this.data || []; + STOR[STOR_ID] = JSON.stringify(_this.data); + return _this.data; + }; + + this.add = function (str) { + return _this.set(_this.data.concat({ title: str, completed: false })); + }; + + this.put = function (todo, obj) { + return _this.set(_this.data.map(function (t) { + return (0, _share.isEqual)(t, todo) ? (0, _share.assign)(todo, obj) : t; + })); + }; + + this.del = function (todo) { + return _this.set(_this.data.filter(function (t) { + return !(0, _share.isEqual)(t, todo); + })); + }; + + this.toggle = function (todo) { + return _this.put(todo, { completed: !todo.completed }); + }; + + this.toggleAll = function (completed) { + return _this.set(_this.data.map(function (t) { + return _extends({}, t, { completed: completed }); + })); + }; + + this.clearCompleted = function () { + return _this.set(_this.data.filter(function (t) { + return !t.completed; + })); + }; + }; + + exports.default = Model; + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _inferno = __webpack_require__(1); + + var _inferno2 = _interopRequireDefault(_inferno); + + var _infernoComponent = __webpack_require__(3); + + var _infernoComponent2 = _interopRequireDefault(_infernoComponent); + + var _share = __webpack_require__(5); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(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; } + + function _inherits(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; } + + var Item = function (_Component) { + _inherits(Item, _Component); + + function Item(_ref) { + var data = _ref.data, + props = _objectWithoutProperties(_ref, ['data']); + + _classCallCheck(this, Item); + + var _this = _possibleConstructorReturn(this, _Component.call(this, props)); + + _initialiseProps.call(_this); + + _this.todo = data; + _this.state = { text: data.title }; + _this.editor = null; + return _this; + } + + Item.prototype.render = function render(_ref2, _ref3) { + var _this2 = this; + + var doToggle = _ref2.doToggle, + doDelete = _ref2.doDelete, + doSave = _ref2.doSave, + onBlur = _ref2.onBlur, + onFocus = _ref2.onFocus; + var text = _ref3.text; + var _todo = this.todo, + title = _todo.title, + completed = _todo.completed, + editing = _todo.editing; + + + var cls = []; + editing && cls.push('editing'); + completed && cls.push('completed'); + + var handleKeydown = function handleKeydown(e) { + if (e.which === _share.ESCAPE) return onBlur(); + if (e.which === _share.ENTER) return doSave(text); + }; + + // tmp fix + var handleBlur = function handleBlur() { + return doSave(text); + }; + var handleInput = function handleInput(e) { + return _this2.setText(e.target.value); + }; + + return _inferno2.default.createVNode(2, 'li', { + 'className': cls.join(' ') + }, [_inferno2.default.createVNode(2, 'div', { + 'className': 'view' + }, [_inferno2.default.createVNode(512, 'input', { + 'className': 'toggle', + 'type': 'checkbox', + 'checked': completed + }, null, { + 'onClick': doToggle + }), _inferno2.default.createVNode(2, 'label', null, title, { + 'ondblclick': onFocus + }), _inferno2.default.createVNode(2, 'button', { + 'className': 'destroy' + }, null, { + 'onClick': doDelete + })]), _inferno2.default.createVNode(512, 'input', { + 'className': 'edit', + 'value': editing && text + }, null, { + 'onblur': handleBlur, + 'oninput': handleInput, + 'onkeydown': handleKeydown + }, null, function (el) { + _this2.editor = el; + })]); + }; + + return Item; + }(_infernoComponent2.default); + + var _initialiseProps = function _initialiseProps() { + var _this3 = this; + + this.componentWillReceiveProps = function (_ref4) { + var data = _ref4.data; + return _this3.setText(data.title); + }; + + this.shouldComponentUpdate = function (_ref5, _ref6) { + var data = _ref5.data; + var text = _ref6.text; + return !((0, _share.isEqual)(data, _this3.todo) && text === _this3.state.text); + }; + + this.componentWillUpdate = function (_ref7) { + var data = _ref7.data; + return _this3.todo = data; + }; + + this.componentDidUpdate = function () { + return _this3.editor.focus(); + }; + + this.setText = function (text) { + return _this3.setState({ text: text }); + }; + }; + + exports.default = Item; + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/index.html b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/index.html new file mode 100644 index 0000000000..50157815d3 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/index.html @@ -0,0 +1,18 @@ + + + + + Inferno • TodoMVC + + + + +
+
+

Double-click to edit a todo

+

Part of TodoMVC

+
+ + + + diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/index.css b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/index.css new file mode 100644 index 0000000000..e04fbdbdb4 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/index.css @@ -0,0 +1,376 @@ +html, +body { + margin: 0; + padding: 0; +} + +button { + margin: 0; + padding: 0; + border: 0; + background: none; + font-size: 100%; + vertical-align: baseline; + font-family: inherit; + font-weight: inherit; + color: inherit; + -webkit-appearance: none; + appearance: none; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +body { + font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; + line-height: 1.4em; + background: #f5f5f5; + color: #4d4d4d; + min-width: 230px; + max-width: 550px; + margin: 0 auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-weight: 300; +} + +:focus { + outline: 0; +} + +.hidden { + display: none; +} + +.todoapp { + background: #fff; + margin: 130px 0 40px 0; + position: relative; + box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), + 0 25px 50px 0 rgba(0, 0, 0, 0.1); +} + +.todoapp input::-webkit-input-placeholder { + font-style: italic; + font-weight: 300; + color: #e6e6e6; +} + +.todoapp input::-moz-placeholder { + font-style: italic; + font-weight: 300; + color: #e6e6e6; +} + +.todoapp input::input-placeholder { + font-style: italic; + font-weight: 300; + color: #e6e6e6; +} + +.todoapp h1 { + position: absolute; + top: -155px; + width: 100%; + font-size: 100px; + font-weight: 100; + text-align: center; + color: rgba(175, 47, 47, 0.15); + -webkit-text-rendering: optimizeLegibility; + -moz-text-rendering: optimizeLegibility; + text-rendering: optimizeLegibility; +} + +.new-todo, +.edit { + position: relative; + margin: 0; + width: 100%; + font-size: 24px; + font-family: inherit; + font-weight: inherit; + line-height: 1.4em; + border: 0; + color: inherit; + padding: 6px; + border: 1px solid #999; + box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2); + box-sizing: border-box; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.new-todo { + padding: 16px 16px 16px 60px; + border: none; + background: rgba(0, 0, 0, 0.003); + box-shadow: inset 0 -2px 1px rgba(0,0,0,0.03); +} + +.main { + position: relative; + z-index: 2; + border-top: 1px solid #e6e6e6; +} + +.toggle-all { + text-align: center; + border: none; /* Mobile Safari */ + opacity: 0; + position: absolute; +} + +.toggle-all + label { + width: 60px; + height: 34px; + font-size: 0; + position: absolute; + top: -52px; + left: -13px; + -webkit-transform: rotate(90deg); + transform: rotate(90deg); +} + +.toggle-all + label:before { + content: '❯'; + font-size: 22px; + color: #e6e6e6; + padding: 10px 27px 10px 27px; +} + +.toggle-all:checked + label:before { + color: #737373; +} + +.todo-list { + margin: 0; + padding: 0; + list-style: none; +} + +.todo-list li { + position: relative; + font-size: 24px; + border-bottom: 1px solid #ededed; +} + +.todo-list li:last-child { + border-bottom: none; +} + +.todo-list li.editing { + border-bottom: none; + padding: 0; +} + +.todo-list li.editing .edit { + display: block; + width: 506px; + padding: 12px 16px; + margin: 0 0 0 43px; +} + +.todo-list li.editing .view { + display: none; +} + +.todo-list li .toggle { + text-align: center; + width: 40px; + /* auto, since non-WebKit browsers doesn't support input styling */ + height: auto; + position: absolute; + top: 0; + bottom: 0; + margin: auto 0; + border: none; /* Mobile Safari */ + -webkit-appearance: none; + appearance: none; +} + +.todo-list li .toggle { + opacity: 0; +} + +.todo-list li .toggle + label { + /* + Firefox requires `#` to be escaped - https://bugzilla.mozilla.org/show_bug.cgi?id=922433 + IE and Edge requires *everything* to be escaped to render, so we do that instead of just the `#` - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7157459/ + */ + background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E'); + background-repeat: no-repeat; + background-position: center left; +} + +.todo-list li .toggle:checked + label { + background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22/%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22/%3E%3C/svg%3E'); +} + +.todo-list li label { + word-break: break-all; + padding: 15px 15px 15px 60px; + display: block; + line-height: 1.2; + transition: color 0.4s; +} + +.todo-list li.completed label { + color: #d9d9d9; + text-decoration: line-through; +} + +.todo-list li .destroy { + display: none; + position: absolute; + top: 0; + right: 10px; + bottom: 0; + width: 40px; + height: 40px; + margin: auto 0; + font-size: 30px; + color: #cc9a9a; + margin-bottom: 11px; + transition: color 0.2s ease-out; +} + +.todo-list li .destroy:hover { + color: #af5b5e; +} + +.todo-list li .destroy:after { + content: '×'; +} + +.todo-list li:hover .destroy { + display: block; +} + +.todo-list li .edit { + display: none; +} + +.todo-list li.editing:last-child { + margin-bottom: -1px; +} + +.footer { + color: #777; + padding: 10px 15px; + height: 20px; + text-align: center; + border-top: 1px solid #e6e6e6; +} + +.footer:before { + content: ''; + position: absolute; + right: 0; + bottom: 0; + left: 0; + height: 50px; + overflow: hidden; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), + 0 8px 0 -3px #f6f6f6, + 0 9px 1px -3px rgba(0, 0, 0, 0.2), + 0 16px 0 -6px #f6f6f6, + 0 17px 2px -6px rgba(0, 0, 0, 0.2); +} + +.todo-count { + float: left; + text-align: left; +} + +.todo-count strong { + font-weight: 300; +} + +.filters { + margin: 0; + padding: 0; + list-style: none; + position: absolute; + right: 0; + left: 0; +} + +.filters li { + display: inline; +} + +.filters li a { + color: inherit; + margin: 3px; + padding: 3px 7px; + text-decoration: none; + border: 1px solid transparent; + border-radius: 3px; +} + +.filters li a:hover { + border-color: rgba(175, 47, 47, 0.1); +} + +.filters li a.selected { + border-color: rgba(175, 47, 47, 0.2); +} + +.clear-completed, +html .clear-completed:active { + float: right; + position: relative; + line-height: 20px; + text-decoration: none; + cursor: pointer; +} + +.clear-completed:hover { + text-decoration: underline; +} + +.info { + margin: 65px auto 0; + color: #bfbfbf; + font-size: 10px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + text-align: center; +} + +.info p { + line-height: 1; +} + +.info a { + color: inherit; + text-decoration: none; + font-weight: 400; +} + +.info a:hover { + text-decoration: underline; +} + +/* + Hack to remove background from Mobile Safari. + Can't use it globally since it destroys checkboxes in Firefox +*/ +@media screen and (-webkit-min-device-pixel-ratio:0) { + .toggle-all, + .todo-list li .toggle { + background: none; + } + + .todo-list li .toggle { + height: 40px; + } +} + +@media (max-width: 430px) { + .footer { + height: 50px; + } + + .filters { + bottom: 10px; + } +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/package.json b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/package.json new file mode 100644 index 0000000000..63b81a80d1 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/package.json @@ -0,0 +1,59 @@ +{ + "_from": "todomvc-app-css@^2.1.0", + "_id": "todomvc-app-css@2.1.0", + "_inBundle": false, + "_integrity": "sha1-tvJxbTOa+i5feZNH0qSLBTliQqU=", + "_location": "/todomvc-app-css", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "todomvc-app-css@^2.1.0", + "name": "todomvc-app-css", + "escapedName": "todomvc-app-css", + "rawSpec": "^2.1.0", + "saveSpec": null, + "fetchSpec": "^2.1.0" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/todomvc-app-css/-/todomvc-app-css-2.1.0.tgz", + "_shasum": "b6f2716d339afa2e5f799347d2a48b05396242a5", + "_spec": "todomvc-app-css@^2.1.0", + "_where": "/Users/mathiasb/projects/WebKit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/tastejs/todomvc-app-css/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "CSS for TodoMVC apps", + "files": [ + "index.css" + ], + "homepage": "https://github.com/tastejs/todomvc-app-css#readme", + "keywords": [ + "todomvc", + "tastejs", + "app", + "todo", + "template", + "css", + "style", + "stylesheet" + ], + "license": "CC-BY-4.0", + "name": "todomvc-app-css", + "repository": { + "type": "git", + "url": "git+https://github.com/tastejs/todomvc-app-css.git" + }, + "style": "index.css", + "version": "2.1.0" +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/readme.md b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/readme.md new file mode 100644 index 0000000000..6ddbebf024 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-app-css/readme.md @@ -0,0 +1,28 @@ +# todomvc-app-css + +> CSS for TodoMVC apps + +![](screenshot.png) + + +## Install + + +``` +$ npm install --save todomvc-app-css +``` + + +## Getting started + +```html + +``` + +See the [TodoMVC app template](https://github.com/tastejs/todomvc-app-template). + + + +## License + +Creative Commons License
This work by Sindre Sorhus is licensed under a Creative Commons Attribution 4.0 International License. diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/base.css b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/base.css new file mode 100644 index 0000000000..4d25d3c84a --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/base.css @@ -0,0 +1,141 @@ +hr { + margin: 20px 0; + border: 0; + border-top: 1px dashed #c5c5c5; + border-bottom: 1px dashed #f7f7f7; +} + +.learn a { + font-weight: normal; + text-decoration: none; + color: #b83f45; +} + +.learn a:hover { + text-decoration: underline; + color: #787e7e; +} + +.learn h3, +.learn h4, +.learn h5 { + margin: 10px 0; + font-weight: 500; + line-height: 1.2; + color: #000; +} + +.learn h3 { + font-size: 24px; +} + +.learn h4 { + font-size: 18px; +} + +.learn h5 { + margin-bottom: 0; + font-size: 14px; +} + +.learn ul { + padding: 0; + margin: 0 0 30px 25px; +} + +.learn li { + line-height: 20px; +} + +.learn p { + font-size: 15px; + font-weight: 300; + line-height: 1.3; + margin-top: 0; + margin-bottom: 0; +} + +#issue-count { + display: none; +} + +.quote { + border: none; + margin: 20px 0 60px 0; +} + +.quote p { + font-style: italic; +} + +.quote p:before { + content: '“'; + font-size: 50px; + opacity: .15; + position: absolute; + top: -20px; + left: 3px; +} + +.quote p:after { + content: '”'; + font-size: 50px; + opacity: .15; + position: absolute; + bottom: -42px; + right: 3px; +} + +.quote footer { + position: absolute; + bottom: -40px; + right: 0; +} + +.quote footer img { + border-radius: 3px; +} + +.quote footer a { + margin-left: 5px; + vertical-align: middle; +} + +.speech-bubble { + position: relative; + padding: 10px; + background: rgba(0, 0, 0, .04); + border-radius: 5px; +} + +.speech-bubble:after { + content: ''; + position: absolute; + top: 100%; + right: 30px; + border: 13px solid transparent; + border-top-color: rgba(0, 0, 0, .04); +} + +.learn-bar > .learn { + position: absolute; + width: 272px; + top: 8px; + left: -300px; + padding: 10px; + border-radius: 5px; + background-color: rgba(255, 255, 255, .6); + transition-property: left; + transition-duration: 500ms; +} + +@media (min-width: 899px) { + .learn-bar { + width: auto; + padding-left: 300px; + } + + .learn-bar > .learn { + left: 8px; + } +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/base.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/base.js new file mode 100644 index 0000000000..e1676dbb8f --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/base.js @@ -0,0 +1,249 @@ +/* global _ */ +(function () { + 'use strict'; + + /* jshint ignore:start */ + // Underscore's Template Module + // Courtesy of underscorejs.org + var _ = (function (_) { + _.defaults = function (object) { + if (!object) { + return object; + } + for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) { + var iterable = arguments[argsIndex]; + if (iterable) { + for (var key in iterable) { + if (object[key] == null) { + object[key] = iterable[key]; + } + } + } + } + return object; + }; + + // By default, Underscore uses ERB-style template delimiters, change the + // following template settings to use alternative delimiters. + _.templateSettings = { + evaluate : /<%([\s\S]+?)%>/g, + interpolate : /<%=([\s\S]+?)%>/g, + escape : /<%-([\s\S]+?)%>/g + }; + + // When customizing `templateSettings`, if you don't want to define an + // interpolation, evaluation or escaping regex, we need one that is + // guaranteed not to match. + var noMatch = /(.)^/; + + // Certain characters need to be escaped so that they can be put into a + // string literal. + var escapes = { + "'": "'", + '\\': '\\', + '\r': 'r', + '\n': 'n', + '\t': 't', + '\u2028': 'u2028', + '\u2029': 'u2029' + }; + + var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; + + // JavaScript micro-templating, similar to John Resig's implementation. + // Underscore templating handles arbitrary delimiters, preserves whitespace, + // and correctly escapes quotes within interpolated code. + _.template = function(text, data, settings) { + var render; + settings = _.defaults({}, settings, _.templateSettings); + + // Combine delimiters into one regular expression via alternation. + var matcher = new RegExp([ + (settings.escape || noMatch).source, + (settings.interpolate || noMatch).source, + (settings.evaluate || noMatch).source + ].join('|') + '|$', 'g'); + + // Compile the template source, escaping string literals appropriately. + var index = 0; + var source = "__p+='"; + text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { + source += text.slice(index, offset) + .replace(escaper, function(match) { return '\\' + escapes[match]; }); + + if (escape) { + source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; + } + if (interpolate) { + source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; + } + if (evaluate) { + source += "';\n" + evaluate + "\n__p+='"; + } + index = offset + match.length; + return match; + }); + source += "';\n"; + + // If a variable is not specified, place data values in local scope. + if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; + + source = "var __t,__p='',__j=Array.prototype.join," + + "print=function(){__p+=__j.call(arguments,'');};\n" + + source + "return __p;\n"; + + try { + render = new Function(settings.variable || 'obj', '_', source); + } catch (e) { + e.source = source; + throw e; + } + + if (data) return render(data, _); + var template = function(data) { + return render.call(this, data, _); + }; + + // Provide the compiled function source as a convenience for precompilation. + template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; + + return template; + }; + + return _; + })({}); + + if (location.hostname === 'todomvc.com') { + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); + ga('create', 'UA-31081062-1', 'auto'); + ga('send', 'pageview'); + } + /* jshint ignore:end */ + + function redirect() { + if (location.hostname === 'tastejs.github.io') { + location.href = location.href.replace('tastejs.github.io/todomvc', 'todomvc.com'); + } + } + + function findRoot() { + var base = location.href.indexOf('examples/'); + return location.href.substr(0, base); + } + + function getFile(file, callback) { + if (!location.host) { + return console.info('Miss the info bar? Run TodoMVC from a server to avoid a cross-origin error.'); + } + + var xhr = new XMLHttpRequest(); + + xhr.open('GET', findRoot() + file, true); + xhr.send(); + + xhr.onload = function () { + if (xhr.status === 200 && callback) { + callback(xhr.responseText); + } + }; + } + + function Learn(learnJSON, config) { + if (!(this instanceof Learn)) { + return new Learn(learnJSON, config); + } + + var template, framework; + + if (typeof learnJSON !== 'object') { + try { + learnJSON = JSON.parse(learnJSON); + } catch (e) { + return; + } + } + + if (config) { + template = config.template; + framework = config.framework; + } + + if (!template && learnJSON.templates) { + template = learnJSON.templates.todomvc; + } + + if (!framework && document.querySelector('[data-framework]')) { + framework = document.querySelector('[data-framework]').dataset.framework; + } + + this.template = template; + + if (learnJSON.backend) { + this.frameworkJSON = learnJSON.backend; + this.frameworkJSON.issueLabel = framework; + this.append({ + backend: true + }); + } else if (learnJSON[framework]) { + this.frameworkJSON = learnJSON[framework]; + this.frameworkJSON.issueLabel = framework; + this.append(); + } + + this.fetchIssueCount(); + } + + Learn.prototype.append = function (opts) { + var aside = document.createElement('aside'); + aside.innerHTML = _.template(this.template, this.frameworkJSON); + aside.className = 'learn'; + + if (opts && opts.backend) { + // Remove demo link + var sourceLinks = aside.querySelector('.source-links'); + var heading = sourceLinks.firstElementChild; + var sourceLink = sourceLinks.lastElementChild; + // Correct link path + var href = sourceLink.getAttribute('href'); + sourceLink.setAttribute('href', href.substr(href.lastIndexOf('http'))); + sourceLinks.innerHTML = heading.outerHTML + sourceLink.outerHTML; + } else { + // Localize demo links + var demoLinks = aside.querySelectorAll('.demo-link'); + Array.prototype.forEach.call(demoLinks, function (demoLink) { + if (demoLink.getAttribute('href').substr(0, 4) !== 'http') { + demoLink.setAttribute('href', findRoot() + demoLink.getAttribute('href')); + } + }); + } + + document.body.className = (document.body.className + ' learn-bar').trim(); + document.body.insertAdjacentHTML('afterBegin', aside.outerHTML); + }; + + Learn.prototype.fetchIssueCount = function () { + var issueLink = document.getElementById('issue-count-link'); + if (issueLink) { + var url = issueLink.href.replace('https://github.com', 'https://api.github.com/repos'); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.onload = function (e) { + var parsedResponse = JSON.parse(e.target.responseText); + if (parsedResponse instanceof Array) { + var count = parsedResponse.length; + if (count !== 0) { + issueLink.innerHTML = 'This app has ' + count + ' open issues'; + document.getElementById('issue-count').style.display = 'inline'; + } + } + }; + xhr.send(); + } + }; + + redirect(); + getFile('learn.json', Learn); +})(); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/package.json b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/package.json new file mode 100644 index 0000000000..4018c19c64 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/package.json @@ -0,0 +1,55 @@ +{ + "_from": "todomvc-common@^1.0.4", + "_id": "todomvc-common@1.0.4", + "_inBundle": false, + "_integrity": "sha512-AA0Z4exovEqubhbZCrzzn9roVT4zvOncS319p2zIc4CsNe5B9TLL7Sei1NIV6d+WrgR5rOi+y0I9Y6GE7xgNOw==", + "_location": "/todomvc-common", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "todomvc-common@^1.0.4", + "name": "todomvc-common", + "escapedName": "todomvc-common", + "rawSpec": "^1.0.4", + "saveSpec": null, + "fetchSpec": "^1.0.4" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/todomvc-common/-/todomvc-common-1.0.4.tgz", + "_shasum": "23099af886c2f0525bfd4537e078f12d0074309e", + "_spec": "todomvc-common@^1.0.4", + "_where": "/Users/mathiasb/projects/WebKit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno", + "author": { + "name": "TasteJS" + }, + "bugs": { + "url": "https://github.com/tastejs/todomvc-common/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Common TodoMVC utilities used by our apps", + "files": [ + "base.js", + "base.css" + ], + "homepage": "https://github.com/tastejs/todomvc-common#readme", + "keywords": [ + "todomvc", + "tastejs", + "util", + "utilities" + ], + "license": "MIT", + "main": "base.js", + "name": "todomvc-common", + "repository": { + "type": "git", + "url": "git+https://github.com/tastejs/todomvc-common.git" + }, + "style": "base.css", + "version": "1.0.4" +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/readme.md b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/readme.md new file mode 100644 index 0000000000..7a5de5118f --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/node_modules/todomvc-common/readme.md @@ -0,0 +1,15 @@ +# todomvc-common + +> Common TodoMVC utilities used by our apps + + +## Install + +``` +$ npm install --save todomvc-common +``` + + +## License + +MIT © [TasteJS](http://tastejs.com) diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/package.json b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/package.json new file mode 100644 index 0000000000..4eae839713 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/package.json @@ -0,0 +1,24 @@ +{ + "private": true, + "scripts": { + "dev": "webpack-dev-server", + "build": "webpack -p", + "test": "cd test && npm test" + }, + "dependencies": { + "inferno": "beta32", + "inferno-component": "beta32", + "todomvc-app-css": "^2.1.0", + "todomvc-common": "^1.0.4" + }, + "devDependencies": { + "babel-core": "^6.5.2", + "babel-loader": "^6.2.1", + "babel-plugin-inferno": "beta13", + "babel-preset-es2015": "^6.5.0", + "babel-preset-es2015-loose": "^7.0.0", + "babel-preset-stage-0": "^6.5.0", + "webpack": "^1.12.14", + "webpack-dev-server": "^1.14.1" + } +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/base.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/base.js new file mode 100644 index 0000000000..89a2ca30c8 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/base.js @@ -0,0 +1,49 @@ +import Inferno from 'inferno'; +import { states } from './share'; + +/** + * Stateless Header component + */ +export function Head({onEnter}) { + return ( +
+

todos

+ +
+ ); +} + +export const links = [ + {hash: '#/', name: 'All'}, + {hash: '#/active', name: 'Active'}, + {hash: '#/completed', name: 'Completed'} +]; + +/** + * Stateless Footer component + */ +export function Foot({left, done, route, onClear}) { + return ( +
+ + { left } { left > 1 ? 'items' : 'item' } left + + + { done > 0 ? ( + + ) : null } +
+ ); +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/index.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/index.js new file mode 100644 index 0000000000..87414c0b38 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/index.js @@ -0,0 +1,112 @@ +import Inferno from 'inferno'; +import Component from 'inferno-component'; +import { ENTER, filters, read } from './share'; +import { Head, Foot } from './base'; +import Model from './model'; +import Item from './item'; + +const { render } = Inferno; +const model = new Model(); + +class App extends Component { + state = { + route: read(), + todos: model.get() + }; + + update = arr => this.setState({todos: arr}); + + componentWillMount = () => { + window.onhashchange = () => this.setState({route: read()}); + }; + + add = e => { + if (e.which !== ENTER) return; + + const val = e.target.value.trim(); + if (!val) return; + + e.target.value = ''; + this.update( + model.add(val) + ); + }; + + edit = (todo, val) => { + val = val.trim(); + if (val.length) { + this.update( + model.put(todo, {title: val, editing: 0}) + ); + } else { + this.remove(todo); + } + }; + + focus = todo => this.update( + model.put(todo, {editing: 1}) + ); + + blur = todo => this.update( + model.put(todo, {editing: 0}) + ); + + remove = todo => this.update( + model.del(todo) + ); + + toggleOne = todo => this.update( + model.toggle(todo) + ); + + toggleAll = ev => this.update( + model.toggleAll(ev.target.checked) + ); + + clearCompleted = () => this.update( + model.clearCompleted() + ); + + render(_, {todos, route}) { + const num = todos.length; + const shown = todos.filter(filters[route]); + const numDone = todos.filter(filters.completed).length; + const numAct = num - numDone; + + return ( +
+ + + { num ? ( +
+ + +
    + { + shown.map(t => + this.blur(t) } + onFocus={ () => this.focus(t) } + doDelete={ () => this.remove(t) } + doSave={ val => this.edit(t, val) } + doToggle={ () => this.toggleOne(t) } + /> + ) + } +
+
+ ) : null } + + { (numAct || numDone) ? ( + + ) : null } +
+ ) + } +} + +render(, document.getElementById('app')); diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/item.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/item.js new file mode 100644 index 0000000000..57f8b1d0e8 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/item.js @@ -0,0 +1,58 @@ +import Inferno from 'inferno'; +import Component from 'inferno-component'; +import { ESCAPE, ENTER, isEqual } from './share'; + +export default class Item extends Component { + constructor({data, ...props}) { + super(props); + this.todo = data; + this.state = {text: data.title}; + this.editor = null; + } + + componentWillReceiveProps = ({data}) => this.setText(data.title); + shouldComponentUpdate = ({data}, {text}) => !(isEqual(data, this.todo) && text === this.state.text); + componentWillUpdate = ({data}) => (this.todo = data); + componentDidUpdate = () => this.editor.focus(); + + setText = text => this.setState({text}); + + render({doToggle, doDelete, doSave, onBlur, onFocus}, {text}) { + const {title, completed, editing} = this.todo; + + const cls = []; + editing && cls.push('editing'); + completed && cls.push('completed'); + + const handleKeydown = e => { + if (e.which === ESCAPE) return onBlur(); + if (e.which === ENTER) return doSave(text); + }; + + // tmp fix + const handleBlur = () => doSave(text); + const handleInput = e => this.setText(e.target.value); + + return ( +
  • +
    + + + + + +
    + + { this.editor = el }} + value={ editing && text } + onblur={ handleBlur } + oninput={ handleInput } + onkeydown={ handleKeydown } + /> +
  • + ); + } +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/model.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/model.js new file mode 100644 index 0000000000..52eaf46635 --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/model.js @@ -0,0 +1,36 @@ +import { assign, isEqual } from './share'; + +const STOR = {}; +const STOR_ID = 'todos-inferno'; + +export default class Model { + get = () => (this.data = JSON.parse(STOR[STOR_ID] || '[]')) + + set = arr => { + this.data = arr || this.data || []; + STOR[STOR_ID] = JSON.stringify(this.data); + return this.data; + } + + add = str => this.set( + this.data.concat({title: str, completed: false}) + ) + + put = (todo, obj) => this.set( + this.data.map(t => isEqual(t, todo) ? assign(todo, obj) : t) + ) + + del = todo => this.set( + this.data.filter(t => !isEqual(t, todo)) + ) + + toggle = todo => this.put(todo, {completed: !todo.completed}) + + toggleAll = completed => this.set( + this.data.map(t => ({...t, completed})) + ) + + clearCompleted = () => this.set( + this.data.filter(t => !t.completed) + ) +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js new file mode 100644 index 0000000000..9e7d962b8f --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/src/share.js @@ -0,0 +1,58 @@ +/** + * Shared funcs/values + */ + +export const ENTER = 13; +export const ESCAPE = 27; + +export const filters = { + all: t => true, + active: t => !t.completed, + completed: t => t.completed +} + +/** + * Read the `location.hash` value + * @return {String} + */ +export function read() { + return location.hash.replace('#/', '') || 'all'; +} + +/** + * Modified `Object.assign` shim + * - always writes to new object + * @return {Object} + */ +export function assign() { + let src; + let tar = {}; + for (let s = 0; s < arguments.length; s++) { + src = Object(arguments[s]); + for (const k in src) { + tar[k] = src[k]; + } + } + return tar; +} + +/** + * Are two Objects equal values? + * @param {Object} a + * @param {Object} b + * @return {Boolean} + */ +export function isEqual(a, b) { + // Create arrays of property names + const aProps = Object.getOwnPropertyNames(a); + const bProps = Object.getOwnPropertyNames(b); + + if (aProps.length !== bProps.length) return false; + + for (let i = 0; i < aProps.length; i++) { + const k = aProps[i]; + if (a[k] !== b[k]) return false; + } + + return true; +} diff --git a/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/webpack.config.js b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/webpack.config.js new file mode 100644 index 0000000000..c7b3e6f7fd --- /dev/null +++ b/third_party/webkit/PerformanceTests/Speedometer/resources/todomvc/architecture-examples/inferno/webpack.config.js @@ -0,0 +1,31 @@ +const webpack = require('webpack'); + +module.exports = { + entry: './src/index.js', + output: { + path: './dist', + publicPath: 'dist', + filename: 'bundle.js' + }, + module: { + loaders: [{ + test: /\.jsx?$/, + exclude: /node_modules/, + loader: 'babel', + query: { + presets: ['es2015-loose', 'stage-0'], + plugins: ['syntax-jsx', 'inferno'] + } + }] + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify('production') + } + }), + ], + devServer: { + port: process.env.PORT || 8000 + } +}; -- cgit v1.2.3