diff --git a/packages/omi/dist/omi.dev.js b/packages/omi/dist/omi.dev.js index e83acea1c..e7329b5bc 100644 --- a/packages/omi/dist/omi.dev.js +++ b/packages/omi/dist/omi.dev.js @@ -1061,10 +1061,6 @@ }; return JSONPatcherProxy; }(); - if (typeof module !== 'undefined') { - module.exports = JSONPatcherProxy; - module.exports.default = JSONPatcherProxy; - } var timeout = null; var patchs = {}; diff --git a/packages/omi/dist/omi.dev.js.map b/packages/omi/dist/omi.dev.js.map index af66aeabf..2206353a2 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/we-element.js","../src/proxy.js","../src/render.js","../src/define.js","../src/tag.js","../src/omi.js","../src/omi.js"],"sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","function getGlobal() {\r\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\r\n\t\tif (typeof self !== 'undefined') {\r\n\t\t\treturn self\r\n\t\t} else if (typeof window !== 'undefined') {\r\n\t\t\treturn window\r\n\t\t} else if (typeof global !== 'undefined') {\r\n\t\t\treturn global\r\n\t\t}\r\n\t\treturn (function(){\r\n\t\t\treturn this\r\n\t\t})()\r\n\t\t\r\n\t}\r\n\treturn global\r\n}\r\n\r\n/** Global options\r\n *\t@public\r\n *\t@namespace options {Object}\r\n */\r\nexport default {\r\n\r\n\tstore: null,\r\n\t\r\n\troot: getGlobal()\r\n\t//componentChange(component, element) { },\r\n\t/** If `true`, `prop` changes trigger synchronous component updates.\r\n\t *\t@name syncComponentUpdates\r\n\t *\t@type Boolean\r\n\t *\t@default true\r\n\t */\r\n\t//syncComponentUpdates: true,\r\n\r\n\t/** Processes all created VNodes.\r\n\t *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\r\n\t */\r\n\t//vnode(vnode) { }\r\n\r\n\t/** Hook invoked after a component is mounted. */\r\n\t//afterMount(component) { },\r\n\r\n\t/** Hook invoked after the DOM is updated with a component's latest render. */\r\n\t//afterUpdate(component) { }\r\n\r\n\t/** Hook invoked immediately before a component is unmounted. */\r\n\t// beforeUnmount(component) { }\r\n}\r\n","import { VNode } from './vnode'\r\nimport options from './options'\r\n\r\nconst stack = []\r\nconst EMPTY_CHILDREN = []\r\n\r\nexport function h(nodeName, attributes) {\r\n\tlet children = EMPTY_CHILDREN, lastSimple, child, simple, i\r\n\tfor (i = arguments.length; i-- > 2;) {\r\n\t\tstack.push(arguments[i])\r\n\t}\r\n\tif (attributes && attributes.children != null) {\r\n\t\tif (!stack.length) stack.push(attributes.children)\r\n\t\tdelete attributes.children\r\n\t}\r\n\twhile (stack.length) {\r\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\r\n\t\t\tfor (i = child.length; i--;) stack.push(child[i])\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (typeof child === 'boolean') child = null\r\n\r\n\t\t\tif ((simple = typeof nodeName !== 'function')) {\r\n\t\t\t\tif (child == null) child = ''\r\n\t\t\t\telse if (typeof child === 'number') child = String(child)\r\n\t\t\t\telse if (typeof child !== 'string') simple = false\r\n\t\t\t}\r\n\r\n\t\t\tif (simple && lastSimple) {\r\n\t\t\t\tchildren[children.length - 1] += child\r\n\t\t\t}\r\n\t\t\telse if (children === EMPTY_CHILDREN) {\r\n\t\t\t\tchildren = [child]\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tchildren.push(child)\r\n\t\t\t}\r\n\r\n\t\t\tlastSimple = simple\r\n\t\t}\r\n\t}\r\n\r\n\tlet p = new VNode()\r\n\tp.nodeName = nodeName\r\n\tp.children = children\r\n\tp.attributes = attributes == null ? undefined : attributes\r\n\tp.key = attributes == null ? undefined : attributes.key\r\n\r\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\r\n\tif (options.vnode !== undefined) options.vnode(p)\r\n\r\n\treturn p\r\n}","/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n/**\r\n * This shim allows elements written in, or compiled to, ES5 to work on native\r\n * implementations of Custom Elements v1. It sets new.target to the value of\r\n * this.constructor so that the native HTMLElement constructor can access the\r\n * current under-construction element's definition.\r\n */\r\n(function() {\r\n\tif (\r\n\t// No Reflect, no classes, no need for shim because native custom elements\r\n\t// require ES2015 classes or Reflect.\r\n\t\twindow.Reflect === undefined ||\r\n window.customElements === undefined ||\r\n // The webcomponentsjs custom elements polyfill doesn't require\r\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\r\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')\r\n\t) {\r\n\t\treturn\r\n\t}\r\n\tconst BuiltInHTMLElement = HTMLElement\r\n\twindow.HTMLElement = function HTMLElement() {\r\n\t\treturn Reflect.construct(BuiltInHTMLElement, [], this.constructor)\r\n\t}\r\n\tHTMLElement.prototype = BuiltInHTMLElement.prototype\r\n\tHTMLElement.prototype.constructor = HTMLElement\r\n\tObject.setPrototypeOf(HTMLElement, BuiltInHTMLElement)\r\n})()\r\n\r\n\r\n\r\nexport function cssToDom(css) {\r\n\tconst node = document.createElement('style')\r\n\tnode.innerText = css\r\n\treturn node\r\n}\r\n\r\n\r\nexport function npn(str) {\r\n\treturn str.replace(/-(\\w)/g, ($, $1) => {\r\n\t\treturn $1.toUpperCase()\r\n\t})\r\n}\r\n\r\nexport function extend(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i]\r\n\treturn obj\r\n}\r\n\r\n/** Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} [ref=null]\r\n * @param {any} [value]\r\n */\r\nexport function applyRef(ref, value) {\r\n\tif (ref!=null) {\r\n\t\tif (typeof ref=='function') ref(value)\r\n\t\telse ref.current = value\r\n\t}\r\n}\r\n\r\n/**\r\n * Call a function asynchronously, as soon as possible. Makes\r\n * use of HTML Promise to schedule the callback if available,\r\n * otherwise falling back to `setTimeout` (mainly for IE<11).\r\n * @type {(callback: function) => void}\r\n */\r\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout\r\n\r\nexport function isArray(obj){\r\n\treturn Object.prototype.toString.call(obj) === '[object Array]'\r\n}\r\n\r\nexport function nProps(props){\r\n\tif (!props || isArray(props)) return {}\r\n\tconst result = {}\r\n\tObject.keys(props).forEach(key =>{\r\n\t\tresult[key] = props[key].value\r\n\t})\r\n\treturn result\r\n}\r\n","// render modes\r\n\r\nexport const NO_RENDER = 0\r\nexport const SYNC_RENDER = 1\r\nexport const FORCE_RENDER = 2\r\nexport const ASYNC_RENDER = 3\r\n\r\n\r\nexport const ATTR_KEY = '__preactattr_'\r\n\r\n// DOM properties that should NOT have \"px\" added when numeric\r\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\r\n\r\n","import { extend } from '../util'\r\n\r\n\r\n/**\r\n * Check if two nodes are equivalent.\r\n *\r\n * @param {Node} node\t\t\tDOM Node to compare\r\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\r\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\r\n * @private\r\n */\r\nexport function isSameNodeType(node, vnode, hydrating) {\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\t\treturn node.splitText!==undefined\r\n\t}\r\n\tif (typeof vnode.nodeName==='string') {\r\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName)\r\n\t}\r\n\treturn hydrating || node._componentConstructor===vnode.nodeName\r\n}\r\n\r\n\r\n/**\r\n * Check if an Element has a given nodeName, case-insensitively.\r\n *\r\n * @param {Element} node\tA DOM Element to inspect the name of.\r\n * @param {String} nodeName\tUnnormalized name to compare against.\r\n */\r\nexport function isNamedNode(node, nodeName) {\r\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase()\r\n}\r\n\r\n\r\n/**\r\n * Reconstruct Component-style `props` from a VNode.\r\n * Ensures default/fallback values from `defaultProps`:\r\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\r\n *\r\n * @param {VNode} vnode\r\n * @returns {Object} props\r\n */\r\nexport function getNodeProps(vnode) {\r\n\tlet props = extend({}, vnode.attributes)\r\n\tprops.children = vnode.children\r\n\r\n\tlet defaultProps = vnode.nodeName.defaultProps\r\n\tif (defaultProps!==undefined) {\r\n\t\tfor (let i in defaultProps) {\r\n\t\t\tif (props[i]===undefined) {\r\n\t\t\t\tprops[i] = defaultProps[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n","import { IS_NON_DIMENSIONAL } from '../constants'\r\nimport { applyRef } from '../util'\r\nimport options from '../options'\r\n\r\n/**\r\n * A DOM event listener\r\n * @typedef {(e: Event) => void} EventListner\r\n */\r\n\r\n/**\r\n * A mapping of event types to event listeners\r\n * @typedef {Object.} EventListenerMap\r\n */\r\n\r\n/**\r\n * Properties Preact adds to elements it creates\r\n * @typedef PreactElementExtensions\r\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\r\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\r\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\r\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\r\n */\r\n\r\n/**\r\n * A DOM element that has been extended with Preact properties\r\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\r\n */\r\n\r\n/**\r\n * Create an element with the given nodeName.\r\n * @param {string} nodeName The DOM node to create\r\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\r\n * namespace.\r\n * @returns {PreactElement} The created DOM node\r\n */\r\nexport function createNode(nodeName, isSvg) {\r\n\t/** @type {PreactElement} */\r\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName)\r\n\tnode.normalizedNodeName = nodeName\r\n\treturn node\r\n}\r\n\r\n\r\n/**\r\n * Remove a child node from its parent if attached.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode\r\n\tif (parentNode) parentNode.removeChild(node)\r\n}\r\n\r\n\r\n/**\r\n * Set a named attribute on the given Node, with special behavior for some names\r\n * and event handlers. If `value` is `null`, the attribute/handler will be\r\n * removed.\r\n * @param {PreactElement} node An element to mutate\r\n * @param {string} name The name/key to set, such as an event or attribute name\r\n * @param {*} old The last value that was set for this name/node pair\r\n * @param {*} value An attribute value, such as a function to be used as an\r\n * event handler\r\n * @param {boolean} isSvg Are we currently diffing inside an svg?\r\n * @private\r\n */\r\nexport function setAccessor(node, name, old, value, isSvg) {\r\n\tif (name==='className') name = 'class'\r\n\r\n\r\n\tif (name==='key') {\r\n\t\t// ignore\r\n\t}\r\n\telse if (name==='ref') {\r\n\t\tapplyRef(old, null)\r\n\t\tapplyRef(value, node)\r\n\t}\r\n\telse if (name==='class' && !isSvg) {\r\n\t\tnode.className = value || ''\r\n\t}\r\n\telse if (name==='style') {\r\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\r\n\t\t\tnode.style.cssText = value || ''\r\n\t\t}\r\n\t\tif (value && typeof value==='object') {\r\n\t\t\tif (typeof old!=='string') {\r\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = ''\r\n\t\t\t}\r\n\t\t\tfor (let i in value) {\r\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if (name==='dangerouslySetInnerHTML') {\r\n\t\tif (value) node.innerHTML = value.__html || ''\r\n\t}\r\n\telse if (name[0]=='o' && name[1]=='n') {\r\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''))\r\n\t\tname = name.toLowerCase().substring(2)\r\n\t\tif (value) {\r\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\t(node._listeners || (node._listeners = {}))[name] = value\r\n\t}\r\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\r\n\t\t// Attempt to set a DOM property to the given value.\r\n\t\t// IE & FF throw for certain property-value combinations.\r\n\t\ttry {\r\n\t\t\tnode[name] = value==null ? '' : value\r\n\t\t} catch (e) { }\r\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name)\r\n\t}\r\n\telse {\r\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')))\r\n\t\t// spellcheck is treated differently than all other boolean values and\r\n\t\t// should not be removed when the value is `false`. See:\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\r\n\t\tif (value==null || value===false) {\r\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase())\r\n\t\t\telse node.removeAttribute(name)\r\n\t\t}\r\n\t\telse if (typeof value === 'string') {\r\n\t\t\tif (ns) {\r\n\t\t\t\tnode.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(name, value)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\treturn this._listeners[e.type](options.event && options.event(e) || e)\r\n}","import { ATTR_KEY } from '../constants'\r\nimport { isSameNodeType, isNamedNode } from './index'\r\nimport { createNode, setAccessor } from '../dom/index'\r\nimport { npn } from '../util'\r\nimport { removeNode } from '../dom/index'\r\n\r\n/** Queue of components that have been mounted and are awaiting componentDidMount */\r\nexport const mounts = []\r\n\r\n/** Diff recursion count, used to track the end of the diff cycle. */\r\nexport let diffLevel = 0\r\n\r\n/** Global flag indicating if the diff is currently within an SVG */\r\nlet isSvgMode = false\r\n\r\n/** Global flag indicating if the diff is performing hydration */\r\nlet hydrating = false\r\n\r\n\r\n\r\n\r\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\r\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\r\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\r\n *\t@returns {Element} dom\t\t\tThe created/mutated element\r\n *\t@private\r\n */\r\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\r\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\r\n\tif (!diffLevel++) {\r\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\r\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined\r\n\r\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\r\n\t\thydrating = dom!=null && !(ATTR_KEY in dom)\r\n\t}\r\n\r\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot)\r\n\r\n\t// append the element if its a new parent\r\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret)\r\n\r\n\t// diffLevel being reduced to 0 means we're exiting the diff\r\n\tif (!--diffLevel) {\r\n\t\thydrating = false\r\n\t\t// invoke queued componentDidMount lifecycle methods\r\n\t\t\r\n\t}\r\n\r\n\treturn ret\r\n}\r\n\r\n\r\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\r\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\r\n\tlet out = dom,\r\n\t\tprevSvgMode = isSvgMode\r\n\r\n\t// empty values (null, undefined, booleans) render as empty Text nodes\r\n\tif (vnode==null || typeof vnode==='boolean') vnode = ''\r\n\r\n\r\n\t// Fast case: Strings & Numbers create/update Text nodes.\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\r\n\t\t// update if it's already a Text node:\r\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\r\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\r\n\t\t\tif (dom.nodeValue!=vnode) {\r\n\t\t\t\tdom.nodeValue = vnode\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\r\n\t\t\tout = document.createTextNode(vnode)\r\n\t\t\tif (dom) {\r\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\t\t\t\trecollectNodeTree(dom, true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tout[ATTR_KEY] = true\r\n\r\n\t\treturn out\r\n\t}\r\n\r\n\r\n\t// If the VNode represents a Component, perform a component diff:\r\n\tlet vnodeName = vnode.nodeName\r\n\t\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode\r\n\r\n\r\n\t// If there's no existing element or it's the wrong type, create a new one:\r\n\tvnodeName = String(vnodeName)\r\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\r\n\t\tout = createNode(vnodeName, isSvgMode)\r\n\r\n\t\tif (dom) {\r\n\t\t\t// move children into the replacement node\r\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild)\r\n\r\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\r\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\r\n\t\t\t// recycle the old element (skips non-Element node types)\r\n\t\t\trecollectNodeTree(dom, true)\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tlet fc = out.firstChild,\r\n\t\tprops = out[ATTR_KEY],\r\n\t\tvchildren = vnode.children\r\n\r\n\tif (props==null) {\r\n\t\tprops = out[ATTR_KEY] = {}\r\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value\r\n\t}\r\n\r\n\t// Optimization: fast-path for elements containing a single TextNode:\r\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\r\n\t\tif (fc.nodeValue!=vchildren[0]) {\r\n\t\t\tfc.nodeValue = vchildren[0]\r\n\t\t}\r\n\t}\r\n\t// otherwise, if there are existing or new children, diff them:\r\n\telse if (vchildren && vchildren.length || fc!=null) {\r\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null)\r\n\t}\r\n\r\n\r\n\t// Apply attributes/props from VNode to the DOM Element:\r\n\tdiffAttributes(out, vnode.attributes, props)\r\n\r\n\r\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\r\n\tisSvgMode = prevSvgMode\r\n\r\n\treturn out\r\n}\r\n\r\n\r\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\r\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\r\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\r\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\r\n *\t@param {Boolean} mountAll\r\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\r\n */\r\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\r\n\tlet originalChildren = dom.childNodes,\r\n\t\tchildren = [],\r\n\t\tkeyed = {},\r\n\t\tkeyedLen = 0,\r\n\t\tmin = 0,\r\n\t\tlen = originalChildren.length,\r\n\t\tchildrenLen = 0,\r\n\t\tvlen = vchildren ? vchildren.length : 0,\r\n\t\tj, c, f, vchild, child\r\n\r\n\t// Build up a map of keyed children and an Array of unkeyed children:\r\n\tif (len!==0) {\r\n\t\tfor (let i=0; i {\n\t\t\tthis.isRecording && this.patches.push(operation)\n\t\t\tthis.userCallback && this.userCallback(operation)\n\t\t}\n\t\tthis.isObserving = true\n\t}\n\tfunction pause() {\n\t\tthis.defaultCallback = () => {}\n\t\tthis.isObserving = false\n\t}\n\t/**\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\tfunction JSONPatcherProxy(root, showDetachedWarning) {\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.isObserving = false\n\t\tthis.proxifiedObjectsMap = new Map()\n\t\tthis.parenthoodMap = new Map()\n\t\t// default to true\n\t\tif (typeof showDetachedWarning !== 'boolean') {\n\t\t\tshowDetachedWarning = true\n\t\t}\n\n\t\tthis.showDetachedWarning = showDetachedWarning\n\t\tthis.originalObject = root\n\t\tthis.cachedProxy = null\n\t\tthis.isRecording = false\n\t\tthis.userCallback\n\t\t/**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n\t\tthis.resume = resume.bind(this)\n\t\t/**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n\t\tthis.pause = pause.bind(this)\n\t}\n\n\tJSONPatcherProxy.prototype.generateProxyAtPath = function(parent, obj, path) {\n\t\tif (!obj) {\n\t\t\treturn obj\n\t\t}\n\t\tconst traps = {\n\t\t\tset: (target, key, value, receiver) =>\n\t\t\t\tsetTrap(this, target, key, value, receiver),\n\t\t\tdeleteProperty: (target, key) => deleteTrap(this, target, key)\n\t\t}\n\t\tconst revocableInstance = Proxy.revocable(obj, traps)\n\t\t// cache traps object to disable them later.\n\t\trevocableInstance.trapsInstance = traps\n\t\trevocableInstance.originalObject = obj\n\n\t\t/* keeping track of object's parent and path */\n\n\t\tthis.parenthoodMap.set(obj, { parent, path })\n\n\t\t/* keeping track of all the proxies to be able to revoke them later */\n\t\tthis.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance)\n\t\treturn revocableInstance.proxy\n\t}\n\t// grab tree's leaves one by one, encapsulate them into a proxy and return\n\tJSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function(\n\t\tparent,\n\t\troot,\n\t\tpath\n\t) {\n\t\tfor (let key in root) {\n\t\t\tif (root.hasOwnProperty(key)) {\n\t\t\t\tif (root[key] instanceof Object) {\n\t\t\t\t\troot[key] = this._proxifyObjectTreeRecursively(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\troot[key],\n\t\t\t\t\t\tescapePathComponent(key)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.generateProxyAtPath(parent, root, path)\n\t}\n\t// this function is for aesthetic purposes\n\tJSONPatcherProxy.prototype.proxifyObjectTree = function(root) {\n\t\t/*\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\t\tthis.pause()\n\t\tthis.isProxifyingTreeNow = true\n\t\tconst proxifiedObject = this._proxifyObjectTreeRecursively(\n\t\t\tundefined,\n\t\t\troot,\n\t\t\t''\n\t\t)\n\t\t/* OK you can record now */\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.resume()\n\t\treturn proxifiedObject\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTrapsForProxy = function(\n\t\trevokableProxyInstance\n\t) {\n\t\tif (this.showDetachedWarning) {\n\t\t\tconst message =\n \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\"\n\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.deleteProperty = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey\n\t\t\t) => {\n\t\t\t\treturn Reflect.deleteProperty(targetObject, propKey)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete revokableProxyInstance.trapsInstance.set\n\t\t\tdelete revokableProxyInstance.trapsInstance.get\n\t\t\tdelete revokableProxyInstance.trapsInstance.deleteProperty\n\t\t}\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.observe = function(record, callback) {\n\t\tif (!record && !callback) {\n\t\t\tthrow new Error('You need to either record changes or pass a callback')\n\t\t}\n\t\tthis.isRecording = record\n\t\tthis.userCallback = callback\n\t\t/*\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\t\tif (record) this.patches = []\n\t\tthis.cachedProxy = this.proxifyObjectTree(this.originalObject)\n\t\treturn this.cachedProxy\n\t}\n\t/**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n\tJSONPatcherProxy.prototype.generate = function() {\n\t\tif (!this.isRecording) {\n\t\t\tthrow new Error('You should set record to true to get patches later')\n\t\t}\n\t\treturn this.patches.splice(0, this.patches.length)\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.revoke = function() {\n\t\tthis.proxifiedObjectsMap.forEach(el => {\n\t\t\tel.revoke()\n\t\t})\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTraps = function() {\n\t\tthis.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this)\n\t}\n\treturn JSONPatcherProxy\n})()\n\nexport default JSONPatcherProxy\nif (typeof module !== 'undefined') {\n\tmodule.exports = JSONPatcherProxy\n\tmodule.exports.default = JSONPatcherProxy\n}\n","\r\nimport { diff } from './vdom/diff'\r\nimport options from './options'\r\nimport JSONProxy from './proxy'\r\n\r\nlet timeout = null\r\nlet patchs = {}\r\n\r\nconst handler = function (patch) {\r\n\r\n\tclearTimeout(timeout)\r\n\tif (patch.op === 'remove') {//fix arr splice\r\n\t\tconst kv = getArrayPatch(patch.path)\r\n\t\tpatchs[kv.k] = kv.v\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t} else {\r\n\t\tconst key = fixPath(patch.path)\r\n\t\tpatchs[key] = patch.value\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t}\r\n}\r\n\r\nexport function render(vnode, parent, store) {\r\n\tparent = typeof parent === 'string' ? document.querySelector(parent) : parent\r\n\tif (store) {\r\n\t\tstore.instances = []\r\n\t\textendStoreUpate(store)\r\n\t\toptions.store = store\r\n\t\tstore.data = new JSONProxy(store.data).observe(true, handler)\r\n\t}\r\n\tdiff(null, vnode, {}, false, parent, false)\r\n}\r\n\r\nfunction update(patch) {\r\n\toptions.store.update(patch)\r\n}\r\n\r\nfunction extendStoreUpate(store) {\r\n\tstore.update = function (patch) {\r\n\t\tconst updateAll = matchGlobalData(this.globalData, patch)\r\n\r\n\t\tif (Object.keys(patch).length > 0) {\r\n\t\t\tthis.instances.forEach(instance => {\r\n\t\t\t\tif (updateAll || this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath)) {\r\n\t\t\t\t\tinstance.update()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tthis.onChange && this.onChange(patch)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction matchGlobalData(globalData, diffResult) {\r\n\tif (!globalData) return false\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (globalData.indexOf(keyA) > -1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let i = 0, len = globalData.length; i < len; i++) {\r\n\t\t\tif (includePath(keyA, globalData[i])) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction needUpdate(diffResult, updatePath) {\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (updatePath[keyA]) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let keyB in updatePath) {\r\n\t\t\tif (includePath(keyA, keyB)) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction includePath(pathA, pathB) {\r\n\tif (pathA.indexOf(pathB) === 0) {\r\n\t\tconst next = pathA.substr(pathB.length, 1)\r\n\t\tif (next === '[' || next === '.') {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction fixPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index) {\r\n\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmpPath += item\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}\r\n\r\nfunction getArrayPatch(path) {\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tlet current = options.store.data[arr[0]]\r\n\tfor (let i = 1, len = arr.length; i < len - 1; i++) {\r\n\t\tcurrent = current[arr[i]]\r\n\t}\r\n\treturn { k: fixArrPath(path), v: current }\r\n}\r\n\r\nfunction fixArrPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tconst len = arr.length\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index < len - 1) {\r\n\t\t\tif (index) {\r\n\t\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += item\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}","const OBJECTTYPE = '[object Object]'\r\nconst ARRAYTYPE = '[object Array]'\r\n\r\nexport function define(name, ctor) {\r\n\tcustomElements.define(name, ctor)\r\n\tif (ctor.data && !ctor.pure) {\r\n\t\tctor.updatePath = getUpdatePath(ctor.data)\r\n\t}\r\n}\r\n\r\nexport function getUpdatePath(data) {\r\n\tconst result = {}\r\n\tdataToPath(data, result)\r\n\treturn result\r\n}\r\n\r\nfunction dataToPath(data, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[key] = true\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _objToPath(data, path, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[path + '.' + key] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], path + '.' + key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], path + '.' + key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _arrayToPath(data, path, result) {\r\n\tdata.forEach((item, index) => {\r\n\t\tresult[path + '[' + index + ']'] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(item)\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(item, path + '[' + index + ']', result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(item, path + '[' + index + ']', result)\r\n\t\t}\r\n\t})\r\n}","import { define } from './define'\r\n\r\nexport function tag(name, pure) {\r\n\treturn function (target) {\r\n\t\ttarget.pure = pure\r\n\t\tdefine(name, target)\r\n\t}\r\n}","import { h, h as createElement } from './h'\r\nimport options from './options'\r\nimport WeElement from './we-element'\r\nimport { render } from './render'\r\nimport { define } from './define'\r\nimport { tag } from './tag'\r\n\r\noptions.root.Omi = {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\noptions.root.Omi.version = '4.0.0'\r\n\r\nexport default {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\nexport {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\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","innerText","npn","str","replace","$","$1","toUpperCase","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","isArray","obj","toString","call","nProps","props","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","ownerSVGElement","ret","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","WeElement","data","connectedCallback","instances","install","shadowRoot","attachShadow","mode","host","render","pure","installed","disconnectedCallback","uninstall","splice","beforeUpdate","afterUpdate","fire","dispatchEvent","CustomEvent","detail","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","revoke","el","disableTraps","module","exports","default","timeout","patchs","handler","patch","clearTimeout","kv","getArrayPatch","k","v","fixPath","querySelector","extendStoreUpate","JSONProxy","updateAll","matchGlobalData","globalData","updatePath","needUpdate","onChange","diffResult","keyA","includePath","keyB","pathA","pathB","substr","mpPath","arr","split","item","index","isNaN","fixArrPath","OBJECTTYPE","ARRAYTYPE","define","ctor","getUpdatePath","dataToPath","_objToPath","_arrayToPath","tag","Omi","version"],"mappings":";;;;;;;;;;;CAAA;AACA,CAAO,SAASA,KAAT,GAAiB;;CCDxB,SAASC,SAAT,GAAqB;CACpB,KAAI,OAAOC,MAAP,KAAkB,QAAlB,IAA8B,CAACA,MAA/B,IAAyCA,OAAOC,IAAP,KAAgBA,IAAzD,IAAiED,OAAOE,KAAP,KAAiBA,KAAtF,EAA6F;CAC5F,MAAI,OAAOC,IAAP,KAAgB,WAApB,EAAiC;CAChC,UAAOA,IAAP;CACA,GAFD,MAEO,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;CACzC,UAAOA,MAAP;CACA,GAFM,MAEA,IAAI,OAAOJ,MAAP,KAAkB,WAAtB,EAAmC;CACzC,UAAOA,MAAP;CACA;CACD,SAAQ,YAAU;CACjB,UAAO,IAAP;CACA,GAFM,EAAP;CAIA;CACD,QAAOA,MAAP;CACA;;CAED;;;;AAIA,eAAe;;CAEdK,QAAO,IAFO;;CAIdC,OAAMP;CACN;CACA;;;;;CAKA;;CAEA;;;CAGA;;CAEA;CACA;;CAEA;CACA;;CAEA;CACA;CAzBc,CAAf;;KClBMQ,QAAQ,EAAd;CACA,IAAMC,iBAAiB,EAAvB;;AAEA,CAAO,SAASC,CAAT,CAAWC,QAAX,EAAqBC,UAArB,EAAiC;CACvC,KAAIC,WAAWJ,cAAf;CAAA,KAA+BK,mBAA/B;CAAA,KAA2CC,cAA3C;CAAA,KAAkD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UA;;UClDewO,GAAT,CAAarN,IAAb,EAAmBoF,IAAnB,EAAyB;CAC/B,QAAO,UAAU4B,MAAV,EAAkB;CACxBA,SAAO5B,IAAP,GAAcA,IAAd;CACA2H,SAAO/M,IAAP,EAAagH,MAAb;CACA,EAHD;CAIA;;SCAO9L,IAAR,CAAaoS,GAAb,GAAmB;CAClBD,SADkB;CAElB3I,qBAFkB;CAGlBS,eAHkB;CAIlB9J,KAJkB;CAKlBgC,iBALkB;CAMlBhB,iBANkB;CAOlB0Q;CAPkB,CAAnB;;CAUA1Q,QAAQnB,IAAR,CAAaoS,GAAb,CAAiBC,OAAjB,GAA2B,OAA3B;;AAEA,WAAe;CACdF,SADc;CAEd3I,qBAFc;CAGdS,eAHc;CAId9J,KAJc;CAKdgC,iBALc;CAMdhB,iBANc;CAOd0Q;CAPc,CAAf;;CCjBI,IAAI,OAAOtC,MAAP,IAAe,WAAnB,EAAgCA,OAAOC,OAAP,GAAiB4C,GAAjB,CAAhC,KACKvS,KAAKuS,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/we-element.js","../src/proxy.js","../src/render.js","../src/define.js","../src/tag.js","../src/omi.js","../src/omi.js"],"sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","function getGlobal() {\r\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\r\n\t\tif (typeof self !== 'undefined') {\r\n\t\t\treturn self\r\n\t\t} else if (typeof window !== 'undefined') {\r\n\t\t\treturn window\r\n\t\t} else if (typeof global !== 'undefined') {\r\n\t\t\treturn global\r\n\t\t}\r\n\t\treturn (function(){\r\n\t\t\treturn this\r\n\t\t})()\r\n\t\t\r\n\t}\r\n\treturn global\r\n}\r\n\r\n/** Global options\r\n *\t@public\r\n *\t@namespace options {Object}\r\n */\r\nexport default {\r\n\r\n\tstore: null,\r\n\t\r\n\troot: getGlobal()\r\n\t//componentChange(component, element) { },\r\n\t/** If `true`, `prop` changes trigger synchronous component updates.\r\n\t *\t@name syncComponentUpdates\r\n\t *\t@type Boolean\r\n\t *\t@default true\r\n\t */\r\n\t//syncComponentUpdates: true,\r\n\r\n\t/** Processes all created VNodes.\r\n\t *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\r\n\t */\r\n\t//vnode(vnode) { }\r\n\r\n\t/** Hook invoked after a component is mounted. */\r\n\t//afterMount(component) { },\r\n\r\n\t/** Hook invoked after the DOM is updated with a component's latest render. */\r\n\t//afterUpdate(component) { }\r\n\r\n\t/** Hook invoked immediately before a component is unmounted. */\r\n\t// beforeUnmount(component) { }\r\n}\r\n","import { VNode } from './vnode'\r\nimport options from './options'\r\n\r\nconst stack = []\r\nconst EMPTY_CHILDREN = []\r\n\r\nexport function h(nodeName, attributes) {\r\n\tlet children = EMPTY_CHILDREN, lastSimple, child, simple, i\r\n\tfor (i = arguments.length; i-- > 2;) {\r\n\t\tstack.push(arguments[i])\r\n\t}\r\n\tif (attributes && attributes.children != null) {\r\n\t\tif (!stack.length) stack.push(attributes.children)\r\n\t\tdelete attributes.children\r\n\t}\r\n\twhile (stack.length) {\r\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\r\n\t\t\tfor (i = child.length; i--;) stack.push(child[i])\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (typeof child === 'boolean') child = null\r\n\r\n\t\t\tif ((simple = typeof nodeName !== 'function')) {\r\n\t\t\t\tif (child == null) child = ''\r\n\t\t\t\telse if (typeof child === 'number') child = String(child)\r\n\t\t\t\telse if (typeof child !== 'string') simple = false\r\n\t\t\t}\r\n\r\n\t\t\tif (simple && lastSimple) {\r\n\t\t\t\tchildren[children.length - 1] += child\r\n\t\t\t}\r\n\t\t\telse if (children === EMPTY_CHILDREN) {\r\n\t\t\t\tchildren = [child]\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tchildren.push(child)\r\n\t\t\t}\r\n\r\n\t\t\tlastSimple = simple\r\n\t\t}\r\n\t}\r\n\r\n\tlet p = new VNode()\r\n\tp.nodeName = nodeName\r\n\tp.children = children\r\n\tp.attributes = attributes == null ? undefined : attributes\r\n\tp.key = attributes == null ? undefined : attributes.key\r\n\r\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\r\n\tif (options.vnode !== undefined) options.vnode(p)\r\n\r\n\treturn p\r\n}","/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n/**\r\n * This shim allows elements written in, or compiled to, ES5 to work on native\r\n * implementations of Custom Elements v1. It sets new.target to the value of\r\n * this.constructor so that the native HTMLElement constructor can access the\r\n * current under-construction element's definition.\r\n */\r\n(function() {\r\n\tif (\r\n\t// No Reflect, no classes, no need for shim because native custom elements\r\n\t// require ES2015 classes or Reflect.\r\n\t\twindow.Reflect === undefined ||\r\n window.customElements === undefined ||\r\n // The webcomponentsjs custom elements polyfill doesn't require\r\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\r\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')\r\n\t) {\r\n\t\treturn\r\n\t}\r\n\tconst BuiltInHTMLElement = HTMLElement\r\n\twindow.HTMLElement = function HTMLElement() {\r\n\t\treturn Reflect.construct(BuiltInHTMLElement, [], this.constructor)\r\n\t}\r\n\tHTMLElement.prototype = BuiltInHTMLElement.prototype\r\n\tHTMLElement.prototype.constructor = HTMLElement\r\n\tObject.setPrototypeOf(HTMLElement, BuiltInHTMLElement)\r\n})()\r\n\r\n\r\n\r\nexport function cssToDom(css) {\r\n\tconst node = document.createElement('style')\r\n\tnode.innerText = css\r\n\treturn node\r\n}\r\n\r\n\r\nexport function npn(str) {\r\n\treturn str.replace(/-(\\w)/g, ($, $1) => {\r\n\t\treturn $1.toUpperCase()\r\n\t})\r\n}\r\n\r\nexport function extend(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i]\r\n\treturn obj\r\n}\r\n\r\n/** Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} [ref=null]\r\n * @param {any} [value]\r\n */\r\nexport function applyRef(ref, value) {\r\n\tif (ref!=null) {\r\n\t\tif (typeof ref=='function') ref(value)\r\n\t\telse ref.current = value\r\n\t}\r\n}\r\n\r\n/**\r\n * Call a function asynchronously, as soon as possible. Makes\r\n * use of HTML Promise to schedule the callback if available,\r\n * otherwise falling back to `setTimeout` (mainly for IE<11).\r\n * @type {(callback: function) => void}\r\n */\r\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout\r\n\r\nexport function isArray(obj){\r\n\treturn Object.prototype.toString.call(obj) === '[object Array]'\r\n}\r\n\r\nexport function nProps(props){\r\n\tif (!props || isArray(props)) return {}\r\n\tconst result = {}\r\n\tObject.keys(props).forEach(key =>{\r\n\t\tresult[key] = props[key].value\r\n\t})\r\n\treturn result\r\n}\r\n","// render modes\r\n\r\nexport const NO_RENDER = 0\r\nexport const SYNC_RENDER = 1\r\nexport const FORCE_RENDER = 2\r\nexport const ASYNC_RENDER = 3\r\n\r\n\r\nexport const ATTR_KEY = '__preactattr_'\r\n\r\n// DOM properties that should NOT have \"px\" added when numeric\r\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\r\n\r\n","import { extend } from '../util'\r\n\r\n\r\n/**\r\n * Check if two nodes are equivalent.\r\n *\r\n * @param {Node} node\t\t\tDOM Node to compare\r\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\r\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\r\n * @private\r\n */\r\nexport function isSameNodeType(node, vnode, hydrating) {\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\t\treturn node.splitText!==undefined\r\n\t}\r\n\tif (typeof vnode.nodeName==='string') {\r\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName)\r\n\t}\r\n\treturn hydrating || node._componentConstructor===vnode.nodeName\r\n}\r\n\r\n\r\n/**\r\n * Check if an Element has a given nodeName, case-insensitively.\r\n *\r\n * @param {Element} node\tA DOM Element to inspect the name of.\r\n * @param {String} nodeName\tUnnormalized name to compare against.\r\n */\r\nexport function isNamedNode(node, nodeName) {\r\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase()\r\n}\r\n\r\n\r\n/**\r\n * Reconstruct Component-style `props` from a VNode.\r\n * Ensures default/fallback values from `defaultProps`:\r\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\r\n *\r\n * @param {VNode} vnode\r\n * @returns {Object} props\r\n */\r\nexport function getNodeProps(vnode) {\r\n\tlet props = extend({}, vnode.attributes)\r\n\tprops.children = vnode.children\r\n\r\n\tlet defaultProps = vnode.nodeName.defaultProps\r\n\tif (defaultProps!==undefined) {\r\n\t\tfor (let i in defaultProps) {\r\n\t\t\tif (props[i]===undefined) {\r\n\t\t\t\tprops[i] = defaultProps[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n","import { IS_NON_DIMENSIONAL } from '../constants'\r\nimport { applyRef } from '../util'\r\nimport options from '../options'\r\n\r\n/**\r\n * A DOM event listener\r\n * @typedef {(e: Event) => void} EventListner\r\n */\r\n\r\n/**\r\n * A mapping of event types to event listeners\r\n * @typedef {Object.} EventListenerMap\r\n */\r\n\r\n/**\r\n * Properties Preact adds to elements it creates\r\n * @typedef PreactElementExtensions\r\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\r\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\r\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\r\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\r\n */\r\n\r\n/**\r\n * A DOM element that has been extended with Preact properties\r\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\r\n */\r\n\r\n/**\r\n * Create an element with the given nodeName.\r\n * @param {string} nodeName The DOM node to create\r\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\r\n * namespace.\r\n * @returns {PreactElement} The created DOM node\r\n */\r\nexport function createNode(nodeName, isSvg) {\r\n\t/** @type {PreactElement} */\r\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName)\r\n\tnode.normalizedNodeName = nodeName\r\n\treturn node\r\n}\r\n\r\n\r\n/**\r\n * Remove a child node from its parent if attached.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode\r\n\tif (parentNode) parentNode.removeChild(node)\r\n}\r\n\r\n\r\n/**\r\n * Set a named attribute on the given Node, with special behavior for some names\r\n * and event handlers. If `value` is `null`, the attribute/handler will be\r\n * removed.\r\n * @param {PreactElement} node An element to mutate\r\n * @param {string} name The name/key to set, such as an event or attribute name\r\n * @param {*} old The last value that was set for this name/node pair\r\n * @param {*} value An attribute value, such as a function to be used as an\r\n * event handler\r\n * @param {boolean} isSvg Are we currently diffing inside an svg?\r\n * @private\r\n */\r\nexport function setAccessor(node, name, old, value, isSvg) {\r\n\tif (name==='className') name = 'class'\r\n\r\n\r\n\tif (name==='key') {\r\n\t\t// ignore\r\n\t}\r\n\telse if (name==='ref') {\r\n\t\tapplyRef(old, null)\r\n\t\tapplyRef(value, node)\r\n\t}\r\n\telse if (name==='class' && !isSvg) {\r\n\t\tnode.className = value || ''\r\n\t}\r\n\telse if (name==='style') {\r\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\r\n\t\t\tnode.style.cssText = value || ''\r\n\t\t}\r\n\t\tif (value && typeof value==='object') {\r\n\t\t\tif (typeof old!=='string') {\r\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = ''\r\n\t\t\t}\r\n\t\t\tfor (let i in value) {\r\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if (name==='dangerouslySetInnerHTML') {\r\n\t\tif (value) node.innerHTML = value.__html || ''\r\n\t}\r\n\telse if (name[0]=='o' && name[1]=='n') {\r\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''))\r\n\t\tname = name.toLowerCase().substring(2)\r\n\t\tif (value) {\r\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\t(node._listeners || (node._listeners = {}))[name] = value\r\n\t}\r\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\r\n\t\t// Attempt to set a DOM property to the given value.\r\n\t\t// IE & FF throw for certain property-value combinations.\r\n\t\ttry {\r\n\t\t\tnode[name] = value==null ? '' : value\r\n\t\t} catch (e) { }\r\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name)\r\n\t}\r\n\telse {\r\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')))\r\n\t\t// spellcheck is treated differently than all other boolean values and\r\n\t\t// should not be removed when the value is `false`. See:\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\r\n\t\tif (value==null || value===false) {\r\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase())\r\n\t\t\telse node.removeAttribute(name)\r\n\t\t}\r\n\t\telse if (typeof value === 'string') {\r\n\t\t\tif (ns) {\r\n\t\t\t\tnode.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(name, value)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\treturn this._listeners[e.type](options.event && options.event(e) || e)\r\n}","import { ATTR_KEY } from '../constants'\r\nimport { isSameNodeType, isNamedNode } from './index'\r\nimport { createNode, setAccessor } from '../dom/index'\r\nimport { npn } from '../util'\r\nimport { removeNode } from '../dom/index'\r\n\r\n/** Queue of components that have been mounted and are awaiting componentDidMount */\r\nexport const mounts = []\r\n\r\n/** Diff recursion count, used to track the end of the diff cycle. */\r\nexport let diffLevel = 0\r\n\r\n/** Global flag indicating if the diff is currently within an SVG */\r\nlet isSvgMode = false\r\n\r\n/** Global flag indicating if the diff is performing hydration */\r\nlet hydrating = false\r\n\r\n\r\n\r\n\r\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\r\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\r\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\r\n *\t@returns {Element} dom\t\t\tThe created/mutated element\r\n *\t@private\r\n */\r\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\r\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\r\n\tif (!diffLevel++) {\r\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\r\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined\r\n\r\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\r\n\t\thydrating = dom!=null && !(ATTR_KEY in dom)\r\n\t}\r\n\r\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot)\r\n\r\n\t// append the element if its a new parent\r\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret)\r\n\r\n\t// diffLevel being reduced to 0 means we're exiting the diff\r\n\tif (!--diffLevel) {\r\n\t\thydrating = false\r\n\t\t// invoke queued componentDidMount lifecycle methods\r\n\t\t\r\n\t}\r\n\r\n\treturn ret\r\n}\r\n\r\n\r\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\r\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\r\n\tlet out = dom,\r\n\t\tprevSvgMode = isSvgMode\r\n\r\n\t// empty values (null, undefined, booleans) render as empty Text nodes\r\n\tif (vnode==null || typeof vnode==='boolean') vnode = ''\r\n\r\n\r\n\t// Fast case: Strings & Numbers create/update Text nodes.\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\r\n\t\t// update if it's already a Text node:\r\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\r\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\r\n\t\t\tif (dom.nodeValue!=vnode) {\r\n\t\t\t\tdom.nodeValue = vnode\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\r\n\t\t\tout = document.createTextNode(vnode)\r\n\t\t\tif (dom) {\r\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\t\t\t\trecollectNodeTree(dom, true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tout[ATTR_KEY] = true\r\n\r\n\t\treturn out\r\n\t}\r\n\r\n\r\n\t// If the VNode represents a Component, perform a component diff:\r\n\tlet vnodeName = vnode.nodeName\r\n\t\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode\r\n\r\n\r\n\t// If there's no existing element or it's the wrong type, create a new one:\r\n\tvnodeName = String(vnodeName)\r\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\r\n\t\tout = createNode(vnodeName, isSvgMode)\r\n\r\n\t\tif (dom) {\r\n\t\t\t// move children into the replacement node\r\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild)\r\n\r\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\r\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\r\n\t\t\t// recycle the old element (skips non-Element node types)\r\n\t\t\trecollectNodeTree(dom, true)\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tlet fc = out.firstChild,\r\n\t\tprops = out[ATTR_KEY],\r\n\t\tvchildren = vnode.children\r\n\r\n\tif (props==null) {\r\n\t\tprops = out[ATTR_KEY] = {}\r\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value\r\n\t}\r\n\r\n\t// Optimization: fast-path for elements containing a single TextNode:\r\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\r\n\t\tif (fc.nodeValue!=vchildren[0]) {\r\n\t\t\tfc.nodeValue = vchildren[0]\r\n\t\t}\r\n\t}\r\n\t// otherwise, if there are existing or new children, diff them:\r\n\telse if (vchildren && vchildren.length || fc!=null) {\r\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null)\r\n\t}\r\n\r\n\r\n\t// Apply attributes/props from VNode to the DOM Element:\r\n\tdiffAttributes(out, vnode.attributes, props)\r\n\r\n\r\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\r\n\tisSvgMode = prevSvgMode\r\n\r\n\treturn out\r\n}\r\n\r\n\r\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\r\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\r\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\r\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\r\n *\t@param {Boolean} mountAll\r\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\r\n */\r\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\r\n\tlet originalChildren = dom.childNodes,\r\n\t\tchildren = [],\r\n\t\tkeyed = {},\r\n\t\tkeyedLen = 0,\r\n\t\tmin = 0,\r\n\t\tlen = originalChildren.length,\r\n\t\tchildrenLen = 0,\r\n\t\tvlen = vchildren ? vchildren.length : 0,\r\n\t\tj, c, f, vchild, child\r\n\r\n\t// Build up a map of keyed children and an Array of unkeyed children:\r\n\tif (len!==0) {\r\n\t\tfor (let i=0; i {\n\t\t\tthis.isRecording && this.patches.push(operation)\n\t\t\tthis.userCallback && this.userCallback(operation)\n\t\t}\n\t\tthis.isObserving = true\n\t}\n\tfunction pause() {\n\t\tthis.defaultCallback = () => {}\n\t\tthis.isObserving = false\n\t}\n\t/**\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\tfunction JSONPatcherProxy(root, showDetachedWarning) {\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.isObserving = false\n\t\tthis.proxifiedObjectsMap = new Map()\n\t\tthis.parenthoodMap = new Map()\n\t\t// default to true\n\t\tif (typeof showDetachedWarning !== 'boolean') {\n\t\t\tshowDetachedWarning = true\n\t\t}\n\n\t\tthis.showDetachedWarning = showDetachedWarning\n\t\tthis.originalObject = root\n\t\tthis.cachedProxy = null\n\t\tthis.isRecording = false\n\t\tthis.userCallback\n\t\t/**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n\t\tthis.resume = resume.bind(this)\n\t\t/**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n\t\tthis.pause = pause.bind(this)\n\t}\n\n\tJSONPatcherProxy.prototype.generateProxyAtPath = function(parent, obj, path) {\n\t\tif (!obj) {\n\t\t\treturn obj\n\t\t}\n\t\tconst traps = {\n\t\t\tset: (target, key, value, receiver) =>\n\t\t\t\tsetTrap(this, target, key, value, receiver),\n\t\t\tdeleteProperty: (target, key) => deleteTrap(this, target, key)\n\t\t}\n\t\tconst revocableInstance = Proxy.revocable(obj, traps)\n\t\t// cache traps object to disable them later.\n\t\trevocableInstance.trapsInstance = traps\n\t\trevocableInstance.originalObject = obj\n\n\t\t/* keeping track of object's parent and path */\n\n\t\tthis.parenthoodMap.set(obj, { parent, path })\n\n\t\t/* keeping track of all the proxies to be able to revoke them later */\n\t\tthis.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance)\n\t\treturn revocableInstance.proxy\n\t}\n\t// grab tree's leaves one by one, encapsulate them into a proxy and return\n\tJSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function(\n\t\tparent,\n\t\troot,\n\t\tpath\n\t) {\n\t\tfor (let key in root) {\n\t\t\tif (root.hasOwnProperty(key)) {\n\t\t\t\tif (root[key] instanceof Object) {\n\t\t\t\t\troot[key] = this._proxifyObjectTreeRecursively(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\troot[key],\n\t\t\t\t\t\tescapePathComponent(key)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.generateProxyAtPath(parent, root, path)\n\t}\n\t// this function is for aesthetic purposes\n\tJSONPatcherProxy.prototype.proxifyObjectTree = function(root) {\n\t\t/*\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\t\tthis.pause()\n\t\tthis.isProxifyingTreeNow = true\n\t\tconst proxifiedObject = this._proxifyObjectTreeRecursively(\n\t\t\tundefined,\n\t\t\troot,\n\t\t\t''\n\t\t)\n\t\t/* OK you can record now */\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.resume()\n\t\treturn proxifiedObject\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTrapsForProxy = function(\n\t\trevokableProxyInstance\n\t) {\n\t\tif (this.showDetachedWarning) {\n\t\t\tconst message =\n \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\"\n\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.deleteProperty = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey\n\t\t\t) => {\n\t\t\t\treturn Reflect.deleteProperty(targetObject, propKey)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete revokableProxyInstance.trapsInstance.set\n\t\t\tdelete revokableProxyInstance.trapsInstance.get\n\t\t\tdelete revokableProxyInstance.trapsInstance.deleteProperty\n\t\t}\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.observe = function(record, callback) {\n\t\tif (!record && !callback) {\n\t\t\tthrow new Error('You need to either record changes or pass a callback')\n\t\t}\n\t\tthis.isRecording = record\n\t\tthis.userCallback = callback\n\t\t/*\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\t\tif (record) this.patches = []\n\t\tthis.cachedProxy = this.proxifyObjectTree(this.originalObject)\n\t\treturn this.cachedProxy\n\t}\n\t/**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n\tJSONPatcherProxy.prototype.generate = function() {\n\t\tif (!this.isRecording) {\n\t\t\tthrow new Error('You should set record to true to get patches later')\n\t\t}\n\t\treturn this.patches.splice(0, this.patches.length)\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.revoke = function() {\n\t\tthis.proxifiedObjectsMap.forEach(el => {\n\t\t\tel.revoke()\n\t\t})\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTraps = function() {\n\t\tthis.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this)\n\t}\n\treturn JSONPatcherProxy\n})()\n\nexport default JSONPatcherProxy","\r\nimport { diff } from './vdom/diff'\r\nimport options from './options'\r\nimport JSONProxy from './proxy'\r\n\r\nlet timeout = null\r\nlet patchs = {}\r\n\r\nconst handler = function (patch) {\r\n\r\n\tclearTimeout(timeout)\r\n\tif (patch.op === 'remove') {//fix arr splice\r\n\t\tconst kv = getArrayPatch(patch.path)\r\n\t\tpatchs[kv.k] = kv.v\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t} else {\r\n\t\tconst key = fixPath(patch.path)\r\n\t\tpatchs[key] = patch.value\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t}\r\n}\r\n\r\nexport function render(vnode, parent, store) {\r\n\tparent = typeof parent === 'string' ? document.querySelector(parent) : parent\r\n\tif (store) {\r\n\t\tstore.instances = []\r\n\t\textendStoreUpate(store)\r\n\t\toptions.store = store\r\n\t\tstore.data = new JSONProxy(store.data).observe(true, handler)\r\n\t}\r\n\tdiff(null, vnode, {}, false, parent, false)\r\n}\r\n\r\nfunction update(patch) {\r\n\toptions.store.update(patch)\r\n}\r\n\r\nfunction extendStoreUpate(store) {\r\n\tstore.update = function (patch) {\r\n\t\tconst updateAll = matchGlobalData(this.globalData, patch)\r\n\r\n\t\tif (Object.keys(patch).length > 0) {\r\n\t\t\tthis.instances.forEach(instance => {\r\n\t\t\t\tif (updateAll || this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath)) {\r\n\t\t\t\t\tinstance.update()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tthis.onChange && this.onChange(patch)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function matchGlobalData(globalData, diffResult) {\r\n\tif (!globalData) return false\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (globalData.indexOf(keyA) > -1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let i = 0, len = globalData.length; i < len; i++) {\r\n\t\t\tif (includePath(keyA, globalData[i])) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nexport function needUpdate(diffResult, updatePath) {\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (updatePath[keyA]) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let keyB in updatePath) {\r\n\t\t\tif (includePath(keyA, keyB)) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction includePath(pathA, pathB) {\r\n\tif (pathA.indexOf(pathB) === 0) {\r\n\t\tconst next = pathA.substr(pathB.length, 1)\r\n\t\tif (next === '[' || next === '.') {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nexport function fixPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index) {\r\n\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmpPath += item\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}\r\n\r\nfunction getArrayPatch(path) {\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tlet current = options.store.data[arr[0]]\r\n\tfor (let i = 1, len = arr.length; i < len - 1; i++) {\r\n\t\tcurrent = current[arr[i]]\r\n\t}\r\n\treturn { k: fixArrPath(path), v: current }\r\n}\r\n\r\nfunction fixArrPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tconst len = arr.length\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index < len - 1) {\r\n\t\t\tif (index) {\r\n\t\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += item\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}","const OBJECTTYPE = '[object Object]'\r\nconst ARRAYTYPE = '[object Array]'\r\n\r\nexport function define(name, ctor) {\r\n\tcustomElements.define(name, ctor)\r\n\tif (ctor.data && !ctor.pure) {\r\n\t\tctor.updatePath = getUpdatePath(ctor.data)\r\n\t}\r\n}\r\n\r\nexport function getUpdatePath(data) {\r\n\tconst result = {}\r\n\tdataToPath(data, result)\r\n\treturn result\r\n}\r\n\r\nfunction dataToPath(data, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[key] = true\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _objToPath(data, path, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[path + '.' + key] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], path + '.' + key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], path + '.' + key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _arrayToPath(data, path, result) {\r\n\tdata.forEach((item, index) => {\r\n\t\tresult[path + '[' + index + ']'] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(item)\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(item, path + '[' + index + ']', result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(item, path + '[' + index + ']', result)\r\n\t\t}\r\n\t})\r\n}","import { define } from './define'\r\n\r\nexport function tag(name, pure) {\r\n\treturn function (target) {\r\n\t\ttarget.pure = pure\r\n\t\tdefine(name, target)\r\n\t}\r\n}","import { h, h as createElement } from './h'\r\nimport options from './options'\r\nimport WeElement from './we-element'\r\nimport { render } from './render'\r\nimport { define } from './define'\r\nimport { tag } from './tag'\r\n\r\noptions.root.Omi = {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\noptions.root.Omi.version = '4.0.0'\r\n\r\nexport default {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\nexport {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\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","innerText","npn","str","replace","$","$1","toUpperCase","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","isArray","obj","toString","call","nProps","props","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","ownerSVGElement","ret","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","WeElement","data","connectedCallback","instances","install","shadowRoot","attachShadow","mode","host","render","pure","installed","disconnectedCallback","uninstall","splice","beforeUpdate","afterUpdate","fire","dispatchEvent","CustomEvent","detail","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","revoke","el","disableTraps","timeout","patchs","handler","patch","clearTimeout","kv","getArrayPatch","k","v","fixPath","querySelector","extendStoreUpate","JSONProxy","updateAll","matchGlobalData","globalData","updatePath","needUpdate","onChange","diffResult","keyA","includePath","keyB","pathA","pathB","substr","mpPath","arr","split","item","index","isNaN","fixArrPath","OBJECTTYPE","ARRAYTYPE","define","ctor","getUpdatePath","dataToPath","_objToPath","_arrayToPath","tag","Omi","version","module","exports"],"mappings":";;;;;;;;;;;CAAA;AACA,CAAO,SAASA,KAAT,GAAiB;;CCDxB,SAASC,SAAT,GAAqB;CACpB,KAAI,OAAOC,MAAP,KAAkB,QAAlB,IAA8B,CAACA,MAA/B,IAAyCA,OAAOC,IAAP,KAAgBA,IAAzD,IAAiED,OAAOE,KAAP,KAAiBA,KAAtF,EAA6F;CAC5F,MAAI,OAAOC,IAAP,KAAgB,WAApB,EAAiC;CAChC,UAAOA,IAAP;CACA,GAFD,MAEO,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;CACzC,UAAOA,MAAP;CACA,GAFM,MAEA,IAAI,OAAOJ,MAAP,KAAkB,WAAtB,EAAmC;CACzC,UAAOA,MAAP;CACA;CACD,SAAQ,YAAU;CACjB,UAAO,IAAP;CACA,GAFM,EAAP;CAIA;CACD,QAAOA,MAAP;CACA;;CAED;;;;AAIA,eAAe;;CAEdK,QAAO,IAFO;;CAIdC,OAAMP;CACN;CACA;;;;;CAKA;;CAEA;;;CAGA;;CAEA;CACA;;CAEA;CACA;;CAEA;CACA;CAzBc,CAAf;;KClB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F,KAAb,GAAqB,GAAxC,EAA6C1N,MAA7C;CACA;CACD,EATD;CAUA;;UClDeqO,GAAT,CAAalN,IAAb,EAAmBoF,IAAnB,EAAyB;CAC/B,QAAO,UAAU4B,MAAV,EAAkB;CACxBA,SAAO5B,IAAP,GAAcA,IAAd;CACAwH,SAAO5M,IAAP,EAAagH,MAAb;CACA,EAHD;CAIA;;SCAO9L,IAAR,CAAaiS,GAAb,GAAmB;CAClBD,SADkB;CAElBxI,qBAFkB;CAGlBS,eAHkB;CAIlB9J,KAJkB;CAKlBgC,iBALkB;CAMlBhB,iBANkB;CAOlBuQ;CAPkB,CAAnB;;CAUAvQ,QAAQnB,IAAR,CAAaiS,GAAb,CAAiBC,OAAjB,GAA2B,OAA3B;;AAEA,WAAe;CACdF,SADc;CAEdxI,qBAFc;CAGdS,eAHc;CAId9J,KAJc;CAKdgC,iBALc;CAMdhB,iBANc;CAOduQ;CAPc,CAAf;;CCjBI,IAAI,OAAOS,MAAP,IAAe,WAAnB,EAAgCA,OAAOC,OAAP,GAAiBH,GAAjB,CAAhC,KACKpS,KAAKoS,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 aa6892748..141697559 100644 --- a/packages/omi/dist/omi.esm.js +++ b/packages/omi/dist/omi.esm.js @@ -1058,10 +1058,6 @@ var JSONPatcherProxy = function () { }; return JSONPatcherProxy; }(); -if (typeof module !== 'undefined') { - module.exports = JSONPatcherProxy; - module.exports.default = JSONPatcherProxy; -} var timeout = null; var patchs = {}; diff --git a/packages/omi/dist/omi.esm.js.map b/packages/omi/dist/omi.esm.js.map index 29f291de5..9ec95c083 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/we-element.js","../src/proxy.js","../src/render.js","../src/define.js","../src/tag.js","../src/omi.js"],"sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","function getGlobal() {\r\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\r\n\t\tif (typeof self !== 'undefined') {\r\n\t\t\treturn self\r\n\t\t} else if (typeof window !== 'undefined') {\r\n\t\t\treturn window\r\n\t\t} else if (typeof global !== 'undefined') {\r\n\t\t\treturn global\r\n\t\t}\r\n\t\treturn (function(){\r\n\t\t\treturn this\r\n\t\t})()\r\n\t\t\r\n\t}\r\n\treturn global\r\n}\r\n\r\n/** Global options\r\n *\t@public\r\n *\t@namespace options {Object}\r\n */\r\nexport default {\r\n\r\n\tstore: null,\r\n\t\r\n\troot: getGlobal()\r\n\t//componentChange(component, element) { },\r\n\t/** If `true`, `prop` changes trigger synchronous component updates.\r\n\t *\t@name syncComponentUpdates\r\n\t *\t@type Boolean\r\n\t *\t@default true\r\n\t */\r\n\t//syncComponentUpdates: true,\r\n\r\n\t/** Processes all created VNodes.\r\n\t *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\r\n\t */\r\n\t//vnode(vnode) { }\r\n\r\n\t/** Hook invoked after a component is mounted. */\r\n\t//afterMount(component) { },\r\n\r\n\t/** Hook invoked after the DOM is updated with a component's latest render. */\r\n\t//afterUpdate(component) { }\r\n\r\n\t/** Hook invoked immediately before a component is unmounted. */\r\n\t// beforeUnmount(component) { }\r\n}\r\n","import { VNode } from './vnode'\r\nimport options from './options'\r\n\r\nconst stack = []\r\nconst EMPTY_CHILDREN = []\r\n\r\nexport function h(nodeName, attributes) {\r\n\tlet children = EMPTY_CHILDREN, lastSimple, child, simple, i\r\n\tfor (i = arguments.length; i-- > 2;) {\r\n\t\tstack.push(arguments[i])\r\n\t}\r\n\tif (attributes && attributes.children != null) {\r\n\t\tif (!stack.length) stack.push(attributes.children)\r\n\t\tdelete attributes.children\r\n\t}\r\n\twhile (stack.length) {\r\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\r\n\t\t\tfor (i = child.length; i--;) stack.push(child[i])\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (typeof child === 'boolean') child = null\r\n\r\n\t\t\tif ((simple = typeof nodeName !== 'function')) {\r\n\t\t\t\tif (child == null) child = ''\r\n\t\t\t\telse if (typeof child === 'number') child = String(child)\r\n\t\t\t\telse if (typeof child !== 'string') simple = false\r\n\t\t\t}\r\n\r\n\t\t\tif (simple && lastSimple) {\r\n\t\t\t\tchildren[children.length - 1] += child\r\n\t\t\t}\r\n\t\t\telse if (children === EMPTY_CHILDREN) {\r\n\t\t\t\tchildren = [child]\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tchildren.push(child)\r\n\t\t\t}\r\n\r\n\t\t\tlastSimple = simple\r\n\t\t}\r\n\t}\r\n\r\n\tlet p = new VNode()\r\n\tp.nodeName = nodeName\r\n\tp.children = children\r\n\tp.attributes = attributes == null ? undefined : attributes\r\n\tp.key = attributes == null ? undefined : attributes.key\r\n\r\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\r\n\tif (options.vnode !== undefined) options.vnode(p)\r\n\r\n\treturn p\r\n}","/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n/**\r\n * This shim allows elements written in, or compiled to, ES5 to work on native\r\n * implementations of Custom Elements v1. It sets new.target to the value of\r\n * this.constructor so that the native HTMLElement constructor can access the\r\n * current under-construction element's definition.\r\n */\r\n(function() {\r\n\tif (\r\n\t// No Reflect, no classes, no need for shim because native custom elements\r\n\t// require ES2015 classes or Reflect.\r\n\t\twindow.Reflect === undefined ||\r\n window.customElements === undefined ||\r\n // The webcomponentsjs custom elements polyfill doesn't require\r\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\r\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')\r\n\t) {\r\n\t\treturn\r\n\t}\r\n\tconst BuiltInHTMLElement = HTMLElement\r\n\twindow.HTMLElement = function HTMLElement() {\r\n\t\treturn Reflect.construct(BuiltInHTMLElement, [], this.constructor)\r\n\t}\r\n\tHTMLElement.prototype = BuiltInHTMLElement.prototype\r\n\tHTMLElement.prototype.constructor = HTMLElement\r\n\tObject.setPrototypeOf(HTMLElement, BuiltInHTMLElement)\r\n})()\r\n\r\n\r\n\r\nexport function cssToDom(css) {\r\n\tconst node = document.createElement('style')\r\n\tnode.innerText = css\r\n\treturn node\r\n}\r\n\r\n\r\nexport function npn(str) {\r\n\treturn str.replace(/-(\\w)/g, ($, $1) => {\r\n\t\treturn $1.toUpperCase()\r\n\t})\r\n}\r\n\r\nexport function extend(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i]\r\n\treturn obj\r\n}\r\n\r\n/** Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} [ref=null]\r\n * @param {any} [value]\r\n */\r\nexport function applyRef(ref, value) {\r\n\tif (ref!=null) {\r\n\t\tif (typeof ref=='function') ref(value)\r\n\t\telse ref.current = value\r\n\t}\r\n}\r\n\r\n/**\r\n * Call a function asynchronously, as soon as possible. Makes\r\n * use of HTML Promise to schedule the callback if available,\r\n * otherwise falling back to `setTimeout` (mainly for IE<11).\r\n * @type {(callback: function) => void}\r\n */\r\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout\r\n\r\nexport function isArray(obj){\r\n\treturn Object.prototype.toString.call(obj) === '[object Array]'\r\n}\r\n\r\nexport function nProps(props){\r\n\tif (!props || isArray(props)) return {}\r\n\tconst result = {}\r\n\tObject.keys(props).forEach(key =>{\r\n\t\tresult[key] = props[key].value\r\n\t})\r\n\treturn result\r\n}\r\n","// render modes\r\n\r\nexport const NO_RENDER = 0\r\nexport const SYNC_RENDER = 1\r\nexport const FORCE_RENDER = 2\r\nexport const ASYNC_RENDER = 3\r\n\r\n\r\nexport const ATTR_KEY = '__preactattr_'\r\n\r\n// DOM properties that should NOT have \"px\" added when numeric\r\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\r\n\r\n","import { extend } from '../util'\r\n\r\n\r\n/**\r\n * Check if two nodes are equivalent.\r\n *\r\n * @param {Node} node\t\t\tDOM Node to compare\r\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\r\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\r\n * @private\r\n */\r\nexport function isSameNodeType(node, vnode, hydrating) {\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\t\treturn node.splitText!==undefined\r\n\t}\r\n\tif (typeof vnode.nodeName==='string') {\r\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName)\r\n\t}\r\n\treturn hydrating || node._componentConstructor===vnode.nodeName\r\n}\r\n\r\n\r\n/**\r\n * Check if an Element has a given nodeName, case-insensitively.\r\n *\r\n * @param {Element} node\tA DOM Element to inspect the name of.\r\n * @param {String} nodeName\tUnnormalized name to compare against.\r\n */\r\nexport function isNamedNode(node, nodeName) {\r\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase()\r\n}\r\n\r\n\r\n/**\r\n * Reconstruct Component-style `props` from a VNode.\r\n * Ensures default/fallback values from `defaultProps`:\r\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\r\n *\r\n * @param {VNode} vnode\r\n * @returns {Object} props\r\n */\r\nexport function getNodeProps(vnode) {\r\n\tlet props = extend({}, vnode.attributes)\r\n\tprops.children = vnode.children\r\n\r\n\tlet defaultProps = vnode.nodeName.defaultProps\r\n\tif (defaultProps!==undefined) {\r\n\t\tfor (let i in defaultProps) {\r\n\t\t\tif (props[i]===undefined) {\r\n\t\t\t\tprops[i] = defaultProps[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n","import { IS_NON_DIMENSIONAL } from '../constants'\r\nimport { applyRef } from '../util'\r\nimport options from '../options'\r\n\r\n/**\r\n * A DOM event listener\r\n * @typedef {(e: Event) => void} EventListner\r\n */\r\n\r\n/**\r\n * A mapping of event types to event listeners\r\n * @typedef {Object.} EventListenerMap\r\n */\r\n\r\n/**\r\n * Properties Preact adds to elements it creates\r\n * @typedef PreactElementExtensions\r\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\r\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\r\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\r\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\r\n */\r\n\r\n/**\r\n * A DOM element that has been extended with Preact properties\r\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\r\n */\r\n\r\n/**\r\n * Create an element with the given nodeName.\r\n * @param {string} nodeName The DOM node to create\r\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\r\n * namespace.\r\n * @returns {PreactElement} The created DOM node\r\n */\r\nexport function createNode(nodeName, isSvg) {\r\n\t/** @type {PreactElement} */\r\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName)\r\n\tnode.normalizedNodeName = nodeName\r\n\treturn node\r\n}\r\n\r\n\r\n/**\r\n * Remove a child node from its parent if attached.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode\r\n\tif (parentNode) parentNode.removeChild(node)\r\n}\r\n\r\n\r\n/**\r\n * Set a named attribute on the given Node, with special behavior for some names\r\n * and event handlers. If `value` is `null`, the attribute/handler will be\r\n * removed.\r\n * @param {PreactElement} node An element to mutate\r\n * @param {string} name The name/key to set, such as an event or attribute name\r\n * @param {*} old The last value that was set for this name/node pair\r\n * @param {*} value An attribute value, such as a function to be used as an\r\n * event handler\r\n * @param {boolean} isSvg Are we currently diffing inside an svg?\r\n * @private\r\n */\r\nexport function setAccessor(node, name, old, value, isSvg) {\r\n\tif (name==='className') name = 'class'\r\n\r\n\r\n\tif (name==='key') {\r\n\t\t// ignore\r\n\t}\r\n\telse if (name==='ref') {\r\n\t\tapplyRef(old, null)\r\n\t\tapplyRef(value, node)\r\n\t}\r\n\telse if (name==='class' && !isSvg) {\r\n\t\tnode.className = value || ''\r\n\t}\r\n\telse if (name==='style') {\r\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\r\n\t\t\tnode.style.cssText = value || ''\r\n\t\t}\r\n\t\tif (value && typeof value==='object') {\r\n\t\t\tif (typeof old!=='string') {\r\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = ''\r\n\t\t\t}\r\n\t\t\tfor (let i in value) {\r\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if (name==='dangerouslySetInnerHTML') {\r\n\t\tif (value) node.innerHTML = value.__html || ''\r\n\t}\r\n\telse if (name[0]=='o' && name[1]=='n') {\r\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''))\r\n\t\tname = name.toLowerCase().substring(2)\r\n\t\tif (value) {\r\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\t(node._listeners || (node._listeners = {}))[name] = value\r\n\t}\r\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\r\n\t\t// Attempt to set a DOM property to the given value.\r\n\t\t// IE & FF throw for certain property-value combinations.\r\n\t\ttry {\r\n\t\t\tnode[name] = value==null ? '' : value\r\n\t\t} catch (e) { }\r\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name)\r\n\t}\r\n\telse {\r\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')))\r\n\t\t// spellcheck is treated differently than all other boolean values and\r\n\t\t// should not be removed when the value is `false`. See:\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\r\n\t\tif (value==null || value===false) {\r\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase())\r\n\t\t\telse node.removeAttribute(name)\r\n\t\t}\r\n\t\telse if (typeof value === 'string') {\r\n\t\t\tif (ns) {\r\n\t\t\t\tnode.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(name, value)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\treturn this._listeners[e.type](options.event && options.event(e) || e)\r\n}","import { ATTR_KEY } from '../constants'\r\nimport { isSameNodeType, isNamedNode } from './index'\r\nimport { createNode, setAccessor } from '../dom/index'\r\nimport { npn } from '../util'\r\nimport { removeNode } from '../dom/index'\r\n\r\n/** Queue of components that have been mounted and are awaiting componentDidMount */\r\nexport const mounts = []\r\n\r\n/** Diff recursion count, used to track the end of the diff cycle. */\r\nexport let diffLevel = 0\r\n\r\n/** Global flag indicating if the diff is currently within an SVG */\r\nlet isSvgMode = false\r\n\r\n/** Global flag indicating if the diff is performing hydration */\r\nlet hydrating = false\r\n\r\n\r\n\r\n\r\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\r\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\r\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\r\n *\t@returns {Element} dom\t\t\tThe created/mutated element\r\n *\t@private\r\n */\r\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\r\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\r\n\tif (!diffLevel++) {\r\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\r\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined\r\n\r\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\r\n\t\thydrating = dom!=null && !(ATTR_KEY in dom)\r\n\t}\r\n\r\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot)\r\n\r\n\t// append the element if its a new parent\r\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret)\r\n\r\n\t// diffLevel being reduced to 0 means we're exiting the diff\r\n\tif (!--diffLevel) {\r\n\t\thydrating = false\r\n\t\t// invoke queued componentDidMount lifecycle methods\r\n\t\t\r\n\t}\r\n\r\n\treturn ret\r\n}\r\n\r\n\r\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\r\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\r\n\tlet out = dom,\r\n\t\tprevSvgMode = isSvgMode\r\n\r\n\t// empty values (null, undefined, booleans) render as empty Text nodes\r\n\tif (vnode==null || typeof vnode==='boolean') vnode = ''\r\n\r\n\r\n\t// Fast case: Strings & Numbers create/update Text nodes.\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\r\n\t\t// update if it's already a Text node:\r\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\r\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\r\n\t\t\tif (dom.nodeValue!=vnode) {\r\n\t\t\t\tdom.nodeValue = vnode\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\r\n\t\t\tout = document.createTextNode(vnode)\r\n\t\t\tif (dom) {\r\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\t\t\t\trecollectNodeTree(dom, true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tout[ATTR_KEY] = true\r\n\r\n\t\treturn out\r\n\t}\r\n\r\n\r\n\t// If the VNode represents a Component, perform a component diff:\r\n\tlet vnodeName = vnode.nodeName\r\n\t\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode\r\n\r\n\r\n\t// If there's no existing element or it's the wrong type, create a new one:\r\n\tvnodeName = String(vnodeName)\r\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\r\n\t\tout = createNode(vnodeName, isSvgMode)\r\n\r\n\t\tif (dom) {\r\n\t\t\t// move children into the replacement node\r\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild)\r\n\r\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\r\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\r\n\t\t\t// recycle the old element (skips non-Element node types)\r\n\t\t\trecollectNodeTree(dom, true)\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tlet fc = out.firstChild,\r\n\t\tprops = out[ATTR_KEY],\r\n\t\tvchildren = vnode.children\r\n\r\n\tif (props==null) {\r\n\t\tprops = out[ATTR_KEY] = {}\r\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value\r\n\t}\r\n\r\n\t// Optimization: fast-path for elements containing a single TextNode:\r\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\r\n\t\tif (fc.nodeValue!=vchildren[0]) {\r\n\t\t\tfc.nodeValue = vchildren[0]\r\n\t\t}\r\n\t}\r\n\t// otherwise, if there are existing or new children, diff them:\r\n\telse if (vchildren && vchildren.length || fc!=null) {\r\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null)\r\n\t}\r\n\r\n\r\n\t// Apply attributes/props from VNode to the DOM Element:\r\n\tdiffAttributes(out, vnode.attributes, props)\r\n\r\n\r\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\r\n\tisSvgMode = prevSvgMode\r\n\r\n\treturn out\r\n}\r\n\r\n\r\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\r\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\r\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\r\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\r\n *\t@param {Boolean} mountAll\r\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\r\n */\r\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\r\n\tlet originalChildren = dom.childNodes,\r\n\t\tchildren = [],\r\n\t\tkeyed = {},\r\n\t\tkeyedLen = 0,\r\n\t\tmin = 0,\r\n\t\tlen = originalChildren.length,\r\n\t\tchildrenLen = 0,\r\n\t\tvlen = vchildren ? vchildren.length : 0,\r\n\t\tj, c, f, vchild, child\r\n\r\n\t// Build up a map of keyed children and an Array of unkeyed children:\r\n\tif (len!==0) {\r\n\t\tfor (let i=0; i {\n\t\t\tthis.isRecording && this.patches.push(operation)\n\t\t\tthis.userCallback && this.userCallback(operation)\n\t\t}\n\t\tthis.isObserving = true\n\t}\n\tfunction pause() {\n\t\tthis.defaultCallback = () => {}\n\t\tthis.isObserving = false\n\t}\n\t/**\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\tfunction JSONPatcherProxy(root, showDetachedWarning) {\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.isObserving = false\n\t\tthis.proxifiedObjectsMap = new Map()\n\t\tthis.parenthoodMap = new Map()\n\t\t// default to true\n\t\tif (typeof showDetachedWarning !== 'boolean') {\n\t\t\tshowDetachedWarning = true\n\t\t}\n\n\t\tthis.showDetachedWarning = showDetachedWarning\n\t\tthis.originalObject = root\n\t\tthis.cachedProxy = null\n\t\tthis.isRecording = false\n\t\tthis.userCallback\n\t\t/**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n\t\tthis.resume = resume.bind(this)\n\t\t/**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n\t\tthis.pause = pause.bind(this)\n\t}\n\n\tJSONPatcherProxy.prototype.generateProxyAtPath = function(parent, obj, path) {\n\t\tif (!obj) {\n\t\t\treturn obj\n\t\t}\n\t\tconst traps = {\n\t\t\tset: (target, key, value, receiver) =>\n\t\t\t\tsetTrap(this, target, key, value, receiver),\n\t\t\tdeleteProperty: (target, key) => deleteTrap(this, target, key)\n\t\t}\n\t\tconst revocableInstance = Proxy.revocable(obj, traps)\n\t\t// cache traps object to disable them later.\n\t\trevocableInstance.trapsInstance = traps\n\t\trevocableInstance.originalObject = obj\n\n\t\t/* keeping track of object's parent and path */\n\n\t\tthis.parenthoodMap.set(obj, { parent, path })\n\n\t\t/* keeping track of all the proxies to be able to revoke them later */\n\t\tthis.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance)\n\t\treturn revocableInstance.proxy\n\t}\n\t// grab tree's leaves one by one, encapsulate them into a proxy and return\n\tJSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function(\n\t\tparent,\n\t\troot,\n\t\tpath\n\t) {\n\t\tfor (let key in root) {\n\t\t\tif (root.hasOwnProperty(key)) {\n\t\t\t\tif (root[key] instanceof Object) {\n\t\t\t\t\troot[key] = this._proxifyObjectTreeRecursively(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\troot[key],\n\t\t\t\t\t\tescapePathComponent(key)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.generateProxyAtPath(parent, root, path)\n\t}\n\t// this function is for aesthetic purposes\n\tJSONPatcherProxy.prototype.proxifyObjectTree = function(root) {\n\t\t/*\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\t\tthis.pause()\n\t\tthis.isProxifyingTreeNow = true\n\t\tconst proxifiedObject = this._proxifyObjectTreeRecursively(\n\t\t\tundefined,\n\t\t\troot,\n\t\t\t''\n\t\t)\n\t\t/* OK you can record now */\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.resume()\n\t\treturn proxifiedObject\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTrapsForProxy = function(\n\t\trevokableProxyInstance\n\t) {\n\t\tif (this.showDetachedWarning) {\n\t\t\tconst message =\n \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\"\n\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.deleteProperty = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey\n\t\t\t) => {\n\t\t\t\treturn Reflect.deleteProperty(targetObject, propKey)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete revokableProxyInstance.trapsInstance.set\n\t\t\tdelete revokableProxyInstance.trapsInstance.get\n\t\t\tdelete revokableProxyInstance.trapsInstance.deleteProperty\n\t\t}\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.observe = function(record, callback) {\n\t\tif (!record && !callback) {\n\t\t\tthrow new Error('You need to either record changes or pass a callback')\n\t\t}\n\t\tthis.isRecording = record\n\t\tthis.userCallback = callback\n\t\t/*\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\t\tif (record) this.patches = []\n\t\tthis.cachedProxy = this.proxifyObjectTree(this.originalObject)\n\t\treturn this.cachedProxy\n\t}\n\t/**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n\tJSONPatcherProxy.prototype.generate = function() {\n\t\tif (!this.isRecording) {\n\t\t\tthrow new Error('You should set record to true to get patches later')\n\t\t}\n\t\treturn this.patches.splice(0, this.patches.length)\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.revoke = function() {\n\t\tthis.proxifiedObjectsMap.forEach(el => {\n\t\t\tel.revoke()\n\t\t})\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTraps = function() {\n\t\tthis.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this)\n\t}\n\treturn JSONPatcherProxy\n})()\n\nexport default JSONPatcherProxy\nif (typeof module !== 'undefined') {\n\tmodule.exports = JSONPatcherProxy\n\tmodule.exports.default = JSONPatcherProxy\n}\n","\r\nimport { diff } from './vdom/diff'\r\nimport options from './options'\r\nimport JSONProxy from './proxy'\r\n\r\nlet timeout = null\r\nlet patchs = {}\r\n\r\nconst handler = function (patch) {\r\n\r\n\tclearTimeout(timeout)\r\n\tif (patch.op === 'remove') {//fix arr splice\r\n\t\tconst kv = getArrayPatch(patch.path)\r\n\t\tpatchs[kv.k] = kv.v\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t} else {\r\n\t\tconst key = fixPath(patch.path)\r\n\t\tpatchs[key] = patch.value\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t}\r\n}\r\n\r\nexport function render(vnode, parent, store) {\r\n\tparent = typeof parent === 'string' ? document.querySelector(parent) : parent\r\n\tif (store) {\r\n\t\tstore.instances = []\r\n\t\textendStoreUpate(store)\r\n\t\toptions.store = store\r\n\t\tstore.data = new JSONProxy(store.data).observe(true, handler)\r\n\t}\r\n\tdiff(null, vnode, {}, false, parent, false)\r\n}\r\n\r\nfunction update(patch) {\r\n\toptions.store.update(patch)\r\n}\r\n\r\nfunction extendStoreUpate(store) {\r\n\tstore.update = function (patch) {\r\n\t\tconst updateAll = matchGlobalData(this.globalData, patch)\r\n\r\n\t\tif (Object.keys(patch).length > 0) {\r\n\t\t\tthis.instances.forEach(instance => {\r\n\t\t\t\tif (updateAll || this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath)) {\r\n\t\t\t\t\tinstance.update()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tthis.onChange && this.onChange(patch)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction matchGlobalData(globalData, diffResult) {\r\n\tif (!globalData) return false\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (globalData.indexOf(keyA) > -1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let i = 0, len = globalData.length; i < len; i++) {\r\n\t\t\tif (includePath(keyA, globalData[i])) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction needUpdate(diffResult, updatePath) {\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (updatePath[keyA]) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let keyB in updatePath) {\r\n\t\t\tif (includePath(keyA, keyB)) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction includePath(pathA, pathB) {\r\n\tif (pathA.indexOf(pathB) === 0) {\r\n\t\tconst next = pathA.substr(pathB.length, 1)\r\n\t\tif (next === '[' || next === '.') {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction fixPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index) {\r\n\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmpPath += item\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}\r\n\r\nfunction getArrayPatch(path) {\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tlet current = options.store.data[arr[0]]\r\n\tfor (let i = 1, len = arr.length; i < len - 1; i++) {\r\n\t\tcurrent = current[arr[i]]\r\n\t}\r\n\treturn { k: fixArrPath(path), v: current }\r\n}\r\n\r\nfunction fixArrPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tconst len = arr.length\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index < len - 1) {\r\n\t\t\tif (index) {\r\n\t\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += item\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}","const OBJECTTYPE = '[object Object]'\r\nconst ARRAYTYPE = '[object Array]'\r\n\r\nexport function define(name, ctor) {\r\n\tcustomElements.define(name, ctor)\r\n\tif (ctor.data && !ctor.pure) {\r\n\t\tctor.updatePath = getUpdatePath(ctor.data)\r\n\t}\r\n}\r\n\r\nexport function getUpdatePath(data) {\r\n\tconst result = {}\r\n\tdataToPath(data, result)\r\n\treturn result\r\n}\r\n\r\nfunction dataToPath(data, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[key] = true\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _objToPath(data, path, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[path + '.' + key] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], path + '.' + key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], path + '.' + key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _arrayToPath(data, path, result) {\r\n\tdata.forEach((item, index) => {\r\n\t\tresult[path + '[' + index + ']'] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(item)\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(item, path + '[' + index + ']', result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(item, path + '[' + index + ']', result)\r\n\t\t}\r\n\t})\r\n}","import { define } from './define'\r\n\r\nexport function tag(name, pure) {\r\n\treturn function (target) {\r\n\t\ttarget.pure = pure\r\n\t\tdefine(name, target)\r\n\t}\r\n}","import { h, h as createElement } from './h'\r\nimport options from './options'\r\nimport WeElement from './we-element'\r\nimport { render } from './render'\r\nimport { define } from './define'\r\nimport { tag } from './tag'\r\n\r\noptions.root.Omi = {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\noptions.root.Omi.version = '4.0.0'\r\n\r\nexport default {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\nexport {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\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","innerText","npn","str","replace","$","$1","toUpperCase","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","isArray","obj","Object","toString","call","nProps","props","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","ownerSVGElement","ret","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","WeElement","data","connectedCallback","store","instances","install","shadowRoot","attachShadow","mode","host","render","pure","installed","disconnectedCallback","uninstall","splice","beforeUpdate","afterUpdate","fire","dispatchEvent","CustomEvent","detail","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","revoke","disableTraps","module","exports","default","timeout","patchs","handler","patch","kv","getArrayPatch","k","v","fixPath","querySelector","JSONProxy","extendStoreUpate","updateAll","matchGlobalData","globalData","updatePath","needUpdate","onChange","diffResult","keyA","includePath","keyB","pathA","pathB","substr","mpPath","arr","split","item","index","isNaN","fixArrPath","OBJECTTYPE","ARRAYTYPE","define","ctor","getUpdatePath","dataToPath","_objToPath","_arrayToPath","tag","Omi","version"],"mappings":";;;;;;;;AAAA;AACA,SAAgBA,KAAT,GAAiB;;ACDxB,SAASC,SAAT,GAAqB;KAChB,OAAOC,MAAP,KAAkB,QAAlB,IAA8B,CAACA,MAA/B,IAAyCA,OAAOC,IAAP,KAAgBA,IAAzD,IAAiED,OAAOE,KAAP,KAAiBA,KAAtF,EAA6F;MACxF,OAAOC,IAAP,KAAgB,WAApB,EAAiC;UACzBA,IAAP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azK,GAArC,EAA0CyC,MAA1C;;EAPF;;;AAYD,SAASsO,YAAT,CAAsBxI,IAAtB,EAA4BkC,IAA5B,EAAkChI,MAAlC,EAA0C;MACpCE,OAAL,CAAa,UAACyN,IAAD,EAAOC,KAAP,EAAiB;SACtB5F,OAAO,GAAP,GAAa4F,KAAb,GAAqB,GAA5B,IAAmC,IAAnC;SACO5N,OAAOgI,IAAP,CAAP;MACMzF,OAAO5C,OAAO1B,SAAP,CAAiB2B,QAAjB,CAA0BC,IAA1B,CAA+B8N,IAA/B,CAAb;MACIpL,SAASwL,UAAb,EAAyB;cACbJ,IAAX,EAAiB3F,OAAO,GAAP,GAAa4F,KAAb,GAAqB,GAAtC,EAA2C5N,MAA3C;GADD,MAEO,IAAIuC,SAASyL,SAAb,EAAwB;gBACjBL,IAAb,EAAmB3F,OAAO,GAAP,GAAa4F,KAAb,GAAqB,GAAxC,EAA6C5N,MAA7C;;EAPF;;;SCxCeuO,GAAT,CAAapN,IAAb,EAAmBqF,IAAnB,EAAyB;QACxB,UAAU4B,MAAV,EAAkB;SACjB5B,IAAP,GAAcA,IAAd;SACOrF,IAAP,EAAaiH,MAAb;EAFD;;;QCIOgC,IAAR,CAAaoE,GAAb,GAAmB;SAAA;qBAAA;eAAA;KAAA;iBAAA;iBAAA;;CAAnB;;AAUAhR,QAAQ4M,IAAR,CAAaoE,GAAb,CAAiBC,OAAjB,GAA2B,OAA3B;;AAEA,UAAe;SAAA;qBAAA;eAAA;KAAA;iBAAA;iBAAA;;CAAf;;;"} \ 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/we-element.js","../src/proxy.js","../src/render.js","../src/define.js","../src/tag.js","../src/omi.js"],"sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","function getGlobal() {\r\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\r\n\t\tif (typeof self !== 'undefined') {\r\n\t\t\treturn self\r\n\t\t} else if (typeof window !== 'undefined') {\r\n\t\t\treturn window\r\n\t\t} else if (typeof global !== 'undefined') {\r\n\t\t\treturn global\r\n\t\t}\r\n\t\treturn (function(){\r\n\t\t\treturn this\r\n\t\t})()\r\n\t\t\r\n\t}\r\n\treturn global\r\n}\r\n\r\n/** Global options\r\n *\t@public\r\n *\t@namespace options {Object}\r\n */\r\nexport default {\r\n\r\n\tstore: null,\r\n\t\r\n\troot: getGlobal()\r\n\t//componentChange(component, element) { },\r\n\t/** If `true`, `prop` changes trigger synchronous component updates.\r\n\t *\t@name syncComponentUpdates\r\n\t *\t@type Boolean\r\n\t *\t@default true\r\n\t */\r\n\t//syncComponentUpdates: true,\r\n\r\n\t/** Processes all created VNodes.\r\n\t *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\r\n\t */\r\n\t//vnode(vnode) { }\r\n\r\n\t/** Hook invoked after a component is mounted. */\r\n\t//afterMount(component) { },\r\n\r\n\t/** Hook invoked after the DOM is updated with a component's latest render. */\r\n\t//afterUpdate(component) { }\r\n\r\n\t/** Hook invoked immediately before a component is unmounted. */\r\n\t// beforeUnmount(component) { }\r\n}\r\n","import { VNode } from './vnode'\r\nimport options from './options'\r\n\r\nconst stack = []\r\nconst EMPTY_CHILDREN = []\r\n\r\nexport function h(nodeName, attributes) {\r\n\tlet children = EMPTY_CHILDREN, lastSimple, child, simple, i\r\n\tfor (i = arguments.length; i-- > 2;) {\r\n\t\tstack.push(arguments[i])\r\n\t}\r\n\tif (attributes && attributes.children != null) {\r\n\t\tif (!stack.length) stack.push(attributes.children)\r\n\t\tdelete attributes.children\r\n\t}\r\n\twhile (stack.length) {\r\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\r\n\t\t\tfor (i = child.length; i--;) stack.push(child[i])\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (typeof child === 'boolean') child = null\r\n\r\n\t\t\tif ((simple = typeof nodeName !== 'function')) {\r\n\t\t\t\tif (child == null) child = ''\r\n\t\t\t\telse if (typeof child === 'number') child = String(child)\r\n\t\t\t\telse if (typeof child !== 'string') simple = false\r\n\t\t\t}\r\n\r\n\t\t\tif (simple && lastSimple) {\r\n\t\t\t\tchildren[children.length - 1] += child\r\n\t\t\t}\r\n\t\t\telse if (children === EMPTY_CHILDREN) {\r\n\t\t\t\tchildren = [child]\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tchildren.push(child)\r\n\t\t\t}\r\n\r\n\t\t\tlastSimple = simple\r\n\t\t}\r\n\t}\r\n\r\n\tlet p = new VNode()\r\n\tp.nodeName = nodeName\r\n\tp.children = children\r\n\tp.attributes = attributes == null ? undefined : attributes\r\n\tp.key = attributes == null ? undefined : attributes.key\r\n\r\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\r\n\tif (options.vnode !== undefined) options.vnode(p)\r\n\r\n\treturn p\r\n}","/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n/**\r\n * This shim allows elements written in, or compiled to, ES5 to work on native\r\n * implementations of Custom Elements v1. It sets new.target to the value of\r\n * this.constructor so that the native HTMLElement constructor can access the\r\n * current under-construction element's definition.\r\n */\r\n(function() {\r\n\tif (\r\n\t// No Reflect, no classes, no need for shim because native custom elements\r\n\t// require ES2015 classes or Reflect.\r\n\t\twindow.Reflect === undefined ||\r\n window.customElements === undefined ||\r\n // The webcomponentsjs custom elements polyfill doesn't require\r\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\r\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')\r\n\t) {\r\n\t\treturn\r\n\t}\r\n\tconst BuiltInHTMLElement = HTMLElement\r\n\twindow.HTMLElement = function HTMLElement() {\r\n\t\treturn Reflect.construct(BuiltInHTMLElement, [], this.constructor)\r\n\t}\r\n\tHTMLElement.prototype = BuiltInHTMLElement.prototype\r\n\tHTMLElement.prototype.constructor = HTMLElement\r\n\tObject.setPrototypeOf(HTMLElement, BuiltInHTMLElement)\r\n})()\r\n\r\n\r\n\r\nexport function cssToDom(css) {\r\n\tconst node = document.createElement('style')\r\n\tnode.innerText = css\r\n\treturn node\r\n}\r\n\r\n\r\nexport function npn(str) {\r\n\treturn str.replace(/-(\\w)/g, ($, $1) => {\r\n\t\treturn $1.toUpperCase()\r\n\t})\r\n}\r\n\r\nexport function extend(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i]\r\n\treturn obj\r\n}\r\n\r\n/** Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} [ref=null]\r\n * @param {any} [value]\r\n */\r\nexport function applyRef(ref, value) {\r\n\tif (ref!=null) {\r\n\t\tif (typeof ref=='function') ref(value)\r\n\t\telse ref.current = value\r\n\t}\r\n}\r\n\r\n/**\r\n * Call a function asynchronously, as soon as possible. Makes\r\n * use of HTML Promise to schedule the callback if available,\r\n * otherwise falling back to `setTimeout` (mainly for IE<11).\r\n * @type {(callback: function) => void}\r\n */\r\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout\r\n\r\nexport function isArray(obj){\r\n\treturn Object.prototype.toString.call(obj) === '[object Array]'\r\n}\r\n\r\nexport function nProps(props){\r\n\tif (!props || isArray(props)) return {}\r\n\tconst result = {}\r\n\tObject.keys(props).forEach(key =>{\r\n\t\tresult[key] = props[key].value\r\n\t})\r\n\treturn result\r\n}\r\n","// render modes\r\n\r\nexport const NO_RENDER = 0\r\nexport const SYNC_RENDER = 1\r\nexport const FORCE_RENDER = 2\r\nexport const ASYNC_RENDER = 3\r\n\r\n\r\nexport const ATTR_KEY = '__preactattr_'\r\n\r\n// DOM properties that should NOT have \"px\" added when numeric\r\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\r\n\r\n","import { extend } from '../util'\r\n\r\n\r\n/**\r\n * Check if two nodes are equivalent.\r\n *\r\n * @param {Node} node\t\t\tDOM Node to compare\r\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\r\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\r\n * @private\r\n */\r\nexport function isSameNodeType(node, vnode, hydrating) {\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\t\treturn node.splitText!==undefined\r\n\t}\r\n\tif (typeof vnode.nodeName==='string') {\r\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName)\r\n\t}\r\n\treturn hydrating || node._componentConstructor===vnode.nodeName\r\n}\r\n\r\n\r\n/**\r\n * Check if an Element has a given nodeName, case-insensitively.\r\n *\r\n * @param {Element} node\tA DOM Element to inspect the name of.\r\n * @param {String} nodeName\tUnnormalized name to compare against.\r\n */\r\nexport function isNamedNode(node, nodeName) {\r\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase()\r\n}\r\n\r\n\r\n/**\r\n * Reconstruct Component-style `props` from a VNode.\r\n * Ensures default/fallback values from `defaultProps`:\r\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\r\n *\r\n * @param {VNode} vnode\r\n * @returns {Object} props\r\n */\r\nexport function getNodeProps(vnode) {\r\n\tlet props = extend({}, vnode.attributes)\r\n\tprops.children = vnode.children\r\n\r\n\tlet defaultProps = vnode.nodeName.defaultProps\r\n\tif (defaultProps!==undefined) {\r\n\t\tfor (let i in defaultProps) {\r\n\t\t\tif (props[i]===undefined) {\r\n\t\t\t\tprops[i] = defaultProps[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n","import { IS_NON_DIMENSIONAL } from '../constants'\r\nimport { applyRef } from '../util'\r\nimport options from '../options'\r\n\r\n/**\r\n * A DOM event listener\r\n * @typedef {(e: Event) => void} EventListner\r\n */\r\n\r\n/**\r\n * A mapping of event types to event listeners\r\n * @typedef {Object.} EventListenerMap\r\n */\r\n\r\n/**\r\n * Properties Preact adds to elements it creates\r\n * @typedef PreactElementExtensions\r\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\r\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\r\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\r\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\r\n */\r\n\r\n/**\r\n * A DOM element that has been extended with Preact properties\r\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\r\n */\r\n\r\n/**\r\n * Create an element with the given nodeName.\r\n * @param {string} nodeName The DOM node to create\r\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\r\n * namespace.\r\n * @returns {PreactElement} The created DOM node\r\n */\r\nexport function createNode(nodeName, isSvg) {\r\n\t/** @type {PreactElement} */\r\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName)\r\n\tnode.normalizedNodeName = nodeName\r\n\treturn node\r\n}\r\n\r\n\r\n/**\r\n * Remove a child node from its parent if attached.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode\r\n\tif (parentNode) parentNode.removeChild(node)\r\n}\r\n\r\n\r\n/**\r\n * Set a named attribute on the given Node, with special behavior for some names\r\n * and event handlers. If `value` is `null`, the attribute/handler will be\r\n * removed.\r\n * @param {PreactElement} node An element to mutate\r\n * @param {string} name The name/key to set, such as an event or attribute name\r\n * @param {*} old The last value that was set for this name/node pair\r\n * @param {*} value An attribute value, such as a function to be used as an\r\n * event handler\r\n * @param {boolean} isSvg Are we currently diffing inside an svg?\r\n * @private\r\n */\r\nexport function setAccessor(node, name, old, value, isSvg) {\r\n\tif (name==='className') name = 'class'\r\n\r\n\r\n\tif (name==='key') {\r\n\t\t// ignore\r\n\t}\r\n\telse if (name==='ref') {\r\n\t\tapplyRef(old, null)\r\n\t\tapplyRef(value, node)\r\n\t}\r\n\telse if (name==='class' && !isSvg) {\r\n\t\tnode.className = value || ''\r\n\t}\r\n\telse if (name==='style') {\r\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\r\n\t\t\tnode.style.cssText = value || ''\r\n\t\t}\r\n\t\tif (value && typeof value==='object') {\r\n\t\t\tif (typeof old!=='string') {\r\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = ''\r\n\t\t\t}\r\n\t\t\tfor (let i in value) {\r\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if (name==='dangerouslySetInnerHTML') {\r\n\t\tif (value) node.innerHTML = value.__html || ''\r\n\t}\r\n\telse if (name[0]=='o' && name[1]=='n') {\r\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''))\r\n\t\tname = name.toLowerCase().substring(2)\r\n\t\tif (value) {\r\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\t(node._listeners || (node._listeners = {}))[name] = value\r\n\t}\r\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\r\n\t\t// Attempt to set a DOM property to the given value.\r\n\t\t// IE & FF throw for certain property-value combinations.\r\n\t\ttry {\r\n\t\t\tnode[name] = value==null ? '' : value\r\n\t\t} catch (e) { }\r\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name)\r\n\t}\r\n\telse {\r\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')))\r\n\t\t// spellcheck is treated differently than all other boolean values and\r\n\t\t// should not be removed when the value is `false`. See:\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\r\n\t\tif (value==null || value===false) {\r\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase())\r\n\t\t\telse node.removeAttribute(name)\r\n\t\t}\r\n\t\telse if (typeof value === 'string') {\r\n\t\t\tif (ns) {\r\n\t\t\t\tnode.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(name, value)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\treturn this._listeners[e.type](options.event && options.event(e) || e)\r\n}","import { ATTR_KEY } from '../constants'\r\nimport { isSameNodeType, isNamedNode } from './index'\r\nimport { createNode, setAccessor } from '../dom/index'\r\nimport { npn } from '../util'\r\nimport { removeNode } from '../dom/index'\r\n\r\n/** Queue of components that have been mounted and are awaiting componentDidMount */\r\nexport const mounts = []\r\n\r\n/** Diff recursion count, used to track the end of the diff cycle. */\r\nexport let diffLevel = 0\r\n\r\n/** Global flag indicating if the diff is currently within an SVG */\r\nlet isSvgMode = false\r\n\r\n/** Global flag indicating if the diff is performing hydration */\r\nlet hydrating = false\r\n\r\n\r\n\r\n\r\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\r\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\r\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\r\n *\t@returns {Element} dom\t\t\tThe created/mutated element\r\n *\t@private\r\n */\r\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\r\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\r\n\tif (!diffLevel++) {\r\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\r\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined\r\n\r\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\r\n\t\thydrating = dom!=null && !(ATTR_KEY in dom)\r\n\t}\r\n\r\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot)\r\n\r\n\t// append the element if its a new parent\r\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret)\r\n\r\n\t// diffLevel being reduced to 0 means we're exiting the diff\r\n\tif (!--diffLevel) {\r\n\t\thydrating = false\r\n\t\t// invoke queued componentDidMount lifecycle methods\r\n\t\t\r\n\t}\r\n\r\n\treturn ret\r\n}\r\n\r\n\r\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\r\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\r\n\tlet out = dom,\r\n\t\tprevSvgMode = isSvgMode\r\n\r\n\t// empty values (null, undefined, booleans) render as empty Text nodes\r\n\tif (vnode==null || typeof vnode==='boolean') vnode = ''\r\n\r\n\r\n\t// Fast case: Strings & Numbers create/update Text nodes.\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\r\n\t\t// update if it's already a Text node:\r\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\r\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\r\n\t\t\tif (dom.nodeValue!=vnode) {\r\n\t\t\t\tdom.nodeValue = vnode\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\r\n\t\t\tout = document.createTextNode(vnode)\r\n\t\t\tif (dom) {\r\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\t\t\t\trecollectNodeTree(dom, true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tout[ATTR_KEY] = true\r\n\r\n\t\treturn out\r\n\t}\r\n\r\n\r\n\t// If the VNode represents a Component, perform a component diff:\r\n\tlet vnodeName = vnode.nodeName\r\n\t\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode\r\n\r\n\r\n\t// If there's no existing element or it's the wrong type, create a new one:\r\n\tvnodeName = String(vnodeName)\r\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\r\n\t\tout = createNode(vnodeName, isSvgMode)\r\n\r\n\t\tif (dom) {\r\n\t\t\t// move children into the replacement node\r\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild)\r\n\r\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\r\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\r\n\t\t\t// recycle the old element (skips non-Element node types)\r\n\t\t\trecollectNodeTree(dom, true)\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tlet fc = out.firstChild,\r\n\t\tprops = out[ATTR_KEY],\r\n\t\tvchildren = vnode.children\r\n\r\n\tif (props==null) {\r\n\t\tprops = out[ATTR_KEY] = {}\r\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value\r\n\t}\r\n\r\n\t// Optimization: fast-path for elements containing a single TextNode:\r\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\r\n\t\tif (fc.nodeValue!=vchildren[0]) {\r\n\t\t\tfc.nodeValue = vchildren[0]\r\n\t\t}\r\n\t}\r\n\t// otherwise, if there are existing or new children, diff them:\r\n\telse if (vchildren && vchildren.length || fc!=null) {\r\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null)\r\n\t}\r\n\r\n\r\n\t// Apply attributes/props from VNode to the DOM Element:\r\n\tdiffAttributes(out, vnode.attributes, props)\r\n\r\n\r\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\r\n\tisSvgMode = prevSvgMode\r\n\r\n\treturn out\r\n}\r\n\r\n\r\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\r\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\r\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\r\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\r\n *\t@param {Boolean} mountAll\r\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\r\n */\r\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\r\n\tlet originalChildren = dom.childNodes,\r\n\t\tchildren = [],\r\n\t\tkeyed = {},\r\n\t\tkeyedLen = 0,\r\n\t\tmin = 0,\r\n\t\tlen = originalChildren.length,\r\n\t\tchildrenLen = 0,\r\n\t\tvlen = vchildren ? vchildren.length : 0,\r\n\t\tj, c, f, vchild, child\r\n\r\n\t// Build up a map of keyed children and an Array of unkeyed children:\r\n\tif (len!==0) {\r\n\t\tfor (let i=0; i {\n\t\t\tthis.isRecording && this.patches.push(operation)\n\t\t\tthis.userCallback && this.userCallback(operation)\n\t\t}\n\t\tthis.isObserving = true\n\t}\n\tfunction pause() {\n\t\tthis.defaultCallback = () => {}\n\t\tthis.isObserving = false\n\t}\n\t/**\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\tfunction JSONPatcherProxy(root, showDetachedWarning) {\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.isObserving = false\n\t\tthis.proxifiedObjectsMap = new Map()\n\t\tthis.parenthoodMap = new Map()\n\t\t// default to true\n\t\tif (typeof showDetachedWarning !== 'boolean') {\n\t\t\tshowDetachedWarning = true\n\t\t}\n\n\t\tthis.showDetachedWarning = showDetachedWarning\n\t\tthis.originalObject = root\n\t\tthis.cachedProxy = null\n\t\tthis.isRecording = false\n\t\tthis.userCallback\n\t\t/**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n\t\tthis.resume = resume.bind(this)\n\t\t/**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n\t\tthis.pause = pause.bind(this)\n\t}\n\n\tJSONPatcherProxy.prototype.generateProxyAtPath = function(parent, obj, path) {\n\t\tif (!obj) {\n\t\t\treturn obj\n\t\t}\n\t\tconst traps = {\n\t\t\tset: (target, key, value, receiver) =>\n\t\t\t\tsetTrap(this, target, key, value, receiver),\n\t\t\tdeleteProperty: (target, key) => deleteTrap(this, target, key)\n\t\t}\n\t\tconst revocableInstance = Proxy.revocable(obj, traps)\n\t\t// cache traps object to disable them later.\n\t\trevocableInstance.trapsInstance = traps\n\t\trevocableInstance.originalObject = obj\n\n\t\t/* keeping track of object's parent and path */\n\n\t\tthis.parenthoodMap.set(obj, { parent, path })\n\n\t\t/* keeping track of all the proxies to be able to revoke them later */\n\t\tthis.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance)\n\t\treturn revocableInstance.proxy\n\t}\n\t// grab tree's leaves one by one, encapsulate them into a proxy and return\n\tJSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function(\n\t\tparent,\n\t\troot,\n\t\tpath\n\t) {\n\t\tfor (let key in root) {\n\t\t\tif (root.hasOwnProperty(key)) {\n\t\t\t\tif (root[key] instanceof Object) {\n\t\t\t\t\troot[key] = this._proxifyObjectTreeRecursively(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\troot[key],\n\t\t\t\t\t\tescapePathComponent(key)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.generateProxyAtPath(parent, root, path)\n\t}\n\t// this function is for aesthetic purposes\n\tJSONPatcherProxy.prototype.proxifyObjectTree = function(root) {\n\t\t/*\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\t\tthis.pause()\n\t\tthis.isProxifyingTreeNow = true\n\t\tconst proxifiedObject = this._proxifyObjectTreeRecursively(\n\t\t\tundefined,\n\t\t\troot,\n\t\t\t''\n\t\t)\n\t\t/* OK you can record now */\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.resume()\n\t\treturn proxifiedObject\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTrapsForProxy = function(\n\t\trevokableProxyInstance\n\t) {\n\t\tif (this.showDetachedWarning) {\n\t\t\tconst message =\n \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\"\n\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.deleteProperty = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey\n\t\t\t) => {\n\t\t\t\treturn Reflect.deleteProperty(targetObject, propKey)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete revokableProxyInstance.trapsInstance.set\n\t\t\tdelete revokableProxyInstance.trapsInstance.get\n\t\t\tdelete revokableProxyInstance.trapsInstance.deleteProperty\n\t\t}\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.observe = function(record, callback) {\n\t\tif (!record && !callback) {\n\t\t\tthrow new Error('You need to either record changes or pass a callback')\n\t\t}\n\t\tthis.isRecording = record\n\t\tthis.userCallback = callback\n\t\t/*\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\t\tif (record) this.patches = []\n\t\tthis.cachedProxy = this.proxifyObjectTree(this.originalObject)\n\t\treturn this.cachedProxy\n\t}\n\t/**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n\tJSONPatcherProxy.prototype.generate = function() {\n\t\tif (!this.isRecording) {\n\t\t\tthrow new Error('You should set record to true to get patches later')\n\t\t}\n\t\treturn this.patches.splice(0, this.patches.length)\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.revoke = function() {\n\t\tthis.proxifiedObjectsMap.forEach(el => {\n\t\t\tel.revoke()\n\t\t})\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTraps = function() {\n\t\tthis.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this)\n\t}\n\treturn JSONPatcherProxy\n})()\n\nexport default JSONPatcherProxy","\r\nimport { diff } from './vdom/diff'\r\nimport options from './options'\r\nimport JSONProxy from './proxy'\r\n\r\nlet timeout = null\r\nlet patchs = {}\r\n\r\nconst handler = function (patch) {\r\n\r\n\tclearTimeout(timeout)\r\n\tif (patch.op === 'remove') {//fix arr splice\r\n\t\tconst kv = getArrayPatch(patch.path)\r\n\t\tpatchs[kv.k] = kv.v\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t} else {\r\n\t\tconst key = fixPath(patch.path)\r\n\t\tpatchs[key] = patch.value\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t}\r\n}\r\n\r\nexport function render(vnode, parent, store) {\r\n\tparent = typeof parent === 'string' ? document.querySelector(parent) : parent\r\n\tif (store) {\r\n\t\tstore.instances = []\r\n\t\textendStoreUpate(store)\r\n\t\toptions.store = store\r\n\t\tstore.data = new JSONProxy(store.data).observe(true, handler)\r\n\t}\r\n\tdiff(null, vnode, {}, false, parent, false)\r\n}\r\n\r\nfunction update(patch) {\r\n\toptions.store.update(patch)\r\n}\r\n\r\nfunction extendStoreUpate(store) {\r\n\tstore.update = function (patch) {\r\n\t\tconst updateAll = matchGlobalData(this.globalData, patch)\r\n\r\n\t\tif (Object.keys(patch).length > 0) {\r\n\t\t\tthis.instances.forEach(instance => {\r\n\t\t\t\tif (updateAll || this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath)) {\r\n\t\t\t\t\tinstance.update()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tthis.onChange && this.onChange(patch)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function matchGlobalData(globalData, diffResult) {\r\n\tif (!globalData) return false\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (globalData.indexOf(keyA) > -1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let i = 0, len = globalData.length; i < len; i++) {\r\n\t\t\tif (includePath(keyA, globalData[i])) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nexport function needUpdate(diffResult, updatePath) {\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (updatePath[keyA]) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let keyB in updatePath) {\r\n\t\t\tif (includePath(keyA, keyB)) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction includePath(pathA, pathB) {\r\n\tif (pathA.indexOf(pathB) === 0) {\r\n\t\tconst next = pathA.substr(pathB.length, 1)\r\n\t\tif (next === '[' || next === '.') {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nexport function fixPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index) {\r\n\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmpPath += item\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}\r\n\r\nfunction getArrayPatch(path) {\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tlet current = options.store.data[arr[0]]\r\n\tfor (let i = 1, len = arr.length; i < len - 1; i++) {\r\n\t\tcurrent = current[arr[i]]\r\n\t}\r\n\treturn { k: fixArrPath(path), v: current }\r\n}\r\n\r\nfunction fixArrPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tconst len = arr.length\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index < len - 1) {\r\n\t\t\tif (index) {\r\n\t\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += item\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}","const OBJECTTYPE = '[object Object]'\r\nconst ARRAYTYPE = '[object Array]'\r\n\r\nexport function define(name, ctor) {\r\n\tcustomElements.define(name, ctor)\r\n\tif (ctor.data && !ctor.pure) {\r\n\t\tctor.updatePath = getUpdatePath(ctor.data)\r\n\t}\r\n}\r\n\r\nexport function getUpdatePath(data) {\r\n\tconst result = {}\r\n\tdataToPath(data, result)\r\n\treturn result\r\n}\r\n\r\nfunction dataToPath(data, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[key] = true\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _objToPath(data, path, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[path + '.' + key] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], path + '.' + key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], path + '.' + key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _arrayToPath(data, path, result) {\r\n\tdata.forEach((item, index) => {\r\n\t\tresult[path + '[' + index + ']'] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(item)\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(item, path + '[' + index + ']', result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(item, path + '[' + index + ']', result)\r\n\t\t}\r\n\t})\r\n}","import { define } from './define'\r\n\r\nexport function tag(name, pure) {\r\n\treturn function (target) {\r\n\t\ttarget.pure = pure\r\n\t\tdefine(name, target)\r\n\t}\r\n}","import { h, h as createElement } from './h'\r\nimport options from './options'\r\nimport WeElement from './we-element'\r\nimport { render } from './render'\r\nimport { define } from './define'\r\nimport { tag } from './tag'\r\n\r\noptions.root.Omi = {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\noptions.root.Omi.version = '4.0.0'\r\n\r\nexport default {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\nexport {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\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","innerText","npn","str","replace","$","$1","toUpperCase","applyRef","ref","value","current","defer","Promise","resolve","then","bind","setTimeout","isArray","obj","Object","toString","call","nProps","props","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","ownerSVGElement","ret","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","WeElement","data","connectedCallback","store","instances","install","shadowRoot","attachShadow","mode","host","render","pure","installed","disconnectedCallback","uninstall","splice","beforeUpdate","afterUpdate","fire","dispatchEvent","CustomEvent","detail","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","revoke","disableTraps","timeout","patchs","handler","patch","kv","getArrayPatch","k","v","fixPath","querySelector","JSONProxy","extendStoreUpate","updateAll","matchGlobalData","globalData","updatePath","needUpdate","onChange","diffResult","keyA","includePath","keyB","pathA","pathB","substr","mpPath","arr","split","item","index","isNaN","fixArrPath","OBJECTTYPE","ARRAYTYPE","define","ctor","getUpdatePath","dataToPath","_objToPath","_arrayToPath","tag","Omi","version"],"mappings":";;;;;;;;AAAA;AACA,SAAgBA,KAAT,GAAiB;;ACDxB,SAASC,SAAT,GAAqB;KAChB,OAAOC,MAAP,KAAkB,QAAlB,IAA8B,CAACA,MAA/B,IAAyCA,OAAOC,IAAP,KAAgBA,IAAzD,IAAiED,OAAOE,KAAP,KAAiBA,KAAtF,EAA6F;MACxF,OAAOC,IAAP,KAAgB,WAApB,EAAiC;UACzBA,IAAP;GADD,MAEO,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;UAClCA,MAAP;GADM,MAEA,IAAI,OAAOJ,MAAP,KAAkB,WAAtB,EAAmC;UAClCA,MAAP;;SAEO,YAAU;UACV,IAAP;GADM,EAAP;;QAKMA,MAAP;;;;;;;AAOD,cAAe;;QAEP,IAFO;;OAIRD;;;;;;;;;;;;;;;;;;;;;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b,EAAyB;cACbJ,IAAX,EAAiBxF,OAAO,GAAP,GAAayF,KAAb,GAAqB,GAAtC,EAA2CzN,MAA3C;GADD,MAEO,IAAIuC,SAASsL,SAAb,EAAwB;gBACjBL,IAAb,EAAmBxF,OAAO,GAAP,GAAayF,KAAb,GAAqB,GAAxC,EAA6CzN,MAA7C;;EAPF;;;SCxCeoO,GAAT,CAAajN,IAAb,EAAmBqF,IAAnB,EAAyB;QACxB,UAAU4B,MAAV,EAAkB;SACjB5B,IAAP,GAAcA,IAAd;SACOrF,IAAP,EAAaiH,MAAb;EAFD;;;QCIOgC,IAAR,CAAaiE,GAAb,GAAmB;SAAA;qBAAA;eAAA;KAAA;iBAAA;iBAAA;;CAAnB;;AAUA7Q,QAAQ4M,IAAR,CAAaiE,GAAb,CAAiBC,OAAjB,GAA2B,OAA3B;;AAEA,UAAe;SAAA;qBAAA;eAAA;KAAA;iBAAA;iBAAA;;CAAf;;;"} \ No newline at end of file diff --git a/packages/omi/dist/omi.js b/packages/omi/dist/omi.js index ffae280db..963b4c38a 100644 --- a/packages/omi/dist/omi.js +++ b/packages/omi/dist/omi.js @@ -613,10 +613,6 @@ }; return JSONPatcherProxy; }(); - if ('undefined' != typeof module) { - module.exports = JSONPatcherProxy; - module.exports.default = JSONPatcherProxy; - } var timeout = null; var patchs = {}; var handler = function(patch) { diff --git a/packages/omi/dist/omi.js.map b/packages/omi/dist/omi.js.map index ba2da786a..5ac3f9fcf 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/render.js","../src/define.js","../src/options.js","../src/we-element.js","../src/proxy.js","../src/tag.js","../src/omi.js"],"names":["VNode","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","innerText","npn","str","replace","$","$1","toUpperCase","applyRef","ref","value","current","isArray","obj","Object","prototype","toString","call","nProps","props","result","keys","forEach","isSameNodeType","hydrating","_componentConstructor","removeNode","name","isSvg","className","old","style","cssText","IS_NON_DIMENSIONAL","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","e","removeAttribute","ns","removeAttributeNS","toLowerCase","setAttribute","isSvgMode","dom","componentRoot","context","mountAll","ret","idiff","diffLevel","parent","out","splitText","parentNode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","createNode","vchildren","firstChild","fc","a","nextSibling","innerDiffNode","dangerouslySetInnerHTML","prevSvgMode","min","len","childrenLen","vlen","j","keyedLen","originalChildren","keyed","vchild","_child","__key","trim","isHydrating","c","f","appendChild","unmountOnly","removeChildren","update","attrs","setAccessor","isWeElement","_possibleConstructorReturn","self","ReferenceError","render","store","querySelector","extendStoreUpate","JSONPatcherProxy","data","observe","handler","patch","diff","_this","this","updateAll","globalData","matchGlobalData","constructor","updatePath","needUpdate","instance","onChange","diffResult","keyA","indexOf","keyB","includePath","pathA","pathB","next","substr","fixPath","path","mpPath","arr","split","index","item","getArrayPatch","fixArrPath","define","ctor","customElements","pure","dataToPath","getUpdatePath","type","_objToPath","_arrayToPath","ARRAYTYPE","target","root","global","Math","Array","window","Reflect","hasOwnProperty","BuiltInHTMLElement","HTMLElement","construct","setPrototypeOf","Promise","resolve","then","bind","setTimeout","_listeners","WeElement","shadowRoot","instances","mode","install","attachShadow","installed","disconnectedCallback","uninstall","splice","beforeUpdate","host","fire","afterUpdate","CustomEvent","detail","JSON","escapePathComponent","deepClone","pathComponents","parentAndPath","parenthoodMap","get","parentPath","newValueOriginalObject","revokableInstance","inherited","proxifiedObjectsMap","has","newValue","set","operation","destinationPropKey","op","delete","oldValue","disableTrapsForProxy","Number","console","warn","reflectionResult","defaultCallback","revokableProxyInstance","deleteProperty","isRecording","patches","userCallback","isObserving","showDetachedWarning","cachedProxy","resume","pause","_this2","receiver","deleteTrap","Proxy","revocable","revocableInstance","trapsInstance","traps","originalObject","_proxifyObjectTreeRecursively","generateProxyAtPath","proxifyObjectTree","isProxifyingTreeNow","proxifiedObject","targetObject","message","propKey","record","callback","generate","revoke","el","disableTraps","module","exports","clearTimeout","timeout","patchs","tag","h","Omi","version"],"mappings":";;IACO,SAASA;ICKT,SAAWC,EAAAA,UAAUC;QAC3B,IAA+BC,YAAYC,OAAOC,QAAQC,GAAtDC,WAAWC;QACf,KAAKF,IAAIG,UAAUC,QAAQJ,MAAM,KAChCK,MAAMC,KAAKH,UAAUH;QAEtB,IAAIJ,cAAqC,QAAvBA,WAAWK,UAAkB;YAC9C,KAAKI,MAAMD,QAAQC,MAAMC,KAAKV,WAAWK;mBAClCL,WAAWK;;QAEnB,OAAOI,MAAMD,QACZ,KAAKN,QAAQO,MAAME,eAAwBC,MAAdV,MAAMS,KAClC,KAAKP,IAAIF,MAAMM,QAAQJ,OAAMK,MAAMC,KAAKR,MAAME,UAE1C;YACJ,IAAqB,oBAAVF,OAAqBA,QAAQ;YAExC,IAAKC,SAA6B,qBAAbJ,UACpB,IAAa,QAATG,OAAeA,QAAQ,SACtB,IAAqB,mBAAVA,OAAoBA,QAAQW,OAAOX,aAC9C,IAAqB,mBAAVA,OAAoBC,UAAS;YAG9C,IAAIA,UAAUF,YACbI,SAASA,SAASG,SAAS,MAAMN,YAE7B,IAAIG,aAAaC,gBACrBD,aAAYH,cAGZG,SAASK,KAAKR;YAGfD,aAAaE;;QAIf,IAAIW,IAAI,IAAIhB;QACZgB,EAAEf,WAAWA;QACbe,EAAET,WAAWA;QACbS,EAAEd,aAA2B,QAAdA,kBAAqBY,IAAYZ;QAChDc,EAAEC,MAAoB,QAAdf,kBAAqBY,IAAYZ,WAAWe;QAGpD,SAAsBH,MAAlBI,QAAQC,OAAqBD,QAAQC,MAAMH;QAE/C,OAAOA;;ICZD,SAASI,SAATC;QACN,IAAMC,OAAOC,SAASC,cAAc;QACpCF,KAAKG,YAAYJ;QACjB,OAAOC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;QACnB0N,KAAAA;QACClG,WAAOP;QACPH,QAAO9G;QACP2N,GAHDA;QAIAtP,eAAAsP;;gBCAOlG;;IAGPjD,QAAAA,KAHkBoJ,IAAAC,UAAA;IAKlBxP,IAAAA;QACAN,KAAAA;QACA+I,WAAAA;QAPDtC,QAAAA;;QAUAzG,eAAA4P;;QAEA7G,QAAAA;;IAGCtC,IAHc,sBAGdA,QAHc6I,OAAAC,UAAAM,UAAAtJ,KAAAsJ,MAAAA","file":"omi.js","sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","import { VNode } from './vnode'\r\nimport options from './options'\r\n\r\nconst stack = []\r\nconst EMPTY_CHILDREN = []\r\n\r\nexport function h(nodeName, attributes) {\r\n\tlet children = EMPTY_CHILDREN, lastSimple, child, simple, i\r\n\tfor (i = arguments.length; i-- > 2;) {\r\n\t\tstack.push(arguments[i])\r\n\t}\r\n\tif (attributes && attributes.children != null) {\r\n\t\tif (!stack.length) stack.push(attributes.children)\r\n\t\tdelete attributes.children\r\n\t}\r\n\twhile (stack.length) {\r\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\r\n\t\t\tfor (i = child.length; i--;) stack.push(child[i])\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (typeof child === 'boolean') child = null\r\n\r\n\t\t\tif ((simple = typeof nodeName !== 'function')) {\r\n\t\t\t\tif (child == null) child = ''\r\n\t\t\t\telse if (typeof child === 'number') child = String(child)\r\n\t\t\t\telse if (typeof child !== 'string') simple = false\r\n\t\t\t}\r\n\r\n\t\t\tif (simple && lastSimple) {\r\n\t\t\t\tchildren[children.length - 1] += child\r\n\t\t\t}\r\n\t\t\telse if (children === EMPTY_CHILDREN) {\r\n\t\t\t\tchildren = [child]\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tchildren.push(child)\r\n\t\t\t}\r\n\r\n\t\t\tlastSimple = simple\r\n\t\t}\r\n\t}\r\n\r\n\tlet p = new VNode()\r\n\tp.nodeName = nodeName\r\n\tp.children = children\r\n\tp.attributes = attributes == null ? undefined : attributes\r\n\tp.key = attributes == null ? undefined : attributes.key\r\n\r\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\r\n\tif (options.vnode !== undefined) options.vnode(p)\r\n\r\n\treturn p\r\n}","/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n/**\r\n * This shim allows elements written in, or compiled to, ES5 to work on native\r\n * implementations of Custom Elements v1. It sets new.target to the value of\r\n * this.constructor so that the native HTMLElement constructor can access the\r\n * current under-construction element's definition.\r\n */\r\n(function() {\r\n\tif (\r\n\t// No Reflect, no classes, no need for shim because native custom elements\r\n\t// require ES2015 classes or Reflect.\r\n\t\twindow.Reflect === undefined ||\r\n window.customElements === undefined ||\r\n // The webcomponentsjs custom elements polyfill doesn't require\r\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\r\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')\r\n\t) {\r\n\t\treturn\r\n\t}\r\n\tconst BuiltInHTMLElement = HTMLElement\r\n\twindow.HTMLElement = function HTMLElement() {\r\n\t\treturn Reflect.construct(BuiltInHTMLElement, [], this.constructor)\r\n\t}\r\n\tHTMLElement.prototype = BuiltInHTMLElement.prototype\r\n\tHTMLElement.prototype.constructor = HTMLElement\r\n\tObject.setPrototypeOf(HTMLElement, BuiltInHTMLElement)\r\n})()\r\n\r\n\r\n\r\nexport function cssToDom(css) {\r\n\tconst node = document.createElement('style')\r\n\tnode.innerText = css\r\n\treturn node\r\n}\r\n\r\n\r\nexport function npn(str) {\r\n\treturn str.replace(/-(\\w)/g, ($, $1) => {\r\n\t\treturn $1.toUpperCase()\r\n\t})\r\n}\r\n\r\nexport function extend(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i]\r\n\treturn obj\r\n}\r\n\r\n/** Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} [ref=null]\r\n * @param {any} [value]\r\n */\r\nexport function applyRef(ref, value) {\r\n\tif (ref!=null) {\r\n\t\tif (typeof ref=='function') ref(value)\r\n\t\telse ref.current = value\r\n\t}\r\n}\r\n\r\n/**\r\n * Call a function asynchronously, as soon as possible. Makes\r\n * use of HTML Promise to schedule the callback if available,\r\n * otherwise falling back to `setTimeout` (mainly for IE<11).\r\n * @type {(callback: function) => void}\r\n */\r\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout\r\n\r\nexport function isArray(obj){\r\n\treturn Object.prototype.toString.call(obj) === '[object Array]'\r\n}\r\n\r\nexport function nProps(props){\r\n\tif (!props || isArray(props)) return {}\r\n\tconst result = {}\r\n\tObject.keys(props).forEach(key =>{\r\n\t\tresult[key] = props[key].value\r\n\t})\r\n\treturn result\r\n}\r\n","import { extend } from '../util'\r\n\r\n\r\n/**\r\n * Check if two nodes are equivalent.\r\n *\r\n * @param {Node} node\t\t\tDOM Node to compare\r\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\r\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\r\n * @private\r\n */\r\nexport function isSameNodeType(node, vnode, hydrating) {\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\t\treturn node.splitText!==undefined\r\n\t}\r\n\tif (typeof vnode.nodeName==='string') {\r\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName)\r\n\t}\r\n\treturn hydrating || node._componentConstructor===vnode.nodeName\r\n}\r\n\r\n\r\n/**\r\n * Check if an Element has a given nodeName, case-insensitively.\r\n *\r\n * @param {Element} node\tA DOM Element to inspect the name of.\r\n * @param {String} nodeName\tUnnormalized name to compare against.\r\n */\r\nexport function isNamedNode(node, nodeName) {\r\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase()\r\n}\r\n\r\n\r\n/**\r\n * Reconstruct Component-style `props` from a VNode.\r\n * Ensures default/fallback values from `defaultProps`:\r\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\r\n *\r\n * @param {VNode} vnode\r\n * @returns {Object} props\r\n */\r\nexport function getNodeProps(vnode) {\r\n\tlet props = extend({}, vnode.attributes)\r\n\tprops.children = vnode.children\r\n\r\n\tlet defaultProps = vnode.nodeName.defaultProps\r\n\tif (defaultProps!==undefined) {\r\n\t\tfor (let i in defaultProps) {\r\n\t\t\tif (props[i]===undefined) {\r\n\t\t\t\tprops[i] = defaultProps[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n","import { IS_NON_DIMENSIONAL } from '../constants'\r\nimport { applyRef } from '../util'\r\nimport options from '../options'\r\n\r\n/**\r\n * A DOM event listener\r\n * @typedef {(e: Event) => void} EventListner\r\n */\r\n\r\n/**\r\n * A mapping of event types to event listeners\r\n * @typedef {Object.} EventListenerMap\r\n */\r\n\r\n/**\r\n * Properties Preact adds to elements it creates\r\n * @typedef PreactElementExtensions\r\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\r\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\r\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\r\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\r\n */\r\n\r\n/**\r\n * A DOM element that has been extended with Preact properties\r\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\r\n */\r\n\r\n/**\r\n * Create an element with the given nodeName.\r\n * @param {string} nodeName The DOM node to create\r\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\r\n * namespace.\r\n * @returns {PreactElement} The created DOM node\r\n */\r\nexport function createNode(nodeName, isSvg) {\r\n\t/** @type {PreactElement} */\r\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName)\r\n\tnode.normalizedNodeName = nodeName\r\n\treturn node\r\n}\r\n\r\n\r\n/**\r\n * Remove a child node from its parent if attached.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode\r\n\tif (parentNode) parentNode.removeChild(node)\r\n}\r\n\r\n\r\n/**\r\n * Set a named attribute on the given Node, with special behavior for some names\r\n * and event handlers. If `value` is `null`, the attribute/handler will be\r\n * removed.\r\n * @param {PreactElement} node An element to mutate\r\n * @param {string} name The name/key to set, such as an event or attribute name\r\n * @param {*} old The last value that was set for this name/node pair\r\n * @param {*} value An attribute value, such as a function to be used as an\r\n * event handler\r\n * @param {boolean} isSvg Are we currently diffing inside an svg?\r\n * @private\r\n */\r\nexport function setAccessor(node, name, old, value, isSvg) {\r\n\tif (name==='className') name = 'class'\r\n\r\n\r\n\tif (name==='key') {\r\n\t\t// ignore\r\n\t}\r\n\telse if (name==='ref') {\r\n\t\tapplyRef(old, null)\r\n\t\tapplyRef(value, node)\r\n\t}\r\n\telse if (name==='class' && !isSvg) {\r\n\t\tnode.className = value || ''\r\n\t}\r\n\telse if (name==='style') {\r\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\r\n\t\t\tnode.style.cssText = value || ''\r\n\t\t}\r\n\t\tif (value && typeof value==='object') {\r\n\t\t\tif (typeof old!=='string') {\r\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = ''\r\n\t\t\t}\r\n\t\t\tfor (let i in value) {\r\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if (name==='dangerouslySetInnerHTML') {\r\n\t\tif (value) node.innerHTML = value.__html || ''\r\n\t}\r\n\telse if (name[0]=='o' && name[1]=='n') {\r\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''))\r\n\t\tname = name.toLowerCase().substring(2)\r\n\t\tif (value) {\r\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\t(node._listeners || (node._listeners = {}))[name] = value\r\n\t}\r\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\r\n\t\t// Attempt to set a DOM property to the given value.\r\n\t\t// IE & FF throw for certain property-value combinations.\r\n\t\ttry {\r\n\t\t\tnode[name] = value==null ? '' : value\r\n\t\t} catch (e) { }\r\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name)\r\n\t}\r\n\telse {\r\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')))\r\n\t\t// spellcheck is treated differently than all other boolean values and\r\n\t\t// should not be removed when the value is `false`. See:\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\r\n\t\tif (value==null || value===false) {\r\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase())\r\n\t\t\telse node.removeAttribute(name)\r\n\t\t}\r\n\t\telse if (typeof value === 'string') {\r\n\t\t\tif (ns) {\r\n\t\t\t\tnode.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(name, value)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\treturn this._listeners[e.type](options.event && options.event(e) || e)\r\n}","import { ATTR_KEY } from '../constants'\r\nimport { isSameNodeType, isNamedNode } from './index'\r\nimport { createNode, setAccessor } from '../dom/index'\r\nimport { npn } from '../util'\r\nimport { removeNode } from '../dom/index'\r\n\r\n/** Queue of components that have been mounted and are awaiting componentDidMount */\r\nexport const mounts = []\r\n\r\n/** Diff recursion count, used to track the end of the diff cycle. */\r\nexport let diffLevel = 0\r\n\r\n/** Global flag indicating if the diff is currently within an SVG */\r\nlet isSvgMode = false\r\n\r\n/** Global flag indicating if the diff is performing hydration */\r\nlet hydrating = false\r\n\r\n\r\n\r\n\r\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\r\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\r\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\r\n *\t@returns {Element} dom\t\t\tThe created/mutated element\r\n *\t@private\r\n */\r\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\r\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\r\n\tif (!diffLevel++) {\r\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\r\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined\r\n\r\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\r\n\t\thydrating = dom!=null && !(ATTR_KEY in dom)\r\n\t}\r\n\r\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot)\r\n\r\n\t// append the element if its a new parent\r\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret)\r\n\r\n\t// diffLevel being reduced to 0 means we're exiting the diff\r\n\tif (!--diffLevel) {\r\n\t\thydrating = false\r\n\t\t// invoke queued componentDidMount lifecycle methods\r\n\t\t\r\n\t}\r\n\r\n\treturn ret\r\n}\r\n\r\n\r\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\r\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\r\n\tlet out = dom,\r\n\t\tprevSvgMode = isSvgMode\r\n\r\n\t// empty values (null, undefined, booleans) render as empty Text nodes\r\n\tif (vnode==null || typeof vnode==='boolean') vnode = ''\r\n\r\n\r\n\t// Fast case: Strings & Numbers create/update Text nodes.\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\r\n\t\t// update if it's already a Text node:\r\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\r\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\r\n\t\t\tif (dom.nodeValue!=vnode) {\r\n\t\t\t\tdom.nodeValue = vnode\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\r\n\t\t\tout = document.createTextNode(vnode)\r\n\t\t\tif (dom) {\r\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\t\t\t\trecollectNodeTree(dom, true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tout[ATTR_KEY] = true\r\n\r\n\t\treturn out\r\n\t}\r\n\r\n\r\n\t// If the VNode represents a Component, perform a component diff:\r\n\tlet vnodeName = vnode.nodeName\r\n\t\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode\r\n\r\n\r\n\t// If there's no existing element or it's the wrong type, create a new one:\r\n\tvnodeName = String(vnodeName)\r\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\r\n\t\tout = createNode(vnodeName, isSvgMode)\r\n\r\n\t\tif (dom) {\r\n\t\t\t// move children into the replacement node\r\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild)\r\n\r\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\r\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\r\n\t\t\t// recycle the old element (skips non-Element node types)\r\n\t\t\trecollectNodeTree(dom, true)\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tlet fc = out.firstChild,\r\n\t\tprops = out[ATTR_KEY],\r\n\t\tvchildren = vnode.children\r\n\r\n\tif (props==null) {\r\n\t\tprops = out[ATTR_KEY] = {}\r\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value\r\n\t}\r\n\r\n\t// Optimization: fast-path for elements containing a single TextNode:\r\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\r\n\t\tif (fc.nodeValue!=vchildren[0]) {\r\n\t\t\tfc.nodeValue = vchildren[0]\r\n\t\t}\r\n\t}\r\n\t// otherwise, if there are existing or new children, diff them:\r\n\telse if (vchildren && vchildren.length || fc!=null) {\r\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null)\r\n\t}\r\n\r\n\r\n\t// Apply attributes/props from VNode to the DOM Element:\r\n\tdiffAttributes(out, vnode.attributes, props)\r\n\r\n\r\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\r\n\tisSvgMode = prevSvgMode\r\n\r\n\treturn out\r\n}\r\n\r\n\r\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\r\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\r\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\r\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\r\n *\t@param {Boolean} mountAll\r\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\r\n */\r\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\r\n\tlet originalChildren = dom.childNodes,\r\n\t\tchildren = [],\r\n\t\tkeyed = {},\r\n\t\tkeyedLen = 0,\r\n\t\tmin = 0,\r\n\t\tlen = originalChildren.length,\r\n\t\tchildrenLen = 0,\r\n\t\tvlen = vchildren ? vchildren.length : 0,\r\n\t\tj, c, f, vchild, child\r\n\r\n\t// Build up a map of keyed children and an Array of unkeyed children:\r\n\tif (len!==0) {\r\n\t\tfor (let i=0; i {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t} else {\r\n\t\tconst key = fixPath(patch.path)\r\n\t\tpatchs[key] = patch.value\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t}\r\n}\r\n\r\nexport function render(vnode, parent, store) {\r\n\tparent = typeof parent === 'string' ? document.querySelector(parent) : parent\r\n\tif (store) {\r\n\t\tstore.instances = []\r\n\t\textendStoreUpate(store)\r\n\t\toptions.store = store\r\n\t\tstore.data = new JSONProxy(store.data).observe(true, handler)\r\n\t}\r\n\tdiff(null, vnode, {}, false, parent, false)\r\n}\r\n\r\nfunction update(patch) {\r\n\toptions.store.update(patch)\r\n}\r\n\r\nfunction extendStoreUpate(store) {\r\n\tstore.update = function (patch) {\r\n\t\tconst updateAll = matchGlobalData(this.globalData, patch)\r\n\r\n\t\tif (Object.keys(patch).length > 0) {\r\n\t\t\tthis.instances.forEach(instance => {\r\n\t\t\t\tif (updateAll || this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath)) {\r\n\t\t\t\t\tinstance.update()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tthis.onChange && this.onChange(patch)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction matchGlobalData(globalData, diffResult) {\r\n\tif (!globalData) return false\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (globalData.indexOf(keyA) > -1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let i = 0, len = globalData.length; i < len; i++) {\r\n\t\t\tif (includePath(keyA, globalData[i])) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction needUpdate(diffResult, updatePath) {\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (updatePath[keyA]) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let keyB in updatePath) {\r\n\t\t\tif (includePath(keyA, keyB)) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction includePath(pathA, pathB) {\r\n\tif (pathA.indexOf(pathB) === 0) {\r\n\t\tconst next = pathA.substr(pathB.length, 1)\r\n\t\tif (next === '[' || next === '.') {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction fixPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index) {\r\n\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmpPath += item\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}\r\n\r\nfunction getArrayPatch(path) {\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tlet current = options.store.data[arr[0]]\r\n\tfor (let i = 1, len = arr.length; i < len - 1; i++) {\r\n\t\tcurrent = current[arr[i]]\r\n\t}\r\n\treturn { k: fixArrPath(path), v: current }\r\n}\r\n\r\nfunction fixArrPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tconst len = arr.length\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index < len - 1) {\r\n\t\t\tif (index) {\r\n\t\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += item\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}","const OBJECTTYPE = '[object Object]'\r\nconst ARRAYTYPE = '[object Array]'\r\n\r\nexport function define(name, ctor) {\r\n\tcustomElements.define(name, ctor)\r\n\tif (ctor.data && !ctor.pure) {\r\n\t\tctor.updatePath = getUpdatePath(ctor.data)\r\n\t}\r\n}\r\n\r\nexport function getUpdatePath(data) {\r\n\tconst result = {}\r\n\tdataToPath(data, result)\r\n\treturn result\r\n}\r\n\r\nfunction dataToPath(data, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[key] = true\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _objToPath(data, path, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[path + '.' + key] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], path + '.' + key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], path + '.' + key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _arrayToPath(data, path, result) {\r\n\tdata.forEach((item, index) => {\r\n\t\tresult[path + '[' + index + ']'] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(item)\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(item, path + '[' + index + ']', result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(item, path + '[' + index + ']', result)\r\n\t\t}\r\n\t})\r\n}","function getGlobal() {\r\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\r\n\t\tif (typeof self !== 'undefined') {\r\n\t\t\treturn self\r\n\t\t} else if (typeof window !== 'undefined') {\r\n\t\t\treturn window\r\n\t\t} else if (typeof global !== 'undefined') {\r\n\t\t\treturn global\r\n\t\t}\r\n\t\treturn (function(){\r\n\t\t\treturn this\r\n\t\t})()\r\n\t\t\r\n\t}\r\n\treturn global\r\n}\r\n\r\n/** Global options\r\n *\t@public\r\n *\t@namespace options {Object}\r\n */\r\nexport default {\r\n\r\n\tstore: null,\r\n\t\r\n\troot: getGlobal()\r\n\t//componentChange(component, element) { },\r\n\t/** If `true`, `prop` changes trigger synchronous component updates.\r\n\t *\t@name syncComponentUpdates\r\n\t *\t@type Boolean\r\n\t *\t@default true\r\n\t */\r\n\t//syncComponentUpdates: true,\r\n\r\n\t/** Processes all created VNodes.\r\n\t *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\r\n\t */\r\n\t//vnode(vnode) { }\r\n\r\n\t/** Hook invoked after a component is mounted. */\r\n\t//afterMount(component) { },\r\n\r\n\t/** Hook invoked after the DOM is updated with a component's latest render. */\r\n\t//afterUpdate(component) { }\r\n\r\n\t/** Hook invoked immediately before a component is unmounted. */\r\n\t// beforeUnmount(component) { }\r\n}\r\n","import { cssToDom, nProps } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\n\nexport default class WeElement extends HTMLElement {\n\tconstructor() {\n\t\tsuper()\n\t\tthis.props = nProps(this.constructor.props)\n\t\tthis.data = this.constructor.data || {}\n\t}\n\n\tconnectedCallback() {\n\t\tthis.store = options.store\n\t\tif (this.store){\n\t\t\tthis.store.instances.push(this)\n\t\t}\n\t\tthis.install()\n \n\t\tconst shadowRoot = this.attachShadow({ mode: 'open' })\n\n\t\tthis.css && shadowRoot.appendChild(cssToDom(this.css()))\n\t\tthis.host = diff(null, this.render(this.props, (!this.constructor.pure && this.store) ? this.store.data : this.data), {}, false, null, false)\n\t\tshadowRoot.appendChild(this.host)\n\n\t\tthis.installed()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.uninstall()\n\t\tif (this.store) {\n\t\t\tfor (let i = 0, len = this.store.instances.length; i < len; i++) {\n\t\t\t\tif (this.store.instances[i] === this) {\n\t\t\t\t\tthis.store.instances.splice(i, 1)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.beforeUpdate()\n\t\tdiff(this.host, this.render(this.props, (!this.constructor.pure && this.store) ? this.store.data : this.data))\n\t\tthis.afterUpdate()\n\t}\n\n\tfire(name, data){\n\t\tthis.dispatchEvent(new CustomEvent(name, { detail : data }))\n\t}\n\n\tinstall() {\n\n\t}\n\n\tinstalled() {\n\n\t}\n\n\tuninstall() {\n\n\t}\n\n\tbeforeUpdate() {\n\n\t}\n\n\tafterUpdate() {\n\n\t}\n}\n","\n\n/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst JSONPatcherProxy = (function() {\n\t/**\n * Deep clones your object and returns a new object.\n */\n\tfunction deepClone(obj) {\n\t\tswitch (typeof obj) {\n\t\t\tcase 'object':\n\t\t\t\treturn JSON.parse(JSON.stringify(obj)) //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n\t\t\tcase 'undefined':\n\t\t\t\treturn null //this is how JSON.stringify behaves for array items\n\t\t\tdefault:\n\t\t\t\treturn obj //no need to clone primitives\n\t\t}\n\t}\n\tJSONPatcherProxy.deepClone = deepClone\n\n\tfunction escapePathComponent(str) {\n\t\tif (str.indexOf('/') == -1 && str.indexOf('~') == -1) return str\n\t\treturn str.replace(/~/g, '~0').replace(/\\//g, '~1')\n\t}\n\tJSONPatcherProxy.escapePathComponent = escapePathComponent\n\n\t/**\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\tfunction findObjectPath(instance, obj) {\n\t\tconst pathComponents = []\n\t\tlet parentAndPath = instance.parenthoodMap.get(obj)\n\t\twhile (parentAndPath && parentAndPath.path) {\n\t\t\t// because we're walking up-tree, we need to use the array as a stack\n\t\t\tpathComponents.unshift(parentAndPath.path)\n\t\t\tparentAndPath = instance.parenthoodMap.get(parentAndPath.parent)\n\t\t}\n\t\tif (pathComponents.length) {\n\t\t\tconst path = pathComponents.join('/')\n\t\t\treturn '/' + path\n\t\t}\n\t\treturn ''\n\t}\n\t/**\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\tfunction setTrap(instance, target, key, newValue) {\n\t\tconst parentPath = findObjectPath(instance, target)\n\n\t\tconst destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n\t\tif (instance.proxifiedObjectsMap.has(newValue)) {\n\t\t\tconst newValueOriginalObject = instance.proxifiedObjectsMap.get(newValue)\n\n\t\t\tinstance.parenthoodMap.set(newValueOriginalObject.originalObject, {\n\t\t\t\tparent: target,\n\t\t\t\tpath: key\n\t\t\t})\n\t\t}\n\t\t/*\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\t\tconst revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n\t\t/*\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\t\tif (revokableInstance && !instance.isProxifyingTreeNow) {\n\t\t\trevokableInstance.inherited = true\n\t\t}\n\n\t\t// if the new value is an object, make sure to watch it\n\t\tif (\n\t\t\tnewValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n\t\t) {\n\t\t\tinstance.parenthoodMap.set(newValue, {\n\t\t\t\tparent: target,\n\t\t\t\tpath: key\n\t\t\t})\n\t\t\tnewValue = instance._proxifyObjectTreeRecursively(target, newValue, key)\n\t\t}\n\t\t// let's start with this operation, and may or may not update it later\n\t\tconst operation = {\n\t\t\top: 'remove',\n\t\t\tpath: destinationPropKey\n\t\t}\n\t\tif (typeof newValue == 'undefined') {\n\t\t\t// applying De Morgan's laws would be a tad faster, but less readable\n\t\t\tif (!Array.isArray(target) && !target.hasOwnProperty(key)) {\n\t\t\t\t// `undefined` is being set to an already undefined value, keep silent\n\t\t\t\treturn Reflect.set(target, key, newValue)\n\t\t\t}\n\t\t\t// when array element is set to `undefined`, should generate replace to `null`\n\t\t\tif (Array.isArray(target)) {\n\t\t\t\t// undefined array elements are JSON.stringified to `null`\n\t\t\t\t(operation.op = 'replace'), (operation.value = null)\n\t\t\t}\n\t\t\tconst oldValue = instance.proxifiedObjectsMap.get(target[key])\n\t\t\t// was the deleted a proxified object?\n\t\t\tif (oldValue) {\n\t\t\t\tinstance.parenthoodMap.delete(target[key])\n\t\t\t\tinstance.disableTrapsForProxy(oldValue)\n\t\t\t\tinstance.proxifiedObjectsMap.delete(oldValue)\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tif (Array.isArray(target) && !Number.isInteger(+key.toString())) {\n\t\t\t\t/* array props (as opposed to indices) don't emit any patches, to avoid needless `length` patches */\n\t\t\t\tif (key != 'length') {\n\t\t\t\t\tconsole.warn('JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch')\n\t\t\t\t}\n\t\t\t\treturn Reflect.set(target, key, newValue)\n\t\t\t}\n\t\t\toperation.op = 'add'\n\t\t\tif (target.hasOwnProperty(key)) {\n\t\t\t\tif (typeof target[key] !== 'undefined' || Array.isArray(target)) {\n\t\t\t\t\toperation.op = 'replace' // setting `undefined` array elements is a `replace` op\n\t\t\t\t}\n\t\t\t}\n\t\t\toperation.value = newValue\n\t\t}\n\t\tconst reflectionResult = Reflect.set(target, key, newValue)\n\t\tinstance.defaultCallback(operation)\n\t\treturn reflectionResult\n\t}\n\t/**\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\tfunction deleteTrap(instance, target, key) {\n\t\tif (typeof target[key] !== 'undefined') {\n\t\t\tconst parentPath = findObjectPath(instance, target)\n\t\t\tconst destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n\t\t\tconst revokableProxyInstance = instance.proxifiedObjectsMap.get(\n\t\t\t\ttarget[key]\n\t\t\t)\n\n\t\t\tif (revokableProxyInstance) {\n\t\t\t\tif (revokableProxyInstance.inherited) {\n\t\t\t\t\t/*\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\t\t\t\t\trevokableProxyInstance.inherited = false\n\t\t\t\t} else {\n\t\t\t\t\tinstance.parenthoodMap.delete(revokableProxyInstance.originalObject)\n\t\t\t\t\tinstance.disableTrapsForProxy(revokableProxyInstance)\n\t\t\t\t\tinstance.proxifiedObjectsMap.delete(target[key])\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst reflectionResult = Reflect.deleteProperty(target, key)\n\n\t\t\tinstance.defaultCallback({\n\t\t\t\top: 'remove',\n\t\t\t\tpath: destinationPropKey\n\t\t\t})\n\n\t\t\treturn reflectionResult\n\t\t}\n\t}\n\t/* pre-define resume and pause functions to enhance constructors performance */\n\tfunction resume() {\n\t\tthis.defaultCallback = operation => {\n\t\t\tthis.isRecording && this.patches.push(operation)\n\t\t\tthis.userCallback && this.userCallback(operation)\n\t\t}\n\t\tthis.isObserving = true\n\t}\n\tfunction pause() {\n\t\tthis.defaultCallback = () => {}\n\t\tthis.isObserving = false\n\t}\n\t/**\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\tfunction JSONPatcherProxy(root, showDetachedWarning) {\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.isObserving = false\n\t\tthis.proxifiedObjectsMap = new Map()\n\t\tthis.parenthoodMap = new Map()\n\t\t// default to true\n\t\tif (typeof showDetachedWarning !== 'boolean') {\n\t\t\tshowDetachedWarning = true\n\t\t}\n\n\t\tthis.showDetachedWarning = showDetachedWarning\n\t\tthis.originalObject = root\n\t\tthis.cachedProxy = null\n\t\tthis.isRecording = false\n\t\tthis.userCallback\n\t\t/**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n\t\tthis.resume = resume.bind(this)\n\t\t/**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n\t\tthis.pause = pause.bind(this)\n\t}\n\n\tJSONPatcherProxy.prototype.generateProxyAtPath = function(parent, obj, path) {\n\t\tif (!obj) {\n\t\t\treturn obj\n\t\t}\n\t\tconst traps = {\n\t\t\tset: (target, key, value, receiver) =>\n\t\t\t\tsetTrap(this, target, key, value, receiver),\n\t\t\tdeleteProperty: (target, key) => deleteTrap(this, target, key)\n\t\t}\n\t\tconst revocableInstance = Proxy.revocable(obj, traps)\n\t\t// cache traps object to disable them later.\n\t\trevocableInstance.trapsInstance = traps\n\t\trevocableInstance.originalObject = obj\n\n\t\t/* keeping track of object's parent and path */\n\n\t\tthis.parenthoodMap.set(obj, { parent, path })\n\n\t\t/* keeping track of all the proxies to be able to revoke them later */\n\t\tthis.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance)\n\t\treturn revocableInstance.proxy\n\t}\n\t// grab tree's leaves one by one, encapsulate them into a proxy and return\n\tJSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function(\n\t\tparent,\n\t\troot,\n\t\tpath\n\t) {\n\t\tfor (let key in root) {\n\t\t\tif (root.hasOwnProperty(key)) {\n\t\t\t\tif (root[key] instanceof Object) {\n\t\t\t\t\troot[key] = this._proxifyObjectTreeRecursively(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\troot[key],\n\t\t\t\t\t\tescapePathComponent(key)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.generateProxyAtPath(parent, root, path)\n\t}\n\t// this function is for aesthetic purposes\n\tJSONPatcherProxy.prototype.proxifyObjectTree = function(root) {\n\t\t/*\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\t\tthis.pause()\n\t\tthis.isProxifyingTreeNow = true\n\t\tconst proxifiedObject = this._proxifyObjectTreeRecursively(\n\t\t\tundefined,\n\t\t\troot,\n\t\t\t''\n\t\t)\n\t\t/* OK you can record now */\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.resume()\n\t\treturn proxifiedObject\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTrapsForProxy = function(\n\t\trevokableProxyInstance\n\t) {\n\t\tif (this.showDetachedWarning) {\n\t\t\tconst message =\n \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\"\n\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.deleteProperty = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey\n\t\t\t) => {\n\t\t\t\treturn Reflect.deleteProperty(targetObject, propKey)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete revokableProxyInstance.trapsInstance.set\n\t\t\tdelete revokableProxyInstance.trapsInstance.get\n\t\t\tdelete revokableProxyInstance.trapsInstance.deleteProperty\n\t\t}\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.observe = function(record, callback) {\n\t\tif (!record && !callback) {\n\t\t\tthrow new Error('You need to either record changes or pass a callback')\n\t\t}\n\t\tthis.isRecording = record\n\t\tthis.userCallback = callback\n\t\t/*\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\t\tif (record) this.patches = []\n\t\tthis.cachedProxy = this.proxifyObjectTree(this.originalObject)\n\t\treturn this.cachedProxy\n\t}\n\t/**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n\tJSONPatcherProxy.prototype.generate = function() {\n\t\tif (!this.isRecording) {\n\t\t\tthrow new Error('You should set record to true to get patches later')\n\t\t}\n\t\treturn this.patches.splice(0, this.patches.length)\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.revoke = function() {\n\t\tthis.proxifiedObjectsMap.forEach(el => {\n\t\t\tel.revoke()\n\t\t})\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTraps = function() {\n\t\tthis.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this)\n\t}\n\treturn JSONPatcherProxy\n})()\n\nexport default JSONPatcherProxy\nif (typeof module !== 'undefined') {\n\tmodule.exports = JSONPatcherProxy\n\tmodule.exports.default = JSONPatcherProxy\n}\n","import { define } from './define'\r\n\r\nexport function tag(name, pure) {\r\n\treturn function (target) {\r\n\t\ttarget.pure = pure\r\n\t\tdefine(name, target)\r\n\t}\r\n}","import { h, h as createElement } from './h'\r\nimport options from './options'\r\nimport WeElement from './we-element'\r\nimport { render } from './render'\r\nimport { define } from './define'\r\nimport { tag } from './tag'\r\n\r\noptions.root.Omi = {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\noptions.root.Omi.version = '4.0.0'\r\n\r\nexport default {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\nexport {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\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/render.js","../src/define.js","../src/options.js","../src/we-element.js","../src/proxy.js","../src/tag.js","../src/omi.js"],"names":["VNode","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","innerText","npn","str","replace","$","$1","toUpperCase","applyRef","ref","value","current","isArray","obj","Object","prototype","toString","call","nProps","props","result","keys","forEach","isSameNodeType","hydrating","_componentConstructor","removeNode","name","isSvg","className","old","style","cssText","IS_NON_DIMENSIONAL","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","e","removeAttribute","ns","removeAttributeNS","toLowerCase","setAttribute","isSvgMode","dom","componentRoot","context","mountAll","ret","idiff","diffLevel","parent","out","splitText","parentNode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","createNode","vchildren","firstChild","fc","a","nextSibling","innerDiffNode","dangerouslySetInnerHTML","prevSvgMode","min","len","childrenLen","vlen","j","keyedLen","originalChildren","keyed","vchild","_child","__key","trim","isHydrating","c","f","appendChild","unmountOnly","removeChildren","update","attrs","setAccessor","isWeElement","_possibleConstructorReturn","self","ReferenceError","render","store","querySelector","extendStoreUpate","JSONPatcherProxy","data","observe","handler","patch","diff","_this","this","updateAll","globalData","matchGlobalData","constructor","updatePath","needUpdate","instance","onChange","diffResult","keyA","indexOf","keyB","includePath","pathA","pathB","next","substr","fixPath","path","mpPath","arr","split","index","item","getArrayPatch","fixArrPath","define","ctor","customElements","pure","dataToPath","getUpdatePath","type","_objToPath","_arrayToPath","ARRAYTYPE","target","root","global","Math","Array","window","Reflect","hasOwnProperty","BuiltInHTMLElement","HTMLElement","construct","setPrototypeOf","Promise","resolve","then","bind","setTimeout","_listeners","WeElement","shadowRoot","instances","mode","install","attachShadow","installed","disconnectedCallback","uninstall","splice","beforeUpdate","host","fire","afterUpdate","CustomEvent","detail","JSON","escapePathComponent","deepClone","pathComponents","parentAndPath","parenthoodMap","get","parentPath","newValueOriginalObject","revokableInstance","inherited","proxifiedObjectsMap","has","newValue","set","operation","destinationPropKey","op","delete","oldValue","disableTrapsForProxy","Number","console","warn","reflectionResult","defaultCallback","revokableProxyInstance","deleteProperty","isRecording","patches","userCallback","isObserving","showDetachedWarning","cachedProxy","resume","pause","_this2","receiver","deleteTrap","Proxy","revocable","revocableInstance","trapsInstance","traps","originalObject","_proxifyObjectTreeRecursively","generateProxyAtPath","proxifyObjectTree","isProxifyingTreeNow","proxifiedObject","targetObject","message","propKey","record","callback","generate","revoke","el","disableTraps","timeout","patchs","clearTimeout","tag","h","Omi","version","module","exports"],"mappings":";;IACO,SAASA;ICKT,SAAWC,EAAAA,UAAUC;QAC3B,IAA+BC,YAAYC,OAA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export function VNode() {}\r\n","import { VNode } from './vnode'\r\nimport options from './options'\r\n\r\nconst stack = []\r\nconst EMPTY_CHILDREN = []\r\n\r\nexport function h(nodeName, attributes) {\r\n\tlet children = EMPTY_CHILDREN, lastSimple, child, simple, i\r\n\tfor (i = arguments.length; i-- > 2;) {\r\n\t\tstack.push(arguments[i])\r\n\t}\r\n\tif (attributes && attributes.children != null) {\r\n\t\tif (!stack.length) stack.push(attributes.children)\r\n\t\tdelete attributes.children\r\n\t}\r\n\twhile (stack.length) {\r\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\r\n\t\t\tfor (i = child.length; i--;) stack.push(child[i])\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (typeof child === 'boolean') child = null\r\n\r\n\t\t\tif ((simple = typeof nodeName !== 'function')) {\r\n\t\t\t\tif (child == null) child = ''\r\n\t\t\t\telse if (typeof child === 'number') child = String(child)\r\n\t\t\t\telse if (typeof child !== 'string') simple = false\r\n\t\t\t}\r\n\r\n\t\t\tif (simple && lastSimple) {\r\n\t\t\t\tchildren[children.length - 1] += child\r\n\t\t\t}\r\n\t\t\telse if (children === EMPTY_CHILDREN) {\r\n\t\t\t\tchildren = [child]\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tchildren.push(child)\r\n\t\t\t}\r\n\r\n\t\t\tlastSimple = simple\r\n\t\t}\r\n\t}\r\n\r\n\tlet p = new VNode()\r\n\tp.nodeName = nodeName\r\n\tp.children = children\r\n\tp.attributes = attributes == null ? undefined : attributes\r\n\tp.key = attributes == null ? undefined : attributes.key\r\n\r\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\r\n\tif (options.vnode !== undefined) options.vnode(p)\r\n\r\n\treturn p\r\n}","/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n/**\r\n * This shim allows elements written in, or compiled to, ES5 to work on native\r\n * implementations of Custom Elements v1. It sets new.target to the value of\r\n * this.constructor so that the native HTMLElement constructor can access the\r\n * current under-construction element's definition.\r\n */\r\n(function() {\r\n\tif (\r\n\t// No Reflect, no classes, no need for shim because native custom elements\r\n\t// require ES2015 classes or Reflect.\r\n\t\twindow.Reflect === undefined ||\r\n window.customElements === undefined ||\r\n // The webcomponentsjs custom elements polyfill doesn't require\r\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\r\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')\r\n\t) {\r\n\t\treturn\r\n\t}\r\n\tconst BuiltInHTMLElement = HTMLElement\r\n\twindow.HTMLElement = function HTMLElement() {\r\n\t\treturn Reflect.construct(BuiltInHTMLElement, [], this.constructor)\r\n\t}\r\n\tHTMLElement.prototype = BuiltInHTMLElement.prototype\r\n\tHTMLElement.prototype.constructor = HTMLElement\r\n\tObject.setPrototypeOf(HTMLElement, BuiltInHTMLElement)\r\n})()\r\n\r\n\r\n\r\nexport function cssToDom(css) {\r\n\tconst node = document.createElement('style')\r\n\tnode.innerText = css\r\n\treturn node\r\n}\r\n\r\n\r\nexport function npn(str) {\r\n\treturn str.replace(/-(\\w)/g, ($, $1) => {\r\n\t\treturn $1.toUpperCase()\r\n\t})\r\n}\r\n\r\nexport function extend(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i]\r\n\treturn obj\r\n}\r\n\r\n/** Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} [ref=null]\r\n * @param {any} [value]\r\n */\r\nexport function applyRef(ref, value) {\r\n\tif (ref!=null) {\r\n\t\tif (typeof ref=='function') ref(value)\r\n\t\telse ref.current = value\r\n\t}\r\n}\r\n\r\n/**\r\n * Call a function asynchronously, as soon as possible. Makes\r\n * use of HTML Promise to schedule the callback if available,\r\n * otherwise falling back to `setTimeout` (mainly for IE<11).\r\n * @type {(callback: function) => void}\r\n */\r\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout\r\n\r\nexport function isArray(obj){\r\n\treturn Object.prototype.toString.call(obj) === '[object Array]'\r\n}\r\n\r\nexport function nProps(props){\r\n\tif (!props || isArray(props)) return {}\r\n\tconst result = {}\r\n\tObject.keys(props).forEach(key =>{\r\n\t\tresult[key] = props[key].value\r\n\t})\r\n\treturn result\r\n}\r\n","import { extend } from '../util'\r\n\r\n\r\n/**\r\n * Check if two nodes are equivalent.\r\n *\r\n * @param {Node} node\t\t\tDOM Node to compare\r\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\r\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\r\n * @private\r\n */\r\nexport function isSameNodeType(node, vnode, hydrating) {\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\t\treturn node.splitText!==undefined\r\n\t}\r\n\tif (typeof vnode.nodeName==='string') {\r\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName)\r\n\t}\r\n\treturn hydrating || node._componentConstructor===vnode.nodeName\r\n}\r\n\r\n\r\n/**\r\n * Check if an Element has a given nodeName, case-insensitively.\r\n *\r\n * @param {Element} node\tA DOM Element to inspect the name of.\r\n * @param {String} nodeName\tUnnormalized name to compare against.\r\n */\r\nexport function isNamedNode(node, nodeName) {\r\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase()\r\n}\r\n\r\n\r\n/**\r\n * Reconstruct Component-style `props` from a VNode.\r\n * Ensures default/fallback values from `defaultProps`:\r\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\r\n *\r\n * @param {VNode} vnode\r\n * @returns {Object} props\r\n */\r\nexport function getNodeProps(vnode) {\r\n\tlet props = extend({}, vnode.attributes)\r\n\tprops.children = vnode.children\r\n\r\n\tlet defaultProps = vnode.nodeName.defaultProps\r\n\tif (defaultProps!==undefined) {\r\n\t\tfor (let i in defaultProps) {\r\n\t\t\tif (props[i]===undefined) {\r\n\t\t\t\tprops[i] = defaultProps[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n","import { IS_NON_DIMENSIONAL } from '../constants'\r\nimport { applyRef } from '../util'\r\nimport options from '../options'\r\n\r\n/**\r\n * A DOM event listener\r\n * @typedef {(e: Event) => void} EventListner\r\n */\r\n\r\n/**\r\n * A mapping of event types to event listeners\r\n * @typedef {Object.} EventListenerMap\r\n */\r\n\r\n/**\r\n * Properties Preact adds to elements it creates\r\n * @typedef PreactElementExtensions\r\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\r\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\r\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\r\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\r\n */\r\n\r\n/**\r\n * A DOM element that has been extended with Preact properties\r\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\r\n */\r\n\r\n/**\r\n * Create an element with the given nodeName.\r\n * @param {string} nodeName The DOM node to create\r\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\r\n * namespace.\r\n * @returns {PreactElement} The created DOM node\r\n */\r\nexport function createNode(nodeName, isSvg) {\r\n\t/** @type {PreactElement} */\r\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName)\r\n\tnode.normalizedNodeName = nodeName\r\n\treturn node\r\n}\r\n\r\n\r\n/**\r\n * Remove a child node from its parent if attached.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode\r\n\tif (parentNode) parentNode.removeChild(node)\r\n}\r\n\r\n\r\n/**\r\n * Set a named attribute on the given Node, with special behavior for some names\r\n * and event handlers. If `value` is `null`, the attribute/handler will be\r\n * removed.\r\n * @param {PreactElement} node An element to mutate\r\n * @param {string} name The name/key to set, such as an event or attribute name\r\n * @param {*} old The last value that was set for this name/node pair\r\n * @param {*} value An attribute value, such as a function to be used as an\r\n * event handler\r\n * @param {boolean} isSvg Are we currently diffing inside an svg?\r\n * @private\r\n */\r\nexport function setAccessor(node, name, old, value, isSvg) {\r\n\tif (name==='className') name = 'class'\r\n\r\n\r\n\tif (name==='key') {\r\n\t\t// ignore\r\n\t}\r\n\telse if (name==='ref') {\r\n\t\tapplyRef(old, null)\r\n\t\tapplyRef(value, node)\r\n\t}\r\n\telse if (name==='class' && !isSvg) {\r\n\t\tnode.className = value || ''\r\n\t}\r\n\telse if (name==='style') {\r\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\r\n\t\t\tnode.style.cssText = value || ''\r\n\t\t}\r\n\t\tif (value && typeof value==='object') {\r\n\t\t\tif (typeof old!=='string') {\r\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = ''\r\n\t\t\t}\r\n\t\t\tfor (let i in value) {\r\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if (name==='dangerouslySetInnerHTML') {\r\n\t\tif (value) node.innerHTML = value.__html || ''\r\n\t}\r\n\telse if (name[0]=='o' && name[1]=='n') {\r\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''))\r\n\t\tname = name.toLowerCase().substring(2)\r\n\t\tif (value) {\r\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\t(node._listeners || (node._listeners = {}))[name] = value\r\n\t}\r\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\r\n\t\t// Attempt to set a DOM property to the given value.\r\n\t\t// IE & FF throw for certain property-value combinations.\r\n\t\ttry {\r\n\t\t\tnode[name] = value==null ? '' : value\r\n\t\t} catch (e) { }\r\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name)\r\n\t}\r\n\telse {\r\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')))\r\n\t\t// spellcheck is treated differently than all other boolean values and\r\n\t\t// should not be removed when the value is `false`. See:\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\r\n\t\tif (value==null || value===false) {\r\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase())\r\n\t\t\telse node.removeAttribute(name)\r\n\t\t}\r\n\t\telse if (typeof value === 'string') {\r\n\t\t\tif (ns) {\r\n\t\t\t\tnode.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(name, value)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\treturn this._listeners[e.type](options.event && options.event(e) || e)\r\n}","import { ATTR_KEY } from '../constants'\r\nimport { isSameNodeType, isNamedNode } from './index'\r\nimport { createNode, setAccessor } from '../dom/index'\r\nimport { npn } from '../util'\r\nimport { removeNode } from '../dom/index'\r\n\r\n/** Queue of components that have been mounted and are awaiting componentDidMount */\r\nexport const mounts = []\r\n\r\n/** Diff recursion count, used to track the end of the diff cycle. */\r\nexport let diffLevel = 0\r\n\r\n/** Global flag indicating if the diff is currently within an SVG */\r\nlet isSvgMode = false\r\n\r\n/** Global flag indicating if the diff is performing hydration */\r\nlet hydrating = false\r\n\r\n\r\n\r\n\r\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\r\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\r\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\r\n *\t@returns {Element} dom\t\t\tThe created/mutated element\r\n *\t@private\r\n */\r\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\r\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\r\n\tif (!diffLevel++) {\r\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\r\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined\r\n\r\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\r\n\t\thydrating = dom!=null && !(ATTR_KEY in dom)\r\n\t}\r\n\r\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot)\r\n\r\n\t// append the element if its a new parent\r\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret)\r\n\r\n\t// diffLevel being reduced to 0 means we're exiting the diff\r\n\tif (!--diffLevel) {\r\n\t\thydrating = false\r\n\t\t// invoke queued componentDidMount lifecycle methods\r\n\t\t\r\n\t}\r\n\r\n\treturn ret\r\n}\r\n\r\n\r\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\r\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\r\n\tlet out = dom,\r\n\t\tprevSvgMode = isSvgMode\r\n\r\n\t// empty values (null, undefined, booleans) render as empty Text nodes\r\n\tif (vnode==null || typeof vnode==='boolean') vnode = ''\r\n\r\n\r\n\t// Fast case: Strings & Numbers create/update Text nodes.\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\r\n\t\t// update if it's already a Text node:\r\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\r\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\r\n\t\t\tif (dom.nodeValue!=vnode) {\r\n\t\t\t\tdom.nodeValue = vnode\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\r\n\t\t\tout = document.createTextNode(vnode)\r\n\t\t\tif (dom) {\r\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\t\t\t\trecollectNodeTree(dom, true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tout[ATTR_KEY] = true\r\n\r\n\t\treturn out\r\n\t}\r\n\r\n\r\n\t// If the VNode represents a Component, perform a component diff:\r\n\tlet vnodeName = vnode.nodeName\r\n\t\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode\r\n\r\n\r\n\t// If there's no existing element or it's the wrong type, create a new one:\r\n\tvnodeName = String(vnodeName)\r\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\r\n\t\tout = createNode(vnodeName, isSvgMode)\r\n\r\n\t\tif (dom) {\r\n\t\t\t// move children into the replacement node\r\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild)\r\n\r\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\r\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\r\n\t\t\t// recycle the old element (skips non-Element node types)\r\n\t\t\trecollectNodeTree(dom, true)\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tlet fc = out.firstChild,\r\n\t\tprops = out[ATTR_KEY],\r\n\t\tvchildren = vnode.children\r\n\r\n\tif (props==null) {\r\n\t\tprops = out[ATTR_KEY] = {}\r\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value\r\n\t}\r\n\r\n\t// Optimization: fast-path for elements containing a single TextNode:\r\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\r\n\t\tif (fc.nodeValue!=vchildren[0]) {\r\n\t\t\tfc.nodeValue = vchildren[0]\r\n\t\t}\r\n\t}\r\n\t// otherwise, if there are existing or new children, diff them:\r\n\telse if (vchildren && vchildren.length || fc!=null) {\r\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null)\r\n\t}\r\n\r\n\r\n\t// Apply attributes/props from VNode to the DOM Element:\r\n\tdiffAttributes(out, vnode.attributes, props)\r\n\r\n\r\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\r\n\tisSvgMode = prevSvgMode\r\n\r\n\treturn out\r\n}\r\n\r\n\r\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\r\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\r\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\r\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\r\n *\t@param {Boolean} mountAll\r\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\r\n */\r\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\r\n\tlet originalChildren = dom.childNodes,\r\n\t\tchildren = [],\r\n\t\tkeyed = {},\r\n\t\tkeyedLen = 0,\r\n\t\tmin = 0,\r\n\t\tlen = originalChildren.length,\r\n\t\tchildrenLen = 0,\r\n\t\tvlen = vchildren ? vchildren.length : 0,\r\n\t\tj, c, f, vchild, child\r\n\r\n\t// Build up a map of keyed children and an Array of unkeyed children:\r\n\tif (len!==0) {\r\n\t\tfor (let i=0; i {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t} else {\r\n\t\tconst key = fixPath(patch.path)\r\n\t\tpatchs[key] = patch.value\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t}\r\n}\r\n\r\nexport function render(vnode, parent, store) {\r\n\tparent = typeof parent === 'string' ? document.querySelector(parent) : parent\r\n\tif (store) {\r\n\t\tstore.instances = []\r\n\t\textendStoreUpate(store)\r\n\t\toptions.store = store\r\n\t\tstore.data = new JSONProxy(store.data).observe(true, handler)\r\n\t}\r\n\tdiff(null, vnode, {}, false, parent, false)\r\n}\r\n\r\nfunction update(patch) {\r\n\toptions.store.update(patch)\r\n}\r\n\r\nfunction extendStoreUpate(store) {\r\n\tstore.update = function (patch) {\r\n\t\tconst updateAll = matchGlobalData(this.globalData, patch)\r\n\r\n\t\tif (Object.keys(patch).length > 0) {\r\n\t\t\tthis.instances.forEach(instance => {\r\n\t\t\t\tif (updateAll || this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath)) {\r\n\t\t\t\t\tinstance.update()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tthis.onChange && this.onChange(patch)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function matchGlobalData(globalData, diffResult) {\r\n\tif (!globalData) return false\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (globalData.indexOf(keyA) > -1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let i = 0, len = globalData.length; i < len; i++) {\r\n\t\t\tif (includePath(keyA, globalData[i])) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nexport function needUpdate(diffResult, updatePath) {\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (updatePath[keyA]) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let keyB in updatePath) {\r\n\t\t\tif (includePath(keyA, keyB)) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction includePath(pathA, pathB) {\r\n\tif (pathA.indexOf(pathB) === 0) {\r\n\t\tconst next = pathA.substr(pathB.length, 1)\r\n\t\tif (next === '[' || next === '.') {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nexport function fixPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index) {\r\n\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmpPath += item\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}\r\n\r\nfunction getArrayPatch(path) {\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tlet current = options.store.data[arr[0]]\r\n\tfor (let i = 1, len = arr.length; i < len - 1; i++) {\r\n\t\tcurrent = current[arr[i]]\r\n\t}\r\n\treturn { k: fixArrPath(path), v: current }\r\n}\r\n\r\nfunction fixArrPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tconst len = arr.length\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index < len - 1) {\r\n\t\t\tif (index) {\r\n\t\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += item\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}","const OBJECTTYPE = '[object Object]'\r\nconst ARRAYTYPE = '[object Array]'\r\n\r\nexport function define(name, ctor) {\r\n\tcustomElements.define(name, ctor)\r\n\tif (ctor.data && !ctor.pure) {\r\n\t\tctor.updatePath = getUpdatePath(ctor.data)\r\n\t}\r\n}\r\n\r\nexport function getUpdatePath(data) {\r\n\tconst result = {}\r\n\tdataToPath(data, result)\r\n\treturn result\r\n}\r\n\r\nfunction dataToPath(data, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[key] = true\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _objToPath(data, path, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[path + '.' + key] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], path + '.' + key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], path + '.' + key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _arrayToPath(data, path, result) {\r\n\tdata.forEach((item, index) => {\r\n\t\tresult[path + '[' + index + ']'] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(item)\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(item, path + '[' + index + ']', result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(item, path + '[' + index + ']', result)\r\n\t\t}\r\n\t})\r\n}","function getGlobal() {\r\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\r\n\t\tif (typeof self !== 'undefined') {\r\n\t\t\treturn self\r\n\t\t} else if (typeof window !== 'undefined') {\r\n\t\t\treturn window\r\n\t\t} else if (typeof global !== 'undefined') {\r\n\t\t\treturn global\r\n\t\t}\r\n\t\treturn (function(){\r\n\t\t\treturn this\r\n\t\t})()\r\n\t\t\r\n\t}\r\n\treturn global\r\n}\r\n\r\n/** Global options\r\n *\t@public\r\n *\t@namespace options {Object}\r\n */\r\nexport default {\r\n\r\n\tstore: null,\r\n\t\r\n\troot: getGlobal()\r\n\t//componentChange(component, element) { },\r\n\t/** If `true`, `prop` changes trigger synchronous component updates.\r\n\t *\t@name syncComponentUpdates\r\n\t *\t@type Boolean\r\n\t *\t@default true\r\n\t */\r\n\t//syncComponentUpdates: true,\r\n\r\n\t/** Processes all created VNodes.\r\n\t *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\r\n\t */\r\n\t//vnode(vnode) { }\r\n\r\n\t/** Hook invoked after a component is mounted. */\r\n\t//afterMount(component) { },\r\n\r\n\t/** Hook invoked after the DOM is updated with a component's latest render. */\r\n\t//afterUpdate(component) { }\r\n\r\n\t/** Hook invoked immediately before a component is unmounted. */\r\n\t// beforeUnmount(component) { }\r\n}\r\n","import { cssToDom, nProps } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\n\nexport default class WeElement extends HTMLElement {\n\tconstructor() {\n\t\tsuper()\n\t\tthis.props = nProps(this.constructor.props)\n\t\tthis.data = this.constructor.data || {}\n\t}\n\n\tconnectedCallback() {\n\t\tthis.store = options.store\n\t\tif (this.store){\n\t\t\tthis.store.instances.push(this)\n\t\t}\n\t\tthis.install()\n \n\t\tconst shadowRoot = this.attachShadow({ mode: 'open' })\n\n\t\tthis.css && shadowRoot.appendChild(cssToDom(this.css()))\n\t\tthis.host = diff(null, this.render(this.props, (!this.constructor.pure && this.store) ? this.store.data : this.data), {}, false, null, false)\n\t\tshadowRoot.appendChild(this.host)\n\n\t\tthis.installed()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.uninstall()\n\t\tif (this.store) {\n\t\t\tfor (let i = 0, len = this.store.instances.length; i < len; i++) {\n\t\t\t\tif (this.store.instances[i] === this) {\n\t\t\t\t\tthis.store.instances.splice(i, 1)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.beforeUpdate()\n\t\tdiff(this.host, this.render(this.props, (!this.constructor.pure && this.store) ? this.store.data : this.data))\n\t\tthis.afterUpdate()\n\t}\n\n\tfire(name, data){\n\t\tthis.dispatchEvent(new CustomEvent(name, { detail : data }))\n\t}\n\n\tinstall() {\n\n\t}\n\n\tinstalled() {\n\n\t}\n\n\tuninstall() {\n\n\t}\n\n\tbeforeUpdate() {\n\n\t}\n\n\tafterUpdate() {\n\n\t}\n}\n","\n\n/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst JSONPatcherProxy = (function() {\n\t/**\n * Deep clones your object and returns a new object.\n */\n\tfunction deepClone(obj) {\n\t\tswitch (typeof obj) {\n\t\t\tcase 'object':\n\t\t\t\treturn JSON.parse(JSON.stringify(obj)) //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n\t\t\tcase 'undefined':\n\t\t\t\treturn null //this is how JSON.stringify behaves for array items\n\t\t\tdefault:\n\t\t\t\treturn obj //no need to clone primitives\n\t\t}\n\t}\n\tJSONPatcherProxy.deepClone = deepClone\n\n\tfunction escapePathComponent(str) {\n\t\tif (str.indexOf('/') == -1 && str.indexOf('~') == -1) return str\n\t\treturn str.replace(/~/g, '~0').replace(/\\//g, '~1')\n\t}\n\tJSONPatcherProxy.escapePathComponent = escapePathComponent\n\n\t/**\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\tfunction findObjectPath(instance, obj) {\n\t\tconst pathComponents = []\n\t\tlet parentAndPath = instance.parenthoodMap.get(obj)\n\t\twhile (parentAndPath && parentAndPath.path) {\n\t\t\t// because we're walking up-tree, we need to use the array as a stack\n\t\t\tpathComponents.unshift(parentAndPath.path)\n\t\t\tparentAndPath = instance.parenthoodMap.get(parentAndPath.parent)\n\t\t}\n\t\tif (pathComponents.length) {\n\t\t\tconst path = pathComponents.join('/')\n\t\t\treturn '/' + path\n\t\t}\n\t\treturn ''\n\t}\n\t/**\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\tfunction setTrap(instance, target, key, newValue) {\n\t\tconst parentPath = findObjectPath(instance, target)\n\n\t\tconst destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n\t\tif (instance.proxifiedObjectsMap.has(newValue)) {\n\t\t\tconst newValueOriginalObject = instance.proxifiedObjectsMap.get(newValue)\n\n\t\t\tinstance.parenthoodMap.set(newValueOriginalObject.originalObject, {\n\t\t\t\tparent: target,\n\t\t\t\tpath: key\n\t\t\t})\n\t\t}\n\t\t/*\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\t\tconst revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n\t\t/*\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\t\tif (revokableInstance && !instance.isProxifyingTreeNow) {\n\t\t\trevokableInstance.inherited = true\n\t\t}\n\n\t\t// if the new value is an object, make sure to watch it\n\t\tif (\n\t\t\tnewValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n\t\t) {\n\t\t\tinstance.parenthoodMap.set(newValue, {\n\t\t\t\tparent: target,\n\t\t\t\tpath: key\n\t\t\t})\n\t\t\tnewValue = instance._proxifyObjectTreeRecursively(target, newValue, key)\n\t\t}\n\t\t// let's start with this operation, and may or may not update it later\n\t\tconst operation = {\n\t\t\top: 'remove',\n\t\t\tpath: destinationPropKey\n\t\t}\n\t\tif (typeof newValue == 'undefined') {\n\t\t\t// applying De Morgan's laws would be a tad faster, but less readable\n\t\t\tif (!Array.isArray(target) && !target.hasOwnProperty(key)) {\n\t\t\t\t// `undefined` is being set to an already undefined value, keep silent\n\t\t\t\treturn Reflect.set(target, key, newValue)\n\t\t\t}\n\t\t\t// when array element is set to `undefined`, should generate replace to `null`\n\t\t\tif (Array.isArray(target)) {\n\t\t\t\t// undefined array elements are JSON.stringified to `null`\n\t\t\t\t(operation.op = 'replace'), (operation.value = null)\n\t\t\t}\n\t\t\tconst oldValue = instance.proxifiedObjectsMap.get(target[key])\n\t\t\t// was the deleted a proxified object?\n\t\t\tif (oldValue) {\n\t\t\t\tinstance.parenthoodMap.delete(target[key])\n\t\t\t\tinstance.disableTrapsForProxy(oldValue)\n\t\t\t\tinstance.proxifiedObjectsMap.delete(oldValue)\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tif (Array.isArray(target) && !Number.isInteger(+key.toString())) {\n\t\t\t\t/* array props (as opposed to indices) don't emit any patches, to avoid needless `length` patches */\n\t\t\t\tif (key != 'length') {\n\t\t\t\t\tconsole.warn('JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch')\n\t\t\t\t}\n\t\t\t\treturn Reflect.set(target, key, newValue)\n\t\t\t}\n\t\t\toperation.op = 'add'\n\t\t\tif (target.hasOwnProperty(key)) {\n\t\t\t\tif (typeof target[key] !== 'undefined' || Array.isArray(target)) {\n\t\t\t\t\toperation.op = 'replace' // setting `undefined` array elements is a `replace` op\n\t\t\t\t}\n\t\t\t}\n\t\t\toperation.value = newValue\n\t\t}\n\t\tconst reflectionResult = Reflect.set(target, key, newValue)\n\t\tinstance.defaultCallback(operation)\n\t\treturn reflectionResult\n\t}\n\t/**\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\tfunction deleteTrap(instance, target, key) {\n\t\tif (typeof target[key] !== 'undefined') {\n\t\t\tconst parentPath = findObjectPath(instance, target)\n\t\t\tconst destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n\t\t\tconst revokableProxyInstance = instance.proxifiedObjectsMap.get(\n\t\t\t\ttarget[key]\n\t\t\t)\n\n\t\t\tif (revokableProxyInstance) {\n\t\t\t\tif (revokableProxyInstance.inherited) {\n\t\t\t\t\t/*\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\t\t\t\t\trevokableProxyInstance.inherited = false\n\t\t\t\t} else {\n\t\t\t\t\tinstance.parenthoodMap.delete(revokableProxyInstance.originalObject)\n\t\t\t\t\tinstance.disableTrapsForProxy(revokableProxyInstance)\n\t\t\t\t\tinstance.proxifiedObjectsMap.delete(target[key])\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst reflectionResult = Reflect.deleteProperty(target, key)\n\n\t\t\tinstance.defaultCallback({\n\t\t\t\top: 'remove',\n\t\t\t\tpath: destinationPropKey\n\t\t\t})\n\n\t\t\treturn reflectionResult\n\t\t}\n\t}\n\t/* pre-define resume and pause functions to enhance constructors performance */\n\tfunction resume() {\n\t\tthis.defaultCallback = operation => {\n\t\t\tthis.isRecording && this.patches.push(operation)\n\t\t\tthis.userCallback && this.userCallback(operation)\n\t\t}\n\t\tthis.isObserving = true\n\t}\n\tfunction pause() {\n\t\tthis.defaultCallback = () => {}\n\t\tthis.isObserving = false\n\t}\n\t/**\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\tfunction JSONPatcherProxy(root, showDetachedWarning) {\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.isObserving = false\n\t\tthis.proxifiedObjectsMap = new Map()\n\t\tthis.parenthoodMap = new Map()\n\t\t// default to true\n\t\tif (typeof showDetachedWarning !== 'boolean') {\n\t\t\tshowDetachedWarning = true\n\t\t}\n\n\t\tthis.showDetachedWarning = showDetachedWarning\n\t\tthis.originalObject = root\n\t\tthis.cachedProxy = null\n\t\tthis.isRecording = false\n\t\tthis.userCallback\n\t\t/**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n\t\tthis.resume = resume.bind(this)\n\t\t/**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n\t\tthis.pause = pause.bind(this)\n\t}\n\n\tJSONPatcherProxy.prototype.generateProxyAtPath = function(parent, obj, path) {\n\t\tif (!obj) {\n\t\t\treturn obj\n\t\t}\n\t\tconst traps = {\n\t\t\tset: (target, key, value, receiver) =>\n\t\t\t\tsetTrap(this, target, key, value, receiver),\n\t\t\tdeleteProperty: (target, key) => deleteTrap(this, target, key)\n\t\t}\n\t\tconst revocableInstance = Proxy.revocable(obj, traps)\n\t\t// cache traps object to disable them later.\n\t\trevocableInstance.trapsInstance = traps\n\t\trevocableInstance.originalObject = obj\n\n\t\t/* keeping track of object's parent and path */\n\n\t\tthis.parenthoodMap.set(obj, { parent, path })\n\n\t\t/* keeping track of all the proxies to be able to revoke them later */\n\t\tthis.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance)\n\t\treturn revocableInstance.proxy\n\t}\n\t// grab tree's leaves one by one, encapsulate them into a proxy and return\n\tJSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function(\n\t\tparent,\n\t\troot,\n\t\tpath\n\t) {\n\t\tfor (let key in root) {\n\t\t\tif (root.hasOwnProperty(key)) {\n\t\t\t\tif (root[key] instanceof Object) {\n\t\t\t\t\troot[key] = this._proxifyObjectTreeRecursively(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\troot[key],\n\t\t\t\t\t\tescapePathComponent(key)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.generateProxyAtPath(parent, root, path)\n\t}\n\t// this function is for aesthetic purposes\n\tJSONPatcherProxy.prototype.proxifyObjectTree = function(root) {\n\t\t/*\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\t\tthis.pause()\n\t\tthis.isProxifyingTreeNow = true\n\t\tconst proxifiedObject = this._proxifyObjectTreeRecursively(\n\t\t\tundefined,\n\t\t\troot,\n\t\t\t''\n\t\t)\n\t\t/* OK you can record now */\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.resume()\n\t\treturn proxifiedObject\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTrapsForProxy = function(\n\t\trevokableProxyInstance\n\t) {\n\t\tif (this.showDetachedWarning) {\n\t\t\tconst message =\n \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\"\n\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.deleteProperty = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey\n\t\t\t) => {\n\t\t\t\treturn Reflect.deleteProperty(targetObject, propKey)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete revokableProxyInstance.trapsInstance.set\n\t\t\tdelete revokableProxyInstance.trapsInstance.get\n\t\t\tdelete revokableProxyInstance.trapsInstance.deleteProperty\n\t\t}\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.observe = function(record, callback) {\n\t\tif (!record && !callback) {\n\t\t\tthrow new Error('You need to either record changes or pass a callback')\n\t\t}\n\t\tthis.isRecording = record\n\t\tthis.userCallback = callback\n\t\t/*\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\t\tif (record) this.patches = []\n\t\tthis.cachedProxy = this.proxifyObjectTree(this.originalObject)\n\t\treturn this.cachedProxy\n\t}\n\t/**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n\tJSONPatcherProxy.prototype.generate = function() {\n\t\tif (!this.isRecording) {\n\t\t\tthrow new Error('You should set record to true to get patches later')\n\t\t}\n\t\treturn this.patches.splice(0, this.patches.length)\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.revoke = function() {\n\t\tthis.proxifiedObjectsMap.forEach(el => {\n\t\t\tel.revoke()\n\t\t})\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTraps = function() {\n\t\tthis.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this)\n\t}\n\treturn JSONPatcherProxy\n})()\n\nexport default JSONPatcherProxy","import { define } from './define'\r\n\r\nexport function tag(name, pure) {\r\n\treturn function (target) {\r\n\t\ttarget.pure = pure\r\n\t\tdefine(name, target)\r\n\t}\r\n}","import { h, h as createElement } from './h'\r\nimport options from './options'\r\nimport WeElement from './we-element'\r\nimport { render } from './render'\r\nimport { define } from './define'\r\nimport { tag } from './tag'\r\n\r\noptions.root.Omi = {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\noptions.root.Omi.version = '4.0.0'\r\n\r\nexport default {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\nexport {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n"]} \ No newline at end of file diff --git a/packages/omi/dist/omi.min.js b/packages/omi/dist/omi.min.js index 4ee9c57ac..5e61cdd42 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=F;for(a=arguments.length;a-- >2;)V.push(arguments[a]);n&&null!=n.children&&(V.length||V.push(n.children),delete n.children);while(V.length)if((o=V.pop())&&void 0!==o.pop)for(a=o.length;a--;)V.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===F?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!==I.vnode&&I.vnode(l),l}function n(e){var t=document.createElement("style");return t.innerText=e,t}function r(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function o(e,t){null!=e&&("function"==typeof e?e(t):e.current=t)}function i(e){return"[object Array]"===Object.prototype.toString.call(e)}function a(e){if(!e||i(e))return{};var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t}function s(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&l(e,t.nodeName):n||e._componentConstructor===t.nodeName}function l(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function c(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function u(e){var t=e.parentNode;t&&t.removeChild(e)}function p(e,t,n,r,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)o(n,null),o(r,e);else if("class"!==t||i)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===U.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,f,s):e.removeEventListener(t,f,s),(e.__l||(e.__l={}))[t]=r}else if("list"!==t&&"type"!==t&&!i&&t in e){try{e[t]=null==r?"":r}catch(e){}null!=r&&!1!==r||"spellcheck"==t||e.removeAttribute(t)}else{var l=i&&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 f(e){return this.__l[e.type](I.event&&I.event(e)||e)}function h(e,t,n,r,o,i){W++||(J=null!=o&&void 0!==o.ownerSVGElement,D=null!=e&&!("__preactattr_"in e));var a=d(e,t,n,r,i);return o&&a.parentNode!==o&&o.appendChild(a),--W||(D=!1),a}function d(e,t,n,r,o){var i=e,a=J;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),v(e,!0))),i.t=!0,i;var s=t.nodeName;if(J="svg"===s||"foreignObject"!==s&&J,s+="",(!e||!l(e,s))&&(i=c(s,J),e)){while(e.firstChild)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),v(e,!0)}var u=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!D&&f&&1===f.length&&"string"==typeof f[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=f[0]&&(u.nodeValue=f[0]):(f&&f.length||null!=u)&&y(i,f,n,r,D||null!=p.dangerouslySetInnerHTML),g(i,t.attributes,p),J=a,i}function y(e,t,n,r,o){var i,a,l,c,p,f=e.childNodes,h=[],y={},b=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&&E(e,r.constructor.updatePath))&&r.update()}),this.onChange&&this.onChange(e))}}function C(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;)V.push(arguments[a]);n&&null!=n.children&&(V.length||V.push(n.children),delete n.children);while(V.length)if((o=V.pop())&&void 0!==o.pop)for(a=o.length;a--;)V.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===F?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!==I.vnode&&I.vnode(l),l}function n(e){var t=document.createElement("style");return t.innerText=e,t}function r(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})}function o(e,t){null!=e&&("function"==typeof e?e(t):e.current=t)}function i(e){return"[object Array]"===Object.prototype.toString.call(e)}function a(e){if(!e||i(e))return{};var t={};return Object.keys(e).forEach(function(n){t[n]=e[n].value}),t}function s(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&l(e,t.nodeName):n||e._componentConstructor===t.nodeName}function l(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function c(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}function u(e){var t=e.parentNode;t&&t.removeChild(e)}function p(e,t,n,r,i){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)o(n,null),o(r,e);else if("class"!==t||i)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===U.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,f,s):e.removeEventListener(t,f,s),(e.__l||(e.__l={}))[t]=r}else if("list"!==t&&"type"!==t&&!i&&t in e){try{e[t]=null==r?"":r}catch(e){}null!=r&&!1!==r||"spellcheck"==t||e.removeAttribute(t)}else{var l=i&&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 f(e){return this.__l[e.type](I.event&&I.event(e)||e)}function h(e,t,n,r,o,i){W++||(J=null!=o&&void 0!==o.ownerSVGElement,D=null!=e&&!("__preactattr_"in e));var a=d(e,t,n,r,i);return o&&a.parentNode!==o&&o.appendChild(a),--W||(D=!1),a}function d(e,t,n,r,o){var i=e,a=J;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),v(e,!0))),i.t=!0,i;var s=t.nodeName;if(J="svg"===s||"foreignObject"!==s&&J,s+="",(!e||!l(e,s))&&(i=c(s,J),e)){while(e.firstChild)i.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(i,e),v(e,!0)}var u=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!D&&f&&1===f.length&&"string"==typeof f[0]&&null!=u&&void 0!==u.splitText&&null==u.nextSibling?u.nodeValue!=f[0]&&(u.nodeValue=f[0]):(f&&f.length||null!=u)&&y(i,f,n,r,D||null!=p.dangerouslySetInnerHTML),g(i,t.attributes,p),J=a,i}function y(e,t,n,r,o){var i,a,l,c,p,f=e.childNodes,h=[],y={},b=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&&E(e,r.constructor.updatePath))&&r.update()}),this.onChange&&this.onChange(e))}}function C(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;r 2;) {\r\n\t\tstack.push(arguments[i])\r\n\t}\r\n\tif (attributes && attributes.children != null) {\r\n\t\tif (!stack.length) stack.push(attributes.children)\r\n\t\tdelete attributes.children\r\n\t}\r\n\twhile (stack.length) {\r\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\r\n\t\t\tfor (i = child.length; i--;) stack.push(child[i])\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (typeof child === 'boolean') child = null\r\n\r\n\t\t\tif ((simple = typeof nodeName !== 'function')) {\r\n\t\t\t\tif (child == null) child = ''\r\n\t\t\t\telse if (typeof child === 'number') child = String(child)\r\n\t\t\t\telse if (typeof child !== 'string') simple = false\r\n\t\t\t}\r\n\r\n\t\t\tif (simple && lastSimple) {\r\n\t\t\t\tchildren[children.length - 1] += child\r\n\t\t\t}\r\n\t\t\telse if (children === EMPTY_CHILDREN) {\r\n\t\t\t\tchildren = [child]\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tchildren.push(child)\r\n\t\t\t}\r\n\r\n\t\t\tlastSimple = simple\r\n\t\t}\r\n\t}\r\n\r\n\tlet p = new VNode()\r\n\tp.nodeName = nodeName\r\n\tp.children = children\r\n\tp.attributes = attributes == null ? undefined : attributes\r\n\tp.key = attributes == null ? undefined : attributes.key\r\n\r\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\r\n\tif (options.vnode !== undefined) options.vnode(p)\r\n\r\n\treturn p\r\n}","/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n/**\r\n * This shim allows elements written in, or compiled to, ES5 to work on native\r\n * implementations of Custom Elements v1. It sets new.target to the value of\r\n * this.constructor so that the native HTMLElement constructor can access the\r\n * current under-construction element's definition.\r\n */\r\n(function() {\r\n\tif (\r\n\t// No Reflect, no classes, no need for shim because native custom elements\r\n\t// require ES2015 classes or Reflect.\r\n\t\twindow.Reflect === undefined ||\r\n window.customElements === undefined ||\r\n // The webcomponentsjs custom elements polyfill doesn't require\r\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\r\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')\r\n\t) {\r\n\t\treturn\r\n\t}\r\n\tconst BuiltInHTMLElement = HTMLElement\r\n\twindow.HTMLElement = function HTMLElement() {\r\n\t\treturn Reflect.construct(BuiltInHTMLElement, [], this.constructor)\r\n\t}\r\n\tHTMLElement.prototype = BuiltInHTMLElement.prototype\r\n\tHTMLElement.prototype.constructor = HTMLElement\r\n\tObject.setPrototypeOf(HTMLElement, BuiltInHTMLElement)\r\n})()\r\n\r\n\r\n\r\nexport function cssToDom(css) {\r\n\tconst node = document.createElement('style')\r\n\tnode.innerText = css\r\n\treturn node\r\n}\r\n\r\n\r\nexport function npn(str) {\r\n\treturn str.replace(/-(\\w)/g, ($, $1) => {\r\n\t\treturn $1.toUpperCase()\r\n\t})\r\n}\r\n\r\nexport function extend(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i]\r\n\treturn obj\r\n}\r\n\r\n/** Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} [ref=null]\r\n * @param {any} [value]\r\n */\r\nexport function applyRef(ref, value) {\r\n\tif (ref!=null) {\r\n\t\tif (typeof ref=='function') ref(value)\r\n\t\telse ref.current = value\r\n\t}\r\n}\r\n\r\n/**\r\n * Call a function asynchronously, as soon as possible. Makes\r\n * use of HTML Promise to schedule the callback if available,\r\n * otherwise falling back to `setTimeout` (mainly for IE<11).\r\n * @type {(callback: function) => void}\r\n */\r\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout\r\n\r\nexport function isArray(obj){\r\n\treturn Object.prototype.toString.call(obj) === '[object Array]'\r\n}\r\n\r\nexport function nProps(props){\r\n\tif (!props || isArray(props)) return {}\r\n\tconst result = {}\r\n\tObject.keys(props).forEach(key =>{\r\n\t\tresult[key] = props[key].value\r\n\t})\r\n\treturn result\r\n}\r\n","import { extend } from '../util'\r\n\r\n\r\n/**\r\n * Check if two nodes are equivalent.\r\n *\r\n * @param {Node} node\t\t\tDOM Node to compare\r\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\r\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\r\n * @private\r\n */\r\nexport function isSameNodeType(node, vnode, hydrating) {\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\t\treturn node.splitText!==undefined\r\n\t}\r\n\tif (typeof vnode.nodeName==='string') {\r\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName)\r\n\t}\r\n\treturn hydrating || node._componentConstructor===vnode.nodeName\r\n}\r\n\r\n\r\n/**\r\n * Check if an Element has a given nodeName, case-insensitively.\r\n *\r\n * @param {Element} node\tA DOM Element to inspect the name of.\r\n * @param {String} nodeName\tUnnormalized name to compare against.\r\n */\r\nexport function isNamedNode(node, nodeName) {\r\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase()\r\n}\r\n\r\n\r\n/**\r\n * Reconstruct Component-style `props` from a VNode.\r\n * Ensures default/fallback values from `defaultProps`:\r\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\r\n *\r\n * @param {VNode} vnode\r\n * @returns {Object} props\r\n */\r\nexport function getNodeProps(vnode) {\r\n\tlet props = extend({}, vnode.attributes)\r\n\tprops.children = vnode.children\r\n\r\n\tlet defaultProps = vnode.nodeName.defaultProps\r\n\tif (defaultProps!==undefined) {\r\n\t\tfor (let i in defaultProps) {\r\n\t\t\tif (props[i]===undefined) {\r\n\t\t\t\tprops[i] = defaultProps[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n","import { IS_NON_DIMENSIONAL } from '../constants'\r\nimport { applyRef } from '../util'\r\nimport options from '../options'\r\n\r\n/**\r\n * A DOM event listener\r\n * @typedef {(e: Event) => void} EventListner\r\n */\r\n\r\n/**\r\n * A mapping of event types to event listeners\r\n * @typedef {Object.} EventListenerMap\r\n */\r\n\r\n/**\r\n * Properties Preact adds to elements it creates\r\n * @typedef PreactElementExtensions\r\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\r\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\r\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\r\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\r\n */\r\n\r\n/**\r\n * A DOM element that has been extended with Preact properties\r\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\r\n */\r\n\r\n/**\r\n * Create an element with the given nodeName.\r\n * @param {string} nodeName The DOM node to create\r\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\r\n * namespace.\r\n * @returns {PreactElement} The created DOM node\r\n */\r\nexport function createNode(nodeName, isSvg) {\r\n\t/** @type {PreactElement} */\r\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName)\r\n\tnode.normalizedNodeName = nodeName\r\n\treturn node\r\n}\r\n\r\n\r\n/**\r\n * Remove a child node from its parent if attached.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode\r\n\tif (parentNode) parentNode.removeChild(node)\r\n}\r\n\r\n\r\n/**\r\n * Set a named attribute on the given Node, with special behavior for some names\r\n * and event handlers. If `value` is `null`, the attribute/handler will be\r\n * removed.\r\n * @param {PreactElement} node An element to mutate\r\n * @param {string} name The name/key to set, such as an event or attribute name\r\n * @param {*} old The last value that was set for this name/node pair\r\n * @param {*} value An attribute value, such as a function to be used as an\r\n * event handler\r\n * @param {boolean} isSvg Are we currently diffing inside an svg?\r\n * @private\r\n */\r\nexport function setAccessor(node, name, old, value, isSvg) {\r\n\tif (name==='className') name = 'class'\r\n\r\n\r\n\tif (name==='key') {\r\n\t\t// ignore\r\n\t}\r\n\telse if (name==='ref') {\r\n\t\tapplyRef(old, null)\r\n\t\tapplyRef(value, node)\r\n\t}\r\n\telse if (name==='class' && !isSvg) {\r\n\t\tnode.className = value || ''\r\n\t}\r\n\telse if (name==='style') {\r\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\r\n\t\t\tnode.style.cssText = value || ''\r\n\t\t}\r\n\t\tif (value && typeof value==='object') {\r\n\t\t\tif (typeof old!=='string') {\r\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = ''\r\n\t\t\t}\r\n\t\t\tfor (let i in value) {\r\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if (name==='dangerouslySetInnerHTML') {\r\n\t\tif (value) node.innerHTML = value.__html || ''\r\n\t}\r\n\telse if (name[0]=='o' && name[1]=='n') {\r\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''))\r\n\t\tname = name.toLowerCase().substring(2)\r\n\t\tif (value) {\r\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\t(node._listeners || (node._listeners = {}))[name] = value\r\n\t}\r\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\r\n\t\t// Attempt to set a DOM property to the given value.\r\n\t\t// IE & FF throw for certain property-value combinations.\r\n\t\ttry {\r\n\t\t\tnode[name] = value==null ? '' : value\r\n\t\t} catch (e) { }\r\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name)\r\n\t}\r\n\telse {\r\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')))\r\n\t\t// spellcheck is treated differently than all other boolean values and\r\n\t\t// should not be removed when the value is `false`. See:\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\r\n\t\tif (value==null || value===false) {\r\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase())\r\n\t\t\telse node.removeAttribute(name)\r\n\t\t}\r\n\t\telse if (typeof value === 'string') {\r\n\t\t\tif (ns) {\r\n\t\t\t\tnode.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(name, value)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\treturn this._listeners[e.type](options.event && options.event(e) || e)\r\n}","import { ATTR_KEY } from '../constants'\r\nimport { isSameNodeType, isNamedNode } from './index'\r\nimport { createNode, setAccessor } from '../dom/index'\r\nimport { npn } from '../util'\r\nimport { removeNode } from '../dom/index'\r\n\r\n/** Queue of components that have been mounted and are awaiting componentDidMount */\r\nexport const mounts = []\r\n\r\n/** Diff recursion count, used to track the end of the diff cycle. */\r\nexport let diffLevel = 0\r\n\r\n/** Global flag indicating if the diff is currently within an SVG */\r\nlet isSvgMode = false\r\n\r\n/** Global flag indicating if the diff is performing hydration */\r\nlet hydrating = false\r\n\r\n\r\n\r\n\r\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\r\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\r\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\r\n *\t@returns {Element} dom\t\t\tThe created/mutated element\r\n *\t@private\r\n */\r\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\r\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\r\n\tif (!diffLevel++) {\r\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\r\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined\r\n\r\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\r\n\t\thydrating = dom!=null && !(ATTR_KEY in dom)\r\n\t}\r\n\r\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot)\r\n\r\n\t// append the element if its a new parent\r\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret)\r\n\r\n\t// diffLevel being reduced to 0 means we're exiting the diff\r\n\tif (!--diffLevel) {\r\n\t\thydrating = false\r\n\t\t// invoke queued componentDidMount lifecycle methods\r\n\t\t\r\n\t}\r\n\r\n\treturn ret\r\n}\r\n\r\n\r\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\r\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\r\n\tlet out = dom,\r\n\t\tprevSvgMode = isSvgMode\r\n\r\n\t// empty values (null, undefined, booleans) render as empty Text nodes\r\n\tif (vnode==null || typeof vnode==='boolean') vnode = ''\r\n\r\n\r\n\t// Fast case: Strings & Numbers create/update Text nodes.\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\r\n\t\t// update if it's already a Text node:\r\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\r\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\r\n\t\t\tif (dom.nodeValue!=vnode) {\r\n\t\t\t\tdom.nodeValue = vnode\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\r\n\t\t\tout = document.createTextNode(vnode)\r\n\t\t\tif (dom) {\r\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\t\t\t\trecollectNodeTree(dom, true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tout[ATTR_KEY] = true\r\n\r\n\t\treturn out\r\n\t}\r\n\r\n\r\n\t// If the VNode represents a Component, perform a component diff:\r\n\tlet vnodeName = vnode.nodeName\r\n\t\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode\r\n\r\n\r\n\t// If there's no existing element or it's the wrong type, create a new one:\r\n\tvnodeName = String(vnodeName)\r\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\r\n\t\tout = createNode(vnodeName, isSvgMode)\r\n\r\n\t\tif (dom) {\r\n\t\t\t// move children into the replacement node\r\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild)\r\n\r\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\r\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\r\n\t\t\t// recycle the old element (skips non-Element node types)\r\n\t\t\trecollectNodeTree(dom, true)\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tlet fc = out.firstChild,\r\n\t\tprops = out[ATTR_KEY],\r\n\t\tvchildren = vnode.children\r\n\r\n\tif (props==null) {\r\n\t\tprops = out[ATTR_KEY] = {}\r\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value\r\n\t}\r\n\r\n\t// Optimization: fast-path for elements containing a single TextNode:\r\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\r\n\t\tif (fc.nodeValue!=vchildren[0]) {\r\n\t\t\tfc.nodeValue = vchildren[0]\r\n\t\t}\r\n\t}\r\n\t// otherwise, if there are existing or new children, diff them:\r\n\telse if (vchildren && vchildren.length || fc!=null) {\r\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null)\r\n\t}\r\n\r\n\r\n\t// Apply attributes/props from VNode to the DOM Element:\r\n\tdiffAttributes(out, vnode.attributes, props)\r\n\r\n\r\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\r\n\tisSvgMode = prevSvgMode\r\n\r\n\treturn out\r\n}\r\n\r\n\r\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\r\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\r\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\r\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\r\n *\t@param {Boolean} mountAll\r\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\r\n */\r\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\r\n\tlet originalChildren = dom.childNodes,\r\n\t\tchildren = [],\r\n\t\tkeyed = {},\r\n\t\tkeyedLen = 0,\r\n\t\tmin = 0,\r\n\t\tlen = originalChildren.length,\r\n\t\tchildrenLen = 0,\r\n\t\tvlen = vchildren ? vchildren.length : 0,\r\n\t\tj, c, f, vchild, child\r\n\r\n\t// Build up a map of keyed children and an Array of unkeyed children:\r\n\tif (len!==0) {\r\n\t\tfor (let i=0; i {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t} else {\r\n\t\tconst key = fixPath(patch.path)\r\n\t\tpatchs[key] = patch.value\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t}\r\n}\r\n\r\nexport function render(vnode, parent, store) {\r\n\tparent = typeof parent === 'string' ? document.querySelector(parent) : parent\r\n\tif (store) {\r\n\t\tstore.instances = []\r\n\t\textendStoreUpate(store)\r\n\t\toptions.store = store\r\n\t\tstore.data = new JSONProxy(store.data).observe(true, handler)\r\n\t}\r\n\tdiff(null, vnode, {}, false, parent, false)\r\n}\r\n\r\nfunction update(patch) {\r\n\toptions.store.update(patch)\r\n}\r\n\r\nfunction extendStoreUpate(store) {\r\n\tstore.update = function (patch) {\r\n\t\tconst updateAll = matchGlobalData(this.globalData, patch)\r\n\r\n\t\tif (Object.keys(patch).length > 0) {\r\n\t\t\tthis.instances.forEach(instance => {\r\n\t\t\t\tif (updateAll || this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath)) {\r\n\t\t\t\t\tinstance.update()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tthis.onChange && this.onChange(patch)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction matchGlobalData(globalData, diffResult) {\r\n\tif (!globalData) return false\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (globalData.indexOf(keyA) > -1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let i = 0, len = globalData.length; i < len; i++) {\r\n\t\t\tif (includePath(keyA, globalData[i])) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction needUpdate(diffResult, updatePath) {\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (updatePath[keyA]) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let keyB in updatePath) {\r\n\t\t\tif (includePath(keyA, keyB)) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction includePath(pathA, pathB) {\r\n\tif (pathA.indexOf(pathB) === 0) {\r\n\t\tconst next = pathA.substr(pathB.length, 1)\r\n\t\tif (next === '[' || next === '.') {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction fixPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index) {\r\n\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmpPath += item\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}\r\n\r\nfunction getArrayPatch(path) {\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tlet current = options.store.data[arr[0]]\r\n\tfor (let i = 1, len = arr.length; i < len - 1; i++) {\r\n\t\tcurrent = current[arr[i]]\r\n\t}\r\n\treturn { k: fixArrPath(path), v: current }\r\n}\r\n\r\nfunction fixArrPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tconst len = arr.length\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index < len - 1) {\r\n\t\t\tif (index) {\r\n\t\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += item\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}","const OBJECTTYPE = '[object Object]'\r\nconst ARRAYTYPE = '[object Array]'\r\n\r\nexport function define(name, ctor) {\r\n\tcustomElements.define(name, ctor)\r\n\tif (ctor.data && !ctor.pure) {\r\n\t\tctor.updatePath = getUpdatePath(ctor.data)\r\n\t}\r\n}\r\n\r\nexport function getUpdatePath(data) {\r\n\tconst result = {}\r\n\tdataToPath(data, result)\r\n\treturn result\r\n}\r\n\r\nfunction dataToPath(data, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[key] = true\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _objToPath(data, path, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[path + '.' + key] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], path + '.' + key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], path + '.' + key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _arrayToPath(data, path, result) {\r\n\tdata.forEach((item, index) => {\r\n\t\tresult[path + '[' + index + ']'] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(item)\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(item, path + '[' + index + ']', result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(item, path + '[' + index + ']', result)\r\n\t\t}\r\n\t})\r\n}","function getGlobal() {\r\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\r\n\t\tif (typeof self !== 'undefined') {\r\n\t\t\treturn self\r\n\t\t} else if (typeof window !== 'undefined') {\r\n\t\t\treturn window\r\n\t\t} else if (typeof global !== 'undefined') {\r\n\t\t\treturn global\r\n\t\t}\r\n\t\treturn (function(){\r\n\t\t\treturn this\r\n\t\t})()\r\n\t\t\r\n\t}\r\n\treturn global\r\n}\r\n\r\n/** Global options\r\n *\t@public\r\n *\t@namespace options {Object}\r\n */\r\nexport default {\r\n\r\n\tstore: null,\r\n\t\r\n\troot: getGlobal()\r\n\t//componentChange(component, element) { },\r\n\t/** If `true`, `prop` changes trigger synchronous component updates.\r\n\t *\t@name syncComponentUpdates\r\n\t *\t@type Boolean\r\n\t *\t@default true\r\n\t */\r\n\t//syncComponentUpdates: true,\r\n\r\n\t/** Processes all created VNodes.\r\n\t *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\r\n\t */\r\n\t//vnode(vnode) { }\r\n\r\n\t/** Hook invoked after a component is mounted. */\r\n\t//afterMount(component) { },\r\n\r\n\t/** Hook invoked after the DOM is updated with a component's latest render. */\r\n\t//afterUpdate(component) { }\r\n\r\n\t/** Hook invoked immediately before a component is unmounted. */\r\n\t// beforeUnmount(component) { }\r\n}\r\n","import { cssToDom, nProps } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\n\nexport default class WeElement extends HTMLElement {\n\tconstructor() {\n\t\tsuper()\n\t\tthis.props = nProps(this.constructor.props)\n\t\tthis.data = this.constructor.data || {}\n\t}\n\n\tconnectedCallback() {\n\t\tthis.store = options.store\n\t\tif (this.store){\n\t\t\tthis.store.instances.push(this)\n\t\t}\n\t\tthis.install()\n \n\t\tconst shadowRoot = this.attachShadow({ mode: 'open' })\n\n\t\tthis.css && shadowRoot.appendChild(cssToDom(this.css()))\n\t\tthis.host = diff(null, this.render(this.props, (!this.constructor.pure && this.store) ? this.store.data : this.data), {}, false, null, false)\n\t\tshadowRoot.appendChild(this.host)\n\n\t\tthis.installed()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.uninstall()\n\t\tif (this.store) {\n\t\t\tfor (let i = 0, len = this.store.instances.length; i < len; i++) {\n\t\t\t\tif (this.store.instances[i] === this) {\n\t\t\t\t\tthis.store.instances.splice(i, 1)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.beforeUpdate()\n\t\tdiff(this.host, this.render(this.props, (!this.constructor.pure && this.store) ? this.store.data : this.data))\n\t\tthis.afterUpdate()\n\t}\n\n\tfire(name, data){\n\t\tthis.dispatchEvent(new CustomEvent(name, { detail : data }))\n\t}\n\n\tinstall() {\n\n\t}\n\n\tinstalled() {\n\n\t}\n\n\tuninstall() {\n\n\t}\n\n\tbeforeUpdate() {\n\n\t}\n\n\tafterUpdate() {\n\n\t}\n}\n","\n\n/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst JSONPatcherProxy = (function() {\n\t/**\n * Deep clones your object and returns a new object.\n */\n\tfunction deepClone(obj) {\n\t\tswitch (typeof obj) {\n\t\t\tcase 'object':\n\t\t\t\treturn JSON.parse(JSON.stringify(obj)) //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n\t\t\tcase 'undefined':\n\t\t\t\treturn null //this is how JSON.stringify behaves for array items\n\t\t\tdefault:\n\t\t\t\treturn obj //no need to clone primitives\n\t\t}\n\t}\n\tJSONPatcherProxy.deepClone = deepClone\n\n\tfunction escapePathComponent(str) {\n\t\tif (str.indexOf('/') == -1 && str.indexOf('~') == -1) return str\n\t\treturn str.replace(/~/g, '~0').replace(/\\//g, '~1')\n\t}\n\tJSONPatcherProxy.escapePathComponent = escapePathComponent\n\n\t/**\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\tfunction findObjectPath(instance, obj) {\n\t\tconst pathComponents = []\n\t\tlet parentAndPath = instance.parenthoodMap.get(obj)\n\t\twhile (parentAndPath && parentAndPath.path) {\n\t\t\t// because we're walking up-tree, we need to use the array as a stack\n\t\t\tpathComponents.unshift(parentAndPath.path)\n\t\t\tparentAndPath = instance.parenthoodMap.get(parentAndPath.parent)\n\t\t}\n\t\tif (pathComponents.length) {\n\t\t\tconst path = pathComponents.join('/')\n\t\t\treturn '/' + path\n\t\t}\n\t\treturn ''\n\t}\n\t/**\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\tfunction setTrap(instance, target, key, newValue) {\n\t\tconst parentPath = findObjectPath(instance, target)\n\n\t\tconst destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n\t\tif (instance.proxifiedObjectsMap.has(newValue)) {\n\t\t\tconst newValueOriginalObject = instance.proxifiedObjectsMap.get(newValue)\n\n\t\t\tinstance.parenthoodMap.set(newValueOriginalObject.originalObject, {\n\t\t\t\tparent: target,\n\t\t\t\tpath: key\n\t\t\t})\n\t\t}\n\t\t/*\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\t\tconst revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n\t\t/*\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\t\tif (revokableInstance && !instance.isProxifyingTreeNow) {\n\t\t\trevokableInstance.inherited = true\n\t\t}\n\n\t\t// if the new value is an object, make sure to watch it\n\t\tif (\n\t\t\tnewValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n\t\t) {\n\t\t\tinstance.parenthoodMap.set(newValue, {\n\t\t\t\tparent: target,\n\t\t\t\tpath: key\n\t\t\t})\n\t\t\tnewValue = instance._proxifyObjectTreeRecursively(target, newValue, key)\n\t\t}\n\t\t// let's start with this operation, and may or may not update it later\n\t\tconst operation = {\n\t\t\top: 'remove',\n\t\t\tpath: destinationPropKey\n\t\t}\n\t\tif (typeof newValue == 'undefined') {\n\t\t\t// applying De Morgan's laws would be a tad faster, but less readable\n\t\t\tif (!Array.isArray(target) && !target.hasOwnProperty(key)) {\n\t\t\t\t// `undefined` is being set to an already undefined value, keep silent\n\t\t\t\treturn Reflect.set(target, key, newValue)\n\t\t\t}\n\t\t\t// when array element is set to `undefined`, should generate replace to `null`\n\t\t\tif (Array.isArray(target)) {\n\t\t\t\t// undefined array elements are JSON.stringified to `null`\n\t\t\t\t(operation.op = 'replace'), (operation.value = null)\n\t\t\t}\n\t\t\tconst oldValue = instance.proxifiedObjectsMap.get(target[key])\n\t\t\t// was the deleted a proxified object?\n\t\t\tif (oldValue) {\n\t\t\t\tinstance.parenthoodMap.delete(target[key])\n\t\t\t\tinstance.disableTrapsForProxy(oldValue)\n\t\t\t\tinstance.proxifiedObjectsMap.delete(oldValue)\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tif (Array.isArray(target) && !Number.isInteger(+key.toString())) {\n\t\t\t\t/* array props (as opposed to indices) don't emit any patches, to avoid needless `length` patches */\n\t\t\t\tif (key != 'length') {\n\t\t\t\t\tconsole.warn('JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch')\n\t\t\t\t}\n\t\t\t\treturn Reflect.set(target, key, newValue)\n\t\t\t}\n\t\t\toperation.op = 'add'\n\t\t\tif (target.hasOwnProperty(key)) {\n\t\t\t\tif (typeof target[key] !== 'undefined' || Array.isArray(target)) {\n\t\t\t\t\toperation.op = 'replace' // setting `undefined` array elements is a `replace` op\n\t\t\t\t}\n\t\t\t}\n\t\t\toperation.value = newValue\n\t\t}\n\t\tconst reflectionResult = Reflect.set(target, key, newValue)\n\t\tinstance.defaultCallback(operation)\n\t\treturn reflectionResult\n\t}\n\t/**\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\tfunction deleteTrap(instance, target, key) {\n\t\tif (typeof target[key] !== 'undefined') {\n\t\t\tconst parentPath = findObjectPath(instance, target)\n\t\t\tconst destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n\t\t\tconst revokableProxyInstance = instance.proxifiedObjectsMap.get(\n\t\t\t\ttarget[key]\n\t\t\t)\n\n\t\t\tif (revokableProxyInstance) {\n\t\t\t\tif (revokableProxyInstance.inherited) {\n\t\t\t\t\t/*\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\t\t\t\t\trevokableProxyInstance.inherited = false\n\t\t\t\t} else {\n\t\t\t\t\tinstance.parenthoodMap.delete(revokableProxyInstance.originalObject)\n\t\t\t\t\tinstance.disableTrapsForProxy(revokableProxyInstance)\n\t\t\t\t\tinstance.proxifiedObjectsMap.delete(target[key])\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst reflectionResult = Reflect.deleteProperty(target, key)\n\n\t\t\tinstance.defaultCallback({\n\t\t\t\top: 'remove',\n\t\t\t\tpath: destinationPropKey\n\t\t\t})\n\n\t\t\treturn reflectionResult\n\t\t}\n\t}\n\t/* pre-define resume and pause functions to enhance constructors performance */\n\tfunction resume() {\n\t\tthis.defaultCallback = operation => {\n\t\t\tthis.isRecording && this.patches.push(operation)\n\t\t\tthis.userCallback && this.userCallback(operation)\n\t\t}\n\t\tthis.isObserving = true\n\t}\n\tfunction pause() {\n\t\tthis.defaultCallback = () => {}\n\t\tthis.isObserving = false\n\t}\n\t/**\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\tfunction JSONPatcherProxy(root, showDetachedWarning) {\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.isObserving = false\n\t\tthis.proxifiedObjectsMap = new Map()\n\t\tthis.parenthoodMap = new Map()\n\t\t// default to true\n\t\tif (typeof showDetachedWarning !== 'boolean') {\n\t\t\tshowDetachedWarning = true\n\t\t}\n\n\t\tthis.showDetachedWarning = showDetachedWarning\n\t\tthis.originalObject = root\n\t\tthis.cachedProxy = null\n\t\tthis.isRecording = false\n\t\tthis.userCallback\n\t\t/**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n\t\tthis.resume = resume.bind(this)\n\t\t/**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n\t\tthis.pause = pause.bind(this)\n\t}\n\n\tJSONPatcherProxy.prototype.generateProxyAtPath = function(parent, obj, path) {\n\t\tif (!obj) {\n\t\t\treturn obj\n\t\t}\n\t\tconst traps = {\n\t\t\tset: (target, key, value, receiver) =>\n\t\t\t\tsetTrap(this, target, key, value, receiver),\n\t\t\tdeleteProperty: (target, key) => deleteTrap(this, target, key)\n\t\t}\n\t\tconst revocableInstance = Proxy.revocable(obj, traps)\n\t\t// cache traps object to disable them later.\n\t\trevocableInstance.trapsInstance = traps\n\t\trevocableInstance.originalObject = obj\n\n\t\t/* keeping track of object's parent and path */\n\n\t\tthis.parenthoodMap.set(obj, { parent, path })\n\n\t\t/* keeping track of all the proxies to be able to revoke them later */\n\t\tthis.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance)\n\t\treturn revocableInstance.proxy\n\t}\n\t// grab tree's leaves one by one, encapsulate them into a proxy and return\n\tJSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function(\n\t\tparent,\n\t\troot,\n\t\tpath\n\t) {\n\t\tfor (let key in root) {\n\t\t\tif (root.hasOwnProperty(key)) {\n\t\t\t\tif (root[key] instanceof Object) {\n\t\t\t\t\troot[key] = this._proxifyObjectTreeRecursively(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\troot[key],\n\t\t\t\t\t\tescapePathComponent(key)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.generateProxyAtPath(parent, root, path)\n\t}\n\t// this function is for aesthetic purposes\n\tJSONPatcherProxy.prototype.proxifyObjectTree = function(root) {\n\t\t/*\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\t\tthis.pause()\n\t\tthis.isProxifyingTreeNow = true\n\t\tconst proxifiedObject = this._proxifyObjectTreeRecursively(\n\t\t\tundefined,\n\t\t\troot,\n\t\t\t''\n\t\t)\n\t\t/* OK you can record now */\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.resume()\n\t\treturn proxifiedObject\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTrapsForProxy = function(\n\t\trevokableProxyInstance\n\t) {\n\t\tif (this.showDetachedWarning) {\n\t\t\tconst message =\n \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\"\n\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.deleteProperty = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey\n\t\t\t) => {\n\t\t\t\treturn Reflect.deleteProperty(targetObject, propKey)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete revokableProxyInstance.trapsInstance.set\n\t\t\tdelete revokableProxyInstance.trapsInstance.get\n\t\t\tdelete revokableProxyInstance.trapsInstance.deleteProperty\n\t\t}\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.observe = function(record, callback) {\n\t\tif (!record && !callback) {\n\t\t\tthrow new Error('You need to either record changes or pass a callback')\n\t\t}\n\t\tthis.isRecording = record\n\t\tthis.userCallback = callback\n\t\t/*\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\t\tif (record) this.patches = []\n\t\tthis.cachedProxy = this.proxifyObjectTree(this.originalObject)\n\t\treturn this.cachedProxy\n\t}\n\t/**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n\tJSONPatcherProxy.prototype.generate = function() {\n\t\tif (!this.isRecording) {\n\t\t\tthrow new Error('You should set record to true to get patches later')\n\t\t}\n\t\treturn this.patches.splice(0, this.patches.length)\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.revoke = function() {\n\t\tthis.proxifiedObjectsMap.forEach(el => {\n\t\t\tel.revoke()\n\t\t})\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTraps = function() {\n\t\tthis.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this)\n\t}\n\treturn JSONPatcherProxy\n})()\n\nexport default JSONPatcherProxy\nif (typeof module !== 'undefined') {\n\tmodule.exports = JSONPatcherProxy\n\tmodule.exports.default = JSONPatcherProxy\n}\n","import { define } from './define'\r\n\r\nexport function tag(name, pure) {\r\n\treturn function (target) {\r\n\t\ttarget.pure = pure\r\n\t\tdefine(name, target)\r\n\t}\r\n}","import { h, h as createElement } from './h'\r\nimport options from './options'\r\nimport WeElement from './we-element'\r\nimport { render } from './render'\r\nimport { define } from './define'\r\nimport { tag } from './tag'\r\n\r\noptions.root.Omi = {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\noptions.root.Omi.version = '4.0.0'\r\n\r\nexport default {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\nexport {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\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/render.js","../src/define.js","../src/options.js","../src/we-element.js","../src/proxy.js","../src/tag.js","../src/omi.js"],"names":["VNode","nodeName","attributes","lastSimple","child","simple","i","children","EMPTY_CHILDREN","arguments","length","stack","push","pop","String","p","key","options","vnode","cssToDom","css","node","document","createElement","innerText","npn","str","replace","$","$1","toUpperCase","applyRef","ref","value","current","isArray","obj","Object","prototype","toString","call","nProps","props","result","keys","forEach","isSameNodeType","hydrating","_componentConstructor","removeNode","name","isSvg","old","style","cssText","IS_NON_DIMENSIONAL","test","innerHTML","__html","useCapture","substring","addEventListener","eventProxy","e","removeAttribute","ns","removeAttributeNS","toLowerCase","setAttribute","className","isSvgMode","dom","context","mountAll","ret","idiff","componentRoot","diffLevel","out","splitText","parentNode","_component","nodeValue","createTextNode","replaceChild","recollectNodeTree","vnodeName","createNode","t","vchildren","firstChild","fc","a","nextSibling","innerDiffNode","dangerouslySetInnerHTML","prevSvgMode","min","len","childrenLen","vlen","j","keyedLen","originalChildren","keyed","vchild","_child","__key","trim","isHydrating","c","f","appendChild","unmountOnly","removeChildren","update","attrs","setAccessor","isWeElement","_possibleConstructorReturn","self","ReferenceError","render","parent","store","querySelector","extendStoreUpate","JSONPatcherProxy","data","observe","handler","patch","diff","_this","this","updateAll","globalData","matchGlobalData","constructor","updatePath","needUpdate","instance","onChange","diffResult","keyA","indexOf","keyB","includePath","pathA","pathB","next","substr","fixPath","path","mpPath","split","index","item","getArrayPatch","arr","fixArrPath","define","ctor","customElements","pure","dataToPath","getUpdatePath","type","_objToPath","_arrayToPath","ARRAYTYPE","target","root","global","Math","Array","window","Reflect","hasOwnProperty","BuiltInHTMLElement","HTMLElement","construct","setPrototypeOf","Promise","resolve","then","bind","setTimeout","_listeners","WeElement","shadowRoot","instances","mode","install","attachShadow","installed","disconnectedCallback","uninstall","splice","beforeUpdate","host","fire","afterUpdate","CustomEvent","detail","JSON","escapePathComponent","deepClone","pathComponents","parentAndPath","parenthoodMap","get","parentPath","newValueOriginalObject","revokableInstance","inherited","proxifiedObjectsMap","has","newValue","set","operation","destinationPropKey","op","delete","oldValue","disableTrapsForProxy","Number","console","warn","reflectionResult","defaultCallback","revokableProxyInstance","deleteProperty","isRecording","patches","userCallback","isObserving","showDetachedWarning","cachedProxy","resume","pause","_this2","deleteTrap","Proxy","revocable","revocableInstance","trapsInstance","traps","originalObject","_proxifyObjectTreeRecursively","generateProxyAtPath","proxifyObjectTree","isProxifyingTreeNow","proxifiedObject","targetObject","message","propKey","record","callback","generate","revoke","el","disableTraps","timeout","patchs","clearTimeout","tag","h","Omi","version","module","exports"],"mappings":"wBACO,SAASA,MCKT,QAAWC,GAAAA,EAAUC,GAC3B,GAA+BC,GAAYC,EAAOC,EAAQC,EAAtDC,EAAWC,CACf,KAAKF,EAAIG,UAAUC,OAAQJ,KAAM,GAChCK,EAAMC,KAAKH,UAAUH,GAElBJ,IAAqC,MAAvBA,EAAWK,WACvBI,EAAMD,QAAQC,EAAMC,KAAKV,EAAWK,gBAClCL,GAAWK,SAEnB,OAAOI,EAAMD,OACZ,IAAKN,EAAQO,EAAME,YAAAA,KAAUT,EAAMS,IAClC,IAAKP,EAAIF,EAAMM,OAAQJ,KAAMK,EAAMC,KAAKR,EAAME,QAGzB,iBAAVF,KAAqBA,EAAQ,OAEnCC,EAA6B,kBAAbJ,MACP,MAATG,EAAeA,EAAQ,GACD,gBAAVA,GAAoBA,GAAQU,GAClB,gBAAVV,KAAoBC,GAAAA,IAGjCA,GAAUF,EACbI,EAASA,EAASG,OAAS,IAAMN,EAEzBG,IAAaC,EACrBD,GAAYH,GAGZG,EAASK,KAAKR,GAGfD,EAAaE,CAIf,IAAIU,GAAI,GAAIf,EASZ,OARAe,GAAEd,SAAWA,EACbc,EAAER,SAAWA,EACbQ,EAAEb,WAA2B,MAAdA,MAAAA,GAAiCA,EAChDa,EAAEC,IAAoB,MAAdd,MAAAA,GAAiCA,EAAWc,QAGpD,KAAIC,EAAQC,OAAqBD,EAAQC,MAAMH,GAExCA,ECZD,QAASI,GAATC,GACN,GAAMC,GAAOC,SAASC,cAAc,QAEpC,OADAF,GAAKG,UAAYJ,EACVC,EAID,QAAAI,GAAAC,GACN,MAAOA,GAAIC,QAAQ,SAAU,SAACC,EAAGC,GAChC,MAAOA,GAAGC,gBAaL,QAASC,GAATC,EAAuBC,GACpB,MAALD,IACa,kBAAL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AsChO,SAKrCqH,EALDzF,UAAA8N,OAAA,WAMA9H,KAAAkF,oBAAA3K,QAAA,SAAAwN,iBAOCtI,EAJDzF,UAAAgO,aAAA,WAKAhI,KAAAkF,oBAAA3K,QAAAyF,KAAA2F,qBAAA3F,YAGAiI,EAAA,KAGAC,sBJ7XDC,aAAaF,mCAIZE,GAAAA,EAAAA,GAAaF,EAAAA,EACbA,EAAUzC,WAAO,WAAW3G,EAAAqJ,GAC3BA,WAEAD,CACCpJ,GAAAA,GAAOqJ,EAAPrI,EAAAsB,KACA+G,GAAAA,GAAArI,EAAAlG,MACAsO,EAHD5E,WAAA,WAHDxE,EAOOqJ,GACNA,WKjBcE,KAAIxN,KACnBwN,IAAAA,EACC/F,UAAOP,EACPH,OAAO/G,EACPyN,EAHDA,EAIApP,cAAAoP,mBCAO/F,GAGPlD,EAAAA,KAHkBkJ,IAAAC,QAAA,OAKlBtP,IAAAA,IACAN,IAAAA,EACAgJ,UAAAA,EAPDvC,OAAAA,MAUAzG,cAAA0P,YAEA1G,OAAAA,EAAe,oBAGdvC,QAHcoJ,OAAAC,QAAAH,EAAApJ,KAAAoJ,IAAAA","file":"omi.min.js","sourcesContent":["/** Virtual DOM Node */\r\nexport function VNode() {}\r\n","import { VNode } from './vnode'\r\nimport options from './options'\r\n\r\nconst stack = []\r\nconst EMPTY_CHILDREN = []\r\n\r\nexport function h(nodeName, attributes) {\r\n\tlet children = EMPTY_CHILDREN, lastSimple, child, simple, i\r\n\tfor (i = arguments.length; i-- > 2;) {\r\n\t\tstack.push(arguments[i])\r\n\t}\r\n\tif (attributes && attributes.children != null) {\r\n\t\tif (!stack.length) stack.push(attributes.children)\r\n\t\tdelete attributes.children\r\n\t}\r\n\twhile (stack.length) {\r\n\t\tif ((child = stack.pop()) && child.pop !== undefined) {\r\n\t\t\tfor (i = child.length; i--;) stack.push(child[i])\r\n\t\t}\r\n\t\telse {\r\n\t\t\tif (typeof child === 'boolean') child = null\r\n\r\n\t\t\tif ((simple = typeof nodeName !== 'function')) {\r\n\t\t\t\tif (child == null) child = ''\r\n\t\t\t\telse if (typeof child === 'number') child = String(child)\r\n\t\t\t\telse if (typeof child !== 'string') simple = false\r\n\t\t\t}\r\n\r\n\t\t\tif (simple && lastSimple) {\r\n\t\t\t\tchildren[children.length - 1] += child\r\n\t\t\t}\r\n\t\t\telse if (children === EMPTY_CHILDREN) {\r\n\t\t\t\tchildren = [child]\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tchildren.push(child)\r\n\t\t\t}\r\n\r\n\t\t\tlastSimple = simple\r\n\t\t}\r\n\t}\r\n\r\n\tlet p = new VNode()\r\n\tp.nodeName = nodeName\r\n\tp.children = children\r\n\tp.attributes = attributes == null ? undefined : attributes\r\n\tp.key = attributes == null ? undefined : attributes.key\r\n\r\n\t// if a \"vnode hook\" is defined, pass every created VNode to it\r\n\tif (options.vnode !== undefined) options.vnode(p)\r\n\r\n\treturn p\r\n}","/**\r\n * @license\r\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\r\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\r\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\r\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\r\n * Code distributed by Google as part of the polymer project is also\r\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\r\n */\r\n\r\n/**\r\n * This shim allows elements written in, or compiled to, ES5 to work on native\r\n * implementations of Custom Elements v1. It sets new.target to the value of\r\n * this.constructor so that the native HTMLElement constructor can access the\r\n * current under-construction element's definition.\r\n */\r\n(function() {\r\n\tif (\r\n\t// No Reflect, no classes, no need for shim because native custom elements\r\n\t// require ES2015 classes or Reflect.\r\n\t\twindow.Reflect === undefined ||\r\n window.customElements === undefined ||\r\n // The webcomponentsjs custom elements polyfill doesn't require\r\n // ES2015-compatible construction (`super()` or `Reflect.construct`).\r\n window.customElements.hasOwnProperty('polyfillWrapFlushCallback')\r\n\t) {\r\n\t\treturn\r\n\t}\r\n\tconst BuiltInHTMLElement = HTMLElement\r\n\twindow.HTMLElement = function HTMLElement() {\r\n\t\treturn Reflect.construct(BuiltInHTMLElement, [], this.constructor)\r\n\t}\r\n\tHTMLElement.prototype = BuiltInHTMLElement.prototype\r\n\tHTMLElement.prototype.constructor = HTMLElement\r\n\tObject.setPrototypeOf(HTMLElement, BuiltInHTMLElement)\r\n})()\r\n\r\n\r\n\r\nexport function cssToDom(css) {\r\n\tconst node = document.createElement('style')\r\n\tnode.innerText = css\r\n\treturn node\r\n}\r\n\r\n\r\nexport function npn(str) {\r\n\treturn str.replace(/-(\\w)/g, ($, $1) => {\r\n\t\treturn $1.toUpperCase()\r\n\t})\r\n}\r\n\r\nexport function extend(obj, props) {\r\n\tfor (let i in props) obj[i] = props[i]\r\n\treturn obj\r\n}\r\n\r\n/** Invoke or update a ref, depending on whether it is a function or object ref.\r\n * @param {object|function} [ref=null]\r\n * @param {any} [value]\r\n */\r\nexport function applyRef(ref, value) {\r\n\tif (ref!=null) {\r\n\t\tif (typeof ref=='function') ref(value)\r\n\t\telse ref.current = value\r\n\t}\r\n}\r\n\r\n/**\r\n * Call a function asynchronously, as soon as possible. Makes\r\n * use of HTML Promise to schedule the callback if available,\r\n * otherwise falling back to `setTimeout` (mainly for IE<11).\r\n * @type {(callback: function) => void}\r\n */\r\nexport const defer = typeof Promise=='function' ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout\r\n\r\nexport function isArray(obj){\r\n\treturn Object.prototype.toString.call(obj) === '[object Array]'\r\n}\r\n\r\nexport function nProps(props){\r\n\tif (!props || isArray(props)) return {}\r\n\tconst result = {}\r\n\tObject.keys(props).forEach(key =>{\r\n\t\tresult[key] = props[key].value\r\n\t})\r\n\treturn result\r\n}\r\n","import { extend } from '../util'\r\n\r\n\r\n/**\r\n * Check if two nodes are equivalent.\r\n *\r\n * @param {Node} node\t\t\tDOM Node to compare\r\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\r\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\r\n * @private\r\n */\r\nexport function isSameNodeType(node, vnode, hydrating) {\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\t\treturn node.splitText!==undefined\r\n\t}\r\n\tif (typeof vnode.nodeName==='string') {\r\n\t\treturn !node._componentConstructor && isNamedNode(node, vnode.nodeName)\r\n\t}\r\n\treturn hydrating || node._componentConstructor===vnode.nodeName\r\n}\r\n\r\n\r\n/**\r\n * Check if an Element has a given nodeName, case-insensitively.\r\n *\r\n * @param {Element} node\tA DOM Element to inspect the name of.\r\n * @param {String} nodeName\tUnnormalized name to compare against.\r\n */\r\nexport function isNamedNode(node, nodeName) {\r\n\treturn node.normalizedNodeName===nodeName || node.nodeName.toLowerCase()===nodeName.toLowerCase()\r\n}\r\n\r\n\r\n/**\r\n * Reconstruct Component-style `props` from a VNode.\r\n * Ensures default/fallback values from `defaultProps`:\r\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\r\n *\r\n * @param {VNode} vnode\r\n * @returns {Object} props\r\n */\r\nexport function getNodeProps(vnode) {\r\n\tlet props = extend({}, vnode.attributes)\r\n\tprops.children = vnode.children\r\n\r\n\tlet defaultProps = vnode.nodeName.defaultProps\r\n\tif (defaultProps!==undefined) {\r\n\t\tfor (let i in defaultProps) {\r\n\t\t\tif (props[i]===undefined) {\r\n\t\t\t\tprops[i] = defaultProps[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\treturn props\r\n}\r\n","import { IS_NON_DIMENSIONAL } from '../constants'\r\nimport { applyRef } from '../util'\r\nimport options from '../options'\r\n\r\n/**\r\n * A DOM event listener\r\n * @typedef {(e: Event) => void} EventListner\r\n */\r\n\r\n/**\r\n * A mapping of event types to event listeners\r\n * @typedef {Object.} EventListenerMap\r\n */\r\n\r\n/**\r\n * Properties Preact adds to elements it creates\r\n * @typedef PreactElementExtensions\r\n * @property {string} [normalizedNodeName] A normalized node name to use in diffing\r\n * @property {EventListenerMap} [_listeners] A map of event listeners added by components to this DOM node\r\n * @property {import('../component').Component} [_component] The component that rendered this DOM node\r\n * @property {function} [_componentConstructor] The constructor of the component that rendered this DOM node\r\n */\r\n\r\n/**\r\n * A DOM element that has been extended with Preact properties\r\n * @typedef {Element & ElementCSSInlineStyle & PreactElementExtensions} PreactElement\r\n */\r\n\r\n/**\r\n * Create an element with the given nodeName.\r\n * @param {string} nodeName The DOM node to create\r\n * @param {boolean} [isSvg=false] If `true`, creates an element within the SVG\r\n * namespace.\r\n * @returns {PreactElement} The created DOM node\r\n */\r\nexport function createNode(nodeName, isSvg) {\r\n\t/** @type {PreactElement} */\r\n\tlet node = isSvg ? document.createElementNS('http://www.w3.org/2000/svg', nodeName) : document.createElement(nodeName)\r\n\tnode.normalizedNodeName = nodeName\r\n\treturn node\r\n}\r\n\r\n\r\n/**\r\n * Remove a child node from its parent if attached.\r\n * @param {Node} node The node to remove\r\n */\r\nexport function removeNode(node) {\r\n\tlet parentNode = node.parentNode\r\n\tif (parentNode) parentNode.removeChild(node)\r\n}\r\n\r\n\r\n/**\r\n * Set a named attribute on the given Node, with special behavior for some names\r\n * and event handlers. If `value` is `null`, the attribute/handler will be\r\n * removed.\r\n * @param {PreactElement} node An element to mutate\r\n * @param {string} name The name/key to set, such as an event or attribute name\r\n * @param {*} old The last value that was set for this name/node pair\r\n * @param {*} value An attribute value, such as a function to be used as an\r\n * event handler\r\n * @param {boolean} isSvg Are we currently diffing inside an svg?\r\n * @private\r\n */\r\nexport function setAccessor(node, name, old, value, isSvg) {\r\n\tif (name==='className') name = 'class'\r\n\r\n\r\n\tif (name==='key') {\r\n\t\t// ignore\r\n\t}\r\n\telse if (name==='ref') {\r\n\t\tapplyRef(old, null)\r\n\t\tapplyRef(value, node)\r\n\t}\r\n\telse if (name==='class' && !isSvg) {\r\n\t\tnode.className = value || ''\r\n\t}\r\n\telse if (name==='style') {\r\n\t\tif (!value || typeof value==='string' || typeof old==='string') {\r\n\t\t\tnode.style.cssText = value || ''\r\n\t\t}\r\n\t\tif (value && typeof value==='object') {\r\n\t\t\tif (typeof old!=='string') {\r\n\t\t\t\tfor (let i in old) if (!(i in value)) node.style[i] = ''\r\n\t\t\t}\r\n\t\t\tfor (let i in value) {\r\n\t\t\t\tnode.style[i] = typeof value[i]==='number' && IS_NON_DIMENSIONAL.test(i)===false ? (value[i]+'px') : value[i]\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\telse if (name==='dangerouslySetInnerHTML') {\r\n\t\tif (value) node.innerHTML = value.__html || ''\r\n\t}\r\n\telse if (name[0]=='o' && name[1]=='n') {\r\n\t\tlet useCapture = name !== (name=name.replace(/Capture$/, ''))\r\n\t\tname = name.toLowerCase().substring(2)\r\n\t\tif (value) {\r\n\t\t\tif (!old) node.addEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\telse {\r\n\t\t\tnode.removeEventListener(name, eventProxy, useCapture)\r\n\t\t}\r\n\t\t(node._listeners || (node._listeners = {}))[name] = value\r\n\t}\r\n\telse if (name!=='list' && name!=='type' && !isSvg && name in node) {\r\n\t\t// Attempt to set a DOM property to the given value.\r\n\t\t// IE & FF throw for certain property-value combinations.\r\n\t\ttry {\r\n\t\t\tnode[name] = value==null ? '' : value\r\n\t\t} catch (e) { }\r\n\t\tif ((value==null || value===false) && name!='spellcheck') node.removeAttribute(name)\r\n\t}\r\n\telse {\r\n\t\tlet ns = isSvg && (name !== (name = name.replace(/^xlink:?/, '')))\r\n\t\t// spellcheck is treated differently than all other boolean values and\r\n\t\t// should not be removed when the value is `false`. See:\r\n\t\t// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-spellcheck\r\n\t\tif (value==null || value===false) {\r\n\t\t\tif (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase())\r\n\t\t\telse node.removeAttribute(name)\r\n\t\t}\r\n\t\telse if (typeof value === 'string') {\r\n\t\t\tif (ns) {\r\n\t\t\t\tnode.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value)\r\n\t\t\t} else {\r\n\t\t\t\tnode.setAttribute(name, value)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\r\n/**\r\n * Proxy an event to hooked event handlers\r\n * @param {Event} e The event object from the browser\r\n * @private\r\n */\r\nfunction eventProxy(e) {\r\n\treturn this._listeners[e.type](options.event && options.event(e) || e)\r\n}","import { ATTR_KEY } from '../constants'\r\nimport { isSameNodeType, isNamedNode } from './index'\r\nimport { createNode, setAccessor } from '../dom/index'\r\nimport { npn } from '../util'\r\nimport { removeNode } from '../dom/index'\r\n\r\n/** Queue of components that have been mounted and are awaiting componentDidMount */\r\nexport const mounts = []\r\n\r\n/** Diff recursion count, used to track the end of the diff cycle. */\r\nexport let diffLevel = 0\r\n\r\n/** Global flag indicating if the diff is currently within an SVG */\r\nlet isSvgMode = false\r\n\r\n/** Global flag indicating if the diff is performing hydration */\r\nlet hydrating = false\r\n\r\n\r\n\r\n\r\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\r\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\r\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\r\n *\t@returns {Element} dom\t\t\tThe created/mutated element\r\n *\t@private\r\n */\r\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot) {\r\n\t// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\r\n\tif (!diffLevel++) {\r\n\t\t// when first starting the diff, check if we're diffing an SVG or within an SVG\r\n\t\tisSvgMode = parent!=null && parent.ownerSVGElement!==undefined\r\n\r\n\t\t// hydration is indicated by the existing element to be diffed not having a prop cache\r\n\t\thydrating = dom!=null && !(ATTR_KEY in dom)\r\n\t}\r\n\r\n\tlet ret = idiff(dom, vnode, context, mountAll, componentRoot)\r\n\r\n\t// append the element if its a new parent\r\n\tif (parent && ret.parentNode!==parent) parent.appendChild(ret)\r\n\r\n\t// diffLevel being reduced to 0 means we're exiting the diff\r\n\tif (!--diffLevel) {\r\n\t\thydrating = false\r\n\t\t// invoke queued componentDidMount lifecycle methods\r\n\t\t\r\n\t}\r\n\r\n\treturn ret\r\n}\r\n\r\n\r\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\r\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\r\n\tlet out = dom,\r\n\t\tprevSvgMode = isSvgMode\r\n\r\n\t// empty values (null, undefined, booleans) render as empty Text nodes\r\n\tif (vnode==null || typeof vnode==='boolean') vnode = ''\r\n\r\n\r\n\t// Fast case: Strings & Numbers create/update Text nodes.\r\n\tif (typeof vnode==='string' || typeof vnode==='number') {\r\n\r\n\t\t// update if it's already a Text node:\r\n\t\tif (dom && dom.splitText!==undefined && dom.parentNode && (!dom._component || componentRoot)) {\r\n\t\t\t/* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\r\n\t\t\tif (dom.nodeValue!=vnode) {\r\n\t\t\t\tdom.nodeValue = vnode\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\t// it wasn't a Text node: replace it with one and recycle the old Element\r\n\t\t\tout = document.createTextNode(vnode)\r\n\t\t\tif (dom) {\r\n\t\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\t\t\t\trecollectNodeTree(dom, true)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tout[ATTR_KEY] = true\r\n\r\n\t\treturn out\r\n\t}\r\n\r\n\r\n\t// If the VNode represents a Component, perform a component diff:\r\n\tlet vnodeName = vnode.nodeName\r\n\t\r\n\r\n\t// Tracks entering and exiting SVG namespace when descending through the tree.\r\n\tisSvgMode = vnodeName==='svg' ? true : vnodeName==='foreignObject' ? false : isSvgMode\r\n\r\n\r\n\t// If there's no existing element or it's the wrong type, create a new one:\r\n\tvnodeName = String(vnodeName)\r\n\tif (!dom || !isNamedNode(dom, vnodeName)) {\r\n\t\tout = createNode(vnodeName, isSvgMode)\r\n\r\n\t\tif (dom) {\r\n\t\t\t// move children into the replacement node\r\n\t\t\twhile (dom.firstChild) out.appendChild(dom.firstChild)\r\n\r\n\t\t\t// if the previous Element was mounted into the DOM, replace it inline\r\n\t\t\tif (dom.parentNode) dom.parentNode.replaceChild(out, dom)\r\n\r\n\t\t\t// recycle the old element (skips non-Element node types)\r\n\t\t\trecollectNodeTree(dom, true)\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tlet fc = out.firstChild,\r\n\t\tprops = out[ATTR_KEY],\r\n\t\tvchildren = vnode.children\r\n\r\n\tif (props==null) {\r\n\t\tprops = out[ATTR_KEY] = {}\r\n\t\tfor (let a=out.attributes, i=a.length; i--; ) props[a[i].name] = a[i].value\r\n\t}\r\n\r\n\t// Optimization: fast-path for elements containing a single TextNode:\r\n\tif (!hydrating && vchildren && vchildren.length===1 && typeof vchildren[0]==='string' && fc!=null && fc.splitText!==undefined && fc.nextSibling==null) {\r\n\t\tif (fc.nodeValue!=vchildren[0]) {\r\n\t\t\tfc.nodeValue = vchildren[0]\r\n\t\t}\r\n\t}\r\n\t// otherwise, if there are existing or new children, diff them:\r\n\telse if (vchildren && vchildren.length || fc!=null) {\r\n\t\tinnerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML!=null)\r\n\t}\r\n\r\n\r\n\t// Apply attributes/props from VNode to the DOM Element:\r\n\tdiffAttributes(out, vnode.attributes, props)\r\n\r\n\r\n\t// restore previous SVG mode: (in case we're exiting an SVG namespace)\r\n\tisSvgMode = prevSvgMode\r\n\r\n\treturn out\r\n}\r\n\r\n\r\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\r\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\r\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\r\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\r\n *\t@param {Boolean} mountAll\r\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\r\n */\r\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\r\n\tlet originalChildren = dom.childNodes,\r\n\t\tchildren = [],\r\n\t\tkeyed = {},\r\n\t\tkeyedLen = 0,\r\n\t\tmin = 0,\r\n\t\tlen = originalChildren.length,\r\n\t\tchildrenLen = 0,\r\n\t\tvlen = vchildren ? vchildren.length : 0,\r\n\t\tj, c, f, vchild, child\r\n\r\n\t// Build up a map of keyed children and an Array of unkeyed children:\r\n\tif (len!==0) {\r\n\t\tfor (let i=0; i {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t} else {\r\n\t\tconst key = fixPath(patch.path)\r\n\t\tpatchs[key] = patch.value\r\n\t\ttimeout = setTimeout(() => {\r\n\t\t\tupdate(patchs)\r\n\t\t\tpatchs = {}\r\n\t\t})\r\n\t}\r\n}\r\n\r\nexport function render(vnode, parent, store) {\r\n\tparent = typeof parent === 'string' ? document.querySelector(parent) : parent\r\n\tif (store) {\r\n\t\tstore.instances = []\r\n\t\textendStoreUpate(store)\r\n\t\toptions.store = store\r\n\t\tstore.data = new JSONProxy(store.data).observe(true, handler)\r\n\t}\r\n\tdiff(null, vnode, {}, false, parent, false)\r\n}\r\n\r\nfunction update(patch) {\r\n\toptions.store.update(patch)\r\n}\r\n\r\nfunction extendStoreUpate(store) {\r\n\tstore.update = function (patch) {\r\n\t\tconst updateAll = matchGlobalData(this.globalData, patch)\r\n\r\n\t\tif (Object.keys(patch).length > 0) {\r\n\t\t\tthis.instances.forEach(instance => {\r\n\t\t\t\tif (updateAll || this.updateAll || instance.constructor.updatePath && needUpdate(patch, instance.constructor.updatePath)) {\r\n\t\t\t\t\tinstance.update()\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tthis.onChange && this.onChange(patch)\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport function matchGlobalData(globalData, diffResult) {\r\n\tif (!globalData) return false\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (globalData.indexOf(keyA) > -1) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let i = 0, len = globalData.length; i < len; i++) {\r\n\t\t\tif (includePath(keyA, globalData[i])) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nexport function needUpdate(diffResult, updatePath) {\r\n\tfor (let keyA in diffResult) {\r\n\t\tif (updatePath[keyA]) {\r\n\t\t\treturn true\r\n\t\t}\r\n\t\tfor (let keyB in updatePath) {\r\n\t\t\tif (includePath(keyA, keyB)) {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nfunction includePath(pathA, pathB) {\r\n\tif (pathA.indexOf(pathB) === 0) {\r\n\t\tconst next = pathA.substr(pathB.length, 1)\r\n\t\tif (next === '[' || next === '.') {\r\n\t\t\treturn true\r\n\t\t}\r\n\t}\r\n\treturn false\r\n}\r\n\r\nexport function fixPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index) {\r\n\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tmpPath += item\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}\r\n\r\nfunction getArrayPatch(path) {\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tlet current = options.store.data[arr[0]]\r\n\tfor (let i = 1, len = arr.length; i < len - 1; i++) {\r\n\t\tcurrent = current[arr[i]]\r\n\t}\r\n\treturn { k: fixArrPath(path), v: current }\r\n}\r\n\r\nfunction fixArrPath(path) {\r\n\tlet mpPath = ''\r\n\tconst arr = path.replace('/', '').split('/')\r\n\tconst len = arr.length\r\n\tarr.forEach((item, index) => {\r\n\t\tif (index < len - 1) {\r\n\t\t\tif (index) {\r\n\t\t\t\tif (isNaN(Number(item))) {\r\n\t\t\t\t\tmpPath += '.' + item\r\n\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmpPath += '[' + item + ']'\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tmpPath += item\r\n\t\t\t}\r\n\t\t}\r\n\t})\r\n\treturn mpPath\r\n}","const OBJECTTYPE = '[object Object]'\r\nconst ARRAYTYPE = '[object Array]'\r\n\r\nexport function define(name, ctor) {\r\n\tcustomElements.define(name, ctor)\r\n\tif (ctor.data && !ctor.pure) {\r\n\t\tctor.updatePath = getUpdatePath(ctor.data)\r\n\t}\r\n}\r\n\r\nexport function getUpdatePath(data) {\r\n\tconst result = {}\r\n\tdataToPath(data, result)\r\n\treturn result\r\n}\r\n\r\nfunction dataToPath(data, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[key] = true\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _objToPath(data, path, result) {\r\n\tObject.keys(data).forEach(key => {\r\n\t\tresult[path + '.' + key] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(data[key])\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(data[key], path + '.' + key, result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(data[key], path + '.' + key, result)\r\n\t\t}\r\n\t})\r\n}\r\n\r\nfunction _arrayToPath(data, path, result) {\r\n\tdata.forEach((item, index) => {\r\n\t\tresult[path + '[' + index + ']'] = true\r\n\t\tdelete result[path]\r\n\t\tconst type = Object.prototype.toString.call(item)\r\n\t\tif (type === OBJECTTYPE) {\r\n\t\t\t_objToPath(item, path + '[' + index + ']', result)\r\n\t\t} else if (type === ARRAYTYPE) {\r\n\t\t\t_arrayToPath(item, path + '[' + index + ']', result)\r\n\t\t}\r\n\t})\r\n}","function getGlobal() {\r\n\tif (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) {\r\n\t\tif (typeof self !== 'undefined') {\r\n\t\t\treturn self\r\n\t\t} else if (typeof window !== 'undefined') {\r\n\t\t\treturn window\r\n\t\t} else if (typeof global !== 'undefined') {\r\n\t\t\treturn global\r\n\t\t}\r\n\t\treturn (function(){\r\n\t\t\treturn this\r\n\t\t})()\r\n\t\t\r\n\t}\r\n\treturn global\r\n}\r\n\r\n/** Global options\r\n *\t@public\r\n *\t@namespace options {Object}\r\n */\r\nexport default {\r\n\r\n\tstore: null,\r\n\t\r\n\troot: getGlobal()\r\n\t//componentChange(component, element) { },\r\n\t/** If `true`, `prop` changes trigger synchronous component updates.\r\n\t *\t@name syncComponentUpdates\r\n\t *\t@type Boolean\r\n\t *\t@default true\r\n\t */\r\n\t//syncComponentUpdates: true,\r\n\r\n\t/** Processes all created VNodes.\r\n\t *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\r\n\t */\r\n\t//vnode(vnode) { }\r\n\r\n\t/** Hook invoked after a component is mounted. */\r\n\t//afterMount(component) { },\r\n\r\n\t/** Hook invoked after the DOM is updated with a component's latest render. */\r\n\t//afterUpdate(component) { }\r\n\r\n\t/** Hook invoked immediately before a component is unmounted. */\r\n\t// beforeUnmount(component) { }\r\n}\r\n","import { cssToDom, nProps } from './util'\nimport { diff } from './vdom/diff'\nimport options from './options'\n\nexport default class WeElement extends HTMLElement {\n\tconstructor() {\n\t\tsuper()\n\t\tthis.props = nProps(this.constructor.props)\n\t\tthis.data = this.constructor.data || {}\n\t}\n\n\tconnectedCallback() {\n\t\tthis.store = options.store\n\t\tif (this.store){\n\t\t\tthis.store.instances.push(this)\n\t\t}\n\t\tthis.install()\n \n\t\tconst shadowRoot = this.attachShadow({ mode: 'open' })\n\n\t\tthis.css && shadowRoot.appendChild(cssToDom(this.css()))\n\t\tthis.host = diff(null, this.render(this.props, (!this.constructor.pure && this.store) ? this.store.data : this.data), {}, false, null, false)\n\t\tshadowRoot.appendChild(this.host)\n\n\t\tthis.installed()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.uninstall()\n\t\tif (this.store) {\n\t\t\tfor (let i = 0, len = this.store.instances.length; i < len; i++) {\n\t\t\t\tif (this.store.instances[i] === this) {\n\t\t\t\t\tthis.store.instances.splice(i, 1)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate() {\n\t\tthis.beforeUpdate()\n\t\tdiff(this.host, this.render(this.props, (!this.constructor.pure && this.store) ? this.store.data : this.data))\n\t\tthis.afterUpdate()\n\t}\n\n\tfire(name, data){\n\t\tthis.dispatchEvent(new CustomEvent(name, { detail : data }))\n\t}\n\n\tinstall() {\n\n\t}\n\n\tinstalled() {\n\n\t}\n\n\tuninstall() {\n\n\t}\n\n\tbeforeUpdate() {\n\n\t}\n\n\tafterUpdate() {\n\n\t}\n}\n","\n\n/*!\n * https://github.com/Palindrom/JSONPatcherProxy\n * (c) 2017 Starcounter\n * MIT license\n */\n\n/** Class representing a JS Object observer */\nconst JSONPatcherProxy = (function() {\n\t/**\n * Deep clones your object and returns a new object.\n */\n\tfunction deepClone(obj) {\n\t\tswitch (typeof obj) {\n\t\t\tcase 'object':\n\t\t\t\treturn JSON.parse(JSON.stringify(obj)) //Faster than ES5 clone - http://jsperf.com/deep-cloning-of-objects/5\n\t\t\tcase 'undefined':\n\t\t\t\treturn null //this is how JSON.stringify behaves for array items\n\t\t\tdefault:\n\t\t\t\treturn obj //no need to clone primitives\n\t\t}\n\t}\n\tJSONPatcherProxy.deepClone = deepClone\n\n\tfunction escapePathComponent(str) {\n\t\tif (str.indexOf('/') == -1 && str.indexOf('~') == -1) return str\n\t\treturn str.replace(/~/g, '~0').replace(/\\//g, '~1')\n\t}\n\tJSONPatcherProxy.escapePathComponent = escapePathComponent\n\n\t/**\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\tfunction findObjectPath(instance, obj) {\n\t\tconst pathComponents = []\n\t\tlet parentAndPath = instance.parenthoodMap.get(obj)\n\t\twhile (parentAndPath && parentAndPath.path) {\n\t\t\t// because we're walking up-tree, we need to use the array as a stack\n\t\t\tpathComponents.unshift(parentAndPath.path)\n\t\t\tparentAndPath = instance.parenthoodMap.get(parentAndPath.parent)\n\t\t}\n\t\tif (pathComponents.length) {\n\t\t\tconst path = pathComponents.join('/')\n\t\t\treturn '/' + path\n\t\t}\n\t\treturn ''\n\t}\n\t/**\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\tfunction setTrap(instance, target, key, newValue) {\n\t\tconst parentPath = findObjectPath(instance, target)\n\n\t\tconst destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n\t\tif (instance.proxifiedObjectsMap.has(newValue)) {\n\t\t\tconst newValueOriginalObject = instance.proxifiedObjectsMap.get(newValue)\n\n\t\t\tinstance.parenthoodMap.set(newValueOriginalObject.originalObject, {\n\t\t\t\tparent: target,\n\t\t\t\tpath: key\n\t\t\t})\n\t\t}\n\t\t/*\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\t\tconst revokableInstance = instance.proxifiedObjectsMap.get(newValue)\n\t\t/*\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\t\tif (revokableInstance && !instance.isProxifyingTreeNow) {\n\t\t\trevokableInstance.inherited = true\n\t\t}\n\n\t\t// if the new value is an object, make sure to watch it\n\t\tif (\n\t\t\tnewValue &&\n typeof newValue == 'object' &&\n !instance.proxifiedObjectsMap.has(newValue)\n\t\t) {\n\t\t\tinstance.parenthoodMap.set(newValue, {\n\t\t\t\tparent: target,\n\t\t\t\tpath: key\n\t\t\t})\n\t\t\tnewValue = instance._proxifyObjectTreeRecursively(target, newValue, key)\n\t\t}\n\t\t// let's start with this operation, and may or may not update it later\n\t\tconst operation = {\n\t\t\top: 'remove',\n\t\t\tpath: destinationPropKey\n\t\t}\n\t\tif (typeof newValue == 'undefined') {\n\t\t\t// applying De Morgan's laws would be a tad faster, but less readable\n\t\t\tif (!Array.isArray(target) && !target.hasOwnProperty(key)) {\n\t\t\t\t// `undefined` is being set to an already undefined value, keep silent\n\t\t\t\treturn Reflect.set(target, key, newValue)\n\t\t\t}\n\t\t\t// when array element is set to `undefined`, should generate replace to `null`\n\t\t\tif (Array.isArray(target)) {\n\t\t\t\t// undefined array elements are JSON.stringified to `null`\n\t\t\t\t(operation.op = 'replace'), (operation.value = null)\n\t\t\t}\n\t\t\tconst oldValue = instance.proxifiedObjectsMap.get(target[key])\n\t\t\t// was the deleted a proxified object?\n\t\t\tif (oldValue) {\n\t\t\t\tinstance.parenthoodMap.delete(target[key])\n\t\t\t\tinstance.disableTrapsForProxy(oldValue)\n\t\t\t\tinstance.proxifiedObjectsMap.delete(oldValue)\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tif (Array.isArray(target) && !Number.isInteger(+key.toString())) {\n\t\t\t\t/* array props (as opposed to indices) don't emit any patches, to avoid needless `length` patches */\n\t\t\t\tif (key != 'length') {\n\t\t\t\t\tconsole.warn('JSONPatcherProxy noticed a non-integer prop was set for an array. This will not emit a patch')\n\t\t\t\t}\n\t\t\t\treturn Reflect.set(target, key, newValue)\n\t\t\t}\n\t\t\toperation.op = 'add'\n\t\t\tif (target.hasOwnProperty(key)) {\n\t\t\t\tif (typeof target[key] !== 'undefined' || Array.isArray(target)) {\n\t\t\t\t\toperation.op = 'replace' // setting `undefined` array elements is a `replace` op\n\t\t\t\t}\n\t\t\t}\n\t\t\toperation.value = newValue\n\t\t}\n\t\tconst reflectionResult = Reflect.set(target, key, newValue)\n\t\tinstance.defaultCallback(operation)\n\t\treturn reflectionResult\n\t}\n\t/**\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\tfunction deleteTrap(instance, target, key) {\n\t\tif (typeof target[key] !== 'undefined') {\n\t\t\tconst parentPath = findObjectPath(instance, target)\n\t\t\tconst destinationPropKey = parentPath + '/' + escapePathComponent(key)\n\n\t\t\tconst revokableProxyInstance = instance.proxifiedObjectsMap.get(\n\t\t\t\ttarget[key]\n\t\t\t)\n\n\t\t\tif (revokableProxyInstance) {\n\t\t\t\tif (revokableProxyInstance.inherited) {\n\t\t\t\t\t/*\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\t\t\t\t\trevokableProxyInstance.inherited = false\n\t\t\t\t} else {\n\t\t\t\t\tinstance.parenthoodMap.delete(revokableProxyInstance.originalObject)\n\t\t\t\t\tinstance.disableTrapsForProxy(revokableProxyInstance)\n\t\t\t\t\tinstance.proxifiedObjectsMap.delete(target[key])\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst reflectionResult = Reflect.deleteProperty(target, key)\n\n\t\t\tinstance.defaultCallback({\n\t\t\t\top: 'remove',\n\t\t\t\tpath: destinationPropKey\n\t\t\t})\n\n\t\t\treturn reflectionResult\n\t\t}\n\t}\n\t/* pre-define resume and pause functions to enhance constructors performance */\n\tfunction resume() {\n\t\tthis.defaultCallback = operation => {\n\t\t\tthis.isRecording && this.patches.push(operation)\n\t\t\tthis.userCallback && this.userCallback(operation)\n\t\t}\n\t\tthis.isObserving = true\n\t}\n\tfunction pause() {\n\t\tthis.defaultCallback = () => {}\n\t\tthis.isObserving = false\n\t}\n\t/**\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\tfunction JSONPatcherProxy(root, showDetachedWarning) {\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.isObserving = false\n\t\tthis.proxifiedObjectsMap = new Map()\n\t\tthis.parenthoodMap = new Map()\n\t\t// default to true\n\t\tif (typeof showDetachedWarning !== 'boolean') {\n\t\t\tshowDetachedWarning = true\n\t\t}\n\n\t\tthis.showDetachedWarning = showDetachedWarning\n\t\tthis.originalObject = root\n\t\tthis.cachedProxy = null\n\t\tthis.isRecording = false\n\t\tthis.userCallback\n\t\t/**\n * @memberof JSONPatcherProxy\n * Restores callback back to the original one provided to `observe`.\n */\n\t\tthis.resume = resume.bind(this)\n\t\t/**\n * @memberof JSONPatcherProxy\n * Replaces your callback with a noop function.\n */\n\t\tthis.pause = pause.bind(this)\n\t}\n\n\tJSONPatcherProxy.prototype.generateProxyAtPath = function(parent, obj, path) {\n\t\tif (!obj) {\n\t\t\treturn obj\n\t\t}\n\t\tconst traps = {\n\t\t\tset: (target, key, value, receiver) =>\n\t\t\t\tsetTrap(this, target, key, value, receiver),\n\t\t\tdeleteProperty: (target, key) => deleteTrap(this, target, key)\n\t\t}\n\t\tconst revocableInstance = Proxy.revocable(obj, traps)\n\t\t// cache traps object to disable them later.\n\t\trevocableInstance.trapsInstance = traps\n\t\trevocableInstance.originalObject = obj\n\n\t\t/* keeping track of object's parent and path */\n\n\t\tthis.parenthoodMap.set(obj, { parent, path })\n\n\t\t/* keeping track of all the proxies to be able to revoke them later */\n\t\tthis.proxifiedObjectsMap.set(revocableInstance.proxy, revocableInstance)\n\t\treturn revocableInstance.proxy\n\t}\n\t// grab tree's leaves one by one, encapsulate them into a proxy and return\n\tJSONPatcherProxy.prototype._proxifyObjectTreeRecursively = function(\n\t\tparent,\n\t\troot,\n\t\tpath\n\t) {\n\t\tfor (let key in root) {\n\t\t\tif (root.hasOwnProperty(key)) {\n\t\t\t\tif (root[key] instanceof Object) {\n\t\t\t\t\troot[key] = this._proxifyObjectTreeRecursively(\n\t\t\t\t\t\troot,\n\t\t\t\t\t\troot[key],\n\t\t\t\t\t\tescapePathComponent(key)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this.generateProxyAtPath(parent, root, path)\n\t}\n\t// this function is for aesthetic purposes\n\tJSONPatcherProxy.prototype.proxifyObjectTree = function(root) {\n\t\t/*\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\t\tthis.pause()\n\t\tthis.isProxifyingTreeNow = true\n\t\tconst proxifiedObject = this._proxifyObjectTreeRecursively(\n\t\t\tundefined,\n\t\t\troot,\n\t\t\t''\n\t\t)\n\t\t/* OK you can record now */\n\t\tthis.isProxifyingTreeNow = false\n\t\tthis.resume()\n\t\treturn proxifiedObject\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTrapsForProxy = function(\n\t\trevokableProxyInstance\n\t) {\n\t\tif (this.showDetachedWarning) {\n\t\t\tconst message =\n \"You're accessing an object that is detached from the observedObject tree, see https://github.com/Palindrom/JSONPatcherProxy#detached-objects\"\n\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.set = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey,\n\t\t\t\tnewValue\n\t\t\t) => {\n\t\t\t\tconsole.warn(message)\n\t\t\t\treturn Reflect.set(targetObject, propKey, newValue)\n\t\t\t}\n\t\t\trevokableProxyInstance.trapsInstance.deleteProperty = (\n\t\t\t\ttargetObject,\n\t\t\t\tpropKey\n\t\t\t) => {\n\t\t\t\treturn Reflect.deleteProperty(targetObject, propKey)\n\t\t\t}\n\t\t} else {\n\t\t\tdelete revokableProxyInstance.trapsInstance.set\n\t\t\tdelete revokableProxyInstance.trapsInstance.get\n\t\t\tdelete revokableProxyInstance.trapsInstance.deleteProperty\n\t\t}\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.observe = function(record, callback) {\n\t\tif (!record && !callback) {\n\t\t\tthrow new Error('You need to either record changes or pass a callback')\n\t\t}\n\t\tthis.isRecording = record\n\t\tthis.userCallback = callback\n\t\t/*\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\t\tif (record) this.patches = []\n\t\tthis.cachedProxy = this.proxifyObjectTree(this.originalObject)\n\t\treturn this.cachedProxy\n\t}\n\t/**\n * If the observed is set to record, it will synchronously return all the patches and empties patches array.\n */\n\tJSONPatcherProxy.prototype.generate = function() {\n\t\tif (!this.isRecording) {\n\t\t\tthrow new Error('You should set record to true to get patches later')\n\t\t}\n\t\treturn this.patches.splice(0, this.patches.length)\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.revoke = function() {\n\t\tthis.proxifiedObjectsMap.forEach(el => {\n\t\t\tel.revoke()\n\t\t})\n\t}\n\t/**\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\tJSONPatcherProxy.prototype.disableTraps = function() {\n\t\tthis.proxifiedObjectsMap.forEach(this.disableTrapsForProxy, this)\n\t}\n\treturn JSONPatcherProxy\n})()\n\nexport default JSONPatcherProxy","import { define } from './define'\r\n\r\nexport function tag(name, pure) {\r\n\treturn function (target) {\r\n\t\ttarget.pure = pure\r\n\t\tdefine(name, target)\r\n\t}\r\n}","import { h, h as createElement } from './h'\r\nimport options from './options'\r\nimport WeElement from './we-element'\r\nimport { render } from './render'\r\nimport { define } from './define'\r\nimport { tag } from './tag'\r\n\r\noptions.root.Omi = {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\noptions.root.Omi.version = '4.0.0'\r\n\r\nexport default {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n\r\nexport {\r\n\ttag,\r\n\tWeElement,\r\n\trender,\r\n\th,\r\n\tcreateElement,\r\n\toptions,\r\n\tdefine\r\n}\r\n"]} \ No newline at end of file diff --git a/packages/omi/src/proxy.js b/packages/omi/src/proxy.js index 0306d1d38..d89aaf8b4 100644 --- a/packages/omi/src/proxy.js +++ b/packages/omi/src/proxy.js @@ -388,8 +388,4 @@ const JSONPatcherProxy = (function() { return JSONPatcherProxy })() -export default JSONPatcherProxy -if (typeof module !== 'undefined') { - module.exports = JSONPatcherProxy - module.exports.default = JSONPatcherProxy -} +export default JSONPatcherProxy \ No newline at end of file