@ktjs/jsx 0.6.5 → 0.6.8
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 +1 -1
- package/dist/index.d.ts +37 -1
- package/dist/index.mjs +1 -1
- package/dist/jsx-runtime.cjs +5 -1
- package/dist/jsx-runtime.mjs +5 -1
- package/package.json +8 -8
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;
|
|
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
|
-
|
|
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.8 (Last Update: 2025.12.24 17:31:41.751)
|
|
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;
|
|
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};
|
package/dist/jsx-runtime.cjs
CHANGED
|
@@ -14,7 +14,11 @@ function jsx(tag, props, ..._metadata) {
|
|
|
14
14
|
}
|
|
15
15
|
const children = propObj.children;
|
|
16
16
|
delete propObj.children;
|
|
17
|
-
|
|
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
|
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -13,7 +13,11 @@ function jsx(tag, props, ..._metadata) {
|
|
|
13
13
|
}
|
|
14
14
|
const children = propObj.children;
|
|
15
15
|
delete propObj.children;
|
|
16
|
-
|
|
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.
|
|
3
|
+
"version": "0.6.8",
|
|
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",
|
|
@@ -37,12 +37,6 @@
|
|
|
37
37
|
"README.md",
|
|
38
38
|
"LICENSE"
|
|
39
39
|
],
|
|
40
|
-
"scripts": {
|
|
41
|
-
"build": "rollup -c rollup.config.mjs",
|
|
42
|
-
"dev": "rollup -c rollup.config.mjs -w",
|
|
43
|
-
"check": "tsc --noEmit",
|
|
44
|
-
"test": "vitest"
|
|
45
|
-
},
|
|
46
40
|
"keywords": [
|
|
47
41
|
"ktjs",
|
|
48
42
|
"jsx",
|
|
@@ -60,6 +54,12 @@
|
|
|
60
54
|
"@ktjs/core": "^0.5.0"
|
|
61
55
|
},
|
|
62
56
|
"devDependencies": {
|
|
63
|
-
"@ktjs/core": "
|
|
57
|
+
"@ktjs/core": "0.6.6"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "rollup -c rollup.config.mjs",
|
|
61
|
+
"dev": "rollup -c rollup.config.mjs -w",
|
|
62
|
+
"check": "tsc --noEmit",
|
|
63
|
+
"test": "vitest"
|
|
64
64
|
}
|
|
65
65
|
}
|