publish: omi v6.11.3, add updateSelf method
This commit is contained in:
parent
86314ef60e
commit
a7d29faa3f
|
@ -125,7 +125,8 @@ declare namespace Omi {
|
|||
normalizedNodeName?: string;
|
||||
elementId: number;
|
||||
|
||||
update?(ignoreAttrs?:boolean): void;
|
||||
update?(ignoreAttrs?:boolean, updateSelf?:boolean): void;
|
||||
updateSelf?(ignoreAttrs?:boolean): void;
|
||||
fire?(name: string, data?: any): void;
|
||||
css?(): string;
|
||||
// Abstract methods don't infer argument types
|
||||
|
@ -179,7 +180,8 @@ declare namespace Omi {
|
|||
normalizedNodeName?: string;
|
||||
elementId: number;
|
||||
|
||||
update?(ignoreAttrs?:boolean): void;
|
||||
update?(ignoreAttrs?:boolean, updateSelf?:boolean): void;
|
||||
updateSelf?(ignoreAttrs?:boolean): void;
|
||||
fire?(name: string, data?: any): void;
|
||||
css?(): string;
|
||||
// Abstract methods don't infer argument types
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omi v6.11.2 http://omijs.org
|
||||
* omi v6.11.3 http://omijs.org
|
||||
* Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.
|
||||
* By dntzhang https://github.com/dntzhang
|
||||
* Github: https://github.com/Tencent/omi
|
||||
|
@ -424,7 +424,7 @@
|
|||
* @returns {Element} dom The created/mutated element
|
||||
* @private
|
||||
*/
|
||||
function diff(dom, vnode, context, mountAll, parent, component) {
|
||||
function diff(dom, vnode, parent, component, updateSelf) {
|
||||
// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)
|
||||
var ret;
|
||||
if (!diffLevel++) {
|
||||
|
@ -448,7 +448,7 @@
|
|||
} else {
|
||||
ret = [];
|
||||
vnode.forEach(function (item, index) {
|
||||
var ele = idiff(index === 0 ? dom : null, item, context, mountAll, component);
|
||||
var ele = idiff(index === 0 ? dom : null, item, component, updateSelf);
|
||||
ret.push(ele);
|
||||
});
|
||||
}
|
||||
|
@ -456,13 +456,13 @@
|
|||
if (isArray(dom)) {
|
||||
dom.forEach(function (one, index) {
|
||||
if (index === 0) {
|
||||
ret = idiff(one, vnode, context, mountAll, component);
|
||||
ret = idiff(one, vnode, component, updateSelf);
|
||||
} else {
|
||||
recollectNodeTree(one, false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ret = idiff(dom, vnode, context, mountAll, component);
|
||||
ret = idiff(dom, vnode, component, updateSelf);
|
||||
}
|
||||
// append the element if its a new parent
|
||||
if (parent && ret.parentNode !== parent) parent.appendChild(ret);
|
||||
|
@ -478,7 +478,7 @@
|
|||
}
|
||||
|
||||
/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */
|
||||
function idiff(dom, vnode, context, mountAll, component) {
|
||||
function idiff(dom, vnode, component, updateSelf) {
|
||||
if (dom && vnode && dom.props) {
|
||||
dom.props.children = vnode.children;
|
||||
}
|
||||
|
@ -561,12 +561,12 @@
|
|||
// otherwise, if there are existing or new children, diff them:
|
||||
else if (vchildren && vchildren.length || fc != null) {
|
||||
if (!(out.constructor.is == 'WeElement' && out.constructor.noSlot)) {
|
||||
innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null, component);
|
||||
innerDiffNode(out, vchildren, hydrating || props.dangerouslySetInnerHTML != null, component, updateSelf);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply attributes/props from VNode to the DOM Element:
|
||||
diffAttributes(out, vnode.attributes, props, component);
|
||||
diffAttributes(out, vnode.attributes, props, component, updateSelf);
|
||||
if (out.props) {
|
||||
out.props.children = vnode.children;
|
||||
}
|
||||
|
@ -579,11 +579,9 @@
|
|||
/** 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, component) {
|
||||
function innerDiffNode(dom, vchildren, isHydrating, component, updateSelf) {
|
||||
var originalChildren = dom.childNodes,
|
||||
children = [],
|
||||
keyed = {},
|
||||
|
@ -641,7 +639,7 @@
|
|||
}
|
||||
|
||||
// morph the matched/found/created DOM child to match vchild (deep)
|
||||
child = idiff(child, vchild, context, mountAll, component);
|
||||
child = idiff(child, vchild, component, updateSelf);
|
||||
|
||||
f = originalChildren[i];
|
||||
if (child && child !== dom && child !== f) {
|
||||
|
@ -709,9 +707,9 @@
|
|||
* @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, component) {
|
||||
function diffAttributes(dom, attrs, old, component, updateSelf) {
|
||||
var name;
|
||||
var update = false;
|
||||
//let update = false
|
||||
var isWeElement = dom.update;
|
||||
var oldClone;
|
||||
if (dom.receiveProps) {
|
||||
|
@ -723,7 +721,7 @@
|
|||
setAccessor(dom, name, old[name], old[name] = undefined, isSvgMode, component);
|
||||
if (isWeElement) {
|
||||
delete dom.props[name];
|
||||
update = true;
|
||||
//update = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -736,26 +734,26 @@
|
|||
}
|
||||
var ccName = camelCase(name);
|
||||
dom.props[ccName] = old[ccName] = attrs[name];
|
||||
update = true;
|
||||
//update = true
|
||||
} else if (name !== 'children' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) {
|
||||
setAccessor(dom, name, old[name], attrs[name], isSvgMode, component);
|
||||
if (isWeElement) {
|
||||
var _ccName = camelCase(name);
|
||||
dom.props[_ccName] = old[_ccName] = attrs[name];
|
||||
update = true;
|
||||
//update = true
|
||||
} else {
|
||||
old[name] = attrs[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isWeElement && dom.parentNode) {
|
||||
if (isWeElement && !updateSelf && dom.parentNode) {
|
||||
//__hasChildren is not accuracy when it was empty at first, so add dom.children.length > 0 condition
|
||||
if (update || dom.__hasChildren || dom.children.length > 0 || dom.store && !dom.store.data) {
|
||||
if (dom.receiveProps(dom.props, oldClone) !== false) {
|
||||
dom.update();
|
||||
}
|
||||
//if (update || dom.__hasChildren || dom.children.length > 0 || (dom.store && !dom.store.data)) {
|
||||
if (dom.receiveProps(dom.props, oldClone) !== false) {
|
||||
dom.update();
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1419,7 +1417,7 @@
|
|||
var rendered = this.render(this.props, this.data, this.store);
|
||||
this.__hasChildren = Object.prototype.toString.call(rendered) === '[object Array]' && rendered.length > 0;
|
||||
|
||||
this.rootNode = diff(null, rendered, {}, false, null, this);
|
||||
this.rootNode = diff(null, rendered, null, this);
|
||||
this.rendered();
|
||||
|
||||
if (this.props.css) {
|
||||
|
@ -1452,7 +1450,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
WeElement.prototype.update = function update(ignoreAttrs) {
|
||||
WeElement.prototype.update = function update(ignoreAttrs, updateSelf) {
|
||||
this._willUpdate = true;
|
||||
this.beforeUpdate();
|
||||
this.beforeRender();
|
||||
|
@ -1467,11 +1465,15 @@
|
|||
this.rendered();
|
||||
this.__hasChildren = this.__hasChildren || Object.prototype.toString.call(rendered) === '[object Array]' && rendered.length > 0;
|
||||
|
||||
this.rootNode = diff(this.rootNode, rendered, null, null, this.shadowRoot, this);
|
||||
this.rootNode = diff(this.rootNode, rendered, this.shadowRoot, this, updateSelf);
|
||||
this._willUpdate = false;
|
||||
this.updated();
|
||||
};
|
||||
|
||||
WeElement.prototype.updateSelf = function updateSelf(ignoreAttrs) {
|
||||
this.update(ignoreAttrs, true);
|
||||
};
|
||||
|
||||
WeElement.prototype.removeAttribute = function removeAttribute(key) {
|
||||
_HTMLElement.prototype.removeAttribute.call(this, key);
|
||||
//Avoid executing removeAttribute methods before connectedCallback
|
||||
|
@ -1595,7 +1597,7 @@
|
|||
});
|
||||
parent.store = store;
|
||||
}
|
||||
return diff(null, vnode, {}, false, parent, false);
|
||||
return diff(null, vnode, parent, false);
|
||||
}
|
||||
|
||||
function update(patch, store) {
|
||||
|
@ -1883,7 +1885,7 @@
|
|||
|
||||
options.root.Omi = omi;
|
||||
options.root.omi = omi;
|
||||
options.root.Omi.version = '6.11.2';
|
||||
options.root.Omi.version = '6.11.3';
|
||||
|
||||
if (typeof module != 'undefined') module.exports = omi;else self.Omi = omi;
|
||||
}());
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omi v6.11.2 http://omijs.org
|
||||
* omi v6.11.3 http://omijs.org
|
||||
* Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.
|
||||
* By dntzhang https://github.com/dntzhang
|
||||
* Github: https://github.com/Tencent/omi
|
||||
|
@ -421,7 +421,7 @@ var hydrating = false;
|
|||
* @returns {Element} dom The created/mutated element
|
||||
* @private
|
||||
*/
|
||||
function diff(dom, vnode, context, mountAll, parent, component) {
|
||||
function diff(dom, vnode, parent, component, updateSelf) {
|
||||
// diffLevel having been 0 here indicates initial entry into the diff (not a subdiff)
|
||||
var ret;
|
||||
if (!diffLevel++) {
|
||||
|
@ -445,7 +445,7 @@ function diff(dom, vnode, context, mountAll, parent, component) {
|
|||
} else {
|
||||
ret = [];
|
||||
vnode.forEach(function (item, index) {
|
||||
var ele = idiff(index === 0 ? dom : null, item, context, mountAll, component);
|
||||
var ele = idiff(index === 0 ? dom : null, item, component, updateSelf);
|
||||
ret.push(ele);
|
||||
});
|
||||
}
|
||||
|
@ -453,13 +453,13 @@ function diff(dom, vnode, context, mountAll, parent, component) {
|
|||
if (isArray(dom)) {
|
||||
dom.forEach(function (one, index) {
|
||||
if (index === 0) {
|
||||
ret = idiff(one, vnode, context, mountAll, component);
|
||||
ret = idiff(one, vnode, component, updateSelf);
|
||||
} else {
|
||||
recollectNodeTree(one, false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ret = idiff(dom, vnode, context, mountAll, component);
|
||||
ret = idiff(dom, vnode, component, updateSelf);
|
||||
}
|
||||
// append the element if its a new parent
|
||||
if (parent && ret.parentNode !== parent) parent.appendChild(ret);
|
||||
|
@ -475,7 +475,7 @@ function diff(dom, vnode, context, mountAll, parent, component) {
|
|||
}
|
||||
|
||||
/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */
|
||||
function idiff(dom, vnode, context, mountAll, component) {
|
||||
function idiff(dom, vnode, component, updateSelf) {
|
||||
if (dom && vnode && dom.props) {
|
||||
dom.props.children = vnode.children;
|
||||
}
|
||||
|
@ -558,12 +558,12 @@ function idiff(dom, vnode, context, mountAll, component) {
|
|||
// otherwise, if there are existing or new children, diff them:
|
||||
else if (vchildren && vchildren.length || fc != null) {
|
||||
if (!(out.constructor.is == 'WeElement' && out.constructor.noSlot)) {
|
||||
innerDiffNode(out, vchildren, context, mountAll, hydrating || props.dangerouslySetInnerHTML != null, component);
|
||||
innerDiffNode(out, vchildren, hydrating || props.dangerouslySetInnerHTML != null, component, updateSelf);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply attributes/props from VNode to the DOM Element:
|
||||
diffAttributes(out, vnode.attributes, props, component);
|
||||
diffAttributes(out, vnode.attributes, props, component, updateSelf);
|
||||
if (out.props) {
|
||||
out.props.children = vnode.children;
|
||||
}
|
||||
|
@ -576,11 +576,9 @@ function idiff(dom, vnode, context, mountAll, component) {
|
|||
/** 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, component) {
|
||||
function innerDiffNode(dom, vchildren, isHydrating, component, updateSelf) {
|
||||
var originalChildren = dom.childNodes,
|
||||
children = [],
|
||||
keyed = {},
|
||||
|
@ -638,7 +636,7 @@ function innerDiffNode(dom, vchildren, context, mountAll, isHydrating, component
|
|||
}
|
||||
|
||||
// morph the matched/found/created DOM child to match vchild (deep)
|
||||
child = idiff(child, vchild, context, mountAll, component);
|
||||
child = idiff(child, vchild, component, updateSelf);
|
||||
|
||||
f = originalChildren[i];
|
||||
if (child && child !== dom && child !== f) {
|
||||
|
@ -706,9 +704,9 @@ function removeChildren(node) {
|
|||
* @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, component) {
|
||||
function diffAttributes(dom, attrs, old, component, updateSelf) {
|
||||
var name;
|
||||
var update = false;
|
||||
//let update = false
|
||||
var isWeElement = dom.update;
|
||||
var oldClone;
|
||||
if (dom.receiveProps) {
|
||||
|
@ -720,7 +718,7 @@ function diffAttributes(dom, attrs, old, component) {
|
|||
setAccessor(dom, name, old[name], old[name] = undefined, isSvgMode, component);
|
||||
if (isWeElement) {
|
||||
delete dom.props[name];
|
||||
update = true;
|
||||
//update = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -733,26 +731,26 @@ function diffAttributes(dom, attrs, old, component) {
|
|||
}
|
||||
var ccName = camelCase(name);
|
||||
dom.props[ccName] = old[ccName] = attrs[name];
|
||||
update = true;
|
||||
//update = true
|
||||
} else if (name !== 'children' && (!(name in old) || attrs[name] !== (name === 'value' || name === 'checked' ? dom[name] : old[name]))) {
|
||||
setAccessor(dom, name, old[name], attrs[name], isSvgMode, component);
|
||||
if (isWeElement) {
|
||||
var _ccName = camelCase(name);
|
||||
dom.props[_ccName] = old[_ccName] = attrs[name];
|
||||
update = true;
|
||||
//update = true
|
||||
} else {
|
||||
old[name] = attrs[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isWeElement && dom.parentNode) {
|
||||
if (isWeElement && !updateSelf && dom.parentNode) {
|
||||
//__hasChildren is not accuracy when it was empty at first, so add dom.children.length > 0 condition
|
||||
if (update || dom.__hasChildren || dom.children.length > 0 || dom.store && !dom.store.data) {
|
||||
if (dom.receiveProps(dom.props, oldClone) !== false) {
|
||||
dom.update();
|
||||
}
|
||||
//if (update || dom.__hasChildren || dom.children.length > 0 || (dom.store && !dom.store.data)) {
|
||||
if (dom.receiveProps(dom.props, oldClone) !== false) {
|
||||
dom.update();
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1416,7 +1414,7 @@ var WeElement = function (_HTMLElement) {
|
|||
var rendered = this.render(this.props, this.data, this.store);
|
||||
this.__hasChildren = Object.prototype.toString.call(rendered) === '[object Array]' && rendered.length > 0;
|
||||
|
||||
this.rootNode = diff(null, rendered, {}, false, null, this);
|
||||
this.rootNode = diff(null, rendered, null, this);
|
||||
this.rendered();
|
||||
|
||||
if (this.props.css) {
|
||||
|
@ -1449,7 +1447,7 @@ var WeElement = function (_HTMLElement) {
|
|||
}
|
||||
};
|
||||
|
||||
WeElement.prototype.update = function update(ignoreAttrs) {
|
||||
WeElement.prototype.update = function update(ignoreAttrs, updateSelf) {
|
||||
this._willUpdate = true;
|
||||
this.beforeUpdate();
|
||||
this.beforeRender();
|
||||
|
@ -1464,11 +1462,15 @@ var WeElement = function (_HTMLElement) {
|
|||
this.rendered();
|
||||
this.__hasChildren = this.__hasChildren || Object.prototype.toString.call(rendered) === '[object Array]' && rendered.length > 0;
|
||||
|
||||
this.rootNode = diff(this.rootNode, rendered, null, null, this.shadowRoot, this);
|
||||
this.rootNode = diff(this.rootNode, rendered, this.shadowRoot, this, updateSelf);
|
||||
this._willUpdate = false;
|
||||
this.updated();
|
||||
};
|
||||
|
||||
WeElement.prototype.updateSelf = function updateSelf(ignoreAttrs) {
|
||||
this.update(ignoreAttrs, true);
|
||||
};
|
||||
|
||||
WeElement.prototype.removeAttribute = function removeAttribute(key) {
|
||||
_HTMLElement.prototype.removeAttribute.call(this, key);
|
||||
//Avoid executing removeAttribute methods before connectedCallback
|
||||
|
@ -1592,7 +1594,7 @@ function render(vnode, parent, store) {
|
|||
});
|
||||
parent.store = store;
|
||||
}
|
||||
return diff(null, vnode, {}, false, parent, false);
|
||||
return diff(null, vnode, parent, false);
|
||||
}
|
||||
|
||||
function update(patch, store) {
|
||||
|
@ -1880,7 +1882,7 @@ var omi = {
|
|||
|
||||
options.root.Omi = omi;
|
||||
options.root.omi = omi;
|
||||
options.root.Omi.version = '6.11.2';
|
||||
options.root.Omi.version = '6.11.3';
|
||||
|
||||
export default omi;
|
||||
export { tag, WeElement, Component, render, h, h as createElement, options, define, observe, cloneElement, getHost, rpx, tick, nextTick, ModelView, defineElement, classNames, extractClass, createRef, html, htm, o, elements, $, extend$1 as extend, get, set, bind, unbind, JSONPatcherProxy as JSONProxy };
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -182,7 +182,7 @@
|
|||
detail: e
|
||||
}));
|
||||
}
|
||||
function diff(dom, vnode, context, mountAll, parent, component) {
|
||||
function diff(dom, vnode, parent, component, updateSelf) {
|
||||
var ret;
|
||||
if (!diffLevel++) {
|
||||
isSvgMode = null != parent && void 0 !== parent.ownerSVGElement;
|
||||
|
@ -193,24 +193,24 @@
|
|||
styles.forEach(function(s) {
|
||||
parent.removeChild(s);
|
||||
});
|
||||
innerDiffNode(parent, vnode, null, null, null, component);
|
||||
innerDiffNode(parent, vnode, null, null, null);
|
||||
for (var i = styles.length - 1; i >= 0; i--) parent.firstChild ? parent.insertBefore(styles[i], parent.firstChild) : parent.appendChild(style[i]);
|
||||
} else {
|
||||
ret = [];
|
||||
vnode.forEach(function(item, index) {
|
||||
var ele = idiff(0 === index ? dom : null, item, context, mountAll, component);
|
||||
var ele = idiff(0 === index ? dom : null, item, component, updateSelf);
|
||||
ret.push(ele);
|
||||
});
|
||||
} else {
|
||||
if (isArray(dom)) dom.forEach(function(one, index) {
|
||||
if (0 === index) ret = idiff(one, vnode, context, mountAll, component); else recollectNodeTree(one, !1);
|
||||
}); else ret = idiff(dom, vnode, context, mountAll, component);
|
||||
if (0 === index) ret = idiff(one, vnode, component, updateSelf); else recollectNodeTree(one, !1);
|
||||
}); else ret = idiff(dom, vnode, component, updateSelf);
|
||||
if (parent && ret.parentNode !== parent) parent.appendChild(ret);
|
||||
}
|
||||
if (!--diffLevel) hydrating = !1;
|
||||
return ret;
|
||||
}
|
||||
function idiff(dom, vnode, context, mountAll, component) {
|
||||
function idiff(dom, vnode, component, updateSelf) {
|
||||
if (dom && vnode && dom.props) dom.props.children = vnode.children;
|
||||
var out = dom, prevSvgMode = isSvgMode;
|
||||
if (null == vnode || 'boolean' == typeof vnode) vnode = '';
|
||||
|
@ -250,13 +250,13 @@
|
|||
}
|
||||
if (!hydrating && vchildren && 1 === vchildren.length && 'string' == typeof vchildren[0] && null != fc && void 0 !== fc.splitText && null == fc.nextSibling) {
|
||||
if (fc.nodeValue != vchildren[0]) fc.nodeValue = vchildren[0];
|
||||
} else if (vchildren && vchildren.length || null != fc) if ('WeElement' != out.constructor.is || !out.constructor.noSlot) innerDiffNode(out, vchildren, context, mountAll, hydrating || null != props.dangerouslySetInnerHTML, component);
|
||||
diffAttributes(out, vnode.attributes, props, component);
|
||||
} else if (vchildren && vchildren.length || null != fc) if ('WeElement' != out.constructor.is || !out.constructor.noSlot) innerDiffNode(out, vchildren, hydrating || null != props.dangerouslySetInnerHTML, component, updateSelf);
|
||||
diffAttributes(out, vnode.attributes, props, component, updateSelf);
|
||||
if (out.props) out.props.children = vnode.children;
|
||||
isSvgMode = prevSvgMode;
|
||||
return out;
|
||||
}
|
||||
function innerDiffNode(dom, vchildren, context, mountAll, isHydrating, component) {
|
||||
function innerDiffNode(dom, vchildren, isHydrating, component, updateSelf) {
|
||||
var j, c, f, vchild, child, originalChildren = dom.childNodes, children = [], keyed = {}, keyedLen = 0, min = 0, len = originalChildren.length, childrenLen = 0, vlen = vchildren ? vchildren.length : 0;
|
||||
if (0 !== len) for (var i = 0; i < len; i++) {
|
||||
var _child = originalChildren[i], props = _child.__p, key = vlen && props ? _child._component ? _child._component.__k : props.key : null;
|
||||
|
@ -282,7 +282,7 @@
|
|||
if (j === min) min++;
|
||||
break;
|
||||
}
|
||||
child = idiff(child, vchild, context, mountAll, component);
|
||||
child = idiff(child, vchild, component, updateSelf);
|
||||
f = originalChildren[i];
|
||||
if (child && child !== dom && child !== f) if (null == f) dom.appendChild(child); else if (child === f.nextSibling) removeNode(f); else dom.insertBefore(child, f);
|
||||
}
|
||||
|
@ -302,33 +302,27 @@
|
|||
node = next;
|
||||
}
|
||||
}
|
||||
function diffAttributes(dom, attrs, old, component) {
|
||||
function diffAttributes(dom, attrs, old, component, updateSelf) {
|
||||
var name;
|
||||
var update = !1;
|
||||
var isWeElement = dom.update;
|
||||
var oldClone;
|
||||
if (dom.receiveProps) oldClone = Object.assign({}, old);
|
||||
for (name in old) if ((!attrs || null == attrs[name]) && null != old[name]) {
|
||||
setAccessor(dom, name, old[name], old[name] = void 0, isSvgMode, component);
|
||||
if (isWeElement) {
|
||||
delete dom.props[name];
|
||||
update = !0;
|
||||
}
|
||||
if (isWeElement) delete dom.props[name];
|
||||
}
|
||||
for (name in attrs) if (isWeElement && 'object' == typeof attrs[name] && 'ref' !== name) {
|
||||
if ('style' === name) setAccessor(dom, name, old[name], old[name] = attrs[name], isSvgMode, component);
|
||||
var ccName = camelCase(name);
|
||||
dom.props[ccName] = old[ccName] = attrs[name];
|
||||
update = !0;
|
||||
} else if (!('children' === name || name in old && attrs[name] === ('value' === name || 'checked' === name ? dom[name] : old[name]))) {
|
||||
setAccessor(dom, name, old[name], attrs[name], isSvgMode, component);
|
||||
if (isWeElement) {
|
||||
var _ccName = camelCase(name);
|
||||
dom.props[_ccName] = old[_ccName] = attrs[name];
|
||||
update = !0;
|
||||
} else old[name] = attrs[name];
|
||||
}
|
||||
if (isWeElement && dom.parentNode) if (update || dom.P || dom.children.length > 0 || dom.store && !dom.store.data) if (!1 !== dom.receiveProps(dom.props, oldClone)) dom.update();
|
||||
if (isWeElement && !updateSelf && dom.parentNode) if (!1 !== dom.receiveProps(dom.props, oldClone)) dom.update();
|
||||
}
|
||||
function tick(fn, scope) {
|
||||
callbacks.push({
|
||||
|
@ -538,7 +532,7 @@
|
|||
});
|
||||
parent.store = store;
|
||||
}
|
||||
return diff(null, vnode, {}, !1, parent, !1);
|
||||
return diff(null, vnode, parent, !1);
|
||||
}
|
||||
function update(patch, store) {
|
||||
store.update(patch);
|
||||
|
@ -951,7 +945,7 @@
|
|||
}
|
||||
var rendered = this.render(this.props, this.data, this.store);
|
||||
this.P = '[object Array]' === Object.prototype.toString.call(rendered) && rendered.length > 0;
|
||||
this.rootNode = diff(null, rendered, {}, !1, null, this);
|
||||
this.rootNode = diff(null, rendered, null, this);
|
||||
this.rendered();
|
||||
if (this.props.css) {
|
||||
this.N = cssToDom(this.props.css);
|
||||
|
@ -972,7 +966,7 @@
|
|||
break;
|
||||
}
|
||||
};
|
||||
WeElement.prototype.update = function(ignoreAttrs) {
|
||||
WeElement.prototype.update = function(ignoreAttrs, updateSelf) {
|
||||
this.J = !0;
|
||||
this.beforeUpdate();
|
||||
this.beforeRender();
|
||||
|
@ -984,10 +978,13 @@
|
|||
var rendered = this.render(this.props, this.data, this.store);
|
||||
this.rendered();
|
||||
this.P = this.P || '[object Array]' === Object.prototype.toString.call(rendered) && rendered.length > 0;
|
||||
this.rootNode = diff(this.rootNode, rendered, null, null, this.shadowRoot, this);
|
||||
this.rootNode = diff(this.rootNode, rendered, this.shadowRoot, this, updateSelf);
|
||||
this.J = !1;
|
||||
this.updated();
|
||||
};
|
||||
WeElement.prototype.updateSelf = function(ignoreAttrs) {
|
||||
this.update(ignoreAttrs, !0);
|
||||
};
|
||||
WeElement.prototype.removeAttribute = function(key) {
|
||||
_HTMLElement.prototype.removeAttribute.call(this, key);
|
||||
this.B && this.update();
|
||||
|
@ -1131,7 +1128,7 @@
|
|||
};
|
||||
options.root.Omi = omi;
|
||||
options.root.omi = omi;
|
||||
options.root.Omi.version = '6.11.2';
|
||||
options.root.Omi.version = '6.11.3';
|
||||
if ('undefined' != typeof module) module.exports = omi; else self.Omi = omi;
|
||||
}();
|
||||
//# sourceMappingURL=omi.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "omi",
|
||||
"version": "6.11.2",
|
||||
"version": "6.11.3",
|
||||
"description": "Front End Cross-Frameworks Framework.",
|
||||
"main": "dist/omi.js",
|
||||
"jsnext:main": "dist/omi.esm.js",
|
||||
|
|
|
@ -62,7 +62,7 @@ const omi = {
|
|||
|
||||
options.root.Omi = omi
|
||||
options.root.omi = omi
|
||||
options.root.Omi.version = '6.11.2'
|
||||
options.root.Omi.version = '6.11.3'
|
||||
|
||||
export default omi
|
||||
|
||||
|
|
Loading…
Reference in New Issue