diff --git a/packages/omim/demos/expansion/bundle.js b/packages/omim/demos/expansion/bundle.js index 4bce95f917..ee28a72641 100644 --- a/packages/omim/demos/expansion/bundle.js +++ b/packages/omim/demos/expansion/bundle.js @@ -94,7 +94,7 @@ /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar _a;\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__webpack_require__(/*! ../../src/expansion/index.tsx */ \"./src/expansion/index.tsx\");\nvar omi_1 = __webpack_require__(/*! omi */ \"./node_modules/_omi@6.6.5@omi/dist/omi.esm.js\");\nomi_1.define('my-app', (_a = /** @class */ (function (_super) {\n __extends(class_1, _super);\n function class_1() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.onClick = function () {\n _this.expand = !_this.expand;\n _this.update();\n };\n _this.expand = true;\n return _this;\n }\n class_1.prototype.render = function (props, data) {\n return (omi_1.h(\"div\", null,\n omi_1.h(\"button\", { onClick: this.onClick }, \"Toggle\"),\n omi_1.h(\"m-expansion\", { expand: this.expand },\n omi_1.h(\"div\", { style: \"width:100px;height:100px;background:green;\" }, Math.random())),\n omi_1.h(\"div\", null, \"Bottom\")));\n };\n return class_1;\n }(omi_1.WeElement)),\n _a.propTypes = {\n expand: Boolean\n },\n _a));\nomi_1.render(omi_1.h(\"my-app\", null), 'body');\n\n\n//# sourceURL=webpack:///./demos/expansion/index.js?"); +eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar _a;\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__webpack_require__(/*! ../../src/expansion/index.tsx */ \"./src/expansion/index.tsx\");\nvar omi_1 = __webpack_require__(/*! omi */ \"./node_modules/_omi@6.6.7@omi/dist/omi.esm.js\");\nomi_1.define('my-app', (_a = /** @class */ (function (_super) {\n __extends(class_1, _super);\n function class_1() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.onClick = function () {\n _this.expand = !_this.expand;\n _this.update();\n };\n _this.expand = true;\n return _this;\n }\n class_1.prototype.render = function (props, data) {\n return (omi_1.h(\"div\", null,\n omi_1.h(\"button\", { onClick: this.onClick }, \"Toggle\"),\n omi_1.h(\"m-expansion\", { expand: this.expand },\n omi_1.h(\"div\", { style: \"width:100px;height:100px;background:green;\" }, Math.random())),\n omi_1.h(\"div\", null, \"Bottom\")));\n };\n return class_1;\n }(omi_1.WeElement)),\n _a.propTypes = {\n expand: Boolean\n },\n _a));\nomi_1.render(omi_1.h(\"my-app\", null), 'body');\n\n\n//# sourceURL=webpack:///./demos/expansion/index.js?"); /***/ }), @@ -120,19 +120,19 @@ eval("/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAu /***/ }), -/***/ "./node_modules/_omi@6.6.5@omi/dist/omi.esm.js": +/***/ "./node_modules/_omi@6.6.7@omi/dist/omi.esm.js": /*!*****************************************************!*\ - !*** ./node_modules/_omi@6.6.5@omi/dist/omi.esm.js ***! + !*** ./node_modules/_omi@6.6.7@omi/dist/omi.esm.js ***! \*****************************************************/ /*! exports provided: default, tag, WeElement, Component, render, h, createElement, options, define, observe, cloneElement, getHost, rpx, tick, nextTick, ModelView, defineElement, classNames, extractClass, createRef, html, htm, o, elements */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"tag\", function() { return tag; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WeElement\", function() { return WeElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Component\", function() { return Component; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"h\", function() { return h; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createElement\", function() { return h; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"options\", function() { return options; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"define\", function() { return define; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"observe\", function() { return observe; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"cloneElement\", function() { return cloneElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getHost\", function() { return getHost; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rpx\", function() { return rpx; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"tick\", function() { return tick; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"nextTick\", function() { return nextTick; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ModelView\", function() { return ModelView; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defineElement\", function() { return defineElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"classNames\", function() { return classNames; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractClass\", function() { return extractClass; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createRef\", function() { return createRef; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"html\", function() { return html; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"htm\", function() { return htm; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"o\", function() { return o; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"elements\", function() { return elements; });\n/**\n * omi v6.6.5 http://omijs.org\n * Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.\n * By dntzhang https://github.com/dntzhang\n * Github: https://github.com/Tencent/omi\n * MIT Licensed.\n */\n\n/** Virtual DOM Node */\nfunction VNode() {}\n\nfunction getGlobal() {\n if (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\n return self || window || global || function () {\n return this;\n }();\n }\n return global;\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nvar options = {\n store: null,\n root: getGlobal(),\n mapping: {}\n};\n\nvar stack = [];\n\nfunction h(nodeName, attributes) {\n var children = [],\n lastSimple,\n child,\n simple,\n i;\n for (i = arguments.length; i-- > 2;) {\n stack.push(arguments[i]);\n }\n if (attributes && attributes.children != null) {\n if (!stack.length) stack.push(attributes.children);\n delete attributes.children;\n }\n while (stack.length) {\n if ((child = stack.pop()) && child.pop !== undefined) {\n for (i = child.length; i--;) {\n stack.push(child[i]);\n }\n } else {\n if (typeof child === 'boolean') child = null;\n\n if (simple = typeof nodeName !== 'function') {\n if (child == null) child = '';else if (typeof child === 'number') child = String(child);else if (typeof child !== 'string') simple = false;\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child;\n } else if (children.length === 0) {\n children = [child];\n } else {\n children.push(child);\n }\n\n lastSimple = simple;\n }\n }\n\n var p = new VNode();\n p.nodeName = nodeName;\n p.children = children;\n p.attributes = attributes == null ? undefined : attributes;\n p.key = attributes == null ? undefined : attributes.key;\n\n // if a \"vnode hook\" is defined, pass every created VNode to it\n if (options.vnode !== undefined) options.vnode(p);\n\n return p;\n}\n\n/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n(function () {\n if (\n // No Reflect, no classes, no need for shim because native custom elements\n // require ES2015 classes or Reflect.\n window.Reflect === undefined || window.customElements === undefined ||\n // The webcomponentsjs custom elements polyfill doesn't require\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')) {\n return;\n }\n var BuiltInHTMLElement = HTMLElement;\n window.HTMLElement = function HTMLElement() {\n return Reflect.construct(BuiltInHTMLElement, [], this.constructor);\n };\n HTMLElement.prototype = BuiltInHTMLElement.prototype;\n HTMLElement.prototype.constructor = HTMLElement;\n Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);\n})();\n\nfunction cssToDom(css) {\n var node = document.createElement('style');\n node.textContent = css;\n return node;\n}\n\nfunction npn(str) {\n return str.replace(/-(\\w)/g, function ($, $1) {\n return $1.toUpperCase();\n });\n}\n\nfunction extend(obj, props) {\n for (var i in props) {\n obj[i] = props[i];\n }return obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nfunction applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value);else ref.current = value;\n }\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nvar defer = typeof Promise == 'function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n\nfunction isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n}\n\nfunction nProps(props) {\n if (!props || isArray(props)) return {};\n var result = {};\n Object.keys(props).forEach(function (key) {\n result[key] = props[key].value;\n });\n return result;\n}\n\nfunction getUse(data, paths) {\n var obj = [];\n paths.forEach(function (path, index) {\n var isPath = typeof path === 'string';\n if (isPath) {\n obj[index] = getTargetByPath(data, path);\n } else {\n var key = Object.keys(path)[0];\n var value = path[key];\n if (typeof value === 'string') {\n obj[index] = getTargetByPath(data, value);\n } else {\n var tempPath = value[0];\n if (typeof tempPath === 'string') {\n var tempVal = getTargetByPath(data, tempPath);\n obj[index] = value[1] ? value[1](tempVal) : tempVal;\n } else {\n var args = [];\n tempPath.forEach(function (path) {\n args.push(getTargetByPath(data, path));\n });\n obj[index] = value[1].apply(null, args);\n }\n }\n obj[key] = obj[index];\n }\n });\n return obj;\n}\n\nfunction getTargetByPath(origin, path) {\n var arr = path.replace(/]/g, '').replace(/\\[/g, '.').split('.');\n var current = origin;\n for (var i = 0, len = arr.length; i < len; i++) {\n current = current[arr[i]];\n }\n return current;\n}\n\nvar hyphenateRE = /\\B([A-Z])/g;\nfunction hyphenate(str) {\n return str.replace(hyphenateRE, '-$1').toLowerCase();\n}\n\n// DOM properties that should NOT have \"px\" added when numeric\nvar IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n/**\n * Check if two nodes are equivalent.\n *\n * @param {Node} node\t\t\tDOM Node to compare\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\n * @private\n */\nfunction isSameNodeType(node, vnode, hydrating) {\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n return node.splitText !== undefined;\n }\n if (typeof vnode.nodeName === 'string') {\n return !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n } else if (typeof vnode.nodeName === 'function') {\n return options.mapping[node.nodeName.toLowerCase()] === vnode.nodeName;\n }\n return hydrating || node._componentConstructor === vnode.nodeName;\n}\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n *\n * @param {Element} node\tA DOM Element to inspect the name of.\n * @param {String} nodeName\tUnnormalized name to compare against.\n */\nfunction isNamedNode(node, nodeName) {\n return node.normalizedNodeName === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase();\n}\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {Element} The created DOM node\n */\nfunction createNode(nodeName, isSvg) {\n /** @type {Element} */\n var node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n node.normalizedNodeName = nodeName;\n return node;\n}\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nfunction removeNode(node) {\n var parentNode = node.parentNode;\n if (parentNode) parentNode.removeChild(node);\n}\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {Element} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nfunction setAccessor(node, name, old, value, isSvg) {\n if (name === 'className') name = 'class';\n\n if (name === 'key') {\n // ignore\n } else if (name === 'ref') {\n applyRef(old, null);\n applyRef(value, node);\n } else if (name === 'class' && !isSvg) {\n node.className = value || '';\n } else if (name === 'style') {\n if (!value || typeof value === 'string' || typeof old === 'string') {\n node.style.cssText = value || '';\n }\n if (value && typeof value === 'object') {\n if (typeof old !== 'string') {\n for (var i in old) {\n if (!(i in value)) node.style[i] = '';\n }\n }\n for (var i in value) {\n node.style[i] = typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false ? value[i] + 'px' : value[i];\n }\n }\n } else if (name === 'dangerouslySetInnerHTML') {\n if (value) node.innerHTML = value.__html || '';\n } else if (name[0] == 'o' && name[1] == 'n') {\n var useCapture = name !== (name = name.replace(/Capture$/, ''));\n name = name.toLowerCase().substring(2);\n if (value) {\n if (!old) {\n node.addEventListener(name, eventProxy, useCapture);\n if (name == 'tap') {\n node.addEventListener('touchstart', touchStart, useCapture);\n node.addEventListener('touchend', touchEnd, useCapture);\n }\n }\n } else {\n node.removeEventListener(name, eventProxy, useCapture);\n if (name == 'tap') {\n node.removeEventListener('touchstart', touchStart, useCapture);\n node.removeEventListener('touchend', touchEnd, useCapture);\n }\n }\n(node._listeners || (node._listeners = {}))[name] = value;\n } else if (name !== 'list' && name !== 'type' && name !== 'css' && !isSvg && name in node && value !== '') {\n //value !== '' fix for selected, disabled, checked with pure element\n // Attempt to set a DOM property to the given value.\n // IE & FF throw for certain property-value combinations.\n try {\n node[name] = value == null ? '' : value;\n } catch (e) {}\n if ((value == null || value === false) && name != 'spellcheck') node.pureRemoveAttribute ? node.pureRemoveAttribute(name) : node.removeAttribute(name);\n } else {\n var ns = isSvg && name !== (name = name.replace(/^xlink:?/, ''));\n // spellcheck is treated differently than all other boolean values and\n // should not be removed when the value is `false`. See:\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n if (value == null || value === false) {\n if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());else node.pureRemoveAttribute ? node.pureRemoveAttribute(name) : node.removeAttribute(name);\n } else if (typeof value !== 'function') {\n if (ns) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n } else {\n node.pureSetAttribute ? node.pureSetAttribute(name, value) : node.setAttribute(name, value);\n }\n }\n }\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n return this._listeners[e.type](options.event && options.event(e) || e);\n}\n\nfunction touchStart(e) {\n this.___touchX = e.touches[0].pageX;\n this.___touchY = e.touches[0].pageY;\n this.___scrollTop = document.body.scrollTop;\n}\n\nfunction touchEnd(e) {\n if (Math.abs(e.changedTouches[0].pageX - this.___touchX) < 30 && Math.abs(e.changedTouches[0].pageY - this.___touchY) < 30 && Math.abs(document.body.scrollTop - this.___scrollTop) < 30) {\n this.dispatchEvent(new CustomEvent('tap', { detail: e }));\n }\n}\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nvar diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nvar isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nvar hydrating = false;\n\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\n *\t@returns {Element} dom\t\t\tThe created/mutated element\n *\t@private\n */\nfunction diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n var ret;\n if (!diffLevel++) {\n // when first starting the diff, check if we're diffing an SVG or within an SVG\n isSvgMode = parent != null && parent.ownerSVGElement !== undefined;\n\n // hydration is indicated by the existing element to be diffed not having a prop cache\n hydrating = dom != null && !('__omiattr_' in dom);\n }\n if (isArray(vnode)) {\n if (parent) {\n var styles = parent.querySelectorAll('style');\n styles.forEach(function (s) {\n parent.removeChild(s);\n });\n innerDiffNode(parent, vnode);\n\n for (var i = styles.length - 1; i >= 0; i--) {\n parent.firstChild ? parent.insertBefore(styles[i], parent.firstChild) : parent.appendChild(style[i]);\n }\n } else {\n\n ret = [];\n vnode.forEach(function (item, index) {\n var ele = idiff(index === 0 ? dom : null, item, context, mountAll, componentRoot);\n ret.push(ele);\n parent && parent.appendChild(ele);\n });\n }\n } else {\n if (isArray(dom)) {\n dom.forEach(function (one, index) {\n if (index === 0) {\n ret = idiff(one, vnode, context, mountAll, componentRoot);\n } else {\n recollectNodeTree(one, false);\n }\n });\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot);\n }\n // append the element if its a new parent\n if (parent && ret.parentNode !== parent) parent.appendChild(ret);\n }\n\n // diffLevel being reduced to 0 means we're exiting the diff\n if (! --diffLevel) {\n hydrating = false;\n // invoke queued componentDidMount lifecycle methods\n }\n\n return ret;\n}\n\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\n if (dom && vnode && dom.props) {\n dom.props.children = vnode.children;\n }\n var out = dom,\n prevSvgMode = isSvgMode;\n\n // empty values (null, undefined, booleans) render as empty Text nodes\n if (vnode == null || typeof vnode === 'boolean') vnode = '';\n\n // Fast case: Strings & Numbers create/update Text nodes.\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n // update if it's already a Text node:\n if (dom && dom.splitText !== undefined && dom.parentNode && (!dom._component || componentRoot)) {\n /* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n if (dom.nodeValue != vnode) {\n dom.nodeValue = vnode;\n }\n } else {\n // it wasn't a Text node: replace it with one and recycle the old Element\n out = document.createTextNode(vnode);\n if (dom) {\n if (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n recollectNodeTree(dom, true);\n }\n }\n\n out['__omiattr_'] = true;\n\n return out;\n }\n\n // If the VNode represents a Component, perform a component diff:\n var vnodeName = vnode.nodeName;\n if (typeof vnodeName === 'function') {\n for (var key in options.mapping) {\n if (options.mapping[key] === vnodeName) {\n vnodeName = key;\n vnode.nodeName = key;\n break;\n }\n }\n }\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode = vnodeName === 'svg' ? true : vnodeName === 'foreignObject' ? false : isSvgMode;\n\n // If there's no existing element or it's the wrong type, create a new one:\n vnodeName = String(vnodeName);\n if (!dom || !isNamedNode(dom, vnodeName)) {\n out = createNode(vnodeName, isSvgMode);\n\n if (dom) {\n // move children into the replacement node\n while (dom.firstChild) {\n out.appendChild(dom.firstChild);\n } // if the previous Element was mounted into the DOM, replace it inline\n if (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n // recycle the old element (skips non-Element node types)\n recollectNodeTree(dom, true);\n }\n }\n\n var fc = out.firstChild,\n props = out['__omiattr_'],\n vchildren = vnode.children;\n\n if (props == null) {\n props = out['__omiattr_'] = {};\n for (var a = out.attributes, i = a.length; i--;) {\n props[a[i].name] = a[i].value;\n }\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (!hydrating && vchildren && vchildren.length === 1 && typeof vchildren[0] === 'string' && fc != null && fc.splitText !== undefined && fc.nextSibling == null) {\n if (fc.nodeValue != vchildren[0]) {\n fc.nodeValue = vchildren[0];\n }\n }\n // otherwise, if there are existing or new children, diff them:\n else if (vchildren && vchildren.length || fc != null) {\n if (!(out.constructor.is == 'WeElement' && out.constructor.noSlot)) {\n innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null);\n }\n }\n\n // Apply attributes/props from VNode to the DOM Element:\n diffAttributes(out, vnode.attributes, props);\n if (out.props) {\n out.props.children = vnode.children;\n }\n // restore previous SVG mode: (in case we're exiting an SVG namespace)\n isSvgMode = prevSvgMode;\n\n return out;\n}\n\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\n *\t@param {Boolean} mountAll\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\n var originalChildren = dom.childNodes,\n children = [],\n keyed = {},\n keyedLen = 0,\n min = 0,\n len = originalChildren.length,\n childrenLen = 0,\n vlen = vchildren ? vchildren.length : 0,\n j,\n c,\n f,\n vchild,\n child;\n\n // Build up a map of keyed children and an Array of unkeyed children:\n if (len !== 0) {\n for (var i = 0; i < len; i++) {\n var _child = originalChildren[i],\n props = _child['__omiattr_'],\n key = vlen && props ? _child._component ? _child._component.__key : props.key : null;\n if (key != null) {\n keyedLen++;\n keyed[key] = _child;\n } else if (props || (_child.splitText !== undefined ? isHydrating ? _child.nodeValue.trim() : true : isHydrating)) {\n children[childrenLen++] = _child;\n }\n }\n }\n\n if (vlen !== 0) {\n for (var i = 0; i < vlen; i++) {\n vchild = vchildren[i];\n child = null;\n\n // attempt to find a node based on key matching\n var key = vchild.key;\n if (key != null) {\n if (keyedLen && keyed[key] !== undefined) {\n child = keyed[key];\n keyed[key] = undefined;\n keyedLen--;\n }\n }\n // attempt to pluck a node of the same type from the existing children\n else if (!child && min < childrenLen) {\n for (j = min; j < childrenLen; j++) {\n if (children[j] !== undefined && isSameNodeType(c = children[j], vchild, isHydrating)) {\n child = c;\n children[j] = undefined;\n if (j === childrenLen - 1) childrenLen--;\n if (j === min) min++;\n break;\n }\n }\n }\n\n // morph the matched/found/created DOM child to match vchild (deep)\n child = idiff(child, vchild, context, mountAll);\n\n f = originalChildren[i];\n if (child && child !== dom && child !== f) {\n if (f == null) {\n dom.appendChild(child);\n } else if (child === f.nextSibling) {\n removeNode(f);\n } else {\n dom.insertBefore(child, f);\n }\n }\n }\n }\n\n // remove unused keyed children:\n if (keyedLen) {\n for (var i in keyed) {\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false);\n }\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined) recollectNodeTree(child, false);\n }\n}\n\n/** Recursively recycle (or just unmount) a node and its descendants.\n *\t@param {Node} node\t\t\t\t\t\tDOM node to start unmount/removal from\n *\t@param {Boolean} [unmountOnly=false]\tIf `true`, only triggers unmount lifecycle, skips removal\n */\nfunction recollectNodeTree(node, unmountOnly) {\n // If the node's VNode had a ref function, invoke it with null here.\n // (this is part of the React spec, and smart for unsetting references)\n if (node['__omiattr_'] != null && node['__omiattr_'].ref) {\n if (typeof node['__omiattr_'].ref === 'function') {\n node['__omiattr_'].ref(null);\n } else if (node['__omiattr_'].ref.current) {\n node['__omiattr_'].ref.current = null;\n }\n }\n\n if (unmountOnly === false || node['__omiattr_'] == null) {\n removeNode(node);\n }\n\n removeChildren(node);\n}\n\n/** Recollect/unmount all children.\n *\t- we use .lastChild here because it causes less reflow than .firstChild\n *\t- it's also cheaper than accessing the .childNodes Live NodeList\n */\nfunction removeChildren(node) {\n node = node.lastChild;\n while (node) {\n var next = node.previousSibling;\n recollectNodeTree(node, true);\n node = next;\n }\n}\n\n/** Apply differences in attributes from a VNode to the given DOM Element.\n *\t@param {Element} dom\t\tElement with attributes to diff `attrs` against\n *\t@param {Object} attrs\t\tThe desired end-state key-value attribute pairs\n *\t@param {Object} old\t\t\tCurrent/previous attributes (from previous VNode or element's prop cache)\n */\nfunction diffAttributes(dom, attrs, old) {\n var name;\n var update = false;\n var isWeElement = dom.update;\n var oldClone;\n if (dom.receiveProps) {\n oldClone = Object.assign({}, old);\n }\n // remove attributes no longer present on the vnode by setting them to undefined\n for (name in old) {\n if (!(attrs && attrs[name] != null) && old[name] != null) {\n setAccessor(dom, name, old[name], old[name] = undefined, isSvgMode);\n if (isWeElement) {\n delete dom.props[name];\n update = true;\n }\n }\n }\n\n // add new & update changed attributes\n for (name in attrs) {\n if (isWeElement && typeof attrs[name] === 'object' && name !== 'ref') {\n if (name === 'style') {\n setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);\n }\n if (dom.receiveProps) {\n try {\n old[name] = JSON.parse(JSON.stringify(attrs[name]));\n } catch (e) {\n console.warn('When using receiveProps, you cannot pass prop of cyclic dependencies down.');\n }\n }\n dom.props[npn(name)] = attrs[name];\n update = true;\n } else if (name !== 'children' && name !== 'innerHTML' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) {\n setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);\n if (isWeElement) {\n dom.props[npn(name)] = attrs[name];\n update = true;\n }\n }\n }\n\n if (isWeElement && dom.parentNode) {\n //__hasChildren is not accuracy when it was empty at first, so add dom.children.length > 0 condition\n if (update || dom.__hasChildren || dom.children.length > 0 || dom.store && !dom.store.data) {\n if (dom.receiveProps(dom.props, dom.data, oldClone) !== false) {\n dom.update();\n }\n }\n }\n}\n\n/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nvar JSONPatcherProxy = function () {\n /**\n * Deep clones your object and returns a new object.\n */\n function deepClone(obj) {\n switch (typeof obj) {\n case 'object':\n return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n case 'undefined':\n return null; //this is how JSON.stringify behaves for array items\n default:\n return obj; //no need to clone primitives\n }\n }\n JSONPatcherProxy.deepClone = deepClone;\n\n function escapePathComponent(str) {\n if (str.indexOf('/') == -1 && str.indexOf('~') == -1) return str;\n return str.replace(/~/g, '~0').replace(/\\//g, '~1');\n }\n JSONPatcherProxy.escapePathComponent = escapePathComponent;\n\n /**\n * Walk up the parenthood tree to get the path\n * @param {JSONPatcherProxy} instance\n * @param {Object} obj the object you need to find its path\n */\n function findObjectPath(instance, obj) {\n var pathComponents = [];\n var parentAndPath = instance.parenthoodMap.get(obj);\n while (parentAndPath && parentAndPath.path) {\n // because we're walking up-tree, we need to use the array as a stack\n pathComponents.unshift(parentAndPath.path);\n parentAndPath = instance.parenthoodMap.get(parentAndPath.parent);\n }\n if (pathComponents.length) {\n var path = pathComponents.join('/');\n return '/' + path;\n }\n return '';\n }\n /**\n * A callback to be used as th proxy set trap callback.\n * It updates parenthood map if needed, proxifies nested newly-added objects, calls default callbacks with the changes occurred.\n * @param {JSONPatcherProxy} instance JSONPatcherProxy instance\n * @param {Object} target the affected object\n * @param {String} key the effect property's name\n * @param {Any} newValue the value being set\n */\n function setTrap(instance, target, key, newValue) {\n var parentPath = findObjectPath(instance, target);\n\n var destinationPropKey = parentPath + '/' + escapePathComponent(key);\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n var newValueOriginalObject = instance.proxifiedObjectsMap.get(newValue);\n\n instance.parenthoodMap.set(newValueOriginalObject.originalObject, {\n parent: target,\n path: key\n });\n }\n /*\n mark already proxified values as inherited.\n rationale: proxy.arr.shift()\n will emit\n {op: replace, path: '/arr/1', value: arr_2}\n {op: remove, path: '/arr/2'}\n by default, the second operation would revoke the proxy, and this renders arr revoked.\n That's why we need to remember the proxies that are inherited.\n */\n var revokableInstance = instance.proxifiedObjectsMap.get(newValue);\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n We need to make sure we mark revokables as inherited ONLY when we're observing,\n because throughout the first proxification, a sub-object is proxified and then assigned to\n its parent object. This assignment of a pre-proxified object can fool us into thinking\n that it's a proxified object moved around, while in fact it's the first assignment ever.\n Checking isProxifyingTreeNow ensures this is not happening in the first proxification,\n but in fact is is a proxified object moved around the tree\n */\n if (revokableInstance && !instance.isProxifyingTreeNow) {\n revokableInstance.inherited = true;\n }\n\n // if the new value is an object, make sure to watch it\n if (newValue && typeof newValue == 'object' && !instance.proxifiedObjectsMap.has(newValue)) {\n instance.parenthoodMap.set(newValue, {\n parent: target,\n path: key\n });\n newValue = instance._proxifyObjectTreeRecursively(target, newValue, key);\n }\n // let's start with this operation, and may or may not update it later\n var operation = {\n op: 'remove',\n path: destinationPropKey\n };\n if (typeof newValue == 'undefined') {\n // applying De Morgan's laws would be a tad faster, but less readable\n if (!Array.isArray(target) && !target.hasOwnProperty(key)) {\n // `undefined` is being set to an already undefined value, keep silent\n return Reflect.set(target, key, newValue);\n }\n // when array element is set to `undefined`, should generate replace to `null`\n if (Array.isArray(target)) {\noperation.op = 'replace', operation.value = null;\n }\n var oldValue = instance.proxifiedObjectsMap.get(target[key]);\n // was the deleted a proxified object?\n if (oldValue) {\n instance.parenthoodMap.delete(target[key]);\n instance.disableTrapsForProxy(oldValue);\n instance.proxifiedObjectsMap.delete(oldValue);\n }\n } else {\n if (Array.isArray(target) && !Number.isInteger(+key.toString())) {\n /* array props (as opposed to indices) don't emit any patches, to avoid needless `length` patches */\n if (key != 'length') {\n console.warn('JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch');\n }\n return Reflect.set(target, key, newValue);\n }\n operation.op = 'add';\n if (target.hasOwnProperty(key)) {\n if (typeof target[key] !== 'undefined' || Array.isArray(target)) {\n operation.op = 'replace'; // setting `undefined` array elements is a `replace` op\n }\n }\n operation.value = newValue;\n }\n operation.oldValue = target[key];\n var reflectionResult = Reflect.set(target, key, newValue);\n instance.defaultCallback(operation);\n return reflectionResult;\n }\n /**\n * A callback to be used as th proxy delete trap callback.\n * It updates parenthood map if needed, calls default callbacks with the changes occurred.\n * @param {JSONPatcherProxy} instance JSONPatcherProxy instance\n * @param {Object} target the effected object\n * @param {String} key the effected property's name\n */\n function deleteTrap(instance, target, key) {\n if (typeof target[key] !== 'undefined') {\n var parentPath = findObjectPath(instance, target);\n var destinationPropKey = parentPath + '/' + escapePathComponent(key);\n\n var revokableProxyInstance = instance.proxifiedObjectsMap.get(target[key]);\n\n if (revokableProxyInstance) {\n if (revokableProxyInstance.inherited) {\n /*\n this is an inherited proxy (an already proxified object that was moved around),\n we shouldn't revoke it, because even though it was removed from path1, it is still used in path2.\n And we know that because we mark moved proxies with `inherited` flag when we move them\n it is a good idea to remove this flag if we come across it here, in deleteProperty trap.\n We DO want to revoke the proxy if it was removed again.\n */\n revokableProxyInstance.inherited = false;\n } else {\n instance.parenthoodMap.delete(revokableProxyInstance.originalObject);\n instance.disableTrapsForProxy(revokableProxyInstance);\n instance.proxifiedObjectsMap.delete(target[key]);\n }\n }\n var reflectionResult = Reflect.deleteProperty(target, key);\n\n instance.defaultCallback({\n op: 'remove',\n path: destinationPropKey\n });\n\n return reflectionResult;\n }\n }\n /* pre-define resume and pause functions to enhance constructors performance */\n function resume() {\n var _this = this;\n\n this.defaultCallback = function (operation) {\n _this.isRecording && _this.patches.push(operation);\n _this.userCallback && _this.userCallback(operation);\n };\n this.isObserving = true;\n }\n function pause() {\n this.defaultCallback = function () {};\n this.isObserving = false;\n }\n /**\n * Creates an instance of JSONPatcherProxy around your object of interest `root`.\n * @param {Object|Array} root - the object you want to wrap\n * @param {Boolean} [showDetachedWarning = true] - whether to log a warning when a detached sub-object is modified @see {@link https://github.com/Palindrom/JSONPatcherProxy#detached-objects}\n * @returns {JSONPatcherProxy}\n * @constructor\n */\n function JSONPatcherProxy(root, showDetachedWarning) {\n this.isProxifyingTreeNow = false;\n this.isObserving = false;\n this.proxifiedObjectsMap = new Map();\n this.parenthoodMap = new Map();\n // default to true\n if (typeof showDetachedWarning !== 'boolean') {\n showDetachedWarning = true;\n }\n\n this.showDetachedWarning = showDetachedWarning;\n this.originalObject = root;\n this.cachedProxy = null;\n this.isRecording = false;\n this.userCallback;\n /**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n this.resume = resume.bind(this);\n /**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n this.pause = pause.bind(this);\n }\n\n JSONPatcherProxy.prototype.generateProxyAtPath = function (parent, obj, path) {\n var _this2 = this;\n\n if (!obj) {\n return obj;\n }\n var traps = {\n set: function set(target, key, value, receiver) {\n return setTrap(_this2, target, key, value, receiver);\n },\n deleteProperty: function deleteProperty(target, key) {\n return deleteTrap(_this2, target, key);\n }\n };\n var revocableInstance = Proxy.revocable(obj, traps);\n // cache traps object to disable them later.\n revocableInstance.trapsInstance = traps;\n revocableInstance.originalObject = obj;\n\n /* keeping track of object's parent and path */\n\n this.parenthoodMap.set(obj, { parent: parent, path: path });\n\n /* keeping track of all the proxies to be able to revoke them later */\n this.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance);\n return revocableInstance.proxy;\n };\n // grab tree's leaves one by one, encapsulate them into a proxy and return\n JSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function (parent, root, path) {\n for (var key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(root, root[key], escapePathComponent(key));\n }\n }\n }\n return this.generateProxyAtPath(parent, root, path);\n };\n // this function is for aesthetic purposes\n JSONPatcherProxy.prototype.proxifyObjectTree = function (root) {\n /*\n while proxyifying object tree,\n the proxyifying operation itself is being\n recorded, which in an unwanted behavior,\n that's why we disable recording through this\n initial process;\n */\n this.pause();\n this.isProxifyingTreeNow = true;\n var proxifiedObject = this._proxifyObjectTreeRecursively(undefined, root, '');\n /* OK you can record now */\n this.isProxifyingTreeNow = false;\n this.resume();\n return proxifiedObject;\n };\n /**\n * Turns a proxified object into a forward-proxy object; doesn't emit any patches anymore, like a normal object\n * @param {Proxy} proxy - The target proxy object\n */\n JSONPatcherProxy.prototype.disableTrapsForProxy = function (revokableProxyInstance) {\n if (this.showDetachedWarning) {\n var message = \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\";\n\n revokableProxyInstance.trapsInstance.set = function (targetObject, propKey, newValue) {\n console.warn(message);\n return Reflect.set(targetObject, propKey, newValue);\n };\n revokableProxyInstance.trapsInstance.set = function (targetObject, propKey, newValue) {\n console.warn(message);\n return Reflect.set(targetObject, propKey, newValue);\n };\n revokableProxyInstance.trapsInstance.deleteProperty = function (targetObject, propKey) {\n return Reflect.deleteProperty(targetObject, propKey);\n };\n } else {\n delete revokableProxyInstance.trapsInstance.set;\n delete revokableProxyInstance.trapsInstance.get;\n delete revokableProxyInstance.trapsInstance.deleteProperty;\n }\n };\n /**\n * Proxifies the object that was passed in the constructor and returns a proxified mirror of it. Even though both parameters are options. You need to pass at least one of them.\n * @param {Boolean} [record] - whether to record object changes to a later-retrievable patches array.\n * @param {Function} [callback] - this will be synchronously called with every object change with a single `patch` as the only parameter.\n */\n JSONPatcherProxy.prototype.observe = function (record, callback) {\n if (!record && !callback) {\n throw new Error('You need to either record changes or pass a callback');\n }\n this.isRecording = record;\n this.userCallback = callback;\n /*\n I moved it here to remove it from `unobserve`,\n this will also make the constructor faster, why initiate\n the array before they decide to actually observe with recording?\n They might need to use only a callback.\n */\n if (record) this.patches = [];\n this.cachedProxy = this.proxifyObjectTree(this.originalObject);\n return this.cachedProxy;\n };\n /**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n JSONPatcherProxy.prototype.generate = function () {\n if (!this.isRecording) {\n throw new Error('You should set record to true to get patches later');\n }\n return this.patches.splice(0, this.patches.length);\n };\n /**\n * Revokes all proxies rendering the observed object useless and good for garbage collection @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/revocable}\n */\n JSONPatcherProxy.prototype.revoke = function () {\n this.proxifiedObjectsMap.forEach(function (el) {\n el.revoke();\n });\n };\n /**\n * Disables all proxies' traps, turning the observed object into a forward-proxy object, like a normal object that you can modify silently.\n */\n JSONPatcherProxy.prototype.disableTraps = function () {\n this.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this);\n };\n return JSONPatcherProxy;\n}();\n\nvar callbacks = [];\nvar nextTickCallback = [];\n\nfunction tick(fn, scope) {\n callbacks.push({ fn: fn, scope: scope });\n}\n\nfunction fireTick() {\n callbacks.forEach(function (item) {\n item.fn.call(item.scope);\n });\n\n nextTickCallback.forEach(function (nextItem) {\n nextItem.fn.call(nextItem.scope);\n });\n nextTickCallback.length = 0;\n}\n\nfunction nextTick(fn, scope) {\n nextTickCallback.push({ fn: fn, scope: scope });\n}\n\nfunction observe(target) {\n target.observe = true;\n}\n\nfunction proxyUpdate(ele) {\n var timeout = null;\n ele.data = new JSONPatcherProxy(ele.data).observe(false, function () {\n if (ele._willUpdate) {\n return;\n }\n if (ele.constructor.mergeUpdate) {\n clearTimeout(timeout);\n\n timeout = setTimeout(function () {\n ele.update();\n fireTick();\n }, 0);\n } else {\n ele.update();\n fireTick();\n }\n });\n}\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nfunction define(name, ctor) {\n if (ctor.is === 'WeElement') {\n if (options.mapping[name]) {\n // if(options.mapping[name] === ctor){\n // console.warn(`You redefine custom elements named [${name}], redundant JS files may be referenced.`)\n // } else {\n // console.warn(`This custom elements name [${name}] has already been used, please rename it.`)\n // }\n return;\n }\n customElements.define(name, ctor);\n options.mapping[name] = ctor;\n if (ctor.use) {\n ctor.updatePath = getPath(ctor.use);\n } else if (ctor.data) {\n //Compatible with older versions\n ctor.updatePath = getUpdatePath(ctor.data);\n }\n } else {\n var Element = function (_WeElement) {\n _inherits(Element, _WeElement);\n\n function Element() {\n var _temp, _this, _ret;\n\n _classCallCheck(this, Element);\n\n for (var _len = arguments.length, args = Array(_len), key = 0; key < _len; key++) {\n args[key] = arguments[key];\n }\n\n return _ret = (_temp = (_this = _possibleConstructorReturn(this, _WeElement.call.apply(_WeElement, [this].concat(args))), _this), _this._useId = 0, _this._useMap = {}, _this._preCss = null, _temp), _possibleConstructorReturn(_this, _ret);\n }\n\n Element.prototype.render = function render(props, data) {\n return ctor.call(this, props, data);\n };\n\n Element.prototype.beforeRender = function beforeRender() {\n this._useId = 0;\n };\n\n Element.prototype.useCss = function useCss(css) {\n if (css === this._preCss) {\n return;\n }\n this._preCss = css;\n var style = this.shadowRoot.querySelector('style');\n style && this.shadowRoot.removeChild(style);\n this.shadowRoot.appendChild(cssToDom(css));\n };\n\n Element.prototype.useData = function useData(data) {\n return this.use({ data: data });\n };\n\n Element.prototype.use = function use(option) {\n var _this2 = this;\n\n this._useId++;\n var updater = function updater(newValue) {\n var item = _this2._useMap[updater.id];\n\n item.data = newValue;\n\n _this2.update();\n item.effect && item.effect();\n };\n\n updater.id = this._useId;\n if (!this._isInstalled) {\n this._useMap[this._useId] = option;\n return [option.data, updater];\n }\n\n return [this._useMap[this._useId].data, updater];\n };\n\n Element.prototype.installed = function installed() {\n this._isInstalled = true;\n };\n\n return Element;\n }(WeElement);\n\n customElements.define(name, Element);\n }\n}\n\nfunction getPath(obj) {\n if (Object.prototype.toString.call(obj) === '[object Array]') {\n var result = {};\n obj.forEach(function (item) {\n if (typeof item === 'string') {\n result[item] = true;\n } else {\n var tempPath = item[Object.keys(item)[0]];\n if (typeof tempPath === 'string') {\n result[tempPath] = true;\n } else {\n if (typeof tempPath[0] === 'string') {\n result[tempPath[0]] = true;\n } else {\n tempPath[0].forEach(function (path) {\n return result[path] = true;\n });\n }\n }\n }\n });\n return result;\n } else {\n return getUpdatePath(obj);\n }\n}\n\nfunction getUpdatePath(data) {\n var result = {};\n dataToPath(data, result);\n return result;\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(function (key) {\n result[key] = true;\n var type = Object.prototype.toString.call(data[key]);\n if (type === '[object Object]') {\n _objToPath(data[key], key, result);\n } else if (type === '[object Array]') {\n _arrayToPath(data[key], key, result);\n }\n });\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(function (key) {\n result[path + '.' + key] = true;\n delete result[path];\n var type = Object.prototype.toString.call(data[key]);\n if (type === '[object Object]') {\n _objToPath(data[key], path + '.' + key, result);\n } else if (type === '[object Array]') {\n _arrayToPath(data[key], path + '.' + key, result);\n }\n });\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach(function (item, index) {\n result[path + '[' + index + ']'] = true;\n delete result[path];\n var type = Object.prototype.toString.call(item);\n if (type === '[object Object]') {\n _objToPath(item, path + '[' + index + ']', result);\n } else if (type === '[object Array]') {\n _arrayToPath(item, path + '[' + index + ']', result);\n }\n });\n}\n\nfunction _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn$1(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; }\n\nfunction _inherits$1(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; }\n\nvar id = 0;\n\nvar WeElement = function (_HTMLElement) {\n _inherits$1(WeElement, _HTMLElement);\n\n function WeElement() {\n _classCallCheck$1(this, WeElement);\n\n var _this = _possibleConstructorReturn$1(this, _HTMLElement.call(this));\n\n _this.props = Object.assign(nProps(_this.constructor.props), _this.constructor.defaultProps);\n _this.elementId = id++;\n _this.data = {};\n return _this;\n }\n\n WeElement.prototype.connectedCallback = function connectedCallback() {\n var p = this.parentNode;\n while (p && !this.store) {\n this.store = p.store;\n p = p.parentNode || p.host;\n }\n if (this.store) {\n this.store.instances.push(this);\n }\n\n if (this.initUse) {\n var use = this.initUse();\n this._updatePath = getPath(use);\n this.use = getUse(this.store.data, use);\n } else {\n this.constructor.use && (this.use = getUse(this.store.data, this.constructor.use));\n }\n this.attrsToProps();\n this.beforeInstall();\n this.install();\n this.afterInstall();\n\n var shadowRoot;\n if (!this.shadowRoot) {\n shadowRoot = this.attachShadow({\n mode: 'open'\n });\n } else {\n shadowRoot = this.shadowRoot;\n var fc;\n while (fc = shadowRoot.firstChild) {\n shadowRoot.removeChild(fc);\n }\n }\n\n if (this.constructor.css) {\n shadowRoot.appendChild(cssToDom(this.constructor.css));\n } else if (this.css) {\n shadowRoot.appendChild(cssToDom(typeof this.css === 'function' ? this.css() : this.css));\n }\n this.beforeRender();\n options.afterInstall && options.afterInstall(this);\n if (this.constructor.observe) {\n this.beforeObserve();\n proxyUpdate(this);\n this.observed();\n }\n\n var rendered = this.render(this.props, this.data, this.store);\n this.__hasChildren = Object.prototype.toString.call(rendered) === '[object Array]' && rendered.length > 0;\n\n this._host = diff(null, rendered, {}, false, null, false);\n this.rendered();\n\n if (this.props.css) {\n this._customStyleElement = cssToDom(this.props.css);\n this._customStyleContent = this.props.css;\n shadowRoot.appendChild(this._customStyleElement);\n }\n\n if (isArray(this._host)) {\n this._host.forEach(function (item) {\n shadowRoot.appendChild(item);\n });\n } else {\n shadowRoot.appendChild(this._host);\n }\n this.installed();\n this._isInstalled = true;\n };\n\n WeElement.prototype.disconnectedCallback = function disconnectedCallback() {\n this.uninstall();\n this._isInstalled = false;\n if (this.store) {\n for (var i = 0, len = this.store.instances.length; i < len; i++) {\n if (this.store.instances[i] === this) {\n this.store.instances.splice(i, 1);\n break;\n }\n }\n }\n };\n\n WeElement.prototype.update = function update(ignoreAttrs) {\n this._willUpdate = true;\n this.beforeUpdate();\n this.beforeRender();\n //fix null !== undefined\n if (this._customStyleContent != this.props.css) {\n this._customStyleContent = this.props.css;\n this._customStyleElement.textContent = this._customStyleContent;\n }\n this.attrsToProps(ignoreAttrs);\n\n var rendered = this.render(this.props, this.data, this.store);\n this.__hasChildren = this.__hasChildren || Object.prototype.toString.call(rendered) === '[object Array]' && rendered.length > 0;\n\n this._host = diff(this._host, rendered, null, null, this.shadowRoot);\n this._willUpdate = false;\n this.updated();\n };\n\n WeElement.prototype.removeAttribute = function removeAttribute(key) {\n _HTMLElement.prototype.removeAttribute.call(this, key);\n //Avoid executing removeAttribute methods before connectedCallback\n this._isInstalled && this.update();\n };\n\n WeElement.prototype.setAttribute = function setAttribute(key, val) {\n if (val && typeof val === 'object') {\n _HTMLElement.prototype.setAttribute.call(this, key, JSON.stringify(val));\n } else {\n _HTMLElement.prototype.setAttribute.call(this, key, val);\n }\n //Avoid executing setAttribute methods before connectedCallback\n this._isInstalled && this.update();\n };\n\n WeElement.prototype.pureRemoveAttribute = function pureRemoveAttribute(key) {\n _HTMLElement.prototype.removeAttribute.call(this, key);\n };\n\n WeElement.prototype.pureSetAttribute = function pureSetAttribute(key, val) {\n _HTMLElement.prototype.setAttribute.call(this, key, val);\n };\n\n WeElement.prototype.attrsToProps = function attrsToProps(ignoreAttrs) {\n var ele = this;\n if (ele.normalizedNodeName || ignoreAttrs) return;\n ele.props['css'] = ele.getAttribute('css');\n var attrs = this.constructor.propTypes;\n if (!attrs) return;\n Object.keys(attrs).forEach(function (key) {\n var type = attrs[key];\n var val = ele.getAttribute(hyphenate(key));\n if (val !== null) {\n switch (type) {\n case String:\n ele.props[key] = val;\n break;\n case Number:\n ele.props[key] = Number(val);\n break;\n case Boolean:\n if (val === 'false' || val === '0') {\n ele.props[key] = false;\n } else {\n ele.props[key] = true;\n }\n break;\n case Array:\n case Object:\n ele.props[key] = JSON.parse(val.replace(/(['\"])?([a-zA-Z0-9_-]+)(['\"])?:([^\\/])/g, '\"$2\":$4').replace(/'([\\s\\S]*?)'/g, '\"$1\"').replace(/,(\\s*})/g, '$1'));\n break;\n }\n } else {\n if (ele.constructor.defaultProps && ele.constructor.defaultProps.hasOwnProperty(key)) {\n ele.props[key] = ele.constructor.defaultProps[key];\n } else {\n ele.props[key] = null;\n }\n }\n });\n };\n\n WeElement.prototype.fire = function fire(name, data) {\n this.dispatchEvent(new CustomEvent(name.replace(/-/g, '').toLowerCase(), { detail: data }));\n };\n\n WeElement.prototype.beforeInstall = function beforeInstall() {};\n\n WeElement.prototype.install = function install() {};\n\n WeElement.prototype.afterInstall = function afterInstall() {};\n\n WeElement.prototype.installed = function installed() {};\n\n WeElement.prototype.uninstall = function uninstall() {};\n\n WeElement.prototype.beforeUpdate = function beforeUpdate() {};\n\n WeElement.prototype.updated = function updated() {};\n\n WeElement.prototype.beforeRender = function beforeRender() {};\n\n WeElement.prototype.rendered = function rendered() {};\n\n WeElement.prototype.receiveProps = function receiveProps() {};\n\n WeElement.prototype.beforeObserve = function beforeObserve() {};\n\n WeElement.prototype.observed = function observed() {};\n\n return WeElement;\n}(HTMLElement);\n\nWeElement.is = 'WeElement';\n\nfunction render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent;\n if (store) {\n store.instances = [];\n extendStoreUpate(store);\n\n store.data = new JSONPatcherProxy(store.data).observe(false, function (patch) {\n var patchs = {};\n if (patch.op === 'remove') {\n // fix arr splice\n var kv = getArrayPatch(patch.path, store);\n patchs[kv.k] = kv.v;\n\n update(patchs, store);\n } else {\n var key = fixPath(patch.path);\n patchs[key] = patch.value;\n\n update(patchs, store);\n }\n });\n parent.store = store;\n }\n return diff(null, vnode, {}, false, parent, false);\n}\n\nfunction update(patch, store) {\n store.update(patch);\n}\n\nfunction extendStoreUpate(store) {\n store.update = function (patch) {\n var _this = this;\n\n var updateAll = matchGlobalData(this.globalData, patch);\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(function (instance) {\n if (updateAll || _this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath) || instance._updatePath && needUpdate(patch, instance._updatePath)) {\n //update this.use\n if (instance.constructor.use) {\n instance.use = getUse(store.data, instance.constructor.use);\n } else if (instance.initUse) {\n instance.use = getUse(store.data, instance.initUse());\n }\n\n instance.update();\n }\n });\n this.onChange && this.onChange(patch);\n }\n };\n}\n\nfunction matchGlobalData(globalData, diffResult) {\n if (!globalData) return false;\n for (var keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true;\n }\n for (var i = 0, len = globalData.length; i < len; i++) {\n if (includePath(keyA, globalData[i])) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction needUpdate(diffResult, updatePath) {\n for (var keyA in diffResult) {\n if (updatePath[keyA]) {\n return true;\n }\n for (var keyB in updatePath) {\n if (includePath(keyA, keyB)) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction includePath(pathA, pathB) {\n if (pathA.indexOf(pathB) === 0) {\n var next = pathA.substr(pathB.length, 1);\n if (next === '[' || next === '.') {\n return true;\n }\n }\n return false;\n}\n\nfunction fixPath(path) {\n var mpPath = '';\n var arr = path.replace('/', '').split('/');\n arr.forEach(function (item, index) {\n if (index) {\n if (isNaN(Number(item))) {\n mpPath += '.' + item;\n } else {\n mpPath += '[' + item + ']';\n }\n } else {\n mpPath += item;\n }\n });\n return mpPath;\n}\n\nfunction getArrayPatch(path, store) {\n var arr = path.replace('/', '').split('/');\n var current = store.data[arr[0]];\n for (var i = 1, len = arr.length; i < len - 1; i++) {\n current = current[arr[i]];\n }\n return { k: fixArrPath(path), v: current };\n}\n\nfunction fixArrPath(path) {\n var mpPath = '';\n var arr = path.replace('/', '').split('/');\n var len = arr.length;\n arr.forEach(function (item, index) {\n if (index < len - 1) {\n if (index) {\n if (isNaN(Number(item))) {\n mpPath += '.' + item;\n } else {\n mpPath += '[' + item + ']';\n }\n } else {\n mpPath += item;\n }\n }\n });\n return mpPath;\n}\n\nfunction tag(name, pure) {\n return function (target) {\n target.pure = pure;\n define(name, target);\n };\n}\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its children.\n * @param {VNode} vnode\t\tThe virtual DOM element to clone\n * @param {Object} props\tAttributes/props to add when cloning\n * @param {VNode} rest\t\tAny additional arguments will be used as replacement children.\n */\nfunction cloneElement(vnode, props) {\n return h(vnode.nodeName, extend(extend({}, vnode.attributes), props), arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children);\n}\n\nfunction getHost(ele) {\n var p = ele.parentNode;\n while (p) {\n if (p.host) {\n return p.host;\n } else if (p.shadowRoot && p.shadowRoot.host) {\n return p.shadowRoot.host;\n } else {\n p = p.parentNode;\n }\n }\n}\n\nfunction rpx(str) {\n return str.replace(/([1-9]\\d*|0)(\\.\\d*)*rpx/g, function (a, b) {\n return window.innerWidth * Number(b) / 750 + 'px';\n });\n}\n\nfunction _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn$2(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; }\n\nfunction _inherits$2(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; }\n\nvar ModelView = function (_WeElement) {\n _inherits$2(ModelView, _WeElement);\n\n function ModelView() {\n _classCallCheck$2(this, ModelView);\n\n return _possibleConstructorReturn$2(this, _WeElement.apply(this, arguments));\n }\n\n ModelView.prototype.beforeInstall = function beforeInstall() {\n this.data = this.vm.data;\n };\n\n ModelView.prototype.observed = function observed() {\n this.vm.data = this.data;\n };\n\n return ModelView;\n}(WeElement);\n\nModelView.observe = true;\nModelView.mergeUpdate = false;\n\n/**\n * classNames based on https://github.com/JedWatson/classnames\n * by Jed Watson\n * Licensed under the MIT License\n * https://github.com/JedWatson/classnames/blob/master/LICENSE\n * modified by dntzhang\n */\n\nvar hasOwn = {}.hasOwnProperty;\n\nfunction classNames() {\n var classes = [];\n\n for (var i = 0; i < arguments.length; i++) {\n var arg = arguments[i];\n if (!arg) continue;\n\n var argType = typeof arg;\n\n if (argType === 'string' || argType === 'number') {\n classes.push(arg);\n } else if (Array.isArray(arg) && arg.length) {\n var inner = classNames.apply(null, arg);\n if (inner) {\n classes.push(inner);\n }\n } else if (argType === 'object') {\n for (var key in arg) {\n if (hasOwn.call(arg, key) && arg[key]) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(' ');\n}\n\nfunction extractClass() {\n var _Array$prototype$slic = Array.prototype.slice.call(arguments, 0),\n props = _Array$prototype$slic[0],\n args = _Array$prototype$slic.slice(1);\n\n if (props.class) {\n args.unshift(props.class);\n delete props.class;\n } else if (props.className) {\n args.unshift(props.className);\n delete props.className;\n }\n if (args.length > 0) {\n return { class: classNames.apply(null, args) };\n }\n}\n\nfunction o(obj) {\n return JSON.stringify(obj);\n}\n\nvar n=function(t,r,u,e){for(var p=1;p\"===t?(a(), u=1):u&&(\"=\"===t?(u=4, r=e, e=\"\"):\"/\"===t?(a(), 3===u&&(s=s[0]), u=s, (s=s[0]).push(u,4), u=0):\" \"===t||\"\\t\"===t||\"\\n\"===t||\"\\r\"===t?(a(), u=2):e+=t);}return a(), s},r=\"function\"==typeof Map,u=r?new Map:{},e=r?function(n){var r=u.get(n);return r||u.set(n,r=t(n)), r}:function(n){for(var r=\"\",e=0;e1?r:r[0]}\n\nvar html = htm.bind(h);\n\nfunction createRef() {\n return {};\n}\n\nvar Component = WeElement;\nvar defineElement = define;\nvar elements = options.mapping;\n\nvar omi = {\n tag: tag,\n WeElement: WeElement,\n Component: Component,\n render: render,\n h: h,\n createElement: h,\n options: options,\n define: define,\n observe: observe,\n cloneElement: cloneElement,\n getHost: getHost,\n rpx: rpx,\n tick: tick,\n nextTick: nextTick,\n ModelView: ModelView,\n defineElement: defineElement,\n classNames: classNames,\n extractClass: extractClass,\n createRef: createRef,\n html: html,\n htm: htm,\n o: o,\n elements: elements\n};\n\noptions.root.Omi = omi;\noptions.root.omi = omi;\noptions.root.Omi.version = '6.6.5';\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (omi);\n\n//# sourceMappingURL=omi.esm.js.map\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../_webpack@4.34.0@webpack/buildin/global.js */ \"./node_modules/_webpack@4.34.0@webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/_omi@6.6.5@omi/dist/omi.esm.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"tag\", function() { return tag; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"WeElement\", function() { return WeElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Component\", function() { return Component; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"h\", function() { return h; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createElement\", function() { return h; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"options\", function() { return options; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"define\", function() { return define; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"observe\", function() { return observe; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"cloneElement\", function() { return cloneElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getHost\", function() { return getHost; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"rpx\", function() { return rpx; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"tick\", function() { return tick; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"nextTick\", function() { return nextTick; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ModelView\", function() { return ModelView; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defineElement\", function() { return defineElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"classNames\", function() { return classNames; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"extractClass\", function() { return extractClass; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"createRef\", function() { return createRef; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"html\", function() { return html; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"htm\", function() { return htm; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"o\", function() { return o; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"elements\", function() { return elements; });\n/**\n * omi v6.6.8 http://omijs.org\n * Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.\n * By dntzhang https://github.com/dntzhang\n * Github: https://github.com/Tencent/omi\n * MIT Licensed.\n */\n\n/** Virtual DOM Node */\nfunction VNode() {}\n\nfunction getGlobal() {\n if (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\n return self || window || global || function () {\n return this;\n }();\n }\n return global;\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nvar options = {\n store: null,\n root: getGlobal(),\n mapping: {}\n};\n\nvar stack = [];\n\nfunction h(nodeName, attributes) {\n var children = [],\n lastSimple,\n child,\n simple,\n i;\n for (i = arguments.length; i-- > 2;) {\n stack.push(arguments[i]);\n }\n if (attributes && attributes.children != null) {\n if (!stack.length) stack.push(attributes.children);\n delete attributes.children;\n }\n while (stack.length) {\n if ((child = stack.pop()) && child.pop !== undefined) {\n for (i = child.length; i--;) {\n stack.push(child[i]);\n }\n } else {\n if (typeof child === 'boolean') child = null;\n\n if (simple = typeof nodeName !== 'function') {\n if (child == null) child = '';else if (typeof child === 'number') child = String(child);else if (typeof child !== 'string') simple = false;\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child;\n } else if (children.length === 0) {\n children = [child];\n } else {\n children.push(child);\n }\n\n lastSimple = simple;\n }\n }\n\n var p = new VNode();\n p.nodeName = nodeName;\n p.children = children;\n p.attributes = attributes == null ? undefined : attributes;\n p.key = attributes == null ? undefined : attributes.key;\n\n // if a \"vnode hook\" is defined, pass every created VNode to it\n if (options.vnode !== undefined) options.vnode(p);\n\n return p;\n}\n\n/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n(function () {\n if (\n // No Reflect, no classes, no need for shim because native custom elements\n // require ES2015 classes or Reflect.\n window.Reflect === undefined || window.customElements === undefined ||\n // The webcomponentsjs custom elements polyfill doesn't require\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')) {\n return;\n }\n var BuiltInHTMLElement = HTMLElement;\n window.HTMLElement = function HTMLElement() {\n return Reflect.construct(BuiltInHTMLElement, [], this.constructor);\n };\n HTMLElement.prototype = BuiltInHTMLElement.prototype;\n HTMLElement.prototype.constructor = HTMLElement;\n Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);\n})();\n\nfunction cssToDom(css) {\n var node = document.createElement('style');\n node.textContent = css;\n return node;\n}\n\nfunction npn(str) {\n return str.replace(/-(\\w)/g, function ($, $1) {\n return $1.toUpperCase();\n });\n}\n\nfunction extend(obj, props) {\n for (var i in props) {\n obj[i] = props[i];\n }return obj;\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nfunction applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value);else ref.current = value;\n }\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n * @type {(callback: function) => void}\n */\nvar defer = typeof Promise == 'function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout;\n\nfunction isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n}\n\nfunction nProps(props) {\n if (!props || isArray(props)) return {};\n var result = {};\n Object.keys(props).forEach(function (key) {\n result[key] = props[key].value;\n });\n return result;\n}\n\nfunction getUse(data, paths) {\n var obj = [];\n paths.forEach(function (path, index) {\n var isPath = typeof path === 'string';\n if (isPath) {\n obj[index] = getTargetByPath(data, path);\n } else {\n var key = Object.keys(path)[0];\n var value = path[key];\n if (typeof value === 'string') {\n obj[index] = getTargetByPath(data, value);\n } else {\n var tempPath = value[0];\n if (typeof tempPath === 'string') {\n var tempVal = getTargetByPath(data, tempPath);\n obj[index] = value[1] ? value[1](tempVal) : tempVal;\n } else {\n var args = [];\n tempPath.forEach(function (path) {\n args.push(getTargetByPath(data, path));\n });\n obj[index] = value[1].apply(null, args);\n }\n }\n obj[key] = obj[index];\n }\n });\n return obj;\n}\n\nfunction getTargetByPath(origin, path) {\n var arr = path.replace(/]/g, '').replace(/\\[/g, '.').split('.');\n var current = origin;\n for (var i = 0, len = arr.length; i < len; i++) {\n current = current[arr[i]];\n }\n return current;\n}\n\nvar hyphenateRE = /\\B([A-Z])/g;\nfunction hyphenate(str) {\n return str.replace(hyphenateRE, '-$1').toLowerCase();\n}\n\n// DOM properties that should NOT have \"px\" added when numeric\nvar IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;\n\n/**\n * Check if two nodes are equivalent.\n *\n * @param {Node} node\t\t\tDOM Node to compare\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\n * @private\n */\nfunction isSameNodeType(node, vnode, hydrating) {\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n return node.splitText !== undefined;\n }\n if (typeof vnode.nodeName === 'string') {\n return !node._componentConstructor && isNamedNode(node, vnode.nodeName);\n } else if (typeof vnode.nodeName === 'function') {\n return options.mapping[node.nodeName.toLowerCase()] === vnode.nodeName;\n }\n return hydrating || node._componentConstructor === vnode.nodeName;\n}\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n *\n * @param {Element} node\tA DOM Element to inspect the name of.\n * @param {String} nodeName\tUnnormalized name to compare against.\n */\nfunction isNamedNode(node, nodeName) {\n return node.normalizedNodeName === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase();\n}\n\n/**\n * Create an element with the given nodeName.\n * @param {string} nodeName The DOM node to create\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\n * namespace.\n * @returns {Element} The created DOM node\n */\nfunction createNode(nodeName, isSvg) {\n /** @type {Element} */\n var node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName);\n node.normalizedNodeName = nodeName;\n return node;\n}\n\n/**\n * Remove a child node from its parent if attached.\n * @param {Node} node The node to remove\n */\nfunction removeNode(node) {\n var parentNode = node.parentNode;\n if (parentNode) parentNode.removeChild(node);\n}\n\n/**\n * Set a named attribute on the given Node, with special behavior for some names\n * and event handlers. If `value` is `null`, the attribute/handler will be\n * removed.\n * @param {Element} node An element to mutate\n * @param {string} name The name/key to set, such as an event or attribute name\n * @param {*} old The last value that was set for this name/node pair\n * @param {*} value An attribute value, such as a function to be used as an\n * event handler\n * @param {boolean} isSvg Are we currently diffing inside an svg?\n * @private\n */\nfunction setAccessor(node, name, old, value, isSvg) {\n if (name === 'className') name = 'class';\n\n if (name === 'key') {\n // ignore\n } else if (name === 'ref') {\n applyRef(old, null);\n applyRef(value, node);\n } else if (name === 'class' && !isSvg) {\n node.className = value || '';\n } else if (name === 'style') {\n if (!value || typeof value === 'string' || typeof old === 'string') {\n node.style.cssText = value || '';\n }\n if (value && typeof value === 'object') {\n if (typeof old !== 'string') {\n for (var i in old) {\n if (!(i in value)) node.style[i] = '';\n }\n }\n for (var i in value) {\n node.style[i] = typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false ? value[i] + 'px' : value[i];\n }\n }\n } else if (name === 'dangerouslySetInnerHTML') {\n if (value) node.innerHTML = value.__html || '';\n } else if (name[0] == 'o' && name[1] == 'n') {\n var useCapture = name !== (name = name.replace(/Capture$/, ''));\n name = name.toLowerCase().substring(2);\n if (value) {\n if (!old) {\n node.addEventListener(name, eventProxy, useCapture);\n if (name == 'tap') {\n node.addEventListener('touchstart', touchStart, useCapture);\n node.addEventListener('touchend', touchEnd, useCapture);\n }\n }\n } else {\n node.removeEventListener(name, eventProxy, useCapture);\n if (name == 'tap') {\n node.removeEventListener('touchstart', touchStart, useCapture);\n node.removeEventListener('touchend', touchEnd, useCapture);\n }\n }\n(node._listeners || (node._listeners = {}))[name] = value;\n } else if (name !== 'list' && name !== 'type' && name !== 'css' && !isSvg && name in node && value !== '') {\n //value !== '' fix for selected, disabled, checked with pure element\n // Attempt to set a DOM property to the given value.\n // IE & FF throw for certain property-value combinations.\n try {\n node[name] = value == null ? '' : value;\n } catch (e) {}\n if ((value == null || value === false) && name != 'spellcheck') node.pureRemoveAttribute ? node.pureRemoveAttribute(name) : node.removeAttribute(name);\n } else {\n var ns = isSvg && name !== (name = name.replace(/^xlink:?/, ''));\n // spellcheck is treated differently than all other boolean values and\n // should not be removed when the value is `false`. See:\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\n if (value == null || value === false) {\n if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());else node.pureRemoveAttribute ? node.pureRemoveAttribute(name) : node.removeAttribute(name);\n } else if (typeof value !== 'function') {\n if (ns) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);\n } else {\n node.pureSetAttribute ? node.pureSetAttribute(name, value) : node.setAttribute(name, value);\n }\n }\n }\n}\n\n/**\n * Proxy an event to hooked event handlers\n * @param {Event} e The event object from the browser\n * @private\n */\nfunction eventProxy(e) {\n return this._listeners[e.type](options.event && options.event(e) || e);\n}\n\nfunction touchStart(e) {\n this.___touchX = e.touches[0].pageX;\n this.___touchY = e.touches[0].pageY;\n this.___scrollTop = document.body.scrollTop;\n}\n\nfunction touchEnd(e) {\n if (Math.abs(e.changedTouches[0].pageX - this.___touchX) < 30 && Math.abs(e.changedTouches[0].pageY - this.___touchY) < 30 && Math.abs(document.body.scrollTop - this.___scrollTop) < 30) {\n this.dispatchEvent(new CustomEvent('tap', { detail: e }));\n }\n}\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nvar diffLevel = 0;\n\n/** Global flag indicating if the diff is currently within an SVG */\nvar isSvgMode = false;\n\n/** Global flag indicating if the diff is performing hydration */\nvar hydrating = false;\n\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\n *\t@returns {Element} dom\t\t\tThe created/mutated element\n *\t@private\n */\nfunction diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n var ret;\n if (!diffLevel++) {\n // when first starting the diff, check if we're diffing an SVG or within an SVG\n isSvgMode = parent != null && parent.ownerSVGElement !== undefined;\n\n // hydration is indicated by the existing element to be diffed not having a prop cache\n hydrating = dom != null && !('prevProps' in dom);\n }\n if (isArray(vnode)) {\n if (parent) {\n var styles = parent.querySelectorAll('style');\n styles.forEach(function (s) {\n parent.removeChild(s);\n });\n innerDiffNode(parent, vnode);\n\n for (var i = styles.length - 1; i >= 0; i--) {\n parent.firstChild ? parent.insertBefore(styles[i], parent.firstChild) : parent.appendChild(style[i]);\n }\n } else {\n\n ret = [];\n vnode.forEach(function (item, index) {\n var ele = idiff(index === 0 ? dom : null, item, context, mountAll, componentRoot);\n ret.push(ele);\n parent && parent.appendChild(ele);\n });\n }\n } else {\n if (isArray(dom)) {\n dom.forEach(function (one, index) {\n if (index === 0) {\n ret = idiff(one, vnode, context, mountAll, componentRoot);\n } else {\n recollectNodeTree(one, false);\n }\n });\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot);\n }\n // append the element if its a new parent\n if (parent && ret.parentNode !== parent) parent.appendChild(ret);\n }\n\n // diffLevel being reduced to 0 means we're exiting the diff\n if (! --diffLevel) {\n hydrating = false;\n // invoke queued componentDidMount lifecycle methods\n }\n\n return ret;\n}\n\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\n if (dom && vnode && dom.props) {\n dom.props.children = vnode.children;\n }\n var out = dom,\n prevSvgMode = isSvgMode;\n\n // empty values (null, undefined, booleans) render as empty Text nodes\n if (vnode == null || typeof vnode === 'boolean') vnode = '';\n\n // Fast case: Strings & Numbers create/update Text nodes.\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n // update if it's already a Text node:\n if (dom && dom.splitText !== undefined && dom.parentNode && (!dom._component || componentRoot)) {\n /* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n if (dom.nodeValue != vnode) {\n dom.nodeValue = vnode;\n }\n } else {\n // it wasn't a Text node: replace it with one and recycle the old Element\n out = document.createTextNode(vnode);\n if (dom) {\n if (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n recollectNodeTree(dom, true);\n }\n }\n\n out['prevProps'] = true;\n\n return out;\n }\n\n // If the VNode represents a Component, perform a component diff:\n var vnodeName = vnode.nodeName;\n if (typeof vnodeName === 'function') {\n for (var key in options.mapping) {\n if (options.mapping[key] === vnodeName) {\n vnodeName = key;\n vnode.nodeName = key;\n break;\n }\n }\n }\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode = vnodeName === 'svg' ? true : vnodeName === 'foreignObject' ? false : isSvgMode;\n\n // If there's no existing element or it's the wrong type, create a new one:\n vnodeName = String(vnodeName);\n if (!dom || !isNamedNode(dom, vnodeName)) {\n out = createNode(vnodeName, isSvgMode);\n\n if (dom) {\n // move children into the replacement node\n while (dom.firstChild) {\n out.appendChild(dom.firstChild);\n } // if the previous Element was mounted into the DOM, replace it inline\n if (dom.parentNode) dom.parentNode.replaceChild(out, dom);\n\n // recycle the old element (skips non-Element node types)\n recollectNodeTree(dom, true);\n }\n }\n\n var fc = out.firstChild,\n props = out['prevProps'],\n vchildren = vnode.children;\n\n if (props == null) {\n props = out['prevProps'] = {};\n for (var a = out.attributes, i = a.length; i--;) {\n props[a[i].name] = a[i].value;\n }\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (!hydrating && vchildren && vchildren.length === 1 && typeof vchildren[0] === 'string' && fc != null && fc.splitText !== undefined && fc.nextSibling == null) {\n if (fc.nodeValue != vchildren[0]) {\n fc.nodeValue = vchildren[0];\n }\n }\n // otherwise, if there are existing or new children, diff them:\n else if (vchildren && vchildren.length || fc != null) {\n if (!(out.constructor.is == 'WeElement' && out.constructor.noSlot)) {\n innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null);\n }\n }\n\n // Apply attributes/props from VNode to the DOM Element:\n diffAttributes(out, vnode.attributes, props);\n if (out.props) {\n out.props.children = vnode.children;\n }\n // restore previous SVG mode: (in case we're exiting an SVG namespace)\n isSvgMode = prevSvgMode;\n\n return out;\n}\n\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\n *\t@param {Boolean} mountAll\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\n var originalChildren = dom.childNodes,\n children = [],\n keyed = {},\n keyedLen = 0,\n min = 0,\n len = originalChildren.length,\n childrenLen = 0,\n vlen = vchildren ? vchildren.length : 0,\n j,\n c,\n f,\n vchild,\n child;\n\n // Build up a map of keyed children and an Array of unkeyed children:\n if (len !== 0) {\n for (var i = 0; i < len; i++) {\n var _child = originalChildren[i],\n props = _child['prevProps'],\n key = vlen && props ? _child._component ? _child._component.__key : props.key : null;\n if (key != null) {\n keyedLen++;\n keyed[key] = _child;\n } else if (props || (_child.splitText !== undefined ? isHydrating ? _child.nodeValue.trim() : true : isHydrating)) {\n children[childrenLen++] = _child;\n }\n }\n }\n\n if (vlen !== 0) {\n for (var i = 0; i < vlen; i++) {\n vchild = vchildren[i];\n child = null;\n\n // attempt to find a node based on key matching\n var key = vchild.key;\n if (key != null) {\n if (keyedLen && keyed[key] !== undefined) {\n child = keyed[key];\n keyed[key] = undefined;\n keyedLen--;\n }\n }\n // attempt to pluck a node of the same type from the existing children\n else if (!child && min < childrenLen) {\n for (j = min; j < childrenLen; j++) {\n if (children[j] !== undefined && isSameNodeType(c = children[j], vchild, isHydrating)) {\n child = c;\n children[j] = undefined;\n if (j === childrenLen - 1) childrenLen--;\n if (j === min) min++;\n break;\n }\n }\n }\n\n // morph the matched/found/created DOM child to match vchild (deep)\n child = idiff(child, vchild, context, mountAll);\n\n f = originalChildren[i];\n if (child && child !== dom && child !== f) {\n if (f == null) {\n dom.appendChild(child);\n } else if (child === f.nextSibling) {\n removeNode(f);\n } else {\n dom.insertBefore(child, f);\n }\n }\n }\n }\n\n // remove unused keyed children:\n if (keyedLen) {\n for (var i in keyed) {\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false);\n }\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined) recollectNodeTree(child, false);\n }\n}\n\n/** Recursively recycle (or just unmount) a node and its descendants.\n *\t@param {Node} node\t\t\t\t\t\tDOM node to start unmount/removal from\n *\t@param {Boolean} [unmountOnly=false]\tIf `true`, only triggers unmount lifecycle, skips removal\n */\nfunction recollectNodeTree(node, unmountOnly) {\n // If the node's VNode had a ref function, invoke it with null here.\n // (this is part of the React spec, and smart for unsetting references)\n if (node['prevProps'] != null && node['prevProps'].ref) {\n if (typeof node['prevProps'].ref === 'function') {\n node['prevProps'].ref(null);\n } else if (node['prevProps'].ref.current) {\n node['prevProps'].ref.current = null;\n }\n }\n\n if (unmountOnly === false || node['prevProps'] == null) {\n removeNode(node);\n }\n\n removeChildren(node);\n}\n\n/** Recollect/unmount all children.\n *\t- we use .lastChild here because it causes less reflow than .firstChild\n *\t- it's also cheaper than accessing the .childNodes Live NodeList\n */\nfunction removeChildren(node) {\n node = node.lastChild;\n while (node) {\n var next = node.previousSibling;\n recollectNodeTree(node, true);\n node = next;\n }\n}\n\n/** Apply differences in attributes from a VNode to the given DOM Element.\n *\t@param {Element} dom\t\tElement with attributes to diff `attrs` against\n *\t@param {Object} attrs\t\tThe desired end-state key-value attribute pairs\n *\t@param {Object} old\t\t\tCurrent/previous attributes (from previous VNode or element's prop cache)\n */\nfunction diffAttributes(dom, attrs, old) {\n var name;\n var update = false;\n var isWeElement = dom.update;\n var oldClone;\n if (dom.receiveProps) {\n oldClone = Object.assign({}, old);\n }\n // remove attributes no longer present on the vnode by setting them to undefined\n for (name in old) {\n if (!(attrs && attrs[name] != null) && old[name] != null) {\n setAccessor(dom, name, old[name], old[name] = undefined, isSvgMode);\n if (isWeElement) {\n delete dom.props[name];\n update = true;\n }\n }\n }\n\n // add new & update changed attributes\n for (name in attrs) {\n if (isWeElement && typeof attrs[name] === 'object' && name !== 'ref') {\n if (name === 'style') {\n setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);\n }\n dom.props[npn(name)] = attrs[name];\n update = true;\n } else if (name !== 'children' && name !== 'innerHTML' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) {\n setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode);\n if (isWeElement) {\n dom.props[npn(name)] = attrs[name];\n update = true;\n }\n }\n }\n\n if (isWeElement && dom.parentNode) {\n //__hasChildren is not accuracy when it was empty at first, so add dom.children.length > 0 condition\n if (update || dom.__hasChildren || dom.children.length > 0 || dom.store && !dom.store.data) {\n if (dom.receiveProps(dom.props, oldClone) !== false) {\n dom.update();\n }\n }\n }\n}\n\n/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nvar JSONPatcherProxy = function () {\n /**\n * Deep clones your object and returns a new object.\n */\n function deepClone(obj) {\n switch (typeof obj) {\n case 'object':\n return JSON.parse(JSON.stringify(obj)); //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n case 'undefined':\n return null; //this is how JSON.stringify behaves for array items\n default:\n return obj; //no need to clone primitives\n }\n }\n JSONPatcherProxy.deepClone = deepClone;\n\n function escapePathComponent(str) {\n if (str.indexOf('/') == -1 && str.indexOf('~') == -1) return str;\n return str.replace(/~/g, '~0').replace(/\\//g, '~1');\n }\n JSONPatcherProxy.escapePathComponent = escapePathComponent;\n\n /**\n * Walk up the parenthood tree to get the path\n * @param {JSONPatcherProxy} instance\n * @param {Object} obj the object you need to find its path\n */\n function findObjectPath(instance, obj) {\n var pathComponents = [];\n var parentAndPath = instance.parenthoodMap.get(obj);\n while (parentAndPath && parentAndPath.path) {\n // because we're walking up-tree, we need to use the array as a stack\n pathComponents.unshift(parentAndPath.path);\n parentAndPath = instance.parenthoodMap.get(parentAndPath.parent);\n }\n if (pathComponents.length) {\n var path = pathComponents.join('/');\n return '/' + path;\n }\n return '';\n }\n /**\n * A callback to be used as th proxy set trap callback.\n * It updates parenthood map if needed, proxifies nested newly-added objects, calls default callbacks with the changes occurred.\n * @param {JSONPatcherProxy} instance JSONPatcherProxy instance\n * @param {Object} target the affected object\n * @param {String} key the effect property's name\n * @param {Any} newValue the value being set\n */\n function setTrap(instance, target, key, newValue) {\n var parentPath = findObjectPath(instance, target);\n\n var destinationPropKey = parentPath + '/' + escapePathComponent(key);\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n var newValueOriginalObject = instance.proxifiedObjectsMap.get(newValue);\n\n instance.parenthoodMap.set(newValueOriginalObject.originalObject, {\n parent: target,\n path: key\n });\n }\n /*\n mark already proxified values as inherited.\n rationale: proxy.arr.shift()\n will emit\n {op: replace, path: '/arr/1', value: arr_2}\n {op: remove, path: '/arr/2'}\n by default, the second operation would revoke the proxy, and this renders arr revoked.\n That's why we need to remember the proxies that are inherited.\n */\n var revokableInstance = instance.proxifiedObjectsMap.get(newValue);\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n We need to make sure we mark revokables as inherited ONLY when we're observing,\n because throughout the first proxification, a sub-object is proxified and then assigned to\n its parent object. This assignment of a pre-proxified object can fool us into thinking\n that it's a proxified object moved around, while in fact it's the first assignment ever.\n Checking isProxifyingTreeNow ensures this is not happening in the first proxification,\n but in fact is is a proxified object moved around the tree\n */\n if (revokableInstance && !instance.isProxifyingTreeNow) {\n revokableInstance.inherited = true;\n }\n\n // if the new value is an object, make sure to watch it\n if (newValue && typeof newValue == 'object' && !instance.proxifiedObjectsMap.has(newValue)) {\n instance.parenthoodMap.set(newValue, {\n parent: target,\n path: key\n });\n newValue = instance._proxifyObjectTreeRecursively(target, newValue, key);\n }\n // let's start with this operation, and may or may not update it later\n var operation = {\n op: 'remove',\n path: destinationPropKey\n };\n if (typeof newValue == 'undefined') {\n // applying De Morgan's laws would be a tad faster, but less readable\n if (!Array.isArray(target) && !target.hasOwnProperty(key)) {\n // `undefined` is being set to an already undefined value, keep silent\n return Reflect.set(target, key, newValue);\n }\n // when array element is set to `undefined`, should generate replace to `null`\n if (Array.isArray(target)) {\noperation.op = 'replace', operation.value = null;\n }\n var oldValue = instance.proxifiedObjectsMap.get(target[key]);\n // was the deleted a proxified object?\n if (oldValue) {\n instance.parenthoodMap.delete(target[key]);\n instance.disableTrapsForProxy(oldValue);\n instance.proxifiedObjectsMap.delete(oldValue);\n }\n } else {\n if (Array.isArray(target) && !Number.isInteger(+key.toString())) {\n /* array props (as opposed to indices) don't emit any patches, to avoid needless `length` patches */\n if (key != 'length') {\n console.warn('JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch');\n }\n return Reflect.set(target, key, newValue);\n }\n operation.op = 'add';\n if (target.hasOwnProperty(key)) {\n if (typeof target[key] !== 'undefined' || Array.isArray(target)) {\n operation.op = 'replace'; // setting `undefined` array elements is a `replace` op\n }\n }\n operation.value = newValue;\n }\n operation.oldValue = target[key];\n var reflectionResult = Reflect.set(target, key, newValue);\n instance.defaultCallback(operation);\n return reflectionResult;\n }\n /**\n * A callback to be used as th proxy delete trap callback.\n * It updates parenthood map if needed, calls default callbacks with the changes occurred.\n * @param {JSONPatcherProxy} instance JSONPatcherProxy instance\n * @param {Object} target the effected object\n * @param {String} key the effected property's name\n */\n function deleteTrap(instance, target, key) {\n if (typeof target[key] !== 'undefined') {\n var parentPath = findObjectPath(instance, target);\n var destinationPropKey = parentPath + '/' + escapePathComponent(key);\n\n var revokableProxyInstance = instance.proxifiedObjectsMap.get(target[key]);\n\n if (revokableProxyInstance) {\n if (revokableProxyInstance.inherited) {\n /*\n this is an inherited proxy (an already proxified object that was moved around),\n we shouldn't revoke it, because even though it was removed from path1, it is still used in path2.\n And we know that because we mark moved proxies with `inherited` flag when we move them\n it is a good idea to remove this flag if we come across it here, in deleteProperty trap.\n We DO want to revoke the proxy if it was removed again.\n */\n revokableProxyInstance.inherited = false;\n } else {\n instance.parenthoodMap.delete(revokableProxyInstance.originalObject);\n instance.disableTrapsForProxy(revokableProxyInstance);\n instance.proxifiedObjectsMap.delete(target[key]);\n }\n }\n var reflectionResult = Reflect.deleteProperty(target, key);\n\n instance.defaultCallback({\n op: 'remove',\n path: destinationPropKey\n });\n\n return reflectionResult;\n }\n }\n /* pre-define resume and pause functions to enhance constructors performance */\n function resume() {\n var _this = this;\n\n this.defaultCallback = function (operation) {\n _this.isRecording && _this.patches.push(operation);\n _this.userCallback && _this.userCallback(operation);\n };\n this.isObserving = true;\n }\n function pause() {\n this.defaultCallback = function () {};\n this.isObserving = false;\n }\n /**\n * Creates an instance of JSONPatcherProxy around your object of interest `root`.\n * @param {Object|Array} root - the object you want to wrap\n * @param {Boolean} [showDetachedWarning = true] - whether to log a warning when a detached sub-object is modified @see {@link https://github.com/Palindrom/JSONPatcherProxy#detached-objects}\n * @returns {JSONPatcherProxy}\n * @constructor\n */\n function JSONPatcherProxy(root, showDetachedWarning) {\n this.isProxifyingTreeNow = false;\n this.isObserving = false;\n this.proxifiedObjectsMap = new Map();\n this.parenthoodMap = new Map();\n // default to true\n if (typeof showDetachedWarning !== 'boolean') {\n showDetachedWarning = true;\n }\n\n this.showDetachedWarning = showDetachedWarning;\n this.originalObject = root;\n this.cachedProxy = null;\n this.isRecording = false;\n this.userCallback;\n /**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n this.resume = resume.bind(this);\n /**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n this.pause = pause.bind(this);\n }\n\n JSONPatcherProxy.prototype.generateProxyAtPath = function (parent, obj, path) {\n var _this2 = this;\n\n if (!obj) {\n return obj;\n }\n var traps = {\n set: function set(target, key, value, receiver) {\n return setTrap(_this2, target, key, value, receiver);\n },\n deleteProperty: function deleteProperty(target, key) {\n return deleteTrap(_this2, target, key);\n }\n };\n var revocableInstance = Proxy.revocable(obj, traps);\n // cache traps object to disable them later.\n revocableInstance.trapsInstance = traps;\n revocableInstance.originalObject = obj;\n\n /* keeping track of object's parent and path */\n\n this.parenthoodMap.set(obj, { parent: parent, path: path });\n\n /* keeping track of all the proxies to be able to revoke them later */\n this.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance);\n return revocableInstance.proxy;\n };\n // grab tree's leaves one by one, encapsulate them into a proxy and return\n JSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function (parent, root, path) {\n for (var key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(root, root[key], escapePathComponent(key));\n }\n }\n }\n return this.generateProxyAtPath(parent, root, path);\n };\n // this function is for aesthetic purposes\n JSONPatcherProxy.prototype.proxifyObjectTree = function (root) {\n /*\n while proxyifying object tree,\n the proxyifying operation itself is being\n recorded, which in an unwanted behavior,\n that's why we disable recording through this\n initial process;\n */\n this.pause();\n this.isProxifyingTreeNow = true;\n var proxifiedObject = this._proxifyObjectTreeRecursively(undefined, root, '');\n /* OK you can record now */\n this.isProxifyingTreeNow = false;\n this.resume();\n return proxifiedObject;\n };\n /**\n * Turns a proxified object into a forward-proxy object; doesn't emit any patches anymore, like a normal object\n * @param {Proxy} proxy - The target proxy object\n */\n JSONPatcherProxy.prototype.disableTrapsForProxy = function (revokableProxyInstance) {\n if (this.showDetachedWarning) {\n var message = \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\";\n\n revokableProxyInstance.trapsInstance.set = function (targetObject, propKey, newValue) {\n console.warn(message);\n return Reflect.set(targetObject, propKey, newValue);\n };\n revokableProxyInstance.trapsInstance.set = function (targetObject, propKey, newValue) {\n console.warn(message);\n return Reflect.set(targetObject, propKey, newValue);\n };\n revokableProxyInstance.trapsInstance.deleteProperty = function (targetObject, propKey) {\n return Reflect.deleteProperty(targetObject, propKey);\n };\n } else {\n delete revokableProxyInstance.trapsInstance.set;\n delete revokableProxyInstance.trapsInstance.get;\n delete revokableProxyInstance.trapsInstance.deleteProperty;\n }\n };\n /**\n * Proxifies the object that was passed in the constructor and returns a proxified mirror of it. Even though both parameters are options. You need to pass at least one of them.\n * @param {Boolean} [record] - whether to record object changes to a later-retrievable patches array.\n * @param {Function} [callback] - this will be synchronously called with every object change with a single `patch` as the only parameter.\n */\n JSONPatcherProxy.prototype.observe = function (record, callback) {\n if (!record && !callback) {\n throw new Error('You need to either record changes or pass a callback');\n }\n this.isRecording = record;\n this.userCallback = callback;\n /*\n I moved it here to remove it from `unobserve`,\n this will also make the constructor faster, why initiate\n the array before they decide to actually observe with recording?\n They might need to use only a callback.\n */\n if (record) this.patches = [];\n this.cachedProxy = this.proxifyObjectTree(this.originalObject);\n return this.cachedProxy;\n };\n /**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n JSONPatcherProxy.prototype.generate = function () {\n if (!this.isRecording) {\n throw new Error('You should set record to true to get patches later');\n }\n return this.patches.splice(0, this.patches.length);\n };\n /**\n * Revokes all proxies rendering the observed object useless and good for garbage collection @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/revocable}\n */\n JSONPatcherProxy.prototype.revoke = function () {\n this.proxifiedObjectsMap.forEach(function (el) {\n el.revoke();\n });\n };\n /**\n * Disables all proxies' traps, turning the observed object into a forward-proxy object, like a normal object that you can modify silently.\n */\n JSONPatcherProxy.prototype.disableTraps = function () {\n this.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this);\n };\n return JSONPatcherProxy;\n}();\n\nvar callbacks = [];\nvar nextTickCallback = [];\n\nfunction tick(fn, scope) {\n callbacks.push({ fn: fn, scope: scope });\n}\n\nfunction fireTick() {\n callbacks.forEach(function (item) {\n item.fn.call(item.scope);\n });\n\n nextTickCallback.forEach(function (nextItem) {\n nextItem.fn.call(nextItem.scope);\n });\n nextTickCallback.length = 0;\n}\n\nfunction nextTick(fn, scope) {\n nextTickCallback.push({ fn: fn, scope: scope });\n}\n\nfunction observe(target) {\n target.observe = true;\n}\n\nfunction proxyUpdate(ele) {\n var timeout = null;\n ele.data = new JSONPatcherProxy(ele.data).observe(false, function () {\n if (ele._willUpdate) {\n return;\n }\n if (ele.constructor.mergeUpdate) {\n clearTimeout(timeout);\n\n timeout = setTimeout(function () {\n ele.update();\n fireTick();\n }, 0);\n } else {\n ele.update();\n fireTick();\n }\n });\n}\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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; }\n\nfunction _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; }\n\nfunction define(name, ctor) {\n if (ctor.is === 'WeElement') {\n if (options.mapping[name]) {\n // if(options.mapping[name] === ctor){\n // console.warn(`You redefine custom elements named [${name}], redundant JS files may be referenced.`)\n // } else {\n // console.warn(`This custom elements name [${name}] has already been used, please rename it.`)\n // }\n return;\n }\n customElements.define(name, ctor);\n options.mapping[name] = ctor;\n if (ctor.use) {\n ctor.updatePath = getPath(ctor.use);\n } else if (ctor.data) {\n //Compatible with older versions\n ctor.updatePath = getUpdatePath(ctor.data);\n }\n } else {\n var Element = function (_WeElement) {\n _inherits(Element, _WeElement);\n\n function Element() {\n var _temp, _this, _ret;\n\n _classCallCheck(this, Element);\n\n for (var _len = arguments.length, args = Array(_len), key = 0; key < _len; key++) {\n args[key] = arguments[key];\n }\n\n return _ret = (_temp = (_this = _possibleConstructorReturn(this, _WeElement.call.apply(_WeElement, [this].concat(args))), _this), _this._useId = 0, _this._useMap = {}, _this._preCss = null, _temp), _possibleConstructorReturn(_this, _ret);\n }\n\n Element.prototype.render = function render(props, data) {\n return ctor.call(this, props, data);\n };\n\n Element.prototype.beforeRender = function beforeRender() {\n this._useId = 0;\n };\n\n Element.prototype.useCss = function useCss(css) {\n if (css === this._preCss) {\n return;\n }\n this._preCss = css;\n var style = this.shadowRoot.querySelector('style');\n style && this.shadowRoot.removeChild(style);\n this.shadowRoot.appendChild(cssToDom(css));\n };\n\n Element.prototype.useData = function useData(data) {\n return this.use({ data: data });\n };\n\n Element.prototype.use = function use(option) {\n var _this2 = this;\n\n this._useId++;\n var updater = function updater(newValue) {\n var item = _this2._useMap[updater.id];\n\n item.data = newValue;\n\n _this2.update();\n item.effect && item.effect();\n };\n\n updater.id = this._useId;\n if (!this._isInstalled) {\n this._useMap[this._useId] = option;\n return [option.data, updater];\n }\n\n return [this._useMap[this._useId].data, updater];\n };\n\n Element.prototype.installed = function installed() {\n this._isInstalled = true;\n };\n\n return Element;\n }(WeElement);\n\n customElements.define(name, Element);\n }\n}\n\nfunction getPath(obj) {\n if (Object.prototype.toString.call(obj) === '[object Array]') {\n var result = {};\n obj.forEach(function (item) {\n if (typeof item === 'string') {\n result[item] = true;\n } else {\n var tempPath = item[Object.keys(item)[0]];\n if (typeof tempPath === 'string') {\n result[tempPath] = true;\n } else {\n if (typeof tempPath[0] === 'string') {\n result[tempPath[0]] = true;\n } else {\n tempPath[0].forEach(function (path) {\n return result[path] = true;\n });\n }\n }\n }\n });\n return result;\n } else {\n return getUpdatePath(obj);\n }\n}\n\nfunction getUpdatePath(data) {\n var result = {};\n dataToPath(data, result);\n return result;\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(function (key) {\n result[key] = true;\n var type = Object.prototype.toString.call(data[key]);\n if (type === '[object Object]') {\n _objToPath(data[key], key, result);\n } else if (type === '[object Array]') {\n _arrayToPath(data[key], key, result);\n }\n });\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(function (key) {\n result[path + '.' + key] = true;\n delete result[path];\n var type = Object.prototype.toString.call(data[key]);\n if (type === '[object Object]') {\n _objToPath(data[key], path + '.' + key, result);\n } else if (type === '[object Array]') {\n _arrayToPath(data[key], path + '.' + key, result);\n }\n });\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach(function (item, index) {\n result[path + '[' + index + ']'] = true;\n delete result[path];\n var type = Object.prototype.toString.call(item);\n if (type === '[object Object]') {\n _objToPath(item, path + '[' + index + ']', result);\n } else if (type === '[object Array]') {\n _arrayToPath(item, path + '[' + index + ']', result);\n }\n });\n}\n\nfunction _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn$1(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; }\n\nfunction _inherits$1(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; }\n\nvar id = 0;\n\nvar WeElement = function (_HTMLElement) {\n _inherits$1(WeElement, _HTMLElement);\n\n function WeElement() {\n _classCallCheck$1(this, WeElement);\n\n var _this = _possibleConstructorReturn$1(this, _HTMLElement.call(this));\n\n _this.props = Object.assign(nProps(_this.constructor.props), _this.constructor.defaultProps);\n _this.elementId = id++;\n _this.data = {};\n return _this;\n }\n\n WeElement.prototype.connectedCallback = function connectedCallback() {\n var p = this.parentNode;\n while (p && !this.store) {\n this.store = p.store;\n p = p.parentNode || p.host;\n }\n if (this.store) {\n this.store.instances.push(this);\n }\n\n if (this.initUse) {\n var use = this.initUse();\n this._updatePath = getPath(use);\n this.use = getUse(this.store.data, use);\n } else {\n this.constructor.use && (this.use = getUse(this.store.data, this.constructor.use));\n }\n this.attrsToProps();\n this.beforeInstall();\n this.install();\n this.afterInstall();\n\n var shadowRoot;\n if (!this.shadowRoot) {\n shadowRoot = this.attachShadow({\n mode: 'open'\n });\n } else {\n shadowRoot = this.shadowRoot;\n var fc;\n while (fc = shadowRoot.firstChild) {\n shadowRoot.removeChild(fc);\n }\n }\n\n if (this.constructor.css) {\n shadowRoot.appendChild(cssToDom(this.constructor.css));\n } else if (this.css) {\n shadowRoot.appendChild(cssToDom(typeof this.css === 'function' ? this.css() : this.css));\n }\n this.beforeRender();\n options.afterInstall && options.afterInstall(this);\n if (this.constructor.observe) {\n this.beforeObserve();\n proxyUpdate(this);\n this.observed();\n }\n\n var rendered = this.render(this.props, this.data, this.store);\n this.__hasChildren = Object.prototype.toString.call(rendered) === '[object Array]' && rendered.length > 0;\n\n this.rootNode = diff(null, rendered, {}, false, null, false);\n this.rendered();\n\n if (this.props.css) {\n this._customStyleElement = cssToDom(this.props.css);\n this._customStyleContent = this.props.css;\n shadowRoot.appendChild(this._customStyleElement);\n }\n\n if (isArray(this.rootNode)) {\n this.rootNode.forEach(function (item) {\n shadowRoot.appendChild(item);\n });\n } else {\n shadowRoot.appendChild(this.rootNode);\n }\n this.installed();\n this._isInstalled = true;\n };\n\n WeElement.prototype.disconnectedCallback = function disconnectedCallback() {\n this.uninstall();\n this._isInstalled = false;\n if (this.store) {\n for (var i = 0, len = this.store.instances.length; i < len; i++) {\n if (this.store.instances[i] === this) {\n this.store.instances.splice(i, 1);\n break;\n }\n }\n }\n };\n\n WeElement.prototype.update = function update(ignoreAttrs) {\n this._willUpdate = true;\n this.beforeUpdate();\n this.beforeRender();\n //fix null !== undefined\n if (this._customStyleContent != this.props.css) {\n this._customStyleContent = this.props.css;\n this._customStyleElement.textContent = this._customStyleContent;\n }\n this.attrsToProps(ignoreAttrs);\n\n var rendered = this.render(this.props, this.data, this.store);\n this.__hasChildren = this.__hasChildren || Object.prototype.toString.call(rendered) === '[object Array]' && rendered.length > 0;\n\n this.rootNode = diff(this.rootNode, rendered, null, null, this.shadowRoot);\n this._willUpdate = false;\n this.updated();\n };\n\n WeElement.prototype.removeAttribute = function removeAttribute(key) {\n _HTMLElement.prototype.removeAttribute.call(this, key);\n //Avoid executing removeAttribute methods before connectedCallback\n this._isInstalled && this.update();\n };\n\n WeElement.prototype.setAttribute = function setAttribute(key, val) {\n if (val && typeof val === 'object') {\n _HTMLElement.prototype.setAttribute.call(this, key, JSON.stringify(val));\n } else {\n _HTMLElement.prototype.setAttribute.call(this, key, val);\n }\n //Avoid executing setAttribute methods before connectedCallback\n this._isInstalled && this.update();\n };\n\n WeElement.prototype.pureRemoveAttribute = function pureRemoveAttribute(key) {\n _HTMLElement.prototype.removeAttribute.call(this, key);\n };\n\n WeElement.prototype.pureSetAttribute = function pureSetAttribute(key, val) {\n _HTMLElement.prototype.setAttribute.call(this, key, val);\n };\n\n WeElement.prototype.attrsToProps = function attrsToProps(ignoreAttrs) {\n var ele = this;\n if (ele.normalizedNodeName || ignoreAttrs) return;\n ele.props['css'] = ele.getAttribute('css');\n var attrs = this.constructor.propTypes;\n if (!attrs) return;\n Object.keys(attrs).forEach(function (key) {\n var type = attrs[key];\n var val = ele.getAttribute(hyphenate(key));\n if (val !== null) {\n switch (type) {\n case String:\n ele.props[key] = val;\n break;\n case Number:\n ele.props[key] = Number(val);\n break;\n case Boolean:\n if (val === 'false' || val === '0') {\n ele.props[key] = false;\n } else {\n ele.props[key] = true;\n }\n break;\n case Array:\n case Object:\n ele.props[key] = JSON.parse(val.replace(/(['\"])?([a-zA-Z0-9_-]+)(['\"])?:([^\\/])/g, '\"$2\":$4').replace(/'([\\s\\S]*?)'/g, '\"$1\"').replace(/,(\\s*})/g, '$1'));\n break;\n }\n } else {\n if (ele.constructor.defaultProps && ele.constructor.defaultProps.hasOwnProperty(key)) {\n ele.props[key] = ele.constructor.defaultProps[key];\n } else {\n ele.props[key] = null;\n }\n }\n });\n };\n\n WeElement.prototype.fire = function fire(name, data) {\n this.dispatchEvent(new CustomEvent(name.replace(/-/g, '').toLowerCase(), { detail: data }));\n };\n\n WeElement.prototype.beforeInstall = function beforeInstall() {};\n\n WeElement.prototype.install = function install() {};\n\n WeElement.prototype.afterInstall = function afterInstall() {};\n\n WeElement.prototype.installed = function installed() {};\n\n WeElement.prototype.uninstall = function uninstall() {};\n\n WeElement.prototype.beforeUpdate = function beforeUpdate() {};\n\n WeElement.prototype.updated = function updated() {};\n\n WeElement.prototype.beforeRender = function beforeRender() {};\n\n WeElement.prototype.rendered = function rendered() {};\n\n WeElement.prototype.receiveProps = function receiveProps() {};\n\n WeElement.prototype.beforeObserve = function beforeObserve() {};\n\n WeElement.prototype.observed = function observed() {};\n\n return WeElement;\n}(HTMLElement);\n\nWeElement.is = 'WeElement';\n\nfunction render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent;\n if (store) {\n store.instances = [];\n extendStoreUpate(store);\n\n store.data = new JSONPatcherProxy(store.data).observe(false, function (patch) {\n var patchs = {};\n if (patch.op === 'remove') {\n // fix arr splice\n var kv = getArrayPatch(patch.path, store);\n patchs[kv.k] = kv.v;\n\n update(patchs, store);\n } else {\n var key = fixPath(patch.path);\n patchs[key] = patch.value;\n\n update(patchs, store);\n }\n });\n parent.store = store;\n }\n return diff(null, vnode, {}, false, parent, false);\n}\n\nfunction update(patch, store) {\n store.update(patch);\n}\n\nfunction extendStoreUpate(store) {\n store.update = function (patch) {\n var _this = this;\n\n var updateAll = matchGlobalData(this.globalData, patch);\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(function (instance) {\n if (updateAll || _this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath) || instance._updatePath && needUpdate(patch, instance._updatePath)) {\n //update this.use\n if (instance.constructor.use) {\n instance.use = getUse(store.data, instance.constructor.use);\n } else if (instance.initUse) {\n instance.use = getUse(store.data, instance.initUse());\n }\n\n instance.update();\n }\n });\n this.onChange && this.onChange(patch);\n }\n };\n}\n\nfunction matchGlobalData(globalData, diffResult) {\n if (!globalData) return false;\n for (var keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true;\n }\n for (var i = 0, len = globalData.length; i < len; i++) {\n if (includePath(keyA, globalData[i])) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction needUpdate(diffResult, updatePath) {\n for (var keyA in diffResult) {\n if (updatePath[keyA]) {\n return true;\n }\n for (var keyB in updatePath) {\n if (includePath(keyA, keyB)) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction includePath(pathA, pathB) {\n if (pathA.indexOf(pathB) === 0) {\n var next = pathA.substr(pathB.length, 1);\n if (next === '[' || next === '.') {\n return true;\n }\n }\n return false;\n}\n\nfunction fixPath(path) {\n var mpPath = '';\n var arr = path.replace('/', '').split('/');\n arr.forEach(function (item, index) {\n if (index) {\n if (isNaN(Number(item))) {\n mpPath += '.' + item;\n } else {\n mpPath += '[' + item + ']';\n }\n } else {\n mpPath += item;\n }\n });\n return mpPath;\n}\n\nfunction getArrayPatch(path, store) {\n var arr = path.replace('/', '').split('/');\n var current = store.data[arr[0]];\n for (var i = 1, len = arr.length; i < len - 1; i++) {\n current = current[arr[i]];\n }\n return { k: fixArrPath(path), v: current };\n}\n\nfunction fixArrPath(path) {\n var mpPath = '';\n var arr = path.replace('/', '').split('/');\n var len = arr.length;\n arr.forEach(function (item, index) {\n if (index < len - 1) {\n if (index) {\n if (isNaN(Number(item))) {\n mpPath += '.' + item;\n } else {\n mpPath += '[' + item + ']';\n }\n } else {\n mpPath += item;\n }\n }\n });\n return mpPath;\n}\n\nfunction tag(name, pure) {\n return function (target) {\n target.pure = pure;\n define(name, target);\n };\n}\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its children.\n * @param {VNode} vnode\t\tThe virtual DOM element to clone\n * @param {Object} props\tAttributes/props to add when cloning\n * @param {VNode} rest\t\tAny additional arguments will be used as replacement children.\n */\nfunction cloneElement(vnode, props) {\n return h(vnode.nodeName, extend(extend({}, vnode.attributes), props), arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children);\n}\n\nfunction getHost(ele) {\n var p = ele.parentNode;\n while (p) {\n if (p.host) {\n return p.host;\n } else if (p.shadowRoot && p.shadowRoot.host) {\n return p.shadowRoot.host;\n } else {\n p = p.parentNode;\n }\n }\n}\n\nfunction rpx(str) {\n return str.replace(/([1-9]\\d*|0)(\\.\\d*)*rpx/g, function (a, b) {\n return window.innerWidth * Number(b) / 750 + 'px';\n });\n}\n\nfunction _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn$2(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; }\n\nfunction _inherits$2(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; }\n\nvar ModelView = function (_WeElement) {\n _inherits$2(ModelView, _WeElement);\n\n function ModelView() {\n _classCallCheck$2(this, ModelView);\n\n return _possibleConstructorReturn$2(this, _WeElement.apply(this, arguments));\n }\n\n ModelView.prototype.beforeInstall = function beforeInstall() {\n this.data = this.vm.data;\n };\n\n ModelView.prototype.observed = function observed() {\n this.vm.data = this.data;\n };\n\n return ModelView;\n}(WeElement);\n\nModelView.observe = true;\nModelView.mergeUpdate = false;\n\n/**\n * classNames based on https://github.com/JedWatson/classnames\n * by Jed Watson\n * Licensed under the MIT License\n * https://github.com/JedWatson/classnames/blob/master/LICENSE\n * modified by dntzhang\n */\n\nvar hasOwn = {}.hasOwnProperty;\n\nfunction classNames() {\n var classes = [];\n\n for (var i = 0; i < arguments.length; i++) {\n var arg = arguments[i];\n if (!arg) continue;\n\n var argType = typeof arg;\n\n if (argType === 'string' || argType === 'number') {\n classes.push(arg);\n } else if (Array.isArray(arg) && arg.length) {\n var inner = classNames.apply(null, arg);\n if (inner) {\n classes.push(inner);\n }\n } else if (argType === 'object') {\n for (var key in arg) {\n if (hasOwn.call(arg, key) && arg[key]) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(' ');\n}\n\nfunction extractClass() {\n var _Array$prototype$slic = Array.prototype.slice.call(arguments, 0),\n props = _Array$prototype$slic[0],\n args = _Array$prototype$slic.slice(1);\n\n if (props.class) {\n args.unshift(props.class);\n delete props.class;\n } else if (props.className) {\n args.unshift(props.className);\n delete props.className;\n }\n if (args.length > 0) {\n return { class: classNames.apply(null, args) };\n }\n}\n\nfunction o(obj) {\n return JSON.stringify(obj);\n}\n\nvar n=function(t,r,u,e){for(var p=1;p\"===t?(a(), u=1):u&&(\"=\"===t?(u=4, r=e, e=\"\"):\"/\"===t?(a(), 3===u&&(s=s[0]), u=s, (s=s[0]).push(u,4), u=0):\" \"===t||\"\\t\"===t||\"\\n\"===t||\"\\r\"===t?(a(), u=2):e+=t);}return a(), s},r=\"function\"==typeof Map,u=r?new Map:{},e=r?function(n){var r=u.get(n);return r||u.set(n,r=t(n)), r}:function(n){for(var r=\"\",e=0;e1?r:r[0]}\n\nvar html = htm.bind(h);\n\nfunction createRef() {\n return {};\n}\n\nvar Component = WeElement;\nvar defineElement = define;\nvar elements = options.mapping;\n\nvar omi = {\n tag: tag,\n WeElement: WeElement,\n Component: Component,\n render: render,\n h: h,\n createElement: h,\n options: options,\n define: define,\n observe: observe,\n cloneElement: cloneElement,\n getHost: getHost,\n rpx: rpx,\n tick: tick,\n nextTick: nextTick,\n ModelView: ModelView,\n defineElement: defineElement,\n classNames: classNames,\n extractClass: extractClass,\n createRef: createRef,\n html: html,\n htm: htm,\n o: o,\n elements: elements\n};\n\noptions.root.Omi = omi;\noptions.root.omi = omi;\noptions.root.Omi.version = '6.6.8';\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (omi);\n\n//# sourceMappingURL=omi.esm.js.map\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../_webpack@4.35.0@webpack/buildin/global.js */ \"./node_modules/_webpack@4.35.0@webpack/buildin/global.js\")))\n\n//# sourceURL=webpack:///./node_modules/_omi@6.6.7@omi/dist/omi.esm.js?"); /***/ }), -/***/ "./node_modules/_webpack@4.34.0@webpack/buildin/global.js": +/***/ "./node_modules/_webpack@4.35.0@webpack/buildin/global.js": /*!***********************************!*\ !*** (webpack)/buildin/global.js ***! \***********************************/ @@ -162,7 +162,7 @@ eval("\n var result = __webpack_require__(/*! !../../node_modules/_css-lo /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar omi_1 = __webpack_require__(/*! omi */ \"./node_modules/_omi@6.6.5@omi/dist/omi.esm.js\");\nvar css = __webpack_require__(/*! ./index.scss */ \"./src/expansion/index.scss\");\nvar dom_ready_1 = __webpack_require__(/*! ../util/dom-ready */ \"./src/util/dom-ready.js\");\n//@ts-ignore\n__webpack_require__(/*! ../theme.ts */ \"./src/theme.ts\");\nvar Expansion = /** @class */ (function (_super) {\n __extends(Expansion, _super);\n function Expansion() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Expansion.prototype.receiveProps = function () {\n var rect = this.shadowRoot.querySelector('div').getBoundingClientRect();\n if (this.props.expand) {\n this.style.height = rect.height + 'px';\n }\n else {\n this.style.height = '0px';\n }\n return false;\n };\n Expansion.prototype.setAttribute = function (attr, value) {\n if (attr.toLowerCase() === 'expand') {\n this.style.height = this.shadowRoot.querySelector('div').getBoundingClientRect().height + 'px';\n }\n else {\n //@ts-ignore\n _super.prototype.pureSetAttribute.call(this, attr);\n }\n };\n Expansion.prototype.removeAttribute = function (attr) {\n if (attr === 'expand') {\n this.style.height = '0px';\n }\n else {\n //@ts-ignore\n _super.prototype.pureRemoveAttribute.call(this, attr);\n }\n };\n Expansion.prototype.install = function () {\n var _this = this;\n dom_ready_1.domReady(function () {\n var rect = _this.shadowRoot.querySelector('div').getBoundingClientRect();\n if (!_this.props.expand) {\n _this.style.height = '0px';\n }\n else {\n _this.style.height = rect.height + 'px';\n }\n });\n };\n Expansion.prototype.render = function (props) {\n return (omi_1.h(\"div\", null,\n omi_1.h(\"slot\", null)));\n };\n Expansion.css = css;\n Expansion.propTypes = {\n expand: Boolean\n };\n Expansion = __decorate([\n omi_1.tag('m-expansion')\n ], Expansion);\n return Expansion;\n}(omi_1.WeElement));\nexports.default = Expansion;\n\n\n//# sourceURL=webpack:///./src/expansion/index.tsx?"); +eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar omi_1 = __webpack_require__(/*! omi */ \"./node_modules/_omi@6.6.7@omi/dist/omi.esm.js\");\nvar css = __webpack_require__(/*! ./index.scss */ \"./src/expansion/index.scss\");\nvar dom_ready_1 = __webpack_require__(/*! ../util/dom-ready */ \"./src/util/dom-ready.js\");\n//@ts-ignore\n__webpack_require__(/*! ../theme.ts */ \"./src/theme.ts\");\nvar Expansion = /** @class */ (function (_super) {\n __extends(Expansion, _super);\n function Expansion() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Expansion.prototype.receiveProps = function () {\n var rect = this.shadowRoot.querySelector('div').getBoundingClientRect();\n if (this.props.expand) {\n this.style.height = rect.height + 'px';\n }\n else {\n this.style.height = '0px';\n }\n return false;\n };\n Expansion.prototype.setAttribute = function (attr, value) {\n if (attr.toLowerCase() === 'expand') {\n this.style.height = this.shadowRoot.querySelector('div').getBoundingClientRect().height + 'px';\n }\n else {\n //@ts-ignore\n _super.prototype.pureSetAttribute.call(this, attr);\n }\n };\n Expansion.prototype.removeAttribute = function (attr) {\n if (attr === 'expand') {\n this.style.height = '0px';\n }\n else {\n //@ts-ignore\n _super.prototype.pureRemoveAttribute.call(this, attr);\n }\n };\n Expansion.prototype.install = function () {\n var _this = this;\n dom_ready_1.domReady(function () {\n var rect = _this.shadowRoot.querySelector('div').getBoundingClientRect();\n if (!_this.props.expand) {\n _this.style.height = '0px';\n }\n else {\n _this.style.height = rect.height + 'px';\n }\n });\n };\n Expansion.prototype.render = function (props) {\n return (omi_1.h(\"div\", null,\n omi_1.h(\"slot\", null)));\n };\n Expansion.css = css;\n Expansion.propTypes = {\n expand: Boolean\n };\n Expansion = __decorate([\n omi_1.tag('m-expansion')\n ], Expansion);\n return Expansion;\n}(omi_1.WeElement));\nexports.default = Expansion;\n\n\n//# sourceURL=webpack:///./src/expansion/index.tsx?"); /***/ }), diff --git a/packages/omim/src/expansion/index.d.ts b/packages/omim/src/expansion/index.d.ts index 8b2d8ec51e..4e2a6a2a1f 100644 --- a/packages/omim/src/expansion/index.d.ts +++ b/packages/omim/src/expansion/index.d.ts @@ -10,7 +10,6 @@ export default class Expansion extends WeElement { static propTypes: { expand: BooleanConstructor; }; - _host: HTMLElement; preHeight: number; receiveProps(): boolean; setAttribute(attr: any, value: any): void; diff --git a/packages/omim/src/expansion/index.tsx b/packages/omim/src/expansion/index.tsx index 0129aebc4b..1f3babdb35 100644 --- a/packages/omim/src/expansion/index.tsx +++ b/packages/omim/src/expansion/index.tsx @@ -18,7 +18,6 @@ export default class Expansion extends WeElement { expand: Boolean } - _host: HTMLElement preHeight: number receiveProps(){ diff --git a/packages/omim/src/scroll/index.d.ts b/packages/omim/src/scroll/index.d.ts index ee183bb790..6aa5c76a37 100644 --- a/packages/omim/src/scroll/index.d.ts +++ b/packages/omim/src/scroll/index.d.ts @@ -1,11 +1,27 @@ import { WeElement } from 'omi'; -export default class SimpleCard extends WeElement { +interface Props { + vertical: boolean; + min: number; + max: number; + sensitivity: number; + factor: number; + step: number; + bindSelf: boolean; + preventDefault: boolean; + onChange: () => void; + onTouchStart: () => void; + onTouchMove: () => void; + onTouchEnd: () => void; + onTap: () => void; + onPressMove: () => void; + onAnimationEnd: () => void; +} +export default class Scroll extends WeElement { static css: any; static propTypes: { - color: StringConstructor; - path: StringConstructor; - info: StringConstructor; - caption: StringConstructor; + vertical: BooleanConstructor; }; - render(props: any): JSX.Element; + installed(): void; + render(): any; } +export {}; diff --git a/packages/omim/src/scroll/index.js b/packages/omim/src/scroll/index.js index d00b37ea63..023de8f8fc 100644 --- a/packages/omim/src/scroll/index.js +++ b/packages/omim/src/scroll/index.js @@ -4,9 +4,9 @@ else if(typeof define === 'function' && define.amd) define(["omi"], factory); else if(typeof exports === 'object') - exports["MSimpleCard"] = factory(require("omi")); + exports["MScroll"] = factory(require("omi")); else - root["MSimpleCard"] = factory(root["Omi"]); + root["MScroll"] = factory(root["Omi"]); })(window, function(__WEBPACK_EXTERNAL_MODULE_omi__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache @@ -91,15 +91,15 @@ return /******/ (function(modules) { // webpackBootstrap /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./src/simple-card/index.tsx"); +/******/ return __webpack_require__(__webpack_require__.s = "./src/scroll/index.tsx"); /******/ }) /************************************************************************/ /******/ ({ -/***/ "./node_modules/_css-loader@1.0.1@css-loader/index.js!./node_modules/_resolve-url-loader@3.1.0@resolve-url-loader/index.js!./node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js?!./src/simple-card/index.scss": -/*!******************************************************************************************************************************************************************************************************************!*\ - !*** ./node_modules/_css-loader@1.0.1@css-loader!./node_modules/_resolve-url-loader@3.1.0@resolve-url-loader!./node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js??ref--4-3!./src/simple-card/index.scss ***! - \******************************************************************************************************************************************************************************************************************/ +/***/ "./node_modules/_css-loader@1.0.1@css-loader/index.js!./node_modules/_resolve-url-loader@3.1.0@resolve-url-loader/index.js!./node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js?!./src/scroll/index.scss": +/*!*************************************************************************************************************************************************************************************************************!*\ + !*** ./node_modules/_css-loader@1.0.1@css-loader!./node_modules/_resolve-url-loader@3.1.0@resolve-url-loader!./node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js??ref--4-3!./src/scroll/index.scss ***! + \*************************************************************************************************************************************************************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -108,7 +108,7 @@ exports = module.exports = __webpack_require__(/*! ../../node_modules/_css-loade // module -exports.push([module.i, ".card {\n display: inline-block;\n box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n text-decoration: none;\n height: 85px;\n white-space: nowrap;\n width: 100%;\n text-align: center;\n border-radius: 4px;\n overflow: hidden; }\n\n.icon {\n display: inline-block;\n width: 50%;\n height: 85px;\n vertical-align: top;\n padding-top: 20px; }\n\n* {\n box-sizing: border-box; }\n\n.text {\n display: inline-block;\n width: 50%;\n height: 85px;\n vertical-align: top;\n color: white;\n line-height: 20px;\n padding-top: 20px; }\n\n.info {\n font-weight: bold;\n margin-bottom: 5px; }\n\n.caption {\n font-size: 14px; }\n", ""]); +exports.push([module.i, ":host {\n display: inline-block; }\n\n.card {\n display: inline-block;\n box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n text-decoration: none;\n height: 85px;\n white-space: nowrap;\n width: 100%;\n text-align: center;\n border-radius: 4px;\n overflow: hidden; }\n\n.icon {\n display: inline-block;\n width: 50%;\n height: 85px;\n vertical-align: top;\n padding-top: 20px; }\n\n* {\n box-sizing: border-box; }\n\n.text {\n display: inline-block;\n width: 50%;\n height: 85px;\n vertical-align: top;\n color: white;\n line-height: 20px;\n padding-top: 20px; }\n\n.info {\n font-weight: bold;\n margin-bottom: 5px; }\n\n.caption {\n font-size: 14px; }\n", ""]); // exports @@ -202,15 +202,453 @@ function toComment(sourceMap) { /***/ }), -/***/ "./src/simple-card/index.scss": -/*!************************************!*\ - !*** ./src/simple-card/index.scss ***! - \************************************/ +/***/ "./node_modules/_phy-scroll@1.0.3@phy-scroll/index.js": +/*!************************************************************!*\ + !*** ./node_modules/_phy-scroll@1.0.3@phy-scroll/index.js ***! + \************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { +/* phy-scroll v1.0.3 + * By dntzhang https://github.com/dntzhang + * Github: https://github.com/Tencent/omi/tree/master/packages/phy-scroll + * MIT Licensed. + */ + +; (function () { + 'use strict'; + + if (!Date.now) + Date.now = function () { return new Date().getTime(); }; + + var vendors = ['webkit', 'moz']; + for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { + var vp = vendors[i]; + window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; + window.cancelAnimationFrame = (window[vp + 'CancelAnimationFrame'] + || window[vp + 'CancelRequestAnimationFrame']); + } + if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy + || !window.requestAnimationFrame || !window.cancelAnimationFrame) { + var lastTime = 0; + window.requestAnimationFrame = function (callback) { + var now = Date.now(); + var nextTime = Math.max(lastTime + 16, now); + return setTimeout(function () { callback(lastTime = nextTime); }, + nextTime - now); + }; + window.cancelAnimationFrame = clearTimeout; + } +}()); + +; (function () { + + var supportsPassiveOption = false; + try { + var opts = Object.defineProperty({}, 'passive', { + get: function() { + supportsPassiveOption = true; + } + }); + window.addEventListener('test', null, opts); + } catch (e) {} + + var _elementStyle = document.createElement('div').style, + endTransitionEventName, + transitionDuration, + transitionTimingFunction, + transform; + + if ('transform' in _elementStyle) { + transform = 'transform'; + endTransitionEventName = 'transitionend'; + transitionDuration = 'transitionDuration'; + transitionTimingFunction = 'transitionTimingFunction'; + } else if ('webkitTransform' in _elementStyle) { + transform = 'webkitTransform'; + endTransitionEventName = 'webkitTransitionEnd'; + transitionDuration = 'webkitTransitionDuration'; + transitionTimingFunction = 'webkitTransitionTimingFunction'; + } else { + throw 'please use a modern browser' + } + + var ease = 'cubic-bezier(0.1, 0.57, 0.1, 1)'; + + function reverseEase(y) { + return 1 - Math.sqrt(1 - y * y); + } + + function bind(element, type, callback) { + element.addEventListener(type, callback, false); + } + + function unbind(element, type, callback) { + element.removeEventListener(type, callback); + } + + function preventDefaultTest(el, exceptions) { + for (var i in exceptions) { + if (exceptions[i].test(el[i])) { + return true; + } + } + return false; + } + + function getTransform(ele) { + return +ele.style[transform].replace(/[^\-?\d.]/g, '') + } + + function setTransform(ele, prop, val) { + ele.style[transform] = prop + '(' + val + 'px)' + } + + var PhyScroll = function (option) { + this.scroll = typeof option.scroll === "string" ? document.querySelector(option.scroll) : option.scroll; + + //内部会有scroll出现的DOM + //如果配置这个属性,需要min=max=0,否则会有意想不到的糟糕效果 + this.scrollDom = option.scrollDom; + + this.element = typeof option.touch === "string" ? document.querySelector(option.touch) : option.touch; + this.vertical = this._getValue(option.vertical, true); + this.property = this.vertical ? 'translateY' : 'translateX'; + this.preventDefault = this._getValue(option.preventDefault, true); + this.sensitivity = this._getValue(option.sensitivity, 1); + this.lockDirection = this._getValue(option.lockDirection, true); + + this.value = this._getValue(option.value, 0); + + setTransform(this.scroll, this.property, this.value) + + this.moveFactor = this._getValue(option.moveFactor, 1); + this.factor = this._getValue(option.factor, 1); + this.outFactor = this._getValue(option.outFactor, 0.3); + + this.min = option.min; + this.max = option.max; + + this.maxRegion = this._getValue(option.maxRegion, 60); + + this.deceleration = 0.0006; + this.maxRegion = this._getValue(option.maxRegion, 600); + this.springMaxRegion = this._getValue(option.springMaxRegion, 60); + + this.change = option.change || function () { }; + this.touchEnd = option.touchEnd || function () { }; + this.touchStart = option.touchStart || function () { }; + this.touchMove = option.touchMove || function () { }; + this.touchCancel = option.touchMove || function () { }; + this.animationEnd = option.animationEnd || function () { }; + + this.preventDefaultException = { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ }; + this.hasMin = !(this.min === void 0); + this.hasMax = !(this.max === void 0); + this.isTouchStart = false; + this.step = option.step; + this.inertia = this._getValue(option.inertia, true); + this.maxSpeed = option.maxSpeed; + this.hasMaxSpeed = !(this.maxSpeed === void 0); + + if (this.hasMax && this.hasMin) { + if (this.min > this.max) throw "min value can't be greater than max value"; + this.currentPage = Math.round((this.max - getTransform(this.scroll)) / this.step); + } + + this._startHandler = this._start.bind(this); + this._moveHandler = this._move.bind(this); + this._transitionEndHandler = this._transitionEnd.bind(this); + this._endHandler = this._end.bind(this); + this._cancelHandler = this._cancel.bind(this); + bind(this.element, "touchstart", this._startHandler); + bind(this.scroll, endTransitionEventName, this._transitionEndHandler); + document.addEventListener('touchmove', this._moveHandler, supportsPassiveOption ? { + passive: false + }: false) + bind(document, "touchend", this._endHandler); + bind(document, "touchcancel", this._cancelHandler); + //当有step设置的时候防止执行两次end + this._endCallbackTag = true; + + this._endTimeout = null; + }; + + PhyScroll.prototype = { + _getValue: function (obj, defaultValue) { + return obj === void 0 ? defaultValue : obj; + }, + _transitionEnd: function () { + if (!this._triggerTransitionEnd) return; + var current = getTransform(this.scroll); + if (current < this.min) { + this.to(this.min, 600, ease); + return; + } else if (current > this.max) { + this.to(this.max, 600, ease); + return; + } + + if (this.step) { + this.correction(); + if (this._endCallbackTag) { + this._endTimeout = setTimeout(function () { + this.animationEnd.call(this, current, this.index); + cancelAnimationFrame(this.tickID); + }.bind(this), 400); + this._endCallbackTag = false; + } + } else { + this.animationEnd.call(this, current, this.index); + cancelAnimationFrame(this.tickID); + } + }, + _cancelAnimation: function () { + this.scroll.style[transitionDuration] = '0ms'; + setTransform(this.scroll, this.property, this.getComputedPosition()); + + }, + getComputedPosition: function () { + var matrix = window.getComputedStyle(this.scroll, null); + matrix = matrix[transform].split(')')[0].split(', '); + return this.vertical ? (+(matrix[13] || matrix[5])) : (+(matrix[12] || matrix[4])); + }, + _tick: function () { + this.change.call(this, this.getComputedPosition()); + this.tickID = requestAnimationFrame(this._tick.bind(this)); + }, + stop: function () { + cancelAnimationFrame(this.tickID); + this._cancelAnimation(); + clearTimeout(this._endTimeout); + if (this.hasMax && this.hasMin) { + this.currentPage = Math.round((this.max - getTransform(this.scroll)) / this.step); + } + }, + _start: function (evt) { + cancelAnimationFrame(this.tickID); + this._tick(); + + this._endCallbackTag = true; + this.isTouchStart = true; + this._firstTouchMove = true; + this._preventMove = false; + this.touchStart.call(this, evt, getTransform(this.scroll)); + this._cancelAnimation(); + clearTimeout(this._endTimeout); + if (this.hasMax && this.hasMin) { + this.currentPage = Math.round((this.max - getTransform(this.scroll)) / this.step); + } + this.startTime = new Date().getTime(); + this._startX = this.preX = evt.touches[0].pageX; + this._startY = this.preY = evt.touches[0].pageY; + this.start = this.vertical ? this.preY : this.preX; + }, + /** + * 根据滑动方向判断 + * @param element 具有scroll的DOM + * @param move 滚动的距离 + * @param property 滚动的方向 + * @returns {*} 返回当前滑动状态下,element元素的scroll位置信息,'middle'-scroll正在滚动 + * @private + */ + _scrollPosition: function (element, move, property) { + var scrollKeys = property === 'translateY' + ? ['scrollTop', 'offsetHeight', 'scrollHeight'] + : property === 'translateX' ? ['scrollLeft', 'offsetWidth', 'scrollWidth'] : null; + if (!scrollKeys) { return '' } + + var scroll_start = element[scrollKeys[0]] || 0; + if (scroll_start === 0 && move >= 0) { + return 'start' + } + var visible_range = element[scrollKeys[1]] || 0, + scroll_range = element[scrollKeys[2]] || 0; + if (scroll_range === visible_range + scroll_start) { + return 'end' + } + return 'middle' + }, + _move: function (evt) { + + //如果当前滑动的时候,滚动元素scrollDOM非触发边界,则不触发滚动效果 + if (this.scrollDom && this._scrollPosition( + this.scrollDom, + getTransform(this.scroll), + this.property + ) === 'middle') { + evt.preventDefault(); + return false; + } + + if (this.isTouchStart) { + var dx = Math.abs(evt.touches[0].pageX - this._startX), dy = Math.abs(evt.touches[0].pageY - this._startY); + if (this._firstTouchMove && this.lockDirection) { + var dDis = dx - dy; + if (dDis > 0 && this.vertical) { + this._preventMove = true; + } else if (dDis < 0 && !this.vertical) { + this._preventMove = true; + } + this._firstTouchMove = false; + } + if (dx < 10 && dy < 10) return; + + if (!this._preventMove) { + var f = this.moveFactor; + var d = (this.vertical ? evt.touches[0].pageY - this.preY : evt.touches[0].pageX - this.preX) * this.sensitivity; + if (this.hasMax && getTransform(this.scroll) > this.max && d > 0) { + f = this.outFactor; + } else if (this.hasMin && getTransform(this.scroll) < this.min && d < 0) { + f = this.outFactor; + } + d *= f; + this.preX = evt.touches[0].pageX; + this.preY = evt.touches[0].pageY; + setTransform(this.scroll, this.property, getTransform(this.scroll) + d); + + var timestamp = new Date().getTime(); + if (timestamp - this.startTime > 300) { + this.startTime = timestamp; + this.start = this.vertical ? this.preY : this.preX; + } + this.touchMove.call(this, evt, getTransform(this.scroll)); + + } + + if (this.preventDefault && !preventDefaultTest(evt.target, this.preventDefaultException)) { + evt.preventDefault(); + } + } + }, + _end: function (evt) { + if (this.isTouchStart) { + var self = this, + current = getTransform(this.scroll); + if (this.touchEnd.call(this, evt, current) === false) { + this._triggerTransitionEnd = false; + cancelAnimationFrame(this.tickID); + return; + } else { + this._triggerTransitionEnd = true; + } + if (this.hasMax && current > this.max) { + this.to(this.max, 600, ease); + } else if (this.hasMin && current < this.min) { + this.to(this.min, 600, ease); + } else if (this.inertia && !this._preventMove) { + var dt = new Date().getTime() - this.startTime; + if (dt < 300) { + + var distance = ((this.vertical ? evt.changedTouches[0].pageY : evt.changedTouches[0].pageX) - this.start) * this.sensitivity, + speed = Math.abs(distance) / dt, + speed2 = this.factor * speed; + if (this.hasMaxSpeed && speed2 > this.maxSpeed) { + speed2 = this.maxSpeed; + } + var destination = current + (speed2 * speed2) / (2 * this.deceleration) * (distance < 0 ? -1 : 1); + + var tRatio = 1; + if (destination < this.min) { + if (destination < this.min - this.maxRegion) { + tRatio = reverseEase((current - this.min + this.springMaxRegion) / (current - destination)); + destination = this.min - this.springMaxRegion; + } else { + tRatio = reverseEase((current - this.min + this.springMaxRegion * (this.min - destination) / this.maxRegion) / (current - destination)); + destination = this.min - this.springMaxRegion * (this.min - destination) / this.maxRegion; + } + } else if (destination > this.max) { + if (destination > this.max + this.maxRegion) { + tRatio = reverseEase((this.max + this.springMaxRegion - current) / (destination - current)); + destination = this.max + this.springMaxRegion; + } else { + tRatio = reverseEase((this.max + this.springMaxRegion * (destination - this.max) / this.maxRegion - current) / (destination - current)); + destination = this.max + this.springMaxRegion * (destination - this.max) / this.maxRegion; + + } + } + var duration = Math.round(speed / self.deceleration) * tRatio; + + self.to(Math.round(destination), duration, ease); + } else { + if (self.step) { + self.correction(); + } + } + } else { + if (self.step) { + self.correction(); + } + } + // if (this.preventDefault && !preventDefaultTest(evt.target, this.preventDefaultException)) { + // evt.preventDefault(); + // } + this.isTouchStart = false; + } + }, + _cancel: function (evt) { + cancelAnimationFrame(this.tickID); + if (this.step) { + this.correction(); + } + this.touchCancel.call(this, evt); + }, + to: function (value, time, u_ease) { + var el = this.scroll, + property = this.property; + + el.style[transitionDuration] = this._getValue(time, 600) + 'ms'; + el.style[transitionTimingFunction] = u_ease || ease; + setTransform(el, property, value) + }, + correction: function (time) { + var time = typeof time === 'number' ? time : 400; + + var value = getTransform(this.scroll) + var rpt = Math.floor(Math.abs(value / this.step)); + var dy = value % this.step; + var result; + if (Math.abs(dy) > this.step / 2) { + result = (value < 0 ? -1 : 1) * (rpt + 1) * this.step; + if (result > this.max) result = this.max; + if (result < this.min) result = this.min; + this.to(result, time, ease); + this.index = (value < 0 ? -1 : 1) * (rpt + 1) + } else { + result = (value < 0 ? -1 : 1) * rpt * this.step; + if (result > this.max) result = this.max; + if (result < this.min) result = this.min; + this.to(result, time, ease); + this.index = (value < 0 ? -1 : 1) * rpt + } + }, + destroy: function () { + unbind(this.element, "touchstart", this._startHandler); + unbind(this.scroll, endTransitionEventName, this._transitionEndHandler); + unbind(window, "touchmove", this._moveHandler); + unbind(window, "touchend", this._endHandler); + unbind(window, "touchcancel", this._cancelHandler); + } + }; - var result = __webpack_require__(/*! !../../node_modules/_css-loader@1.0.1@css-loader!../../node_modules/_resolve-url-loader@3.1.0@resolve-url-loader!../../node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js??ref--4-3!./index.scss */ "./node_modules/_css-loader@1.0.1@css-loader/index.js!./node_modules/_resolve-url-loader@3.1.0@resolve-url-loader/index.js!./node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js?!./src/simple-card/index.scss"); + if (true) { + module.exports = PhyScroll; + } else {} + +})(); + + +/***/ }), + +/***/ "./src/scroll/index.scss": +/*!*******************************!*\ + !*** ./src/scroll/index.scss ***! + \*******************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + + + var result = __webpack_require__(/*! !../../node_modules/_css-loader@1.0.1@css-loader!../../node_modules/_resolve-url-loader@3.1.0@resolve-url-loader!../../node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js??ref--4-3!./index.scss */ "./node_modules/_css-loader@1.0.1@css-loader/index.js!./node_modules/_resolve-url-loader@3.1.0@resolve-url-loader/index.js!./node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js?!./src/scroll/index.scss"); if (typeof result === "string") { module.exports = result; @@ -221,10 +659,10 @@ function toComment(sourceMap) { /***/ }), -/***/ "./src/simple-card/index.tsx": -/*!***********************************!*\ - !*** ./src/simple-card/index.tsx ***! - \***********************************/ +/***/ "./src/scroll/index.tsx": +/*!******************************!*\ + !*** ./src/scroll/index.tsx ***! + \******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -250,35 +688,49 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); -var css = __webpack_require__(/*! ./index.scss */ "./src/simple-card/index.scss"); +var css = __webpack_require__(/*! ./index.scss */ "./src/scroll/index.scss"); var omi_1 = __webpack_require__(/*! omi */ "omi"); -var SimpleCard = /** @class */ (function (_super) { - __extends(SimpleCard, _super); - function SimpleCard() { +var PhyScroll = __webpack_require__(/*! phy-scroll */ "./node_modules/_phy-scroll@1.0.3@phy-scroll/index.js"); +var Scroll = /** @class */ (function (_super) { + __extends(Scroll, _super); + function Scroll() { return _super !== null && _super.apply(this, arguments) || this; } - SimpleCard.prototype.render = function (props) { - return omi_1.h("div", { class: "card" }, - omi_1.h("div", { class: "icon" }, - omi_1.h("svg", { viewBox: "64 64 896 896", class: "", "data-icon": "twitter", width: "3em", height: "3em", fill: props.color, "aria-hidden": "true", focusable: "false" }, - omi_1.h("path", { d: props.path }))), - omi_1.h("div", { class: "text", style: { background: props.color } }, - omi_1.h("div", { class: "info" }, props.info), - omi_1.h("span", { class: "caption" }, props.caption))); + Scroll.prototype.installed = function () { + var target = this.rootNode.firstChild; + new PhyScroll({ + touch: this.rootNode, + vertical: this.props.vertical === false ? false : true, + scroll: target, + min: this.props.min, + max: this.props.max, + sensitivity: this.props.sensitivity, + factor: this.props.factor, + step: this.props.step, + bindSelf: this.props.bindSelf, + preventDefault: this.props.preventDefault === false ? false : true, + change: this.props.onChange, + touchStart: this.props.onTouchStart, + touchMove: this.props.onTouchMove, + touchEnd: this.props.onTouchEnd, + tap: this.props.onTap, + pressMove: this.props.onPressMove, + animationEnd: this.props.onAnimationEnd + }); + }; + Scroll.prototype.render = function () { + return this.props.children[0]; }; - SimpleCard.css = css; - SimpleCard.propTypes = { - color: String, - path: String, - info: String, - caption: String + Scroll.css = css; + Scroll.propTypes = { + vertical: Boolean }; - SimpleCard = __decorate([ - omi_1.tag('m-simple-card') - ], SimpleCard); - return SimpleCard; + Scroll = __decorate([ + omi_1.tag('m-scroll') + ], Scroll); + return Scroll; }(omi_1.WeElement)); -exports.default = SimpleCard; +exports.default = Scroll; /***/ }), diff --git a/packages/omim/src/scroll/index.js.map b/packages/omim/src/scroll/index.js.map index f25738354c..b9bd3975fd 100644 --- a/packages/omim/src/scroll/index.js.map +++ b/packages/omim/src/scroll/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://MSimpleCard/webpack/universalModuleDefinition","webpack://MSimpleCard/webpack/bootstrap","webpack://MSimpleCard/./src/simple-card/index.scss","webpack://MSimpleCard/./node_modules/_css-loader@1.0.1@css-loader/lib/css-base.js","webpack://MSimpleCard/./src/simple-card/index.scss?92c1","webpack://MSimpleCard/./src/simple-card/index.tsx","webpack://MSimpleCard/external {\"commonjs\":\"omi\",\"commonjs2\":\"omi\",\"amd\":\"omi\",\"root\":\"Omi\"}"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;AClFA,2BAA2B,mBAAO,CAAC,oIAAiE;AACpG;;;AAGA;AACA,cAAc,QAAS,UAAU,0BAA0B,oHAAoH,0BAA0B,iBAAiB,wBAAwB,gBAAgB,uBAAuB,uBAAuB,qBAAqB,EAAE,WAAW,0BAA0B,eAAe,iBAAiB,wBAAwB,sBAAsB,EAAE,OAAO,2BAA2B,EAAE,WAAW,0BAA0B,eAAe,iBAAiB,wBAAwB,iBAAiB,sBAAsB,sBAAsB,EAAE,WAAW,sBAAsB,uBAAuB,EAAE,cAAc,oBAAoB,EAAE;;AAE1tB;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA;;;;;;;;;;;;;AC1EA,qBAAqB,mBAAO,CAAC,oaAA4N;;AAEzP;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;ACPa;AACb;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,uDAAuD;AACpF;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA,8CAA8C,cAAc;AAC5D,UAAU,mBAAO,CAAC,kDAAc;AAChC,YAAY,mBAAO,CAAC,gBAAK;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,gBAAgB;AAC/C,4BAA4B,gBAAgB;AAC5C,gCAAgC,yJAAyJ;AACzL,qCAAqC,gBAAgB;AACrD,4BAA4B,wBAAwB,0BAA0B,EAAE;AAChF,gCAAgC,gBAAgB;AAChD,iCAAiC,mBAAmB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;;;;;ACjDA,iD","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"omi\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"omi\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"MSimpleCard\"] = factory(require(\"omi\"));\n\telse\n\t\troot[\"MSimpleCard\"] = factory(root[\"Omi\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE_omi__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/simple-card/index.tsx\");\n","exports = module.exports = require(\"../../node_modules/_css-loader@1.0.1@css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.id, \".card {\\n display: inline-block;\\n box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n text-decoration: none;\\n height: 85px;\\n white-space: nowrap;\\n width: 100%;\\n text-align: center;\\n border-radius: 4px;\\n overflow: hidden; }\\n\\n.icon {\\n display: inline-block;\\n width: 50%;\\n height: 85px;\\n vertical-align: top;\\n padding-top: 20px; }\\n\\n* {\\n box-sizing: border-box; }\\n\\n.text {\\n display: inline-block;\\n width: 50%;\\n height: 85px;\\n vertical-align: top;\\n color: white;\\n line-height: 20px;\\n padding-top: 20px; }\\n\\n.info {\\n font-weight: bold;\\n margin-bottom: 5px; }\\n\\n.caption {\\n font-size: 14px; }\\n\", \"\"]);\n\n// exports\n","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n","\n var result = require(\"!!../../node_modules/_css-loader@1.0.1@css-loader/index.js!../../node_modules/_resolve-url-loader@3.1.0@resolve-url-loader/index.js!../../node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js??ref--4-3!./index.scss\");\n\n if (typeof result === \"string\") {\n module.exports = result;\n } else {\n module.exports = result.toString();\n }\n ","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar css = require(\"./index.scss\");\nvar omi_1 = require(\"omi\");\nvar SimpleCard = /** @class */ (function (_super) {\n __extends(SimpleCard, _super);\n function SimpleCard() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SimpleCard.prototype.render = function (props) {\n return omi_1.h(\"div\", { class: \"card\" },\n omi_1.h(\"div\", { class: \"icon\" },\n omi_1.h(\"svg\", { viewBox: \"64 64 896 896\", class: \"\", \"data-icon\": \"twitter\", width: \"3em\", height: \"3em\", fill: props.color, \"aria-hidden\": \"true\", focusable: \"false\" },\n omi_1.h(\"path\", { d: props.path }))),\n omi_1.h(\"div\", { class: \"text\", style: { background: props.color } },\n omi_1.h(\"div\", { class: \"info\" }, props.info),\n omi_1.h(\"span\", { class: \"caption\" }, props.caption)));\n };\n SimpleCard.css = css;\n SimpleCard.propTypes = {\n color: String,\n path: String,\n info: String,\n caption: String\n };\n SimpleCard = __decorate([\n omi_1.tag('m-simple-card')\n ], SimpleCard);\n return SimpleCard;\n}(omi_1.WeElement));\nexports.default = SimpleCard;\n","module.exports = __WEBPACK_EXTERNAL_MODULE_omi__;"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://MScroll/webpack/universalModuleDefinition","webpack://MScroll/webpack/bootstrap","webpack://MScroll/./src/scroll/index.scss","webpack://MScroll/./node_modules/_css-loader@1.0.1@css-loader/lib/css-base.js","webpack://MScroll/./node_modules/_phy-scroll@1.0.3@phy-scroll/index.js","webpack://MScroll/./src/scroll/index.scss?59fd","webpack://MScroll/./src/scroll/index.tsx","webpack://MScroll/external {\"commonjs\":\"omi\",\"commonjs2\":\"omi\",\"amd\":\"omi\",\"root\":\"Omi\"}"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;AClFA,2BAA2B,mBAAO,CAAC,oIAAiE;AACpG;;;AAGA;AACA,cAAc,QAAS,UAAU,0BAA0B,EAAE,WAAW,0BAA0B,oHAAoH,0BAA0B,iBAAiB,wBAAwB,gBAAgB,uBAAuB,uBAAuB,qBAAqB,EAAE,WAAW,0BAA0B,eAAe,iBAAiB,wBAAwB,sBAAsB,EAAE,OAAO,2BAA2B,EAAE,WAAW,0BAA0B,eAAe,iBAAiB,wBAAwB,iBAAiB,sBAAsB,sBAAsB,EAAE,WAAW,sBAAsB,uBAAuB,EAAE,cAAc,oBAAoB,EAAE;;AAEjwB;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD,IAAI;AACJ;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,cAAc;;AAElE;AACA;;;;;;;;;;;;AC3EA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD;;AAEA;AACA,4BAA4B,6BAA6B;;AAEzD;AACA,iBAAiB,qDAAqD;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,+BAA+B,EAAE;AACtE;AACA;AACA;AACA;AACA,CAAC;;AAED,CAAC;;AAED;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA,KAAK;AACL;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,gDAAgD;AAChD,oDAAoD;AACpD,wDAAwD;AACxD,sDAAsD;AACtD,wDAAwD;AACxD,4DAA4D;;AAE5D,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,iBAAiB,EAAE;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,eAAe;AACf;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAM,IAA4D;AAClE;AACA,GAAG,MAAM,EAEN;;AAEH,CAAC;;;;;;;;;;;;;AC3aD,qBAAqB,mBAAO,CAAC,+ZAA4N;;AAEzP;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;ACPa;AACb;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,uDAAuD;AACpF;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA,8CAA8C,cAAc;AAC5D,UAAU,mBAAO,CAAC,6CAAc;AAChC,YAAY,mBAAO,CAAC,gBAAK;AACzB,gBAAgB,mBAAO,CAAC,wEAAY;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;;;;;AC/DA,iD","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"omi\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"omi\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"MScroll\"] = factory(require(\"omi\"));\n\telse\n\t\troot[\"MScroll\"] = factory(root[\"Omi\"]);\n})(window, function(__WEBPACK_EXTERNAL_MODULE_omi__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/scroll/index.tsx\");\n","exports = module.exports = require(\"../../node_modules/_css-loader@1.0.1@css-loader/lib/css-base.js\")(false);\n// imports\n\n\n// module\nexports.push([module.id, \":host {\\n display: inline-block; }\\n\\n.card {\\n display: inline-block;\\n box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\\n text-decoration: none;\\n height: 85px;\\n white-space: nowrap;\\n width: 100%;\\n text-align: center;\\n border-radius: 4px;\\n overflow: hidden; }\\n\\n.icon {\\n display: inline-block;\\n width: 50%;\\n height: 85px;\\n vertical-align: top;\\n padding-top: 20px; }\\n\\n* {\\n box-sizing: border-box; }\\n\\n.text {\\n display: inline-block;\\n width: 50%;\\n height: 85px;\\n vertical-align: top;\\n color: white;\\n line-height: 20px;\\n padding-top: 20px; }\\n\\n.info {\\n font-weight: bold;\\n margin-bottom: 5px; }\\n\\n.caption {\\n font-size: 14px; }\\n\", \"\"]);\n\n// exports\n","/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra\n*/\n// css base code, injected by the css-loader\nmodule.exports = function(useSourceMap) {\n\tvar list = [];\n\n\t// return the list of modules as css string\n\tlist.toString = function toString() {\n\t\treturn this.map(function (item) {\n\t\t\tvar content = cssWithMappingToString(item, useSourceMap);\n\t\t\tif(item[2]) {\n\t\t\t\treturn \"@media \" + item[2] + \"{\" + content + \"}\";\n\t\t\t} else {\n\t\t\t\treturn content;\n\t\t\t}\n\t\t}).join(\"\");\n\t};\n\n\t// import a list of modules into the list\n\tlist.i = function(modules, mediaQuery) {\n\t\tif(typeof modules === \"string\")\n\t\t\tmodules = [[null, modules, \"\"]];\n\t\tvar alreadyImportedModules = {};\n\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\tvar id = this[i][0];\n\t\t\tif(typeof id === \"number\")\n\t\t\t\talreadyImportedModules[id] = true;\n\t\t}\n\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\tvar item = modules[i];\n\t\t\t// skip already imported module\n\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t// when a module is imported multiple times with different media queries.\n\t\t\t// I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t}\n\t\t\t\tlist.push(item);\n\t\t\t}\n\t\t}\n\t};\n\treturn list;\n};\n\nfunction cssWithMappingToString(item, useSourceMap) {\n\tvar content = item[1] || '';\n\tvar cssMapping = item[3];\n\tif (!cssMapping) {\n\t\treturn content;\n\t}\n\n\tif (useSourceMap && typeof btoa === 'function') {\n\t\tvar sourceMapping = toComment(cssMapping);\n\t\tvar sourceURLs = cssMapping.sources.map(function (source) {\n\t\t\treturn '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'\n\t\t});\n\n\t\treturn [content].concat(sourceURLs).concat([sourceMapping]).join('\\n');\n\t}\n\n\treturn [content].join('\\n');\n}\n\n// Adapted from convert-source-map (MIT)\nfunction toComment(sourceMap) {\n\t// eslint-disable-next-line no-undef\n\tvar base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));\n\tvar data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;\n\n\treturn '/*# ' + data + ' */';\n}\n","/* phy-scroll v1.0.3\n * By dntzhang https://github.com/dntzhang\n * Github: https://github.com/Tencent/omi/tree/master/packages/phy-scroll\n * MIT Licensed.\n */\n\n; (function () {\n 'use strict';\n\n if (!Date.now)\n Date.now = function () { return new Date().getTime(); };\n\n var vendors = ['webkit', 'moz'];\n for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {\n var vp = vendors[i];\n window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];\n window.cancelAnimationFrame = (window[vp + 'CancelAnimationFrame']\n || window[vp + 'CancelRequestAnimationFrame']);\n }\n if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy\n || !window.requestAnimationFrame || !window.cancelAnimationFrame) {\n var lastTime = 0;\n window.requestAnimationFrame = function (callback) {\n var now = Date.now();\n var nextTime = Math.max(lastTime + 16, now);\n return setTimeout(function () { callback(lastTime = nextTime); },\n nextTime - now);\n };\n window.cancelAnimationFrame = clearTimeout;\n }\n}());\n\n; (function () {\n\n var supportsPassiveOption = false;\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function() {\n supportsPassiveOption = true;\n }\n });\n window.addEventListener('test', null, opts);\n } catch (e) {}\n\n var _elementStyle = document.createElement('div').style,\n endTransitionEventName,\n transitionDuration,\n transitionTimingFunction,\n transform;\n\n if ('transform' in _elementStyle) {\n transform = 'transform';\n endTransitionEventName = 'transitionend';\n transitionDuration = 'transitionDuration';\n transitionTimingFunction = 'transitionTimingFunction';\n } else if ('webkitTransform' in _elementStyle) {\n transform = 'webkitTransform';\n endTransitionEventName = 'webkitTransitionEnd';\n transitionDuration = 'webkitTransitionDuration';\n transitionTimingFunction = 'webkitTransitionTimingFunction';\n } else {\n throw 'please use a modern browser'\n }\n\n var ease = 'cubic-bezier(0.1, 0.57, 0.1, 1)';\n\n function reverseEase(y) {\n return 1 - Math.sqrt(1 - y * y);\n }\n\n function bind(element, type, callback) {\n element.addEventListener(type, callback, false);\n }\n\n function unbind(element, type, callback) {\n element.removeEventListener(type, callback);\n }\n\n function preventDefaultTest(el, exceptions) {\n for (var i in exceptions) {\n if (exceptions[i].test(el[i])) {\n return true;\n }\n }\n return false;\n }\n\n function getTransform(ele) {\n return +ele.style[transform].replace(/[^\\-?\\d.]/g, '')\n }\n\n function setTransform(ele, prop, val) {\n ele.style[transform] = prop + '(' + val + 'px)'\n }\n\n var PhyScroll = function (option) {\n this.scroll = typeof option.scroll === \"string\" ? document.querySelector(option.scroll) : option.scroll;\n\n //内部会有scroll出现的DOM\n //如果配置这个属性,需要min=max=0,否则会有意想不到的糟糕效果\n this.scrollDom = option.scrollDom;\n\n this.element = typeof option.touch === \"string\" ? document.querySelector(option.touch) : option.touch;\n this.vertical = this._getValue(option.vertical, true);\n this.property = this.vertical ? 'translateY' : 'translateX';\n this.preventDefault = this._getValue(option.preventDefault, true);\n this.sensitivity = this._getValue(option.sensitivity, 1);\n this.lockDirection = this._getValue(option.lockDirection, true);\n\n this.value = this._getValue(option.value, 0);\n\n setTransform(this.scroll, this.property, this.value)\n\n this.moveFactor = this._getValue(option.moveFactor, 1);\n this.factor = this._getValue(option.factor, 1);\n this.outFactor = this._getValue(option.outFactor, 0.3);\n\n this.min = option.min;\n this.max = option.max;\n\n this.maxRegion = this._getValue(option.maxRegion, 60);\n\n this.deceleration = 0.0006;\n this.maxRegion = this._getValue(option.maxRegion, 600);\n this.springMaxRegion = this._getValue(option.springMaxRegion, 60);\n\n this.change = option.change || function () { };\n this.touchEnd = option.touchEnd || function () { };\n this.touchStart = option.touchStart || function () { };\n this.touchMove = option.touchMove || function () { };\n this.touchCancel = option.touchMove || function () { };\n this.animationEnd = option.animationEnd || function () { };\n\n this.preventDefaultException = { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ };\n this.hasMin = !(this.min === void 0);\n this.hasMax = !(this.max === void 0);\n this.isTouchStart = false;\n this.step = option.step;\n this.inertia = this._getValue(option.inertia, true);\n this.maxSpeed = option.maxSpeed;\n this.hasMaxSpeed = !(this.maxSpeed === void 0);\n\n if (this.hasMax && this.hasMin) {\n if (this.min > this.max) throw \"min value can't be greater than max value\";\n this.currentPage = Math.round((this.max - getTransform(this.scroll)) / this.step);\n }\n\n this._startHandler = this._start.bind(this);\n this._moveHandler = this._move.bind(this);\n this._transitionEndHandler = this._transitionEnd.bind(this);\n this._endHandler = this._end.bind(this);\n this._cancelHandler = this._cancel.bind(this);\n bind(this.element, \"touchstart\", this._startHandler);\n bind(this.scroll, endTransitionEventName, this._transitionEndHandler);\n document.addEventListener('touchmove', this._moveHandler, supportsPassiveOption ? {\n passive: false\n }: false)\n bind(document, \"touchend\", this._endHandler);\n bind(document, \"touchcancel\", this._cancelHandler);\n //当有step设置的时候防止执行两次end\n this._endCallbackTag = true;\n\n this._endTimeout = null;\n };\n\n PhyScroll.prototype = {\n _getValue: function (obj, defaultValue) {\n return obj === void 0 ? defaultValue : obj;\n },\n _transitionEnd: function () {\n if (!this._triggerTransitionEnd) return;\n var current = getTransform(this.scroll);\n if (current < this.min) {\n this.to(this.min, 600, ease);\n return;\n } else if (current > this.max) {\n this.to(this.max, 600, ease);\n return;\n }\n\n if (this.step) {\n this.correction();\n if (this._endCallbackTag) {\n this._endTimeout = setTimeout(function () {\n this.animationEnd.call(this, current, this.index);\n cancelAnimationFrame(this.tickID);\n }.bind(this), 400);\n this._endCallbackTag = false;\n }\n } else {\n this.animationEnd.call(this, current, this.index);\n cancelAnimationFrame(this.tickID);\n }\n },\n _cancelAnimation: function () {\n this.scroll.style[transitionDuration] = '0ms';\n setTransform(this.scroll, this.property, this.getComputedPosition());\n\n },\n getComputedPosition: function () {\n var matrix = window.getComputedStyle(this.scroll, null);\n matrix = matrix[transform].split(')')[0].split(', ');\n return this.vertical ? (+(matrix[13] || matrix[5])) : (+(matrix[12] || matrix[4]));\n },\n _tick: function () {\n this.change.call(this, this.getComputedPosition());\n this.tickID = requestAnimationFrame(this._tick.bind(this));\n },\n stop: function () {\n cancelAnimationFrame(this.tickID);\n this._cancelAnimation();\n clearTimeout(this._endTimeout);\n if (this.hasMax && this.hasMin) {\n this.currentPage = Math.round((this.max - getTransform(this.scroll)) / this.step);\n }\n },\n _start: function (evt) {\n cancelAnimationFrame(this.tickID);\n this._tick();\n\n this._endCallbackTag = true;\n this.isTouchStart = true;\n this._firstTouchMove = true;\n this._preventMove = false;\n this.touchStart.call(this, evt, getTransform(this.scroll));\n this._cancelAnimation();\n clearTimeout(this._endTimeout);\n if (this.hasMax && this.hasMin) {\n this.currentPage = Math.round((this.max - getTransform(this.scroll)) / this.step);\n }\n this.startTime = new Date().getTime();\n this._startX = this.preX = evt.touches[0].pageX;\n this._startY = this.preY = evt.touches[0].pageY;\n this.start = this.vertical ? this.preY : this.preX;\n },\n /**\n * 根据滑动方向判断\n * @param element 具有scroll的DOM\n * @param move 滚动的距离\n * @param property 滚动的方向\n * @returns {*} 返回当前滑动状态下,element元素的scroll位置信息,'middle'-scroll正在滚动\n * @private\n */\n _scrollPosition: function (element, move, property) {\n var scrollKeys = property === 'translateY'\n ? ['scrollTop', 'offsetHeight', 'scrollHeight']\n : property === 'translateX' ? ['scrollLeft', 'offsetWidth', 'scrollWidth'] : null;\n if (!scrollKeys) { return '' }\n\n var scroll_start = element[scrollKeys[0]] || 0;\n if (scroll_start === 0 && move >= 0) {\n return 'start'\n }\n var visible_range = element[scrollKeys[1]] || 0,\n scroll_range = element[scrollKeys[2]] || 0;\n if (scroll_range === visible_range + scroll_start) {\n return 'end'\n }\n return 'middle'\n },\n _move: function (evt) {\n\n //如果当前滑动的时候,滚动元素scrollDOM非触发边界,则不触发滚动效果\n if (this.scrollDom && this._scrollPosition(\n this.scrollDom,\n getTransform(this.scroll),\n this.property\n ) === 'middle') {\n evt.preventDefault();\n return false;\n }\n\n if (this.isTouchStart) {\n var dx = Math.abs(evt.touches[0].pageX - this._startX), dy = Math.abs(evt.touches[0].pageY - this._startY);\n if (this._firstTouchMove && this.lockDirection) {\n var dDis = dx - dy;\n if (dDis > 0 && this.vertical) {\n this._preventMove = true;\n } else if (dDis < 0 && !this.vertical) {\n this._preventMove = true;\n }\n this._firstTouchMove = false;\n }\n if (dx < 10 && dy < 10) return;\n\n if (!this._preventMove) {\n var f = this.moveFactor;\n var d = (this.vertical ? evt.touches[0].pageY - this.preY : evt.touches[0].pageX - this.preX) * this.sensitivity;\n if (this.hasMax && getTransform(this.scroll) > this.max && d > 0) {\n f = this.outFactor;\n } else if (this.hasMin && getTransform(this.scroll) < this.min && d < 0) {\n f = this.outFactor;\n }\n d *= f;\n this.preX = evt.touches[0].pageX;\n this.preY = evt.touches[0].pageY;\n setTransform(this.scroll, this.property, getTransform(this.scroll) + d);\n\n var timestamp = new Date().getTime();\n if (timestamp - this.startTime > 300) {\n this.startTime = timestamp;\n this.start = this.vertical ? this.preY : this.preX;\n }\n this.touchMove.call(this, evt, getTransform(this.scroll));\n\n }\n\n if (this.preventDefault && !preventDefaultTest(evt.target, this.preventDefaultException)) {\n evt.preventDefault();\n }\n }\n },\n _end: function (evt) {\n if (this.isTouchStart) {\n var self = this,\n current = getTransform(this.scroll);\n if (this.touchEnd.call(this, evt, current) === false) {\n this._triggerTransitionEnd = false;\n cancelAnimationFrame(this.tickID);\n return;\n } else {\n this._triggerTransitionEnd = true;\n }\n if (this.hasMax && current > this.max) {\n this.to(this.max, 600, ease);\n } else if (this.hasMin && current < this.min) {\n this.to(this.min, 600, ease);\n } else if (this.inertia && !this._preventMove) {\n var dt = new Date().getTime() - this.startTime;\n if (dt < 300) {\n\n var distance = ((this.vertical ? evt.changedTouches[0].pageY : evt.changedTouches[0].pageX) - this.start) * this.sensitivity,\n speed = Math.abs(distance) / dt,\n speed2 = this.factor * speed;\n if (this.hasMaxSpeed && speed2 > this.maxSpeed) {\n speed2 = this.maxSpeed;\n }\n var destination = current + (speed2 * speed2) / (2 * this.deceleration) * (distance < 0 ? -1 : 1);\n\n var tRatio = 1;\n if (destination < this.min) {\n if (destination < this.min - this.maxRegion) {\n tRatio = reverseEase((current - this.min + this.springMaxRegion) / (current - destination));\n destination = this.min - this.springMaxRegion;\n } else {\n tRatio = reverseEase((current - this.min + this.springMaxRegion * (this.min - destination) / this.maxRegion) / (current - destination));\n destination = this.min - this.springMaxRegion * (this.min - destination) / this.maxRegion;\n }\n } else if (destination > this.max) {\n if (destination > this.max + this.maxRegion) {\n tRatio = reverseEase((this.max + this.springMaxRegion - current) / (destination - current));\n destination = this.max + this.springMaxRegion;\n } else {\n tRatio = reverseEase((this.max + this.springMaxRegion * (destination - this.max) / this.maxRegion - current) / (destination - current));\n destination = this.max + this.springMaxRegion * (destination - this.max) / this.maxRegion;\n\n }\n }\n var duration = Math.round(speed / self.deceleration) * tRatio;\n\n self.to(Math.round(destination), duration, ease);\n } else {\n if (self.step) {\n self.correction();\n }\n }\n } else {\n if (self.step) {\n self.correction();\n }\n }\n // if (this.preventDefault && !preventDefaultTest(evt.target, this.preventDefaultException)) {\n // evt.preventDefault();\n // }\n this.isTouchStart = false;\n }\n },\n _cancel: function (evt) {\n cancelAnimationFrame(this.tickID);\n if (this.step) {\n this.correction();\n }\n this.touchCancel.call(this, evt);\n },\n to: function (value, time, u_ease) {\n var el = this.scroll,\n property = this.property;\n\n el.style[transitionDuration] = this._getValue(time, 600) + 'ms';\n el.style[transitionTimingFunction] = u_ease || ease;\n setTransform(el, property, value)\n },\n correction: function (time) {\n var time = typeof time === 'number' ? time : 400;\n\n var value = getTransform(this.scroll)\n var rpt = Math.floor(Math.abs(value / this.step));\n var dy = value % this.step;\n var result;\n if (Math.abs(dy) > this.step / 2) {\n result = (value < 0 ? -1 : 1) * (rpt + 1) * this.step;\n if (result > this.max) result = this.max;\n if (result < this.min) result = this.min;\n this.to(result, time, ease);\n this.index = (value < 0 ? -1 : 1) * (rpt + 1)\n } else {\n result = (value < 0 ? -1 : 1) * rpt * this.step;\n if (result > this.max) result = this.max;\n if (result < this.min) result = this.min;\n this.to(result, time, ease);\n this.index = (value < 0 ? -1 : 1) * rpt \n }\n },\n destroy: function () {\n unbind(this.element, \"touchstart\", this._startHandler);\n unbind(this.scroll, endTransitionEventName, this._transitionEndHandler);\n unbind(window, \"touchmove\", this._moveHandler);\n unbind(window, \"touchend\", this._endHandler);\n unbind(window, \"touchcancel\", this._cancelHandler);\n }\n };\n\n if (typeof module !== 'undefined' && typeof exports === 'object') {\n module.exports = PhyScroll;\n } else {\n window.PhyScroll = PhyScroll;\n }\n\n})();\n","\n var result = require(\"!!../../node_modules/_css-loader@1.0.1@css-loader/index.js!../../node_modules/_resolve-url-loader@3.1.0@resolve-url-loader/index.js!../../node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js??ref--4-3!./index.scss\");\n\n if (typeof result === \"string\") {\n module.exports = result;\n } else {\n module.exports = result.toString();\n }\n ","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar css = require(\"./index.scss\");\nvar omi_1 = require(\"omi\");\nvar PhyScroll = require(\"phy-scroll\");\nvar Scroll = /** @class */ (function (_super) {\n __extends(Scroll, _super);\n function Scroll() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Scroll.prototype.installed = function () {\n var target = this.rootNode.firstChild;\n new PhyScroll({\n touch: this.rootNode,\n vertical: this.props.vertical === false ? false : true,\n scroll: target,\n min: this.props.min,\n max: this.props.max,\n sensitivity: this.props.sensitivity,\n factor: this.props.factor,\n step: this.props.step,\n bindSelf: this.props.bindSelf,\n preventDefault: this.props.preventDefault === false ? false : true,\n change: this.props.onChange,\n touchStart: this.props.onTouchStart,\n touchMove: this.props.onTouchMove,\n touchEnd: this.props.onTouchEnd,\n tap: this.props.onTap,\n pressMove: this.props.onPressMove,\n animationEnd: this.props.onAnimationEnd\n });\n };\n Scroll.prototype.render = function () {\n return this.props.children[0];\n };\n Scroll.css = css;\n Scroll.propTypes = {\n vertical: Boolean\n };\n Scroll = __decorate([\n omi_1.tag('m-scroll')\n ], Scroll);\n return Scroll;\n}(omi_1.WeElement));\nexports.default = Scroll;\n","module.exports = __WEBPACK_EXTERNAL_MODULE_omi__;"],"sourceRoot":""} \ No newline at end of file