feat: support options.css
This commit is contained in:
parent
4ffe77ab8a
commit
732813a1c3
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omis v2.0.4 http://omijs.org
|
||||
* omis v2.0.5 http://omijs.org
|
||||
* Observable store system for JavaScript apps.
|
||||
* By dntzhang https://github.com/dntzhang
|
||||
* Github: https://github.com/Tencent/omi
|
||||
|
@ -302,6 +302,8 @@
|
|||
var currentComponent = null;
|
||||
|
||||
function $(options) {
|
||||
var _class, _temp;
|
||||
|
||||
if (options.store) {
|
||||
$.store = options.store;
|
||||
obaa($.store.data, function (prop, val, old, path) {
|
||||
|
@ -329,11 +331,11 @@
|
|||
var updatePath = options.use && getPath(options.use);
|
||||
var updateSelfPath = options.useSelf && getPath(options.useSelf);
|
||||
|
||||
return function (_React$Component) {
|
||||
_inherits(_class2, _React$Component);
|
||||
return _temp = _class = function (_React$Component) {
|
||||
_inherits(_class, _React$Component);
|
||||
|
||||
function _class2(props) {
|
||||
_classCallCheck(this, _class2);
|
||||
function _class(props) {
|
||||
_classCallCheck(this, _class);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
||||
|
||||
|
@ -352,12 +354,12 @@
|
|||
return _this;
|
||||
}
|
||||
|
||||
_class2.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
|
||||
_class.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
|
||||
if (currentComponent === this) return true;
|
||||
return !isSelf;
|
||||
};
|
||||
|
||||
_class2.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||
_class.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||
for (var i = 0, len = components.length; i < len; i++) {
|
||||
if (components[i] === this) {
|
||||
components.splice(i, 1);
|
||||
|
@ -373,12 +375,12 @@
|
|||
}
|
||||
};
|
||||
|
||||
_class2.prototype.render = function render() {
|
||||
_class.prototype.render = function render() {
|
||||
return options.render.apply(this, arguments);
|
||||
};
|
||||
|
||||
return _class2;
|
||||
}(React.Component);
|
||||
return _class;
|
||||
}(React.Component), _class.css = options.css, _temp;
|
||||
}
|
||||
|
||||
var Omis = { $: $ };
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* omis v2.0.4 http://omijs.org
|
||||
* omis v2.0.5 http://omijs.org
|
||||
* Observable store system for JavaScript apps.
|
||||
* By dntzhang https://github.com/dntzhang
|
||||
* Github: https://github.com/Tencent/omi
|
||||
|
@ -301,6 +301,8 @@ var isSelf = false;
|
|||
var currentComponent = null;
|
||||
|
||||
function $(options) {
|
||||
var _class, _temp;
|
||||
|
||||
if (options.store) {
|
||||
$.store = options.store;
|
||||
obaa($.store.data, function (prop, val, old, path) {
|
||||
|
@ -328,11 +330,11 @@ function $(options) {
|
|||
var updatePath = options.use && getPath(options.use);
|
||||
var updateSelfPath = options.useSelf && getPath(options.useSelf);
|
||||
|
||||
return function (_React$Component) {
|
||||
_inherits(_class2, _React$Component);
|
||||
return _temp = _class = function (_React$Component) {
|
||||
_inherits(_class, _React$Component);
|
||||
|
||||
function _class2(props) {
|
||||
_classCallCheck(this, _class2);
|
||||
function _class(props) {
|
||||
_classCallCheck(this, _class);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
||||
|
||||
|
@ -351,12 +353,12 @@ function $(options) {
|
|||
return _this;
|
||||
}
|
||||
|
||||
_class2.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
|
||||
_class.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
|
||||
if (currentComponent === this) return true;
|
||||
return !isSelf;
|
||||
};
|
||||
|
||||
_class2.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||
_class.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||
for (var i = 0, len = components.length; i < len; i++) {
|
||||
if (components[i] === this) {
|
||||
components.splice(i, 1);
|
||||
|
@ -372,12 +374,12 @@ function $(options) {
|
|||
}
|
||||
};
|
||||
|
||||
_class2.prototype.render = function render() {
|
||||
_class.prototype.render = function render() {
|
||||
return options.render.apply(this, arguments);
|
||||
};
|
||||
|
||||
return _class2;
|
||||
}(Component);
|
||||
return _class;
|
||||
}(Component), _class.css = options.css, _temp;
|
||||
}
|
||||
|
||||
var omis = { $: $ };
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -178,6 +178,7 @@
|
|||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
}
|
||||
function $(options) {
|
||||
var _class, _temp;
|
||||
if (options.store) {
|
||||
$.store = options.store;
|
||||
obaa($.store.data, function(prop, val, old, path) {
|
||||
|
@ -204,9 +205,9 @@
|
|||
}
|
||||
var updatePath = options.use && getPath(options.use);
|
||||
var updateSelfPath = options.useSelf && getPath(options.useSelf);
|
||||
return function(_React$Component) {
|
||||
function _class2(props) {
|
||||
_classCallCheck(this, _class2);
|
||||
return _temp = _class = function(_React$Component) {
|
||||
function _class(props) {
|
||||
_classCallCheck(this, _class);
|
||||
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
|
||||
_this.state = {
|
||||
X: 0
|
||||
|
@ -221,11 +222,11 @@
|
|||
}
|
||||
return _this;
|
||||
}
|
||||
_inherits(_class2, _React$Component);
|
||||
_class2.prototype.shouldComponentUpdate = function() {
|
||||
_inherits(_class, _React$Component);
|
||||
_class.prototype.shouldComponentUpdate = function() {
|
||||
if (currentComponent === this) return !0; else return !isSelf;
|
||||
};
|
||||
_class2.prototype.componentWillUnmount = function() {
|
||||
_class.prototype.componentWillUnmount = function() {
|
||||
for (var i = 0, len = components.length; i < len; i++) if (components[i] === this) {
|
||||
components.splice(i, 1);
|
||||
break;
|
||||
|
@ -235,11 +236,11 @@
|
|||
break;
|
||||
}
|
||||
};
|
||||
_class2.prototype.render = function() {
|
||||
_class.prototype.render = function() {
|
||||
return options.render.apply(this, arguments);
|
||||
};
|
||||
return _class2;
|
||||
}(React.Component);
|
||||
return _class;
|
||||
}(React.Component), _class.css = options.css, _temp;
|
||||
}
|
||||
var triggerStr = [ 'concat', 'copyWithin', 'fill', 'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'size' ].join(',');
|
||||
var 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' ];
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +1,2 @@
|
|||
!function(t){"use strict";function e(t,e,o){var i=[];f(t)&&(0===t.length&&(t.S={T:t,U:"#"}),r(t,t));for(var c in t)t.hasOwnProperty(c)&&(o?f(e)&&a(e,c)?(i.push(c),n(t,c,null,t)):u(e)&&c===e&&(i.push(c),n(t,c,null,t)):(i.push(c),n(t,c,null,t)));t.V||(t.V=[]),t.V.push({all:!o,propChanged:o||e,eventPropArr:i})}function r(t,e){m.forEach(function(r){t[r]=function(){var t=Array.prototype.slice.call(this,0),c=Array.prototype[r].apply(this,Array.prototype.slice.call(arguments));if(RegExp("\\b"+r+"\\b").test(E)){for(var f in this)this.hasOwnProperty(f)&&!i(this[f])&&n(this,f,this.S.U,e);o("Array-"+r,this,t,this,this.S.U,e)}return c},t["pure"+r.substring(0,1).toUpperCase()+r.substring(1)]=function(){return Array.prototype[r].apply(this,Array.prototype.slice.call(arguments))}})}function n(t,e,o,c){if("__o_"!==e&&!i(t[e])){t.S||(t.S={T:c}),t.S.U=void 0!==o&&null!==o?o:"#";var u=t.S[e]=t[e];if("object"==typeof u){f(u)&&(r(u,c),0===u.length&&(u.S||(u.S={}),u.S.U=void 0!==o&&null!==o?o+"-"+e:"#-"+e));for(var a in u)u.hasOwnProperty(a)&&n(u,a,t.S.U+"-"+e,c)}}}function o(t,e,r,o,i,f){if(e!==r&&(!c(e)||!c(r))&&f.V)for(var u=s(t,i),p=0,l=f.V.length;p<l;p++){var h=f.V[p];(h.all||a(h.eventPropArr,u)||0===u.indexOf("Array-"))&&h.propChanged.call(o,t,e,r,i)}0!==t.indexOf("Array-")&&"object"==typeof e&&n(o,t,o.S.U,f)}function i(t){return"[object Function]"===Object.prototype.toString.call(t)}function c(t){return"number"==typeof t&&isNaN(t)}function f(t){return"[object Array]"===Object.prototype.toString.call(t)}function u(t){return"string"==typeof t}function a(t,e){for(var r=t.length;--r>-1;)if(e===t[r])return!0;return!1}function s(t,e){return"#"===e?t:e.split("-")[1]}function p(t){if("[object Array]"===Object.prototype.toString.call(t)){var e={};return t.forEach(function(t){if("string"==typeof t)e[t]=!0;else{var r=t[Object.keys(t)[0]];"string"==typeof r?e[r]=!0:"string"==typeof r[0]?e[r[0]]=!0:r[0].forEach(function(t){return e[t]=!0})}}),e}return l(t)}function l(t){var e={};return h(t,e),e}function h(t,e){Object.keys(t).forEach(function(r){e[r]=!0;var n=Object.prototype.toString.call(t[r]);"[object Object]"===n?y(t[r],r,e):"[object Array]"===n&&b(t[r],r,e)})}function y(t,e,r){Object.keys(t).forEach(function(n){r[e+"."+n]=!0,delete r[e];var o=Object.prototype.toString.call(t[n]);"[object Object]"===o?y(t[n],e+"."+n,r):"[object Array]"===o&&b(t[n],e+"."+n,r)})}function b(t,e,r){t.forEach(function(t,n){r[e+"["+n+"]"]=!0,delete r[e];var o=Object.prototype.toString.call(t);"[object Object]"===o?y(t,e+"["+n+"]",r):"[object Array]"===o&&b(t,e+"["+n+"]",r)})}function v(t,e){for(var r in t){if(e[r])return!0;for(var n in e)if(d(r,n))return!0}return!1}function d(t,e){if(0===t.indexOf(e)){var r=t.substr(e.length,1);if("["===r||"."===r)return!0}return!1}function S(t){var e="";return t.replace("#-","").split("-").forEach(function(t,r){r?isNaN(+t)?e+="."+t:e+="["+t+"]":e+=t}),e}function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function O(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function A(r){r.store&&(A.store=r.store,e(A.store.data,function(t,e,r,n){var o={};o[S(n+"-"+t)]=!0,U.forEach(function(t){t.W&&v(o,t.W)&&(t.setState({X:t.state.X++}),x=!1)}),w.forEach(function(t){t.Y&&v(o,t.Y)&&(t.setState({X:t.state.X++}),x=!0,P=t)})}));var n=r.use&&p(r.use),o=r.useSelf&&p(r.useSelf);return function(t){function e(r){j(this,e);var i=g(this,t.call(this,r));return i.state={X:0},n&&(U.push(i),i.W=n),o&&(w.push(i),i.Y=o),i}return O(e,t),e.prototype.shouldComponentUpdate=function(){return P===this||!x},e.prototype.componentWillUnmount=function(){for(var t=0,e=U.length;t<e;t++)if(U[t]===this){U.splice(t,1);break}for(var r=0,n=w.length;r<n;r++)if(w[r]===this){w.splice(r,1);break}},e.prototype.render=function(){return r.render.apply(this,arguments)},e}(t.Component)}var E="concat,copyWithin,fill,pop,push,reverse,shift,sort,splice,unshift,size",m=["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"];e.add=function(t,e){n(t,e,t.S.U,t.S.T)},e.set=function(t,e,r){n(t,e,t.S.U,t.S.T),t[e]=r},Array.prototype.size=function(t){this.length=t};var U=[],w=[],x=!1,P=null,_={$:A};"undefined"!=typeof module?module.exports=_:self.Omis=_}(React);
|
||||
!function(t){"use strict";function e(t,e,o){var i=[];f(t)&&(0===t.length&&(t.S={T:t,U:"#"}),r(t,t));for(var c in t)t.hasOwnProperty(c)&&(o?f(e)&&s(e,c)?(i.push(c),n(t,c,null,t)):u(e)&&c===e&&(i.push(c),n(t,c,null,t)):(i.push(c),n(t,c,null,t)));t.V||(t.V=[]),t.V.push({all:!o,propChanged:o||e,eventPropArr:i})}function r(t,e){m.forEach(function(r){t[r]=function(){var t=Array.prototype.slice.call(this,0),c=Array.prototype[r].apply(this,Array.prototype.slice.call(arguments));if(RegExp("\\b"+r+"\\b").test(E)){for(var f in this)this.hasOwnProperty(f)&&!i(this[f])&&n(this,f,this.S.U,e);o("Array-"+r,this,t,this,this.S.U,e)}return c},t["pure"+r.substring(0,1).toUpperCase()+r.substring(1)]=function(){return Array.prototype[r].apply(this,Array.prototype.slice.call(arguments))}})}function n(t,e,o,c){if("__o_"!==e&&!i(t[e])){t.S||(t.S={T:c}),t.S.U=void 0!==o&&null!==o?o:"#";var u=t.S[e]=t[e];if("object"==typeof u){f(u)&&(r(u,c),0===u.length&&(u.S||(u.S={}),u.S.U=void 0!==o&&null!==o?o+"-"+e:"#-"+e));for(var s in u)u.hasOwnProperty(s)&&n(u,s,t.S.U+"-"+e,c)}}}function o(t,e,r,o,i,f){if(e!==r&&(!c(e)||!c(r))&&f.V)for(var u=a(t,i),p=0,l=f.V.length;p<l;p++){var h=f.V[p];(h.all||s(h.eventPropArr,u)||0===u.indexOf("Array-"))&&h.propChanged.call(o,t,e,r,i)}0!==t.indexOf("Array-")&&"object"==typeof e&&n(o,t,o.S.U,f)}function i(t){return"[object Function]"===Object.prototype.toString.call(t)}function c(t){return"number"==typeof t&&isNaN(t)}function f(t){return"[object Array]"===Object.prototype.toString.call(t)}function u(t){return"string"==typeof t}function s(t,e){for(var r=t.length;--r>-1;)if(e===t[r])return!0;return!1}function a(t,e){return"#"===e?t:e.split("-")[1]}function p(t){if("[object Array]"===Object.prototype.toString.call(t)){var e={};return t.forEach(function(t){if("string"==typeof t)e[t]=!0;else{var r=t[Object.keys(t)[0]];"string"==typeof r?e[r]=!0:"string"==typeof r[0]?e[r[0]]=!0:r[0].forEach(function(t){return e[t]=!0})}}),e}return l(t)}function l(t){var e={};return h(t,e),e}function h(t,e){Object.keys(t).forEach(function(r){e[r]=!0;var n=Object.prototype.toString.call(t[r]);"[object Object]"===n?y(t[r],r,e):"[object Array]"===n&&b(t[r],r,e)})}function y(t,e,r){Object.keys(t).forEach(function(n){r[e+"."+n]=!0,delete r[e];var o=Object.prototype.toString.call(t[n]);"[object Object]"===o?y(t[n],e+"."+n,r):"[object Array]"===o&&b(t[n],e+"."+n,r)})}function b(t,e,r){t.forEach(function(t,n){r[e+"["+n+"]"]=!0,delete r[e];var o=Object.prototype.toString.call(t);"[object Object]"===o?y(t,e+"["+n+"]",r):"[object Array]"===o&&b(t,e+"["+n+"]",r)})}function v(t,e){for(var r in t){if(e[r])return!0;for(var n in e)if(d(r,n))return!0}return!1}function d(t,e){if(0===t.indexOf(e)){var r=t.substr(e.length,1);if("["===r||"."===r)return!0}return!1}function S(t){var e="";return t.replace("#-","").split("-").forEach(function(t,r){r?isNaN(+t)?e+="."+t:e+="["+t+"]":e+=t}),e}function j(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function O(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function A(r){var n,o;r.store&&(A.store=r.store,e(A.store.data,function(t,e,r,n){var o={};o[S(n+"-"+t)]=!0,U.forEach(function(t){t.W&&v(o,t.W)&&(t.setState({X:t.state.X++}),x=!1)}),w.forEach(function(t){t.Y&&v(o,t.Y)&&(t.setState({X:t.state.X++}),x=!0,P=t)})}));var i=r.use&&p(r.use),c=r.useSelf&&p(r.useSelf);return o=n=function(t){function e(r){j(this,e);var n=g(this,t.call(this,r));return n.state={X:0},i&&(U.push(n),n.W=i),c&&(w.push(n),n.Y=c),n}return O(e,t),e.prototype.shouldComponentUpdate=function(){return P===this||!x},e.prototype.componentWillUnmount=function(){for(var t=0,e=U.length;t<e;t++)if(U[t]===this){U.splice(t,1);break}for(var r=0,n=w.length;r<n;r++)if(w[r]===this){w.splice(r,1);break}},e.prototype.render=function(){return r.render.apply(this,arguments)},e}(t.Component),n.css=r.css,o}var E="concat,copyWithin,fill,pop,push,reverse,shift,sort,splice,unshift,size",m=["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"];e.add=function(t,e){n(t,e,t.S.U,t.S.T)},e.set=function(t,e,r){n(t,e,t.S.U,t.S.T),t[e]=r},Array.prototype.size=function(t){this.length=t};var U=[],w=[],x=!1,P=null,_={$:A};"undefined"!=typeof module?module.exports=_:self.Omis=_}(React);
|
||||
//# sourceMappingURL=omis.min.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "omis",
|
||||
"version": "2.0.4",
|
||||
"version": "2.0.5",
|
||||
"description": "Observable store system for React apps.",
|
||||
"main": "dist/omis.js",
|
||||
"jsnext:main": "dist/omis.esm.js",
|
||||
|
|
|
@ -47,6 +47,8 @@ export function $(options) {
|
|||
__$id_: 0
|
||||
}
|
||||
|
||||
static css = options.css
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
if (updatePath) {
|
||||
|
|
Loading…
Reference in New Issue