@ktjs/core 0.31.8 → 0.32.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1136,6 +1136,168 @@ declare namespace JSX {
1136
1136
  }
1137
1137
  }
1138
1138
 
1139
+ declare class KTArrayRef<T> extends KTRef<T[]> {
1140
+ constructor(value: T[], onChange?: ReactiveChangeHandler<T[]>);
1141
+ get length(): number;
1142
+ set length(newLength: number);
1143
+ push(...items: T[]): number;
1144
+ /**
1145
+ * Same as `Array.prototype.pop`, but emits change after calling it
1146
+ */
1147
+ pop(): T | undefined;
1148
+ /**
1149
+ * Same as `Array.prototype.shift`, but emits change after calling it
1150
+ */
1151
+ shift(): T | undefined;
1152
+ /**
1153
+ * Same as `Array.prototype.unshift`, but emits change after calling it
1154
+ */
1155
+ unshift(...items: T[]): number;
1156
+ /**
1157
+ * Same as `Array.prototype.splice`, but emits change after calling it
1158
+ */
1159
+ splice(start: number, deleteCount?: number): T[];
1160
+ splice(start: number, deleteCount: number, ...items: T[]): T[];
1161
+ /**
1162
+ * Same as `Array.prototype.sort`, but emits change after calling it
1163
+ */
1164
+ sort(compareFn?: (a: T, b: T) => number): this;
1165
+ /**
1166
+ * Same as `Array.prototype.reverse`, but emits change after calling it
1167
+ */
1168
+ reverse(): this;
1169
+ /**
1170
+ * Same as `Array.prototype.fill`, but emits change after calling it
1171
+ */
1172
+ fill(value: T, start?: number, end?: number): this;
1173
+ /**
1174
+ * Same as `Array.prototype.copyWithin`, but emits change after calling it
1175
+ */
1176
+ copyWithin(target: number, start: number, end?: number): this;
1177
+ }
1178
+ declare const arrayRef: (value: unknown, onChange?: ReactiveChangeHandler<any>) => KTArrayRef<any>;
1179
+
1180
+ declare class KTDateRef extends KTRef<Date> {
1181
+ constructor(value: Date, onChange?: ReactiveChangeHandler<Date>);
1182
+ setTime(timeValue: number): number;
1183
+ setMilliseconds(millisecondsValue: number): number;
1184
+ setUTCMilliseconds(millisecondsValue: number): number;
1185
+ setSeconds(secondsValue: number, millisecondsValue?: number): number;
1186
+ setUTCSeconds(secondsValue: number, millisecondsValue?: number): number;
1187
+ setMinutes(minutesValue: number, secondsValue?: number, millisecondsValue?: number): number;
1188
+ setUTCMinutes(minutesValue: number, secondsValue?: number, millisecondsValue?: number): number;
1189
+ setHours(hoursValue: number, minutesValue?: number, secondsValue?: number, millisecondsValue?: number): number;
1190
+ setUTCHours(hoursValue: number, minutesValue?: number, secondsValue?: number, millisecondsValue?: number): number;
1191
+ setDate(dateValue: number): number;
1192
+ setUTCDate(dateValue: number): number;
1193
+ setMonth(monthValue: number, dateValue?: number): number;
1194
+ setUTCMonth(monthValue: number, dateValue?: number): number;
1195
+ setFullYear(yearValue: number, monthValue?: number, dateValue?: number): number;
1196
+ setUTCFullYear(yearValue: number, monthValue?: number, dateValue?: number): number;
1197
+ }
1198
+ declare const dateRef: (value: unknown, onChange?: ReactiveChangeHandler<any>) => KTDateRef;
1199
+
1200
+ declare class KTMapRef<K, V> extends KTRef<Map<K, V>> {
1201
+ constructor(value: Map<K, V>, onChange?: ReactiveChangeHandler<Map<K, V>>);
1202
+ get size(): number;
1203
+ has(key: K): boolean;
1204
+ get(key: K): V | undefined;
1205
+ set(key: K, value: V): this;
1206
+ delete(key: K): boolean;
1207
+ clear(): any;
1208
+ }
1209
+ declare const mapRef: (value: unknown, onChange?: ReactiveChangeHandler<any>) => KTMapRef<unknown, unknown>;
1210
+
1211
+ declare class KTSetRef<T> extends KTRef<Set<T>> {
1212
+ constructor(value: Set<T>, onChange?: ReactiveChangeHandler<Set<T>>);
1213
+ get size(): number;
1214
+ has(value: T): boolean;
1215
+ add(value: T): this;
1216
+ delete(value: T): boolean;
1217
+ clear(): any;
1218
+ }
1219
+ declare const setRef: (value: unknown, onChange?: ReactiveChangeHandler<any>) => KTSetRef<unknown>;
1220
+
1221
+ declare class KTWeakMapRef<K extends WeakKey = WeakKey, V = any> extends KTRef<WeakMap<K, V>> {
1222
+ constructor(value: WeakMap<K, V>, onChange?: ReactiveChangeHandler<WeakMap<K, V>>);
1223
+ has(key: K): boolean;
1224
+ get(key: K): V | undefined;
1225
+ set(key: K, value: V): this;
1226
+ delete(key: K): boolean;
1227
+ }
1228
+ declare const weakMapRef: (value: unknown, onChange?: ReactiveChangeHandler<any>) => KTWeakMapRef<WeakKey, any>;
1229
+
1230
+ declare class KTWeakSetRef<T extends WeakKey = WeakKey> extends KTRef<WeakSet<T>> {
1231
+ constructor(value: WeakSet<T>, onChange?: ReactiveChangeHandler<WeakSet<T>>);
1232
+ has(value: T): boolean;
1233
+ add(value: T): this;
1234
+ delete(value: T): boolean;
1235
+ }
1236
+ declare const weakSetRef: (value: unknown, onChange?: ReactiveChangeHandler<any>) => KTWeakSetRef<WeakKey>;
1237
+
1238
+ type KTIsExactlyBoolean<T> = [T] extends [boolean] ? ([boolean] extends [T] ? true : false) : false;
1239
+
1240
+ type KTAutoRef<T> =
1241
+ KTIsExactlyBoolean<T> extends true
1242
+ ? KTRef<boolean>
1243
+ : T extends Array<infer A>
1244
+ ? KTArrayRef<A>
1245
+ : T extends Map<infer K, infer V>
1246
+ ? KTMapRef<K, V>
1247
+ : T extends Set<infer U>
1248
+ ? KTSetRef<U>
1249
+ : T extends Date
1250
+ ? KTDateRef
1251
+ : T extends WeakSet<infer U>
1252
+ ? KTWeakSetRef<U>
1253
+ : T extends WeakMap<infer K, infer V>
1254
+ ? KTWeakMapRef<K, V>
1255
+ : KTRef<T>;
1256
+
1257
+ /**
1258
+ * Reference to the created HTML element or other reactive data.
1259
+ * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.
1260
+ * - Automatically wrap the value with corresponding ref type based on its type.
1261
+ * - When wrapped, setter-like methods will be reactive. like `push` for `Array`, `set` for `Map`, `add` for `Set`, etc.
1262
+ * - Supports: `Array`, `Map`, `Set`, `WeakMap`, `WeakSet`, `Date`.
1263
+ * - Since there will be some cost for runtime detection, and compilation plugin might not be able to analyze all cases. It is recommended to use specific ref type directly if you already know the type of value, like `ref.array`, `ref.map`, etc.
1264
+ * @param value any data
1265
+ * @param onChange event handler triggered when the value changes, with signature `(newValue, oldValue) => void`
1266
+ */
1267
+ declare function autoRef<T>(value?: T, onChange?: ReactiveChangeHandler<T>): KTAutoRef<T>;
1268
+ type RefCreator = (<T = JSX.Element>(value?: T, onChange?: ReactiveChangeHandler<T>) => KTRef<T>) & {
1269
+ array: typeof arrayRef;
1270
+ date: typeof dateRef;
1271
+ map: typeof mapRef;
1272
+ set: typeof setRef;
1273
+ weakMap: typeof weakMapRef;
1274
+ weakSet: typeof weakSetRef;
1275
+ };
1276
+ /**
1277
+ * Create a plain `KTRef` object.
1278
+ *
1279
+ * If you want the value to be automatically wrapped with corresponding ref type based on its type, please use `autoRef` instead.
1280
+ *
1281
+ * @param value any data
1282
+ * @param onChange event handler triggered when the value changes, with signature `(newValue, oldValue) => void`
1283
+ * @returns
1284
+ */
1285
+ declare const ref: RefCreator;
1286
+
1287
+ /**
1288
+ * Assert k-model to be a ref object
1289
+ */
1290
+ declare const $modelOrRef: <T = any>(props: any, defaultValue?: T) => KTRef<T>;
1291
+ type RefSetter<T> = (props: {
1292
+ ref?: KTRef<T>;
1293
+ }, node: T) => void;
1294
+ /**
1295
+ * Whether `props.ref` is a `KTRef` only needs to be checked in the initial render
1296
+ */
1297
+ declare const $initRef: <T extends Node>(props: {
1298
+ ref?: KTRef<T>;
1299
+ }, node: T) => RefSetter<T>;
1300
+
1139
1301
  interface KTEffectOptions {
1140
1302
  lazy: boolean;
1141
1303
  onCleanup: () => void;
@@ -1157,11 +1319,23 @@ declare const toReactive: <T>(value: T | KTReactive<T>, onChange?: ReactiveChang
1157
1319
  declare function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T;
1158
1320
 
1159
1321
  declare const enum KTReactiveType {
1160
- REF = 1,
1161
- COMPUTED = 2
1322
+ Computed = 1,
1323
+ Ref = 2,
1324
+ ArrayRef = 3,
1325
+ MapRef = 4,
1326
+ SetRef = 5,
1327
+ WeakMapRef = 6,
1328
+ WeakSetRef = 7,
1329
+ DateRef = 8
1162
1330
  }
1163
1331
  declare const isKT: <T = any>(obj: any) => obj is KTReactive<T>;
1164
1332
  declare const isRef: <T = any>(obj: any) => obj is KTRef<T>;
1333
+ declare const isArrayRef: <T = any>(obj: any) => obj is KTRef<T[]>;
1334
+ declare const isMapRef: <K = any, V = any>(obj: any) => obj is KTRef<Map<K, V>>;
1335
+ declare const isSetRef: <T = any>(obj: any) => obj is KTRef<Set<T>>;
1336
+ declare const isWeakMapRef: <K extends WeakKey = WeakKey, V = any>(obj: any) => obj is KTRef<WeakMap<K, V>>;
1337
+ declare const isWeakSetRef: <T extends WeakKey = WeakKey>(obj: any) => obj is KTRef<WeakSet<T>>;
1338
+ declare const isDateRef: (obj: any) => obj is KTRef<Date>;
1165
1339
  declare const isComputed: <T = any>(obj: any) => obj is KTComputed<T>;
1166
1340
 
1167
1341
  declare class KTComputed<T> implements KTReactive<T> {
@@ -1206,7 +1380,7 @@ declare function computed<T = JSX.Element>(computeFn: () => T, dependencies: Arr
1206
1380
  type ReactiveChangeHandler<T> = (newValue: T, oldValue: T) => void;
1207
1381
  type ReactiveChangeKey = string | number;
1208
1382
 
1209
- declare class KTReactive<T> {
1383
+ interface KTReactive<T> {
1210
1384
  /**
1211
1385
  * Indicates that this is a KTRef instance
1212
1386
  */
@@ -1313,48 +1487,6 @@ declare class KTRef<T> implements KTReactive<T> {
1313
1487
  addOnChange<K extends ReactiveChangeKey | undefined>(callback: ReactiveChangeHandler<T>, key?: K): K extends undefined ? number : K;
1314
1488
  removeOnChange(key: ReactiveChangeKey): ReactiveChangeHandler<any> | undefined;
1315
1489
  }
1316
- /**
1317
- * Reference to the created HTML element.
1318
- * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.
1319
- * - can alse be used to store normal values, but it is not reactive.
1320
- * - if the value is already a `KTRef`, it will be returned **directly**.
1321
- * @param value mostly an HTMLElement
1322
- */
1323
- declare function ref<T = JSX.Element>(value?: T, onChange?: ReactiveChangeHandler<T>): KTRef<T>;
1324
- /**
1325
- * Convert a value to `KTRef`.
1326
- * - Returns the original value if it is already a `KTRef`.
1327
- * - Throws error if the value is a `KTComputed`.
1328
- * - Otherwise wraps the value with `ref()`.
1329
- * @param o value to convert
1330
- */
1331
- declare const toRef: <T = any>(o: any) => KTRef<T>;
1332
- type KTSurfaceRef<T extends object> = {
1333
- [K in keyof T]: KTRef<T[K]>;
1334
- } & {
1335
- /**
1336
- * Get the dereferenced object like the original one
1337
- */
1338
- kcollect: () => T;
1339
- };
1340
- /**
1341
- * Make all first-level properties of the object a `KTRef`.
1342
- * - `obj.a.b` is not reactive
1343
- */
1344
- declare const surfaceRef: <T extends object>(obj: T) => KTSurfaceRef<T>;
1345
- /**
1346
- * Assert k-model to be a ref object
1347
- */
1348
- declare const $modelOrRef: <T = any>(props: any, defaultValue?: T) => KTRef<T>;
1349
- type RefSetter<T> = (props: {
1350
- ref?: KTRef<T>;
1351
- }, node: T) => void;
1352
- /**
1353
- * Whether `props.ref` is a `KTRef` only needs to be checked in the initial render
1354
- */
1355
- declare const $initRef: <T extends Node>(props: {
1356
- ref?: KTRef<T>;
1357
- }, node: T) => RefSetter<T>;
1358
1490
 
1359
1491
  type HTML<T extends (HTMLTag | SVGTag | MathMLTag) & otherstring> = T extends SVGTag
1360
1492
  ? SVGElementTagNameMap[T]
@@ -1528,7 +1660,7 @@ interface KTForProps<T> {
1528
1660
  */
1529
1661
  declare function KTFor<T>(props: KTForProps<T>): KTForElement;
1530
1662
 
1531
- declare function KTConditional(condition: boolean | KTReactive<boolean>, tagIf: JSXTag, propsIf: KTAttribute, tagElse?: JSXTag, propsElse?: KTAttribute): JSX.Element;
1663
+ declare function KTConditional(condition: any | KTReactive<any>, tagIf: JSXTag, propsIf: KTAttribute, tagElse?: JSXTag, propsElse?: KTAttribute): JSX.Element;
1532
1664
 
1533
- export { $initRef, $modelOrRef, Fragment, JSX, KTAsync, KTComputed, KTConditional, KTFor, KTReactive, KTReactiveType, KTRef, applyAttr, computed, h as createElement, mathml$1 as createMathMLElement, svg$1 as createSVGElement, dereactive, effect, h, isComputed, isKT, isRef, jsx, jsxDEV, jsxs, mathml, mathml as mathmlRuntime, ref, surfaceRef, svg, svg as svgRuntime, toReactive, toRef };
1534
- export type { EventHandler, HTML, KTAttribute, KTForElement, KTForProps, KTMaybeReactive, KTMaybeReactiveProps, KTPrefixedEventAttribute, KTRawAttr, KTRawContent, KTRawContents, KTReactify, KTReactifyObject, KTReactifyProps, KTReactifySplit, KTSurfaceRef, ReactiveChangeHandler, ReactiveChangeKey };
1665
+ export { $initRef, $modelOrRef, Fragment, JSX, KTArrayRef, KTAsync, KTComputed, KTConditional, KTDateRef, KTFor, KTMapRef, KTReactiveType, KTSetRef, KTWeakMapRef, KTWeakSetRef, applyAttr, autoRef, computed, h as createElement, mathml$1 as createMathMLElement, svg$1 as createSVGElement, dereactive, effect, h, isArrayRef, isComputed, isDateRef, isKT, isMapRef, isRef, isSetRef, isWeakMapRef, isWeakSetRef, jsx, jsxDEV, jsxs, mathml, mathml as mathmlRuntime, ref, svg, svg as svgRuntime, toReactive };
1666
+ export type { EventHandler, HTML, KTAttribute, KTForElement, KTForProps, KTMaybeReactive, KTMaybeReactiveProps, KTPrefixedEventAttribute, KTRawAttr, KTRawContent, KTRawContents, KTReactify, KTReactifyObject, KTReactifyProps, KTReactifySplit, KTReactive, ReactiveChangeHandler, ReactiveChangeKey };
package/dist/index.mjs CHANGED
@@ -1,8 +1,21 @@
1
- import { $isArray, $isThenable, $isNode, $emptyFn, $is, $entries, $applyModel, $forEach, $identity } from '@ktjs/shared';
1
+ import { $isArray, $isThenable, $isNode, $is, $emptyFn, $applyModel, $forEach, $identity } from '@ktjs/shared';
2
2
 
3
3
  const isKT = (obj) => obj?.isKT;
4
- const isRef = (obj) => obj?.ktType === 1 /* KTReactiveType.REF */;
5
- const isComputed = (obj) => obj?.ktType === 2 /* KTReactiveType.COMPUTED */;
4
+ const isRef = (obj) => {
5
+ // & This is tested to be the fastest way.
6
+ // faster than includes, arrayindex, if or.
7
+ if (obj.ktType === undefined) {
8
+ return false;
9
+ }
10
+ return obj.ktType >= 2 /* KTReactiveType.Ref */ && obj.ktType <= 8 /* KTReactiveType.DateRef */;
11
+ };
12
+ const isArrayRef = (obj) => obj?.ktType === 3 /* KTReactiveType.ArrayRef */;
13
+ const isMapRef = (obj) => obj?.ktType === 4 /* KTReactiveType.MapRef */;
14
+ const isSetRef = (obj) => obj?.ktType === 5 /* KTReactiveType.SetRef */;
15
+ const isWeakMapRef = (obj) => obj?.ktType === 6 /* KTReactiveType.WeakMapRef */;
16
+ const isWeakSetRef = (obj) => obj?.ktType === 7 /* KTReactiveType.WeakSetRef */;
17
+ const isDateRef = (obj) => obj?.ktType === 8 /* KTReactiveType.DateRef */;
18
+ const isComputed = (obj) => obj?.ktType === 1 /* KTReactiveType.Computed */;
6
19
 
7
20
  const booleanHandler = (element, key, value) => {
8
21
  if (key in element) {
@@ -213,7 +226,7 @@ class KTComputed {
213
226
  * Indicates that this is a KTRef instance
214
227
  */
215
228
  isKT = true;
216
- ktType = 2 /* KTReactiveType.COMPUTED */;
229
+ ktType = 1 /* KTReactiveType.Computed */;
217
230
  /**
218
231
  * @internal
219
232
  */
@@ -334,7 +347,7 @@ class KTRef {
334
347
  * Indicates that this is a KTRef instance
335
348
  */
336
349
  isKT = true;
337
- ktType = 1 /* KTReactiveType.REF */;
350
+ ktType = 2 /* KTReactiveType.Ref */;
338
351
  /**
339
352
  * @internal
340
353
  */
@@ -421,59 +434,272 @@ class KTRef {
421
434
  return callback;
422
435
  }
423
436
  }
437
+
424
438
  /**
425
- * Reference to the created HTML element.
426
- * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.
427
- * - can alse be used to store normal values, but it is not reactive.
428
- * - if the value is already a `KTRef`, it will be returned **directly**.
429
- * @param value mostly an HTMLElement
439
+ * Calls the setter-like function and emit all changes of it
430
440
  */
431
- function ref(value, onChange) {
432
- return new KTRef(value, onChange);
441
+ const apply = (r, setter, args) => {
442
+ const v = r.value;
443
+ const result = setter.apply(v, args);
444
+ r._onChanges.forEach((handler) => handler(v, v));
445
+ return result;
446
+ };
447
+ const applyArgless = (r, setter) => {
448
+ const v = r.value;
449
+ const result = setter.apply(v);
450
+ r._onChanges.forEach((handler) => handler(v, v));
451
+ return result;
452
+ };
453
+
454
+ class KTArrayRef extends KTRef {
455
+ constructor(value, onChange) {
456
+ super(value, onChange);
457
+ this.ktType = 3 /* KTReactiveType.ArrayRef */;
458
+ }
459
+ get length() {
460
+ return this.value.length;
461
+ }
462
+ set length(newLength) {
463
+ this._value.length = newLength;
464
+ this._onChanges.forEach((handler) => handler(this._value, this._value));
465
+ }
466
+ push(...items) {
467
+ return apply(this, this._value.push, items);
468
+ }
469
+ /**
470
+ * Same as `Array.prototype.pop`, but emits change after calling it
471
+ */
472
+ pop() {
473
+ return applyArgless(this, this._value.pop);
474
+ }
475
+ /**
476
+ * Same as `Array.prototype.shift`, but emits change after calling it
477
+ */
478
+ shift() {
479
+ return applyArgless(this, this._value.shift);
480
+ }
481
+ /**
482
+ * Same as `Array.prototype.unshift`, but emits change after calling it
483
+ */
484
+ unshift(...items) {
485
+ return apply(this, this._value.unshift, items);
486
+ }
487
+ splice(...args) {
488
+ return apply(this, this._value.splice, args);
489
+ }
490
+ sort(...args) {
491
+ apply(this, this._value.sort, args);
492
+ return this;
493
+ }
494
+ /**
495
+ * Same as `Array.prototype.reverse`, but emits change after calling it
496
+ */
497
+ reverse() {
498
+ applyArgless(this, this._value.reverse);
499
+ return this;
500
+ }
501
+ fill(...args) {
502
+ apply(this, this._value.fill, args);
503
+ return this;
504
+ }
505
+ copyWithin(...args) {
506
+ apply(this, this._value.copyWithin, args);
507
+ return this;
508
+ }
433
509
  }
510
+ const arrayRef = (value, onChange) => new KTArrayRef(value, onChange);
511
+
512
+ class KTDateRef extends KTRef {
513
+ constructor(value, onChange) {
514
+ super(value, onChange);
515
+ this.ktType = 8 /* KTReactiveType.DateRef */;
516
+ }
517
+ setTime(timeValue) {
518
+ return apply(this, this._value.setTime, [timeValue]);
519
+ }
520
+ setMilliseconds(millisecondsValue) {
521
+ return apply(this, this._value.setMilliseconds, [millisecondsValue]);
522
+ }
523
+ setUTCMilliseconds(millisecondsValue) {
524
+ return apply(this, this._value.setUTCMilliseconds, [millisecondsValue]);
525
+ }
526
+ setSeconds(...args) {
527
+ return apply(this, this._value.setSeconds, args);
528
+ }
529
+ setUTCSeconds(...args) {
530
+ return apply(this, this._value.setUTCSeconds, args);
531
+ }
532
+ setMinutes(...args) {
533
+ return apply(this, this._value.setMinutes, args);
534
+ }
535
+ setUTCMinutes(...args) {
536
+ return apply(this, this._value.setUTCMinutes, args);
537
+ }
538
+ setHours(...args) {
539
+ return apply(this, this._value.setHours, args);
540
+ }
541
+ setUTCHours(...args) {
542
+ return apply(this, this._value.setUTCHours, args);
543
+ }
544
+ setDate(dateValue) {
545
+ return apply(this, this._value.setDate, [dateValue]);
546
+ }
547
+ setUTCDate(dateValue) {
548
+ return apply(this, this._value.setUTCDate, [dateValue]);
549
+ }
550
+ setMonth(...args) {
551
+ return apply(this, this._value.setMonth, args);
552
+ }
553
+ setUTCMonth(...args) {
554
+ return apply(this, this._value.setUTCMonth, args);
555
+ }
556
+ setFullYear(...args) {
557
+ return apply(this, this._value.setFullYear, args);
558
+ }
559
+ setUTCFullYear(...args) {
560
+ return apply(this, this._value.setUTCFullYear, args);
561
+ }
562
+ }
563
+ const dateRef = (value, onChange) => new KTDateRef(value, onChange);
564
+
565
+ class KTMapRef extends KTRef {
566
+ constructor(value, onChange) {
567
+ super(value, onChange);
568
+ this.ktType = 4 /* KTReactiveType.MapRef */;
569
+ }
570
+ get size() {
571
+ return this._value.size;
572
+ }
573
+ has(key) {
574
+ return this._value.has(key);
575
+ }
576
+ get(key) {
577
+ return this._value.get(key);
578
+ }
579
+ set(key, value) {
580
+ apply(this, this._value.set, [key, value]);
581
+ return this;
582
+ }
583
+ delete(key) {
584
+ return apply(this, this._value.delete, [key]);
585
+ }
586
+ clear() {
587
+ return applyArgless(this, this._value.clear);
588
+ }
589
+ }
590
+ const mapRef = (value, onChange) => new KTMapRef(value, onChange);
591
+
592
+ class KTSetRef extends KTRef {
593
+ constructor(value, onChange) {
594
+ super(value, onChange);
595
+ this.ktType = 5 /* KTReactiveType.SetRef */;
596
+ }
597
+ get size() {
598
+ return this._value.size;
599
+ }
600
+ has(value) {
601
+ return this._value.has(value);
602
+ }
603
+ add(value) {
604
+ apply(this, this._value.add, [value]);
605
+ return this;
606
+ }
607
+ delete(value) {
608
+ return apply(this, this._value.delete, [value]);
609
+ }
610
+ clear() {
611
+ return applyArgless(this, this._value.clear);
612
+ }
613
+ }
614
+ const setRef = (value, onChange) => new KTSetRef(value, onChange);
615
+
616
+ class KTWeakMapRef extends KTRef {
617
+ constructor(value, onChange) {
618
+ super(value, onChange);
619
+ this.ktType = 6 /* KTReactiveType.WeakMapRef */;
620
+ }
621
+ has(key) {
622
+ return this._value.has(key);
623
+ }
624
+ get(key) {
625
+ return this._value.get(key);
626
+ }
627
+ set(key, value) {
628
+ apply(this, this._value.set, [key, value]);
629
+ return this;
630
+ }
631
+ delete(key) {
632
+ return apply(this, this._value.delete, [key]);
633
+ }
634
+ }
635
+ const weakMapRef = (value, onChange) => new KTWeakMapRef(value, onChange);
636
+
637
+ class KTWeakSetRef extends KTRef {
638
+ constructor(value, onChange) {
639
+ super(value, onChange);
640
+ this.ktType = 7 /* KTReactiveType.WeakSetRef */;
641
+ }
642
+ has(value) {
643
+ return this._value.has(value);
644
+ }
645
+ add(value) {
646
+ apply(this, this._value.add, [value]);
647
+ return this;
648
+ }
649
+ delete(value) {
650
+ return apply(this, this._value.delete, [value]);
651
+ }
652
+ }
653
+ const weakSetRef = (value, onChange) => new KTWeakSetRef(value, onChange);
654
+
434
655
  /**
435
- * Convert a value to `KTRef`.
436
- * - Returns the original value if it is already a `KTRef`.
437
- * - Throws error if the value is a `KTComputed`.
438
- * - Otherwise wraps the value with `ref()`.
439
- * @param o value to convert
656
+ * Reference to the created HTML element or other reactive data.
657
+ * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.
658
+ * - Automatically wrap the value with corresponding ref type based on its type.
659
+ * - When wrapped, setter-like methods will be reactive. like `push` for `Array`, `set` for `Map`, `add` for `Set`, etc.
660
+ * - Supports: `Array`, `Map`, `Set`, `WeakMap`, `WeakSet`, `Date`.
661
+ * - Since there will be some cost for runtime detection, and compilation plugin might not be able to analyze all cases. It is recommended to use specific ref type directly if you already know the type of value, like `ref.array`, `ref.map`, etc.
662
+ * @param value any data
663
+ * @param onChange event handler triggered when the value changes, with signature `(newValue, oldValue) => void`
440
664
  */
441
- const toRef = (o) => {
442
- if (isRef(o)) {
443
- return o;
665
+ function autoRef(value, onChange) {
666
+ if (Array.isArray(value)) {
667
+ return arrayRef(value, onChange);
444
668
  }
445
- else if (isComputed(o)) {
446
- throw new Error('[@ktjs/core error] Computed values cannot be used as KTRef.');
669
+ if (value instanceof Map) {
670
+ return mapRef(value, onChange);
447
671
  }
448
- else {
449
- return ref(o);
672
+ if (value instanceof Set) {
673
+ return setRef(value, onChange);
450
674
  }
451
- };
452
- function kcollect() {
453
- const newObj = {};
454
- const entries = $entries(this);
455
- for (let i = 0; i < entries.length; i++) {
456
- const key = entries[i][0];
457
- if (key === 'kcollect') {
458
- continue;
459
- }
460
- newObj[key] = entries[i][1].value;
675
+ if (value instanceof WeakMap) {
676
+ return weakMapRef(value, onChange);
677
+ }
678
+ if (value instanceof WeakSet) {
679
+ return weakSetRef(value, onChange);
680
+ }
681
+ if (value instanceof Date) {
682
+ return dateRef(value, onChange);
461
683
  }
462
- return newObj;
684
+ return new KTRef(value, onChange);
463
685
  }
686
+ // todo 编译时期,插件要尽量分析出谁是谁,并基于最大限度的覆写支持,避免运行时for循环创建ref
464
687
  /**
465
- * Make all first-level properties of the object a `KTRef`.
466
- * - `obj.a.b` is not reactive
688
+ * Create a plain `KTRef` object.
689
+ *
690
+ * If you want the value to be automatically wrapped with corresponding ref type based on its type, please use `autoRef` instead.
691
+ *
692
+ * @param value any data
693
+ * @param onChange event handler triggered when the value changes, with signature `(newValue, oldValue) => void`
694
+ * @returns
467
695
  */
468
- const surfaceRef = (obj) => {
469
- const entries = $entries(obj);
470
- const newObj = { kcollect };
471
- for (let i = 0; i < entries.length; i++) {
472
- newObj[entries[i][0]] = ref(entries[i][1]);
473
- }
474
- return newObj;
475
- };
476
- // # asserts
696
+ const ref = ((value, onChange) => new KTRef(value, onChange));
697
+ ref.array = arrayRef;
698
+ ref.date = dateRef;
699
+ ref.map = mapRef;
700
+ ref.set = setRef;
701
+ ref.weakMap = weakMapRef;
702
+ ref.weakSet = weakSetRef;
477
703
  /**
478
704
  * Assert k-model to be a ref object
479
705
  */
@@ -612,7 +838,7 @@ function applyKModel(element, valueRef) {
612
838
  * ## About
613
839
  * @package @ktjs/core
614
840
  * @author Kasukabe Tsumugi <futami16237@gmail.com>
615
- * @version 0.31.8 (Last Update: 2026.03.10 16:20:31.143)
841
+ * @version 0.32.3 (Last Update: 2026.03.19 02:06:25.422)
616
842
  * @license MIT
617
843
  * @link https://github.com/baendlorel/kt.js
618
844
  * @link https://baendlorel.github.io/ Welcome to my site!
@@ -1080,5 +1306,5 @@ function KTConditional(condition, tagIf, propsIf, tagElse, propsElse) {
1080
1306
  }
1081
1307
  }
1082
1308
 
1083
- export { $initRef, $modelOrRef, Fragment, KTAsync, KTComputed, KTConditional, KTFor, KTRef, applyAttr, computed, h as createElement, mathml$1 as createMathMLElement, svg$1 as createSVGElement, dereactive, effect, h, isComputed, isKT, isRef, jsx, jsxDEV, jsxs, mathml, mathml as mathmlRuntime, ref, surfaceRef, svg, svg as svgRuntime, toReactive, toRef };
1309
+ export { $initRef, $modelOrRef, Fragment, KTArrayRef, KTAsync, KTComputed, KTConditional, KTDateRef, KTFor, KTMapRef, KTSetRef, KTWeakMapRef, KTWeakSetRef, applyAttr, autoRef, computed, h as createElement, mathml$1 as createMathMLElement, svg$1 as createSVGElement, dereactive, effect, h, isArrayRef, isComputed, isDateRef, isKT, isMapRef, isRef, isSetRef, isWeakMapRef, isWeakSetRef, jsx, jsxDEV, jsxs, mathml, mathml as mathmlRuntime, ref, svg, svg as svgRuntime, toReactive };
1084
1310
  //# sourceMappingURL=index.mjs.map
@@ -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/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","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, handlerKeys?: ReactiveChangeKey[]) {\n if (handlerKeys) {\n for (let i = 0; i < handlerKeys.length; i++) {\n this._onChanges.get(handlerKeys[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, handlerKeys?: ReactiveChangeKey[]) {\n const oldValue = this._value;\n const newValue = this._calculator();\n if (oldValue === newValue) {\n if (forceEmit) {\n this._emit(newValue, oldValue, handlerKeys);\n }\n return;\n }\n this._value = newValue;\n this._emit(newValue, oldValue, handlerKeys);\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(handlerKeys?: ReactiveChangeKey[]) {\n this._recalculate(true, handlerKeys);\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, handlerKeys?: ReactiveChangeKey[]): R {\n $warn('KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');\n if (handlerKeys) {\n this._emit(this._value, this._value, handlerKeys);\n }\n return this._value as unknown as R;\n }\n\n toComputed<R>(calculator: (currentValue: T) => R, dependencies?: KTReactive<any>[]): 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<any> | 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, handlerKeys?: ReactiveChangeKey[]) {\n if (handlerKeys) {\n for (let i = 0; i < handlerKeys.length; i++) {\n this._onChanges.get(handlerKeys[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(handlerKeys?: ReactiveChangeKey[]) {\n this._emit(this._value, this._value, handlerKeys);\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, handlerKeys?: 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, handlerKeys);\n return result;\n }\n\n toComputed<R>(calculator: (currentValue: T) => R, dependencies?: KTReactive<any>[]): 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<any> | 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 return;\n }\n\n if (element.type === 'number') {\n $applyModel(element, valueRef, 'checked', 'change', Number);\n return;\n }\n\n if (element.type === 'date') {\n $applyModel(element, valueRef, 'checked', 'change', (v: any) => new Date(v));\n return;\n }\n\n $applyModel(element, valueRef, 'value', 'input');\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 if (typeof attr === 'object' && attr !== null && 'k-model' in attr) {\n applyKModel(element as any, attr['k-model'] as any);\n }\n\n // * Handle content\n applyAttr(element, attr);\n applyContent(element, content);\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 (typeof tag === 'function' ? tag(props) : h(tag, props, props.children)) as JSX.Element;\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 _mathml, svg as _svg } 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 create(creator: (tag: any, props: KTAttribute) => JSX.Element, tag: any, props: KTAttribute) {\n if (props.ref && isComputed(props.ref)) {\n $throw('Cannot assign a computed value to an element.');\n }\n const el = creator(tag, props);\n $initRef(props, el);\n return el;\n}\n\nexport const jsx = (tag: JSXTag, props: KTAttribute): JSX.Element => create(jsxh, tag, props);\nexport const svg = (tag: SVGTag, props: KTAttribute): JSX.Element => create(_svg, tag, props);\nexport const mathml = (tag: MathMLTag, props: KTAttribute): JSX.Element => create(_mathml, tag, props);\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","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// todo 对于template标签的for和if,会编译为fragment,可特殊处理,让它们保持原样\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","_svg","_mathml","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,IAAI,GAAG,IAAI,OAAO,EAAE;AACjB,QAAA,OAAe,CAAC,GAAG,CAAC,GAAG,KAAK;IAC/B;SAAO;AACL,QAAA,OAAO,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC;IAClC;AACF,CAAC;AAED;AACO,MAAM,QAAQ,GAGjB;AACF,IAAA,OAAO,EAAE,cAAc;AACvB,IAAA,QAAQ,EAAE,cAAc;AACxB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,WAAW,EAAE,YAAY;AACzB,IAAA,aAAa,EAAE,YAAY;AAC3B,IAAA,YAAY,EAAE,YAAY;AAC1B,IAAA,cAAc,EAAE,cAAc;AAC9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../src/h/content.ts","../src/common.ts","../src/reactive/computed.ts","../src/reactive/refs/ref.ts","../src/reactive/refs/applier.ts","../src/reactive/refs/array.ts","../src/reactive/refs/date.ts","../src/reactive/refs/map.ts","../src/reactive/refs/set.ts","../src/reactive/refs/weak-map.ts","../src/reactive/refs/weak-set.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 } from './index.js';\nimport type { KTRef } from './refs/ref.js';\n\nexport const enum KTReactiveType {\n Computed = 1,\n Ref,\n ArrayRef,\n MapRef,\n SetRef,\n WeakMapRef,\n WeakSetRef,\n DateRef,\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> => {\n // & This is tested to be the fastest way.\n // faster than includes, arrayindex, if or.\n if (obj.ktType === undefined) {\n return false;\n }\n return obj.ktType >= KTReactiveType.Ref && obj.ktType <= KTReactiveType.DateRef;\n};\n\nexport const isArrayRef = <T = any>(obj: any): obj is KTRef<T[]> => obj?.ktType === KTReactiveType.ArrayRef;\n\nexport const isMapRef = <K = any, V = any>(obj: any): obj is KTRef<Map<K, V>> => obj?.ktType === KTReactiveType.MapRef;\nexport const isSetRef = <T = any>(obj: any): obj is KTRef<Set<T>> => obj?.ktType === KTReactiveType.SetRef;\nexport const isWeakMapRef = <K extends WeakKey = WeakKey, V = any>(obj: any): obj is KTRef<WeakMap<K, V>> =>\n obj?.ktType === KTReactiveType.WeakMapRef;\nexport const isWeakSetRef = <T extends WeakKey = WeakKey>(obj: any): obj is KTRef<WeakSet<T>> =>\n obj?.ktType === KTReactiveType.WeakSetRef;\nexport const isDateRef = (obj: any): obj is KTRef<Date> => obj?.ktType === KTReactiveType.DateRef;\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","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, handlerKeys?: ReactiveChangeKey[]) {\n if (handlerKeys) {\n for (let i = 0; i < handlerKeys.length; i++) {\n this._onChanges.get(handlerKeys[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, handlerKeys?: ReactiveChangeKey[]) {\n const oldValue = this._value;\n const newValue = this._calculator();\n if (oldValue === newValue) {\n if (forceEmit) {\n this._emit(newValue, oldValue, handlerKeys);\n }\n return;\n }\n this._value = newValue;\n this._emit(newValue, oldValue, handlerKeys);\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(handlerKeys?: ReactiveChangeKey[]) {\n this._recalculate(true, handlerKeys);\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, handlerKeys?: ReactiveChangeKey[]): R {\n $warn('KTComputed.mutate: computed is derived automatically; manual mutate is ignored. Use notify() instead');\n if (handlerKeys) {\n this._emit(this._value, this._value, handlerKeys);\n }\n return this._value as unknown as R;\n }\n\n toComputed<R>(calculator: (currentValue: T) => R, dependencies?: KTReactive<any>[]): 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<any> | 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 { $is } from '@ktjs/shared';\nimport { IdGenerator } from '../../common.js';\nimport type { KTReactive, ReactiveChangeKey, ReactiveChangeHandler } from '../../types/reactive.js';\nimport { computed, type KTComputed } from '../computed.js';\nimport { KTReactiveType } from '../core.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 protected _value: T;\n\n /**\n * @internal\n */\n protected _onChanges: Map<ReactiveChangeKey, ReactiveChangeHandler<T>>;\n\n /**\n * @internal\n */\n protected _emit(newValue: T, oldValue: T, handlerKeys?: ReactiveChangeKey[]) {\n if (handlerKeys) {\n for (let i = 0; i < handlerKeys.length; i++) {\n this._onChanges.get(handlerKeys[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(handlerKeys?: ReactiveChangeKey[]) {\n this._emit(this._value, this._value, handlerKeys);\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, handlerKeys?: 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, handlerKeys);\n return result;\n }\n\n toComputed<R>(calculator: (currentValue: T) => R, dependencies?: KTReactive<any>[]): 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<any> | undefined {\n const callback = this._onChanges.get(key);\n this._onChanges.delete(key);\n return callback;\n }\n}\n","import type { KTRef } from './ref.js';\n\n/**\n * Calls the setter-like function and emit all changes of it\n */\nexport const apply = (r: KTRef<any>, setter: (...args: any[]) => any, args: any[]) => {\n const v = r.value;\n const result = setter.apply(v, args);\n (r as any)._onChanges.forEach((handler: (...args: any[]) => void) => handler(v, v));\n return result;\n};\n\nexport const applyArgless = (r: KTRef<any>, setter: (...args: any[]) => any) => {\n const v = r.value;\n const result = setter.apply(v);\n (r as any)._onChanges.forEach((handler: (...args: any[]) => void) => handler(v, v));\n return result;\n};\n","import type { ReactiveChangeHandler } from '../../types/reactive.js';\nimport { KTReactiveType } from '../core.js';\nimport { KTRef } from './ref.js';\nimport { apply, applyArgless } from './applier.js';\n\nexport class KTArrayRef<T> extends KTRef<T[]> {\n constructor(value: T[], onChange?: ReactiveChangeHandler<T[]>) {\n super(value, onChange);\n this.ktType = KTReactiveType.ArrayRef;\n }\n\n get length() {\n return this.value.length;\n }\n\n set length(newLength: number) {\n this._value.length = newLength;\n this._onChanges.forEach((handler) => handler(this._value, this._value));\n }\n\n push(...items: T[]): number {\n return apply(this, this._value.push, items);\n }\n\n /**\n * Same as `Array.prototype.pop`, but emits change after calling it\n */\n pop(): T | undefined {\n return applyArgless(this, this._value.pop);\n }\n\n /**\n * Same as `Array.prototype.shift`, but emits change after calling it\n */\n shift(): T | undefined {\n return applyArgless(this, this._value.shift);\n }\n\n /**\n * Same as `Array.prototype.unshift`, but emits change after calling it\n */\n unshift(...items: T[]): number {\n return apply(this, this._value.unshift, items);\n }\n\n /**\n * Same as `Array.prototype.splice`, but emits change after calling it\n */\n splice(start: number, deleteCount?: number): T[];\n splice(start: number, deleteCount: number, ...items: T[]): T[];\n splice(...args: any[]): T[] {\n return apply(this, this._value.splice, args);\n }\n\n /**\n * Same as `Array.prototype.sort`, but emits change after calling it\n */\n sort(compareFn?: (a: T, b: T) => number): this;\n sort(...args: any[]): this {\n apply(this, this._value.sort, args);\n return this;\n }\n\n /**\n * Same as `Array.prototype.reverse`, but emits change after calling it\n */\n reverse(): this {\n applyArgless(this, this._value.reverse);\n return this;\n }\n\n /**\n * Same as `Array.prototype.fill`, but emits change after calling it\n */\n fill(value: T, start?: number, end?: number): this;\n fill(...args: any[]): this {\n apply(this, this._value.fill, args);\n return this;\n }\n\n /**\n * Same as `Array.prototype.copyWithin`, but emits change after calling it\n */\n copyWithin(target: number, start: number, end?: number): this;\n copyWithin(...args: any[]): this {\n apply(this, this._value.copyWithin, args);\n return this;\n }\n}\n\nexport const arrayRef = (value: unknown, onChange?: ReactiveChangeHandler<any>) =>\n new KTArrayRef(value as any[], onChange);\n","import type { ReactiveChangeHandler } from '../../types/reactive.js';\nimport { KTReactiveType } from '../core.js';\nimport { KTRef } from './ref.js';\nimport { apply } from './applier.js';\n\nexport class KTDateRef extends KTRef<Date> {\n constructor(value: Date, onChange?: ReactiveChangeHandler<Date>) {\n super(value, onChange);\n this.ktType = KTReactiveType.DateRef;\n }\n\n setTime(timeValue: number): number {\n return apply(this, this._value.setTime, [timeValue]);\n }\n\n setMilliseconds(millisecondsValue: number): number {\n return apply(this, this._value.setMilliseconds, [millisecondsValue]);\n }\n\n setUTCMilliseconds(millisecondsValue: number): number {\n return apply(this, this._value.setUTCMilliseconds, [millisecondsValue]);\n }\n\n setSeconds(secondsValue: number, millisecondsValue?: number): number;\n setSeconds(...args: any[]): number {\n return apply(this, this._value.setSeconds, args);\n }\n\n setUTCSeconds(secondsValue: number, millisecondsValue?: number): number;\n setUTCSeconds(...args: any[]): number {\n return apply(this, this._value.setUTCSeconds, args);\n }\n\n setMinutes(minutesValue: number, secondsValue?: number, millisecondsValue?: number): number;\n setMinutes(...args: any[]): number {\n return apply(this, this._value.setMinutes, args);\n }\n\n setUTCMinutes(minutesValue: number, secondsValue?: number, millisecondsValue?: number): number;\n setUTCMinutes(...args: any[]): number {\n return apply(this, this._value.setUTCMinutes, args);\n }\n\n setHours(hoursValue: number, minutesValue?: number, secondsValue?: number, millisecondsValue?: number): number;\n setHours(...args: any[]): number {\n return apply(this, this._value.setHours, args);\n }\n\n setUTCHours(hoursValue: number, minutesValue?: number, secondsValue?: number, millisecondsValue?: number): number;\n setUTCHours(...args: any[]): number {\n return apply(this, this._value.setUTCHours, args);\n }\n\n setDate(dateValue: number): number {\n return apply(this, this._value.setDate, [dateValue]);\n }\n\n setUTCDate(dateValue: number): number {\n return apply(this, this._value.setUTCDate, [dateValue]);\n }\n\n setMonth(monthValue: number, dateValue?: number): number;\n setMonth(...args: any[]): number {\n return apply(this, this._value.setMonth, args);\n }\n\n setUTCMonth(monthValue: number, dateValue?: number): number;\n setUTCMonth(...args: any[]): number {\n return apply(this, this._value.setUTCMonth, args);\n }\n\n setFullYear(yearValue: number, monthValue?: number, dateValue?: number): number;\n setFullYear(...args: any[]): number {\n return apply(this, this._value.setFullYear, args);\n }\n\n setUTCFullYear(yearValue: number, monthValue?: number, dateValue?: number): number;\n setUTCFullYear(...args: any[]): number {\n return apply(this, this._value.setUTCFullYear, args);\n }\n}\n\nexport const dateRef = (value: unknown, onChange?: ReactiveChangeHandler<any>) => new KTDateRef(value as any, onChange);\n","import type { ReactiveChangeHandler } from '../../types/reactive.js';\nimport { KTReactiveType } from '../core.js';\nimport { KTRef } from './ref.js';\nimport { apply, applyArgless } from './applier.js';\n\nexport class KTMapRef<K, V> extends KTRef<Map<K, V>> {\n constructor(value: Map<K, V>, onChange?: ReactiveChangeHandler<Map<K, V>>) {\n super(value, onChange);\n this.ktType = KTReactiveType.MapRef;\n }\n\n get size() {\n return this._value.size;\n }\n\n has(key: K) {\n return this._value.has(key);\n }\n\n get(key: K) {\n return this._value.get(key);\n }\n\n set(key: K, value: V): this {\n apply(this, this._value.set, [key, value]);\n return this;\n }\n\n delete(key: K): boolean {\n return apply(this, this._value.delete, [key]);\n }\n\n clear() {\n return applyArgless(this, this._value.clear);\n }\n}\n\nexport const mapRef = (value: unknown, onChange?: ReactiveChangeHandler<any>) => new KTMapRef(value as any, onChange);\n","import type { ReactiveChangeHandler } from '../../types/reactive.js';\nimport { KTReactiveType } from '../core.js';\nimport { KTRef } from './ref.js';\nimport { apply, applyArgless } from './applier.js';\n\nexport class KTSetRef<T> extends KTRef<Set<T>> {\n constructor(value: Set<T>, onChange?: ReactiveChangeHandler<Set<T>>) {\n super(value, onChange);\n this.ktType = KTReactiveType.SetRef;\n }\n\n get size() {\n return this._value.size;\n }\n\n has(value: T) {\n return this._value.has(value);\n }\n\n add(value: T): this {\n apply(this, this._value.add, [value]);\n return this;\n }\n\n delete(value: T): boolean {\n return apply(this, this._value.delete, [value]);\n }\n\n clear() {\n return applyArgless(this, this._value.clear);\n }\n}\n\nexport const setRef = (value: unknown, onChange?: ReactiveChangeHandler<any>) => new KTSetRef(value as any, onChange);\n","import type { ReactiveChangeHandler } from '../../types/reactive.js';\nimport { KTReactiveType } from '../core.js';\nimport { KTRef } from './ref.js';\nimport { apply } from './applier.js';\n\nexport class KTWeakMapRef<K extends WeakKey = WeakKey, V = any> extends KTRef<WeakMap<K, V>> {\n constructor(value: WeakMap<K, V>, onChange?: ReactiveChangeHandler<WeakMap<K, V>>) {\n super(value, onChange);\n this.ktType = KTReactiveType.WeakMapRef;\n }\n\n has(key: K) {\n return this._value.has(key);\n }\n\n get(key: K) {\n return this._value.get(key);\n }\n\n set(key: K, value: V): this {\n apply(this, this._value.set, [key, value]);\n return this;\n }\n\n delete(key: K): boolean {\n return apply(this, this._value.delete, [key]);\n }\n}\n\nexport const weakMapRef = (value: unknown, onChange?: ReactiveChangeHandler<any>) =>\n new KTWeakMapRef(value as any, onChange);\n","import type { ReactiveChangeHandler } from '../../types/reactive.js';\nimport { KTReactiveType } from '../core.js';\nimport { KTRef } from './ref.js';\nimport { apply } from './applier.js';\n\nexport class KTWeakSetRef<T extends WeakKey = WeakKey> extends KTRef<WeakSet<T>> {\n constructor(value: WeakSet<T>, onChange?: ReactiveChangeHandler<WeakSet<T>>) {\n super(value, onChange);\n this.ktType = KTReactiveType.WeakSetRef;\n }\n\n has(value: T) {\n return this._value.has(value);\n }\n\n add(value: T): this {\n apply(this, this._value.add, [value]);\n return this;\n }\n\n delete(value: T): boolean {\n return apply(this, this._value.delete, [value]);\n }\n}\n\nexport const weakSetRef = (value: unknown, onChange?: ReactiveChangeHandler<any>) =>\n new KTWeakSetRef(value as any, onChange);\n","import { $emptyFn } from '@ktjs/shared';\nimport type { ReactiveChangeHandler } from '../types/reactive.js';\nimport type { JSX } from '../types/jsx.js';\n\nimport type { KTAutoRef } from './refs/auto-ref.js';\nimport { KTRef } from './refs/ref.js';\nimport { isRef } from './core.js';\nimport { arrayRef } from './refs/array.js';\nimport { dateRef } from './refs/date.js';\nimport { mapRef } from './refs/map.js';\nimport { setRef } from './refs/set.js';\nimport { weakMapRef } from './refs/weak-map.js';\nimport { weakSetRef } from './refs/weak-set.js';\n\n/**\n * Reference to the created HTML element or other reactive data.\n * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.\n * - Automatically wrap the value with corresponding ref type based on its type.\n * - When wrapped, setter-like methods will be reactive. like `push` for `Array`, `set` for `Map`, `add` for `Set`, etc.\n * - Supports: `Array`, `Map`, `Set`, `WeakMap`, `WeakSet`, `Date`.\n * - Since there will be some cost for runtime detection, and compilation plugin might not be able to analyze all cases. It is recommended to use specific ref type directly if you already know the type of value, like `ref.array`, `ref.map`, etc.\n * @param value any data\n * @param onChange event handler triggered when the value changes, with signature `(newValue, oldValue) => void`\n */\nexport function autoRef<T>(value?: T, onChange?: ReactiveChangeHandler<T>): KTAutoRef<T> {\n if (Array.isArray(value)) {\n return arrayRef(value, onChange) as KTAutoRef<T>;\n }\n if (value instanceof Map) {\n return mapRef(value, onChange) as KTAutoRef<T>;\n }\n if (value instanceof Set) {\n return setRef(value, onChange) as KTAutoRef<T>;\n }\n if (value instanceof WeakMap) {\n return weakMapRef(value, onChange) as KTAutoRef<T>;\n }\n if (value instanceof WeakSet) {\n return weakSetRef(value, onChange) as KTAutoRef<T>;\n }\n if (value instanceof Date) {\n return dateRef(value, onChange) as KTAutoRef<T>;\n }\n return new KTRef<T>(value as any, onChange) as KTAutoRef<T>;\n}\n\ntype RefCreator = (<T = JSX.Element>(value?: T, onChange?: ReactiveChangeHandler<T>) => KTRef<T>) & {\n array: typeof arrayRef;\n date: typeof dateRef;\n map: typeof mapRef;\n set: typeof setRef;\n weakMap: typeof weakMapRef;\n weakSet: typeof weakSetRef;\n};\n\n// todo 编译时期,插件要尽量分析出谁是谁,并基于最大限度的覆写支持,避免运行时for循环创建ref\n/**\n * Create a plain `KTRef` object.\n *\n * If you want the value to be automatically wrapped with corresponding ref type based on its type, please use `autoRef` instead.\n *\n * @param value any data\n * @param onChange event handler triggered when the value changes, with signature `(newValue, oldValue) => void`\n * @returns\n */\nconst ref: RefCreator = ((value, onChange) => new KTRef(value as any, onChange)) as RefCreator;\nref.array = arrayRef;\nref.date = dateRef;\nref.map = mapRef;\nref.set = setRef;\nref.weakMap = weakMapRef;\nref.weakSet = weakSetRef;\n\nexport { ref };\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 { KTArrayRef } from './refs/array.js';\nexport { KTMapRef } from './refs/map.js';\nexport { KTSetRef } from './refs/set.js';\nexport { KTWeakMapRef } from './refs/weak-map.js';\nexport { KTWeakSetRef } from './refs/weak-set.js';\nexport { KTDateRef } from './refs/date.js';\n\nexport * from './computed.js';\nexport * from './effect.js';\n","import { $applyModel, type InputElementTag } from '@ktjs/shared';\nimport type { KTRef } from '../reactive/refs/ref.js';\nimport { isKT } 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 return;\n }\n\n if (element.type === 'number') {\n $applyModel(element, valueRef, 'checked', 'change', Number);\n return;\n }\n\n if (element.type === 'date') {\n $applyModel(element, valueRef, 'checked', 'change', (v: any) => new Date(v));\n return;\n }\n\n $applyModel(element, valueRef, 'value', 'input');\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 if (typeof attr === 'object' && attr !== null && 'k-model' in attr) {\n applyKModel(element as any, attr['k-model'] as any);\n }\n\n // * Handle content\n applyAttr(element, attr);\n applyContent(element, content);\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 { KTReactive } from '../types/reactive.js';\nimport type { KTRawContent } from '../types/h.js';\nimport type { JSX } from '../types/jsx.js';\nimport type { KTRef } from '../reactive/refs/ref.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 (typeof tag === 'function' ? tag(props) : h(tag, props, props.children)) as JSX.Element;\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 _mathml, svg as _svg } from '../h/index.js';\nimport { $initRef, isComputed } from '../reactive/index.js';\nimport { convertChildrenToElements, Fragment as FragmentArray } from './fragment.js';\nimport { jsxh, placeholder } from './common.js';\n\nfunction create(creator: (tag: any, props: KTAttribute) => JSX.Element, tag: any, props: KTAttribute) {\n if (props.ref && isComputed(props.ref)) {\n $throw('Cannot assign a computed value to an element.');\n }\n const el = creator(tag, props);\n $initRef(props, el);\n return el;\n}\n\nexport const jsx = (tag: JSXTag, props: KTAttribute): JSX.Element => create(jsxh, tag, props);\nexport const svg = (tag: SVGTag, props: KTAttribute): JSX.Element => create(_svg, tag, props);\nexport const mathml = (tag: MathMLTag, props: KTAttribute): JSX.Element => create(_mathml, tag, props);\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","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/refs/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/refs/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// todo 对于template标签的for和if,会编译为fragment,可特殊处理,让它们保持原样\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: any | KTReactive<any>,\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","_svg","_mathml","FragmentArray"],"mappings":";;AAeO,MAAM,IAAI,GAAG,CAAU,GAAQ,KAA2B,GAAG,EAAE;AAC/D,MAAM,KAAK,GAAG,CAAU,GAAQ,KAAqB;;;AAG1D,IAAA,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE;AAC5B,QAAA,OAAO,KAAK;IACd;IACA,OAAO,GAAG,CAAC,MAAM,IAAA,CAAA,6BAA0B,GAAG,CAAC,MAAM,IAAA,CAAA;AACvD;AAEO,MAAM,UAAU,GAAG,CAAU,GAAQ,KAAwB,GAAG,EAAE,MAAM;AAExE,MAAM,QAAQ,GAAG,CAAmB,GAAQ,KAA8B,GAAG,EAAE,MAAM;AACrF,MAAM,QAAQ,GAAG,CAAU,GAAQ,KAA2B,GAAG,EAAE,MAAM;AACzE,MAAM,YAAY,GAAG,CAAuC,GAAQ,KACzE,GAAG,EAAE,MAAM;AACN,MAAM,YAAY,GAAG,CAA8B,GAAQ,KAChE,GAAG,EAAE,MAAM;AACN,MAAM,SAAS,GAAG,CAAC,GAAQ,KAAyB,GAAG,EAAE,MAAM;AAC/D,MAAM,UAAU,GAAG,CAAU,GAAQ,KAA2B,GAAG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;IAChB;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ktjs/core",
3
- "version": "0.31.8",
3
+ "version": "0.32.3",
4
4
  "description": "Core functionality for kt.js - DOM manipulation utilities with JSX/TSX support",
5
5
  "description_zh": "kt.js 的核心功能,提供支持 JSX/TSX 的 DOM 操作工具。",
6
6
  "type": "module",