@ktjs/core 0.18.0 → 0.18.2
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 +5 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.iife.js +6 -7
- package/dist/index.legacy.js +6 -7
- package/dist/index.mjs +6 -7
- package/dist/jsx/index.d.ts +2 -2
- package/dist/jsx/index.mjs +6 -7
- package/dist/jsx/jsx-runtime.d.ts +2 -2
- package/dist/jsx/jsx-runtime.mjs +6 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Core DOM manipulation utilities for KT.js framework with built-in JSX/TSX suppor
|
|
|
12
12
|
|
|
13
13
|
`@ktjs/core` is the foundation of KT.js, providing the essential `h` function and DOM utilities for building web applications with direct DOM manipulation. It emphasizes performance, type safety, and minimal abstraction over native DOM APIs.
|
|
14
14
|
|
|
15
|
-
**Current Version:** 0.
|
|
15
|
+
**Current Version:** 0.18.1
|
|
16
16
|
|
|
17
17
|
## Features
|
|
18
18
|
|
|
@@ -42,6 +42,10 @@ Core DOM manipulation utilities for KT.js framework with built-in JSX/TSX suppor
|
|
|
42
42
|
- Update props and children selectively
|
|
43
43
|
- Efficient replacement strategy
|
|
44
44
|
- Works with both native elements and function components
|
|
45
|
+
- **Ref Enhancement**: Change event binding support for `ref` (v0.18.1)
|
|
46
|
+
- New methods `addOnChange` and `removeOnChange` for listening to value changes
|
|
47
|
+
- Automatically calls registered callbacks when `ref.value` is updated
|
|
48
|
+
- When both old and new values are DOM nodes, automatically replaces old node with new one in the DOM
|
|
45
49
|
- **DOM Utilities**: Helper functions for common DOM operations
|
|
46
50
|
- Native method caching for performance
|
|
47
51
|
- Symbol-based private properties for internal state
|
package/dist/index.d.ts
CHANGED
|
@@ -178,7 +178,7 @@ type HTML<T extends (HTMLTag | SVGTag) & otherstring> = T extends SVGTag ? SVGEl
|
|
|
178
178
|
* ## About
|
|
179
179
|
* @package @ktjs/core
|
|
180
180
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
181
|
-
* @version 0.18.
|
|
181
|
+
* @version 0.18.2 (Last Update: 2026.01.30 22:52:42.408)
|
|
182
182
|
* @license MIT
|
|
183
183
|
* @link https://github.com/baendlorel/kt.js
|
|
184
184
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -197,7 +197,7 @@ declare function jsx(tag: JSXTag, props?: KTAttribute): KTHTMLElement;
|
|
|
197
197
|
* Fragment support - returns an array of children
|
|
198
198
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
199
199
|
*/
|
|
200
|
-
declare function Fragment(
|
|
200
|
+
declare function Fragment(_props: {
|
|
201
201
|
children?: KTRawContent;
|
|
202
202
|
}): HTMLElement;
|
|
203
203
|
/**
|
package/dist/index.iife.js
CHANGED
|
@@ -215,7 +215,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
215
215
|
* ## About
|
|
216
216
|
* @package @ktjs/core
|
|
217
217
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
218
|
-
* @version 0.18.
|
|
218
|
+
* @version 0.18.2 (Last Update: 2026.01.30 22:52:42.408)
|
|
219
219
|
* @license MIT
|
|
220
220
|
* @link https://github.com/baendlorel/kt.js
|
|
221
221
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -291,9 +291,10 @@ var __ktjs_core__ = (function (exports) {
|
|
|
291
291
|
let el;
|
|
292
292
|
const redraw = (newProps) => {
|
|
293
293
|
props = newProps ? { ...props, ...newProps } : props;
|
|
294
|
-
const old = el;
|
|
295
294
|
el = jsx(tag, props);
|
|
296
|
-
|
|
295
|
+
if (ref !== dummyRef) {
|
|
296
|
+
ref.value = el; // ref setter automatically replaces old element in DOM
|
|
297
|
+
}
|
|
297
298
|
return el;
|
|
298
299
|
};
|
|
299
300
|
if ('k-if' in props && !props['k-if']) {
|
|
@@ -317,7 +318,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
317
318
|
* Fragment support - returns an array of children
|
|
318
319
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
319
320
|
*/
|
|
320
|
-
function Fragment(
|
|
321
|
+
function Fragment(_props) {
|
|
321
322
|
throw new Error("kt.js doesn't have a Fragment concept");
|
|
322
323
|
// const { children } = props ?? {};
|
|
323
324
|
// if (!children) {
|
|
@@ -397,9 +398,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
397
398
|
const elRef = ref();
|
|
398
399
|
elRef.value = creator();
|
|
399
400
|
const redraw = () => {
|
|
400
|
-
|
|
401
|
-
elRef.value = creator();
|
|
402
|
-
old.replaceWith(elRef.value);
|
|
401
|
+
elRef.value = creator(); // ref setter automatically calls replaceWith
|
|
403
402
|
elRef.value.redraw = redraw;
|
|
404
403
|
return elRef.value;
|
|
405
404
|
};
|
package/dist/index.legacy.js
CHANGED
|
@@ -240,7 +240,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
240
240
|
* ## About
|
|
241
241
|
* @package @ktjs/core
|
|
242
242
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
243
|
-
* @version 0.18.
|
|
243
|
+
* @version 0.18.2 (Last Update: 2026.01.30 22:52:42.408)
|
|
244
244
|
* @license MIT
|
|
245
245
|
* @link https://github.com/baendlorel/kt.js
|
|
246
246
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -351,9 +351,10 @@ var __ktjs_core__ = (function (exports) {
|
|
|
351
351
|
var el;
|
|
352
352
|
var redraw = function (newProps) {
|
|
353
353
|
props = newProps ? __assign(__assign({}, props), newProps) : props;
|
|
354
|
-
var old = el;
|
|
355
354
|
el = jsx(tag, props);
|
|
356
|
-
|
|
355
|
+
if (ref !== dummyRef) {
|
|
356
|
+
ref.value = el; // ref setter automatically replaces old element in DOM
|
|
357
|
+
}
|
|
357
358
|
return el;
|
|
358
359
|
};
|
|
359
360
|
if ('k-if' in props && !props['k-if']) {
|
|
@@ -377,7 +378,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
377
378
|
* Fragment support - returns an array of children
|
|
378
379
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
379
380
|
*/
|
|
380
|
-
function Fragment(
|
|
381
|
+
function Fragment(_props) {
|
|
381
382
|
throw new Error("kt.js doesn't have a Fragment concept");
|
|
382
383
|
// const { children } = props ?? {};
|
|
383
384
|
// if (!children) {
|
|
@@ -461,9 +462,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
461
462
|
var elRef = ref();
|
|
462
463
|
elRef.value = creator();
|
|
463
464
|
var redraw = function () {
|
|
464
|
-
|
|
465
|
-
elRef.value = creator();
|
|
466
|
-
old.replaceWith(elRef.value);
|
|
465
|
+
elRef.value = creator(); // ref setter automatically calls replaceWith
|
|
467
466
|
elRef.value.redraw = redraw;
|
|
468
467
|
return elRef.value;
|
|
469
468
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -212,7 +212,7 @@ const svgTempWrapper = document.createElement('div');
|
|
|
212
212
|
* ## About
|
|
213
213
|
* @package @ktjs/core
|
|
214
214
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
215
|
-
* @version 0.18.
|
|
215
|
+
* @version 0.18.2 (Last Update: 2026.01.30 22:52:42.408)
|
|
216
216
|
* @license MIT
|
|
217
217
|
* @link https://github.com/baendlorel/kt.js
|
|
218
218
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -288,9 +288,10 @@ function jsx(tag, props = {}) {
|
|
|
288
288
|
let el;
|
|
289
289
|
const redraw = (newProps) => {
|
|
290
290
|
props = newProps ? { ...props, ...newProps } : props;
|
|
291
|
-
const old = el;
|
|
292
291
|
el = jsx(tag, props);
|
|
293
|
-
|
|
292
|
+
if (ref !== dummyRef) {
|
|
293
|
+
ref.value = el; // ref setter automatically replaces old element in DOM
|
|
294
|
+
}
|
|
294
295
|
return el;
|
|
295
296
|
};
|
|
296
297
|
if ('k-if' in props && !props['k-if']) {
|
|
@@ -314,7 +315,7 @@ function jsx(tag, props = {}) {
|
|
|
314
315
|
* Fragment support - returns an array of children
|
|
315
316
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
316
317
|
*/
|
|
317
|
-
function Fragment(
|
|
318
|
+
function Fragment(_props) {
|
|
318
319
|
throw new Error("kt.js doesn't have a Fragment concept");
|
|
319
320
|
// const { children } = props ?? {};
|
|
320
321
|
// if (!children) {
|
|
@@ -394,9 +395,7 @@ function createRedrawable(creator) {
|
|
|
394
395
|
const elRef = ref();
|
|
395
396
|
elRef.value = creator();
|
|
396
397
|
const redraw = () => {
|
|
397
|
-
|
|
398
|
-
elRef.value = creator();
|
|
399
|
-
old.replaceWith(elRef.value);
|
|
398
|
+
elRef.value = creator(); // ref setter automatically calls replaceWith
|
|
400
399
|
elRef.value.redraw = redraw;
|
|
401
400
|
return elRef.value;
|
|
402
401
|
};
|
package/dist/jsx/index.d.ts
CHANGED
|
@@ -164,7 +164,7 @@ type HTML<T extends (HTMLTag | SVGTag) & otherstring> = T extends SVGTag ? SVGEl
|
|
|
164
164
|
* ## About
|
|
165
165
|
* @package @ktjs/core
|
|
166
166
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
167
|
-
* @version 0.18.
|
|
167
|
+
* @version 0.18.2 (Last Update: 2026.01.30 22:52:42.408)
|
|
168
168
|
* @license MIT
|
|
169
169
|
* @link https://github.com/baendlorel/kt.js
|
|
170
170
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -183,7 +183,7 @@ declare function jsx(tag: JSXTag, props?: KTAttribute): KTHTMLElement;
|
|
|
183
183
|
* Fragment support - returns an array of children
|
|
184
184
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
185
185
|
*/
|
|
186
|
-
declare function Fragment(
|
|
186
|
+
declare function Fragment(_props: {
|
|
187
187
|
children?: KTRawContent;
|
|
188
188
|
}): HTMLElement;
|
|
189
189
|
/**
|
package/dist/jsx/index.mjs
CHANGED
|
@@ -212,7 +212,7 @@ const svgTempWrapper = document.createElement('div');
|
|
|
212
212
|
* ## About
|
|
213
213
|
* @package @ktjs/core
|
|
214
214
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
215
|
-
* @version 0.18.
|
|
215
|
+
* @version 0.18.2 (Last Update: 2026.01.30 22:52:42.408)
|
|
216
216
|
* @license MIT
|
|
217
217
|
* @link https://github.com/baendlorel/kt.js
|
|
218
218
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -288,9 +288,10 @@ function jsx(tag, props = {}) {
|
|
|
288
288
|
let el;
|
|
289
289
|
const redraw = (newProps) => {
|
|
290
290
|
props = newProps ? { ...props, ...newProps } : props;
|
|
291
|
-
const old = el;
|
|
292
291
|
el = jsx(tag, props);
|
|
293
|
-
|
|
292
|
+
if (ref !== dummyRef) {
|
|
293
|
+
ref.value = el; // ref setter automatically replaces old element in DOM
|
|
294
|
+
}
|
|
294
295
|
return el;
|
|
295
296
|
};
|
|
296
297
|
if ('k-if' in props && !props['k-if']) {
|
|
@@ -314,7 +315,7 @@ function jsx(tag, props = {}) {
|
|
|
314
315
|
* Fragment support - returns an array of children
|
|
315
316
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
316
317
|
*/
|
|
317
|
-
function Fragment(
|
|
318
|
+
function Fragment(_props) {
|
|
318
319
|
throw new Error("kt.js doesn't have a Fragment concept");
|
|
319
320
|
// const { children } = props ?? {};
|
|
320
321
|
// if (!children) {
|
|
@@ -394,9 +395,7 @@ function createRedrawable(creator) {
|
|
|
394
395
|
const elRef = ref();
|
|
395
396
|
elRef.value = creator();
|
|
396
397
|
const redraw = () => {
|
|
397
|
-
|
|
398
|
-
elRef.value = creator();
|
|
399
|
-
old.replaceWith(elRef.value);
|
|
398
|
+
elRef.value = creator(); // ref setter automatically calls replaceWith
|
|
400
399
|
elRef.value.redraw = redraw;
|
|
401
400
|
return elRef.value;
|
|
402
401
|
};
|
|
@@ -158,7 +158,7 @@ type HTML<T extends (HTMLTag | SVGTag) & otherstring> = T extends SVGTag ? SVGEl
|
|
|
158
158
|
* ## About
|
|
159
159
|
* @package @ktjs/core
|
|
160
160
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
161
|
-
* @version 0.18.
|
|
161
|
+
* @version 0.18.2 (Last Update: 2026.01.30 22:52:42.408)
|
|
162
162
|
* @license MIT
|
|
163
163
|
* @link https://github.com/baendlorel/kt.js
|
|
164
164
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -177,7 +177,7 @@ declare function jsx(tag: JSXTag, props?: KTAttribute): KTHTMLElement;
|
|
|
177
177
|
* Fragment support - returns an array of children
|
|
178
178
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
179
179
|
*/
|
|
180
|
-
declare function Fragment(
|
|
180
|
+
declare function Fragment(_props: {
|
|
181
181
|
children?: KTRawContent;
|
|
182
182
|
}): HTMLElement;
|
|
183
183
|
/**
|
package/dist/jsx/jsx-runtime.mjs
CHANGED
|
@@ -212,7 +212,7 @@ const svgTempWrapper = document.createElement('div');
|
|
|
212
212
|
* ## About
|
|
213
213
|
* @package @ktjs/core
|
|
214
214
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
215
|
-
* @version 0.18.
|
|
215
|
+
* @version 0.18.2 (Last Update: 2026.01.30 22:52:42.408)
|
|
216
216
|
* @license MIT
|
|
217
217
|
* @link https://github.com/baendlorel/kt.js
|
|
218
218
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -288,9 +288,10 @@ function jsx(tag, props = {}) {
|
|
|
288
288
|
let el;
|
|
289
289
|
const redraw = (newProps) => {
|
|
290
290
|
props = newProps ? { ...props, ...newProps } : props;
|
|
291
|
-
const old = el;
|
|
292
291
|
el = jsx(tag, props);
|
|
293
|
-
|
|
292
|
+
if (ref !== dummyRef) {
|
|
293
|
+
ref.value = el; // ref setter automatically replaces old element in DOM
|
|
294
|
+
}
|
|
294
295
|
return el;
|
|
295
296
|
};
|
|
296
297
|
if ('k-if' in props && !props['k-if']) {
|
|
@@ -314,7 +315,7 @@ function jsx(tag, props = {}) {
|
|
|
314
315
|
* Fragment support - returns an array of children
|
|
315
316
|
* Note: kt.js doesn't have a real Fragment concept,
|
|
316
317
|
*/
|
|
317
|
-
function Fragment(
|
|
318
|
+
function Fragment(_props) {
|
|
318
319
|
throw new Error("kt.js doesn't have a Fragment concept");
|
|
319
320
|
// const { children } = props ?? {};
|
|
320
321
|
// if (!children) {
|
|
@@ -394,9 +395,7 @@ function createRedrawable(creator) {
|
|
|
394
395
|
const elRef = ref();
|
|
395
396
|
elRef.value = creator();
|
|
396
397
|
const redraw = () => {
|
|
397
|
-
|
|
398
|
-
elRef.value = creator();
|
|
399
|
-
old.replaceWith(elRef.value);
|
|
398
|
+
elRef.value = creator(); // ref setter automatically calls replaceWith
|
|
400
399
|
elRef.value.redraw = redraw;
|
|
401
400
|
return elRef.value;
|
|
402
401
|
};
|