@bikeshaving/crank
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -220,3 +220,3 @@ /** | ||
*/ | ||
value: TNode | string | undefined; | ||
value: ElementValue<TNode>; | ||
/** | ||
@@ -283,3 +283,3 @@ * The cached child values of this element. Only host and component elements | ||
*/ | ||
parse(text: string, scope: TScope | undefined): TNode | string; | ||
parse(text: string, scope: TScope | undefined): ElementValue<TNode>; | ||
patch<TTag extends string | symbol, TName extends string>(tag: TTag, node: TNode, name: TName, value: TagProps<TTag>[TName], oldValue: TagProps<TTag>[TName] | undefined, scope: TScope): unknown; | ||
@@ -489,3 +489,3 @@ arrange<TTag extends string | symbol>(tag: TTag, node: TNode, props: TagProps<TTag>, children: Array<TNode | string>, oldProps: TagProps<TTag> | undefined, oldChildren: Array<TNode | string> | undefined): unknown; | ||
declare global { | ||
module Crank { | ||
namespace Crank { | ||
interface EventMap { | ||
@@ -507,2 +507,10 @@ } | ||
} | ||
export {}; | ||
declare const _default: { | ||
createElement: typeof createElement; | ||
Fragment: string; | ||
}; | ||
/** | ||
* Some JSX transpilation tools expect these functions to be defined on the | ||
* default export. Prefer named exports when importing directly. | ||
*/ | ||
export default _default; |
@@ -126,3 +126,2 @@ /// <reference types="crank.d.ts" /> | ||
if (props != null) { | ||
// TODO: deprecate crank-whatever props | ||
for (const name in props) { | ||
@@ -1636,4 +1635,9 @@ switch (name) { | ||
} | ||
/** | ||
* Some JSX transpilation tools expect these functions to be defined on the | ||
* default export. Prefer named exports when importing directly. | ||
*/ | ||
var crank = { createElement, Fragment }; | ||
export { Context, Copy, Element, Fragment, Portal, Raw, Renderer, cloneElement, createElement, isElement }; | ||
export { Context, Copy, Element, Fragment, Portal, Raw, Renderer, cloneElement, createElement, crank as default, isElement }; | ||
//# sourceMappingURL=crank.js.map |
@@ -1,2 +0,2 @@ | ||
import { Children, Context, ElementValue, Renderer, RendererImpl } from "./crank"; | ||
import { Children, Context, ElementValue, Renderer, RendererImpl } from "./crank.js"; | ||
export declare const impl: Partial<RendererImpl<Node, string>>; | ||
@@ -3,0 +3,0 @@ export declare class DOMRenderer extends Renderer<Node, string> { |
@@ -8,12 +8,9 @@ /// <reference types="dom.d.ts" /> | ||
if (typeof document.createRange === "function") { | ||
return document.createRange().createContextualFragment(text); | ||
const fragment = document.createRange().createContextualFragment(text); | ||
return Array.from(fragment.childNodes); | ||
} | ||
else { | ||
const fragment = document.createDocumentFragment(); | ||
const childNodes = new DOMParser().parseFromString(text, "text/html").body | ||
.childNodes; | ||
for (let i = 0; i < childNodes.length; i++) { | ||
fragment.appendChild(childNodes[i]); | ||
} | ||
return fragment; | ||
return Array.from(childNodes); | ||
} | ||
@@ -20,0 +17,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
import { Renderer, RendererImpl } from "./crank"; | ||
import { Renderer, RendererImpl } from "./crank.js"; | ||
interface Node { | ||
@@ -3,0 +3,0 @@ value: string; |
@@ -64,2 +64,7 @@ /// <reference types="html.d.ts" /> | ||
break; | ||
case name === "className": | ||
if (!("class" in props)) { | ||
attrs.push(`class="${escape(value)}"`); | ||
} | ||
break; | ||
case typeof value === "string": | ||
@@ -66,0 +71,0 @@ attrs.push(`${escape(name)}="${escape(value)}"`); |
@@ -1,1 +0,2 @@ | ||
export * from "./crank"; | ||
export * from "./crank.js"; | ||
export { default } from "./crank.js"; |
/// <reference types="index.d.ts" /> | ||
export { Context, Copy, Element, Fragment, Portal, Raw, Renderer, cloneElement, createElement, isElement } from './crank.js'; | ||
export { Context, Copy, Element, Fragment, Portal, Raw, Renderer, cloneElement, createElement, default, isElement } from './crank.js'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@bikeshaving/crank", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Write JSX-driven components with functions, promises and generators.", | ||
@@ -16,6 +16,5 @@ "homepage": "https://crank.js.org", | ||
"exports": { | ||
"./": "./", | ||
".": { | ||
"import": "./index.js", | ||
"require": "./index.cjs" | ||
"import": "./crank.js", | ||
"require": "./crank.cjs" | ||
}, | ||
@@ -62,5 +61,5 @@ "./crank": { | ||
}, | ||
"main": "index.cjs", | ||
"module": "index.js", | ||
"types": "index.d.ts", | ||
"main": "crank.cjs", | ||
"module": "crank.js", | ||
"types": "crank.d.ts", | ||
"devDependencies": { | ||
@@ -71,3 +70,2 @@ "@arkweid/lefthook": "^0.7.7", | ||
"@typescript-eslint/parser": "^4.31.2", | ||
"core-js": "^3.18.0", | ||
"eslint": "^7.32.0", | ||
@@ -85,3 +83,3 @@ "eslint-config-prettier": "^8.3.0", | ||
"ts-jest": "^26.5.6", | ||
"ts-transform-import-path-rewrite": "^0.3.0", | ||
"ts-jest-resolver": "^2.0.0", | ||
"typescript": "^4.4.3" | ||
@@ -88,0 +86,0 @@ }, |
@@ -17,3 +17,3 @@ # Crank.js | ||
### Lightweight | ||
Crank has no dependencies, and its core is a single file. It currently measures at [4.5KB minified and gzipped](https://bundlephobia.com/result?p=@bikeshaving/crank). | ||
Crank has no dependencies, and its core is a single file. It currently measures at [5KB minified and gzipped](https://bundlephobia.com/result?p=@b9g/crank). | ||
@@ -27,6 +27,6 @@ ### Performant | ||
## Installation | ||
Crank is available on [NPM](https://npmjs.org/@bikeshaving/crank) in the ESModule and CommonJS formats. | ||
Crank is available on [NPM](https://npmjs.org/@b9g/crank) in the ESModule and CommonJS formats. | ||
```shell | ||
$ npm install @bikeshaving/crank | ||
$ npm install @b9g/crank | ||
``` | ||
@@ -36,4 +36,4 @@ | ||
/** @jsx createElement */ | ||
import {createElement} from "@bikeshaving/crank"; | ||
import {renderer} from "@bikeshaving/crank/dom"; | ||
import {createElement} from "@b9g/crank"; | ||
import {renderer} from "@b9g/crank/dom"; | ||
@@ -47,4 +47,4 @@ renderer.render(<div id="hello">Hello world</div>, document.body); | ||
/** @jsx createElement */ | ||
import {createElement} from "@bikeshaving/crank/cjs"; | ||
import {renderer} from "@bikeshaving/crank/cjs/dom"; | ||
import {createElement} from "@b9g/crank/cjs"; | ||
import {renderer} from "@b9g/crank/cjs/dom"; | ||
@@ -58,4 +58,4 @@ renderer.render(<div id="hello">Hello world</div>, document.body); | ||
/** @jsx createElement */ | ||
import {createElement} from "@bikeshaving/crank"; | ||
import {renderer} from "@bikeshaving/crank/dom"; | ||
import {createElement} from "@b9g/crank"; | ||
import {renderer} from "@b9g/crank/dom"; | ||
@@ -76,4 +76,4 @@ function Greeting({name = "World"}) { | ||
/** @jsx createElement */ | ||
import {createElement} from "@bikeshaving/crank"; | ||
import {renderer} from "@bikeshaving/crank/dom"; | ||
import {createElement} from "@b9g/crank"; | ||
import {renderer} from "@b9g/crank/dom"; | ||
@@ -103,4 +103,4 @@ function *Timer() { | ||
/** @jsx createElement */ | ||
import {createElement} from "@bikeshaving/crank"; | ||
import {renderer} from "@bikeshaving/crank/dom"; | ||
import {createElement} from "@b9g/crank"; | ||
import {renderer} from "@b9g/crank/dom"; | ||
@@ -125,4 +125,4 @@ async function QuoteOfTheDay() { | ||
/** @jsx createElement */ | ||
import {createElement, Fragment} from "@bikeshaving/crank"; | ||
import {renderer} from "@bikeshaving/crank/dom"; | ||
import {createElement, Fragment} from "@b9g/crank"; | ||
import {renderer} from "@b9g/crank/dom"; | ||
@@ -129,0 +129,0 @@ async function LoadingIndicator() { |
@@ -1,3 +0,3 @@ | ||
export * from "./crank"; | ||
export * as dom from "./dom"; | ||
export * as html from "./html"; | ||
export * from "./crank.js"; | ||
export * as dom from "./dom.js"; | ||
export * as html from "./html.js"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
665729
18
6564