@ktjs/jsx 0.6.6 → 0.6.9

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
@@ -1 +1 @@
1
- "use strict";var e=require("@ktjs/core");function t(t,n,...r){const o="string"==typeof n?{class:n}:n;if(null==o)return e.h(t);const s=o.children;return delete o.children,e.h(t,o,s)}const n=t,r=t;Object.defineProperty(exports,"createElement",{enumerable:!0,get:function(){return e.h}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return e.h}}),exports.Fragment=function(e){window.__ktjs__.throws("kt.js doesn't have a Fragment concept")},exports.jsx=t,exports.jsxDEV=n,exports.jsxs=r;
1
+ "use strict";var e=require("@ktjs/core");function t(t,n,...r){const o="string"==typeof n?{class:n}:n;if(null==o)return e.h(t);const s=o.children;delete o.children;const c=e.h(t,o,s);return"ref"in o&&"object"==typeof o.ref&&null!==o.ref&&(o.ref.value=c),c}const n=t,r=t;Object.defineProperty(exports,"createElement",{enumerable:!0,get:function(){return e.h}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return e.h}}),exports.Fragment=function(e){window.__ktjs__.throws("kt.js doesn't have a Fragment concept")},exports.jsx=t,exports.jsxDEV=n,exports.jsxs=r,exports.ref=function(){return{value:null}};
package/dist/index.d.ts CHANGED
@@ -44,4 +44,40 @@ declare global {
44
44
  }
45
45
  }
46
46
 
47
- export { Fragment, jsx, jsxDEV, jsxs };
47
+ /**
48
+ * @ktjs/jsx - JSX/TSX support for KT.js
49
+ *
50
+ * This package provides JSX transformation support for KT.js,
51
+ * allowing you to write UI code with JSX syntax while maintaining
52
+ * the direct DOM manipulation philosophy of KT.js.
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * import { h } from '@ktjs/jsx';
57
+ *
58
+ * const App = (
59
+ * <div class="app">
60
+ * <h1>Hello KT.js with JSX!</h1>
61
+ * <button @click={() => alert('Clicked!')}>
62
+ * Click me
63
+ * </button>
64
+ * </div>
65
+ * );
66
+ * ```
67
+ *
68
+ * ## About
69
+ * @package @ktjs/jsx
70
+ * @author Kasukabe Tsumugi <futami16237@gmail.com>
71
+ * @version 0.6.9 (Last Update: 2025.12.24 17:36:14.916)
72
+ * @license MIT
73
+ * @link https://github.com/baendlorel/kt.js
74
+ * @link https://baendlorel.github.io/ Welcome to my site!
75
+ * @description JSX/TSX support for KT.js - Build UIs with JSX syntax while keeping direct DOM control
76
+ * @copyright Copyright (c) 2025 Kasukabe Tsumugi. All rights reserved.
77
+ */
78
+
79
+ declare function ref<T extends HTMLElement>(): {
80
+ value: T;
81
+ };
82
+
83
+ export { Fragment, jsx, jsxDEV, jsxs, ref };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{h as t}from"@ktjs/core";export{h as createElement,h}from"@ktjs/core";function e(e,n,...o){const r="string"==typeof n?{class:n}:n;if(null==r)return t(e);const c=r.children;return delete r.children,t(e,r,c)}function n(t){window.__ktjs__.throws("kt.js doesn't have a Fragment concept")}const o=e,r=e;export{n as Fragment,e as jsx,o as jsxDEV,r as jsxs};
1
+ import{h as t}from"@ktjs/core";export{h as createElement,h}from"@ktjs/core";function e(e,n,...o){const r="string"==typeof n?{class:n}:n;if(null==r)return t(e);const c=r.children;delete r.children;const s=t(e,r,c);return"ref"in r&&"object"==typeof r.ref&&null!==r.ref&&(r.ref.value=s),s}function n(t){window.__ktjs__.throws("kt.js doesn't have a Fragment concept")}const o=e,r=e;function c(){return{value:null}}export{n as Fragment,e as jsx,o as jsxDEV,r as jsxs,c as ref};
@@ -14,7 +14,11 @@ function jsx(tag, props, ..._metadata) {
14
14
  }
15
15
  const children = propObj.children;
16
16
  delete propObj.children;
17
- return core.h(tag, propObj, children);
17
+ const el = core.h(tag, propObj, children);
18
+ if ('ref' in propObj && typeof propObj.ref === 'object' && propObj.ref !== null) {
19
+ propObj.ref.value = el;
20
+ }
21
+ return el;
18
22
  }
19
23
  /**
20
24
  * Fragment support - returns an array of children
@@ -13,7 +13,11 @@ function jsx(tag, props, ..._metadata) {
13
13
  }
14
14
  const children = propObj.children;
15
15
  delete propObj.children;
16
- return h(tag, propObj, children);
16
+ const el = h(tag, propObj, children);
17
+ if ('ref' in propObj && typeof propObj.ref === 'object' && propObj.ref !== null) {
18
+ propObj.ref.value = el;
19
+ }
20
+ return el;
17
21
  }
18
22
  /**
19
23
  * Fragment support - returns an array of children
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/jsx",
3
- "version": "0.6.6",
3
+ "version": "0.6.9",
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,7 +51,7 @@
51
51
  "directory": "packages/jsx"
52
52
  },
53
53
  "peerDependencies": {
54
- "@ktjs/core": "^0.5.0"
54
+ "@ktjs/core": "0.6.6"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@ktjs/core": "0.6.6"