@faber1999/axon.js 0.3.0 → 0.4.1

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
@@ -1,4 +1,7 @@
1
- # axon.js
1
+ <div align="center">
2
+ <img src="./logo.svg" width="80" alt="axon.js logo" />
3
+ <h1>axon.js</h1>
4
+ </div>
2
5
 
3
6
  A fine-grained reactive frontend framework built from scratch.
4
7
  JSX syntax · Signals reactivity · Router · Store · No Virtual DOM · Zero dependencies.
@@ -93,6 +93,35 @@ function disposeOwner(owner) {
93
93
 
94
94
  // src/dom/h.ts
95
95
  var Fragment = /* @__PURE__ */ Symbol("Fragment");
96
+ var SVG_NS = "http://www.w3.org/2000/svg";
97
+ var SVG_ELEMENTS = /* @__PURE__ */ new Set([
98
+ "svg",
99
+ "path",
100
+ "circle",
101
+ "rect",
102
+ "ellipse",
103
+ "line",
104
+ "polyline",
105
+ "polygon",
106
+ "g",
107
+ "defs",
108
+ "use",
109
+ "symbol",
110
+ "text",
111
+ "tspan",
112
+ "image",
113
+ "clipPath",
114
+ "mask",
115
+ "filter",
116
+ "linearGradient",
117
+ "radialGradient",
118
+ "stop",
119
+ "marker",
120
+ "pattern",
121
+ "foreignObject",
122
+ "animate",
123
+ "animateTransform"
124
+ ]);
96
125
  var BOOLEAN_ATTRS = /* @__PURE__ */ new Set([
97
126
  "checked",
98
127
  "disabled",
@@ -117,7 +146,7 @@ var BOOLEAN_ATTRS = /* @__PURE__ */ new Set([
117
146
  ]);
118
147
  function applyProp(el, key, value) {
119
148
  if (key === "class" || key === "className") {
120
- el.className = value ?? "";
149
+ el.setAttribute("class", value ?? "");
121
150
  } else if (key === "style") {
122
151
  if (typeof value === "string") {
123
152
  el.style.cssText = value;
@@ -196,7 +225,7 @@ function h(type, props, ...children) {
196
225
  else if (children.length > 1) componentProps.children = children.flat();
197
226
  return runWithOwner(type, componentProps);
198
227
  }
199
- const el = document.createElement(type);
228
+ const el = SVG_ELEMENTS.has(type) ? document.createElementNS(SVG_NS, type) : document.createElement(type);
200
229
  if (props) {
201
230
  for (const key of Object.keys(props)) {
202
231
  const value = props[key];
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  runOwned,
10
10
  runWithOwner,
11
11
  untrack
12
- } from "./chunk-HYNBHCGU.js";
12
+ } from "./chunk-RKZYBE62.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-HYNBHCGU.js";
4
+ } from "./chunk-RKZYBE62.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.3.0",
3
+ "version": "0.4.1",
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": {