@ktjs/jsx 0.6.15 → 0.6.16
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 +9 -9
- package/dist/index.cjs +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +5 -3
- package/dist/jsx-runtime.cjs +4 -2
- package/dist/jsx-runtime.mjs +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Write UI code with JSX syntax while maintaining KT.js's philosophy of direct DOM
|
|
|
14
14
|
- 🎯 **Direct DOM Manipulation**: JSX compiles to direct `h()` calls, no virtual DOM
|
|
15
15
|
- 🔧 **Full TypeScript Support**: Complete type safety with IntelliSense
|
|
16
16
|
- ⚡ **Zero Runtime Overhead**: JSX is pure syntax sugar over KT.js's `h` function
|
|
17
|
-
- 🎨 **Event Handler Syntax**: Support for both function props and
|
|
17
|
+
- 🎨 **Event Handler Syntax**: Support for both function props and `on:eventName` syntax
|
|
18
18
|
- 📦 **Multiple Runtime Modes**: Support both automatic and classic JSX transforms
|
|
19
19
|
- 🔌 **Easy Integration**: Works with Babel, TypeScript, and modern build tools
|
|
20
20
|
|
|
@@ -67,7 +67,7 @@ const greeting = <div class="greeting">Hello, KT.js!</div>;
|
|
|
67
67
|
const button = (
|
|
68
68
|
<button
|
|
69
69
|
class="btn primary"
|
|
70
|
-
|
|
70
|
+
on:click={() => alert('Clicked!')}
|
|
71
71
|
>
|
|
72
72
|
Click me
|
|
73
73
|
</button>
|
|
@@ -97,13 +97,13 @@ You can use event handlers in two ways:
|
|
|
97
97
|
// 1. Function props (automatically converted to event listeners)
|
|
98
98
|
<button click={() => console.log('clicked')}>Button 1</button>
|
|
99
99
|
|
|
100
|
-
// 2.
|
|
101
|
-
<button
|
|
100
|
+
// 2. on:-prefixed attributes (explicit event handlers)
|
|
101
|
+
<button on:click={(e) => console.log('clicked', e)}>Button 2</button>
|
|
102
102
|
|
|
103
103
|
// 3. Mix both (regular attribute + event listener)
|
|
104
104
|
<input
|
|
105
105
|
change="change-value" // Regular attribute
|
|
106
|
-
|
|
106
|
+
on:change={(e) => console.log(e)} // Event listener
|
|
107
107
|
/>
|
|
108
108
|
```
|
|
109
109
|
|
|
@@ -240,7 +240,7 @@ const buttonStyle = css`
|
|
|
240
240
|
`;
|
|
241
241
|
|
|
242
242
|
const button = (
|
|
243
|
-
<button class={buttonStyle}
|
|
243
|
+
<button class={buttonStyle} on:click={() => alert('Styled!')}>
|
|
244
244
|
Styled Button
|
|
245
245
|
</button>
|
|
246
246
|
);
|
|
@@ -263,7 +263,7 @@ function Card({ title, content, onClose }: CardProps) {
|
|
|
263
263
|
<div class="card-header">
|
|
264
264
|
<h3>{title}</h3>
|
|
265
265
|
{onClose && (
|
|
266
|
-
<button class="close"
|
|
266
|
+
<button class="close" on:click={onClose}>×</button>
|
|
267
267
|
)}
|
|
268
268
|
</div>
|
|
269
269
|
<div class="card-body">
|
|
@@ -336,7 +336,7 @@ declare global {
|
|
|
336
336
|
const app = (
|
|
337
337
|
<div class="container">
|
|
338
338
|
<h1>Hello</h1>
|
|
339
|
-
<button
|
|
339
|
+
<button on:click={() => alert('Hi')}>Click</button>
|
|
340
340
|
</div>
|
|
341
341
|
);
|
|
342
342
|
|
|
@@ -345,7 +345,7 @@ import { h, div, button } from '@ktjs/core';
|
|
|
345
345
|
|
|
346
346
|
const app = div({ class: 'container' }, [
|
|
347
347
|
h('h1', {}, 'Hello'),
|
|
348
|
-
button({ '
|
|
348
|
+
button({ 'on:click': () => alert('Hi') }, 'Click')
|
|
349
349
|
]);
|
|
350
350
|
```
|
|
351
351
|
|
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,6 @@ var core = require('@ktjs/core');
|
|
|
8
8
|
* @param _metadata metadata is ignored
|
|
9
9
|
*/
|
|
10
10
|
function jsx(tag, props, ..._metadata) {
|
|
11
|
-
console.log('JSX runtime called:', tag, props, _metadata);
|
|
12
11
|
const propObj = typeof props === 'string' ? { class: props } : props;
|
|
13
12
|
if (propObj === undefined || propObj === null) {
|
|
14
13
|
return core.h(tag);
|
|
@@ -60,7 +59,10 @@ function Fragment(props) {
|
|
|
60
59
|
/**
|
|
61
60
|
* JSX Development runtime - same as jsx but with additional dev checks
|
|
62
61
|
*/
|
|
63
|
-
const jsxDEV =
|
|
62
|
+
const jsxDEV = (...args) => {
|
|
63
|
+
console.log('JSX runtime called:', ...args);
|
|
64
|
+
return jsx(...args);
|
|
65
|
+
};
|
|
64
66
|
/**
|
|
65
67
|
* JSX runtime for React 17+ automatic runtime
|
|
66
68
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
@@ -91,7 +93,7 @@ const jsxs = jsx;
|
|
|
91
93
|
* ## About
|
|
92
94
|
* @package @ktjs/jsx
|
|
93
95
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
94
|
-
* @version 0.6.
|
|
96
|
+
* @version 0.6.16 (Last Update: 2025.12.24 22:11:08.516)
|
|
95
97
|
* @license MIT
|
|
96
98
|
* @link https://github.com/baendlorel/kt.js
|
|
97
99
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
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.
|
|
71
|
+
* @version 0.6.16 (Last Update: 2025.12.24 22:11:08.516)
|
|
72
72
|
* @license MIT
|
|
73
73
|
* @link https://github.com/baendlorel/kt.js
|
|
74
74
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,6 @@ export { h as createElement, h } from '@ktjs/core';
|
|
|
7
7
|
* @param _metadata metadata is ignored
|
|
8
8
|
*/
|
|
9
9
|
function jsx(tag, props, ..._metadata) {
|
|
10
|
-
console.log('JSX runtime called:', tag, props, _metadata);
|
|
11
10
|
const propObj = typeof props === 'string' ? { class: props } : props;
|
|
12
11
|
if (propObj === undefined || propObj === null) {
|
|
13
12
|
return h(tag);
|
|
@@ -59,7 +58,10 @@ function Fragment(props) {
|
|
|
59
58
|
/**
|
|
60
59
|
* JSX Development runtime - same as jsx but with additional dev checks
|
|
61
60
|
*/
|
|
62
|
-
const jsxDEV =
|
|
61
|
+
const jsxDEV = (...args) => {
|
|
62
|
+
console.log('JSX runtime called:', ...args);
|
|
63
|
+
return jsx(...args);
|
|
64
|
+
};
|
|
63
65
|
/**
|
|
64
66
|
* JSX runtime for React 17+ automatic runtime
|
|
65
67
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
@@ -90,7 +92,7 @@ const jsxs = jsx;
|
|
|
90
92
|
* ## About
|
|
91
93
|
* @package @ktjs/jsx
|
|
92
94
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
93
|
-
* @version 0.6.
|
|
95
|
+
* @version 0.6.16 (Last Update: 2025.12.24 22:11:08.516)
|
|
94
96
|
* @license MIT
|
|
95
97
|
* @link https://github.com/baendlorel/kt.js
|
|
96
98
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/dist/jsx-runtime.cjs
CHANGED
|
@@ -8,7 +8,6 @@ var core = require('@ktjs/core');
|
|
|
8
8
|
* @param _metadata metadata is ignored
|
|
9
9
|
*/
|
|
10
10
|
function jsx(tag, props, ..._metadata) {
|
|
11
|
-
console.log('JSX runtime called:', tag, props, _metadata);
|
|
12
11
|
const propObj = typeof props === 'string' ? { class: props } : props;
|
|
13
12
|
if (propObj === undefined || propObj === null) {
|
|
14
13
|
return core.h(tag);
|
|
@@ -60,7 +59,10 @@ function Fragment(props) {
|
|
|
60
59
|
/**
|
|
61
60
|
* JSX Development runtime - same as jsx but with additional dev checks
|
|
62
61
|
*/
|
|
63
|
-
const jsxDEV =
|
|
62
|
+
const jsxDEV = (...args) => {
|
|
63
|
+
console.log('JSX runtime called:', ...args);
|
|
64
|
+
return jsx(...args);
|
|
65
|
+
};
|
|
64
66
|
/**
|
|
65
67
|
* JSX runtime for React 17+ automatic runtime
|
|
66
68
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
package/dist/jsx-runtime.mjs
CHANGED
|
@@ -7,7 +7,6 @@ export { h as createElement, h } from '@ktjs/core';
|
|
|
7
7
|
* @param _metadata metadata is ignored
|
|
8
8
|
*/
|
|
9
9
|
function jsx(tag, props, ..._metadata) {
|
|
10
|
-
console.log('JSX runtime called:', tag, props, _metadata);
|
|
11
10
|
const propObj = typeof props === 'string' ? { class: props } : props;
|
|
12
11
|
if (propObj === undefined || propObj === null) {
|
|
13
12
|
return h(tag);
|
|
@@ -59,7 +58,10 @@ function Fragment(props) {
|
|
|
59
58
|
/**
|
|
60
59
|
* JSX Development runtime - same as jsx but with additional dev checks
|
|
61
60
|
*/
|
|
62
|
-
const jsxDEV =
|
|
61
|
+
const jsxDEV = (...args) => {
|
|
62
|
+
console.log('JSX runtime called:', ...args);
|
|
63
|
+
return jsx(...args);
|
|
64
|
+
};
|
|
63
65
|
/**
|
|
64
66
|
* JSX runtime for React 17+ automatic runtime
|
|
65
67
|
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|