Comparing version 6.4.11 to 6.4.13
@@ -0,1 +1,4 @@ | ||
# 6.4.12 | ||
- Fix: default import for `import React from "jsx-dom/svg"`. | ||
# 6.4.11 | ||
@@ -2,0 +5,0 @@ - Expands `HTML` type alias namespace. No runtime code changed. |
@@ -66,2 +66,21 @@ "use strict" | ||
function useText(initialValue) { | ||
var text = new Text() | ||
Object.defineProperty(text, "toString", { | ||
value: function() { | ||
return this.textContent | ||
}, | ||
}) | ||
function setText(value) { | ||
text.textContent = value | ||
} | ||
if (initialValue != null) { | ||
setText(initialValue) | ||
} | ||
return [text, setText] | ||
} | ||
var SVGNamespace = "http://www.w3.org/2000/svg" | ||
@@ -254,1 +273,2 @@ var index = { | ||
exports.stopPropagation = stopPropagation | ||
exports.useText = useText |
@@ -61,2 +61,21 @@ var __assign = Object.assign | ||
function useText(initialValue) { | ||
var text = new Text() | ||
Object.defineProperty(text, "toString", { | ||
value: function() { | ||
return this.textContent | ||
}, | ||
}) | ||
function setText(value) { | ||
text.textContent = value | ||
} | ||
if (initialValue != null) { | ||
setText(initialValue) | ||
} | ||
return [text, setText] | ||
} | ||
var SVGNamespace = "http://www.w3.org/2000/svg" | ||
@@ -250,2 +269,3 @@ var index = { | ||
stopPropagation, | ||
useText, | ||
} |
@@ -66,2 +66,21 @@ "use strict" | ||
function useText(initialValue) { | ||
var text = new Text() | ||
Object.defineProperty(text, "toString", { | ||
value: function() { | ||
return this.textContent | ||
}, | ||
}) | ||
function setText(value) { | ||
text.textContent = value | ||
} | ||
if (initialValue != null) { | ||
setText(initialValue) | ||
} | ||
return [text, setText] | ||
} | ||
var SVGNamespace = "http://www.w3.org/2000/svg" | ||
@@ -349,1 +368,2 @@ var XLinkNamespace = "http://www.w3.org/1999/xlink" | ||
exports.stopPropagation = stopPropagation | ||
exports.useText = useText |
@@ -61,2 +61,21 @@ var __assign = Object.assign | ||
function useText(initialValue) { | ||
var text = new Text() | ||
Object.defineProperty(text, "toString", { | ||
value: function() { | ||
return this.textContent | ||
}, | ||
}) | ||
function setText(value) { | ||
text.textContent = value | ||
} | ||
if (initialValue != null) { | ||
setText(initialValue) | ||
} | ||
return [text, setText] | ||
} | ||
var SVGNamespace = "http://www.w3.org/2000/svg" | ||
@@ -345,2 +364,3 @@ var XLinkNamespace = "http://www.w3.org/1999/xlink" | ||
stopPropagation, | ||
useText, | ||
} |
{ | ||
"name": "jsx-dom", | ||
"version": "6.4.11", | ||
"version": "6.4.13", | ||
"description": "JSX to document.createElement.", | ||
@@ -23,9 +23,9 @@ "main": "lib/index.cjs.js", | ||
"devDependencies": { | ||
"@babel/core": "^7.8.6", | ||
"@babel/core": "^7.8.7", | ||
"@rollup/plugin-replace": "^2.3.1", | ||
"@types/babel__core": "^7.1.6", | ||
"@types/chai": "^4.2.9", | ||
"@types/chai": "^4.2.10", | ||
"@types/jsdom": "^16.1.0", | ||
"@types/mocha": "^7.0.1", | ||
"@types/node": "^13.7.7", | ||
"@types/mocha": "^7.0.2", | ||
"@types/node": "^13.9.0", | ||
"@types/prop-types": "^15.7.3", | ||
@@ -40,3 +40,3 @@ "babel-preset-minify": "^0.5.1", | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.32.0", | ||
"rollup": "^2.0.2", | ||
"rollup-plugin-prettier": "^0.6.0", | ||
@@ -43,0 +43,0 @@ "rollup-typescript": "^1.2.1", |
# jsx-dom | ||
<!-- prettier-ignore --> | ||
@@ -42,3 +43,3 @@ [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) | ||
Hello.defaultProps = { | ||
firstName: "John" | ||
firstName: "John", | ||
} | ||
@@ -68,4 +69,4 @@ | ||
<div class={[ condition && "class" ]} /> | ||
<div class={{ hidden: isHidden, 'has-item': this.array.length > 0 }} /> | ||
<div class={[ classArray1, classArray2, ['nested'] ]} /> | ||
<div class={{ hidden: isHidden, "has-item": !!array.length }} /> | ||
<div class={[ classArray1, classArray2, ["nested"] ]} /> | ||
``` | ||
@@ -161,3 +162,4 @@ | ||
import React, { SVGNamespace } from "jsx-dom" | ||
<a namespaceURI={ SVGNamespace }>I am an SVG element!</a> | ||
const anchor = <a namespaceURI={SVGNamespace}>I am an SVG element!</a> | ||
``` | ||
@@ -176,2 +178,17 @@ | ||
## `useText` | ||
While this is technically not a hook in a React sense, it functions like one and | ||
facilitates simple DOM text changes. | ||
```jsx | ||
import React, { useText } from "jsx-dom" | ||
function Component() { | ||
const [text, setText] = useText("Downloading") | ||
fetch("./api").then(() => setText("Done!")) | ||
return <div>Status: {text}</div> | ||
} | ||
``` | ||
## Browser Support | ||
@@ -185,2 +202,2 @@ | ||
`<div />`, and other tags, are inferred as a general `JSX.Element` in TypeScript instead of | ||
`HTMLDivElement` (or the equivalents). This is a known bug and its fix depends on [TypeScript#21699](https://github.com/Microsoft/TypeScript/issues/21699). | ||
`HTMLDivElement` (or the equivalents). This is a known bug and its fix depends on [TypeScript#21699](https://github.com/Microsoft/TypeScript/issues/21699). |
@@ -1,1 +0,2 @@ | ||
export * from "./lib/svg" | ||
export { default } from "./lib/svg" | ||
export * from "./lib/svg" |
Sorry, the diff of this file is too big to display
137306
3521
199