This commit is contained in:
dntzhang 2018-11-07 22:12:00 +08:00
parent e060fabf97
commit c91af1288b
10 changed files with 40 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/**
* omi v4.0.21 http://omijs.org
* omi v4.0.22 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
@ -346,10 +346,13 @@
ret = [];
var parentNode = null;
if (isArray(dom)) {
var domLength = dom.length;
var vnodeLength = vnode.length;
var maxLength = domLength >= vnodeLength ? domLength : vnodeLength;
parentNode = dom[0].parentNode;
dom.forEach(function (item, index) {
ret.push(idiff(item, vnode[index], context, mountAll, componentRoot));
});
for (var i = 0; i < maxLength; i++) {
ret.push(idiff(dom[i], vnode[i], context, mountAll, componentRoot));
}
} else {
vnode.forEach(function (item) {
ret.push(idiff(dom, item, context, mountAll, componentRoot));
@ -381,7 +384,7 @@
/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */
function idiff(dom, vnode, context, mountAll, componentRoot) {
if (dom && dom.props) {
if (dom && vnode && dom.props) {
dom.props.children = vnode.children;
}
var out = dom,
@ -1039,7 +1042,7 @@
}
}
this.install();
!this._isInstalled && this.install();
var shadowRoot;
if (!this.shadowRoot) {
shadowRoot = this.attachShadow({
@ -1054,7 +1057,7 @@
}
this.css && shadowRoot.appendChild(cssToDom(this.css()));
this.beforeRender();
!this._isInstalled && this.beforeRender();
options.afterInstall && options.afterInstall(this);
if (this.constructor.observe) {
proxyUpdate(this);
@ -1067,7 +1070,7 @@
} else {
shadowRoot.appendChild(this.host);
}
this.installed();
!this._isInstalled && this.installed();
this._isInstalled = true;
};
@ -1416,7 +1419,7 @@
};
options.root.Omi = omi;
options.root.Omi.version = '4.0.21';
options.root.Omi.version = '4.0.22';
if (typeof module != 'undefined') module.exports = omi;else self.Omi = omi;
}());

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/**
* omi v4.0.21 http://omijs.org
* omi v4.0.22 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
@ -343,10 +343,13 @@ function diff(dom, vnode, context, mountAll, parent, componentRoot) {
ret = [];
var parentNode = null;
if (isArray(dom)) {
var domLength = dom.length;
var vnodeLength = vnode.length;
var maxLength = domLength >= vnodeLength ? domLength : vnodeLength;
parentNode = dom[0].parentNode;
dom.forEach(function (item, index) {
ret.push(idiff(item, vnode[index], context, mountAll, componentRoot));
});
for (var i = 0; i < maxLength; i++) {
ret.push(idiff(dom[i], vnode[i], context, mountAll, componentRoot));
}
} else {
vnode.forEach(function (item) {
ret.push(idiff(dom, item, context, mountAll, componentRoot));
@ -378,7 +381,7 @@ function diff(dom, vnode, context, mountAll, parent, componentRoot) {
/** Internals of `diff()`, separated to allow bypassing diffLevel / mount flushing. */
function idiff(dom, vnode, context, mountAll, componentRoot) {
if (dom && dom.props) {
if (dom && vnode && dom.props) {
dom.props.children = vnode.children;
}
var out = dom,
@ -1036,7 +1039,7 @@ var WeElement = function (_HTMLElement) {
}
}
this.install();
!this._isInstalled && this.install();
var shadowRoot;
if (!this.shadowRoot) {
shadowRoot = this.attachShadow({
@ -1051,7 +1054,7 @@ var WeElement = function (_HTMLElement) {
}
this.css && shadowRoot.appendChild(cssToDom(this.css()));
this.beforeRender();
!this._isInstalled && this.beforeRender();
options.afterInstall && options.afterInstall(this);
if (this.constructor.observe) {
proxyUpdate(this);
@ -1064,7 +1067,7 @@ var WeElement = function (_HTMLElement) {
} else {
shadowRoot.appendChild(this.host);
}
this.installed();
!this._isInstalled && this.installed();
this._isInstalled = true;
};
@ -1413,7 +1416,7 @@ var omi = {
};
options.root.Omi = omi;
options.root.Omi.version = '4.0.21';
options.root.Omi.version = '4.0.22';
export default omi;
export { tag, WeElement, Component, render, h, h as createElement, options, define, observe, cloneElement, getHost };

File diff suppressed because one or more lines are too long

View File

@ -109,10 +109,11 @@
ret = [];
var parentNode = null;
if (isArray(dom)) {
var domLength = dom.length;
var vnodeLength = vnode.length;
var maxLength = domLength >= vnodeLength ? domLength : vnodeLength;
parentNode = dom[0].parentNode;
dom.forEach(function(item, index) {
ret.push(idiff(item, vnode[index], context, mountAll, componentRoot));
});
for (var i = 0; i < maxLength; i++) ret.push(idiff(dom[i], vnode[i], context, mountAll, componentRoot));
} else vnode.forEach(function(item) {
ret.push(idiff(dom, item, context, mountAll, componentRoot));
});
@ -129,7 +130,7 @@
return ret;
}
function idiff(dom, vnode, context, mountAll, componentRoot) {
if (dom && dom.props) dom.props.children = vnode.children;
if (dom && vnode && dom.props) dom.props.children = vnode.children;
var out = dom, prevSvgMode = isSvgMode;
if (null == vnode || 'boolean' == typeof vnode) vnode = '';
if ('string' == typeof vnode || 'number' == typeof vnode) {
@ -717,7 +718,7 @@
}
if (this.store) this.store.instances.push(this);
}
this.install();
!this.B && this.install();
var shadowRoot;
if (!this.shadowRoot) shadowRoot = this.attachShadow({
mode: 'open'
@ -727,14 +728,14 @@
while (fc = shadowRoot.firstChild) shadowRoot.removeChild(fc);
}
this.css && shadowRoot.appendChild(cssToDom(this.css()));
this.beforeRender();
!this.B && this.beforeRender();
options.afterInstall && options.afterInstall(this);
if (this.constructor.observe) proxyUpdate(this);
this.host = diff(null, this.render(this.props, !this.constructor.pure && this.store ? this.store.data : this.data), {}, !1, null, !1);
if (isArray(this.host)) this.host.forEach(function(item) {
shadowRoot.appendChild(item);
}); else shadowRoot.appendChild(this.host);
this.installed();
!this.B && this.installed();
this.B = !0;
};
WeElement.prototype.disconnectedCallback = function() {
@ -779,7 +780,7 @@
getHost: getHost
};
options.root.Omi = omi;
options.root.Omi.version = '4.0.21';
options.root.Omi.version = '4.0.22';
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

View File

@ -1,6 +1,6 @@
{
"name": "omi",
"version": "4.0.21",
"version": "4.0.22",
"description": "Next generation web framework.",
"main": "dist/omi.js",
"jsnext:main": "dist/omi.esm.js",

View File

@ -25,7 +25,7 @@ const omi = {
}
options.root.Omi = omi
options.root.Omi.version = '4.0.21'
options.root.Omi.version = '4.0.22'
export default omi