@ktjs/jsx 0.6.17 → 0.7.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/dist/index.cjs CHANGED
@@ -23,6 +23,12 @@ function jsx(tag, props, ..._metadata) {
23
23
  const el = core.h(tag, propObj, children);
24
24
  if (hasRef) {
25
25
  ref.value = el;
26
+ ref.update = () => {
27
+ const old = ref.value;
28
+ ref.value = core.h(tag, propObj, children);
29
+ old.replaceWith(ref.value);
30
+ return ref.value;
31
+ };
26
32
  }
27
33
  return el;
28
34
  }
@@ -93,7 +99,7 @@ const jsxs = jsx;
93
99
  * ## About
94
100
  * @package @ktjs/jsx
95
101
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
96
- * @version 0.6.17 (Last Update: 2025.12.24 22:17:37.131)
102
+ * @version 0.7.0 (Last Update: 2025.12.25 09:28:19.120)
97
103
  * @license MIT
98
104
  * @link https://github.com/baendlorel/kt.js
99
105
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -102,7 +108,7 @@ const jsxs = jsx;
102
108
  */
103
109
  // Export JSX runtime functions
104
110
  function ref() {
105
- return { value: null };
111
+ return {};
106
112
  }
107
113
 
108
114
  Object.defineProperty(exports, "createElement", {
package/dist/index.d.ts CHANGED
@@ -68,7 +68,7 @@ declare global {
68
68
  * ## About
69
69
  * @package @ktjs/jsx
70
70
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
71
- * @version 0.6.17 (Last Update: 2025.12.24 22:17:37.131)
71
+ * @version 0.7.0 (Last Update: 2025.12.25 09:28:19.120)
72
72
  * @license MIT
73
73
  * @link https://github.com/baendlorel/kt.js
74
74
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -76,8 +76,16 @@ declare global {
76
76
  * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
77
77
  */
78
78
 
79
- declare function ref<T extends HTMLElement>(): {
79
+ interface Ref<T> {
80
+ /**
81
+ * Current value of the referenced element
82
+ */
80
83
  value: T;
81
- };
84
+ /**
85
+ * Update function to re-render the referenced element
86
+ */
87
+ update: () => T;
88
+ }
89
+ declare function ref<T extends HTMLElement>(): Ref<T>;
82
90
 
83
91
  export { Fragment, jsx, jsxDEV, jsxs, ref };
package/dist/index.mjs CHANGED
@@ -22,6 +22,12 @@ function jsx(tag, props, ..._metadata) {
22
22
  const el = h(tag, propObj, children);
23
23
  if (hasRef) {
24
24
  ref.value = el;
25
+ ref.update = () => {
26
+ const old = ref.value;
27
+ ref.value = h(tag, propObj, children);
28
+ old.replaceWith(ref.value);
29
+ return ref.value;
30
+ };
25
31
  }
26
32
  return el;
27
33
  }
@@ -92,7 +98,7 @@ const jsxs = jsx;
92
98
  * ## About
93
99
  * @package @ktjs/jsx
94
100
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
95
- * @version 0.6.17 (Last Update: 2025.12.24 22:17:37.131)
101
+ * @version 0.7.0 (Last Update: 2025.12.25 09:28:19.120)
96
102
  * @license MIT
97
103
  * @link https://github.com/baendlorel/kt.js
98
104
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -101,7 +107,7 @@ const jsxs = jsx;
101
107
  */
102
108
  // Export JSX runtime functions
103
109
  function ref() {
104
- return { value: null };
110
+ return {};
105
111
  }
106
112
 
107
113
  export { Fragment, jsx, jsxDEV, jsxs, ref };
@@ -23,6 +23,12 @@ function jsx(tag, props, ..._metadata) {
23
23
  const el = core.h(tag, propObj, children);
24
24
  if (hasRef) {
25
25
  ref.value = el;
26
+ ref.update = () => {
27
+ const old = ref.value;
28
+ ref.value = core.h(tag, propObj, children);
29
+ old.replaceWith(ref.value);
30
+ return ref.value;
31
+ };
26
32
  }
27
33
  return el;
28
34
  }
@@ -22,6 +22,12 @@ function jsx(tag, props, ..._metadata) {
22
22
  const el = h(tag, propObj, children);
23
23
  if (hasRef) {
24
24
  ref.value = el;
25
+ ref.update = () => {
26
+ const old = ref.value;
27
+ ref.value = h(tag, propObj, children);
28
+ old.replaceWith(ref.value);
29
+ return ref.value;
30
+ };
25
31
  }
26
32
  return el;
27
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/jsx",
3
- "version": "0.6.17",
3
+ "version": "0.7.0",
4
4
  "description": "JSX/TSX support for KT.js - Build UIs with JSX syntax while keeping direct DOM control",
5
5
  "author": {
6
6
  "name": "Kasukabe Tsumugi",
@@ -51,10 +51,10 @@
51
51
  "directory": "packages/jsx"
52
52
  },
53
53
  "peerDependencies": {
54
- "@ktjs/core": "0.6.17"
54
+ "@ktjs/core": "0.7.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@ktjs/core": "0.6.17"
57
+ "@ktjs/core": "0.7.0"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "rollup -c rollup.config.mjs",