@ktjs/core 0.29.8 → 0.29.11

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
@@ -1,10 +1,1469 @@
1
- export * from './h/index.js';
2
- export * from './jsx/index.js';
3
- export * from './reactive/index.js';
4
- export { KTAsync } from './jsx/async.js';
5
- export { KTFor } from './jsx/for.js';
6
- export type { KTForProps, KTForElement } from './jsx/for.js';
7
- export type { HTMLTag, SVGTag, MathMLTag, InputElementTag } from '@ktjs/shared';
8
- export type { KTRawContent, KTRawContents, KTRawAttr, EventHandler, KTAttribute, KTPrefixedEventAttribute, } from './types/h.js';
9
- export type * from './types/jsx.js';
10
- export type * from './types/reactive.js';
1
+ import { otherstring, HTMLTag, SVGTag, MathMLTag, JSXTag } from '@ktjs/shared';
2
+ export { HTMLTag, InputElementTag, MathMLTag, SVGTag } from '@ktjs/shared';
3
+
4
+ // Base events available to all HTML elements
5
+ type BaseAttr = KTPrefixedEventAttribute &
6
+ KTReactifyProps<{
7
+ [k: string]: any;
8
+
9
+ // # base attributes
10
+ class?: string;
11
+ className?: string;
12
+ style?: string | Partial<CSSStyleDeclaration>;
13
+ }>;
14
+
15
+ interface AttributesMap {
16
+ // Anchor element
17
+ a: BaseAttr &
18
+ KTReactifyProps<{
19
+ download?: string;
20
+ href?: string;
21
+ hreflang?: string;
22
+ ping?: string;
23
+ referrerpolicy?:
24
+ | 'no-referrer'
25
+ | 'no-referrer-when-downgrade'
26
+ | 'origin'
27
+ | 'origin-when-cross-origin'
28
+ | 'same-origin'
29
+ | 'strict-origin'
30
+ | 'strict-origin-when-cross-origin'
31
+ | 'unsafe-url';
32
+ rel?: string;
33
+ target?: '_self' | '_blank' | '_parent' | '_top' | string;
34
+ type?: string;
35
+ }>;
36
+
37
+ // Area element
38
+ area: BaseAttr &
39
+ KTReactifyProps<{
40
+ alt?: string;
41
+ coords?: string;
42
+ download?: string;
43
+ href?: string;
44
+ ping?: string;
45
+ referrerpolicy?:
46
+ | 'no-referrer'
47
+ | 'no-referrer-when-downgrade'
48
+ | 'origin'
49
+ | 'origin-when-cross-origin'
50
+ | 'same-origin'
51
+ | 'strict-origin'
52
+ | 'strict-origin-when-cross-origin'
53
+ | 'unsafe-url';
54
+ rel?: string;
55
+ shape?: 'rect' | 'circle' | 'poly' | 'default';
56
+ target?: '_self' | '_blank' | '_parent' | '_top' | string;
57
+ }>;
58
+
59
+ // Audio element
60
+ audio: BaseAttr &
61
+ KTReactifyProps<{
62
+ autoplay?: boolean;
63
+ controls?: boolean;
64
+ crossorigin?: 'anonymous' | 'use-credentials' | '';
65
+ loop?: boolean;
66
+ muted?: boolean;
67
+ preload?: 'none' | 'metadata' | 'auto' | '';
68
+ src?: string;
69
+ }>;
70
+
71
+ // Base element
72
+ base: BaseAttr &
73
+ KTReactifyProps<{
74
+ href?: string;
75
+ target?: '_self' | '_blank' | '_parent' | '_top' | string;
76
+ }>;
77
+
78
+ // Body element
79
+ body: BaseAttr & KTReactifyProps<{}>;
80
+
81
+ // BR element
82
+ br: BaseAttr & KTReactifyProps<{}>;
83
+
84
+ // Button element
85
+ button: BaseAttr &
86
+ KTReactifyProps<{
87
+ disabled?: boolean;
88
+ form?: string;
89
+ formaction?: string;
90
+ formenctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
91
+ formmethod?: 'get' | 'post' | 'dialog';
92
+ formnovalidate?: boolean;
93
+ formtarget?: '_self' | '_blank' | '_parent' | '_top' | string;
94
+ name?: string;
95
+ type?: 'submit' | 'reset' | 'button';
96
+ value?: string;
97
+ }>;
98
+
99
+ // Canvas element
100
+ canvas: BaseAttr &
101
+ KTReactifyProps<{
102
+ height?: number | string;
103
+ width?: number | string;
104
+ }>;
105
+
106
+ // Table caption element
107
+ caption: BaseAttr & KTReactifyProps<{}>;
108
+
109
+ // Col element
110
+ col: BaseAttr &
111
+ KTReactifyProps<{
112
+ span?: number | string;
113
+ }>;
114
+
115
+ // Colgroup element
116
+ colgroup: BaseAttr &
117
+ KTReactifyProps<{
118
+ span?: number | string;
119
+ }>;
120
+
121
+ // Data element
122
+ data: BaseAttr &
123
+ KTReactifyProps<{
124
+ value?: string;
125
+ }>;
126
+
127
+ // Datalist element
128
+ datalist: BaseAttr & KTReactifyProps<{}>;
129
+
130
+ // Del element
131
+ del: BaseAttr &
132
+ KTReactifyProps<{
133
+ cite?: string;
134
+ datetime?: string;
135
+ }>;
136
+
137
+ // Details element
138
+ details: BaseAttr &
139
+ KTReactifyProps<{
140
+ open?: boolean;
141
+ }>;
142
+
143
+ // Dialog element
144
+ dialog: BaseAttr &
145
+ KTReactifyProps<{
146
+ open?: boolean;
147
+ }>;
148
+
149
+ // Embed element
150
+ embed: BaseAttr &
151
+ KTReactifyProps<{
152
+ height?: number | string;
153
+ src?: string;
154
+ type?: string;
155
+ width?: number | string;
156
+ }>;
157
+
158
+ // Fieldset element
159
+ fieldset: BaseAttr &
160
+ KTReactifyProps<{
161
+ disabled?: boolean;
162
+ form?: string;
163
+ name?: string;
164
+ }>;
165
+
166
+ // Form element
167
+ form: BaseAttr &
168
+ KTReactifyProps<{
169
+ 'accept-charset'?: string;
170
+ action?: string;
171
+ autocomplete?: 'on' | 'off';
172
+ enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
173
+ method?: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE' | otherstring;
174
+
175
+ name?: string;
176
+ novalidate?: boolean;
177
+ target?: '_self' | '_blank' | '_parent' | '_top' | string;
178
+ }>;
179
+
180
+ // Head element
181
+ head: BaseAttr & KTReactifyProps<{}>;
182
+
183
+ // HR element
184
+ hr: BaseAttr & KTReactifyProps<{}>;
185
+
186
+ // HTML element
187
+ html: BaseAttr & KTReactifyProps<{}>;
188
+
189
+ // IFrame element
190
+ iframe: BaseAttr &
191
+ KTReactifyProps<{
192
+ allow?: string;
193
+ allowfullscreen?: boolean;
194
+ allowpaymentrequest?: boolean;
195
+ height?: number | string;
196
+ loading?: 'eager' | 'lazy';
197
+ name?: string;
198
+ referrerpolicy?:
199
+ | 'no-referrer'
200
+ | 'no-referrer-when-downgrade'
201
+ | 'origin'
202
+ | 'origin-when-cross-origin'
203
+ | 'same-origin'
204
+ | 'strict-origin'
205
+ | 'strict-origin-when-cross-origin'
206
+ | 'unsafe-url';
207
+ sandbox?: string;
208
+ src?: string;
209
+ srcdoc?: string;
210
+ width?: number | string;
211
+ }>;
212
+
213
+ // Image element
214
+ img: BaseAttr &
215
+ KTReactifyProps<{
216
+ alt?: string;
217
+ crossorigin?: 'anonymous' | 'use-credentials' | '';
218
+ decoding?: 'sync' | 'async' | 'auto';
219
+ height?: number | string;
220
+ ismap?: boolean;
221
+ loading?: 'eager' | 'lazy';
222
+ referrerpolicy?:
223
+ | 'no-referrer'
224
+ | 'no-referrer-when-downgrade'
225
+ | 'origin'
226
+ | 'origin-when-cross-origin'
227
+ | 'same-origin'
228
+ | 'strict-origin'
229
+ | 'strict-origin-when-cross-origin'
230
+ | 'unsafe-url';
231
+ sizes?: string;
232
+ src?: string;
233
+ srcset?: string;
234
+ usemap?: string;
235
+ width?: number | string;
236
+ }>;
237
+
238
+ // Input element
239
+ input: BaseAttr &
240
+ KTReactifyProps<{
241
+ accept?: string;
242
+ alt?: string;
243
+ autocomplete?: string;
244
+ checked?: boolean;
245
+ dirname?: string;
246
+ disabled?: boolean;
247
+ form?: string;
248
+ formaction?: string;
249
+ formenctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
250
+ formmethod?: 'get' | 'post';
251
+ formnovalidate?: boolean;
252
+ formtarget?: '_self' | '_blank' | '_parent' | '_top' | string;
253
+ height?: number | string;
254
+ list?: string;
255
+ max?: number | string;
256
+ maxlength?: number | string;
257
+ min?: number | string;
258
+ minlength?: number | string;
259
+ multiple?: boolean;
260
+ name?: string;
261
+ pattern?: string;
262
+ placeholder?: string;
263
+ readonly?: boolean;
264
+ required?: boolean;
265
+ size?: number | string;
266
+ src?: string;
267
+ step?: number | string;
268
+ type?:
269
+ | 'button'
270
+ | 'checkbox'
271
+ | 'color'
272
+ | 'date'
273
+ | 'datetime-local'
274
+ | 'email'
275
+ | 'file'
276
+ | 'hidden'
277
+ | 'image'
278
+ | 'month'
279
+ | 'number'
280
+ | 'password'
281
+ | 'radio'
282
+ | 'range'
283
+ | 'reset'
284
+ | 'search'
285
+ | 'submit'
286
+ | 'tel'
287
+ | 'text'
288
+ | 'time'
289
+ | 'url'
290
+ | 'week';
291
+ value?: string;
292
+ width?: number | string;
293
+ }>;
294
+
295
+ // Ins element
296
+ ins: BaseAttr &
297
+ KTReactifyProps<{
298
+ cite?: string;
299
+ datetime?: string;
300
+ }>;
301
+
302
+ // Label element
303
+ label: BaseAttr &
304
+ KTReactifyProps<{
305
+ for?: string;
306
+ }>;
307
+
308
+ // Legend element
309
+ legend: BaseAttr & KTReactifyProps<{}>;
310
+
311
+ // LI element
312
+ li: BaseAttr &
313
+ KTReactifyProps<{
314
+ value?: number | string;
315
+ }>;
316
+
317
+ // Link element
318
+ link: BaseAttr &
319
+ KTReactifyProps<{
320
+ as?: string;
321
+ crossorigin?: 'anonymous' | 'use-credentials' | '';
322
+ disabled?: boolean;
323
+ href?: string;
324
+ hreflang?: string;
325
+ imagesizes?: string;
326
+ imagesrcset?: string;
327
+ integrity?: string;
328
+ media?: string;
329
+ referrerpolicy?:
330
+ | 'no-referrer'
331
+ | 'no-referrer-when-downgrade'
332
+ | 'origin'
333
+ | 'origin-when-cross-origin'
334
+ | 'same-origin'
335
+ | 'strict-origin'
336
+ | 'strict-origin-when-cross-origin'
337
+ | 'unsafe-url';
338
+ rel?: string;
339
+ sizes?: string;
340
+ type?: string;
341
+ }>;
342
+
343
+ // Map element
344
+ map: BaseAttr &
345
+ KTReactifyProps<{
346
+ name?: string;
347
+ }>;
348
+
349
+ // Menu element
350
+ menu: BaseAttr & KTReactifyProps<{}>;
351
+
352
+ // Meta element
353
+ meta: BaseAttr &
354
+ KTReactifyProps<{
355
+ charset?: string;
356
+ content?: string;
357
+ 'http-equiv'?: 'content-security-policy' | 'content-type' | 'default-style' | 'refresh' | string;
358
+ name?: string;
359
+ }>;
360
+
361
+ // Meter element
362
+ meter: BaseAttr &
363
+ KTReactifyProps<{
364
+ form?: string;
365
+ high?: number | string;
366
+ low?: number | string;
367
+ max?: number | string;
368
+ min?: number | string;
369
+ optimum?: number | string;
370
+ value?: number | string;
371
+ }>;
372
+
373
+ // Object element
374
+ object: BaseAttr &
375
+ KTReactifyProps<{
376
+ data?: string;
377
+ form?: string;
378
+ height?: number | string;
379
+ name?: string;
380
+ type?: string;
381
+ usemap?: string;
382
+ width?: number | string;
383
+ }>;
384
+
385
+ // OL element
386
+ ol: BaseAttr &
387
+ KTReactifyProps<{
388
+ reversed?: boolean;
389
+ start?: number | string;
390
+ type?: '1' | 'a' | 'A' | 'i' | 'I';
391
+ }>;
392
+
393
+ // Optgroup element
394
+ optgroup: BaseAttr &
395
+ KTReactifyProps<{
396
+ disabled?: boolean;
397
+ label?: string;
398
+ }>;
399
+
400
+ // Option element
401
+ option: BaseAttr &
402
+ KTReactifyProps<{
403
+ disabled?: boolean;
404
+ label?: string;
405
+ selected?: boolean;
406
+ value?: string;
407
+ }>;
408
+
409
+ // Output element
410
+ output: BaseAttr &
411
+ KTReactifyProps<{
412
+ for?: string;
413
+ form?: string;
414
+ name?: string;
415
+ }>;
416
+
417
+ // Picture element
418
+ picture: BaseAttr & KTReactifyProps<{}>;
419
+
420
+ // Pre element
421
+ pre: BaseAttr & KTReactifyProps<{}>;
422
+
423
+ // Progress element
424
+ progress: BaseAttr &
425
+ KTReactifyProps<{
426
+ max?: number | string;
427
+ value?: number | string;
428
+ }>;
429
+
430
+ // Quote element (q and blockquote)
431
+ q: BaseAttr &
432
+ KTReactifyProps<{
433
+ cite?: string;
434
+ }>;
435
+
436
+ blockquote: BaseAttr &
437
+ KTReactifyProps<{
438
+ cite?: string;
439
+ }>;
440
+
441
+ // Script element
442
+ script: BaseAttr &
443
+ KTReactifyProps<{
444
+ async?: boolean;
445
+ crossorigin?: 'anonymous' | 'use-credentials' | '';
446
+ defer?: boolean;
447
+ integrity?: string;
448
+ nomodule?: boolean;
449
+ referrerpolicy?:
450
+ | 'no-referrer'
451
+ | 'no-referrer-when-downgrade'
452
+ | 'origin'
453
+ | 'origin-when-cross-origin'
454
+ | 'same-origin'
455
+ | 'strict-origin'
456
+ | 'strict-origin-when-cross-origin'
457
+ | 'unsafe-url';
458
+ src?: string;
459
+ type?: string;
460
+ }>;
461
+
462
+ // Select element
463
+ select: BaseAttr &
464
+ KTReactifyProps<{
465
+ autocomplete?: string;
466
+ disabled?: boolean;
467
+ form?: string;
468
+ multiple?: boolean;
469
+ name?: string;
470
+ required?: boolean;
471
+ size?: number | string;
472
+ }>;
473
+
474
+ // Slot element
475
+ slot: BaseAttr &
476
+ KTReactifyProps<{
477
+ name?: string;
478
+ }>;
479
+
480
+ // Source element
481
+ source: BaseAttr &
482
+ KTReactifyProps<{
483
+ height?: number | string;
484
+ media?: string;
485
+ sizes?: string;
486
+ src?: string;
487
+ srcset?: string;
488
+ type?: string;
489
+ width?: number | string;
490
+ }>;
491
+
492
+ // Style element
493
+ style: BaseAttr &
494
+ KTReactifyProps<{
495
+ media?: string;
496
+ }>;
497
+
498
+ // Table element
499
+ table: BaseAttr & KTReactifyProps<{}>;
500
+
501
+ // Table body/footer/header elements
502
+ tbody: BaseAttr & KTReactifyProps<{}>;
503
+
504
+ tfoot: BaseAttr & KTReactifyProps<{}>;
505
+
506
+ thead: BaseAttr & KTReactifyProps<{}>;
507
+
508
+ // Table cell elements
509
+ td: BaseAttr &
510
+ KTReactifyProps<{
511
+ colspan?: number | string;
512
+ headers?: string;
513
+ rowspan?: number | string;
514
+ }>;
515
+
516
+ th: BaseAttr &
517
+ KTReactifyProps<{
518
+ abbr?: string;
519
+ colspan?: number | string;
520
+ headers?: string;
521
+ rowspan?: number | string;
522
+ scope?: 'row' | 'col' | 'rowgroup' | 'colgroup';
523
+ }>;
524
+
525
+ // Template element
526
+ template: BaseAttr & KTReactifyProps<{}>;
527
+
528
+ // Textarea element
529
+ textarea: BaseAttr &
530
+ KTReactifyProps<{
531
+ autocomplete?: string;
532
+ cols?: number | string;
533
+ dirname?: string;
534
+ disabled?: boolean;
535
+ form?: string;
536
+ maxlength?: number | string;
537
+ minlength?: number | string;
538
+ name?: string;
539
+ placeholder?: string;
540
+ readonly?: boolean;
541
+ required?: boolean;
542
+ rows?: number | string;
543
+ wrap?: 'hard' | 'soft' | 'off';
544
+ }>;
545
+
546
+ // Time element
547
+ time: BaseAttr &
548
+ KTReactifyProps<{
549
+ datetime?: string;
550
+ }>;
551
+
552
+ // Title element
553
+ title: BaseAttr & KTReactifyProps<{}>;
554
+
555
+ // TR element
556
+ tr: BaseAttr & KTReactifyProps<{}>;
557
+
558
+ // Track element
559
+ track: BaseAttr &
560
+ KTReactifyProps<{
561
+ default?: boolean;
562
+ kind?: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
563
+ label?: string;
564
+ src?: string;
565
+ srclang?: string;
566
+ }>;
567
+
568
+ // UL element
569
+ ul: BaseAttr & KTReactifyProps<{}>;
570
+
571
+ // Video element
572
+ video: BaseAttr &
573
+ KTReactifyProps<{
574
+ autoplay?: boolean;
575
+ controls?: boolean;
576
+ crossorigin?: 'anonymous' | 'use-credentials' | '';
577
+ height?: number | string;
578
+ loop?: boolean;
579
+ muted?: boolean;
580
+ playsinline?: boolean;
581
+ poster?: string;
582
+ preload?: 'none' | 'metadata' | 'auto' | '';
583
+ src?: string;
584
+ width?: number | string;
585
+ }>;
586
+
587
+ // Generic HTMLElement (no specific attributes beyond BaseEvent)
588
+ abbr: BaseAttr & KTReactifyProps<{}>;
589
+ address: BaseAttr & KTReactifyProps<{}>;
590
+ article: BaseAttr & KTReactifyProps<{}>;
591
+ aside: BaseAttr & KTReactifyProps<{}>;
592
+ b: BaseAttr & KTReactifyProps<{}>;
593
+ bdi: BaseAttr & KTReactifyProps<{}>;
594
+ bdo: BaseAttr & KTReactifyProps<{}>;
595
+ cite: BaseAttr & KTReactifyProps<{}>;
596
+ code: BaseAttr & KTReactifyProps<{}>;
597
+ dd: BaseAttr & KTReactifyProps<{}>;
598
+ dfn: BaseAttr & KTReactifyProps<{}>;
599
+ div: BaseAttr & KTReactifyProps<{}>;
600
+ dl: BaseAttr & KTReactifyProps<{}>;
601
+ dt: BaseAttr & KTReactifyProps<{}>;
602
+ em: BaseAttr & KTReactifyProps<{}>;
603
+ figcaption: BaseAttr & KTReactifyProps<{}>;
604
+ figure: BaseAttr & KTReactifyProps<{}>;
605
+ footer: BaseAttr & KTReactifyProps<{}>;
606
+ h1: BaseAttr & KTReactifyProps<{}>;
607
+ h2: BaseAttr & KTReactifyProps<{}>;
608
+ h3: BaseAttr & KTReactifyProps<{}>;
609
+ h4: BaseAttr & KTReactifyProps<{}>;
610
+ h5: BaseAttr & KTReactifyProps<{}>;
611
+ h6: BaseAttr & KTReactifyProps<{}>;
612
+ header: BaseAttr & KTReactifyProps<{}>;
613
+ hgroup: BaseAttr & KTReactifyProps<{}>;
614
+ i: BaseAttr & KTReactifyProps<{}>;
615
+ kbd: BaseAttr & KTReactifyProps<{}>;
616
+ main: BaseAttr & KTReactifyProps<{}>;
617
+ mark: BaseAttr & KTReactifyProps<{}>;
618
+ nav: BaseAttr & KTReactifyProps<{}>;
619
+ noscript: BaseAttr & KTReactifyProps<{}>;
620
+ p: BaseAttr & KTReactifyProps<{}>;
621
+ rp: BaseAttr & KTReactifyProps<{}>;
622
+ rt: BaseAttr & KTReactifyProps<{}>;
623
+ ruby: BaseAttr & KTReactifyProps<{}>;
624
+ s: BaseAttr & KTReactifyProps<{}>;
625
+ samp: BaseAttr & KTReactifyProps<{}>;
626
+ search: BaseAttr & KTReactifyProps<{}>;
627
+ section: BaseAttr & KTReactifyProps<{}>;
628
+ small: BaseAttr & KTReactifyProps<{}>;
629
+ span: BaseAttr & KTReactifyProps<{}>;
630
+ strong: BaseAttr & KTReactifyProps<{}>;
631
+ sub: BaseAttr & KTReactifyProps<{}>;
632
+ summary: BaseAttr & KTReactifyProps<{}>;
633
+ sup: BaseAttr & KTReactifyProps<{}>;
634
+ u: BaseAttr & KTReactifyProps<{}>;
635
+ var: BaseAttr & KTReactifyProps<{}>;
636
+ wbr: BaseAttr & KTReactifyProps<{}>;
637
+
638
+ svg: BaseAttr & {
639
+ class?: string;
640
+ style?: string | Partial<CSSStyleDeclaration>;
641
+ width?: number | string;
642
+ height?: number | string;
643
+ viewBox?: string;
644
+ xmlns?: string;
645
+ fill?: string;
646
+ stroke?: string;
647
+ strokeWidth?: number | string;
648
+ strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';
649
+ strokeLinejoin?: 'miter' | 'round' | 'bevel' | 'inherit';
650
+ strokeDasharray?: string;
651
+ strokeDashoffset?: number | string;
652
+ opacity?: number | string;
653
+ preserveAspectRatio?: string;
654
+ transform?: string;
655
+ x?: number | string;
656
+ y?: number | string;
657
+ rx?: number | string;
658
+ ry?: number | string;
659
+ r?: number | string;
660
+ cx?: number | string;
661
+ cy?: number | string;
662
+ d?: string;
663
+ points?: string;
664
+ pathLength?: number | string;
665
+ viewbox?: string;
666
+ role?: string;
667
+ focusable?: boolean | 'true' | 'false';
668
+ xlinkHref?: string; // legacy xlink:href
669
+ };
670
+ }
671
+
672
+ interface SVGAttributesMap {
673
+ a: AttributesMap['svg'] & { href?: string; x?: number | string; y?: number | string };
674
+ animate: AttributesMap['svg'] & {
675
+ attributeName?: string;
676
+ from?: string | number;
677
+ to?: string | number;
678
+ dur?: string;
679
+ repeatCount?: string | number;
680
+ };
681
+ animateMotion: AttributesMap['svg'] & { path?: string; dur?: string; rotate?: string };
682
+ animateTransform: AttributesMap['svg'] & { type?: string; from?: string; to?: string; dur?: string };
683
+ circle: AttributesMap['svg'] & { cx?: number | string; cy?: number | string; r?: number | string };
684
+ clipPath: AttributesMap['svg'] & { clipPathUnits?: 'userSpaceOnUse' | 'objectBoundingBox' };
685
+ defs: AttributesMap['svg'];
686
+ desc: AttributesMap['svg'];
687
+ ellipse: AttributesMap['svg'] & {
688
+ cx?: number | string;
689
+ cy?: number | string;
690
+ rx?: number | string;
691
+ ry?: number | string;
692
+ };
693
+
694
+ // Filter primitives (provide common props)
695
+ feBlend: AttributesMap['svg'] & { in?: string; in2?: string; mode?: string };
696
+ feColorMatrix: AttributesMap['svg'] & {
697
+ type?: 'matrix' | 'saturate' | 'hueRotate' | 'luminanceToAlpha';
698
+ values?: string;
699
+ };
700
+ feComponentTransfer: AttributesMap['svg'] & {};
701
+ feComposite: AttributesMap['svg'] & {
702
+ in?: string;
703
+ in2?: string;
704
+ operator?: string;
705
+ k1?: number | string;
706
+ k2?: number | string;
707
+ k3?: number | string;
708
+ k4?: number | string;
709
+ };
710
+ feConvolveMatrix: AttributesMap['svg'] & {
711
+ order?: string | number;
712
+ kernelMatrix?: string;
713
+ divisor?: string | number;
714
+ bias?: string | number;
715
+ };
716
+ feDiffuseLighting: AttributesMap['svg'] & {};
717
+ feDisplacementMap: AttributesMap['svg'] & {
718
+ in?: string;
719
+ in2?: string;
720
+ scale?: number | string;
721
+ xChannelSelector?: string;
722
+ yChannelSelector?: string;
723
+ };
724
+ feDistantLight: AttributesMap['svg'] & { azimuth?: number | string; elevation?: number | string };
725
+ feDropShadow: AttributesMap['svg'] & {
726
+ dx?: number | string;
727
+ dy?: number | string;
728
+ stdDeviation?: number | string;
729
+ floodColor?: string;
730
+ floodOpacity?: number | string;
731
+ };
732
+ feFlood: AttributesMap['svg'] & { floodColor?: string; floodOpacity?: number | string };
733
+ feFuncA: AttributesMap['svg'] & {};
734
+ feFuncB: AttributesMap['svg'] & {};
735
+ feFuncG: AttributesMap['svg'] & {};
736
+ feFuncR: AttributesMap['svg'] & {};
737
+ feGaussianBlur: AttributesMap['svg'] & { stdDeviation?: number | string; edgeMode?: string };
738
+ feImage: AttributesMap['svg'] & { href?: string };
739
+ feMerge: AttributesMap['svg'] & {};
740
+ feMergeNode: AttributesMap['svg'] & { in?: string };
741
+ feMorphology: AttributesMap['svg'] & { operator?: 'erode' | 'dilate'; radius?: number | string };
742
+ feOffset: AttributesMap['svg'] & { dx?: number | string; dy?: number | string };
743
+ fePointLight: AttributesMap['svg'] & { x?: number | string; y?: number | string; z?: number | string };
744
+ feSpecularLighting: AttributesMap['svg'] & {
745
+ specularConstant?: number | string;
746
+ specularExponent?: number | string;
747
+ surfaceScale?: number | string;
748
+ };
749
+ feSpotLight: AttributesMap['svg'] & {
750
+ x?: number | string;
751
+ y?: number | string;
752
+ z?: number | string;
753
+ pointsAtX?: number | string;
754
+ pointsAtY?: number | string;
755
+ pointsAtZ?: number | string;
756
+ specularExponent?: number | string;
757
+ limitingConeAngle?: number | string;
758
+ };
759
+ feTile: AttributesMap['svg'] & {};
760
+ feTurbulence: AttributesMap['svg'] & {
761
+ baseFrequency?: number | string;
762
+ numOctaves?: number | string;
763
+ seed?: number | string;
764
+ stitchTiles?: string;
765
+ type?: 'fractalNoise' | 'turbulence';
766
+ };
767
+
768
+ filter: AttributesMap['svg'] & {
769
+ x?: number | string;
770
+ y?: number | string;
771
+ width?: number | string;
772
+ height?: number | string;
773
+ filterUnits?: string;
774
+ primitiveUnits?: string;
775
+ };
776
+ foreignObject: AttributesMap['svg'] & {
777
+ x?: number | string;
778
+ y?: number | string;
779
+ width?: number | string;
780
+ height?: number | string;
781
+ };
782
+ g: AttributesMap['svg'];
783
+ image: AttributesMap['svg'] & {
784
+ href?: string;
785
+ x?: number | string;
786
+ y?: number | string;
787
+ width?: number | string;
788
+ height?: number | string;
789
+ };
790
+ line: AttributesMap['svg'] & {
791
+ x1?: number | string;
792
+ y1?: number | string;
793
+ x2?: number | string;
794
+ y2?: number | string;
795
+ };
796
+ linearGradient: AttributesMap['svg'] & {
797
+ x1?: number | string;
798
+ y1?: number | string;
799
+ x2?: number | string;
800
+ y2?: number | string;
801
+ gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
802
+ gradientTransform?: string;
803
+ };
804
+ marker: AttributesMap['svg'] & {
805
+ markerUnits?: string;
806
+ markerWidth?: number | string;
807
+ markerHeight?: number | string;
808
+ refX?: number | string;
809
+ refY?: number | string;
810
+ orient?: string;
811
+ };
812
+ mask: AttributesMap['svg'] & {
813
+ maskUnits?: string;
814
+ maskContentUnits?: string;
815
+ x?: number | string;
816
+ y?: number | string;
817
+ width?: number | string;
818
+ height?: number | string;
819
+ };
820
+ metadata: AttributesMap['svg'];
821
+ mpath: AttributesMap['svg'] & { href?: string };
822
+ path: AttributesMap['svg'] & { d?: string; pathLength?: number | string };
823
+ pattern: AttributesMap['svg'] & {
824
+ patternUnits?: string;
825
+ patternContentUnits?: string;
826
+ width?: number | string;
827
+ height?: number | string;
828
+ x?: number | string;
829
+ y?: number | string;
830
+ };
831
+ polygon: AttributesMap['svg'] & { points?: string };
832
+ polyline: AttributesMap['svg'] & { points?: string };
833
+ radialGradient: AttributesMap['svg'] & {
834
+ cx?: number | string;
835
+ cy?: number | string;
836
+ r?: number | string;
837
+ fx?: number | string;
838
+ fy?: number | string;
839
+ gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
840
+ gradientTransform?: string;
841
+ };
842
+ rect: AttributesMap['svg'] & {
843
+ x?: number | string;
844
+ y?: number | string;
845
+ width?: number | string;
846
+ height?: number | string;
847
+ rx?: number | string;
848
+ ry?: number | string;
849
+ };
850
+ script: AttributesMap['svg'] & { href?: string; type?: string };
851
+ set: AttributesMap['svg'] & { attributeName?: string; to?: string | number; begin?: string; dur?: string };
852
+ stop: AttributesMap['svg'] & { offset?: number | string; stopColor?: string; stopOpacity?: number | string };
853
+ style: AttributesMap['svg'] & { media?: string };
854
+ svg: AttributesMap['svg'];
855
+ switch: AttributesMap['svg'];
856
+ symbol: AttributesMap['svg'] & { viewBox?: string; preserveAspectRatio?: string };
857
+ text: AttributesMap['svg'] & {
858
+ x?: number | string;
859
+ y?: number | string;
860
+ dx?: number | string;
861
+ dy?: number | string;
862
+ textLength?: number | string;
863
+ };
864
+ textPath: AttributesMap['svg'] & { href?: string; startOffset?: number | string };
865
+ title: AttributesMap['svg'];
866
+ tspan: AttributesMap['svg'] & {
867
+ x?: number | string;
868
+ y?: number | string;
869
+ dx?: number | string;
870
+ dy?: number | string;
871
+ };
872
+ use: AttributesMap['svg'] & {
873
+ href?: string;
874
+ x?: number | string;
875
+ y?: number | string;
876
+ width?: number | string;
877
+ height?: number | string;
878
+ };
879
+ view: AttributesMap['svg'] & { viewBox?: string; preserveAspectRatio?: string };
880
+ }
881
+
882
+ declare namespace JSX {
883
+ type Element = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
884
+
885
+ interface IntrinsicElements {
886
+ [k: string]: AttributesMap['div']; // Allow any element with div attributes as fallback
887
+
888
+ // Document-level & metadata
889
+ html: AttributesMap['html'];
890
+ head: AttributesMap['head'];
891
+ title: AttributesMap['title'];
892
+ base: AttributesMap['base'];
893
+ link: AttributesMap['link'];
894
+ meta: AttributesMap['meta'];
895
+
896
+ // Sectioning
897
+ body: AttributesMap['body'];
898
+ header: AttributesMap['header'];
899
+ footer: AttributesMap['footer'];
900
+ nav: AttributesMap['nav'];
901
+ main: AttributesMap['main'];
902
+ section: AttributesMap['section'];
903
+ article: AttributesMap['article'];
904
+ aside: AttributesMap['aside'];
905
+
906
+ // Headings
907
+ h1: AttributesMap['h1'];
908
+ h2: AttributesMap['h2'];
909
+ h3: AttributesMap['h3'];
910
+ h4: AttributesMap['h4'];
911
+ h5: AttributesMap['h5'];
912
+ h6: AttributesMap['h6'];
913
+
914
+ // Text content
915
+ p: AttributesMap['p'];
916
+ pre: AttributesMap['pre'];
917
+ code: AttributesMap['code'];
918
+ strong: AttributesMap['strong'];
919
+ small: AttributesMap['small'];
920
+ em: AttributesMap['em'];
921
+ br: AttributesMap['br'];
922
+ i: AttributesMap['i'];
923
+
924
+ // Lists
925
+ ul: AttributesMap['ul'];
926
+ ol: AttributesMap['ol'];
927
+ li: AttributesMap['li'];
928
+
929
+ // Tables
930
+ table: AttributesMap['table'];
931
+ thead: AttributesMap['thead'];
932
+ tbody: AttributesMap['tbody'];
933
+ tfoot: AttributesMap['tfoot'];
934
+ tr: AttributesMap['tr'];
935
+ th: AttributesMap['th'];
936
+ td: AttributesMap['td'];
937
+
938
+ // Forms
939
+ form: AttributesMap['form'];
940
+ label: AttributesMap['label'];
941
+ input: AttributesMap['input'];
942
+ textarea: AttributesMap['textarea'];
943
+ select: AttributesMap['select'];
944
+ option: AttributesMap['option'];
945
+ optgroup: AttributesMap['optgroup'];
946
+ button: AttributesMap['button'];
947
+ fieldset: AttributesMap['fieldset'];
948
+ legend: AttributesMap['legend'];
949
+ datalist: AttributesMap['datalist'];
950
+ output: AttributesMap['output'];
951
+
952
+ // Media & embedded
953
+ img: AttributesMap['img'];
954
+ picture: AttributesMap['picture'];
955
+ source: AttributesMap['source'];
956
+ audio: AttributesMap['audio'];
957
+ video: AttributesMap['video'];
958
+ track: AttributesMap['track'];
959
+ iframe: AttributesMap['iframe'];
960
+ embed: AttributesMap['embed'];
961
+ object: AttributesMap['object'];
962
+ canvas: AttributesMap['canvas'];
963
+
964
+ // Interactive & misc
965
+ a: AttributesMap['a'] & SVGAttributesMap['a'];
966
+ area: AttributesMap['area'];
967
+ map: AttributesMap['map'];
968
+ details: AttributesMap['details'];
969
+ dialog: AttributesMap['dialog'];
970
+ summary: AttributesMap['summary'];
971
+ slot: AttributesMap['slot'];
972
+
973
+ // Scripting & styles
974
+ script: AttributesMap['script'];
975
+ style: AttributesMap['style'];
976
+
977
+ // Semantic & phrasing
978
+ figure: AttributesMap['figure'];
979
+ figcaption: AttributesMap['figcaption'];
980
+ blockquote: AttributesMap['blockquote'];
981
+ q: AttributesMap['q'];
982
+
983
+ // Generic elements
984
+ div: AttributesMap['div'];
985
+ span: AttributesMap['span'];
986
+ address: AttributesMap['address'];
987
+ abbr: AttributesMap['abbr'];
988
+ b: AttributesMap['b'];
989
+ cite: AttributesMap['cite'];
990
+ dl: AttributesMap['dl'];
991
+ dt: AttributesMap['dt'];
992
+ dd: AttributesMap['dd'];
993
+ hr: AttributesMap['hr'];
994
+
995
+ // SVG
996
+ svg: AttributesMap['svg'];
997
+ // a: SVGAttributesMap['a'];
998
+ animate: SVGAttributesMap['animate'];
999
+ animateMotion: SVGAttributesMap['animateMotion'];
1000
+ animateTransform: SVGAttributesMap['animateTransform'];
1001
+ circle: SVGAttributesMap['circle'];
1002
+ clipPath: SVGAttributesMap['clipPath'];
1003
+ defs: SVGAttributesMap['defs'];
1004
+ desc: SVGAttributesMap['desc'];
1005
+ ellipse: SVGAttributesMap['ellipse'];
1006
+ feBlend: SVGAttributesMap['feBlend'];
1007
+ feColorMatrix: SVGAttributesMap['feColorMatrix'];
1008
+ feComponentTransfer: SVGAttributesMap['feComponentTransfer'];
1009
+ feComposite: SVGAttributesMap['feComposite'];
1010
+ feConvolveMatrix: SVGAttributesMap['feConvolveMatrix'];
1011
+ feDiffuseLighting: SVGAttributesMap['feDiffuseLighting'];
1012
+ feDisplacementMap: SVGAttributesMap['feDisplacementMap'];
1013
+ feDistantLight: SVGAttributesMap['feDistantLight'];
1014
+ feDropShadow: SVGAttributesMap['feDropShadow'];
1015
+ feFlood: SVGAttributesMap['feFlood'];
1016
+ feFuncA: SVGAttributesMap['feFuncA'];
1017
+ feFuncB: SVGAttributesMap['feFuncB'];
1018
+ feFuncG: SVGAttributesMap['feFuncG'];
1019
+ feFuncR: SVGAttributesMap['feFuncR'];
1020
+ feGaussianBlur: SVGAttributesMap['feGaussianBlur'];
1021
+ feImage: SVGAttributesMap['feImage'];
1022
+ feMerge: SVGAttributesMap['feMerge'];
1023
+ feMergeNode: SVGAttributesMap['feMergeNode'];
1024
+ feMorphology: SVGAttributesMap['feMorphology'];
1025
+ feOffset: SVGAttributesMap['feOffset'];
1026
+ fePointLight: SVGAttributesMap['fePointLight'];
1027
+ feSpecularLighting: SVGAttributesMap['feSpecularLighting'];
1028
+ feSpotLight: SVGAttributesMap['feSpotLight'];
1029
+ feTile: SVGAttributesMap['feTile'];
1030
+ feTurbulence: SVGAttributesMap['feTurbulence'];
1031
+ filter: SVGAttributesMap['filter'];
1032
+ foreignObject: SVGAttributesMap['foreignObject'];
1033
+ g: SVGAttributesMap['g'];
1034
+ image: SVGAttributesMap['image'];
1035
+ line: SVGAttributesMap['line'];
1036
+ linearGradient: SVGAttributesMap['linearGradient'];
1037
+ marker: SVGAttributesMap['marker'];
1038
+ mask: SVGAttributesMap['mask'];
1039
+ metadata: SVGAttributesMap['metadata'];
1040
+ mpath: SVGAttributesMap['mpath'];
1041
+ path: SVGAttributesMap['path'];
1042
+ pattern: SVGAttributesMap['pattern'];
1043
+ polygon: SVGAttributesMap['polygon'];
1044
+ polyline: SVGAttributesMap['polyline'];
1045
+ radialGradient: SVGAttributesMap['radialGradient'];
1046
+ rect: SVGAttributesMap['rect'];
1047
+ set: SVGAttributesMap['set'];
1048
+ stop: SVGAttributesMap['stop'];
1049
+ switch: SVGAttributesMap['switch'];
1050
+ symbol: SVGAttributesMap['symbol'];
1051
+ text: SVGAttributesMap['text'];
1052
+ textPath: SVGAttributesMap['textPath'];
1053
+ tspan: SVGAttributesMap['tspan'];
1054
+ use: SVGAttributesMap['use'];
1055
+ view: SVGAttributesMap['view'];
1056
+ }
1057
+
1058
+ interface IntrinsicAttributes {
1059
+ /**
1060
+ * Make a reference to the created element
1061
+ */
1062
+ ref?: KTRef<any>;
1063
+
1064
+ /**
1065
+ * Conditional rendering
1066
+ * - Provide a `KTRef` to make it reactive
1067
+ */
1068
+ 'k-if'?: any;
1069
+
1070
+ /**
1071
+ * 2-way binding
1072
+ * - Provide a `KTRef` to make it reactive
1073
+ */
1074
+ 'k-model'?: KTRef<any>;
1075
+
1076
+ /**
1077
+ * Raw html binding
1078
+ * - Provide a `KTRef` to make it reactive
1079
+ */
1080
+ 'k-html'?: any;
1081
+ children?: KTRawContent;
1082
+ }
1083
+
1084
+ interface ElementChildrenAttribute {
1085
+ children: {};
1086
+ }
1087
+ }
1088
+
1089
+ declare class KTComputed<T> implements KTReactive<T> {
1090
+ /**
1091
+ * Indicates that this is a KTRef instance
1092
+ */
1093
+ isKT: true;
1094
+ ktType: KTReactiveType;
1095
+ constructor(_calculator: () => T, reactives: Array<KTReactive<unknown>>);
1096
+ /**
1097
+ * If new value and old value are both nodes, the old one will be replaced in the DOM
1098
+ */
1099
+ get value(): T;
1100
+ set value(_newValue: T);
1101
+ /**
1102
+ * Force listeners to run once with the latest computed result.
1103
+ */
1104
+ notify(): void;
1105
+ /**
1106
+ * Computed values are derived from dependencies and should not be mutated manually.
1107
+ */
1108
+ mutate<R = void>(): R;
1109
+ /**
1110
+ * Register a callback when the value changes
1111
+ * @param callback (newValue, oldValue) => xxx
1112
+ */
1113
+ addOnChange(callback: ReactiveChangeHandler<T>): void;
1114
+ /**
1115
+ * Unregister a callback
1116
+ * @param callback (newValue, oldValue) => xxx
1117
+ */
1118
+ removeOnChange(callback: ReactiveChangeHandler<T>): boolean;
1119
+ }
1120
+ /**
1121
+ * Create a reactive computed value
1122
+ * @param computeFn
1123
+ * @param reactives refs and computeds that this computed depends on
1124
+ */
1125
+ declare function computed<T = JSX.Element>(computeFn: () => T, reactives: Array<KTReactive<any>>): KTComputed<T>;
1126
+
1127
+ interface KTEffectOptions {
1128
+ lazy: boolean;
1129
+ onCleanup: () => void;
1130
+ debugName: string;
1131
+ }
1132
+ /**
1133
+ * Register a reactive effect with options.
1134
+ * @param effectFn The effect function to run when dependencies change
1135
+ * @param reactives The reactive dependencies
1136
+ * @param options Effect options: lazy, onCleanup, debugName
1137
+ * @returns stop function to remove all listeners
1138
+ */
1139
+ declare function effect(effectFn: () => void, reactives: Array<KTReactive<any>>, options?: Partial<KTEffectOptions>): () => void;
1140
+
1141
+ declare const toReactive: <T>(value: T | KTReactive<T>, onChange?: ReactiveChangeHandler<T>) => KTReactive<T>;
1142
+ /**
1143
+ * Extracts the value from a KTReactive, or returns the value directly if it's not reactive.
1144
+ */
1145
+ declare function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T;
1146
+
1147
+ declare const enum KTReactiveType {
1148
+ REF = 1,
1149
+ COMPUTED = 2
1150
+ }
1151
+ declare const isKT: <T = any>(obj: any) => obj is KTReactive<T>;
1152
+ declare const isRef: <T = any>(obj: any) => obj is KTRef<T>;
1153
+ declare const isComputed: <T = any>(obj: any) => obj is KTComputed<T>;
1154
+
1155
+ type ReactiveChangeHandler<T> = (newValue: T, oldValue: T) => void;
1156
+
1157
+ declare class KTReactive<T> {
1158
+ /**
1159
+ * Indicates that this is a KTRef instance
1160
+ */
1161
+ isKT: boolean;
1162
+
1163
+ ktType: KTReactiveType;
1164
+
1165
+ /**
1166
+ * If new value and old value are both nodes, the old one will be replaced in the DOM
1167
+ */
1168
+ get value();
1169
+ set value(newValue: T);
1170
+
1171
+ /**
1172
+ * Force all listeners to run even when reference identity has not changed.
1173
+ * Useful for in-place array/object mutations.
1174
+ */
1175
+ notify(): void;
1176
+
1177
+ /**
1178
+ * Mutate current value in-place and notify listeners once.
1179
+ *
1180
+ * @example
1181
+ * const items = ref<number[]>([1, 2]);
1182
+ * items.mutate((list) => list.push(3));
1183
+ */
1184
+ mutate<R = void>(mutator: (currentValue: T) => R): R;
1185
+
1186
+ /**
1187
+ * Register a callback when the value changes
1188
+ * - Value setter will check `Object.is(newValue, oldValue)`.
1189
+ * @param callback (newValue, oldValue) => xxx
1190
+ */
1191
+ addOnChange(callback: ReactiveChangeHandler<T>): void;
1192
+ removeOnChange(callback: ReactiveChangeHandler<T>): void;
1193
+ }
1194
+
1195
+ // & Shockingly, If T is boolean, KTReactify<T> becomes KTReactive<true> | KTReactive<false>. It causes @ktjs/mui that disabledRefs not assignable.
1196
+ type KTReactify<T> = T extends boolean ? KTReactive<boolean> : T extends any ? KTReactive<T> : never;
1197
+
1198
+ type KTReactifyObject<T extends object> = {
1199
+ [K in keyof T]: KTReactify<T[K]>;
1200
+ };
1201
+
1202
+ type KTReactifyProps<T extends object> = {
1203
+ [K in keyof T]: KTReactify<Exclude<T[K], undefined>> | T[K];
1204
+ };
1205
+
1206
+ declare class KTRef<T> implements KTReactive<T> {
1207
+ /**
1208
+ * Indicates that this is a KTRef instance
1209
+ */
1210
+ isKT: true;
1211
+ ktType: KTReactiveType;
1212
+ constructor(_value: T, _onChanges: Array<ReactiveChangeHandler<T>>);
1213
+ /**
1214
+ * If new value and old value are both nodes, the old one will be replaced in the DOM
1215
+ */
1216
+ get value(): T;
1217
+ set value(newValue: T);
1218
+ /**
1219
+ * Force all listeners to run even when reference identity has not changed.
1220
+ * Useful for in-place array/object mutations.
1221
+ */
1222
+ notify(): void;
1223
+ /**
1224
+ * Mutate current value in-place and notify listeners once.
1225
+ *
1226
+ * @example
1227
+ * const items = ref<number[]>([1, 2]);
1228
+ * items.mutate((list) => list.push(3));
1229
+ */
1230
+ mutate<R = void>(mutator: (currentValue: T) => R): R;
1231
+ /**
1232
+ * Register a callback when the value changes
1233
+ * @param callback (newValue, oldValue) => xxx
1234
+ */
1235
+ addOnChange(callback: ReactiveChangeHandler<T>): void;
1236
+ removeOnChange(callback: ReactiveChangeHandler<T>): boolean;
1237
+ }
1238
+ /**
1239
+ * Reference to the created HTML element.
1240
+ * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.
1241
+ * - can alse be used to store normal values, but it is not reactive.
1242
+ * - if the value is already a `KTRef`, it will be returned **directly**.
1243
+ * @param value mostly an HTMLElement
1244
+ */
1245
+ declare function ref<T = JSX.Element>(value?: T, onChange?: ReactiveChangeHandler<T>): KTRef<T>;
1246
+ /**
1247
+ * Convert a value to `KTRef`.
1248
+ * - Returns the original value if it is already a `KTRef`.
1249
+ * - Throws error if the value is a `KTComputed`.
1250
+ * - Otherwise wraps the value with `ref()`.
1251
+ * @param o value to convert
1252
+ */
1253
+ declare const toRef: <T = any>(o: any) => KTRef<T>;
1254
+ type KTSurfaceRef<T extends object> = {
1255
+ [K in keyof T]: KTRef<T[K]>;
1256
+ } & {
1257
+ /**
1258
+ * Get the dereferenced object like the original one
1259
+ */
1260
+ kcollect: () => T;
1261
+ };
1262
+ /**
1263
+ * Make all first-level properties of the object a `KTRef`.
1264
+ * - `obj.a.b` is not reactive
1265
+ */
1266
+ declare const surfaceRef: <T extends object>(obj: T) => KTSurfaceRef<T>;
1267
+ /**
1268
+ * Assert k-model to be a ref object
1269
+ */
1270
+ declare const $modelOrRef: <T = any>(props: any, defaultValue?: T) => KTRef<T>;
1271
+ type RefSetter<T> = (props: {
1272
+ ref?: KTRef<T>;
1273
+ }, node: T) => void;
1274
+ /**
1275
+ * Whether `props.ref` is a `KTRef` only needs to be checked in the initial render
1276
+ */
1277
+ declare const $initRef: <T extends Node>(props: {
1278
+ ref?: KTRef<T>;
1279
+ }, node: T) => RefSetter<T>;
1280
+
1281
+ type HTML<T extends (HTMLTag | SVGTag | MathMLTag) & otherstring> = T extends SVGTag
1282
+ ? SVGElementTagNameMap[T]
1283
+ : T extends HTMLTag
1284
+ ? HTMLElementTagNameMap[T]
1285
+ : T extends MathMLTag
1286
+ ? MathMLElementTagNameMap[T]
1287
+ : HTMLElement;
1288
+
1289
+ type SingleContent = KTRef<any> | HTMLElement | Element | Node | string | number | boolean | null | undefined;
1290
+ type KTAvailableContent = SingleContent | KTAvailableContent[];
1291
+ type KTRawContent = KTAvailableContent | Promise<KTAvailableContent>;
1292
+ type KTRawAttr = KTAttribute | null | undefined | '' | false;
1293
+ type KTRawContents = KTAvailableContent;
1294
+
1295
+ /**
1296
+ * Event handler type for DOM events
1297
+ */
1298
+ type EventHandler<T extends Event = Event> = (this: HTMLElement, ev: T) => any;
1299
+
1300
+ /**
1301
+ * Used to create enhanced HTML elements
1302
+ */
1303
+ interface KTBaseAttribute {
1304
+ [k: string]: any;
1305
+
1306
+ // # kt-specific attributes
1307
+ ref?: KTRef<JSX.Element>;
1308
+
1309
+ /**
1310
+ * If a `KTRef` is bound, it will be reactive; otherwise, it will be static.
1311
+ */
1312
+ 'k-if'?: any;
1313
+
1314
+ /**
1315
+ * Register two-way data binding between an input element and a KTRef.
1316
+ * - Default to regist `input` event and `value` property(`checked` for checkboxes and radios).
1317
+ */
1318
+ 'k-model'?: KTRef<any>;
1319
+
1320
+ /**
1321
+ * Directly apply html string to `innerHTML`.
1322
+ * - Would be reactive if `KTRef` instance is provided
1323
+ */
1324
+ 'k-html'?: any;
1325
+
1326
+ // # normal HTML attributes
1327
+ id?: string;
1328
+ class?: string;
1329
+ className?: string;
1330
+ style?: string | Partial<CSSStyleDeclaration>;
1331
+
1332
+ type?:
1333
+ | 'text'
1334
+ | 'password'
1335
+ | 'email'
1336
+ | 'number'
1337
+ | 'tel'
1338
+ | 'url'
1339
+ | 'search'
1340
+ | 'date'
1341
+ | 'datetime-local'
1342
+ | 'time'
1343
+ | 'month'
1344
+ | 'week'
1345
+ | 'color'
1346
+ | 'range'
1347
+ | 'file'
1348
+ | 'checkbox'
1349
+ | 'radio'
1350
+ | 'hidden'
1351
+ | 'submit'
1352
+ | 'reset'
1353
+ | 'button'
1354
+ | 'image'
1355
+ | otherstring;
1356
+ for?: string;
1357
+
1358
+ name?: string;
1359
+ title?: string;
1360
+ placeholder?: string;
1361
+ contenteditable?: boolean;
1362
+ value?: any;
1363
+ valueAsDate?: Date;
1364
+ valueAsNumber?: number;
1365
+ label?: string;
1366
+ disabled?: boolean;
1367
+
1368
+ min?: string | number;
1369
+ max?: string | number;
1370
+ step?: string | number;
1371
+
1372
+ selected?: boolean;
1373
+ checked?: boolean;
1374
+
1375
+ action?: string;
1376
+ method?: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE' | otherstring;
1377
+ }
1378
+
1379
+ type KTPrefixedEventAttribute = {
1380
+ [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
1381
+ };
1382
+
1383
+ type KTAttribute = KTBaseAttribute & KTPrefixedEventAttribute;
1384
+
1385
+ type KTComponent = (
1386
+ props: {
1387
+ ref?: KTRef<JSX.Element>;
1388
+ children?: KTRawContent;
1389
+ } & KTAttribute &
1390
+ any,
1391
+ ) => JSX.Element | Promise<JSX.Element> | any;
1392
+
1393
+ /**
1394
+ * Create an enhanced HTMLElement.
1395
+ * - Only supports HTMLElements, **NOT** SVGElements or other Elements.
1396
+ * @param tag tag of an `HTMLElement`
1397
+ * @param attr attribute object or className
1398
+ * @param content a string or an array of HTMLEnhancedElement as child nodes
1399
+ *
1400
+ * __PKG_INFO__
1401
+ */
1402
+ declare const h: <T extends HTMLTag | SVGTag | MathMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>;
1403
+
1404
+ /**
1405
+ * @param tag html tag or function component
1406
+ * @param props properties/attributes
1407
+ */
1408
+ declare function jsx(tag: JSXTag, props: KTAttribute): JSX.Element;
1409
+ /**
1410
+ * Fragment support - returns an array of children
1411
+ * Enhanced Fragment component that manages arrays of elements
1412
+ */
1413
+ declare function Fragment(props: {
1414
+ children?: KTRawContent;
1415
+ }): JSX.Element;
1416
+ /**
1417
+ * JSX Development runtime - same as jsx but with additional dev checks
1418
+ */
1419
+ declare const jsxDEV: typeof jsx;
1420
+ /**
1421
+ * JSX runtime for React 17+ automatic runtime
1422
+ * This is called when using jsx: "react-jsx" or "react-jsxdev"
1423
+ */
1424
+ declare const jsxs: typeof jsx;
1425
+
1426
+ /**
1427
+ * A helper to create redrawable elements
1428
+ * ```tsx
1429
+ * export function MyComponent() {
1430
+ * let aa = 10;
1431
+ * // ...
1432
+ * // aa might be changed
1433
+ * return createRedrawable(() => <div>{aa}</div>);
1434
+ * }
1435
+ * ```
1436
+ * Then the returned element has a `redraw` method to redraw itself with new values.
1437
+ * @param creator a simple creator function that returns an element
1438
+ * @returns created element's ref
1439
+ */
1440
+ declare function createRedrawable<T>(creator: () => T): KTRef<T> & {
1441
+ redraw: () => T;
1442
+ };
1443
+
1444
+ /**
1445
+ * Extract component props type (excluding ref and children)
1446
+ */
1447
+ type ExtractComponentProps<T> = T extends (props: infer P) => any ? Omit<P, 'ref' | 'children'> : {};
1448
+ declare function KTAsync<T extends KTComponent>(props: {
1449
+ ref?: KTRef<JSX.Element>;
1450
+ skeleton?: JSX.Element;
1451
+ component: T;
1452
+ children?: KTRawContent;
1453
+ } & ExtractComponentProps<T>): JSX.Element;
1454
+
1455
+ type KTForElement = JSX.Element;
1456
+ interface KTForProps<T> {
1457
+ ref?: KTRef<KTForElement>;
1458
+ list: T[] | KTReactive<T[]>;
1459
+ key?: (item: T, index: number, array: T[]) => any;
1460
+ map: (item: T, index: number, array: T[]) => HTMLElement;
1461
+ }
1462
+ /**
1463
+ * KTFor - List rendering component with key-based optimization
1464
+ * Returns a Comment anchor node with rendered elements in __kt_for_list__
1465
+ */
1466
+ declare function KTFor<T>(props: KTForProps<T>): KTForElement;
1467
+
1468
+ export { $initRef, $modelOrRef, Fragment, JSX, KTAsync, KTComputed, KTFor, KTReactive, KTReactiveType, KTRef, computed, h as createElement, createRedrawable, dereactive, effect, h, isComputed, isKT, isRef, jsx, jsxDEV, jsxs, ref, surfaceRef, toReactive, toRef };
1469
+ export type { EventHandler, KTAttribute, KTForElement, KTForProps, KTPrefixedEventAttribute, KTRawAttr, KTRawContent, KTRawContents, KTReactify, KTReactifyObject, KTReactifyProps, KTSurfaceRef, ReactiveChangeHandler };