omi - v6.6.7
This commit is contained in:
parent
5eab634ef6
commit
0b604da4bd
|
@ -107,6 +107,7 @@ declare namespace Omi {
|
|||
|
||||
props: RenderableProps<P>;
|
||||
data?: D;
|
||||
prevProps: RenderableProps<P>;
|
||||
host?: HTMLElement;
|
||||
normalizedNodeName?: string;
|
||||
elementId: number;
|
||||
|
@ -137,6 +138,7 @@ declare namespace Omi {
|
|||
|
||||
props: RenderableProps<P>;
|
||||
data: D;
|
||||
prevProps: RenderableProps<P>;
|
||||
host: HTMLElement;
|
||||
|
||||
update(ignoreAttrs?:boolean): void;
|
||||
|
@ -159,6 +161,7 @@ declare namespace Omi {
|
|||
|
||||
props: RenderableProps<P>;
|
||||
data?: D;
|
||||
prevProps: RenderableProps<P>;
|
||||
host?: HTMLElement;
|
||||
normalizedNodeName?: string;
|
||||
elementId: number;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omi v6.6.6 http://omijs.org
|
||||
* omi v6.6.7 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
|
||||
|
@ -385,7 +385,7 @@
|
|||
isSvgMode = parent != null && parent.ownerSVGElement !== undefined;
|
||||
|
||||
// hydration is indicated by the existing element to be diffed not having a prop cache
|
||||
hydrating = dom != null && !('__omiattr_' in dom);
|
||||
hydrating = dom != null && !('prevProps' in dom);
|
||||
}
|
||||
if (isArray(vnode)) {
|
||||
if (parent) {
|
||||
|
@ -460,7 +460,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
out['__omiattr_'] = true;
|
||||
out['prevProps'] = true;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -497,11 +497,11 @@
|
|||
}
|
||||
|
||||
var fc = out.firstChild,
|
||||
props = out['__omiattr_'],
|
||||
props = out['prevProps'],
|
||||
vchildren = vnode.children;
|
||||
|
||||
if (props == null) {
|
||||
props = out['__omiattr_'] = {};
|
||||
props = out['prevProps'] = {};
|
||||
for (var a = out.attributes, i = a.length; i--;) {
|
||||
props[a[i].name] = a[i].value;
|
||||
}
|
||||
|
@ -557,7 +557,7 @@
|
|||
if (len !== 0) {
|
||||
for (var i = 0; i < len; i++) {
|
||||
var _child = originalChildren[i],
|
||||
props = _child['__omiattr_'],
|
||||
props = _child['prevProps'],
|
||||
key = vlen && props ? _child._component ? _child._component.__key : props.key : null;
|
||||
if (key != null) {
|
||||
keyedLen++;
|
||||
|
@ -631,15 +631,15 @@
|
|||
function recollectNodeTree(node, unmountOnly) {
|
||||
// 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['__omiattr_'] != null && node['__omiattr_'].ref) {
|
||||
if (typeof node['__omiattr_'].ref === 'function') {
|
||||
node['__omiattr_'].ref(null);
|
||||
} else if (node['__omiattr_'].ref.current) {
|
||||
node['__omiattr_'].ref.current = null;
|
||||
if (node['prevProps'] != null && node['prevProps'].ref) {
|
||||
if (typeof node['prevProps'].ref === 'function') {
|
||||
node['prevProps'].ref(null);
|
||||
} else if (node['prevProps'].ref.current) {
|
||||
node['prevProps'].ref.current = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (unmountOnly === false || node['__omiattr_'] == null) {
|
||||
if (unmountOnly === false || node['prevProps'] == null) {
|
||||
removeNode(node);
|
||||
}
|
||||
|
||||
|
@ -703,15 +703,6 @@
|
|||
if (isWeElement && 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) {
|
||||
var op = dom.constructor.onceProps;
|
||||
if (op) {
|
||||
for (var i = 0, len = op.length; i < len; i++) {
|
||||
var _name = op[i];
|
||||
dom.props[_name] = oldClone[_name];
|
||||
dom['__omiattr_'][_name] = oldClone[_name];
|
||||
}
|
||||
}
|
||||
|
||||
if (dom.receiveProps(dom.props, oldClone) !== false) {
|
||||
dom.update();
|
||||
}
|
||||
|
@ -1813,7 +1804,7 @@
|
|||
|
||||
options.root.Omi = omi;
|
||||
options.root.omi = omi;
|
||||
options.root.Omi.version = '6.6.6';
|
||||
options.root.Omi.version = '6.6.7';
|
||||
|
||||
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.6.6 http://omijs.org
|
||||
* omi v6.6.7 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
|
||||
|
@ -382,7 +382,7 @@ function diff(dom, vnode, context, mountAll, parent, componentRoot) {
|
|||
isSvgMode = parent != null && parent.ownerSVGElement !== undefined;
|
||||
|
||||
// hydration is indicated by the existing element to be diffed not having a prop cache
|
||||
hydrating = dom != null && !('__omiattr_' in dom);
|
||||
hydrating = dom != null && !('prevProps' in dom);
|
||||
}
|
||||
if (isArray(vnode)) {
|
||||
if (parent) {
|
||||
|
@ -457,7 +457,7 @@ function idiff(dom, vnode, context, mountAll, componentRoot) {
|
|||
}
|
||||
}
|
||||
|
||||
out['__omiattr_'] = true;
|
||||
out['prevProps'] = true;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -494,11 +494,11 @@ function idiff(dom, vnode, context, mountAll, componentRoot) {
|
|||
}
|
||||
|
||||
var fc = out.firstChild,
|
||||
props = out['__omiattr_'],
|
||||
props = out['prevProps'],
|
||||
vchildren = vnode.children;
|
||||
|
||||
if (props == null) {
|
||||
props = out['__omiattr_'] = {};
|
||||
props = out['prevProps'] = {};
|
||||
for (var a = out.attributes, i = a.length; i--;) {
|
||||
props[a[i].name] = a[i].value;
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {
|
|||
if (len !== 0) {
|
||||
for (var i = 0; i < len; i++) {
|
||||
var _child = originalChildren[i],
|
||||
props = _child['__omiattr_'],
|
||||
props = _child['prevProps'],
|
||||
key = vlen && props ? _child._component ? _child._component.__key : props.key : null;
|
||||
if (key != null) {
|
||||
keyedLen++;
|
||||
|
@ -628,15 +628,15 @@ function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {
|
|||
function recollectNodeTree(node, unmountOnly) {
|
||||
// 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['__omiattr_'] != null && node['__omiattr_'].ref) {
|
||||
if (typeof node['__omiattr_'].ref === 'function') {
|
||||
node['__omiattr_'].ref(null);
|
||||
} else if (node['__omiattr_'].ref.current) {
|
||||
node['__omiattr_'].ref.current = null;
|
||||
if (node['prevProps'] != null && node['prevProps'].ref) {
|
||||
if (typeof node['prevProps'].ref === 'function') {
|
||||
node['prevProps'].ref(null);
|
||||
} else if (node['prevProps'].ref.current) {
|
||||
node['prevProps'].ref.current = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (unmountOnly === false || node['__omiattr_'] == null) {
|
||||
if (unmountOnly === false || node['prevProps'] == null) {
|
||||
removeNode(node);
|
||||
}
|
||||
|
||||
|
@ -700,15 +700,6 @@ function diffAttributes(dom, attrs, old) {
|
|||
if (isWeElement && 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) {
|
||||
var op = dom.constructor.onceProps;
|
||||
if (op) {
|
||||
for (var i = 0, len = op.length; i < len; i++) {
|
||||
var _name = op[i];
|
||||
dom.props[_name] = oldClone[_name];
|
||||
dom['__omiattr_'][_name] = oldClone[_name];
|
||||
}
|
||||
}
|
||||
|
||||
if (dom.receiveProps(dom.props, oldClone) !== false) {
|
||||
dom.update();
|
||||
}
|
||||
|
@ -1810,7 +1801,7 @@ var omi = {
|
|||
|
||||
options.root.Omi = omi;
|
||||
options.root.omi = omi;
|
||||
options.root.Omi.version = '6.6.6';
|
||||
options.root.Omi.version = '6.6.7';
|
||||
|
||||
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 };
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -160,7 +160,7 @@
|
|||
var ret;
|
||||
if (!diffLevel++) {
|
||||
isSvgMode = null != parent && void 0 !== parent.ownerSVGElement;
|
||||
hydrating = null != dom && !('__omiattr_' in dom);
|
||||
hydrating = null != dom && !('prevProps' in dom);
|
||||
}
|
||||
if (isArray(vnode)) if (parent) {
|
||||
var styles = parent.querySelectorAll('style');
|
||||
|
@ -199,7 +199,7 @@
|
|||
recollectNodeTree(dom, !0);
|
||||
}
|
||||
}
|
||||
out.__omiattr_ = !0;
|
||||
out.__p = !0;
|
||||
return out;
|
||||
}
|
||||
var vnodeName = vnode.nodeName;
|
||||
|
@ -218,9 +218,9 @@
|
|||
recollectNodeTree(dom, !0);
|
||||
}
|
||||
}
|
||||
var fc = out.firstChild, props = out.__omiattr_, vchildren = vnode.children;
|
||||
var fc = out.firstChild, props = out.__p, vchildren = vnode.children;
|
||||
if (null == props) {
|
||||
props = out.__omiattr_ = {};
|
||||
props = out.__p = {};
|
||||
for (var a = out.attributes, i = a.length; i--; ) props[a[i].name] = a[i].value;
|
||||
}
|
||||
if (!hydrating && vchildren && 1 === vchildren.length && 'string' == typeof vchildren[0] && null != fc && void 0 !== fc.splitText && null == fc.nextSibling) {
|
||||
|
@ -234,7 +234,7 @@
|
|||
function innerDiffNode(dom, vchildren, context, mountAll, isHydrating) {
|
||||
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.__omiattr_, key = vlen && props ? _child._component ? _child._component.__k : props.key : null;
|
||||
var _child = originalChildren[i], props = _child.__p, key = vlen && props ? _child._component ? _child._component.__k : props.key : null;
|
||||
if (null != key) {
|
||||
keyedLen++;
|
||||
keyed[key] = _child;
|
||||
|
@ -265,8 +265,8 @@
|
|||
while (min <= childrenLen) if (void 0 !== (child = children[childrenLen--])) recollectNodeTree(child, !1);
|
||||
}
|
||||
function recollectNodeTree(node, unmountOnly) {
|
||||
if (null != node.__omiattr_ && node.__omiattr_.ref) if ('function' == typeof node.__omiattr_.ref) node.__omiattr_.ref(null); else if (node.__omiattr_.ref.current) node.__omiattr_.ref.current = null;
|
||||
if (!1 === unmountOnly || null == node.__omiattr_) removeNode(node);
|
||||
if (null != node.__p && node.__p.ref) if ('function' == typeof node.__p.ref) node.__p.ref(null); else if (node.__p.ref.current) node.__p.ref.current = null;
|
||||
if (!1 === unmountOnly || null == node.__p) removeNode(node);
|
||||
removeChildren(node);
|
||||
}
|
||||
function removeChildren(node) {
|
||||
|
@ -301,15 +301,7 @@
|
|||
update = !0;
|
||||
}
|
||||
}
|
||||
if (isWeElement && dom.parentNode) if (update || dom.P || dom.children.length > 0 || dom.store && !dom.store.data) {
|
||||
var op = dom.constructor.onceProps;
|
||||
if (op) for (var i = 0, len = op.length; i < len; i++) {
|
||||
var _name = op[i];
|
||||
dom.props[_name] = oldClone[_name];
|
||||
dom.__omiattr_[_name] = oldClone[_name];
|
||||
}
|
||||
if (!1 !== dom.receiveProps(dom.props, oldClone)) dom.update();
|
||||
}
|
||||
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();
|
||||
}
|
||||
function tick(fn, scope) {
|
||||
callbacks.push({
|
||||
|
@ -1091,7 +1083,7 @@
|
|||
};
|
||||
options.root.Omi = omi;
|
||||
options.root.omi = omi;
|
||||
options.root.Omi.version = '6.6.6';
|
||||
options.root.Omi.version = '6.6.7';
|
||||
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.6.6",
|
||||
"version": "6.6.7",
|
||||
"description": "Front End Cross-Frameworks Framework.",
|
||||
"main": "dist/omi.js",
|
||||
"jsnext:main": "dist/omi.esm.js",
|
||||
|
|
|
@ -5,7 +5,7 @@ export const SYNC_RENDER = 1
|
|||
export const FORCE_RENDER = 2
|
||||
export const ASYNC_RENDER = 3
|
||||
|
||||
export const ATTR_KEY = '__omiattr_'
|
||||
export const ATTR_KEY = 'prevProps'
|
||||
|
||||
// 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
|
||||
|
|
|
@ -107,6 +107,7 @@ declare namespace Omi {
|
|||
|
||||
props: RenderableProps<P>;
|
||||
data?: D;
|
||||
prevProps: RenderableProps<P>;
|
||||
host?: HTMLElement;
|
||||
normalizedNodeName?: string;
|
||||
elementId: number;
|
||||
|
@ -137,6 +138,7 @@ declare namespace Omi {
|
|||
|
||||
props: RenderableProps<P>;
|
||||
data: D;
|
||||
prevProps: RenderableProps<P>;
|
||||
host: HTMLElement;
|
||||
|
||||
update(ignoreAttrs?:boolean): void;
|
||||
|
@ -159,6 +161,7 @@ declare namespace Omi {
|
|||
|
||||
props: RenderableProps<P>;
|
||||
data?: D;
|
||||
prevProps: RenderableProps<P>;
|
||||
host?: HTMLElement;
|
||||
normalizedNodeName?: string;
|
||||
elementId: number;
|
||||
|
|
|
@ -52,7 +52,7 @@ const omi = {
|
|||
|
||||
options.root.Omi = omi
|
||||
options.root.omi = omi
|
||||
options.root.Omi.version = '6.6.6'
|
||||
options.root.Omi.version = '6.6.7'
|
||||
|
||||
export default omi
|
||||
|
||||
|
|
|
@ -393,15 +393,6 @@ function diffAttributes(dom, attrs, old) {
|
|||
if (isWeElement && 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)) {
|
||||
const op = dom.constructor.onceProps
|
||||
if(op){
|
||||
for (let i = 0, len = op.length; i < len; i++) {
|
||||
let name = op[i]
|
||||
dom.props[name] = oldClone[name]
|
||||
dom[ATTR_KEY][name] = oldClone[name]
|
||||
}
|
||||
}
|
||||
|
||||
if (dom.receiveProps(dom.props, oldClone) !== false) {
|
||||
dom.update()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue