@vimpak/jsx 0.3.0 → 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 CHANGED
@@ -36,42 +36,26 @@ const html = await render(<Greeting name="World" />);
36
36
  // Output: <h1>Hello, World!</h1>
37
37
  ```
38
38
 
39
- ### Fragments
40
-
41
- ```tsx
42
- function Page() {
43
- return (
44
- <>
45
- <h1>Title</h1>
46
- <p>Content</p>
47
- </>
48
- );
49
- }
50
- ```
51
-
52
- ### Safe HTML
39
+ ### Async Components
53
40
 
54
- Use the `safe` prop to render raw HTML:
41
+ Components can be asynchronous:
55
42
 
56
43
  ```tsx
57
- function Component() {
58
- return <div safe="<strong>Bold text</strong>" />;
44
+ async function User({ id }: { id: string }) {
45
+ const user = await fetchUser(id);
46
+ return <div>{user.name}</div>;
59
47
  }
60
- ```
61
48
 
62
- ### Styles
63
-
64
- ```tsx
65
- function Styled() {
66
- return <div style={{ color: "red", fontSize: "16px" }}>Styled</div>;
67
- }
49
+ const html = await render(<User id="1" />);
68
50
  ```
69
51
 
52
+ The `render` function awaits all async components automatically.
53
+
70
54
  ### Context
71
55
 
72
56
  ```tsx
73
57
  class AppContext {
74
- async getTheme() {
58
+ getTheme() {
75
59
  return "dark";
76
60
  }
77
61
  }
@@ -79,7 +63,8 @@ class AppContext {
79
63
  const ctx = new AppContext();
80
64
 
81
65
  function Greeting(props: { name: string }, ctx: AppContext) {
82
- return <div></div>;
66
+ const theme = ctx.getTheme();
67
+ return <div className={theme}>{props.name}</div>;
83
68
  }
84
69
 
85
70
  function App() {
@@ -93,20 +78,23 @@ function App() {
93
78
  const html = await render(<App />, ctx);
94
79
  ```
95
80
 
96
- ### Async Components
81
+ ### Safe HTML
97
82
 
98
- Components can be asynchronous:
83
+ Use the `safe` prop to render raw HTML:
99
84
 
100
85
  ```tsx
101
- async function User({ id }: { id: string }) {
102
- const user = await fetchUser(id);
103
- return <div>{user.name}</div>;
86
+ function Component() {
87
+ return <div safe="<strong>Bold text</strong>" />;
104
88
  }
105
-
106
- const html = await render(<User id="1" />);
107
89
  ```
108
90
 
109
- The `render` function awaits all async components automatically.
91
+ ### Styles
92
+
93
+ ```tsx
94
+ function Styled() {
95
+ return <div style={{ color: "red", fontSize: "16px" }}>Styled</div>;
96
+ }
97
+ ```
110
98
 
111
99
  ## API
112
100
 
package/dist/html.d.ts CHANGED
@@ -428,9 +428,6 @@ declare namespace JSX {
428
428
  height?: undefined | number | string;
429
429
  width?: undefined | number | string;
430
430
  }
431
- interface HtmlUnspecifiedTag extends HtmlTag, Record<string, any> {
432
- of: string;
433
- }
434
431
  interface HtmlBodyTag {
435
432
  onafterprint?: undefined | string;
436
433
  onbeforeprint?: undefined | string;
@@ -685,7 +682,6 @@ declare namespace JSX {
685
682
  switch: HtmlSvgTag;
686
683
  symbol: HtmlSvgTag;
687
684
  table: HtmlTableTag;
688
- tag: HtmlUnspecifiedTag;
689
685
  tbody: HtmlTag;
690
686
  td: HtmlTableDataCellTag;
691
687
  template: HtmlTag;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "name": "@vimpak/jsx",
5
5
  "collaborators": [
6
6
  "Sudesh Yadav <sudeshyadav955@gmail.com>"
@@ -8,6 +8,10 @@
8
8
  "files": [
9
9
  "./dist"
10
10
  ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/sudesh955/jsx"
14
+ },
11
15
  "main": "./dist/index.js",
12
16
  "exports": {
13
17
  ".": {