@react5/dom-jsx 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/README.md +8 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -24,15 +24,19 @@ The runtime also works with Vite. Vite discovers the package's ESM `jsx-runtime`
24
24
  Function components may return DOM nodes with an attached API:
25
25
 
26
26
  ```tsx
27
- type ModalContext = { open?(): void; close?(): void }
27
+ type ModalContext = { open(): void; close(): void }
28
28
 
29
29
  function Modal() {
30
- const element = <dialog />
31
- return element as HTMLDialogElement & { context: ModalContext }
30
+ const element = <dialog /> as HTMLDialogElement
31
+
32
+ return Object.assign(element, {
33
+ open: () => element.showModal(),
34
+ close: () => element.close()
35
+ }) satisfies HTMLDialogElement & ModalContext
32
36
  }
33
37
 
34
38
  const modal = <Modal />
35
- modal.context.open?.()
39
+ modal.open()
36
40
  ```
37
41
 
38
42
  TypeScript represents all JSX expressions with one `JSX.Element` type, so it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react5/dom-jsx",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "JSX runtime for vanilla TS/JS projects.",
5
5
  "keywords": [
6
6
  "JSX"