cellery 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cells.js +12 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Rendering is handled by `Adapters`. Currently these are simply called by `Celler
|
|
|
50
50
|
We're trying to keep Cells simple. A super basic set of low level components to see how much can be achieved with little.
|
|
51
51
|
|
|
52
52
|
| Cell | Description |
|
|
53
|
-
|
|
53
|
+
| ----------- | ---------------------------------------- |
|
|
54
54
|
| `Cell` | Base class for all components |
|
|
55
55
|
| `MultiCell` | Composes multiple cells into one render |
|
|
56
56
|
| `Container` | Layout wrapper with scroll and flex opts |
|
package/lib/cells.js
CHANGED
|
@@ -15,11 +15,21 @@ class Cell {
|
|
|
15
15
|
this.cellery.sub(pattern).on('data', (d) => cb(this, d))
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
_render() {
|
|
19
|
+
// impl
|
|
20
|
+
return this
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
render(opts = {}) {
|
|
24
|
+
const cell = this._render()
|
|
25
|
+
if (!cell.cellery) {
|
|
26
|
+
cell.register(this.cellery)
|
|
27
|
+
}
|
|
28
|
+
|
|
19
29
|
this.cellery.pub({
|
|
20
30
|
event: 'render',
|
|
21
|
-
id:
|
|
22
|
-
content: this.cellery.adapter.render(
|
|
31
|
+
id: cell.id,
|
|
32
|
+
content: this.cellery.adapter.render(cell),
|
|
23
33
|
...opts
|
|
24
34
|
})
|
|
25
35
|
}
|
|
@@ -40,27 +50,6 @@ class Cell {
|
|
|
40
50
|
}
|
|
41
51
|
}
|
|
42
52
|
|
|
43
|
-
class MultiCell {
|
|
44
|
-
constructor(opts = {}) {
|
|
45
|
-
this.id = opts.id
|
|
46
|
-
this.cellery = opts.cellery
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
sub(pattern, cb) {
|
|
50
|
-
this.cellery.sub(pattern).on('data', (d) => cb(this, d))
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
_render() {
|
|
54
|
-
// impl
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
render(opts = {}) {
|
|
58
|
-
const cell = this._render()
|
|
59
|
-
cell.register(this.cellery)
|
|
60
|
-
cell.render(opts)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
53
|
class Container extends Cell {
|
|
65
54
|
// TODO: replace with classes
|
|
66
55
|
static ScrollAll = 'all'
|
|
@@ -107,7 +96,6 @@ class Input extends Cell {
|
|
|
107
96
|
|
|
108
97
|
module.exports = {
|
|
109
98
|
Cell,
|
|
110
|
-
MultiCell,
|
|
111
99
|
Container,
|
|
112
100
|
App,
|
|
113
101
|
Text,
|