@faber1999/axon.js 0.4.3 → 0.4.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.
- package/README.md +11 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,12 +31,7 @@ Components run **once**. Only the exact DOM nodes that depend on a signal update
|
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
npm install @faber1999/axon.js
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
You also need Vite and TypeScript as dev dependencies:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install -D vite typescript
|
|
34
|
+
npm install -D @faber1999/vite-plugin-axon vite typescript
|
|
40
35
|
```
|
|
41
36
|
|
|
42
37
|
### Vite setup
|
|
@@ -45,13 +40,10 @@ npm install -D vite typescript
|
|
|
45
40
|
|
|
46
41
|
```ts
|
|
47
42
|
import { defineConfig } from 'vite'
|
|
43
|
+
import axon from '@faber1999/vite-plugin-axon'
|
|
48
44
|
|
|
49
45
|
export default defineConfig({
|
|
50
|
-
|
|
51
|
-
jsxFactory: 'h',
|
|
52
|
-
jsxFragment: 'Fragment',
|
|
53
|
-
jsxInject: `import { h, Fragment } from '@faber1999/axon.js/jsx'`
|
|
54
|
-
}
|
|
46
|
+
plugins: [axon()],
|
|
55
47
|
})
|
|
56
48
|
```
|
|
57
49
|
|
|
@@ -75,9 +67,15 @@ export default defineConfig({
|
|
|
75
67
|
}
|
|
76
68
|
```
|
|
77
69
|
|
|
78
|
-
The
|
|
70
|
+
The three `jsx*` options are the only ones specific to axon.js. The rest is standard Vite + TypeScript configuration.
|
|
79
71
|
|
|
80
|
-
|
|
72
|
+
The Vite plugin configures JSX automatically and enables reactive expressions in JSX attributes:
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
// Works out of the box — no need to wrap in arrow functions
|
|
76
|
+
<div class={`btn ${active() ? 'btn-active' : ''}`} />
|
|
77
|
+
<button disabled={count() === 0}>-1</button>
|
|
78
|
+
```
|
|
81
79
|
|
|
82
80
|
---
|
|
83
81
|
|
package/package.json
CHANGED