Comparing version 2.7.1 to 2.8.0
@@ -8,3 +8,3 @@ 'use strict'; | ||
}); | ||
exports.LinkingMiddleware = exports.Electrum = undefined; | ||
exports.States = exports.LinkingMiddleware = exports.Electrum = undefined; | ||
@@ -23,2 +23,6 @@ var _radium = require('radium'); | ||
var _states = require('./states.js'); | ||
var _states2 = _interopRequireDefault(_states); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -49,2 +53,3 @@ | ||
exports.Electrum = _electrum2.default; | ||
exports.LinkingMiddleware = _linkingMiddleware2.default; | ||
exports.LinkingMiddleware = _linkingMiddleware2.default; | ||
exports.States = _states2.default; |
{ | ||
"name": "electrum", | ||
"version": "2.7.1", | ||
"version": "2.8.0", | ||
"description": "Electrum simplifies framework-agnostic declaration of React components.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -229,1 +229,29 @@ # Electrum | ||
means that the component should be rendered. | ||
# States and fingerprints | ||
Components may need to represent their internal state as a collection of simple | ||
state objects: | ||
```javascript | ||
const fieldSelection = { from: 12, to: 17 }; // 'from,to' | ||
const listSelection = { first: 5, active: 8 }; // 'active,first' | ||
``` | ||
These state objects have _fingerprints_ which are based on their sorted | ||
property names (`'from,to'`, `'active,first'`). It does not include the | ||
optional `id` property. | ||
## States class | ||
The `States` class provides following `static` methods: | ||
* `fingerprint (state)` → fingerprint of a state object. | ||
* `findState (array, fingerprint)` → finds the first state which | ||
matches the specified fingerprint. | ||
* `replaceState (array, state)` → updates the array of states by adding | ||
or replacing a state; matching is done based on the state's fingerprint. | ||
* `replaceStates (array, state1, state2, ...)` → updates the array of | ||
states based on multiple states. | ||
* `replaceStates (array, [state1, state2, ...])` → updates the array of | ||
states based on multiple states. |
@@ -7,2 +7,3 @@ 'use strict'; | ||
import Electrum from './electrum.js'; | ||
import States from './states.js'; | ||
@@ -20,2 +21,2 @@ /******************************************************************************/ | ||
export default new Electrum (RadiumConnector); | ||
export {Electrum, LinkingMiddleware}; | ||
export {Electrum, LinkingMiddleware, States}; |
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
135757
67
2568
257