reactive-di
Advanced tools
Comparing version 5.0.5 to 5.0.6
@@ -5,2 +5,7 @@ # Change Log | ||
<a name="5.0.6"></a> | ||
## [5.0.6](https://github.com/zerkalica/reactive-di/compare/v5.0.5...v5.0.6) (2017-11-15) | ||
<a name="5.0.5"></a> | ||
@@ -7,0 +12,0 @@ ## [5.0.5](https://github.com/zerkalica/reactive-di/compare/v5.0.4...v5.0.5) (2017-11-06) |
@@ -53,2 +53,4 @@ function _defineProperties(target, props) { | ||
var badClassSymbols = new RegExp('[^\\w\\d]', 'g'); | ||
var SheetManager = | ||
@@ -68,3 +70,6 @@ /*#__PURE__*/ | ||
if (!result) { | ||
var _sheet = this._sheetProcessor.createStyleSheet(css); | ||
var _sheet = this._sheetProcessor.createStyleSheet(css, { | ||
meta: key, | ||
classNamePrefix: key.replace(badClassSymbols, '_').slice(2) + '__' | ||
}); | ||
@@ -92,3 +97,2 @@ _sheet.attach(); | ||
var lastThemeId = 0; | ||
var fakeSheet = {}; | ||
@@ -105,7 +109,4 @@ | ||
var themeId = className + "." + name + "#" + ++lastThemeId; | ||
var atomId = className + "." + name + "()"; | ||
if (getSheet) { | ||
proto[themeId] = getSheet; | ||
proto[name + "#"] = getSheet; | ||
} | ||
@@ -117,6 +118,5 @@ | ||
get: function get() { | ||
this; | ||
var sm = theme.sheetManager; | ||
return sm === undefined ? fakeSheet : sm.sheet(isInstance ? themeId + "[" + this[diKey].instance + "]" : themeId, value || this[themeId](), !!this[atomId]); | ||
var di = this[diKey]; | ||
return sm === undefined ? fakeSheet : sm.sheet(di.displayName + (isInstance ? "[" + di.instance + "]" : ''), value || this[name + "#"](), !!this[name + "()"]); | ||
} | ||
@@ -196,3 +196,3 @@ }; | ||
_proto.toString = function toString() { | ||
return this.displayName; | ||
return this.displayName + (this.instance ? '[' + this.instance + ']' : ''); | ||
}; | ||
@@ -485,3 +485,3 @@ | ||
_this._render = cns.render; | ||
_this._injector = injector.copy(cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''), cns.instance, _this._render.aliases); | ||
_this._injector = injector.copy(cns.displayName, cns.instance, _this._render.aliases); | ||
cns.instance++; | ||
@@ -494,3 +494,3 @@ return _this; | ||
_proto.toString = function toString() { | ||
return this._injector.displayName; | ||
return this._injector.toString(); | ||
}; | ||
@@ -523,2 +523,3 @@ | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this['r()'].destructor(); | ||
this._el = undefined; | ||
@@ -535,4 +536,2 @@ this._keys = undefined; | ||
} | ||
this['r()'].destructor(); | ||
}; | ||
@@ -578,3 +577,3 @@ | ||
return AtomizedComponent; | ||
}(BaseComponent), _class2.isFullEqual = isFullEqual, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
}(BaseComponent), _class2.isFullEqual = isFullEqual, _temp), _applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype), _class); | ||
return function reactWrapper(render) { | ||
@@ -581,0 +580,0 @@ var WrappedComponent = function WrappedComponent(props, context) { |
@@ -57,2 +57,4 @@ 'use strict'; | ||
var badClassSymbols = new RegExp('[^\\w\\d]', 'g'); | ||
var SheetManager = | ||
@@ -72,3 +74,6 @@ /*#__PURE__*/ | ||
if (!result) { | ||
var _sheet = this._sheetProcessor.createStyleSheet(css); | ||
var _sheet = this._sheetProcessor.createStyleSheet(css, { | ||
meta: key, | ||
classNamePrefix: key.replace(badClassSymbols, '_').slice(2) + '__' | ||
}); | ||
@@ -96,3 +101,2 @@ _sheet.attach(); | ||
var lastThemeId = 0; | ||
var fakeSheet = {}; | ||
@@ -109,7 +113,4 @@ | ||
var themeId = className + "." + name + "#" + ++lastThemeId; | ||
var atomId = className + "." + name + "()"; | ||
if (getSheet) { | ||
proto[themeId] = getSheet; | ||
proto[name + "#"] = getSheet; | ||
} | ||
@@ -121,6 +122,5 @@ | ||
get: function get() { | ||
this; | ||
var sm = theme.sheetManager; | ||
return sm === undefined ? fakeSheet : sm.sheet(isInstance ? themeId + "[" + this[diKey].instance + "]" : themeId, value || this[themeId](), !!this[atomId]); | ||
var di = this[diKey]; | ||
return sm === undefined ? fakeSheet : sm.sheet(di.displayName + (isInstance ? "[" + di.instance + "]" : ''), value || this[name + "#"](), !!this[name + "()"]); | ||
} | ||
@@ -200,3 +200,3 @@ }; | ||
_proto.toString = function toString() { | ||
return this.displayName; | ||
return this.displayName + (this.instance ? '[' + this.instance + ']' : ''); | ||
}; | ||
@@ -489,3 +489,3 @@ | ||
_this._render = cns.render; | ||
_this._injector = injector.copy(cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''), cns.instance, _this._render.aliases); | ||
_this._injector = injector.copy(cns.displayName, cns.instance, _this._render.aliases); | ||
cns.instance++; | ||
@@ -498,3 +498,3 @@ return _this; | ||
_proto.toString = function toString() { | ||
return this._injector.displayName; | ||
return this._injector.toString(); | ||
}; | ||
@@ -527,2 +527,3 @@ | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this['r()'].destructor(); | ||
this._el = undefined; | ||
@@ -539,4 +540,2 @@ this._keys = undefined; | ||
} | ||
this['r()'].destructor(); | ||
}; | ||
@@ -582,3 +581,3 @@ | ||
return AtomizedComponent; | ||
}(BaseComponent), _class2.isFullEqual = isFullEqual, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
}(BaseComponent), _class2.isFullEqual = isFullEqual, _temp), _applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype), _class); | ||
return function reactWrapper(render) { | ||
@@ -585,0 +584,0 @@ var WrappedComponent = function WrappedComponent(props, context) { |
@@ -59,2 +59,4 @@ (function (global, factory) { | ||
var badClassSymbols = new RegExp('[^\\w\\d]', 'g'); | ||
var SheetManager = | ||
@@ -74,3 +76,6 @@ /*#__PURE__*/ | ||
if (!result) { | ||
var _sheet = this._sheetProcessor.createStyleSheet(css); | ||
var _sheet = this._sheetProcessor.createStyleSheet(css, { | ||
meta: key, | ||
classNamePrefix: key.replace(badClassSymbols, '_').slice(2) + '__' | ||
}); | ||
@@ -98,3 +103,2 @@ _sheet.attach(); | ||
var lastThemeId = 0; | ||
var fakeSheet = {}; | ||
@@ -111,7 +115,4 @@ | ||
var themeId = className + "." + name + "#" + ++lastThemeId; | ||
var atomId = className + "." + name + "()"; | ||
if (getSheet) { | ||
proto[themeId] = getSheet; | ||
proto[name + "#"] = getSheet; | ||
} | ||
@@ -123,6 +124,5 @@ | ||
get: function get() { | ||
this; | ||
var sm = theme.sheetManager; | ||
return sm === undefined ? fakeSheet : sm.sheet(isInstance ? themeId + "[" + this[diKey].instance + "]" : themeId, value || this[themeId](), !!this[atomId]); | ||
var di = this[diKey]; | ||
return sm === undefined ? fakeSheet : sm.sheet(di.displayName + (isInstance ? "[" + di.instance + "]" : ''), value || this[name + "#"](), !!this[name + "()"]); | ||
} | ||
@@ -202,3 +202,3 @@ }; | ||
_proto.toString = function toString() { | ||
return this.displayName; | ||
return this.displayName + (this.instance ? '[' + this.instance + ']' : ''); | ||
}; | ||
@@ -491,3 +491,3 @@ | ||
_this._render = cns.render; | ||
_this._injector = injector.copy(cns.displayName + (cns.instance ? '[' + cns.instance + ']' : ''), cns.instance, _this._render.aliases); | ||
_this._injector = injector.copy(cns.displayName, cns.instance, _this._render.aliases); | ||
cns.instance++; | ||
@@ -500,3 +500,3 @@ return _this; | ||
_proto.toString = function toString() { | ||
return this._injector.displayName; | ||
return this._injector.toString(); | ||
}; | ||
@@ -529,2 +529,3 @@ | ||
_proto.componentWillUnmount = function componentWillUnmount() { | ||
this['r()'].destructor(); | ||
this._el = undefined; | ||
@@ -541,4 +542,2 @@ this._keys = undefined; | ||
} | ||
this['r()'].destructor(); | ||
}; | ||
@@ -584,3 +583,3 @@ | ||
return AtomizedComponent; | ||
}(BaseComponent), _class2.isFullEqual = isFullEqual, _temp), (_applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype)), _class); | ||
}(BaseComponent), _class2.isFullEqual = isFullEqual, _temp), _applyDecoratedDescriptor(_class.prototype, "r", [detached], Object.getOwnPropertyDescriptor(_class.prototype, "r"), _class.prototype), _class); | ||
return function reactWrapper(render) { | ||
@@ -587,0 +586,0 @@ var WrappedComponent = function WrappedComponent(props, context) { |
{ | ||
"name": "reactive-di", | ||
"version": "5.0.5", | ||
"version": "5.0.6", | ||
"description": "Reactive dependency injection", | ||
@@ -56,12 +56,12 @@ "publishConfig": { | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0-beta.31", | ||
"@babel/plugin-external-helpers": "^7.0.0-beta.31", | ||
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.31", | ||
"@babel/plugin-proposal-decorators": "^7.0.0-beta.31", | ||
"@babel/plugin-transform-flow-strip-types": "^7.0.0-beta.31", | ||
"@babel/preset-es2015": "^7.0.0-beta.31", | ||
"@babel/register": "^7.0.0-beta.31", | ||
"@babel/core": "^7.0.0-beta.32", | ||
"@babel/plugin-external-helpers": "^7.0.0-beta.32", | ||
"@babel/plugin-proposal-class-properties": "^7.0.0-beta.32", | ||
"@babel/plugin-proposal-decorators": "^7.0.0-beta.32", | ||
"@babel/plugin-transform-flow-strip-types": "^7.0.0-beta.32", | ||
"@babel/preset-es2015": "^7.0.0-beta.32", | ||
"@babel/register": "^7.0.0-beta.32", | ||
"chokidar-cli": "^1.2.0", | ||
"flow-bin": "^0.58.0", | ||
"lom_atom": "^2.0.9", | ||
"flow-bin": "^0.59.0", | ||
"lom_atom": "^2.0.10", | ||
"mobx": "^3.3.1", | ||
@@ -72,3 +72,3 @@ "mocha": "^4.0.1", | ||
"rimraf": "^2.6.2", | ||
"rollup": "^0.48.2", | ||
"rollup": "^0.51.5", | ||
"rollup-plugin-babel": "^4.0.0-beta.0", | ||
@@ -78,4 +78,4 @@ "rollup-plugin-node-resolve": "^3.0.0", | ||
"standard-version": "^4.2.0", | ||
"uglify-es": "^3.1.6" | ||
"uglify-es": "^3.1.9" | ||
} | ||
} |
@@ -94,3 +94,4 @@ // @flow | ||
di ? `${di.displayName}.${name}` : name, | ||
this, name + '$', | ||
this, | ||
name + '$', | ||
reactions | ||
@@ -97,0 +98,0 @@ ) |
@@ -44,3 +44,3 @@ // @flow | ||
this._injector = injector.copy( | ||
cns.displayName + (cns.instance ? ('[' + cns.instance + ']') : ''), | ||
cns.displayName, | ||
cns.instance, | ||
@@ -53,3 +53,3 @@ this._render.aliases | ||
toString() { | ||
return this._injector.displayName | ||
return this._injector.toString() | ||
} | ||
@@ -81,2 +81,3 @@ | ||
componentWillUnmount() { | ||
this['r()'].destructor() | ||
this._el = undefined | ||
@@ -90,3 +91,2 @@ this._keys = undefined | ||
} | ||
this['r()'].destructor() | ||
} | ||
@@ -93,0 +93,0 @@ |
@@ -76,3 +76,3 @@ // @flow | ||
toString() { | ||
return this.displayName | ||
return this.displayName + (this.instance ? ('[' + this.instance + ']') : '') | ||
} | ||
@@ -79,0 +79,0 @@ |
@@ -28,3 +28,3 @@ // @flow | ||
} | ||
const badClassSymbols = new RegExp('[^\\w\\d]', 'g') | ||
export default class SheetManager implements IRemover, ISheetManager { | ||
@@ -41,5 +41,8 @@ _sheetProcessor: IProcessor | ||
if (!result) { | ||
const sheet: ISheet<V> = this._sheetProcessor.createStyleSheet(css) | ||
const sheet: ISheet<V> = this._sheetProcessor.createStyleSheet(css, { | ||
meta: key, | ||
classNamePrefix: key.replace(badClassSymbols, '_').slice(2) + '__' | ||
}) | ||
sheet.attach() | ||
result = (new DisposableSheet(key, sheet, this)) | ||
result = new DisposableSheet(key, sheet, this) | ||
if (!memoized) { | ||
@@ -46,0 +49,0 @@ this._cache.set(key, result) |
@@ -10,2 +10,7 @@ // @flow | ||
interface Injector { | ||
instance: number; | ||
displayName: string; | ||
} | ||
function themeProp<V: Object>( | ||
@@ -24,6 +29,4 @@ proto: Object, | ||
const themeId = `${className}.${name}#${++lastThemeId}` | ||
const atomId = `${className}.${name}()` | ||
if (getSheet) { | ||
proto[themeId] = getSheet | ||
proto[`${name}#`] = getSheet | ||
} | ||
@@ -35,16 +38,10 @@ | ||
get(): IDisposableSheet<V> { | ||
;(this: { | ||
[k: typeof diKey]: { | ||
instance: number; | ||
} | ||
}) | ||
const sm: ISheetManager | void = theme.sheetManager | ||
const di: Injector = this[diKey] | ||
return sm === undefined | ||
? fakeSheet | ||
: sm.sheet( | ||
isInstance | ||
? `${themeId}[${this[diKey].instance}]` | ||
: themeId, | ||
value || this[themeId](), | ||
!!this[atomId] | ||
di.displayName + (isInstance ? `[${di.instance}]` : ''), | ||
value || this[`${name}#`](), | ||
!!this[`${name}()`] | ||
) | ||
@@ -51,0 +48,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
307910
2708