diff --git a/packages/omi/dist/omi.dev.js b/packages/omi/dist/omi.dev.js index fb1bdff99..3c365fb53 100644 --- a/packages/omi/dist/omi.dev.js +++ b/packages/omi/dist/omi.dev.js @@ -1,5 +1,5 @@ /** - * omi v4.0.19 http://omijs.org + * omi v4.0.20 http://omijs.org * Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript. * By dntzhang https://github.com/dntzhang * Github: https://github.com/Tencent/omi @@ -454,7 +454,9 @@ } // otherwise, if there are existing or new children, diff them: else if (vchildren && vchildren.length || fc != null) { - innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null); + if (!(out.constructor.is == 'WeElement' && out.constructor.noSlot)) { + innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null); + } } // Apply attributes/props from VNode to the DOM Element: @@ -1044,7 +1046,18 @@ } this.install(); - var shadowRoot = this.attachShadow({ mode: 'open' }); + var shadowRoot; + if (!this.shadowRoot) { + shadowRoot = this.attachShadow({ + mode: 'open' + }); + } else { + shadowRoot = this.shadowRoot; + var fc; + while (fc = shadowRoot.firstChild) { + shadowRoot.removeChild(fc); + } + } this.css && shadowRoot.appendChild(cssToDom(this.css())); this.beforeRender(); @@ -1409,7 +1422,7 @@ }; options.root.Omi = omi; - options.root.Omi.version = '4.0.19'; + options.root.Omi.version = '4.0.20'; if (typeof module != 'undefined') module.exports = omi;else self.Omi = omi; }()); diff --git a/packages/omi/dist/omi.dev.js.map b/packages/omi/dist/omi.dev.js.map index 0b44f1fd8..fdc3b977b 100644 --- a/packages/omi/dist/omi.dev.js.map +++ b/packages/omi/dist/omi.dev.js.map @@ -1 +1 @@ -{"version":3,"file":"omi.dev.js","sources":["../src/vnode.js","../src/options.js","../src/h.js","../src/util.js","../src/constants.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/proxy.js","../src/observe.js","../src/we-element.js","../src/render.js","../src/define.js","../src/tag.js","../src/clone-element.js","../src/get-host.js","../src/omi.js","../src/omi.js"],"sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","function getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n return (\n self ||\n window ||\n global ||\n (function() {\n return this\n })()\n )\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n store: null,\n root: getGlobal()\n}\n","import { VNode } from './vnode'\nimport options from './options'\n\nconst stack = []\nconst EMPTY_CHILDREN = []\n\nexport function h(nodeName, attributes) {\n let children = EMPTY_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--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children === EMPTY_CHILDREN) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let 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 * @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\n/**\n * This shim allows elements written in, or compiled to, ES5 to work on native\n * implementations of Custom Elements v1. It sets new.target to the value of\n * this.constructor so that the native HTMLElement constructor can access the\n * current under-construction element's definition.\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 ||\n 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 ) {\n return\n }\n const 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\nexport function cssToDom(css) {\n const node = document.createElement('style')\n node.textContent = css\n return node\n}\n\nexport function npn(str) {\n return str.replace(/-(\\w)/g, ($, $1) => {\n return $1.toUpperCase()\n })\n}\n\nexport function extend(obj, props) {\n for (let i in props) 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 */\nexport function applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value)\n 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 */\nexport const defer =\n typeof Promise == 'function'\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n","// render modes\n\nexport const NO_RENDER = 0\nexport const SYNC_RENDER = 1\nexport const FORCE_RENDER = 2\nexport const ASYNC_RENDER = 3\n\nexport const ATTR_KEY = '__preactattr_'\n\n// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\n","import { extend } from '../util'\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 */\nexport function 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 }\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 */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n /** @type {PreactElement} */\n let node = isSvg\n ? document.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : 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 */\nexport function removeNode(node) {\n let 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 {PreactElement} 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 */\nexport function 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 (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : 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 let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) node.addEventListener(name, eventProxy, useCapture)\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\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')\n node.removeAttribute(name)\n } else {\n let 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)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value === 'string') {\n if (ns) {\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n } else {\n 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","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { createNode, setAccessor } from '../dom/index'\nimport { npn, isArray } from '../util'\nimport { removeNode } from '../dom/index'\n\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet 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 */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n let 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 && !(ATTR_KEY in dom)\n }\n if (isArray(vnode)) {\n ret = []\n let parentNode = null\n if (isArray(dom)) {\n parentNode = dom[0].parentNode\n dom.forEach(function(item, index) {\n ret.push(idiff(item, vnode[index], context, mountAll, componentRoot))\n })\n } else {\n vnode.forEach(function(item) {\n ret.push(idiff(dom, item, context, mountAll, componentRoot))\n })\n }\n if (parent) {\n ret.forEach(function(vnode) {\n parent.appendChild(vnode)\n })\n } else if (isArray(dom)) {\n dom.forEach(function(node) {\n parentNode.appendChild(node)\n })\n }\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot)\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 && dom.props) {\n dom.props.children = vnode.children\n }\n let 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 (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\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[ATTR_KEY] = true\n\n return out\n }\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : 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) out.appendChild(dom.firstChild)\n\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 let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\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 innerDiffNode(\n out,\n vchildren,\n context,\n mountAll,\n 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 let 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 (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let 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 (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\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 (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n 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 */\nexport function 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[ATTR_KEY] != null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null)\n\n if (unmountOnly === false || node[ATTR_KEY] == 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 */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let 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 let name\n let update = false\n let isWeElement = dom.update\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 //diable when using store system?\n //!dom.store &&\n if (isWeElement && typeof attrs[name] === 'object') {\n dom.props[npn(name)] = attrs[name]\n update = true\n } else if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\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 dom.parentNode && update && isWeElement && dom.update()\n}\n","/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst 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 const pathComponents = []\n let 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 const 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 const parentPath = findObjectPath(instance, target)\n\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n const 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\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 const revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n\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\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 (\n newValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n ) {\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 const 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)) {\n // undefined array elements are JSON.stringified to `null`\n ;(operation.op = 'replace'), (operation.value = null)\n }\n const 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(\n 'JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch'\n )\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 const 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 const parentPath = findObjectPath(instance, target)\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n const revokableProxyInstance = instance.proxifiedObjectsMap.get(\n target[key]\n )\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\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 const 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 this.defaultCallback = 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 = () => {}\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 if (!obj) {\n return obj\n }\n const traps = {\n set: (target, key, value, receiver) =>\n setTrap(this, target, key, value, receiver),\n deleteProperty: (target, key) => deleteTrap(this, target, key)\n }\n const 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, 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(\n parent,\n root,\n path\n ) {\n for (let key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(\n root,\n root[key],\n escapePathComponent(key)\n )\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 const proxifiedObject = this._proxifyObjectTreeRecursively(\n undefined,\n root,\n ''\n )\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(\n revokableProxyInstance\n ) {\n if (this.showDetachedWarning) {\n const message =\n \"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 = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.set = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.deleteProperty = (\n targetObject,\n propKey\n ) => {\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(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\nexport default JSONPatcherProxy\n","import JSONProxy from './proxy'\n\nexport function observe(target) {\n target.observe = true\n}\n\nlet preValue = null\nlet prePath = null\nlet preEle = null\n\nexport function proxyUpdate(ele) {\n let timeout = null\n ele.data = new JSONProxy(ele.data).observe(false, info => {\n if (preValue === info.value && prePath === info.path && preEle === ele) {\n return\n }\n\n preValue = info.value\n prePath = info.path\n preEle = ele\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n }, 16.6)\n })\n}\n","import { cssToDom, nProps, isArray } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\nimport { proxyUpdate } from './observe'\n\nexport default class WeElement extends HTMLElement {\n static is = 'WeElement'\n\n constructor() {\n super()\n this.props = Object.assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps\n )\n this.data = this.constructor.data || {}\n }\n\n connectedCallback() {\n if (!this.constructor.pure) {\n let 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\n this.install()\n const shadowRoot = this.attachShadow({ mode: 'open' })\n\n this.css && shadowRoot.appendChild(cssToDom(this.css()))\n this.beforeRender()\n options.afterInstall && options.afterInstall(this)\n if (this.constructor.observe) {\n proxyUpdate(this)\n }\n this.host = diff(\n null,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n ),\n {},\n false,\n null,\n false\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 disconnectedCallback() {\n this.uninstall()\n if (this.store) {\n for (let 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 update() {\n this.beforeUpdate()\n this.beforeRender()\n diff(\n this.host,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n )\n )\n this.afterUpdate()\n }\n\n fire(name, data) {\n this.dispatchEvent(new CustomEvent(name, { detail: data }))\n }\n\n install() {}\n\n installed() {}\n\n uninstall() {}\n\n beforeUpdate() {}\n\n afterUpdate() {}\n\n beforeRender() {}\n}\n","import { diff } from './vdom/diff'\nimport JSONProxy from './proxy'\n\nexport function render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n if (store) {\n store.instances = []\n extendStoreUpate(store)\n let timeout = null\n let patchs = {}\n store.data = new JSONProxy(store.data).observe(false, function(patch) {\n clearTimeout(timeout)\n if (patch.op === 'remove') {\n // fix arr splice\n const kv = getArrayPatch(patch.path, store)\n patchs[kv.k] = kv.v\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n } else {\n const key = fixPath(patch.path)\n patchs[key] = patch.value\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n }\n })\n parent.store = store\n }\n 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 const updateAll = matchGlobalData(this.globalData, patch)\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(instance => {\n if (\n updateAll ||\n this.updateAll ||\n (instance.constructor.updatePath &&\n needUpdate(patch, instance.constructor.updatePath))\n ) {\n instance.update()\n }\n })\n this.onChange && this.onChange(patch)\n }\n }\n}\n\nexport function matchGlobalData(globalData, diffResult) {\n if (!globalData) return false\n for (let keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true\n }\n for (let 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\nexport function needUpdate(diffResult, updatePath) {\n for (let keyA in diffResult) {\n if (updatePath[keyA]) {\n return true\n }\n for (let 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 const next = pathA.substr(pathB.length, 1)\n if (next === '[' || next === '.') {\n return true\n }\n }\n return false\n}\n\nexport function fixPath(path) {\n let mpPath = ''\n const arr = path.replace('/', '').split('/')\n arr.forEach((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 const arr = path.replace('/', '').split('/')\n let current = store.data[arr[0]]\n for (let 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 let mpPath = ''\n const arr = path.replace('/', '').split('/')\n const len = arr.length\n arr.forEach((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","import WeElement from './we-element'\nimport { cssToDom } from './util'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n if (ctor.is === 'WeElement') {\n customElements.define(name, ctor)\n if (ctor.data && !ctor.pure) {\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n } else {\n class Element extends WeElement {\n _useId = 0\n\n _useMap = {}\n\n render(props, data) {\n return ctor.call(this, props, data)\n }\n\n beforeRender() {\n this._useId = 0\n }\n\n useCss(css) {\n const style = this.shadowRoot.querySelector('style')\n style && this.shadowRoot.removeChild(style)\n this.shadowRoot.appendChild(cssToDom(css))\n }\n\n useData(data) {\n return this.use({ data: data })\n }\n\n use(option) {\n this._useId++\n const updater = newValue => {\n const item = this._useMap[updater.id]\n\n item.data = newValue\n\n this.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 installed() {\n this._isInstalled = true\n }\n }\n customElements.define(name, Element)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import { define } from './define'\nimport WeElement from './we-element'\nexport function tag(name, pure) {\n return function(target) {\n target.pure = pure\n define(name, target)\n }\n}\n","import { extend } from './util'\nimport { h } from './h'\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 */\nexport function cloneElement(vnode, props) {\n return h(\n vnode.nodeName,\n extend(extend({}, vnode.attributes), props),\n arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children\n )\n}\n","export function getHost(ele) {\n let p = ele.parentNode\n while (p) {\n if (p.host) {\n return p.host\n } else {\n p = p.parentNode\n }\n }\n}\n","import { h, h as createElement } from './h'\nimport options from './options'\nimport WeElement from './we-element'\nimport { render } from './render'\nimport { define } from './define'\nimport { tag } from './tag'\nimport { observe } from './observe'\nimport { cloneElement } from './clone-element'\nimport { getHost } from './get-host'\n\nconst Component = WeElement\n\nconst omi = {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n\noptions.root.Omi = omi\noptions.root.Omi.version = '4.0.19'\n\nexport default omi\n\nexport {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n","\n\t\t\t\timport Omi from './omi';\n\t\t\t\tif (typeof module!='undefined') module.exports = Omi;\n\t\t\t\telse self.Omi = Omi;\n\t\t\t"],"names":["VNode","getGlobal","global","Math","Array","self","window","store","root","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","i","arguments","length","push","pop","undefined","String","p","key","options","vnode","Reflect","customElements","hasOwnProperty","BuiltInHTMLElement","HTMLElement","construct","constructor","prototype","Object","setPrototypeOf","cssToDom","css","node","document","createElement","textContent","npn","str","replace","$","$1","toUpperCase","extend","obj","props","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","isArray","toString","call","nProps","result","keys","forEach","ATTR_KEY","IS_NON_DIMENSIONAL","isSameNodeType","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","toLowerCase","createNode","isSvg","createElementNS","removeNode","parentNode","removeChild","setAccessor","name","old","className","style","cssText","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","setAttribute","type","event","diffLevel","isSvgMode","diff","dom","context","mountAll","parent","componentRoot","ret","ownerSVGElement","item","index","idiff","appendChild","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","firstChild","fc","vchildren","a","nextSibling","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","len","childrenLen","vlen","j","c","f","vchild","__key","trim","insertBefore","unmountOnly","removeChildren","lastChild","next","previousSibling","attrs","update","isWeElement","JSONPatcherProxy","deepClone","JSON","parse","stringify","escapePathComponent","indexOf","findObjectPath","instance","pathComponents","parentAndPath","parenthoodMap","get","path","unshift","join","setTrap","target","newValue","parentPath","destinationPropKey","proxifiedObjectsMap","has","newValueOriginalObject","set","originalObject","revokableInstance","isProxifyingTreeNow","inherited","_proxifyObjectTreeRecursively","operation","op","oldValue","delete","disableTrapsForProxy","Number","isInteger","console","warn","reflectionResult","defaultCallback","deleteTrap","revokableProxyInstance","deleteProperty","resume","isRecording","patches","userCallback","isObserving","pause","showDetachedWarning","Map","cachedProxy","generateProxyAtPath","traps","receiver","revocableInstance","Proxy","revocable","trapsInstance","proxy","proxifyObjectTree","proxifiedObject","message","targetObject","propKey","observe","record","callback","Error","generate","splice","revoke","el","disableTraps","preValue","prePath","preEle","proxyUpdate","ele","timeout","data","JSONProxy","info","clearTimeout","WeElement","assign","defaultProps","connectedCallback","pure","host","instances","install","shadowRoot","attachShadow","mode","beforeRender","afterInstall","render","installed","_isInstalled","disconnectedCallback","uninstall","beforeUpdate","afterUpdate","fire","dispatchEvent","CustomEvent","detail","is","querySelector","extendStoreUpate","patchs","patch","kv","getArrayPatch","k","v","fixPath","updateAll","matchGlobalData","globalData","updatePath","needUpdate","onChange","diffResult","keyA","includePath","keyB","pathA","pathB","substr","mpPath","arr","split","isNaN","fixArrPath","OBJECTTYPE","ARRAYTYPE","define","ctor","getUpdatePath","Element","_useId","_useMap","useCss","useData","use","option","updater","id","effect","dataToPath","_objToPath","_arrayToPath","tag","cloneElement","slice","getHost","Component","omi","Omi","version","module","exports"],"mappings":";;;;;;;;;;;EAAA;AACA,EAAO,SAASA,KAAT,GAAiB;;ECDxB,SAASC,SAAT,GAAqB;EACnB,MACE,OAAOC,MAAP,KAAkB,QAAlB,IACA,CAACA,MADD,IAEAA,OAAOC,IAAP,KAAgBA,IAFhB,IAGAD,OAAOE,KAAP,KAAiBA,KAJnB,EAKE;EACA,WACEC,QACAC,MADA,IAEAJ,MAFA,IAGC,YAAW;EACV,aAAO,IAAP;EACD,KAFD,EAJF;EAQD;EACD,SAAOA,MAAP;EACD;;EAED;;;;AAIA,gBAAe;EACbK,SAAO,IADM;EAEbC,QAAMP;EAFO,CAAf;;MCpBMQ,QAAQ,EAAd;EACA,IAAMC,iBAAiB,EAAvB;;AAEA,EAAO,SAASC,CAAT,CAAWC,QAAX,EAAqBC,UAArB,EAAiC;EACtC,MAAIC,WAAWJ,cAAf;EAAA,MACEK,mBADF;EAAA,MAEEC,cAFF;EAAA,MAGEC,eAHF;EAAA,MAIEC,UAJF;EAKA,OA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R,CAAa4T,GAAb,CAAiBC,OAAjB,GAA2B,QAA3B;;ECzBI,IAAI,OAAOC,MAAP,IAAe,WAAnB,EAAgCA,OAAOC,OAAP,GAAiBH,GAAjB,CAAhC,KACK/T,KAAK+T,GAAL,GAAWA,GAAX;;"} \ No newline at end of file +{"version":3,"file":"omi.dev.js","sources":["../src/vnode.js","../src/options.js","../src/h.js","../src/util.js","../src/constants.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/proxy.js","../src/observe.js","../src/we-element.js","../src/render.js","../src/define.js","../src/tag.js","../src/clone-element.js","../src/get-host.js","../src/omi.js","../src/omi.js"],"sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","function getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n return (\n self ||\n window ||\n global ||\n (function() {\n return this\n })()\n )\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n store: null,\n root: getGlobal()\n}\n","import { VNode } from './vnode'\nimport options from './options'\n\nconst stack = []\nconst EMPTY_CHILDREN = []\n\nexport function h(nodeName, attributes) {\n let children = EMPTY_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--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children === EMPTY_CHILDREN) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let 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 * @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\n/**\n * This shim allows elements written in, or compiled to, ES5 to work on native\n * implementations of Custom Elements v1. It sets new.target to the value of\n * this.constructor so that the native HTMLElement constructor can access the\n * current under-construction element's definition.\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 ||\n 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 ) {\n return\n }\n const 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\nexport function cssToDom(css) {\n const node = document.createElement('style')\n node.textContent = css\n return node\n}\n\nexport function npn(str) {\n return str.replace(/-(\\w)/g, ($, $1) => {\n return $1.toUpperCase()\n })\n}\n\nexport function extend(obj, props) {\n for (let i in props) 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 */\nexport function applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value)\n 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 */\nexport const defer =\n typeof Promise == 'function'\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n","// render modes\n\nexport const NO_RENDER = 0\nexport const SYNC_RENDER = 1\nexport const FORCE_RENDER = 2\nexport const ASYNC_RENDER = 3\n\nexport const ATTR_KEY = '__preactattr_'\n\n// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\n","import { extend } from '../util'\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 */\nexport function 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 }\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 */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n /** @type {PreactElement} */\n let node = isSvg\n ? document.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : 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 */\nexport function removeNode(node) {\n let 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 {PreactElement} 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 */\nexport function 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 (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : 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 let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) node.addEventListener(name, eventProxy, useCapture)\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\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')\n node.removeAttribute(name)\n } else {\n let 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)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value === 'string') {\n if (ns) {\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n } else {\n 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","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { createNode, setAccessor } from '../dom/index'\nimport { npn, isArray } from '../util'\nimport { removeNode } from '../dom/index'\n\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet 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 */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n let 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 && !(ATTR_KEY in dom)\n }\n if (isArray(vnode)) {\n ret = []\n let parentNode = null\n if (isArray(dom)) {\n parentNode = dom[0].parentNode\n dom.forEach(function(item, index) {\n ret.push(idiff(item, vnode[index], context, mountAll, componentRoot))\n })\n } else {\n vnode.forEach(function(item) {\n ret.push(idiff(dom, item, context, mountAll, componentRoot))\n })\n }\n if (parent) {\n ret.forEach(function(vnode) {\n parent.appendChild(vnode)\n })\n } else if (isArray(dom)) {\n dom.forEach(function(node) {\n parentNode.appendChild(node)\n })\n }\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot)\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 && dom.props) {\n dom.props.children = vnode.children\n }\n let 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 (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\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[ATTR_KEY] = true\n\n return out\n }\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : 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) out.appendChild(dom.firstChild)\n\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 let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\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(\n out,\n vchildren,\n context,\n mountAll,\n hydrating || props.dangerouslySetInnerHTML != null\n )\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 let 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 (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let 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 (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\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 (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n 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 */\nexport function 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[ATTR_KEY] != null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null)\n\n if (unmountOnly === false || node[ATTR_KEY] == 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 */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let 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 let name\n let update = false\n let isWeElement = dom.update\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 //diable when using store system?\n //!dom.store &&\n if (isWeElement && typeof attrs[name] === 'object') {\n dom.props[npn(name)] = attrs[name]\n update = true\n } else if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\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 dom.parentNode && update && isWeElement && dom.update()\n}\n","/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst 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 const pathComponents = []\n let 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 const 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 const parentPath = findObjectPath(instance, target)\n\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n const 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\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 const revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n\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\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 (\n newValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n ) {\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 const 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)) {\n // undefined array elements are JSON.stringified to `null`\n ;(operation.op = 'replace'), (operation.value = null)\n }\n const 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(\n 'JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch'\n )\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 const 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 const parentPath = findObjectPath(instance, target)\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n const revokableProxyInstance = instance.proxifiedObjectsMap.get(\n target[key]\n )\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\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 const 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 this.defaultCallback = 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 = () => {}\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 if (!obj) {\n return obj\n }\n const traps = {\n set: (target, key, value, receiver) =>\n setTrap(this, target, key, value, receiver),\n deleteProperty: (target, key) => deleteTrap(this, target, key)\n }\n const 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, 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(\n parent,\n root,\n path\n ) {\n for (let key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(\n root,\n root[key],\n escapePathComponent(key)\n )\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 const proxifiedObject = this._proxifyObjectTreeRecursively(\n undefined,\n root,\n ''\n )\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(\n revokableProxyInstance\n ) {\n if (this.showDetachedWarning) {\n const message =\n \"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 = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.set = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.deleteProperty = (\n targetObject,\n propKey\n ) => {\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(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\nexport default JSONPatcherProxy\n","import JSONProxy from './proxy'\n\nexport function observe(target) {\n target.observe = true\n}\n\nlet preValue = null\nlet prePath = null\nlet preEle = null\n\nexport function proxyUpdate(ele) {\n let timeout = null\n ele.data = new JSONProxy(ele.data).observe(false, info => {\n if (preValue === info.value && prePath === info.path && preEle === ele) {\n return\n }\n\n preValue = info.value\n prePath = info.path\n preEle = ele\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n }, 16.6)\n })\n}\n","import { cssToDom, nProps, isArray } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\nimport { proxyUpdate } from './observe'\n\nexport default class WeElement extends HTMLElement {\n static is = 'WeElement'\n\n constructor() {\n super()\n this.props = Object.assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps\n )\n this.data = this.constructor.data || {}\n }\n\n connectedCallback() {\n if (!this.constructor.pure) {\n let 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\n this.install()\n let shadowRoot\n if (!this.shadowRoot) {\n shadowRoot = this.attachShadow({\n mode: 'open'\n })\n } else {\n shadowRoot = this.shadowRoot\n let fc\n while ((fc = shadowRoot.firstChild)) {\n shadowRoot.removeChild(fc)\n }\n }\n\n this.css && shadowRoot.appendChild(cssToDom(this.css()))\n this.beforeRender()\n options.afterInstall && options.afterInstall(this)\n if (this.constructor.observe) {\n proxyUpdate(this)\n }\n this.host = diff(\n null,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n ),\n {},\n false,\n null,\n false\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 disconnectedCallback() {\n this.uninstall()\n if (this.store) {\n for (let 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 update() {\n this.beforeUpdate()\n this.beforeRender()\n diff(\n this.host,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n )\n )\n this.afterUpdate()\n }\n\n fire(name, data) {\n this.dispatchEvent(new CustomEvent(name, { detail: data }))\n }\n\n install() {}\n\n installed() {}\n\n uninstall() {}\n\n beforeUpdate() {}\n\n afterUpdate() {}\n\n beforeRender() {}\n}\n","import { diff } from './vdom/diff'\nimport JSONProxy from './proxy'\n\nexport function render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n if (store) {\n store.instances = []\n extendStoreUpate(store)\n let timeout = null\n let patchs = {}\n store.data = new JSONProxy(store.data).observe(false, function(patch) {\n clearTimeout(timeout)\n if (patch.op === 'remove') {\n // fix arr splice\n const kv = getArrayPatch(patch.path, store)\n patchs[kv.k] = kv.v\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n } else {\n const key = fixPath(patch.path)\n patchs[key] = patch.value\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n }\n })\n parent.store = store\n }\n 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 const updateAll = matchGlobalData(this.globalData, patch)\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(instance => {\n if (\n updateAll ||\n this.updateAll ||\n (instance.constructor.updatePath &&\n needUpdate(patch, instance.constructor.updatePath))\n ) {\n instance.update()\n }\n })\n this.onChange && this.onChange(patch)\n }\n }\n}\n\nexport function matchGlobalData(globalData, diffResult) {\n if (!globalData) return false\n for (let keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true\n }\n for (let 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\nexport function needUpdate(diffResult, updatePath) {\n for (let keyA in diffResult) {\n if (updatePath[keyA]) {\n return true\n }\n for (let 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 const next = pathA.substr(pathB.length, 1)\n if (next === '[' || next === '.') {\n return true\n }\n }\n return false\n}\n\nexport function fixPath(path) {\n let mpPath = ''\n const arr = path.replace('/', '').split('/')\n arr.forEach((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 const arr = path.replace('/', '').split('/')\n let current = store.data[arr[0]]\n for (let 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 let mpPath = ''\n const arr = path.replace('/', '').split('/')\n const len = arr.length\n arr.forEach((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","import WeElement from './we-element'\nimport { cssToDom } from './util'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n if (ctor.is === 'WeElement') {\n customElements.define(name, ctor)\n if (ctor.data && !ctor.pure) {\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n } else {\n class Element extends WeElement {\n _useId = 0\n\n _useMap = {}\n\n render(props, data) {\n return ctor.call(this, props, data)\n }\n\n beforeRender() {\n this._useId = 0\n }\n\n useCss(css) {\n const style = this.shadowRoot.querySelector('style')\n style && this.shadowRoot.removeChild(style)\n this.shadowRoot.appendChild(cssToDom(css))\n }\n\n useData(data) {\n return this.use({ data: data })\n }\n\n use(option) {\n this._useId++\n const updater = newValue => {\n const item = this._useMap[updater.id]\n\n item.data = newValue\n\n this.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 installed() {\n this._isInstalled = true\n }\n }\n customElements.define(name, Element)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import { define } from './define'\nimport WeElement from './we-element'\nexport function tag(name, pure) {\n return function(target) {\n target.pure = pure\n define(name, target)\n }\n}\n","import { extend } from './util'\nimport { h } from './h'\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 */\nexport function cloneElement(vnode, props) {\n return h(\n vnode.nodeName,\n extend(extend({}, vnode.attributes), props),\n arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children\n )\n}\n","export function getHost(ele) {\n let p = ele.parentNode\n while (p) {\n if (p.host) {\n return p.host\n } else {\n p = p.parentNode\n }\n }\n}\n","import { h, h as createElement } from './h'\nimport options from './options'\nimport WeElement from './we-element'\nimport { render } from './render'\nimport { define } from './define'\nimport { tag } from './tag'\nimport { observe } from './observe'\nimport { cloneElement } from './clone-element'\nimport { getHost } from './get-host'\n\nconst Component = WeElement\n\nconst omi = {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n\noptions.root.Omi = omi\noptions.root.Omi.version = '4.0.20'\n\nexport default omi\n\nexport {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n","\n\t\t\t\timport Omi from './omi';\n\t\t\t\tif (typeof module!='undefined') module.exports = Omi;\n\t\t\t\telse self.Omi = Omi;\n\t\t\t"],"names":["VNode","getGlobal","global","Math","Array","self","window","store","root","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","i","arguments","length","push","pop","undefined","String","p","key","options","vnode","Reflect","customElements","hasOwnProperty","BuiltInHTMLElement","HTMLElement","construct","constructor","prototype","Object","setPrototypeOf","cssToDom","css","node","document","createElement","textContent","npn","str","replace","$","$1","toUpperCase","extend","obj","props","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","isArray","toString","call","nProps","result","keys","forEach","ATTR_KEY","IS_NON_DIMENSIONAL","isSameNodeType","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","toLowerCase","createNode","isSvg","createElementNS","removeNode","parentNode","removeChild","setAccessor","name","old","className","style","cssText","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","setAttribute","type","event","diffLevel","isSvgMode","diff","dom","context","mountAll","parent","componentRoot","ret","ownerSVGElement","item","index","idiff","appendChild","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","firstChild","fc","vchildren","a","nextSibling","is","noSlot","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","len","childrenLen","vlen","j","c","f","vchild","__key","trim","insertBefore","unmountOnly","removeChildren","lastChild","next","previousSibling","attrs","update","isWeElement","JSONPatcherProxy","deepClone","JSON","parse","stringify","escapePathComponent","indexOf","findObjectPath","instance","pathComponents","parentAndPath","parenthoodMap","get","path","unshift","join","setTrap","target","newValue","parentPath","destinationPropKey","proxifiedObjectsMap","has","newValueOriginalObject","set","originalObject","revokableInstance","isProxifyingTreeNow","inherited","_proxifyObjectTreeRecursively","operation","op","oldValue","delete","disableTrapsForProxy","Number","isInteger","console","warn","reflectionResult","defaultCallback","deleteTrap","revokableProxyInstance","deleteProperty","resume","isRecording","patches","userCallback","isObserving","pause","showDetachedWarning","Map","cachedProxy","generateProxyAtPath","traps","receiver","revocableInstance","Proxy","revocable","trapsInstance","proxy","proxifyObjectTree","proxifiedObject","message","targetObject","propKey","observe","record","callback","Error","generate","splice","revoke","el","disableTraps","preValue","prePath","preEle","proxyUpdate","ele","timeout","data","JSONProxy","info","clearTimeout","WeElement","assign","defaultProps","connectedCallback","pure","host","instances","install","shadowRoot","attachShadow","mode","beforeRender","afterInstall","render","installed","_isInstalled","disconnectedCallback","uninstall","beforeUpdate","afterUpdate","fire","dispatchEvent","CustomEvent","detail","querySelector","extendStoreUpate","patchs","patch","kv","getArrayPatch","k","v","fixPath","updateAll","matchGlobalData","globalData","updatePath","needUpdate","onChange","diffResult","keyA","includePath","keyB","pathA","pathB","substr","mpPath","arr","split","isNaN","fixArrPath","OBJECTTYPE","ARRAYTYPE","define","ctor","getUpdatePath","Element","_useId","_useMap","useCss","useData","use","option","updater","id","effect","dataToPath","_objToPath","_arrayToPath","tag","cloneElement","slice","getHost","Component","omi","Omi","version","module","exports"],"mappings":";;;;;;;;;;;EAAA;AACA,EAAO,SAASA,KAAT,GAAiB;;ECDxB,SA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OwE,IAAP,GAAcA,IAAd;EACAiD,WAAOxN,IAAP,EAAa+F,MAAb;EACD,GAHD;EAID;;;;;;;;ACED,EAAO,SAAS0I,YAAT,CAAsBpS,KAAtB,EAA6ByB,KAA7B,EAAoC;EACzC,SAAO1C,EACLiB,MAAMhB,QADD,EAELuC,OAAOA,OAAO,EAAP,EAAWvB,MAAMf,UAAjB,CAAP,EAAqCwC,KAArC,CAFK,EAGLlC,UAAUC,MAAV,GAAmB,CAAnB,GAAuB,GAAG6S,KAAH,CAAS/P,IAAT,CAAc/C,SAAd,EAAyB,CAAzB,CAAvB,GAAqDS,MAAMd,QAHtD,CAAP;EAKD;;WCfeoT,OAAT,CAAiB9E,GAAjB,EAAsB;EAC3B,MAAI3N,IAAI2N,IAAIhK,UAAZ;EACA,SAAO3D,CAAP,EAAU;EACR,QAAIA,EAAEsO,IAAN,EAAY;EACV,aAAOtO,EAAEsO,IAAT;EACD,KAFD,MAEO;EACLtO,UAAIA,EAAE2D,UAAN;EACD;EACF;EACF;;MCCK+O,YAAYzE,SAAlB;;EAEA,IAAM0E,MAAM;EACVL,UADU;EAEVrE,sBAFU;EAGVyE,sBAHU;EAIV5D,gBAJU;EAKV5P,MALU;EAMVgC,kBANU;EAOVhB,kBAPU;EAQVoR,gBARU;EASVxE,kBATU;EAUVyF,4BAVU;EAWVE;EAXU,CAAZ;;EAcAvS,QAAQnB,IAAR,CAAa6T,GAAb,GAAmBD,GAAnB;EACAzS,QAAQnB,IAAR,CAAa6T,GAAb,CAAiBC,OAAjB,GAA2B,QAA3B;;ECzBI,IAAI,OAAOC,MAAP,IAAe,WAAnB,EAAgCA,OAAOC,OAAP,GAAiBH,GAAjB,CAAhC,KACKhU,KAAKgU,GAAL,GAAWA,GAAX;;"} \ No newline at end of file diff --git a/packages/omi/dist/omi.esm.js b/packages/omi/dist/omi.esm.js index d9e46d179..685dbd97b 100644 --- a/packages/omi/dist/omi.esm.js +++ b/packages/omi/dist/omi.esm.js @@ -1,5 +1,5 @@ /** - * omi v4.0.19 http://omijs.org + * omi v4.0.20 http://omijs.org * Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript. * By dntzhang https://github.com/dntzhang * Github: https://github.com/Tencent/omi @@ -451,7 +451,9 @@ function idiff(dom, vnode, context, mountAll, componentRoot) { } // otherwise, if there are existing or new children, diff them: else if (vchildren && vchildren.length || fc != null) { - innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null); + if (!(out.constructor.is == 'WeElement' && out.constructor.noSlot)) { + innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null); + } } // Apply attributes/props from VNode to the DOM Element: @@ -1041,7 +1043,18 @@ var WeElement = function (_HTMLElement) { } this.install(); - var shadowRoot = this.attachShadow({ mode: 'open' }); + var shadowRoot; + if (!this.shadowRoot) { + shadowRoot = this.attachShadow({ + mode: 'open' + }); + } else { + shadowRoot = this.shadowRoot; + var fc; + while (fc = shadowRoot.firstChild) { + shadowRoot.removeChild(fc); + } + } this.css && shadowRoot.appendChild(cssToDom(this.css())); this.beforeRender(); @@ -1406,7 +1419,7 @@ var omi = { }; options.root.Omi = omi; -options.root.Omi.version = '4.0.19'; +options.root.Omi.version = '4.0.20'; export default omi; export { tag, WeElement, Component, render, h, h as createElement, options, define, observe, cloneElement, getHost }; diff --git a/packages/omi/dist/omi.esm.js.map b/packages/omi/dist/omi.esm.js.map index ebc431b1d..5563df93e 100644 --- a/packages/omi/dist/omi.esm.js.map +++ b/packages/omi/dist/omi.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"omi.esm.js","sources":["../src/vnode.js","../src/options.js","../src/h.js","../src/util.js","../src/constants.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/proxy.js","../src/observe.js","../src/we-element.js","../src/render.js","../src/define.js","../src/tag.js","../src/clone-element.js","../src/get-host.js","../src/omi.js"],"sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","function getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n return (\n self ||\n window ||\n global ||\n (function() {\n return this\n })()\n )\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n store: null,\n root: getGlobal()\n}\n","import { VNode } from './vnode'\nimport options from './options'\n\nconst stack = []\nconst EMPTY_CHILDREN = []\n\nexport function h(nodeName, attributes) {\n let children = EMPTY_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--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children === EMPTY_CHILDREN) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let 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 * @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\n/**\n * This shim allows elements written in, or compiled to, ES5 to work on native\n * implementations of Custom Elements v1. It sets new.target to the value of\n * this.constructor so that the native HTMLElement constructor can access the\n * current under-construction element's definition.\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 ||\n 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 ) {\n return\n }\n const 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\nexport function cssToDom(css) {\n const node = document.createElement('style')\n node.textContent = css\n return node\n}\n\nexport function npn(str) {\n return str.replace(/-(\\w)/g, ($, $1) => {\n return $1.toUpperCase()\n })\n}\n\nexport function extend(obj, props) {\n for (let i in props) 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 */\nexport function applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value)\n 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 */\nexport const defer =\n typeof Promise == 'function'\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n","// render modes\n\nexport const NO_RENDER = 0\nexport const SYNC_RENDER = 1\nexport const FORCE_RENDER = 2\nexport const ASYNC_RENDER = 3\n\nexport const ATTR_KEY = '__preactattr_'\n\n// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\n","import { extend } from '../util'\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 */\nexport function 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 }\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 */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n /** @type {PreactElement} */\n let node = isSvg\n ? document.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : 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 */\nexport function removeNode(node) {\n let 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 {PreactElement} 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 */\nexport function 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 (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : 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 let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) node.addEventListener(name, eventProxy, useCapture)\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\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')\n node.removeAttribute(name)\n } else {\n let 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)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value === 'string') {\n if (ns) {\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n } else {\n 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","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { createNode, setAccessor } from '../dom/index'\nimport { npn, isArray } from '../util'\nimport { removeNode } from '../dom/index'\n\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet 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 */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n let 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 && !(ATTR_KEY in dom)\n }\n if (isArray(vnode)) {\n ret = []\n let parentNode = null\n if (isArray(dom)) {\n parentNode = dom[0].parentNode\n dom.forEach(function(item, index) {\n ret.push(idiff(item, vnode[index], context, mountAll, componentRoot))\n })\n } else {\n vnode.forEach(function(item) {\n ret.push(idiff(dom, item, context, mountAll, componentRoot))\n })\n }\n if (parent) {\n ret.forEach(function(vnode) {\n parent.appendChild(vnode)\n })\n } else if (isArray(dom)) {\n dom.forEach(function(node) {\n parentNode.appendChild(node)\n })\n }\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot)\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 && dom.props) {\n dom.props.children = vnode.children\n }\n let 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 (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\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[ATTR_KEY] = true\n\n return out\n }\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : 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) out.appendChild(dom.firstChild)\n\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 let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\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 innerDiffNode(\n out,\n vchildren,\n context,\n mountAll,\n 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 let 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 (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let 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 (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\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 (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n 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 */\nexport function 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[ATTR_KEY] != null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null)\n\n if (unmountOnly === false || node[ATTR_KEY] == 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 */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let 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 let name\n let update = false\n let isWeElement = dom.update\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 //diable when using store system?\n //!dom.store &&\n if (isWeElement && typeof attrs[name] === 'object') {\n dom.props[npn(name)] = attrs[name]\n update = true\n } else if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\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 dom.parentNode && update && isWeElement && dom.update()\n}\n","/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst 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 const pathComponents = []\n let 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 const 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 const parentPath = findObjectPath(instance, target)\n\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n const 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\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 const revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n\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\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 (\n newValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n ) {\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 const 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)) {\n // undefined array elements are JSON.stringified to `null`\n ;(operation.op = 'replace'), (operation.value = null)\n }\n const 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(\n 'JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch'\n )\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 const 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 const parentPath = findObjectPath(instance, target)\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n const revokableProxyInstance = instance.proxifiedObjectsMap.get(\n target[key]\n )\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\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 const 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 this.defaultCallback = 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 = () => {}\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 if (!obj) {\n return obj\n }\n const traps = {\n set: (target, key, value, receiver) =>\n setTrap(this, target, key, value, receiver),\n deleteProperty: (target, key) => deleteTrap(this, target, key)\n }\n const 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, 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(\n parent,\n root,\n path\n ) {\n for (let key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(\n root,\n root[key],\n escapePathComponent(key)\n )\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 const proxifiedObject = this._proxifyObjectTreeRecursively(\n undefined,\n root,\n ''\n )\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(\n revokableProxyInstance\n ) {\n if (this.showDetachedWarning) {\n const message =\n \"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 = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.set = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.deleteProperty = (\n targetObject,\n propKey\n ) => {\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(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\nexport default JSONPatcherProxy\n","import JSONProxy from './proxy'\n\nexport function observe(target) {\n target.observe = true\n}\n\nlet preValue = null\nlet prePath = null\nlet preEle = null\n\nexport function proxyUpdate(ele) {\n let timeout = null\n ele.data = new JSONProxy(ele.data).observe(false, info => {\n if (preValue === info.value && prePath === info.path && preEle === ele) {\n return\n }\n\n preValue = info.value\n prePath = info.path\n preEle = ele\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n }, 16.6)\n })\n}\n","import { cssToDom, nProps, isArray } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\nimport { proxyUpdate } from './observe'\n\nexport default class WeElement extends HTMLElement {\n static is = 'WeElement'\n\n constructor() {\n super()\n this.props = Object.assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps\n )\n this.data = this.constructor.data || {}\n }\n\n connectedCallback() {\n if (!this.constructor.pure) {\n let 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\n this.install()\n const shadowRoot = this.attachShadow({ mode: 'open' })\n\n this.css && shadowRoot.appendChild(cssToDom(this.css()))\n this.beforeRender()\n options.afterInstall && options.afterInstall(this)\n if (this.constructor.observe) {\n proxyUpdate(this)\n }\n this.host = diff(\n null,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n ),\n {},\n false,\n null,\n false\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 disconnectedCallback() {\n this.uninstall()\n if (this.store) {\n for (let 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 update() {\n this.beforeUpdate()\n this.beforeRender()\n diff(\n this.host,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n )\n )\n this.afterUpdate()\n }\n\n fire(name, data) {\n this.dispatchEvent(new CustomEvent(name, { detail: data }))\n }\n\n install() {}\n\n installed() {}\n\n uninstall() {}\n\n beforeUpdate() {}\n\n afterUpdate() {}\n\n beforeRender() {}\n}\n","import { diff } from './vdom/diff'\nimport JSONProxy from './proxy'\n\nexport function render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n if (store) {\n store.instances = []\n extendStoreUpate(store)\n let timeout = null\n let patchs = {}\n store.data = new JSONProxy(store.data).observe(false, function(patch) {\n clearTimeout(timeout)\n if (patch.op === 'remove') {\n // fix arr splice\n const kv = getArrayPatch(patch.path, store)\n patchs[kv.k] = kv.v\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n } else {\n const key = fixPath(patch.path)\n patchs[key] = patch.value\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n }\n })\n parent.store = store\n }\n 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 const updateAll = matchGlobalData(this.globalData, patch)\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(instance => {\n if (\n updateAll ||\n this.updateAll ||\n (instance.constructor.updatePath &&\n needUpdate(patch, instance.constructor.updatePath))\n ) {\n instance.update()\n }\n })\n this.onChange && this.onChange(patch)\n }\n }\n}\n\nexport function matchGlobalData(globalData, diffResult) {\n if (!globalData) return false\n for (let keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true\n }\n for (let 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\nexport function needUpdate(diffResult, updatePath) {\n for (let keyA in diffResult) {\n if (updatePath[keyA]) {\n return true\n }\n for (let 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 const next = pathA.substr(pathB.length, 1)\n if (next === '[' || next === '.') {\n return true\n }\n }\n return false\n}\n\nexport function fixPath(path) {\n let mpPath = ''\n const arr = path.replace('/', '').split('/')\n arr.forEach((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 const arr = path.replace('/', '').split('/')\n let current = store.data[arr[0]]\n for (let 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 let mpPath = ''\n const arr = path.replace('/', '').split('/')\n const len = arr.length\n arr.forEach((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","import WeElement from './we-element'\nimport { cssToDom } from './util'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n if (ctor.is === 'WeElement') {\n customElements.define(name, ctor)\n if (ctor.data && !ctor.pure) {\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n } else {\n class Element extends WeElement {\n _useId = 0\n\n _useMap = {}\n\n render(props, data) {\n return ctor.call(this, props, data)\n }\n\n beforeRender() {\n this._useId = 0\n }\n\n useCss(css) {\n const style = this.shadowRoot.querySelector('style')\n style && this.shadowRoot.removeChild(style)\n this.shadowRoot.appendChild(cssToDom(css))\n }\n\n useData(data) {\n return this.use({ data: data })\n }\n\n use(option) {\n this._useId++\n const updater = newValue => {\n const item = this._useMap[updater.id]\n\n item.data = newValue\n\n this.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 installed() {\n this._isInstalled = true\n }\n }\n customElements.define(name, Element)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import { define } from './define'\nimport WeElement from './we-element'\nexport function tag(name, pure) {\n return function(target) {\n target.pure = pure\n define(name, target)\n }\n}\n","import { extend } from './util'\nimport { h } from './h'\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 */\nexport function cloneElement(vnode, props) {\n return h(\n vnode.nodeName,\n extend(extend({}, vnode.attributes), props),\n arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children\n )\n}\n","export function getHost(ele) {\n let p = ele.parentNode\n while (p) {\n if (p.host) {\n return p.host\n } else {\n p = p.parentNode\n }\n }\n}\n","import { h, h as createElement } from './h'\nimport options from './options'\nimport WeElement from './we-element'\nimport { render } from './render'\nimport { define } from './define'\nimport { tag } from './tag'\nimport { observe } from './observe'\nimport { cloneElement } from './clone-element'\nimport { getHost } from './get-host'\n\nconst Component = WeElement\n\nconst omi = {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n\noptions.root.Omi = omi\noptions.root.Omi.version = '4.0.19'\n\nexport default omi\n\nexport {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n"],"names":["VNode","getGlobal","global","Math","Array","self","window","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","i","arguments","length","push","pop","undefined","String","p","key","options","vnode","Reflect","customElements","hasOwnProperty","BuiltInHTMLElement","HTMLElement","construct","constructor","prototype","setPrototypeOf","cssToDom","css","node","document","createElement","textContent","npn","str","replace","$","$1","toUpperCase","extend","obj","props","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","isArray","Object","toString","call","nProps","result","keys","forEach","ATTR_KEY","IS_NON_DIMENSIONAL","isSameNodeType","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","toLowerCase","createNode","isSvg","createElementNS","removeNode","parentNode","removeChild","setAccessor","name","old","className","style","cssText","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","setAttribute","type","event","diffLevel","isSvgMode","diff","dom","context","mountAll","parent","componentRoot","ret","ownerSVGElement","item","index","idiff","appendChild","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","vnodeName","firstChild","fc","vchildren","a","nextSibling","dangerouslySetInnerHTML","innerDiffNode","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","len","childrenLen","vlen","j","c","f","vchild","__key","trim","insertBefore","recollectNodeTree","unmountOnly","removeChildren","lastChild","next","previousSibling","diffAttributes","attrs","update","isWeElement","JSONPatcherProxy","deepClone","JSON","parse","stringify","escapePathComponent","indexOf","findObjectPath","instance","pathComponents","parentAndPath","parenthoodMap","get","path","unshift","join","setTrap","target","newValue","parentPath","destinationPropKey","proxifiedObjectsMap","has","newValueOriginalObject","set","originalObject","revokableInstance","isProxifyingTreeNow","inherited","_proxifyObjectTreeRecursively","operation","op","oldValue","delete","disableTrapsForProxy","Number","isInteger","warn","reflectionResult","defaultCallback","deleteTrap","revokableProxyInstance","deleteProperty","resume","isRecording","patches","userCallback","isObserving","pause","root","showDetachedWarning","Map","cachedProxy","generateProxyAtPath","traps","receiver","revocableInstance","Proxy","revocable","trapsInstance","proxy","proxifyObjectTree","proxifiedObject","message","targetObject","propKey","observe","record","callback","Error","generate","splice","revoke","disableTraps","preValue","prePath","preEle","proxyUpdate","ele","timeout","data","JSONProxy","info","WeElement","assign","defaultProps","connectedCallback","pure","store","host","instances","install","shadowRoot","attachShadow","mode","beforeRender","afterInstall","render","installed","_isInstalled","disconnectedCallback","uninstall","beforeUpdate","afterUpdate","fire","dispatchEvent","CustomEvent","detail","is","querySelector","patchs","patch","kv","getArrayPatch","k","v","fixPath","extendStoreUpate","updateAll","matchGlobalData","globalData","updatePath","needUpdate","onChange","diffResult","keyA","includePath","keyB","pathA","pathB","substr","mpPath","arr","split","isNaN","fixArrPath","OBJECTTYPE","ARRAYTYPE","define","ctor","getUpdatePath","Element","_useId","_useMap","useCss","useData","use","option","updater","id","effect","dataToPath","_objToPath","_arrayToPath","tag","cloneElement","slice","getHost","Component","omi","Omi","version"],"mappings":";;;;;;;;AAAA;AACA,SAAgBA,KAAT,GAAiB;;ACDxB,SAASC,SAAT,GAAqB;MAEjB,OAAOC,MAAP,KAAkB,QAAlB,IACA,CAACA,MADD,IAEAA,OAAOC,IAAP,KAAgBA,IAFhB,IAGAD,OAAOE,KAAP,KAAiBA,KAJnB,EAKE;WAEEC,QACAC,MADA,IAEAJ,MAFA,IAGC,YAAW;aACH,IAAP;KADF,EAJF;;SASKA,MAAP;;;;;;;AAOF,cAAe;SACN,IADM;QAEPD;CAFR;;ICpBMM,QAAQ,EAAd;AACA,IAAMC,iBAAiB,EAAvB;;AAEA,SAAgBC,CAAT,CAAWC,QAAX,EAAqBC,UAArB,EAAiC;MAClCC,WAAWJ,cAAf;MACEK,mBADF;MAEEC,cAFF;MAGEC,eAHF;MAIEC,UAJF;OAKKA,IAAIC,UAAUC,MAAnB,EAA2BF,MAAM,CAAjC,GAAsC;UAC9BG,IAAN,CAAWF,UAAUD,CAAV,CAAX;;MAEEL,cAAcA,WAAWC,QAAX,IAAuB,IAAzC,EAA+C;QACzC,CAACL,MAAMW,MAAX,EAAmBX,MAAMY,IAAN,CAAWR,WAAWC,QAAtB;WACZD,WAAWC,QAAlB;;SAEKL,MAAMW,MAAb,EAAqB;QACf,CAACJ,QAAQP,MAAMa,GAAN,EAA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O,IAAN,EAAY;aACHnO,EAAEmO,IAAT;KADF,MAEO;UACDnO,EAAE2D,UAAN;;;;;ICIA6O,YAAY3E,SAAlB;;AAEA,IAAM4E,MAAM;UAAA;sBAAA;sBAAA;gBAAA;MAAA;kBAAA;kBAAA;gBAAA;kBAAA;4BAAA;;CAAZ;;AAcAvS,QAAQyL,IAAR,CAAa+G,GAAb,GAAmBD,GAAnB;AACAvS,QAAQyL,IAAR,CAAa+G,GAAb,CAAiBC,OAAjB,GAA2B,QAA3B;;;"} \ No newline at end of file +{"version":3,"file":"omi.esm.js","sources":["../src/vnode.js","../src/options.js","../src/h.js","../src/util.js","../src/constants.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/proxy.js","../src/observe.js","../src/we-element.js","../src/render.js","../src/define.js","../src/tag.js","../src/clone-element.js","../src/get-host.js","../src/omi.js"],"sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","function getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n return (\n self ||\n window ||\n global ||\n (function() {\n return this\n })()\n )\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n store: null,\n root: getGlobal()\n}\n","import { VNode } from './vnode'\nimport options from './options'\n\nconst stack = []\nconst EMPTY_CHILDREN = []\n\nexport function h(nodeName, attributes) {\n let children = EMPTY_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--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children === EMPTY_CHILDREN) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let 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 * @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\n/**\n * This shim allows elements written in, or compiled to, ES5 to work on native\n * implementations of Custom Elements v1. It sets new.target to the value of\n * this.constructor so that the native HTMLElement constructor can access the\n * current under-construction element's definition.\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 ||\n 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 ) {\n return\n }\n const 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\nexport function cssToDom(css) {\n const node = document.createElement('style')\n node.textContent = css\n return node\n}\n\nexport function npn(str) {\n return str.replace(/-(\\w)/g, ($, $1) => {\n return $1.toUpperCase()\n })\n}\n\nexport function extend(obj, props) {\n for (let i in props) 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 */\nexport function applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value)\n 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 */\nexport const defer =\n typeof Promise == 'function'\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n","// render modes\n\nexport const NO_RENDER = 0\nexport const SYNC_RENDER = 1\nexport const FORCE_RENDER = 2\nexport const ASYNC_RENDER = 3\n\nexport const ATTR_KEY = '__preactattr_'\n\n// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\n","import { extend } from '../util'\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 */\nexport function 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 }\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 */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n /** @type {PreactElement} */\n let node = isSvg\n ? document.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : 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 */\nexport function removeNode(node) {\n let 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 {PreactElement} 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 */\nexport function 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 (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : 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 let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) node.addEventListener(name, eventProxy, useCapture)\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\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')\n node.removeAttribute(name)\n } else {\n let 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)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value === 'string') {\n if (ns) {\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n } else {\n 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","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { createNode, setAccessor } from '../dom/index'\nimport { npn, isArray } from '../util'\nimport { removeNode } from '../dom/index'\n\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet 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 */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n let 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 && !(ATTR_KEY in dom)\n }\n if (isArray(vnode)) {\n ret = []\n let parentNode = null\n if (isArray(dom)) {\n parentNode = dom[0].parentNode\n dom.forEach(function(item, index) {\n ret.push(idiff(item, vnode[index], context, mountAll, componentRoot))\n })\n } else {\n vnode.forEach(function(item) {\n ret.push(idiff(dom, item, context, mountAll, componentRoot))\n })\n }\n if (parent) {\n ret.forEach(function(vnode) {\n parent.appendChild(vnode)\n })\n } else if (isArray(dom)) {\n dom.forEach(function(node) {\n parentNode.appendChild(node)\n })\n }\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot)\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 && dom.props) {\n dom.props.children = vnode.children\n }\n let 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 (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\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[ATTR_KEY] = true\n\n return out\n }\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : 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) out.appendChild(dom.firstChild)\n\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 let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\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(\n out,\n vchildren,\n context,\n mountAll,\n hydrating || props.dangerouslySetInnerHTML != null\n )\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 let 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 (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let 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 (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\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 (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n 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 */\nexport function 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[ATTR_KEY] != null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null)\n\n if (unmountOnly === false || node[ATTR_KEY] == 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 */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let 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 let name\n let update = false\n let isWeElement = dom.update\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 //diable when using store system?\n //!dom.store &&\n if (isWeElement && typeof attrs[name] === 'object') {\n dom.props[npn(name)] = attrs[name]\n update = true\n } else if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\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 dom.parentNode && update && isWeElement && dom.update()\n}\n","/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst 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 const pathComponents = []\n let 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 const 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 const parentPath = findObjectPath(instance, target)\n\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n const 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\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 const revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n\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\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 (\n newValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n ) {\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 const 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)) {\n // undefined array elements are JSON.stringified to `null`\n ;(operation.op = 'replace'), (operation.value = null)\n }\n const 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(\n 'JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch'\n )\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 const 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 const parentPath = findObjectPath(instance, target)\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n const revokableProxyInstance = instance.proxifiedObjectsMap.get(\n target[key]\n )\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\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 const 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 this.defaultCallback = 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 = () => {}\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 if (!obj) {\n return obj\n }\n const traps = {\n set: (target, key, value, receiver) =>\n setTrap(this, target, key, value, receiver),\n deleteProperty: (target, key) => deleteTrap(this, target, key)\n }\n const 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, 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(\n parent,\n root,\n path\n ) {\n for (let key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(\n root,\n root[key],\n escapePathComponent(key)\n )\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 const proxifiedObject = this._proxifyObjectTreeRecursively(\n undefined,\n root,\n ''\n )\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(\n revokableProxyInstance\n ) {\n if (this.showDetachedWarning) {\n const message =\n \"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 = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.set = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.deleteProperty = (\n targetObject,\n propKey\n ) => {\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(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\nexport default JSONPatcherProxy\n","import JSONProxy from './proxy'\n\nexport function observe(target) {\n target.observe = true\n}\n\nlet preValue = null\nlet prePath = null\nlet preEle = null\n\nexport function proxyUpdate(ele) {\n let timeout = null\n ele.data = new JSONProxy(ele.data).observe(false, info => {\n if (preValue === info.value && prePath === info.path && preEle === ele) {\n return\n }\n\n preValue = info.value\n prePath = info.path\n preEle = ele\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n }, 16.6)\n })\n}\n","import { cssToDom, nProps, isArray } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\nimport { proxyUpdate } from './observe'\n\nexport default class WeElement extends HTMLElement {\n static is = 'WeElement'\n\n constructor() {\n super()\n this.props = Object.assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps\n )\n this.data = this.constructor.data || {}\n }\n\n connectedCallback() {\n if (!this.constructor.pure) {\n let 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\n this.install()\n let shadowRoot\n if (!this.shadowRoot) {\n shadowRoot = this.attachShadow({\n mode: 'open'\n })\n } else {\n shadowRoot = this.shadowRoot\n let fc\n while ((fc = shadowRoot.firstChild)) {\n shadowRoot.removeChild(fc)\n }\n }\n\n this.css && shadowRoot.appendChild(cssToDom(this.css()))\n this.beforeRender()\n options.afterInstall && options.afterInstall(this)\n if (this.constructor.observe) {\n proxyUpdate(this)\n }\n this.host = diff(\n null,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n ),\n {},\n false,\n null,\n false\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 disconnectedCallback() {\n this.uninstall()\n if (this.store) {\n for (let 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 update() {\n this.beforeUpdate()\n this.beforeRender()\n diff(\n this.host,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n )\n )\n this.afterUpdate()\n }\n\n fire(name, data) {\n this.dispatchEvent(new CustomEvent(name, { detail: data }))\n }\n\n install() {}\n\n installed() {}\n\n uninstall() {}\n\n beforeUpdate() {}\n\n afterUpdate() {}\n\n beforeRender() {}\n}\n","import { diff } from './vdom/diff'\nimport JSONProxy from './proxy'\n\nexport function render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n if (store) {\n store.instances = []\n extendStoreUpate(store)\n let timeout = null\n let patchs = {}\n store.data = new JSONProxy(store.data).observe(false, function(patch) {\n clearTimeout(timeout)\n if (patch.op === 'remove') {\n // fix arr splice\n const kv = getArrayPatch(patch.path, store)\n patchs[kv.k] = kv.v\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n } else {\n const key = fixPath(patch.path)\n patchs[key] = patch.value\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n }\n })\n parent.store = store\n }\n 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 const updateAll = matchGlobalData(this.globalData, patch)\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(instance => {\n if (\n updateAll ||\n this.updateAll ||\n (instance.constructor.updatePath &&\n needUpdate(patch, instance.constructor.updatePath))\n ) {\n instance.update()\n }\n })\n this.onChange && this.onChange(patch)\n }\n }\n}\n\nexport function matchGlobalData(globalData, diffResult) {\n if (!globalData) return false\n for (let keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true\n }\n for (let 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\nexport function needUpdate(diffResult, updatePath) {\n for (let keyA in diffResult) {\n if (updatePath[keyA]) {\n return true\n }\n for (let 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 const next = pathA.substr(pathB.length, 1)\n if (next === '[' || next === '.') {\n return true\n }\n }\n return false\n}\n\nexport function fixPath(path) {\n let mpPath = ''\n const arr = path.replace('/', '').split('/')\n arr.forEach((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 const arr = path.replace('/', '').split('/')\n let current = store.data[arr[0]]\n for (let 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 let mpPath = ''\n const arr = path.replace('/', '').split('/')\n const len = arr.length\n arr.forEach((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","import WeElement from './we-element'\nimport { cssToDom } from './util'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n if (ctor.is === 'WeElement') {\n customElements.define(name, ctor)\n if (ctor.data && !ctor.pure) {\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n } else {\n class Element extends WeElement {\n _useId = 0\n\n _useMap = {}\n\n render(props, data) {\n return ctor.call(this, props, data)\n }\n\n beforeRender() {\n this._useId = 0\n }\n\n useCss(css) {\n const style = this.shadowRoot.querySelector('style')\n style && this.shadowRoot.removeChild(style)\n this.shadowRoot.appendChild(cssToDom(css))\n }\n\n useData(data) {\n return this.use({ data: data })\n }\n\n use(option) {\n this._useId++\n const updater = newValue => {\n const item = this._useMap[updater.id]\n\n item.data = newValue\n\n this.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 installed() {\n this._isInstalled = true\n }\n }\n customElements.define(name, Element)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import { define } from './define'\nimport WeElement from './we-element'\nexport function tag(name, pure) {\n return function(target) {\n target.pure = pure\n define(name, target)\n }\n}\n","import { extend } from './util'\nimport { h } from './h'\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 */\nexport function cloneElement(vnode, props) {\n return h(\n vnode.nodeName,\n extend(extend({}, vnode.attributes), props),\n arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children\n )\n}\n","export function getHost(ele) {\n let p = ele.parentNode\n while (p) {\n if (p.host) {\n return p.host\n } else {\n p = p.parentNode\n }\n }\n}\n","import { h, h as createElement } from './h'\nimport options from './options'\nimport WeElement from './we-element'\nimport { render } from './render'\nimport { define } from './define'\nimport { tag } from './tag'\nimport { observe } from './observe'\nimport { cloneElement } from './clone-element'\nimport { getHost } from './get-host'\n\nconst Component = WeElement\n\nconst omi = {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n\noptions.root.Omi = omi\noptions.root.Omi.version = '4.0.20'\n\nexport default omi\n\nexport {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n"],"names":["VNode","getGlobal","global","Math","Array","self","window","stack","EMPTY_CHILDREN","h","nodeName","attributes","children","lastSimple","child","simple","i","arguments","length","push","pop","undefined","String","p","key","options","vnode","Reflect","customElements","hasOwnProperty","BuiltInHTMLElement","HTMLElement","construct","constructor","prototype","setPrototypeOf","cssToDom","css","node","document","createElement","textContent","npn","str","replace","$","$1","toUpperCase","extend","obj","props","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","isArray","Object","toString","call","nProps","result","keys","forEach","ATTR_KEY","IS_NON_DIMENSIONAL","isSameNodeType","hydrating","splitText","_componentConstructor","isNamedNode","normalizedNodeName","toLowerCase","createNode","isSvg","createElementNS","removeNode","parentNode","removeChild","setAccessor","name","old","className","style","cssText","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","removeEventListener","_listeners","e","removeAttribute","ns","removeAttributeNS","setAttributeNS","setAttribute","type","event","diffLevel","isSvgMode","diff","dom","context","mountAll","parent","componentRoot","ret","ownerSVGElement","item","index","idiff","appendChild","out","prevSvgMode","_component","nodeValue","createTextNode","replaceChild","vnodeName","firstChild","fc","vchildren","a","nextSibling","is","noSlot","dangerouslySetInnerHTML","innerDiffNode","isHydrating","originalChildren","childNodes","keyed","keyedLen","min","len","childrenLen","vlen","j","c","f","vchild","__key","trim","insertBefore","recollectNodeTree","unmountOnly","removeChildren","lastChild","next","previousSibling","diffAttributes","attrs","update","isWeElement","JSONPatcherProxy","deepClone","JSON","parse","stringify","escapePathComponent","indexOf","findObjectPath","instance","pathComponents","parentAndPath","parenthoodMap","get","path","unshift","join","setTrap","target","newValue","parentPath","destinationPropKey","proxifiedObjectsMap","has","newValueOriginalObject","set","originalObject","revokableInstance","isProxifyingTreeNow","inherited","_proxifyObjectTreeRecursively","operation","op","oldValue","delete","disableTrapsForProxy","Number","isInteger","warn","reflectionResult","defaultCallback","deleteTrap","revokableProxyInstance","deleteProperty","resume","isRecording","patches","userCallback","isObserving","pause","root","showDetachedWarning","Map","cachedProxy","generateProxyAtPath","traps","receiver","revocableInstance","Proxy","revocable","trapsInstance","proxy","proxifyObjectTree","proxifiedObject","message","targetObject","propKey","observe","record","callback","Error","generate","splice","revoke","disableTraps","preValue","prePath","preEle","proxyUpdate","ele","timeout","data","JSONProxy","info","WeElement","assign","defaultProps","connectedCallback","pure","store","host","instances","install","shadowRoot","attachShadow","beforeRender","afterInstall","render","installed","_isInstalled","disconnectedCallback","uninstall","beforeUpdate","afterUpdate","fire","dispatchEvent","CustomEvent","detail","querySelector","patchs","patch","kv","getArrayPatch","k","v","fixPath","extendStoreUpate","updateAll","matchGlobalData","globalData","updatePath","needUpdate","onChange","diffResult","keyA","includePath","keyB","pathA","pathB","substr","mpPath","arr","split","isNaN","fixArrPath","OBJECTTYPE","ARRAYTYPE","define","ctor","getUpdatePath","Element","_useId","_useMap","useCss","useData","use","option","updater","id","effect","dataToPath","_objToPath","_arrayToPath","tag","cloneElement","slice","getHost","Component","omi","Omi","version"],"mappings":";;;;;;;;AAAA;AACA,SAAgBA,KAAT,GA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AAcAvS,QAAQ2L,IAAR,CAAa6G,GAAb,GAAmBD,GAAnB;AACAvS,QAAQ2L,IAAR,CAAa6G,GAAb,CAAiBC,OAAjB,GAA2B,QAA3B;;;"} \ No newline at end of file diff --git a/packages/omi/dist/omi.js b/packages/omi/dist/omi.js index e2784f1dd..3ca843f28 100644 --- a/packages/omi/dist/omi.js +++ b/packages/omi/dist/omi.js @@ -163,7 +163,7 @@ } if (!hydrating && vchildren && 1 === vchildren.length && 'string' == typeof vchildren[0] && null != fc && void 0 !== fc.splitText && null == fc.nextSibling) { if (fc.nodeValue != vchildren[0]) fc.nodeValue = vchildren[0]; - } else if (vchildren && vchildren.length || null != fc) innerDiffNode(out, vchildren, context, mountAll, hydrating || null != props.dangerouslySetInnerHTML); + } else if (vchildren && vchildren.length || null != fc) if ('WeElement' != out.constructor.is || !out.constructor.noSlot) innerDiffNode(out, vchildren, context, mountAll, hydrating || null != props.dangerouslySetInnerHTML); diffAttributes(out, vnode.attributes, props); if (out.props) out.props.children = vnode.children; isSvgMode = prevSvgMode; @@ -723,9 +723,14 @@ if (this.store) this.store.instances.push(this); } this.install(); - var shadowRoot = this.attachShadow({ + var shadowRoot; + if (!this.shadowRoot) shadowRoot = this.attachShadow({ mode: 'open' - }); + }); else { + shadowRoot = this.shadowRoot; + var fc; + while (fc = shadowRoot.firstChild) shadowRoot.removeChild(fc); + } this.css && shadowRoot.appendChild(cssToDom(this.css())); this.beforeRender(); options.afterInstall && options.afterInstall(this); @@ -779,7 +784,7 @@ getHost: getHost }; options.root.Omi = omi; - options.root.Omi.version = '4.0.19'; + options.root.Omi.version = '4.0.20'; if ('undefined' != typeof module) module.exports = omi; else self.Omi = omi; }(); //# sourceMappingURL=omi.js.map \ No newline at end of file diff --git a/packages/omi/dist/omi.js.map b/packages/omi/dist/omi.js.map index 7cb5195f6..6827082a3 100644 --- a/packages/omi/dist/omi.js.map +++ b/packages/omi/dist/omi.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/vnode.js","../src/h.js","../src/util.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/proxy.js","../src/observe.js","../src/we-element.js","../src/render.js","../src/define.js","../src/clone-element.js","../src/options.js","../src/get-host.js","../src/omi.js"],"names":["VNode","h","nodeName","attributes","lastSimple","child","simple","i","children","EMPTY_CHILDREN","arguments","length","stack","push","pop","undefined","String","p","key","options","vnode","cssToDom","css","node","document","createElement","textContent","npn","str","replace","$","$1","toUpperCase","extend","obj","props","applyRef","ref","value","current","isArray","Object","prototype","toString","call","nProps","result","keys","forEach","isSameNodeType","hydrating","_componentConstructor","createNode","removeNode","name","isSvg","className","old","style","cssText","IS_NON_DIMENSIONAL","test","useCapture","substring","addEventListener","eventProxy","_listeners","e","removeAttribute","ns","removeAttributeNS","toLowerCase","setAttribute","isSvgMode","parent","ownerSVGElement","dom","ret","parentNode","item","index","context","mountAll","componentRoot","idiff","appendChild","out","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","vchildren","firstChild","fc","a","splitText","nextSibling","innerDiffNode","dangerouslySetInnerHTML","min","len","childrenLen","vlen","j","keyedLen","originalChildren","keyed","vchild","_child","_component","__key","trim","isHydrating","c","f","unmountOnly","removeChildren","update","attrs","isWeElement","setAccessor","observe","target","JSONPatcherProxy","preValue","ele","prePath","preEle","data","info","path","clearTimeout","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","HTMLElement","WeElement","is","extendStoreUpate","store","instances","patch","timeout","getArrayPatch","JSONProxy","v","setTimeout","patchs","diff","_this","this","updateAll","globalData","matchGlobalData","updatePath","needUpdate","constructor","onChange","diffResult","keyA","indexOf","keyB","includePath","pathA","pathB","next","substr","fixPath","mpPath","arr","split","Number","fixArrPath","_classCallCheck$1","_possibleConstructorReturn$1","OBJECTTYPE","getUpdatePath","ctor","Element","_WeElement","_len","args","Array","render","beforeRender","_useId","useCss","shadowRoot","querySelector","use","_this2","updater","newValue","_useMap","id","effect","installed","_isInstalled","customElements","define","dataToPath","type","_objToPath","_arrayToPath","ARRAYTYPE","cloneElement","root","global","Math","window","Reflect","hasOwnProperty","BuiltInHTMLElement","construct","setPrototypeOf","Promise","resolve","then","bind","diffLevel","deepClone","JSON","escapePathComponent","pathComponents","parentAndPath","parenthoodMap","get","parentPath","newValueOriginalObject","revokableInstance","inherited","proxifiedObjectsMap","has","set","operation","destinationPropKey","op","oldValue","delete","disableTrapsForProxy","console","warn","reflectionResult","defaultCallback","revokableProxyInstance","resume","patches","userCallback","pause","isObserving","showDetachedWarning","cachedProxy","receiver","deleteProperty","deleteTrap","Proxy","revocable","revocableInstance","trapsInstance","traps","originalObject","_proxifyObjectTreeRecursively","proxifyObjectTree","isProxifyingTreeNow","proxifiedObject","targetObject","message","propKey","record","callback","generate","isRecording","revoke","el","disableTraps","assign","defaultProps","connectedCallback","pure","host","install","attachShadow","mode","proxyUpdate","afterInstall","disconnectedCallback","uninstall","splice","beforeUpdate","fire","afterUpdate","CustomEvent","detail","Component","tag","omi","version","module","exports","Omi"],"mappings":";;IACO,SAASA;ICKT,SAASC,EAAEC,UAAUC;QAC1B,IACEC,YACAC,OACAC,QACAC,GAJEC,WAAWC;QAKf,KAAKF,IAAIG,UAAUC,QAAQJ,MAAM,KAC/BK,MAAMC,KAAKH,UAAUH;QAEvB,IAAIJ,cAAqC,QAAvBA,WAAWK,UAAkB;YAC7C,KAAKI,MAAMD,QAAQC,MAAMC,KAAKV,WAAWK;mBAClCL,WAAWK;;QAEpB,OAAOI,MAAMD,QACX,KAAKN,QAAQO,MAAME,eAAwBC,MAAdV,MAAMS,KACjC,KAAKP,IAAIF,MAAMM,QAAQJ,OAAOK,MAAMC,KAAKR,MAAME,UAC1C;YACL,IAAqB,oBAAVF,OAAqBA,QAAQ;YAExC,IAAKC,SAA6B,qBAAbJ,UACnB,IAAa,QAATG,OAAeA,QAAQ,SACtB,IAAqB,mBAAVA,OAAoBA,QAAQW,OAAOX,aAC9C,IAAqB,mBAAVA,OAAoBC,UAAS;YAG/C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;YACAvI,KAAK+C;YACN,IAAA/C,KAAAX,uFAEDkJ,UAAAA,OAAAA,MAAAA;gBACOC,KAAAA,MAALlJ,UAAAmJ,OAAA7R,GAAA;gBACI;;;QAMDsI,UAAAnG,UAAA4E,SAAA;YACFqC,KAAA0I;YACF1I,KAAAkC;;;;QAKCpC,UACE/G,UACA4P,OAAK1G,SAALtI,MAEG2E;YAGL0B,KAAK4I,cAAL,IAAAC,YAAAlP;gBAAAmP,QAAAxK;;;4BAGFqK,UAAAA;QAECzJ,UAAAnG,UAAA+J,YAAA;4BAEDoF,YAAAA;4BAEApF,eAAAA;4BAEA0F,cAAAA;4BAEAE,eAAAA;;;;IK3FI,IAAAK,YAASd;IAET3Q,IAAAA;QACD0R,KAAAA;QACF9J,WAAAA;QACF6J,WAAAA;;WCCKA;;QAENvR,SAAYA;QACVwR,QADU/F;QAEV/D,SAAAA;QACA6J,cAAAA;QACA9G,SAAAA;;IAGAzK,QAAAA,KAAAA,MAPUyR;IAQVhG,QAAAA,KAAAA,IARUiG,UAAA;IAUV3F,IAAAA,sBAAAA,QAVU4F,OAAAC,UAAAH,UAAAlK,KAAAsK,MAAAJ","file":"omi.js","sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","import { VNode } from './vnode'\nimport options from './options'\n\nconst stack = []\nconst EMPTY_CHILDREN = []\n\nexport function h(nodeName, attributes) {\n let children = EMPTY_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--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children === EMPTY_CHILDREN) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let 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 * @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\n/**\n * This shim allows elements written in, or compiled to, ES5 to work on native\n * implementations of Custom Elements v1. It sets new.target to the value of\n * this.constructor so that the native HTMLElement constructor can access the\n * current under-construction element's definition.\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 ||\n 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 ) {\n return\n }\n const 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\nexport function cssToDom(css) {\n const node = document.createElement('style')\n node.textContent = css\n return node\n}\n\nexport function npn(str) {\n return str.replace(/-(\\w)/g, ($, $1) => {\n return $1.toUpperCase()\n })\n}\n\nexport function extend(obj, props) {\n for (let i in props) 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 */\nexport function applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value)\n 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 */\nexport const defer =\n typeof Promise == 'function'\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n","import { extend } from '../util'\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 */\nexport function 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 }\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 */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n /** @type {PreactElement} */\n let node = isSvg\n ? document.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : 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 */\nexport function removeNode(node) {\n let 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 {PreactElement} 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 */\nexport function 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 (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : 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 let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) node.addEventListener(name, eventProxy, useCapture)\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\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')\n node.removeAttribute(name)\n } else {\n let 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)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value === 'string') {\n if (ns) {\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n } else {\n 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","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { createNode, setAccessor } from '../dom/index'\nimport { npn, isArray } from '../util'\nimport { removeNode } from '../dom/index'\n\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet 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 */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n let 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 && !(ATTR_KEY in dom)\n }\n if (isArray(vnode)) {\n ret = []\n let parentNode = null\n if (isArray(dom)) {\n parentNode = dom[0].parentNode\n dom.forEach(function(item, index) {\n ret.push(idiff(item, vnode[index], context, mountAll, componentRoot))\n })\n } else {\n vnode.forEach(function(item) {\n ret.push(idiff(dom, item, context, mountAll, componentRoot))\n })\n }\n if (parent) {\n ret.forEach(function(vnode) {\n parent.appendChild(vnode)\n })\n } else if (isArray(dom)) {\n dom.forEach(function(node) {\n parentNode.appendChild(node)\n })\n }\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot)\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 && dom.props) {\n dom.props.children = vnode.children\n }\n let 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 (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\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[ATTR_KEY] = true\n\n return out\n }\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : 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) out.appendChild(dom.firstChild)\n\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 let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\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 innerDiffNode(\n out,\n vchildren,\n context,\n mountAll,\n 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 let 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 (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let 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 (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\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 (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n 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 */\nexport function 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[ATTR_KEY] != null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null)\n\n if (unmountOnly === false || node[ATTR_KEY] == 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 */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let 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 let name\n let update = false\n let isWeElement = dom.update\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 //diable when using store system?\n //!dom.store &&\n if (isWeElement && typeof attrs[name] === 'object') {\n dom.props[npn(name)] = attrs[name]\n update = true\n } else if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\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 dom.parentNode && update && isWeElement && dom.update()\n}\n","/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst 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 const pathComponents = []\n let 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 const 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 const parentPath = findObjectPath(instance, target)\n\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n const 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\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 const revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n\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\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 (\n newValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n ) {\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 const 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)) {\n // undefined array elements are JSON.stringified to `null`\n ;(operation.op = 'replace'), (operation.value = null)\n }\n const 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(\n 'JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch'\n )\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 const 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 const parentPath = findObjectPath(instance, target)\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n const revokableProxyInstance = instance.proxifiedObjectsMap.get(\n target[key]\n )\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\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 const 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 this.defaultCallback = 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 = () => {}\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 if (!obj) {\n return obj\n }\n const traps = {\n set: (target, key, value, receiver) =>\n setTrap(this, target, key, value, receiver),\n deleteProperty: (target, key) => deleteTrap(this, target, key)\n }\n const 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, 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(\n parent,\n root,\n path\n ) {\n for (let key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(\n root,\n root[key],\n escapePathComponent(key)\n )\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 const proxifiedObject = this._proxifyObjectTreeRecursively(\n undefined,\n root,\n ''\n )\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(\n revokableProxyInstance\n ) {\n if (this.showDetachedWarning) {\n const message =\n \"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 = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.set = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.deleteProperty = (\n targetObject,\n propKey\n ) => {\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(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\nexport default JSONPatcherProxy\n","import JSONProxy from './proxy'\n\nexport function observe(target) {\n target.observe = true\n}\n\nlet preValue = null\nlet prePath = null\nlet preEle = null\n\nexport function proxyUpdate(ele) {\n let timeout = null\n ele.data = new JSONProxy(ele.data).observe(false, info => {\n if (preValue === info.value && prePath === info.path && preEle === ele) {\n return\n }\n\n preValue = info.value\n prePath = info.path\n preEle = ele\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n }, 16.6)\n })\n}\n","import { cssToDom, nProps, isArray } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\nimport { proxyUpdate } from './observe'\n\nexport default class WeElement extends HTMLElement {\n static is = 'WeElement'\n\n constructor() {\n super()\n this.props = Object.assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps\n )\n this.data = this.constructor.data || {}\n }\n\n connectedCallback() {\n if (!this.constructor.pure) {\n let 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\n this.install()\n const shadowRoot = this.attachShadow({ mode: 'open' })\n\n this.css && shadowRoot.appendChild(cssToDom(this.css()))\n this.beforeRender()\n options.afterInstall && options.afterInstall(this)\n if (this.constructor.observe) {\n proxyUpdate(this)\n }\n this.host = diff(\n null,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n ),\n {},\n false,\n null,\n false\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 disconnectedCallback() {\n this.uninstall()\n if (this.store) {\n for (let 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 update() {\n this.beforeUpdate()\n this.beforeRender()\n diff(\n this.host,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n )\n )\n this.afterUpdate()\n }\n\n fire(name, data) {\n this.dispatchEvent(new CustomEvent(name, { detail: data }))\n }\n\n install() {}\n\n installed() {}\n\n uninstall() {}\n\n beforeUpdate() {}\n\n afterUpdate() {}\n\n beforeRender() {}\n}\n","import { diff } from './vdom/diff'\nimport JSONProxy from './proxy'\n\nexport function render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n if (store) {\n store.instances = []\n extendStoreUpate(store)\n let timeout = null\n let patchs = {}\n store.data = new JSONProxy(store.data).observe(false, function(patch) {\n clearTimeout(timeout)\n if (patch.op === 'remove') {\n // fix arr splice\n const kv = getArrayPatch(patch.path, store)\n patchs[kv.k] = kv.v\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n } else {\n const key = fixPath(patch.path)\n patchs[key] = patch.value\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n }\n })\n parent.store = store\n }\n 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 const updateAll = matchGlobalData(this.globalData, patch)\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(instance => {\n if (\n updateAll ||\n this.updateAll ||\n (instance.constructor.updatePath &&\n needUpdate(patch, instance.constructor.updatePath))\n ) {\n instance.update()\n }\n })\n this.onChange && this.onChange(patch)\n }\n }\n}\n\nexport function matchGlobalData(globalData, diffResult) {\n if (!globalData) return false\n for (let keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true\n }\n for (let 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\nexport function needUpdate(diffResult, updatePath) {\n for (let keyA in diffResult) {\n if (updatePath[keyA]) {\n return true\n }\n for (let 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 const next = pathA.substr(pathB.length, 1)\n if (next === '[' || next === '.') {\n return true\n }\n }\n return false\n}\n\nexport function fixPath(path) {\n let mpPath = ''\n const arr = path.replace('/', '').split('/')\n arr.forEach((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 const arr = path.replace('/', '').split('/')\n let current = store.data[arr[0]]\n for (let 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 let mpPath = ''\n const arr = path.replace('/', '').split('/')\n const len = arr.length\n arr.forEach((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","import WeElement from './we-element'\nimport { cssToDom } from './util'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n if (ctor.is === 'WeElement') {\n customElements.define(name, ctor)\n if (ctor.data && !ctor.pure) {\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n } else {\n class Element extends WeElement {\n _useId = 0\n\n _useMap = {}\n\n render(props, data) {\n return ctor.call(this, props, data)\n }\n\n beforeRender() {\n this._useId = 0\n }\n\n useCss(css) {\n const style = this.shadowRoot.querySelector('style')\n style && this.shadowRoot.removeChild(style)\n this.shadowRoot.appendChild(cssToDom(css))\n }\n\n useData(data) {\n return this.use({ data: data })\n }\n\n use(option) {\n this._useId++\n const updater = newValue => {\n const item = this._useMap[updater.id]\n\n item.data = newValue\n\n this.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 installed() {\n this._isInstalled = true\n }\n }\n customElements.define(name, Element)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import { extend } from './util'\nimport { h } from './h'\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 */\nexport function cloneElement(vnode, props) {\n return h(\n vnode.nodeName,\n extend(extend({}, vnode.attributes), props),\n arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children\n )\n}\n","function getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n return (\n self ||\n window ||\n global ||\n (function() {\n return this\n })()\n )\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n store: null,\n root: getGlobal()\n}\n","export function getHost(ele) {\n let p = ele.parentNode\n while (p) {\n if (p.host) {\n return p.host\n } else {\n p = p.parentNode\n }\n }\n}\n","import { h, h as createElement } from './h'\nimport options from './options'\nimport WeElement from './we-element'\nimport { render } from './render'\nimport { define } from './define'\nimport { tag } from './tag'\nimport { observe } from './observe'\nimport { cloneElement } from './clone-element'\nimport { getHost } from './get-host'\n\nconst Component = WeElement\n\nconst omi = {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n\noptions.root.Omi = omi\noptions.root.Omi.version = '4.0.19'\n\nexport default omi\n\nexport {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../src/vnode.js","../src/h.js","../src/util.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/proxy.js","../src/observe.js","../src/we-element.js","../src/render.js","../src/define.js","../src/clone-element.js","../src/options.js","../src/get-host.js","../src/omi.js"],"names":["VNode","h","nodeName","attributes","lastSimple","child","simple","i","children","EMPTY_CHILDREN","arguments","length","stack","push","pop","undefined","String","p","key","options","vnode","cssToDom","css","node","document","createElement","textContent","npn","str","replace","$","$1","toUpperCase","extend","obj","props","applyRef","ref","value","current","isArray","Object","prototype","toString","call","nProps","result","keys","forEach","isSameNodeType","hydrating","_componentConstructor","createNode","removeNode","name","isSvg","className","old","style","cssText","IS_NON_DIMENSIONAL","test","useCapture","substring","addEventListener","eventProxy","_listeners","e","removeAttribute","ns","removeAttributeNS","toLowerCase","setAttribute","isSvgMode","parent","ownerSVGElement","dom","ret","parentNode","item","index","context","mountAll","componentRoot","idiff","appendChild","out","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","vchildren","firstChild","fc","a","splitText","nextSibling","constructor","is","noSlot","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","min","len","childrenLen","vlen","j","keyedLen","originalChildren","keyed","vchild","_child","_component","__key","trim","isHydrating","c","f","unmountOnly","removeChildren","update","attrs","isWeElement","setAccessor","observe","target","JSONPatcherProxy","preValue","ele","prePath","preEle","data","info","path","clearTimeout","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","HTMLElement","WeElement","extendStoreUpate","store","instances","patch","timeout","getArrayPatch","JSONProxy","v","setTimeout","patchs","diff","_this","this","updateAll","globalData","matchGlobalData","updatePath","needUpdate","onChange","diffResult","keyA","indexOf","keyB","includePath","pathA","pathB","next","substr","fixPath","mpPath","arr","split","Number","fixArrPath","_classCallCheck$1","_possibleConstructorReturn$1","OBJECTTYPE","getUpdatePath","ctor","Element","_WeElement","_len","args","Array","render","beforeRender","_useId","useCss","shadowRoot","querySelector","use","_this2","updater","newValue","_useMap","id","effect","installed","_isInstalled","customElements","define","dataToPath","type","_objToPath","_arrayToPath","ARRAYTYPE","cloneElement","root","global","Math","window","Reflect","hasOwnProperty","BuiltInHTMLElement","construct","setPrototypeOf","Promise","resolve","then","bind","diffLevel","deepClone","JSON","escapePathComponent","pathComponents","parentAndPath","parenthoodMap","get","parentPath","newValueOriginalObject","revokableInstance","inherited","proxifiedObjectsMap","has","set","operation","destinationPropKey","op","oldValue","delete","disableTrapsForProxy","console","warn","reflectionResult","defaultCallback","revokableProxyInstance","resume","patches","userCallback","pause","isObserving","showDetachedWarning","cachedProxy","receiver","deleteProperty","deleteTrap","Proxy","revocable","revocableInstance","trapsInstance","traps","originalObject","_proxifyObjectTreeRecursively","proxifyObjectTree","isProxifyingTreeNow","proxifiedObject","targetObject","message","propKey","record","callback","generate","isRecording","revoke","el","disableTraps","assign","defaultProps","connectedCallback","pure","host","install","mode","attachShadow","removeChild","afterInstall","proxyUpdate","disconnectedCallback","uninstall","splice","beforeUpdate","fire","afterUpdate","CustomEvent","detail","Component","tag","omi","version","module","exports","Omi"],"mappings":";;IACO,SAASA;ICKT,SAASC,EAAEC,UAAUC;QAC1B,IACEC,YACAC,OACAC,QACAC,GAJEC,WAAWC;QAKf,KAAKF,IAAIG,UAAUC,QAAQJ,MAAM,KAC/BK,MAAMC,KAAKH,UAAUH;QAEvB,IAAIJ,cAAqC,QAAvBA,WAAWK,UAAkB;YAC7C,KAAKI,MAAMD,QAAQC,MAAMC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AAAA,sBAAAA,QAVU6F,OAAAC,UAAAH,UAAAjK,KAAAqK,MAAAJ","file":"omi.js","sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","import { VNode } from './vnode'\nimport options from './options'\n\nconst stack = []\nconst EMPTY_CHILDREN = []\n\nexport function h(nodeName, attributes) {\n let children = EMPTY_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--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children === EMPTY_CHILDREN) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let 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 * @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\n/**\n * This shim allows elements written in, or compiled to, ES5 to work on native\n * implementations of Custom Elements v1. It sets new.target to the value of\n * this.constructor so that the native HTMLElement constructor can access the\n * current under-construction element's definition.\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 ||\n 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 ) {\n return\n }\n const 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\nexport function cssToDom(css) {\n const node = document.createElement('style')\n node.textContent = css\n return node\n}\n\nexport function npn(str) {\n return str.replace(/-(\\w)/g, ($, $1) => {\n return $1.toUpperCase()\n })\n}\n\nexport function extend(obj, props) {\n for (let i in props) 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 */\nexport function applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value)\n 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 */\nexport const defer =\n typeof Promise == 'function'\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n","import { extend } from '../util'\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 */\nexport function 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 }\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 */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n /** @type {PreactElement} */\n let node = isSvg\n ? document.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : 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 */\nexport function removeNode(node) {\n let 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 {PreactElement} 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 */\nexport function 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 (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : 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 let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) node.addEventListener(name, eventProxy, useCapture)\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\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')\n node.removeAttribute(name)\n } else {\n let 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)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value === 'string') {\n if (ns) {\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n } else {\n 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","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { createNode, setAccessor } from '../dom/index'\nimport { npn, isArray } from '../util'\nimport { removeNode } from '../dom/index'\n\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet 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 */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n let 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 && !(ATTR_KEY in dom)\n }\n if (isArray(vnode)) {\n ret = []\n let parentNode = null\n if (isArray(dom)) {\n parentNode = dom[0].parentNode\n dom.forEach(function(item, index) {\n ret.push(idiff(item, vnode[index], context, mountAll, componentRoot))\n })\n } else {\n vnode.forEach(function(item) {\n ret.push(idiff(dom, item, context, mountAll, componentRoot))\n })\n }\n if (parent) {\n ret.forEach(function(vnode) {\n parent.appendChild(vnode)\n })\n } else if (isArray(dom)) {\n dom.forEach(function(node) {\n parentNode.appendChild(node)\n })\n }\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot)\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 && dom.props) {\n dom.props.children = vnode.children\n }\n let 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 (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\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[ATTR_KEY] = true\n\n return out\n }\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : 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) out.appendChild(dom.firstChild)\n\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 let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\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(\n out,\n vchildren,\n context,\n mountAll,\n hydrating || props.dangerouslySetInnerHTML != null\n )\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 let 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 (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let 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 (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\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 (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n 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 */\nexport function 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[ATTR_KEY] != null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null)\n\n if (unmountOnly === false || node[ATTR_KEY] == 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 */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let 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 let name\n let update = false\n let isWeElement = dom.update\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 //diable when using store system?\n //!dom.store &&\n if (isWeElement && typeof attrs[name] === 'object') {\n dom.props[npn(name)] = attrs[name]\n update = true\n } else if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\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 dom.parentNode && update && isWeElement && dom.update()\n}\n","/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst 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 const pathComponents = []\n let 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 const 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 const parentPath = findObjectPath(instance, target)\n\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n const 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\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 const revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n\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\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 (\n newValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n ) {\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 const 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)) {\n // undefined array elements are JSON.stringified to `null`\n ;(operation.op = 'replace'), (operation.value = null)\n }\n const 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(\n 'JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch'\n )\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 const 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 const parentPath = findObjectPath(instance, target)\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n const revokableProxyInstance = instance.proxifiedObjectsMap.get(\n target[key]\n )\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\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 const 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 this.defaultCallback = 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 = () => {}\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 if (!obj) {\n return obj\n }\n const traps = {\n set: (target, key, value, receiver) =>\n setTrap(this, target, key, value, receiver),\n deleteProperty: (target, key) => deleteTrap(this, target, key)\n }\n const 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, 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(\n parent,\n root,\n path\n ) {\n for (let key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(\n root,\n root[key],\n escapePathComponent(key)\n )\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 const proxifiedObject = this._proxifyObjectTreeRecursively(\n undefined,\n root,\n ''\n )\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(\n revokableProxyInstance\n ) {\n if (this.showDetachedWarning) {\n const message =\n \"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 = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.set = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.deleteProperty = (\n targetObject,\n propKey\n ) => {\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(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\nexport default JSONPatcherProxy\n","import JSONProxy from './proxy'\n\nexport function observe(target) {\n target.observe = true\n}\n\nlet preValue = null\nlet prePath = null\nlet preEle = null\n\nexport function proxyUpdate(ele) {\n let timeout = null\n ele.data = new JSONProxy(ele.data).observe(false, info => {\n if (preValue === info.value && prePath === info.path && preEle === ele) {\n return\n }\n\n preValue = info.value\n prePath = info.path\n preEle = ele\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n }, 16.6)\n })\n}\n","import { cssToDom, nProps, isArray } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\nimport { proxyUpdate } from './observe'\n\nexport default class WeElement extends HTMLElement {\n static is = 'WeElement'\n\n constructor() {\n super()\n this.props = Object.assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps\n )\n this.data = this.constructor.data || {}\n }\n\n connectedCallback() {\n if (!this.constructor.pure) {\n let 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\n this.install()\n let shadowRoot\n if (!this.shadowRoot) {\n shadowRoot = this.attachShadow({\n mode: 'open'\n })\n } else {\n shadowRoot = this.shadowRoot\n let fc\n while ((fc = shadowRoot.firstChild)) {\n shadowRoot.removeChild(fc)\n }\n }\n\n this.css && shadowRoot.appendChild(cssToDom(this.css()))\n this.beforeRender()\n options.afterInstall && options.afterInstall(this)\n if (this.constructor.observe) {\n proxyUpdate(this)\n }\n this.host = diff(\n null,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n ),\n {},\n false,\n null,\n false\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 disconnectedCallback() {\n this.uninstall()\n if (this.store) {\n for (let 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 update() {\n this.beforeUpdate()\n this.beforeRender()\n diff(\n this.host,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n )\n )\n this.afterUpdate()\n }\n\n fire(name, data) {\n this.dispatchEvent(new CustomEvent(name, { detail: data }))\n }\n\n install() {}\n\n installed() {}\n\n uninstall() {}\n\n beforeUpdate() {}\n\n afterUpdate() {}\n\n beforeRender() {}\n}\n","import { diff } from './vdom/diff'\nimport JSONProxy from './proxy'\n\nexport function render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n if (store) {\n store.instances = []\n extendStoreUpate(store)\n let timeout = null\n let patchs = {}\n store.data = new JSONProxy(store.data).observe(false, function(patch) {\n clearTimeout(timeout)\n if (patch.op === 'remove') {\n // fix arr splice\n const kv = getArrayPatch(patch.path, store)\n patchs[kv.k] = kv.v\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n } else {\n const key = fixPath(patch.path)\n patchs[key] = patch.value\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n }\n })\n parent.store = store\n }\n 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 const updateAll = matchGlobalData(this.globalData, patch)\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(instance => {\n if (\n updateAll ||\n this.updateAll ||\n (instance.constructor.updatePath &&\n needUpdate(patch, instance.constructor.updatePath))\n ) {\n instance.update()\n }\n })\n this.onChange && this.onChange(patch)\n }\n }\n}\n\nexport function matchGlobalData(globalData, diffResult) {\n if (!globalData) return false\n for (let keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true\n }\n for (let 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\nexport function needUpdate(diffResult, updatePath) {\n for (let keyA in diffResult) {\n if (updatePath[keyA]) {\n return true\n }\n for (let 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 const next = pathA.substr(pathB.length, 1)\n if (next === '[' || next === '.') {\n return true\n }\n }\n return false\n}\n\nexport function fixPath(path) {\n let mpPath = ''\n const arr = path.replace('/', '').split('/')\n arr.forEach((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 const arr = path.replace('/', '').split('/')\n let current = store.data[arr[0]]\n for (let 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 let mpPath = ''\n const arr = path.replace('/', '').split('/')\n const len = arr.length\n arr.forEach((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","import WeElement from './we-element'\nimport { cssToDom } from './util'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n if (ctor.is === 'WeElement') {\n customElements.define(name, ctor)\n if (ctor.data && !ctor.pure) {\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n } else {\n class Element extends WeElement {\n _useId = 0\n\n _useMap = {}\n\n render(props, data) {\n return ctor.call(this, props, data)\n }\n\n beforeRender() {\n this._useId = 0\n }\n\n useCss(css) {\n const style = this.shadowRoot.querySelector('style')\n style && this.shadowRoot.removeChild(style)\n this.shadowRoot.appendChild(cssToDom(css))\n }\n\n useData(data) {\n return this.use({ data: data })\n }\n\n use(option) {\n this._useId++\n const updater = newValue => {\n const item = this._useMap[updater.id]\n\n item.data = newValue\n\n this.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 installed() {\n this._isInstalled = true\n }\n }\n customElements.define(name, Element)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import { extend } from './util'\nimport { h } from './h'\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 */\nexport function cloneElement(vnode, props) {\n return h(\n vnode.nodeName,\n extend(extend({}, vnode.attributes), props),\n arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children\n )\n}\n","function getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n return (\n self ||\n window ||\n global ||\n (function() {\n return this\n })()\n )\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n store: null,\n root: getGlobal()\n}\n","export function getHost(ele) {\n let p = ele.parentNode\n while (p) {\n if (p.host) {\n return p.host\n } else {\n p = p.parentNode\n }\n }\n}\n","import { h, h as createElement } from './h'\nimport options from './options'\nimport WeElement from './we-element'\nimport { render } from './render'\nimport { define } from './define'\nimport { tag } from './tag'\nimport { observe } from './observe'\nimport { cloneElement } from './clone-element'\nimport { getHost } from './get-host'\n\nconst Component = WeElement\n\nconst omi = {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n\noptions.root.Omi = omi\noptions.root.Omi.version = '4.0.20'\n\nexport default omi\n\nexport {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n"]} \ No newline at end of file diff --git a/packages/omi/dist/omi.min.js b/packages/omi/dist/omi.min.js index c70186d3a..ca35b3aef 100644 --- a/packages/omi/dist/omi.min.js +++ b/packages/omi/dist/omi.min.js @@ -1,2 +1,2 @@ -!function(){"use strict";function e(){}function t(t,n){var r,o,i,a,s=$;for(a=arguments.length;a-- >2;)q.push(arguments[a]);n&&null!=n.children&&(q.length||q.push(n.children),delete n.children);while(q.length)if((o=q.pop())&&void 0!==o.pop)for(a=o.length;a--;)q.push(o[a]);else"boolean"==typeof o&&(o=null),(i="function"!=typeof t)&&(null==o?o="":"number"==typeof o?o+="":"string"!=typeof o&&(i=!1)),i&&r?s[s.length-1]+=o:s===$?s=[o]:s.push(o),r=i;var l=new e;return l.nodeName=t,l.children=s,l.attributes=null==n?void 0:n,l.key=null==n?void 0:n.key,void 0!==Y.vnode&&Y.vnode(l),l}function n(e){var t=document.createElement("style");return t.textContent=e,t}function r(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function o(e,t){for(var n in t)e[n]=t[n];return e}function i(e,t){null!=e&&("function"==typeof e?e(t):e.current=t)}function a(e){return"[object Array]"===Object.prototype.toString.call(e)}function s(e){if(!e||a(e))return{};var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t}function l(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&c(e,t.nodeName):n||e._componentConstructor===t.nodeName}function c(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function u(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function p(e){var t=e.parentNode;t&&t.removeChild(e)}function f(e,t,n,r,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)i(n,null),i(r,e);else if("class"!==t||o)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var a in n)a in r||(e.style[a]="");for(var a in r)e.style[a]="number"==typeof r[a]&&!1===z.test(a)?r[a]+"px":r[a]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,h,s):e.removeEventListener(t,h,s),(e.__l||(e.__l={}))[t]=r}else if("list"!==t&&"type"!==t&&!o&&t in e){try{e[t]=null==r?"":r}catch(e){}null!=r&&!1!==r||"spellcheck"==t||e.removeAttribute(t)}else{var l=o&&t!==(t=t.replace(/^xlink:?/,""));null==r||!1===r?l?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"string"==typeof r&&(l?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function h(e){return this.__l[e.type](Y.event&&Y.event(e)||e)}function d(e,t,n,r,o,i){var s;if(G++||(K=null!=o&&void 0!==o.ownerSVGElement,Q=null!=e&&!("__preactattr_"in e)),a(t)){s=[];var l=null;a(e)?(l=e[0].parentNode,e.forEach(function(e,o){s.push(y(e,t[o],n,r,i))})):t.forEach(function(t){s.push(y(e,t,n,r,i))}),o?s.forEach(function(e){o.appendChild(e)}):a(e)&&e.forEach(function(e){l.appendChild(e)})}else s=y(e,t,n,r,i),o&&s.parentNode!==o&&o.appendChild(s);return--G||(Q=!1),s}function y(e,t,n,r,o){e&&e.props&&(e.props.children=t.children);var i=e,a=K;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),b(e,!0))),i.t=!0,i;var s=t.nodeName;if(K="svg"===s||"foreignObject"!==s&&K,s+="",(!e||!c(e,s))&&(i=u(s,K),e)){while(e.firstChild)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),b(e,!0)}var l=i.firstChild,p=i.t,f=t.children;if(null==p){p=i.t={};for(var h=i.attributes,d=h.length;d--;)p[h[d].name]=h[d].value}return!Q&&f&&1===f.length&&"string"==typeof f[0]&&null!=l&&void 0!==l.splitText&&null==l.nextSibling?l.nodeValue!=f[0]&&(l.nodeValue=f[0]):(f&&f.length||null!=l)&&v(i,f,n,r,Q||null!=p.dangerouslySetInnerHTML),m(i,t.attributes,p),i.props&&(i.props.children=t.children),K=a,i}function v(e,t,n,r,o){var i,a,s,c,u,f=e.childNodes,h=[],d={},v=0,g=0,m=f.length,w=0,O=t?t.length:0;if(0!==m)for(var j=0;j0&&(this.instances.forEach(function(r){(n||t.updateAll||r.constructor.updatePath&&M(e,r.constructor.updatePath))&&r.update()}),this.onChange&&this.onChange(e))}}function T(e,t){if(!e)return!1;for(var n in t){if(e.indexOf(n)>-1)return!0;for(var r=0,o=e.length;r2?[].slice.call(arguments,2):e.children)}function J(e){var t=e.parentNode;while(t){if(t.host)return t.host;t=t.parentNode}}var Y={store:null,root:function(){return"object"==typeof global&&global&&global.Math===Math&&global.Array===Array?global:self||window||global||function(){return this}()}()},q=[],$=[];!function(){if(void 0!==window.Reflect&&void 0!==window.customElements&&!window.customElements.hasOwnProperty("polyfillWrapFlushCallback")){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}}(),"function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;var z=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,G=0,K=!1,Q=!1,X=function(){function e(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function t(e){return-1==e.indexOf("/")&&-1==e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function n(e,t){var n=[],r=e.parenthoodMap.get(t);while(r&&r.path)n.unshift(r.path),r=e.parenthoodMap.get(r.parent);if(n.length){return"/"+n.join("/")}return""}function r(e,r,o,i){var a=n(e,r),s=a+"/"+t(o);if(e.proxifiedObjectsMap.has(i)){e.parenthoodMap.set(e.proxifiedObjectsMap.get(i).originalObject,{parent:r,path:o})}var l=e.proxifiedObjectsMap.get(i);l&&!e.isProxifyingTreeNow&&(l.inherited=!0),i&&"object"==typeof i&&!e.proxifiedObjectsMap.has(i)&&(e.parenthoodMap.set(i,{parent:r,path:o}),i=e.A(r,i,o));var c={op:"remove",path:s};if(void 0===i){if(!Array.isArray(r)&&!r.hasOwnProperty(o))return Reflect.set(r,o,i);Array.isArray(r)&&(c.op="replace",c.value=null);var u=e.proxifiedObjectsMap.get(r[o]);u&&(e.parenthoodMap.delete(r[o]),e.disableTrapsForProxy(u),e.proxifiedObjectsMap.delete(u))}else{if(Array.isArray(r)&&!Number.isInteger(+(""+o)))return"length"!=o&&console.warn("JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch"),Reflect.set(r,o,i);c.op="add",r.hasOwnProperty(o)&&(void 0!==r[o]||Array.isArray(r))&&(c.op="replace"),c.value=i}var p=Reflect.set(r,o,i);return e.defaultCallback(c),p}function o(e,r,o){if(void 0!==r[o]){var i=n(e,r),a=i+"/"+t(o),s=e.proxifiedObjectsMap.get(r[o]);s&&(s.inherited?s.inherited=!1:(e.parenthoodMap.delete(s.originalObject),e.disableTrapsForProxy(s),e.proxifiedObjectsMap.delete(r[o])));var l=Reflect.deleteProperty(r,o);return e.defaultCallback({op:"remove",path:a}),l}}function i(){var e=this;this.defaultCallback=function(t){e.isRecording&&e.patches.push(t),e.userCallback&&e.userCallback(t)},this.isObserving=!0}function a(){this.defaultCallback=function(){},this.isObserving=!1}function s(e,t){this.isProxifyingTreeNow=!1,this.isObserving=!1,this.proxifiedObjectsMap=new Map,this.parenthoodMap=new Map,"boolean"!=typeof t&&(t=!0),this.showDetachedWarning=t,this.originalObject=e,this.cachedProxy=null,this.isRecording=!1,this.resume=i.bind(this),this.pause=a.bind(this)}return s.deepClone=e,s.escapePathComponent=t,s.prototype.generateProxyAtPath=function(e,t,n){var i=this;if(!t)return t;var a={set:function(e,t,n){return r(i,e,t,n)},deleteProperty:function(e,t){return o(i,e,t)}},s=Proxy.revocable(t,a);return s.trapsInstance=a,s.originalObject=t,this.parenthoodMap.set(t,{parent:e,path:n}),this.proxifiedObjectsMap.set(s.proxy,s),s.proxy},s.prototype.A=function(e,n,r){for(var o in n)n.hasOwnProperty(o)&&n[o]instanceof Object&&(n[o]=this.A(n,n[o],t(o)));return this.generateProxyAtPath(e,n,r)},s.prototype.proxifyObjectTree=function(e){this.pause(),this.isProxifyingTreeNow=!0;var t=this.A(void 0,e,"");return this.isProxifyingTreeNow=!1,this.resume(),t},s.prototype.disableTrapsForProxy=function(e){if(this.showDetachedWarning){var t="You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects";e.trapsInstance.set=function(e,n,r){return console.warn(t),Reflect.set(e,n,r)},e.trapsInstance.set=function(e,n,r){return console.warn(t),Reflect.set(e,n,r)},e.trapsInstance.deleteProperty=function(e,t){return Reflect.deleteProperty(e,t)}}else delete e.trapsInstance.set,delete e.trapsInstance.get,delete e.trapsInstance.deleteProperty},s.prototype.observe=function(e,t){if(!e&&!t)throw Error("You need to either record changes or pass a callback");return this.isRecording=e,this.userCallback=t,e&&(this.patches=[]),this.cachedProxy=this.proxifyObjectTree(this.originalObject)},s.prototype.generate=function(){if(!this.isRecording)throw Error("You should set record to true to get patches later");return this.patches.splice(0,this.patches.length)},s.prototype.revoke=function(){this.proxifiedObjectsMap.forEach(function(e){e.revoke()})},s.prototype.disableTraps=function(){this.proxifiedObjectsMap.forEach(this.disableTrapsForProxy,this)},s}(),Z=null,ee=null,te=null,ne=function(e){function t(){j(this,t);var n=x(this,e.call(this));return n.props=Object.assign(s(n.constructor.props),n.constructor.defaultProps),n.data=n.constructor.data||{},n}return C(t,e),t.prototype.connectedCallback=function(){if(!this.constructor.pure){var e=this.parentNode;while(e&&!this.store)this.store=e.store,e=e.parentNode||e.host;this.store&&this.store.instances.push(this)}this.install();var t=this.attachShadow({mode:"open"});this.css&&t.appendChild(n(this.css())),this.beforeRender(),Y.afterInstall&&Y.afterInstall(this),this.constructor.observe&&O(this),this.host=d(null,this.render(this.props,!this.constructor.pure&&this.store?this.store.data:this.data),{},!1,null,!1),a(this.host)?this.host.forEach(function(e){t.appendChild(e)}):t.appendChild(this.host),this.installed(),this.B=!0},t.prototype.disconnectedCallback=function(){if(this.uninstall(),this.store)for(var e=0,t=this.store.instances.length;e2;)q.push(arguments[a]);n&&null!=n.children&&(q.length||q.push(n.children),delete n.children);while(q.length)if((o=q.pop())&&void 0!==o.pop)for(a=o.length;a--;)q.push(o[a]);else"boolean"==typeof o&&(o=null),(i="function"!=typeof t)&&(null==o?o="":"number"==typeof o?o+="":"string"!=typeof o&&(i=!1)),i&&r?s[s.length-1]+=o:s===$?s=[o]:s.push(o),r=i;var l=new e;return l.nodeName=t,l.children=s,l.attributes=null==n?void 0:n,l.key=null==n?void 0:n.key,void 0!==Y.vnode&&Y.vnode(l),l}function n(e){var t=document.createElement("style");return t.textContent=e,t}function r(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function o(e,t){for(var n in t)e[n]=t[n];return e}function i(e,t){null!=e&&("function"==typeof e?e(t):e.current=t)}function a(e){return"[object Array]"===Object.prototype.toString.call(e)}function s(e){if(!e||a(e))return{};var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t}function l(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&c(e,t.nodeName):n||e._componentConstructor===t.nodeName}function c(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function u(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function p(e){var t=e.parentNode;t&&t.removeChild(e)}function f(e,t,n,r,o){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)i(n,null),i(r,e);else if("class"!==t||o)if("style"===t){if(r&&"string"!=typeof r&&"string"!=typeof n||(e.style.cssText=r||""),r&&"object"==typeof r){if("string"!=typeof n)for(var a in n)a in r||(e.style[a]="");for(var a in r)e.style[a]="number"==typeof r[a]&&!1===z.test(a)?r[a]+"px":r[a]}}else if("dangerouslySetInnerHTML"===t)r&&(e.innerHTML=r.__html||"");else if("o"==t[0]&&"n"==t[1]){var s=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),r?n||e.addEventListener(t,h,s):e.removeEventListener(t,h,s),(e.__l||(e.__l={}))[t]=r}else if("list"!==t&&"type"!==t&&!o&&t in e){try{e[t]=null==r?"":r}catch(e){}null!=r&&!1!==r||"spellcheck"==t||e.removeAttribute(t)}else{var l=o&&t!==(t=t.replace(/^xlink:?/,""));null==r||!1===r?l?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"string"==typeof r&&(l?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),r):e.setAttribute(t,r))}else e.className=r||""}function h(e){return this.__l[e.type](Y.event&&Y.event(e)||e)}function d(e,t,n,r,o,i){var s;if(G++||(K=null!=o&&void 0!==o.ownerSVGElement,Q=null!=e&&!("__preactattr_"in e)),a(t)){s=[];var l=null;a(e)?(l=e[0].parentNode,e.forEach(function(e,o){s.push(y(e,t[o],n,r,i))})):t.forEach(function(t){s.push(y(e,t,n,r,i))}),o?s.forEach(function(e){o.appendChild(e)}):a(e)&&e.forEach(function(e){l.appendChild(e)})}else s=y(e,t,n,r,i),o&&s.parentNode!==o&&o.appendChild(s);return--G||(Q=!1),s}function y(e,t,n,r,o){e&&e.props&&(e.props.children=t.children);var i=e,a=K;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||o)?e.nodeValue!=t&&(e.nodeValue=t):(i=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(i,e),b(e,!0))),i.t=!0,i;var s=t.nodeName;if(K="svg"===s||"foreignObject"!==s&&K,s+="",(!e||!c(e,s))&&(i=u(s,K),e)){while(e.firstChild)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),b(e,!0)}var l=i.firstChild,p=i.t,f=t.children;if(null==p){p=i.t={};for(var h=i.attributes,d=h.length;d--;)p[h[d].name]=h[d].value}return!Q&&f&&1===f.length&&"string"==typeof f[0]&&null!=l&&void 0!==l.splitText&&null==l.nextSibling?l.nodeValue!=f[0]&&(l.nodeValue=f[0]):(f&&f.length||null!=l)&&("WeElement"==i.constructor.is&&i.constructor.noSlot||v(i,f,n,r,Q||null!=p.dangerouslySetInnerHTML)),m(i,t.attributes,p),i.props&&(i.props.children=t.children),K=a,i}function v(e,t,n,r,o){var i,a,s,c,u,f=e.childNodes,h=[],d={},v=0,g=0,m=f.length,w=0,O=t?t.length:0;if(0!==m)for(var j=0;j0&&(this.instances.forEach(function(r){(n||t.updateAll||r.constructor.updatePath&&M(e,r.constructor.updatePath))&&r.update()}),this.onChange&&this.onChange(e))}}function T(e,t){if(!e)return!1;for(var n in t){if(e.indexOf(n)>-1)return!0;for(var r=0,o=e.length;r2?[].slice.call(arguments,2):e.children)}function J(e){var t=e.parentNode;while(t){if(t.host)return t.host;t=t.parentNode}}var Y={store:null,root:function(){return"object"==typeof global&&global&&global.Math===Math&&global.Array===Array?global:self||window||global||function(){return this}()}()},q=[],$=[];!function(){if(void 0!==window.Reflect&&void 0!==window.customElements&&!window.customElements.hasOwnProperty("polyfillWrapFlushCallback")){var e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e)}}(),"function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout;var z=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,G=0,K=!1,Q=!1,X=function(){function e(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function t(e){return-1==e.indexOf("/")&&-1==e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function n(e,t){var n=[],r=e.parenthoodMap.get(t);while(r&&r.path)n.unshift(r.path),r=e.parenthoodMap.get(r.parent);if(n.length){return"/"+n.join("/")}return""}function r(e,r,o,i){var a=n(e,r),s=a+"/"+t(o);if(e.proxifiedObjectsMap.has(i)){e.parenthoodMap.set(e.proxifiedObjectsMap.get(i).originalObject,{parent:r,path:o})}var l=e.proxifiedObjectsMap.get(i);l&&!e.isProxifyingTreeNow&&(l.inherited=!0),i&&"object"==typeof i&&!e.proxifiedObjectsMap.has(i)&&(e.parenthoodMap.set(i,{parent:r,path:o}),i=e.A(r,i,o));var c={op:"remove",path:s};if(void 0===i){if(!Array.isArray(r)&&!r.hasOwnProperty(o))return Reflect.set(r,o,i);Array.isArray(r)&&(c.op="replace",c.value=null);var u=e.proxifiedObjectsMap.get(r[o]);u&&(e.parenthoodMap.delete(r[o]),e.disableTrapsForProxy(u),e.proxifiedObjectsMap.delete(u))}else{if(Array.isArray(r)&&!Number.isInteger(+(""+o)))return"length"!=o&&console.warn("JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch"),Reflect.set(r,o,i);c.op="add",r.hasOwnProperty(o)&&(void 0!==r[o]||Array.isArray(r))&&(c.op="replace"),c.value=i}var p=Reflect.set(r,o,i);return e.defaultCallback(c),p}function o(e,r,o){if(void 0!==r[o]){var i=n(e,r),a=i+"/"+t(o),s=e.proxifiedObjectsMap.get(r[o]);s&&(s.inherited?s.inherited=!1:(e.parenthoodMap.delete(s.originalObject),e.disableTrapsForProxy(s),e.proxifiedObjectsMap.delete(r[o])));var l=Reflect.deleteProperty(r,o);return e.defaultCallback({op:"remove",path:a}),l}}function i(){var e=this;this.defaultCallback=function(t){e.isRecording&&e.patches.push(t),e.userCallback&&e.userCallback(t)},this.isObserving=!0}function a(){this.defaultCallback=function(){},this.isObserving=!1}function s(e,t){this.isProxifyingTreeNow=!1,this.isObserving=!1,this.proxifiedObjectsMap=new Map,this.parenthoodMap=new Map,"boolean"!=typeof t&&(t=!0),this.showDetachedWarning=t,this.originalObject=e,this.cachedProxy=null,this.isRecording=!1,this.resume=i.bind(this),this.pause=a.bind(this)}return s.deepClone=e,s.escapePathComponent=t,s.prototype.generateProxyAtPath=function(e,t,n){var i=this;if(!t)return t;var a={set:function(e,t,n){return r(i,e,t,n)},deleteProperty:function(e,t){return o(i,e,t)}},s=Proxy.revocable(t,a);return s.trapsInstance=a,s.originalObject=t,this.parenthoodMap.set(t,{parent:e,path:n}),this.proxifiedObjectsMap.set(s.proxy,s),s.proxy},s.prototype.A=function(e,n,r){for(var o in n)n.hasOwnProperty(o)&&n[o]instanceof Object&&(n[o]=this.A(n,n[o],t(o)));return this.generateProxyAtPath(e,n,r)},s.prototype.proxifyObjectTree=function(e){this.pause(),this.isProxifyingTreeNow=!0;var t=this.A(void 0,e,"");return this.isProxifyingTreeNow=!1,this.resume(),t},s.prototype.disableTrapsForProxy=function(e){if(this.showDetachedWarning){var t="You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects";e.trapsInstance.set=function(e,n,r){return console.warn(t),Reflect.set(e,n,r)},e.trapsInstance.set=function(e,n,r){return console.warn(t),Reflect.set(e,n,r)},e.trapsInstance.deleteProperty=function(e,t){return Reflect.deleteProperty(e,t)}}else delete e.trapsInstance.set,delete e.trapsInstance.get,delete e.trapsInstance.deleteProperty},s.prototype.observe=function(e,t){if(!e&&!t)throw Error("You need to either record changes or pass a callback");return this.isRecording=e,this.userCallback=t,e&&(this.patches=[]),this.cachedProxy=this.proxifyObjectTree(this.originalObject)},s.prototype.generate=function(){if(!this.isRecording)throw Error("You should set record to true to get patches later");return this.patches.splice(0,this.patches.length)},s.prototype.revoke=function(){this.proxifiedObjectsMap.forEach(function(e){e.revoke()})},s.prototype.disableTraps=function(){this.proxifiedObjectsMap.forEach(this.disableTrapsForProxy,this)},s}(),Z=null,ee=null,te=null,ne=function(e){function t(){j(this,t);var n=C(this,e.call(this));return n.props=Object.assign(s(n.constructor.props),n.constructor.defaultProps),n.data=n.constructor.data||{},n}return x(t,e),t.prototype.connectedCallback=function(){if(!this.constructor.pure){var e=this.parentNode;while(e&&!this.store)this.store=e.store,e=e.parentNode||e.host;this.store&&this.store.instances.push(this)}this.install();var t;if(this.shadowRoot){t=this.shadowRoot;var r;while(r=t.firstChild)t.removeChild(r)}else t=this.attachShadow({mode:"open"});this.css&&t.appendChild(n(this.css())),this.beforeRender(),Y.afterInstall&&Y.afterInstall(this),this.constructor.observe&&O(this),this.host=d(null,this.render(this.props,!this.constructor.pure&&this.store?this.store.data:this.data),{},!1,null,!1),a(this.host)?this.host.forEach(function(e){t.appendChild(e)}):t.appendChild(this.host),this.installed(),this.B=!0},t.prototype.disconnectedCallback=function(){if(this.uninstall(),this.store)for(var e=0,t=this.store.instances.length;e 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--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children === EMPTY_CHILDREN) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let 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 * @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\n/**\n * This shim allows elements written in, or compiled to, ES5 to work on native\n * implementations of Custom Elements v1. It sets new.target to the value of\n * this.constructor so that the native HTMLElement constructor can access the\n * current under-construction element's definition.\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 ||\n 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 ) {\n return\n }\n const 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\nexport function cssToDom(css) {\n const node = document.createElement('style')\n node.textContent = css\n return node\n}\n\nexport function npn(str) {\n return str.replace(/-(\\w)/g, ($, $1) => {\n return $1.toUpperCase()\n })\n}\n\nexport function extend(obj, props) {\n for (let i in props) 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 */\nexport function applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value)\n 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 */\nexport const defer =\n typeof Promise == 'function'\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n","import { extend } from '../util'\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 */\nexport function 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 }\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 */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n /** @type {PreactElement} */\n let node = isSvg\n ? document.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : 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 */\nexport function removeNode(node) {\n let 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 {PreactElement} 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 */\nexport function 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 (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : 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 let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) node.addEventListener(name, eventProxy, useCapture)\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\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')\n node.removeAttribute(name)\n } else {\n let 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)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value === 'string') {\n if (ns) {\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n } else {\n 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","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { createNode, setAccessor } from '../dom/index'\nimport { npn, isArray } from '../util'\nimport { removeNode } from '../dom/index'\n\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet 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 */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n let 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 && !(ATTR_KEY in dom)\n }\n if (isArray(vnode)) {\n ret = []\n let parentNode = null\n if (isArray(dom)) {\n parentNode = dom[0].parentNode\n dom.forEach(function(item, index) {\n ret.push(idiff(item, vnode[index], context, mountAll, componentRoot))\n })\n } else {\n vnode.forEach(function(item) {\n ret.push(idiff(dom, item, context, mountAll, componentRoot))\n })\n }\n if (parent) {\n ret.forEach(function(vnode) {\n parent.appendChild(vnode)\n })\n } else if (isArray(dom)) {\n dom.forEach(function(node) {\n parentNode.appendChild(node)\n })\n }\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot)\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 && dom.props) {\n dom.props.children = vnode.children\n }\n let 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 (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\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[ATTR_KEY] = true\n\n return out\n }\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : 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) out.appendChild(dom.firstChild)\n\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 let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\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 innerDiffNode(\n out,\n vchildren,\n context,\n mountAll,\n 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 let 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 (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let 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 (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\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 (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n 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 */\nexport function 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[ATTR_KEY] != null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null)\n\n if (unmountOnly === false || node[ATTR_KEY] == 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 */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let 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 let name\n let update = false\n let isWeElement = dom.update\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 //diable when using store system?\n //!dom.store &&\n if (isWeElement && typeof attrs[name] === 'object') {\n dom.props[npn(name)] = attrs[name]\n update = true\n } else if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\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 dom.parentNode && update && isWeElement && dom.update()\n}\n","/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst 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 const pathComponents = []\n let 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 const 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 const parentPath = findObjectPath(instance, target)\n\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n const 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\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 const revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n\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\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 (\n newValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n ) {\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 const 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)) {\n // undefined array elements are JSON.stringified to `null`\n ;(operation.op = 'replace'), (operation.value = null)\n }\n const 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(\n 'JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch'\n )\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 const 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 const parentPath = findObjectPath(instance, target)\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n const revokableProxyInstance = instance.proxifiedObjectsMap.get(\n target[key]\n )\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\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 const 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 this.defaultCallback = 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 = () => {}\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 if (!obj) {\n return obj\n }\n const traps = {\n set: (target, key, value, receiver) =>\n setTrap(this, target, key, value, receiver),\n deleteProperty: (target, key) => deleteTrap(this, target, key)\n }\n const 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, 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(\n parent,\n root,\n path\n ) {\n for (let key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(\n root,\n root[key],\n escapePathComponent(key)\n )\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 const proxifiedObject = this._proxifyObjectTreeRecursively(\n undefined,\n root,\n ''\n )\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(\n revokableProxyInstance\n ) {\n if (this.showDetachedWarning) {\n const message =\n \"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 = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.set = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.deleteProperty = (\n targetObject,\n propKey\n ) => {\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(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\nexport default JSONPatcherProxy\n","import JSONProxy from './proxy'\n\nexport function observe(target) {\n target.observe = true\n}\n\nlet preValue = null\nlet prePath = null\nlet preEle = null\n\nexport function proxyUpdate(ele) {\n let timeout = null\n ele.data = new JSONProxy(ele.data).observe(false, info => {\n if (preValue === info.value && prePath === info.path && preEle === ele) {\n return\n }\n\n preValue = info.value\n prePath = info.path\n preEle = ele\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n }, 16.6)\n })\n}\n","import { cssToDom, nProps, isArray } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\nimport { proxyUpdate } from './observe'\n\nexport default class WeElement extends HTMLElement {\n static is = 'WeElement'\n\n constructor() {\n super()\n this.props = Object.assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps\n )\n this.data = this.constructor.data || {}\n }\n\n connectedCallback() {\n if (!this.constructor.pure) {\n let 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\n this.install()\n const shadowRoot = this.attachShadow({ mode: 'open' })\n\n this.css && shadowRoot.appendChild(cssToDom(this.css()))\n this.beforeRender()\n options.afterInstall && options.afterInstall(this)\n if (this.constructor.observe) {\n proxyUpdate(this)\n }\n this.host = diff(\n null,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n ),\n {},\n false,\n null,\n false\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 disconnectedCallback() {\n this.uninstall()\n if (this.store) {\n for (let 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 update() {\n this.beforeUpdate()\n this.beforeRender()\n diff(\n this.host,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n )\n )\n this.afterUpdate()\n }\n\n fire(name, data) {\n this.dispatchEvent(new CustomEvent(name, { detail: data }))\n }\n\n install() {}\n\n installed() {}\n\n uninstall() {}\n\n beforeUpdate() {}\n\n afterUpdate() {}\n\n beforeRender() {}\n}\n","import { diff } from './vdom/diff'\nimport JSONProxy from './proxy'\n\nexport function render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n if (store) {\n store.instances = []\n extendStoreUpate(store)\n let timeout = null\n let patchs = {}\n store.data = new JSONProxy(store.data).observe(false, function(patch) {\n clearTimeout(timeout)\n if (patch.op === 'remove') {\n // fix arr splice\n const kv = getArrayPatch(patch.path, store)\n patchs[kv.k] = kv.v\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n } else {\n const key = fixPath(patch.path)\n patchs[key] = patch.value\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n }\n })\n parent.store = store\n }\n 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 const updateAll = matchGlobalData(this.globalData, patch)\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(instance => {\n if (\n updateAll ||\n this.updateAll ||\n (instance.constructor.updatePath &&\n needUpdate(patch, instance.constructor.updatePath))\n ) {\n instance.update()\n }\n })\n this.onChange && this.onChange(patch)\n }\n }\n}\n\nexport function matchGlobalData(globalData, diffResult) {\n if (!globalData) return false\n for (let keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true\n }\n for (let 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\nexport function needUpdate(diffResult, updatePath) {\n for (let keyA in diffResult) {\n if (updatePath[keyA]) {\n return true\n }\n for (let 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 const next = pathA.substr(pathB.length, 1)\n if (next === '[' || next === '.') {\n return true\n }\n }\n return false\n}\n\nexport function fixPath(path) {\n let mpPath = ''\n const arr = path.replace('/', '').split('/')\n arr.forEach((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 const arr = path.replace('/', '').split('/')\n let current = store.data[arr[0]]\n for (let 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 let mpPath = ''\n const arr = path.replace('/', '').split('/')\n const len = arr.length\n arr.forEach((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","import WeElement from './we-element'\nimport { cssToDom } from './util'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n if (ctor.is === 'WeElement') {\n customElements.define(name, ctor)\n if (ctor.data && !ctor.pure) {\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n } else {\n class Element extends WeElement {\n _useId = 0\n\n _useMap = {}\n\n render(props, data) {\n return ctor.call(this, props, data)\n }\n\n beforeRender() {\n this._useId = 0\n }\n\n useCss(css) {\n const style = this.shadowRoot.querySelector('style')\n style && this.shadowRoot.removeChild(style)\n this.shadowRoot.appendChild(cssToDom(css))\n }\n\n useData(data) {\n return this.use({ data: data })\n }\n\n use(option) {\n this._useId++\n const updater = newValue => {\n const item = this._useMap[updater.id]\n\n item.data = newValue\n\n this.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 installed() {\n this._isInstalled = true\n }\n }\n customElements.define(name, Element)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import { extend } from './util'\nimport { h } from './h'\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 */\nexport function cloneElement(vnode, props) {\n return h(\n vnode.nodeName,\n extend(extend({}, vnode.attributes), props),\n arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children\n )\n}\n","function getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n return (\n self ||\n window ||\n global ||\n (function() {\n return this\n })()\n )\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n store: null,\n root: getGlobal()\n}\n","export function getHost(ele) {\n let p = ele.parentNode\n while (p) {\n if (p.host) {\n return p.host\n } else {\n p = p.parentNode\n }\n }\n}\n","import { h, h as createElement } from './h'\nimport options from './options'\nimport WeElement from './we-element'\nimport { render } from './render'\nimport { define } from './define'\nimport { tag } from './tag'\nimport { observe } from './observe'\nimport { cloneElement } from './clone-element'\nimport { getHost } from './get-host'\n\nconst Component = WeElement\n\nconst omi = {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n\noptions.root.Omi = omi\noptions.root.Omi.version = '4.0.19'\n\nexport default omi\n\nexport {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../src/vnode.js","../src/h.js","../src/util.js","../src/vdom/index.js","../src/dom/index.js","../src/vdom/diff.js","../src/proxy.js","../src/observe.js","../src/we-element.js","../src/render.js","../src/define.js","../src/clone-element.js","../src/options.js","../src/get-host.js","../src/omi.js"],"names":["VNode","h","nodeName","attributes","lastSimple","child","simple","i","children","EMPTY_CHILDREN","arguments","length","stack","push","pop","String","p","key","options","vnode","cssToDom","css","node","document","createElement","textContent","npn","str","replace","$","$1","toUpperCase","extend","obj","props","applyRef","ref","value","current","isArray","Object","prototype","toString","call","nProps","result","keys","forEach","isSameNodeType","hydrating","_componentConstructor","createNode","removeNode","name","isSvg","old","style","cssText","IS_NON_DIMENSIONAL","test","useCapture","substring","addEventListener","eventProxy","_listeners","e","removeAttribute","ns","removeAttributeNS","toLowerCase","setAttribute","className","isSvgMode","parent","ownerSVGElement","dom","ret","parentNode","item","index","context","mountAll","componentRoot","idiff","appendChild","out","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","t","vchildren","firstChild","fc","a","splitText","nextSibling","constructor","is","noSlot","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","min","len","childrenLen","vlen","j","keyedLen","originalChildren","keyed","vchild","_child","_component","__key","trim","isHydrating","c","f","unmountOnly","removeChildren","update","attrs","isWeElement","setAccessor","observe","target","JSONPatcherProxy","preValue","ele","prePath","preEle","data","info","path","clearTimeout","_classCallCheck","instance","Constructor","TypeError","_possibleConstructorReturn","self","ReferenceError","HTMLElement","WeElement","extendStoreUpate","store","instances","patch","timeout","getArrayPatch","JSONProxy","v","setTimeout","patchs","diff","_this","this","updateAll","globalData","matchGlobalData","updatePath","needUpdate","onChange","diffResult","keyA","indexOf","keyB","includePath","pathA","pathB","next","substr","fixPath","mpPath","split","arr","fixArrPath","_classCallCheck$1","_possibleConstructorReturn$1","OBJECTTYPE","getUpdatePath","ctor","Element","_WeElement","_len","args","Array","render","beforeRender","_useId","useCss","shadowRoot","querySelector","use","_this2","updater","newValue","_useMap","id","effect","installed","_isInstalled","customElements","define","dataToPath","type","_objToPath","_arrayToPath","ARRAYTYPE","cloneElement","root","global","Math","window","Reflect","hasOwnProperty","BuiltInHTMLElement","construct","setPrototypeOf","Promise","resolve","then","bind","diffLevel","deepClone","JSON","escapePathComponent","pathComponents","parentAndPath","parenthoodMap","get","parentPath","newValueOriginalObject","revokableInstance","inherited","proxifiedObjectsMap","has","set","operation","destinationPropKey","op","oldValue","delete","disableTrapsForProxy","console","warn","reflectionResult","defaultCallback","revokableProxyInstance","resume","patches","userCallback","pause","isObserving","showDetachedWarning","cachedProxy","deleteProperty","deleteTrap","Proxy","revocable","revocableInstance","trapsInstance","traps","originalObject","_proxifyObjectTreeRecursively","proxifyObjectTree","isProxifyingTreeNow","proxifiedObject","targetObject","message","propKey","record","callback","generate","isRecording","revoke","el","disableTraps","assign","defaultProps","connectedCallback","pure","host","install","attachShadow","mode","removeChild","afterInstall","proxyUpdate","disconnectedCallback","uninstall","splice","beforeUpdate","fire","afterUpdate","CustomEvent","detail","Component","tag","omi","version","module","exports","Omi"],"mappings":"wBACO,SAASA,MCKT,QAASC,GAAEC,EAAUC,GAC1B,GACEC,GACAC,EACAC,EACAC,EAJEC,EAAWC,CAKf,KAAKF,EAAIG,UAAUC,OAAQJ,KAAM,GAC/BK,EAAMC,KAAKH,UAAUH,GAEnBJ,IAAqC,MAAvBA,EAAWK,WACtBI,EAAMD,QAAQC,EAAMC,KAAKV,EAAWK,gBAClCL,GAAWK,SAEpB,OAAOI,EAAMD,OACX,IAAKN,EAAQO,EAAME,YAAAA,KAAUT,EAAMS,IACjC,IAAKP,EAAIF,EAAMM,OAAQJ,KAAOK,EAAMC,KAAKR,EAAME,QAE1B,iBAAVF,KAAqBA,EAAQ,OAEnCC,EAA6B,kBAAbJ,MACN,MAATG,EAAeA,EAAQ,GACD,gBAAVA,GAAoBA,GAAQU,GAClB,gBAAVV,KAAoBC,GAAAA,IAGlCA,GAAUF,EACZI,EAASA,EAASG,OAAS,IAAMN,EACxBG,IAAaC,EACtBD,GAAYH,GAEZG,EAASK,KAAKR,GAGhBD,EAAaE,CAIjB,I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,GAAAA,KAAAA,IAPU2R,GAQVhG,EAAAA,KAAAA,IARUiG,QAAA,SAUV3F,mBAAAA,QAVU4F,OAAAC,QAAAH,GAAA/J,KAAAmK,IAAAJ","file":"omi.min.js","sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","import { VNode } from './vnode'\nimport options from './options'\n\nconst stack = []\nconst EMPTY_CHILDREN = []\n\nexport function h(nodeName, attributes) {\n let children = EMPTY_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--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children === EMPTY_CHILDREN) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let 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 * @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\n/**\n * This shim allows elements written in, or compiled to, ES5 to work on native\n * implementations of Custom Elements v1. It sets new.target to the value of\n * this.constructor so that the native HTMLElement constructor can access the\n * current under-construction element's definition.\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 ||\n 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 ) {\n return\n }\n const 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\nexport function cssToDom(css) {\n const node = document.createElement('style')\n node.textContent = css\n return node\n}\n\nexport function npn(str) {\n return str.replace(/-(\\w)/g, ($, $1) => {\n return $1.toUpperCase()\n })\n}\n\nexport function extend(obj, props) {\n for (let i in props) 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 */\nexport function applyRef(ref, value) {\n if (ref != null) {\n if (typeof ref == 'function') ref(value)\n 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 */\nexport const defer =\n typeof Promise == 'function'\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n","import { extend } from '../util'\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 */\nexport function 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 }\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 */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/**\n * A DOM event listener\n * @typedef {(e: Event) => void} EventListner\n */\n\n/**\n * A mapping of event types to event listeners\n * @typedef {Object.} EventListenerMap\n */\n\n/**\n * Properties Preact adds to elements it creates\n * @typedef PreactElementExtensions\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\n */\n\n/**\n * A DOM element that has been extended with Preact properties\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\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 {PreactElement} The created DOM node\n */\nexport function createNode(nodeName, isSvg) {\n /** @type {PreactElement} */\n let node = isSvg\n ? document.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : 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 */\nexport function removeNode(node) {\n let 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 {PreactElement} 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 */\nexport function 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 (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : 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 let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) node.addEventListener(name, eventProxy, useCapture)\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\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')\n node.removeAttribute(name)\n } else {\n let 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)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value === 'string') {\n if (ns) {\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n } else {\n 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","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { createNode, setAccessor } from '../dom/index'\nimport { npn, isArray } from '../util'\nimport { removeNode } from '../dom/index'\n\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet 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 */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n let 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 && !(ATTR_KEY in dom)\n }\n if (isArray(vnode)) {\n ret = []\n let parentNode = null\n if (isArray(dom)) {\n parentNode = dom[0].parentNode\n dom.forEach(function(item, index) {\n ret.push(idiff(item, vnode[index], context, mountAll, componentRoot))\n })\n } else {\n vnode.forEach(function(item) {\n ret.push(idiff(dom, item, context, mountAll, componentRoot))\n })\n }\n if (parent) {\n ret.forEach(function(vnode) {\n parent.appendChild(vnode)\n })\n } else if (isArray(dom)) {\n dom.forEach(function(node) {\n parentNode.appendChild(node)\n })\n }\n } else {\n ret = idiff(dom, vnode, context, mountAll, componentRoot)\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 && dom.props) {\n dom.props.children = vnode.children\n }\n let 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 (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\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[ATTR_KEY] = true\n\n return out\n }\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : 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) out.appendChild(dom.firstChild)\n\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 let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\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(\n out,\n vchildren,\n context,\n mountAll,\n hydrating || props.dangerouslySetInnerHTML != null\n )\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 let 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 (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let 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 (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\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 (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n // remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n 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 */\nexport function 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[ATTR_KEY] != null && node[ATTR_KEY].ref) node[ATTR_KEY].ref(null)\n\n if (unmountOnly === false || node[ATTR_KEY] == 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 */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let 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 let name\n let update = false\n let isWeElement = dom.update\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 //diable when using store system?\n //!dom.store &&\n if (isWeElement && typeof attrs[name] === 'object') {\n dom.props[npn(name)] = attrs[name]\n update = true\n } else if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\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 dom.parentNode && update && isWeElement && dom.update()\n}\n","/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst 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 const pathComponents = []\n let 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 const 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 const parentPath = findObjectPath(instance, target)\n\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n if (instance.proxifiedObjectsMap.has(newValue)) {\n const 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\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 const revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n /*\n Why do we need to check instance.isProxifyingTreeNow?\n\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\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 (\n newValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n ) {\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 const 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)) {\n // undefined array elements are JSON.stringified to `null`\n ;(operation.op = 'replace'), (operation.value = null)\n }\n const 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(\n 'JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch'\n )\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 const 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 const parentPath = findObjectPath(instance, target)\n const destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n const revokableProxyInstance = instance.proxifiedObjectsMap.get(\n target[key]\n )\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\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 const 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 this.defaultCallback = 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 = () => {}\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 if (!obj) {\n return obj\n }\n const traps = {\n set: (target, key, value, receiver) =>\n setTrap(this, target, key, value, receiver),\n deleteProperty: (target, key) => deleteTrap(this, target, key)\n }\n const 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, 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(\n parent,\n root,\n path\n ) {\n for (let key in root) {\n if (root.hasOwnProperty(key)) {\n if (root[key] instanceof Object) {\n root[key] = this._proxifyObjectTreeRecursively(\n root,\n root[key],\n escapePathComponent(key)\n )\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 const proxifiedObject = this._proxifyObjectTreeRecursively(\n undefined,\n root,\n ''\n )\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(\n revokableProxyInstance\n ) {\n if (this.showDetachedWarning) {\n const message =\n \"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 = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.set = (\n targetObject,\n propKey,\n newValue\n ) => {\n console.warn(message)\n return Reflect.set(targetObject, propKey, newValue)\n }\n revokableProxyInstance.trapsInstance.deleteProperty = (\n targetObject,\n propKey\n ) => {\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(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\nexport default JSONPatcherProxy\n","import JSONProxy from './proxy'\n\nexport function observe(target) {\n target.observe = true\n}\n\nlet preValue = null\nlet prePath = null\nlet preEle = null\n\nexport function proxyUpdate(ele) {\n let timeout = null\n ele.data = new JSONProxy(ele.data).observe(false, info => {\n if (preValue === info.value && prePath === info.path && preEle === ele) {\n return\n }\n\n preValue = info.value\n prePath = info.path\n preEle = ele\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n }, 16.6)\n })\n}\n","import { cssToDom, nProps, isArray } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\nimport { proxyUpdate } from './observe'\n\nexport default class WeElement extends HTMLElement {\n static is = 'WeElement'\n\n constructor() {\n super()\n this.props = Object.assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps\n )\n this.data = this.constructor.data || {}\n }\n\n connectedCallback() {\n if (!this.constructor.pure) {\n let 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\n this.install()\n let shadowRoot\n if (!this.shadowRoot) {\n shadowRoot = this.attachShadow({\n mode: 'open'\n })\n } else {\n shadowRoot = this.shadowRoot\n let fc\n while ((fc = shadowRoot.firstChild)) {\n shadowRoot.removeChild(fc)\n }\n }\n\n this.css && shadowRoot.appendChild(cssToDom(this.css()))\n this.beforeRender()\n options.afterInstall && options.afterInstall(this)\n if (this.constructor.observe) {\n proxyUpdate(this)\n }\n this.host = diff(\n null,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n ),\n {},\n false,\n null,\n false\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 disconnectedCallback() {\n this.uninstall()\n if (this.store) {\n for (let 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 update() {\n this.beforeUpdate()\n this.beforeRender()\n diff(\n this.host,\n this.render(\n this.props,\n !this.constructor.pure && this.store ? this.store.data : this.data\n )\n )\n this.afterUpdate()\n }\n\n fire(name, data) {\n this.dispatchEvent(new CustomEvent(name, { detail: data }))\n }\n\n install() {}\n\n installed() {}\n\n uninstall() {}\n\n beforeUpdate() {}\n\n afterUpdate() {}\n\n beforeRender() {}\n}\n","import { diff } from './vdom/diff'\nimport JSONProxy from './proxy'\n\nexport function render(vnode, parent, store) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n if (store) {\n store.instances = []\n extendStoreUpate(store)\n let timeout = null\n let patchs = {}\n store.data = new JSONProxy(store.data).observe(false, function(patch) {\n clearTimeout(timeout)\n if (patch.op === 'remove') {\n // fix arr splice\n const kv = getArrayPatch(patch.path, store)\n patchs[kv.k] = kv.v\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n } else {\n const key = fixPath(patch.path)\n patchs[key] = patch.value\n timeout = setTimeout(() => {\n update(patchs, store)\n patchs = {}\n }, 16.6)\n }\n })\n parent.store = store\n }\n 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 const updateAll = matchGlobalData(this.globalData, patch)\n\n if (Object.keys(patch).length > 0) {\n this.instances.forEach(instance => {\n if (\n updateAll ||\n this.updateAll ||\n (instance.constructor.updatePath &&\n needUpdate(patch, instance.constructor.updatePath))\n ) {\n instance.update()\n }\n })\n this.onChange && this.onChange(patch)\n }\n }\n}\n\nexport function matchGlobalData(globalData, diffResult) {\n if (!globalData) return false\n for (let keyA in diffResult) {\n if (globalData.indexOf(keyA) > -1) {\n return true\n }\n for (let 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\nexport function needUpdate(diffResult, updatePath) {\n for (let keyA in diffResult) {\n if (updatePath[keyA]) {\n return true\n }\n for (let 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 const next = pathA.substr(pathB.length, 1)\n if (next === '[' || next === '.') {\n return true\n }\n }\n return false\n}\n\nexport function fixPath(path) {\n let mpPath = ''\n const arr = path.replace('/', '').split('/')\n arr.forEach((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 const arr = path.replace('/', '').split('/')\n let current = store.data[arr[0]]\n for (let 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 let mpPath = ''\n const arr = path.replace('/', '').split('/')\n const len = arr.length\n arr.forEach((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","import WeElement from './we-element'\nimport { cssToDom } from './util'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n if (ctor.is === 'WeElement') {\n customElements.define(name, ctor)\n if (ctor.data && !ctor.pure) {\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n } else {\n class Element extends WeElement {\n _useId = 0\n\n _useMap = {}\n\n render(props, data) {\n return ctor.call(this, props, data)\n }\n\n beforeRender() {\n this._useId = 0\n }\n\n useCss(css) {\n const style = this.shadowRoot.querySelector('style')\n style && this.shadowRoot.removeChild(style)\n this.shadowRoot.appendChild(cssToDom(css))\n }\n\n useData(data) {\n return this.use({ data: data })\n }\n\n use(option) {\n this._useId++\n const updater = newValue => {\n const item = this._useMap[updater.id]\n\n item.data = newValue\n\n this.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 installed() {\n this._isInstalled = true\n }\n }\n customElements.define(name, Element)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import { extend } from './util'\nimport { h } from './h'\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 */\nexport function cloneElement(vnode, props) {\n return h(\n vnode.nodeName,\n extend(extend({}, vnode.attributes), props),\n arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children\n )\n}\n","function getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n return (\n self ||\n window ||\n global ||\n (function() {\n return this\n })()\n )\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n store: null,\n root: getGlobal()\n}\n","export function getHost(ele) {\n let p = ele.parentNode\n while (p) {\n if (p.host) {\n return p.host\n } else {\n p = p.parentNode\n }\n }\n}\n","import { h, h as createElement } from './h'\nimport options from './options'\nimport WeElement from './we-element'\nimport { render } from './render'\nimport { define } from './define'\nimport { tag } from './tag'\nimport { observe } from './observe'\nimport { cloneElement } from './clone-element'\nimport { getHost } from './get-host'\n\nconst Component = WeElement\n\nconst omi = {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n\noptions.root.Omi = omi\noptions.root.Omi.version = '4.0.20'\n\nexport default omi\n\nexport {\n tag,\n WeElement,\n Component,\n render,\n h,\n createElement,\n options,\n define,\n observe,\n cloneElement,\n getHost\n}\n"]} \ No newline at end of file diff --git a/packages/omi/package.json b/packages/omi/package.json index a11cef936..e5876bca1 100644 --- a/packages/omi/package.json +++ b/packages/omi/package.json @@ -1,6 +1,6 @@ { "name": "omi", - "version": "4.0.19", + "version": "4.0.20", "description": "Next generation web framework.", "main": "dist/omi.js", "jsnext:main": "dist/omi.esm.js", diff --git a/packages/omi/src/omi.js b/packages/omi/src/omi.js index b7384e6ca..c65670ce5 100644 --- a/packages/omi/src/omi.js +++ b/packages/omi/src/omi.js @@ -25,7 +25,7 @@ const omi = { } options.root.Omi = omi -options.root.Omi.version = '4.0.19' +options.root.Omi.version = '4.0.20' export default omi