@ktjs/core 0.30.11 → 0.31.1
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 +8 -3
- package/dist/index.d.ts +37 -30
- package/dist/index.mjs +125 -119
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,12 +10,17 @@
|
|
|
10
10
|
</a>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Document
|
|
14
14
|
|
|
15
15
|
<p align="center"><strong>Visit KT.js: <a href="https://baendlorel.github.io/kt.js/">https://baendlorel.github.io/kt.js/</a></strong></p>
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Community
|
|
18
|
+
|
|
19
|
+
- QQ Group: `1070434849`
|
|
20
|
+
- Telegram: https://t.me/kt_js
|
|
18
21
|
|
|
19
|
-
##
|
|
22
|
+
## Introduction
|
|
23
|
+
|
|
24
|
+
kt.js is a simple framework with a tiny runtime that renders real DOM directly (no virtual DOM), uses explicit reactivity variables and gives you manual control over refs, bindings, and redraw timing.
|
|
20
25
|
|
|
21
26
|
KT.js focuses on one principle: keep direct control of the DOM and avoid unnecessary repainting.
|
package/dist/index.d.ts
CHANGED
|
@@ -1101,6 +1101,34 @@ declare namespace JSX {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
|
|
1104
|
+
interface KTEffectOptions {
|
|
1105
|
+
lazy: boolean;
|
|
1106
|
+
onCleanup: () => void;
|
|
1107
|
+
debugName: string;
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Register a reactive effect with options.
|
|
1111
|
+
* @param effectFn The effect function to run when dependencies change
|
|
1112
|
+
* @param reactives The reactive dependencies
|
|
1113
|
+
* @param options Effect options: lazy, onCleanup, debugName
|
|
1114
|
+
* @returns stop function to remove all listeners
|
|
1115
|
+
*/
|
|
1116
|
+
declare function effect(effectFn: () => void, reactives: Array<KTReactive<any>>, options?: Partial<KTEffectOptions>): () => void;
|
|
1117
|
+
|
|
1118
|
+
declare const toReactive: <T>(value: T | KTReactive<T>, onChange?: ReactiveChangeHandler<T>) => KTReactive<T>;
|
|
1119
|
+
/**
|
|
1120
|
+
* Extracts the value from a KTReactive, or returns the value directly if it's not reactive.
|
|
1121
|
+
*/
|
|
1122
|
+
declare function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T;
|
|
1123
|
+
|
|
1124
|
+
declare const enum KTReactiveType {
|
|
1125
|
+
REF = 1,
|
|
1126
|
+
COMPUTED = 2
|
|
1127
|
+
}
|
|
1128
|
+
declare const isKT: <T = any>(obj: any) => obj is KTReactive<T>;
|
|
1129
|
+
declare const isRef: <T = any>(obj: any) => obj is KTRef<T>;
|
|
1130
|
+
declare const isComputed: <T = any>(obj: any) => obj is KTComputed<T>;
|
|
1131
|
+
|
|
1104
1132
|
declare class KTComputed<T> implements KTReactive<T> {
|
|
1105
1133
|
/**
|
|
1106
1134
|
* Indicates that this is a KTRef instance
|
|
@@ -1121,6 +1149,7 @@ declare class KTComputed<T> implements KTReactive<T> {
|
|
|
1121
1149
|
* Computed values are derived from dependencies and should not be mutated manually.
|
|
1122
1150
|
*/
|
|
1123
1151
|
mutate<R = void>(_mutator?: (currentValue: T) => R, changeKeys?: ReactiveChangeKey[]): R;
|
|
1152
|
+
deriveComputed<R>(calculator: (currentValue: T) => R, dependencies?: KTReactive<unknown>[]): KTComputed<R>;
|
|
1124
1153
|
/**
|
|
1125
1154
|
* Register a callback when the value changes
|
|
1126
1155
|
* @param callback (newValue, oldValue) => xxx
|
|
@@ -1135,37 +1164,9 @@ declare class KTComputed<T> implements KTReactive<T> {
|
|
|
1135
1164
|
/**
|
|
1136
1165
|
* Create a reactive computed value
|
|
1137
1166
|
* @param computeFn
|
|
1138
|
-
* @param
|
|
1167
|
+
* @param dependencies refs and computeds that this computed depends on
|
|
1139
1168
|
*/
|
|
1140
|
-
declare function computed<T = JSX.Element>(computeFn: () => T,
|
|
1141
|
-
|
|
1142
|
-
interface KTEffectOptions {
|
|
1143
|
-
lazy: boolean;
|
|
1144
|
-
onCleanup: () => void;
|
|
1145
|
-
debugName: string;
|
|
1146
|
-
}
|
|
1147
|
-
/**
|
|
1148
|
-
* Register a reactive effect with options.
|
|
1149
|
-
* @param effectFn The effect function to run when dependencies change
|
|
1150
|
-
* @param reactives The reactive dependencies
|
|
1151
|
-
* @param options Effect options: lazy, onCleanup, debugName
|
|
1152
|
-
* @returns stop function to remove all listeners
|
|
1153
|
-
*/
|
|
1154
|
-
declare function effect(effectFn: () => void, reactives: Array<KTReactive<any>>, options?: Partial<KTEffectOptions>): () => void;
|
|
1155
|
-
|
|
1156
|
-
declare const toReactive: <T>(value: T | KTReactive<T>, onChange?: ReactiveChangeHandler<T>) => KTReactive<T>;
|
|
1157
|
-
/**
|
|
1158
|
-
* Extracts the value from a KTReactive, or returns the value directly if it's not reactive.
|
|
1159
|
-
*/
|
|
1160
|
-
declare function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T;
|
|
1161
|
-
|
|
1162
|
-
declare const enum KTReactiveType {
|
|
1163
|
-
REF = 1,
|
|
1164
|
-
COMPUTED = 2
|
|
1165
|
-
}
|
|
1166
|
-
declare const isKT: <T = any>(obj: any) => obj is KTReactive<T>;
|
|
1167
|
-
declare const isRef: <T = any>(obj: any) => obj is KTRef<T>;
|
|
1168
|
-
declare const isComputed: <T = any>(obj: any) => obj is KTComputed<T>;
|
|
1169
|
+
declare function computed<T = JSX.Element>(computeFn: () => T, dependencies: Array<KTReactive<any>>): KTComputed<T>;
|
|
1169
1170
|
|
|
1170
1171
|
type ReactiveChangeHandler<T> = (newValue: T, oldValue: T) => void;
|
|
1171
1172
|
type ReactiveChangeKey = string | number;
|
|
@@ -1199,6 +1200,11 @@ declare class KTReactive<T> {
|
|
|
1199
1200
|
*/
|
|
1200
1201
|
mutate<R = void>(mutator: (currentValue: T) => R, changeKeys?: ReactiveChangeKey[]): R;
|
|
1201
1202
|
|
|
1203
|
+
/**
|
|
1204
|
+
* A simple way to create a computed value based on this reactive.
|
|
1205
|
+
*/
|
|
1206
|
+
deriveComputed<R>(calculator: (currentValue: T) => R): KTComputed<R>;
|
|
1207
|
+
|
|
1202
1208
|
/**
|
|
1203
1209
|
* Register a callback when the value changes
|
|
1204
1210
|
* - Value setter will check `Object.is(newValue, oldValue)`.
|
|
@@ -1247,6 +1253,7 @@ declare class KTRef<T> implements KTReactive<T> {
|
|
|
1247
1253
|
* items.mutate((list) => list.push(3));
|
|
1248
1254
|
*/
|
|
1249
1255
|
mutate<R = void>(mutator: (currentValue: T) => R, changeKeys?: ReactiveChangeKey[]): R;
|
|
1256
|
+
deriveComputed<R>(calculator: (currentValue: T) => R, dependencies?: KTReactive<unknown>[]): KTComputed<R>;
|
|
1250
1257
|
/**
|
|
1251
1258
|
* Register a callback when the value changes
|
|
1252
1259
|
* @param callback (newValue, oldValue) => xxx
|
package/dist/index.mjs
CHANGED
|
@@ -208,6 +208,127 @@ const IdGenerator = {
|
|
|
208
208
|
return this._computedOnChangeId++;
|
|
209
209
|
}};
|
|
210
210
|
|
|
211
|
+
class KTComputed {
|
|
212
|
+
/**
|
|
213
|
+
* Indicates that this is a KTRef instance
|
|
214
|
+
*/
|
|
215
|
+
isKT = true;
|
|
216
|
+
ktType = 2 /* KTReactiveType.COMPUTED */;
|
|
217
|
+
/**
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
_calculator;
|
|
221
|
+
/**
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
_value;
|
|
225
|
+
/**
|
|
226
|
+
* @internal
|
|
227
|
+
*/
|
|
228
|
+
_onChanges = new Map();
|
|
229
|
+
/**
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
_emit(newValue, oldValue, changeKeys) {
|
|
233
|
+
if (changeKeys) {
|
|
234
|
+
for (let i = 0; i < changeKeys.length; i++) {
|
|
235
|
+
this._onChanges.get(changeKeys[i])?.(newValue, oldValue);
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
this._onChanges.forEach((c) => c(newValue, oldValue));
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* @internal
|
|
243
|
+
*/
|
|
244
|
+
_recalculate(forceEmit = false, changeKeys) {
|
|
245
|
+
const oldValue = this._value;
|
|
246
|
+
const newValue = this._calculator();
|
|
247
|
+
if (oldValue === newValue) {
|
|
248
|
+
if (forceEmit) {
|
|
249
|
+
this._emit(newValue, oldValue, changeKeys);
|
|
250
|
+
}
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
this._value = newValue;
|
|
254
|
+
this._emit(newValue, oldValue, changeKeys);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* @internal
|
|
258
|
+
*/
|
|
259
|
+
_subscribe(reactives) {
|
|
260
|
+
for (let i = 0; i < reactives.length; i++) {
|
|
261
|
+
const reactive = reactives[i];
|
|
262
|
+
reactive.addOnChange(() => this._recalculate());
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
constructor(_calculator, reactives) {
|
|
266
|
+
this._calculator = _calculator;
|
|
267
|
+
this._value = _calculator();
|
|
268
|
+
this._subscribe(reactives);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* If new value and old value are both nodes, the old one will be replaced in the DOM
|
|
272
|
+
*/
|
|
273
|
+
get value() {
|
|
274
|
+
return this._value;
|
|
275
|
+
}
|
|
276
|
+
set value(_newValue) {
|
|
277
|
+
throw new Error('[@ktjs/core error] KTComputed: cannot set value of a computed value');
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Force listeners to run once with the latest computed result.
|
|
281
|
+
*/
|
|
282
|
+
notify(changeKeys) {
|
|
283
|
+
this._recalculate(true, changeKeys);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Computed values are derived from dependencies and should not be mutated manually.
|
|
287
|
+
*/
|
|
288
|
+
mutate(_mutator, changeKeys) {
|
|
289
|
+
console.warn('[@ktjs/core warn]','KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');
|
|
290
|
+
if (changeKeys) {
|
|
291
|
+
this._emit(this._value, this._value, changeKeys);
|
|
292
|
+
}
|
|
293
|
+
return this._value;
|
|
294
|
+
}
|
|
295
|
+
deriveComputed(calculator, dependencies) {
|
|
296
|
+
return computed(() => calculator(this.value), dependencies ? [this, ...dependencies] : [this]);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Register a callback when the value changes
|
|
300
|
+
* @param callback (newValue, oldValue) => xxx
|
|
301
|
+
*/
|
|
302
|
+
addOnChange(callback, key) {
|
|
303
|
+
if (typeof callback !== 'function') {
|
|
304
|
+
throw new Error('[@ktjs/core error] KTComputed.addOnChange: callback must be a function');
|
|
305
|
+
}
|
|
306
|
+
const k = key ?? IdGenerator.computedOnChangeId;
|
|
307
|
+
this._onChanges.set(k, callback);
|
|
308
|
+
return k;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Unregister a callback
|
|
312
|
+
* @param key registered listener key
|
|
313
|
+
*/
|
|
314
|
+
removeOnChange(key) {
|
|
315
|
+
const callback = this._onChanges.get(key);
|
|
316
|
+
this._onChanges.delete(key);
|
|
317
|
+
return callback;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Create a reactive computed value
|
|
322
|
+
* @param computeFn
|
|
323
|
+
* @param dependencies refs and computeds that this computed depends on
|
|
324
|
+
*/
|
|
325
|
+
function computed(computeFn, dependencies) {
|
|
326
|
+
if (dependencies.some((v) => !isKT(v))) {
|
|
327
|
+
throw new Error('[@ktjs/core error] computed: all reactives must be KTRef or KTComputed instances');
|
|
328
|
+
}
|
|
329
|
+
return new KTComputed(computeFn, dependencies);
|
|
330
|
+
}
|
|
331
|
+
|
|
211
332
|
class KTRef {
|
|
212
333
|
/**
|
|
213
334
|
* Indicates that this is a KTRef instance
|
|
@@ -278,6 +399,9 @@ class KTRef {
|
|
|
278
399
|
this._emit(this._value, oldValue, changeKeys);
|
|
279
400
|
return result;
|
|
280
401
|
}
|
|
402
|
+
deriveComputed(calculator, dependencies) {
|
|
403
|
+
return computed(() => calculator(this.value), dependencies ? [this, ...dependencies] : [this]);
|
|
404
|
+
}
|
|
281
405
|
/**
|
|
282
406
|
* Register a callback when the value changes
|
|
283
407
|
* @param callback (newValue, oldValue) => xxx
|
|
@@ -384,124 +508,6 @@ const $initRef = (props, node) => {
|
|
|
384
508
|
}
|
|
385
509
|
};
|
|
386
510
|
|
|
387
|
-
class KTComputed {
|
|
388
|
-
/**
|
|
389
|
-
* Indicates that this is a KTRef instance
|
|
390
|
-
*/
|
|
391
|
-
isKT = true;
|
|
392
|
-
ktType = 2 /* KTReactiveType.COMPUTED */;
|
|
393
|
-
/**
|
|
394
|
-
* @internal
|
|
395
|
-
*/
|
|
396
|
-
_calculator;
|
|
397
|
-
/**
|
|
398
|
-
* @internal
|
|
399
|
-
*/
|
|
400
|
-
_value;
|
|
401
|
-
/**
|
|
402
|
-
* @internal
|
|
403
|
-
*/
|
|
404
|
-
_onChanges = new Map();
|
|
405
|
-
/**
|
|
406
|
-
* @internal
|
|
407
|
-
*/
|
|
408
|
-
_emit(newValue, oldValue, changeKeys) {
|
|
409
|
-
if (changeKeys) {
|
|
410
|
-
for (let i = 0; i < changeKeys.length; i++) {
|
|
411
|
-
this._onChanges.get(changeKeys[i])?.(newValue, oldValue);
|
|
412
|
-
}
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
this._onChanges.forEach((c) => c(newValue, oldValue));
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* @internal
|
|
419
|
-
*/
|
|
420
|
-
_recalculate(forceEmit = false, changeKeys) {
|
|
421
|
-
const oldValue = this._value;
|
|
422
|
-
const newValue = this._calculator();
|
|
423
|
-
if (oldValue === newValue) {
|
|
424
|
-
if (forceEmit) {
|
|
425
|
-
this._emit(newValue, oldValue, changeKeys);
|
|
426
|
-
}
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
this._value = newValue;
|
|
430
|
-
this._emit(newValue, oldValue, changeKeys);
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* @internal
|
|
434
|
-
*/
|
|
435
|
-
_subscribe(reactives) {
|
|
436
|
-
for (let i = 0; i < reactives.length; i++) {
|
|
437
|
-
const reactive = reactives[i];
|
|
438
|
-
reactive.addOnChange(() => this._recalculate());
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
constructor(_calculator, reactives) {
|
|
442
|
-
this._calculator = _calculator;
|
|
443
|
-
this._value = _calculator();
|
|
444
|
-
this._subscribe(reactives);
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* If new value and old value are both nodes, the old one will be replaced in the DOM
|
|
448
|
-
*/
|
|
449
|
-
get value() {
|
|
450
|
-
return this._value;
|
|
451
|
-
}
|
|
452
|
-
set value(_newValue) {
|
|
453
|
-
throw new Error('[@ktjs/core error] KTComputed: cannot set value of a computed value');
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Force listeners to run once with the latest computed result.
|
|
457
|
-
*/
|
|
458
|
-
notify(changeKeys) {
|
|
459
|
-
this._recalculate(true, changeKeys);
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Computed values are derived from dependencies and should not be mutated manually.
|
|
463
|
-
*/
|
|
464
|
-
mutate(_mutator, changeKeys) {
|
|
465
|
-
console.warn('[@ktjs/core warn]','KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');
|
|
466
|
-
if (changeKeys) {
|
|
467
|
-
this._emit(this._value, this._value, changeKeys);
|
|
468
|
-
}
|
|
469
|
-
return this._value;
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Register a callback when the value changes
|
|
473
|
-
* @param callback (newValue, oldValue) => xxx
|
|
474
|
-
*/
|
|
475
|
-
addOnChange(callback, key) {
|
|
476
|
-
if (typeof callback !== 'function') {
|
|
477
|
-
throw new Error('[@ktjs/core error] KTComputed.addOnChange: callback must be a function');
|
|
478
|
-
}
|
|
479
|
-
const k = key ?? IdGenerator.computedOnChangeId;
|
|
480
|
-
this._onChanges.set(k, callback);
|
|
481
|
-
return k;
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Unregister a callback
|
|
485
|
-
* @param key registered listener key
|
|
486
|
-
*/
|
|
487
|
-
removeOnChange(key) {
|
|
488
|
-
const callback = this._onChanges.get(key);
|
|
489
|
-
this._onChanges.delete(key);
|
|
490
|
-
return callback;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Create a reactive computed value
|
|
495
|
-
* @param computeFn
|
|
496
|
-
* @param reactives refs and computeds that this computed depends on
|
|
497
|
-
*/
|
|
498
|
-
function computed(computeFn, reactives) {
|
|
499
|
-
if (reactives.some((v) => !isKT(v))) {
|
|
500
|
-
throw new Error('[@ktjs/core error] computed: all reactives must be KTRef or KTComputed instances');
|
|
501
|
-
}
|
|
502
|
-
return new KTComputed(computeFn, reactives);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
511
|
/**
|
|
506
512
|
* Register a reactive effect with options.
|
|
507
513
|
* @param effectFn The effect function to run when dependencies change
|
|
@@ -599,7 +605,7 @@ function applyKModel(element, valueRef) {
|
|
|
599
605
|
* ## About
|
|
600
606
|
* @package @ktjs/core
|
|
601
607
|
* @author Kasukabe Tsumugi <futami16237@gmail.com>
|
|
602
|
-
* @version 0.
|
|
608
|
+
* @version 0.31.1 (Last Update: 2026.02.25 21:43:34.452)
|
|
603
609
|
* @license MIT
|
|
604
610
|
* @link https://github.com/baendlorel/kt.js
|
|
605
611
|
* @link https://baendlorel.github.io/ Welcome to my site!
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/reactive/core.ts","../src/h/attr-helpers.ts","../src/h/attr.ts","../src/h/content.ts","../src/common.ts","../src/reactive/ref.ts","../src/reactive/computed.ts","../src/reactive/effect.ts","../src/reactive/index.ts","../src/h/model.ts","../src/h/index.ts","../src/jsx/fragment.ts","../src/jsx/common.ts","../src/jsx/jsx-runtime.ts","../src/jsx/async.ts","../src/jsx/for.ts","../src/jsx/if.ts"],"sourcesContent":["import type { KTReactive } from '../types/reactive.js';\nimport type { KTComputed, KTRef } from './index.js';\n\nexport const enum KTReactiveType {\n REF = 1,\n COMPUTED = 2,\n}\n\nexport const isKT = <T = any>(obj: any): obj is KTReactive<T> => obj?.isKT;\nexport const isRef = <T = any>(obj: any): obj is KTRef<T> => obj?.ktType === KTReactiveType.REF;\nexport const isComputed = <T = any>(obj: any): obj is KTComputed<T> => obj?.ktType === KTReactiveType.COMPUTED;\n","const booleanHandler = (element: HTMLElement | SVGElement | MathMLElement, key: string, value: any) => {\n if (key in element) {\n (element as any)[key] = !!value;\n } else {\n element.setAttribute(key, value);\n }\n};\n\nconst valueHandler = (element: HTMLElement | SVGElement | MathMLElement, key: string, value: any) => {\n if (key in element) {\n (element as any)[key] = value;\n } else {\n element.setAttribute(key, value);\n }\n};\n\n// Attribute handlers map for optimized lookup\nexport const handlers: Record<\n string,\n (element: HTMLElement | SVGElement | MathMLElement, key: string, value: any) => void\n> = {\n checked: booleanHandler,\n selected: booleanHandler,\n value: valueHandler,\n valueAsDate: valueHandler,\n valueAsNumber: valueHandler,\n defaultValue: valueHandler,\n defaultChecked: booleanHandler,\n defaultSelected: booleanHandler,\n disabled: booleanHandler,\n readOnly: booleanHandler,\n multiple: booleanHandler,\n required: booleanHandler,\n autofocus: booleanHandler,\n open: booleanHandler,\n controls: booleanHandler,\n autoplay: booleanHandler,\n loop: booleanHandler,\n muted: booleanHandler,\n defer: booleanHandler,\n async: booleanHandler,\n hidden: (element, _key, value) => ((element as HTMLElement).hidden = !!value),\n};\n\ntype InputElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\ntype StringEventHandler = (element: InputElement, handler: (value: string) => void) => void;\ntype NumberEventHandler = (element: InputElement, handler: (value: number) => void) => void;\n\nexport const ktEventHandlers: Record<string, StringEventHandler | NumberEventHandler> = {\n 'on:ktchange': (element: InputElement, handler: (value: string) => void) =>\n element.addEventListener('change', () => handler(element.value)),\n 'ontrim:ktchange': (element: InputElement, handler: (value: string) => void) =>\n element.addEventListener('change', () => handler(element.value.trim())),\n 'on:ktchangenumber': (element: InputElement, handler: (value: number) => void) =>\n element.addEventListener('change', () => handler(Number(element.value))),\n 'on:ktinput': (element: InputElement, handler: (value: string) => void) =>\n element.addEventListener('input', () => handler(element.value)),\n 'ontrim:ktinput': (element: InputElement, handler: (value: string) => void) =>\n element.addEventListener('input', () => handler(element.value.trim())),\n 'on:ktinputnumber': (element: InputElement, handler: (value: number) => void) =>\n element.addEventListener('input', () => handler(Number(element.value))),\n};\n","import type { KTReactifyProps } from '../types/reactive.js';\nimport type { KTRawAttr, KTAttribute } from '../types/h.js';\nimport { isKT } from '../reactive/core.js';\nimport { handlers } from './attr-helpers.js';\n\nconst defaultHandler = (element: HTMLElement | SVGElement | MathMLElement, key: string, value: any) =>\n element.setAttribute(key, value);\n\nconst setElementStyle = (\n element: HTMLElement | SVGElement | MathMLElement,\n style: Partial<CSSStyleDeclaration> | string,\n) => {\n if (typeof style === 'string') {\n (element as HTMLElement).style.cssText = style;\n return;\n }\n\n for (const key in style) {\n (element as any).style[key as any] = style[key];\n }\n};\n\nfunction attrIsObject(element: HTMLElement | SVGElement | MathMLElement, attr: KTReactifyProps<KTAttribute>) {\n const classValue = attr.class || attr.className;\n if (classValue !== undefined) {\n if (isKT<string>(classValue)) {\n element.setAttribute('class', classValue.value);\n classValue.addOnChange((v) => element.setAttribute('class', v));\n } else {\n element.setAttribute('class', classValue);\n }\n }\n\n const style = attr.style;\n if (style) {\n if (typeof style === 'string') {\n element.setAttribute('style', style);\n } else if (typeof style === 'object') {\n if (isKT(style)) {\n setElementStyle(element, style.value);\n style.addOnChange((v: Partial<CSSStyleDeclaration> | string) => setElementStyle(element, v));\n } else {\n setElementStyle(element, style as Partial<CSSStyleDeclaration>);\n }\n }\n }\n\n if ('k-html' in attr) {\n const html = attr['k-html'];\n if (isKT(html)) {\n element.innerHTML = html.value;\n html.addOnChange((v) => (element.innerHTML = v));\n } else {\n element.innerHTML = html;\n }\n }\n\n for (const key in attr) {\n // & Arranged in order of usage frequency\n if (\n // key === 'k-if' ||\n // key === 'k-else' ||\n key === 'k-model' ||\n key === 'k-for' ||\n key === 'k-key' ||\n key === 'ref' ||\n key === 'class' ||\n key === 'className' ||\n key === 'style' ||\n key === 'children' ||\n key === 'k-html'\n ) {\n continue;\n }\n\n const o = attr[key];\n\n // normal event handler\n if (key.startsWith('on:')) {\n if (o) {\n element.addEventListener(key.slice(3), o); // chop off the `on:`\n }\n continue;\n }\n\n // normal attributes\n const handler = handlers[key] || defaultHandler;\n if (isKT(o)) {\n handler(element, key, o.value);\n o.addOnChange((v) => handler(element, key, v));\n } else {\n handler(element, key, o);\n }\n }\n}\n\nexport function applyAttr(element: HTMLElement | SVGElement | MathMLElement, attr: KTRawAttr) {\n if (!attr) {\n return;\n }\n if (typeof attr === 'object' && attr !== null) {\n attrIsObject(element, attr as KTAttribute);\n } else {\n $throw('attr must be an object.');\n }\n}\n","import { $isArray, $isNode, $isThenable } from '@ktjs/shared';\nimport type { KTAvailableContent, KTRawContent } from '../types/h.js';\nimport { isKT } from '../reactive/core.js';\n\nconst assureNode = (o: any) => ($isNode(o) ? o : document.createTextNode(o));\n\nfunction apdSingle(element: HTMLElement | DocumentFragment | SVGElement | MathMLElement, c: KTAvailableContent) {\n // & Ignores falsy values, consistent with React's behavior\n if (c === undefined || c === null || c === false) {\n return;\n }\n\n if (isKT(c)) {\n let node = assureNode(c.value);\n element.appendChild(node);\n c.addOnChange((newValue, _oldValue) => {\n const oldNode = node;\n node = assureNode(newValue);\n oldNode.replaceWith(node);\n });\n } else {\n const node = assureNode(c);\n element.appendChild(node);\n // Handle KTFor anchor\n const list = (node as any).__kt_for_list__ as any[];\n if ($isArray(list)) {\n apd(element, list);\n }\n }\n}\n\nfunction apd(element: HTMLElement | DocumentFragment | SVGElement | MathMLElement, c: KTAvailableContent) {\n if ($isThenable(c)) {\n c.then((r) => apd(element, r));\n } else if ($isArray(c)) {\n for (let i = 0; i < c.length; i++) {\n // & might be thenable here too\n const ci = c[i];\n if ($isThenable(ci)) {\n const comment = document.createComment('ktjs-promise-placeholder');\n element.appendChild(comment);\n ci.then((awaited) => comment.replaceWith(awaited));\n } else {\n apdSingle(element, ci);\n }\n }\n } else {\n // & here is thened, so must be a simple elementj\n apdSingle(element, c);\n }\n}\n\nexport function applyContent(element: HTMLElement | SVGElement | MathMLElement, content: KTRawContent): void {\n if ($isArray(content)) {\n for (let i = 0; i < content.length; i++) {\n apd(element, content[i]);\n }\n } else {\n apd(element, content as KTAvailableContent);\n }\n}\n","// # internal methods that cannot be placed in @ktjs/shared\n\nexport const IdGenerator = {\n _refOnChangeId: 1,\n get refOnChangeId() {\n return this._refOnChangeId++;\n },\n _computedOnChangeId: 1,\n get computedOnChangeId() {\n return this._computedOnChangeId++;\n },\n _kid: 1,\n get kid() {\n return this._kid++;\n },\n};\n","import { $emptyFn, $entries, $is } from '@ktjs/shared';\nimport type { KTReactive, ReactiveChangeHandler, ReactiveChangeKey } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\nimport { isComputed, isRef, KTReactiveType } from './core.js';\nimport { IdGenerator } from '../common.js';\n\nexport class KTRef<T> implements KTReactive<T> {\n /**\n * Indicates that this is a KTRef instance\n */\n isKT = true as const;\n\n ktType = KTReactiveType.REF;\n\n /**\n * @internal\n */\n private _value: T;\n\n /**\n * @internal\n */\n private _onChanges: Map<ReactiveChangeKey, ReactiveChangeHandler<T>>;\n\n /**\n * @internal\n */\n private _emit(newValue: T, oldValue: T, changeKeys?: ReactiveChangeKey[]) {\n if (changeKeys) {\n for (let i = 0; i < changeKeys.length; i++) {\n this._onChanges.get(changeKeys[i])?.(newValue, oldValue);\n }\n return;\n }\n this._onChanges.forEach((c) => c(newValue, oldValue));\n }\n\n constructor(_value: T, _onChange?: ReactiveChangeHandler<T>) {\n this._value = _value;\n this._onChanges = new Map();\n if (_onChange) {\n this._onChanges.set(IdGenerator.refOnChangeId, _onChange);\n }\n }\n\n /**\n * If new value and old value are both nodes, the old one will be replaced in the DOM\n */\n get value() {\n return this._value;\n }\n\n set value(newValue: T) {\n if ($is(newValue, this._value)) {\n return;\n }\n const oldValue = this._value;\n this._value = newValue;\n this._emit(newValue, oldValue);\n }\n\n /**\n * Force all listeners to run even when reference identity has not changed.\n * Useful for in-place array/object mutations.\n */\n notify(changeKeys?: ReactiveChangeKey[]) {\n this._emit(this._value, this._value, changeKeys);\n }\n\n /**\n * Mutate current value in-place and notify listeners once.\n *\n * @example\n * const items = ref<number[]>([1, 2]);\n * items.mutate((list) => list.push(3));\n */\n mutate<R = void>(mutator: (currentValue: T) => R, changeKeys?: ReactiveChangeKey[]): R {\n if (typeof mutator !== 'function') {\n $throw('KTRef.mutate: mutator must be a function');\n }\n const oldValue = this._value;\n const result = mutator(this._value);\n this._emit(this._value, oldValue, changeKeys);\n return result;\n }\n\n /**\n * Register a callback when the value changes\n * @param callback (newValue, oldValue) => xxx\n * @param key Optional key to identify the callback, allowing multiple listeners on the same ref and individual removal. If not provided, a unique ID will be generated.\n */\n addOnChange<K extends ReactiveChangeKey | undefined>(\n callback: ReactiveChangeHandler<T>,\n key?: K,\n ): K extends undefined ? number : K {\n if (typeof callback !== 'function') {\n $throw('KTRef.addOnChange: callback must be a function');\n }\n const k = key ?? IdGenerator.refOnChangeId;\n this._onChanges.set(k, callback);\n return k as K extends undefined ? number : K;\n }\n\n removeOnChange(key: ReactiveChangeKey): ReactiveChangeHandler<T> | undefined {\n const callback = this._onChanges.get(key);\n this._onChanges.delete(key);\n return callback;\n }\n}\n\n/**\n * Reference to the created HTML element.\n * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.\n * - can alse be used to store normal values, but it is not reactive.\n * - if the value is already a `KTRef`, it will be returned **directly**.\n * @param value mostly an HTMLElement\n */\nexport function ref<T = JSX.Element>(value?: T, onChange?: ReactiveChangeHandler<T>): KTRef<T> {\n return new KTRef<T>(value as any, onChange);\n}\n\n/**\n * Convert a value to `KTRef`.\n * - Returns the original value if it is already a `KTRef`.\n * - Throws error if the value is a `KTComputed`.\n * - Otherwise wraps the value with `ref()`.\n * @param o value to convert\n */\nexport const toRef = <T = any>(o: any): KTRef<T> => {\n if (isRef(o)) {\n return o;\n } else if (isComputed(o)) {\n $throw('Computed values cannot be used as KTRef.');\n } else {\n return ref(o);\n }\n};\n\nexport type KTSurfaceRef<T extends object> = {\n [K in keyof T]: KTRef<T[K]>;\n} & {\n /**\n * Get the dereferenced object like the original one\n */\n kcollect: () => T;\n};\n\nfunction kcollect<T extends object>(this: KTSurfaceRef<T>): T {\n const newObj: any = {};\n const entries = $entries(this);\n for (let i = 0; i < entries.length; i++) {\n const key = entries[i][0];\n if (key === 'kcollect') {\n continue;\n }\n newObj[key] = entries[i][1].value;\n }\n return newObj;\n}\n\n/**\n * Make all first-level properties of the object a `KTRef`.\n * - `obj.a.b` is not reactive\n */\nexport const surfaceRef = <T extends object>(obj: T): KTSurfaceRef<T> => {\n const entries = $entries(obj);\n const newObj = { kcollect } as KTSurfaceRef<T>;\n for (let i = 0; i < entries.length; i++) {\n (newObj[entries[i][0]] as KTReactive<any>) = ref(entries[i][1]);\n }\n return newObj;\n};\n\n// # asserts\n\n/**\n * Assert k-model to be a ref object\n */\nexport const $modelOrRef = <T = any>(props: any, defaultValue?: T): KTRef<T> => {\n // & props is an object. Won't use it in any other place\n if ('k-model' in props) {\n const kmodel = props['k-model'];\n if (isRef(kmodel)) {\n return kmodel;\n } else {\n $throw(`k-model data must be a KTRef object, please use 'ref(...)' to wrap it.`);\n }\n }\n return ref(defaultValue) as KTRef<T>;\n};\n\nconst $refSetter = <T>(props: { ref?: KTRef<T> }, node: T) => (props.ref!.value = node);\ntype RefSetter<T> = (props: { ref?: KTRef<T> }, node: T) => void;\n\n/**\n * Whether `props.ref` is a `KTRef` only needs to be checked in the initial render\n */\nexport const $initRef = <T extends Node>(props: { ref?: KTRef<T> }, node: T): RefSetter<T> => {\n if (!('ref' in props)) {\n return $emptyFn;\n }\n\n const r = props.ref;\n if (isRef(r)) {\n r.value = node;\n return $refSetter;\n } else {\n $throw('Fragment: ref must be a KTRef');\n }\n};\n","import type { KTReactive, ReactiveChangeHandler, ReactiveChangeKey } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\nimport { isKT, KTReactiveType } from './core.js';\nimport { IdGenerator } from '../common.js';\n\nexport class KTComputed<T> implements KTReactive<T> {\n /**\n * Indicates that this is a KTRef instance\n */\n isKT = true as const;\n\n ktType = KTReactiveType.COMPUTED;\n\n /**\n * @internal\n */\n private _calculator: () => T;\n\n /**\n * @internal\n */\n private _value: T;\n\n /**\n * @internal\n */\n private _onChanges: Map<ReactiveChangeKey, ReactiveChangeHandler<T>> = new Map();\n\n /**\n * @internal\n */\n private _emit(newValue: T, oldValue: T, changeKeys?: ReactiveChangeKey[]) {\n if (changeKeys) {\n for (let i = 0; i < changeKeys.length; i++) {\n this._onChanges.get(changeKeys[i])?.(newValue, oldValue);\n }\n return;\n }\n this._onChanges.forEach((c) => c(newValue, oldValue));\n }\n\n /**\n * @internal\n */\n private _recalculate(forceEmit: boolean = false, changeKeys?: ReactiveChangeKey[]) {\n const oldValue = this._value;\n const newValue = this._calculator();\n if (oldValue === newValue) {\n if (forceEmit) {\n this._emit(newValue, oldValue, changeKeys);\n }\n return;\n }\n this._value = newValue;\n this._emit(newValue, oldValue, changeKeys);\n }\n\n /**\n * @internal\n */\n private _subscribe(reactives: Array<KTReactive<unknown>>) {\n for (let i = 0; i < reactives.length; i++) {\n const reactive = reactives[i];\n reactive.addOnChange(() => this._recalculate());\n }\n }\n\n constructor(_calculator: () => T, reactives: Array<KTReactive<unknown>>) {\n this._calculator = _calculator;\n this._value = _calculator();\n this._subscribe(reactives);\n }\n\n /**\n * If new value and old value are both nodes, the old one will be replaced in the DOM\n */\n get value() {\n return this._value;\n }\n\n set value(_newValue: T) {\n $throw('KTComputed: cannot set value of a computed value');\n }\n\n /**\n * Force listeners to run once with the latest computed result.\n */\n notify(changeKeys?: ReactiveChangeKey[]) {\n this._recalculate(true, changeKeys);\n }\n\n /**\n * Computed values are derived from dependencies and should not be mutated manually.\n */\n mutate<R = void>(_mutator?: (currentValue: T) => R, changeKeys?: ReactiveChangeKey[]): R {\n $warn('KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');\n if (changeKeys) {\n this._emit(this._value, this._value, changeKeys);\n }\n return this._value as unknown as R;\n }\n\n /**\n * Register a callback when the value changes\n * @param callback (newValue, oldValue) => xxx\n */\n addOnChange<K extends ReactiveChangeKey | undefined>(\n callback: ReactiveChangeHandler<T>,\n key?: K,\n ): K extends undefined ? number : K {\n if (typeof callback !== 'function') {\n $throw('KTComputed.addOnChange: callback must be a function');\n }\n const k = key ?? IdGenerator.computedOnChangeId;\n this._onChanges.set(k, callback);\n return k as K extends undefined ? number : K;\n }\n\n /**\n * Unregister a callback\n * @param key registered listener key\n */\n removeOnChange(key: ReactiveChangeKey): ReactiveChangeHandler<T> | undefined {\n const callback = this._onChanges.get(key);\n this._onChanges.delete(key);\n return callback;\n }\n}\n\n/**\n * Create a reactive computed value\n * @param computeFn\n * @param reactives refs and computeds that this computed depends on\n */\nexport function computed<T = JSX.Element>(computeFn: () => T, reactives: Array<KTReactive<any>>): KTComputed<T> {\n if (reactives.some((v) => !isKT(v))) {\n $throw('computed: all reactives must be KTRef or KTComputed instances');\n }\n return new KTComputed<T>(computeFn, reactives);\n}\n","import { $emptyFn } from '@ktjs/shared';\nimport type { KTReactive } from '../types/reactive.js';\n\ninterface KTEffectOptions {\n lazy: boolean;\n onCleanup: () => void;\n debugName: string;\n}\n\n/**\n * Register a reactive effect with options.\n * @param effectFn The effect function to run when dependencies change\n * @param reactives The reactive dependencies\n * @param options Effect options: lazy, onCleanup, debugName\n * @returns stop function to remove all listeners\n */\nexport function effect(effectFn: () => void, reactives: Array<KTReactive<any>>, options?: Partial<KTEffectOptions>) {\n const { lazy = false, onCleanup = $emptyFn, debugName = '' } = Object(options);\n const listenerKeys: Array<string | number> = [];\n\n let active = true;\n\n const run = () => {\n if (!active) {\n return;\n }\n\n // cleanup before rerun\n onCleanup();\n\n try {\n effectFn();\n } catch (err) {\n $debug('effect error:', debugName, err);\n }\n };\n\n // subscribe to dependencies\n for (let i = 0; i < reactives.length; i++) {\n listenerKeys[i] = reactives[i].addOnChange(run);\n }\n\n // auto run unless lazy\n if (!lazy) {\n run();\n }\n\n // stop function\n return () => {\n if (!active) {\n return;\n }\n active = false;\n\n for (let i = 0; i < reactives.length; i++) {\n reactives[i].removeOnChange(listenerKeys[i]);\n }\n\n // final cleanup\n onCleanup();\n };\n}\n","import type { KTReactive, ReactiveChangeHandler } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\nimport { isKT } from './core.js';\nimport { ref } from './ref.js';\n\nexport const toReactive = <T>(value: T | KTReactive<T>, onChange?: ReactiveChangeHandler<T>): KTReactive<T> => {\n if (isKT(value)) {\n if (onChange) {\n value.addOnChange(onChange);\n }\n return value;\n } else {\n return ref(value as T, onChange) as KTReactive<T>;\n }\n};\n\n/**\n * Extracts the value from a KTReactive, or returns the value directly if it's not reactive.\n */\nexport function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T {\n return isKT<T>(value) ? value.value : value;\n}\n\nexport * from './core.js';\nexport * from './ref.js';\nexport * from './computed.js';\nexport * from './effect.js';\n","import { $applyModel, type InputElementTag } from '@ktjs/shared';\nimport { isKT, type KTRef } from '../reactive/index.js';\n\nexport function applyKModel(element: HTMLElementTagNameMap[InputElementTag], valueRef: KTRef<any>) {\n if (!isKT(valueRef)) {\n $throw('k-model value must be a KTRef.');\n }\n\n if (element.tagName === 'INPUT') {\n if (element.type === 'radio' || element.type === 'checkbox') {\n $applyModel(element, valueRef, 'checked', 'change');\n } else {\n $applyModel(element, valueRef, 'value', 'input');\n }\n } else if (element.tagName === 'SELECT') {\n $applyModel(element, valueRef, 'value', 'change');\n } else if (element.tagName === 'TEXTAREA') {\n $applyModel(element, valueRef, 'value', 'input');\n } else {\n $warn('not supported element for k-model:');\n }\n}\n","import type { HTMLTag, MathMLTag, SVGTag } from '@ktjs/shared';\nimport type { KTRawAttr, KTRawContent, HTML } from '../types/h.js';\n\nimport { applyAttr } from './attr.js';\nimport { applyContent } from './content.js';\nimport { applyKModel } from './model.js';\n\n/**\n * Create an enhanced HTMLElement.\n * - Only supports HTMLElements, **NOT** SVGElements or other Elements.\n * @param tag tag of an `HTMLElement`\n * @param attr attribute object or className\n * @param content a string or an array of HTMLEnhancedElement as child nodes\n *\n * __PKG_INFO__\n */\nexport const h = <T extends HTMLTag | SVGTag | MathMLTag>(\n tag: T,\n attr?: KTRawAttr,\n content?: KTRawContent,\n): HTML<T> => {\n if (typeof tag !== 'string') {\n $throw('tagName must be a string.');\n }\n\n // * start creating the element\n const element = document.createElement(tag) as HTML<T>;\n\n // * Handle content\n applyAttr(element, attr);\n applyContent(element, content);\n\n if (typeof attr === 'object' && attr !== null && 'k-model' in attr) {\n applyKModel(element as any, attr['k-model'] as any);\n }\n\n return element;\n};\n\nexport const svg = <T extends SVGTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent): HTML<T> => {\n if (typeof tag !== 'string') {\n $throw('tagName must be a string.');\n }\n\n // * start creating the element\n const element = document.createElementNS('http://www.w3.org/2000/svg', tag) as HTML<T>;\n\n // * Handle content\n applyAttr(element, attr);\n applyContent(element, content);\n\n if (typeof attr === 'object' && attr !== null && 'k-model' in attr) {\n applyKModel(element as any, attr['k-model'] as any);\n }\n\n return element;\n};\n\nexport const mathml = <T extends MathMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent): HTML<T> => {\n if (typeof tag !== 'string') {\n $throw('tagName must be a string.');\n }\n\n // * start creating the element\n const element = document.createElementNS('http://www.w3.org/1998/Math/MathML', tag) as HTML<T>;\n\n // * Handle content\n applyAttr(element, attr);\n applyContent(element, content);\n\n if (typeof attr === 'object' && attr !== null && 'k-model' in attr) {\n applyKModel(element as any, attr['k-model'] as any);\n }\n\n return element;\n};\n","import { $forEach, $isArray } from '@ktjs/shared';\nimport type { KTRef } from '../reactive/ref.js';\nimport type { KTReactive } from '../types/reactive.js';\nimport type { KTRawContent } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\n\nimport { $initRef, isKT, toReactive } from '../reactive/index.js';\n\nconst FRAGMENT_MOUNT_PATCHED = '__kt_fragment_mount_patched__';\nconst FRAGMENT_MOUNT = '__kt_fragment_mount__';\n\nif (typeof Node !== 'undefined' && !(globalThis as any)[FRAGMENT_MOUNT_PATCHED]) {\n (globalThis as any)[FRAGMENT_MOUNT_PATCHED] = true;\n\n const originAppendChild = Node.prototype.appendChild;\n Node.prototype.appendChild = function (node) {\n const result = originAppendChild.call(this, node);\n const mount = (node as any)[FRAGMENT_MOUNT];\n if (typeof mount === 'function') {\n mount();\n }\n return result as any;\n };\n\n const originInsertBefore = Node.prototype.insertBefore;\n Node.prototype.insertBefore = function (node: Node, child: Node | null) {\n const result = originInsertBefore.call(this, node, child);\n const mount = (node as any)[FRAGMENT_MOUNT];\n if (typeof mount === 'function') {\n mount();\n }\n return result as any;\n };\n}\n\nexport interface FragmentProps<T extends HTMLElement = HTMLElement> {\n /** Array of child elements, supports reactive arrays */\n children: T[] | KTReactive<T[]>;\n\n /** element key function for optimization (future enhancement) */\n key?: (element: T, index: number, array: T[]) => any;\n\n /** ref to get the anchor node */\n ref?: KTRef<JSX.Element>;\n}\n\n/**\n * Fragment - Container component for managing arrays of child elements\n *\n * Features:\n * 1. Returns a comment anchor node, child elements are inserted after the anchor\n * 2. Supports reactive arrays, automatically updates DOM when array changes\n * 3. Basic version uses simple replacement algorithm (remove all old elements, insert all new elements)\n * 4. Future enhancement: key-based optimization\n *\n * Usage example:\n * ```tsx\n * const children = ref([<div>A</div>, <div>B</div>]);\n * const fragment = <Fragment children={children} />;\n * document.body.appendChild(fragment);\n *\n * // Automatic update\n * children.value = [<div>C</div>, <div>D</div>];\n * ```\n */\nexport function Fragment<T extends HTMLElement = HTMLElement>(props: FragmentProps<T>): JSX.Element {\n const elements: T[] = [];\n const anchor = document.createComment('kt-fragment') as unknown as JSX.Element;\n let inserted = false;\n let observer: MutationObserver | undefined;\n\n const redraw = () => {\n const newElements = childrenRef.value;\n const parent = anchor.parentNode;\n\n if (!parent) {\n elements.length = 0;\n for (let i = 0; i < newElements.length; i++) {\n elements.push(newElements[i]);\n }\n (anchor as any).__kt_fragment_list__ = elements;\n return;\n }\n\n for (let i = 0; i < elements.length; i++) {\n elements[i].remove();\n }\n\n const fragment = document.createDocumentFragment();\n elements.length = 0;\n\n for (let i = 0; i < newElements.length; i++) {\n const element = newElements[i];\n elements.push(element);\n fragment.appendChild(element);\n }\n\n parent.insertBefore(fragment, anchor.nextSibling);\n inserted = true;\n delete (anchor as any)[FRAGMENT_MOUNT];\n observer?.disconnect();\n observer = undefined;\n (anchor as any).__kt_fragment_list__ = elements;\n };\n\n const childrenRef = toReactive(props.children, redraw);\n\n const renderInitial = () => {\n const current = childrenRef.value;\n elements.length = 0;\n\n const fragment = document.createDocumentFragment();\n for (let i = 0; i < current.length; i++) {\n const element = current[i];\n elements.push(element);\n fragment.appendChild(element);\n }\n\n (anchor as any).__kt_fragment_list__ = elements;\n\n const parent = anchor.parentNode;\n if (parent && !inserted) {\n parent.insertBefore(fragment, anchor.nextSibling);\n inserted = true;\n }\n };\n\n renderInitial();\n\n (anchor as any)[FRAGMENT_MOUNT] = () => {\n if (!inserted && anchor.parentNode) {\n redraw();\n }\n };\n\n observer = new MutationObserver(() => {\n if (anchor.parentNode && !inserted) {\n redraw();\n observer?.disconnect();\n observer = undefined;\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n\n $initRef(props, anchor);\n\n return anchor;\n}\n\n/**\n * Convert KTRawContent to HTMLElement array\n */\nexport function convertChildrenToElements(children: KTRawContent): HTMLElement[] {\n const elements: HTMLElement[] = [];\n\n const processChild = (child: any): void => {\n if (child === undefined || child === null || child === false || child === true) {\n // Ignore null, undefined, false, true\n return;\n }\n\n if ($isArray(child)) {\n // Recursively process array\n $forEach(child, processChild);\n return;\n }\n\n if (typeof child === 'string' || typeof child === 'number') {\n const span = document.createElement('span');\n span.textContent = String(child);\n elements.push(span);\n return;\n }\n\n if (child instanceof HTMLElement) {\n elements.push(child);\n return;\n }\n\n if (isKT(child)) {\n processChild(child.value);\n return;\n }\n\n console.warn('Fragment: unsupported child type', child);\n };\n\n processChild(children);\n return elements;\n}\n","import type { JSXTag } from '@ktjs/shared';\nimport type { KTAttribute } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\nimport { h } from '../h/index';\n\nexport const jsxh = (tag: JSXTag, props: KTAttribute): HTMLElement => {\n if (typeof tag === 'function') {\n return tag(props) as HTMLElement;\n } else {\n return h(tag, props, props.children) as HTMLElement;\n }\n};\n\nexport const placeholder = (data: string): JSX.Element => document.createComment(data) as unknown as JSX.Element;\n","import type { JSXTag, MathMLTag, SVGTag } from '@ktjs/shared';\nimport type { KTAttribute, KTRawContent } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\n\nimport { h, mathml as createMathMLElement, svg as createSVGElement } from '../h/index.js';\nimport { $initRef, isComputed, type KTRef, ref } from '../reactive/index.js';\nimport { convertChildrenToElements, Fragment as FragmentArray } from './fragment.js';\nimport { jsxh, placeholder } from './common.js';\n\nfunction assertWritableRef(props: KTAttribute) {\n if (isComputed(props.ref)) {\n $throw('Cannot assign a computed value to an element.');\n }\n}\n\n/**\n * @param tag html tag or function component\n * @param props properties/attributes\n */\nexport function jsx(tag: JSXTag, props: KTAttribute): JSX.Element {\n assertWritableRef(props);\n const el = jsxh(tag, props);\n $initRef(props, el);\n return el;\n}\n\nexport function svg(tag: SVGTag, props: KTAttribute): JSX.Element {\n assertWritableRef(props);\n const el = createSVGElement(tag, props, props.children) as unknown as JSX.Element;\n $initRef(props, el);\n return el;\n}\n\nexport function mathml(tag: MathMLTag, props: KTAttribute): JSX.Element {\n assertWritableRef(props);\n const el = createMathMLElement(tag, props, props.children) as unknown as JSX.Element;\n $initRef(props, el);\n return el;\n}\n\nexport { svg as svgRuntime, mathml as mathmlRuntime };\n\n/**\n * Fragment support - returns an array of children\n * Enhanced Fragment component that manages arrays of elements\n */\nexport function Fragment(props: { children?: KTRawContent }): JSX.Element {\n const { children } = props ?? {};\n\n if (!children) {\n return placeholder('kt-fragment-empty');\n }\n\n const elements = convertChildrenToElements(children);\n\n return FragmentArray({ children: elements });\n}\n\n/**\n * JSX Development runtime - same as jsx but with additional dev checks\n */\nexport const jsxDEV: typeof jsx = (...args) => {\n // console.log('JSX DEV called:', ...args);\n // console.log('children', (args[1] as any)?.children);\n return jsx(...args);\n};\n\n/**\n * JSX runtime for React 17+ automatic runtime\n * This is called when using jsx: \"react-jsx\" or \"react-jsxdev\"\n */\nexport const jsxs = jsx;\n\n// Export h as the classic JSX factory for backward compatibility\nexport { h, h as createElement };\n\n/**\n * A helper to create redrawable elements\n * ```tsx\n * export function MyComponent() {\n * let aa = 10;\n * // ...\n * // aa might be changed\n * return createRedrawable(() => <div>{aa}</div>);\n * }\n * ```\n * Then the returned element has a `redraw` method to redraw itself with new values.\n * @param creator a simple creator function that returns an element\n * @returns created element's ref\n */\nexport function createRedrawable<T>(creator: () => T): KTRef<T> & { redraw: () => T } {\n const elRef = ref<T>() as KTRef<T> & { redraw: () => T };\n\n const redraw = () => {\n elRef.value = creator(); // ref setter automatically calls replaceWith\n elRef.redraw = redraw;\n return elRef.value;\n };\n\n redraw();\n return elRef;\n}\n","import { $isThenable } from '@ktjs/shared';\nimport type { KTComponent, KTRawContent } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\nimport type { KTRef } from '../reactive/ref.js';\n\n/**\n * Extract component props type (excluding ref and children)\n */\ntype ExtractComponentProps<T> = T extends (props: infer P) => any ? Omit<P, 'ref' | 'children'> : {};\n\nexport function KTAsync<T extends KTComponent>(\n props: {\n ref?: KTRef<JSX.Element>;\n skeleton?: JSX.Element;\n component: T;\n children?: KTRawContent;\n } & ExtractComponentProps<T>,\n): JSX.Element {\n const raw = props.component(props);\n let comp: JSX.Element =\n props.skeleton ?? (document.createComment('ktjs-suspense-placeholder') as unknown as JSX.Element);\n\n if ($isThenable(raw)) {\n raw.then((resolved) => comp.replaceWith(resolved));\n } else {\n comp = raw as JSX.Element;\n }\n\n return comp;\n}\n","import type { KTRef } from '../reactive/ref.js';\nimport type { KTReactive } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\nimport { $initRef, toReactive } from '../reactive/index.js';\nimport { $identity } from '@ktjs/shared';\n\nexport type KTForElement = JSX.Element;\n\nexport interface KTForProps<T> {\n ref?: KTRef<KTForElement>;\n list: T[] | KTReactive<T[]>;\n key?: (item: T, index: number, array: T[]) => any;\n map?: (item: T, index: number, array: T[]) => HTMLElement;\n}\n\n/**\n * KTFor - List rendering component with key-based optimization\n * Returns a Comment anchor node with rendered elements in __kt_for_list__\n */\nexport function KTFor<T>(props: KTForProps<T>): KTForElement {\n const redraw = () => {\n const newList = listRef.value;\n\n const parent = anchor.parentNode;\n if (!parent) {\n // If not in DOM yet, just rebuild the list\n const newElements: HTMLElement[] = [];\n nodeMap.clear();\n for (let index = 0; index < newList.length; index++) {\n const item = newList[index];\n const itemKey = currentKey(item, index, newList);\n const node = currentMap(item, index, newList);\n nodeMap.set(itemKey, node);\n newElements.push(node);\n }\n (anchor as any).__kt_for_list__ = newElements;\n return anchor;\n }\n\n const oldLength = (anchor as any).__kt_for_list__.length;\n const newLength = newList.length;\n\n // Fast path: empty list\n if (newLength === 0) {\n nodeMap.forEach((node) => node.remove());\n nodeMap.clear();\n (anchor as any).__kt_for_list__ = [];\n return anchor;\n }\n\n // Fast path: all new items\n if (oldLength === 0) {\n const newElements: HTMLElement[] = [];\n const fragment = document.createDocumentFragment();\n for (let i = 0; i < newLength; i++) {\n const item = newList[i];\n const itemKey = currentKey(item, i, newList);\n const node = currentMap(item, i, newList);\n nodeMap.set(itemKey, node);\n newElements.push(node);\n fragment.appendChild(node);\n }\n parent.insertBefore(fragment, anchor.nextSibling);\n (anchor as any).__kt_for_list__ = newElements;\n return anchor;\n }\n\n // Build key index map and new elements array in one pass\n const newKeyToNewIndex = new Map<any, number>();\n const newElements: HTMLElement[] = new Array(newLength);\n let maxNewIndexSoFar = 0;\n let moved = false;\n\n for (let i = 0; i < newLength; i++) {\n const item = newList[i];\n const itemKey = currentKey(item, i, newList);\n newKeyToNewIndex.set(itemKey, i);\n\n if (nodeMap.has(itemKey)) {\n // Reuse existing node\n const node = nodeMap.get(itemKey)!;\n newElements[i] = node;\n\n // Track if items moved\n if (i < maxNewIndexSoFar) {\n moved = true;\n } else {\n maxNewIndexSoFar = i;\n }\n } else {\n // Create new node\n newElements[i] = currentMap(item, i, newList);\n }\n }\n\n // Remove nodes not in new list\n const toRemove: HTMLElement[] = [];\n nodeMap.forEach((node, key) => {\n if (!newKeyToNewIndex.has(key)) {\n toRemove.push(node);\n }\n });\n for (let i = 0; i < toRemove.length; i++) {\n toRemove[i].remove();\n }\n\n // Update DOM with minimal operations\n if (moved) {\n // Use longest increasing subsequence to minimize moves\n const seq = getSequence(newElements.map((el, i) => (nodeMap.has(currentKey(newList[i], i, newList)) ? i : -1)));\n\n let j = seq.length - 1;\n let anchor: Node | null = null;\n\n // Traverse from end to start for stable insertions\n for (let i = newLength - 1; i >= 0; i--) {\n const node = newElements[i];\n\n if (j < 0 || i !== seq[j]) {\n // Node needs to be moved or inserted\n if (anchor) {\n parent.insertBefore(node, anchor);\n } else {\n // Insert at end\n let nextSibling = (anchor as any).nextSibling;\n let temp = nextSibling;\n while (temp && newElements.includes(temp as HTMLElement)) {\n temp = temp.nextSibling;\n }\n parent.insertBefore(node, temp);\n }\n } else {\n j--;\n }\n anchor = node;\n }\n } else {\n // No moves needed, just insert new nodes\n let currentNode = anchor.nextSibling;\n for (let i = 0; i < newLength; i++) {\n const node = newElements[i];\n if (currentNode !== node) {\n parent.insertBefore(node, currentNode);\n } else {\n currentNode = currentNode.nextSibling;\n }\n }\n }\n\n // Update maps\n nodeMap.clear();\n for (let i = 0; i < newLength; i++) {\n const itemKey = currentKey(newList[i], i, newList);\n nodeMap.set(itemKey, newElements[i]);\n }\n (anchor as any).__kt_for_list__ = newElements;\n return anchor;\n };\n\n const { key: currentKey = (item: T) => item, map: currentMap = $identity } = props;\n const listRef = toReactive(props.list, redraw);\n const anchor = document.createComment('kt-for') as unknown as KTForElement;\n\n // Map to track rendered nodes by key\n const nodeMap = new Map<any, HTMLElement>();\n\n // Render initial list\n const elements: HTMLElement[] = [];\n for (let index = 0; index < listRef.value.length; index++) {\n const item = listRef.value[index];\n const itemKey = currentKey(item, index, listRef.value);\n const node = currentMap(item, index, listRef.value);\n nodeMap.set(itemKey, node);\n elements.push(node);\n }\n\n (anchor as any).__kt_for_list__ = elements;\n\n $initRef(props, anchor);\n\n return anchor;\n}\n\n// Longest Increasing Subsequence algorithm (optimized for diff)\nfunction getSequence(arr: number[]): number[] {\n const p = arr.slice();\n const result = [0];\n let i: number, j: number, u: number, v: number, c: number;\n const len = arr.length;\n\n for (i = 0; i < len; i++) {\n const arrI = arr[i];\n if (arrI === -1) continue;\n\n j = result[result.length - 1];\n if (arr[j] < arrI) {\n p[i] = j;\n result.push(i);\n continue;\n }\n\n u = 0;\n v = result.length - 1;\n\n while (u < v) {\n c = ((u + v) / 2) | 0;\n if (arr[result[c]] < arrI) {\n u = c + 1;\n } else {\n v = c;\n }\n }\n\n if (arrI < arr[result[u]]) {\n if (u > 0) {\n p[i] = result[u - 1];\n }\n result[u] = i;\n }\n }\n\n u = result.length;\n v = result[u - 1];\n\n while (u-- > 0) {\n result[u] = v;\n v = p[v];\n }\n\n return result;\n}\n","import type { JSXTag } from '@ktjs/shared';\nimport type { KTAttribute } from '../types/h.js';\nimport type { KTReactive } from '../types/reactive.js';\n\nimport { isKT } from '../reactive/index.js';\nimport { jsxh, placeholder } from './common.js';\n\nexport function KTConditional(\n condition: boolean | KTReactive<boolean>,\n tagIf: JSXTag,\n propsIf: KTAttribute,\n tagElse?: JSXTag,\n propsElse?: KTAttribute,\n) {\n if (!isKT(condition)) {\n return condition ? jsxh(tagIf, propsIf) : tagElse ? jsxh(tagElse, propsElse!) : placeholder('kt-conditional');\n }\n\n if (tagElse) {\n let current = condition.value ? jsxh(tagIf, propsIf) : jsxh(tagElse!, propsElse!);\n condition.addOnChange((newValue) => {\n const old = current;\n current = newValue ? jsxh(tagIf, propsIf) : jsxh(tagElse!, propsElse!);\n old.replaceWith(current);\n });\n return current;\n } else {\n const dummy = placeholder('kt-conditional') as HTMLElement;\n let current = condition.value ? jsxh(tagIf, propsIf) : dummy;\n condition.addOnChange((newValue) => {\n const old = current;\n current = newValue ? jsxh(tagIf, propsIf) : dummy;\n old.replaceWith(current);\n });\n return current;\n }\n}\n"],"names":["svg","mathml","Fragment","createSVGElement","createMathMLElement","FragmentArray"],"mappings":";;AAQO,MAAM,IAAI,GAAG,CAAU,GAAQ,KAA2B,GAAG,EAAE;AAC/D,MAAM,KAAK,GAAG,CAAU,GAAQ,KAAsB,GAAG,EAAE,MAAM;AACjE,MAAM,UAAU,GAAG,CAAU,GAAQ,KAA2B,GAAG,EAAE,MAAM;;ACVlF,MAAM,cAAc,GAAG,CAAC,OAAiD,EAAE,GAAW,EAAE,KAAU,KAAI;AACpG,IAAA,IAAI,GAAG,IAAI,OAAO,EAAE;AACjB,QAAA,OAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK;IACjC;SAAO;AACL,QAAA,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC;IAClC;AACF,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,OAAiD,EAAE,GAAW,EAAE,KAAU,KAAI;AAClG,IAAA,I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C,WAAW,CAAC,CAAC,QAAQ,KAAI;YACjC,MAAM,GAAG,GAAG,OAAO;AACnB,YAAA,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,KAAK;AACjD,YAAA,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC;AAC1B,QAAA,CAAC,CAAC;AACF,QAAA,OAAO,OAAO;IAChB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/reactive/core.ts","../src/h/attr-helpers.ts","../src/h/attr.ts","../src/h/content.ts","../src/common.ts","../src/reactive/computed.ts","../src/reactive/ref.ts","../src/reactive/effect.ts","../src/reactive/index.ts","../src/h/model.ts","../src/h/index.ts","../src/jsx/fragment.ts","../src/jsx/common.ts","../src/jsx/jsx-runtime.ts","../src/jsx/async.ts","../src/jsx/for.ts","../src/jsx/if.ts"],"sourcesContent":["import type { KTReactive } from '../types/reactive.js';\nimport type { KTComputed, KTRef } from './index.js';\n\nexport const enum KTReactiveType {\n REF = 1,\n COMPUTED = 2,\n}\n\nexport const isKT = <T = any>(obj: any): obj is KTReactive<T> => obj?.isKT;\nexport const isRef = <T = any>(obj: any): obj is KTRef<T> => obj?.ktType === KTReactiveType.REF;\nexport const isComputed = <T = any>(obj: any): obj is KTComputed<T> => obj?.ktType === KTReactiveType.COMPUTED;\n","const booleanHandler = (element: HTMLElement | SVGElement | MathMLElement, key: string, value: any) => {\n if (key in element) {\n (element as any)[key] = !!value;\n } else {\n element.setAttribute(key, value);\n }\n};\n\nconst valueHandler = (element: HTMLElement | SVGElement | MathMLElement, key: string, value: any) => {\n if (key in element) {\n (element as any)[key] = value;\n } else {\n element.setAttribute(key, value);\n }\n};\n\n// Attribute handlers map for optimized lookup\nexport const handlers: Record<\n string,\n (element: HTMLElement | SVGElement | MathMLElement, key: string, value: any) => void\n> = {\n checked: booleanHandler,\n selected: booleanHandler,\n value: valueHandler,\n valueAsDate: valueHandler,\n valueAsNumber: valueHandler,\n defaultValue: valueHandler,\n defaultChecked: booleanHandler,\n defaultSelected: booleanHandler,\n disabled: booleanHandler,\n readOnly: booleanHandler,\n multiple: booleanHandler,\n required: booleanHandler,\n autofocus: booleanHandler,\n open: booleanHandler,\n controls: booleanHandler,\n autoplay: booleanHandler,\n loop: booleanHandler,\n muted: booleanHandler,\n defer: booleanHandler,\n async: booleanHandler,\n hidden: (element, _key, value) => ((element as HTMLElement).hidden = !!value),\n};\n\ntype InputElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\ntype StringEventHandler = (element: InputElement, handler: (value: string) => void) => void;\ntype NumberEventHandler = (element: InputElement, handler: (value: number) => void) => void;\n\nexport const ktEventHandlers: Record<string, StringEventHandler | NumberEventHandler> = {\n 'on:ktchange': (element: InputElement, handler: (value: string) => void) =>\n element.addEventListener('change', () => handler(element.value)),\n 'ontrim:ktchange': (element: InputElement, handler: (value: string) => void) =>\n element.addEventListener('change', () => handler(element.value.trim())),\n 'on:ktchangenumber': (element: InputElement, handler: (value: number) => void) =>\n element.addEventListener('change', () => handler(Number(element.value))),\n 'on:ktinput': (element: InputElement, handler: (value: string) => void) =>\n element.addEventListener('input', () => handler(element.value)),\n 'ontrim:ktinput': (element: InputElement, handler: (value: string) => void) =>\n element.addEventListener('input', () => handler(element.value.trim())),\n 'on:ktinputnumber': (element: InputElement, handler: (value: number) => void) =>\n element.addEventListener('input', () => handler(Number(element.value))),\n};\n","import type { KTReactifyProps } from '../types/reactive.js';\nimport type { KTRawAttr, KTAttribute } from '../types/h.js';\nimport { isKT } from '../reactive/core.js';\nimport { handlers } from './attr-helpers.js';\n\nconst defaultHandler = (element: HTMLElement | SVGElement | MathMLElement, key: string, value: any) =>\n element.setAttribute(key, value);\n\nconst setElementStyle = (\n element: HTMLElement | SVGElement | MathMLElement,\n style: Partial<CSSStyleDeclaration> | string,\n) => {\n if (typeof style === 'string') {\n (element as HTMLElement).style.cssText = style;\n return;\n }\n\n for (const key in style) {\n (element as any).style[key as any] = style[key];\n }\n};\n\nfunction attrIsObject(element: HTMLElement | SVGElement | MathMLElement, attr: KTReactifyProps<KTAttribute>) {\n const classValue = attr.class || attr.className;\n if (classValue !== undefined) {\n if (isKT<string>(classValue)) {\n element.setAttribute('class', classValue.value);\n classValue.addOnChange((v) => element.setAttribute('class', v));\n } else {\n element.setAttribute('class', classValue);\n }\n }\n\n const style = attr.style;\n if (style) {\n if (typeof style === 'string') {\n element.setAttribute('style', style);\n } else if (typeof style === 'object') {\n if (isKT(style)) {\n setElementStyle(element, style.value);\n style.addOnChange((v: Partial<CSSStyleDeclaration> | string) => setElementStyle(element, v));\n } else {\n setElementStyle(element, style as Partial<CSSStyleDeclaration>);\n }\n }\n }\n\n if ('k-html' in attr) {\n const html = attr['k-html'];\n if (isKT(html)) {\n element.innerHTML = html.value;\n html.addOnChange((v) => (element.innerHTML = v));\n } else {\n element.innerHTML = html;\n }\n }\n\n for (const key in attr) {\n // & Arranged in order of usage frequency\n if (\n // key === 'k-if' ||\n // key === 'k-else' ||\n key === 'k-model' ||\n key === 'k-for' ||\n key === 'k-key' ||\n key === 'ref' ||\n key === 'class' ||\n key === 'className' ||\n key === 'style' ||\n key === 'children' ||\n key === 'k-html'\n ) {\n continue;\n }\n\n const o = attr[key];\n\n // normal event handler\n if (key.startsWith('on:')) {\n if (o) {\n element.addEventListener(key.slice(3), o); // chop off the `on:`\n }\n continue;\n }\n\n // normal attributes\n const handler = handlers[key] || defaultHandler;\n if (isKT(o)) {\n handler(element, key, o.value);\n o.addOnChange((v) => handler(element, key, v));\n } else {\n handler(element, key, o);\n }\n }\n}\n\nexport function applyAttr(element: HTMLElement | SVGElement | MathMLElement, attr: KTRawAttr) {\n if (!attr) {\n return;\n }\n if (typeof attr === 'object' && attr !== null) {\n attrIsObject(element, attr as KTAttribute);\n } else {\n $throw('attr must be an object.');\n }\n}\n","import { $isArray, $isNode, $isThenable } from '@ktjs/shared';\nimport type { KTAvailableContent, KTRawContent } from '../types/h.js';\nimport { isKT } from '../reactive/core.js';\n\nconst assureNode = (o: any) => ($isNode(o) ? o : document.createTextNode(o));\n\nfunction apdSingle(element: HTMLElement | DocumentFragment | SVGElement | MathMLElement, c: KTAvailableContent) {\n // & Ignores falsy values, consistent with React's behavior\n if (c === undefined || c === null || c === false) {\n return;\n }\n\n if (isKT(c)) {\n let node = assureNode(c.value);\n element.appendChild(node);\n c.addOnChange((newValue, _oldValue) => {\n const oldNode = node;\n node = assureNode(newValue);\n oldNode.replaceWith(node);\n });\n } else {\n const node = assureNode(c);\n element.appendChild(node);\n // Handle KTFor anchor\n const list = (node as any).__kt_for_list__ as any[];\n if ($isArray(list)) {\n apd(element, list);\n }\n }\n}\n\nfunction apd(element: HTMLElement | DocumentFragment | SVGElement | MathMLElement, c: KTAvailableContent) {\n if ($isThenable(c)) {\n c.then((r) => apd(element, r));\n } else if ($isArray(c)) {\n for (let i = 0; i < c.length; i++) {\n // & might be thenable here too\n const ci = c[i];\n if ($isThenable(ci)) {\n const comment = document.createComment('ktjs-promise-placeholder');\n element.appendChild(comment);\n ci.then((awaited) => comment.replaceWith(awaited));\n } else {\n apdSingle(element, ci);\n }\n }\n } else {\n // & here is thened, so must be a simple elementj\n apdSingle(element, c);\n }\n}\n\nexport function applyContent(element: HTMLElement | SVGElement | MathMLElement, content: KTRawContent): void {\n if ($isArray(content)) {\n for (let i = 0; i < content.length; i++) {\n apd(element, content[i]);\n }\n } else {\n apd(element, content as KTAvailableContent);\n }\n}\n","// # internal methods that cannot be placed in @ktjs/shared\n\nexport const IdGenerator = {\n _refOnChangeId: 1,\n get refOnChangeId() {\n return this._refOnChangeId++;\n },\n _computedOnChangeId: 1,\n get computedOnChangeId() {\n return this._computedOnChangeId++;\n },\n _kid: 1,\n get kid() {\n return this._kid++;\n },\n};\n","import type { KTReactive, ReactiveChangeHandler, ReactiveChangeKey } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\nimport { isKT, KTReactiveType } from './core.js';\nimport { IdGenerator } from '../common.js';\n\nexport class KTComputed<T> implements KTReactive<T> {\n /**\n * Indicates that this is a KTRef instance\n */\n isKT = true as const;\n\n ktType = KTReactiveType.COMPUTED;\n\n /**\n * @internal\n */\n private _calculator: () => T;\n\n /**\n * @internal\n */\n private _value: T;\n\n /**\n * @internal\n */\n private _onChanges: Map<ReactiveChangeKey, ReactiveChangeHandler<T>> = new Map();\n\n /**\n * @internal\n */\n private _emit(newValue: T, oldValue: T, changeKeys?: ReactiveChangeKey[]) {\n if (changeKeys) {\n for (let i = 0; i < changeKeys.length; i++) {\n this._onChanges.get(changeKeys[i])?.(newValue, oldValue);\n }\n return;\n }\n this._onChanges.forEach((c) => c(newValue, oldValue));\n }\n\n /**\n * @internal\n */\n private _recalculate(forceEmit: boolean = false, changeKeys?: ReactiveChangeKey[]) {\n const oldValue = this._value;\n const newValue = this._calculator();\n if (oldValue === newValue) {\n if (forceEmit) {\n this._emit(newValue, oldValue, changeKeys);\n }\n return;\n }\n this._value = newValue;\n this._emit(newValue, oldValue, changeKeys);\n }\n\n /**\n * @internal\n */\n private _subscribe(reactives: Array<KTReactive<unknown>>) {\n for (let i = 0; i < reactives.length; i++) {\n const reactive = reactives[i];\n reactive.addOnChange(() => this._recalculate());\n }\n }\n\n constructor(_calculator: () => T, reactives: Array<KTReactive<unknown>>) {\n this._calculator = _calculator;\n this._value = _calculator();\n this._subscribe(reactives);\n }\n\n /**\n * If new value and old value are both nodes, the old one will be replaced in the DOM\n */\n get value() {\n return this._value;\n }\n\n set value(_newValue: T) {\n $throw('KTComputed: cannot set value of a computed value');\n }\n\n /**\n * Force listeners to run once with the latest computed result.\n */\n notify(changeKeys?: ReactiveChangeKey[]) {\n this._recalculate(true, changeKeys);\n }\n\n /**\n * Computed values are derived from dependencies and should not be mutated manually.\n */\n mutate<R = void>(_mutator?: (currentValue: T) => R, changeKeys?: ReactiveChangeKey[]): R {\n $warn('KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');\n if (changeKeys) {\n this._emit(this._value, this._value, changeKeys);\n }\n return this._value as unknown as R;\n }\n\n deriveComputed<R>(calculator: (currentValue: T) => R, dependencies?: KTReactive<unknown>[]): KTComputed<R> {\n return computed(() => calculator(this.value), dependencies ? [this, ...dependencies] : [this]);\n }\n\n /**\n * Register a callback when the value changes\n * @param callback (newValue, oldValue) => xxx\n */\n addOnChange<K extends ReactiveChangeKey | undefined>(\n callback: ReactiveChangeHandler<T>,\n key?: K,\n ): K extends undefined ? number : K {\n if (typeof callback !== 'function') {\n $throw('KTComputed.addOnChange: callback must be a function');\n }\n const k = key ?? IdGenerator.computedOnChangeId;\n this._onChanges.set(k, callback);\n return k as K extends undefined ? number : K;\n }\n\n /**\n * Unregister a callback\n * @param key registered listener key\n */\n removeOnChange(key: ReactiveChangeKey): ReactiveChangeHandler<T> | undefined {\n const callback = this._onChanges.get(key);\n this._onChanges.delete(key);\n return callback;\n }\n}\n\n/**\n * Create a reactive computed value\n * @param computeFn\n * @param dependencies refs and computeds that this computed depends on\n */\nexport function computed<T = JSX.Element>(computeFn: () => T, dependencies: Array<KTReactive<any>>): KTComputed<T> {\n if (dependencies.some((v) => !isKT(v))) {\n $throw('computed: all reactives must be KTRef or KTComputed instances');\n }\n return new KTComputed<T>(computeFn, dependencies);\n}\n","import { $emptyFn, $entries, $is } from '@ktjs/shared';\nimport type { KTReactive, ReactiveChangeHandler, ReactiveChangeKey } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\nimport { isComputed, isRef, KTReactiveType } from './core.js';\nimport { IdGenerator } from '../common.js';\nimport { computed, type KTComputed } from './computed.js';\n\nexport class KTRef<T> implements KTReactive<T> {\n /**\n * Indicates that this is a KTRef instance\n */\n isKT = true as const;\n\n ktType = KTReactiveType.REF;\n\n /**\n * @internal\n */\n private _value: T;\n\n /**\n * @internal\n */\n private _onChanges: Map<ReactiveChangeKey, ReactiveChangeHandler<T>>;\n\n /**\n * @internal\n */\n private _emit(newValue: T, oldValue: T, changeKeys?: ReactiveChangeKey[]) {\n if (changeKeys) {\n for (let i = 0; i < changeKeys.length; i++) {\n this._onChanges.get(changeKeys[i])?.(newValue, oldValue);\n }\n return;\n }\n this._onChanges.forEach((c) => c(newValue, oldValue));\n }\n\n constructor(_value: T, _onChange?: ReactiveChangeHandler<T>) {\n this._value = _value;\n this._onChanges = new Map();\n if (_onChange) {\n this._onChanges.set(IdGenerator.refOnChangeId, _onChange);\n }\n }\n\n /**\n * If new value and old value are both nodes, the old one will be replaced in the DOM\n */\n get value() {\n return this._value;\n }\n\n set value(newValue: T) {\n if ($is(newValue, this._value)) {\n return;\n }\n const oldValue = this._value;\n this._value = newValue;\n this._emit(newValue, oldValue);\n }\n\n /**\n * Force all listeners to run even when reference identity has not changed.\n * Useful for in-place array/object mutations.\n */\n notify(changeKeys?: ReactiveChangeKey[]) {\n this._emit(this._value, this._value, changeKeys);\n }\n\n /**\n * Mutate current value in-place and notify listeners once.\n *\n * @example\n * const items = ref<number[]>([1, 2]);\n * items.mutate((list) => list.push(3));\n */\n mutate<R = void>(mutator: (currentValue: T) => R, changeKeys?: ReactiveChangeKey[]): R {\n if (typeof mutator !== 'function') {\n $throw('KTRef.mutate: mutator must be a function');\n }\n const oldValue = this._value;\n const result = mutator(this._value);\n this._emit(this._value, oldValue, changeKeys);\n return result;\n }\n\n deriveComputed<R>(calculator: (currentValue: T) => R, dependencies?: KTReactive<unknown>[]): KTComputed<R> {\n return computed(() => calculator(this.value), dependencies ? [this, ...dependencies] : [this]);\n }\n\n /**\n * Register a callback when the value changes\n * @param callback (newValue, oldValue) => xxx\n * @param key Optional key to identify the callback, allowing multiple listeners on the same ref and individual removal. If not provided, a unique ID will be generated.\n */\n addOnChange<K extends ReactiveChangeKey | undefined>(\n callback: ReactiveChangeHandler<T>,\n key?: K,\n ): K extends undefined ? number : K {\n if (typeof callback !== 'function') {\n $throw('KTRef.addOnChange: callback must be a function');\n }\n const k = key ?? IdGenerator.refOnChangeId;\n this._onChanges.set(k, callback);\n return k as K extends undefined ? number : K;\n }\n\n removeOnChange(key: ReactiveChangeKey): ReactiveChangeHandler<T> | undefined {\n const callback = this._onChanges.get(key);\n this._onChanges.delete(key);\n return callback;\n }\n}\n\n/**\n * Reference to the created HTML element.\n * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.\n * - can alse be used to store normal values, but it is not reactive.\n * - if the value is already a `KTRef`, it will be returned **directly**.\n * @param value mostly an HTMLElement\n */\nexport function ref<T = JSX.Element>(value?: T, onChange?: ReactiveChangeHandler<T>): KTRef<T> {\n return new KTRef<T>(value as any, onChange);\n}\n\n/**\n * Convert a value to `KTRef`.\n * - Returns the original value if it is already a `KTRef`.\n * - Throws error if the value is a `KTComputed`.\n * - Otherwise wraps the value with `ref()`.\n * @param o value to convert\n */\nexport const toRef = <T = any>(o: any): KTRef<T> => {\n if (isRef(o)) {\n return o;\n } else if (isComputed(o)) {\n $throw('Computed values cannot be used as KTRef.');\n } else {\n return ref(o);\n }\n};\n\nexport type KTSurfaceRef<T extends object> = {\n [K in keyof T]: KTRef<T[K]>;\n} & {\n /**\n * Get the dereferenced object like the original one\n */\n kcollect: () => T;\n};\n\nfunction kcollect<T extends object>(this: KTSurfaceRef<T>): T {\n const newObj: any = {};\n const entries = $entries(this);\n for (let i = 0; i < entries.length; i++) {\n const key = entries[i][0];\n if (key === 'kcollect') {\n continue;\n }\n newObj[key] = entries[i][1].value;\n }\n return newObj;\n}\n\n/**\n * Make all first-level properties of the object a `KTRef`.\n * - `obj.a.b` is not reactive\n */\nexport const surfaceRef = <T extends object>(obj: T): KTSurfaceRef<T> => {\n const entries = $entries(obj);\n const newObj = { kcollect } as KTSurfaceRef<T>;\n for (let i = 0; i < entries.length; i++) {\n (newObj[entries[i][0]] as KTReactive<any>) = ref(entries[i][1]);\n }\n return newObj;\n};\n\n// # asserts\n\n/**\n * Assert k-model to be a ref object\n */\nexport const $modelOrRef = <T = any>(props: any, defaultValue?: T): KTRef<T> => {\n // & props is an object. Won't use it in any other place\n if ('k-model' in props) {\n const kmodel = props['k-model'];\n if (isRef(kmodel)) {\n return kmodel;\n } else {\n $throw(`k-model data must be a KTRef object, please use 'ref(...)' to wrap it.`);\n }\n }\n return ref(defaultValue) as KTRef<T>;\n};\n\nconst $refSetter = <T>(props: { ref?: KTRef<T> }, node: T) => (props.ref!.value = node);\ntype RefSetter<T> = (props: { ref?: KTRef<T> }, node: T) => void;\n\n/**\n * Whether `props.ref` is a `KTRef` only needs to be checked in the initial render\n */\nexport const $initRef = <T extends Node>(props: { ref?: KTRef<T> }, node: T): RefSetter<T> => {\n if (!('ref' in props)) {\n return $emptyFn;\n }\n\n const r = props.ref;\n if (isRef(r)) {\n r.value = node;\n return $refSetter;\n } else {\n $throw('Fragment: ref must be a KTRef');\n }\n};\n","import { $emptyFn } from '@ktjs/shared';\nimport type { KTReactive } from '../types/reactive.js';\n\ninterface KTEffectOptions {\n lazy: boolean;\n onCleanup: () => void;\n debugName: string;\n}\n\n/**\n * Register a reactive effect with options.\n * @param effectFn The effect function to run when dependencies change\n * @param reactives The reactive dependencies\n * @param options Effect options: lazy, onCleanup, debugName\n * @returns stop function to remove all listeners\n */\nexport function effect(effectFn: () => void, reactives: Array<KTReactive<any>>, options?: Partial<KTEffectOptions>) {\n const { lazy = false, onCleanup = $emptyFn, debugName = '' } = Object(options);\n const listenerKeys: Array<string | number> = [];\n\n let active = true;\n\n const run = () => {\n if (!active) {\n return;\n }\n\n // cleanup before rerun\n onCleanup();\n\n try {\n effectFn();\n } catch (err) {\n $debug('effect error:', debugName, err);\n }\n };\n\n // subscribe to dependencies\n for (let i = 0; i < reactives.length; i++) {\n listenerKeys[i] = reactives[i].addOnChange(run);\n }\n\n // auto run unless lazy\n if (!lazy) {\n run();\n }\n\n // stop function\n return () => {\n if (!active) {\n return;\n }\n active = false;\n\n for (let i = 0; i < reactives.length; i++) {\n reactives[i].removeOnChange(listenerKeys[i]);\n }\n\n // final cleanup\n onCleanup();\n };\n}\n","import type { KTReactive, ReactiveChangeHandler } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\nimport { isKT } from './core.js';\nimport { ref } from './ref.js';\n\nexport const toReactive = <T>(value: T | KTReactive<T>, onChange?: ReactiveChangeHandler<T>): KTReactive<T> => {\n if (isKT(value)) {\n if (onChange) {\n value.addOnChange(onChange);\n }\n return value;\n } else {\n return ref(value as T, onChange) as KTReactive<T>;\n }\n};\n\n/**\n * Extracts the value from a KTReactive, or returns the value directly if it's not reactive.\n */\nexport function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T {\n return isKT<T>(value) ? value.value : value;\n}\n\nexport * from './core.js';\nexport * from './ref.js';\nexport * from './computed.js';\nexport * from './effect.js';\n","import { $applyModel, type InputElementTag } from '@ktjs/shared';\nimport { isKT, type KTRef } from '../reactive/index.js';\n\nexport function applyKModel(element: HTMLElementTagNameMap[InputElementTag], valueRef: KTRef<any>) {\n if (!isKT(valueRef)) {\n $throw('k-model value must be a KTRef.');\n }\n\n if (element.tagName === 'INPUT') {\n if (element.type === 'radio' || element.type === 'checkbox') {\n $applyModel(element, valueRef, 'checked', 'change');\n } else {\n $applyModel(element, valueRef, 'value', 'input');\n }\n } else if (element.tagName === 'SELECT') {\n $applyModel(element, valueRef, 'value', 'change');\n } else if (element.tagName === 'TEXTAREA') {\n $applyModel(element, valueRef, 'value', 'input');\n } else {\n $warn('not supported element for k-model:');\n }\n}\n","import type { HTMLTag, MathMLTag, SVGTag } from '@ktjs/shared';\nimport type { KTRawAttr, KTRawContent, HTML } from '../types/h.js';\n\nimport { applyAttr } from './attr.js';\nimport { applyContent } from './content.js';\nimport { applyKModel } from './model.js';\n\n/**\n * Create an enhanced HTMLElement.\n * - Only supports HTMLElements, **NOT** SVGElements or other Elements.\n * @param tag tag of an `HTMLElement`\n * @param attr attribute object or className\n * @param content a string or an array of HTMLEnhancedElement as child nodes\n *\n * __PKG_INFO__\n */\nexport const h = <T extends HTMLTag | SVGTag | MathMLTag>(\n tag: T,\n attr?: KTRawAttr,\n content?: KTRawContent,\n): HTML<T> => {\n if (typeof tag !== 'string') {\n $throw('tagName must be a string.');\n }\n\n // * start creating the element\n const element = document.createElement(tag) as HTML<T>;\n\n // * Handle content\n applyAttr(element, attr);\n applyContent(element, content);\n\n if (typeof attr === 'object' && attr !== null && 'k-model' in attr) {\n applyKModel(element as any, attr['k-model'] as any);\n }\n\n return element;\n};\n\nexport const svg = <T extends SVGTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent): HTML<T> => {\n if (typeof tag !== 'string') {\n $throw('tagName must be a string.');\n }\n\n // * start creating the element\n const element = document.createElementNS('http://www.w3.org/2000/svg', tag) as HTML<T>;\n\n // * Handle content\n applyAttr(element, attr);\n applyContent(element, content);\n\n if (typeof attr === 'object' && attr !== null && 'k-model' in attr) {\n applyKModel(element as any, attr['k-model'] as any);\n }\n\n return element;\n};\n\nexport const mathml = <T extends MathMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent): HTML<T> => {\n if (typeof tag !== 'string') {\n $throw('tagName must be a string.');\n }\n\n // * start creating the element\n const element = document.createElementNS('http://www.w3.org/1998/Math/MathML', tag) as HTML<T>;\n\n // * Handle content\n applyAttr(element, attr);\n applyContent(element, content);\n\n if (typeof attr === 'object' && attr !== null && 'k-model' in attr) {\n applyKModel(element as any, attr['k-model'] as any);\n }\n\n return element;\n};\n","import { $forEach, $isArray } from '@ktjs/shared';\nimport type { KTRef } from '../reactive/ref.js';\nimport type { KTReactive } from '../types/reactive.js';\nimport type { KTRawContent } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\n\nimport { $initRef, isKT, toReactive } from '../reactive/index.js';\n\nconst FRAGMENT_MOUNT_PATCHED = '__kt_fragment_mount_patched__';\nconst FRAGMENT_MOUNT = '__kt_fragment_mount__';\n\nif (typeof Node !== 'undefined' && !(globalThis as any)[FRAGMENT_MOUNT_PATCHED]) {\n (globalThis as any)[FRAGMENT_MOUNT_PATCHED] = true;\n\n const originAppendChild = Node.prototype.appendChild;\n Node.prototype.appendChild = function (node) {\n const result = originAppendChild.call(this, node);\n const mount = (node as any)[FRAGMENT_MOUNT];\n if (typeof mount === 'function') {\n mount();\n }\n return result as any;\n };\n\n const originInsertBefore = Node.prototype.insertBefore;\n Node.prototype.insertBefore = function (node: Node, child: Node | null) {\n const result = originInsertBefore.call(this, node, child);\n const mount = (node as any)[FRAGMENT_MOUNT];\n if (typeof mount === 'function') {\n mount();\n }\n return result as any;\n };\n}\n\nexport interface FragmentProps<T extends HTMLElement = HTMLElement> {\n /** Array of child elements, supports reactive arrays */\n children: T[] | KTReactive<T[]>;\n\n /** element key function for optimization (future enhancement) */\n key?: (element: T, index: number, array: T[]) => any;\n\n /** ref to get the anchor node */\n ref?: KTRef<JSX.Element>;\n}\n\n/**\n * Fragment - Container component for managing arrays of child elements\n *\n * Features:\n * 1. Returns a comment anchor node, child elements are inserted after the anchor\n * 2. Supports reactive arrays, automatically updates DOM when array changes\n * 3. Basic version uses simple replacement algorithm (remove all old elements, insert all new elements)\n * 4. Future enhancement: key-based optimization\n *\n * Usage example:\n * ```tsx\n * const children = ref([<div>A</div>, <div>B</div>]);\n * const fragment = <Fragment children={children} />;\n * document.body.appendChild(fragment);\n *\n * // Automatic update\n * children.value = [<div>C</div>, <div>D</div>];\n * ```\n */\nexport function Fragment<T extends HTMLElement = HTMLElement>(props: FragmentProps<T>): JSX.Element {\n const elements: T[] = [];\n const anchor = document.createComment('kt-fragment') as unknown as JSX.Element;\n let inserted = false;\n let observer: MutationObserver | undefined;\n\n const redraw = () => {\n const newElements = childrenRef.value;\n const parent = anchor.parentNode;\n\n if (!parent) {\n elements.length = 0;\n for (let i = 0; i < newElements.length; i++) {\n elements.push(newElements[i]);\n }\n (anchor as any).__kt_fragment_list__ = elements;\n return;\n }\n\n for (let i = 0; i < elements.length; i++) {\n elements[i].remove();\n }\n\n const fragment = document.createDocumentFragment();\n elements.length = 0;\n\n for (let i = 0; i < newElements.length; i++) {\n const element = newElements[i];\n elements.push(element);\n fragment.appendChild(element);\n }\n\n parent.insertBefore(fragment, anchor.nextSibling);\n inserted = true;\n delete (anchor as any)[FRAGMENT_MOUNT];\n observer?.disconnect();\n observer = undefined;\n (anchor as any).__kt_fragment_list__ = elements;\n };\n\n const childrenRef = toReactive(props.children, redraw);\n\n const renderInitial = () => {\n const current = childrenRef.value;\n elements.length = 0;\n\n const fragment = document.createDocumentFragment();\n for (let i = 0; i < current.length; i++) {\n const element = current[i];\n elements.push(element);\n fragment.appendChild(element);\n }\n\n (anchor as any).__kt_fragment_list__ = elements;\n\n const parent = anchor.parentNode;\n if (parent && !inserted) {\n parent.insertBefore(fragment, anchor.nextSibling);\n inserted = true;\n }\n };\n\n renderInitial();\n\n (anchor as any)[FRAGMENT_MOUNT] = () => {\n if (!inserted && anchor.parentNode) {\n redraw();\n }\n };\n\n observer = new MutationObserver(() => {\n if (anchor.parentNode && !inserted) {\n redraw();\n observer?.disconnect();\n observer = undefined;\n }\n });\n\n observer.observe(document.body, { childList: true, subtree: true });\n\n $initRef(props, anchor);\n\n return anchor;\n}\n\n/**\n * Convert KTRawContent to HTMLElement array\n */\nexport function convertChildrenToElements(children: KTRawContent): HTMLElement[] {\n const elements: HTMLElement[] = [];\n\n const processChild = (child: any): void => {\n if (child === undefined || child === null || child === false || child === true) {\n // Ignore null, undefined, false, true\n return;\n }\n\n if ($isArray(child)) {\n // Recursively process array\n $forEach(child, processChild);\n return;\n }\n\n if (typeof child === 'string' || typeof child === 'number') {\n const span = document.createElement('span');\n span.textContent = String(child);\n elements.push(span);\n return;\n }\n\n if (child instanceof HTMLElement) {\n elements.push(child);\n return;\n }\n\n if (isKT(child)) {\n processChild(child.value);\n return;\n }\n\n console.warn('Fragment: unsupported child type', child);\n };\n\n processChild(children);\n return elements;\n}\n","import type { JSXTag } from '@ktjs/shared';\nimport type { KTAttribute } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\nimport { h } from '../h/index';\n\nexport const jsxh = (tag: JSXTag, props: KTAttribute): HTMLElement => {\n if (typeof tag === 'function') {\n return tag(props) as HTMLElement;\n } else {\n return h(tag, props, props.children) as HTMLElement;\n }\n};\n\nexport const placeholder = (data: string): JSX.Element => document.createComment(data) as unknown as JSX.Element;\n","import type { JSXTag, MathMLTag, SVGTag } from '@ktjs/shared';\nimport type { KTAttribute, KTRawContent } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\n\nimport { h, mathml as createMathMLElement, svg as createSVGElement } from '../h/index.js';\nimport { $initRef, isComputed, type KTRef, ref } from '../reactive/index.js';\nimport { convertChildrenToElements, Fragment as FragmentArray } from './fragment.js';\nimport { jsxh, placeholder } from './common.js';\n\nfunction assertWritableRef(props: KTAttribute) {\n if (isComputed(props.ref)) {\n $throw('Cannot assign a computed value to an element.');\n }\n}\n\n/**\n * @param tag html tag or function component\n * @param props properties/attributes\n */\nexport function jsx(tag: JSXTag, props: KTAttribute): JSX.Element {\n assertWritableRef(props);\n const el = jsxh(tag, props);\n $initRef(props, el);\n return el;\n}\n\nexport function svg(tag: SVGTag, props: KTAttribute): JSX.Element {\n assertWritableRef(props);\n const el = createSVGElement(tag, props, props.children) as unknown as JSX.Element;\n $initRef(props, el);\n return el;\n}\n\nexport function mathml(tag: MathMLTag, props: KTAttribute): JSX.Element {\n assertWritableRef(props);\n const el = createMathMLElement(tag, props, props.children) as unknown as JSX.Element;\n $initRef(props, el);\n return el;\n}\n\nexport { svg as svgRuntime, mathml as mathmlRuntime };\n\n/**\n * Fragment support - returns an array of children\n * Enhanced Fragment component that manages arrays of elements\n */\nexport function Fragment(props: { children?: KTRawContent }): JSX.Element {\n const { children } = props ?? {};\n\n if (!children) {\n return placeholder('kt-fragment-empty');\n }\n\n const elements = convertChildrenToElements(children);\n\n return FragmentArray({ children: elements });\n}\n\n/**\n * JSX Development runtime - same as jsx but with additional dev checks\n */\nexport const jsxDEV: typeof jsx = (...args) => {\n // console.log('JSX DEV called:', ...args);\n // console.log('children', (args[1] as any)?.children);\n return jsx(...args);\n};\n\n/**\n * JSX runtime for React 17+ automatic runtime\n * This is called when using jsx: \"react-jsx\" or \"react-jsxdev\"\n */\nexport const jsxs = jsx;\n\n// Export h as the classic JSX factory for backward compatibility\nexport { h, h as createElement };\n\n/**\n * A helper to create redrawable elements\n * ```tsx\n * export function MyComponent() {\n * let aa = 10;\n * // ...\n * // aa might be changed\n * return createRedrawable(() => <div>{aa}</div>);\n * }\n * ```\n * Then the returned element has a `redraw` method to redraw itself with new values.\n * @param creator a simple creator function that returns an element\n * @returns created element's ref\n */\nexport function createRedrawable<T>(creator: () => T): KTRef<T> & { redraw: () => T } {\n const elRef = ref<T>() as KTRef<T> & { redraw: () => T };\n\n const redraw = () => {\n elRef.value = creator(); // ref setter automatically calls replaceWith\n elRef.redraw = redraw;\n return elRef.value;\n };\n\n redraw();\n return elRef;\n}\n","import { $isThenable } from '@ktjs/shared';\nimport type { KTComponent, KTRawContent } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\nimport type { KTRef } from '../reactive/ref.js';\n\n/**\n * Extract component props type (excluding ref and children)\n */\ntype ExtractComponentProps<T> = T extends (props: infer P) => any ? Omit<P, 'ref' | 'children'> : {};\n\nexport function KTAsync<T extends KTComponent>(\n props: {\n ref?: KTRef<JSX.Element>;\n skeleton?: JSX.Element;\n component: T;\n children?: KTRawContent;\n } & ExtractComponentProps<T>,\n): JSX.Element {\n const raw = props.component(props);\n let comp: JSX.Element =\n props.skeleton ?? (document.createComment('ktjs-suspense-placeholder') as unknown as JSX.Element);\n\n if ($isThenable(raw)) {\n raw.then((resolved) => comp.replaceWith(resolved));\n } else {\n comp = raw as JSX.Element;\n }\n\n return comp;\n}\n","import type { KTRef } from '../reactive/ref.js';\nimport type { KTReactive } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\nimport { $initRef, toReactive } from '../reactive/index.js';\nimport { $identity } from '@ktjs/shared';\n\nexport type KTForElement = JSX.Element;\n\nexport interface KTForProps<T> {\n ref?: KTRef<KTForElement>;\n list: T[] | KTReactive<T[]>;\n key?: (item: T, index: number, array: T[]) => any;\n map?: (item: T, index: number, array: T[]) => HTMLElement;\n}\n\n/**\n * KTFor - List rendering component with key-based optimization\n * Returns a Comment anchor node with rendered elements in __kt_for_list__\n */\nexport function KTFor<T>(props: KTForProps<T>): KTForElement {\n const redraw = () => {\n const newList = listRef.value;\n\n const parent = anchor.parentNode;\n if (!parent) {\n // If not in DOM yet, just rebuild the list\n const newElements: HTMLElement[] = [];\n nodeMap.clear();\n for (let index = 0; index < newList.length; index++) {\n const item = newList[index];\n const itemKey = currentKey(item, index, newList);\n const node = currentMap(item, index, newList);\n nodeMap.set(itemKey, node);\n newElements.push(node);\n }\n (anchor as any).__kt_for_list__ = newElements;\n return anchor;\n }\n\n const oldLength = (anchor as any).__kt_for_list__.length;\n const newLength = newList.length;\n\n // Fast path: empty list\n if (newLength === 0) {\n nodeMap.forEach((node) => node.remove());\n nodeMap.clear();\n (anchor as any).__kt_for_list__ = [];\n return anchor;\n }\n\n // Fast path: all new items\n if (oldLength === 0) {\n const newElements: HTMLElement[] = [];\n const fragment = document.createDocumentFragment();\n for (let i = 0; i < newLength; i++) {\n const item = newList[i];\n const itemKey = currentKey(item, i, newList);\n const node = currentMap(item, i, newList);\n nodeMap.set(itemKey, node);\n newElements.push(node);\n fragment.appendChild(node);\n }\n parent.insertBefore(fragment, anchor.nextSibling);\n (anchor as any).__kt_for_list__ = newElements;\n return anchor;\n }\n\n // Build key index map and new elements array in one pass\n const newKeyToNewIndex = new Map<any, number>();\n const newElements: HTMLElement[] = new Array(newLength);\n let maxNewIndexSoFar = 0;\n let moved = false;\n\n for (let i = 0; i < newLength; i++) {\n const item = newList[i];\n const itemKey = currentKey(item, i, newList);\n newKeyToNewIndex.set(itemKey, i);\n\n if (nodeMap.has(itemKey)) {\n // Reuse existing node\n const node = nodeMap.get(itemKey)!;\n newElements[i] = node;\n\n // Track if items moved\n if (i < maxNewIndexSoFar) {\n moved = true;\n } else {\n maxNewIndexSoFar = i;\n }\n } else {\n // Create new node\n newElements[i] = currentMap(item, i, newList);\n }\n }\n\n // Remove nodes not in new list\n const toRemove: HTMLElement[] = [];\n nodeMap.forEach((node, key) => {\n if (!newKeyToNewIndex.has(key)) {\n toRemove.push(node);\n }\n });\n for (let i = 0; i < toRemove.length; i++) {\n toRemove[i].remove();\n }\n\n // Update DOM with minimal operations\n if (moved) {\n // Use longest increasing subsequence to minimize moves\n const seq = getSequence(newElements.map((el, i) => (nodeMap.has(currentKey(newList[i], i, newList)) ? i : -1)));\n\n let j = seq.length - 1;\n let anchor: Node | null = null;\n\n // Traverse from end to start for stable insertions\n for (let i = newLength - 1; i >= 0; i--) {\n const node = newElements[i];\n\n if (j < 0 || i !== seq[j]) {\n // Node needs to be moved or inserted\n if (anchor) {\n parent.insertBefore(node, anchor);\n } else {\n // Insert at end\n let nextSibling = (anchor as any).nextSibling;\n let temp = nextSibling;\n while (temp && newElements.includes(temp as HTMLElement)) {\n temp = temp.nextSibling;\n }\n parent.insertBefore(node, temp);\n }\n } else {\n j--;\n }\n anchor = node;\n }\n } else {\n // No moves needed, just insert new nodes\n let currentNode = anchor.nextSibling;\n for (let i = 0; i < newLength; i++) {\n const node = newElements[i];\n if (currentNode !== node) {\n parent.insertBefore(node, currentNode);\n } else {\n currentNode = currentNode.nextSibling;\n }\n }\n }\n\n // Update maps\n nodeMap.clear();\n for (let i = 0; i < newLength; i++) {\n const itemKey = currentKey(newList[i], i, newList);\n nodeMap.set(itemKey, newElements[i]);\n }\n (anchor as any).__kt_for_list__ = newElements;\n return anchor;\n };\n\n const { key: currentKey = (item: T) => item, map: currentMap = $identity } = props;\n const listRef = toReactive(props.list, redraw);\n const anchor = document.createComment('kt-for') as unknown as KTForElement;\n\n // Map to track rendered nodes by key\n const nodeMap = new Map<any, HTMLElement>();\n\n // Render initial list\n const elements: HTMLElement[] = [];\n for (let index = 0; index < listRef.value.length; index++) {\n const item = listRef.value[index];\n const itemKey = currentKey(item, index, listRef.value);\n const node = currentMap(item, index, listRef.value);\n nodeMap.set(itemKey, node);\n elements.push(node);\n }\n\n (anchor as any).__kt_for_list__ = elements;\n\n $initRef(props, anchor);\n\n return anchor;\n}\n\n// Longest Increasing Subsequence algorithm (optimized for diff)\nfunction getSequence(arr: number[]): number[] {\n const p = arr.slice();\n const result = [0];\n let i: number, j: number, u: number, v: number, c: number;\n const len = arr.length;\n\n for (i = 0; i < len; i++) {\n const arrI = arr[i];\n if (arrI === -1) continue;\n\n j = result[result.length - 1];\n if (arr[j] < arrI) {\n p[i] = j;\n result.push(i);\n continue;\n }\n\n u = 0;\n v = result.length - 1;\n\n while (u < v) {\n c = ((u + v) / 2) | 0;\n if (arr[result[c]] < arrI) {\n u = c + 1;\n } else {\n v = c;\n }\n }\n\n if (arrI < arr[result[u]]) {\n if (u > 0) {\n p[i] = result[u - 1];\n }\n result[u] = i;\n }\n }\n\n u = result.length;\n v = result[u - 1];\n\n while (u-- > 0) {\n result[u] = v;\n v = p[v];\n }\n\n return result;\n}\n","import type { JSXTag } from '@ktjs/shared';\nimport type { KTAttribute } from '../types/h.js';\nimport type { KTReactive } from '../types/reactive.js';\n\nimport { isKT } from '../reactive/index.js';\nimport { jsxh, placeholder } from './common.js';\n\nexport function KTConditional(\n condition: boolean | KTReactive<boolean>,\n tagIf: JSXTag,\n propsIf: KTAttribute,\n tagElse?: JSXTag,\n propsElse?: KTAttribute,\n) {\n if (!isKT(condition)) {\n return condition ? jsxh(tagIf, propsIf) : tagElse ? jsxh(tagElse, propsElse!) : placeholder('kt-conditional');\n }\n\n if (tagElse) {\n let current = condition.value ? jsxh(tagIf, propsIf) : jsxh(tagElse!, propsElse!);\n condition.addOnChange((newValue) => {\n const old = current;\n current = newValue ? jsxh(tagIf, propsIf) : jsxh(tagElse!, propsElse!);\n old.replaceWith(current);\n });\n return current;\n } else {\n const dummy = placeholder('kt-conditional') as HTMLElement;\n let current = condition.value ? jsxh(tagIf, propsIf) : dummy;\n condition.addOnChange((newValue) => {\n const old = current;\n current = newValue ? jsxh(tagIf, propsIf) : dummy;\n old.replaceWith(current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