diff --git a/packages/omiax/examples/counter/main.js b/packages/omiax/examples/counter/main.js new file mode 100644 index 000000000..545de3c28 --- /dev/null +++ b/packages/omiax/examples/counter/main.js @@ -0,0 +1,35 @@ +//逻辑store外置,UI只负责渲染 +const Counter = (props, store) => { + return
+ + {store.data.count} + +
+} + +Counter.store = _ => { + return { + data: { + count: 1 + }, + add() { + this.data.count++ + }, + sub() { + this.data.count-- + } + } +} + + +const App = (props, store) => { + return
+ +
+} + +App.store = _ => { + +} + +render() diff --git a/packages/omiax/examples/hello/b.js b/packages/omiax/examples/hello/b.js index 677439008..c6f79d75a 100644 --- a/packages/omiax/examples/hello/b.js +++ b/packages/omiax/examples/hello/b.js @@ -620,6 +620,10 @@ } } + function render(node) { + console.log(layoutNode(node())); + } + var stack = []; /** @@ -707,492 +711,9 @@ return p; } - // render modes + var root = getGlobal(); - var NO_RENDER = 0; - var SYNC_RENDER = 1; - var FORCE_RENDER = 2; - var ASYNC_RENDER = 3; - - var ATTR_KEY = '__omiattr_'; - - // DOM properties that should NOT have "px" added when numeric - var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i; - - var nodeId = 1; - function uniqueId() { - return nodeId++; - } - - var docMap = {}; - - function addDoc(id, doc) { - docMap[id] = doc; - } - - function getDoc(id) { - return docMap[id]; - } - - function removeDoc(id) { - delete docMap[id]; - } - - function insertIndex(target, list, newIndex) { - if (newIndex < 0) { - newIndex = 0; - } - var before = list[newIndex - 1]; - var after = list[newIndex]; - list.splice(newIndex, 0, target); - - before && (before.nextSibling = target); - target.previousSibling = before; - target.nextSibling = after; - after && (after.previousSibling = target); - - return newIndex; - } - - function moveIndex(target, list, newIndex) { - var index = list.indexOf(target); - - if (index < 0) { - return -1; - } - - var before = list[index - 1]; - var after = list[index + 1]; - before && (before.nextSibling = after); - after && (after.previousSibling = before); - - list.splice(index, 1); - var newIndexAfter = newIndex; - if (index <= newIndex) { - newIndexAfter = newIndex - 1; - } - var beforeNew = list[newIndexAfter - 1]; - var afterNew = list[newIndexAfter]; - list.splice(newIndexAfter, 0, target); - - beforeNew && (beforeNew.nextSibling = target); - target.previousSibling = beforeNew; - target.nextSibling = afterNew; - afterNew && (afterNew.previousSibling = target); - - if (index === newIndexAfter) { - return -1; - } - return newIndex; - } - - function removeIndex(target, list, changeSibling) { - var index = list.indexOf(target); - - if (index < 0) { - return; - } - if (changeSibling) { - var before = list[index - 1]; - var after = list[index + 1]; - before && (before.nextSibling = after); - after && (after.previousSibling = before); - } - list.splice(index, 1); - } - - function linkParent(node, parent) { - node.parentNode = parent; - if (parent.docId) { - node.docId = parent.docId; - node.ownerDocument = parent.ownerDocument; - node.ownerDocument.nodeMap[node.nodeId] = node; - node.depth = parent.depth + 1; - } - - node.childNodes && node.childNodes.forEach(function (child) { - linkParent(child, node); - }); - } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var displayMap = { - div: 'block', - span: 'inline-block' - }; - - function registerNode(docId, node) { - var doc = getDoc(docId); - doc.nodeMap[node.nodeId] = node; - } - - var Element$1 = function () { - function Element(type) { - _classCallCheck(this, Element); - - this.nodeType = 1; - this.nodeId = uniqueId(); - this.ref = this.nodeId; - this.type = type; - this.attributes = {}; - this.style = { - display: displayMap[type] - }; - this.classStyle = {}; - this.event = {}; - this.childNodes = []; - - this.nodeName = this.type; - - this.parentNode = null; - this.nextSibling = null; - this.previousSibling = null; - this.firstChild = null; - } - - Element.prototype.appendChild = function appendChild(node) { - if (!node.parentNode) { - linkParent(node, this); - insertIndex(node, this.childNodes, this.childNodes.length, true); - - if (this.docId != undefined) { - registerNode(this.docId, node); - } - - //this.ownerDocument.addElement(this.ref, node.toJSON(), -1) - } else { - node.parentNode.removeChild(node); - - this.appendChild(node); - - return; - } - - this.firstChild = this.childNodes[0]; - }; - - Element.prototype.insertBefore = function insertBefore(node, before) { - if (!node.parentNode) { - linkParent(node, this); - var index = insertIndex(node, this.childNodes, this.childNodes.indexOf(before), true); - if (this.docId != undefined) { - registerNode(this.docId, node); - } - - //this.ownerDocument.addElement(this.ref, node.toJSON(), index) - } else { - node.parentNode.removeChild(node); - this.insertBefore(node, before); - return; - } - - this.firstChild = this.childNodes[0]; - }; - - Element.prototype.insertAfter = function insertAfter(node, after) { - if (node.parentNode && node.parentNode !== this) { - return; - } - if (node === after || node.previousSibling && node.previousSibling === after) { - return; - } - if (!node.parentNode) { - linkParent(node, this); - var index = insertIndex(node, this.childNodes, this.childNodes.indexOf(after) + 1, true); - - if (this.docId != undefined) { - registerNode(this.docId, node); - } - - //this.ownerDocument.addElement(this.ref, node.toJSON(), index) - } else { - var _index = moveIndex(node, this.childNodes, this.childNodes.indexOf(after) + 1); - - //this.ownerDocument.moveElement(node.ref, this.ref, index) - } - - this.firstChild = this.childNodes[0]; - }; - - Element.prototype.removeChild = function removeChild(node) { - if (node.parentNode) { - removeIndex(node, this.childNodes, true); - - this.ownerDocument.removeElement(node.ref); - } - - node.parentNode = null; - - this.firstChild = this.childNodes[0]; - }; - - Element.prototype.setAttribute = function setAttribute(key, value, silent) { - if (this.attributes[key] === value && silent !== false) { - return; - } - this.attributes[key] = value; - if (!silent) { - var result = {}; - result[key] = value; - - this.ownerDocument.setAttr(this.ref, result); - } - }; - - Element.prototype.removeAttribute = function removeAttribute(key) { - if (this.attributes[key]) { - delete this.attributes[key]; - } - }; - - Element.prototype.setStyle = function setStyle(key, value, silent) { - if (this.style[key] === value && silent !== false) { - return; - } - this.style[key] = value; - if (!silent && this.ownerDocument) { - var result = {}; - result[key] = value; - - this.ownerDocument.setStyles(this.ref, result); - } - }; - - Element.prototype.setStyles = function setStyles(styles) { - Object.assign(this.style, styles); - if (this.ownerDocument) { - - this.ownerDocument.setStyles(this.ref, styles); - } - }; - - Element.prototype.setClassStyle = function setClassStyle(classStyle) { - for (var key in this.classStyle) { - this.classStyle[key] = ''; - } - - Object.assign(this.classStyle, classStyle); - - this.ownerDocument.setStyles(this.ref, this.toStyle()); - }; - - Element.prototype.addEventListener = function addEventListener(type, handler) { - if (!this.event[type]) { - this.event[type] = handler; - - //this.ownerDocument.addEvent(this.ref, type) - } - }; - - Element.prototype.removeEventListener = function removeEventListener(type) { - if (this.event[type]) { - delete this.event[type]; - var doc = getDoc(this.docId); - doc.nodeMap[this.ref] && doc.nodeMap[this.ref].event && doc.nodeMap[this.ref].event[type] ? doc.nodeMap[this.ref].event[type] = null : ''; - - this.ownerDocument.removeEvent(this.ref, type); - } - }; - - Element.prototype.fireEvent = function fireEvent(type, e) { - var handler = this.event[type]; - if (handler) { - return handler.call(this, e); - } - }; - - Element.prototype.toStyle = function toStyle() { - return Object.assign({}, this.classStyle, this.style); - }; - - Element.prototype.getComputedStyle = function getComputedStyle() {}; - - Element.prototype.toJSON = function toJSON() { - var result = { - id: this.ref, - type: this.type, - docId: this.docId || -10000, - attributes: this.attributes ? this.attributes : {} - }; - result.attributes.style = this.toStyle(); - - var event = Object.keys(this.event); - if (event.length) { - result.event = event; - } - - if (this.childNodes.length) { - result.children = this.childNodes.map(function (child) { - return child.toJSON(); - }); - } - return result; - }; - - Element.prototype.replaceChild = function replaceChild(newChild, oldChild) { - this.insertBefore(newChild, oldChild); - this.removeChild(oldChild); - }; - - Element.prototype.destroy = function destroy() { - var doc = getDoc(this.docId); - - if (doc) { - delete doc.nodeMap[this.nodeId]; - } - - this.parentNode = null; - this.childNodes.forEach(function (child) { - child.destroy(); - }); - }; - - return Element; - }(); - - function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var TextNode = function () { - function TextNode(nodeValue) { - _classCallCheck$1(this, TextNode); - - this.nodeType = 3; - this.nodeId = uniqueId(); - this.ref = this.nodeId; - this.attributes = {}; - this.style = { - display: 'inline' - }; - this.classStyle = {}; - this.event = {}; - this.nodeValue = nodeValue; - this.parentNode = null; - this.nextSibling = null; - this.previousSibling = null; - this.firstChild = null; - this.type = 'text'; - } - - TextNode.prototype.setAttribute = function setAttribute(key, value, silent) { - if (this.attributes[key] === value && silent !== false) { - return; - } - this.attributes[key] = value; - if (!silent) { - var result = {}; - result[key] = value; - - this.ownerDocument.setAttr(this.ref, result); - } - }; - - TextNode.prototype.removeAttribute = function removeAttribute(key) { - if (this.attributes[key]) { - delete this.attributes[key]; - } - }; - - TextNode.prototype.toStyle = function toStyle() { - return Object.assign({}, this.classStyle, this.style); - }; - - TextNode.prototype.splitText = function splitText() {}; - - TextNode.prototype.getComputedStyle = function getComputedStyle() {}; - - TextNode.prototype.toJSON = function toJSON() { - var result = { - id: this.ref, - type: this.type, - docId: this.docId || -10000, - attributes: this.attributes ? this.attributes : {} - }; - result.attributes.style = this.toStyle(); - - var event = Object.keys(this.event); - if (event.length) { - result.event = event; - } - - return result; - }; - - TextNode.prototype.destroy = function destroy() { - var doc = getDoc(this.docId); - - if (doc) { - delete doc.nodeMap[this.nodeId]; - } - - this.parentNode = null; - }; - - return TextNode; - }(); - - function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Document = function () { - function Document(id) { - _classCallCheck$2(this, Document); - - this.id = id; - addDoc(id, this); - this.nodeMap = {}; - this._isMockDocument = true; - } - - // createBody(type, props) { - // if (!this.body) { - // const el = new Element(type, props) - // el.didMount = true - // el.ownerDocument = this - // el.docId = this.id - // el.style.alignItems = 'flex-start' - // this.body = el - // } - - // return this.body - // } - - Document.prototype.createElement = function createElement(tagName, props) { - var el = new Element$1(tagName, props); - el.ownerDocument = this; - el.docId = this.id; - return el; - }; - - Document.prototype.createTextNode = function createTextNode(txt) { - var node = new TextNode(txt); - node.docId = this.id; - return node; - }; - - Document.prototype.destroy = function destroy() { - delete this.listener; - delete this.nodeMap; - removeDoc(this.id); - }; - - Document.prototype.addEventListener = function addEventListener(ref, type) { - //document.addEvent(this.id, ref, type) - }; - - Document.prototype.removeEventListener = function removeEventListener(ref, type) { - //document.removeEvent(this.id, ref, type) - }; - - Document.prototype.scrollTo = function scrollTo(ref, x, y, animated) { - document.scrollTo(this.id, ref, x, y, animated); - }; - - return Document; - }(); - - var mock = { - document: new Document(0) - }; + root.Omi = { h: h, version: '0.0.0' }; function getGlobal() { if (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) { @@ -1210,1693 +731,40 @@ return global; } - /** Global options - * @public - * @namespace options {Object} - */ - var options = { - scopedStyle: true, - mapping: {}, - isWeb: true, - staticStyleMapping: {}, - doc: mock.document, - //doc: typeof document === 'object' ? document : null, - root: getGlobal(), - //styleCache :[{ctor:ctor,ctorName:ctorName,style:style}] - styleCache: [] - //componentChange(component, element) { }, - /** If `true`, `prop` changes trigger synchronous component updates. - * @name syncComponentUpdates - * @type Boolean - * @default true - */ - //syncComponentUpdates: true, - - /** Processes all created VNodes. - * @param {VNode} vnode A newly-created VNode to normalize/process - */ - //vnode(vnode) { } - - /** Hook invoked after a component is mounted. */ - //afterMount(component) { }, - - /** Hook invoked after the DOM is updated with a component's latest render. */ - //afterUpdate(component) { } - - /** Hook invoked immediately before a component is unmounted. */ - // beforeUnmount(component) { } - }; - - /* eslint-disable no-unused-vars */ - - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - function assign(target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; - } - - if (typeof Element !== 'undefined' && !Element.prototype.addEventListener) { - var runListeners = function runListeners(oEvent) { - if (!oEvent) { - oEvent = window.event; - } - for (var iLstId = 0, iElId = 0, oEvtListeners = oListeners[oEvent.type]; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { - for (iLstId; iLstId < oEvtListeners.aEvts[iElId].length; iLstId++) { - oEvtListeners.aEvts[iElId][iLstId].call(this, oEvent); - } - break; - } - } - }; - - var oListeners = {}; - - Element.prototype.addEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) { - if (oListeners.hasOwnProperty(sEventType)) { - var oEvtListeners = oListeners[sEventType]; - for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { - nElIdx = iElId;break; - } - } - if (nElIdx === -1) { - oEvtListeners.aEls.push(this); - oEvtListeners.aEvts.push([fListener]); - this["on" + sEventType] = runListeners; - } else { - var aElListeners = oEvtListeners.aEvts[nElIdx]; - if (this["on" + sEventType] !== runListeners) { - aElListeners.splice(0); - this["on" + sEventType] = runListeners; - } - for (var iLstId = 0; iLstId < aElListeners.length; iLstId++) { - if (aElListeners[iLstId] === fListener) { - return; - } - } - aElListeners.push(fListener); - } - } else { - oListeners[sEventType] = { aEls: [this], aEvts: [[fListener]] }; - this["on" + sEventType] = runListeners; - } - }; - Element.prototype.removeEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) { - if (!oListeners.hasOwnProperty(sEventType)) { - return; - } - var oEvtListeners = oListeners[sEventType]; - for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { - nElIdx = iElId;break; - } - } - if (nElIdx === -1) { - return; - } - for (var iLstId = 0, aElListeners = oEvtListeners.aEvts[nElIdx]; iLstId < aElListeners.length; iLstId++) { - if (aElListeners[iLstId] === fListener) { - aElListeners.splice(iLstId, 1); - } - } - }; - } - - if (typeof Object.create !== 'function') { - Object.create = function (proto, propertiesObject) { - if (typeof proto !== 'object' && typeof proto !== 'function') { - throw new TypeError('Object prototype may only be an Object: ' + proto); - } else if (proto === null) { - throw new Error("This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument."); - } - - // if (typeof propertiesObject != 'undefined') { - // throw new Error("This browser's implementation of Object.create is a shim and doesn't support a second argument."); - // } - - function F() {} - F.prototype = proto; - - return new F(); - }; - } - - if (!String.prototype.trim) { - String.prototype.trim = function () { - return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - }; - } - - /** - * Copy all properties from `props` onto `obj`. - * @param {Object} obj Object onto which properties should be copied. - * @param {Object} props Object from which to copy properties. - * @returns obj - * @private - */ - function extend(obj, props) { - for (var i in props) { - obj[i] = props[i]; - }return obj; - } - - /** Invoke or update a ref, depending on whether it is a function or object ref. - * @param {object|function} [ref=null] - * @param {any} [value] - */ - function applyRef(ref, value) { - if (ref) { - if (typeof ref == 'function') ref(value);else ref.current = value; - } - } - - /** - * Call a function asynchronously, as soon as possible. Makes - * use of HTML Promise to schedule the callback if available, - * otherwise falling back to `setTimeout` (mainly for IE<11). - * - * @param {Function} callback - */ - - var usePromise = typeof Promise == 'function'; - - // for native - if (typeof document !== 'object' && typeof global !== 'undefined' && global.__config__) { - if (global.__config__.platform === 'android') { - usePromise = true; - } else { - var systemVersion = global.__config__.systemVersion && global.__config__.systemVersion.split('.')[0] || 0; - if (systemVersion > 8) { - usePromise = true; - } - } - } - - var defer = usePromise ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout; - - function isArray(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - } - - function nProps(props) { - if (!props || isArray(props)) return {}; - var result = {}; - Object.keys(props).forEach(function (key) { - result[key] = props[key].value; - }); - return result; - } - - function getUse(data, paths) { - var obj = []; - paths.forEach(function (path, index) { - var isPath = typeof path === 'string'; - if (isPath) { - obj[index] = getTargetByPath(data, path); - } else { - var key = Object.keys(path)[0]; - var value = path[key]; - if (typeof value === 'string') { - obj[index] = getTargetByPath(data, value); - } else { - var tempPath = value[0]; - if (typeof tempPath === 'string') { - var tempVal = getTargetByPath(data, tempPath); - obj[index] = value[1] ? value[1](tempVal) : tempVal; - } else { - var args = []; - tempPath.forEach(function (path) { - args.push(getTargetByPath(data, path)); - }); - obj[index] = value[1].apply(null, args); - } - } - obj[key] = obj[index]; - } - }); - return obj; - } - - function getTargetByPath(origin, path) { - var arr = path.replace(/]/g, '').replace(/\[/g, '.').split('.'); - var current = origin; - for (var i = 0, len = arr.length; i < len; i++) { - current = current[arr[i]]; - } - return current; - } - - /** Managed queue of dirty components to be re-rendered */ - - var items = []; - - function enqueueRender(component) { - if (items.push(component) == 1) { - (options.debounceRendering || defer)(rerender); - } - } - - /** Rerender all enqueued dirty components */ - function rerender() { - var p = void 0; - while (p = items.pop()) { - renderComponent(p); - } - } - - var mapping = options.mapping; - /** - * Check if two nodes are equivalent. - * - * @param {Node} node DOM Node to compare - * @param {VNode} vnode Virtual DOM node to compare - * @param {boolean} [hydrating=false] If true, ignores component constructors when comparing. - * @private - */ - function isSameNodeType(node, vnode, hydrating) { - if (typeof vnode === 'string' || typeof vnode === 'number') { - return node.splitText !== undefined; - } - if (typeof vnode.nodeName === 'string') { - var ctor = mapping[vnode.nodeName]; - if (ctor) { - return hydrating || node._componentConstructor === ctor; - } - return !node._componentConstructor && isNamedNode(node, vnode.nodeName); - } - return hydrating || node._componentConstructor === vnode.nodeName; - } - - /** - * Check if an Element has a given nodeName, case-insensitively. - * - * @param {Element} node A DOM Element to inspect the name of. - * @param {String} nodeName Unnormalized name to compare against. - */ - function isNamedNode(node, nodeName) { - return node.normalizedNodeName === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase(); - } - - /** - * Reconstruct Component-style `props` from a VNode. - * Ensures default/fallback values from `defaultProps`: - * Own-properties of `defaultProps` not present in `vnode.attributes` are added. - * - * @param {VNode} vnode - * @returns {Object} props - */ - function getNodeProps(vnode) { - var props = extend({}, vnode.attributes); - props.children = vnode.children; - - var defaultProps = vnode.nodeName.defaultProps; - if (defaultProps !== undefined) { - for (var i in defaultProps) { - if (props[i] === undefined) { - props[i] = defaultProps[i]; - } - } - } - - return props; - } - - /** Create an element with the given nodeName. - * @param {String} nodeName - * @param {Boolean} [isSvg=false] If `true`, creates an element within the SVG namespace. - * @returns {Element} node - */ - function createNode$1(nodeName, isSvg) { - var node = isSvg ? options.doc.createElementNS('http://www.w3.org/2000/svg', nodeName) : options.doc.createElement(nodeName); - node.normalizedNodeName = nodeName; - return node; - } - - function parseCSSText(cssText) { - var cssTxt = cssText.replace(/\/\*(.|\s)*?\*\//g, ' ').replace(/\s+/g, ' '); - var style = {}, - _ref = cssTxt.match(/ ?(.*?) ?{([^}]*)}/) || [a, b, cssTxt], - a = _ref[0], - b = _ref[1], - rule = _ref[2]; - - var cssToJs = function cssToJs(s) { - return s.replace(/\W+\w/g, function (match) { - return match.slice(-1).toUpperCase(); - }); - }; - var properties = rule.split(';').map(function (o) { - return o.split(':').map(function (x) { - return x && x.trim(); - }); - }); - for (var _iterator = properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref3; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref3 = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref3 = _i.value; - } - - var _ref2 = _ref3; - var property = _ref2[0]; - var value = _ref2[1]; - style[cssToJs(property)] = value; - }return style; - } - - /** Remove a child node from its parent if attached. - * @param {Element} node The node to remove - */ - function removeNode(node) { - var parentNode = node.parentNode; - if (parentNode) parentNode.removeChild(node); - } - - /** Set a named attribute on the given Node, with special behavior for some names and event handlers. - * If `value` is `null`, the attribute/handler will be removed. - * @param {Element} node An element to mutate - * @param {string} name The name/key to set, such as an event or attribute name - * @param {any} old The last value that was set for this name/node pair - * @param {any} value An attribute value, such as a function to be used as an event handler - * @param {Boolean} isSvg Are we currently diffing inside an svg? - * @private - */ - function setAccessor(node, name, old, value, isSvg) { - if (name === 'className') name = 'class'; - - if (name === 'key') { - // ignore - } else if (name === 'ref') { - applyRef(old, null); - applyRef(value, node); - } else if (name === 'class' && !isSvg) { - node.className = value || ''; - } else if (name === 'style') { - if (options.isWeb) { - if (!value || typeof value === 'string' || typeof old === 'string') { - node.style.cssText = value || ''; - } - if (value && typeof value === 'object') { - if (typeof old !== 'string') { - for (var i in old) { - if (!(i in value)) node.style[i] = ''; - } - } - for (var _i2 in value) { - node.style[_i2] = typeof value[_i2] === 'number' && IS_NON_DIMENSIONAL.test(_i2) === false ? value[_i2] + 'px' : value[_i2]; - } - } - } else { - var oldJson = old, - currentJson = value; - if (typeof old === 'string') { - oldJson = parseCSSText(old); - } - if (typeof value == 'string') { - currentJson = parseCSSText(value); - } - - var result = {}, - changed = false; - - if (oldJson) { - for (var key in oldJson) { - if (typeof currentJson == 'object' && !(key in currentJson)) { - result[key] = ''; - changed = true; - } - } - - for (var ckey in currentJson) { - if (currentJson[ckey] !== oldJson[ckey]) { - result[ckey] = currentJson[ckey]; - changed = true; - } - } - - if (changed) { - node.setStyles(result); - } - } else { - node.setStyles(currentJson); - } - } - } else if (name === 'dangerouslySetInnerHTML') { - if (value) node.innerHTML = value.__html || ''; - } else if (name[0] == 'o' && name[1] == 'n') { - var useCapture = name !== (name = name.replace(/Capture$/, '')); - name = name.toLowerCase().substring(2); - if (value) { - if (!old) { - node.addEventListener(name, eventProxy, useCapture); - if (name == 'tap') { - node.addEventListener('touchstart', touchStart, useCapture); - node.addEventListener('touchend', touchEnd, useCapture); - } - } - } else { - node.removeEventListener(name, eventProxy, useCapture); - if (name == 'tap') { - node.removeEventListener('touchstart', touchStart, useCapture); - node.removeEventListener('touchend', touchEnd, useCapture); - } - } - (node._listeners || (node._listeners = {}))[name] = value; - } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) { - setProperty(node, name, value == null ? '' : value); - if (value == null || value === false) node.removeAttribute(name); - } else { - var ns = isSvg && name !== (name = name.replace(/^xlink:?/, '')); - if (value == null || value === false) { - if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());else node.removeAttribute(name); - } else if (typeof value !== 'function') { - if (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);else node.setAttribute(name, value); - } - } - } - - /** Attempt to set a DOM property to the given value. - * IE & FF throw for certain property-value combinations. - */ - function setProperty(node, name, value) { - try { - node[name] = value; - } catch (e) {} - } - - /** Proxy an event to hooked event handlers - * @private - */ - function eventProxy(e) { - return this._listeners[e.type](options.event && options.event(e) || e); - } - - function touchStart(e) { - this.___touchX = e.touches[0].pageX; - this.___touchY = e.touches[0].pageY; - this.___scrollTop = document.body.scrollTop; - } - - function touchEnd(e) { - if (Math.abs(e.changedTouches[0].pageX - this.___touchX) < 30 && Math.abs(e.changedTouches[0].pageY - this.___touchY) < 30 && Math.abs(document.body.scrollTop - this.___scrollTop) < 30) { - this.dispatchEvent(new CustomEvent('tap', { detail: e })); - } - } - - function draw(res) { - console.log(res); - return document.createElement('canvas'); - } - - /** Queue of components that have been mounted and are awaiting componentDidMount */ - var mounts = []; - - /** Diff recursion count, used to track the end of the diff cycle. */ - var diffLevel = 0; - - /** Global flag indicating if the diff is currently within an SVG */ - var isSvgMode = false; - - /** Global flag indicating if the diff is performing hydration */ - var hydrating = false; - - /** Invoke queued componentDidMount lifecycle methods */ - function flushMounts() { - var c = void 0; - while (c = mounts.pop()) { - if (options.afterMount) options.afterMount(c); - if (c.installed) c.installed(); - } - } - - /** Apply differences in a given vnode (and it's deep children) to a real DOM Node. - * @param {Element} [dom=null] A DOM node to mutate into the shape of the `vnode` - * @param {VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure - * @returns {Element} dom The created/mutated element - * @private - */ - function diff(dom, vnode, context, mountAll, parent, componentRoot, fromRender) { - // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff) - if (!diffLevel++) { - // when first starting the diff, check if we're diffing an SVG or within an SVG - isSvgMode = parent != null && parent.ownerSVGElement !== undefined; - - // hydration is indicated by the existing element to be diffed not having a prop cache - hydrating = dom != null && !(ATTR_KEY in dom); - } - var ret = void 0; - - if (isArray(vnode)) { - vnode = { - nodeName: 'span', - children: vnode - }; - } - - ret = idiff(dom, vnode, context, mountAll, componentRoot); - // append the element if its a new parent - if (parent && ret.parentNode !== parent) { - if (fromRender) { - parent.appendChild(draw(ret)); - } else { - parent.appendChild(ret); - } - } - - // diffLevel being reduced to 0 means we're exiting the diff - if (! --diffLevel) { - hydrating = false; - // invoke queued componentDidMount lifecycle methods - if (!componentRoot) flushMounts(); - } - - return ret; - } - - /** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */ - function idiff(dom, vnode, context, mountAll, componentRoot) { - var out = dom, - prevSvgMode = isSvgMode; - - // empty values (null, undefined, booleans) render as empty Text nodes - if (vnode == null || typeof vnode === 'boolean') vnode = ''; - - // If the VNode represents a Component, perform a component diff: - var vnodeName = vnode.nodeName; - if (options.mapping[vnodeName]) { - vnode.nodeName = options.mapping[vnodeName]; - return buildComponentFromVNode(dom, vnode, context, mountAll); - } - if (typeof vnodeName == 'function') { - return buildComponentFromVNode(dom, vnode, context, mountAll); - } - - // Fast case: Strings & Numbers create/update Text nodes. - if (typeof vnode === 'string' || typeof vnode === 'number') { - // update if it's already a Text node: - if (dom && dom.splitText !== undefined && dom.parentNode && (!dom._component || componentRoot)) { - /* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */ - if (dom.nodeValue != vnode) { - dom.nodeValue = vnode; - } - } else { - // it wasn't a Text node: replace it with one and recycle the old Element - out = options.doc.createTextNode(vnode); - if (dom) { - if (dom.parentNode) dom.parentNode.replaceChild(out, dom); - recollectNodeTree(dom, true); - } - } - - //ie8 error - try { - out[ATTR_KEY] = true; - } catch (e) {} - - return out; - } - - // Tracks entering and exiting SVG namespace when descending through the tree. - isSvgMode = vnodeName === 'svg' ? true : vnodeName === 'foreignObject' ? false : isSvgMode; - - // If there's no existing element or it's the wrong type, create a new one: - vnodeName = String(vnodeName); - if (!dom || !isNamedNode(dom, vnodeName)) { - out = createNode$1(vnodeName, isSvgMode); - - if (dom) { - // move children into the replacement node - while (dom.firstChild) { - out.appendChild(dom.firstChild); - } // if the previous Element was mounted into the DOM, replace it inline - if (dom.parentNode) dom.parentNode.replaceChild(out, dom); - - // recycle the old element (skips non-Element node types) - recollectNodeTree(dom, true); - } - } - - var fc = out.firstChild, - props = out[ATTR_KEY], - vchildren = vnode.children; - - if (props == null) { - props = out[ATTR_KEY] = {}; - for (var a = out.attributes, i = a.length; i--;) { - props[a[i].name] = a[i].value; - } - } - - // Optimization: fast-path for elements containing a single TextNode: - if (!hydrating && vchildren && vchildren.length === 1 && typeof vchildren[0] === 'string' && fc != null && fc.splitText !== undefined && fc.nextSibling == null) { - if (fc.nodeValue != vchildren[0]) { - fc.nodeValue = vchildren[0]; - //update rendering obj - fc._renderText.text = fc.nodeValue; - } - } - // otherwise, if there are existing or new children, diff them: - else if (vchildren && vchildren.length || fc != null) { - innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null); - } - - // Apply attributes/props from VNode to the DOM Element: - diffAttributes(out, vnode.attributes, props); - - // restore previous SVG mode: (in case we're exiting an SVG namespace) - isSvgMode = prevSvgMode; - - return out; - } - - /** Apply child and attribute changes between a VNode and a DOM Node to the DOM. - * @param {Element} dom Element whose children should be compared & mutated - * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes` - * @param {Object} context Implicitly descendant context object (from most recent `getChildContext()`) - * @param {Boolean} mountAll - * @param {Boolean} isHydrating If `true`, consumes externally created elements similar to hydration - */ - function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) { - var originalChildren = dom.childNodes, - children = [], - keyed = {}, - keyedLen = 0, - min = 0, - len = originalChildren.length, - childrenLen = 0, - vlen = vchildren ? vchildren.length : 0, - j = void 0, - c = void 0, - f = void 0, - vchild = void 0, - child = void 0; - - // Build up a map of keyed children and an Array of unkeyed children: - if (len !== 0) { - for (var i = 0; i < len; i++) { - var _child = originalChildren[i], - props = _child[ATTR_KEY], - key = vlen && props ? _child._component ? _child._component.__key : props.key : null; - if (key != null) { - keyedLen++; - keyed[key] = _child; - } else if (props || (_child.splitText !== undefined ? isHydrating ? _child.nodeValue.trim() : true : isHydrating)) { - children[childrenLen++] = _child; - } - } - } - - if (vlen !== 0) { - for (var _i = 0; _i < vlen; _i++) { - vchild = vchildren[_i]; - child = null; - - // attempt to find a node based on key matching - var _key = vchild.key; - if (_key != null) { - if (keyedLen && keyed[_key] !== undefined) { - child = keyed[_key]; - keyed[_key] = undefined; - keyedLen--; - } - } - // attempt to pluck a node of the same type from the existing children - else if (!child && min < childrenLen) { - for (j = min; j < childrenLen; j++) { - if (children[j] !== undefined && isSameNodeType(c = children[j], vchild, isHydrating)) { - child = c; - children[j] = undefined; - if (j === childrenLen - 1) childrenLen--; - if (j === min) min++; - break; - } - } - } - - // morph the matched/found/created DOM child to match vchild (deep) - child = idiff(child, vchild, context, mountAll); - - f = originalChildren[_i]; - if (child && child !== dom && child !== f) { - if (f == null) { - dom.appendChild(child); - } else if (child === f.nextSibling) { - removeNode(f); - } else { - dom.insertBefore(child, f); - } - } - } - } - - // remove unused keyed children: - if (keyedLen) { - for (var _i2 in keyed) { - if (keyed[_i2] !== undefined) recollectNodeTree(keyed[_i2], false); - } - } - - // remove orphaned unkeyed children: - while (min <= childrenLen) { - if ((child = children[childrenLen--]) !== undefined) recollectNodeTree(child, false); - } - } - - /** Recursively recycle (or just unmount) a node and its descendants. - * @param {Node} node DOM node to start unmount/removal from - * @param {Boolean} [unmountOnly=false] If `true`, only triggers unmount lifecycle, skips removal - */ - function recollectNodeTree(node, unmountOnly) { - var component = node._component; - if (component) { - // if node is owned by a Component, unmount that component (ends up recursing back here) - unmountComponent(component); - } else { - // If the node's VNode had a ref function, invoke it with null here. - // (this is part of the React spec, and smart for unsetting references) - if (node[ATTR_KEY] != null) applyRef(node[ATTR_KEY].ref, null); - - if (unmountOnly === false || node[ATTR_KEY] == null) { - removeNode(node); - } - - removeChildren(node); - } - } - - /** Recollect/unmount all children. - * - we use .lastChild here because it causes less reflow than .firstChild - * - it's also cheaper than accessing the .childNodes Live NodeList - */ - function removeChildren(node) { - node = node.lastChild; - while (node) { - var next = node.previousSibling; - recollectNodeTree(node, true); - node = next; - } - } - - /** Apply differences in attributes from a VNode to the given DOM Element. - * @param {Element} dom Element with attributes to diff `attrs` against - * @param {Object} attrs The desired end-state key-value attribute pairs - * @param {Object} old Current/previous attributes (from previous VNode or element's prop cache) - */ - function diffAttributes(dom, attrs, old) { - var name = void 0; - - // remove attributes no longer present on the vnode by setting them to undefined - for (name in old) { - if (!(attrs && attrs[name] != null) && old[name] != null) { - setAccessor(dom, name, old[name], old[name] = undefined, isSvgMode); - } - } - - // add new & update changed attributes - for (name in attrs) { - if (name !== 'children' && name !== 'innerHTML' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) { - setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode); - } - } - } - - var OBJECTTYPE = '[object Object]'; - var ARRAYTYPE = '[object Array]'; - - function define(name, ctor) { - options.mapping[name] = ctor; - if (ctor.use) { - ctor.updatePath = getPath(ctor.use); - } else if (ctor.data) { - //Compatible with older versions - ctor.updatePath = getUpdatePath(ctor.data); - } - } - - function getPath(obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - var result = {}; - obj.forEach(function (item) { - if (typeof item === 'string') { - result[item] = true; - } else { - var tempPath = item[Object.keys(item)[0]]; - if (typeof tempPath === 'string') { - result[tempPath] = true; - } else { - if (typeof tempPath[0] === 'string') { - result[tempPath[0]] = true; - } else { - tempPath[0].forEach(function (path) { - return result[path] = true; - }); - } - } - } - }); - return result; - } else { - return getUpdatePath(obj); - } - } - - function getUpdatePath(data) { - var result = {}; - dataToPath(data, result); - return result; - } - - function dataToPath(data, result) { - Object.keys(data).forEach(function (key) { - result[key] = true; - var type = Object.prototype.toString.call(data[key]); - if (type === OBJECTTYPE) { - _objToPath(data[key], key, result); - } else if (type === ARRAYTYPE) { - _arrayToPath(data[key], key, result); - } - }); - } - - function _objToPath(data, path, result) { - Object.keys(data).forEach(function (key) { - result[path + '.' + key] = true; - delete result[path]; - var type = Object.prototype.toString.call(data[key]); - if (type === OBJECTTYPE) { - _objToPath(data[key], path + '.' + key, result); - } else if (type === ARRAYTYPE) { - _arrayToPath(data[key], path + '.' + key, result); - } - }); - } - - function _arrayToPath(data, path, result) { - data.forEach(function (item, index) { - result[path + '[' + index + ']'] = true; - delete result[path]; - var type = Object.prototype.toString.call(item); - if (type === OBJECTTYPE) { - _objToPath(item, path + '[' + index + ']', result); - } else if (type === ARRAYTYPE) { - _arrayToPath(item, path + '[' + index + ']', result); - } - }); - } - - /** Retains a pool of Components for re-use, keyed on component name. - * Note: since component names are not unique or even necessarily available, these are primarily a form of sharding. - * @private - */ - var components = {}; - - /** Reclaim a component for later re-use by the recycler. */ - function collectComponent(component) { - var name = component.constructor.name;(components[name] || (components[name] = [])).push(component); - } - - /** Create a component. Normalizes differences between PFC's and classful Components. */ - function createComponent(Ctor, props, context, vnode) { - var list = components[Ctor.name], - inst = void 0; - - if (Ctor.prototype && Ctor.prototype.render) { - inst = new Ctor(props, context); - Component.call(inst, props, context); - } else { - inst = new Component(props, context); - inst.constructor = Ctor; - inst.render = doRender; - } - vnode && (inst.scopedCssAttr = vnode.css); - - if (inst.store && inst.store.data) { - if (inst.constructor.use) { - inst.use = getUse(inst.store.data, inst.constructor.use); - inst.store.instances.push(inst); - } else if (inst.initUse) { - var use = inst.initUse(); - inst._updatePath = getPath(use); - inst.use = getUse(inst.store.data, use); - inst.store.instances.push(inst); - } - } - - if (list) { - for (var i = list.length; i--;) { - if (list[i].constructor === Ctor) { - inst.nextBase = list[i].nextBase; - list.splice(i, 1); - break; - } - } - } - return inst; - } - - /** The `.render()` method for a PFC backing instance. */ - function doRender(props, data, context) { - return this.constructor(props, context); - } - - var styleId = 0; - - function getCtorName(ctor) { - for (var i = 0, len = options.styleCache.length; i < len; i++) { - var item = options.styleCache[i]; - - if (item.ctor === ctor) { - return item.attrName; - } - } - - var attrName = 's' + styleId; - options.styleCache.push({ ctor: ctor, attrName: attrName }); - styleId++; - - return attrName; - } - - function addScopedAttrStatic(vdom, attr) { - if (options.scopedStyle) { - scopeVdom(attr, vdom); - } - } - - function scopeVdom(attr, vdom) { - if (typeof vdom === 'object') { - vdom.attributes = vdom.attributes || {}; - vdom.attributes[attr] = ''; - vdom.css = vdom.css || {}; - vdom.css[attr] = ''; - vdom.children.forEach(function (child) { - return scopeVdom(attr, child); - }); - } - } - - function scopeHost(vdom, css) { - if (typeof vdom === 'object' && css) { - vdom.attributes = vdom.attributes || {}; - for (var key in css) { - vdom.attributes[key] = ''; - } - } - } - - /* obaa 1.0.0 - * By dntzhang - * Github: https://github.com/Tencent/omi - * MIT Licensed. - */ - - var obaa = function obaa(target, arr, callback) { - var _observe = function _observe(target, arr, callback) { - if (!target.$observer) target.$observer = this; - var $observer = target.$observer; - var eventPropArr = []; - if (obaa.isArray(target)) { - if (target.length === 0) { - target.$observeProps = {}; - target.$observeProps.$observerPath = '#'; - } - $observer.mock(target); - } - for (var prop in target) { - if (target.hasOwnProperty(prop)) { - if (callback) { - if (obaa.isArray(arr) && obaa.isInArray(arr, prop)) { - eventPropArr.push(prop); - $observer.watch(target, prop); - } else if (obaa.isString(arr) && prop == arr) { - eventPropArr.push(prop); - $observer.watch(target, prop); - } - } else { - eventPropArr.push(prop); - $observer.watch(target, prop); - } - } - } - $observer.target = target; - if (!$observer.propertyChangedHandler) $observer.propertyChangedHandler = []; - var propChanged = callback ? callback : arr; - $observer.propertyChangedHandler.push({ - all: !callback, - propChanged: propChanged, - eventPropArr: eventPropArr - }); - }; - _observe.prototype = { - onPropertyChanged: function onPropertyChanged(prop, value, oldValue, target, path) { - if (value !== oldValue && this.propertyChangedHandler) { - var rootName = obaa._getRootName(prop, path); - for (var i = 0, len = this.propertyChangedHandler.length; i < len; i++) { - var handler = this.propertyChangedHandler[i]; - if (handler.all || obaa.isInArray(handler.eventPropArr, rootName) || rootName.indexOf('Array-') === 0) { - handler.propChanged.call(this.target, prop, value, oldValue, path); - } - } - } - if (prop.indexOf('Array-') !== 0 && typeof value === 'object') { - this.watch(target, prop, target.$observeProps.$observerPath); - } - }, - mock: function mock(target) { - var self = this; - obaa.methods.forEach(function (item) { - target[item] = function () { - var old = Array.prototype.slice.call(this, 0); - var result = Array.prototype[item].apply(this, Array.prototype.slice.call(arguments)); - if (new RegExp('\\b' + item + '\\b').test(obaa.triggerStr)) { - for (var cprop in this) { - if (this.hasOwnProperty(cprop) && !obaa.isFunction(this[cprop])) { - self.watch(this, cprop, this.$observeProps.$observerPath); - } - } - //todo - self.onPropertyChanged('Array-' + item, this, old, this, this.$observeProps.$observerPath); - } - return result; - }; - target['pure' + item.substring(0, 1).toUpperCase() + item.substring(1)] = function () { - return Array.prototype[item].apply(this, Array.prototype.slice.call(arguments)); - }; - }); - }, - watch: function watch(target, prop, path) { - if (prop === '$observeProps' || prop === '$observer') return; - if (obaa.isFunction(target[prop])) return; - if (!target.$observeProps) target.$observeProps = {}; - if (path !== undefined) { - target.$observeProps.$observerPath = path; - } else { - target.$observeProps.$observerPath = '#'; - } - var self = this; - var currentValue = target.$observeProps[prop] = target[prop]; - Object.defineProperty(target, prop, { - get: function get() { - return this.$observeProps[prop]; - }, - set: function set(value) { - var old = this.$observeProps[prop]; - this.$observeProps[prop] = value; - self.onPropertyChanged(prop, value, old, this, target.$observeProps.$observerPath); - } - }); - if (typeof currentValue == 'object') { - if (obaa.isArray(currentValue)) { - this.mock(currentValue); - if (currentValue.length === 0) { - if (!currentValue.$observeProps) currentValue.$observeProps = {}; - if (path !== undefined) { - currentValue.$observeProps.$observerPath = path; - } else { - currentValue.$observeProps.$observerPath = '#'; - } - } - } - for (var cprop in currentValue) { - if (currentValue.hasOwnProperty(cprop)) { - this.watch(currentValue, cprop, target.$observeProps.$observerPath + '-' + prop); - } - } - } - } - }; - return new _observe(target, arr, callback); - }; - - obaa.methods = ['concat', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values', 'size']; - obaa.triggerStr = ['concat', 'copyWithin', 'fill', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'size'].join(','); - - obaa.isArray = function (obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - - obaa.isString = function (obj) { - return typeof obj === 'string'; - }; - - obaa.isInArray = function (arr, item) { - for (var i = arr.length; --i > -1;) { - if (item === arr[i]) return true; - } - return false; - }; - - obaa.isFunction = function (obj) { - return Object.prototype.toString.call(obj) == '[object Function]'; - }; - - obaa._getRootName = function (prop, path) { - if (path === '#') { - return prop; - } - return path.split('-')[1]; - }; - - obaa.add = function (obj, prop) { - var $observer = obj.$observer; - $observer.watch(obj, prop); - }; - - obaa.set = function (obj, prop, value, exec) { - if (!exec) { - obj[prop] = value; - } - var $observer = obj.$observer; - $observer.watch(obj, prop); - if (exec) { - obj[prop] = value; - } - }; - - Array.prototype.size = function (length) { - this.length = length; - }; - - var callbacks = []; - var nextTickCallback = []; - - function fireTick() { - callbacks.forEach(function (item) { - item.fn.call(item.scope); - }); - - nextTickCallback.forEach(function (nextItem) { - nextItem.fn.call(nextItem.scope); - }); - nextTickCallback.length = 0; - } - - function proxyUpdate(ele) { - var timeout = null; - obaa(ele.data, function () { - if (ele._willUpdate) { - return; - } - if (ele.constructor.mergeUpdate) { - clearTimeout(timeout); - - timeout = setTimeout(function () { - ele.update(); - fireTick(); - }, 0); - } else { - ele.update(); - fireTick(); - } - }); - } - - /** Set a component's `props` (generally derived from JSX attributes). - * @param {Object} props - * @param {Object} [opts] - * @param {boolean} [opts.renderSync=false] If `true` and {@link options.syncComponentUpdates} is `true`, triggers synchronous rendering. - * @param {boolean} [opts.render=true] If `false`, no render will be triggered. - */ - function setComponentProps(component, props, opts, context, mountAll) { - if (component._disable) return; - component._disable = true; - - if (component.__ref = props.ref) delete props.ref; - if (component.__key = props.key) delete props.key; - - if (!component.base || mountAll) { - if (component.beforeInstall) component.beforeInstall(); - if (component.install) component.install(); - if (component.constructor.observe) { - proxyUpdate(component); - } - } - - if (context && context !== component.context) { - if (!component.prevContext) component.prevContext = component.context; - component.context = context; - } - - if (!component.prevProps) component.prevProps = component.props; - component.props = props; - - component._disable = false; - - if (opts !== NO_RENDER) { - if (opts === SYNC_RENDER || options.syncComponentUpdates !== false || !component.base) { - renderComponent(component, SYNC_RENDER, mountAll); - } else { - enqueueRender(component); - } - } - - applyRef(component.__ref, component); - } - - function shallowComparison(old, attrs) { - var name = void 0; - - for (name in old) { - if (attrs[name] == null && old[name] != null) { - return true; - } - } - - if (old.children.length > 0 || attrs.children.length > 0) { - return true; - } - - for (name in attrs) { - if (name != 'children') { - var type = typeof attrs[name]; - if (type == 'function' || type == 'object') { - return true; - } else if (attrs[name] != old[name]) { - return true; - } - } - } - } - - /** Render a Component, triggering necessary lifecycle events and taking High-Order Components into account. - * @param {Component} component - * @param {Object} [opts] - * @param {boolean} [opts.build=false] If `true`, component will build and store a DOM node if not already associated with one. - * @private - */ - function renderComponent(component, opts, mountAll, isChild) { - if (component._disable) return; - - var props = component.props, - data = component.data, - context = component.context, - previousProps = component.prevProps || props, - previousState = component.prevState || data, - previousContext = component.prevContext || context, - isUpdate = component.base, - nextBase = component.nextBase, - initialBase = isUpdate || nextBase, - initialChildComponent = component._component, - skip = false, - rendered = void 0, - inst = void 0, - cbase = void 0; - - // if updating - if (isUpdate) { - component.props = previousProps; - component.data = previousState; - component.context = previousContext; - if (component.store || opts == FORCE_RENDER || shallowComparison(previousProps, props)) { - var receiveResult = true; - if (component.receiveProps) { - receiveResult = component.receiveProps(props, previousProps); - } - if (receiveResult !== false) { - skip = false; - if (component.beforeUpdate) { - component.beforeUpdate(props, data, context); - } - } else { - skip = true; - } - } else { - skip = true; - } - component.props = props; - component.data = data; - component.context = context; - } - - component.prevProps = component.prevState = component.prevContext = component.nextBase = null; - - if (!skip) { - component.beforeRender && component.beforeRender(); - rendered = component.render(props, data, context); - - //don't rerender - if (component.constructor.css || component.css) { - addScopedAttrStatic(rendered, '_s' + getCtorName(component.constructor)); - } - - scopeHost(rendered, component.scopedCssAttr); - - // context to pass to the child, can be updated via (grand-)parent component - if (component.getChildContext) { - context = extend(extend({}, context), component.getChildContext()); - } - - var childComponent = rendered && rendered.nodeName, - toUnmount = void 0, - base = void 0, - ctor = options.mapping[childComponent]; - - if (ctor) { - // set up high order component link - - var childProps = getNodeProps(rendered); - inst = initialChildComponent; - - if (inst && inst.constructor === ctor && childProps.key == inst.__key) { - setComponentProps(inst, childProps, SYNC_RENDER, context, false); - } else { - toUnmount = inst; - - component._component = inst = createComponent(ctor, childProps, context); - inst.nextBase = inst.nextBase || nextBase; - inst._parentComponent = component; - setComponentProps(inst, childProps, NO_RENDER, context, false); - renderComponent(inst, SYNC_RENDER, mountAll, true); - } - - base = inst.base; - } else { - cbase = initialBase; - - // destroy high order component link - toUnmount = initialChildComponent; - if (toUnmount) { - cbase = component._component = null; - } - - if (initialBase || opts === SYNC_RENDER) { - if (cbase) cbase._component = null; - base = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, true); - } - } - - if (initialBase && base !== initialBase && inst !== initialChildComponent) { - var baseParent = initialBase.parentNode; - if (baseParent && base !== baseParent) { - baseParent.replaceChild(base, initialBase); - - if (!toUnmount) { - initialBase._component = null; - recollectNodeTree(initialBase, false); - } - } - } - - if (toUnmount) { - unmountComponent(toUnmount); - } - - component.base = base; - if (base && !isChild) { - var componentRef = component, - t = component; - while (t = t._parentComponent) { - (componentRef = t).base = base; - } - base._component = componentRef; - base._componentConstructor = componentRef.constructor; - } - } - - if (!isUpdate || mountAll) { - mounts.unshift(component); - } else if (!skip) { - // Ensure that pending componentDidMount() hooks of child components - // are called before the componentDidUpdate() hook in the parent. - // Note: disabled as it causes duplicate hooks, see https://github.com/developit/preact/issues/750 - // flushMounts(); - - if (component.afterUpdate) { - //deprecated - component.afterUpdate(previousProps, previousState, previousContext); - } - if (component.updated) { - component.updated(previousProps, previousState, previousContext); - } - if (options.afterUpdate) options.afterUpdate(component); - } - - if (component._renderCallbacks != null) { - while (component._renderCallbacks.length) { - component._renderCallbacks.pop().call(component); - } - } - - if (!diffLevel && !isChild) flushMounts(); - } - - /** Apply the Component referenced by a VNode to the DOM. - * @param {Element} dom The DOM node to mutate - * @param {VNode} vnode A Component-referencing VNode - * @returns {Element} dom The created/mutated element - * @private - */ - function buildComponentFromVNode(dom, vnode, context, mountAll) { - var c = dom && dom._component, - originalComponent = c, - oldDom = dom, - isDirectOwner = c && dom._componentConstructor === vnode.nodeName, - isOwner = isDirectOwner, - props = getNodeProps(vnode); - while (c && !isOwner && (c = c._parentComponent)) { - isOwner = c.constructor === vnode.nodeName; - } - - if (c && isOwner && (!mountAll || c._component)) { - setComponentProps(c, props, ASYNC_RENDER, context, mountAll); - dom = c.base; - } else { - if (originalComponent && !isDirectOwner) { - unmountComponent(originalComponent); - dom = oldDom = null; - } - - c = createComponent(vnode.nodeName, props, context, vnode); - if (dom && !c.nextBase) { - c.nextBase = dom; - // passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229: - oldDom = null; - } - setComponentProps(c, props, SYNC_RENDER, context, mountAll); - dom = c.base; - - if (oldDom && dom !== oldDom) { - oldDom._component = null; - recollectNodeTree(oldDom, false); - } - } - - return dom; - } - - /** Remove a component from the DOM and recycle it. - * @param {Component} component The Component instance to unmount - * @private - */ - function unmountComponent(component) { - if (options.beforeUnmount) options.beforeUnmount(component); - - var base = component.base; - - component._disable = true; - - if (component.uninstall) component.uninstall(); - - if (component.store && component.store.instances) { - for (var i = 0, len = component.store.instances.length; i < len; i++) { - if (component.store.instances[i] === component) { - component.store.instances.splice(i, 1); - break; - } - } - } - - component.base = null; - - // recursively tear down & recollect high-order component children: - var inner = component._component; - if (inner) { - unmountComponent(inner); - } else if (base) { - if (base[ATTR_KEY] != null) applyRef(base[ATTR_KEY].ref, null); - - component.nextBase = base; - - removeNode(base); - collectComponent(component); - - removeChildren(base); - } - - applyRef(component.__ref, null); - } - - var _class, _temp; - - function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var id = 0; - - var Component = (_temp = _class = function () { - function Component(props, store) { - _classCallCheck$3(this, Component); - - this.props = assign(nProps(this.constructor.props), this.constructor.defaultProps, props); - this.elementId = id++; - this.data = this.constructor.data || this.data || {}; - - this._preCss = null; - - this.store = store; - } - - Component.prototype.update = function update(callback) { - this._willUpdate = true; - if (callback) (this._renderCallbacks = this._renderCallbacks || []).push(callback); - renderComponent(this, FORCE_RENDER); - if (options.componentChange) options.componentChange(this, this.base); - this._willUpdate = false; - }; - - Component.prototype.fire = function fire(type, data) { - var _this = this; - - Object.keys(this.props).every(function (key) { - if ('on' + type.toLowerCase() === key.toLowerCase()) { - _this.props[key]({ detail: data }); - return false; - } - return true; - }); - }; - - Component.prototype.render = function render() {}; - - return Component; - }(), _class.is = 'WeElement', _temp); - - /** Render JSX into a `parent` Element. - * @param {VNode} vnode A (JSX) VNode to render - * @param {Element} parent DOM element to render into - * @param {object} [store] - * @public - */ - function render(vnode, parent, store, empty, merge) { - parent = typeof parent === 'string' ? document.querySelector(parent) : parent; - - if (empty) { - while (parent.firstChild) { - parent.removeChild(parent.firstChild); - } - } - - if (merge) { - merge = typeof merge === 'string' ? document.querySelector(merge) : merge; - } - - return diff(merge, vnode, store, false, parent, false, true); - } - - function tag(name) { - return function (target) { - define(name, target); - }; - } - - var WeElement = Component; - var root = getGlobal$1(); - var omiax = { - h: h, - tag: tag, - define: define, - Component: Component, - render: render, - WeElement: WeElement, - options: options - }; - - root.Omi = omiax; - root.omi = omiax; - root.omiax = omiax; - root.omiax.version = '0.0.0'; - - function getGlobal$1() { - if (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) { - if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else if (typeof global !== 'undefined') { - return global; - } - return function () { - return this; - }(); - } - return global; - } - var size = getSize(); - var vnode = Omi.h( - 'surface', - { top: 0, left: 0, width: size.width, height: size.height, enableCSSLayout: true }, - Omi.h( - 'group', - { style: getPageStyle() }, - Omi.h( - 'text', - { style: getTitleStyle() }, - 'Professor PuddinPop' - ), + //全局 store或者局部 store,data全放这里,组件没有私有 data,只可以有 props + var store = {}; + + //UI is UI,没有 data + var App = function App(props, store) { + return Omi.h( + 'surface', + { top: 0, left: 0, width: size.width, height: size.height, enableCSSLayout: true }, Omi.h( 'group', - { style: getImageGroupStyle() }, - Omi.h('image', { src: 'https://placekitten.com/720/840', style: getImageStyle(), fadeIn: true }) - ), - Omi.h( - 'text', - { style: getExcerptStyle() }, - 'With these words the Witch fell down in a brown, melted, shapeless mass and began to spread over the clean boards of the kitchen floor. Seeing that she had really melted away to nothing, Dorothy drew another bucket of water and threw it over the mess. She then swept it all out the door. After picking out the silver shoe, which was all that was left of the old woman, she cleaned and dried it with a cloth, and put it on her foot again. Then, being at last free to do as she chose, she ran out to the courtyard to tell the Lion that the Wicked Witch of the West had come to an end, and that they were no longer prisoners in a strange land.' + { style: getPageStyle() }, + Omi.h( + 'text', + { style: getTitleStyle() }, + 'Professor PuddinPop' + ), + Omi.h( + 'group', + { style: getImageGroupStyle() }, + Omi.h('image', { src: 'https://placekitten.com/720/840', style: getImageStyle(), fadeIn: true }) + ), + Omi.h( + 'text', + { style: getExcerptStyle() }, + 'With these words the Witch fell down in a brown, melted, shapeless mass and began to spread over the clean boards of the kitchen floor. Seeing that she had really melted away to nothing, Dorothy drew another bucket of water and threw it over the mess. She then swept it all out the door. After picking out the silver shoe, which was all that was left of the old woman, she cleaned and dried it with a cloth, and put it on her foot again. Then, being at last free to do as she chose, she ran out to the courtyard to tell the Lion that the Wicked Witch of the West had come to an end, and that they were no longer prisoners in a strange land.' + ) ) - ) - ); + ); + }; - console.log(layoutNode(vnode)); + //渲染并注入 store + console.log(render(App, store)); function getSize() { return { diff --git a/packages/omiax/examples/hello/b.js.map b/packages/omiax/examples/hello/b.js.map index c98806f91..551b1cacf 100644 --- a/packages/omiax/examples/hello/b.js.map +++ b/packages/omiax/examples/hello/b.js.map @@ -1 +1 @@ -{"version":3,"file":"b.js","sources":["../../src/layout/layout.js","../../src/layout/layout-node.js","../../src/omi/h.js","../../src/omi/constants.js","../../src/omi/mock/util.js","../../src/omi/mock/element.js","../../src/omi/mock/text-node.js","../../src/omi/mock/document.js","../../src/omi/mock/index.js","../../src/omi/options.js","../../src/omi/util.js","../../src/omi/render-queue.js","../../src/omi/vdom/index.js","../../src/omi/dom/index.js","../../src/cax/draw.js","../../src/omi/vdom/diff.js","../../src/omi/define.js","../../src/omi/vdom/component-recycler.js","../../src/omi/style.js","../../src/omi/obaa.js","../../src/omi/tick.js","../../src/omi/observe.js","../../src/omi/vdom/component.js","../../src/omi/component.js","../../src/omi/render.js","../../src/omi/tag.js","../../src/omi/omi.js","main.js"],"sourcesContent":["// https://github.com/facebook/css-layout\n\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\nvar computeLayout = (function() {\n\n function capitalizeFirst(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n function getSpacing(node, type, suffix, location) {\n var key = type + capitalizeFirst(location) + suffix;\n if (key in node.style) {\n return node.style[key];\n }\n\n key = type + suffix;\n if (key in node.style) {\n return node.style[key];\n }\n\n return 0;\n }\n\n function getPositiveSpacing(node, type, suffix, location) {\n var key = type + capitalizeFirst(location) + suffix;\n if (key in node.style && node.style[key] >= 0) {\n return node.style[key];\n }\n\n key = type + suffix;\n if (key in node.style && node.style[key] >= 0) {\n return node.style[key];\n }\n\n return 0;\n }\n\n function isUndefined(value) {\n return value === undefined;\n }\n\n function getMargin(node, location) {\n return getSpacing(node, 'margin', '', location);\n }\n\n function getPadding(node, location) {\n return getPositiveSpacing(node, 'padding', '', location);\n }\n\n function getBorder(node, location) {\n return getPositiveSpacing(node, 'border', 'Width', location);\n }\n\n function getPaddingAndBorder(node, location) {\n return getPadding(node, location) + getBorder(node, location);\n }\n\n function getMarginAxis(node, axis) {\n return getMargin(node, leading[axis]) + getMargin(node, trailing[axis]);\n }\n\n function getPaddingAndBorderAxis(node, axis) {\n return getPaddingAndBorder(node, leading[axis]) + getPaddingAndBorder(node, trailing[axis]);\n }\n\n function getJustifyContent(node) {\n if ('justifyContent' in node.style) {\n return node.style.justifyContent;\n }\n return 'flex-start';\n }\n\n function getAlignItem(node, child) {\n if ('alignSelf' in child.style) {\n return child.style.alignSelf;\n }\n if ('alignItems' in node.style) {\n return node.style.alignItems;\n }\n return 'stretch';\n }\n\n function getFlexDirection(node) {\n if ('flexDirection' in node.style) {\n return node.style.flexDirection;\n }\n return 'column';\n }\n\n function getPositionType(node) {\n if ('position' in node.style) {\n return node.style.position;\n }\n return 'relative';\n }\n\n function getFlex(node) {\n return node.style.flex;\n }\n\n function isFlex(node) {\n return (\n getPositionType(node) === CSS_POSITION_RELATIVE &&\n getFlex(node) > 0\n );\n }\n\n function isFlexWrap(node) {\n return node.style.flexWrap === 'wrap';\n }\n\n function getDimWithMargin(node, axis) {\n return node.layout[dim[axis]] + getMarginAxis(node, axis);\n }\n\n function isDimDefined(node, axis) {\n return !isUndefined(node.style[dim[axis]]) && node.style[dim[axis]] >= 0;\n }\n\n function isPosDefined(node, pos) {\n return !isUndefined(node.style[pos]);\n }\n\n function isMeasureDefined(node) {\n return 'measure' in node.style;\n }\n\n function getPosition(node, pos) {\n if (pos in node.style) {\n return node.style[pos];\n }\n return 0;\n }\n\n // When the user specifically sets a value for width or height\n function setDimensionFromStyle(node, axis) {\n // The parent already computed us a width or height. We just skip it\n if (!isUndefined(node.layout[dim[axis]])) {\n return;\n }\n // We only run if there's a width or height defined\n if (!isDimDefined(node, axis)) {\n return;\n }\n\n // The dimensions can never be smaller than the padding and border\n node.layout[dim[axis]] = fmaxf(\n node.style[dim[axis]],\n getPaddingAndBorderAxis(node, axis)\n );\n }\n\n // If both left and right are defined, then use left. Otherwise return\n // +left or -right depending on which is defined.\n function getRelativePosition(node, axis) {\n if (leading[axis] in node.style) {\n return getPosition(node, leading[axis]);\n }\n return -getPosition(node, trailing[axis]);\n }\n\n var leading = {\n row: 'left',\n column: 'top'\n };\n var trailing = {\n row: 'right',\n column: 'bottom'\n };\n var pos = {\n row: 'left',\n column: 'top'\n };\n var dim = {\n row: 'width',\n column: 'height'\n };\n\n function fmaxf(a, b) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n var CSS_UNDEFINED = undefined;\n\n var CSS_FLEX_DIRECTION_ROW = 'row';\n var CSS_FLEX_DIRECTION_COLUMN = 'column';\n\n var CSS_JUSTIFY_FLEX_START = 'flex-start';\n var CSS_JUSTIFY_CENTER = 'center';\n var CSS_JUSTIFY_FLEX_END = 'flex-end';\n var CSS_JUSTIFY_SPACE_BETWEEN = 'space-between';\n var CSS_JUSTIFY_SPACE_AROUND = 'space-around';\n\n var CSS_ALIGN_FLEX_START = 'flex-start';\n var CSS_ALIGN_CENTER = 'center';\n var CSS_ALIGN_FLEX_END = 'flex-end';\n var CSS_ALIGN_STRETCH = 'stretch';\n\n var CSS_POSITION_RELATIVE = 'relative';\n var CSS_POSITION_ABSOLUTE = 'absolute';\n\n return function layoutNode(node, parentMaxWidth) {\n var/*css_flex_direction_t*/ mainAxis = getFlexDirection(node);\n var/*css_flex_direction_t*/ crossAxis = mainAxis === CSS_FLEX_DIRECTION_ROW ?\n CSS_FLEX_DIRECTION_COLUMN :\n CSS_FLEX_DIRECTION_ROW;\n\n // Handle width and height style attributes\n setDimensionFromStyle(node, mainAxis);\n setDimensionFromStyle(node, crossAxis);\n\n // The position is set by the parent, but we need to complete it with a\n // delta composed of the margin and left/top/right/bottom\n node.layout[leading[mainAxis]] += getMargin(node, leading[mainAxis]) +\n getRelativePosition(node, mainAxis);\n node.layout[leading[crossAxis]] += getMargin(node, leading[crossAxis]) +\n getRelativePosition(node, crossAxis);\n\n if (isMeasureDefined(node)) {\n var/*float*/ width = CSS_UNDEFINED;\n if (isDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {\n width = node.style.width;\n } else if (!isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_ROW]])) {\n width = node.layout[dim[CSS_FLEX_DIRECTION_ROW]];\n } else {\n width = parentMaxWidth -\n getMarginAxis(node, CSS_FLEX_DIRECTION_ROW);\n }\n width -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n\n // We only need to give a dimension for the text if we haven't got any\n // for it computed yet. It can either be from the style attribute or because\n // the element is flexible.\n var/*bool*/ isRowUndefined = !isDimDefined(node, CSS_FLEX_DIRECTION_ROW) &&\n isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_ROW]]);\n var/*bool*/ isColumnUndefined = !isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) &&\n isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]);\n\n // Let's not measure the text if we already know both dimensions\n if (isRowUndefined || isColumnUndefined) {\n var/*css_dim_t*/ measure_dim = node.style.measure(\n /*(c)!node->context,*/\n width\n );\n if (isRowUndefined) {\n node.layout.width = measure_dim.width +\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n }\n if (isColumnUndefined) {\n node.layout.height = measure_dim.height +\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN);\n }\n }\n return;\n }\n\n // Pre-fill some dimensions straight from the parent\n for (var/*int*/ i = 0; i < node.children.length; ++i) {\n var/*css_node_t**/ child = node.children[i];\n // Pre-fill cross axis dimensions when the child is using stretch before\n // we call the recursive layout pass\n if (getAlignItem(node, child) === CSS_ALIGN_STRETCH &&\n getPositionType(child) === CSS_POSITION_RELATIVE &&\n !isUndefined(node.layout[dim[crossAxis]]) &&\n !isDimDefined(child, crossAxis)) {\n child.layout[dim[crossAxis]] = fmaxf(\n node.layout[dim[crossAxis]] -\n getPaddingAndBorderAxis(node, crossAxis) -\n getMarginAxis(child, crossAxis),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, crossAxis)\n );\n } else if (getPositionType(child) == CSS_POSITION_ABSOLUTE) {\n // Pre-fill dimensions when using absolute position and both offsets for the axis are defined (either both\n // left and right or top and bottom).\n for (var/*int*/ ii = 0; ii < 2; ii++) {\n var/*css_flex_direction_t*/ axis = (ii != 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n if (!isUndefined(node.layout[dim[axis]]) &&\n !isDimDefined(child, axis) &&\n isPosDefined(child, leading[axis]) &&\n isPosDefined(child, trailing[axis])) {\n child.layout[dim[axis]] = fmaxf(\n node.layout[dim[axis]] -\n getPaddingAndBorderAxis(node, axis) -\n getMarginAxis(child, axis) -\n getPosition(child, leading[axis]) -\n getPosition(child, trailing[axis]),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, axis)\n );\n }\n }\n }\n }\n\n var/*float*/ definedMainDim = CSS_UNDEFINED;\n if (!isUndefined(node.layout[dim[mainAxis]])) {\n definedMainDim = node.layout[dim[mainAxis]] -\n getPaddingAndBorderAxis(node, mainAxis);\n }\n\n // We want to execute the next two loops one per line with flex-wrap\n var/*int*/ startLine = 0;\n var/*int*/ endLine = 0;\n var/*int*/ nextOffset = 0;\n var/*int*/ alreadyComputedNextLayout = 0;\n // We aggregate the total dimensions of the container in those two variables\n var/*float*/ linesCrossDim = 0;\n var/*float*/ linesMainDim = 0;\n while (endLine < node.children.length) {\n // Layout non flexible children and count children by type\n\n // mainContentDim is accumulation of the dimensions and margin of all the\n // non flexible children. This will be used in order to either set the\n // dimensions of the node if none already exist, or to compute the\n // remaining space left for the flexible children.\n var/*float*/ mainContentDim = 0;\n\n // There are three kind of children, non flexible, flexible and absolute.\n // We need to know how many there are in order to distribute the space.\n var/*int*/ flexibleChildrenCount = 0;\n var/*float*/ totalFlexible = 0;\n var/*int*/ nonFlexibleChildrenCount = 0;\n for (var/*int*/ i = startLine; i < node.children.length; ++i) {\n var/*css_node_t**/ child = node.children[i];\n var/*float*/ nextContentDim = 0;\n\n // It only makes sense to consider a child flexible if we have a computed\n // dimension for the node.\n if (!isUndefined(node.layout[dim[mainAxis]]) && isFlex(child)) {\n flexibleChildrenCount++;\n totalFlexible += getFlex(child);\n\n // Even if we don't know its exact size yet, we already know the padding,\n // border and margin. We'll use this partial information to compute the\n // remaining space.\n nextContentDim = getPaddingAndBorderAxis(child, mainAxis) +\n getMarginAxis(child, mainAxis);\n\n } else {\n var/*float*/ maxWidth = CSS_UNDEFINED;\n if (mainAxis === CSS_FLEX_DIRECTION_ROW) {\n // do nothing\n } else if (isDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {\n maxWidth = node.layout[dim[CSS_FLEX_DIRECTION_ROW]] -\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n } else {\n maxWidth = parentMaxWidth -\n getMarginAxis(node, CSS_FLEX_DIRECTION_ROW) -\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n }\n\n // This is the main recursive call. We layout non flexible children.\n if (alreadyComputedNextLayout === 0) {\n layoutNode(child, maxWidth);\n }\n\n // Absolute positioned elements do not take part of the layout, so we\n // don't use them to compute mainContentDim\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n nonFlexibleChildrenCount++;\n // At this point we know the final size and margin of the element.\n nextContentDim = getDimWithMargin(child, mainAxis);\n }\n }\n\n // The element we are about to add would make us go to the next line\n if (isFlexWrap(node) &&\n !isUndefined(node.layout[dim[mainAxis]]) &&\n mainContentDim + nextContentDim > definedMainDim &&\n // If there's only one element, then it's bigger than the content\n // and needs its own line\n i !== startLine) {\n alreadyComputedNextLayout = 1;\n break;\n }\n alreadyComputedNextLayout = 0;\n mainContentDim += nextContentDim;\n endLine = i + 1;\n }\n\n // Layout flexible children and allocate empty space\n\n // In order to position the elements in the main axis, we have two\n // controls. The space between the beginning and the first element\n // and the space between each two elements.\n var/*float*/ leadingMainDim = 0;\n var/*float*/ betweenMainDim = 0;\n\n // The remaining available space that needs to be allocated\n var/*float*/ remainingMainDim = 0;\n if (!isUndefined(node.layout[dim[mainAxis]])) {\n remainingMainDim = definedMainDim - mainContentDim;\n } else {\n remainingMainDim = fmaxf(mainContentDim, 0) - mainContentDim;\n }\n\n // If there are flexible children in the mix, they are going to fill the\n // remaining space\n if (flexibleChildrenCount !== 0) {\n var/*float*/ flexibleMainDim = remainingMainDim / totalFlexible;\n\n // The non flexible children can overflow the container, in this case\n // we should just assume that there is no space available.\n if (flexibleMainDim < 0) {\n flexibleMainDim = 0;\n }\n // We iterate over the full array and only apply the action on flexible\n // children. This is faster than actually allocating a new array that\n // contains only flexible children.\n for (var/*int*/ i = startLine; i < endLine; ++i) {\n var/*css_node_t**/ child = node.children[i];\n if (isFlex(child)) {\n // At this point we know the final size of the element in the main\n // dimension\n child.layout[dim[mainAxis]] = flexibleMainDim * getFlex(child) +\n getPaddingAndBorderAxis(child, mainAxis);\n\n var/*float*/ maxWidth = CSS_UNDEFINED;\n if (mainAxis === CSS_FLEX_DIRECTION_ROW) {\n // do nothing\n } else if (isDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {\n maxWidth = node.layout[dim[CSS_FLEX_DIRECTION_ROW]] -\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n } else {\n maxWidth = parentMaxWidth -\n getMarginAxis(node, CSS_FLEX_DIRECTION_ROW) -\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n }\n\n // And we recursively call the layout algorithm for this child\n layoutNode(child, maxWidth);\n }\n }\n\n // We use justifyContent to figure out how to allocate the remaining\n // space available\n } else {\n var/*css_justify_t*/ justifyContent = getJustifyContent(node);\n if (justifyContent === CSS_JUSTIFY_FLEX_START) {\n // Do nothing\n } else if (justifyContent === CSS_JUSTIFY_CENTER) {\n leadingMainDim = remainingMainDim / 2;\n } else if (justifyContent === CSS_JUSTIFY_FLEX_END) {\n leadingMainDim = remainingMainDim;\n } else if (justifyContent === CSS_JUSTIFY_SPACE_BETWEEN) {\n remainingMainDim = fmaxf(remainingMainDim, 0);\n if (flexibleChildrenCount + nonFlexibleChildrenCount - 1 !== 0) {\n betweenMainDim = remainingMainDim /\n (flexibleChildrenCount + nonFlexibleChildrenCount - 1);\n } else {\n betweenMainDim = 0;\n }\n } else if (justifyContent === CSS_JUSTIFY_SPACE_AROUND) {\n // Space on the edges is half of the space between elements\n betweenMainDim = remainingMainDim /\n (flexibleChildrenCount + nonFlexibleChildrenCount);\n leadingMainDim = betweenMainDim / 2;\n }\n }\n\n // Position elements in the main axis and compute dimensions\n\n // At this point, all the children have their dimensions set. We need to\n // find their position. In order to do that, we accumulate data in\n // variables that are also useful to compute the total dimensions of the\n // container!\n var/*float*/ crossDim = 0;\n var/*float*/ mainDim = leadingMainDim +\n getPaddingAndBorder(node, leading[mainAxis]);\n\n for (var/*int*/ i = startLine; i < endLine; ++i) {\n var/*css_node_t**/ child = node.children[i];\n\n if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&\n isPosDefined(child, leading[mainAxis])) {\n // In case the child is position absolute and has left/top being\n // defined, we override the position to whatever the user said\n // (and margin/border).\n child.layout[pos[mainAxis]] = getPosition(child, leading[mainAxis]) +\n getBorder(node, leading[mainAxis]) +\n getMargin(child, leading[mainAxis]);\n } else {\n // If the child is position absolute (without top/left) or relative,\n // we put it at the current accumulated offset.\n child.layout[pos[mainAxis]] += mainDim;\n }\n\n // Now that we placed the element, we need to update the variables\n // We only need to do that for relative elements. Absolute elements\n // do not take part in that phase.\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n // The main dimension is the sum of all the elements dimension plus\n // the spacing.\n mainDim += betweenMainDim + getDimWithMargin(child, mainAxis);\n // The cross dimension is the max of the elements dimension since there\n // can only be one element in that cross dimension.\n crossDim = fmaxf(crossDim, getDimWithMargin(child, crossAxis));\n }\n }\n\n var/*float*/ containerMainAxis = node.layout[dim[mainAxis]];\n // If the user didn't specify a width or height, and it has not been set\n // by the container, then we set it via the children.\n if (isUndefined(node.layout[dim[mainAxis]])) {\n containerMainAxis = fmaxf(\n // We're missing the last padding at this point to get the final\n // dimension\n mainDim + getPaddingAndBorder(node, trailing[mainAxis]),\n // We can never assign a width smaller than the padding and borders\n getPaddingAndBorderAxis(node, mainAxis)\n );\n }\n\n var/*float*/ containerCrossAxis = node.layout[dim[crossAxis]];\n if (isUndefined(node.layout[dim[crossAxis]])) {\n containerCrossAxis = fmaxf(\n // For the cross dim, we add both sides at the end because the value\n // is aggregate via a max function. Intermediate negative values\n // can mess this computation otherwise\n crossDim + getPaddingAndBorderAxis(node, crossAxis),\n getPaddingAndBorderAxis(node, crossAxis)\n );\n }\n\n // Position elements in the cross axis\n\n for (var/*int*/ i = startLine; i < endLine; ++i) {\n var/*css_node_t**/ child = node.children[i];\n\n if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&\n isPosDefined(child, leading[crossAxis])) {\n // In case the child is absolutely positionned and has a\n // top/left/bottom/right being set, we override all the previously\n // computed positions to set it correctly.\n child.layout[pos[crossAxis]] = getPosition(child, leading[crossAxis]) +\n getBorder(node, leading[crossAxis]) +\n getMargin(child, leading[crossAxis]);\n\n } else {\n var/*float*/ leadingCrossDim = getPaddingAndBorder(node, leading[crossAxis]);\n\n // For a relative children, we're either using alignItems (parent) or\n // alignSelf (child) in order to determine the position in the cross axis\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n var/*css_align_t*/ alignItem = getAlignItem(node, child);\n if (alignItem === CSS_ALIGN_FLEX_START) {\n // Do nothing\n } else if (alignItem === CSS_ALIGN_STRETCH) {\n // You can only stretch if the dimension has not already been set\n // previously.\n if (!isDimDefined(child, crossAxis)) {\n child.layout[dim[crossAxis]] = fmaxf(\n containerCrossAxis -\n getPaddingAndBorderAxis(node, crossAxis) -\n getMarginAxis(child, crossAxis),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, crossAxis)\n );\n }\n } else {\n // The remaining space between the parent dimensions+padding and child\n // dimensions+margin.\n var/*float*/ remainingCrossDim = containerCrossAxis -\n getPaddingAndBorderAxis(node, crossAxis) -\n getDimWithMargin(child, crossAxis);\n\n if (alignItem === CSS_ALIGN_CENTER) {\n leadingCrossDim += remainingCrossDim / 2;\n } else { // CSS_ALIGN_FLEX_END\n leadingCrossDim += remainingCrossDim;\n }\n }\n }\n\n // And we apply the position\n child.layout[pos[crossAxis]] += linesCrossDim + leadingCrossDim;\n }\n }\n\n linesCrossDim += crossDim;\n linesMainDim = fmaxf(linesMainDim, mainDim);\n startLine = endLine;\n }\n\n // If the user didn't specify a width or height, and it has not been set\n // by the container, then we set it via the children.\n if (isUndefined(node.layout[dim[mainAxis]])) {\n node.layout[dim[mainAxis]] = fmaxf(\n // We're missing the last padding at this point to get the final\n // dimension\n linesMainDim + getPaddingAndBorder(node, trailing[mainAxis]),\n // We can never assign a width smaller than the padding and borders\n getPaddingAndBorderAxis(node, mainAxis)\n );\n }\n\n if (isUndefined(node.layout[dim[crossAxis]])) {\n node.layout[dim[crossAxis]] = fmaxf(\n // For the cross dim, we add both sides at the end because the value\n // is aggregate via a max function. Intermediate negative values\n // can mess this computation otherwise\n linesCrossDim + getPaddingAndBorderAxis(node, crossAxis),\n getPaddingAndBorderAxis(node, crossAxis)\n );\n }\n\n // Calculate dimensions for absolutely positioned elements\n\n for (var/*int*/ i = 0; i < node.children.length; ++i) {\n var/*css_node_t**/ child = node.children[i];\n if (getPositionType(child) == CSS_POSITION_ABSOLUTE) {\n // Pre-fill dimensions when using absolute position and both offsets for the axis are defined (either both\n // left and right or top and bottom).\n for (var/*int*/ ii = 0; ii < 2; ii++) {\n var/*css_flex_direction_t*/ axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n if (!isUndefined(node.layout[dim[axis]]) &&\n !isDimDefined(child, axis) &&\n isPosDefined(child, leading[axis]) &&\n isPosDefined(child, trailing[axis])) {\n child.layout[dim[axis]] = fmaxf(\n node.layout[dim[axis]] -\n getPaddingAndBorderAxis(node, axis) -\n getMarginAxis(child, axis) -\n getPosition(child, leading[axis]) -\n getPosition(child, trailing[axis]),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, axis)\n );\n }\n }\n for (var/*int*/ ii = 0; ii < 2; ii++) {\n var/*css_flex_direction_t*/ axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n if (isPosDefined(child, trailing[axis]) &&\n !isPosDefined(child, leading[axis])) {\n child.layout[leading[axis]] =\n node.layout[dim[axis]] -\n child.layout[dim[axis]] -\n getPosition(child, trailing[axis]);\n }\n }\n }\n }\n };\n})();\n\nexport default computeLayout","// https://github.com/Flipboard/react-canvas\n\n/**\nCopyright (c) 2015, Flipboard\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice, this\n list of conditions and the following disclaimer in the documentation and/or\n other materials provided with the distribution.\n\n* Neither the name of Flipboard nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n'use strict';\n\nimport computeLayout from './layout';\n\n/**\n * This computes the CSS layout for a RenderLayer tree and mutates the frame\n * objects at each node.\n *\n * @param {Renderlayer} root\n * @return {Object}\n */\nfunction layoutNode (root) {\n var rootNode = createNode(root);\n computeLayout(rootNode);\n walkNode(rootNode);\n return rootNode;\n}\n\nfunction createNode (layer) {\n return {\n layer: layer,\n layout: {\n width: undefined, // computeLayout will mutate\n height: undefined, // computeLayout will mutate\n top: 0,\n left: 0,\n },\n style: (layer.attributes && layer.attributes.style) || {},\n children: (layer.children || []).map(createNode)\n };\n}\n\nfunction walkNode (node, parentLeft, parentTop) {\n node.layer.frame.x = node.layout.left + (parentLeft || 0);\n node.layer.frame.y = node.layout.top + (parentTop || 0);\n node.layer.frame.width = node.layout.width;\n node.layer.frame.height = node.layout.height;\n if (node.children && node.children.length > 0) {\n node.children.forEach(function (child) {\n walkNode(child, node.layer.frame.x, node.layer.frame.y);\n });\n }\n}\n\nexport default layoutNode;","const stack = []\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a lightweight representation\n * of the structure of a DOM tree. This structure can be realized by recursively comparing it against\n * the current _actual_ DOM structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string} nodeName\tAn element name. Ex: `div`, `a`, `span`, etc.\n * @param {Object} attributes\tAny attributes/props to set on the created element.\n * @param rest\t\t\tAdditional arguments are taken to be children to append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(type, attributes) {\n let children = [],\n lastSimple,\n child,\n simple,\n i\n for (i = arguments.length; i-- > 2;) {\n stack.push(arguments[i])\n }\n if (attributes && attributes.children != null) {\n if (!stack.length) stack.push(attributes.children)\n delete attributes.children\n }\n\n let p = {}\n if (type !== 'text') {\n while (stack.length) {\n if ((child = stack.pop()) && child.pop !== undefined) {\n for (i = child.length; i--;) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof type !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children.length === 0) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n } else {\n p.value = stack.pop()\n }\n\n\n\n p.type = type\n p.frame = {\n \"x\": 0,\n \"y\": 0,\n \"width\": 0,\n \"height\": 0\n }\n p.children = children\n p.attributes = attributes == null ? undefined : attributes\n p.key = attributes == null ? undefined : attributes.key\n\n\n return p\n}\n","// render modes\n\nexport const NO_RENDER = 0\nexport const SYNC_RENDER = 1\nexport const FORCE_RENDER = 2\nexport const ASYNC_RENDER = 3\n\nexport const ATTR_KEY = '__omiattr_'\n\n// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\n","let nodeId = 1\nexport function uniqueId() {\n return nodeId++\n}\n\nlet docMap = {}\n\nexport function addDoc(id, doc) {\n docMap[id] = doc\n}\n\nexport function getDoc(id) {\n return docMap[id]\n}\n\nexport function removeDoc(id) {\n delete docMap[id]\n}\n\nlet sendBridgeFlag = {}\n\nexport function getSendBridgeFlag() {\n return sendBridgeFlag\n}\n\nexport function setSendBridgeFlag(docId, flag) {\n return (sendBridgeFlag[docId] = flag)\n}\n\nexport function insertIndex(target, list, newIndex) {\n if (newIndex < 0) {\n newIndex = 0\n }\n const before = list[newIndex - 1]\n const after = list[newIndex]\n list.splice(newIndex, 0, target)\n\n before && (before.nextSibling = target)\n target.previousSibling = before\n target.nextSibling = after\n after && (after.previousSibling = target)\n\n return newIndex\n}\n\nexport function moveIndex(target, list, newIndex) {\n const index = list.indexOf(target)\n\n if (index < 0) {\n return -1\n }\n\n const before = list[index - 1]\n const after = list[index + 1]\n before && (before.nextSibling = after)\n after && (after.previousSibling = before)\n\n list.splice(index, 1)\n let newIndexAfter = newIndex\n if (index <= newIndex) {\n newIndexAfter = newIndex - 1\n }\n const beforeNew = list[newIndexAfter - 1]\n const afterNew = list[newIndexAfter]\n list.splice(newIndexAfter, 0, target)\n\n beforeNew && (beforeNew.nextSibling = target)\n target.previousSibling = beforeNew\n target.nextSibling = afterNew\n afterNew && (afterNew.previousSibling = target)\n\n if (index === newIndexAfter) {\n return -1\n }\n return newIndex\n}\n\nexport function removeIndex(target, list, changeSibling) {\n const index = list.indexOf(target)\n\n if (index < 0) {\n return\n }\n if (changeSibling) {\n const before = list[index - 1]\n const after = list[index + 1]\n before && (before.nextSibling = after)\n after && (after.previousSibling = before)\n }\n list.splice(index, 1)\n}\n\nexport function remove(target, list) {\n const index = list.indexOf(target)\n\n if (index < 0) {\n return\n }\n\n const before = list[index - 1]\n const after = list[index + 1]\n before && (before.nextSibling = after)\n after && (after.previousSibling = before)\n\n list.splice(index, 1)\n}\n\nexport function linkParent(node, parent) {\n node.parentNode = parent\n if (parent.docId) {\n node.docId = parent.docId\n node.ownerDocument = parent.ownerDocument\n node.ownerDocument.nodeMap[node.nodeId] = node\n node.depth = parent.depth + 1\n\t}\n\n node.childNodes && node.childNodes.forEach(child => {\n linkParent(child, node)\n })\n}\n\nexport function nextElement(node) {\n while (node) {\n if (node.nodeType === 1) {\n return node\n }\n node = node.nextSibling\n }\n}\n\nexport function previousElement(node) {\n while (node) {\n if (node.nodeType === 1) {\n return node\n }\n node = node.previousSibling\n }\n}\n","import {\n\tgetDoc,\n\tuniqueId,\n\tlinkParent,\n\tinsertIndex,\n\tmoveIndex,\n\tremoveIndex\n} from './util'\n\nconst displayMap = {\n\tdiv: 'block',\n\tspan: 'inline-block'\n}\n\nfunction registerNode(docId, node) {\n\tconst doc = getDoc(docId)\n\tdoc.nodeMap[node.nodeId] = node\n}\n\nexport default class Element {\n\tconstructor(type) {\n\t\tthis.nodeType = 1\n\t\tthis.nodeId = uniqueId()\n\t\tthis.ref = this.nodeId\n\t\tthis.type = type\n\t\tthis.attributes = {}\n\t\tthis.style = {\n\t\t\tdisplay: displayMap[type]\n\t\t}\n\t\tthis.classStyle = {}\n\t\tthis.event = {}\n\t\tthis.childNodes = []\n\n\t\tthis.nodeName = this.type\n\n\t\tthis.parentNode = null\n\t\tthis.nextSibling = null\n\t\tthis.previousSibling = null\n\t\tthis.firstChild = null\n\t}\n\n\tappendChild(node) {\n\t\tif (!node.parentNode) {\n\t\t\tlinkParent(node, this)\n\t\t\tinsertIndex(node, this.childNodes, this.childNodes.length, true)\n\n\t\t\tif (this.docId != undefined) {\n\t\t\t\tregisterNode(this.docId, node)\n\t\t\t}\n\n\n\t\t\t//this.ownerDocument.addElement(this.ref, node.toJSON(), -1)\n\n\t\t} else {\n\t\t\tnode.parentNode.removeChild(node)\n\n\t\t\tthis.appendChild(node)\n\n\t\t\treturn\n\t\t}\n\n\t\tthis.firstChild = this.childNodes[0]\n\n\n\t}\n\n\tinsertBefore(node, before) {\n\t\tif (!node.parentNode) {\n\t\t\tlinkParent(node, this)\n\t\t\tconst index = insertIndex(\n\t\t\t\tnode,\n\t\t\t\tthis.childNodes,\n\t\t\t\tthis.childNodes.indexOf(before),\n\t\t\t\ttrue\n\t\t\t)\n\t\t\tif (this.docId != undefined) {\n\t\t\t\tregisterNode(this.docId, node)\n\t\t\t}\n\n\n\t\t\t//this.ownerDocument.addElement(this.ref, node.toJSON(), index)\n\n\t\t} else {\n\t\t\tnode.parentNode.removeChild(node)\n\t\t\tthis.insertBefore(node, before)\n\t\t\treturn\n\t\t}\n\n\t\tthis.firstChild = this.childNodes[0]\n\t}\n\n\tinsertAfter(node, after) {\n\t\tif (node.parentNode && node.parentNode !== this) {\n\t\t\treturn\n\t\t}\n\t\tif (\n\t\t\tnode === after ||\n\t\t\t(node.previousSibling && node.previousSibling === after)\n\t\t) {\n\t\t\treturn\n\t\t}\n\t\tif (!node.parentNode) {\n\t\t\tlinkParent(node, this)\n\t\t\tconst index = insertIndex(\n\t\t\t\tnode,\n\t\t\t\tthis.childNodes,\n\t\t\t\tthis.childNodes.indexOf(after) + 1,\n\t\t\t\ttrue\n\t\t\t)\n\n\t\t\tif (this.docId != undefined) {\n\t\t\t\tregisterNode(this.docId, node)\n\t\t\t}\n\n\t\t\t//this.ownerDocument.addElement(this.ref, node.toJSON(), index)\n\n\t\t} else {\n\t\t\tconst index = moveIndex(\n\t\t\t\tnode,\n\t\t\t\tthis.childNodes,\n\t\t\t\tthis.childNodes.indexOf(after) + 1\n\t\t\t)\n\n\t\t\t//this.ownerDocument.moveElement(node.ref, this.ref, index)\n\n\t\t}\n\n\t\tthis.firstChild = this.childNodes[0]\n\t}\n\n\tremoveChild(node) {\n\t\tif (node.parentNode) {\n\t\t\tremoveIndex(node, this.childNodes, true)\n\n\n\t\t\tthis.ownerDocument.removeElement(node.ref)\n\n\t\t}\n\n\t\tnode.parentNode = null\n\n\n\n\t\tthis.firstChild = this.childNodes[0]\n\t}\n\n\tsetAttribute(key, value, silent) {\n\t\tif (this.attributes[key] === value && silent !== false) {\n\t\t\treturn\n\t\t}\n\t\tthis.attributes[key] = value\n\t\tif (!silent) {\n\t\t\tconst result = {}\n\t\t\tresult[key] = value\n\n\t\t\tthis.ownerDocument.setAttr(this.ref, result)\n\n\t\t}\n\t}\n\n\tremoveAttribute(key) {\n\t\tif (this.attributes[key]) {\n\t\t\tdelete this.attributes[key]\n\t\t}\n\t}\n\n\tsetStyle(key, value, silent) {\n\t\tif (this.style[key] === value && silent !== false) {\n\t\t\treturn\n\t\t}\n\t\tthis.style[key] = value\n\t\tif (!silent && this.ownerDocument) {\n\t\t\tconst result = {}\n\t\t\tresult[key] = value\n\n\t\t\tthis.ownerDocument.setStyles(this.ref, result)\n\n\t\t}\n\t}\n\n\tsetStyles(styles) {\n\t\tObject.assign(this.style, styles)\n\t\tif (this.ownerDocument) {\n\n\t\t\tthis.ownerDocument.setStyles(this.ref, styles)\n\n\t\t}\n\t}\n\n\tsetClassStyle(classStyle) {\n\t\tfor (const key in this.classStyle) {\n\t\t\tthis.classStyle[key] = ''\n\t\t}\n\n\t\tObject.assign(this.classStyle, classStyle)\n\n\n\t\tthis.ownerDocument.setStyles(this.ref, this.toStyle())\n\n\t}\n\n\taddEventListener(type, handler) {\n\t\tif (!this.event[type]) {\n\t\t\tthis.event[type] = handler\n\n\t\t\t//this.ownerDocument.addEvent(this.ref, type)\n\t\t}\n\t}\n\n\tremoveEventListener(type) {\n\t\tif (this.event[type]) {\n\t\t\tdelete this.event[type]\n\t\t\tlet doc = getDoc(this.docId)\n\t\t\tdoc.nodeMap[this.ref] &&\n\t\t\t\tdoc.nodeMap[this.ref].event &&\n\t\t\t\tdoc.nodeMap[this.ref].event[type]\n\t\t\t\t? (doc.nodeMap[this.ref].event[type] = null)\n\t\t\t\t: ''\n\n\t\t\tthis.ownerDocument.removeEvent(this.ref, type)\n\t\t}\n\t}\n\n\tfireEvent(type, e) {\n\t\tconst handler = this.event[type]\n\t\tif (handler) {\n\t\t\treturn handler.call(this, e)\n\t\t}\n\t}\n\n\ttoStyle() {\n\t\treturn Object.assign({}, this.classStyle, this.style)\n\t}\n\n\tgetComputedStyle() { }\n\n\ttoJSON() {\n\t\tlet result = {\n\t\t\tid: this.ref,\n\t\t\ttype: this.type,\n\t\t\tdocId: this.docId || -10000,\n\t\t\tattributes: this.attributes ? this.attributes : {}\n\t\t}\n\t\tresult.attributes.style = this.toStyle()\n\n\t\tconst event = Object.keys(this.event)\n\t\tif (event.length) {\n\t\t\tresult.event = event\n\t\t}\n\n\t\tif (this.childNodes.length) {\n\t\t\tresult.children = this.childNodes.map(child => child.toJSON())\n\t\t}\n\t\treturn result\n\t}\n\n\treplaceChild(newChild, oldChild) {\n\t\tthis.insertBefore(newChild, oldChild)\n\t\tthis.removeChild(oldChild)\n\t}\n\n\tdestroy() {\n\t\tconst doc = getDoc(this.docId)\n\n\t\tif (doc) {\n\t\t\tdelete doc.nodeMap[this.nodeId]\n\t\t}\n\n\t\tthis.parentNode = null\n\t\tthis.childNodes.forEach(child => {\n\t\t\tchild.destroy()\n\t\t})\n\t}\n}\n","import {\n\tgetDoc,\n\tuniqueId\n} from './util'\n\n\nfunction registerNode(docId, node) {\n\tconst doc = getDoc(docId)\n\tdoc.nodeMap[node.nodeId] = node\n}\n\nexport default class TextNode {\n\tconstructor(nodeValue) {\n\t\tthis.nodeType = 3\n\t\tthis.nodeId = uniqueId()\n\t\tthis.ref = this.nodeId\n\t\tthis.attributes = {}\n\t\tthis.style = {\n\t\t\tdisplay: 'inline'\n\t\t}\n\t\tthis.classStyle = {}\n\t\tthis.event = {}\n\t\tthis.nodeValue = nodeValue\n\t\tthis.parentNode = null\n\t\tthis.nextSibling = null\n\t\tthis.previousSibling = null\n\t\tthis.firstChild = null\n\t\tthis.type = 'text'\n\t}\n\n\tsetAttribute(key, value, silent) {\n\t\tif (this.attributes[key] === value && silent !== false) {\n\t\t\treturn\n\t\t}\n\t\tthis.attributes[key] = value\n\t\tif (!silent) {\n\t\t\tconst result = {}\n\t\t\tresult[key] = value\n\n\t\t\tthis.ownerDocument.setAttr(this.ref, result)\n\n\t\t}\n\t}\n\n\tremoveAttribute(key) {\n\t\tif (this.attributes[key]) {\n\t\t\tdelete this.attributes[key]\n\t\t}\n\t}\n\n\ttoStyle() {\n\t\treturn Object.assign({}, this.classStyle, this.style)\n\t}\n\n\tsplitText() {\n\n\t}\n\n\tgetComputedStyle() { }\n\n\ttoJSON() {\n\t\tlet result = {\n\t\t\tid: this.ref,\n\t\t\ttype: this.type,\n\t\t\tdocId: this.docId || -10000,\n\t\t\tattributes: this.attributes ? this.attributes : {}\n\t\t}\n\t\tresult.attributes.style = this.toStyle()\n\n\t\tconst event = Object.keys(this.event)\n\t\tif (event.length) {\n\t\t\tresult.event = event\n\t\t}\n\n\t\treturn result\n\t}\n\n\tdestroy() {\n\t\tconst doc = getDoc(this.docId)\n\n\t\tif (doc) {\n\t\t\tdelete doc.nodeMap[this.nodeId]\n\t\t}\n\n\t\tthis.parentNode = null\n\n\t}\n}\n","import Element from './element'\nimport TextNode from './text-node'\nimport { addDoc, removeDoc } from './util'\n\n\nexport default class Document {\n constructor(id) {\n this.id = id\n addDoc(id, this)\n this.nodeMap = {}\n this._isMockDocument = true\n }\n\n // createBody(type, props) {\n // if (!this.body) {\n // const el = new Element(type, props)\n // el.didMount = true\n // el.ownerDocument = this\n // el.docId = this.id\n // el.style.alignItems = 'flex-start'\n // this.body = el\n // }\n\n // return this.body\n // }\n\n createElement(tagName, props) {\n let el = new Element(tagName, props)\n el.ownerDocument = this\n el.docId = this.id\n return el\n\t}\n\n\tcreateTextNode(txt){\n\t\tconst node = new TextNode(txt)\n\t\tnode.docId = this.id\n\t\treturn node\n\t}\n\n destroy() {\n delete this.listener\n delete this.nodeMap\n removeDoc(this.id)\n }\n\n addEventListener(ref, type) {\n //document.addEvent(this.id, ref, type)\n }\n\n removeEventListener(ref, type) {\n //document.removeEvent(this.id, ref, type)\n }\n\n\n scrollTo(ref, x, y, animated) {\n document.scrollTo(this.id, ref, x, y, animated)\n }\n\n}\n","import Document from './document'\n\n\nexport default {\n\tdocument: new Document(0)\n}\n","import mock from './mock/index'\n\nfunction getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n if (typeof self !== 'undefined') {\n return self\n } else if (typeof window !== 'undefined') {\n return window\n } else if (typeof global !== 'undefined') {\n return global\n }\n return (function() {\n return this\n })()\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n scopedStyle: true,\n mapping: {},\n isWeb: true,\n\tstaticStyleMapping: {},\n\tdoc: mock.document,\n //doc: typeof document === 'object' ? document : null,\n root: getGlobal(),\n //styleCache :[{ctor:ctor,ctorName:ctorName,style:style}]\n styleCache: []\n //componentChange(component, element) { },\n /** If `true`, `prop` changes trigger synchronous component updates.\n *\t@name syncComponentUpdates\n *\t@type Boolean\n *\t@default true\n */\n //syncComponentUpdates: true,\n\n /** Processes all created VNodes.\n *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\n */\n //vnode(vnode) { }\n\n /** Hook invoked after a component is mounted. */\n //afterMount(component) { },\n\n /** Hook invoked after the DOM is updated with a component's latest render. */\n //afterUpdate(component) { }\n\n /** Hook invoked immediately before a component is unmounted. */\n // beforeUnmount(component) { }\n}\n","'use strict'\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols\nvar hasOwnProperty = Object.prototype.hasOwnProperty\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable\n\nfunction toObject(val) {\n if (val === null || val === undefined) {\n throw new TypeError('Object.assign cannot be called with null or undefined')\n }\n\n return Object(val)\n}\n\nexport function assign(target, source) {\n var from\n var to = toObject(target)\n var symbols\n\n for (var s = 1; s < arguments.length; s++) {\n from = Object(arguments[s])\n\n for (var key in from) {\n if (hasOwnProperty.call(from, key)) {\n to[key] = from[key]\n }\n }\n\n if (getOwnPropertySymbols) {\n symbols = getOwnPropertySymbols(from)\n for (var i = 0; i < symbols.length; i++) {\n if (propIsEnumerable.call(from, symbols[i])) {\n to[symbols[i]] = from[symbols[i]]\n }\n }\n }\n }\n\n return to\n}\n\nif (typeof Element !== 'undefined' && !Element.prototype.addEventListener) {\n var oListeners = {};\n function runListeners(oEvent) {\n if (!oEvent) { oEvent = window.event; }\n for (var iLstId = 0, iElId = 0, oEvtListeners = oListeners[oEvent.type]; iElId < oEvtListeners.aEls.length; iElId++) {\n if (oEvtListeners.aEls[iElId] === this) {\n for (iLstId; iLstId < oEvtListeners.aEvts[iElId].length; iLstId++) { oEvtListeners.aEvts[iElId][iLstId].call(this, oEvent); }\n break;\n }\n }\n }\n Element.prototype.addEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) {\n if (oListeners.hasOwnProperty(sEventType)) {\n var oEvtListeners = oListeners[sEventType];\n for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) {\n if (oEvtListeners.aEls[iElId] === this) { nElIdx = iElId; break; }\n }\n if (nElIdx === -1) {\n oEvtListeners.aEls.push(this);\n oEvtListeners.aEvts.push([fListener]);\n this[\"on\" + sEventType] = runListeners;\n } else {\n var aElListeners = oEvtListeners.aEvts[nElIdx];\n if (this[\"on\" + sEventType] !== runListeners) {\n aElListeners.splice(0);\n this[\"on\" + sEventType] = runListeners;\n }\n for (var iLstId = 0; iLstId < aElListeners.length; iLstId++) {\n if (aElListeners[iLstId] === fListener) { return; }\n }\n aElListeners.push(fListener);\n }\n } else {\n oListeners[sEventType] = { aEls: [this], aEvts: [[fListener]] };\n this[\"on\" + sEventType] = runListeners;\n }\n };\n Element.prototype.removeEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) {\n if (!oListeners.hasOwnProperty(sEventType)) { return; }\n var oEvtListeners = oListeners[sEventType];\n for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) {\n if (oEvtListeners.aEls[iElId] === this) { nElIdx = iElId; break; }\n }\n if (nElIdx === -1) { return; }\n for (var iLstId = 0, aElListeners = oEvtListeners.aEvts[nElIdx]; iLstId < aElListeners.length; iLstId++) {\n if (aElListeners[iLstId] === fListener) { aElListeners.splice(iLstId, 1); }\n }\n };\n}\n\n\nif (typeof Object.create !== 'function') {\n Object.create = function(proto, propertiesObject) {\n if (typeof proto !== 'object' && typeof proto !== 'function') {\n throw new TypeError('Object prototype may only be an Object: ' + proto)\n } else if (proto === null) {\n throw new Error(\n \"This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.\"\n )\n }\n\n // if (typeof propertiesObject != 'undefined') {\n // throw new Error(\"This browser's implementation of Object.create is a shim and doesn't support a second argument.\");\n // }\n\n function F() {}\n F.prototype = proto\n\n return new F()\n }\n}\n\nif (!String.prototype.trim) {\n String.prototype.trim = function () {\n return this.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '')\n }\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {Object} obj\t\tObject onto which properties should be copied.\n * @param {Object} props\tObject from which to copy properties.\n * @returns obj\n * @private\n */\nexport function extend(obj, props) {\n for (let i in props) obj[i] = props[i]\n return obj\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n if (ref) {\n if (typeof ref == 'function') ref(value)\n else ref.current = value\n }\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n *\n * @param {Function} callback\n */\n\nlet usePromise = typeof Promise == 'function'\n\n// for native\nif (\n typeof document !== 'object' &&\n typeof global !== 'undefined' &&\n global.__config__\n) {\n if (global.__config__.platform === 'android') {\n usePromise = true\n } else {\n let systemVersion =\n (global.__config__.systemVersion &&\n global.__config__.systemVersion.split('.')[0]) ||\n 0\n if (systemVersion > 8) {\n usePromise = true\n }\n }\n}\n\nexport const defer = usePromise\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n\nexport function getUse(data, paths) {\n const obj = []\n paths.forEach((path, index) => {\n const isPath = typeof path === 'string'\n if (isPath) {\n obj[index] = getTargetByPath(data, path)\n } else {\n const key = Object.keys(path)[0]\n const value = path[key]\n if (typeof value === 'string') {\n obj[index] = getTargetByPath(data, value)\n } else {\n const tempPath = value[0]\n if (typeof tempPath === 'string') {\n const tempVal = getTargetByPath(data, tempPath)\n obj[index] = value[1] ? value[1](tempVal) : tempVal\n } else {\n const args = []\n tempPath.forEach(path =>{\n args.push(getTargetByPath(data, path))\n })\n obj[index] = value[1].apply(null, args)\n }\n }\n obj[key] = obj[index]\n }\n })\n return obj\n}\n\nexport function getTargetByPath(origin, path) {\n const arr = path.replace(/]/g, '').replace(/\\[/g, '.').split('.')\n let current = origin\n for (let i = 0, len = arr.length; i < len; i++) {\n current = current[arr[i]]\n }\n return current\n}\n","import options from './options'\nimport { defer } from './util'\nimport { renderComponent } from './vdom/component'\n\n/** Managed queue of dirty components to be re-rendered */\n\nlet items = []\n\nexport function enqueueRender(component) {\n if (items.push(component) == 1) {\n ;(options.debounceRendering || defer)(rerender)\n }\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p\n\twhile ( (p = items.pop()) ) {\n renderComponent(p)\n\t}\n}","import { extend } from '../util'\nimport options from '../options'\n\nconst mapping = options.mapping\n/**\n * Check if two nodes are equivalent.\n *\n * @param {Node} node\t\t\tDOM Node to compare\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n return node.splitText !== undefined\n }\n if (typeof vnode.nodeName === 'string') {\n var ctor = mapping[vnode.nodeName]\n if (ctor) {\n return hydrating || node._componentConstructor === ctor\n }\n return !node._componentConstructor && isNamedNode(node, vnode.nodeName)\n }\n return hydrating || node._componentConstructor === vnode.nodeName\n}\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n *\n * @param {Element} node\tA DOM Element to inspect the name of.\n * @param {String} nodeName\tUnnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/** Create an element with the given nodeName.\n *\t@param {String} nodeName\n *\t@param {Boolean} [isSvg=false]\tIf `true`, creates an element within the SVG namespace.\n *\t@returns {Element} node\n */\nexport function createNode(nodeName, isSvg) {\n let node = isSvg\n ? options.doc.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : options.doc.createElement(nodeName)\n node.normalizedNodeName = nodeName\n return node\n}\n\nfunction parseCSSText(cssText) {\n let cssTxt = cssText.replace(/\\/\\*(.|\\s)*?\\*\\//g, ' ').replace(/\\s+/g, ' ')\n let style = {},\n [a, b, rule] = cssTxt.match(/ ?(.*?) ?{([^}]*)}/) || [a, b, cssTxt]\n let cssToJs = s => s.replace(/\\W+\\w/g, match => match.slice(-1).toUpperCase())\n let properties = rule\n .split(';')\n .map(o => o.split(':').map(x => x && x.trim()))\n for (let [property, value] of properties) style[cssToJs(property)] = value\n return style\n}\n\n/** Remove a child node from its parent if attached.\n *\t@param {Element} node\t\tThe node to remove\n */\nexport function removeNode(node) {\n let parentNode = node.parentNode\n if (parentNode) parentNode.removeChild(node)\n}\n\n/** Set a named attribute on the given Node, with special behavior for some names and event handlers.\n *\tIf `value` is `null`, the attribute/handler will be removed.\n *\t@param {Element} node\tAn element to mutate\n *\t@param {string} name\tThe name/key to set, such as an event or attribute name\n *\t@param {any} old\tThe last value that was set for this name/node pair\n *\t@param {any} value\tAn attribute value, such as a function to be used as an event handler\n *\t@param {Boolean} isSvg\tAre we currently diffing inside an svg?\n *\t@private\n */\nexport function setAccessor(node, name, old, value, isSvg) {\n if (name === 'className') name = 'class'\n\n if (name === 'key') {\n // ignore\n } else if (name === 'ref') {\n applyRef(old, null)\n applyRef(value, node)\n } else if (name === 'class' && !isSvg) {\n node.className = value || ''\n } else if (name === 'style') {\n if (options.isWeb) {\n if (!value || typeof value === 'string' || typeof old === 'string') {\n node.style.cssText = value || ''\n }\n if (value && typeof value === 'object') {\n if (typeof old !== 'string') {\n for (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : value[i]\n }\n }\n } else {\n let oldJson = old,\n currentJson = value\n if (typeof old === 'string') {\n oldJson = parseCSSText(old)\n }\n if (typeof value == 'string') {\n currentJson = parseCSSText(value)\n }\n\n let result = {},\n changed = false\n\n if (oldJson) {\n for (let key in oldJson) {\n if (typeof currentJson == 'object' && !(key in currentJson)) {\n result[key] = ''\n changed = true\n }\n }\n\n for (let ckey in currentJson) {\n if (currentJson[ckey] !== oldJson[ckey]) {\n result[ckey] = currentJson[ckey]\n changed = true\n }\n }\n\n if (changed) {\n node.setStyles(result)\n }\n } else {\n node.setStyles(currentJson)\n }\n }\n } else if (name === 'dangerouslySetInnerHTML') {\n if (value) node.innerHTML = value.__html || ''\n } else if (name[0] == 'o' && name[1] == 'n') {\n let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) {\n node.addEventListener(name, eventProxy, useCapture)\n if (name == 'tap') {\n node.addEventListener('touchstart', touchStart, useCapture)\n node.addEventListener('touchend', touchEnd, useCapture)\n }\n }\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n if (name == 'tap') {\n node.removeEventListener('touchstart', touchStart, useCapture)\n node.removeEventListener('touchend', touchEnd, useCapture)\n }\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\n setProperty(node, name, value == null ? '' : value)\n if (value == null || value === false) node.removeAttribute(name)\n } else {\n let ns = isSvg && name !== (name = name.replace(/^xlink:?/, ''))\n if (value == null || value === false) {\n if (ns)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value !== 'function') {\n if (ns)\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n else node.setAttribute(name, value)\n }\n }\n}\n\n/** Attempt to set a DOM property to the given value.\n *\tIE & FF throw for certain property-value combinations.\n */\nfunction setProperty(node, name, value) {\n try {\n node[name] = value\n } catch (e) {}\n}\n\n/** Proxy an event to hooked event handlers\n *\t@private\n */\nfunction eventProxy(e) {\n return this._listeners[e.type]((options.event && options.event(e)) || e)\n}\n\nfunction touchStart(e) {\n this.___touchX = e.touches[0].pageX\n this.___touchY = e.touches[0].pageY\n this.___scrollTop = document.body.scrollTop\n}\n\nfunction touchEnd(e) {\n if (\n Math.abs(e.changedTouches[0].pageX - this.___touchX) < 30 &&\n Math.abs(e.changedTouches[0].pageY - this.___touchY) < 30 &&\n Math.abs(document.body.scrollTop - this.___scrollTop) < 30\n ) {\n this.dispatchEvent(new CustomEvent('tap', { detail: e }))\n }\n}","export function draw(res){\n console.log(res)\n return document.createElement('canvas')\n}","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { buildComponentFromVNode } from './component'\nimport { createNode, setAccessor } from '../dom/index'\nimport { unmountComponent } from './component'\nimport options from '../options'\nimport { applyRef } from '../util'\nimport { removeNode } from '../dom/index'\nimport { isArray } from '../util'\nimport { draw } from '../../cax/draw'\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n let c\n while ((c = mounts.pop())) {\n if (options.afterMount) options.afterMount(c)\n if (c.installed) c.installed()\n }\n}\n\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\n *\t@returns {Element} dom\t\t\tThe created/mutated element\n *\t@private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, fromRender) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n if (!diffLevel++) {\n // when first starting the diff, check if we're diffing an SVG or within an SVG\n isSvgMode = parent != null && parent.ownerSVGElement !== undefined\n\n // hydration is indicated by the existing element to be diffed not having a prop cache\n hydrating = dom != null && !(ATTR_KEY in dom)\n }\n let ret\n\n if (isArray(vnode)) {\n vnode = {\n nodeName: 'span',\n children: vnode\n }\n }\n\n\tret = idiff(dom, vnode, context, mountAll, componentRoot)\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode !== parent) {\n\t\tif (fromRender) {\n\t\t\tparent.appendChild(draw(ret))\n\t\t} else {\n\t\t\tparent.appendChild(ret)\n\t\t}\n\t}\n\n // diffLevel being reduced to 0 means we're exiting the diff\n if (!--diffLevel) {\n hydrating = false\n // invoke queued componentDidMount lifecycle methods\n if (!componentRoot) flushMounts()\n }\n\n return ret\n}\n\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\n let out = dom,\n prevSvgMode = isSvgMode\n\n // empty values (null, undefined, booleans) render as empty Text nodes\n if (vnode == null || typeof vnode === 'boolean') vnode = ''\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n if (options.mapping[vnodeName]) {\n vnode.nodeName = options.mapping[vnodeName]\n return buildComponentFromVNode(dom, vnode, context, mountAll)\n }\n if (typeof vnodeName == 'function') {\n return buildComponentFromVNode(dom, vnode, context, mountAll)\n }\n\n // Fast case: Strings & Numbers create/update Text nodes.\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n // update if it's already a Text node:\n if (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\n /* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n if (dom.nodeValue != vnode) {\n dom.nodeValue = vnode\n }\n } else {\n // it wasn't a Text node: replace it with one and recycle the old Element\n out = options.doc.createTextNode(vnode)\n if (dom) {\n if (dom.parentNode) dom.parentNode.replaceChild(out, dom)\n recollectNodeTree(dom, true)\n }\n }\n\n //ie8 error\n try {\n out[ATTR_KEY] = true\n } catch (e) {}\n\n return out\n }\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : isSvgMode\n\n // If there's no existing element or it's the wrong type, create a new one:\n vnodeName = String(vnodeName)\n if (!dom || !isNamedNode(dom, vnodeName)) {\n out = createNode(vnodeName, isSvgMode)\n\n if (dom) {\n // move children into the replacement node\n while (dom.firstChild) out.appendChild(dom.firstChild)\n\n // if the previous Element was mounted into the DOM, replace it inline\n if (dom.parentNode) dom.parentNode.replaceChild(out, dom)\n\n // recycle the old element (skips non-Element node types)\n recollectNodeTree(dom, true)\n }\n }\n\n let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\n if (fc.nodeValue != vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0]\n\t\t\t//update rendering obj\n\t\t\tfc._renderText.text = fc.nodeValue\n }\n }\n // otherwise, if there are existing or new children, diff them:\n else if ((vchildren && vchildren.length) || fc != null) {\n innerDiffNode(\n out,\n vchildren,\n context,\n mountAll,\n hydrating || props.dangerouslySetInnerHTML != null\n )\n }\n\n // Apply attributes/props from VNode to the DOM Element:\n diffAttributes(out, vnode.attributes, props)\n\n // restore previous SVG mode: (in case we're exiting an SVG namespace)\n isSvgMode = prevSvgMode\n\n return out\n}\n\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\n *\t@param {Boolean} mountAll\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\n let originalChildren = dom.childNodes,\n children = [],\n keyed = {},\n keyedLen = 0,\n min = 0,\n len = originalChildren.length,\n childrenLen = 0,\n vlen = vchildren ? vchildren.length : 0,\n j,\n c,\n f,\n vchild,\n child\n\n // Build up a map of keyed children and an Array of unkeyed children:\n if (len !== 0) {\n for (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let key = vchild.key\n if (key != null) {\n if (keyedLen && keyed[key] !== undefined) {\n child = keyed[key]\n keyed[key] = undefined\n keyedLen--\n }\n }\n // attempt to pluck a node of the same type from the existing children\n else if (!child && min < childrenLen) {\n for (j = min; j < childrenLen; j++) {\n if (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\n child = c\n children[j] = undefined\n if (j === childrenLen - 1) childrenLen--\n if (j === min) min++\n break\n }\n }\n }\n\n // morph the matched/found/created DOM child to match vchild (deep)\n child = idiff(child, vchild, context, mountAll)\n\n f = originalChildren[i]\n if (child && child !== dom && child !== f) {\n if (f == null) {\n\t\t\t\t\tdom.appendChild(child)\n } else if (child === f.nextSibling) {\n removeNode(f)\n } else {\n dom.insertBefore(child, f)\n }\n }\n }\n }\n\n // remove unused keyed children:\n if (keyedLen) {\n for (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n\t// remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n recollectNodeTree(child, false)\n }\n}\n\n/** Recursively recycle (or just unmount) a node and its descendants.\n *\t@param {Node} node\t\t\t\t\t\tDOM node to start unmount/removal from\n *\t@param {Boolean} [unmountOnly=false]\tIf `true`, only triggers unmount lifecycle, skips removal\n */\nexport function recollectNodeTree(node, unmountOnly) {\n let component = node._component\n if (component) {\n // if node is owned by a Component, unmount that component (ends up recursing back here)\n unmountComponent(component)\n } else {\n // If the node's VNode had a ref function, invoke it with null here.\n // (this is part of the React spec, and smart for unsetting references)\n if (node[ATTR_KEY] != null) applyRef(node[ATTR_KEY].ref, null)\n\n if (unmountOnly === false || node[ATTR_KEY] == null) {\n removeNode(node)\n }\n\n removeChildren(node)\n }\n}\n\n/** Recollect/unmount all children.\n *\t- we use .lastChild here because it causes less reflow than .firstChild\n *\t- it's also cheaper than accessing the .childNodes Live NodeList\n */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let next = node.previousSibling\n recollectNodeTree(node, true)\n node = next\n }\n}\n\n/** Apply differences in attributes from a VNode to the given DOM Element.\n *\t@param {Element} dom\t\tElement with attributes to diff `attrs` against\n *\t@param {Object} attrs\t\tThe desired end-state key-value attribute pairs\n *\t@param {Object} old\t\t\tCurrent/previous attributes (from previous VNode or element's prop cache)\n */\nfunction diffAttributes(dom, attrs, old) {\n let name\n\n // remove attributes no longer present on the vnode by setting them to undefined\n for (name in old) {\n if (!(attrs && attrs[name] != null) && old[name] != null) {\n setAccessor(dom, name, old[name], (old[name] = undefined), isSvgMode)\n }\n }\n\n // add new & update changed attributes\n for (name in attrs) {\n if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\n setAccessor(dom, name, old[name], (old[name] = attrs[name]), isSvgMode)\n }\n }\n}\n","import options from './options'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n options.mapping[name] = ctor\n if (ctor.use) {\n ctor.updatePath = getPath(ctor.use)\n } else if (ctor.data) { //Compatible with older versions\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n}\n\nexport function getPath(obj) {\n if (Object.prototype.toString.call(obj) === '[object Array]') {\n const result = {}\n obj.forEach(item => {\n if (typeof item === 'string') {\n result[item] = true\n } else {\n const tempPath = item[Object.keys(item)[0]]\n if (typeof tempPath === 'string') {\n result[tempPath] = true\n } else {\n if(typeof tempPath[0] === 'string'){\n result[tempPath[0]] = true\n }else{\n tempPath[0].forEach(path => result[path] = true)\n }\n }\n }\n })\n return result\n } else {\n return getUpdatePath(obj)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import Component from '../component'\nimport { getUse } from '../util'\nimport { getPath } from '../define'\n/** Retains a pool of Components for re-use, keyed on component name.\n *\tNote: since component names are not unique or even necessarily available, these are primarily a form of sharding.\n *\t@private\n */\nconst components = {}\n\n/** Reclaim a component for later re-use by the recycler. */\nexport function collectComponent(component) {\n let name = component.constructor.name\n ;(components[name] || (components[name] = [])).push(component)\n}\n\n/** Create a component. Normalizes differences between PFC's and classful Components. */\nexport function createComponent(Ctor, props, context, vnode) {\n let list = components[Ctor.name],\n inst\n\n if (Ctor.prototype && Ctor.prototype.render) {\n inst = new Ctor(props, context)\n Component.call(inst, props, context)\n } else {\n inst = new Component(props, context)\n inst.constructor = Ctor\n inst.render = doRender\n }\n vnode && (inst.scopedCssAttr = vnode.css)\n\n if ( inst.store && inst.store.data) {\n\t\tif(inst.constructor.use){\n\t\t\tinst.use = getUse(inst.store.data, inst.constructor.use)\n\t\t\tinst.store.instances.push(inst)\n\t\t} else if(inst.initUse){\n\t\t\tconst use = inst.initUse()\n\t\t\tinst._updatePath = getPath(use)\n\t\t\tinst.use = getUse(inst.store.data, use)\n\t\t\tinst.store.instances.push(inst)\n\t\t}\n\n\n }\n\n if (list) {\n for (let i = list.length; i--; ) {\n if (list[i].constructor === Ctor) {\n inst.nextBase = list[i].nextBase\n list.splice(i, 1)\n break\n }\n }\n }\n return inst\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, data, context) {\n return this.constructor(props, context)\n}\n","import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = 's' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleWithoutId(cssText) {\n let head = document.getElementsByTagName('head')[0]\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addScopedAttrStatic(vdom, attr) {\n if (options.scopedStyle) {\n scopeVdom(attr, vdom)\n } \n}\n\nexport function addStyleToHead(style, attr) {\n if (options.scopedStyle) {\n if (!options.staticStyleMapping[attr]) {\n addStyle(scoper(style, attr), attr)\n options.staticStyleMapping[attr] = true\n }\n } else if (!options.staticStyleMapping[attr]) {\n addStyleWithoutId(style)\n options.staticStyleMapping[attr] = true\n }\n}\n\nexport function scopeVdom(attr, vdom) {\n if (typeof vdom === 'object') {\n vdom.attributes = vdom.attributes || {}\n vdom.attributes[attr] = ''\n vdom.css = vdom.css || {}\n vdom.css[attr] = ''\n vdom.children.forEach(child => scopeVdom(attr, child))\n }\n}\n\nexport function scopeHost(vdom, css) {\n if (typeof vdom === 'object' && css) {\n vdom.attributes = vdom.attributes || {}\n for (let key in css) {\n vdom.attributes[key] = ''\n }\n }\n}\n","/* obaa 1.0.0\n * By dntzhang\n * Github: https://github.com/Tencent/omi\n * MIT Licensed.\n */\n\nvar obaa = function(target, arr, callback) {\n var _observe = function(target, arr, callback) {\n if (!target.$observer) target.$observer = this\n var $observer = target.$observer\n var eventPropArr = []\n if (obaa.isArray(target)) {\n if (target.length === 0) {\n target.$observeProps = {}\n target.$observeProps.$observerPath = '#'\n }\n $observer.mock(target)\n }\n for (var prop in target) {\n if (target.hasOwnProperty(prop)) {\n if (callback) {\n if (obaa.isArray(arr) && obaa.isInArray(arr, prop)) {\n eventPropArr.push(prop)\n $observer.watch(target, prop)\n } else if (obaa.isString(arr) && prop == arr) {\n eventPropArr.push(prop)\n $observer.watch(target, prop)\n }\n } else {\n eventPropArr.push(prop)\n $observer.watch(target, prop)\n }\n }\n }\n $observer.target = target\n if (!$observer.propertyChangedHandler) $observer.propertyChangedHandler = []\n var propChanged = callback ? callback : arr\n $observer.propertyChangedHandler.push({\n all: !callback,\n propChanged: propChanged,\n eventPropArr: eventPropArr\n })\n }\n _observe.prototype = {\n onPropertyChanged: function(prop, value, oldValue, target, path) {\n if (value !== oldValue && this.propertyChangedHandler) {\n var rootName = obaa._getRootName(prop, path)\n for (\n var i = 0, len = this.propertyChangedHandler.length;\n i < len;\n i++\n ) {\n var handler = this.propertyChangedHandler[i]\n if (\n handler.all ||\n obaa.isInArray(handler.eventPropArr, rootName) ||\n rootName.indexOf('Array-') === 0\n ) {\n handler.propChanged.call(this.target, prop, value, oldValue, path)\n }\n }\n }\n if (prop.indexOf('Array-') !== 0 && typeof value === 'object') {\n this.watch(target, prop, target.$observeProps.$observerPath)\n }\n },\n mock: function(target) {\n var self = this\n obaa.methods.forEach(function(item) {\n target[item] = function() {\n var old = Array.prototype.slice.call(this, 0)\n var result = Array.prototype[item].apply(\n this,\n Array.prototype.slice.call(arguments)\n )\n if (new RegExp('\\\\b' + item + '\\\\b').test(obaa.triggerStr)) {\n for (var cprop in this) {\n if (this.hasOwnProperty(cprop) && !obaa.isFunction(this[cprop])) {\n self.watch(this, cprop, this.$observeProps.$observerPath)\n }\n }\n //todo\n self.onPropertyChanged(\n 'Array-' + item,\n this,\n old,\n this,\n this.$observeProps.$observerPath\n )\n }\n return result\n }\n target[\n 'pure' + item.substring(0, 1).toUpperCase() + item.substring(1)\n ] = function() {\n return Array.prototype[item].apply(\n this,\n Array.prototype.slice.call(arguments)\n )\n }\n })\n },\n watch: function(target, prop, path) {\n if (prop === '$observeProps' || prop === '$observer') return\n if (obaa.isFunction(target[prop])) return\n if (!target.$observeProps) target.$observeProps = {}\n if (path !== undefined) {\n target.$observeProps.$observerPath = path\n } else {\n target.$observeProps.$observerPath = '#'\n }\n var self = this\n var currentValue = (target.$observeProps[prop] = target[prop])\n Object.defineProperty(target, prop, {\n get: function() {\n return this.$observeProps[prop]\n },\n set: function(value) {\n var old = this.$observeProps[prop]\n this.$observeProps[prop] = value\n self.onPropertyChanged(\n prop,\n value,\n old,\n this,\n target.$observeProps.$observerPath\n )\n }\n })\n if (typeof currentValue == 'object') {\n if (obaa.isArray(currentValue)) {\n this.mock(currentValue)\n if (currentValue.length === 0) {\n if (!currentValue.$observeProps) currentValue.$observeProps = {}\n if (path !== undefined) {\n currentValue.$observeProps.$observerPath = path\n } else {\n currentValue.$observeProps.$observerPath = '#'\n }\n }\n }\n for (var cprop in currentValue) {\n if (currentValue.hasOwnProperty(cprop)) {\n this.watch(\n currentValue,\n cprop,\n target.$observeProps.$observerPath + '-' + prop\n )\n }\n }\n }\n }\n }\n return new _observe(target, arr, callback)\n}\n\nobaa.methods = [\n 'concat',\n 'copyWithin',\n 'entries',\n 'every',\n 'fill',\n 'filter',\n 'find',\n 'findIndex',\n 'forEach',\n 'includes',\n 'indexOf',\n 'join',\n 'keys',\n 'lastIndexOf',\n 'map',\n 'pop',\n 'push',\n 'reduce',\n 'reduceRight',\n 'reverse',\n 'shift',\n 'slice',\n 'some',\n 'sort',\n 'splice',\n 'toLocaleString',\n 'toString',\n 'unshift',\n 'values',\n 'size'\n]\nobaa.triggerStr = [\n 'concat',\n 'copyWithin',\n 'fill',\n 'pop',\n 'push',\n 'reverse',\n 'shift',\n 'sort',\n 'splice',\n 'unshift',\n 'size'\n].join(',')\n\nobaa.isArray = function(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nobaa.isString = function(obj) {\n return typeof obj === 'string'\n}\n\nobaa.isInArray = function(arr, item) {\n for (var i = arr.length; --i > -1; ) {\n if (item === arr[i]) return true\n }\n return false\n}\n\nobaa.isFunction = function(obj) {\n return Object.prototype.toString.call(obj) == '[object Function]'\n}\n\nobaa._getRootName = function(prop, path) {\n if (path === '#') {\n return prop\n }\n return path.split('-')[1]\n}\n\nobaa.add = function(obj, prop) {\n var $observer = obj.$observer\n $observer.watch(obj, prop)\n}\n\nobaa.set = function(obj, prop, value, exec) {\n if (!exec) {\n obj[prop] = value\n }\n var $observer = obj.$observer\n $observer.watch(obj, prop)\n if (exec) {\n obj[prop] = value\n }\n}\n\nArray.prototype.size = function(length) {\n this.length = length\n}\n\nexport default obaa\n","const callbacks = []\nconst nextTickCallback = []\n\nexport function tick(fn, scope) {\n callbacks.push({ fn, scope })\n}\n\nexport function fireTick() {\n callbacks.forEach(item => {\n item.fn.call(item.scope)\n })\n\n nextTickCallback.forEach(nextItem => {\n nextItem.fn.call(nextItem.scope)\n })\n nextTickCallback.length = 0\n}\n\nexport function nextTick(fn, scope) {\n nextTickCallback.push({ fn, scope })\n}\n","import obaa from './obaa'\nimport { fireTick } from './tick'\n\nexport function proxyUpdate(ele) {\n let timeout = null\n obaa(ele.data, () => {\n if (ele._willUpdate) {\n return\n }\n if (ele.constructor.mergeUpdate) {\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n fireTick()\n }, 0)\n } else {\n ele.update()\n fireTick()\n }\n })\n}\n","import {\n SYNC_RENDER,\n NO_RENDER,\n FORCE_RENDER,\n ASYNC_RENDER,\n ATTR_KEY\n} from '../constants'\nimport options from '../options'\nimport { extend, applyRef } from '../util'\nimport { enqueueRender } from '../render-queue'\nimport { getNodeProps } from './index'\nimport {\n diff,\n mounts,\n diffLevel,\n flushMounts,\n recollectNodeTree,\n removeChildren\n} from './diff'\nimport { createComponent, collectComponent } from './component-recycler'\nimport { removeNode } from '../dom/index'\nimport {\n addScopedAttrStatic,\n getCtorName,\n scopeHost\n} from '../style'\nimport { proxyUpdate } from '../observe'\n\n/** Set a component's `props` (generally derived from JSX attributes).\n *\t@param {Object} props\n *\t@param {Object} [opts]\n *\t@param {boolean} [opts.renderSync=false]\tIf `true` and {@link options.syncComponentUpdates} is `true`, triggers synchronous rendering.\n *\t@param {boolean} [opts.render=true]\t\t\tIf `false`, no render will be triggered.\n */\nexport function setComponentProps(component, props, opts, context, mountAll) {\n if (component._disable) return\n component._disable = true\n\n if ((component.__ref = props.ref)) delete props.ref\n if ((component.__key = props.key)) delete props.key\n\n if (!component.base || mountAll) {\n if (component.beforeInstall) component.beforeInstall()\n if (component.install) component.install()\n if (component.constructor.observe) {\n proxyUpdate(component)\n }\n }\n\n if (context && context !== component.context) {\n if (!component.prevContext) component.prevContext = component.context\n component.context = context\n }\n\n if (!component.prevProps) component.prevProps = component.props\n component.props = props\n\n component._disable = false\n\n if (opts !== NO_RENDER) {\n if (\n opts === SYNC_RENDER ||\n options.syncComponentUpdates !== false ||\n !component.base\n ) {\n renderComponent(component, SYNC_RENDER, mountAll)\n } else {\n enqueueRender(component)\n }\n }\n\n applyRef(component.__ref, component)\n}\n\nfunction shallowComparison(old, attrs) {\n let name\n\n for (name in old) {\n if (attrs[name] == null && old[name] != null) {\n return true\n }\n }\n\n if (old.children.length > 0 || attrs.children.length > 0) {\n return true\n }\n\n for (name in attrs) {\n if (name != 'children') {\n let type = typeof attrs[name]\n if (type == 'function' || type == 'object') {\n return true\n } else if (attrs[name] != old[name]) {\n return true\n }\n }\n }\n}\n\n/** Render a Component, triggering necessary lifecycle events and taking High-Order Components into account.\n *\t@param {Component} component\n *\t@param {Object} [opts]\n *\t@param {boolean} [opts.build=false]\t\tIf `true`, component will build and store a DOM node if not already associated with one.\n *\t@private\n */\nexport function renderComponent(component, opts, mountAll, isChild) {\n if (component._disable) return\n\n let props = component.props,\n data = component.data,\n context = component.context,\n previousProps = component.prevProps || props,\n previousState = component.prevState || data,\n previousContext = component.prevContext || context,\n isUpdate = component.base,\n nextBase = component.nextBase,\n initialBase = isUpdate || nextBase,\n initialChildComponent = component._component,\n skip = false,\n rendered,\n inst,\n cbase\n\n // if updating\n if (isUpdate) {\n component.props = previousProps\n component.data = previousState\n component.context = previousContext\n if (component.store || opts == FORCE_RENDER || shallowComparison(previousProps, props)) {\n let receiveResult = true\n if (component.receiveProps) {\n receiveResult = component.receiveProps(props, previousProps)\n }\n if (receiveResult !== false) {\n skip = false\n if (component.beforeUpdate) {\n component.beforeUpdate(props, data, context)\n }\n } else {\n skip = true\n }\n } else {\n skip = true\n }\n component.props = props\n component.data = data\n component.context = context\n }\n\n component.prevProps = component.prevState = component.prevContext = component.nextBase = null\n\n if (!skip) {\n component.beforeRender && component.beforeRender()\n rendered = component.render(props, data, context)\n\n //don't rerender\n if (component.constructor.css || component.css) {\n addScopedAttrStatic(\n rendered,\n '_s' + getCtorName(component.constructor)\n )\n }\n\n scopeHost(rendered, component.scopedCssAttr)\n\n // context to pass to the child, can be updated via (grand-)parent component\n if (component.getChildContext) {\n context = extend(extend({}, context), component.getChildContext())\n }\n\n let childComponent = rendered && rendered.nodeName,\n toUnmount,\n base,\n ctor = options.mapping[childComponent]\n\n if (ctor) {\n // set up high order component link\n\n let childProps = getNodeProps(rendered)\n inst = initialChildComponent\n\n if (inst && inst.constructor === ctor && childProps.key == inst.__key) {\n setComponentProps(inst, childProps, SYNC_RENDER, context, false)\n } else {\n toUnmount = inst\n\n component._component = inst = createComponent(ctor, childProps, context)\n inst.nextBase = inst.nextBase || nextBase\n inst._parentComponent = component\n setComponentProps(inst, childProps, NO_RENDER, context, false)\n renderComponent(inst, SYNC_RENDER, mountAll, true)\n }\n\n base = inst.base\n } else {\n cbase = initialBase\n\n // destroy high order component link\n toUnmount = initialChildComponent\n if (toUnmount) {\n cbase = component._component = null\n }\n\n if (initialBase || opts === SYNC_RENDER) {\n if (cbase) cbase._component = null\n base = diff(\n cbase,\n rendered,\n context,\n mountAll || !isUpdate,\n initialBase && initialBase.parentNode,\n true\n )\n }\n }\n\n if (initialBase && base !== initialBase && inst !== initialChildComponent) {\n let baseParent = initialBase.parentNode\n if (baseParent && base !== baseParent) {\n baseParent.replaceChild(base, initialBase)\n\n if (!toUnmount) {\n initialBase._component = null\n recollectNodeTree(initialBase, false)\n }\n }\n }\n\n if (toUnmount) {\n unmountComponent(toUnmount)\n }\n\n component.base = base\n if (base && !isChild) {\n let componentRef = component,\n t = component\n while ((t = t._parentComponent)) {\n ;(componentRef = t).base = base\n }\n base._component = componentRef\n base._componentConstructor = componentRef.constructor\n }\n }\n\n if (!isUpdate || mountAll) {\n mounts.unshift(component)\n } else if (!skip) {\n // Ensure that pending componentDidMount() hooks of child components\n // are called before the componentDidUpdate() hook in the parent.\n // Note: disabled as it causes duplicate hooks, see https://github.com/developit/preact/issues/750\n // flushMounts();\n\n if (component.afterUpdate) {\n //deprecated\n component.afterUpdate(previousProps, previousState, previousContext)\n }\n if (component.updated) {\n component.updated(previousProps, previousState, previousContext)\n }\n if (options.afterUpdate) options.afterUpdate(component)\n }\n\n if (component._renderCallbacks != null) {\n while (component._renderCallbacks.length)\n component._renderCallbacks.pop().call(component)\n }\n\n if (!diffLevel && !isChild) flushMounts()\n}\n\n/** Apply the Component referenced by a VNode to the DOM.\n *\t@param {Element} dom\tThe DOM node to mutate\n *\t@param {VNode} vnode\tA Component-referencing VNode\n *\t@returns {Element} dom\tThe created/mutated element\n *\t@private\n */\nexport function buildComponentFromVNode(dom, vnode, context, mountAll) {\n let c = dom && dom._component,\n originalComponent = c,\n oldDom = dom,\n isDirectOwner = c && dom._componentConstructor === vnode.nodeName,\n isOwner = isDirectOwner,\n props = getNodeProps(vnode)\n while (c && !isOwner && (c = c._parentComponent)) {\n isOwner = c.constructor === vnode.nodeName\n }\n\n if (c && isOwner && (!mountAll || c._component)) {\n setComponentProps(c, props, ASYNC_RENDER, context, mountAll)\n dom = c.base\n } else {\n if (originalComponent && !isDirectOwner) {\n unmountComponent(originalComponent)\n dom = oldDom = null\n }\n\n c = createComponent(vnode.nodeName, props, context, vnode)\n if (dom && !c.nextBase) {\n c.nextBase = dom\n // passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229:\n oldDom = null\n }\n setComponentProps(c, props, SYNC_RENDER, context, mountAll)\n dom = c.base\n\n if (oldDom && dom !== oldDom) {\n oldDom._component = null\n recollectNodeTree(oldDom, false)\n }\n }\n\n return dom\n}\n\n/** Remove a component from the DOM and recycle it.\n *\t@param {Component} component\tThe Component instance to unmount\n *\t@private\n */\nexport function unmountComponent(component) {\n if (options.beforeUnmount) options.beforeUnmount(component)\n\n let base = component.base\n\n component._disable = true\n\n\tif (component.uninstall) component.uninstall()\n\n\tif (component.store && component.store.instances) {\n\t\tfor (let i = 0, len = component.store.instances.length; i < len; i++) {\n\t\t\tif (component.store.instances[i] === component) {\n\t\t\t\tcomponent.store.instances.splice(i, 1)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n component.base = null\n\n // recursively tear down & recollect high-order component children:\n let inner = component._component\n if (inner) {\n unmountComponent(inner)\n } else if (base) {\n if (base[ATTR_KEY] != null) applyRef(base[ATTR_KEY].ref, null)\n\n component.nextBase = base\n\n removeNode(base)\n collectComponent(component)\n\n removeChildren(base)\n }\n\n applyRef(component.__ref, null)\n}\n","import { FORCE_RENDER } from './constants'\nimport { renderComponent } from './vdom/component'\nimport options from './options'\nimport { nProps, assign } from './util'\n\nlet id = 0\n\nexport default class Component {\n static is = 'WeElement'\n\n constructor(props, store) {\n this.props = assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps,\n props\n )\n this.elementId = id++\n this.data = this.constructor.data || this.data || {}\n\n this._preCss = null\n\n this.store = store\n }\n\n update(callback) {\n this._willUpdate = true\n if (callback)\n (this._renderCallbacks = this._renderCallbacks || []).push(callback)\n renderComponent(this, FORCE_RENDER)\n if (options.componentChange) options.componentChange(this, this.base)\n this._willUpdate = false\n }\n\n fire(type, data) {\n Object.keys(this.props).every(key => {\n if ('on' + type.toLowerCase() === key.toLowerCase()) {\n this.props[key]({ detail: data })\n return false\n }\n return true\n })\n }\n\n render() {}\n}\n","import { diff } from './vdom/diff'\n\n/** Render JSX into a `parent` Element.\n *\t@param {VNode} vnode\t\tA (JSX) VNode to render\n *\t@param {Element} parent\t\tDOM element to render into\n *\t@param {object} [store]\n *\t@public\n */\nexport function render(vnode, parent, store, empty, merge) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n\n if (empty) {\n while (parent.firstChild) {\n parent.removeChild(parent.firstChild)\n }\n }\n\n if (merge) {\n merge =\n typeof merge === 'string'\n ? document.querySelector(merge)\n : merge\n }\n\n return diff(merge, vnode, store, false, parent, false, true)\n}\n","import { define } from './define'\n\nexport function tag(name) {\n return function(target) {\n define(name, target)\n }\n}\n","import { h } from './h'\nimport Component from './component'\nimport { render } from './render'\nimport { tag } from './tag'\nimport { define } from './define'\nimport options from './options'\n\nconst WeElement = Component\nconst root = getGlobal()\nconst omiax = {\n h,\n tag,\n\tdefine,\n\tComponent,\n\trender,\n\tWeElement,\n\toptions\n}\n\nroot.Omi = omiax\nroot.omi = omiax\nroot.omiax = omiax\nroot.omiax.version = '0.0.0'\n\nexport default {\n h,\n tag,\n\tdefine,\n\tComponent,\n\trender,\n\tWeElement,\n\toptions\n}\n\nexport {\n h,\n tag,\n\tdefine,\n\tComponent,\n\trender,\n\tWeElement,\n\toptions\n}\n\nfunction getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n if (typeof self !== 'undefined') {\n return self\n } else if (typeof window !== 'undefined') {\n return window\n } else if (typeof global !== 'undefined') {\n return global\n }\n return (function() {\n return this\n })()\n }\n return global\n}\n","import layoutNode from '../../src/layout/layout-node'\nimport '../../src/index'\n\nvar size = getSize();\n\nconst vnode = \n \n \n Professor PuddinPop\n \n \n \n \n \n With these words the Witch fell down in a brown, melted, shapeless mass and began to spread over the clean boards of the kitchen floor. Seeing that she had really melted away to nothing, Dorothy drew another bucket of water and threw it over the mess. She then swept it all out the door. After picking out the silver shoe, which was all that was left of the old woman, she cleaned and dried it with a cloth, and put it on her foot again. Then, being at last free to do as she chose, she ran out to the courtyard to tell the Lion that the Wicked Witch of the West had come to an end, and that they were no longer prisoners in a strange land.\n \n \n\n\nconsole.log(layoutNode(vnode))\n\nfunction getSize() {\n return {\n left: 0,\n top: 0,\n width: 420,\n height: 740\n }\n}\n\nfunction getPageStyle() {\n\n return {\n position: 'relative',\n padding: 14,\n width: size.width,\n height: size.height,\n backgroundColor: '#f7f7f7',\n flexDirection: 'column'\n };\n}\n\nfunction getImageGroupStyle() {\n return {\n position: 'relative',\n flex: 1,\n backgroundColor: '#eee'\n };\n}\n\nfunction getImageStyle() {\n return {\n position: 'absolute',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0\n };\n}\n\nfunction getTitleStyle() {\n return {\n fontFace: FontFace('Georgia'),\n fontSize: 22,\n lineHeight: 28,\n height: 28,\n marginBottom: 10,\n color: '#333',\n textAlign: 'center'\n };\n}\n\nfunction getExcerptStyle() {\n return {\n fontFace: FontFace('Georgia'),\n fontSize: 17,\n lineHeight: 25,\n marginTop: 15,\n flex: 1,\n color: '#333'\n };\n}\n\nfunction FontFace() {\n\n}"],"names":["computeLayout","capitalizeFirst","str","charAt","toUpperCase","slice","getSpacing","node","type","suffix","location","key","style","getPositiveSpacing","isUndefined","value","undefined","getMargin","getPadding","getBorder","getPaddingAndBorder","getMarginAxis","axis","leading","trailing","getPaddingAndBorderAxis","getJustifyContent","justifyContent","getAlignItem","child","alignSelf","alignItems","getFlexDirection","flexDirection","getPositionType","position","getFlex","flex","isFlex","CSS_POSITION_RELATIVE","isFlexWrap","flexWrap","getDimWithMargin","layout","dim","isDimDefined","isPosDefined","pos","isMeasureDefined","getPosition","setDimensionFromStyle","fmaxf","getRelativePosition","row","column","a","b","CSS_UNDEFINED","CSS_FLEX_DIRECTION_ROW","CSS_FLEX_DIRECTION_COLUMN","CSS_JUSTIFY_FLEX_START","CSS_JUSTIFY_CENTER","CSS_JUSTIFY_FLEX_END","CSS_JUSTIFY_SPACE_BETWEEN","CSS_JUSTIFY_SPACE_AROUND","CSS_ALIGN_FLEX_START","CSS_ALIGN_CENTER","CSS_ALIGN_STRETCH","CSS_POSITION_ABSOLUTE","layoutNode","parentMaxWidth","mainAxis","crossAxis","width","isRowUndefined","isColumnUndefined","measure_dim","measure","height","i","children","length","ii","definedMainDim","startLine","endLine","alreadyComputedNextLayout","linesCrossDim","linesMainDim","mainContentDim","flexibleChildrenCount","totalFlexible","nonFlexibleChildrenCount","nextContentDim","maxWidth","leadingMainDim","betweenMainDim","remainingMainDim","flexibleMainDim","crossDim","mainDim","containerMainAxis","containerCrossAxis","leadingCrossDim","alignItem","remainingCrossDim","root","rootNode","createNode","walkNode","layer","top","left","attributes","map","parentLeft","parentTop","frame","x","y","forEach","stack","h","lastSimple","simple","arguments","push","p","pop","String","NO_RENDER","SYNC_RENDER","FORCE_RENDER","ASYNC_RENDER","ATTR_KEY","IS_NON_DIMENSIONAL","nodeId","uniqueId","docMap","addDoc","id","doc","getDoc","removeDoc","insertIndex","target","list","newIndex","before","after","splice","nextSibling","previousSibling","moveIndex","index","indexOf","newIndexAfter","beforeNew","afterNew","removeIndex","changeSibling","linkParent","parent","parentNode","docId","ownerDocument","nodeMap","depth","childNodes","displayMap","div","span","registerNode","Element","nodeType","ref","display","classStyle","event","nodeName","firstChild","appendChild","removeChild","insertBefore","insertAfter","removeElement","setAttribute","silent","result","setAttr","removeAttribute","setStyle","setStyles","styles","Object","assign","setClassStyle","toStyle","addEventListener","handler","removeEventListener","removeEvent","fireEvent","e","call","getComputedStyle","toJSON","keys","replaceChild","newChild","oldChild","destroy","TextNode","nodeValue","splitText","Document","_isMockDocument","createElement","tagName","props","el","createTextNode","txt","listener","scrollTo","animated","document","getGlobal","global","Math","Array","self","window","scopedStyle","mapping","isWeb","staticStyleMapping","mock","styleCache","getOwnPropertySymbols","hasOwnProperty","prototype","propIsEnumerable","propertyIsEnumerable","toObject","val","TypeError","source","from","to","symbols","s","runListeners","oEvent","iLstId","iElId","oEvtListeners","oListeners","aEls","aEvts","sEventType","fListener","nElIdx","aElListeners","create","proto","propertiesObject","Error","F","trim","replace","extend","obj","applyRef","current","usePromise","Promise","__config__","platform","systemVersion","split","defer","resolve","then","bind","setTimeout","isArray","toString","nProps","getUse","data","paths","path","isPath","getTargetByPath","tempPath","tempVal","args","apply","origin","arr","len","items","enqueueRender","component","options","debounceRendering","rerender","renderComponent","isSameNodeType","vnode","hydrating","ctor","_componentConstructor","isNamedNode","normalizedNodeName","toLowerCase","getNodeProps","defaultProps","isSvg","createElementNS","parseCSSText","cssText","cssTxt","match","rule","cssToJs","properties","o","property","removeNode","setAccessor","name","old","className","test","oldJson","currentJson","changed","ckey","innerHTML","__html","useCapture","substring","eventProxy","touchStart","touchEnd","_listeners","setProperty","ns","removeAttributeNS","setAttributeNS","___touchX","touches","pageX","___touchY","pageY","___scrollTop","body","scrollTop","abs","changedTouches","dispatchEvent","CustomEvent","detail","draw","res","console","log","mounts","diffLevel","isSvgMode","flushMounts","c","afterMount","installed","diff","dom","context","mountAll","componentRoot","fromRender","ownerSVGElement","ret","idiff","out","prevSvgMode","vnodeName","buildComponentFromVNode","_component","recollectNodeTree","fc","vchildren","_renderText","text","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","isHydrating","originalChildren","keyed","keyedLen","min","childrenLen","vlen","j","f","vchild","__key","unmountOnly","unmountComponent","removeChildren","lastChild","next","attrs","OBJECTTYPE","ARRAYTYPE","define","use","updatePath","getPath","getUpdatePath","item","dataToPath","_objToPath","_arrayToPath","components","collectComponent","constructor","createComponent","Ctor","inst","render","Component","doRender","scopedCssAttr","css","store","instances","initUse","_updatePath","nextBase","styleId","getCtorName","attrName","addScopedAttrStatic","vdom","attr","scopeVdom","scopeHost","obaa","callback","_observe","$observer","eventPropArr","$observeProps","$observerPath","prop","isInArray","watch","isString","propertyChangedHandler","propChanged","all","onPropertyChanged","oldValue","rootName","_getRootName","methods","RegExp","triggerStr","cprop","isFunction","currentValue","defineProperty","get","set","join","add","exec","size","callbacks","nextTickCallback","fireTick","fn","scope","nextItem","proxyUpdate","ele","timeout","_willUpdate","mergeUpdate","clearTimeout","update","setComponentProps","opts","_disable","__ref","base","beforeInstall","install","observe","prevContext","prevProps","syncComponentUpdates","shallowComparison","isChild","previousProps","previousState","prevState","previousContext","isUpdate","initialBase","initialChildComponent","skip","rendered","cbase","receiveResult","receiveProps","beforeUpdate","beforeRender","getChildContext","childComponent","toUnmount","childProps","_parentComponent","baseParent","componentRef","t","unshift","afterUpdate","updated","_renderCallbacks","originalComponent","oldDom","isDirectOwner","isOwner","beforeUnmount","uninstall","inner","elementId","_preCss","componentChange","fire","every","is","empty","merge","querySelector","tag","WeElement","omiax","Omi","omi","version","getSize","getPageStyle","getTitleStyle","getImageGroupStyle","getImageStyle","getExcerptStyle","padding","backgroundColor","right","bottom","fontFace","FontFace","fontSize","lineHeight","marginBottom","color","textAlign","marginTop"],"mappings":";;;EAAA;;EAEA;;;;;;;;;EASA,IAAIA,gBAAiB,YAAW;;EAE9B,WAASC,eAAT,CAAyBC,GAAzB,EAA8B;EAC5B,WAAOA,IAAIC,MAAJ,CAAW,CAAX,EAAcC,WAAd,KAA8BF,IAAIG,KAAJ,CAAU,CAAV,CAArC;EACD;;EAED,WAASC,UAAT,CAAoBC,IAApB,EAA0BC,IAA1B,EAAgCC,MAAhC,EAAwCC,QAAxC,EAAkD;EAChD,QAAIC,MAAMH,OAAOP,gBAAgBS,QAAhB,CAAP,GAAmCD,MAA7C;EACA,QAAIE,OAAOJ,KAAKK,KAAhB,EAAuB;EACrB,aAAOL,KAAKK,KAAL,CAAWD,GAAX,CAAP;EACD;;EAEDA,UAAMH,OAAOC,MAAb;EACA,QAAIE,OAAOJ,KAAKK,KAAhB,EAAuB;EACrB,aAAOL,KAAKK,KAAL,CAAWD,GAAX,CAAP;EACD;;E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ADF,KAJF;EAOE;EAAA;EAAA,QAAM,OAAOC,iBAAb;EAAA;EAAA;EAPF;EADY,CAAd;;EAcAjM,QAAQC,GAAR,CAAY3S,WAAWiP,KAAX,CAAZ;;EAEA,SAASqP,OAAT,GAAmB;EACjB,SAAO;EACL3b,UAAM,CADD;EAELD,SAAK,CAFA;EAGLtC,WAAO,GAHF;EAILK,YAAQ;EAJH,GAAP;EAMD;;EAED,SAAS8d,YAAT,GAAwB;;EAEtB,SAAO;EACLzgB,cAAU,UADL;EAEL8gB,aAAS,EAFJ;EAGLxe,WAAOuZ,KAAKvZ,KAHP;EAILK,YAAQkZ,KAAKlZ,MAJR;EAKLoe,qBAAiB,SALZ;EAMLjhB,mBAAe;EANV,GAAP;EAQD;;EAED,SAAS6gB,kBAAT,GAA8B;EAC5B,SAAO;EACL3gB,cAAU,UADL;EAELE,UAAM,CAFD;EAGL6gB,qBAAiB;EAHZ,GAAP;EAKD;;EAED,SAASH,aAAT,GAAyB;EACvB,SAAO;EACL5gB,cAAU,UADL;EAEL6E,UAAM,CAFD;EAGLD,SAAK,CAHA;EAILoc,WAAO,CAJF;EAKLC,YAAQ;EALH,GAAP;EAOD;;EAED,SAASP,aAAT,GAAyB;EACvB,SAAO;EACLQ,cAAUC,SAAS,SAAT,CADL;EAELC,cAAU,EAFL;EAGLC,gBAAY,EAHP;EAIL1e,YAAQ,EAJH;EAKL2e,kBAAc,EALT;EAMLC,WAAO,MANF;EAOLC,eAAW;EAPN,GAAP;EASD;;EAED,SAASX,eAAT,GAA2B;EACzB,SAAO;EACLK,cAAUC,SAAS,SAAT,CADL;EAELC,cAAU,EAFL;EAGLC,gBAAY,EAHP;EAILI,eAAW,EAJN;EAKLvhB,UAAM,CALD;EAMLqhB,WAAO;EANF,GAAP;EAQD;;EAED,SAASJ,QAAT,GAAoB;;;;"} \ No newline at end of file +{"version":3,"file":"b.js","sources":["../../src/layout/layout.js","../../src/layout/layout-node.js","../../src/render.js","../../src/h.js","../../src/index.js","main.js"],"sourcesContent":["// https://github.com/facebook/css-layout\n\n/**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\nvar computeLayout = (function() {\n\n function capitalizeFirst(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n function getSpacing(node, type, suffix, location) {\n var key = type + capitalizeFirst(location) + suffix;\n if (key in node.style) {\n return node.style[key];\n }\n\n key = type + suffix;\n if (key in node.style) {\n return node.style[key];\n }\n\n return 0;\n }\n\n function getPositiveSpacing(node, type, suffix, location) {\n var key = type + capitalizeFirst(location) + suffix;\n if (key in node.style && node.style[key] >= 0) {\n return node.style[key];\n }\n\n key = type + suffix;\n if (key in node.style && node.style[key] >= 0) {\n return node.style[key];\n }\n\n return 0;\n }\n\n function isUndefined(value) {\n return value === undefined;\n }\n\n function getMargin(node, location) {\n return getSpacing(node, 'margin', '', location);\n }\n\n function getPadding(node, location) {\n return getPositiveSpacing(node, 'padding', '', location);\n }\n\n function getBorder(node, location) {\n return getPositiveSpacing(node, 'border', 'Width', location);\n }\n\n function getPaddingAndBorder(node, location) {\n return getPadding(node, location) + getBorder(node, location);\n }\n\n function getMarginAxis(node, axis) {\n return getMargin(node, leading[axis]) + getMargin(node, trailing[axis]);\n }\n\n function getPaddingAndBorderAxis(node, axis) {\n return getPaddingAndBorder(node, leading[axis]) + getPaddingAndBorder(node, trailing[axis]);\n }\n\n function getJustifyContent(node) {\n if ('justifyContent' in node.style) {\n return node.style.justifyContent;\n }\n return 'flex-start';\n }\n\n function getAlignItem(node, child) {\n if ('alignSelf' in child.style) {\n return child.style.alignSelf;\n }\n if ('alignItems' in node.style) {\n return node.style.alignItems;\n }\n return 'stretch';\n }\n\n function getFlexDirection(node) {\n if ('flexDirection' in node.style) {\n return node.style.flexDirection;\n }\n return 'column';\n }\n\n function getPositionType(node) {\n if ('position' in node.style) {\n return node.style.position;\n }\n return 'relative';\n }\n\n function getFlex(node) {\n return node.style.flex;\n }\n\n function isFlex(node) {\n return (\n getPositionType(node) === CSS_POSITION_RELATIVE &&\n getFlex(node) > 0\n );\n }\n\n function isFlexWrap(node) {\n return node.style.flexWrap === 'wrap';\n }\n\n function getDimWithMargin(node, axis) {\n return node.layout[dim[axis]] + getMarginAxis(node, axis);\n }\n\n function isDimDefined(node, axis) {\n return !isUndefined(node.style[dim[axis]]) && node.style[dim[axis]] >= 0;\n }\n\n function isPosDefined(node, pos) {\n return !isUndefined(node.style[pos]);\n }\n\n function isMeasureDefined(node) {\n return 'measure' in node.style;\n }\n\n function getPosition(node, pos) {\n if (pos in node.style) {\n return node.style[pos];\n }\n return 0;\n }\n\n // When the user specifically sets a value for width or height\n function setDimensionFromStyle(node, axis) {\n // The parent already computed us a width or height. We just skip it\n if (!isUndefined(node.layout[dim[axis]])) {\n return;\n }\n // We only run if there's a width or height defined\n if (!isDimDefined(node, axis)) {\n return;\n }\n\n // The dimensions can never be smaller than the padding and border\n node.layout[dim[axis]] = fmaxf(\n node.style[dim[axis]],\n getPaddingAndBorderAxis(node, axis)\n );\n }\n\n // If both left and right are defined, then use left. Otherwise return\n // +left or -right depending on which is defined.\n function getRelativePosition(node, axis) {\n if (leading[axis] in node.style) {\n return getPosition(node, leading[axis]);\n }\n return -getPosition(node, trailing[axis]);\n }\n\n var leading = {\n row: 'left',\n column: 'top'\n };\n var trailing = {\n row: 'right',\n column: 'bottom'\n };\n var pos = {\n row: 'left',\n column: 'top'\n };\n var dim = {\n row: 'width',\n column: 'height'\n };\n\n function fmaxf(a, b) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n var CSS_UNDEFINED = undefined;\n\n var CSS_FLEX_DIRECTION_ROW = 'row';\n var CSS_FLEX_DIRECTION_COLUMN = 'column';\n\n var CSS_JUSTIFY_FLEX_START = 'flex-start';\n var CSS_JUSTIFY_CENTER = 'center';\n var CSS_JUSTIFY_FLEX_END = 'flex-end';\n var CSS_JUSTIFY_SPACE_BETWEEN = 'space-between';\n var CSS_JUSTIFY_SPACE_AROUND = 'space-around';\n\n var CSS_ALIGN_FLEX_START = 'flex-start';\n var CSS_ALIGN_CENTER = 'center';\n var CSS_ALIGN_FLEX_END = 'flex-end';\n var CSS_ALIGN_STRETCH = 'stretch';\n\n var CSS_POSITION_RELATIVE = 'relative';\n var CSS_POSITION_ABSOLUTE = 'absolute';\n\n return function layoutNode(node, parentMaxWidth) {\n var/*css_flex_direction_t*/ mainAxis = getFlexDirection(node);\n var/*css_flex_direction_t*/ crossAxis = mainAxis === CSS_FLEX_DIRECTION_ROW ?\n CSS_FLEX_DIRECTION_COLUMN :\n CSS_FLEX_DIRECTION_ROW;\n\n // Handle width and height style attributes\n setDimensionFromStyle(node, mainAxis);\n setDimensionFromStyle(node, crossAxis);\n\n // The position is set by the parent, but we need to complete it with a\n // delta composed of the margin and left/top/right/bottom\n node.layout[leading[mainAxis]] += getMargin(node, leading[mainAxis]) +\n getRelativePosition(node, mainAxis);\n node.layout[leading[crossAxis]] += getMargin(node, leading[crossAxis]) +\n getRelativePosition(node, crossAxis);\n\n if (isMeasureDefined(node)) {\n var/*float*/ width = CSS_UNDEFINED;\n if (isDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {\n width = node.style.width;\n } else if (!isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_ROW]])) {\n width = node.layout[dim[CSS_FLEX_DIRECTION_ROW]];\n } else {\n width = parentMaxWidth -\n getMarginAxis(node, CSS_FLEX_DIRECTION_ROW);\n }\n width -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n\n // We only need to give a dimension for the text if we haven't got any\n // for it computed yet. It can either be from the style attribute or because\n // the element is flexible.\n var/*bool*/ isRowUndefined = !isDimDefined(node, CSS_FLEX_DIRECTION_ROW) &&\n isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_ROW]]);\n var/*bool*/ isColumnUndefined = !isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) &&\n isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]);\n\n // Let's not measure the text if we already know both dimensions\n if (isRowUndefined || isColumnUndefined) {\n var/*css_dim_t*/ measure_dim = node.style.measure(\n /*(c)!node->context,*/\n width\n );\n if (isRowUndefined) {\n node.layout.width = measure_dim.width +\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n }\n if (isColumnUndefined) {\n node.layout.height = measure_dim.height +\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN);\n }\n }\n return;\n }\n\n // Pre-fill some dimensions straight from the parent\n for (var/*int*/ i = 0; i < node.children.length; ++i) {\n var/*css_node_t**/ child = node.children[i];\n // Pre-fill cross axis dimensions when the child is using stretch before\n // we call the recursive layout pass\n if (getAlignItem(node, child) === CSS_ALIGN_STRETCH &&\n getPositionType(child) === CSS_POSITION_RELATIVE &&\n !isUndefined(node.layout[dim[crossAxis]]) &&\n !isDimDefined(child, crossAxis)) {\n child.layout[dim[crossAxis]] = fmaxf(\n node.layout[dim[crossAxis]] -\n getPaddingAndBorderAxis(node, crossAxis) -\n getMarginAxis(child, crossAxis),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, crossAxis)\n );\n } else if (getPositionType(child) == CSS_POSITION_ABSOLUTE) {\n // Pre-fill dimensions when using absolute position and both offsets for the axis are defined (either both\n // left and right or top and bottom).\n for (var/*int*/ ii = 0; ii < 2; ii++) {\n var/*css_flex_direction_t*/ axis = (ii != 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n if (!isUndefined(node.layout[dim[axis]]) &&\n !isDimDefined(child, axis) &&\n isPosDefined(child, leading[axis]) &&\n isPosDefined(child, trailing[axis])) {\n child.layout[dim[axis]] = fmaxf(\n node.layout[dim[axis]] -\n getPaddingAndBorderAxis(node, axis) -\n getMarginAxis(child, axis) -\n getPosition(child, leading[axis]) -\n getPosition(child, trailing[axis]),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, axis)\n );\n }\n }\n }\n }\n\n var/*float*/ definedMainDim = CSS_UNDEFINED;\n if (!isUndefined(node.layout[dim[mainAxis]])) {\n definedMainDim = node.layout[dim[mainAxis]] -\n getPaddingAndBorderAxis(node, mainAxis);\n }\n\n // We want to execute the next two loops one per line with flex-wrap\n var/*int*/ startLine = 0;\n var/*int*/ endLine = 0;\n var/*int*/ nextOffset = 0;\n var/*int*/ alreadyComputedNextLayout = 0;\n // We aggregate the total dimensions of the container in those two variables\n var/*float*/ linesCrossDim = 0;\n var/*float*/ linesMainDim = 0;\n while (endLine < node.children.length) {\n // Layout non flexible children and count children by type\n\n // mainContentDim is accumulation of the dimensions and margin of all the\n // non flexible children. This will be used in order to either set the\n // dimensions of the node if none already exist, or to compute the\n // remaining space left for the flexible children.\n var/*float*/ mainContentDim = 0;\n\n // There are three kind of children, non flexible, flexible and absolute.\n // We need to know how many there are in order to distribute the space.\n var/*int*/ flexibleChildrenCount = 0;\n var/*float*/ totalFlexible = 0;\n var/*int*/ nonFlexibleChildrenCount = 0;\n for (var/*int*/ i = startLine; i < node.children.length; ++i) {\n var/*css_node_t**/ child = node.children[i];\n var/*float*/ nextContentDim = 0;\n\n // It only makes sense to consider a child flexible if we have a computed\n // dimension for the node.\n if (!isUndefined(node.layout[dim[mainAxis]]) && isFlex(child)) {\n flexibleChildrenCount++;\n totalFlexible += getFlex(child);\n\n // Even if we don't know its exact size yet, we already know the padding,\n // border and margin. We'll use this partial information to compute the\n // remaining space.\n nextContentDim = getPaddingAndBorderAxis(child, mainAxis) +\n getMarginAxis(child, mainAxis);\n\n } else {\n var/*float*/ maxWidth = CSS_UNDEFINED;\n if (mainAxis === CSS_FLEX_DIRECTION_ROW) {\n // do nothing\n } else if (isDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {\n maxWidth = node.layout[dim[CSS_FLEX_DIRECTION_ROW]] -\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n } else {\n maxWidth = parentMaxWidth -\n getMarginAxis(node, CSS_FLEX_DIRECTION_ROW) -\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n }\n\n // This is the main recursive call. We layout non flexible children.\n if (alreadyComputedNextLayout === 0) {\n layoutNode(child, maxWidth);\n }\n\n // Absolute positioned elements do not take part of the layout, so we\n // don't use them to compute mainContentDim\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n nonFlexibleChildrenCount++;\n // At this point we know the final size and margin of the element.\n nextContentDim = getDimWithMargin(child, mainAxis);\n }\n }\n\n // The element we are about to add would make us go to the next line\n if (isFlexWrap(node) &&\n !isUndefined(node.layout[dim[mainAxis]]) &&\n mainContentDim + nextContentDim > definedMainDim &&\n // If there's only one element, then it's bigger than the content\n // and needs its own line\n i !== startLine) {\n alreadyComputedNextLayout = 1;\n break;\n }\n alreadyComputedNextLayout = 0;\n mainContentDim += nextContentDim;\n endLine = i + 1;\n }\n\n // Layout flexible children and allocate empty space\n\n // In order to position the elements in the main axis, we have two\n // controls. The space between the beginning and the first element\n // and the space between each two elements.\n var/*float*/ leadingMainDim = 0;\n var/*float*/ betweenMainDim = 0;\n\n // The remaining available space that needs to be allocated\n var/*float*/ remainingMainDim = 0;\n if (!isUndefined(node.layout[dim[mainAxis]])) {\n remainingMainDim = definedMainDim - mainContentDim;\n } else {\n remainingMainDim = fmaxf(mainContentDim, 0) - mainContentDim;\n }\n\n // If there are flexible children in the mix, they are going to fill the\n // remaining space\n if (flexibleChildrenCount !== 0) {\n var/*float*/ flexibleMainDim = remainingMainDim / totalFlexible;\n\n // The non flexible children can overflow the container, in this case\n // we should just assume that there is no space available.\n if (flexibleMainDim < 0) {\n flexibleMainDim = 0;\n }\n // We iterate over the full array and only apply the action on flexible\n // children. This is faster than actually allocating a new array that\n // contains only flexible children.\n for (var/*int*/ i = startLine; i < endLine; ++i) {\n var/*css_node_t**/ child = node.children[i];\n if (isFlex(child)) {\n // At this point we know the final size of the element in the main\n // dimension\n child.layout[dim[mainAxis]] = flexibleMainDim * getFlex(child) +\n getPaddingAndBorderAxis(child, mainAxis);\n\n var/*float*/ maxWidth = CSS_UNDEFINED;\n if (mainAxis === CSS_FLEX_DIRECTION_ROW) {\n // do nothing\n } else if (isDimDefined(node, CSS_FLEX_DIRECTION_ROW)) {\n maxWidth = node.layout[dim[CSS_FLEX_DIRECTION_ROW]] -\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n } else {\n maxWidth = parentMaxWidth -\n getMarginAxis(node, CSS_FLEX_DIRECTION_ROW) -\n getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_ROW);\n }\n\n // And we recursively call the layout algorithm for this child\n layoutNode(child, maxWidth);\n }\n }\n\n // We use justifyContent to figure out how to allocate the remaining\n // space available\n } else {\n var/*css_justify_t*/ justifyContent = getJustifyContent(node);\n if (justifyContent === CSS_JUSTIFY_FLEX_START) {\n // Do nothing\n } else if (justifyContent === CSS_JUSTIFY_CENTER) {\n leadingMainDim = remainingMainDim / 2;\n } else if (justifyContent === CSS_JUSTIFY_FLEX_END) {\n leadingMainDim = remainingMainDim;\n } else if (justifyContent === CSS_JUSTIFY_SPACE_BETWEEN) {\n remainingMainDim = fmaxf(remainingMainDim, 0);\n if (flexibleChildrenCount + nonFlexibleChildrenCount - 1 !== 0) {\n betweenMainDim = remainingMainDim /\n (flexibleChildrenCount + nonFlexibleChildrenCount - 1);\n } else {\n betweenMainDim = 0;\n }\n } else if (justifyContent === CSS_JUSTIFY_SPACE_AROUND) {\n // Space on the edges is half of the space between elements\n betweenMainDim = remainingMainDim /\n (flexibleChildrenCount + nonFlexibleChildrenCount);\n leadingMainDim = betweenMainDim / 2;\n }\n }\n\n // Position elements in the main axis and compute dimensions\n\n // At this point, all the children have their dimensions set. We need to\n // find their position. In order to do that, we accumulate data in\n // variables that are also useful to compute the total dimensions of the\n // container!\n var/*float*/ crossDim = 0;\n var/*float*/ mainDim = leadingMainDim +\n getPaddingAndBorder(node, leading[mainAxis]);\n\n for (var/*int*/ i = startLine; i < endLine; ++i) {\n var/*css_node_t**/ child = node.children[i];\n\n if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&\n isPosDefined(child, leading[mainAxis])) {\n // In case the child is position absolute and has left/top being\n // defined, we override the position to whatever the user said\n // (and margin/border).\n child.layout[pos[mainAxis]] = getPosition(child, leading[mainAxis]) +\n getBorder(node, leading[mainAxis]) +\n getMargin(child, leading[mainAxis]);\n } else {\n // If the child is position absolute (without top/left) or relative,\n // we put it at the current accumulated offset.\n child.layout[pos[mainAxis]] += mainDim;\n }\n\n // Now that we placed the element, we need to update the variables\n // We only need to do that for relative elements. Absolute elements\n // do not take part in that phase.\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n // The main dimension is the sum of all the elements dimension plus\n // the spacing.\n mainDim += betweenMainDim + getDimWithMargin(child, mainAxis);\n // The cross dimension is the max of the elements dimension since there\n // can only be one element in that cross dimension.\n crossDim = fmaxf(crossDim, getDimWithMargin(child, crossAxis));\n }\n }\n\n var/*float*/ containerMainAxis = node.layout[dim[mainAxis]];\n // If the user didn't specify a width or height, and it has not been set\n // by the container, then we set it via the children.\n if (isUndefined(node.layout[dim[mainAxis]])) {\n containerMainAxis = fmaxf(\n // We're missing the last padding at this point to get the final\n // dimension\n mainDim + getPaddingAndBorder(node, trailing[mainAxis]),\n // We can never assign a width smaller than the padding and borders\n getPaddingAndBorderAxis(node, mainAxis)\n );\n }\n\n var/*float*/ containerCrossAxis = node.layout[dim[crossAxis]];\n if (isUndefined(node.layout[dim[crossAxis]])) {\n containerCrossAxis = fmaxf(\n // For the cross dim, we add both sides at the end because the value\n // is aggregate via a max function. Intermediate negative values\n // can mess this computation otherwise\n crossDim + getPaddingAndBorderAxis(node, crossAxis),\n getPaddingAndBorderAxis(node, crossAxis)\n );\n }\n\n // Position elements in the cross axis\n\n for (var/*int*/ i = startLine; i < endLine; ++i) {\n var/*css_node_t**/ child = node.children[i];\n\n if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&\n isPosDefined(child, leading[crossAxis])) {\n // In case the child is absolutely positionned and has a\n // top/left/bottom/right being set, we override all the previously\n // computed positions to set it correctly.\n child.layout[pos[crossAxis]] = getPosition(child, leading[crossAxis]) +\n getBorder(node, leading[crossAxis]) +\n getMargin(child, leading[crossAxis]);\n\n } else {\n var/*float*/ leadingCrossDim = getPaddingAndBorder(node, leading[crossAxis]);\n\n // For a relative children, we're either using alignItems (parent) or\n // alignSelf (child) in order to determine the position in the cross axis\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n var/*css_align_t*/ alignItem = getAlignItem(node, child);\n if (alignItem === CSS_ALIGN_FLEX_START) {\n // Do nothing\n } else if (alignItem === CSS_ALIGN_STRETCH) {\n // You can only stretch if the dimension has not already been set\n // previously.\n if (!isDimDefined(child, crossAxis)) {\n child.layout[dim[crossAxis]] = fmaxf(\n containerCrossAxis -\n getPaddingAndBorderAxis(node, crossAxis) -\n getMarginAxis(child, crossAxis),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, crossAxis)\n );\n }\n } else {\n // The remaining space between the parent dimensions+padding and child\n // dimensions+margin.\n var/*float*/ remainingCrossDim = containerCrossAxis -\n getPaddingAndBorderAxis(node, crossAxis) -\n getDimWithMargin(child, crossAxis);\n\n if (alignItem === CSS_ALIGN_CENTER) {\n leadingCrossDim += remainingCrossDim / 2;\n } else { // CSS_ALIGN_FLEX_END\n leadingCrossDim += remainingCrossDim;\n }\n }\n }\n\n // And we apply the position\n child.layout[pos[crossAxis]] += linesCrossDim + leadingCrossDim;\n }\n }\n\n linesCrossDim += crossDim;\n linesMainDim = fmaxf(linesMainDim, mainDim);\n startLine = endLine;\n }\n\n // If the user didn't specify a width or height, and it has not been set\n // by the container, then we set it via the children.\n if (isUndefined(node.layout[dim[mainAxis]])) {\n node.layout[dim[mainAxis]] = fmaxf(\n // We're missing the last padding at this point to get the final\n // dimension\n linesMainDim + getPaddingAndBorder(node, trailing[mainAxis]),\n // We can never assign a width smaller than the padding and borders\n getPaddingAndBorderAxis(node, mainAxis)\n );\n }\n\n if (isUndefined(node.layout[dim[crossAxis]])) {\n node.layout[dim[crossAxis]] = fmaxf(\n // For the cross dim, we add both sides at the end because the value\n // is aggregate via a max function. Intermediate negative values\n // can mess this computation otherwise\n linesCrossDim + getPaddingAndBorderAxis(node, crossAxis),\n getPaddingAndBorderAxis(node, crossAxis)\n );\n }\n\n // Calculate dimensions for absolutely positioned elements\n\n for (var/*int*/ i = 0; i < node.children.length; ++i) {\n var/*css_node_t**/ child = node.children[i];\n if (getPositionType(child) == CSS_POSITION_ABSOLUTE) {\n // Pre-fill dimensions when using absolute position and both offsets for the axis are defined (either both\n // left and right or top and bottom).\n for (var/*int*/ ii = 0; ii < 2; ii++) {\n var/*css_flex_direction_t*/ axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n if (!isUndefined(node.layout[dim[axis]]) &&\n !isDimDefined(child, axis) &&\n isPosDefined(child, leading[axis]) &&\n isPosDefined(child, trailing[axis])) {\n child.layout[dim[axis]] = fmaxf(\n node.layout[dim[axis]] -\n getPaddingAndBorderAxis(node, axis) -\n getMarginAxis(child, axis) -\n getPosition(child, leading[axis]) -\n getPosition(child, trailing[axis]),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, axis)\n );\n }\n }\n for (var/*int*/ ii = 0; ii < 2; ii++) {\n var/*css_flex_direction_t*/ axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n if (isPosDefined(child, trailing[axis]) &&\n !isPosDefined(child, leading[axis])) {\n child.layout[leading[axis]] =\n node.layout[dim[axis]] -\n child.layout[dim[axis]] -\n getPosition(child, trailing[axis]);\n }\n }\n }\n }\n };\n})();\n\nexport default computeLayout","// https://github.com/Flipboard/react-canvas\n\n/**\nCopyright (c) 2015, Flipboard\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice, this\n list of conditions and the following disclaimer in the documentation and/or\n other materials provided with the distribution.\n\n* Neither the name of Flipboard nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n'use strict';\n\nimport computeLayout from './layout';\n\n/**\n * This computes the CSS layout for a RenderLayer tree and mutates the frame\n * objects at each node.\n *\n * @param {Renderlayer} root\n * @return {Object}\n */\nfunction layoutNode (root) {\n var rootNode = createNode(root);\n computeLayout(rootNode);\n walkNode(rootNode);\n return rootNode;\n}\n\nfunction createNode (layer) {\n return {\n layer: layer,\n layout: {\n width: undefined, // computeLayout will mutate\n height: undefined, // computeLayout will mutate\n top: 0,\n left: 0,\n },\n style: (layer.attributes && layer.attributes.style) || {},\n children: (layer.children || []).map(createNode)\n };\n}\n\nfunction walkNode (node, parentLeft, parentTop) {\n node.layer.frame.x = node.layout.left + (parentLeft || 0);\n node.layer.frame.y = node.layout.top + (parentTop || 0);\n node.layer.frame.width = node.layout.width;\n node.layer.frame.height = node.layout.height;\n if (node.children && node.children.length > 0) {\n node.children.forEach(function (child) {\n walkNode(child, node.layer.frame.x, node.layer.frame.y);\n });\n }\n}\n\nexport default layoutNode;","import layout from './layout/layout-node'\n\nexport function render(node){\n console.log(layout(node()))\n}\n","const stack = []\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a lightweight representation\n * of the structure of a DOM tree. This structure can be realized by recursively comparing it against\n * the current _actual_ DOM structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string} nodeName\tAn element name. Ex: `div`, `a`, `span`, etc.\n * @param {Object} attributes\tAny attributes/props to set on the created element.\n * @param rest\t\t\tAdditional arguments are taken to be children to append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(type, attributes) {\n let children = [],\n lastSimple,\n child,\n simple,\n i\n for (i = arguments.length; i-- > 2;) {\n stack.push(arguments[i])\n }\n if (attributes && attributes.children != null) {\n if (!stack.length) stack.push(attributes.children)\n delete attributes.children\n }\n\n let p = {}\n if (type !== 'text') {\n while (stack.length) {\n if ((child = stack.pop()) && child.pop !== undefined) {\n for (i = child.length; i--;) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof type !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children.length === 0) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n } else {\n p.value = stack.pop()\n }\n\n\n\n p.type = type\n p.frame = {\n \"x\": 0,\n \"y\": 0,\n \"width\": 0,\n \"height\": 0\n }\n p.children = children\n p.attributes = attributes == null ? undefined : attributes\n p.key = attributes == null ? undefined : attributes.key\n\n\n return p\n}\n","import { render } from './render'\nimport { h } from './h'\n\nconst root = getGlobal()\n\n\nroot.Omi = { h, version: '0.0.0' }\n\nfunction getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n if (typeof self !== 'undefined') {\n return self\n } else if (typeof window !== 'undefined') {\n return window\n } else if (typeof global !== 'undefined') {\n return global\n }\n return (function () {\n return this\n })()\n }\n return global\n}\n\nexport {\n render\n}\n","import { render } from '../../src/index'\n\nconst size = getSize();\n\n//全局 store或者局部 store,data全放这里,组件没有私有 data,只可以有 props\nconst store = {\n\n}\n\n//UI is UI,没有 data\nconst App = (props, store) => {\n return \n \n \n Professor PuddinPop\n \n \n \n \n \n With these words the Witch fell down in a brown, melted, shapeless mass and began to spread over the clean boards of the kitchen floor. Seeing that she had really melted away to nothing, Dorothy drew another bucket of water and threw it over the mess. She then swept it all out the door. After picking out the silver shoe, which was all that was left of the old woman, she cleaned and dried it with a cloth, and put it on her foot again. Then, being at last free to do as she chose, she ran out to the courtyard to tell the Lion that the Wicked Witch of the West had come to an end, and that they were no longer prisoners in a strange land.\n \n \n \n}\n\n//渲染并注入 store\nconsole.log(render(App, store))\n\nfunction getSize() {\n return {\n left: 0,\n top: 0,\n width: 420,\n height: 740\n }\n}\n\nfunction getPageStyle() {\n\n return {\n position: 'relative',\n padding: 14,\n width: size.width,\n height: size.height,\n backgroundColor: '#f7f7f7',\n flexDirection: 'column'\n };\n}\n\nfunction getImageGroupStyle() {\n return {\n position: 'relative',\n flex: 1,\n backgroundColor: '#eee'\n };\n}\n\nfunction getImageStyle() {\n return {\n position: 'absolute',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0\n };\n}\n\nfunction getTitleStyle() {\n return {\n fontFace: FontFace('Georgia'),\n fontSize: 22,\n lineHeight: 28,\n height: 28,\n marginBottom: 10,\n color: '#333',\n textAlign: 'center'\n };\n}\n\nfunction getExcerptStyle() {\n return {\n fontFace: FontFace('Georgia'),\n fontSize: 17,\n lineHeight: 25,\n marginTop: 15,\n flex: 1,\n color: '#333'\n };\n}\n\nfunction FontFace() {\n\n}\n"],"names":["computeLayout","capitalizeFirst","str","charAt","toUpperCase","slice","getSpacing","node","type","suffix","location","key","style","getPositiveSpacing","isUndefined","value","undefined","getMargin","getPadding","getBorder","getPaddingAndBorder","getMarginAxis","axis","leading","trailing","getPaddingAndBorderAxis","getJustifyContent","justifyContent","getAlignItem","child","alignSelf","alignItems","getFlexDirection","flexDirection","getPositionType","position","getFlex","flex","isFlex","CSS_POSITION_RELATIVE","isFlexWrap","flexWrap","getDimWithMargin","layout","dim","isDimDefined","isPosDefined","pos","isMeasureDefined","getPosition","setDimensionFromStyle","fmaxf","getRelativePosition","row","column","a","b","CSS_UNDEFINED","CSS_FLEX_DIRECTION_ROW","CSS_FLEX_DIRECTION_COLUMN","CSS_JUSTIFY_FLEX_START","CSS_JUSTIFY_CENTER","CSS_JUSTIFY_FLEX_END","CSS_JUSTIFY_SPACE_BETWEEN","CSS_JUSTIFY_SPACE_AROUND","CSS_ALIGN_FLEX_START","CSS_ALIGN_CENTER","CSS_ALIGN_STRETCH","CSS_POSITION_ABSOLUTE","layoutNode","parentMaxWidth","mainAxis","crossAxis","width","isRowUndefined","isColumnUndefined","measure_dim","measure","height","i","children","length","ii","definedMainDim","startLine","endLine","alreadyComputedNextLayout","linesCrossDim","linesMainDim","mainContentDim","flexibleChildrenCount","totalFlexible","nonFlexibleChildrenCount","nextContentDim","maxWidth","leadingMainDim","betweenMainDim","remainingMainDim","flexibleMainDim","crossDim","mainDim","containerMainAxis","containerCrossAxis","leadingCrossDim","alignItem","remainingCrossDim","root","rootNode","createNode","walkNode","layer","top","left","attributes","map","parentLeft","parentTop","frame","x","y","forEach","render","console","log","stack","h","lastSimple","simple","arguments","push","p","pop","String","getGlobal","Omi","version","global","Math","Array","self","window","size","getSize","store","App","props","getPageStyle","getTitleStyle","getImageGroupStyle","getImageStyle","getExcerptStyle","padding","backgroundColor","right","bottom","fontFace","FontFace","fontSize","lineHeight","marginBottom","color","textAlign","marginTop"],"mappings":";;;EAAA;;EAEA;;;;;;;;;EASA,IAAIA,gBAAiB,YAAW;;EAE9B,WAASC,eAAT,CAAyBC,GAAzB,EAA8B;EAC5B,WAAOA,IAAIC,MAAJ,CAAW,CAAX,EAAcC,WAAd,KAA8BF,IAAIG,KAAJ,CAAU,CAAV,CAArC;EACD;;EAED,WAASC,UAAT,CAAoBC,IAApB,EAA0BC,IAA1B,EAAgCC,MAAhC,EAAwCC,QAAxC,EAAkD;EAChD,QAAIC,MAAMH,OAAOP,gBAAgBS,QAAhB,CAAP,GAAmCD,MAA7C;EACA,QAAIE,OAAOJ,KAAKK,KAAhB,EAAuB;EACrB,aAAOL,KAAKK,KAAL,CAAWD,GAAX,CAAP;EACD;;EAEDA,UAAMH,OAAOC,MAAb;EACA,QAAIE,OAAOJ,KAAKK,KAAhB,EAAuB;EACrB,aAAOL,KAAKK,KAAL,CAAWD,GAAX,CAAP;EACD;;EAED,WAAO,CAAP;EACD;;EAED,WAASE,kBAAT,CAA4BN,IAA5B,EAAkCC,IAAlC,EAAwCC,MAAxC,EAAgDC,QAAhD,EAA0D;EACxD,QAAIC,MAAMH,OAAOP,gBAAgBS,QAAhB,CAAP,GAAmCD,MAA7C;EACA,QAAIE,OAAOJ,KAAKK,KAAZ,IAAqBL,KAAKK,KAAL,CAAWD,GAAX,KAAmB,CAA5C,EAA+C;EAC7C,aAAOJ,KAAKK,KAAL,CAAWD,GAAX,CAAP;EACD;;EAEDA,UAAMH,OAAOC,MAAb;EACA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;EAKD;;EAED,SAASH,aAAT,GAAyB;EACvB,SAAO;EACLlH,cAAU,UADL;EAEL6E,UAAM,CAFD;EAGLD,SAAK,CAHA;EAIL0C,WAAO,CAJF;EAKLC,YAAQ;EALH,GAAP;EAOD;;EAED,SAASP,aAAT,GAAyB;EACvB,SAAO;EACLQ,cAAUC,SAAS,SAAT,CADL;EAELC,cAAU,EAFL;EAGLC,gBAAY,EAHP;EAILhF,YAAQ,EAJH;EAKLiF,kBAAc,EALT;EAMLC,WAAO,MANF;EAOLC,eAAW;EAPN,GAAP;EASD;;EAED,SAASX,eAAT,GAA2B;EACzB,SAAO;EACLK,cAAUC,SAAS,SAAT,CADL;EAELC,cAAU,EAFL;EAGLC,gBAAY,EAHP;EAILI,eAAW,EAJN;EAKL7H,UAAM,CALD;EAML2H,WAAO;EANF,GAAP;EAQD;;EAED,SAASJ,QAAT,GAAoB;;;;"} \ No newline at end of file diff --git a/packages/omiax/examples/hello/main.js b/packages/omiax/examples/hello/main.js index 6b4e0fa70..1a73cfb0b 100644 --- a/packages/omiax/examples/hello/main.js +++ b/packages/omiax/examples/hello/main.js @@ -1,23 +1,31 @@ -import layoutNode from '../../src/layout/layout-node' -import '../../src/index' +import { render } from '../../src/index' -var size = getSize(); +const size = getSize(); -const vnode = - - - Professor PuddinPop +//全局 store或者局部 store,data全放这里,组件没有私有 data,只可以有 props +const store = { + +} + +//UI is UI,没有 data +const App = (props, store) => { + return + + + Professor PuddinPop + + + + + + With these words the Witch fell down in a brown, melted, shapeless mass and began to spread over the clean boards of the kitchen floor. Seeing that she had really melted away to nothing, Dorothy drew another bucket of water and threw it over the mess. She then swept it all out the door. After picking out the silver shoe, which was all that was left of the old woman, she cleaned and dried it with a cloth, and put it on her foot again. Then, being at last free to do as she chose, she ran out to the courtyard to tell the Lion that the Wicked Witch of the West had come to an end, and that they were no longer prisoners in a strange land. - - - - With these words the Witch fell down in a brown, melted, shapeless mass and began to spread over the clean boards of the kitchen floor. Seeing that she had really melted away to nothing, Dorothy drew another bucket of water and threw it over the mess. She then swept it all out the door. After picking out the silver shoe, which was all that was left of the old woman, she cleaned and dried it with a cloth, and put it on her foot again. Then, being at last free to do as she chose, she ran out to the courtyard to tell the Lion that the Wicked Witch of the West had come to an end, and that they were no longer prisoners in a strange land. - - - + +} -console.log(layoutNode(vnode)) +//渲染并注入 store +console.log(render(App, store)) function getSize() { return { @@ -83,4 +91,4 @@ function getExcerptStyle() { function FontFace() { -} \ No newline at end of file +} diff --git a/packages/omiax/examples/simple/b.js b/packages/omiax/examples/simple/b.js deleted file mode 100644 index ca6f62ea4..000000000 --- a/packages/omiax/examples/simple/b.js +++ /dev/null @@ -1,2300 +0,0 @@ -(function () { - 'use strict'; - - var stack = []; - - /** - * JSX/hyperscript reviver. - * @see http://jasonformat.com/wtf-is-jsx - * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0 - * - * Note: this is exported as both `h()` and `createElement()` for compatibility reasons. - * - * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a lightweight representation - * of the structure of a DOM tree. This structure can be realized by recursively comparing it against - * the current _actual_ DOM structure, and applying only the differences. - * - * `h()`/`createElement()` accepts an element name, a list of attributes/props, - * and optionally children to append to the element. - * - * @example The following DOM tree - * - * `
Hello!
` - * - * can be constructed using this function as: - * - * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');` - * - * @param {string} nodeName An element name. Ex: `div`, `a`, `span`, etc. - * @param {Object} attributes Any attributes/props to set on the created element. - * @param rest Additional arguments are taken to be children to append. Can be infinitely nested Arrays. - * - * @public - */ - function h(nodeName, attributes) { - var children = [], - lastSimple = void 0, - child = void 0, - simple = void 0, - i = void 0; - for (i = arguments.length; i-- > 2;) { - stack.push(arguments[i]); - } - if (attributes && attributes.children != null) { - if (!stack.length) stack.push(attributes.children); - delete attributes.children; - } - while (stack.length) { - if ((child = stack.pop()) && child.pop !== undefined) { - for (i = child.length; i--;) { - stack.push(child[i]); - } - } else { - if (typeof child === 'boolean') child = null; - - if (simple = typeof nodeName !== 'function') { - if (child == null) child = '';else if (typeof child === 'number') child = String(child);else if (typeof child !== 'string') simple = false; - } - - if (simple && lastSimple) { - children[children.length - 1] += child; - } else if (children.length === 0) { - children = [child]; - } else { - children.push(child); - } - - lastSimple = simple; - } - } - - var p = {}; - p.nodeName = nodeName; - p.children = children; - p.attributes = attributes == null ? undefined : attributes; - p.key = attributes == null ? undefined : attributes.key; - - return p; - } - - // render modes - - var NO_RENDER = 0; - var SYNC_RENDER = 1; - var FORCE_RENDER = 2; - var ASYNC_RENDER = 3; - - var ATTR_KEY = '__omiattr_'; - - // DOM properties that should NOT have "px" added when numeric - var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i; - - var nodeId = 1; - function uniqueId() { - return nodeId++; - } - - var docMap = {}; - - function addDoc(id, doc) { - docMap[id] = doc; - } - - function getDoc(id) { - return docMap[id]; - } - - function removeDoc(id) { - delete docMap[id]; - } - - function insertIndex(target, list, newIndex) { - if (newIndex < 0) { - newIndex = 0; - } - var before = list[newIndex - 1]; - var after = list[newIndex]; - list.splice(newIndex, 0, target); - - before && (before.nextSibling = target); - target.previousSibling = before; - target.nextSibling = after; - after && (after.previousSibling = target); - - return newIndex; - } - - function moveIndex(target, list, newIndex) { - var index = list.indexOf(target); - - if (index < 0) { - return -1; - } - - var before = list[index - 1]; - var after = list[index + 1]; - before && (before.nextSibling = after); - after && (after.previousSibling = before); - - list.splice(index, 1); - var newIndexAfter = newIndex; - if (index <= newIndex) { - newIndexAfter = newIndex - 1; - } - var beforeNew = list[newIndexAfter - 1]; - var afterNew = list[newIndexAfter]; - list.splice(newIndexAfter, 0, target); - - beforeNew && (beforeNew.nextSibling = target); - target.previousSibling = beforeNew; - target.nextSibling = afterNew; - afterNew && (afterNew.previousSibling = target); - - if (index === newIndexAfter) { - return -1; - } - return newIndex; - } - - function removeIndex(target, list, changeSibling) { - var index = list.indexOf(target); - - if (index < 0) { - return; - } - if (changeSibling) { - var before = list[index - 1]; - var after = list[index + 1]; - before && (before.nextSibling = after); - after && (after.previousSibling = before); - } - list.splice(index, 1); - } - - function linkParent(node, parent) { - node.parentNode = parent; - if (parent.docId) { - node.docId = parent.docId; - node.ownerDocument = parent.ownerDocument; - node.ownerDocument.nodeMap[node.nodeId] = node; - node.depth = parent.depth + 1; - } - - node.childNodes && node.childNodes.forEach(function (child) { - linkParent(child, node); - }); - } - - function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var displayMap = { - div: 'block', - span: 'inline-block' - }; - - function registerNode(docId, node) { - var doc = getDoc(docId); - doc.nodeMap[node.nodeId] = node; - } - - var Element$1 = function () { - function Element(type) { - _classCallCheck(this, Element); - - this.nodeType = 1; - this.nodeId = uniqueId(); - this.ref = this.nodeId; - this.type = type; - this.attributes = {}; - this.style = { - display: displayMap[type] - }; - this.classStyle = {}; - this.event = {}; - this.childNodes = []; - - this.nodeName = this.type; - - this.parentNode = null; - this.nextSibling = null; - this.previousSibling = null; - this.firstChild = null; - } - - Element.prototype.appendChild = function appendChild(node) { - if (!node.parentNode) { - linkParent(node, this); - insertIndex(node, this.childNodes, this.childNodes.length, true); - - if (this.docId != undefined) { - registerNode(this.docId, node); - } - - //this.ownerDocument.addElement(this.ref, node.toJSON(), -1) - } else { - node.parentNode.removeChild(node); - - this.appendChild(node); - - return; - } - - this.firstChild = this.childNodes[0]; - }; - - Element.prototype.insertBefore = function insertBefore(node, before) { - if (!node.parentNode) { - linkParent(node, this); - var index = insertIndex(node, this.childNodes, this.childNodes.indexOf(before), true); - if (this.docId != undefined) { - registerNode(this.docId, node); - } - - //this.ownerDocument.addElement(this.ref, node.toJSON(), index) - } else { - node.parentNode.removeChild(node); - this.insertBefore(node, before); - return; - } - - this.firstChild = this.childNodes[0]; - }; - - Element.prototype.insertAfter = function insertAfter(node, after) { - if (node.parentNode && node.parentNode !== this) { - return; - } - if (node === after || node.previousSibling && node.previousSibling === after) { - return; - } - if (!node.parentNode) { - linkParent(node, this); - var index = insertIndex(node, this.childNodes, this.childNodes.indexOf(after) + 1, true); - - if (this.docId != undefined) { - registerNode(this.docId, node); - } - - //this.ownerDocument.addElement(this.ref, node.toJSON(), index) - } else { - var _index = moveIndex(node, this.childNodes, this.childNodes.indexOf(after) + 1); - - //this.ownerDocument.moveElement(node.ref, this.ref, index) - } - - this.firstChild = this.childNodes[0]; - }; - - Element.prototype.removeChild = function removeChild(node) { - if (node.parentNode) { - removeIndex(node, this.childNodes, true); - - this.ownerDocument.removeElement(node.ref); - } - - node.parentNode = null; - - this.firstChild = this.childNodes[0]; - }; - - Element.prototype.setAttribute = function setAttribute(key, value, silent) { - if (this.attributes[key] === value && silent !== false) { - return; - } - this.attributes[key] = value; - if (!silent) { - var result = {}; - result[key] = value; - - this.ownerDocument.setAttr(this.ref, result); - } - }; - - Element.prototype.removeAttribute = function removeAttribute(key) { - if (this.attributes[key]) { - delete this.attributes[key]; - } - }; - - Element.prototype.setStyle = function setStyle(key, value, silent) { - if (this.style[key] === value && silent !== false) { - return; - } - this.style[key] = value; - if (!silent && this.ownerDocument) { - var result = {}; - result[key] = value; - - this.ownerDocument.setStyles(this.ref, result); - } - }; - - Element.prototype.setStyles = function setStyles(styles) { - Object.assign(this.style, styles); - if (this.ownerDocument) { - - this.ownerDocument.setStyles(this.ref, styles); - } - }; - - Element.prototype.setClassStyle = function setClassStyle(classStyle) { - for (var key in this.classStyle) { - this.classStyle[key] = ''; - } - - Object.assign(this.classStyle, classStyle); - - this.ownerDocument.setStyles(this.ref, this.toStyle()); - }; - - Element.prototype.addEventListener = function addEventListener(type, handler) { - if (!this.event[type]) { - this.event[type] = handler; - - //this.ownerDocument.addEvent(this.ref, type) - } - }; - - Element.prototype.removeEventListener = function removeEventListener(type) { - if (this.event[type]) { - delete this.event[type]; - var doc = getDoc(this.docId); - doc.nodeMap[this.ref] && doc.nodeMap[this.ref].event && doc.nodeMap[this.ref].event[type] ? doc.nodeMap[this.ref].event[type] = null : ''; - - this.ownerDocument.removeEvent(this.ref, type); - } - }; - - Element.prototype.fireEvent = function fireEvent(type, e) { - var handler = this.event[type]; - if (handler) { - return handler.call(this, e); - } - }; - - Element.prototype.toStyle = function toStyle() { - return Object.assign({}, this.classStyle, this.style); - }; - - Element.prototype.getComputedStyle = function getComputedStyle() {}; - - Element.prototype.toJSON = function toJSON() { - var result = { - id: this.ref, - type: this.type, - docId: this.docId || -10000, - attributes: this.attributes ? this.attributes : {} - }; - result.attributes.style = this.toStyle(); - - var event = Object.keys(this.event); - if (event.length) { - result.event = event; - } - - if (this.childNodes.length) { - result.children = this.childNodes.map(function (child) { - return child.toJSON(); - }); - } - return result; - }; - - Element.prototype.replaceChild = function replaceChild(newChild, oldChild) { - this.insertBefore(newChild, oldChild); - this.removeChild(oldChild); - }; - - Element.prototype.destroy = function destroy() { - var doc = getDoc(this.docId); - - if (doc) { - delete doc.nodeMap[this.nodeId]; - } - - this.parentNode = null; - this.childNodes.forEach(function (child) { - child.destroy(); - }); - }; - - return Element; - }(); - - function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var TextNode = function () { - function TextNode(nodeValue) { - _classCallCheck$1(this, TextNode); - - this.nodeType = 3; - this.nodeId = uniqueId(); - this.ref = this.nodeId; - this.attributes = {}; - this.style = { - display: 'inline' - }; - this.classStyle = {}; - this.event = {}; - this.nodeValue = nodeValue; - this.parentNode = null; - this.nextSibling = null; - this.previousSibling = null; - this.firstChild = null; - this.type = 'text'; - } - - TextNode.prototype.setAttribute = function setAttribute(key, value, silent) { - if (this.attributes[key] === value && silent !== false) { - return; - } - this.attributes[key] = value; - if (!silent) { - var result = {}; - result[key] = value; - - this.ownerDocument.setAttr(this.ref, result); - } - }; - - TextNode.prototype.removeAttribute = function removeAttribute(key) { - if (this.attributes[key]) { - delete this.attributes[key]; - } - }; - - TextNode.prototype.toStyle = function toStyle() { - return Object.assign({}, this.classStyle, this.style); - }; - - TextNode.prototype.splitText = function splitText() {}; - - TextNode.prototype.getComputedStyle = function getComputedStyle() {}; - - TextNode.prototype.toJSON = function toJSON() { - var result = { - id: this.ref, - type: this.type, - docId: this.docId || -10000, - attributes: this.attributes ? this.attributes : {} - }; - result.attributes.style = this.toStyle(); - - var event = Object.keys(this.event); - if (event.length) { - result.event = event; - } - - return result; - }; - - TextNode.prototype.destroy = function destroy() { - var doc = getDoc(this.docId); - - if (doc) { - delete doc.nodeMap[this.nodeId]; - } - - this.parentNode = null; - }; - - return TextNode; - }(); - - function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var Document = function () { - function Document(id) { - _classCallCheck$2(this, Document); - - this.id = id; - addDoc(id, this); - this.nodeMap = {}; - this._isMockDocument = true; - } - - // createBody(type, props) { - // if (!this.body) { - // const el = new Element(type, props) - // el.didMount = true - // el.ownerDocument = this - // el.docId = this.id - // el.style.alignItems = 'flex-start' - // this.body = el - // } - - // return this.body - // } - - Document.prototype.createElement = function createElement(tagName, props) { - var el = new Element$1(tagName, props); - el.ownerDocument = this; - el.docId = this.id; - return el; - }; - - Document.prototype.createTextNode = function createTextNode(txt) { - var node = new TextNode(txt); - node.docId = this.id; - return node; - }; - - Document.prototype.destroy = function destroy() { - delete this.listener; - delete this.nodeMap; - removeDoc(this.id); - }; - - Document.prototype.addEventListener = function addEventListener(ref, type) { - //document.addEvent(this.id, ref, type) - }; - - Document.prototype.removeEventListener = function removeEventListener(ref, type) { - //document.removeEvent(this.id, ref, type) - }; - - Document.prototype.scrollTo = function scrollTo(ref, x, y, animated) { - document.scrollTo(this.id, ref, x, y, animated); - }; - - return Document; - }(); - - var mock = { - document: new Document(0) - }; - - function getGlobal() { - if (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) { - if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else if (typeof global !== 'undefined') { - return global; - } - return function () { - return this; - }(); - } - return global; - } - - /** Global options - * @public - * @namespace options {Object} - */ - var options = { - scopedStyle: true, - mapping: {}, - isWeb: true, - staticStyleMapping: {}, - doc: mock.document, - //doc: typeof document === 'object' ? document : null, - root: getGlobal(), - //styleCache :[{ctor:ctor,ctorName:ctorName,style:style}] - styleCache: [] - //componentChange(component, element) { }, - /** If `true`, `prop` changes trigger synchronous component updates. - * @name syncComponentUpdates - * @type Boolean - * @default true - */ - //syncComponentUpdates: true, - - /** Processes all created VNodes. - * @param {VNode} vnode A newly-created VNode to normalize/process - */ - //vnode(vnode) { } - - /** Hook invoked after a component is mounted. */ - //afterMount(component) { }, - - /** Hook invoked after the DOM is updated with a component's latest render. */ - //afterUpdate(component) { } - - /** Hook invoked immediately before a component is unmounted. */ - // beforeUnmount(component) { } - }; - - /* eslint-disable no-unused-vars */ - - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - function assign(target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; - } - - if (typeof Element !== 'undefined' && !Element.prototype.addEventListener) { - var runListeners = function runListeners(oEvent) { - if (!oEvent) { - oEvent = window.event; - } - for (var iLstId = 0, iElId = 0, oEvtListeners = oListeners[oEvent.type]; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { - for (iLstId; iLstId < oEvtListeners.aEvts[iElId].length; iLstId++) { - oEvtListeners.aEvts[iElId][iLstId].call(this, oEvent); - } - break; - } - } - }; - - var oListeners = {}; - - Element.prototype.addEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) { - if (oListeners.hasOwnProperty(sEventType)) { - var oEvtListeners = oListeners[sEventType]; - for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { - nElIdx = iElId;break; - } - } - if (nElIdx === -1) { - oEvtListeners.aEls.push(this); - oEvtListeners.aEvts.push([fListener]); - this["on" + sEventType] = runListeners; - } else { - var aElListeners = oEvtListeners.aEvts[nElIdx]; - if (this["on" + sEventType] !== runListeners) { - aElListeners.splice(0); - this["on" + sEventType] = runListeners; - } - for (var iLstId = 0; iLstId < aElListeners.length; iLstId++) { - if (aElListeners[iLstId] === fListener) { - return; - } - } - aElListeners.push(fListener); - } - } else { - oListeners[sEventType] = { aEls: [this], aEvts: [[fListener]] }; - this["on" + sEventType] = runListeners; - } - }; - Element.prototype.removeEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) { - if (!oListeners.hasOwnProperty(sEventType)) { - return; - } - var oEvtListeners = oListeners[sEventType]; - for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { - nElIdx = iElId;break; - } - } - if (nElIdx === -1) { - return; - } - for (var iLstId = 0, aElListeners = oEvtListeners.aEvts[nElIdx]; iLstId < aElListeners.length; iLstId++) { - if (aElListeners[iLstId] === fListener) { - aElListeners.splice(iLstId, 1); - } - } - }; - } - - if (typeof Object.create !== 'function') { - Object.create = function (proto, propertiesObject) { - if (typeof proto !== 'object' && typeof proto !== 'function') { - throw new TypeError('Object prototype may only be an Object: ' + proto); - } else if (proto === null) { - throw new Error("This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument."); - } - - // if (typeof propertiesObject != 'undefined') { - // throw new Error("This browser's implementation of Object.create is a shim and doesn't support a second argument."); - // } - - function F() {} - F.prototype = proto; - - return new F(); - }; - } - - if (!String.prototype.trim) { - String.prototype.trim = function () { - return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - }; - } - - /** - * Copy all properties from `props` onto `obj`. - * @param {Object} obj Object onto which properties should be copied. - * @param {Object} props Object from which to copy properties. - * @returns obj - * @private - */ - function extend(obj, props) { - for (var i in props) { - obj[i] = props[i]; - }return obj; - } - - /** Invoke or update a ref, depending on whether it is a function or object ref. - * @param {object|function} [ref=null] - * @param {any} [value] - */ - function applyRef(ref, value) { - if (ref) { - if (typeof ref == 'function') ref(value);else ref.current = value; - } - } - - /** - * Call a function asynchronously, as soon as possible. Makes - * use of HTML Promise to schedule the callback if available, - * otherwise falling back to `setTimeout` (mainly for IE<11). - * - * @param {Function} callback - */ - - var usePromise = typeof Promise == 'function'; - - // for native - if (typeof document !== 'object' && typeof global !== 'undefined' && global.__config__) { - if (global.__config__.platform === 'android') { - usePromise = true; - } else { - var systemVersion = global.__config__.systemVersion && global.__config__.systemVersion.split('.')[0] || 0; - if (systemVersion > 8) { - usePromise = true; - } - } - } - - var defer = usePromise ? Promise.resolve().then.bind(Promise.resolve()) : setTimeout; - - function isArray(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - } - - function nProps(props) { - if (!props || isArray(props)) return {}; - var result = {}; - Object.keys(props).forEach(function (key) { - result[key] = props[key].value; - }); - return result; - } - - function getUse(data, paths) { - var obj = []; - paths.forEach(function (path, index) { - var isPath = typeof path === 'string'; - if (isPath) { - obj[index] = getTargetByPath(data, path); - } else { - var key = Object.keys(path)[0]; - var value = path[key]; - if (typeof value === 'string') { - obj[index] = getTargetByPath(data, value); - } else { - var tempPath = value[0]; - if (typeof tempPath === 'string') { - var tempVal = getTargetByPath(data, tempPath); - obj[index] = value[1] ? value[1](tempVal) : tempVal; - } else { - var args = []; - tempPath.forEach(function (path) { - args.push(getTargetByPath(data, path)); - }); - obj[index] = value[1].apply(null, args); - } - } - obj[key] = obj[index]; - } - }); - return obj; - } - - function getTargetByPath(origin, path) { - var arr = path.replace(/]/g, '').replace(/\[/g, '.').split('.'); - var current = origin; - for (var i = 0, len = arr.length; i < len; i++) { - current = current[arr[i]]; - } - return current; - } - - /** Managed queue of dirty components to be re-rendered */ - - var items = []; - - function enqueueRender(component) { - if (items.push(component) == 1) { - (options.debounceRendering || defer)(rerender); - } - } - - /** Rerender all enqueued dirty components */ - function rerender() { - var p = void 0; - while (p = items.pop()) { - renderComponent(p); - } - } - - var mapping = options.mapping; - /** - * Check if two nodes are equivalent. - * - * @param {Node} node DOM Node to compare - * @param {VNode} vnode Virtual DOM node to compare - * @param {boolean} [hydrating=false] If true, ignores component constructors when comparing. - * @private - */ - function isSameNodeType(node, vnode, hydrating) { - if (typeof vnode === 'string' || typeof vnode === 'number') { - return node.splitText !== undefined; - } - if (typeof vnode.nodeName === 'string') { - var ctor = mapping[vnode.nodeName]; - if (ctor) { - return hydrating || node._componentConstructor === ctor; - } - return !node._componentConstructor && isNamedNode(node, vnode.nodeName); - } - return hydrating || node._componentConstructor === vnode.nodeName; - } - - /** - * Check if an Element has a given nodeName, case-insensitively. - * - * @param {Element} node A DOM Element to inspect the name of. - * @param {String} nodeName Unnormalized name to compare against. - */ - function isNamedNode(node, nodeName) { - return node.normalizedNodeName === nodeName || node.nodeName.toLowerCase() === nodeName.toLowerCase(); - } - - /** - * Reconstruct Component-style `props` from a VNode. - * Ensures default/fallback values from `defaultProps`: - * Own-properties of `defaultProps` not present in `vnode.attributes` are added. - * - * @param {VNode} vnode - * @returns {Object} props - */ - function getNodeProps(vnode) { - var props = extend({}, vnode.attributes); - props.children = vnode.children; - - var defaultProps = vnode.nodeName.defaultProps; - if (defaultProps !== undefined) { - for (var i in defaultProps) { - if (props[i] === undefined) { - props[i] = defaultProps[i]; - } - } - } - - return props; - } - - /** Create an element with the given nodeName. - * @param {String} nodeName - * @param {Boolean} [isSvg=false] If `true`, creates an element within the SVG namespace. - * @returns {Element} node - */ - function createNode(nodeName, isSvg) { - var node = isSvg ? options.doc.createElementNS('http://www.w3.org/2000/svg', nodeName) : options.doc.createElement(nodeName); - node.normalizedNodeName = nodeName; - return node; - } - - function parseCSSText(cssText) { - var cssTxt = cssText.replace(/\/\*(.|\s)*?\*\//g, ' ').replace(/\s+/g, ' '); - var style = {}, - _ref = cssTxt.match(/ ?(.*?) ?{([^}]*)}/) || [a, b, cssTxt], - a = _ref[0], - b = _ref[1], - rule = _ref[2]; - - var cssToJs = function cssToJs(s) { - return s.replace(/\W+\w/g, function (match) { - return match.slice(-1).toUpperCase(); - }); - }; - var properties = rule.split(';').map(function (o) { - return o.split(':').map(function (x) { - return x && x.trim(); - }); - }); - for (var _iterator = properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref3; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref3 = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref3 = _i.value; - } - - var _ref2 = _ref3; - var property = _ref2[0]; - var value = _ref2[1]; - style[cssToJs(property)] = value; - }return style; - } - - /** Remove a child node from its parent if attached. - * @param {Element} node The node to remove - */ - function removeNode(node) { - var parentNode = node.parentNode; - if (parentNode) parentNode.removeChild(node); - } - - /** Set a named attribute on the given Node, with special behavior for some names and event handlers. - * If `value` is `null`, the attribute/handler will be removed. - * @param {Element} node An element to mutate - * @param {string} name The name/key to set, such as an event or attribute name - * @param {any} old The last value that was set for this name/node pair - * @param {any} value An attribute value, such as a function to be used as an event handler - * @param {Boolean} isSvg Are we currently diffing inside an svg? - * @private - */ - function setAccessor(node, name, old, value, isSvg) { - if (name === 'className') name = 'class'; - - if (name === 'key') { - // ignore - } else if (name === 'ref') { - applyRef(old, null); - applyRef(value, node); - } else if (name === 'class' && !isSvg) { - node.className = value || ''; - } else if (name === 'style') { - if (options.isWeb) { - if (!value || typeof value === 'string' || typeof old === 'string') { - node.style.cssText = value || ''; - } - if (value && typeof value === 'object') { - if (typeof old !== 'string') { - for (var i in old) { - if (!(i in value)) node.style[i] = ''; - } - } - for (var _i2 in value) { - node.style[_i2] = typeof value[_i2] === 'number' && IS_NON_DIMENSIONAL.test(_i2) === false ? value[_i2] + 'px' : value[_i2]; - } - } - } else { - var oldJson = old, - currentJson = value; - if (typeof old === 'string') { - oldJson = parseCSSText(old); - } - if (typeof value == 'string') { - currentJson = parseCSSText(value); - } - - var result = {}, - changed = false; - - if (oldJson) { - for (var key in oldJson) { - if (typeof currentJson == 'object' && !(key in currentJson)) { - result[key] = ''; - changed = true; - } - } - - for (var ckey in currentJson) { - if (currentJson[ckey] !== oldJson[ckey]) { - result[ckey] = currentJson[ckey]; - changed = true; - } - } - - if (changed) { - node.setStyles(result); - } - } else { - node.setStyles(currentJson); - } - } - } else if (name === 'dangerouslySetInnerHTML') { - if (value) node.innerHTML = value.__html || ''; - } else if (name[0] == 'o' && name[1] == 'n') { - var useCapture = name !== (name = name.replace(/Capture$/, '')); - name = name.toLowerCase().substring(2); - if (value) { - if (!old) { - node.addEventListener(name, eventProxy, useCapture); - if (name == 'tap') { - node.addEventListener('touchstart', touchStart, useCapture); - node.addEventListener('touchend', touchEnd, useCapture); - } - } - } else { - node.removeEventListener(name, eventProxy, useCapture); - if (name == 'tap') { - node.removeEventListener('touchstart', touchStart, useCapture); - node.removeEventListener('touchend', touchEnd, useCapture); - } - } - (node._listeners || (node._listeners = {}))[name] = value; - } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) { - setProperty(node, name, value == null ? '' : value); - if (value == null || value === false) node.removeAttribute(name); - } else { - var ns = isSvg && name !== (name = name.replace(/^xlink:?/, '')); - if (value == null || value === false) { - if (ns) node.removeAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase());else node.removeAttribute(name); - } else if (typeof value !== 'function') { - if (ns) node.setAttributeNS('http://www.w3.org/1999/xlink', name.toLowerCase(), value);else node.setAttribute(name, value); - } - } - } - - /** Attempt to set a DOM property to the given value. - * IE & FF throw for certain property-value combinations. - */ - function setProperty(node, name, value) { - try { - node[name] = value; - } catch (e) {} - } - - /** Proxy an event to hooked event handlers - * @private - */ - function eventProxy(e) { - return this._listeners[e.type](options.event && options.event(e) || e); - } - - function touchStart(e) { - this.___touchX = e.touches[0].pageX; - this.___touchY = e.touches[0].pageY; - this.___scrollTop = document.body.scrollTop; - } - - function touchEnd(e) { - if (Math.abs(e.changedTouches[0].pageX - this.___touchX) < 30 && Math.abs(e.changedTouches[0].pageY - this.___touchY) < 30 && Math.abs(document.body.scrollTop - this.___scrollTop) < 30) { - this.dispatchEvent(new CustomEvent('tap', { detail: e })); - } - } - - function draw(res) { - console.log(res); - return document.createElement('canvas'); - } - - /** Queue of components that have been mounted and are awaiting componentDidMount */ - var mounts = []; - - /** Diff recursion count, used to track the end of the diff cycle. */ - var diffLevel = 0; - - /** Global flag indicating if the diff is currently within an SVG */ - var isSvgMode = false; - - /** Global flag indicating if the diff is performing hydration */ - var hydrating = false; - - /** Invoke queued componentDidMount lifecycle methods */ - function flushMounts() { - var c = void 0; - while (c = mounts.pop()) { - if (options.afterMount) options.afterMount(c); - if (c.installed) c.installed(); - } - } - - /** Apply differences in a given vnode (and it's deep children) to a real DOM Node. - * @param {Element} [dom=null] A DOM node to mutate into the shape of the `vnode` - * @param {VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure - * @returns {Element} dom The created/mutated element - * @private - */ - function diff(dom, vnode, context, mountAll, parent, componentRoot, fromRender) { - // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff) - if (!diffLevel++) { - // when first starting the diff, check if we're diffing an SVG or within an SVG - isSvgMode = parent != null && parent.ownerSVGElement !== undefined; - - // hydration is indicated by the existing element to be diffed not having a prop cache - hydrating = dom != null && !(ATTR_KEY in dom); - } - var ret = void 0; - - if (isArray(vnode)) { - vnode = { - nodeName: 'span', - children: vnode - }; - } - - ret = idiff(dom, vnode, context, mountAll, componentRoot); - // append the element if its a new parent - if (parent && ret.parentNode !== parent) { - if (fromRender) { - parent.appendChild(draw(ret)); - } else { - parent.appendChild(ret); - } - } - - // diffLevel being reduced to 0 means we're exiting the diff - if (! --diffLevel) { - hydrating = false; - // invoke queued componentDidMount lifecycle methods - if (!componentRoot) flushMounts(); - } - - return ret; - } - - /** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */ - function idiff(dom, vnode, context, mountAll, componentRoot) { - var out = dom, - prevSvgMode = isSvgMode; - - // empty values (null, undefined, booleans) render as empty Text nodes - if (vnode == null || typeof vnode === 'boolean') vnode = ''; - - // If the VNode represents a Component, perform a component diff: - var vnodeName = vnode.nodeName; - if (options.mapping[vnodeName]) { - vnode.nodeName = options.mapping[vnodeName]; - return buildComponentFromVNode(dom, vnode, context, mountAll); - } - if (typeof vnodeName == 'function') { - return buildComponentFromVNode(dom, vnode, context, mountAll); - } - - // Fast case: Strings & Numbers create/update Text nodes. - if (typeof vnode === 'string' || typeof vnode === 'number') { - // update if it's already a Text node: - if (dom && dom.splitText !== undefined && dom.parentNode && (!dom._component || componentRoot)) { - /* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */ - if (dom.nodeValue != vnode) { - dom.nodeValue = vnode; - } - } else { - // it wasn't a Text node: replace it with one and recycle the old Element - out = options.doc.createTextNode(vnode); - if (dom) { - if (dom.parentNode) dom.parentNode.replaceChild(out, dom); - recollectNodeTree(dom, true); - } - } - - //ie8 error - try { - out[ATTR_KEY] = true; - } catch (e) {} - - return out; - } - - // Tracks entering and exiting SVG namespace when descending through the tree. - isSvgMode = vnodeName === 'svg' ? true : vnodeName === 'foreignObject' ? false : isSvgMode; - - // If there's no existing element or it's the wrong type, create a new one: - vnodeName = String(vnodeName); - if (!dom || !isNamedNode(dom, vnodeName)) { - out = createNode(vnodeName, isSvgMode); - - if (dom) { - // move children into the replacement node - while (dom.firstChild) { - out.appendChild(dom.firstChild); - } // if the previous Element was mounted into the DOM, replace it inline - if (dom.parentNode) dom.parentNode.replaceChild(out, dom); - - // recycle the old element (skips non-Element node types) - recollectNodeTree(dom, true); - } - } - - var fc = out.firstChild, - props = out[ATTR_KEY], - vchildren = vnode.children; - - if (props == null) { - props = out[ATTR_KEY] = {}; - for (var a = out.attributes, i = a.length; i--;) { - props[a[i].name] = a[i].value; - } - } - - // Optimization: fast-path for elements containing a single TextNode: - if (!hydrating && vchildren && vchildren.length === 1 && typeof vchildren[0] === 'string' && fc != null && fc.splitText !== undefined && fc.nextSibling == null) { - if (fc.nodeValue != vchildren[0]) { - fc.nodeValue = vchildren[0]; - //update rendering obj - fc._renderText.text = fc.nodeValue; - } - } - // otherwise, if there are existing or new children, diff them: - else if (vchildren && vchildren.length || fc != null) { - innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null); - } - - // Apply attributes/props from VNode to the DOM Element: - diffAttributes(out, vnode.attributes, props); - - // restore previous SVG mode: (in case we're exiting an SVG namespace) - isSvgMode = prevSvgMode; - - return out; - } - - /** Apply child and attribute changes between a VNode and a DOM Node to the DOM. - * @param {Element} dom Element whose children should be compared & mutated - * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes` - * @param {Object} context Implicitly descendant context object (from most recent `getChildContext()`) - * @param {Boolean} mountAll - * @param {Boolean} isHydrating If `true`, consumes externally created elements similar to hydration - */ - function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) { - var originalChildren = dom.childNodes, - children = [], - keyed = {}, - keyedLen = 0, - min = 0, - len = originalChildren.length, - childrenLen = 0, - vlen = vchildren ? vchildren.length : 0, - j = void 0, - c = void 0, - f = void 0, - vchild = void 0, - child = void 0; - - // Build up a map of keyed children and an Array of unkeyed children: - if (len !== 0) { - for (var i = 0; i < len; i++) { - var _child = originalChildren[i], - props = _child[ATTR_KEY], - key = vlen && props ? _child._component ? _child._component.__key : props.key : null; - if (key != null) { - keyedLen++; - keyed[key] = _child; - } else if (props || (_child.splitText !== undefined ? isHydrating ? _child.nodeValue.trim() : true : isHydrating)) { - children[childrenLen++] = _child; - } - } - } - - if (vlen !== 0) { - for (var _i = 0; _i < vlen; _i++) { - vchild = vchildren[_i]; - child = null; - - // attempt to find a node based on key matching - var _key = vchild.key; - if (_key != null) { - if (keyedLen && keyed[_key] !== undefined) { - child = keyed[_key]; - keyed[_key] = undefined; - keyedLen--; - } - } - // attempt to pluck a node of the same type from the existing children - else if (!child && min < childrenLen) { - for (j = min; j < childrenLen; j++) { - if (children[j] !== undefined && isSameNodeType(c = children[j], vchild, isHydrating)) { - child = c; - children[j] = undefined; - if (j === childrenLen - 1) childrenLen--; - if (j === min) min++; - break; - } - } - } - - // morph the matched/found/created DOM child to match vchild (deep) - child = idiff(child, vchild, context, mountAll); - - f = originalChildren[_i]; - if (child && child !== dom && child !== f) { - if (f == null) { - dom.appendChild(child); - } else if (child === f.nextSibling) { - removeNode(f); - } else { - dom.insertBefore(child, f); - } - } - } - } - - // remove unused keyed children: - if (keyedLen) { - for (var _i2 in keyed) { - if (keyed[_i2] !== undefined) recollectNodeTree(keyed[_i2], false); - } - } - - // remove orphaned unkeyed children: - while (min <= childrenLen) { - if ((child = children[childrenLen--]) !== undefined) recollectNodeTree(child, false); - } - } - - /** Recursively recycle (or just unmount) a node and its descendants. - * @param {Node} node DOM node to start unmount/removal from - * @param {Boolean} [unmountOnly=false] If `true`, only triggers unmount lifecycle, skips removal - */ - function recollectNodeTree(node, unmountOnly) { - var component = node._component; - if (component) { - // if node is owned by a Component, unmount that component (ends up recursing back here) - unmountComponent(component); - } else { - // If the node's VNode had a ref function, invoke it with null here. - // (this is part of the React spec, and smart for unsetting references) - if (node[ATTR_KEY] != null) applyRef(node[ATTR_KEY].ref, null); - - if (unmountOnly === false || node[ATTR_KEY] == null) { - removeNode(node); - } - - removeChildren(node); - } - } - - /** Recollect/unmount all children. - * - we use .lastChild here because it causes less reflow than .firstChild - * - it's also cheaper than accessing the .childNodes Live NodeList - */ - function removeChildren(node) { - node = node.lastChild; - while (node) { - var next = node.previousSibling; - recollectNodeTree(node, true); - node = next; - } - } - - /** Apply differences in attributes from a VNode to the given DOM Element. - * @param {Element} dom Element with attributes to diff `attrs` against - * @param {Object} attrs The desired end-state key-value attribute pairs - * @param {Object} old Current/previous attributes (from previous VNode or element's prop cache) - */ - function diffAttributes(dom, attrs, old) { - var name = void 0; - - // remove attributes no longer present on the vnode by setting them to undefined - for (name in old) { - if (!(attrs && attrs[name] != null) && old[name] != null) { - setAccessor(dom, name, old[name], old[name] = undefined, isSvgMode); - } - } - - // add new & update changed attributes - for (name in attrs) { - if (name !== 'children' && name !== 'innerHTML' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) { - setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode); - } - } - } - - var OBJECTTYPE = '[object Object]'; - var ARRAYTYPE = '[object Array]'; - - function define(name, ctor) { - options.mapping[name] = ctor; - if (ctor.use) { - ctor.updatePath = getPath(ctor.use); - } else if (ctor.data) { - //Compatible with older versions - ctor.updatePath = getUpdatePath(ctor.data); - } - } - - function getPath(obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - var result = {}; - obj.forEach(function (item) { - if (typeof item === 'string') { - result[item] = true; - } else { - var tempPath = item[Object.keys(item)[0]]; - if (typeof tempPath === 'string') { - result[tempPath] = true; - } else { - if (typeof tempPath[0] === 'string') { - result[tempPath[0]] = true; - } else { - tempPath[0].forEach(function (path) { - return result[path] = true; - }); - } - } - } - }); - return result; - } else { - return getUpdatePath(obj); - } - } - - function getUpdatePath(data) { - var result = {}; - dataToPath(data, result); - return result; - } - - function dataToPath(data, result) { - Object.keys(data).forEach(function (key) { - result[key] = true; - var type = Object.prototype.toString.call(data[key]); - if (type === OBJECTTYPE) { - _objToPath(data[key], key, result); - } else if (type === ARRAYTYPE) { - _arrayToPath(data[key], key, result); - } - }); - } - - function _objToPath(data, path, result) { - Object.keys(data).forEach(function (key) { - result[path + '.' + key] = true; - delete result[path]; - var type = Object.prototype.toString.call(data[key]); - if (type === OBJECTTYPE) { - _objToPath(data[key], path + '.' + key, result); - } else if (type === ARRAYTYPE) { - _arrayToPath(data[key], path + '.' + key, result); - } - }); - } - - function _arrayToPath(data, path, result) { - data.forEach(function (item, index) { - result[path + '[' + index + ']'] = true; - delete result[path]; - var type = Object.prototype.toString.call(item); - if (type === OBJECTTYPE) { - _objToPath(item, path + '[' + index + ']', result); - } else if (type === ARRAYTYPE) { - _arrayToPath(item, path + '[' + index + ']', result); - } - }); - } - - /** Retains a pool of Components for re-use, keyed on component name. - * Note: since component names are not unique or even necessarily available, these are primarily a form of sharding. - * @private - */ - var components = {}; - - /** Reclaim a component for later re-use by the recycler. */ - function collectComponent(component) { - var name = component.constructor.name;(components[name] || (components[name] = [])).push(component); - } - - /** Create a component. Normalizes differences between PFC's and classful Components. */ - function createComponent(Ctor, props, context, vnode) { - var list = components[Ctor.name], - inst = void 0; - - if (Ctor.prototype && Ctor.prototype.render) { - inst = new Ctor(props, context); - Component.call(inst, props, context); - } else { - inst = new Component(props, context); - inst.constructor = Ctor; - inst.render = doRender; - } - vnode && (inst.scopedCssAttr = vnode.css); - - if (inst.store && inst.store.data) { - if (inst.constructor.use) { - inst.use = getUse(inst.store.data, inst.constructor.use); - inst.store.instances.push(inst); - } else if (inst.initUse) { - var use = inst.initUse(); - inst._updatePath = getPath(use); - inst.use = getUse(inst.store.data, use); - inst.store.instances.push(inst); - } - } - - if (list) { - for (var i = list.length; i--;) { - if (list[i].constructor === Ctor) { - inst.nextBase = list[i].nextBase; - list.splice(i, 1); - break; - } - } - } - return inst; - } - - /** The `.render()` method for a PFC backing instance. */ - function doRender(props, data, context) { - return this.constructor(props, context); - } - - var styleId = 0; - - function getCtorName(ctor) { - for (var i = 0, len = options.styleCache.length; i < len; i++) { - var item = options.styleCache[i]; - - if (item.ctor === ctor) { - return item.attrName; - } - } - - var attrName = 's' + styleId; - options.styleCache.push({ ctor: ctor, attrName: attrName }); - styleId++; - - return attrName; - } - - function addScopedAttrStatic(vdom, attr) { - if (options.scopedStyle) { - scopeVdom(attr, vdom); - } - } - - function scopeVdom(attr, vdom) { - if (typeof vdom === 'object') { - vdom.attributes = vdom.attributes || {}; - vdom.attributes[attr] = ''; - vdom.css = vdom.css || {}; - vdom.css[attr] = ''; - vdom.children.forEach(function (child) { - return scopeVdom(attr, child); - }); - } - } - - function scopeHost(vdom, css) { - if (typeof vdom === 'object' && css) { - vdom.attributes = vdom.attributes || {}; - for (var key in css) { - vdom.attributes[key] = ''; - } - } - } - - /* obaa 1.0.0 - * By dntzhang - * Github: https://github.com/Tencent/omi - * MIT Licensed. - */ - - var obaa = function obaa(target, arr, callback) { - var _observe = function _observe(target, arr, callback) { - if (!target.$observer) target.$observer = this; - var $observer = target.$observer; - var eventPropArr = []; - if (obaa.isArray(target)) { - if (target.length === 0) { - target.$observeProps = {}; - target.$observeProps.$observerPath = '#'; - } - $observer.mock(target); - } - for (var prop in target) { - if (target.hasOwnProperty(prop)) { - if (callback) { - if (obaa.isArray(arr) && obaa.isInArray(arr, prop)) { - eventPropArr.push(prop); - $observer.watch(target, prop); - } else if (obaa.isString(arr) && prop == arr) { - eventPropArr.push(prop); - $observer.watch(target, prop); - } - } else { - eventPropArr.push(prop); - $observer.watch(target, prop); - } - } - } - $observer.target = target; - if (!$observer.propertyChangedHandler) $observer.propertyChangedHandler = []; - var propChanged = callback ? callback : arr; - $observer.propertyChangedHandler.push({ - all: !callback, - propChanged: propChanged, - eventPropArr: eventPropArr - }); - }; - _observe.prototype = { - onPropertyChanged: function onPropertyChanged(prop, value, oldValue, target, path) { - if (value !== oldValue && this.propertyChangedHandler) { - var rootName = obaa._getRootName(prop, path); - for (var i = 0, len = this.propertyChangedHandler.length; i < len; i++) { - var handler = this.propertyChangedHandler[i]; - if (handler.all || obaa.isInArray(handler.eventPropArr, rootName) || rootName.indexOf('Array-') === 0) { - handler.propChanged.call(this.target, prop, value, oldValue, path); - } - } - } - if (prop.indexOf('Array-') !== 0 && typeof value === 'object') { - this.watch(target, prop, target.$observeProps.$observerPath); - } - }, - mock: function mock(target) { - var self = this; - obaa.methods.forEach(function (item) { - target[item] = function () { - var old = Array.prototype.slice.call(this, 0); - var result = Array.prototype[item].apply(this, Array.prototype.slice.call(arguments)); - if (new RegExp('\\b' + item + '\\b').test(obaa.triggerStr)) { - for (var cprop in this) { - if (this.hasOwnProperty(cprop) && !obaa.isFunction(this[cprop])) { - self.watch(this, cprop, this.$observeProps.$observerPath); - } - } - //todo - self.onPropertyChanged('Array-' + item, this, old, this, this.$observeProps.$observerPath); - } - return result; - }; - target['pure' + item.substring(0, 1).toUpperCase() + item.substring(1)] = function () { - return Array.prototype[item].apply(this, Array.prototype.slice.call(arguments)); - }; - }); - }, - watch: function watch(target, prop, path) { - if (prop === '$observeProps' || prop === '$observer') return; - if (obaa.isFunction(target[prop])) return; - if (!target.$observeProps) target.$observeProps = {}; - if (path !== undefined) { - target.$observeProps.$observerPath = path; - } else { - target.$observeProps.$observerPath = '#'; - } - var self = this; - var currentValue = target.$observeProps[prop] = target[prop]; - Object.defineProperty(target, prop, { - get: function get() { - return this.$observeProps[prop]; - }, - set: function set(value) { - var old = this.$observeProps[prop]; - this.$observeProps[prop] = value; - self.onPropertyChanged(prop, value, old, this, target.$observeProps.$observerPath); - } - }); - if (typeof currentValue == 'object') { - if (obaa.isArray(currentValue)) { - this.mock(currentValue); - if (currentValue.length === 0) { - if (!currentValue.$observeProps) currentValue.$observeProps = {}; - if (path !== undefined) { - currentValue.$observeProps.$observerPath = path; - } else { - currentValue.$observeProps.$observerPath = '#'; - } - } - } - for (var cprop in currentValue) { - if (currentValue.hasOwnProperty(cprop)) { - this.watch(currentValue, cprop, target.$observeProps.$observerPath + '-' + prop); - } - } - } - } - }; - return new _observe(target, arr, callback); - }; - - obaa.methods = ['concat', 'copyWithin', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values', 'size']; - obaa.triggerStr = ['concat', 'copyWithin', 'fill', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'size'].join(','); - - obaa.isArray = function (obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; - - obaa.isString = function (obj) { - return typeof obj === 'string'; - }; - - obaa.isInArray = function (arr, item) { - for (var i = arr.length; --i > -1;) { - if (item === arr[i]) return true; - } - return false; - }; - - obaa.isFunction = function (obj) { - return Object.prototype.toString.call(obj) == '[object Function]'; - }; - - obaa._getRootName = function (prop, path) { - if (path === '#') { - return prop; - } - return path.split('-')[1]; - }; - - obaa.add = function (obj, prop) { - var $observer = obj.$observer; - $observer.watch(obj, prop); - }; - - obaa.set = function (obj, prop, value, exec) { - if (!exec) { - obj[prop] = value; - } - var $observer = obj.$observer; - $observer.watch(obj, prop); - if (exec) { - obj[prop] = value; - } - }; - - Array.prototype.size = function (length) { - this.length = length; - }; - - var callbacks = []; - var nextTickCallback = []; - - function fireTick() { - callbacks.forEach(function (item) { - item.fn.call(item.scope); - }); - - nextTickCallback.forEach(function (nextItem) { - nextItem.fn.call(nextItem.scope); - }); - nextTickCallback.length = 0; - } - - function proxyUpdate(ele) { - var timeout = null; - obaa(ele.data, function () { - if (ele._willUpdate) { - return; - } - if (ele.constructor.mergeUpdate) { - clearTimeout(timeout); - - timeout = setTimeout(function () { - ele.update(); - fireTick(); - }, 0); - } else { - ele.update(); - fireTick(); - } - }); - } - - /** Set a component's `props` (generally derived from JSX attributes). - * @param {Object} props - * @param {Object} [opts] - * @param {boolean} [opts.renderSync=false] If `true` and {@link options.syncComponentUpdates} is `true`, triggers synchronous rendering. - * @param {boolean} [opts.render=true] If `false`, no render will be triggered. - */ - function setComponentProps(component, props, opts, context, mountAll) { - if (component._disable) return; - component._disable = true; - - if (component.__ref = props.ref) delete props.ref; - if (component.__key = props.key) delete props.key; - - if (!component.base || mountAll) { - if (component.beforeInstall) component.beforeInstall(); - if (component.install) component.install(); - if (component.constructor.observe) { - proxyUpdate(component); - } - } - - if (context && context !== component.context) { - if (!component.prevContext) component.prevContext = component.context; - component.context = context; - } - - if (!component.prevProps) component.prevProps = component.props; - component.props = props; - - component._disable = false; - - if (opts !== NO_RENDER) { - if (opts === SYNC_RENDER || options.syncComponentUpdates !== false || !component.base) { - renderComponent(component, SYNC_RENDER, mountAll); - } else { - enqueueRender(component); - } - } - - applyRef(component.__ref, component); - } - - function shallowComparison(old, attrs) { - var name = void 0; - - for (name in old) { - if (attrs[name] == null && old[name] != null) { - return true; - } - } - - if (old.children.length > 0 || attrs.children.length > 0) { - return true; - } - - for (name in attrs) { - if (name != 'children') { - var type = typeof attrs[name]; - if (type == 'function' || type == 'object') { - return true; - } else if (attrs[name] != old[name]) { - return true; - } - } - } - } - - /** Render a Component, triggering necessary lifecycle events and taking High-Order Components into account. - * @param {Component} component - * @param {Object} [opts] - * @param {boolean} [opts.build=false] If `true`, component will build and store a DOM node if not already associated with one. - * @private - */ - function renderComponent(component, opts, mountAll, isChild) { - if (component._disable) return; - - var props = component.props, - data = component.data, - context = component.context, - previousProps = component.prevProps || props, - previousState = component.prevState || data, - previousContext = component.prevContext || context, - isUpdate = component.base, - nextBase = component.nextBase, - initialBase = isUpdate || nextBase, - initialChildComponent = component._component, - skip = false, - rendered = void 0, - inst = void 0, - cbase = void 0; - - // if updating - if (isUpdate) { - component.props = previousProps; - component.data = previousState; - component.context = previousContext; - if (component.store || opts == FORCE_RENDER || shallowComparison(previousProps, props)) { - var receiveResult = true; - if (component.receiveProps) { - receiveResult = component.receiveProps(props, previousProps); - } - if (receiveResult !== false) { - skip = false; - if (component.beforeUpdate) { - component.beforeUpdate(props, data, context); - } - } else { - skip = true; - } - } else { - skip = true; - } - component.props = props; - component.data = data; - component.context = context; - } - - component.prevProps = component.prevState = component.prevContext = component.nextBase = null; - - if (!skip) { - component.beforeRender && component.beforeRender(); - rendered = component.render(props, data, context); - - //don't rerender - if (component.constructor.css || component.css) { - addScopedAttrStatic(rendered, '_s' + getCtorName(component.constructor)); - } - - scopeHost(rendered, component.scopedCssAttr); - - // context to pass to the child, can be updated via (grand-)parent component - if (component.getChildContext) { - context = extend(extend({}, context), component.getChildContext()); - } - - var childComponent = rendered && rendered.nodeName, - toUnmount = void 0, - base = void 0, - ctor = options.mapping[childComponent]; - - if (ctor) { - // set up high order component link - - var childProps = getNodeProps(rendered); - inst = initialChildComponent; - - if (inst && inst.constructor === ctor && childProps.key == inst.__key) { - setComponentProps(inst, childProps, SYNC_RENDER, context, false); - } else { - toUnmount = inst; - - component._component = inst = createComponent(ctor, childProps, context); - inst.nextBase = inst.nextBase || nextBase; - inst._parentComponent = component; - setComponentProps(inst, childProps, NO_RENDER, context, false); - renderComponent(inst, SYNC_RENDER, mountAll, true); - } - - base = inst.base; - } else { - cbase = initialBase; - - // destroy high order component link - toUnmount = initialChildComponent; - if (toUnmount) { - cbase = component._component = null; - } - - if (initialBase || opts === SYNC_RENDER) { - if (cbase) cbase._component = null; - base = diff(cbase, rendered, context, mountAll || !isUpdate, initialBase && initialBase.parentNode, true); - } - } - - if (initialBase && base !== initialBase && inst !== initialChildComponent) { - var baseParent = initialBase.parentNode; - if (baseParent && base !== baseParent) { - baseParent.replaceChild(base, initialBase); - - if (!toUnmount) { - initialBase._component = null; - recollectNodeTree(initialBase, false); - } - } - } - - if (toUnmount) { - unmountComponent(toUnmount); - } - - component.base = base; - if (base && !isChild) { - var componentRef = component, - t = component; - while (t = t._parentComponent) { - (componentRef = t).base = base; - } - base._component = componentRef; - base._componentConstructor = componentRef.constructor; - } - } - - if (!isUpdate || mountAll) { - mounts.unshift(component); - } else if (!skip) { - // Ensure that pending componentDidMount() hooks of child components - // are called before the componentDidUpdate() hook in the parent. - // Note: disabled as it causes duplicate hooks, see https://github.com/developit/preact/issues/750 - // flushMounts(); - - if (component.afterUpdate) { - //deprecated - component.afterUpdate(previousProps, previousState, previousContext); - } - if (component.updated) { - component.updated(previousProps, previousState, previousContext); - } - if (options.afterUpdate) options.afterUpdate(component); - } - - if (component._renderCallbacks != null) { - while (component._renderCallbacks.length) { - component._renderCallbacks.pop().call(component); - } - } - - if (!diffLevel && !isChild) flushMounts(); - } - - /** Apply the Component referenced by a VNode to the DOM. - * @param {Element} dom The DOM node to mutate - * @param {VNode} vnode A Component-referencing VNode - * @returns {Element} dom The created/mutated element - * @private - */ - function buildComponentFromVNode(dom, vnode, context, mountAll) { - var c = dom && dom._component, - originalComponent = c, - oldDom = dom, - isDirectOwner = c && dom._componentConstructor === vnode.nodeName, - isOwner = isDirectOwner, - props = getNodeProps(vnode); - while (c && !isOwner && (c = c._parentComponent)) { - isOwner = c.constructor === vnode.nodeName; - } - - if (c && isOwner && (!mountAll || c._component)) { - setComponentProps(c, props, ASYNC_RENDER, context, mountAll); - dom = c.base; - } else { - if (originalComponent && !isDirectOwner) { - unmountComponent(originalComponent); - dom = oldDom = null; - } - - c = createComponent(vnode.nodeName, props, context, vnode); - if (dom && !c.nextBase) { - c.nextBase = dom; - // passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229: - oldDom = null; - } - setComponentProps(c, props, SYNC_RENDER, context, mountAll); - dom = c.base; - - if (oldDom && dom !== oldDom) { - oldDom._component = null; - recollectNodeTree(oldDom, false); - } - } - - return dom; - } - - /** Remove a component from the DOM and recycle it. - * @param {Component} component The Component instance to unmount - * @private - */ - function unmountComponent(component) { - if (options.beforeUnmount) options.beforeUnmount(component); - - var base = component.base; - - component._disable = true; - - if (component.uninstall) component.uninstall(); - - if (component.store && component.store.instances) { - for (var i = 0, len = component.store.instances.length; i < len; i++) { - if (component.store.instances[i] === component) { - component.store.instances.splice(i, 1); - break; - } - } - } - - component.base = null; - - // recursively tear down & recollect high-order component children: - var inner = component._component; - if (inner) { - unmountComponent(inner); - } else if (base) { - if (base[ATTR_KEY] != null) applyRef(base[ATTR_KEY].ref, null); - - component.nextBase = base; - - removeNode(base); - collectComponent(component); - - removeChildren(base); - } - - applyRef(component.__ref, null); - } - - var _class, _temp; - - function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - var id = 0; - - var Component = (_temp = _class = function () { - function Component(props, store) { - _classCallCheck$3(this, Component); - - this.props = assign(nProps(this.constructor.props), this.constructor.defaultProps, props); - this.elementId = id++; - this.data = this.constructor.data || this.data || {}; - - this._preCss = null; - - this.store = store; - } - - Component.prototype.update = function update(callback) { - this._willUpdate = true; - if (callback) (this._renderCallbacks = this._renderCallbacks || []).push(callback); - renderComponent(this, FORCE_RENDER); - if (options.componentChange) options.componentChange(this, this.base); - this._willUpdate = false; - }; - - Component.prototype.fire = function fire(type, data) { - var _this = this; - - Object.keys(this.props).every(function (key) { - if ('on' + type.toLowerCase() === key.toLowerCase()) { - _this.props[key]({ detail: data }); - return false; - } - return true; - }); - }; - - Component.prototype.render = function render() {}; - - return Component; - }(), _class.is = 'WeElement', _temp); - - /** Render JSX into a `parent` Element. - * @param {VNode} vnode A (JSX) VNode to render - * @param {Element} parent DOM element to render into - * @param {object} [store] - * @public - */ - function render(vnode, parent, store, empty, merge) { - parent = typeof parent === 'string' ? document.querySelector(parent) : parent; - - if (empty) { - while (parent.firstChild) { - parent.removeChild(parent.firstChild); - } - } - - if (merge) { - merge = typeof merge === 'string' ? document.querySelector(merge) : merge; - } - - return diff(merge, vnode, store, false, parent, false, true); - } - - function tag(name) { - return function (target) { - define(name, target); - }; - } - - var WeElement = Component; - var root = getGlobal$1(); - var omiax = { - h: h, - tag: tag, - define: define, - Component: Component, - render: render, - WeElement: WeElement, - options: options - }; - - root.Omi = omiax; - root.omi = omiax; - root.omiax = omiax; - root.omiax.version = '0.0.0'; - - function getGlobal$1() { - if (typeof global !== 'object' || !global || global.Math !== Math || global.Array !== Array) { - if (typeof self !== 'undefined') { - return self; - } else if (typeof window !== 'undefined') { - return window; - } else if (typeof global !== 'undefined') { - return global; - } - return function () { - return this; - }(); - } - return global; - } - - function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - - function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - - function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } - - define('my-counter', function (_WeElement) { - _inherits(_class2, _WeElement); - - function _class2() { - var _temp, _this, _ret; - - _classCallCheck$4(this, _class2); - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return _ret = (_temp = (_this = _possibleConstructorReturn(this, _WeElement.call.apply(_WeElement, [this].concat(args))), _this), _this.count = 1, _this.sub = function () { - _this.count--; - _this.update(); - }, _this.add = function () { - _this.count++; - _this.update(); - }, _temp), _possibleConstructorReturn(_this, _ret); - } - - _class2.prototype.render = function render$$1() { - return Omi.h( - 'div', - null, - Omi.h( - 'button', - { onClick: this.sub }, - '-' - ), - Omi.h( - 'span', - { style: { - color: 'red' - } }, - this.count - ), - Omi.h( - 'button', - { onClick: this.add }, - '+' - ) - ); - }; - - return _class2; - }(WeElement)); - - render(Omi.h('my-counter', null), 'body'); - -}()); -//# sourceMappingURL=b.js.map diff --git a/packages/omiax/examples/simple/b.js.map b/packages/omiax/examples/simple/b.js.map deleted file mode 100644 index cb43dfe5b..000000000 --- a/packages/omiax/examples/simple/b.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"b.js","sources":["../../src/omi/h.js","../../src/omi/constants.js","../../src/omi/mock/util.js","../../src/omi/mock/element.js","../../src/omi/mock/text-node.js","../../src/omi/mock/document.js","../../src/omi/mock/index.js","../../src/omi/options.js","../../src/omi/util.js","../../src/omi/render-queue.js","../../src/omi/vdom/index.js","../../src/omi/dom/index.js","../../src/cax/draw.js","../../src/omi/vdom/diff.js","../../src/omi/define.js","../../src/omi/vdom/component-recycler.js","../../src/omi/style.js","../../src/omi/obaa.js","../../src/omi/tick.js","../../src/omi/observe.js","../../src/omi/vdom/component.js","../../src/omi/component.js","../../src/omi/render.js","../../src/omi/tag.js","../../src/omi/omi.js","main.js"],"sourcesContent":["const stack = []\n\n/**\n * JSX/hyperscript reviver.\n * @see http://jasonformat.com/wtf-is-jsx\n * Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0\n *\n * Note: this is exported as both `h()` and `createElement()` for compatibility reasons.\n *\n * Creates a VNode (virtual DOM element). A tree of VNodes can be used as a lightweight representation\n * of the structure of a DOM tree. This structure can be realized by recursively comparing it against\n * the current _actual_ DOM structure, and applying only the differences.\n *\n * `h()`/`createElement()` accepts an element name, a list of attributes/props,\n * and optionally children to append to the element.\n *\n * @example The following DOM tree\n *\n * `
Hello!
`\n *\n * can be constructed using this function as:\n *\n * `h('div', { id: 'foo', name : 'bar' }, 'Hello!');`\n *\n * @param {string} nodeName\tAn element name. Ex: `div`, `a`, `span`, etc.\n * @param {Object} attributes\tAny attributes/props to set on the created element.\n * @param rest\t\t\tAdditional arguments are taken to be children to append. Can be infinitely nested Arrays.\n *\n * @public\n */\nexport function h(nodeName, attributes) {\n let children = [],\n lastSimple,\n child,\n simple,\n i\n for (i = arguments.length; i-- > 2; ) {\n stack.push(arguments[i])\n }\n if (attributes && attributes.children != null) {\n if (!stack.length) stack.push(attributes.children)\n delete attributes.children\n }\n while (stack.length) {\n if ((child = stack.pop()) && child.pop !== undefined) {\n for (i = child.length; i--; ) stack.push(child[i])\n } else {\n if (typeof child === 'boolean') child = null\n\n if ((simple = typeof nodeName !== 'function')) {\n if (child == null) child = ''\n else if (typeof child === 'number') child = String(child)\n else if (typeof child !== 'string') simple = false\n }\n\n if (simple && lastSimple) {\n children[children.length - 1] += child\n } else if (children.length === 0) {\n children = [child]\n } else {\n children.push(child)\n }\n\n lastSimple = simple\n }\n }\n\n let p = {}\n p.nodeName = nodeName\n p.children = children\n\tp.attributes = attributes == null ? undefined : attributes\n p.key = attributes == null ? undefined : attributes.key\n\n\n return p\n}\n","// render modes\n\nexport const NO_RENDER = 0\nexport const SYNC_RENDER = 1\nexport const FORCE_RENDER = 2\nexport const ASYNC_RENDER = 3\n\nexport const ATTR_KEY = '__omiattr_'\n\n// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i\n","let nodeId = 1\nexport function uniqueId() {\n return nodeId++\n}\n\nlet docMap = {}\n\nexport function addDoc(id, doc) {\n docMap[id] = doc\n}\n\nexport function getDoc(id) {\n return docMap[id]\n}\n\nexport function removeDoc(id) {\n delete docMap[id]\n}\n\nlet sendBridgeFlag = {}\n\nexport function getSendBridgeFlag() {\n return sendBridgeFlag\n}\n\nexport function setSendBridgeFlag(docId, flag) {\n return (sendBridgeFlag[docId] = flag)\n}\n\nexport function insertIndex(target, list, newIndex) {\n if (newIndex < 0) {\n newIndex = 0\n }\n const before = list[newIndex - 1]\n const after = list[newIndex]\n list.splice(newIndex, 0, target)\n\n before && (before.nextSibling = target)\n target.previousSibling = before\n target.nextSibling = after\n after && (after.previousSibling = target)\n\n return newIndex\n}\n\nexport function moveIndex(target, list, newIndex) {\n const index = list.indexOf(target)\n\n if (index < 0) {\n return -1\n }\n\n const before = list[index - 1]\n const after = list[index + 1]\n before && (before.nextSibling = after)\n after && (after.previousSibling = before)\n\n list.splice(index, 1)\n let newIndexAfter = newIndex\n if (index <= newIndex) {\n newIndexAfter = newIndex - 1\n }\n const beforeNew = list[newIndexAfter - 1]\n const afterNew = list[newIndexAfter]\n list.splice(newIndexAfter, 0, target)\n\n beforeNew && (beforeNew.nextSibling = target)\n target.previousSibling = beforeNew\n target.nextSibling = afterNew\n afterNew && (afterNew.previousSibling = target)\n\n if (index === newIndexAfter) {\n return -1\n }\n return newIndex\n}\n\nexport function removeIndex(target, list, changeSibling) {\n const index = list.indexOf(target)\n\n if (index < 0) {\n return\n }\n if (changeSibling) {\n const before = list[index - 1]\n const after = list[index + 1]\n before && (before.nextSibling = after)\n after && (after.previousSibling = before)\n }\n list.splice(index, 1)\n}\n\nexport function remove(target, list) {\n const index = list.indexOf(target)\n\n if (index < 0) {\n return\n }\n\n const before = list[index - 1]\n const after = list[index + 1]\n before && (before.nextSibling = after)\n after && (after.previousSibling = before)\n\n list.splice(index, 1)\n}\n\nexport function linkParent(node, parent) {\n node.parentNode = parent\n if (parent.docId) {\n node.docId = parent.docId\n node.ownerDocument = parent.ownerDocument\n node.ownerDocument.nodeMap[node.nodeId] = node\n node.depth = parent.depth + 1\n\t}\n\n node.childNodes && node.childNodes.forEach(child => {\n linkParent(child, node)\n })\n}\n\nexport function nextElement(node) {\n while (node) {\n if (node.nodeType === 1) {\n return node\n }\n node = node.nextSibling\n }\n}\n\nexport function previousElement(node) {\n while (node) {\n if (node.nodeType === 1) {\n return node\n }\n node = node.previousSibling\n }\n}\n","import {\n\tgetDoc,\n\tuniqueId,\n\tlinkParent,\n\tinsertIndex,\n\tmoveIndex,\n\tremoveIndex\n} from './util'\n\nconst displayMap = {\n\tdiv: 'block',\n\tspan: 'inline-block'\n}\n\nfunction registerNode(docId, node) {\n\tconst doc = getDoc(docId)\n\tdoc.nodeMap[node.nodeId] = node\n}\n\nexport default class Element {\n\tconstructor(type) {\n\t\tthis.nodeType = 1\n\t\tthis.nodeId = uniqueId()\n\t\tthis.ref = this.nodeId\n\t\tthis.type = type\n\t\tthis.attributes = {}\n\t\tthis.style = {\n\t\t\tdisplay: displayMap[type]\n\t\t}\n\t\tthis.classStyle = {}\n\t\tthis.event = {}\n\t\tthis.childNodes = []\n\n\t\tthis.nodeName = this.type\n\n\t\tthis.parentNode = null\n\t\tthis.nextSibling = null\n\t\tthis.previousSibling = null\n\t\tthis.firstChild = null\n\t}\n\n\tappendChild(node) {\n\t\tif (!node.parentNode) {\n\t\t\tlinkParent(node, this)\n\t\t\tinsertIndex(node, this.childNodes, this.childNodes.length, true)\n\n\t\t\tif (this.docId != undefined) {\n\t\t\t\tregisterNode(this.docId, node)\n\t\t\t}\n\n\n\t\t\t//this.ownerDocument.addElement(this.ref, node.toJSON(), -1)\n\n\t\t} else {\n\t\t\tnode.parentNode.removeChild(node)\n\n\t\t\tthis.appendChild(node)\n\n\t\t\treturn\n\t\t}\n\n\t\tthis.firstChild = this.childNodes[0]\n\n\n\t}\n\n\tinsertBefore(node, before) {\n\t\tif (!node.parentNode) {\n\t\t\tlinkParent(node, this)\n\t\t\tconst index = insertIndex(\n\t\t\t\tnode,\n\t\t\t\tthis.childNodes,\n\t\t\t\tthis.childNodes.indexOf(before),\n\t\t\t\ttrue\n\t\t\t)\n\t\t\tif (this.docId != undefined) {\n\t\t\t\tregisterNode(this.docId, node)\n\t\t\t}\n\n\n\t\t\t//this.ownerDocument.addElement(this.ref, node.toJSON(), index)\n\n\t\t} else {\n\t\t\tnode.parentNode.removeChild(node)\n\t\t\tthis.insertBefore(node, before)\n\t\t\treturn\n\t\t}\n\n\t\tthis.firstChild = this.childNodes[0]\n\t}\n\n\tinsertAfter(node, after) {\n\t\tif (node.parentNode && node.parentNode !== this) {\n\t\t\treturn\n\t\t}\n\t\tif (\n\t\t\tnode === after ||\n\t\t\t(node.previousSibling && node.previousSibling === after)\n\t\t) {\n\t\t\treturn\n\t\t}\n\t\tif (!node.parentNode) {\n\t\t\tlinkParent(node, this)\n\t\t\tconst index = insertIndex(\n\t\t\t\tnode,\n\t\t\t\tthis.childNodes,\n\t\t\t\tthis.childNodes.indexOf(after) + 1,\n\t\t\t\ttrue\n\t\t\t)\n\n\t\t\tif (this.docId != undefined) {\n\t\t\t\tregisterNode(this.docId, node)\n\t\t\t}\n\n\t\t\t//this.ownerDocument.addElement(this.ref, node.toJSON(), index)\n\n\t\t} else {\n\t\t\tconst index = moveIndex(\n\t\t\t\tnode,\n\t\t\t\tthis.childNodes,\n\t\t\t\tthis.childNodes.indexOf(after) + 1\n\t\t\t)\n\n\t\t\t//this.ownerDocument.moveElement(node.ref, this.ref, index)\n\n\t\t}\n\n\t\tthis.firstChild = this.childNodes[0]\n\t}\n\n\tremoveChild(node) {\n\t\tif (node.parentNode) {\n\t\t\tremoveIndex(node, this.childNodes, true)\n\n\n\t\t\tthis.ownerDocument.removeElement(node.ref)\n\n\t\t}\n\n\t\tnode.parentNode = null\n\n\n\n\t\tthis.firstChild = this.childNodes[0]\n\t}\n\n\tsetAttribute(key, value, silent) {\n\t\tif (this.attributes[key] === value && silent !== false) {\n\t\t\treturn\n\t\t}\n\t\tthis.attributes[key] = value\n\t\tif (!silent) {\n\t\t\tconst result = {}\n\t\t\tresult[key] = value\n\n\t\t\tthis.ownerDocument.setAttr(this.ref, result)\n\n\t\t}\n\t}\n\n\tremoveAttribute(key) {\n\t\tif (this.attributes[key]) {\n\t\t\tdelete this.attributes[key]\n\t\t}\n\t}\n\n\tsetStyle(key, value, silent) {\n\t\tif (this.style[key] === value && silent !== false) {\n\t\t\treturn\n\t\t}\n\t\tthis.style[key] = value\n\t\tif (!silent && this.ownerDocument) {\n\t\t\tconst result = {}\n\t\t\tresult[key] = value\n\n\t\t\tthis.ownerDocument.setStyles(this.ref, result)\n\n\t\t}\n\t}\n\n\tsetStyles(styles) {\n\t\tObject.assign(this.style, styles)\n\t\tif (this.ownerDocument) {\n\n\t\t\tthis.ownerDocument.setStyles(this.ref, styles)\n\n\t\t}\n\t}\n\n\tsetClassStyle(classStyle) {\n\t\tfor (const key in this.classStyle) {\n\t\t\tthis.classStyle[key] = ''\n\t\t}\n\n\t\tObject.assign(this.classStyle, classStyle)\n\n\n\t\tthis.ownerDocument.setStyles(this.ref, this.toStyle())\n\n\t}\n\n\taddEventListener(type, handler) {\n\t\tif (!this.event[type]) {\n\t\t\tthis.event[type] = handler\n\n\t\t\t//this.ownerDocument.addEvent(this.ref, type)\n\t\t}\n\t}\n\n\tremoveEventListener(type) {\n\t\tif (this.event[type]) {\n\t\t\tdelete this.event[type]\n\t\t\tlet doc = getDoc(this.docId)\n\t\t\tdoc.nodeMap[this.ref] &&\n\t\t\t\tdoc.nodeMap[this.ref].event &&\n\t\t\t\tdoc.nodeMap[this.ref].event[type]\n\t\t\t\t? (doc.nodeMap[this.ref].event[type] = null)\n\t\t\t\t: ''\n\n\t\t\tthis.ownerDocument.removeEvent(this.ref, type)\n\t\t}\n\t}\n\n\tfireEvent(type, e) {\n\t\tconst handler = this.event[type]\n\t\tif (handler) {\n\t\t\treturn handler.call(this, e)\n\t\t}\n\t}\n\n\ttoStyle() {\n\t\treturn Object.assign({}, this.classStyle, this.style)\n\t}\n\n\tgetComputedStyle() { }\n\n\ttoJSON() {\n\t\tlet result = {\n\t\t\tid: this.ref,\n\t\t\ttype: this.type,\n\t\t\tdocId: this.docId || -10000,\n\t\t\tattributes: this.attributes ? this.attributes : {}\n\t\t}\n\t\tresult.attributes.style = this.toStyle()\n\n\t\tconst event = Object.keys(this.event)\n\t\tif (event.length) {\n\t\t\tresult.event = event\n\t\t}\n\n\t\tif (this.childNodes.length) {\n\t\t\tresult.children = this.childNodes.map(child => child.toJSON())\n\t\t}\n\t\treturn result\n\t}\n\n\treplaceChild(newChild, oldChild) {\n\t\tthis.insertBefore(newChild, oldChild)\n\t\tthis.removeChild(oldChild)\n\t}\n\n\tdestroy() {\n\t\tconst doc = getDoc(this.docId)\n\n\t\tif (doc) {\n\t\t\tdelete doc.nodeMap[this.nodeId]\n\t\t}\n\n\t\tthis.parentNode = null\n\t\tthis.childNodes.forEach(child => {\n\t\t\tchild.destroy()\n\t\t})\n\t}\n}\n","import {\n\tgetDoc,\n\tuniqueId\n} from './util'\n\n\nfunction registerNode(docId, node) {\n\tconst doc = getDoc(docId)\n\tdoc.nodeMap[node.nodeId] = node\n}\n\nexport default class TextNode {\n\tconstructor(nodeValue) {\n\t\tthis.nodeType = 3\n\t\tthis.nodeId = uniqueId()\n\t\tthis.ref = this.nodeId\n\t\tthis.attributes = {}\n\t\tthis.style = {\n\t\t\tdisplay: 'inline'\n\t\t}\n\t\tthis.classStyle = {}\n\t\tthis.event = {}\n\t\tthis.nodeValue = nodeValue\n\t\tthis.parentNode = null\n\t\tthis.nextSibling = null\n\t\tthis.previousSibling = null\n\t\tthis.firstChild = null\n\t\tthis.type = 'text'\n\t}\n\n\tsetAttribute(key, value, silent) {\n\t\tif (this.attributes[key] === value && silent !== false) {\n\t\t\treturn\n\t\t}\n\t\tthis.attributes[key] = value\n\t\tif (!silent) {\n\t\t\tconst result = {}\n\t\t\tresult[key] = value\n\n\t\t\tthis.ownerDocument.setAttr(this.ref, result)\n\n\t\t}\n\t}\n\n\tremoveAttribute(key) {\n\t\tif (this.attributes[key]) {\n\t\t\tdelete this.attributes[key]\n\t\t}\n\t}\n\n\ttoStyle() {\n\t\treturn Object.assign({}, this.classStyle, this.style)\n\t}\n\n\tsplitText() {\n\n\t}\n\n\tgetComputedStyle() { }\n\n\ttoJSON() {\n\t\tlet result = {\n\t\t\tid: this.ref,\n\t\t\ttype: this.type,\n\t\t\tdocId: this.docId || -10000,\n\t\t\tattributes: this.attributes ? this.attributes : {}\n\t\t}\n\t\tresult.attributes.style = this.toStyle()\n\n\t\tconst event = Object.keys(this.event)\n\t\tif (event.length) {\n\t\t\tresult.event = event\n\t\t}\n\n\t\treturn result\n\t}\n\n\tdestroy() {\n\t\tconst doc = getDoc(this.docId)\n\n\t\tif (doc) {\n\t\t\tdelete doc.nodeMap[this.nodeId]\n\t\t}\n\n\t\tthis.parentNode = null\n\n\t}\n}\n","import Element from './element'\nimport TextNode from './text-node'\nimport { addDoc, removeDoc } from './util'\n\n\nexport default class Document {\n constructor(id) {\n this.id = id\n addDoc(id, this)\n this.nodeMap = {}\n this._isMockDocument = true\n }\n\n // createBody(type, props) {\n // if (!this.body) {\n // const el = new Element(type, props)\n // el.didMount = true\n // el.ownerDocument = this\n // el.docId = this.id\n // el.style.alignItems = 'flex-start'\n // this.body = el\n // }\n\n // return this.body\n // }\n\n createElement(tagName, props) {\n let el = new Element(tagName, props)\n el.ownerDocument = this\n el.docId = this.id\n return el\n\t}\n\n\tcreateTextNode(txt){\n\t\tconst node = new TextNode(txt)\n\t\tnode.docId = this.id\n\t\treturn node\n\t}\n\n destroy() {\n delete this.listener\n delete this.nodeMap\n removeDoc(this.id)\n }\n\n addEventListener(ref, type) {\n //document.addEvent(this.id, ref, type)\n }\n\n removeEventListener(ref, type) {\n //document.removeEvent(this.id, ref, type)\n }\n\n\n scrollTo(ref, x, y, animated) {\n document.scrollTo(this.id, ref, x, y, animated)\n }\n\n}\n","import Document from './document'\n\n\nexport default {\n\tdocument: new Document(0)\n}\n","import mock from './mock/index'\n\nfunction getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n if (typeof self !== 'undefined') {\n return self\n } else if (typeof window !== 'undefined') {\n return window\n } else if (typeof global !== 'undefined') {\n return global\n }\n return (function() {\n return this\n })()\n }\n return global\n}\n\n/** Global options\n *\t@public\n *\t@namespace options {Object}\n */\nexport default {\n scopedStyle: true,\n mapping: {},\n isWeb: true,\n\tstaticStyleMapping: {},\n\tdoc: mock.document,\n //doc: typeof document === 'object' ? document : null,\n root: getGlobal(),\n //styleCache :[{ctor:ctor,ctorName:ctorName,style:style}]\n styleCache: []\n //componentChange(component, element) { },\n /** If `true`, `prop` changes trigger synchronous component updates.\n *\t@name syncComponentUpdates\n *\t@type Boolean\n *\t@default true\n */\n //syncComponentUpdates: true,\n\n /** Processes all created VNodes.\n *\t@param {VNode} vnode\tA newly-created VNode to normalize/process\n */\n //vnode(vnode) { }\n\n /** Hook invoked after a component is mounted. */\n //afterMount(component) { },\n\n /** Hook invoked after the DOM is updated with a component's latest render. */\n //afterUpdate(component) { }\n\n /** Hook invoked immediately before a component is unmounted. */\n // beforeUnmount(component) { }\n}\n","'use strict'\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols\nvar hasOwnProperty = Object.prototype.hasOwnProperty\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable\n\nfunction toObject(val) {\n if (val === null || val === undefined) {\n throw new TypeError('Object.assign cannot be called with null or undefined')\n }\n\n return Object(val)\n}\n\nexport function assign(target, source) {\n var from\n var to = toObject(target)\n var symbols\n\n for (var s = 1; s < arguments.length; s++) {\n from = Object(arguments[s])\n\n for (var key in from) {\n if (hasOwnProperty.call(from, key)) {\n to[key] = from[key]\n }\n }\n\n if (getOwnPropertySymbols) {\n symbols = getOwnPropertySymbols(from)\n for (var i = 0; i < symbols.length; i++) {\n if (propIsEnumerable.call(from, symbols[i])) {\n to[symbols[i]] = from[symbols[i]]\n }\n }\n }\n }\n\n return to\n}\n\nif (typeof Element !== 'undefined' && !Element.prototype.addEventListener) {\n var oListeners = {};\n function runListeners(oEvent) {\n if (!oEvent) { oEvent = window.event; }\n for (var iLstId = 0, iElId = 0, oEvtListeners = oListeners[oEvent.type]; iElId < oEvtListeners.aEls.length; iElId++) {\n if (oEvtListeners.aEls[iElId] === this) {\n for (iLstId; iLstId < oEvtListeners.aEvts[iElId].length; iLstId++) { oEvtListeners.aEvts[iElId][iLstId].call(this, oEvent); }\n break;\n }\n }\n }\n Element.prototype.addEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) {\n if (oListeners.hasOwnProperty(sEventType)) {\n var oEvtListeners = oListeners[sEventType];\n for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) {\n if (oEvtListeners.aEls[iElId] === this) { nElIdx = iElId; break; }\n }\n if (nElIdx === -1) {\n oEvtListeners.aEls.push(this);\n oEvtListeners.aEvts.push([fListener]);\n this[\"on\" + sEventType] = runListeners;\n } else {\n var aElListeners = oEvtListeners.aEvts[nElIdx];\n if (this[\"on\" + sEventType] !== runListeners) {\n aElListeners.splice(0);\n this[\"on\" + sEventType] = runListeners;\n }\n for (var iLstId = 0; iLstId < aElListeners.length; iLstId++) {\n if (aElListeners[iLstId] === fListener) { return; }\n }\n aElListeners.push(fListener);\n }\n } else {\n oListeners[sEventType] = { aEls: [this], aEvts: [[fListener]] };\n this[\"on\" + sEventType] = runListeners;\n }\n };\n Element.prototype.removeEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) {\n if (!oListeners.hasOwnProperty(sEventType)) { return; }\n var oEvtListeners = oListeners[sEventType];\n for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) {\n if (oEvtListeners.aEls[iElId] === this) { nElIdx = iElId; break; }\n }\n if (nElIdx === -1) { return; }\n for (var iLstId = 0, aElListeners = oEvtListeners.aEvts[nElIdx]; iLstId < aElListeners.length; iLstId++) {\n if (aElListeners[iLstId] === fListener) { aElListeners.splice(iLstId, 1); }\n }\n };\n}\n\n\nif (typeof Object.create !== 'function') {\n Object.create = function(proto, propertiesObject) {\n if (typeof proto !== 'object' && typeof proto !== 'function') {\n throw new TypeError('Object prototype may only be an Object: ' + proto)\n } else if (proto === null) {\n throw new Error(\n \"This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument.\"\n )\n }\n\n // if (typeof propertiesObject != 'undefined') {\n // throw new Error(\"This browser's implementation of Object.create is a shim and doesn't support a second argument.\");\n // }\n\n function F() {}\n F.prototype = proto\n\n return new F()\n }\n}\n\nif (!String.prototype.trim) {\n String.prototype.trim = function () {\n return this.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '')\n }\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {Object} obj\t\tObject onto which properties should be copied.\n * @param {Object} props\tObject from which to copy properties.\n * @returns obj\n * @private\n */\nexport function extend(obj, props) {\n for (let i in props) obj[i] = props[i]\n return obj\n}\n\n/** Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {object|function} [ref=null]\n * @param {any} [value]\n */\nexport function applyRef(ref, value) {\n if (ref) {\n if (typeof ref == 'function') ref(value)\n else ref.current = value\n }\n}\n\n/**\n * Call a function asynchronously, as soon as possible. Makes\n * use of HTML Promise to schedule the callback if available,\n * otherwise falling back to `setTimeout` (mainly for IE<11).\n *\n * @param {Function} callback\n */\n\nlet usePromise = typeof Promise == 'function'\n\n// for native\nif (\n typeof document !== 'object' &&\n typeof global !== 'undefined' &&\n global.__config__\n) {\n if (global.__config__.platform === 'android') {\n usePromise = true\n } else {\n let systemVersion =\n (global.__config__.systemVersion &&\n global.__config__.systemVersion.split('.')[0]) ||\n 0\n if (systemVersion > 8) {\n usePromise = true\n }\n }\n}\n\nexport const defer = usePromise\n ? Promise.resolve().then.bind(Promise.resolve())\n : setTimeout\n\nexport function isArray(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nexport function nProps(props) {\n if (!props || isArray(props)) return {}\n const result = {}\n Object.keys(props).forEach(key => {\n result[key] = props[key].value\n })\n return result\n}\n\nexport function getUse(data, paths) {\n const obj = []\n paths.forEach((path, index) => {\n const isPath = typeof path === 'string'\n if (isPath) {\n obj[index] = getTargetByPath(data, path)\n } else {\n const key = Object.keys(path)[0]\n const value = path[key]\n if (typeof value === 'string') {\n obj[index] = getTargetByPath(data, value)\n } else {\n const tempPath = value[0]\n if (typeof tempPath === 'string') {\n const tempVal = getTargetByPath(data, tempPath)\n obj[index] = value[1] ? value[1](tempVal) : tempVal\n } else {\n const args = []\n tempPath.forEach(path =>{\n args.push(getTargetByPath(data, path))\n })\n obj[index] = value[1].apply(null, args)\n }\n }\n obj[key] = obj[index]\n }\n })\n return obj\n}\n\nexport function getTargetByPath(origin, path) {\n const arr = path.replace(/]/g, '').replace(/\\[/g, '.').split('.')\n let current = origin\n for (let i = 0, len = arr.length; i < len; i++) {\n current = current[arr[i]]\n }\n return current\n}\n","import options from './options'\nimport { defer } from './util'\nimport { renderComponent } from './vdom/component'\n\n/** Managed queue of dirty components to be re-rendered */\n\nlet items = []\n\nexport function enqueueRender(component) {\n if (items.push(component) == 1) {\n ;(options.debounceRendering || defer)(rerender)\n }\n}\n\n/** Rerender all enqueued dirty components */\nexport function rerender() {\n\tlet p\n\twhile ( (p = items.pop()) ) {\n renderComponent(p)\n\t}\n}","import { extend } from '../util'\nimport options from '../options'\n\nconst mapping = options.mapping\n/**\n * Check if two nodes are equivalent.\n *\n * @param {Node} node\t\t\tDOM Node to compare\n * @param {VNode} vnode\t\t\tVirtual DOM node to compare\n * @param {boolean} [hydrating=false]\tIf true, ignores component constructors when comparing.\n * @private\n */\nexport function isSameNodeType(node, vnode, hydrating) {\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n return node.splitText !== undefined\n }\n if (typeof vnode.nodeName === 'string') {\n var ctor = mapping[vnode.nodeName]\n if (ctor) {\n return hydrating || node._componentConstructor === ctor\n }\n return !node._componentConstructor && isNamedNode(node, vnode.nodeName)\n }\n return hydrating || node._componentConstructor === vnode.nodeName\n}\n\n/**\n * Check if an Element has a given nodeName, case-insensitively.\n *\n * @param {Element} node\tA DOM Element to inspect the name of.\n * @param {String} nodeName\tUnnormalized name to compare against.\n */\nexport function isNamedNode(node, nodeName) {\n return (\n node.normalizedNodeName === nodeName ||\n node.nodeName.toLowerCase() === nodeName.toLowerCase()\n )\n}\n\n/**\n * Reconstruct Component-style `props` from a VNode.\n * Ensures default/fallback values from `defaultProps`:\n * Own-properties of `defaultProps` not present in `vnode.attributes` are added.\n *\n * @param {VNode} vnode\n * @returns {Object} props\n */\nexport function getNodeProps(vnode) {\n let props = extend({}, vnode.attributes)\n props.children = vnode.children\n\n let defaultProps = vnode.nodeName.defaultProps\n if (defaultProps !== undefined) {\n for (let i in defaultProps) {\n if (props[i] === undefined) {\n props[i] = defaultProps[i]\n }\n }\n }\n\n return props\n}\n","import { IS_NON_DIMENSIONAL } from '../constants'\nimport { applyRef } from '../util'\nimport options from '../options'\n\n/** Create an element with the given nodeName.\n *\t@param {String} nodeName\n *\t@param {Boolean} [isSvg=false]\tIf `true`, creates an element within the SVG namespace.\n *\t@returns {Element} node\n */\nexport function createNode(nodeName, isSvg) {\n let node = isSvg\n ? options.doc.createElementNS('http://www.w3.org/2000/svg', nodeName)\n : options.doc.createElement(nodeName)\n node.normalizedNodeName = nodeName\n return node\n}\n\nfunction parseCSSText(cssText) {\n let cssTxt = cssText.replace(/\\/\\*(.|\\s)*?\\*\\//g, ' ').replace(/\\s+/g, ' ')\n let style = {},\n [a, b, rule] = cssTxt.match(/ ?(.*?) ?{([^}]*)}/) || [a, b, cssTxt]\n let cssToJs = s => s.replace(/\\W+\\w/g, match => match.slice(-1).toUpperCase())\n let properties = rule\n .split(';')\n .map(o => o.split(':').map(x => x && x.trim()))\n for (let [property, value] of properties) style[cssToJs(property)] = value\n return style\n}\n\n/** Remove a child node from its parent if attached.\n *\t@param {Element} node\t\tThe node to remove\n */\nexport function removeNode(node) {\n let parentNode = node.parentNode\n if (parentNode) parentNode.removeChild(node)\n}\n\n/** Set a named attribute on the given Node, with special behavior for some names and event handlers.\n *\tIf `value` is `null`, the attribute/handler will be removed.\n *\t@param {Element} node\tAn element to mutate\n *\t@param {string} name\tThe name/key to set, such as an event or attribute name\n *\t@param {any} old\tThe last value that was set for this name/node pair\n *\t@param {any} value\tAn attribute value, such as a function to be used as an event handler\n *\t@param {Boolean} isSvg\tAre we currently diffing inside an svg?\n *\t@private\n */\nexport function setAccessor(node, name, old, value, isSvg) {\n if (name === 'className') name = 'class'\n\n if (name === 'key') {\n // ignore\n } else if (name === 'ref') {\n applyRef(old, null)\n applyRef(value, node)\n } else if (name === 'class' && !isSvg) {\n node.className = value || ''\n } else if (name === 'style') {\n if (options.isWeb) {\n if (!value || typeof value === 'string' || typeof old === 'string') {\n node.style.cssText = value || ''\n }\n if (value && typeof value === 'object') {\n if (typeof old !== 'string') {\n for (let i in old) if (!(i in value)) node.style[i] = ''\n }\n for (let i in value) {\n node.style[i] =\n typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false\n ? value[i] + 'px'\n : value[i]\n }\n }\n } else {\n let oldJson = old,\n currentJson = value\n if (typeof old === 'string') {\n oldJson = parseCSSText(old)\n }\n if (typeof value == 'string') {\n currentJson = parseCSSText(value)\n }\n\n let result = {},\n changed = false\n\n if (oldJson) {\n for (let key in oldJson) {\n if (typeof currentJson == 'object' && !(key in currentJson)) {\n result[key] = ''\n changed = true\n }\n }\n\n for (let ckey in currentJson) {\n if (currentJson[ckey] !== oldJson[ckey]) {\n result[ckey] = currentJson[ckey]\n changed = true\n }\n }\n\n if (changed) {\n node.setStyles(result)\n }\n } else {\n node.setStyles(currentJson)\n }\n }\n } else if (name === 'dangerouslySetInnerHTML') {\n if (value) node.innerHTML = value.__html || ''\n } else if (name[0] == 'o' && name[1] == 'n') {\n let useCapture = name !== (name = name.replace(/Capture$/, ''))\n name = name.toLowerCase().substring(2)\n if (value) {\n if (!old) {\n node.addEventListener(name, eventProxy, useCapture)\n if (name == 'tap') {\n node.addEventListener('touchstart', touchStart, useCapture)\n node.addEventListener('touchend', touchEnd, useCapture)\n }\n }\n } else {\n node.removeEventListener(name, eventProxy, useCapture)\n if (name == 'tap') {\n node.removeEventListener('touchstart', touchStart, useCapture)\n node.removeEventListener('touchend', touchEnd, useCapture)\n }\n }\n ;(node._listeners || (node._listeners = {}))[name] = value\n } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) {\n setProperty(node, name, value == null ? '' : value)\n if (value == null || value === false) node.removeAttribute(name)\n } else {\n let ns = isSvg && name !== (name = name.replace(/^xlink:?/, ''))\n if (value == null || value === false) {\n if (ns)\n node.removeAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase()\n )\n else node.removeAttribute(name)\n } else if (typeof value !== 'function') {\n if (ns)\n node.setAttributeNS(\n 'http://www.w3.org/1999/xlink',\n name.toLowerCase(),\n value\n )\n else node.setAttribute(name, value)\n }\n }\n}\n\n/** Attempt to set a DOM property to the given value.\n *\tIE & FF throw for certain property-value combinations.\n */\nfunction setProperty(node, name, value) {\n try {\n node[name] = value\n } catch (e) {}\n}\n\n/** Proxy an event to hooked event handlers\n *\t@private\n */\nfunction eventProxy(e) {\n return this._listeners[e.type]((options.event && options.event(e)) || e)\n}\n\nfunction touchStart(e) {\n this.___touchX = e.touches[0].pageX\n this.___touchY = e.touches[0].pageY\n this.___scrollTop = document.body.scrollTop\n}\n\nfunction touchEnd(e) {\n if (\n Math.abs(e.changedTouches[0].pageX - this.___touchX) < 30 &&\n Math.abs(e.changedTouches[0].pageY - this.___touchY) < 30 &&\n Math.abs(document.body.scrollTop - this.___scrollTop) < 30\n ) {\n this.dispatchEvent(new CustomEvent('tap', { detail: e }))\n }\n}","export function draw(res){\n console.log(res)\n return document.createElement('canvas')\n}","import { ATTR_KEY } from '../constants'\nimport { isSameNodeType, isNamedNode } from './index'\nimport { buildComponentFromVNode } from './component'\nimport { createNode, setAccessor } from '../dom/index'\nimport { unmountComponent } from './component'\nimport options from '../options'\nimport { applyRef } from '../util'\nimport { removeNode } from '../dom/index'\nimport { isArray } from '../util'\nimport { draw } from '../../cax/draw'\n/** Queue of components that have been mounted and are awaiting componentDidMount */\nexport const mounts = []\n\n/** Diff recursion count, used to track the end of the diff cycle. */\nexport let diffLevel = 0\n\n/** Global flag indicating if the diff is currently within an SVG */\nlet isSvgMode = false\n\n/** Global flag indicating if the diff is performing hydration */\nlet hydrating = false\n\n/** Invoke queued componentDidMount lifecycle methods */\nexport function flushMounts() {\n let c\n while ((c = mounts.pop())) {\n if (options.afterMount) options.afterMount(c)\n if (c.installed) c.installed()\n }\n}\n\n/** Apply differences in a given vnode (and it's deep children) to a real DOM Node.\n *\t@param {Element} [dom=null]\t\tA DOM node to mutate into the shape of the `vnode`\n *\t@param {VNode} vnode\t\t\tA VNode (with descendants forming a tree) representing the desired DOM structure\n *\t@returns {Element} dom\t\t\tThe created/mutated element\n *\t@private\n */\nexport function diff(dom, vnode, context, mountAll, parent, componentRoot, fromRender) {\n // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)\n if (!diffLevel++) {\n // when first starting the diff, check if we're diffing an SVG or within an SVG\n isSvgMode = parent != null && parent.ownerSVGElement !== undefined\n\n // hydration is indicated by the existing element to be diffed not having a prop cache\n hydrating = dom != null && !(ATTR_KEY in dom)\n }\n let ret\n\n if (isArray(vnode)) {\n vnode = {\n nodeName: 'span',\n children: vnode\n }\n }\n\n\tret = idiff(dom, vnode, context, mountAll, componentRoot)\n\t// append the element if its a new parent\n\tif (parent && ret.parentNode !== parent) {\n\t\tif (fromRender) {\n\t\t\tparent.appendChild(draw(ret))\n\t\t} else {\n\t\t\tparent.appendChild(ret)\n\t\t}\n\t}\n\n // diffLevel being reduced to 0 means we're exiting the diff\n if (!--diffLevel) {\n hydrating = false\n // invoke queued componentDidMount lifecycle methods\n if (!componentRoot) flushMounts()\n }\n\n return ret\n}\n\n/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */\nfunction idiff(dom, vnode, context, mountAll, componentRoot) {\n let out = dom,\n prevSvgMode = isSvgMode\n\n // empty values (null, undefined, booleans) render as empty Text nodes\n if (vnode == null || typeof vnode === 'boolean') vnode = ''\n\n // If the VNode represents a Component, perform a component diff:\n let vnodeName = vnode.nodeName\n if (options.mapping[vnodeName]) {\n vnode.nodeName = options.mapping[vnodeName]\n return buildComponentFromVNode(dom, vnode, context, mountAll)\n }\n if (typeof vnodeName == 'function') {\n return buildComponentFromVNode(dom, vnode, context, mountAll)\n }\n\n // Fast case: Strings & Numbers create/update Text nodes.\n if (typeof vnode === 'string' || typeof vnode === 'number') {\n // update if it's already a Text node:\n if (\n dom &&\n dom.splitText !== undefined &&\n dom.parentNode &&\n (!dom._component || componentRoot)\n ) {\n /* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */\n if (dom.nodeValue != vnode) {\n dom.nodeValue = vnode\n }\n } else {\n // it wasn't a Text node: replace it with one and recycle the old Element\n out = options.doc.createTextNode(vnode)\n if (dom) {\n if (dom.parentNode) dom.parentNode.replaceChild(out, dom)\n recollectNodeTree(dom, true)\n }\n }\n\n //ie8 error\n try {\n out[ATTR_KEY] = true\n } catch (e) {}\n\n return out\n }\n\n // Tracks entering and exiting SVG namespace when descending through the tree.\n isSvgMode =\n vnodeName === 'svg'\n ? true\n : vnodeName === 'foreignObject'\n ? false\n : isSvgMode\n\n // If there's no existing element or it's the wrong type, create a new one:\n vnodeName = String(vnodeName)\n if (!dom || !isNamedNode(dom, vnodeName)) {\n out = createNode(vnodeName, isSvgMode)\n\n if (dom) {\n // move children into the replacement node\n while (dom.firstChild) out.appendChild(dom.firstChild)\n\n // if the previous Element was mounted into the DOM, replace it inline\n if (dom.parentNode) dom.parentNode.replaceChild(out, dom)\n\n // recycle the old element (skips non-Element node types)\n recollectNodeTree(dom, true)\n }\n }\n\n let fc = out.firstChild,\n props = out[ATTR_KEY],\n vchildren = vnode.children\n\n if (props == null) {\n props = out[ATTR_KEY] = {}\n for (let a = out.attributes, i = a.length; i--; )\n props[a[i].name] = a[i].value\n }\n\n // Optimization: fast-path for elements containing a single TextNode:\n if (\n !hydrating &&\n vchildren &&\n vchildren.length === 1 &&\n typeof vchildren[0] === 'string' &&\n fc != null &&\n fc.splitText !== undefined &&\n fc.nextSibling == null\n ) {\n if (fc.nodeValue != vchildren[0]) {\n\t\t\tfc.nodeValue = vchildren[0]\n\t\t\t//update rendering obj\n\t\t\tfc._renderText.text = fc.nodeValue\n }\n }\n // otherwise, if there are existing or new children, diff them:\n else if ((vchildren && vchildren.length) || fc != null) {\n innerDiffNode(\n out,\n vchildren,\n context,\n mountAll,\n hydrating || props.dangerouslySetInnerHTML != null\n )\n }\n\n // Apply attributes/props from VNode to the DOM Element:\n diffAttributes(out, vnode.attributes, props)\n\n // restore previous SVG mode: (in case we're exiting an SVG namespace)\n isSvgMode = prevSvgMode\n\n return out\n}\n\n/** Apply child and attribute changes between a VNode and a DOM Node to the DOM.\n *\t@param {Element} dom\t\t\tElement whose children should be compared & mutated\n *\t@param {Array} vchildren\t\tArray of VNodes to compare to `dom.childNodes`\n *\t@param {Object} context\t\t\tImplicitly descendant context object (from most recent `getChildContext()`)\n *\t@param {Boolean} mountAll\n *\t@param {Boolean} isHydrating\tIf `true`, consumes externally created elements similar to hydration\n */\nfunction innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {\n let originalChildren = dom.childNodes,\n children = [],\n keyed = {},\n keyedLen = 0,\n min = 0,\n len = originalChildren.length,\n childrenLen = 0,\n vlen = vchildren ? vchildren.length : 0,\n j,\n c,\n f,\n vchild,\n child\n\n // Build up a map of keyed children and an Array of unkeyed children:\n if (len !== 0) {\n for (let i = 0; i < len; i++) {\n let child = originalChildren[i],\n props = child[ATTR_KEY],\n key =\n vlen && props\n ? child._component\n ? child._component.__key\n : props.key\n : null\n if (key != null) {\n keyedLen++\n keyed[key] = child\n } else if (\n props ||\n (child.splitText !== undefined\n ? isHydrating\n ? child.nodeValue.trim()\n : true\n : isHydrating)\n ) {\n children[childrenLen++] = child\n }\n }\n }\n\n if (vlen !== 0) {\n for (let i = 0; i < vlen; i++) {\n vchild = vchildren[i]\n child = null\n\n // attempt to find a node based on key matching\n let key = vchild.key\n if (key != null) {\n if (keyedLen && keyed[key] !== undefined) {\n child = keyed[key]\n keyed[key] = undefined\n keyedLen--\n }\n }\n // attempt to pluck a node of the same type from the existing children\n else if (!child && min < childrenLen) {\n for (j = min; j < childrenLen; j++) {\n if (\n children[j] !== undefined &&\n isSameNodeType((c = children[j]), vchild, isHydrating)\n ) {\n child = c\n children[j] = undefined\n if (j === childrenLen - 1) childrenLen--\n if (j === min) min++\n break\n }\n }\n }\n\n // morph the matched/found/created DOM child to match vchild (deep)\n child = idiff(child, vchild, context, mountAll)\n\n f = originalChildren[i]\n if (child && child !== dom && child !== f) {\n if (f == null) {\n\t\t\t\t\tdom.appendChild(child)\n } else if (child === f.nextSibling) {\n removeNode(f)\n } else {\n dom.insertBefore(child, f)\n }\n }\n }\n }\n\n // remove unused keyed children:\n if (keyedLen) {\n for (let i in keyed)\n if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false)\n }\n\n\t// remove orphaned unkeyed children:\n while (min <= childrenLen) {\n if ((child = children[childrenLen--]) !== undefined)\n recollectNodeTree(child, false)\n }\n}\n\n/** Recursively recycle (or just unmount) a node and its descendants.\n *\t@param {Node} node\t\t\t\t\t\tDOM node to start unmount/removal from\n *\t@param {Boolean} [unmountOnly=false]\tIf `true`, only triggers unmount lifecycle, skips removal\n */\nexport function recollectNodeTree(node, unmountOnly) {\n let component = node._component\n if (component) {\n // if node is owned by a Component, unmount that component (ends up recursing back here)\n unmountComponent(component)\n } else {\n // If the node's VNode had a ref function, invoke it with null here.\n // (this is part of the React spec, and smart for unsetting references)\n if (node[ATTR_KEY] != null) applyRef(node[ATTR_KEY].ref, null)\n\n if (unmountOnly === false || node[ATTR_KEY] == null) {\n removeNode(node)\n }\n\n removeChildren(node)\n }\n}\n\n/** Recollect/unmount all children.\n *\t- we use .lastChild here because it causes less reflow than .firstChild\n *\t- it's also cheaper than accessing the .childNodes Live NodeList\n */\nexport function removeChildren(node) {\n node = node.lastChild\n while (node) {\n let next = node.previousSibling\n recollectNodeTree(node, true)\n node = next\n }\n}\n\n/** Apply differences in attributes from a VNode to the given DOM Element.\n *\t@param {Element} dom\t\tElement with attributes to diff `attrs` against\n *\t@param {Object} attrs\t\tThe desired end-state key-value attribute pairs\n *\t@param {Object} old\t\t\tCurrent/previous attributes (from previous VNode or element's prop cache)\n */\nfunction diffAttributes(dom, attrs, old) {\n let name\n\n // remove attributes no longer present on the vnode by setting them to undefined\n for (name in old) {\n if (!(attrs && attrs[name] != null) && old[name] != null) {\n setAccessor(dom, name, old[name], (old[name] = undefined), isSvgMode)\n }\n }\n\n // add new & update changed attributes\n for (name in attrs) {\n if (\n name !== 'children' &&\n name !== 'innerHTML' &&\n (!(name in old) ||\n attrs[name] !==\n (name === 'value' || name === 'checked' ? dom[name] : old[name]))\n ) {\n setAccessor(dom, name, old[name], (old[name] = attrs[name]), isSvgMode)\n }\n }\n}\n","import options from './options'\n\nconst OBJECTTYPE = '[object Object]'\nconst ARRAYTYPE = '[object Array]'\n\nexport function define(name, ctor) {\n options.mapping[name] = ctor\n if (ctor.use) {\n ctor.updatePath = getPath(ctor.use)\n } else if (ctor.data) { //Compatible with older versions\n ctor.updatePath = getUpdatePath(ctor.data)\n }\n}\n\nexport function getPath(obj) {\n if (Object.prototype.toString.call(obj) === '[object Array]') {\n const result = {}\n obj.forEach(item => {\n if (typeof item === 'string') {\n result[item] = true\n } else {\n const tempPath = item[Object.keys(item)[0]]\n if (typeof tempPath === 'string') {\n result[tempPath] = true\n } else {\n if(typeof tempPath[0] === 'string'){\n result[tempPath[0]] = true\n }else{\n tempPath[0].forEach(path => result[path] = true)\n }\n }\n }\n })\n return result\n } else {\n return getUpdatePath(obj)\n }\n}\n\nexport function getUpdatePath(data) {\n const result = {}\n dataToPath(data, result)\n return result\n}\n\nfunction dataToPath(data, result) {\n Object.keys(data).forEach(key => {\n result[key] = true\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], key, result)\n }\n })\n}\n\nfunction _objToPath(data, path, result) {\n Object.keys(data).forEach(key => {\n result[path + '.' + key] = true\n delete result[path]\n const type = Object.prototype.toString.call(data[key])\n if (type === OBJECTTYPE) {\n _objToPath(data[key], path + '.' + key, result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(data[key], path + '.' + key, result)\n }\n })\n}\n\nfunction _arrayToPath(data, path, result) {\n data.forEach((item, index) => {\n result[path + '[' + index + ']'] = true\n delete result[path]\n const type = Object.prototype.toString.call(item)\n if (type === OBJECTTYPE) {\n _objToPath(item, path + '[' + index + ']', result)\n } else if (type === ARRAYTYPE) {\n _arrayToPath(item, path + '[' + index + ']', result)\n }\n })\n}\n","import Component from '../component'\nimport { getUse } from '../util'\nimport { getPath } from '../define'\n/** Retains a pool of Components for re-use, keyed on component name.\n *\tNote: since component names are not unique or even necessarily available, these are primarily a form of sharding.\n *\t@private\n */\nconst components = {}\n\n/** Reclaim a component for later re-use by the recycler. */\nexport function collectComponent(component) {\n let name = component.constructor.name\n ;(components[name] || (components[name] = [])).push(component)\n}\n\n/** Create a component. Normalizes differences between PFC's and classful Components. */\nexport function createComponent(Ctor, props, context, vnode) {\n let list = components[Ctor.name],\n inst\n\n if (Ctor.prototype && Ctor.prototype.render) {\n inst = new Ctor(props, context)\n Component.call(inst, props, context)\n } else {\n inst = new Component(props, context)\n inst.constructor = Ctor\n inst.render = doRender\n }\n vnode && (inst.scopedCssAttr = vnode.css)\n\n if ( inst.store && inst.store.data) {\n\t\tif(inst.constructor.use){\n\t\t\tinst.use = getUse(inst.store.data, inst.constructor.use)\n\t\t\tinst.store.instances.push(inst)\n\t\t} else if(inst.initUse){\n\t\t\tconst use = inst.initUse()\n\t\t\tinst._updatePath = getPath(use)\n\t\t\tinst.use = getUse(inst.store.data, use)\n\t\t\tinst.store.instances.push(inst)\n\t\t}\n\n\n }\n\n if (list) {\n for (let i = list.length; i--; ) {\n if (list[i].constructor === Ctor) {\n inst.nextBase = list[i].nextBase\n list.splice(i, 1)\n break\n }\n }\n }\n return inst\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, data, context) {\n return this.constructor(props, context)\n}\n","import options from './options'\n\nlet styleId = 0\n\nexport function getCtorName(ctor) {\n for (let i = 0, len = options.styleCache.length; i < len; i++) {\n let item = options.styleCache[i]\n\n if (item.ctor === ctor) {\n return item.attrName\n }\n }\n\n let attrName = 's' + styleId\n options.styleCache.push({ ctor, attrName })\n styleId++\n\n return attrName\n}\n\n// many thanks to https://github.com/thomaspark/scoper/\nexport function scoper(css, prefix) {\n prefix = '[' + prefix.toLowerCase() + ']'\n // https://www.w3.org/TR/css-syntax-3/#lexical\n css = css.replace(/\\/\\*[^*]*\\*+([^/][^*]*\\*+)*\\//g, '')\n // eslint-disable-next-line\n let re = new RegExp('([^\\r\\n,{}:]+)(:[^\\r\\n,{}]+)?(,(?=[^{}]*{)|\\s*{)', 'g')\n /**\n * Example:\n *\n * .classname::pesudo { color:red }\n *\n * g1 is normal selector `.classname`\n * g2 is pesudo class or pesudo element\n * g3 is the suffix\n */\n css = css.replace(re, (g0, g1, g2, g3) => {\n if (typeof g2 === 'undefined') {\n g2 = ''\n }\n\n /* eslint-ignore-next-line */\n if (\n g1.match(\n /^\\s*(@media|\\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/\n )\n ) {\n return g1 + g2 + g3\n }\n\n let appendClass = g1.replace(/(\\s*)$/, '') + prefix + g2\n //let prependClass = prefix + ' ' + g1.trim() + g2;\n\n return appendClass + g3\n //return appendClass + ',' + prependClass + g3;\n })\n\n return css\n}\n\nexport function addStyle(cssText, id) {\n id = id.toLowerCase()\n let ele = document.getElementById(id)\n let head = document.getElementsByTagName('head')[0]\n if (ele && ele.parentNode === head) {\n head.removeChild(ele)\n }\n\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n someThingStyles.setAttribute('id', id)\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addStyleWithoutId(cssText) {\n let head = document.getElementsByTagName('head')[0]\n let someThingStyles = document.createElement('style')\n head.appendChild(someThingStyles)\n someThingStyles.setAttribute('type', 'text/css')\n\n if (window.ActiveXObject) {\n someThingStyles.styleSheet.cssText = cssText\n } else {\n someThingStyles.textContent = cssText\n }\n}\n\nexport function addScopedAttrStatic(vdom, attr) {\n if (options.scopedStyle) {\n scopeVdom(attr, vdom)\n } \n}\n\nexport function addStyleToHead(style, attr) {\n if (options.scopedStyle) {\n if (!options.staticStyleMapping[attr]) {\n addStyle(scoper(style, attr), attr)\n options.staticStyleMapping[attr] = true\n }\n } else if (!options.staticStyleMapping[attr]) {\n addStyleWithoutId(style)\n options.staticStyleMapping[attr] = true\n }\n}\n\nexport function scopeVdom(attr, vdom) {\n if (typeof vdom === 'object') {\n vdom.attributes = vdom.attributes || {}\n vdom.attributes[attr] = ''\n vdom.css = vdom.css || {}\n vdom.css[attr] = ''\n vdom.children.forEach(child => scopeVdom(attr, child))\n }\n}\n\nexport function scopeHost(vdom, css) {\n if (typeof vdom === 'object' && css) {\n vdom.attributes = vdom.attributes || {}\n for (let key in css) {\n vdom.attributes[key] = ''\n }\n }\n}\n","/* obaa 1.0.0\n * By dntzhang\n * Github: https://github.com/Tencent/omi\n * MIT Licensed.\n */\n\nvar obaa = function(target, arr, callback) {\n var _observe = function(target, arr, callback) {\n if (!target.$observer) target.$observer = this\n var $observer = target.$observer\n var eventPropArr = []\n if (obaa.isArray(target)) {\n if (target.length === 0) {\n target.$observeProps = {}\n target.$observeProps.$observerPath = '#'\n }\n $observer.mock(target)\n }\n for (var prop in target) {\n if (target.hasOwnProperty(prop)) {\n if (callback) {\n if (obaa.isArray(arr) && obaa.isInArray(arr, prop)) {\n eventPropArr.push(prop)\n $observer.watch(target, prop)\n } else if (obaa.isString(arr) && prop == arr) {\n eventPropArr.push(prop)\n $observer.watch(target, prop)\n }\n } else {\n eventPropArr.push(prop)\n $observer.watch(target, prop)\n }\n }\n }\n $observer.target = target\n if (!$observer.propertyChangedHandler) $observer.propertyChangedHandler = []\n var propChanged = callback ? callback : arr\n $observer.propertyChangedHandler.push({\n all: !callback,\n propChanged: propChanged,\n eventPropArr: eventPropArr\n })\n }\n _observe.prototype = {\n onPropertyChanged: function(prop, value, oldValue, target, path) {\n if (value !== oldValue && this.propertyChangedHandler) {\n var rootName = obaa._getRootName(prop, path)\n for (\n var i = 0, len = this.propertyChangedHandler.length;\n i < len;\n i++\n ) {\n var handler = this.propertyChangedHandler[i]\n if (\n handler.all ||\n obaa.isInArray(handler.eventPropArr, rootName) ||\n rootName.indexOf('Array-') === 0\n ) {\n handler.propChanged.call(this.target, prop, value, oldValue, path)\n }\n }\n }\n if (prop.indexOf('Array-') !== 0 && typeof value === 'object') {\n this.watch(target, prop, target.$observeProps.$observerPath)\n }\n },\n mock: function(target) {\n var self = this\n obaa.methods.forEach(function(item) {\n target[item] = function() {\n var old = Array.prototype.slice.call(this, 0)\n var result = Array.prototype[item].apply(\n this,\n Array.prototype.slice.call(arguments)\n )\n if (new RegExp('\\\\b' + item + '\\\\b').test(obaa.triggerStr)) {\n for (var cprop in this) {\n if (this.hasOwnProperty(cprop) && !obaa.isFunction(this[cprop])) {\n self.watch(this, cprop, this.$observeProps.$observerPath)\n }\n }\n //todo\n self.onPropertyChanged(\n 'Array-' + item,\n this,\n old,\n this,\n this.$observeProps.$observerPath\n )\n }\n return result\n }\n target[\n 'pure' + item.substring(0, 1).toUpperCase() + item.substring(1)\n ] = function() {\n return Array.prototype[item].apply(\n this,\n Array.prototype.slice.call(arguments)\n )\n }\n })\n },\n watch: function(target, prop, path) {\n if (prop === '$observeProps' || prop === '$observer') return\n if (obaa.isFunction(target[prop])) return\n if (!target.$observeProps) target.$observeProps = {}\n if (path !== undefined) {\n target.$observeProps.$observerPath = path\n } else {\n target.$observeProps.$observerPath = '#'\n }\n var self = this\n var currentValue = (target.$observeProps[prop] = target[prop])\n Object.defineProperty(target, prop, {\n get: function() {\n return this.$observeProps[prop]\n },\n set: function(value) {\n var old = this.$observeProps[prop]\n this.$observeProps[prop] = value\n self.onPropertyChanged(\n prop,\n value,\n old,\n this,\n target.$observeProps.$observerPath\n )\n }\n })\n if (typeof currentValue == 'object') {\n if (obaa.isArray(currentValue)) {\n this.mock(currentValue)\n if (currentValue.length === 0) {\n if (!currentValue.$observeProps) currentValue.$observeProps = {}\n if (path !== undefined) {\n currentValue.$observeProps.$observerPath = path\n } else {\n currentValue.$observeProps.$observerPath = '#'\n }\n }\n }\n for (var cprop in currentValue) {\n if (currentValue.hasOwnProperty(cprop)) {\n this.watch(\n currentValue,\n cprop,\n target.$observeProps.$observerPath + '-' + prop\n )\n }\n }\n }\n }\n }\n return new _observe(target, arr, callback)\n}\n\nobaa.methods = [\n 'concat',\n 'copyWithin',\n 'entries',\n 'every',\n 'fill',\n 'filter',\n 'find',\n 'findIndex',\n 'forEach',\n 'includes',\n 'indexOf',\n 'join',\n 'keys',\n 'lastIndexOf',\n 'map',\n 'pop',\n 'push',\n 'reduce',\n 'reduceRight',\n 'reverse',\n 'shift',\n 'slice',\n 'some',\n 'sort',\n 'splice',\n 'toLocaleString',\n 'toString',\n 'unshift',\n 'values',\n 'size'\n]\nobaa.triggerStr = [\n 'concat',\n 'copyWithin',\n 'fill',\n 'pop',\n 'push',\n 'reverse',\n 'shift',\n 'sort',\n 'splice',\n 'unshift',\n 'size'\n].join(',')\n\nobaa.isArray = function(obj) {\n return Object.prototype.toString.call(obj) === '[object Array]'\n}\n\nobaa.isString = function(obj) {\n return typeof obj === 'string'\n}\n\nobaa.isInArray = function(arr, item) {\n for (var i = arr.length; --i > -1; ) {\n if (item === arr[i]) return true\n }\n return false\n}\n\nobaa.isFunction = function(obj) {\n return Object.prototype.toString.call(obj) == '[object Function]'\n}\n\nobaa._getRootName = function(prop, path) {\n if (path === '#') {\n return prop\n }\n return path.split('-')[1]\n}\n\nobaa.add = function(obj, prop) {\n var $observer = obj.$observer\n $observer.watch(obj, prop)\n}\n\nobaa.set = function(obj, prop, value, exec) {\n if (!exec) {\n obj[prop] = value\n }\n var $observer = obj.$observer\n $observer.watch(obj, prop)\n if (exec) {\n obj[prop] = value\n }\n}\n\nArray.prototype.size = function(length) {\n this.length = length\n}\n\nexport default obaa\n","const callbacks = []\nconst nextTickCallback = []\n\nexport function tick(fn, scope) {\n callbacks.push({ fn, scope })\n}\n\nexport function fireTick() {\n callbacks.forEach(item => {\n item.fn.call(item.scope)\n })\n\n nextTickCallback.forEach(nextItem => {\n nextItem.fn.call(nextItem.scope)\n })\n nextTickCallback.length = 0\n}\n\nexport function nextTick(fn, scope) {\n nextTickCallback.push({ fn, scope })\n}\n","import obaa from './obaa'\nimport { fireTick } from './tick'\n\nexport function proxyUpdate(ele) {\n let timeout = null\n obaa(ele.data, () => {\n if (ele._willUpdate) {\n return\n }\n if (ele.constructor.mergeUpdate) {\n clearTimeout(timeout)\n\n timeout = setTimeout(() => {\n ele.update()\n fireTick()\n }, 0)\n } else {\n ele.update()\n fireTick()\n }\n })\n}\n","import {\n SYNC_RENDER,\n NO_RENDER,\n FORCE_RENDER,\n ASYNC_RENDER,\n ATTR_KEY\n} from '../constants'\nimport options from '../options'\nimport { extend, applyRef } from '../util'\nimport { enqueueRender } from '../render-queue'\nimport { getNodeProps } from './index'\nimport {\n diff,\n mounts,\n diffLevel,\n flushMounts,\n recollectNodeTree,\n removeChildren\n} from './diff'\nimport { createComponent, collectComponent } from './component-recycler'\nimport { removeNode } from '../dom/index'\nimport {\n addScopedAttrStatic,\n getCtorName,\n scopeHost\n} from '../style'\nimport { proxyUpdate } from '../observe'\n\n/** Set a component's `props` (generally derived from JSX attributes).\n *\t@param {Object} props\n *\t@param {Object} [opts]\n *\t@param {boolean} [opts.renderSync=false]\tIf `true` and {@link options.syncComponentUpdates} is `true`, triggers synchronous rendering.\n *\t@param {boolean} [opts.render=true]\t\t\tIf `false`, no render will be triggered.\n */\nexport function setComponentProps(component, props, opts, context, mountAll) {\n if (component._disable) return\n component._disable = true\n\n if ((component.__ref = props.ref)) delete props.ref\n if ((component.__key = props.key)) delete props.key\n\n if (!component.base || mountAll) {\n if (component.beforeInstall) component.beforeInstall()\n if (component.install) component.install()\n if (component.constructor.observe) {\n proxyUpdate(component)\n }\n }\n\n if (context && context !== component.context) {\n if (!component.prevContext) component.prevContext = component.context\n component.context = context\n }\n\n if (!component.prevProps) component.prevProps = component.props\n component.props = props\n\n component._disable = false\n\n if (opts !== NO_RENDER) {\n if (\n opts === SYNC_RENDER ||\n options.syncComponentUpdates !== false ||\n !component.base\n ) {\n renderComponent(component, SYNC_RENDER, mountAll)\n } else {\n enqueueRender(component)\n }\n }\n\n applyRef(component.__ref, component)\n}\n\nfunction shallowComparison(old, attrs) {\n let name\n\n for (name in old) {\n if (attrs[name] == null && old[name] != null) {\n return true\n }\n }\n\n if (old.children.length > 0 || attrs.children.length > 0) {\n return true\n }\n\n for (name in attrs) {\n if (name != 'children') {\n let type = typeof attrs[name]\n if (type == 'function' || type == 'object') {\n return true\n } else if (attrs[name] != old[name]) {\n return true\n }\n }\n }\n}\n\n/** Render a Component, triggering necessary lifecycle events and taking High-Order Components into account.\n *\t@param {Component} component\n *\t@param {Object} [opts]\n *\t@param {boolean} [opts.build=false]\t\tIf `true`, component will build and store a DOM node if not already associated with one.\n *\t@private\n */\nexport function renderComponent(component, opts, mountAll, isChild) {\n if (component._disable) return\n\n let props = component.props,\n data = component.data,\n context = component.context,\n previousProps = component.prevProps || props,\n previousState = component.prevState || data,\n previousContext = component.prevContext || context,\n isUpdate = component.base,\n nextBase = component.nextBase,\n initialBase = isUpdate || nextBase,\n initialChildComponent = component._component,\n skip = false,\n rendered,\n inst,\n cbase\n\n // if updating\n if (isUpdate) {\n component.props = previousProps\n component.data = previousState\n component.context = previousContext\n if (component.store || opts == FORCE_RENDER || shallowComparison(previousProps, props)) {\n let receiveResult = true\n if (component.receiveProps) {\n receiveResult = component.receiveProps(props, previousProps)\n }\n if (receiveResult !== false) {\n skip = false\n if (component.beforeUpdate) {\n component.beforeUpdate(props, data, context)\n }\n } else {\n skip = true\n }\n } else {\n skip = true\n }\n component.props = props\n component.data = data\n component.context = context\n }\n\n component.prevProps = component.prevState = component.prevContext = component.nextBase = null\n\n if (!skip) {\n component.beforeRender && component.beforeRender()\n rendered = component.render(props, data, context)\n\n //don't rerender\n if (component.constructor.css || component.css) {\n addScopedAttrStatic(\n rendered,\n '_s' + getCtorName(component.constructor)\n )\n }\n\n scopeHost(rendered, component.scopedCssAttr)\n\n // context to pass to the child, can be updated via (grand-)parent component\n if (component.getChildContext) {\n context = extend(extend({}, context), component.getChildContext())\n }\n\n let childComponent = rendered && rendered.nodeName,\n toUnmount,\n base,\n ctor = options.mapping[childComponent]\n\n if (ctor) {\n // set up high order component link\n\n let childProps = getNodeProps(rendered)\n inst = initialChildComponent\n\n if (inst && inst.constructor === ctor && childProps.key == inst.__key) {\n setComponentProps(inst, childProps, SYNC_RENDER, context, false)\n } else {\n toUnmount = inst\n\n component._component = inst = createComponent(ctor, childProps, context)\n inst.nextBase = inst.nextBase || nextBase\n inst._parentComponent = component\n setComponentProps(inst, childProps, NO_RENDER, context, false)\n renderComponent(inst, SYNC_RENDER, mountAll, true)\n }\n\n base = inst.base\n } else {\n cbase = initialBase\n\n // destroy high order component link\n toUnmount = initialChildComponent\n if (toUnmount) {\n cbase = component._component = null\n }\n\n if (initialBase || opts === SYNC_RENDER) {\n if (cbase) cbase._component = null\n base = diff(\n cbase,\n rendered,\n context,\n mountAll || !isUpdate,\n initialBase && initialBase.parentNode,\n true\n )\n }\n }\n\n if (initialBase && base !== initialBase && inst !== initialChildComponent) {\n let baseParent = initialBase.parentNode\n if (baseParent && base !== baseParent) {\n baseParent.replaceChild(base, initialBase)\n\n if (!toUnmount) {\n initialBase._component = null\n recollectNodeTree(initialBase, false)\n }\n }\n }\n\n if (toUnmount) {\n unmountComponent(toUnmount)\n }\n\n component.base = base\n if (base && !isChild) {\n let componentRef = component,\n t = component\n while ((t = t._parentComponent)) {\n ;(componentRef = t).base = base\n }\n base._component = componentRef\n base._componentConstructor = componentRef.constructor\n }\n }\n\n if (!isUpdate || mountAll) {\n mounts.unshift(component)\n } else if (!skip) {\n // Ensure that pending componentDidMount() hooks of child components\n // are called before the componentDidUpdate() hook in the parent.\n // Note: disabled as it causes duplicate hooks, see https://github.com/developit/preact/issues/750\n // flushMounts();\n\n if (component.afterUpdate) {\n //deprecated\n component.afterUpdate(previousProps, previousState, previousContext)\n }\n if (component.updated) {\n component.updated(previousProps, previousState, previousContext)\n }\n if (options.afterUpdate) options.afterUpdate(component)\n }\n\n if (component._renderCallbacks != null) {\n while (component._renderCallbacks.length)\n component._renderCallbacks.pop().call(component)\n }\n\n if (!diffLevel && !isChild) flushMounts()\n}\n\n/** Apply the Component referenced by a VNode to the DOM.\n *\t@param {Element} dom\tThe DOM node to mutate\n *\t@param {VNode} vnode\tA Component-referencing VNode\n *\t@returns {Element} dom\tThe created/mutated element\n *\t@private\n */\nexport function buildComponentFromVNode(dom, vnode, context, mountAll) {\n let c = dom && dom._component,\n originalComponent = c,\n oldDom = dom,\n isDirectOwner = c && dom._componentConstructor === vnode.nodeName,\n isOwner = isDirectOwner,\n props = getNodeProps(vnode)\n while (c && !isOwner && (c = c._parentComponent)) {\n isOwner = c.constructor === vnode.nodeName\n }\n\n if (c && isOwner && (!mountAll || c._component)) {\n setComponentProps(c, props, ASYNC_RENDER, context, mountAll)\n dom = c.base\n } else {\n if (originalComponent && !isDirectOwner) {\n unmountComponent(originalComponent)\n dom = oldDom = null\n }\n\n c = createComponent(vnode.nodeName, props, context, vnode)\n if (dom && !c.nextBase) {\n c.nextBase = dom\n // passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229:\n oldDom = null\n }\n setComponentProps(c, props, SYNC_RENDER, context, mountAll)\n dom = c.base\n\n if (oldDom && dom !== oldDom) {\n oldDom._component = null\n recollectNodeTree(oldDom, false)\n }\n }\n\n return dom\n}\n\n/** Remove a component from the DOM and recycle it.\n *\t@param {Component} component\tThe Component instance to unmount\n *\t@private\n */\nexport function unmountComponent(component) {\n if (options.beforeUnmount) options.beforeUnmount(component)\n\n let base = component.base\n\n component._disable = true\n\n\tif (component.uninstall) component.uninstall()\n\n\tif (component.store && component.store.instances) {\n\t\tfor (let i = 0, len = component.store.instances.length; i < len; i++) {\n\t\t\tif (component.store.instances[i] === component) {\n\t\t\t\tcomponent.store.instances.splice(i, 1)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n component.base = null\n\n // recursively tear down & recollect high-order component children:\n let inner = component._component\n if (inner) {\n unmountComponent(inner)\n } else if (base) {\n if (base[ATTR_KEY] != null) applyRef(base[ATTR_KEY].ref, null)\n\n component.nextBase = base\n\n removeNode(base)\n collectComponent(component)\n\n removeChildren(base)\n }\n\n applyRef(component.__ref, null)\n}\n","import { FORCE_RENDER } from './constants'\nimport { renderComponent } from './vdom/component'\nimport options from './options'\nimport { nProps, assign } from './util'\n\nlet id = 0\n\nexport default class Component {\n static is = 'WeElement'\n\n constructor(props, store) {\n this.props = assign(\n nProps(this.constructor.props),\n this.constructor.defaultProps,\n props\n )\n this.elementId = id++\n this.data = this.constructor.data || this.data || {}\n\n this._preCss = null\n\n this.store = store\n }\n\n update(callback) {\n this._willUpdate = true\n if (callback)\n (this._renderCallbacks = this._renderCallbacks || []).push(callback)\n renderComponent(this, FORCE_RENDER)\n if (options.componentChange) options.componentChange(this, this.base)\n this._willUpdate = false\n }\n\n fire(type, data) {\n Object.keys(this.props).every(key => {\n if ('on' + type.toLowerCase() === key.toLowerCase()) {\n this.props[key]({ detail: data })\n return false\n }\n return true\n })\n }\n\n render() {}\n}\n","import { diff } from './vdom/diff'\n\n/** Render JSX into a `parent` Element.\n *\t@param {VNode} vnode\t\tA (JSX) VNode to render\n *\t@param {Element} parent\t\tDOM element to render into\n *\t@param {object} [store]\n *\t@public\n */\nexport function render(vnode, parent, store, empty, merge) {\n parent = typeof parent === 'string' ? document.querySelector(parent) : parent\n\n if (empty) {\n while (parent.firstChild) {\n parent.removeChild(parent.firstChild)\n }\n }\n\n if (merge) {\n merge =\n typeof merge === 'string'\n ? document.querySelector(merge)\n : merge\n }\n\n return diff(merge, vnode, store, false, parent, false, true)\n}\n","import { define } from './define'\n\nexport function tag(name) {\n return function(target) {\n define(name, target)\n }\n}\n","import { h } from './h'\nimport Component from './component'\nimport { render } from './render'\nimport { tag } from './tag'\nimport { define } from './define'\nimport options from './options'\n\nconst WeElement = Component\nconst root = getGlobal()\nconst omiax = {\n h,\n tag,\n\tdefine,\n\tComponent,\n\trender,\n\tWeElement,\n\toptions\n}\n\nroot.Omi = omiax\nroot.omi = omiax\nroot.omiax = omiax\nroot.omiax.version = '0.0.0'\n\nexport default {\n h,\n tag,\n\tdefine,\n\tComponent,\n\trender,\n\tWeElement,\n\toptions\n}\n\nexport {\n h,\n tag,\n\tdefine,\n\tComponent,\n\trender,\n\tWeElement,\n\toptions\n}\n\nfunction getGlobal() {\n if (\n typeof global !== 'object' ||\n !global ||\n global.Math !== Math ||\n global.Array !== Array\n ) {\n if (typeof self !== 'undefined') {\n return self\n } else if (typeof window !== 'undefined') {\n return window\n } else if (typeof global !== 'undefined') {\n return global\n }\n return (function() {\n return this\n })()\n }\n return global\n}\n","import { define, WeElement, render } from '../../src/index'\n\ndefine('my-counter', class extends WeElement {\n count = 1\n\n sub = () => {\n this.count--\n this.update()\n }\n\n add = () => {\n this.count++\n this.update()\n }\n\n render() {\n return (\n
\n \n {this.count}\n \n
\n )\n }\n})\n\nrender(, 'body')"],"names":["stack","h","nodeName","attributes","children","lastSimple","child","simple","i","arguments","length","push","pop","undefined","String","p","key","NO_RENDER","SYNC_RENDER","FORCE_RENDER","ASYNC_RENDER","ATTR_KEY","IS_NON_DIMENSIONAL","nodeId","uniqueId","docMap","addDoc","id","doc","getDoc","removeDoc","insertIndex","target","list","newIndex","before","after","splice","nextSibling","previousSibling","moveIndex","index","indexOf","newIndexAfter","beforeNew","afterNew","removeIndex","changeSibling","linkParent","node","parent","parentNode","docId","ownerDocument","nodeMap","depth","childNodes","forEach","displayMap","div","span","registerNode","Element","type","nodeType","ref","style","display","classStyle","event","firstChild","appendChild","removeChild","insertBefore","insertAfter","removeElement","setAttribute","value","silent","result","setAttr","removeAttribute","setStyle","setStyles","styles","Object","assign","setClassStyle","toStyle","addEventListener","handler","removeEventListener","removeEvent","fireEvent","e","call","getComputedStyle","toJSON","keys","map","replaceChild","newChild","oldChild","destroy","TextNode","nodeValue","splitText","Document","_isMockDocument","createElement","tagName","props","el","createTextNode","txt","listener","scrollTo","x","y","animated","document","getGlobal","global","Math","Array","self","window","scopedStyle","mapping","isWeb","staticStyleMapping","mock","root","styleCache","getOwnPropertySymbols","hasOwnProperty","prototype","propIsEnumerable","propertyIsEnumerable","toObject","val","TypeError","source","from","to","symbols","s","runListeners","oEvent","iLstId","iElId","oEvtListeners","oListeners","aEls","aEvts","sEventType","fListener","nElIdx","aElListeners","create","proto","propertiesObject","Error","F","trim","replace","extend","obj","applyRef","current","usePromise","Promise","__config__","platform","systemVersion","split","defer","resolve","then","bind","setTimeout","isArray","toString","nProps","getUse","data","paths","path","isPath","getTargetByPath","tempPath","tempVal","args","apply","origin","arr","len","items","enqueueRender","component","options","debounceRendering","rerender","renderComponent","isSameNodeType","vnode","hydrating","ctor","_componentConstructor","isNamedNode","normalizedNodeName","toLowerCase","getNodeProps","defaultProps","createNode","isSvg","createElementNS","parseCSSText","cssText","cssTxt","match","a","b","rule","cssToJs","slice","toUpperCase","properties","o","property","removeNode","setAccessor","name","old","className","test","oldJson","currentJson","changed","ckey","innerHTML","__html","useCapture","substring","eventProxy","touchStart","touchEnd","_listeners","setProperty","ns","removeAttributeNS","setAttributeNS","___touchX","touches","pageX","___touchY","pageY","___scrollTop","body","scrollTop","abs","changedTouches","dispatchEvent","CustomEvent","detail","draw","res","console","log","mounts","diffLevel","isSvgMode","flushMounts","c","afterMount","installed","diff","dom","context","mountAll","componentRoot","fromRender","ownerSVGElement","ret","idiff","out","prevSvgMode","vnodeName","buildComponentFromVNode","_component","recollectNodeTree","fc","vchildren","_renderText","text","innerDiffNode","dangerouslySetInnerHTML","diffAttributes","isHydrating","originalChildren","keyed","keyedLen","min","childrenLen","vlen","j","f","vchild","__key","unmountOnly","unmountComponent","removeChildren","lastChild","next","attrs","OBJECTTYPE","ARRAYTYPE","define","use","updatePath","getPath","getUpdatePath","item","dataToPath","_objToPath","_arrayToPath","components","collectComponent","constructor","createComponent","Ctor","inst","render","Component","doRender","scopedCssAttr","css","store","instances","initUse","_updatePath","nextBase","styleId","getCtorName","attrName","addScopedAttrStatic","vdom","attr","scopeVdom","scopeHost","obaa","callback","_observe","$observer","eventPropArr","$observeProps","$observerPath","prop","isInArray","watch","isString","propertyChangedHandler","propChanged","all","onPropertyChanged","oldValue","rootName","_getRootName","methods","RegExp","triggerStr","cprop","isFunction","currentValue","defineProperty","get","set","join","add","exec","size","callbacks","nextTickCallback","fireTick","fn","scope","nextItem","proxyUpdate","ele","timeout","_willUpdate","mergeUpdate","clearTimeout","update","setComponentProps","opts","_disable","__ref","base","beforeInstall","install","observe","prevContext","prevProps","syncComponentUpdates","shallowComparison","isChild","previousProps","previousState","prevState","previousContext","isUpdate","initialBase","initialChildComponent","skip","rendered","cbase","receiveResult","receiveProps","beforeUpdate","beforeRender","getChildContext","childComponent","toUnmount","childProps","_parentComponent","baseParent","componentRef","t","unshift","afterUpdate","updated","_renderCallbacks","originalComponent","oldDom","isDirectOwner","isOwner","beforeUnmount","uninstall","inner","elementId","_preCss","componentChange","fire","every","is","empty","merge","querySelector","tag","WeElement","omiax","Omi","omi","version","count","sub","color"],"mappings":";;;EAAA,IAAMA,QAAQ,EAAd;;EAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,EAAO,SAASC,CAAT,CAAWC,QAAX,EAAqBC,UAArB,EAAiC;EACtC,MAAIC,WAAW,EAAf;EAAA,MACEC,mBADF;EAAA,MAEEC,cAFF;EAAA,MAGEC,eAHF;EAAA,MAIEC,UAJF;EAKA,OAAKA,IAAIC,UAAUC,MAAnB,EAA2BF,MAAM,CAAjC,GAAsC;EACpCR,UAAMW,IAAN,CAAWF,UAAUD,CAAV,CAAX;EACD;EACD,MAAIL,cAAcA,WAAWC,QAAX,IAAuB,IAAzC,EAA+C;EAC7C,QAAI,CAACJ,MAAMU,MAAX,EAAmBV,MAAMW,IAAN,CAAWR,WAAWC,QAAtB;EACnB,WAAOD,WAAWC,QAAlB;EACD;EACD,SAAOJ,MAAMU,MAAb,EAAqB;EACnB,QAAI,CAACJ,QAAQN,MAAMY,GAAN,EAAT,KAAyBN,MAAMM,GAAN,KAAcC,SAA3C,EAAsD;EACpD,WAAKL,IAAIF,MAAMI,MAAf,EAAuBF,GAAvB;EAA8BR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AaA,KAAb;EACA/T,KAAK+T,KAAL,CAAWG,OAAX,GAAqB,OAArB;;EAsBA,SAAS7U,WAAT,GAAqB;EACnB,MACE,OAAOC,MAAP,KAAkB,QAAlB,IACA,CAACA,MADD,IAEAA,OAAOC,IAAP,KAAgBA,IAFhB,IAGAD,OAAOE,KAAP,KAAiBA,KAJnB,EAKE;EACA,QAAI,OAAOC,IAAP,KAAgB,WAApB,EAAiC;EAC/B,aAAOA,IAAP;EACD,KAFD,MAEO,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;EACxC,aAAOA,MAAP;EACD,KAFM,MAEA,IAAI,OAAOJ,MAAP,KAAkB,WAAtB,EAAmC;EACxC,aAAOA,MAAP;EACD;EACD,WAAQ,YAAW;EACjB,aAAO,IAAP;EACD,KAFM,EAAP;EAGD;EACD,SAAOA,MAAP;EACD;;;;;;;;EC7DDmM,OAAO,YAAP;EAAA;;EAAA;EAAA;;EAAA;;EAAA;EAAA;EAAA;;EAAA,4IACE0I,KADF,GACU,CADV,QAGEC,GAHF,GAGQ,YAAM;EACV,YAAKD,KAAL;EACA,YAAK9D,MAAL;EACD,KANH,QAQEf,GARF,GAQQ,YAAM;EACV,YAAK6E,KAAL;EACA,YAAK9D,MAAL;EACD,KAXH;EAAA;;EAAA,oBAaE7D,MAbF,wBAaW;EACP,WACE;EAAA;EAAA;EACE;EAAA;EAAA,UAAQ,SAAS,KAAK4H,GAAtB;EAAA;EAAA,OADF;EAEE;EAAA;EAAA,UAAM,OAAO;EACXC,mBAAO;EADI,WAAb;EAEI,aAAKF;EAFT,OAFF;EAKE;EAAA;EAAA,UAAQ,SAAS,KAAK7E,GAAtB;EAAA;EAAA;EALF,KADF;EASD,GAvBH;;EAAA;EAAA,EAAmCwE,SAAnC;;EA0BAtH,OAAO,yBAAP,EAAuB,MAAvB;;;;"} \ No newline at end of file diff --git a/packages/omiax/examples/simple/index.html b/packages/omiax/examples/simple/index.html deleted file mode 100644 index 46bbb4d59..000000000 --- a/packages/omiax/examples/simple/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/omiax/examples/simple/main.js b/packages/omiax/examples/simple/main.js deleted file mode 100644 index 2ce5da16b..000000000 --- a/packages/omiax/examples/simple/main.js +++ /dev/null @@ -1,29 +0,0 @@ -import { define, WeElement, render } from '../../src/index' - -define('my-counter', class extends WeElement { - count = 1 - - sub = () => { - this.count-- - this.update() - } - - add = () => { - this.count++ - this.update() - } - - render() { - return ( -
- - {this.count} - -
- ) - } -}) - -render(, 'body') \ No newline at end of file diff --git a/packages/omiax/src/omi/h.js b/packages/omiax/src/h.js similarity index 100% rename from packages/omiax/src/omi/h.js rename to packages/omiax/src/h.js diff --git a/packages/omiax/src/index.js b/packages/omiax/src/index.js index 560cd5cfd..823039c84 100644 --- a/packages/omiax/src/index.js +++ b/packages/omiax/src/index.js @@ -1,5 +1,32 @@ -import { define, WeElement, tag, render} from './omi/omi.js' +import { render } from './render' +import { h } from './h' + +const root = getGlobal() + + +root.Omi = { h, version: '0.0.0' } + +function getGlobal() { + if ( + typeof global !== 'object' || + !global || + global.Math !== Math || + global.Array !== Array + ) { + if (typeof self !== 'undefined') { + return self + } else if (typeof window !== 'undefined') { + return window + } else if (typeof global !== 'undefined') { + return global + } + return (function () { + return this + })() + } + return global +} export { - define, WeElement, tag, render -} \ No newline at end of file + render +} diff --git a/packages/omiax/src/omi/class.js b/packages/omiax/src/omi/class.js deleted file mode 100644 index cad84a903..000000000 --- a/packages/omiax/src/omi/class.js +++ /dev/null @@ -1,53 +0,0 @@ -/** - * classNames based on https://github.com/JedWatson/classnames - * by Jed Watson - * Licensed under the MIT License - * https://github.com/JedWatson/classnames/blob/master/LICENSE - * modified by dntzhang - */ - -var hasOwn = {}.hasOwnProperty - -export function classNames() { - var classes = [] - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i] - if (!arg) continue - - var argType = typeof arg - - if (argType === 'string' || argType === 'number') { - classes.push(arg) - } else if (Array.isArray(arg) && arg.length) { - var inner = classNames.apply(null, arg) - if (inner) { - classes.push(inner) - } - } else if (argType === 'object') { - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key) - } - } - } - } - - return classes.join(' ') -} - -export function extractClass() { - const [props, ...args] = Array.prototype.slice.call(arguments, 0) - if (props) { - if (props['class']) { - args.unshift(props['class']) - delete props['class'] - } else if (props.className) { - args.unshift(props.className) - delete props.className - } - } - if (args.length > 0) { - return { 'class': classNames.apply(null, args) } - } -} diff --git a/packages/omiax/src/omi/clone-element.js b/packages/omiax/src/omi/clone-element.js deleted file mode 100755 index 03161f688..000000000 --- a/packages/omiax/src/omi/clone-element.js +++ /dev/null @@ -1,16 +0,0 @@ -import { extend } from './util' -import { h } from './h' - -/** - * Clones the given VNode, optionally adding attributes/props and replacing its children. - * @param {VNode} vnode The virtual DOM element to clone - * @param {Object} props Attributes/props to add when cloning - * @param {VNode} rest Any additional arguments will be used as replacement children. - */ -export function cloneElement(vnode, props) { - return h( - vnode.nodeName, - extend(extend({}, vnode.attributes), props), - arguments.length > 2 ? [].slice.call(arguments, 2) : vnode.children - ) -} diff --git a/packages/omiax/src/omi/component.js b/packages/omiax/src/omi/component.js deleted file mode 100755 index 546ec4bf5..000000000 --- a/packages/omiax/src/omi/component.js +++ /dev/null @@ -1,45 +0,0 @@ -import { FORCE_RENDER } from './constants' -import { renderComponent } from './vdom/component' -import options from './options' -import { nProps, assign } from './util' - -let id = 0 - -export default class Component { - static is = 'WeElement' - - constructor(props, store) { - this.props = assign( - nProps(this.constructor.props), - this.constructor.defaultProps, - props - ) - this.elementId = id++ - this.data = this.constructor.data || this.data || {} - - this._preCss = null - - this.store = store - } - - update(callback) { - this._willUpdate = true - if (callback) - (this._renderCallbacks = this._renderCallbacks || []).push(callback) - renderComponent(this, FORCE_RENDER) - if (options.componentChange) options.componentChange(this, this.base) - this._willUpdate = false - } - - fire(type, data) { - Object.keys(this.props).every(key => { - if ('on' + type.toLowerCase() === key.toLowerCase()) { - this.props[key]({ detail: data }) - return false - } - return true - }) - } - - render() {} -} diff --git a/packages/omiax/src/omi/constants.js b/packages/omiax/src/omi/constants.js deleted file mode 100755 index 29f5d16d2..000000000 --- a/packages/omiax/src/omi/constants.js +++ /dev/null @@ -1,11 +0,0 @@ -// render modes - -export const NO_RENDER = 0 -export const SYNC_RENDER = 1 -export const FORCE_RENDER = 2 -export const ASYNC_RENDER = 3 - -export const ATTR_KEY = '__omiattr_' - -// DOM properties that should NOT have "px" added when numeric -export const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i diff --git a/packages/omiax/src/omi/define.js b/packages/omiax/src/omi/define.js deleted file mode 100644 index 8aee119f8..000000000 --- a/packages/omiax/src/omi/define.js +++ /dev/null @@ -1,82 +0,0 @@ -import options from './options' - -const OBJECTTYPE = '[object Object]' -const ARRAYTYPE = '[object Array]' - -export function define(name, ctor) { - options.mapping[name] = ctor - if (ctor.use) { - ctor.updatePath = getPath(ctor.use) - } else if (ctor.data) { //Compatible with older versions - ctor.updatePath = getUpdatePath(ctor.data) - } -} - -export function getPath(obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - const result = {} - obj.forEach(item => { - if (typeof item === 'string') { - result[item] = true - } else { - const tempPath = item[Object.keys(item)[0]] - if (typeof tempPath === 'string') { - result[tempPath] = true - } else { - if(typeof tempPath[0] === 'string'){ - result[tempPath[0]] = true - }else{ - tempPath[0].forEach(path => result[path] = true) - } - } - } - }) - return result - } else { - return getUpdatePath(obj) - } -} - -export function getUpdatePath(data) { - const result = {} - dataToPath(data, result) - return result -} - -function dataToPath(data, result) { - Object.keys(data).forEach(key => { - result[key] = true - const type = Object.prototype.toString.call(data[key]) - if (type === OBJECTTYPE) { - _objToPath(data[key], key, result) - } else if (type === ARRAYTYPE) { - _arrayToPath(data[key], key, result) - } - }) -} - -function _objToPath(data, path, result) { - Object.keys(data).forEach(key => { - result[path + '.' + key] = true - delete result[path] - const type = Object.prototype.toString.call(data[key]) - if (type === OBJECTTYPE) { - _objToPath(data[key], path + '.' + key, result) - } else if (type === ARRAYTYPE) { - _arrayToPath(data[key], path + '.' + key, result) - } - }) -} - -function _arrayToPath(data, path, result) { - data.forEach((item, index) => { - result[path + '[' + index + ']'] = true - delete result[path] - const type = Object.prototype.toString.call(item) - if (type === OBJECTTYPE) { - _objToPath(item, path + '[' + index + ']', result) - } else if (type === ARRAYTYPE) { - _arrayToPath(item, path + '[' + index + ']', result) - } - }) -} diff --git a/packages/omiax/src/omi/dom/index.js b/packages/omiax/src/omi/dom/index.js deleted file mode 100755 index d5c8c2faf..000000000 --- a/packages/omiax/src/omi/dom/index.js +++ /dev/null @@ -1,183 +0,0 @@ -import { IS_NON_DIMENSIONAL } from '../constants' -import { applyRef } from '../util' -import options from '../options' - -/** Create an element with the given nodeName. - * @param {String} nodeName - * @param {Boolean} [isSvg=false] If `true`, creates an element within the SVG namespace. - * @returns {Element} node - */ -export function createNode(nodeName, isSvg) { - let node = isSvg - ? options.doc.createElementNS('http://www.w3.org/2000/svg', nodeName) - : options.doc.createElement(nodeName) - node.normalizedNodeName = nodeName - return node -} - -function parseCSSText(cssText) { - let cssTxt = cssText.replace(/\/\*(.|\s)*?\*\//g, ' ').replace(/\s+/g, ' ') - let style = {}, - [a, b, rule] = cssTxt.match(/ ?(.*?) ?{([^}]*)}/) || [a, b, cssTxt] - let cssToJs = s => s.replace(/\W+\w/g, match => match.slice(-1).toUpperCase()) - let properties = rule - .split(';') - .map(o => o.split(':').map(x => x && x.trim())) - for (let [property, value] of properties) style[cssToJs(property)] = value - return style -} - -/** Remove a child node from its parent if attached. - * @param {Element} node The node to remove - */ -export function removeNode(node) { - let parentNode = node.parentNode - if (parentNode) parentNode.removeChild(node) -} - -/** Set a named attribute on the given Node, with special behavior for some names and event handlers. - * If `value` is `null`, the attribute/handler will be removed. - * @param {Element} node An element to mutate - * @param {string} name The name/key to set, such as an event or attribute name - * @param {any} old The last value that was set for this name/node pair - * @param {any} value An attribute value, such as a function to be used as an event handler - * @param {Boolean} isSvg Are we currently diffing inside an svg? - * @private - */ -export function setAccessor(node, name, old, value, isSvg) { - if (name === 'className') name = 'class' - - if (name === 'key') { - // ignore - } else if (name === 'ref') { - applyRef(old, null) - applyRef(value, node) - } else if (name === 'class' && !isSvg) { - node.className = value || '' - } else if (name === 'style') { - if (options.isWeb) { - if (!value || typeof value === 'string' || typeof old === 'string') { - node.style.cssText = value || '' - } - if (value && typeof value === 'object') { - if (typeof old !== 'string') { - for (let i in old) if (!(i in value)) node.style[i] = '' - } - for (let i in value) { - node.style[i] = - typeof value[i] === 'number' && IS_NON_DIMENSIONAL.test(i) === false - ? value[i] + 'px' - : value[i] - } - } - } else { - let oldJson = old, - currentJson = value - if (typeof old === 'string') { - oldJson = parseCSSText(old) - } - if (typeof value == 'string') { - currentJson = parseCSSText(value) - } - - let result = {}, - changed = false - - if (oldJson) { - for (let key in oldJson) { - if (typeof currentJson == 'object' && !(key in currentJson)) { - result[key] = '' - changed = true - } - } - - for (let ckey in currentJson) { - if (currentJson[ckey] !== oldJson[ckey]) { - result[ckey] = currentJson[ckey] - changed = true - } - } - - if (changed) { - node.setStyles(result) - } - } else { - node.setStyles(currentJson) - } - } - } else if (name === 'dangerouslySetInnerHTML') { - if (value) node.innerHTML = value.__html || '' - } else if (name[0] == 'o' && name[1] == 'n') { - let useCapture = name !== (name = name.replace(/Capture$/, '')) - name = name.toLowerCase().substring(2) - if (value) { - if (!old) { - node.addEventListener(name, eventProxy, useCapture) - if (name == 'tap') { - node.addEventListener('touchstart', touchStart, useCapture) - node.addEventListener('touchend', touchEnd, useCapture) - } - } - } else { - node.removeEventListener(name, eventProxy, useCapture) - if (name == 'tap') { - node.removeEventListener('touchstart', touchStart, useCapture) - node.removeEventListener('touchend', touchEnd, useCapture) - } - } - ;(node._listeners || (node._listeners = {}))[name] = value - } else if (name !== 'list' && name !== 'type' && !isSvg && name in node) { - setProperty(node, name, value == null ? '' : value) - if (value == null || value === false) node.removeAttribute(name) - } else { - let ns = isSvg && name !== (name = name.replace(/^xlink:?/, '')) - if (value == null || value === false) { - if (ns) - node.removeAttributeNS( - 'http://www.w3.org/1999/xlink', - name.toLowerCase() - ) - else node.removeAttribute(name) - } else if (typeof value !== 'function') { - if (ns) - node.setAttributeNS( - 'http://www.w3.org/1999/xlink', - name.toLowerCase(), - value - ) - else node.setAttribute(name, value) - } - } -} - -/** Attempt to set a DOM property to the given value. - * IE & FF throw for certain property-value combinations. - */ -function setProperty(node, name, value) { - try { - node[name] = value - } catch (e) {} -} - -/** Proxy an event to hooked event handlers - * @private - */ -function eventProxy(e) { - return this._listeners[e.type]((options.event && options.event(e)) || e) -} - -function touchStart(e) { - this.___touchX = e.touches[0].pageX - this.___touchY = e.touches[0].pageY - this.___scrollTop = document.body.scrollTop -} - -function touchEnd(e) { - if ( - Math.abs(e.changedTouches[0].pageX - this.___touchX) < 30 && - Math.abs(e.changedTouches[0].pageY - this.___touchY) < 30 && - Math.abs(document.body.scrollTop - this.___scrollTop) < 30 - ) { - this.dispatchEvent(new CustomEvent('tap', { detail: e })) - } -} \ No newline at end of file diff --git a/packages/omiax/src/omi/get-host.js b/packages/omiax/src/omi/get-host.js deleted file mode 100644 index 35db00517..000000000 --- a/packages/omiax/src/omi/get-host.js +++ /dev/null @@ -1,12 +0,0 @@ -export function getHost(component) { - let base = component.base - if (base) { - while (base.parentNode) { - if (base.parentNode._component) { - return base.parentNode._component - } else { - base = base.parentNode - } - } - } -} \ No newline at end of file diff --git a/packages/omiax/src/omi/mock/README.md b/packages/omiax/src/omi/mock/README.md deleted file mode 100755 index 64f6e9fc1..000000000 --- a/packages/omiax/src/omi/mock/README.md +++ /dev/null @@ -1,7 +0,0 @@ -## document.js - -Implement this web document for client rendering, send instructions to the client through it. - -## element.js - -Implement this web element for client rendering. It has the same API as dom elment. \ No newline at end of file diff --git a/packages/omiax/src/omi/mock/document.js b/packages/omiax/src/omi/mock/document.js deleted file mode 100755 index 49cecb96a..000000000 --- a/packages/omiax/src/omi/mock/document.js +++ /dev/null @@ -1,59 +0,0 @@ -import Element from './element' -import TextNode from './text-node' -import { addDoc, removeDoc } from './util' - - -export default class Document { - constructor(id) { - this.id = id - addDoc(id, this) - this.nodeMap = {} - this._isMockDocument = true - } - - // createBody(type, props) { - // if (!this.body) { - // const el = new Element(type, props) - // el.didMount = true - // el.ownerDocument = this - // el.docId = this.id - // el.style.alignItems = 'flex-start' - // this.body = el - // } - - // return this.body - // } - - createElement(tagName, props) { - let el = new Element(tagName, props) - el.ownerDocument = this - el.docId = this.id - return el - } - - createTextNode(txt){ - const node = new TextNode(txt) - node.docId = this.id - return node - } - - destroy() { - delete this.listener - delete this.nodeMap - removeDoc(this.id) - } - - addEventListener(ref, type) { - //document.addEvent(this.id, ref, type) - } - - removeEventListener(ref, type) { - //document.removeEvent(this.id, ref, type) - } - - - scrollTo(ref, x, y, animated) { - document.scrollTo(this.id, ref, x, y, animated) - } - -} diff --git a/packages/omiax/src/omi/mock/element.js b/packages/omiax/src/omi/mock/element.js deleted file mode 100755 index 02ffcf6d4..000000000 --- a/packages/omiax/src/omi/mock/element.js +++ /dev/null @@ -1,274 +0,0 @@ -import { - getDoc, - uniqueId, - linkParent, - insertIndex, - moveIndex, - removeIndex -} from './util' - -const displayMap = { - div: 'block', - span: 'inline-block' -} - -function registerNode(docId, node) { - const doc = getDoc(docId) - doc.nodeMap[node.nodeId] = node -} - -export default class Element { - constructor(type) { - this.nodeType = 1 - this.nodeId = uniqueId() - this.ref = this.nodeId - this.type = type - this.attributes = {} - this.style = { - display: displayMap[type] - } - this.classStyle = {} - this.event = {} - this.childNodes = [] - - this.nodeName = this.type - - this.parentNode = null - this.nextSibling = null - this.previousSibling = null - this.firstChild = null - } - - appendChild(node) { - if (!node.parentNode) { - linkParent(node, this) - insertIndex(node, this.childNodes, this.childNodes.length, true) - - if (this.docId != undefined) { - registerNode(this.docId, node) - } - - - //this.ownerDocument.addElement(this.ref, node.toJSON(), -1) - - } else { - node.parentNode.removeChild(node) - - this.appendChild(node) - - return - } - - this.firstChild = this.childNodes[0] - - - } - - insertBefore(node, before) { - if (!node.parentNode) { - linkParent(node, this) - const index = insertIndex( - node, - this.childNodes, - this.childNodes.indexOf(before), - true - ) - if (this.docId != undefined) { - registerNode(this.docId, node) - } - - - //this.ownerDocument.addElement(this.ref, node.toJSON(), index) - - } else { - node.parentNode.removeChild(node) - this.insertBefore(node, before) - return - } - - this.firstChild = this.childNodes[0] - } - - insertAfter(node, after) { - if (node.parentNode && node.parentNode !== this) { - return - } - if ( - node === after || - (node.previousSibling && node.previousSibling === after) - ) { - return - } - if (!node.parentNode) { - linkParent(node, this) - const index = insertIndex( - node, - this.childNodes, - this.childNodes.indexOf(after) + 1, - true - ) - - if (this.docId != undefined) { - registerNode(this.docId, node) - } - - //this.ownerDocument.addElement(this.ref, node.toJSON(), index) - - } else { - const index = moveIndex( - node, - this.childNodes, - this.childNodes.indexOf(after) + 1 - ) - - //this.ownerDocument.moveElement(node.ref, this.ref, index) - - } - - this.firstChild = this.childNodes[0] - } - - removeChild(node) { - if (node.parentNode) { - removeIndex(node, this.childNodes, true) - - - this.ownerDocument.removeElement(node.ref) - - } - - node.parentNode = null - - - - this.firstChild = this.childNodes[0] - } - - setAttribute(key, value, silent) { - if (this.attributes[key] === value && silent !== false) { - return - } - this.attributes[key] = value - if (!silent) { - const result = {} - result[key] = value - - this.ownerDocument.setAttr(this.ref, result) - - } - } - - removeAttribute(key) { - if (this.attributes[key]) { - delete this.attributes[key] - } - } - - setStyle(key, value, silent) { - if (this.style[key] === value && silent !== false) { - return - } - this.style[key] = value - if (!silent && this.ownerDocument) { - const result = {} - result[key] = value - - this.ownerDocument.setStyles(this.ref, result) - - } - } - - setStyles(styles) { - Object.assign(this.style, styles) - if (this.ownerDocument) { - - this.ownerDocument.setStyles(this.ref, styles) - - } - } - - setClassStyle(classStyle) { - for (const key in this.classStyle) { - this.classStyle[key] = '' - } - - Object.assign(this.classStyle, classStyle) - - - this.ownerDocument.setStyles(this.ref, this.toStyle()) - - } - - addEventListener(type, handler) { - if (!this.event[type]) { - this.event[type] = handler - - //this.ownerDocument.addEvent(this.ref, type) - } - } - - removeEventListener(type) { - if (this.event[type]) { - delete this.event[type] - let doc = getDoc(this.docId) - doc.nodeMap[this.ref] && - doc.nodeMap[this.ref].event && - doc.nodeMap[this.ref].event[type] - ? (doc.nodeMap[this.ref].event[type] = null) - : '' - - this.ownerDocument.removeEvent(this.ref, type) - } - } - - fireEvent(type, e) { - const handler = this.event[type] - if (handler) { - return handler.call(this, e) - } - } - - toStyle() { - return Object.assign({}, this.classStyle, this.style) - } - - getComputedStyle() { } - - toJSON() { - let result = { - id: this.ref, - type: this.type, - docId: this.docId || -10000, - attributes: this.attributes ? this.attributes : {} - } - result.attributes.style = this.toStyle() - - const event = Object.keys(this.event) - if (event.length) { - result.event = event - } - - if (this.childNodes.length) { - result.children = this.childNodes.map(child => child.toJSON()) - } - return result - } - - replaceChild(newChild, oldChild) { - this.insertBefore(newChild, oldChild) - this.removeChild(oldChild) - } - - destroy() { - const doc = getDoc(this.docId) - - if (doc) { - delete doc.nodeMap[this.nodeId] - } - - this.parentNode = null - this.childNodes.forEach(child => { - child.destroy() - }) - } -} diff --git a/packages/omiax/src/omi/mock/index.js b/packages/omiax/src/omi/mock/index.js deleted file mode 100644 index 02dd95f84..000000000 --- a/packages/omiax/src/omi/mock/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import Document from './document' - - -export default { - document: new Document(0) -} diff --git a/packages/omiax/src/omi/mock/text-node.js b/packages/omiax/src/omi/mock/text-node.js deleted file mode 100755 index 8f76d4005..000000000 --- a/packages/omiax/src/omi/mock/text-node.js +++ /dev/null @@ -1,88 +0,0 @@ -import { - getDoc, - uniqueId -} from './util' - - -function registerNode(docId, node) { - const doc = getDoc(docId) - doc.nodeMap[node.nodeId] = node -} - -export default class TextNode { - constructor(nodeValue) { - this.nodeType = 3 - this.nodeId = uniqueId() - this.ref = this.nodeId - this.attributes = {} - this.style = { - display: 'inline' - } - this.classStyle = {} - this.event = {} - this.nodeValue = nodeValue - this.parentNode = null - this.nextSibling = null - this.previousSibling = null - this.firstChild = null - this.type = 'text' - } - - setAttribute(key, value, silent) { - if (this.attributes[key] === value && silent !== false) { - return - } - this.attributes[key] = value - if (!silent) { - const result = {} - result[key] = value - - this.ownerDocument.setAttr(this.ref, result) - - } - } - - removeAttribute(key) { - if (this.attributes[key]) { - delete this.attributes[key] - } - } - - toStyle() { - return Object.assign({}, this.classStyle, this.style) - } - - splitText() { - - } - - getComputedStyle() { } - - toJSON() { - let result = { - id: this.ref, - type: this.type, - docId: this.docId || -10000, - attributes: this.attributes ? this.attributes : {} - } - result.attributes.style = this.toStyle() - - const event = Object.keys(this.event) - if (event.length) { - result.event = event - } - - return result - } - - destroy() { - const doc = getDoc(this.docId) - - if (doc) { - delete doc.nodeMap[this.nodeId] - } - - this.parentNode = null - - } -} diff --git a/packages/omiax/src/omi/mock/util.js b/packages/omiax/src/omi/mock/util.js deleted file mode 100755 index 99db2ce96..000000000 --- a/packages/omiax/src/omi/mock/util.js +++ /dev/null @@ -1,138 +0,0 @@ -let nodeId = 1 -export function uniqueId() { - return nodeId++ -} - -let docMap = {} - -export function addDoc(id, doc) { - docMap[id] = doc -} - -export function getDoc(id) { - return docMap[id] -} - -export function removeDoc(id) { - delete docMap[id] -} - -let sendBridgeFlag = {} - -export function getSendBridgeFlag() { - return sendBridgeFlag -} - -export function setSendBridgeFlag(docId, flag) { - return (sendBridgeFlag[docId] = flag) -} - -export function insertIndex(target, list, newIndex) { - if (newIndex < 0) { - newIndex = 0 - } - const before = list[newIndex - 1] - const after = list[newIndex] - list.splice(newIndex, 0, target) - - before && (before.nextSibling = target) - target.previousSibling = before - target.nextSibling = after - after && (after.previousSibling = target) - - return newIndex -} - -export function moveIndex(target, list, newIndex) { - const index = list.indexOf(target) - - if (index < 0) { - return -1 - } - - const before = list[index - 1] - const after = list[index + 1] - before && (before.nextSibling = after) - after && (after.previousSibling = before) - - list.splice(index, 1) - let newIndexAfter = newIndex - if (index <= newIndex) { - newIndexAfter = newIndex - 1 - } - const beforeNew = list[newIndexAfter - 1] - const afterNew = list[newIndexAfter] - list.splice(newIndexAfter, 0, target) - - beforeNew && (beforeNew.nextSibling = target) - target.previousSibling = beforeNew - target.nextSibling = afterNew - afterNew && (afterNew.previousSibling = target) - - if (index === newIndexAfter) { - return -1 - } - return newIndex -} - -export function removeIndex(target, list, changeSibling) { - const index = list.indexOf(target) - - if (index < 0) { - return - } - if (changeSibling) { - const before = list[index - 1] - const after = list[index + 1] - before && (before.nextSibling = after) - after && (after.previousSibling = before) - } - list.splice(index, 1) -} - -export function remove(target, list) { - const index = list.indexOf(target) - - if (index < 0) { - return - } - - const before = list[index - 1] - const after = list[index + 1] - before && (before.nextSibling = after) - after && (after.previousSibling = before) - - list.splice(index, 1) -} - -export function linkParent(node, parent) { - node.parentNode = parent - if (parent.docId) { - node.docId = parent.docId - node.ownerDocument = parent.ownerDocument - node.ownerDocument.nodeMap[node.nodeId] = node - node.depth = parent.depth + 1 - } - - node.childNodes && node.childNodes.forEach(child => { - linkParent(child, node) - }) -} - -export function nextElement(node) { - while (node) { - if (node.nodeType === 1) { - return node - } - node = node.nextSibling - } -} - -export function previousElement(node) { - while (node) { - if (node.nodeType === 1) { - return node - } - node = node.previousSibling - } -} diff --git a/packages/omiax/src/omi/model-view.js b/packages/omiax/src/omi/model-view.js deleted file mode 100644 index 590cfe321..000000000 --- a/packages/omiax/src/omi/model-view.js +++ /dev/null @@ -1,11 +0,0 @@ -import Component from './component' - -export default class ModelView extends Component { - static observe = true - - static mergeUpdate = true - - beforeInstall() { - this.data = this.vm.data - } -} diff --git a/packages/omiax/src/omi/obaa.js b/packages/omiax/src/omi/obaa.js deleted file mode 100755 index 53452dec5..000000000 --- a/packages/omiax/src/omi/obaa.js +++ /dev/null @@ -1,249 +0,0 @@ -/* obaa 1.0.0 - * By dntzhang - * Github: https://github.com/Tencent/omi - * MIT Licensed. - */ - -var obaa = function(target, arr, callback) { - var _observe = function(target, arr, callback) { - if (!target.$observer) target.$observer = this - var $observer = target.$observer - var eventPropArr = [] - if (obaa.isArray(target)) { - if (target.length === 0) { - target.$observeProps = {} - target.$observeProps.$observerPath = '#' - } - $observer.mock(target) - } - for (var prop in target) { - if (target.hasOwnProperty(prop)) { - if (callback) { - if (obaa.isArray(arr) && obaa.isInArray(arr, prop)) { - eventPropArr.push(prop) - $observer.watch(target, prop) - } else if (obaa.isString(arr) && prop == arr) { - eventPropArr.push(prop) - $observer.watch(target, prop) - } - } else { - eventPropArr.push(prop) - $observer.watch(target, prop) - } - } - } - $observer.target = target - if (!$observer.propertyChangedHandler) $observer.propertyChangedHandler = [] - var propChanged = callback ? callback : arr - $observer.propertyChangedHandler.push({ - all: !callback, - propChanged: propChanged, - eventPropArr: eventPropArr - }) - } - _observe.prototype = { - onPropertyChanged: function(prop, value, oldValue, target, path) { - if (value !== oldValue && this.propertyChangedHandler) { - var rootName = obaa._getRootName(prop, path) - for ( - var i = 0, len = this.propertyChangedHandler.length; - i < len; - i++ - ) { - var handler = this.propertyChangedHandler[i] - if ( - handler.all || - obaa.isInArray(handler.eventPropArr, rootName) || - rootName.indexOf('Array-') === 0 - ) { - handler.propChanged.call(this.target, prop, value, oldValue, path) - } - } - } - if (prop.indexOf('Array-') !== 0 && typeof value === 'object') { - this.watch(target, prop, target.$observeProps.$observerPath) - } - }, - mock: function(target) { - var self = this - obaa.methods.forEach(function(item) { - target[item] = function() { - var old = Array.prototype.slice.call(this, 0) - var result = Array.prototype[item].apply( - this, - Array.prototype.slice.call(arguments) - ) - if (new RegExp('\\b' + item + '\\b').test(obaa.triggerStr)) { - for (var cprop in this) { - if (this.hasOwnProperty(cprop) && !obaa.isFunction(this[cprop])) { - self.watch(this, cprop, this.$observeProps.$observerPath) - } - } - //todo - self.onPropertyChanged( - 'Array-' + item, - this, - old, - this, - this.$observeProps.$observerPath - ) - } - return result - } - target[ - 'pure' + item.substring(0, 1).toUpperCase() + item.substring(1) - ] = function() { - return Array.prototype[item].apply( - this, - Array.prototype.slice.call(arguments) - ) - } - }) - }, - watch: function(target, prop, path) { - if (prop === '$observeProps' || prop === '$observer') return - if (obaa.isFunction(target[prop])) return - if (!target.$observeProps) target.$observeProps = {} - if (path !== undefined) { - target.$observeProps.$observerPath = path - } else { - target.$observeProps.$observerPath = '#' - } - var self = this - var currentValue = (target.$observeProps[prop] = target[prop]) - Object.defineProperty(target, prop, { - get: function() { - return this.$observeProps[prop] - }, - set: function(value) { - var old = this.$observeProps[prop] - this.$observeProps[prop] = value - self.onPropertyChanged( - prop, - value, - old, - this, - target.$observeProps.$observerPath - ) - } - }) - if (typeof currentValue == 'object') { - if (obaa.isArray(currentValue)) { - this.mock(currentValue) - if (currentValue.length === 0) { - if (!currentValue.$observeProps) currentValue.$observeProps = {} - if (path !== undefined) { - currentValue.$observeProps.$observerPath = path - } else { - currentValue.$observeProps.$observerPath = '#' - } - } - } - for (var cprop in currentValue) { - if (currentValue.hasOwnProperty(cprop)) { - this.watch( - currentValue, - cprop, - target.$observeProps.$observerPath + '-' + prop - ) - } - } - } - } - } - return new _observe(target, arr, callback) -} - -obaa.methods = [ - 'concat', - 'copyWithin', - 'entries', - 'every', - 'fill', - 'filter', - 'find', - 'findIndex', - 'forEach', - 'includes', - 'indexOf', - 'join', - 'keys', - 'lastIndexOf', - 'map', - 'pop', - 'push', - 'reduce', - 'reduceRight', - 'reverse', - 'shift', - 'slice', - 'some', - 'sort', - 'splice', - 'toLocaleString', - 'toString', - 'unshift', - 'values', - 'size' -] -obaa.triggerStr = [ - 'concat', - 'copyWithin', - 'fill', - 'pop', - 'push', - 'reverse', - 'shift', - 'sort', - 'splice', - 'unshift', - 'size' -].join(',') - -obaa.isArray = function(obj) { - return Object.prototype.toString.call(obj) === '[object Array]' -} - -obaa.isString = function(obj) { - return typeof obj === 'string' -} - -obaa.isInArray = function(arr, item) { - for (var i = arr.length; --i > -1; ) { - if (item === arr[i]) return true - } - return false -} - -obaa.isFunction = function(obj) { - return Object.prototype.toString.call(obj) == '[object Function]' -} - -obaa._getRootName = function(prop, path) { - if (path === '#') { - return prop - } - return path.split('-')[1] -} - -obaa.add = function(obj, prop) { - var $observer = obj.$observer - $observer.watch(obj, prop) -} - -obaa.set = function(obj, prop, value, exec) { - if (!exec) { - obj[prop] = value - } - var $observer = obj.$observer - $observer.watch(obj, prop) - if (exec) { - obj[prop] = value - } -} - -Array.prototype.size = function(length) { - this.length = length -} - -export default obaa diff --git a/packages/omiax/src/omi/observe.js b/packages/omiax/src/omi/observe.js deleted file mode 100644 index 16f5d526e..000000000 --- a/packages/omiax/src/omi/observe.js +++ /dev/null @@ -1,22 +0,0 @@ -import obaa from './obaa' -import { fireTick } from './tick' - -export function proxyUpdate(ele) { - let timeout = null - obaa(ele.data, () => { - if (ele._willUpdate) { - return - } - if (ele.constructor.mergeUpdate) { - clearTimeout(timeout) - - timeout = setTimeout(() => { - ele.update() - fireTick() - }, 0) - } else { - ele.update() - fireTick() - } - }) -} diff --git a/packages/omiax/src/omi/omi.d.ts b/packages/omiax/src/omi/omi.d.ts deleted file mode 100755 index 11a8adc26..000000000 --- a/packages/omiax/src/omi/omi.d.ts +++ /dev/null @@ -1,978 +0,0 @@ -export = Omi; -export as namespace Omi; - -declare namespace Omi { - type Callback = (...args: any[]) => void; - type Key = string | number; - type Ref = (instance: T) => void; - type ComponentChild = VNode | object | string | number | boolean | null; - type ComponentChildren = ComponentChild[] | ComponentChild; - - interface Attributes { - key?: string | number | any; - } - - interface ClassAttributes extends Attributes { - ref?: Ref; - } - - interface OmiDOMAttributes { - children?: ComponentChildren; - dangerouslySetInnerHTML?: { - __html: string; - }; - } - - /** - * Use this to manually set the attributes of a custom element - * - * declare global { - * namespace JSX { - * interface IntrinsicElements { - * 'hello-element': CustomElementBaseAttributes & { - * propFromParent: string; - * } - * } - * } - * } - */ - interface CustomElementBaseAttributes extends ClassAttributes, OmiDOMAttributes {} - - /** - * Define the contract for a virtual node in omi. - * - * A virtual node has a name, a map of attributes, an array - * of child {VNode}s and a key. The key is used by omi for - * internal purposes. - */ - interface VNode

{ - nodeName: string; - attributes: P; - children: Array | string>; - key?: Key | null; - } - - type RenderableProps = Readonly< - P & Attributes & { children?: ComponentChildren; ref?: Ref } - >; - - interface WeElement { - install?(): void; - installed?(): void; - uninstall?(): void; - beforeUpdate?(): void; - afterUpdate?(): void; - updated?(): void; - beforeRender?(): void; - receiveProps?(props: RenderableProps

, oldProps:RenderableProps

): any; - } - - interface ModelView { - install?(): void; - installed?(): void; - uninstall?(): void; - beforeUpdate?(): void; - afterUpdate?(): void; - updated?(): void; - beforeRender?(): void; - receiveProps?(props: RenderableProps

, oldProps:RenderableProps

): any; - } - - interface Component { - install?(): void; - installed?(): void; - uninstall?(): void; - beforeUpdate?(): void; - afterUpdate?(): void; - updated?(): void; - beforeRender?(): void; - receiveProps?(props: RenderableProps

, oldProps:RenderableProps

): any; - } - - abstract class WeElement

{ - constructor(); - - // Allow static members to reference class type parameters - // https://github.com/Microsoft/TypeScript/issues/24018 - static props: object; - static data: object; - static observe: boolean; - static mergeUpdate: boolean; - static css: string; - - props: RenderableProps

; - data: D; - host: HTMLElement; - - update(): void; - fire(name: string, data?: object): void; - css(): string; - // Abstract methods don't infer argument types - // https://github.com/Microsoft/TypeScript/issues/14887 - abstract render(props: RenderableProps

, data: D): void; - } - - // The class type (not instance of class) - // https://stackoverflow.com/q/42753968/2777142 - interface WeElementConstructor { - new(): WeElement; - } - - abstract class ModelView

{ - constructor(); - - // Allow static members to reference class type parameters - // https://github.com/Microsoft/TypeScript/issues/24018 - static props: object; - static data: object; - static observe: boolean; - static mergeUpdate: boolean; - - props: RenderableProps

; - data: D; - host: HTMLElement; - - update(): void; - fire(name: string, data?: object): void; - - // Abstract methods don't infer argument types - // https://github.com/Microsoft/TypeScript/issues/14887 - abstract render(props: RenderableProps

, data: D): void; - } - - abstract class Component

{ - constructor(); - - // Allow static members to reference class type parameters - // https://github.com/Microsoft/TypeScript/issues/24018 - static props: object; - static data: object; - static observe: boolean; - static mergeUpdate: boolean; - static css: string; - - props: RenderableProps

; - data: D; - host: HTMLElement; - - update(): void; - fire(name: string, data?: object): void; - css(): string; - // Abstract methods don't infer argument types - // https://github.com/Microsoft/TypeScript/issues/14887 - abstract render(props: RenderableProps

, data: D): void; - } - - function h

( - node: string, - params: Attributes & P | null, - ...children: ComponentChildren[] - ): VNode; - function h( - node: string, - params: JSX.HTMLAttributes & JSX.SVGAttributes & Record | null, - ...children: ComponentChildren[] - ): VNode; - - function render(vnode: ComponentChild, parent: string | Element | Document | ShadowRoot | DocumentFragment, store?: object, empty?: boolean, merge?: string | Element | Document | ShadowRoot | DocumentFragment): void; - - function define(name: string, ctor: WeElementConstructor): void; - function tag(name: string, pure?: boolean): (ctor: WeElementConstructor) => void; - function tick(callback: Callback, scope?: any): void; - function nextTick(callback: Callback, scope?: any): void; - function observe(target: WeElementConstructor): void; - function getHost(element: WeElement): WeElement; - function classNames(...args: any[]): string; - function extractClass(...args: any[]): object; - - var options: { - vnode?: (vnode: VNode) => void; - event?: (event: Event) => Event; - }; -} - - -type Defaultize = - // Distribute over unions - Props extends any - ? // Make any properties included in Default optional - & Partial>> - // Include the remaining properties from Props - & Pick> - : never; - -declare global { - namespace JSX { - interface Element extends Omi.VNode { - } - - interface ElementClass extends Omi.WeElement { - } - - interface ElementClass extends Omi.Component { - } - - interface ElementAttributesProperty { - props: any; - } - - interface ElementChildrenAttribute { - children: any; - } - - type LibraryManagedAttributes = - Component extends { defaultProps: infer Defaults } - ? Defaultize - : Props; - - interface SVGAttributes extends HTMLAttributes { - accentHeight?: number | string; - accumulate?: "none" | "sum"; - additive?: "replace" | "sum"; - alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" | "text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit"; - allowReorder?: "no" | "yes"; - alphabetic?: number | string; - amplitude?: number | string; - arabicForm?: "initial" | "medial" | "terminal" | "isolated"; - ascent?: number | string; - attributeName?: string; - attributeType?: string; - autoReverse?: number | string; - azimuth?: number | string; - baseFrequency?: number | string; - baselineShift?: number | string; - baseProfile?: number | string; - bbox?: number | string; - begin?: number | string; - bias?: number | string; - by?: number | string; - calcMode?: number | string; - capHeight?: number | string; - clip?: number | string; - clipPath?: string; - clipPathUnits?: number | string; - clipRule?: number | string; - colorInterpolation?: number | string; - colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit"; - colorProfile?: number | string; - colorRendering?: number | string; - contentScriptType?: number | string; - contentStyleType?: number | string; - cursor?: number | string; - cx?: number | string; - cy?: number | string; - d?: string; - decelerate?: number | string; - descent?: number | string; - diffuseConstant?: number | string; - direction?: number | string; - display?: number | string; - divisor?: number | string; - dominantBaseline?: number | string; - dur?: number | string; - dx?: number | string; - dy?: number | string; - edgeMode?: number | string; - elevation?: number | string; - enableBackground?: number | string; - end?: number | string; - exponent?: number | string; - externalResourcesRequired?: number | string; - fill?: string; - fillOpacity?: number | string; - fillRule?: "nonzero" | "evenodd" | "inherit"; - filter?: string; - filterRes?: number | string; - filterUnits?: number | string; - floodColor?: number | string; - floodOpacity?: number | string; - focusable?: number | string; - fontFamily?: string; - fontSize?: number | string; - fontSizeAdjust?: number | string; - fontStretch?: number | string; - fontStyle?: number | string; - fontVariant?: number | string; - fontWeight?: number | string; - format?: number | string; - from?: number | string; - fx?: number | string; - fy?: number | string; - g1?: number | string; - g2?: number | string; - glyphName?: number | string; - glyphOrientationHorizontal?: number | string; - glyphOrientationVertical?: number | string; - glyphRef?: number | string; - gradientTransform?: string; - gradientUnits?: string; - hanging?: number | string; - horizAdvX?: number | string; - horizOriginX?: number | string; - ideographic?: number | string; - imageRendering?: number | string; - in2?: number | string; - in?: string; - intercept?: number | string; - k1?: number | string; - k2?: number | string; - k3?: number | string; - k4?: number | string; - k?: number | string; - kernelMatrix?: number | string; - kernelUnitLength?: number | string; - kerning?: number | string; - keyPoints?: number | string; - keySplines?: number | string; - keyTimes?: number | string; - lengthAdjust?: number | string; - letterSpacing?: number | string; - lightingColor?: number | string; - limitingConeAngle?: number | string; - local?: number | string; - markerEnd?: string; - markerHeight?: number | string; - markerMid?: string; - markerStart?: string; - markerUnits?: number | string; - markerWidth?: number | string; - mask?: string; - maskContentUnits?: number | string; - maskUnits?: number | string; - mathematical?: number | string; - mode?: number | string; - numOctaves?: number | string; - offset?: number | string; - opacity?: number | string; - operator?: number | string; - order?: number | string; - orient?: number | string; - orientation?: number | string; - origin?: number | string; - overflow?: number | string; - overlinePosition?: number | string; - overlineThickness?: number | string; - paintOrder?: number | string; - panose1?: number | string; - pathLength?: number | string; - patternContentUnits?: string; - patternTransform?: number | string; - patternUnits?: string; - pointerEvents?: number | string; - points?: string; - pointsAtX?: number | string; - pointsAtY?: number | string; - pointsAtZ?: number | string; - preserveAlpha?: number | string; - preserveAspectRatio?: string; - primitiveUnits?: number | string; - r?: number | string; - radius?: number | string; - refX?: number | string; - refY?: number | string; - renderingIntent?: number | string; - repeatCount?: number | string; - repeatDur?: number | string; - requiredExtensions?: number | string; - requiredFeatures?: number | string; - restart?: number | string; - result?: string; - rotate?: number | string; - rx?: number | string; - ry?: number | string; - scale?: number | string; - seed?: number | string; - shapeRendering?: number | string; - slope?: number | string; - spacing?: number | string; - specularConstant?: number | string; - specularExponent?: number | string; - speed?: number | string; - spreadMethod?: string; - startOffset?: number | string; - stdDeviation?: number | string; - stemh?: number | string; - stemv?: number | string; - stitchTiles?: number | string; - stopColor?: string; - stopOpacity?: number | string; - strikethroughPosition?: number | string; - strikethroughThickness?: number | string; - string?: number | string; - stroke?: string; - strokeDasharray?: string | number; - strokeDashoffset?: string | number; - strokeLinecap?: "butt" | "round" | "square" | "inherit"; - strokeLinejoin?: "miter" | "round" | "bevel" | "inherit"; - strokeMiterlimit?: string; - strokeOpacity?: number | string; - strokeWidth?: number | string; - surfaceScale?: number | string; - systemLanguage?: number | string; - tableValues?: number | string; - targetX?: number | string; - targetY?: number | string; - textAnchor?: string; - textDecoration?: number | string; - textLength?: number | string; - textRendering?: number | string; - to?: number | string; - transform?: string; - u1?: number | string; - u2?: number | string; - underlinePosition?: number | string; - underlineThickness?: number | string; - unicode?: number | string; - unicodeBidi?: number | string; - unicodeRange?: number | string; - unitsPerEm?: number | string; - vAlphabetic?: number | string; - values?: string; - vectorEffect?: number | string; - version?: string; - vertAdvY?: number | string; - vertOriginX?: number | string; - vertOriginY?: number | string; - vHanging?: number | string; - vIdeographic?: number | string; - viewBox?: string; - viewTarget?: number | string; - visibility?: number | string; - vMathematical?: number | string; - widths?: number | string; - wordSpacing?: number | string; - writingMode?: number | string; - x1?: number | string; - x2?: number | string; - x?: number | string; - xChannelSelector?: string; - xHeight?: number | string; - xlinkActuate?: string; - xlinkArcrole?: string; - xlinkHref?: string; - xlinkRole?: string; - xlinkShow?: string; - xlinkTitle?: string; - xlinkType?: string; - xmlBase?: string; - xmlLang?: string; - xmlns?: string; - xmlnsXlink?: string; - xmlSpace?: string; - y1?: number | string; - y2?: number | string; - y?: number | string; - yChannelSelector?: string; - z?: number | string; - zoomAndPan?: string; - } - - interface PathAttributes { - d: string; - } - - interface EventHandler { - (event: E): void; - } - - type ClipboardEventHandler = EventHandler; - type CompositionEventHandler = EventHandler; - type DragEventHandler = EventHandler; - type FocusEventHandler = EventHandler; - type KeyboardEventHandler = EventHandler; - type MouseEventHandler = EventHandler; - type TouchEventHandler = EventHandler; - type UIEventHandler = EventHandler; - type WheelEventHandler = EventHandler; - type AnimationEventHandler = EventHandler; - type TransitionEventHandler = EventHandler; - type GenericEventHandler = EventHandler; - type PointerEventHandler = EventHandler; - - interface DOMAttributes extends Omi.OmiDOMAttributes { - // Image Events - onLoad?: GenericEventHandler; - onError?: GenericEventHandler; - onLoadCapture?: GenericEventHandler; - - // Clipboard Events - onCopy?: ClipboardEventHandler; - onCopyCapture?: ClipboardEventHandler; - onCut?: ClipboardEventHandler; - onCutCapture?: ClipboardEventHandler; - onPaste?: ClipboardEventHandler; - onPasteCapture?: ClipboardEventHandler; - - // Composition Events - onCompositionEnd?: CompositionEventHandler; - onCompositionEndCapture?: CompositionEventHandler; - onCompositionStart?: CompositionEventHandler; - onCompositionStartCapture?: CompositionEventHandler; - onCompositionUpdate?: CompositionEventHandler; - onCompositionUpdateCapture?: CompositionEventHandler; - - // Focus Events - onFocus?: FocusEventHandler; - onFocusCapture?: FocusEventHandler; - onBlur?: FocusEventHandler; - onBlurCapture?: FocusEventHandler; - - // Form Events - onChange?: GenericEventHandler; - onChangeCapture?: GenericEventHandler; - onInput?: GenericEventHandler; - onInputCapture?: GenericEventHandler; - onSearch?: GenericEventHandler; - onSearchCapture?: GenericEventHandler; - onSubmit?: GenericEventHandler; - onSubmitCapture?: GenericEventHandler; - - // Keyboard Events - onKeyDown?: KeyboardEventHandler; - onKeyDownCapture?: KeyboardEventHandler; - onKeyPress?: KeyboardEventHandler; - onKeyPressCapture?: KeyboardEventHandler; - onKeyUp?: KeyboardEventHandler; - onKeyUpCapture?: KeyboardEventHandler; - - // Media Events - onAbort?: GenericEventHandler; - onAbortCapture?: GenericEventHandler; - onCanPlay?: GenericEventHandler; - onCanPlayCapture?: GenericEventHandler; - onCanPlayThrough?: GenericEventHandler; - onCanPlayThroughCapture?: GenericEventHandler; - onDurationChange?: GenericEventHandler; - onDurationChangeCapture?: GenericEventHandler; - onEmptied?: GenericEventHandler; - onEmptiedCapture?: GenericEventHandler; - onEncrypted?: GenericEventHandler; - onEncryptedCapture?: GenericEventHandler; - onEnded?: GenericEventHandler; - onEndedCapture?: GenericEventHandler; - onLoadedData?: GenericEventHandler; - onLoadedDataCapture?: GenericEventHandler; - onLoadedMetadata?: GenericEventHandler; - onLoadedMetadataCapture?: GenericEventHandler; - onLoadStart?: GenericEventHandler; - onLoadStartCapture?: GenericEventHandler; - onPause?: GenericEventHandler; - onPauseCapture?: GenericEventHandler; - onPlay?: GenericEventHandler; - onPlayCapture?: GenericEventHandler; - onPlaying?: GenericEventHandler; - onPlayingCapture?: GenericEventHandler; - onProgress?: GenericEventHandler; - onProgressCapture?: GenericEventHandler; - onRateChange?: GenericEventHandler; - onRateChangeCapture?: GenericEventHandler; - onSeeked?: GenericEventHandler; - onSeekedCapture?: GenericEventHandler; - onSeeking?: GenericEventHandler; - onSeekingCapture?: GenericEventHandler; - onStalled?: GenericEventHandler; - onStalledCapture?: GenericEventHandler; - onSuspend?: GenericEventHandler; - onSuspendCapture?: GenericEventHandler; - onTimeUpdate?: GenericEventHandler; - onTimeUpdateCapture?: GenericEventHandler; - onVolumeChange?: GenericEventHandler; - onVolumeChangeCapture?: GenericEventHandler; - onWaiting?: GenericEventHandler; - onWaitingCapture?: GenericEventHandler; - - // MouseEvents - onClick?: MouseEventHandler; - onClickCapture?: MouseEventHandler; - onContextMenu?: MouseEventHandler; - onContextMenuCapture?: MouseEventHandler; - onDblClick?: MouseEventHandler; - onDblClickCapture?: MouseEventHandler; - onDrag?: DragEventHandler; - onDragCapture?: DragEventHandler; - onDragEnd?: DragEventHandler; - onDragEndCapture?: DragEventHandler; - onDragEnter?: DragEventHandler; - onDragEnterCapture?: DragEventHandler; - onDragExit?: DragEventHandler; - onDragExitCapture?: DragEventHandler; - onDragLeave?: DragEventHandler; - onDragLeaveCapture?: DragEventHandler; - onDragOver?: DragEventHandler; - onDragOverCapture?: DragEventHandler; - onDragStart?: DragEventHandler; - onDragStartCapture?: DragEventHandler; - onDrop?: DragEventHandler; - onDropCapture?: DragEventHandler; - onMouseDown?: MouseEventHandler; - onMouseDownCapture?: MouseEventHandler; - onMouseEnter?: MouseEventHandler; - onMouseEnterCapture?: MouseEventHandler; - onMouseLeave?: MouseEventHandler; - onMouseLeaveCapture?: MouseEventHandler; - onMouseMove?: MouseEventHandler; - onMouseMoveCapture?: MouseEventHandler; - onMouseOut?: MouseEventHandler; - onMouseOutCapture?: MouseEventHandler; - onMouseOver?: MouseEventHandler; - onMouseOverCapture?: MouseEventHandler; - onMouseUp?: MouseEventHandler; - onMouseUpCapture?: MouseEventHandler; - - // Selection Events - onSelect?: GenericEventHandler; - onSelectCapture?: GenericEventHandler; - - // Touch Events - onTouchCancel?: TouchEventHandler; - onTouchCancelCapture?: TouchEventHandler; - onTouchEnd?: TouchEventHandler; - onTouchEndCapture?: TouchEventHandler; - onTouchMove?: TouchEventHandler; - onTouchMoveCapture?: TouchEventHandler; - onTouchStart?: TouchEventHandler; - onTouchStartCapture?: TouchEventHandler; - - // Pointer Events - onPointerOver?: PointerEventHandler; - onPointerOverCapture?: PointerEventHandler; - onPointerEnter?: PointerEventHandler; - onPointerEnterCapture?: PointerEventHandler; - onPointerDown?: PointerEventHandler; - onPointerDownCapture?: PointerEventHandler; - onPointerMove?: PointerEventHandler; - onPointerMoveCapture?: PointerEventHandler; - onPointerUp?: PointerEventHandler; - onPointerUpCapture?: PointerEventHandler; - onPointerCancel?: PointerEventHandler; - onPointerCancelCapture?: PointerEventHandler; - onPointerOut?: PointerEventHandler; - onPointerOutCapture?: PointerEventHandler; - onPointerLeave?: PointerEventHandler; - onPointerLeaveCapture?: PointerEventHandler; - onGotPointerCapture?: PointerEventHandler; - onGotPointerCaptureCapture?: PointerEventHandler; - onLostPointerCapture?: PointerEventHandler; - onLostPointerCaptureCapture?: PointerEventHandler; - - // UI Events - onScroll?: UIEventHandler; - onScrollCapture?: UIEventHandler; - - // Wheel Events - onWheel?: WheelEventHandler; - onWheelCapture?: WheelEventHandler; - - // Animation Events - onAnimationStart?: AnimationEventHandler; - onAnimationStartCapture?: AnimationEventHandler; - onAnimationEnd?: AnimationEventHandler; - onAnimationEndCapture?: AnimationEventHandler; - onAnimationIteration?: AnimationEventHandler; - onAnimationIterationCapture?: AnimationEventHandler; - - // Transition Events - onTransitionEnd?: TransitionEventHandler; - onTransitionEndCapture?: TransitionEventHandler; - } - - interface HTMLAttributes extends Omi.ClassAttributes, DOMAttributes { - // Standard HTML Attributes - accept?: string; - acceptCharset?: string; - accessKey?: string; - action?: string; - allowFullScreen?: boolean; - allowTransparency?: boolean; - alt?: string; - async?: boolean; - autocomplete?: string; - autofocus?: boolean; - autoPlay?: boolean; - capture?: boolean; - cellPadding?: number | string; - cellSpacing?: number | string; - charSet?: string; - challenge?: string; - checked?: boolean; - class?: string; - className?: string; - cols?: number; - colSpan?: number; - content?: string; - contentEditable?: boolean; - contextMenu?: string; - controls?: boolean; - controlsList?: string; - coords?: string; - crossOrigin?: string; - data?: string; - dateTime?: string; - default?: boolean; - defer?: boolean; - dir?: string; - disabled?: boolean; - download?: any; - draggable?: boolean; - encType?: string; - form?: string; - formAction?: string; - formEncType?: string; - formMethod?: string; - formNoValidate?: boolean; - formTarget?: string; - frameBorder?: number | string; - headers?: string; - height?: number | string; - hidden?: boolean; - high?: number; - href?: string; - hrefLang?: string; - for?: string; - httpEquiv?: string; - icon?: string; - id?: string; - inputMode?: string; - integrity?: string; - is?: string; - keyParams?: string; - keyType?: string; - kind?: string; - label?: string; - lang?: string; - list?: string; - loop?: boolean; - low?: number; - manifest?: string; - marginHeight?: number; - marginWidth?: number; - max?: number | string; - maxLength?: number; - media?: string; - mediaGroup?: string; - method?: string; - min?: number | string; - minLength?: number; - multiple?: boolean; - muted?: boolean; - name?: string; - noValidate?: boolean; - open?: boolean; - optimum?: number; - pattern?: string; - placeholder?: string; - playsInline?: boolean; - poster?: string; - preload?: string; - radioGroup?: string; - readOnly?: boolean; - rel?: string; - required?: boolean; - role?: string; - rows?: number; - rowSpan?: number; - sandbox?: string; - scope?: string; - scoped?: boolean; - scrolling?: string; - seamless?: boolean; - selected?: boolean; - shape?: string; - size?: number; - sizes?: string; - slot?: string; - span?: number; - spellcheck?: boolean; - src?: string; - srcset?: string; - srcDoc?: string; - srcLang?: string; - srcSet?: string; - start?: number; - step?: number | string; - style?: any; - summary?: string; - tabIndex?: number; - target?: string; - title?: string; - type?: string; - useMap?: string; - value?: string | string[] | number; - width?: number | string; - wmode?: string; - wrap?: string; - - // RDFa Attributes - about?: string; - datatype?: string; - inlist?: any; - prefix?: string; - property?: string; - resource?: string; - typeof?: string; - vocab?: string; - } - - interface IntrinsicElements { - // HTML - a: HTMLAttributes; - abbr: HTMLAttributes; - address: HTMLAttributes; - area: HTMLAttributes; - article: HTMLAttributes; - aside: HTMLAttributes; - audio: HTMLAttributes; - b: HTMLAttributes; - base: HTMLAttributes; - bdi: HTMLAttributes; - bdo: HTMLAttributes; - big: HTMLAttributes; - blockquote: HTMLAttributes; - body: HTMLAttributes; - br: HTMLAttributes; - button: HTMLAttributes; - canvas: HTMLAttributes; - caption: HTMLAttributes; - cite: HTMLAttributes; - code: HTMLAttributes; - col: HTMLAttributes; - colgroup: HTMLAttributes; - data: HTMLAttributes; - datalist: HTMLAttributes; - dd: HTMLAttributes; - del: HTMLAttributes; - details: HTMLAttributes; - dfn: HTMLAttributes; - dialog: HTMLAttributes; - div: HTMLAttributes; - dl: HTMLAttributes; - dt: HTMLAttributes; - em: HTMLAttributes; - embed: HTMLAttributes; - fieldset: HTMLAttributes; - figcaption: HTMLAttributes; - figure: HTMLAttributes; - footer: HTMLAttributes; - form: HTMLAttributes; - h1: HTMLAttributes; - h2: HTMLAttributes; - h3: HTMLAttributes; - h4: HTMLAttributes; - h5: HTMLAttributes; - h6: HTMLAttributes; - head: HTMLAttributes; - header: HTMLAttributes; - hr: HTMLAttributes; - html: HTMLAttributes; - i: HTMLAttributes; - iframe: HTMLAttributes; - img: HTMLAttributes; - input: HTMLAttributes; - ins: HTMLAttributes; - kbd: HTMLAttributes; - keygen: HTMLAttributes; - label: HTMLAttributes; - legend: HTMLAttributes; - li: HTMLAttributes; - link: HTMLAttributes; - main: HTMLAttributes; - map: HTMLAttributes; - mark: HTMLAttributes; - menu: HTMLAttributes; - menuitem: HTMLAttributes; - meta: HTMLAttributes; - meter: HTMLAttributes; - nav: HTMLAttributes; - noscript: HTMLAttributes; - object: HTMLAttributes; - ol: HTMLAttributes; - optgroup: HTMLAttributes; - option: HTMLAttributes; - output: HTMLAttributes; - p: HTMLAttributes; - param: HTMLAttributes; - picture: HTMLAttributes; - pre: HTMLAttributes; - progress: HTMLAttributes; - q: HTMLAttributes; - rp: HTMLAttributes; - rt: HTMLAttributes; - ruby: HTMLAttributes; - s: HTMLAttributes; - samp: HTMLAttributes; - script: HTMLAttributes; - section: HTMLAttributes; - select: HTMLAttributes; - slot: HTMLAttributes; - small: HTMLAttributes; - source: HTMLAttributes; - span: HTMLAttributes; - strong: HTMLAttributes; - style: HTMLAttributes; - sub: HTMLAttributes; - summary: HTMLAttributes; - sup: HTMLAttributes; - table: HTMLAttributes; - tbody: HTMLAttributes; - td: HTMLAttributes; - textarea: HTMLAttributes; - tfoot: HTMLAttributes; - th: HTMLAttributes; - thead: HTMLAttributes; - time: HTMLAttributes; - title: HTMLAttributes; - tr: HTMLAttributes; - track: HTMLAttributes; - u: HTMLAttributes; - ul: HTMLAttributes; - "var": HTMLAttributes; - video: HTMLAttributes; - wbr: HTMLAttributes; - - //SVG - svg: SVGAttributes; - animate: SVGAttributes; - circle: SVGAttributes; - clipPath: SVGAttributes; - defs: SVGAttributes; - ellipse: SVGAttributes; - feBlend: SVGAttributes; - feColorMatrix: SVGAttributes; - feComponentTransfer: SVGAttributes; - feComposite: SVGAttributes; - feConvolveMatrix: SVGAttributes; - feDiffuseLighting: SVGAttributes; - feDisplacementMap: SVGAttributes; - feFlood: SVGAttributes; - feGaussianBlur: SVGAttributes; - feImage: SVGAttributes; - feMerge: SVGAttributes; - feMergeNode: SVGAttributes; - feMorphology: SVGAttributes; - feOffset: SVGAttributes; - feSpecularLighting: SVGAttributes; - feTile: SVGAttributes; - feTurbulence: SVGAttributes; - filter: SVGAttributes; - foreignObject: SVGAttributes; - g: SVGAttributes; - image: SVGAttributes; - line: SVGAttributes; - linearGradient: SVGAttributes; - marker: SVGAttributes; - mask: SVGAttributes; - path: SVGAttributes; - pattern: SVGAttributes; - polygon: SVGAttributes; - polyline: SVGAttributes; - radialGradient: SVGAttributes; - rect: SVGAttributes; - stop: SVGAttributes; - symbol: SVGAttributes; - text: SVGAttributes; - tspan: SVGAttributes; - use: SVGAttributes; - [tagName: string]: any; - } - } -} diff --git a/packages/omiax/src/omi/omi.js b/packages/omiax/src/omi/omi.js deleted file mode 100755 index bf9cda851..000000000 --- a/packages/omiax/src/omi/omi.js +++ /dev/null @@ -1,64 +0,0 @@ -import { h } from './h' -import Component from './component' -import { render } from './render' -import { tag } from './tag' -import { define } from './define' -import options from './options' - -const WeElement = Component -const root = getGlobal() -const omiax = { - h, - tag, - define, - Component, - render, - WeElement, - options -} - -root.Omi = omiax -root.omi = omiax -root.omiax = omiax -root.omiax.version = '0.0.0' - -export default { - h, - tag, - define, - Component, - render, - WeElement, - options -} - -export { - h, - tag, - define, - Component, - render, - WeElement, - options -} - -function getGlobal() { - if ( - typeof global !== 'object' || - !global || - global.Math !== Math || - global.Array !== Array - ) { - if (typeof self !== 'undefined') { - return self - } else if (typeof window !== 'undefined') { - return window - } else if (typeof global !== 'undefined') { - return global - } - return (function() { - return this - })() - } - return global -} diff --git a/packages/omiax/src/omi/omi.js.flow b/packages/omiax/src/omi/omi.js.flow deleted file mode 100755 index 1340d01c7..000000000 --- a/packages/omiax/src/omi/omi.js.flow +++ /dev/null @@ -1,13 +0,0 @@ -/* @flow */ - -import { createElement, cloneElement, Component, type Node } from 'react'; - -declare var h: createElement; - -declare function render(vnode: Node, parent: Element, toReplace?: Element): Element; - -export { h, createElement, cloneElement, Component, render }; -export default { h, createElement, cloneElement, Component, render }; - -declare export function rerender(): void; -declare export var options: Object; diff --git a/packages/omiax/src/omi/options.js b/packages/omiax/src/omi/options.js deleted file mode 100755 index e10b3ed1d..000000000 --- a/packages/omiax/src/omi/options.js +++ /dev/null @@ -1,59 +0,0 @@ -import mock from './mock/index' - -function getGlobal() { - if ( - typeof global !== 'object' || - !global || - global.Math !== Math || - global.Array !== Array - ) { - if (typeof self !== 'undefined') { - return self - } else if (typeof window !== 'undefined') { - return window - } else if (typeof global !== 'undefined') { - return global - } - return (function() { - return this - })() - } - return global -} - -/** Global options - * @public - * @namespace options {Object} - */ -export default { - scopedStyle: true, - mapping: {}, - isWeb: true, - staticStyleMapping: {}, - doc: mock.document, - //doc: typeof document === 'object' ? document : null, - root: getGlobal(), - //styleCache :[{ctor:ctor,ctorName:ctorName,style:style}] - styleCache: [] - //componentChange(component, element) { }, - /** If `true`, `prop` changes trigger synchronous component updates. - * @name syncComponentUpdates - * @type Boolean - * @default true - */ - //syncComponentUpdates: true, - - /** Processes all created VNodes. - * @param {VNode} vnode A newly-created VNode to normalize/process - */ - //vnode(vnode) { } - - /** Hook invoked after a component is mounted. */ - //afterMount(component) { }, - - /** Hook invoked after the DOM is updated with a component's latest render. */ - //afterUpdate(component) { } - - /** Hook invoked immediately before a component is unmounted. */ - // beforeUnmount(component) { } -} diff --git a/packages/omiax/src/omi/render-queue.js b/packages/omiax/src/omi/render-queue.js deleted file mode 100755 index 5fd7d6c35..000000000 --- a/packages/omiax/src/omi/render-queue.js +++ /dev/null @@ -1,21 +0,0 @@ -import options from './options' -import { defer } from './util' -import { renderComponent } from './vdom/component' - -/** Managed queue of dirty components to be re-rendered */ - -let items = [] - -export function enqueueRender(component) { - if (items.push(component) == 1) { - ;(options.debounceRendering || defer)(rerender) - } -} - -/** Rerender all enqueued dirty components */ -export function rerender() { - let p - while ( (p = items.pop()) ) { - renderComponent(p) - } -} \ No newline at end of file diff --git a/packages/omiax/src/omi/render-to-string.js b/packages/omiax/src/omi/render-to-string.js deleted file mode 100644 index 9ff3d9d02..000000000 --- a/packages/omiax/src/omi/render-to-string.js +++ /dev/null @@ -1,255 +0,0 @@ -/** - * preact-render-to-string based on preact-render-to-string - * by Jason Miller - * Licensed under the MIT License - * https://github.com/developit/preact-render-to-string - * - * modified by dntzhang - */ - -import options from './options' - -import { - addScopedAttrStatic, - getCtorName, - scopeHost, - scoper -} from './style' - - -const encodeEntities = s => String(s) - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); - -const indent = (s, char) => String(s).replace(/(\n+)/g, '$1' + (char || '\t')); - -const mapping = options.mapping - -const VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/; - -const isLargeString = (s, length, ignoreLines) => (String(s).length > (length || 40) || (!ignoreLines && String(s).indexOf('\n') !== -1) || String(s).indexOf('<') !== -1); - -const JS_TO_CSS = {}; - -// Convert an Object style to a CSSText string -function styleObjToCss(s) { - let str = ''; - for (let prop in s) { - let val = s[prop]; - if (val != null) { - if (str) str += ' '; - // str += jsToCss(prop); - str += JS_TO_CSS[prop] || (JS_TO_CSS[prop] = prop.replace(/([A-Z])/g, '-$1').toLowerCase()); - str += ': '; - str += val; - if (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) { - str += 'px'; - } - str += ';'; - } - } - return str || undefined; -} - -export function renderToString(vnode, opts, store, isSvgMode){ - store = store || {}; - opts = Object.assign({ - scopedCSS: true - },opts) - const css = {} - const html = _renderToString(vnode, opts, store, isSvgMode, css) - return { - css: Object.values(css), - html: html - } -} - -/** The default export is an alias of `render()`. */ -function _renderToString(vnode, opts, store, isSvgMode, css) { - if (vnode == null || typeof vnode === 'boolean') { - return ''; - } - - let nodeName = vnode.nodeName, - attributes = vnode.attributes, - isComponent = false; - - - let pretty = true && opts.pretty, - indentChar = pretty && typeof pretty === 'string' ? pretty : '\t'; - - // #text nodes - if (typeof vnode !== 'object' && !nodeName) { - return encodeEntities(vnode); - } - - // components - const ctor = mapping[nodeName] - if (ctor) { - isComponent = true; - - let props = getNodeProps(vnode), - rendered; - // class-based components - let c = new ctor(props, store); - // turn off stateful re-rendering: - c._disable = c.__x = true; - c.props = props; - c.store = store; - if (c.install) c.install(); - if (c.beforeRender) c.beforeRender(); - rendered = c.render(c.props, c.data, c.store); - - if(opts.scopedCSS){ - - if (c.constructor.css || c.css) { - - const cssStr = c.constructor.css ? c.constructor.css : (typeof c.css === 'function' ? c.css() : c.css) - const cssAttr = '_s' + getCtorName(c.constructor) - css[cssAttr] = { - id: cssAttr, - css: scoper(cssStr, cssAttr) - } - addScopedAttrStatic( - rendered, - cssAttr - ) - } - - c.scopedCSSAttr = vnode.css - scopeHost(rendered, c.scopedCSSAttr) - } - - return _renderToString(rendered, opts, store, false, css); - } - - - // render JSX to HTML - let s = '', html; - - if (attributes) { - let attrs = Object.keys(attributes); - - // allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai) - if (opts && opts.sortAttributes === true) attrs.sort(); - - for (let i = 0; i < attrs.length; i++) { - let name = attrs[i], - v = attributes[name]; - if (name === 'children') continue; - - if (name.match(/[\s\n\\/='"\0<>]/)) continue; - - if (!(opts && opts.allAttributes) && (name === 'key' || name === 'ref')) continue; - - if (name === 'className') { - if (attributes['class']) continue; - name = 'class'; - } - else if (isSvgMode && name.match(/^xlink:?./)) { - name = name.toLowerCase().replace(/^xlink:?/, 'xlink:'); - } - - if (name === 'style' && v && typeof v === 'object') { - v = styleObjToCss(v); - } - - let hooked = opts.attributeHook && opts.attributeHook(name, v, store, opts, isComponent); - if (hooked || hooked === '') { - s += hooked; - continue; - } - - if (name === 'dangerouslySetInnerHTML') { - html = v && v.__html; - } - else if ((v || v === 0 || v === '') && typeof v !== 'function') { - if (v === true || v === '') { - v = name; - // in non-xml mode, allow boolean attributes - if (!opts || !opts.xml) { - s += ' ' + name; - continue; - } - } - s += ` ${name}="${encodeEntities(v)}"`; - } - } - } - - // account for >1 multiline attribute - if (pretty) { - let sub = s.replace(/^\n\s*/, ' '); - if (sub !== s && !~sub.indexOf('\n')) s = sub; - else if (pretty && ~s.indexOf('\n')) s += '\n'; - } - - s = `<${nodeName}${s}>`; - if (String(nodeName).match(/[\s\n\\/='"\0<>]/)) throw s; - - let isVoid = String(nodeName).match(VOID_ELEMENTS); - if (isVoid) s = s.replace(/>$/, ' />'); - - let pieces = []; - if (html) { - // if multiline, indent. - if (pretty && isLargeString(html)) { - html = '\n' + indentChar + indent(html, indentChar); - } - s += html; - } - else if (vnode.children) { - let hasLarge = pretty && ~s.indexOf('\n'); - for (let i = 0; i < vnode.children.length; i++) { - let child = vnode.children[i]; - if (child != null && child !== false) { - let childSvgMode = nodeName === 'svg' ? true : nodeName === 'foreignObject' ? false : isSvgMode, - ret = _renderToString(child, opts, store, childSvgMode, css); - if (pretty && !hasLarge && isLargeString(ret)) hasLarge = true; - if (ret) pieces.push(ret); - } - } - if (pretty && hasLarge) { - for (let i = pieces.length; i--;) { - pieces[i] = '\n' + indentChar + indent(pieces[i], indentChar); - } - } - } - - if (pieces.length) { - s += pieces.join(''); - } - else if (opts && opts.xml) { - return s.substring(0, s.length - 1) + ' />'; - } - - if (!isVoid) { - if (pretty && ~s.indexOf('\n')) s += '\n'; - s += ``; - } - - return s -} - -function assign(obj, props) { - for (let i in props) obj[i] = props[i]; - return obj; -} - -function getNodeProps(vnode) { - let props = assign({}, vnode.attributes); - props.children = vnode.children; - - let defaultProps = vnode.nodeName.defaultProps; - if (defaultProps !== undefined) { - for (let i in defaultProps) { - if (props[i] === undefined) { - props[i] = defaultProps[i]; - } - } - } - - return props; -} \ No newline at end of file diff --git a/packages/omiax/src/omi/render.js b/packages/omiax/src/omi/render.js deleted file mode 100755 index 4bc3207de..000000000 --- a/packages/omiax/src/omi/render.js +++ /dev/null @@ -1,26 +0,0 @@ -import { diff } from './vdom/diff' - -/** Render JSX into a `parent` Element. - * @param {VNode} vnode A (JSX) VNode to render - * @param {Element} parent DOM element to render into - * @param {object} [store] - * @public - */ -export function render(vnode, parent, store, empty, merge) { - parent = typeof parent === 'string' ? document.querySelector(parent) : parent - - if (empty) { - while (parent.firstChild) { - parent.removeChild(parent.firstChild) - } - } - - if (merge) { - merge = - typeof merge === 'string' - ? document.querySelector(merge) - : merge - } - - return diff(merge, vnode, store, false, parent, false, true) -} diff --git a/packages/omiax/src/omi/rpx.js b/packages/omiax/src/omi/rpx.js deleted file mode 100644 index 48c85c463..000000000 --- a/packages/omiax/src/omi/rpx.js +++ /dev/null @@ -1,5 +0,0 @@ -export function rpx(str) { - return str.replace(/([1-9]\d*|0)(\.\d*)*rpx/g, (a, b) => { - return (window.innerWidth * Number(b)) / 750 + 'px' - }) -} diff --git a/packages/omiax/src/omi/style.js b/packages/omiax/src/omi/style.js deleted file mode 100755 index c5b7ff970..000000000 --- a/packages/omiax/src/omi/style.js +++ /dev/null @@ -1,128 +0,0 @@ -import options from './options' - -let styleId = 0 - -export function getCtorName(ctor) { - for (let i = 0, len = options.styleCache.length; i < len; i++) { - let item = options.styleCache[i] - - if (item.ctor === ctor) { - return item.attrName - } - } - - let attrName = 's' + styleId - options.styleCache.push({ ctor, attrName }) - styleId++ - - return attrName -} - -// many thanks to https://github.com/thomaspark/scoper/ -export function scoper(css, prefix) { - prefix = '[' + prefix.toLowerCase() + ']' - // https://www.w3.org/TR/css-syntax-3/#lexical - css = css.replace(/\/\*[^*]*\*+([^/][^*]*\*+)*\//g, '') - // eslint-disable-next-line - let re = new RegExp('([^\r\n,{}:]+)(:[^\r\n,{}]+)?(,(?=[^{}]*{)|\s*{)', 'g') - /** - * Example: - * - * .classname::pesudo { color:red } - * - * g1 is normal selector `.classname` - * g2 is pesudo class or pesudo element - * g3 is the suffix - */ - css = css.replace(re, (g0, g1, g2, g3) => { - if (typeof g2 === 'undefined') { - g2 = '' - } - - /* eslint-ignore-next-line */ - if ( - g1.match( - /^\s*(@media|\d+%?|@-webkit-keyframes|@keyframes|to|from|@font-face)/ - ) - ) { - return g1 + g2 + g3 - } - - let appendClass = g1.replace(/(\s*)$/, '') + prefix + g2 - //let prependClass = prefix + ' ' + g1.trim() + g2; - - return appendClass + g3 - //return appendClass + ',' + prependClass + g3; - }) - - return css -} - -export function addStyle(cssText, id) { - id = id.toLowerCase() - let ele = document.getElementById(id) - let head = document.getElementsByTagName('head')[0] - if (ele && ele.parentNode === head) { - head.removeChild(ele) - } - - let someThingStyles = document.createElement('style') - head.appendChild(someThingStyles) - someThingStyles.setAttribute('type', 'text/css') - someThingStyles.setAttribute('id', id) - if (window.ActiveXObject) { - someThingStyles.styleSheet.cssText = cssText - } else { - someThingStyles.textContent = cssText - } -} - -export function addStyleWithoutId(cssText) { - let head = document.getElementsByTagName('head')[0] - let someThingStyles = document.createElement('style') - head.appendChild(someThingStyles) - someThingStyles.setAttribute('type', 'text/css') - - if (window.ActiveXObject) { - someThingStyles.styleSheet.cssText = cssText - } else { - someThingStyles.textContent = cssText - } -} - -export function addScopedAttrStatic(vdom, attr) { - if (options.scopedStyle) { - scopeVdom(attr, vdom) - } -} - -export function addStyleToHead(style, attr) { - if (options.scopedStyle) { - if (!options.staticStyleMapping[attr]) { - addStyle(scoper(style, attr), attr) - options.staticStyleMapping[attr] = true - } - } else if (!options.staticStyleMapping[attr]) { - addStyleWithoutId(style) - options.staticStyleMapping[attr] = true - } -} - -export function scopeVdom(attr, vdom) { - if (typeof vdom === 'object') { - vdom.attributes = vdom.attributes || {} - vdom.attributes[attr] = '' - vdom.css = vdom.css || {} - vdom.css[attr] = '' - vdom.children.forEach(child => scopeVdom(attr, child)) - } -} - -export function scopeHost(vdom, css) { - if (typeof vdom === 'object' && css) { - vdom.attributes = vdom.attributes || {} - for (let key in css) { - vdom.attributes[key] = '' - } - } -} diff --git a/packages/omiax/src/omi/tag.js b/packages/omiax/src/omi/tag.js deleted file mode 100644 index b9421c519..000000000 --- a/packages/omiax/src/omi/tag.js +++ /dev/null @@ -1,7 +0,0 @@ -import { define } from './define' - -export function tag(name) { - return function(target) { - define(name, target) - } -} diff --git a/packages/omiax/src/omi/tick.js b/packages/omiax/src/omi/tick.js deleted file mode 100644 index 686483fae..000000000 --- a/packages/omiax/src/omi/tick.js +++ /dev/null @@ -1,21 +0,0 @@ -const callbacks = [] -const nextTickCallback = [] - -export function tick(fn, scope) { - callbacks.push({ fn, scope }) -} - -export function fireTick() { - callbacks.forEach(item => { - item.fn.call(item.scope) - }) - - nextTickCallback.forEach(nextItem => { - nextItem.fn.call(nextItem.scope) - }) - nextTickCallback.length = 0 -} - -export function nextTick(fn, scope) { - nextTickCallback.push({ fn, scope }) -} diff --git a/packages/omiax/src/omi/util.js b/packages/omiax/src/omi/util.js deleted file mode 100755 index 477fcfeee..000000000 --- a/packages/omiax/src/omi/util.js +++ /dev/null @@ -1,226 +0,0 @@ -'use strict' -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols -var hasOwnProperty = Object.prototype.hasOwnProperty -var propIsEnumerable = Object.prototype.propertyIsEnumerable - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined') - } - - return Object(val) -} - -export function assign(target, source) { - var from - var to = toObject(target) - var symbols - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]) - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key] - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from) - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]] - } - } - } - } - - return to -} - -if (typeof Element !== 'undefined' && !Element.prototype.addEventListener) { - var oListeners = {}; - function runListeners(oEvent) { - if (!oEvent) { oEvent = window.event; } - for (var iLstId = 0, iElId = 0, oEvtListeners = oListeners[oEvent.type]; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { - for (iLstId; iLstId < oEvtListeners.aEvts[iElId].length; iLstId++) { oEvtListeners.aEvts[iElId][iLstId].call(this, oEvent); } - break; - } - } - } - Element.prototype.addEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) { - if (oListeners.hasOwnProperty(sEventType)) { - var oEvtListeners = oListeners[sEventType]; - for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { nElIdx = iElId; break; } - } - if (nElIdx === -1) { - oEvtListeners.aEls.push(this); - oEvtListeners.aEvts.push([fListener]); - this["on" + sEventType] = runListeners; - } else { - var aElListeners = oEvtListeners.aEvts[nElIdx]; - if (this["on" + sEventType] !== runListeners) { - aElListeners.splice(0); - this["on" + sEventType] = runListeners; - } - for (var iLstId = 0; iLstId < aElListeners.length; iLstId++) { - if (aElListeners[iLstId] === fListener) { return; } - } - aElListeners.push(fListener); - } - } else { - oListeners[sEventType] = { aEls: [this], aEvts: [[fListener]] }; - this["on" + sEventType] = runListeners; - } - }; - Element.prototype.removeEventListener = function (sEventType, fListener /*, useCapture (will be ignored!) */) { - if (!oListeners.hasOwnProperty(sEventType)) { return; } - var oEvtListeners = oListeners[sEventType]; - for (var nElIdx = -1, iElId = 0; iElId < oEvtListeners.aEls.length; iElId++) { - if (oEvtListeners.aEls[iElId] === this) { nElIdx = iElId; break; } - } - if (nElIdx === -1) { return; } - for (var iLstId = 0, aElListeners = oEvtListeners.aEvts[nElIdx]; iLstId < aElListeners.length; iLstId++) { - if (aElListeners[iLstId] === fListener) { aElListeners.splice(iLstId, 1); } - } - }; -} - - -if (typeof Object.create !== 'function') { - Object.create = function(proto, propertiesObject) { - if (typeof proto !== 'object' && typeof proto !== 'function') { - throw new TypeError('Object prototype may only be an Object: ' + proto) - } else if (proto === null) { - throw new Error( - "This browser's implementation of Object.create is a shim and doesn't support 'null' as the first argument." - ) - } - - // if (typeof propertiesObject != 'undefined') { - // throw new Error("This browser's implementation of Object.create is a shim and doesn't support a second argument."); - // } - - function F() {} - F.prototype = proto - - return new F() - } -} - -if (!String.prototype.trim) { - String.prototype.trim = function () { - return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '') - } -} - -/** - * Copy all properties from `props` onto `obj`. - * @param {Object} obj Object onto which properties should be copied. - * @param {Object} props Object from which to copy properties. - * @returns obj - * @private - */ -export function extend(obj, props) { - for (let i in props) obj[i] = props[i] - return obj -} - -/** Invoke or update a ref, depending on whether it is a function or object ref. - * @param {object|function} [ref=null] - * @param {any} [value] - */ -export function applyRef(ref, value) { - if (ref) { - if (typeof ref == 'function') ref(value) - else ref.current = value - } -} - -/** - * Call a function asynchronously, as soon as possible. Makes - * use of HTML Promise to schedule the callback if available, - * otherwise falling back to `setTimeout` (mainly for IE<11). - * - * @param {Function} callback - */ - -let usePromise = typeof Promise == 'function' - -// for native -if ( - typeof document !== 'object' && - typeof global !== 'undefined' && - global.__config__ -) { - if (global.__config__.platform === 'android') { - usePromise = true - } else { - let systemVersion = - (global.__config__.systemVersion && - global.__config__.systemVersion.split('.')[0]) || - 0 - if (systemVersion > 8) { - usePromise = true - } - } -} - -export const defer = usePromise - ? Promise.resolve().then.bind(Promise.resolve()) - : setTimeout - -export function isArray(obj) { - return Object.prototype.toString.call(obj) === '[object Array]' -} - -export function nProps(props) { - if (!props || isArray(props)) return {} - const result = {} - Object.keys(props).forEach(key => { - result[key] = props[key].value - }) - return result -} - -export function getUse(data, paths) { - const obj = [] - paths.forEach((path, index) => { - const isPath = typeof path === 'string' - if (isPath) { - obj[index] = getTargetByPath(data, path) - } else { - const key = Object.keys(path)[0] - const value = path[key] - if (typeof value === 'string') { - obj[index] = getTargetByPath(data, value) - } else { - const tempPath = value[0] - if (typeof tempPath === 'string') { - const tempVal = getTargetByPath(data, tempPath) - obj[index] = value[1] ? value[1](tempVal) : tempVal - } else { - const args = [] - tempPath.forEach(path =>{ - args.push(getTargetByPath(data, path)) - }) - obj[index] = value[1].apply(null, args) - } - } - obj[key] = obj[index] - } - }) - return obj -} - -export function getTargetByPath(origin, path) { - const arr = path.replace(/]/g, '').replace(/\[/g, '.').split('.') - let current = origin - for (let i = 0, len = arr.length; i < len; i++) { - current = current[arr[i]] - } - return current -} diff --git a/packages/omiax/src/omi/vdom/component-recycler.js b/packages/omiax/src/omi/vdom/component-recycler.js deleted file mode 100755 index 874b4729f..000000000 --- a/packages/omiax/src/omi/vdom/component-recycler.js +++ /dev/null @@ -1,60 +0,0 @@ -import Component from '../component' -import { getUse } from '../util' -import { getPath } from '../define' -/** Retains a pool of Components for re-use, keyed on component name. - * Note: since component names are not unique or even necessarily available, these are primarily a form of sharding. - * @private - */ -const components = {} - -/** Reclaim a component for later re-use by the recycler. */ -export function collectComponent(component) { - let name = component.constructor.name - ;(components[name] || (components[name] = [])).push(component) -} - -/** Create a component. Normalizes differences between PFC's and classful Components. */ -export function createComponent(Ctor, props, context, vnode) { - let list = components[Ctor.name], - inst - - if (Ctor.prototype && Ctor.prototype.render) { - inst = new Ctor(props, context) - Component.call(inst, props, context) - } else { - inst = new Component(props, context) - inst.constructor = Ctor - inst.render = doRender - } - vnode && (inst.scopedCssAttr = vnode.css) - - if ( inst.store && inst.store.data) { - if(inst.constructor.use){ - inst.use = getUse(inst.store.data, inst.constructor.use) - inst.store.instances.push(inst) - } else if(inst.initUse){ - const use = inst.initUse() - inst._updatePath = getPath(use) - inst.use = getUse(inst.store.data, use) - inst.store.instances.push(inst) - } - - - } - - if (list) { - for (let i = list.length; i--; ) { - if (list[i].constructor === Ctor) { - inst.nextBase = list[i].nextBase - list.splice(i, 1) - break - } - } - } - return inst -} - -/** The `.render()` method for a PFC backing instance. */ -function doRender(props, data, context) { - return this.constructor(props, context) -} diff --git a/packages/omiax/src/omi/vdom/component.js b/packages/omiax/src/omi/vdom/component.js deleted file mode 100755 index fd2cd1128..000000000 --- a/packages/omiax/src/omi/vdom/component.js +++ /dev/null @@ -1,355 +0,0 @@ -import { - SYNC_RENDER, - NO_RENDER, - FORCE_RENDER, - ASYNC_RENDER, - ATTR_KEY -} from '../constants' -import options from '../options' -import { extend, applyRef } from '../util' -import { enqueueRender } from '../render-queue' -import { getNodeProps } from './index' -import { - diff, - mounts, - diffLevel, - flushMounts, - recollectNodeTree, - removeChildren -} from './diff' -import { createComponent, collectComponent } from './component-recycler' -import { removeNode } from '../dom/index' -import { - addScopedAttrStatic, - getCtorName, - scopeHost -} from '../style' -import { proxyUpdate } from '../observe' - -/** Set a component's `props` (generally derived from JSX attributes). - * @param {Object} props - * @param {Object} [opts] - * @param {boolean} [opts.renderSync=false] If `true` and {@link options.syncComponentUpdates} is `true`, triggers synchronous rendering. - * @param {boolean} [opts.render=true] If `false`, no render will be triggered. - */ -export function setComponentProps(component, props, opts, context, mountAll) { - if (component._disable) return - component._disable = true - - if ((component.__ref = props.ref)) delete props.ref - if ((component.__key = props.key)) delete props.key - - if (!component.base || mountAll) { - if (component.beforeInstall) component.beforeInstall() - if (component.install) component.install() - if (component.constructor.observe) { - proxyUpdate(component) - } - } - - if (context && context !== component.context) { - if (!component.prevContext) component.prevContext = component.context - component.context = context - } - - if (!component.prevProps) component.prevProps = component.props - component.props = props - - component._disable = false - - if (opts !== NO_RENDER) { - if ( - opts === SYNC_RENDER || - options.syncComponentUpdates !== false || - !component.base - ) { - renderComponent(component, SYNC_RENDER, mountAll) - } else { - enqueueRender(component) - } - } - - applyRef(component.__ref, component) -} - -function shallowComparison(old, attrs) { - let name - - for (name in old) { - if (attrs[name] == null && old[name] != null) { - return true - } - } - - if (old.children.length > 0 || attrs.children.length > 0) { - return true - } - - for (name in attrs) { - if (name != 'children') { - let type = typeof attrs[name] - if (type == 'function' || type == 'object') { - return true - } else if (attrs[name] != old[name]) { - return true - } - } - } -} - -/** Render a Component, triggering necessary lifecycle events and taking High-Order Components into account. - * @param {Component} component - * @param {Object} [opts] - * @param {boolean} [opts.build=false] If `true`, component will build and store a DOM node if not already associated with one. - * @private - */ -export function renderComponent(component, opts, mountAll, isChild) { - if (component._disable) return - - let props = component.props, - data = component.data, - context = component.context, - previousProps = component.prevProps || props, - previousState = component.prevState || data, - previousContext = component.prevContext || context, - isUpdate = component.base, - nextBase = component.nextBase, - initialBase = isUpdate || nextBase, - initialChildComponent = component._component, - skip = false, - rendered, - inst, - cbase - - // if updating - if (isUpdate) { - component.props = previousProps - component.data = previousState - component.context = previousContext - if (component.store || opts == FORCE_RENDER || shallowComparison(previousProps, props)) { - let receiveResult = true - if (component.receiveProps) { - receiveResult = component.receiveProps(props, previousProps) - } - if (receiveResult !== false) { - skip = false - if (component.beforeUpdate) { - component.beforeUpdate(props, data, context) - } - } else { - skip = true - } - } else { - skip = true - } - component.props = props - component.data = data - component.context = context - } - - component.prevProps = component.prevState = component.prevContext = component.nextBase = null - - if (!skip) { - component.beforeRender && component.beforeRender() - rendered = component.render(props, data, context) - - //don't rerender - if (component.constructor.css || component.css) { - addScopedAttrStatic( - rendered, - '_s' + getCtorName(component.constructor) - ) - } - - scopeHost(rendered, component.scopedCssAttr) - - // context to pass to the child, can be updated via (grand-)parent component - if (component.getChildContext) { - context = extend(extend({}, context), component.getChildContext()) - } - - let childComponent = rendered && rendered.nodeName, - toUnmount, - base, - ctor = options.mapping[childComponent] - - if (ctor) { - // set up high order component link - - let childProps = getNodeProps(rendered) - inst = initialChildComponent - - if (inst && inst.constructor === ctor && childProps.key == inst.__key) { - setComponentProps(inst, childProps, SYNC_RENDER, context, false) - } else { - toUnmount = inst - - component._component = inst = createComponent(ctor, childProps, context) - inst.nextBase = inst.nextBase || nextBase - inst._parentComponent = component - setComponentProps(inst, childProps, NO_RENDER, context, false) - renderComponent(inst, SYNC_RENDER, mountAll, true) - } - - base = inst.base - } else { - cbase = initialBase - - // destroy high order component link - toUnmount = initialChildComponent - if (toUnmount) { - cbase = component._component = null - } - - if (initialBase || opts === SYNC_RENDER) { - if (cbase) cbase._component = null - base = diff( - cbase, - rendered, - context, - mountAll || !isUpdate, - initialBase && initialBase.parentNode, - true - ) - } - } - - if (initialBase && base !== initialBase && inst !== initialChildComponent) { - let baseParent = initialBase.parentNode - if (baseParent && base !== baseParent) { - baseParent.replaceChild(base, initialBase) - - if (!toUnmount) { - initialBase._component = null - recollectNodeTree(initialBase, false) - } - } - } - - if (toUnmount) { - unmountComponent(toUnmount) - } - - component.base = base - if (base && !isChild) { - let componentRef = component, - t = component - while ((t = t._parentComponent)) { - ;(componentRef = t).base = base - } - base._component = componentRef - base._componentConstructor = componentRef.constructor - } - } - - if (!isUpdate || mountAll) { - mounts.unshift(component) - } else if (!skip) { - // Ensure that pending componentDidMount() hooks of child components - // are called before the componentDidUpdate() hook in the parent. - // Note: disabled as it causes duplicate hooks, see https://github.com/developit/preact/issues/750 - // flushMounts(); - - if (component.afterUpdate) { - //deprecated - component.afterUpdate(previousProps, previousState, previousContext) - } - if (component.updated) { - component.updated(previousProps, previousState, previousContext) - } - if (options.afterUpdate) options.afterUpdate(component) - } - - if (component._renderCallbacks != null) { - while (component._renderCallbacks.length) - component._renderCallbacks.pop().call(component) - } - - if (!diffLevel && !isChild) flushMounts() -} - -/** Apply the Component referenced by a VNode to the DOM. - * @param {Element} dom The DOM node to mutate - * @param {VNode} vnode A Component-referencing VNode - * @returns {Element} dom The created/mutated element - * @private - */ -export function buildComponentFromVNode(dom, vnode, context, mountAll) { - let c = dom && dom._component, - originalComponent = c, - oldDom = dom, - isDirectOwner = c && dom._componentConstructor === vnode.nodeName, - isOwner = isDirectOwner, - props = getNodeProps(vnode) - while (c && !isOwner && (c = c._parentComponent)) { - isOwner = c.constructor === vnode.nodeName - } - - if (c && isOwner && (!mountAll || c._component)) { - setComponentProps(c, props, ASYNC_RENDER, context, mountAll) - dom = c.base - } else { - if (originalComponent && !isDirectOwner) { - unmountComponent(originalComponent) - dom = oldDom = null - } - - c = createComponent(vnode.nodeName, props, context, vnode) - if (dom && !c.nextBase) { - c.nextBase = dom - // passing dom/oldDom as nextBase will recycle it if unused, so bypass recycling on L229: - oldDom = null - } - setComponentProps(c, props, SYNC_RENDER, context, mountAll) - dom = c.base - - if (oldDom && dom !== oldDom) { - oldDom._component = null - recollectNodeTree(oldDom, false) - } - } - - return dom -} - -/** Remove a component from the DOM and recycle it. - * @param {Component} component The Component instance to unmount - * @private - */ -export function unmountComponent(component) { - if (options.beforeUnmount) options.beforeUnmount(component) - - let base = component.base - - component._disable = true - - if (component.uninstall) component.uninstall() - - if (component.store && component.store.instances) { - for (let i = 0, len = component.store.instances.length; i < len; i++) { - if (component.store.instances[i] === component) { - component.store.instances.splice(i, 1) - break - } - } - } - - component.base = null - - // recursively tear down & recollect high-order component children: - let inner = component._component - if (inner) { - unmountComponent(inner) - } else if (base) { - if (base[ATTR_KEY] != null) applyRef(base[ATTR_KEY].ref, null) - - component.nextBase = base - - removeNode(base) - collectComponent(component) - - removeChildren(base) - } - - applyRef(component.__ref, null) -} diff --git a/packages/omiax/src/omi/vdom/diff.js b/packages/omiax/src/omi/vdom/diff.js deleted file mode 100755 index d2e6eaef1..000000000 --- a/packages/omiax/src/omi/vdom/diff.js +++ /dev/null @@ -1,365 +0,0 @@ -import { ATTR_KEY } from '../constants' -import { isSameNodeType, isNamedNode } from './index' -import { buildComponentFromVNode } from './component' -import { createNode, setAccessor } from '../dom/index' -import { unmountComponent } from './component' -import options from '../options' -import { applyRef } from '../util' -import { removeNode } from '../dom/index' -import { isArray } from '../util' -import { draw } from '../../cax/draw' -/** Queue of components that have been mounted and are awaiting componentDidMount */ -export const mounts = [] - -/** Diff recursion count, used to track the end of the diff cycle. */ -export let diffLevel = 0 - -/** Global flag indicating if the diff is currently within an SVG */ -let isSvgMode = false - -/** Global flag indicating if the diff is performing hydration */ -let hydrating = false - -/** Invoke queued componentDidMount lifecycle methods */ -export function flushMounts() { - let c - while ((c = mounts.pop())) { - if (options.afterMount) options.afterMount(c) - if (c.installed) c.installed() - } -} - -/** Apply differences in a given vnode (and it's deep children) to a real DOM Node. - * @param {Element} [dom=null] A DOM node to mutate into the shape of the `vnode` - * @param {VNode} vnode A VNode (with descendants forming a tree) representing the desired DOM structure - * @returns {Element} dom The created/mutated element - * @private - */ -export function diff(dom, vnode, context, mountAll, parent, componentRoot, fromRender) { - // diffLevel having been 0 here indicates initial entry into the diff (not a subdiff) - if (!diffLevel++) { - // when first starting the diff, check if we're diffing an SVG or within an SVG - isSvgMode = parent != null && parent.ownerSVGElement !== undefined - - // hydration is indicated by the existing element to be diffed not having a prop cache - hydrating = dom != null && !(ATTR_KEY in dom) - } - let ret - - if (isArray(vnode)) { - vnode = { - nodeName: 'span', - children: vnode - } - } - - ret = idiff(dom, vnode, context, mountAll, componentRoot) - // append the element if its a new parent - if (parent && ret.parentNode !== parent) { - if (fromRender) { - parent.appendChild(draw(ret)) - } else { - parent.appendChild(ret) - } - } - - // diffLevel being reduced to 0 means we're exiting the diff - if (!--diffLevel) { - hydrating = false - // invoke queued componentDidMount lifecycle methods - if (!componentRoot) flushMounts() - } - - return ret -} - -/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */ -function idiff(dom, vnode, context, mountAll, componentRoot) { - let out = dom, - prevSvgMode = isSvgMode - - // empty values (null, undefined, booleans) render as empty Text nodes - if (vnode == null || typeof vnode === 'boolean') vnode = '' - - // If the VNode represents a Component, perform a component diff: - let vnodeName = vnode.nodeName - if (options.mapping[vnodeName]) { - vnode.nodeName = options.mapping[vnodeName] - return buildComponentFromVNode(dom, vnode, context, mountAll) - } - if (typeof vnodeName == 'function') { - return buildComponentFromVNode(dom, vnode, context, mountAll) - } - - // Fast case: Strings & Numbers create/update Text nodes. - if (typeof vnode === 'string' || typeof vnode === 'number') { - // update if it's already a Text node: - if ( - dom && - dom.splitText !== undefined && - dom.parentNode && - (!dom._component || componentRoot) - ) { - /* istanbul ignore if */ /* Browser quirk that can't be covered: https://github.com/developit/preact/commit/fd4f21f5c45dfd75151bd27b4c217d8003aa5eb9 */ - if (dom.nodeValue != vnode) { - dom.nodeValue = vnode - } - } else { - // it wasn't a Text node: replace it with one and recycle the old Element - out = options.doc.createTextNode(vnode) - if (dom) { - if (dom.parentNode) dom.parentNode.replaceChild(out, dom) - recollectNodeTree(dom, true) - } - } - - //ie8 error - try { - out[ATTR_KEY] = true - } catch (e) {} - - return out - } - - // Tracks entering and exiting SVG namespace when descending through the tree. - isSvgMode = - vnodeName === 'svg' - ? true - : vnodeName === 'foreignObject' - ? false - : isSvgMode - - // If there's no existing element or it's the wrong type, create a new one: - vnodeName = String(vnodeName) - if (!dom || !isNamedNode(dom, vnodeName)) { - out = createNode(vnodeName, isSvgMode) - - if (dom) { - // move children into the replacement node - while (dom.firstChild) out.appendChild(dom.firstChild) - - // if the previous Element was mounted into the DOM, replace it inline - if (dom.parentNode) dom.parentNode.replaceChild(out, dom) - - // recycle the old element (skips non-Element node types) - recollectNodeTree(dom, true) - } - } - - let fc = out.firstChild, - props = out[ATTR_KEY], - vchildren = vnode.children - - if (props == null) { - props = out[ATTR_KEY] = {} - for (let a = out.attributes, i = a.length; i--; ) - props[a[i].name] = a[i].value - } - - // Optimization: fast-path for elements containing a single TextNode: - if ( - !hydrating && - vchildren && - vchildren.length === 1 && - typeof vchildren[0] === 'string' && - fc != null && - fc.splitText !== undefined && - fc.nextSibling == null - ) { - if (fc.nodeValue != vchildren[0]) { - fc.nodeValue = vchildren[0] - //update rendering obj - fc._renderText.text = fc.nodeValue - } - } - // otherwise, if there are existing or new children, diff them: - else if ((vchildren && vchildren.length) || fc != null) { - innerDiffNode( - out, - vchildren, - context, - mountAll, - hydrating || props.dangerouslySetInnerHTML != null - ) - } - - // Apply attributes/props from VNode to the DOM Element: - diffAttributes(out, vnode.attributes, props) - - // restore previous SVG mode: (in case we're exiting an SVG namespace) - isSvgMode = prevSvgMode - - return out -} - -/** Apply child and attribute changes between a VNode and a DOM Node to the DOM. - * @param {Element} dom Element whose children should be compared & mutated - * @param {Array} vchildren Array of VNodes to compare to `dom.childNodes` - * @param {Object} context Implicitly descendant context object (from most recent `getChildContext()`) - * @param {Boolean} mountAll - * @param {Boolean} isHydrating If `true`, consumes externally created elements similar to hydration - */ -function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) { - let originalChildren = dom.childNodes, - children = [], - keyed = {}, - keyedLen = 0, - min = 0, - len = originalChildren.length, - childrenLen = 0, - vlen = vchildren ? vchildren.length : 0, - j, - c, - f, - vchild, - child - - // Build up a map of keyed children and an Array of unkeyed children: - if (len !== 0) { - for (let i = 0; i < len; i++) { - let child = originalChildren[i], - props = child[ATTR_KEY], - key = - vlen && props - ? child._component - ? child._component.__key - : props.key - : null - if (key != null) { - keyedLen++ - keyed[key] = child - } else if ( - props || - (child.splitText !== undefined - ? isHydrating - ? child.nodeValue.trim() - : true - : isHydrating) - ) { - children[childrenLen++] = child - } - } - } - - if (vlen !== 0) { - for (let i = 0; i < vlen; i++) { - vchild = vchildren[i] - child = null - - // attempt to find a node based on key matching - let key = vchild.key - if (key != null) { - if (keyedLen && keyed[key] !== undefined) { - child = keyed[key] - keyed[key] = undefined - keyedLen-- - } - } - // attempt to pluck a node of the same type from the existing children - else if (!child && min < childrenLen) { - for (j = min; j < childrenLen; j++) { - if ( - children[j] !== undefined && - isSameNodeType((c = children[j]), vchild, isHydrating) - ) { - child = c - children[j] = undefined - if (j === childrenLen - 1) childrenLen-- - if (j === min) min++ - break - } - } - } - - // morph the matched/found/created DOM child to match vchild (deep) - child = idiff(child, vchild, context, mountAll) - - f = originalChildren[i] - if (child && child !== dom && child !== f) { - if (f == null) { - dom.appendChild(child) - } else if (child === f.nextSibling) { - removeNode(f) - } else { - dom.insertBefore(child, f) - } - } - } - } - - // remove unused keyed children: - if (keyedLen) { - for (let i in keyed) - if (keyed[i] !== undefined) recollectNodeTree(keyed[i], false) - } - - // remove orphaned unkeyed children: - while (min <= childrenLen) { - if ((child = children[childrenLen--]) !== undefined) - recollectNodeTree(child, false) - } -} - -/** Recursively recycle (or just unmount) a node and its descendants. - * @param {Node} node DOM node to start unmount/removal from - * @param {Boolean} [unmountOnly=false] If `true`, only triggers unmount lifecycle, skips removal - */ -export function recollectNodeTree(node, unmountOnly) { - let component = node._component - if (component) { - // if node is owned by a Component, unmount that component (ends up recursing back here) - unmountComponent(component) - } else { - // If the node's VNode had a ref function, invoke it with null here. - // (this is part of the React spec, and smart for unsetting references) - if (node[ATTR_KEY] != null) applyRef(node[ATTR_KEY].ref, null) - - if (unmountOnly === false || node[ATTR_KEY] == null) { - removeNode(node) - } - - removeChildren(node) - } -} - -/** Recollect/unmount all children. - * - we use .lastChild here because it causes less reflow than .firstChild - * - it's also cheaper than accessing the .childNodes Live NodeList - */ -export function removeChildren(node) { - node = node.lastChild - while (node) { - let next = node.previousSibling - recollectNodeTree(node, true) - node = next - } -} - -/** Apply differences in attributes from a VNode to the given DOM Element. - * @param {Element} dom Element with attributes to diff `attrs` against - * @param {Object} attrs The desired end-state key-value attribute pairs - * @param {Object} old Current/previous attributes (from previous VNode or element's prop cache) - */ -function diffAttributes(dom, attrs, old) { - let name - - // remove attributes no longer present on the vnode by setting them to undefined - for (name in old) { - if (!(attrs && attrs[name] != null) && old[name] != null) { - setAccessor(dom, name, old[name], (old[name] = undefined), isSvgMode) - } - } - - // add new & update changed attributes - for (name in attrs) { - if ( - name !== 'children' && - name !== 'innerHTML' && - (!(name in old) || - attrs[name] !== - (name === 'value' || name === 'checked' ? dom[name] : old[name])) - ) { - setAccessor(dom, name, old[name], (old[name] = attrs[name]), isSvgMode) - } - } -} diff --git a/packages/omiax/src/omi/vdom/index.js b/packages/omiax/src/omi/vdom/index.js deleted file mode 100755 index 5e882f998..000000000 --- a/packages/omiax/src/omi/vdom/index.js +++ /dev/null @@ -1,62 +0,0 @@ -import { extend } from '../util' -import options from '../options' - -const mapping = options.mapping -/** - * Check if two nodes are equivalent. - * - * @param {Node} node DOM Node to compare - * @param {VNode} vnode Virtual DOM node to compare - * @param {boolean} [hydrating=false] If true, ignores component constructors when comparing. - * @private - */ -export function isSameNodeType(node, vnode, hydrating) { - if (typeof vnode === 'string' || typeof vnode === 'number') { - return node.splitText !== undefined - } - if (typeof vnode.nodeName === 'string') { - var ctor = mapping[vnode.nodeName] - if (ctor) { - return hydrating || node._componentConstructor === ctor - } - return !node._componentConstructor && isNamedNode(node, vnode.nodeName) - } - return hydrating || node._componentConstructor === vnode.nodeName -} - -/** - * Check if an Element has a given nodeName, case-insensitively. - * - * @param {Element} node A DOM Element to inspect the name of. - * @param {String} nodeName Unnormalized name to compare against. - */ -export function isNamedNode(node, nodeName) { - return ( - node.normalizedNodeName === nodeName || - node.nodeName.toLowerCase() === nodeName.toLowerCase() - ) -} - -/** - * Reconstruct Component-style `props` from a VNode. - * Ensures default/fallback values from `defaultProps`: - * Own-properties of `defaultProps` not present in `vnode.attributes` are added. - * - * @param {VNode} vnode - * @returns {Object} props - */ -export function getNodeProps(vnode) { - let props = extend({}, vnode.attributes) - props.children = vnode.children - - let defaultProps = vnode.nodeName.defaultProps - if (defaultProps !== undefined) { - for (let i in defaultProps) { - if (props[i] === undefined) { - props[i] = defaultProps[i] - } - } - } - - return props -} diff --git a/packages/omiax/src/render.js b/packages/omiax/src/render.js new file mode 100644 index 000000000..580ce6d13 --- /dev/null +++ b/packages/omiax/src/render.js @@ -0,0 +1,5 @@ +import layout from './layout/layout-node' + +export function render(node){ + console.log(layout(node())) +}