@faber1999/axon.js 0.4.2 → 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 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
- esbuild: {
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 last three `jsx*` options are the only ones specific to axon.js. The rest is standard Vite + TypeScript configuration.
70
+ The three `jsx*` options are the only ones specific to axon.js. The rest is standard Vite + TypeScript configuration.
79
71
 
80
- That's it. No plugins, no Babel, no extra config.
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
 
@@ -55,11 +55,13 @@ function runOwned(fn) {
55
55
  const parent = getCurrentOwner();
56
56
  if (parent) parent._children.push(owner);
57
57
  ownerStack.push(owner);
58
+ const savedEffects = effectStack.splice(0);
58
59
  let result;
59
60
  try {
60
61
  result = fn();
61
62
  } finally {
62
63
  ownerStack.pop();
64
+ effectStack.push(...savedEffects);
63
65
  }
64
66
  queueMicrotask(() => {
65
67
  if (!owner._mounted) {
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  runOwned,
10
10
  runWithOwner,
11
11
  untrack
12
- } from "./chunk-HE4N2XY4.js";
12
+ } from "./chunk-OJYYRMLE.js";
13
13
 
14
14
  // src/reactivity/signal.ts
15
15
  var batchDepth = 0;
package/dist/jsx.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Fragment,
3
3
  h
4
- } from "./chunk-HE4N2XY4.js";
4
+ } from "./chunk-OJYYRMLE.js";
5
5
  export {
6
6
  Fragment,
7
7
  h
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faber1999/axon.js",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "A fine-grained reactive frontend framework with JSX",
5
5
  "author": "Faber Grajales Hincapié <faber1999> (https://github.com/faber1999)",
6
6
  "repository": {