@ktjs/core 0.29.9 → 0.29.12

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,428 +1,1484 @@
1
- import { HTMLTag } from '@ktjs/shared';
2
- import { InputElementTag } from '@ktjs/shared';
3
- import { JSXTag } from '@ktjs/shared';
4
- import { MathMLTag } from '@ktjs/shared';
5
- import { otherstring } from '@ktjs/shared';
6
- import { SVGTag } from '@ktjs/shared';
7
-
8
- /**
9
- * Whether `props.ref` is a `KTRef` only needs to be checked in the initial render
10
- */
11
- export declare const $initRef: <T extends Node>(props: {
12
- ref?: KTRef<T>;
13
- }, node: T) => RefSetter<T>;
14
-
15
- /**
16
- * Assert k-model to be a ref object
17
- */
18
- export declare const $modelOrRef: <T = any>(props: any, defaultValue?: T) => KTRef<T>;
19
-
20
- /**
21
- * Create a reactive computed value
22
- * @param computeFn
23
- * @param reactives refs and computeds that this computed depends on
24
- */
25
- export declare function computed<T = JSX.Element>(computeFn: () => T, reactives: Array<KTReactive<any>>): KTComputed<T>;
26
-
27
- /**
28
- * A helper to create redrawable elements
29
- * ```tsx
30
- * export function MyComponent() {
31
- * let aa = 10;
32
- * // ...
33
- * // aa might be changed
34
- * return createRedrawable(() => <div>{aa}</div>);
35
- * }
36
- * ```
37
- * Then the returned element has a `redraw` method to redraw itself with new values.
38
- * @param creator a simple creator function that returns an element
39
- * @returns created element's ref
40
- */
41
- export declare function createRedrawable<T>(creator: () => T): KTRef<T> & {
42
- redraw: () => T;
43
- };
44
-
45
- /**
46
- * Extracts the value from a KTReactive, or returns the value directly if it's not reactive.
47
- */
48
- export declare function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T;
49
-
50
- /**
51
- * Register a reactive effect with options.
52
- * @param effectFn The effect function to run when dependencies change
53
- * @param reactives The reactive dependencies
54
- * @param options Effect options: lazy, onCleanup, debugName
55
- * @returns stop function to remove all listeners
56
- */
57
- export declare function effect(effectFn: () => void, reactives: Array<KTReactive<any>>, options?: Partial<KTEffectOptions>): () => void;
58
-
59
- /**
60
- * Event handler type for DOM events
61
- */
62
- export declare type EventHandler<T extends Event = Event> = (this: HTMLElement, ev: T) => any;
63
-
64
- /**
65
- * Extract component props type (excluding ref and children)
66
- */
67
- declare type ExtractComponentProps<T> = T extends (props: infer P) => any ? Omit<P, 'ref' | 'children'> : {};
68
-
69
- /**
70
- * Fragment support - returns an array of children
71
- * Enhanced Fragment component that manages arrays of elements
72
- */
73
- export declare function Fragment(props: {
74
- children?: KTRawContent;
75
- }): JSX.Element;
76
-
77
- /**
78
- * Create an enhanced HTMLElement.
79
- * - Only supports HTMLElements, **NOT** SVGElements or other Elements.
80
- * @param tag tag of an `HTMLElement`
81
- * @param attr attribute object or className
82
- * @param content a string or an array of HTMLEnhancedElement as child nodes
83
- *
84
- * __PKG_INFO__
85
- */
86
- declare const h: <T extends HTMLTag | SVGTag | MathMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>;
87
- export { h as createElement }
88
- export { h }
89
-
90
- declare type HTML<T extends (HTMLTag | SVGTag | MathMLTag) & otherstring> = T extends SVGTag
91
- ? SVGElementTagNameMap[T]
92
- : T extends HTMLTag
93
- ? HTMLElementTagNameMap[T]
94
- : T extends MathMLTag
95
- ? MathMLElementTagNameMap[T]
96
- : HTMLElement;
97
-
98
- export { HTMLTag }
99
-
100
- export { InputElementTag }
101
-
102
- export declare const isComputed: <T = any>(obj: any) => obj is KTComputed<T>;
103
-
104
- export declare const isKT: <T = any>(obj: any) => obj is KTReactive<T>;
105
-
106
- export declare const isRef: <T = any>(obj: any) => obj is KTRef<T>;
107
-
108
- /**
109
- * @param tag html tag or function component
110
- * @param props properties/attributes
111
- */
112
- export declare function jsx(tag: JSXTag, props: KTAttribute): JSX.Element;
113
-
114
- /**
115
- * JSX Development runtime - same as jsx but with additional dev checks
116
- */
117
- export declare const jsxDEV: typeof jsx;
118
-
119
- /**
120
- * JSX runtime for React 17+ automatic runtime
121
- * This is called when using jsx: "react-jsx" or "react-jsxdev"
122
- */
123
- export declare const jsxs: typeof jsx;
124
-
125
- export declare function KTAsync<T extends KTComponent>(props: {
126
- ref?: KTRef<JSX.Element>;
127
- skeleton?: JSX.Element;
128
- component: T;
129
- children?: KTRawContent;
130
- } & ExtractComponentProps<T>): JSX.Element;
131
-
132
- export declare type KTAttribute = KTBaseAttribute & KTPrefixedEventAttribute;
133
-
134
- declare type KTAvailableContent = SingleContent | KTAvailableContent[];
135
-
136
- /**
137
- * Used to create enhanced HTML elements
138
- */
139
- declare interface KTBaseAttribute {
140
- [k: string]: any;
141
-
142
- // # kt-specific attributes
143
- ref?: KTRef<JSX.Element>;
144
-
145
- /**
146
- * If a `KTRef` is bound, it will be reactive; otherwise, it will be static.
147
- */
148
- 'k-if'?: any;
149
-
150
- /**
151
- * Register two-way data binding between an input element and a KTRef.
152
- * - Default to regist `input` event and `value` property(`checked` for checkboxes and radios).
153
- */
154
- 'k-model'?: KTRef<any>;
155
-
156
- /**
157
- * Directly apply html string to `innerHTML`.
158
- * - Would be reactive if `KTRef` instance is provided
159
- */
160
- 'k-html'?: any;
161
-
162
- // # normal HTML attributes
163
- id?: string;
164
- class?: string;
165
- className?: string;
166
- style?: string | Partial<CSSStyleDeclaration>;
167
-
168
- type?:
169
- | 'text'
170
- | 'password'
171
- | 'email'
172
- | 'number'
173
- | 'tel'
174
- | 'url'
175
- | 'search'
176
- | 'date'
177
- | 'datetime-local'
178
- | 'time'
179
- | 'month'
180
- | 'week'
181
- | 'color'
182
- | 'range'
183
- | 'file'
184
- | 'checkbox'
185
- | 'radio'
186
- | 'hidden'
187
- | 'submit'
188
- | 'reset'
189
- | 'button'
190
- | 'image'
191
- | otherstring;
192
- for?: string;
193
-
194
- name?: string;
195
- title?: string;
196
- placeholder?: string;
197
- contenteditable?: boolean;
198
- value?: any;
199
- valueAsDate?: Date;
200
- valueAsNumber?: number;
201
- label?: string;
202
- disabled?: boolean;
203
-
204
- min?: string | number;
205
- max?: string | number;
206
- step?: string | number;
207
-
208
- selected?: boolean;
209
- checked?: boolean;
210
-
211
- action?: string;
212
- method?: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE' | otherstring;
213
- }
214
-
215
- declare type KTComponent = (
216
- props: {
217
- ref?: KTRef<JSX.Element>;
218
- children?: KTRawContent;
219
- } & KTAttribute &
220
- any,
221
- ) => JSX.Element | Promise<JSX.Element> | any;
222
-
223
- export declare class KTComputed<T> implements KTReactive<T> {
224
- /**
225
- * Indicates that this is a KTRef instance
226
- */
227
- isKT: true;
228
- ktType: KTReactiveType;
229
- /* Excluded from this release type: _calculator */
230
- /* Excluded from this release type: _value */
231
- /* Excluded from this release type: _onChanges */
232
- /* Excluded from this release type: _emit */
233
- /* Excluded from this release type: _recalculate */
234
- /* Excluded from this release type: _subscribe */
235
- constructor(_calculator: () => T, reactives: Array<KTReactive<unknown>>);
236
- /**
237
- * If new value and old value are both nodes, the old one will be replaced in the DOM
238
- */
239
- get value(): T;
240
- set value(_newValue: T);
241
- /**
242
- * Force listeners to run once with the latest computed result.
243
- */
244
- notify(): void;
245
- /**
246
- * Computed values are derived from dependencies and should not be mutated manually.
247
- */
248
- mutate<R = void>(): R;
249
- /**
250
- * Register a callback when the value changes
251
- * @param callback (newValue, oldValue) => xxx
252
- */
253
- addOnChange(callback: ReactiveChangeHandler<T>): void;
254
- /**
255
- * Unregister a callback
256
- * @param callback (newValue, oldValue) => xxx
257
- */
258
- removeOnChange(callback: ReactiveChangeHandler<T>): boolean;
259
- }
260
-
261
- declare interface KTEffectOptions {
262
- lazy: boolean;
263
- onCleanup: () => void;
264
- debugName: string;
265
- }
266
-
267
- /**
268
- * KTFor - List rendering component with key-based optimization
269
- * Returns a Comment anchor node with rendered elements in __kt_for_list__
270
- */
271
- export declare function KTFor<T>(props: KTForProps<T>): KTForElement;
272
-
273
- export declare type KTForElement = JSX.Element;
274
-
275
- export declare interface KTForProps<T> {
276
- ref?: KTRef<KTForElement>;
277
- list: T[] | KTReactive<T[]>;
278
- key?: (item: T, index: number, array: T[]) => any;
279
- map: (item: T, index: number, array: T[]) => HTMLElement;
280
- }
281
-
282
- export declare type KTPrefixedEventAttribute = {
283
- [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
284
- };
285
-
286
- export declare type KTRawAttr = KTAttribute | null | undefined | '' | false;
287
-
288
- export declare type KTRawContent = KTAvailableContent | Promise<KTAvailableContent>;
289
-
290
- export declare type KTRawContents = KTAvailableContent;
291
-
292
- export declare type KTReactify<T> = T extends boolean ? KTReactive<boolean> : T extends any ? KTReactive<T> : never;
293
-
294
- export declare type KTReactifyObject<T extends object> = {
295
- [K in keyof T]: KTReactify<T[K]>;
296
- };
297
-
298
- export declare type KTReactifyProps<T extends object> = {
299
- [K in keyof T]: KTReactify<Exclude<T[K], undefined>> | T[K];
300
- };
301
-
302
- export declare class KTReactive<T> {
303
- /**
304
- * Indicates that this is a KTRef instance
305
- */
306
- isKT: boolean;
307
-
308
- ktType: KTReactiveType;
309
-
310
- /**
311
- * If new value and old value are both nodes, the old one will be replaced in the DOM
312
- */
313
- get value();
314
- set value(newValue: T);
315
-
316
- /**
317
- * Force all listeners to run even when reference identity has not changed.
318
- * Useful for in-place array/object mutations.
319
- */
320
- notify(): void;
321
-
322
- /**
323
- * Mutate current value in-place and notify listeners once.
324
- *
325
- * @example
326
- * const items = ref<number[]>([1, 2]);
327
- * items.mutate((list) => list.push(3));
328
- */
329
- mutate<R = void>(mutator: (currentValue: T) => R): R;
330
-
331
- /**
332
- * Register a callback when the value changes
333
- * - Value setter will check `Object.is(newValue, oldValue)`.
334
- * @param callback (newValue, oldValue) => xxx
335
- */
336
- addOnChange(callback: ReactiveChangeHandler<T>): void;
337
- removeOnChange(callback: ReactiveChangeHandler<T>): void;
338
- }
339
-
340
- export declare const enum KTReactiveType {
341
- REF = 1,
342
- COMPUTED = 2
343
- }
344
-
345
- export declare class KTRef<T> implements KTReactive<T> {
346
- /**
347
- * Indicates that this is a KTRef instance
348
- */
349
- isKT: true;
350
- ktType: KTReactiveType;
351
- /* Excluded from this release type: _value */
352
- /* Excluded from this release type: _onChanges */
353
- /* Excluded from this release type: _emit */
354
- constructor(_value: T, _onChanges: Array<ReactiveChangeHandler<T>>);
355
- /**
356
- * If new value and old value are both nodes, the old one will be replaced in the DOM
357
- */
358
- get value(): T;
359
- set value(newValue: T);
360
- /**
361
- * Force all listeners to run even when reference identity has not changed.
362
- * Useful for in-place array/object mutations.
363
- */
364
- notify(): void;
365
- /**
366
- * Mutate current value in-place and notify listeners once.
367
- *
368
- * @example
369
- * const items = ref<number[]>([1, 2]);
370
- * items.mutate((list) => list.push(3));
371
- */
372
- mutate<R = void>(mutator: (currentValue: T) => R): R;
373
- /**
374
- * Register a callback when the value changes
375
- * @param callback (newValue, oldValue) => xxx
376
- */
377
- addOnChange(callback: ReactiveChangeHandler<T>): void;
378
- removeOnChange(callback: ReactiveChangeHandler<T>): boolean;
379
- }
380
-
381
- export declare type KTSurfaceRef<T extends object> = {
382
- [K in keyof T]: KTRef<T[K]>;
383
- } & {
384
- /**
385
- * Get the dereferenced object like the original one
386
- */
387
- kcollect: () => T;
388
- };
389
-
390
- export { MathMLTag }
391
-
392
- export declare type ReactiveChangeHandler<T> = (newValue: T, oldValue: T) => void;
393
-
394
- /**
395
- * Reference to the created HTML element.
396
- * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.
397
- * - can alse be used to store normal values, but it is not reactive.
398
- * - if the value is already a `KTRef`, it will be returned **directly**.
399
- * @param value mostly an HTMLElement
400
- */
401
- export declare function ref<T = JSX.Element>(value?: T, onChange?: ReactiveChangeHandler<T>): KTRef<T>;
402
-
403
- declare type RefSetter<T> = (props: {
404
- ref?: KTRef<T>;
405
- }, node: T) => void;
406
-
407
- declare type SingleContent = KTRef<any> | HTMLElement | Element | Node | string | number | boolean | null | undefined;
408
-
409
- /**
410
- * Make all first-level properties of the object a `KTRef`.
411
- * - `obj.a.b` is not reactive
412
- */
413
- export declare const surfaceRef: <T extends object>(obj: T) => KTSurfaceRef<T>;
414
-
415
- export { SVGTag }
416
-
417
- export declare const toReactive: <T>(value: T | KTReactive<T>, onChange?: ReactiveChangeHandler<T>) => KTReactive<T>;
418
-
419
- /**
420
- * Convert a value to `KTRef`.
421
- * - Returns the original value if it is already a `KTRef`.
422
- * - Throws error if the value is a `KTComputed`.
423
- * - Otherwise wraps the value with `ref()`.
424
- * @param o value to convert
425
- */
426
- export declare const toRef: <T = any>(o: any) => KTRef<T>;
427
-
428
- export { }
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
+ * Conditional rendering, must come after `k-if`
1072
+ * @throws Error if used without a preceding `k-if` or coexisting with another `k-if`
1073
+ */
1074
+ 'k-else'?: any;
1075
+
1076
+ /**
1077
+ * List rendering. Must provide an iterable or array-like `KTReactive`
1078
+ */
1079
+ 'k-for'?: any;
1080
+
1081
+ /**
1082
+ * List key. Use it with `k-for`
1083
+ */
1084
+ 'k-key'?: any;
1085
+
1086
+ /**
1087
+ * 2-way binding. Must provide a `KTRef`
1088
+ */
1089
+ 'k-model'?: KTRef<any>;
1090
+
1091
+ /**
1092
+ * Raw html binding
1093
+ * - Provide a `KTRef` to make it reactive
1094
+ */
1095
+ 'k-html'?: any;
1096
+ children?: KTRawContent;
1097
+ }
1098
+
1099
+ interface ElementChildrenAttribute {
1100
+ children: {};
1101
+ }
1102
+ }
1103
+
1104
+ declare class KTComputed<T> implements KTReactive<T> {
1105
+ /**
1106
+ * Indicates that this is a KTRef instance
1107
+ */
1108
+ isKT: true;
1109
+ ktType: KTReactiveType;
1110
+ constructor(_calculator: () => T, reactives: Array<KTReactive<unknown>>);
1111
+ /**
1112
+ * If new value and old value are both nodes, the old one will be replaced in the DOM
1113
+ */
1114
+ get value(): T;
1115
+ set value(_newValue: T);
1116
+ /**
1117
+ * Force listeners to run once with the latest computed result.
1118
+ */
1119
+ notify(): void;
1120
+ /**
1121
+ * Computed values are derived from dependencies and should not be mutated manually.
1122
+ */
1123
+ mutate<R = void>(): R;
1124
+ /**
1125
+ * Register a callback when the value changes
1126
+ * @param callback (newValue, oldValue) => xxx
1127
+ */
1128
+ addOnChange(callback: ReactiveChangeHandler<T>): void;
1129
+ /**
1130
+ * Unregister a callback
1131
+ * @param callback (newValue, oldValue) => xxx
1132
+ */
1133
+ removeOnChange(callback: ReactiveChangeHandler<T>): boolean;
1134
+ }
1135
+ /**
1136
+ * Create a reactive computed value
1137
+ * @param computeFn
1138
+ * @param reactives refs and computeds that this computed depends on
1139
+ */
1140
+ declare function computed<T = JSX.Element>(computeFn: () => T, reactives: Array<KTReactive<any>>): KTComputed<T>;
1141
+
1142
+ interface KTEffectOptions {
1143
+ lazy: boolean;
1144
+ onCleanup: () => void;
1145
+ debugName: string;
1146
+ }
1147
+ /**
1148
+ * Register a reactive effect with options.
1149
+ * @param effectFn The effect function to run when dependencies change
1150
+ * @param reactives The reactive dependencies
1151
+ * @param options Effect options: lazy, onCleanup, debugName
1152
+ * @returns stop function to remove all listeners
1153
+ */
1154
+ declare function effect(effectFn: () => void, reactives: Array<KTReactive<any>>, options?: Partial<KTEffectOptions>): () => void;
1155
+
1156
+ declare const toReactive: <T>(value: T | KTReactive<T>, onChange?: ReactiveChangeHandler<T>) => KTReactive<T>;
1157
+ /**
1158
+ * Extracts the value from a KTReactive, or returns the value directly if it's not reactive.
1159
+ */
1160
+ declare function dereactive<T = JSX.Element>(value: T | KTReactive<T>): T;
1161
+
1162
+ declare const enum KTReactiveType {
1163
+ REF = 1,
1164
+ COMPUTED = 2
1165
+ }
1166
+ declare const isKT: <T = any>(obj: any) => obj is KTReactive<T>;
1167
+ declare const isRef: <T = any>(obj: any) => obj is KTRef<T>;
1168
+ declare const isComputed: <T = any>(obj: any) => obj is KTComputed<T>;
1169
+
1170
+ type ReactiveChangeHandler<T> = (newValue: T, oldValue: T) => void;
1171
+
1172
+ declare class KTReactive<T> {
1173
+ /**
1174
+ * Indicates that this is a KTRef instance
1175
+ */
1176
+ isKT: boolean;
1177
+
1178
+ ktType: KTReactiveType;
1179
+
1180
+ /**
1181
+ * If new value and old value are both nodes, the old one will be replaced in the DOM
1182
+ */
1183
+ get value();
1184
+ set value(newValue: T);
1185
+
1186
+ /**
1187
+ * Force all listeners to run even when reference identity has not changed.
1188
+ * Useful for in-place array/object mutations.
1189
+ */
1190
+ notify(): void;
1191
+
1192
+ /**
1193
+ * Mutate current value in-place and notify listeners once.
1194
+ *
1195
+ * @example
1196
+ * const items = ref<number[]>([1, 2]);
1197
+ * items.mutate((list) => list.push(3));
1198
+ */
1199
+ mutate<R = void>(mutator: (currentValue: T) => R): R;
1200
+
1201
+ /**
1202
+ * Register a callback when the value changes
1203
+ * - Value setter will check `Object.is(newValue, oldValue)`.
1204
+ * @param callback (newValue, oldValue) => xxx
1205
+ */
1206
+ addOnChange(callback: ReactiveChangeHandler<T>): void;
1207
+ removeOnChange(callback: ReactiveChangeHandler<T>): void;
1208
+ }
1209
+
1210
+ // & Shockingly, If T is boolean, KTReactify<T> becomes KTReactive<true> | KTReactive<false>. It causes @ktjs/mui that disabledRefs not assignable.
1211
+ type KTReactify<T> = T extends boolean ? KTReactive<boolean> : T extends any ? KTReactive<T> : never;
1212
+
1213
+ type KTReactifyObject<T extends object> = {
1214
+ [K in keyof T]: KTReactify<T[K]>;
1215
+ };
1216
+
1217
+ type KTReactifyProps<T extends object> = {
1218
+ [K in keyof T]: KTReactify<Exclude<T[K], undefined>> | T[K];
1219
+ };
1220
+
1221
+ declare class KTRef<T> implements KTReactive<T> {
1222
+ /**
1223
+ * Indicates that this is a KTRef instance
1224
+ */
1225
+ isKT: true;
1226
+ ktType: KTReactiveType;
1227
+ constructor(_value: T, _onChanges: Array<ReactiveChangeHandler<T>>);
1228
+ /**
1229
+ * If new value and old value are both nodes, the old one will be replaced in the DOM
1230
+ */
1231
+ get value(): T;
1232
+ set value(newValue: T);
1233
+ /**
1234
+ * Force all listeners to run even when reference identity has not changed.
1235
+ * Useful for in-place array/object mutations.
1236
+ */
1237
+ notify(): void;
1238
+ /**
1239
+ * Mutate current value in-place and notify listeners once.
1240
+ *
1241
+ * @example
1242
+ * const items = ref<number[]>([1, 2]);
1243
+ * items.mutate((list) => list.push(3));
1244
+ */
1245
+ mutate<R = void>(mutator: (currentValue: T) => R): R;
1246
+ /**
1247
+ * Register a callback when the value changes
1248
+ * @param callback (newValue, oldValue) => xxx
1249
+ */
1250
+ addOnChange(callback: ReactiveChangeHandler<T>): void;
1251
+ removeOnChange(callback: ReactiveChangeHandler<T>): boolean;
1252
+ }
1253
+ /**
1254
+ * Reference to the created HTML element.
1255
+ * - **Only** respond to `ref.value` changes, not reactive to internal changes of the element.
1256
+ * - can alse be used to store normal values, but it is not reactive.
1257
+ * - if the value is already a `KTRef`, it will be returned **directly**.
1258
+ * @param value mostly an HTMLElement
1259
+ */
1260
+ declare function ref<T = JSX.Element>(value?: T, onChange?: ReactiveChangeHandler<T>): KTRef<T>;
1261
+ /**
1262
+ * Convert a value to `KTRef`.
1263
+ * - Returns the original value if it is already a `KTRef`.
1264
+ * - Throws error if the value is a `KTComputed`.
1265
+ * - Otherwise wraps the value with `ref()`.
1266
+ * @param o value to convert
1267
+ */
1268
+ declare const toRef: <T = any>(o: any) => KTRef<T>;
1269
+ type KTSurfaceRef<T extends object> = {
1270
+ [K in keyof T]: KTRef<T[K]>;
1271
+ } & {
1272
+ /**
1273
+ * Get the dereferenced object like the original one
1274
+ */
1275
+ kcollect: () => T;
1276
+ };
1277
+ /**
1278
+ * Make all first-level properties of the object a `KTRef`.
1279
+ * - `obj.a.b` is not reactive
1280
+ */
1281
+ declare const surfaceRef: <T extends object>(obj: T) => KTSurfaceRef<T>;
1282
+ /**
1283
+ * Assert k-model to be a ref object
1284
+ */
1285
+ declare const $modelOrRef: <T = any>(props: any, defaultValue?: T) => KTRef<T>;
1286
+ type RefSetter<T> = (props: {
1287
+ ref?: KTRef<T>;
1288
+ }, node: T) => void;
1289
+ /**
1290
+ * Whether `props.ref` is a `KTRef` only needs to be checked in the initial render
1291
+ */
1292
+ declare const $initRef: <T extends Node>(props: {
1293
+ ref?: KTRef<T>;
1294
+ }, node: T) => RefSetter<T>;
1295
+
1296
+ type HTML<T extends (HTMLTag | SVGTag | MathMLTag) & otherstring> = T extends SVGTag
1297
+ ? SVGElementTagNameMap[T]
1298
+ : T extends HTMLTag
1299
+ ? HTMLElementTagNameMap[T]
1300
+ : T extends MathMLTag
1301
+ ? MathMLElementTagNameMap[T]
1302
+ : HTMLElement;
1303
+
1304
+ type SingleContent = KTRef<any> | HTMLElement | Element | Node | string | number | boolean | null | undefined;
1305
+ type KTAvailableContent = SingleContent | KTAvailableContent[];
1306
+ type KTRawContent = KTAvailableContent | Promise<KTAvailableContent>;
1307
+ type KTRawAttr = KTAttribute | null | undefined | '' | false;
1308
+ type KTRawContents = KTAvailableContent;
1309
+
1310
+ /**
1311
+ * Event handler type for DOM events
1312
+ */
1313
+ type EventHandler<T extends Event = Event> = (this: HTMLElement, ev: T) => any;
1314
+
1315
+ /**
1316
+ * Used to create enhanced HTML elements
1317
+ */
1318
+ interface KTBaseAttribute {
1319
+ [k: string]: any;
1320
+
1321
+ // # kt-specific attributes
1322
+ ref?: KTRef<JSX.Element>;
1323
+
1324
+ /**
1325
+ * If a `KTRef` is bound, it will be reactive; otherwise, it will be static.
1326
+ */
1327
+ 'k-if'?: any;
1328
+
1329
+ /**
1330
+ * Register two-way data binding between an input element and a KTRef.
1331
+ * - Default to regist `input` event and `value` property(`checked` for checkboxes and radios).
1332
+ */
1333
+ 'k-model'?: KTRef<any>;
1334
+
1335
+ /**
1336
+ * Directly apply html string to `innerHTML`.
1337
+ * - Would be reactive if `KTRef` instance is provided
1338
+ */
1339
+ 'k-html'?: any;
1340
+
1341
+ // # normal HTML attributes
1342
+ id?: string;
1343
+ class?: string;
1344
+ className?: string;
1345
+ style?: string | Partial<CSSStyleDeclaration>;
1346
+
1347
+ type?:
1348
+ | 'text'
1349
+ | 'password'
1350
+ | 'email'
1351
+ | 'number'
1352
+ | 'tel'
1353
+ | 'url'
1354
+ | 'search'
1355
+ | 'date'
1356
+ | 'datetime-local'
1357
+ | 'time'
1358
+ | 'month'
1359
+ | 'week'
1360
+ | 'color'
1361
+ | 'range'
1362
+ | 'file'
1363
+ | 'checkbox'
1364
+ | 'radio'
1365
+ | 'hidden'
1366
+ | 'submit'
1367
+ | 'reset'
1368
+ | 'button'
1369
+ | 'image'
1370
+ | otherstring;
1371
+ for?: string;
1372
+
1373
+ name?: string;
1374
+ title?: string;
1375
+ placeholder?: string;
1376
+ contenteditable?: boolean;
1377
+ value?: any;
1378
+ valueAsDate?: Date;
1379
+ valueAsNumber?: number;
1380
+ label?: string;
1381
+ disabled?: boolean;
1382
+
1383
+ min?: string | number;
1384
+ max?: string | number;
1385
+ step?: string | number;
1386
+
1387
+ selected?: boolean;
1388
+ checked?: boolean;
1389
+
1390
+ action?: string;
1391
+ method?: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE' | otherstring;
1392
+ }
1393
+
1394
+ type KTPrefixedEventAttribute = {
1395
+ [EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
1396
+ };
1397
+
1398
+ type KTAttribute = KTBaseAttribute & KTPrefixedEventAttribute;
1399
+
1400
+ type KTComponent = (
1401
+ props: {
1402
+ ref?: KTRef<JSX.Element>;
1403
+ children?: KTRawContent;
1404
+ } & KTAttribute &
1405
+ any,
1406
+ ) => JSX.Element | Promise<JSX.Element> | any;
1407
+
1408
+ /**
1409
+ * Create an enhanced HTMLElement.
1410
+ * - Only supports HTMLElements, **NOT** SVGElements or other Elements.
1411
+ * @param tag tag of an `HTMLElement`
1412
+ * @param attr attribute object or className
1413
+ * @param content a string or an array of HTMLEnhancedElement as child nodes
1414
+ *
1415
+ * __PKG_INFO__
1416
+ */
1417
+ declare const h: <T extends HTMLTag | SVGTag | MathMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>;
1418
+
1419
+ /**
1420
+ * @param tag html tag or function component
1421
+ * @param props properties/attributes
1422
+ */
1423
+ declare function jsx(tag: JSXTag, props: KTAttribute): JSX.Element;
1424
+ /**
1425
+ * Fragment support - returns an array of children
1426
+ * Enhanced Fragment component that manages arrays of elements
1427
+ */
1428
+ declare function Fragment(props: {
1429
+ children?: KTRawContent;
1430
+ }): JSX.Element;
1431
+ /**
1432
+ * JSX Development runtime - same as jsx but with additional dev checks
1433
+ */
1434
+ declare const jsxDEV: typeof jsx;
1435
+ /**
1436
+ * JSX runtime for React 17+ automatic runtime
1437
+ * This is called when using jsx: "react-jsx" or "react-jsxdev"
1438
+ */
1439
+ declare const jsxs: typeof jsx;
1440
+
1441
+ /**
1442
+ * A helper to create redrawable elements
1443
+ * ```tsx
1444
+ * export function MyComponent() {
1445
+ * let aa = 10;
1446
+ * // ...
1447
+ * // aa might be changed
1448
+ * return createRedrawable(() => <div>{aa}</div>);
1449
+ * }
1450
+ * ```
1451
+ * Then the returned element has a `redraw` method to redraw itself with new values.
1452
+ * @param creator a simple creator function that returns an element
1453
+ * @returns created element's ref
1454
+ */
1455
+ declare function createRedrawable<T>(creator: () => T): KTRef<T> & {
1456
+ redraw: () => T;
1457
+ };
1458
+
1459
+ /**
1460
+ * Extract component props type (excluding ref and children)
1461
+ */
1462
+ type ExtractComponentProps<T> = T extends (props: infer P) => any ? Omit<P, 'ref' | 'children'> : {};
1463
+ declare function KTAsync<T extends KTComponent>(props: {
1464
+ ref?: KTRef<JSX.Element>;
1465
+ skeleton?: JSX.Element;
1466
+ component: T;
1467
+ children?: KTRawContent;
1468
+ } & ExtractComponentProps<T>): JSX.Element;
1469
+
1470
+ type KTForElement = JSX.Element;
1471
+ interface KTForProps<T> {
1472
+ ref?: KTRef<KTForElement>;
1473
+ list: T[] | KTReactive<T[]>;
1474
+ key?: (item: T, index: number, array: T[]) => any;
1475
+ map: (item: T, index: number, array: T[]) => HTMLElement;
1476
+ }
1477
+ /**
1478
+ * KTFor - List rendering component with key-based optimization
1479
+ * Returns a Comment anchor node with rendered elements in __kt_for_list__
1480
+ */
1481
+ declare function KTFor<T>(props: KTForProps<T>): KTForElement;
1482
+
1483
+ 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 };
1484
+ export type { EventHandler, KTAttribute, KTForElement, KTForProps, KTPrefixedEventAttribute, KTRawAttr, KTRawContent, KTRawContents, KTReactify, KTReactifyObject, KTReactifyProps, KTSurfaceRef, ReactiveChangeHandler };