@ktjs/core 0.24.3 → 0.25.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.d.ts +17 -64
- package/dist/index.iife.js +56 -4
- package/dist/index.legacy.js +56 -4
- package/dist/index.mjs +56 -5
- package/dist/jsx/index.d.ts +2 -63
- package/dist/jsx/index.mjs +4 -4
- package/dist/jsx/jsx-runtime.d.ts +1 -1
- package/dist/jsx/jsx-runtime.mjs +4 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,20 @@ declare class KTComputed<T> {
|
|
|
40
40
|
*/
|
|
41
41
|
declare function computed<T = JSX.Element>(computeFn: () => T, reactives: Array<KTReactive<any>>): KTComputed<T>;
|
|
42
42
|
|
|
43
|
+
interface KTEffectOptions {
|
|
44
|
+
lazy: boolean;
|
|
45
|
+
onCleanup: () => void;
|
|
46
|
+
debugName: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Register a reactive effect with options.
|
|
50
|
+
* @param effectFn The effect function to run when dependencies change
|
|
51
|
+
* @param reactives The reactive dependencies
|
|
52
|
+
* @param options Effect options: lazy, onCleanup, debugName
|
|
53
|
+
* @returns stop function to remove all listeners
|
|
54
|
+
*/
|
|
55
|
+
declare function effect(effectFn: () => void, reactives: Array<KTReactive<any>>, options?: Partial<KTEffectOptions>): () => void;
|
|
56
|
+
|
|
43
57
|
type KTReactive<T> = KTRef<T> | KTComputed<T>;
|
|
44
58
|
declare const toReactive: <T>(value: T | KTReactive<T>, onChange?: ReactiveChangeHandler<T>) => KTReactive<T>;
|
|
45
59
|
|
|
@@ -228,7 +242,7 @@ type KTComponent = (
|
|
|
228
242
|
* ## About
|
|
229
243
|
* @package @ktjs/core
|
|
230
244
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
231
|
-
* @version 0.
|
|
245
|
+
* @version 0.25.0 (Last Update: 2026.02.05 16:20:09.244)
|
|
232
246
|
* @license MIT
|
|
233
247
|
* @link https://github.com/baendlorel/kt.js
|
|
234
248
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -1286,70 +1300,9 @@ declare global {
|
|
|
1286
1300
|
tspan: SVGAttributesMap['tspan'];
|
|
1287
1301
|
use: SVGAttributesMap['use'];
|
|
1288
1302
|
view: SVGAttributesMap['view'];
|
|
1289
|
-
|
|
1290
|
-
// 'svg:svg': AttributesMap['svg'];
|
|
1291
|
-
// 'svg:a': SVGAttributesMap['a'];
|
|
1292
|
-
// 'svg:animate': SVGAttributesMap['animate'];
|
|
1293
|
-
// 'svg:animateMotion': SVGAttributesMap['animateMotion'];
|
|
1294
|
-
// 'svg:animateTransform': SVGAttributesMap['animateTransform'];
|
|
1295
|
-
// 'svg:circle': SVGAttributesMap['circle'];
|
|
1296
|
-
// 'svg:clipPath': SVGAttributesMap['clipPath'];
|
|
1297
|
-
// 'svg:defs': SVGAttributesMap['defs'];
|
|
1298
|
-
// 'svg:desc': SVGAttributesMap['desc'];
|
|
1299
|
-
// 'svg:ellipse': SVGAttributesMap['ellipse'];
|
|
1300
|
-
// 'svg:feBlend': SVGAttributesMap['feBlend'];
|
|
1301
|
-
// 'svg:feColorMatrix': SVGAttributesMap['feColorMatrix'];
|
|
1302
|
-
// 'svg:feComponentTransfer': SVGAttributesMap['feComponentTransfer'];
|
|
1303
|
-
// 'svg:feComposite': SVGAttributesMap['feComposite'];
|
|
1304
|
-
// 'svg:feConvolveMatrix': SVGAttributesMap['feConvolveMatrix'];
|
|
1305
|
-
// 'svg:feDiffuseLighting': SVGAttributesMap['feDiffuseLighting'];
|
|
1306
|
-
// 'svg:feDisplacementMap': SVGAttributesMap['feDisplacementMap'];
|
|
1307
|
-
// 'svg:feDistantLight': SVGAttributesMap['feDistantLight'];
|
|
1308
|
-
// 'svg:feDropShadow': SVGAttributesMap['feDropShadow'];
|
|
1309
|
-
// 'svg:feFlood': SVGAttributesMap['feFlood'];
|
|
1310
|
-
// 'svg:feFuncA': SVGAttributesMap['feFuncA'];
|
|
1311
|
-
// 'svg:feFuncB': SVGAttributesMap['feFuncB'];
|
|
1312
|
-
// 'svg:feFuncG': SVGAttributesMap['feFuncG'];
|
|
1313
|
-
// 'svg:feFuncR': SVGAttributesMap['feFuncR'];
|
|
1314
|
-
// 'svg:feGaussianBlur': SVGAttributesMap['feGaussianBlur'];
|
|
1315
|
-
// 'svg:feImage': SVGAttributesMap['feImage'];
|
|
1316
|
-
// 'svg:feMerge': SVGAttributesMap['feMerge'];
|
|
1317
|
-
// 'svg:feMergeNode': SVGAttributesMap['feMergeNode'];
|
|
1318
|
-
// 'svg:feMorphology': SVGAttributesMap['feMorphology'];
|
|
1319
|
-
// 'svg:feOffset': SVGAttributesMap['feOffset'];
|
|
1320
|
-
// 'svg:fePointLight': SVGAttributesMap['fePointLight'];
|
|
1321
|
-
// 'svg:feSpecularLighting': SVGAttributesMap['feSpecularLighting'];
|
|
1322
|
-
// 'svg:feSpotLight': SVGAttributesMap['feSpotLight'];
|
|
1323
|
-
// 'svg:feTile': SVGAttributesMap['feTile'];
|
|
1324
|
-
// 'svg:feTurbulence': SVGAttributesMap['feTurbulence'];
|
|
1325
|
-
// 'svg:filter': SVGAttributesMap['filter'];
|
|
1326
|
-
// 'svg:foreignObject': SVGAttributesMap['foreignObject'];
|
|
1327
|
-
// 'svg:g': SVGAttributesMap['g'];
|
|
1328
|
-
// 'svg:image': SVGAttributesMap['image'];
|
|
1329
|
-
// 'svg:line': SVGAttributesMap['line'];
|
|
1330
|
-
// 'svg:linearGradient': SVGAttributesMap['linearGradient'];
|
|
1331
|
-
// 'svg:marker': SVGAttributesMap['marker'];
|
|
1332
|
-
// 'svg:mask': SVGAttributesMap['mask'];
|
|
1333
|
-
// 'svg:metadata': SVGAttributesMap['metadata'];
|
|
1334
|
-
// 'svg:mpath': SVGAttributesMap['mpath'];
|
|
1335
|
-
// 'svg:path': SVGAttributesMap['path'];
|
|
1336
|
-
// 'svg:pattern': SVGAttributesMap['pattern'];
|
|
1337
|
-
// 'svg:polygon': SVGAttributesMap['polygon'];
|
|
1338
|
-
// 'svg:polyline': SVGAttributesMap['polyline'];
|
|
1339
|
-
// 'svg:radialGradient': SVGAttributesMap['radialGradient'];
|
|
1340
|
-
// 'svg:rect': SVGAttributesMap['rect'];
|
|
1341
|
-
// 'svg:set': SVGAttributesMap['set'];
|
|
1342
|
-
// 'svg:stop': SVGAttributesMap['stop'];
|
|
1343
|
-
// 'svg:switch': SVGAttributesMap['switch'];
|
|
1344
|
-
// 'svg:symbol': SVGAttributesMap['symbol'];
|
|
1345
|
-
// 'svg:text': SVGAttributesMap['text'];
|
|
1346
|
-
// 'svg:textPath': SVGAttributesMap['textPath'];
|
|
1347
|
-
// 'svg:tspan': SVGAttributesMap['tspan'];
|
|
1348
|
-
// 'svg:use': SVGAttributesMap['use'];
|
|
1349
|
-
// 'svg:view': SVGAttributesMap['view'];
|
|
1350
1303
|
}
|
|
1351
1304
|
|
|
1352
|
-
type IntrinsicAttributes =
|
|
1305
|
+
type IntrinsicAttributes = {
|
|
1353
1306
|
/**
|
|
1354
1307
|
* Make a reference to the created element
|
|
1355
1308
|
*/
|
|
@@ -1407,5 +1360,5 @@ interface KTForProps<T> {
|
|
|
1407
1360
|
*/
|
|
1408
1361
|
declare function KTFor<T>(props: KTForProps<T>): KTForElement;
|
|
1409
1362
|
|
|
1410
|
-
export { $modelOrRef, Fragment, KTAsync, KTComputed, KTFor, KTReactiveType, KTRef, computed, h as createElement, createRedrawable, deref, h, isComputed, isKT, isRef, jsx, jsxDEV, jsxs, ref, surfaceRef, toReactive, toRef };
|
|
1363
|
+
export { $modelOrRef, Fragment, KTAsync, KTComputed, KTFor, KTReactiveType, KTRef, computed, h as createElement, createRedrawable, deref, effect, h, isComputed, isKT, isRef, jsx, jsxDEV, jsxs, ref, surfaceRef, toReactive, toRef };
|
|
1411
1364
|
export type { EventHandler, HTMLTag, InputElementTag, KTAttribute, KTForElement, KTForProps, KTPrefixedEventAttribute, KTRawAttr, KTRawContent, KTRawContents, KTReactive, KTSurfaceRef, MathMLTag, ReactiveChangeHandler, SVGTag };
|
package/dist/index.iife.js
CHANGED
|
@@ -78,6 +78,12 @@ var __ktjs_core__ = (function (exports) {
|
|
|
78
78
|
element.addEventListener(eventName, () => (valueRef.value = element[propName]));
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
// String manipulation utilities
|
|
82
|
+
/**
|
|
83
|
+
* Default empty function
|
|
84
|
+
*/
|
|
85
|
+
const $emptyFn = (() => true);
|
|
86
|
+
|
|
81
87
|
if (typeof Symbol === 'undefined') {
|
|
82
88
|
window.Symbol = function Symbol(description) {
|
|
83
89
|
return `@@SYMBOL_${description || ''}_${$random().toString(36).slice(2)}`;
|
|
@@ -85,7 +91,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
// Shared utilities and cached native methods for kt.js framework
|
|
88
|
-
Object.defineProperty(window, '__ktjs__', { value: '0.22.
|
|
94
|
+
Object.defineProperty(window, '__ktjs__', { value: '0.22.8' });
|
|
89
95
|
|
|
90
96
|
// export const KT_TYPE_REF = 1 as const;
|
|
91
97
|
// export const KT_TYPE_COMPUTED = 2 as const;
|
|
@@ -470,6 +476,51 @@ var __ktjs_core__ = (function (exports) {
|
|
|
470
476
|
return new KTComputed(computeFn, reactives);
|
|
471
477
|
}
|
|
472
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Register a reactive effect with options.
|
|
481
|
+
* @param effectFn The effect function to run when dependencies change
|
|
482
|
+
* @param reactives The reactive dependencies
|
|
483
|
+
* @param options Effect options: lazy, onCleanup, debugName
|
|
484
|
+
* @returns stop function to remove all listeners
|
|
485
|
+
*/
|
|
486
|
+
function effect(effectFn, reactives, options) {
|
|
487
|
+
const { lazy = false, onCleanup = $emptyFn, debugName = '' } = Object(options);
|
|
488
|
+
let active = true;
|
|
489
|
+
const run = () => {
|
|
490
|
+
if (!active) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
// cleanup before rerun
|
|
494
|
+
onCleanup();
|
|
495
|
+
try {
|
|
496
|
+
effectFn();
|
|
497
|
+
}
|
|
498
|
+
catch (err) {
|
|
499
|
+
console.debug('[kt.js debug]','effect error:', debugName, err);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
// subscribe to dependencies
|
|
503
|
+
for (let i = 0; i < reactives.length; i++) {
|
|
504
|
+
reactives[i].addOnChange(run);
|
|
505
|
+
}
|
|
506
|
+
// auto run unless lazy
|
|
507
|
+
if (!lazy) {
|
|
508
|
+
run();
|
|
509
|
+
}
|
|
510
|
+
// stop function
|
|
511
|
+
return () => {
|
|
512
|
+
if (!active) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
active = false;
|
|
516
|
+
for (let i = 0; i < reactives.length; i++) {
|
|
517
|
+
reactives[i].removeOnChange(run);
|
|
518
|
+
}
|
|
519
|
+
// final cleanup
|
|
520
|
+
onCleanup();
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
|
|
473
524
|
const toReactive = (value, onChange) => {
|
|
474
525
|
if (isKT(value)) {
|
|
475
526
|
if (onChange) {
|
|
@@ -484,7 +535,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
484
535
|
|
|
485
536
|
function applyKModel(element, valueRef) {
|
|
486
537
|
if (!isKT(valueRef)) {
|
|
487
|
-
console.warn('[kt.js warn]
|
|
538
|
+
console.warn('[kt.js warn]','k-model value must be a KTRef.');
|
|
488
539
|
return;
|
|
489
540
|
}
|
|
490
541
|
if (element instanceof HTMLInputElement) {
|
|
@@ -502,7 +553,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
502
553
|
applyModel(element, valueRef, 'value', 'input');
|
|
503
554
|
}
|
|
504
555
|
else {
|
|
505
|
-
console.warn('[kt.js warn]
|
|
556
|
+
console.warn('[kt.js warn]','not supported element for k-model:');
|
|
506
557
|
}
|
|
507
558
|
}
|
|
508
559
|
|
|
@@ -520,7 +571,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
520
571
|
* ## About
|
|
521
572
|
* @package @ktjs/core
|
|
522
573
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
523
|
-
* @version 0.
|
|
574
|
+
* @version 0.25.0 (Last Update: 2026.02.05 16:20:09.244)
|
|
524
575
|
* @license MIT
|
|
525
576
|
* @link https://github.com/baendlorel/kt.js
|
|
526
577
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -901,6 +952,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
901
952
|
exports.createElement = h;
|
|
902
953
|
exports.createRedrawable = createRedrawable;
|
|
903
954
|
exports.deref = deref;
|
|
955
|
+
exports.effect = effect;
|
|
904
956
|
exports.h = h;
|
|
905
957
|
exports.isComputed = isComputed;
|
|
906
958
|
exports.isKT = isKT;
|
package/dist/index.legacy.js
CHANGED
|
@@ -78,6 +78,12 @@ var __ktjs_core__ = (function (exports) {
|
|
|
78
78
|
element.addEventListener(eventName, () => (valueRef.value = element[propName]));
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
// String manipulation utilities
|
|
82
|
+
/**
|
|
83
|
+
* Default empty function
|
|
84
|
+
*/
|
|
85
|
+
const $emptyFn = (() => true);
|
|
86
|
+
|
|
81
87
|
if (typeof Symbol === 'undefined') {
|
|
82
88
|
window.Symbol = function Symbol(description) {
|
|
83
89
|
return `@@SYMBOL_${description || ''}_${$random().toString(36).slice(2)}`;
|
|
@@ -85,7 +91,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
// Shared utilities and cached native methods for kt.js framework
|
|
88
|
-
Object.defineProperty(window, '__ktjs__', { value: '0.22.
|
|
94
|
+
Object.defineProperty(window, '__ktjs__', { value: '0.22.8' });
|
|
89
95
|
|
|
90
96
|
// export const KT_TYPE_REF = 1 as const;
|
|
91
97
|
// export const KT_TYPE_COMPUTED = 2 as const;
|
|
@@ -470,6 +476,51 @@ var __ktjs_core__ = (function (exports) {
|
|
|
470
476
|
return new KTComputed(computeFn, reactives);
|
|
471
477
|
}
|
|
472
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Register a reactive effect with options.
|
|
481
|
+
* @param effectFn The effect function to run when dependencies change
|
|
482
|
+
* @param reactives The reactive dependencies
|
|
483
|
+
* @param options Effect options: lazy, onCleanup, debugName
|
|
484
|
+
* @returns stop function to remove all listeners
|
|
485
|
+
*/
|
|
486
|
+
function effect(effectFn, reactives, options) {
|
|
487
|
+
var _a = Object(options), _b = _a.lazy, lazy = _b === void 0 ? false : _b, _c = _a.onCleanup, onCleanup = _c === void 0 ? $emptyFn : _c, _d = _a.debugName, debugName = _d === void 0 ? '' : _d;
|
|
488
|
+
var active = true;
|
|
489
|
+
var run = function () {
|
|
490
|
+
if (!active) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
// cleanup before rerun
|
|
494
|
+
onCleanup();
|
|
495
|
+
try {
|
|
496
|
+
effectFn();
|
|
497
|
+
}
|
|
498
|
+
catch (err) {
|
|
499
|
+
console.debug('[kt.js debug]','effect error:', debugName, err);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
// subscribe to dependencies
|
|
503
|
+
for (var i = 0; i < reactives.length; i++) {
|
|
504
|
+
reactives[i].addOnChange(run);
|
|
505
|
+
}
|
|
506
|
+
// auto run unless lazy
|
|
507
|
+
if (!lazy) {
|
|
508
|
+
run();
|
|
509
|
+
}
|
|
510
|
+
// stop function
|
|
511
|
+
return function () {
|
|
512
|
+
if (!active) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
active = false;
|
|
516
|
+
for (var i = 0; i < reactives.length; i++) {
|
|
517
|
+
reactives[i].removeOnChange(run);
|
|
518
|
+
}
|
|
519
|
+
// final cleanup
|
|
520
|
+
onCleanup();
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
|
|
473
524
|
var toReactive = function (value, onChange) {
|
|
474
525
|
if (isKT(value)) {
|
|
475
526
|
if (onChange) {
|
|
@@ -484,7 +535,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
484
535
|
|
|
485
536
|
function applyKModel(element, valueRef) {
|
|
486
537
|
if (!isKT(valueRef)) {
|
|
487
|
-
console.warn('[kt.js warn]
|
|
538
|
+
console.warn('[kt.js warn]','k-model value must be a KTRef.');
|
|
488
539
|
return;
|
|
489
540
|
}
|
|
490
541
|
if (element instanceof HTMLInputElement) {
|
|
@@ -502,7 +553,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
502
553
|
applyModel(element, valueRef, 'value', 'input');
|
|
503
554
|
}
|
|
504
555
|
else {
|
|
505
|
-
console.warn('[kt.js warn]
|
|
556
|
+
console.warn('[kt.js warn]','not supported element for k-model:');
|
|
506
557
|
}
|
|
507
558
|
}
|
|
508
559
|
|
|
@@ -520,7 +571,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
520
571
|
* ## About
|
|
521
572
|
* @package @ktjs/core
|
|
522
573
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
523
|
-
* @version 0.
|
|
574
|
+
* @version 0.25.0 (Last Update: 2026.02.05 16:20:09.244)
|
|
524
575
|
* @license MIT
|
|
525
576
|
* @link https://github.com/baendlorel/kt.js
|
|
526
577
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -908,6 +959,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
908
959
|
exports.createElement = h;
|
|
909
960
|
exports.createRedrawable = createRedrawable;
|
|
910
961
|
exports.deref = deref;
|
|
962
|
+
exports.effect = effect;
|
|
911
963
|
exports.h = h;
|
|
912
964
|
exports.isComputed = isComputed;
|
|
913
965
|
exports.isKT = isKT;
|
package/dist/index.mjs
CHANGED
|
@@ -75,6 +75,12 @@ const applyModel = (element, valueRef, propName, eventName) => {
|
|
|
75
75
|
element.addEventListener(eventName, () => (valueRef.value = element[propName]));
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
// String manipulation utilities
|
|
79
|
+
/**
|
|
80
|
+
* Default empty function
|
|
81
|
+
*/
|
|
82
|
+
const $emptyFn = (() => true);
|
|
83
|
+
|
|
78
84
|
if (typeof Symbol === 'undefined') {
|
|
79
85
|
window.Symbol = function Symbol(description) {
|
|
80
86
|
return `@@SYMBOL_${description || ''}_${$random().toString(36).slice(2)}`;
|
|
@@ -82,7 +88,7 @@ if (typeof Symbol === 'undefined') {
|
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
// Shared utilities and cached native methods for kt.js framework
|
|
85
|
-
Object.defineProperty(window, '__ktjs__', { value: '0.22.
|
|
91
|
+
Object.defineProperty(window, '__ktjs__', { value: '0.22.8' });
|
|
86
92
|
|
|
87
93
|
// export const KT_TYPE_REF = 1 as const;
|
|
88
94
|
// export const KT_TYPE_COMPUTED = 2 as const;
|
|
@@ -467,6 +473,51 @@ function computed(computeFn, reactives) {
|
|
|
467
473
|
return new KTComputed(computeFn, reactives);
|
|
468
474
|
}
|
|
469
475
|
|
|
476
|
+
/**
|
|
477
|
+
* Register a reactive effect with options.
|
|
478
|
+
* @param effectFn The effect function to run when dependencies change
|
|
479
|
+
* @param reactives The reactive dependencies
|
|
480
|
+
* @param options Effect options: lazy, onCleanup, debugName
|
|
481
|
+
* @returns stop function to remove all listeners
|
|
482
|
+
*/
|
|
483
|
+
function effect(effectFn, reactives, options) {
|
|
484
|
+
const { lazy = false, onCleanup = $emptyFn, debugName = '' } = Object(options);
|
|
485
|
+
let active = true;
|
|
486
|
+
const run = () => {
|
|
487
|
+
if (!active) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
// cleanup before rerun
|
|
491
|
+
onCleanup();
|
|
492
|
+
try {
|
|
493
|
+
effectFn();
|
|
494
|
+
}
|
|
495
|
+
catch (err) {
|
|
496
|
+
console.debug('[kt.js debug]','effect error:', debugName, err);
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
// subscribe to dependencies
|
|
500
|
+
for (let i = 0; i < reactives.length; i++) {
|
|
501
|
+
reactives[i].addOnChange(run);
|
|
502
|
+
}
|
|
503
|
+
// auto run unless lazy
|
|
504
|
+
if (!lazy) {
|
|
505
|
+
run();
|
|
506
|
+
}
|
|
507
|
+
// stop function
|
|
508
|
+
return () => {
|
|
509
|
+
if (!active) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
active = false;
|
|
513
|
+
for (let i = 0; i < reactives.length; i++) {
|
|
514
|
+
reactives[i].removeOnChange(run);
|
|
515
|
+
}
|
|
516
|
+
// final cleanup
|
|
517
|
+
onCleanup();
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
|
|
470
521
|
const toReactive = (value, onChange) => {
|
|
471
522
|
if (isKT(value)) {
|
|
472
523
|
if (onChange) {
|
|
@@ -481,7 +532,7 @@ const toReactive = (value, onChange) => {
|
|
|
481
532
|
|
|
482
533
|
function applyKModel(element, valueRef) {
|
|
483
534
|
if (!isKT(valueRef)) {
|
|
484
|
-
console.warn('[kt.js warn]
|
|
535
|
+
console.warn('[kt.js warn]','k-model value must be a KTRef.');
|
|
485
536
|
return;
|
|
486
537
|
}
|
|
487
538
|
if (element instanceof HTMLInputElement) {
|
|
@@ -499,7 +550,7 @@ function applyKModel(element, valueRef) {
|
|
|
499
550
|
applyModel(element, valueRef, 'value', 'input');
|
|
500
551
|
}
|
|
501
552
|
else {
|
|
502
|
-
console.warn('[kt.js warn]
|
|
553
|
+
console.warn('[kt.js warn]','not supported element for k-model:');
|
|
503
554
|
}
|
|
504
555
|
}
|
|
505
556
|
|
|
@@ -517,7 +568,7 @@ let creator = htmlCreator;
|
|
|
517
568
|
* ## About
|
|
518
569
|
* @package @ktjs/core
|
|
519
570
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
520
|
-
* @version 0.
|
|
571
|
+
* @version 0.25.0 (Last Update: 2026.02.05 16:20:09.244)
|
|
521
572
|
* @license MIT
|
|
522
573
|
* @link https://github.com/baendlorel/kt.js
|
|
523
574
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -888,4 +939,4 @@ function getSequence(arr) {
|
|
|
888
939
|
return result;
|
|
889
940
|
}
|
|
890
941
|
|
|
891
|
-
export { $modelOrRef, Fragment, KTAsync, KTComputed, KTFor, KTRef, computed, h as createElement, createRedrawable, deref, h, isComputed, isKT, isRef, jsx, jsxDEV, jsxs, ref, surfaceRef, toReactive, toRef };
|
|
942
|
+
export { $modelOrRef, Fragment, KTAsync, KTComputed, KTFor, KTRef, computed, h as createElement, createRedrawable, deref, effect, h, isComputed, isKT, isRef, jsx, jsxDEV, jsxs, ref, surfaceRef, toReactive, toRef };
|
package/dist/jsx/index.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ type KTAttribute = KTBaseAttribute & KTPrefixedEventAttribute;
|
|
|
141
141
|
* ## About
|
|
142
142
|
* @package @ktjs/core
|
|
143
143
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
144
|
-
* @version 0.
|
|
144
|
+
* @version 0.25.0 (Last Update: 2026.02.05 16:20:09.244)
|
|
145
145
|
* @license MIT
|
|
146
146
|
* @link https://github.com/baendlorel/kt.js
|
|
147
147
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -1199,70 +1199,9 @@ declare global {
|
|
|
1199
1199
|
tspan: SVGAttributesMap['tspan'];
|
|
1200
1200
|
use: SVGAttributesMap['use'];
|
|
1201
1201
|
view: SVGAttributesMap['view'];
|
|
1202
|
-
|
|
1203
|
-
// 'svg:svg': AttributesMap['svg'];
|
|
1204
|
-
// 'svg:a': SVGAttributesMap['a'];
|
|
1205
|
-
// 'svg:animate': SVGAttributesMap['animate'];
|
|
1206
|
-
// 'svg:animateMotion': SVGAttributesMap['animateMotion'];
|
|
1207
|
-
// 'svg:animateTransform': SVGAttributesMap['animateTransform'];
|
|
1208
|
-
// 'svg:circle': SVGAttributesMap['circle'];
|
|
1209
|
-
// 'svg:clipPath': SVGAttributesMap['clipPath'];
|
|
1210
|
-
// 'svg:defs': SVGAttributesMap['defs'];
|
|
1211
|
-
// 'svg:desc': SVGAttributesMap['desc'];
|
|
1212
|
-
// 'svg:ellipse': SVGAttributesMap['ellipse'];
|
|
1213
|
-
// 'svg:feBlend': SVGAttributesMap['feBlend'];
|
|
1214
|
-
// 'svg:feColorMatrix': SVGAttributesMap['feColorMatrix'];
|
|
1215
|
-
// 'svg:feComponentTransfer': SVGAttributesMap['feComponentTransfer'];
|
|
1216
|
-
// 'svg:feComposite': SVGAttributesMap['feComposite'];
|
|
1217
|
-
// 'svg:feConvolveMatrix': SVGAttributesMap['feConvolveMatrix'];
|
|
1218
|
-
// 'svg:feDiffuseLighting': SVGAttributesMap['feDiffuseLighting'];
|
|
1219
|
-
// 'svg:feDisplacementMap': SVGAttributesMap['feDisplacementMap'];
|
|
1220
|
-
// 'svg:feDistantLight': SVGAttributesMap['feDistantLight'];
|
|
1221
|
-
// 'svg:feDropShadow': SVGAttributesMap['feDropShadow'];
|
|
1222
|
-
// 'svg:feFlood': SVGAttributesMap['feFlood'];
|
|
1223
|
-
// 'svg:feFuncA': SVGAttributesMap['feFuncA'];
|
|
1224
|
-
// 'svg:feFuncB': SVGAttributesMap['feFuncB'];
|
|
1225
|
-
// 'svg:feFuncG': SVGAttributesMap['feFuncG'];
|
|
1226
|
-
// 'svg:feFuncR': SVGAttributesMap['feFuncR'];
|
|
1227
|
-
// 'svg:feGaussianBlur': SVGAttributesMap['feGaussianBlur'];
|
|
1228
|
-
// 'svg:feImage': SVGAttributesMap['feImage'];
|
|
1229
|
-
// 'svg:feMerge': SVGAttributesMap['feMerge'];
|
|
1230
|
-
// 'svg:feMergeNode': SVGAttributesMap['feMergeNode'];
|
|
1231
|
-
// 'svg:feMorphology': SVGAttributesMap['feMorphology'];
|
|
1232
|
-
// 'svg:feOffset': SVGAttributesMap['feOffset'];
|
|
1233
|
-
// 'svg:fePointLight': SVGAttributesMap['fePointLight'];
|
|
1234
|
-
// 'svg:feSpecularLighting': SVGAttributesMap['feSpecularLighting'];
|
|
1235
|
-
// 'svg:feSpotLight': SVGAttributesMap['feSpotLight'];
|
|
1236
|
-
// 'svg:feTile': SVGAttributesMap['feTile'];
|
|
1237
|
-
// 'svg:feTurbulence': SVGAttributesMap['feTurbulence'];
|
|
1238
|
-
// 'svg:filter': SVGAttributesMap['filter'];
|
|
1239
|
-
// 'svg:foreignObject': SVGAttributesMap['foreignObject'];
|
|
1240
|
-
// 'svg:g': SVGAttributesMap['g'];
|
|
1241
|
-
// 'svg:image': SVGAttributesMap['image'];
|
|
1242
|
-
// 'svg:line': SVGAttributesMap['line'];
|
|
1243
|
-
// 'svg:linearGradient': SVGAttributesMap['linearGradient'];
|
|
1244
|
-
// 'svg:marker': SVGAttributesMap['marker'];
|
|
1245
|
-
// 'svg:mask': SVGAttributesMap['mask'];
|
|
1246
|
-
// 'svg:metadata': SVGAttributesMap['metadata'];
|
|
1247
|
-
// 'svg:mpath': SVGAttributesMap['mpath'];
|
|
1248
|
-
// 'svg:path': SVGAttributesMap['path'];
|
|
1249
|
-
// 'svg:pattern': SVGAttributesMap['pattern'];
|
|
1250
|
-
// 'svg:polygon': SVGAttributesMap['polygon'];
|
|
1251
|
-
// 'svg:polyline': SVGAttributesMap['polyline'];
|
|
1252
|
-
// 'svg:radialGradient': SVGAttributesMap['radialGradient'];
|
|
1253
|
-
// 'svg:rect': SVGAttributesMap['rect'];
|
|
1254
|
-
// 'svg:set': SVGAttributesMap['set'];
|
|
1255
|
-
// 'svg:stop': SVGAttributesMap['stop'];
|
|
1256
|
-
// 'svg:switch': SVGAttributesMap['switch'];
|
|
1257
|
-
// 'svg:symbol': SVGAttributesMap['symbol'];
|
|
1258
|
-
// 'svg:text': SVGAttributesMap['text'];
|
|
1259
|
-
// 'svg:textPath': SVGAttributesMap['textPath'];
|
|
1260
|
-
// 'svg:tspan': SVGAttributesMap['tspan'];
|
|
1261
|
-
// 'svg:use': SVGAttributesMap['use'];
|
|
1262
|
-
// 'svg:view': SVGAttributesMap['view'];
|
|
1263
1202
|
}
|
|
1264
1203
|
|
|
1265
|
-
type IntrinsicAttributes =
|
|
1204
|
+
type IntrinsicAttributes = {
|
|
1266
1205
|
/**
|
|
1267
1206
|
* Make a reference to the created element
|
|
1268
1207
|
*/
|
package/dist/jsx/index.mjs
CHANGED
|
@@ -81,7 +81,7 @@ if (typeof Symbol === 'undefined') {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// Shared utilities and cached native methods for kt.js framework
|
|
84
|
-
Object.defineProperty(window, '__ktjs__', { value: '0.22.
|
|
84
|
+
Object.defineProperty(window, '__ktjs__', { value: '0.22.8' });
|
|
85
85
|
|
|
86
86
|
// export const KT_TYPE_REF = 1 as const;
|
|
87
87
|
// export const KT_TYPE_COMPUTED = 2 as const;
|
|
@@ -324,7 +324,7 @@ function ref(value, onChange) {
|
|
|
324
324
|
|
|
325
325
|
function applyKModel(element, valueRef) {
|
|
326
326
|
if (!isKT(valueRef)) {
|
|
327
|
-
console.warn('[kt.js warn]
|
|
327
|
+
console.warn('[kt.js warn]','k-model value must be a KTRef.');
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
330
|
if (element instanceof HTMLInputElement) {
|
|
@@ -342,7 +342,7 @@ function applyKModel(element, valueRef) {
|
|
|
342
342
|
applyModel(element, valueRef, 'value', 'input');
|
|
343
343
|
}
|
|
344
344
|
else {
|
|
345
|
-
console.warn('[kt.js warn]
|
|
345
|
+
console.warn('[kt.js warn]','not supported element for k-model:');
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
|
|
@@ -360,7 +360,7 @@ let creator = htmlCreator;
|
|
|
360
360
|
* ## About
|
|
361
361
|
* @package @ktjs/core
|
|
362
362
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
363
|
-
* @version 0.
|
|
363
|
+
* @version 0.25.0 (Last Update: 2026.02.05 16:20:09.244)
|
|
364
364
|
* @license MIT
|
|
365
365
|
* @link https://github.com/baendlorel/kt.js
|
|
366
366
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -141,7 +141,7 @@ type KTAttribute = KTBaseAttribute & KTPrefixedEventAttribute;
|
|
|
141
141
|
* ## About
|
|
142
142
|
* @package @ktjs/core
|
|
143
143
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
144
|
-
* @version 0.
|
|
144
|
+
* @version 0.25.0 (Last Update: 2026.02.05 16:20:09.244)
|
|
145
145
|
* @license MIT
|
|
146
146
|
* @link https://github.com/baendlorel/kt.js
|
|
147
147
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/dist/jsx/jsx-runtime.mjs
CHANGED
|
@@ -81,7 +81,7 @@ if (typeof Symbol === 'undefined') {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// Shared utilities and cached native methods for kt.js framework
|
|
84
|
-
Object.defineProperty(window, '__ktjs__', { value: '0.22.
|
|
84
|
+
Object.defineProperty(window, '__ktjs__', { value: '0.22.8' });
|
|
85
85
|
|
|
86
86
|
// export const KT_TYPE_REF = 1 as const;
|
|
87
87
|
// export const KT_TYPE_COMPUTED = 2 as const;
|
|
@@ -324,7 +324,7 @@ function ref(value, onChange) {
|
|
|
324
324
|
|
|
325
325
|
function applyKModel(element, valueRef) {
|
|
326
326
|
if (!isKT(valueRef)) {
|
|
327
|
-
console.warn('[kt.js warn]
|
|
327
|
+
console.warn('[kt.js warn]','k-model value must be a KTRef.');
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
330
|
if (element instanceof HTMLInputElement) {
|
|
@@ -342,7 +342,7 @@ function applyKModel(element, valueRef) {
|
|
|
342
342
|
applyModel(element, valueRef, 'value', 'input');
|
|
343
343
|
}
|
|
344
344
|
else {
|
|
345
|
-
console.warn('[kt.js warn]
|
|
345
|
+
console.warn('[kt.js warn]','not supported element for k-model:');
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
|
|
@@ -360,7 +360,7 @@ let creator = htmlCreator;
|
|
|
360
360
|
* ## About
|
|
361
361
|
* @package @ktjs/core
|
|
362
362
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
363
|
-
* @version 0.
|
|
363
|
+
* @version 0.25.0 (Last Update: 2026.02.05 16:20:09.244)
|
|
364
364
|
* @license MIT
|
|
365
365
|
* @link https://github.com/baendlorel/kt.js
|
|
366
366
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ktjs/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"directory": "packages/core"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ktjs/shared": "0.22.
|
|
47
|
+
"@ktjs/shared": "0.22.8"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup -c rollup.config.mjs",
|