@expressive/mvc 1.0.0-beta.3 → 1.0.0-beta.30

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 CHANGED
@@ -14,6 +14,7 @@
14
14
  <p align="center">
15
15
  <a href="https://www.npmjs.com/package/@expressive/mvc"><img alt="NPM" src="https://badge.fury.io/js/%40expressive%2Fmvc.svg"></a>
16
16
  <a href=""><img alt="Build" src="https://shields-staging.herokuapp.com/npm/types/@expressive/mvc.svg"></a>
17
+ <img src="https://img.shields.io/badge/Coverage-100%25-brightgreen.svg">
17
18
  </p>
18
19
 
19
20
  <p align="center">
@@ -23,9 +24,18 @@
23
24
  </p>
24
25
 
25
26
  <br/>
26
- <h1 id="overview-section"></h1>
27
+ <p align="center">
28
+ <b>Have suggestions, need help or just want to discuss?</b><br/><br/>
29
+ <a href="https://join.slack.com/t/expressivejs/shared_invite/zt-s2j5cdhz-gffKn3bTATMbXf~iq4pvHg" alt="Join Slack">
30
+ <img src="https://img.shields.io/badge/Slack-Come%20say%20hi!-blueviolet" />
31
+ </a>
32
+ </p>
33
+
34
+ <br/>
35
+ <h1 id="overview-section">Overview</h1>
36
+
37
+ Classes which extend `Model` can manage behavior for components. Custom models are easy to define, use and even provide. While hooks are great, state and logic are not a part of well-formed JSX. Models help wrap that stuff in robust, portable controllers instead.
27
38
 
28
- Classes which extend `Model` can manage state and logic for components. Custom models are easy to define, use and even provide. Hooks are great, but state and logic are not a part of well-formed components. Models help wrap that stuff in robust, portable controllers instead.
29
39
 
30
40
  <br/>
31
41
 
@@ -87,7 +97,7 @@ const MyComponent = () => {
87
97
  <br/>
88
98
 
89
99
  ### Refresh using simple assignment
90
- Reserved `set` loops back to instance, to update from inside a component.
100
+ Reserved `set` loops back to the instance, to update from inside a component.
91
101
 
92
102
  ```jsx
93
103
  class Hello extends Model {
@@ -199,7 +209,7 @@ const MyComponent = () => {
199
209
  <br/>
200
210
 
201
211
  ### Extend to configure
202
- Custom models may be extended to set needed properties.
212
+ Use class extension to set needed properties.
203
213
  Reusable logic is easy to implement, document and share.
204
214
 
205
215
  ```ts
@@ -496,10 +506,10 @@ class Timer extends Model {
496
506
 
497
507
  A getter's value is cached, facing the user. It will only run when a dependency changes, and **not upon access** as you might expect. However, getters are also lazy, so first access is one exception.
498
508
 
499
- Because getters run whenever a controller thinks they *could* change, make sure to design them along these principles:
509
+ Getters run whenever a controller thinks they *could* change. Make sure to design them along these lines:
500
510
  - Getters should be deterministic. Only expect a change where inputs have changed.
501
511
  - Avoid computing from values which change a lot, but don't change output as often.
502
- - [Goes without saying](https://www.youtube.com/watch?v=0i0IlSKn0sE "Goes Without Saying") but, **side-effects are an anti-pattern** and can cause infinite loops.
512
+ - [Goes without saying](https://www.youtube.com/watch?v=0i0IlSKn0sE "Goes Without Saying") but, **side-effects are an anti-pattern** and may cause infinite loops.
503
513
 
504
514
  <br/>
505
515
 
@@ -535,7 +545,7 @@ const SayHello = ({ fullName }) => {
535
545
 
536
546
  <h2 id="concept-passing-props">Assigning props to state</h2>
537
547
 
538
- Besides `use`, similar methods will assign values after a controller is created. This is a great alternative to a manual setup, as done previously.
548
+ Besides `use`, similar methods will assign values after a controller is created. Good alternative to a manual setup.
539
549
 
540
550
  <h4 id="method-uses"><code>Model.uses(source, keys?)</code></h4>
541
551
 
@@ -797,8 +807,6 @@ Sometimes, we want to react to changes coming from outside, usually via props. O
797
807
 
798
808
  This method helps watch an object by running [`assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) on it *every render*. Because controllers only react to new values, this makes for a simple way to watch externals. Combine this with getters and event-listeners, to do things when inputs change.
799
809
 
800
- <br />
801
-
802
810
  ```ts
803
811
  class ActivityTracker extends Model {
804
812
  active = undefined;
@@ -843,8 +851,6 @@ const Activate = () => {
843
851
 
844
852
  <sup><a href="https://codesandbox.io/s/example-using-method-wvrtu">View in CodeSandbox</a></sup>
845
853
 
846
- With this, we can interact with all different sorts of state!
847
-
848
854
  > **Note:** Method is also picky (ala `uses`), and will ignore values which don't already exist in state.
849
855
 
850
856
  <br />
@@ -1323,7 +1329,7 @@ class Greet extends Model {
1323
1329
  }
1324
1330
  }
1325
1331
  ```
1326
- Create a controller which taps another one. Make sure it's wrapped by proper `Provider`, and controller will fetch that instance from context.
1332
+ Create a controller which taps another one. Make sure it's wrapped by proper `Provider`, and the controller will fetch that instance from context.
1327
1333
  ```js
1328
1334
  import { Provider } from "@expressive/mvc";
1329
1335
 
@@ -1412,8 +1418,8 @@ class FooBar extends Model {
1412
1418
  return this.foo.value + this.bar.value;
1413
1419
  }
1414
1420
 
1415
- plusFoo = () => this.bar.value = this.value;
1416
- plusBar = () => this.foo.value = this.value;
1421
+ addFoo = () => this.bar.value = this.value;
1422
+ addBar = () => this.foo.value = this.value;
1417
1423
  }
1418
1424
  ```
1419
1425
 
@@ -1421,17 +1427,17 @@ class FooBar extends Model {
1421
1427
 
1422
1428
  ```js
1423
1429
  const FibonacciApp = () => {
1424
- const { foo, bar, value, plusFoo, plusBar } = FooBar.use();
1430
+ const { foo, bar, value, addFoo, addBar } = FooBar.use();
1425
1431
 
1426
1432
  return (
1427
1433
  <div>
1428
1434
  <div>
1429
1435
  Foo + Bar = {value}
1430
1436
  </div>
1431
- <div onClick={plusBar}>
1437
+ <div onClick={addBar}>
1432
1438
  Foo's value is ${foo.value}, click to add in bar!
1433
1439
  </div>
1434
- <div onClick={plusFoo}>
1440
+ <div onClick={addFoo}>
1435
1441
  Bar's value is ${bar.value}, click to add in foo!
1436
1442
  </div>
1437
1443
  </div>