@ktjs/core 0.28.1 → 0.28.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/dist/index.d.ts +17 -13
- package/dist/index.iife.js +4 -3
- package/dist/index.legacy.js +4 -3
- package/dist/index.mjs +4 -3
- package/dist/jsx/index.d.ts +11 -9
- package/dist/jsx/index.mjs +2 -2
- package/dist/jsx/jsx-runtime.d.ts +38 -2
- package/dist/jsx/jsx-runtime.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { otherstring, HTMLTag, SVGTag, MathMLTag } from '@ktjs/shared';
|
|
2
2
|
export { HTMLTag, InputElementTag, MathMLTag, SVGTag } from '@ktjs/shared';
|
|
3
3
|
|
|
4
|
-
declare class KTComputed<T> {
|
|
4
|
+
declare class KTComputed<T> implements KTReactive<T> {
|
|
5
5
|
/**
|
|
6
6
|
* Indicates that this is a KTRef instance
|
|
7
7
|
*/
|
|
@@ -20,7 +20,7 @@ declare class KTComputed<T> {
|
|
|
20
20
|
/**
|
|
21
21
|
* Computed values are derived from dependencies and should not be mutated manually.
|
|
22
22
|
*/
|
|
23
|
-
mutate<R = void>(
|
|
23
|
+
mutate<R = void>(): R;
|
|
24
24
|
/**
|
|
25
25
|
* Register a callback when the value changes
|
|
26
26
|
* @param callback (newValue, oldValue) => xxx
|
|
@@ -58,13 +58,6 @@ declare const toReactive: <T>(value: T | KTReactive<T>, onChange?: ReactiveChang
|
|
|
58
58
|
* Extracts the value from a KTReactive, or returns the value directly if it's not reactive.
|
|
59
59
|
*/
|
|
60
60
|
declare function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T;
|
|
61
|
-
type KTReactify<T> = T extends boolean ? KTReactive<boolean> : T extends any ? KTReactive<T> : never;
|
|
62
|
-
type KTReactifyObject<T extends object> = {
|
|
63
|
-
[K in keyof T]: KTReactify<T[K]>;
|
|
64
|
-
};
|
|
65
|
-
type KTReactifyProps<T extends object> = {
|
|
66
|
-
[K in keyof T]: KTReactify<Exclude<T[K], undefined>> | T[K];
|
|
67
|
-
};
|
|
68
61
|
|
|
69
62
|
declare const enum KTReactiveType {
|
|
70
63
|
REF = 1,
|
|
@@ -112,7 +105,18 @@ declare class KTReactive<T> {
|
|
|
112
105
|
removeOnChange(callback: ReactiveChangeHandler<T>): void;
|
|
113
106
|
}
|
|
114
107
|
|
|
115
|
-
|
|
108
|
+
// & Shockingly, If T is boolean, KTReactify<T> becomes KTReactive<true> | KTReactive<false>. It causes @ktjs/mui that disabledRefs not assignable.
|
|
109
|
+
type KTReactify<T> = T extends boolean ? KTReactive<boolean> : T extends any ? KTReactive<T> : never;
|
|
110
|
+
|
|
111
|
+
type KTReactifyObject<T extends object> = {
|
|
112
|
+
[K in keyof T]: KTReactify<T[K]>;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
type KTReactifyProps<T extends object> = {
|
|
116
|
+
[K in keyof T]: KTReactify<Exclude<T[K], undefined>> | T[K];
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
declare class KTRef<T> implements KTReactive<T> {
|
|
116
120
|
/**
|
|
117
121
|
* Indicates that this is a KTRef instance
|
|
118
122
|
*/
|
|
@@ -303,7 +307,7 @@ type KTComponent = (
|
|
|
303
307
|
* ## About
|
|
304
308
|
* @package @ktjs/core
|
|
305
309
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
306
|
-
* @version 0.28.
|
|
310
|
+
* @version 0.28.2 (Last Update: 2026.02.10 14:46:21.243)
|
|
307
311
|
* @license MIT
|
|
308
312
|
* @link https://github.com/baendlorel/kt.js
|
|
309
313
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -1408,7 +1412,7 @@ declare global {
|
|
|
1408
1412
|
view: SVGAttributesMap['view'];
|
|
1409
1413
|
}
|
|
1410
1414
|
|
|
1411
|
-
|
|
1415
|
+
interface IntrinsicAttributes {
|
|
1412
1416
|
/**
|
|
1413
1417
|
* Make a reference to the created element
|
|
1414
1418
|
*/
|
|
@@ -1432,7 +1436,7 @@ declare global {
|
|
|
1432
1436
|
*/
|
|
1433
1437
|
'k-html'?: any;
|
|
1434
1438
|
children?: KTRawContent;
|
|
1435
|
-
}
|
|
1439
|
+
}
|
|
1436
1440
|
|
|
1437
1441
|
interface ElementChildrenAttribute {
|
|
1438
1442
|
children: {};
|
package/dist/index.iife.js
CHANGED
|
@@ -536,8 +536,9 @@ var __ktjs_core__ = (function (exports) {
|
|
|
536
536
|
/**
|
|
537
537
|
* Computed values are derived from dependencies and should not be mutated manually.
|
|
538
538
|
*/
|
|
539
|
-
mutate(
|
|
539
|
+
mutate() {
|
|
540
540
|
console.warn('[kt.js warn]','KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');
|
|
541
|
+
return this._value;
|
|
541
542
|
}
|
|
542
543
|
/**
|
|
543
544
|
* Register a callback when the value changes
|
|
@@ -676,7 +677,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
676
677
|
* ## About
|
|
677
678
|
* @package @ktjs/core
|
|
678
679
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
679
|
-
* @version 0.28.
|
|
680
|
+
* @version 0.28.2 (Last Update: 2026.02.10 14:46:21.243)
|
|
680
681
|
* @license MIT
|
|
681
682
|
* @link https://github.com/baendlorel/kt.js
|
|
682
683
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -784,7 +785,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
784
785
|
function convertChildrenToElements(children) {
|
|
785
786
|
const elements = [];
|
|
786
787
|
const processChild = (child) => {
|
|
787
|
-
if (child
|
|
788
|
+
if (child === undefined || child === null || child === false || child === true) {
|
|
788
789
|
// Ignore null, undefined, false, true
|
|
789
790
|
return;
|
|
790
791
|
}
|
package/dist/index.legacy.js
CHANGED
|
@@ -539,8 +539,9 @@ var __ktjs_core__ = (function (exports) {
|
|
|
539
539
|
/**
|
|
540
540
|
* Computed values are derived from dependencies and should not be mutated manually.
|
|
541
541
|
*/
|
|
542
|
-
KTComputed.prototype.mutate = function (
|
|
542
|
+
KTComputed.prototype.mutate = function () {
|
|
543
543
|
console.warn('[kt.js warn]','KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');
|
|
544
|
+
return this._value;
|
|
544
545
|
};
|
|
545
546
|
/**
|
|
546
547
|
* Register a callback when the value changes
|
|
@@ -680,7 +681,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
680
681
|
* ## About
|
|
681
682
|
* @package @ktjs/core
|
|
682
683
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
683
|
-
* @version 0.28.
|
|
684
|
+
* @version 0.28.2 (Last Update: 2026.02.10 14:46:21.243)
|
|
684
685
|
* @license MIT
|
|
685
686
|
* @link https://github.com/baendlorel/kt.js
|
|
686
687
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -788,7 +789,7 @@ var __ktjs_core__ = (function (exports) {
|
|
|
788
789
|
function convertChildrenToElements(children) {
|
|
789
790
|
var elements = [];
|
|
790
791
|
var processChild = function (child) {
|
|
791
|
-
if (child
|
|
792
|
+
if (child === undefined || child === null || child === false || child === true) {
|
|
792
793
|
// Ignore null, undefined, false, true
|
|
793
794
|
return;
|
|
794
795
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -533,8 +533,9 @@ class KTComputed {
|
|
|
533
533
|
/**
|
|
534
534
|
* Computed values are derived from dependencies and should not be mutated manually.
|
|
535
535
|
*/
|
|
536
|
-
mutate(
|
|
536
|
+
mutate() {
|
|
537
537
|
console.warn('[kt.js warn]','KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');
|
|
538
|
+
return this._value;
|
|
538
539
|
}
|
|
539
540
|
/**
|
|
540
541
|
* Register a callback when the value changes
|
|
@@ -673,7 +674,7 @@ let creator = htmlCreator;
|
|
|
673
674
|
* ## About
|
|
674
675
|
* @package @ktjs/core
|
|
675
676
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
676
|
-
* @version 0.28.
|
|
677
|
+
* @version 0.28.2 (Last Update: 2026.02.10 14:46:21.243)
|
|
677
678
|
* @license MIT
|
|
678
679
|
* @link https://github.com/baendlorel/kt.js
|
|
679
680
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -781,7 +782,7 @@ function Fragment$1(props) {
|
|
|
781
782
|
function convertChildrenToElements(children) {
|
|
782
783
|
const elements = [];
|
|
783
784
|
const processChild = (child) => {
|
|
784
|
-
if (child
|
|
785
|
+
if (child === undefined || child === null || child === false || child === true) {
|
|
785
786
|
// Ignore null, undefined, false, true
|
|
786
787
|
return;
|
|
787
788
|
}
|
package/dist/jsx/index.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { otherstring, HTMLTag, SVGTag, MathMLTag } from '@ktjs/shared';
|
|
2
2
|
|
|
3
|
-
type KTReactify<T> = T extends boolean ? KTReactive<boolean> : T extends any ? KTReactive<T> : never;
|
|
4
|
-
type KTReactifyProps<T extends object> = {
|
|
5
|
-
[K in keyof T]: KTReactify<Exclude<T[K], undefined>> | T[K];
|
|
6
|
-
};
|
|
7
|
-
|
|
8
3
|
declare const enum KTReactiveType {
|
|
9
4
|
REF = 1,
|
|
10
5
|
COMPUTED = 2
|
|
@@ -48,7 +43,14 @@ declare class KTReactive<T> {
|
|
|
48
43
|
removeOnChange(callback: ReactiveChangeHandler<T>): void;
|
|
49
44
|
}
|
|
50
45
|
|
|
51
|
-
|
|
46
|
+
// & Shockingly, If T is boolean, KTReactify<T> becomes KTReactive<true> | KTReactive<false>. It causes @ktjs/mui that disabledRefs not assignable.
|
|
47
|
+
type KTReactify<T> = T extends boolean ? KTReactive<boolean> : T extends any ? KTReactive<T> : never;
|
|
48
|
+
|
|
49
|
+
type KTReactifyProps<T extends object> = {
|
|
50
|
+
[K in keyof T]: KTReactify<Exclude<T[K], undefined>> | T[K];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
declare class KTRef<T> implements KTReactive<T> {
|
|
52
54
|
/**
|
|
53
55
|
* Indicates that this is a KTRef instance
|
|
54
56
|
*/
|
|
@@ -189,7 +191,7 @@ type KTAttribute = KTBaseAttribute & KTPrefixedEventAttribute;
|
|
|
189
191
|
* ## About
|
|
190
192
|
* @package @ktjs/core
|
|
191
193
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
192
|
-
* @version 0.28.
|
|
194
|
+
* @version 0.28.2 (Last Update: 2026.02.10 14:46:21.243)
|
|
193
195
|
* @license MIT
|
|
194
196
|
* @link https://github.com/baendlorel/kt.js
|
|
195
197
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -1294,7 +1296,7 @@ declare global {
|
|
|
1294
1296
|
view: SVGAttributesMap['view'];
|
|
1295
1297
|
}
|
|
1296
1298
|
|
|
1297
|
-
|
|
1299
|
+
interface IntrinsicAttributes {
|
|
1298
1300
|
/**
|
|
1299
1301
|
* Make a reference to the created element
|
|
1300
1302
|
*/
|
|
@@ -1318,7 +1320,7 @@ declare global {
|
|
|
1318
1320
|
*/
|
|
1319
1321
|
'k-html'?: any;
|
|
1320
1322
|
children?: KTRawContent;
|
|
1321
|
-
}
|
|
1323
|
+
}
|
|
1322
1324
|
|
|
1323
1325
|
interface ElementChildrenAttribute {
|
|
1324
1326
|
children: {};
|
package/dist/jsx/index.mjs
CHANGED
|
@@ -443,7 +443,7 @@ let creator = htmlCreator;
|
|
|
443
443
|
* ## About
|
|
444
444
|
* @package @ktjs/core
|
|
445
445
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
446
|
-
* @version 0.28.
|
|
446
|
+
* @version 0.28.2 (Last Update: 2026.02.10 14:46:21.243)
|
|
447
447
|
* @license MIT
|
|
448
448
|
* @link https://github.com/baendlorel/kt.js
|
|
449
449
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -551,7 +551,7 @@ function Fragment$1(props) {
|
|
|
551
551
|
function convertChildrenToElements(children) {
|
|
552
552
|
const elements = [];
|
|
553
553
|
const processChild = (child) => {
|
|
554
|
-
if (child
|
|
554
|
+
if (child === undefined || child === null || child === false || child === true) {
|
|
555
555
|
// Ignore null, undefined, false, true
|
|
556
556
|
return;
|
|
557
557
|
}
|
|
@@ -7,7 +7,43 @@ declare const enum KTReactiveType {
|
|
|
7
7
|
|
|
8
8
|
type ReactiveChangeHandler<T> = (newValue: T, oldValue: T) => void;
|
|
9
9
|
|
|
10
|
-
declare class
|
|
10
|
+
declare class KTReactive<T> {
|
|
11
|
+
/**
|
|
12
|
+
* Indicates that this is a KTRef instance
|
|
13
|
+
*/
|
|
14
|
+
isKT: boolean;
|
|
15
|
+
|
|
16
|
+
ktType: KTReactiveType;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* If new value and old value are both nodes, the old one will be replaced in the DOM
|
|
20
|
+
*/
|
|
21
|
+
get value();
|
|
22
|
+
set value(newValue: T);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Force all listeners to run even when reference identity has not changed.
|
|
26
|
+
* Useful for in-place array/object mutations.
|
|
27
|
+
*/
|
|
28
|
+
notify(): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Mutate current value in-place and notify listeners once.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const items = ref<number[]>([1, 2]);
|
|
35
|
+
* items.mutate((list) => list.push(3));
|
|
36
|
+
*/
|
|
37
|
+
mutate<R = void>(mutator: (currentValue: T) => R): R;
|
|
38
|
+
/**
|
|
39
|
+
* Register a callback when the value changes
|
|
40
|
+
* @param callback (newValue, oldValue) => xxx
|
|
41
|
+
*/
|
|
42
|
+
addOnChange(callback: ReactiveChangeHandler<T>): void;
|
|
43
|
+
removeOnChange(callback: ReactiveChangeHandler<T>): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare class KTRef<T> implements KTReactive<T> {
|
|
11
47
|
/**
|
|
12
48
|
* Indicates that this is a KTRef instance
|
|
13
49
|
*/
|
|
@@ -148,7 +184,7 @@ type KTAttribute = KTBaseAttribute & KTPrefixedEventAttribute;
|
|
|
148
184
|
* ## About
|
|
149
185
|
* @package @ktjs/core
|
|
150
186
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
151
|
-
* @version 0.28.
|
|
187
|
+
* @version 0.28.2 (Last Update: 2026.02.10 14:46:21.243)
|
|
152
188
|
* @license MIT
|
|
153
189
|
* @link https://github.com/baendlorel/kt.js
|
|
154
190
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/dist/jsx/jsx-runtime.mjs
CHANGED
|
@@ -443,7 +443,7 @@ let creator = htmlCreator;
|
|
|
443
443
|
* ## About
|
|
444
444
|
* @package @ktjs/core
|
|
445
445
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
446
|
-
* @version 0.28.
|
|
446
|
+
* @version 0.28.2 (Last Update: 2026.02.10 14:46:21.243)
|
|
447
447
|
* @license MIT
|
|
448
448
|
* @link https://github.com/baendlorel/kt.js
|
|
449
449
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
|
@@ -551,7 +551,7 @@ function Fragment$1(props) {
|
|
|
551
551
|
function convertChildrenToElements(children) {
|
|
552
552
|
const elements = [];
|
|
553
553
|
const processChild = (child) => {
|
|
554
|
-
if (child
|
|
554
|
+
if (child === undefined || child === null || child === false || child === true) {
|
|
555
555
|
// Ignore null, undefined, false, true
|
|
556
556
|
return;
|
|
557
557
|
}
|