@ktjs/core 0.29.9 → 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 +1469 -428
- package/dist/index.mjs +1093 -301
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -5
- package/dist/jsx-runtime-DGJHUQEM.js +0 -600
- package/dist/jsx-runtime.d.ts +0 -245
- package/dist/jsx-runtime.mjs +0 -1
package/dist/jsx-runtime.d.ts
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { HTMLTag } from '@ktjs/shared';
|
|
2
|
-
import { JSXTag } from '@ktjs/shared';
|
|
3
|
-
import { MathMLTag } from '@ktjs/shared';
|
|
4
|
-
import { otherstring } from '@ktjs/shared';
|
|
5
|
-
import { SVGTag } from '@ktjs/shared';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A helper to create redrawable elements
|
|
9
|
-
* ```tsx
|
|
10
|
-
* export function MyComponent() {
|
|
11
|
-
* let aa = 10;
|
|
12
|
-
* // ...
|
|
13
|
-
* // aa might be changed
|
|
14
|
-
* return createRedrawable(() => <div>{aa}</div>);
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
* Then the returned element has a `redraw` method to redraw itself with new values.
|
|
18
|
-
* @param creator a simple creator function that returns an element
|
|
19
|
-
* @returns created element's ref
|
|
20
|
-
*/
|
|
21
|
-
export declare function createRedrawable<T>(creator: () => T): KTRef<T> & {
|
|
22
|
-
redraw: () => T;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Fragment support - returns an array of children
|
|
27
|
-
* Enhanced Fragment component that manages arrays of elements
|
|
28
|
-
*/
|
|
29
|
-
export declare function Fragment(props: {
|
|
30
|
-
children?: KTRawContent;
|
|
31
|
-
}): JSX.Element;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Create an enhanced HTMLElement.
|
|
35
|
-
* - Only supports HTMLElements, **NOT** SVGElements or other Elements.
|
|
36
|
-
* @param tag tag of an `HTMLElement`
|
|
37
|
-
* @param attr attribute object or className
|
|
38
|
-
* @param content a string or an array of HTMLEnhancedElement as child nodes
|
|
39
|
-
*
|
|
40
|
-
* __PKG_INFO__
|
|
41
|
-
*/
|
|
42
|
-
declare const h: <T extends HTMLTag | SVGTag | MathMLTag>(tag: T, attr?: KTRawAttr, content?: KTRawContent) => HTML<T>;
|
|
43
|
-
export { h as createElement }
|
|
44
|
-
export { h }
|
|
45
|
-
|
|
46
|
-
declare type HTML<T extends (HTMLTag | SVGTag | MathMLTag) & otherstring> = T extends SVGTag
|
|
47
|
-
? SVGElementTagNameMap[T]
|
|
48
|
-
: T extends HTMLTag
|
|
49
|
-
? HTMLElementTagNameMap[T]
|
|
50
|
-
: T extends MathMLTag
|
|
51
|
-
? MathMLElementTagNameMap[T]
|
|
52
|
-
: HTMLElement;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @param tag html tag or function component
|
|
56
|
-
* @param props properties/attributes
|
|
57
|
-
*/
|
|
58
|
-
export declare function jsx(tag: JSXTag, props: KTAttribute): JSX.Element;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* JSX Development runtime - same as jsx but with additional dev checks
|
|
62
|
-
*/
|
|
63
|
-
export declare const jsxDEV: typeof jsx;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* JSX runtime for React 17+ automatic runtime
|
|
67
|
-
* This is called when using jsx: "react-jsx" or "react-jsxdev"
|
|
68
|
-
*/
|
|
69
|
-
export declare const jsxs: typeof jsx;
|
|
70
|
-
|
|
71
|
-
declare type KTAttribute = KTBaseAttribute & KTPrefixedEventAttribute;
|
|
72
|
-
|
|
73
|
-
declare type KTAvailableContent = SingleContent | KTAvailableContent[];
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Used to create enhanced HTML elements
|
|
77
|
-
*/
|
|
78
|
-
declare interface KTBaseAttribute {
|
|
79
|
-
[k: string]: any;
|
|
80
|
-
|
|
81
|
-
// # kt-specific attributes
|
|
82
|
-
ref?: KTRef<JSX.Element>;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* If a `KTRef` is bound, it will be reactive; otherwise, it will be static.
|
|
86
|
-
*/
|
|
87
|
-
'k-if'?: any;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Register two-way data binding between an input element and a KTRef.
|
|
91
|
-
* - Default to regist `input` event and `value` property(`checked` for checkboxes and radios).
|
|
92
|
-
*/
|
|
93
|
-
'k-model'?: KTRef<any>;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Directly apply html string to `innerHTML`.
|
|
97
|
-
* - Would be reactive if `KTRef` instance is provided
|
|
98
|
-
*/
|
|
99
|
-
'k-html'?: any;
|
|
100
|
-
|
|
101
|
-
// # normal HTML attributes
|
|
102
|
-
id?: string;
|
|
103
|
-
class?: string;
|
|
104
|
-
className?: string;
|
|
105
|
-
style?: string | Partial<CSSStyleDeclaration>;
|
|
106
|
-
|
|
107
|
-
type?:
|
|
108
|
-
| 'text'
|
|
109
|
-
| 'password'
|
|
110
|
-
| 'email'
|
|
111
|
-
| 'number'
|
|
112
|
-
| 'tel'
|
|
113
|
-
| 'url'
|
|
114
|
-
| 'search'
|
|
115
|
-
| 'date'
|
|
116
|
-
| 'datetime-local'
|
|
117
|
-
| 'time'
|
|
118
|
-
| 'month'
|
|
119
|
-
| 'week'
|
|
120
|
-
| 'color'
|
|
121
|
-
| 'range'
|
|
122
|
-
| 'file'
|
|
123
|
-
| 'checkbox'
|
|
124
|
-
| 'radio'
|
|
125
|
-
| 'hidden'
|
|
126
|
-
| 'submit'
|
|
127
|
-
| 'reset'
|
|
128
|
-
| 'button'
|
|
129
|
-
| 'image'
|
|
130
|
-
| otherstring;
|
|
131
|
-
for?: string;
|
|
132
|
-
|
|
133
|
-
name?: string;
|
|
134
|
-
title?: string;
|
|
135
|
-
placeholder?: string;
|
|
136
|
-
contenteditable?: boolean;
|
|
137
|
-
value?: any;
|
|
138
|
-
valueAsDate?: Date;
|
|
139
|
-
valueAsNumber?: number;
|
|
140
|
-
label?: string;
|
|
141
|
-
disabled?: boolean;
|
|
142
|
-
|
|
143
|
-
min?: string | number;
|
|
144
|
-
max?: string | number;
|
|
145
|
-
step?: string | number;
|
|
146
|
-
|
|
147
|
-
selected?: boolean;
|
|
148
|
-
checked?: boolean;
|
|
149
|
-
|
|
150
|
-
action?: string;
|
|
151
|
-
method?: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE' | otherstring;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
declare type KTPrefixedEventAttribute = {
|
|
155
|
-
[EventName in keyof HTMLElementEventMap as `on:${EventName}`]?: (ev: HTMLElementEventMap[EventName]) => void;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
declare type KTRawAttr = KTAttribute | null | undefined | '' | false;
|
|
159
|
-
|
|
160
|
-
declare type KTRawContent = KTAvailableContent | Promise<KTAvailableContent>;
|
|
161
|
-
|
|
162
|
-
declare class KTReactive<T> {
|
|
163
|
-
/**
|
|
164
|
-
* Indicates that this is a KTRef instance
|
|
165
|
-
*/
|
|
166
|
-
isKT: boolean;
|
|
167
|
-
|
|
168
|
-
ktType: KTReactiveType;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* If new value and old value are both nodes, the old one will be replaced in the DOM
|
|
172
|
-
*/
|
|
173
|
-
get value();
|
|
174
|
-
set value(newValue: T);
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Force all listeners to run even when reference identity has not changed.
|
|
178
|
-
* Useful for in-place array/object mutations.
|
|
179
|
-
*/
|
|
180
|
-
notify(): void;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Mutate current value in-place and notify listeners once.
|
|
184
|
-
*
|
|
185
|
-
* @example
|
|
186
|
-
* const items = ref<number[]>([1, 2]);
|
|
187
|
-
* items.mutate((list) => list.push(3));
|
|
188
|
-
*/
|
|
189
|
-
mutate<R = void>(mutator: (currentValue: T) => R): R;
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Register a callback when the value changes
|
|
193
|
-
* - Value setter will check `Object.is(newValue, oldValue)`.
|
|
194
|
-
* @param callback (newValue, oldValue) => xxx
|
|
195
|
-
*/
|
|
196
|
-
addOnChange(callback: ReactiveChangeHandler<T>): void;
|
|
197
|
-
removeOnChange(callback: ReactiveChangeHandler<T>): void;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
declare const enum KTReactiveType {
|
|
201
|
-
REF = 1,
|
|
202
|
-
COMPUTED = 2
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
declare class KTRef<T> implements KTReactive<T> {
|
|
206
|
-
/**
|
|
207
|
-
* Indicates that this is a KTRef instance
|
|
208
|
-
*/
|
|
209
|
-
isKT: true;
|
|
210
|
-
ktType: KTReactiveType;
|
|
211
|
-
/* Excluded from this release type: _value */
|
|
212
|
-
/* Excluded from this release type: _onChanges */
|
|
213
|
-
/* Excluded from this release type: _emit */
|
|
214
|
-
constructor(_value: T, _onChanges: Array<ReactiveChangeHandler<T>>);
|
|
215
|
-
/**
|
|
216
|
-
* If new value and old value are both nodes, the old one will be replaced in the DOM
|
|
217
|
-
*/
|
|
218
|
-
get value(): T;
|
|
219
|
-
set value(newValue: T);
|
|
220
|
-
/**
|
|
221
|
-
* Force all listeners to run even when reference identity has not changed.
|
|
222
|
-
* Useful for in-place array/object mutations.
|
|
223
|
-
*/
|
|
224
|
-
notify(): void;
|
|
225
|
-
/**
|
|
226
|
-
* Mutate current value in-place and notify listeners once.
|
|
227
|
-
*
|
|
228
|
-
* @example
|
|
229
|
-
* const items = ref<number[]>([1, 2]);
|
|
230
|
-
* items.mutate((list) => list.push(3));
|
|
231
|
-
*/
|
|
232
|
-
mutate<R = void>(mutator: (currentValue: T) => R): R;
|
|
233
|
-
/**
|
|
234
|
-
* Register a callback when the value changes
|
|
235
|
-
* @param callback (newValue, oldValue) => xxx
|
|
236
|
-
*/
|
|
237
|
-
addOnChange(callback: ReactiveChangeHandler<T>): void;
|
|
238
|
-
removeOnChange(callback: ReactiveChangeHandler<T>): boolean;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
declare type ReactiveChangeHandler<T> = (newValue: T, oldValue: T) => void;
|
|
242
|
-
|
|
243
|
-
declare type SingleContent = KTRef<any> | HTMLElement | Element | Node | string | number | boolean | null | undefined;
|
|
244
|
-
|
|
245
|
-
export { }
|
package/dist/jsx-runtime.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { F as Fragment, h as createElement, c as createRedrawable, h, j as jsx, a as jsxDEV, b as jsxs } from './jsx-runtime-DGJHUQEM.js';
|