@b9g/crank 0.5.0-beta.7 → 0.5.0
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 +6 -17
- package/crank.cjs +0 -4
- package/crank.cjs.map +1 -1
- package/crank.js +0 -4
- package/crank.js.map +1 -1
- package/package.json +1 -1
- package/standalone.d.ts +1 -1
- package/umd.js +0 -4
- package/umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
# Crank.js
|
|
2
|
-
### The
|
|
2
|
+
### The Just JavaScript web framework.
|
|
3
3
|
|
|
4
|
-
Crank
|
|
5
|
-
|
|
6
|
-
Its API aims to be minimal and transparent. By relying on standard JavaScript control flow operators and data structures, and by making the process of rendering explicit, Crank.js helps developers write durable, bug-free applications with the latest and greatest libraries and APIs.
|
|
7
|
-
|
|
8
|
-
Rather than forcing developers to work with increasingly convoluted reactive solutions and bespoke templating languages, Crank.js uses the platform. It is a dedication to the web, to the promise of an accessible and inclusive medium for self-expression and commerce, built on the thesis that simpler code is how we’ll push the frontier.
|
|
4
|
+
Crank is a web framework where components can be defined with sync functions, async functions and generator functions. The documentation for Crank.js is available at [crank.js.org](https://crank.js.org).
|
|
9
5
|
|
|
10
6
|
## Get Started
|
|
11
7
|
|
|
12
|
-
|
|
8
|
+
Crank.js is published on NPM under the `@b9g` organization (short for “b*ikeshavin*g”).
|
|
13
9
|
|
|
14
10
|
```shell
|
|
15
|
-
$ npm
|
|
11
|
+
$ npm i @b9g/crank
|
|
16
12
|
```
|
|
17
13
|
|
|
18
14
|
### Key Examples
|
|
@@ -20,8 +16,6 @@ $ npm install @b9g/crank
|
|
|
20
16
|
#### A Simple Component
|
|
21
17
|
|
|
22
18
|
```jsx live
|
|
23
|
-
/** @jsx createElement */
|
|
24
|
-
import {createElement} from "@b9g/crank";
|
|
25
19
|
import {renderer} from "@b9g/crank/dom";
|
|
26
20
|
|
|
27
21
|
function Greeting({name = "World"}) {
|
|
@@ -36,8 +30,6 @@ renderer.render(<Greeting />, document.body);
|
|
|
36
30
|
#### A Stateful Component
|
|
37
31
|
|
|
38
32
|
```jsx live
|
|
39
|
-
/** @jsx createElement */
|
|
40
|
-
import {createElement} from "@b9g/crank";
|
|
41
33
|
import {renderer} from "@b9g/crank/dom";
|
|
42
34
|
|
|
43
35
|
function *Timer() {
|
|
@@ -61,8 +53,6 @@ renderer.render(<Timer />, document.body);
|
|
|
61
53
|
#### An Async Component
|
|
62
54
|
|
|
63
55
|
```jsx live
|
|
64
|
-
/** @jsx createElement */
|
|
65
|
-
import {createElement} from "@b9g/crank";
|
|
66
56
|
import {renderer} from "@b9g/crank/dom";
|
|
67
57
|
|
|
68
58
|
async function QuoteOfTheDay() {
|
|
@@ -81,8 +71,7 @@ renderer.render(<QuoteOfTheDay />, document.body);
|
|
|
81
71
|
### A Loading Component
|
|
82
72
|
|
|
83
73
|
```jsx live
|
|
84
|
-
|
|
85
|
-
import {createElement, Fragment} from "@b9g/crank";
|
|
74
|
+
import {Fragment} from "@b9g/crank";
|
|
86
75
|
import {renderer} from "@b9g/crank/dom";
|
|
87
76
|
|
|
88
77
|
async function LoadingIndicator() {
|
|
@@ -120,7 +109,7 @@ function *RandomDogApp() {
|
|
|
120
109
|
}
|
|
121
110
|
});
|
|
122
111
|
|
|
123
|
-
|
|
112
|
+
for ({} of this) {
|
|
124
113
|
yield (
|
|
125
114
|
<Fragment>
|
|
126
115
|
<div>
|
package/crank.cjs
CHANGED
|
@@ -1236,10 +1236,6 @@ function ctxContains(parent, child) {
|
|
|
1236
1236
|
function updateComponent(renderer, root, host, parent, scope, ret, oldProps, hydrationData) {
|
|
1237
1237
|
let ctx;
|
|
1238
1238
|
if (oldProps) {
|
|
1239
|
-
// TODO: we should probably use the existence of ret.ctx
|
|
1240
|
-
if (ret.ctx == null) {
|
|
1241
|
-
throw new Error("Hmmm");
|
|
1242
|
-
}
|
|
1243
1239
|
ctx = ret.ctx;
|
|
1244
1240
|
if (ctx.f & IsSyncExecuting) {
|
|
1245
1241
|
console.error("Component is already executing");
|