@bikeshaving/crank
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -5,3 +5,3 @@ 'use strict'; | ||
var index = require('./index-454299da.js'); | ||
var index = require('./index-bcf5b5c1.js'); | ||
@@ -8,0 +8,0 @@ var _a; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var index = require('./index-454299da.js'); | ||
var index = require('./index-bcf5b5c1.js'); | ||
@@ -58,3 +58,3 @@ var _a; | ||
case name_2 === "style": | ||
attrs.push("style=\"" + printStyle(value) + "\""); | ||
attrs.push("style=\"" + escapeText(printStyle(value)) + "\""); | ||
break; | ||
@@ -67,3 +67,3 @@ case typeof value === "string": | ||
break; | ||
case typeof value === "boolean": | ||
case value === true: | ||
attrs.push("" + escapeText(name_2)); | ||
@@ -70,0 +70,0 @@ break; |
@@ -142,2 +142,3 @@ import { CrankEventTarget } from "./events"; | ||
constructor(parent: ParentNode<T>, renderer: Renderer<T>, tag: Component, key: Key); | ||
protected updateChildren(children: Children): MaybePromise<undefined>; | ||
private step; | ||
@@ -144,0 +145,0 @@ private advance; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var index = require('./index-454299da.js'); | ||
var index = require('./index-bcf5b5c1.js'); | ||
@@ -8,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { D as Default, _ as __generator, R as Raw, P as Portal, d as __extends, b as Renderer, e as __rest, f as __values, g as __assign } from './index-06d991e2.js'; | ||
import { D as Default, _ as __generator, R as Raw, P as Portal, d as __extends, b as Renderer, e as __rest, f as __values, g as __assign } from './index-4b79835a.js'; | ||
@@ -3,0 +3,0 @@ var _a; |
@@ -1,2 +0,2 @@ | ||
import { D as Default, T as Text, P as Portal, d as __extends, f as __values, h as __read, b as Renderer } from './index-06d991e2.js'; | ||
import { D as Default, T as Text, P as Portal, d as __extends, f as __values, h as __read, b as Renderer } from './index-4b79835a.js'; | ||
@@ -53,3 +53,3 @@ var _a; | ||
case name_2 === "style": | ||
attrs.push("style=\"" + printStyle(value) + "\""); | ||
attrs.push("style=\"" + escapeText(printStyle(value)) + "\""); | ||
break; | ||
@@ -62,3 +62,3 @@ case typeof value === "string": | ||
break; | ||
case typeof value === "boolean": | ||
case value === true: | ||
attrs.push("" + escapeText(name_2)); | ||
@@ -65,0 +65,0 @@ break; |
@@ -142,2 +142,3 @@ import { CrankEventTarget } from "./events"; | ||
constructor(parent: ParentNode<T>, renderer: Renderer<T>, tag: Component, key: Key); | ||
protected updateChildren(children: Children): MaybePromise<undefined>; | ||
private step; | ||
@@ -144,0 +145,0 @@ private advance; |
@@ -1,2 +0,2 @@ | ||
export { a as Context, C as Copy, D as Default, F as Fragment, H as HostContext, P as Portal, R as Raw, b as Renderer, T as Text, c as createElement, i as isElement } from './index-06d991e2.js'; | ||
export { a as Context, C as Copy, D as Default, F as Fragment, H as HostContext, P as Portal, R as Raw, b as Renderer, T as Text, c as createElement, i as isElement } from './index-4b79835a.js'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@bikeshaving/crank", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "JSX-based components with functions, promises and generators.", |
# Crank.js | ||
Write JSX-driven components with functions, promises and generators. | ||
Documentation is available at [crank.js.org](https://crank.js.org). Crank.js is in a beta phase, and some APIs may change. To read more about the motivations for this library, you can read the [introductory blog post](https://crank.js.org/blog/introducing-crank). | ||
## Features | ||
@@ -30,3 +32,3 @@ ### Declarative components | ||
If your environment does not support ESModules (you’ll probably see a message like `SyntaxError: Unexpected token export`), you can import the CommonJS versions of the library like so: | ||
If your environment does not support ESModules (you’ll probably see a message like `SyntaxError: Unexpected token export`), you can import the CommonJS versions of the library under the `cjs` directory. | ||
@@ -48,3 +50,3 @@ ```jsx | ||
function Greeting ({name = "World"}) { | ||
function Greeting({name = "World"}) { | ||
return ( | ||
@@ -55,6 +57,6 @@ <div>Hello {name}</div> | ||
renderer.render(<Greeting />, document.getElementById("app")); | ||
renderer.render(<Greeting />, document.body); | ||
``` | ||
[Try on CodeSandbox](https://codesandbox.io/s/a-simple-crank-component-gnknz) | ||
[Try on CodeSandbox](https://codesandbox.io/s/a-simple-crank-component-mhciu) | ||
@@ -67,3 +69,3 @@ ### A Stateful Component | ||
function *Timer () { | ||
function *Timer() { | ||
let seconds = 0; | ||
@@ -83,3 +85,3 @@ const interval = setInterval(() => { | ||
renderer.render(<Timer />, document.getElementById("app")); | ||
renderer.render(<Timer />, document.body); | ||
``` | ||
@@ -95,9 +97,13 @@ | ||
async function IPAddress () { | ||
const res = await fetch("https://api.ipify.org"); | ||
const address = await res.text(); | ||
return <div>Your IP Address: {address}</div>; | ||
async function QuoteOfTheDay() { | ||
const res = await fetch("https://favqs.com/api/qotd"); | ||
const {quote} = await res.json(); | ||
return ( | ||
<p> | ||
“{quote.body}” – <a href={quote.url}>{quote.author}</a> | ||
</p> | ||
); | ||
} | ||
renderer.render(<IPAddress />, document.getElementById("app")); | ||
renderer.render(<QuoteOfTheDay />, document.body); | ||
``` | ||
@@ -134,3 +140,3 @@ | ||
for await ({throttle} of this) { | ||
yield <LoadingIndicator /> | ||
yield <LoadingIndicator />; | ||
yield <RandomDog throttle={throttle} />; | ||
@@ -137,0 +143,0 @@ } |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
297634
34
5565
164
1