publish: omio v2.8.1, sync update method from omi

This commit is contained in:
dntzhang 2020-04-12 08:54:54 +08:00
parent 149ce5359c
commit c17b05d334
10 changed files with 26 additions and 53 deletions

View File

@ -1,14 +1,16 @@
/**
* omi v2.8.0 https://tencent.github.io/omi/
* omi v2.8.1 https://tencent.github.io/omi/
* Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.
* By dntzhang https://github.com/dntzhang
* Github: https://github.com/Tencent/omi
* MIT Licensed.
*/
(function () {
(function (htm) {
'use strict';
htm = htm && htm.hasOwnProperty('default') ? htm['default'] : htm;
/** Virtual DOM Node */
function VNode() {}
@ -1500,7 +1502,7 @@
this.computed = {};
}
Component.prototype.update = function update(callback) {
Component.prototype.update = function update(ignoreAttrs, updateSelf, callback) {
if (this._willUpdate) return;
this._willUpdate = true;
if (callback) (this._renderCallbacks = this._renderCallbacks || []).push(callback);
@ -2278,8 +2280,6 @@
return props;
}
var n=function(t,r,u,e){for(var p=1;p<r.length;p++){var s=r[p++],a="number"==typeof s?u[s]:s;1===r[p]?e[0]=a:2===r[p]?(e[1]=e[1]||{})[r[++p]]=a:3===r[p]?e[1]=Object.assign(e[1]||{},a):e.push(r[p]?t.apply(null,n(t,a,u,["",null])):a);}return e},t=function(n){for(var t,r,u=1,e="",p="",s=[0],a=function(n){1===u&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(n||e,0):3===u&&(n||e)?(s.push(n||e,1), u=2):2===u&&"..."===e&&n?s.push(n,3):2===u&&e&&!n?s.push(!0,2,e):4===u&&r&&(s.push(n||e,2,r), r=""), e="";},f=0;f<n.length;f++){f&&(1===u&&a(), a(f));for(var h=0;h<n[f].length;h++)t=n[f][h], 1===u?"<"===t?(a(), s=[s], u=3):e+=t:p?t===p?p="":e+=t:'"'===t||"'"===t?p=t:">"===t?(a(), u=1):u&&("="===t?(u=4, r=e, e=""):"/"===t?(a(), 3===u&&(s=s[0]), u=s, (s=s[0]).push(u,4), u=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(), u=2):e+=t);}return a(), s},r="function"==typeof Map,u=r?new Map:{},e=r?function(n){var r=u.get(n);return r||u.set(n,r=t(n)), r}:function(n){for(var r="",e=0;e<n.length;e++)r+=n[e].length+"-"+n[e];return u[r]||(u[r]=t(n))};function htm(t){var r=n(this,e(t),arguments,[]);return r.length>1?r:r[0]}
h.f = Fragment;
var html = htm.bind(h);
@ -2341,5 +2341,5 @@
};
if (typeof module != 'undefined') module.exports = Omi;else self.Omi = Omi;
}());
}(htm));
//# sourceMappingURL=omi.dev.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,14 @@
/**
* omi v2.8.0 https://tencent.github.io/omi/
* omi v2.8.1 https://tencent.github.io/omi/
* Omi === Preact + Scoped CSS + Store System + Native Support in 3kb javascript.
* By dntzhang https://github.com/dntzhang
* Github: https://github.com/Tencent/omi
* MIT Licensed.
*/
import htm from 'htm';
export { default as htm } from 'htm';
/** Virtual DOM Node */
function VNode() {}
@ -1497,7 +1500,7 @@ var Component = function () {
this.computed = {};
}
Component.prototype.update = function update(callback) {
Component.prototype.update = function update(ignoreAttrs, updateSelf, callback) {
if (this._willUpdate) return;
this._willUpdate = true;
if (callback) (this._renderCallbacks = this._renderCallbacks || []).push(callback);
@ -2275,8 +2278,6 @@ function getNodeProps$1(vnode) {
return props;
}
var n=function(t,r,u,e){for(var p=1;p<r.length;p++){var s=r[p++],a="number"==typeof s?u[s]:s;1===r[p]?e[0]=a:2===r[p]?(e[1]=e[1]||{})[r[++p]]=a:3===r[p]?e[1]=Object.assign(e[1]||{},a):e.push(r[p]?t.apply(null,n(t,a,u,["",null])):a);}return e},t=function(n){for(var t,r,u=1,e="",p="",s=[0],a=function(n){1===u&&(n||(e=e.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(n||e,0):3===u&&(n||e)?(s.push(n||e,1), u=2):2===u&&"..."===e&&n?s.push(n,3):2===u&&e&&!n?s.push(!0,2,e):4===u&&r&&(s.push(n||e,2,r), r=""), e="";},f=0;f<n.length;f++){f&&(1===u&&a(), a(f));for(var h=0;h<n[f].length;h++)t=n[f][h], 1===u?"<"===t?(a(), s=[s], u=3):e+=t:p?t===p?p="":e+=t:'"'===t||"'"===t?p=t:">"===t?(a(), u=1):u&&("="===t?(u=4, r=e, e=""):"/"===t?(a(), 3===u&&(s=s[0]), u=s, (s=s[0]).push(u,4), u=0):" "===t||"\t"===t||"\n"===t||"\r"===t?(a(), u=2):e+=t);}return a(), s},r="function"==typeof Map,u=r?new Map:{},e=r?function(n){var r=u.get(n);return r||u.set(n,r=t(n)), r}:function(n){for(var r="",e=0;e<n.length;e++)r+=n[e].length+"-"+n[e];return u[r]||(u[r]=t(n))};function htm(t){var r=n(this,e(t),arguments,[]);return r.length>1?r:r[0]}
h.f = Fragment;
var html = htm.bind(h);
@ -2338,5 +2339,5 @@ var omi = {
};
export default omi;
export { h, h as createElement, cloneElement, createRef, Component, render, rerender, options, WeElement, define, rpx, defineElement, classNames, extractClass, getHost, renderToString, tag, merge, html, htm, obaa };
export { h, h as createElement, cloneElement, createRef, Component, render, rerender, options, WeElement, define, rpx, defineElement, classNames, extractClass, getHost, renderToString, tag, merge, html, obaa };
//# sourceMappingURL=omi.esm.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
!function() {
!function(htm) {
'use strict';
function VNode() {}
function h(nodeName, attributes) {
@ -260,7 +260,7 @@
}
function scoper(css, prefix) {
prefix = '[' + prefix.toLowerCase() + ']';
css = css.replace(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//g, '');
css = css.replace(/\/\*[^*]*\*+([^/][^*]*\*+)*\//g, '');
var re = new RegExp('([^\r\n,{}:]+)(:[^\r\n,{}]+)?(,(?=[^{}]*{)|s*{)', 'g');
css = css.replace(re, function(g0, g1, g2, g3) {
if (void 0 === g2) g2 = '';
@ -1002,7 +1002,7 @@
if (opts && !0 === opts.sortAttributes) attrs.sort();
for (var i = 0; i < attrs.length; i++) {
var name = attrs[i], v = attributes[name];
if ('children' !== name) if (!name.match(/[\s\n\\\/='"\0<>]/)) if (opts && opts.allAttributes || 'key' !== name && 'ref' !== name) {
if ('children' !== name) if (!name.match(/[\s\n\\/='"\0<>]/)) if (opts && opts.allAttributes || 'key' !== name && 'ref' !== name) {
if ('className' === name) {
if (attributes.class) continue;
name = 'class';
@ -1029,7 +1029,7 @@
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;
if (String(nodeName).match(/[\s\n\\/='"\0<>]/)) throw s;
var isVoid = String(nodeName).match(VOID_ELEMENTS);
if (isVoid) s = s.replace(/>$/, ' />');
var pieces = [];
@ -1066,13 +1066,10 @@
if (void 0 !== defaultProps) for (var i in defaultProps) if (void 0 === props[i]) props[i] = defaultProps[i];
return props;
}
function htm(t) {
var r = n(this, e(t), arguments, []);
return r.length > 1 ? r : r[0];
}
function createRef() {
return {};
}
htm = htm && htm.hasOwnProperty('default') ? htm.default : htm;
var options = {
scopedStyle: !0,
mapping: {},
@ -1177,7 +1174,7 @@
this.store = store;
this.computed = {};
}
Component.prototype.update = function(callback) {
Component.prototype.update = function(ignoreAttrs, updateSelf, callback) {
if (!this.A) {
this.A = !0;
if (callback) (this.__h = this.__h || []).push(callback);
@ -1235,31 +1232,6 @@
return String(s).length > (length || 40) || !ignoreLines && -1 !== String(s).indexOf('\n') || -1 !== String(s).indexOf('<');
};
var JS_TO_CSS = {};
var n = function(t, r, u, e) {
for (var p = 1; p < r.length; p++) {
var s = r[p++], a = "number" == typeof s ? u[s] : s;
1 === r[p] ? e[0] = a : 2 === r[p] ? (e[1] = e[1] || {})[r[++p]] = a : 3 === r[p] ? e[1] = Object.assign(e[1] || {}, a) : e.push(r[p] ? t.apply(null, n(t, a, u, [ "", null ])) : a);
}
return e;
}, t = function(n) {
for (var t, r, u = 1, e = "", p = "", s = [ 0 ], a = function(n) {
1 === u && (n || (e = e.replace(/^\s*\n\s*|\s*\n\s*$/g, ""))) ? s.push(n || e, 0) : 3 === u && (n || e) ? (s.push(n || e, 1),
u = 2) : 2 === u && "..." === e && n ? s.push(n, 3) : 2 === u && e && !n ? s.push(!0, 2, e) : 4 === u && r && (s.push(n || e, 2, r),
r = ""), e = "";
}, f = 0; f < n.length; f++) {
f && (1 === u && a(), a(f));
for (var h = 0; h < n[f].length; h++) t = n[f][h], 1 === u ? "<" === t ? (a(), s = [ s ], u = 3) : e += t : p ? t === p ? p = "" : e += t : '"' === t || "'" === t ? p = t : ">" === t ? (a(),
u = 1) : u && ("=" === t ? (u = 4, r = e, e = "") : "/" === t ? (a(), 3 === u && (s = s[0]), u = s, (s = s[0]).push(u, 4),
u = 0) : " " === t || "\t" === t || "\n" === t || "\r" === t ? (a(), u = 2) : e += t);
}
return a(), s;
}, r = "function" == typeof Map, u = r ? new Map() : {}, e = r ? function(n) {
var r = u.get(n);
return r || u.set(n, r = t(n)), r;
} : function(n) {
for (var r = "", e = 0; e < n.length; e++) r += n[e].length + "-" + n[e];
return u[r] || (u[r] = t(n));
};
h.f = Fragment;
var html = htm.bind(h);
var WeElement = Component;
@ -1313,5 +1285,5 @@
obaa: obaa
};
if ('undefined' != typeof module) module.exports = Omi; else self.Omi = Omi;
}();
}(htm);
//# 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": "omio",
"version": "2.8.0",
"version": "2.8.1",
"description": "Omi for old browsers(IE8+).",
"main": "dist/omi.js",
"jsnext:main": "dist/omi.esm.js",

View File

@ -21,7 +21,7 @@ export default class Component {
this.computed = {}
}
update(callback) {
update(ignoreAttrs, updateSelf, callback) {
if(this._willUpdate) return
this._willUpdate = true
if (callback)