hyperscript-rxjs 1.3.7 → 1.3.8
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/hyperscript-rxjs.d.ts +1213 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +1 -1
@@ -0,0 +1,1213 @@
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
2
|
+
import { Observable } from 'rxjs';
|
3
|
+
import { Observer } from 'rxjs';
|
4
|
+
import { Subject } from 'rxjs';
|
5
|
+
import { Subscription } from 'rxjs';
|
6
|
+
|
7
|
+
export declare function a(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLAnchorElement>;
|
8
|
+
|
9
|
+
export declare function abbr(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
10
|
+
|
11
|
+
export declare function address(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Splits an array into two parts: the first `n` elements (in reverse order) and the remaining elements.
|
15
|
+
*
|
16
|
+
* @param array - The input array to process.
|
17
|
+
* @param n - The number of elements to take from the start of the array.
|
18
|
+
* @returns A tuple where the first element is an array of the first `n` elements (in reverse order),
|
19
|
+
* and the second element is the remaining elements of the array.
|
20
|
+
*/
|
21
|
+
export declare function advance<T>(array: T[], n: number): [T[], T[]];
|
22
|
+
|
23
|
+
export declare function area(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLAreaElement>;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Inserts an element into an array at the specified position in place.
|
27
|
+
*
|
28
|
+
* @param array - The array to modify.
|
29
|
+
* @param item - The element to insert.
|
30
|
+
* @param index - The position at which to insert the element (default is the end of the array).
|
31
|
+
*/
|
32
|
+
export declare function arrayInsert<T>(array: T[], item: T, index?: number): void;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Removes an element from an array at the specified position in place.
|
36
|
+
*
|
37
|
+
* @param array - The array to modify.
|
38
|
+
* @param index - The position of the element to remove (default is the last element).
|
39
|
+
*/
|
40
|
+
export declare function arrayRemove<T>(array: T[], index?: number): void;
|
41
|
+
|
42
|
+
export declare function article(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
43
|
+
|
44
|
+
export declare function aside(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* 将 RxJS 订阅对象附加到 DOM 节点上,便于管理。
|
48
|
+
*
|
49
|
+
* @param elem - 要附加订阅的 DOM 节点。
|
50
|
+
* @param subscription - 要附加的 RxJS Subscription 对象。
|
51
|
+
* @throws 如果参数无效会抛出错误。
|
52
|
+
*/
|
53
|
+
export declare function attachSubscriptionToNode(
|
54
|
+
elem: Node & { subscription?: Subscription },
|
55
|
+
subscription: Subscription
|
56
|
+
): void;
|
57
|
+
|
58
|
+
export declare function audio(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLAudioElement>;
|
59
|
+
|
60
|
+
export declare function b(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
61
|
+
|
62
|
+
export declare function bdi(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
63
|
+
|
64
|
+
export declare function bdo(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* 绑定选项卡的激活状态到 tabIndex,实现动态切换选项卡的功能。
|
68
|
+
*
|
69
|
+
* @param tabRoot - 选项卡的根容器,包含导航栏和内容面板。
|
70
|
+
* @param tabIndex$ - 表示当前激活选项卡索引的 BehaviorSubject。
|
71
|
+
*/
|
72
|
+
export declare function bindTabIndex(
|
73
|
+
tabRoot: HTMLElement,
|
74
|
+
tabIndex$: BehaviorSubject<number>
|
75
|
+
): void;
|
76
|
+
|
77
|
+
/**
|
78
|
+
* 一个包含所有 HTML 块级元素标签名称(大写)的集合。
|
79
|
+
* 用于判断某个标签是否为块级元素。
|
80
|
+
*/
|
81
|
+
export declare const blockLevelFamily: Set<string>;
|
82
|
+
|
83
|
+
export declare function blockquote(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLQuoteElement>;
|
84
|
+
|
85
|
+
export declare function br(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLBRElement>;
|
86
|
+
|
87
|
+
export declare function button(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLButtonElement>;
|
88
|
+
|
89
|
+
export declare function caption(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
90
|
+
|
91
|
+
/**
|
92
|
+
* 创建一个支持 RxJS 的复选框组件
|
93
|
+
* @param props - 复选框的属性对象
|
94
|
+
* @param props.checked - 可选的 RxJS BehaviorSubject,用于绑定复选框的选中状态
|
95
|
+
* @returns 返回一个增强的复选框元素
|
96
|
+
*/
|
97
|
+
export declare function checkbox(props: {
|
98
|
+
checked?: BehaviorSubject<boolean>,
|
99
|
+
[key: string]: any
|
100
|
+
}): HyperscriptExtensions<HTMLInputElement>;
|
101
|
+
|
102
|
+
/**
|
103
|
+
* 根据 chosen$ 的字符值动态显示或隐藏一组不同字符标签的可能性元素块。
|
104
|
+
*
|
105
|
+
* @param chosen$ - 一个可观察对象(如 BehaviorSubject),表示当前选中的可能性名称。
|
106
|
+
* @param possibilities - 一个对象,键为可能性名称,值为对应的 HTML 元素或 HTML 元素数组。
|
107
|
+
* @returns 包含所有可能性的 HTML 元素数组。
|
108
|
+
*/
|
109
|
+
export declare function choice(
|
110
|
+
chosen$: Observable<string>,
|
111
|
+
possibilities: Record<string, HTMLElement | HTMLElement[]>
|
112
|
+
): HTMLElement[];
|
113
|
+
|
114
|
+
export declare function cite(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
115
|
+
|
116
|
+
export declare function code(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
117
|
+
|
118
|
+
export declare function col(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableColElement>;
|
119
|
+
|
120
|
+
export declare function colgroup(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableColElement>;
|
121
|
+
|
122
|
+
/**
|
123
|
+
* 显示或隐藏包含的元素,通过绑定 hidden 属性实现动态显示或隐藏。
|
124
|
+
*
|
125
|
+
* @param hidden$ - 一个可观察对象(如 BehaviorSubject),用于控制元素的 hidden 属性。
|
126
|
+
* @param elements - 一个或多个 HTML 元素,或者包含 HTML 元素的数组。
|
127
|
+
* @returns 处理后的元素数组。
|
128
|
+
* @throws 如果 elements 中包含非 HTMLElement 节点会抛出错误。
|
129
|
+
*/
|
130
|
+
export declare function collapse(
|
131
|
+
hidden$: Observable<boolean>,
|
132
|
+
...elements: (HTMLElement | HTMLElement[])[]
|
133
|
+
): HTMLElement[];
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Compares two dates by their numeric value.
|
137
|
+
*
|
138
|
+
* @param a - The first date to compare.
|
139
|
+
* @param b - The second date to compare.
|
140
|
+
* @returns A negative number if `a` is earlier than `b`, 0 if they are equal, or a positive number if `a` is later than `b`.
|
141
|
+
*/
|
142
|
+
export declare function compareDate(a: Date, b: Date): number;
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Compares two entries (key-value pairs) based on their key paths.
|
146
|
+
*
|
147
|
+
* - Uses `compareKeyPath` to compare the key paths of the two entries.
|
148
|
+
*
|
149
|
+
* @param entry1 - The first entry, where the key is a key path (array of keys).
|
150
|
+
* @param entry2 - The second entry, where the key is a key path (array of keys).
|
151
|
+
* @returns A negative number if `entry1` is less than `entry2`, 0 if they are equal, or a positive number if `entry1` is greater than `entry2`.
|
152
|
+
*/
|
153
|
+
export declare function compareEntries(
|
154
|
+
entry1: [(number | string)[], any],
|
155
|
+
entry2: [(number | string)[], any]
|
156
|
+
): number;
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Compares two values and returns a number indicating their relative order.
|
160
|
+
*
|
161
|
+
* - If both values are of the same type, it uses `defaultCompare` for comparison.
|
162
|
+
* - Strings are considered greater than numbers.
|
163
|
+
*
|
164
|
+
* @param a - The first value to compare (can be a `number` or `string`).
|
165
|
+
* @param b - The second value to compare (can be a `number` or `string`).
|
166
|
+
* @returns A negative number if `a` is less than `b`, 0 if they are equal, or a positive number if `a` is greater than `b`.
|
167
|
+
*/
|
168
|
+
export declare function compareKey(a: number | string, b: number | string): number;
|
169
|
+
|
170
|
+
/**
|
171
|
+
* Compares two key paths (arrays of keys) lexicographically.
|
172
|
+
*
|
173
|
+
* - Two empty arrays are considered equal.
|
174
|
+
* - An empty array is considered less than a non-empty array.
|
175
|
+
* - A non-empty array is considered greater than an empty array.
|
176
|
+
* - If the first elements of both arrays are equal, the comparison continues recursively with the remaining elements.
|
177
|
+
*
|
178
|
+
* @param a - The first key path (array of keys) to compare.
|
179
|
+
* @param b - The second key path (array of keys) to compare.
|
180
|
+
* @returns A negative number if `a` is less than `b`, 0 if they are equal, or a positive number if `a` is greater than `b`.
|
181
|
+
*/
|
182
|
+
export declare function compareKeyPath(a: (number | string)[], b: (number | string)[]): number;
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Compares two numbers or bigints, including special handling for `NaN` and `Infinity`.
|
186
|
+
*
|
187
|
+
* - `NaN` is considered the largest value.
|
188
|
+
* - Supports comparison of `number` and `bigint` types.
|
189
|
+
*
|
190
|
+
* @param a - The first value to compare (can be `number` or `bigint`).
|
191
|
+
* @param b - The second value to compare (can be `number` or `bigint`).
|
192
|
+
* @returns A negative number if `a` is less than `b`, 0 if they are equal, or a positive number if `a` is greater than `b`.
|
193
|
+
*/
|
194
|
+
export declare function compareNumber(a: number | bigint, b: number | bigint): number;
|
195
|
+
|
196
|
+
/**
|
197
|
+
* 用于比较和操作数组及集合的工具类。
|
198
|
+
* @template T
|
199
|
+
*/
|
200
|
+
export declare class Comparer<T> {
|
201
|
+
constructor(compare: (a: T, b: T) => number);
|
202
|
+
|
203
|
+
/**
|
204
|
+
* 使用实例的比较函数对数组进行排序。
|
205
|
+
* @param array - 要排序的数组
|
206
|
+
* @returns 排序后的数组
|
207
|
+
*/
|
208
|
+
sort(array: T[]): T[];
|
209
|
+
|
210
|
+
/**
|
211
|
+
* 移除数组中的重复值。
|
212
|
+
* @param array - 要处理的数组
|
213
|
+
* @returns 去重后的新数组
|
214
|
+
*/
|
215
|
+
distinct(array: T[]): T[];
|
216
|
+
|
217
|
+
/**
|
218
|
+
* 根据 getKey 生成的 key 对数组元素分组。
|
219
|
+
* @template U
|
220
|
+
* @param array - 要分组的数组
|
221
|
+
* @param getKey - 生成分组 key 的函数
|
222
|
+
* @returns 分组后的对象或数组
|
223
|
+
*/
|
224
|
+
groupBy<U>(array: U[], getKey: (item: U) => T): [T, U[]][];
|
225
|
+
|
226
|
+
/**
|
227
|
+
* 对已排序的数组按 key 分组。
|
228
|
+
* @template V
|
229
|
+
* @param array - 已排序的数组
|
230
|
+
* @returns 分组结果
|
231
|
+
*/
|
232
|
+
groupSortedEntries<V>(array: [T, V][]): [T, V[]][];
|
233
|
+
|
234
|
+
/**
|
235
|
+
* 计算两个数组的差集。
|
236
|
+
* @param array1 - 第一个数组
|
237
|
+
* @param array2 - 第二个数组
|
238
|
+
* @returns array1 中有而 array2 中没有的元素
|
239
|
+
*/
|
240
|
+
differenceSet(array1: T[], array2: T[]): T[];
|
241
|
+
|
242
|
+
/**
|
243
|
+
* 在集合(数组)中查找元素的索引。
|
244
|
+
* @param set - 要查找的数组
|
245
|
+
* @param element - 要查找的元素
|
246
|
+
* @returns 元素在集合中的索引,未找到返回 -1
|
247
|
+
*/
|
248
|
+
findIndexInSet(set: T[], element: T): number;
|
249
|
+
|
250
|
+
/**
|
251
|
+
* 计算两个数组的交集。
|
252
|
+
* @param array1 - 第一个数组
|
253
|
+
* @param array2 - 第二个数组
|
254
|
+
* @returns 同时存在于 array1 和 array2 的元素
|
255
|
+
*/
|
256
|
+
intersectSet(array1: T[], array2: T[]): T[];
|
257
|
+
|
258
|
+
/**
|
259
|
+
* 判断两个数组作为集合是否相等。
|
260
|
+
* @param array1 - 第一个数组
|
261
|
+
* @param array2 - 第二个数组
|
262
|
+
* @returns 如果集合相等返回 true,否则返回 false
|
263
|
+
*/
|
264
|
+
isEqualset(array1: T[], array2: T[]): boolean;
|
265
|
+
|
266
|
+
/**
|
267
|
+
* 判断第一个数组是否为第二个数组的子集。
|
268
|
+
* @param array1 - 第一个数组
|
269
|
+
* @param array2 - 第二个数组
|
270
|
+
* @returns 如果 array1 是 array2 的子集返回 true,否则返回 false
|
271
|
+
*/
|
272
|
+
isSubset(array1: T[], array2: T[]): boolean;
|
273
|
+
|
274
|
+
/**
|
275
|
+
* 判断第一个数组是否为第二个数组的超集。
|
276
|
+
* @param array1 - 第一个数组
|
277
|
+
* @param array2 - 第二个数组
|
278
|
+
* @returns 如果 array1 是 array2 的超集返回 true,否则返回 false
|
279
|
+
*/
|
280
|
+
isSuperset(array1: T[], array2: T[]): boolean;
|
281
|
+
|
282
|
+
/**
|
283
|
+
* 计算两个数组的并集(去重)。
|
284
|
+
* @param array1 - 第一个数组
|
285
|
+
* @param array2 - 第二个数组
|
286
|
+
* @returns 两个数组的唯一元素合集
|
287
|
+
*/
|
288
|
+
unionSet(array1: T[], array2: T[]): T[];
|
289
|
+
|
290
|
+
/**
|
291
|
+
* 将已排序的数组转为集合(去重)。
|
292
|
+
* @param array - 已排序的数组
|
293
|
+
* @returns 唯一元素数组
|
294
|
+
*/
|
295
|
+
sortedArrayToSet(array: T[]): T[];
|
296
|
+
}
|
297
|
+
|
298
|
+
/**
|
299
|
+
* 函数优先的管道组合工具(从右向左执行)。
|
300
|
+
*
|
301
|
+
* @param fns - 要组合的函数列表。
|
302
|
+
* @returns 组合后的函数(无参数时返回恒等函数 x => x)。
|
303
|
+
* @throws {TypeError} 当参数包含非函数时抛出错误。
|
304
|
+
*/
|
305
|
+
export declare function compose(
|
306
|
+
...fns: Array<(arg: any) => any>
|
307
|
+
): (input: any) => any;
|
308
|
+
|
309
|
+
/**
|
310
|
+
* 条件分支函数,根据分支依次判断并执行。
|
311
|
+
*
|
312
|
+
* @param branches - 分支数组,每个分支可以是函数或 [predicate, action] 形式的数组。
|
313
|
+
* @returns 一个函数,调用时会依次判断分支并返回第一个匹配的结果。
|
314
|
+
*/
|
315
|
+
export declare function cond<T extends any[], R>(
|
316
|
+
branches: (
|
317
|
+
| ((...args: T) => R | undefined | void | null | false)
|
318
|
+
| [ (...args: T) => any, (...args: [...T, any]) => R ]
|
319
|
+
)[]
|
320
|
+
): (...args: T) => R | undefined;
|
321
|
+
|
322
|
+
export declare function data(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLDataElement>;
|
323
|
+
|
324
|
+
export declare function datalist(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLDataListElement>;
|
325
|
+
|
326
|
+
export declare function dd(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
327
|
+
|
328
|
+
export declare class Deep<T> {
|
329
|
+
constructor(entries: [(string | number)[], T][]);
|
330
|
+
|
331
|
+
readonly entries: [(string | number)[], T][];
|
332
|
+
readonly keys: (string | number)[][];
|
333
|
+
getValues(): T[];
|
334
|
+
|
335
|
+
/**
|
336
|
+
* 将深度数据结构转换为普通对象。
|
337
|
+
*
|
338
|
+
* @returns {Record<string|number, any>} 转换后的普通对象。
|
339
|
+
*/
|
340
|
+
toObject(): Record<string | number, any>;
|
341
|
+
|
342
|
+
findIndex(searchKeyPath: (string | number)[]): number;
|
343
|
+
|
344
|
+
structuralEqual(keys: (string | number)[][]): boolean;
|
345
|
+
structuralSubset(keys: (string | number)[][]): boolean;
|
346
|
+
structuralSuperset(keys: (string | number)[][]): boolean;
|
347
|
+
|
348
|
+
intersect(keys: (string | number)[][]): Deep<T>;
|
349
|
+
difference(keys: (string | number)[][]): Deep<T>;
|
350
|
+
/**
|
351
|
+
* 后来者赢(参数赢)
|
352
|
+
* @param entries
|
353
|
+
*/
|
354
|
+
union(entries: [(string | number)[], T][]): Deep<T>;
|
355
|
+
|
356
|
+
map<U>(
|
357
|
+
callbackfn: (value: [(string | number)[], T], index: number, array: [(string | number)[], T][]) => U,
|
358
|
+
thisArg?: any
|
359
|
+
): Deep<U>;
|
360
|
+
filter(
|
361
|
+
predicate: (value: [(string | number)[], T], index: number, array: [(string | number)[], T][]) => boolean,
|
362
|
+
thisArg?: any
|
363
|
+
): Deep<T>;
|
364
|
+
forEach(
|
365
|
+
callbackfn: (value: [(string | number)[], T], index: number, array: [(string | number)[], T][]) => void,
|
366
|
+
thisArg?: any
|
367
|
+
): void;
|
368
|
+
|
369
|
+
freshValue(obj: Record<string | number, any>): Deep<any>;
|
370
|
+
replaceValue<U>(values: U[]): Deep<U>;
|
371
|
+
zipValue<U>(values: U[]): Deep<[T, U]>;
|
372
|
+
|
373
|
+
combineLatest<U>(): Observable<Deep<U>>;
|
374
|
+
merge<U>(): Observable<[(string | number)[], U]>;
|
375
|
+
|
376
|
+
static fromObject(
|
377
|
+
obj: Record<string | number, any>,
|
378
|
+
filter?: (value: any, key: string | number, keyPath: (string | number)[]) => boolean
|
379
|
+
): Deep<any>;
|
380
|
+
static fromBehaviorSubject(obj: Record<string | number, any>): Deep<BehaviorSubject<any>>;
|
381
|
+
static fromObservable(obj: Record<string | number, any>): Deep<Observable<any>>;
|
382
|
+
}
|
383
|
+
|
384
|
+
/**
|
385
|
+
* Compares two values using the default comparison logic.
|
386
|
+
*
|
387
|
+
* @param a - The first value to compare.
|
388
|
+
* @param b - The second value to compare.
|
389
|
+
* @returns A negative number if `a` is less than `b`, 0 if they are equal, or a positive number if `a` is greater than `b`.
|
390
|
+
*/
|
391
|
+
export declare function defaultCompare<T>(a: T, b: T): number;
|
392
|
+
|
393
|
+
/**
|
394
|
+
* A comparer instance using the default comparison logic.
|
395
|
+
*/
|
396
|
+
export declare const defaultComparer: Comparer<any>;
|
397
|
+
|
398
|
+
export declare function del(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLModElement>;
|
399
|
+
|
400
|
+
export declare function details(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLDetailsElement>;
|
401
|
+
|
402
|
+
export declare function dfn(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
403
|
+
|
404
|
+
export declare function dialog(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLDialogElement>;
|
405
|
+
|
406
|
+
export declare function div(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLDivElement>;
|
407
|
+
|
408
|
+
export declare function dl(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLDListElement>;
|
409
|
+
|
410
|
+
export declare function dt(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
411
|
+
|
412
|
+
export declare function em(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
413
|
+
|
414
|
+
/**
|
415
|
+
* A comparer instance for comparing entries.
|
416
|
+
*/
|
417
|
+
export declare const entryComparer: Comparer<[(number | string)[], any]>;
|
418
|
+
|
419
|
+
/**
|
420
|
+
* 从扁平化的数据集构建嵌套的 JavaScript 对象或数组。
|
421
|
+
*
|
422
|
+
* @param entries - 扁平化的键值对数组。每个元素为 [keyPath, value],keyPath 是 (string | number)[]。
|
423
|
+
* @returns 嵌套的对象或数组。
|
424
|
+
*/
|
425
|
+
export declare function erectObject(
|
426
|
+
entries: [ (string | number)[], any ][]
|
427
|
+
): object | any[];
|
428
|
+
|
429
|
+
export declare function fieldset(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLFieldSetElement>;
|
430
|
+
|
431
|
+
export declare function figcaption(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
432
|
+
|
433
|
+
export declare function figure(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
434
|
+
|
435
|
+
/**
|
436
|
+
* Finds the last index in an array where the callback function returns `true`.
|
437
|
+
*
|
438
|
+
* @param array - The array to search.
|
439
|
+
* @param callbackFn - A function that is called for each element in the array.
|
440
|
+
* It should return `true` for the element to match.
|
441
|
+
* @param lastIndex - The starting index for the search (default is the last index of the array).
|
442
|
+
* @returns The index of the last element that satisfies the callback function, or -1 if no such element is found.
|
443
|
+
*/
|
444
|
+
export declare function findLastIndex<T>(
|
445
|
+
array: T[],
|
446
|
+
callbackFn: (value: T, index: number) => boolean,
|
447
|
+
lastIndex?: number
|
448
|
+
): number;
|
449
|
+
|
450
|
+
/**
|
451
|
+
* Flattens an object or array into an array of key paths and values.
|
452
|
+
*
|
453
|
+
* @param data - The object or array to flatten.
|
454
|
+
* @param isLeaf - A function that determines whether a property should be treated as a leaf node.
|
455
|
+
* If the function returns true, the property is treated as a leaf node.
|
456
|
+
* The function receives (value, key, keyPath) as arguments.
|
457
|
+
* @returns An array of tuples, where each tuple contains a key path (array of string or number) and the corresponding value.
|
458
|
+
*/
|
459
|
+
export declare function flat(
|
460
|
+
data: Record<string | number, any>,
|
461
|
+
isLeaf: (
|
462
|
+
value: any,
|
463
|
+
key: string | number,
|
464
|
+
keyPath: (string | number)[]) => boolean
|
465
|
+
): [(string | number)[], any][];
|
466
|
+
|
467
|
+
/**
|
468
|
+
* 动态切换两个元素或元素数组的显示状态。
|
469
|
+
*
|
470
|
+
* @param yinHidden$ - 一个 Observable,表示 yin 是否隐藏。
|
471
|
+
* @param yin - 需要动态控制显示状态的第一个元素或元素数组。
|
472
|
+
* @param yang - 需要动态控制显示状态的第二个元素或元素数组。
|
473
|
+
* @returns 包含所有元素的数组。
|
474
|
+
*/
|
475
|
+
export declare function flip(
|
476
|
+
yinHidden$: Observable<boolean>,
|
477
|
+
yin: HTMLElement | HTMLElement[],
|
478
|
+
yang: HTMLElement | HTMLElement[]
|
479
|
+
): HTMLElement[];
|
480
|
+
|
481
|
+
/**
|
482
|
+
* 通用折叠(归约)函数,支持自定义迭代逻辑。
|
483
|
+
*
|
484
|
+
* @param fn - 迭代函数,接收 (acc, seed),返回 [newAcc, nextSeed] 或 [newAcc] 或 null/undefined 结束。
|
485
|
+
* @param acc - 初始累加值。
|
486
|
+
* @param seed - 初始种子值。
|
487
|
+
* @returns 折叠后的累加结果。
|
488
|
+
*/
|
489
|
+
export declare function fold<A, S>(
|
490
|
+
fn: (acc: A, seed: S) => [A, S] | [A] | [] | null | undefined,
|
491
|
+
acc: A,
|
492
|
+
seed: S
|
493
|
+
): A;
|
494
|
+
|
495
|
+
export declare function footer(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
496
|
+
|
497
|
+
export declare function form(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLFormElement>;
|
498
|
+
|
499
|
+
/**
|
500
|
+
* 插入一组元素,返回包含所有子节点的 DocumentFragment。
|
501
|
+
*
|
502
|
+
* @param childNodes - 要插入的子节点,可以是单个节点、多个节点或节点数组。
|
503
|
+
* @returns 包含所有子节点的 DocumentFragment。
|
504
|
+
* @throws 如果传入的子节点不是有效的 DOM 节点会抛出错误。
|
505
|
+
*/
|
506
|
+
export declare function fragment(
|
507
|
+
...childNodes: (Node | Node[])[]
|
508
|
+
): DocumentFragment;
|
509
|
+
|
510
|
+
/**
|
511
|
+
* 获取 HTML 元素的默认 CSS `display` 值。
|
512
|
+
*
|
513
|
+
* @param elem - 要获取 `display` 值的 HTML 元素。
|
514
|
+
* @returns 元素的默认 `display` 值,如 'block'、'inline'、'table-row'、'unset' 等。
|
515
|
+
*/
|
516
|
+
export declare function getDisplay(elem: HTMLElement): string;
|
517
|
+
|
518
|
+
/**
|
519
|
+
* 根据属性路径数组读取对象的嵌套属性值。
|
520
|
+
*
|
521
|
+
* @param obj - 要读取属性的对象。
|
522
|
+
* @param keyPath - 属性路径数组,例如 ['a', 'b'] 表示 obj.a.b。
|
523
|
+
* @returns 返回目标属性的值,如果路径为空数组,则返回对象本身。
|
524
|
+
* @throws 如果路径中的某一级属性不存在或输入无效会抛出错误。
|
525
|
+
*/
|
526
|
+
export declare function getNestedProperty(
|
527
|
+
obj: Record<string | number, any>,
|
528
|
+
keyPath: (string | number)[]
|
529
|
+
): any;
|
530
|
+
|
531
|
+
/**
|
532
|
+
* 按第一层 key 对扁平化 entries 分组。
|
533
|
+
*
|
534
|
+
* @param flatEntries - 扁平化的键值对数组。每个元素为 [[key, ...keyPath], value]。
|
535
|
+
* @returns 分组后的数组,每组为 [key, group],group 是 [[keyPath, value]][]。
|
536
|
+
*/
|
537
|
+
export declare function groupByFirstLevelKey(
|
538
|
+
flatEntries: [ (string | number)[], any ][]
|
539
|
+
): [ string | number, [ (string | number)[], any ][] ][];
|
540
|
+
|
541
|
+
export declare function h1(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLHeadingElement>;
|
542
|
+
|
543
|
+
export declare function h2(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLHeadingElement>;
|
544
|
+
|
545
|
+
export declare function h3(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLHeadingElement>;
|
546
|
+
|
547
|
+
export declare function h4(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLHeadingElement>;
|
548
|
+
|
549
|
+
export declare function h5(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLHeadingElement>;
|
550
|
+
|
551
|
+
export declare function h6(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLHeadingElement>;
|
552
|
+
|
553
|
+
export declare function header(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
554
|
+
|
555
|
+
export declare function hgroup(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
556
|
+
|
557
|
+
export declare function hr(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLHRElement>;
|
558
|
+
|
559
|
+
/**
|
560
|
+
* Creates an HTML element with extended event handling capabilities
|
561
|
+
* @public
|
562
|
+
* @param elemName The HTML element tag name
|
563
|
+
* @param args Optional properties and child nodes
|
564
|
+
* @returns The created element with extended methods
|
565
|
+
* @throws If elemName is not a valid HTML element tag name
|
566
|
+
*/
|
567
|
+
export declare function hyperscript(
|
568
|
+
elemName: string,
|
569
|
+
...args: any[]
|
570
|
+
): HyperscriptExtensions<HTMLElement>;
|
571
|
+
|
572
|
+
declare type HyperscriptExtensions<T extends HTMLElement> =
|
573
|
+
T & {
|
574
|
+
|
575
|
+
pipeEvent(
|
576
|
+
event: string,
|
577
|
+
subscriber: (input$: Observable<Event>) => Subscription
|
578
|
+
): HyperscriptExtensions<T>;
|
579
|
+
|
580
|
+
subscribeEvent(
|
581
|
+
event: string,
|
582
|
+
observer: ((value: Event) => void) | Partial<Observer<Event>>
|
583
|
+
): HyperscriptExtensions<T>;
|
584
|
+
|
585
|
+
unsubscribe(): void;
|
586
|
+
|
587
|
+
subscription?: Subscription;
|
588
|
+
|
589
|
+
};
|
590
|
+
|
591
|
+
export declare function i(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
592
|
+
|
593
|
+
export declare function img(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLImageElement>;
|
594
|
+
|
595
|
+
/**
|
596
|
+
* 一个包含所有 HTML 内联元素标签名称(大写)的集合。
|
597
|
+
* 用于判断某个标签是否为内联元素。
|
598
|
+
*/
|
599
|
+
export declare const inlineFamily: Set<string>;
|
600
|
+
|
601
|
+
export declare function input(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLInputElement>;
|
602
|
+
|
603
|
+
export declare function ins(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLModElement>;
|
604
|
+
|
605
|
+
/**
|
606
|
+
* 创建一个新对象,仅包含指定 keys 的属性。
|
607
|
+
*
|
608
|
+
* @param obj - 源对象。
|
609
|
+
* @param keys - 要保留的属性名数组。
|
610
|
+
* @returns 新对象,仅包含指定属性。
|
611
|
+
* @throws 如果 obj 不是对象或 keys 不是数组会抛出 TypeError。
|
612
|
+
*/
|
613
|
+
export declare function intersectObject(
|
614
|
+
obj: Record<string,any>,
|
615
|
+
keys: string[]
|
616
|
+
): Record<string,any>;
|
617
|
+
|
618
|
+
/**
|
619
|
+
* 判断对象是否为空对象(非数组、非 null,且无自有属性)。
|
620
|
+
*
|
621
|
+
* @param obj - 要判断的对象。
|
622
|
+
* @returns 如果是空对象返回 true,否则返回 false。
|
623
|
+
*/
|
624
|
+
export declare function isEmptyObject(obj: unknown): boolean;
|
625
|
+
|
626
|
+
/**
|
627
|
+
* 检查给定对象是否为 DOM Node(元素节点或文本节点)。
|
628
|
+
*
|
629
|
+
* @param obj - 要检查的对象。
|
630
|
+
* @returns 如果是 DOM Node 返回 true,否则返回 false。
|
631
|
+
*/
|
632
|
+
export declare function isNode(obj: any): boolean;
|
633
|
+
|
634
|
+
/**
|
635
|
+
* Checks if the input array represents a range of consecutive numbers starting from 0.
|
636
|
+
*
|
637
|
+
* @param keys - An array of strings to check.
|
638
|
+
* @returns `true` if the array represents a range of consecutive numbers starting from 0, otherwise `false`.
|
639
|
+
*/
|
640
|
+
export declare function isRange(keys: string[]): boolean;
|
641
|
+
|
642
|
+
/**
|
643
|
+
* 检查对象是否为 RxJS 类型。
|
644
|
+
*
|
645
|
+
* `isRxType` 函数用于判断给定的对象是否为 RxJS 的 `Observable` 或 `Subscription` 类型。
|
646
|
+
*
|
647
|
+
* @param obj - 要检查的对象。
|
648
|
+
* @returns 如果对象是 `Observable` 或 `Subscription`,返回 `true`;否则返回 `false`。
|
649
|
+
*/
|
650
|
+
export declare function isRxType(obj: any): boolean;
|
651
|
+
|
652
|
+
export declare function kbd(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
653
|
+
|
654
|
+
/**
|
655
|
+
* A comparer instance for comparing keys.
|
656
|
+
*/
|
657
|
+
export declare const keyComparer: Comparer<number | string>;
|
658
|
+
|
659
|
+
/**
|
660
|
+
* A comparer instance for comparing key paths.
|
661
|
+
*/
|
662
|
+
export declare const keyPathComparer: Comparer<(number | string)[]>;
|
663
|
+
|
664
|
+
export declare function label(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLLabelElement>;
|
665
|
+
|
666
|
+
export declare function legend(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLLegendElement>;
|
667
|
+
|
668
|
+
export declare function li(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLLIElement>;
|
669
|
+
|
670
|
+
export declare function main(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
671
|
+
|
672
|
+
export declare function mark(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
673
|
+
|
674
|
+
export declare function menu(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLMenuElement>;
|
675
|
+
|
676
|
+
export declare function menuitem(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
677
|
+
|
678
|
+
export declare function meter(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLMeterElement>;
|
679
|
+
|
680
|
+
/**
|
681
|
+
* 创建一个支持多选功能的 <select> 元素,并绑定选项的选中状态。
|
682
|
+
* 必须手动添加控件更新 BehaviorSubject 的事件。
|
683
|
+
*
|
684
|
+
* @param props - 配置对象,包含 <select> 元素的属性。
|
685
|
+
* @param options - 一个或多个 <option> 元素,必须是 HTMLOptionElement 类型。
|
686
|
+
* @returns 创建的 <select> 元素。
|
687
|
+
* @throws 如果 props 不是对象,或者 options 中的选项未正确定义 selected 属性会抛出错误。
|
688
|
+
*/
|
689
|
+
export declare function multiselect(
|
690
|
+
props: {
|
691
|
+
oninput?: (e: Event) => void,
|
692
|
+
onchange?: (e: Event) => void,
|
693
|
+
[key: string]: any },
|
694
|
+
...options: HTMLOptionElement[]
|
695
|
+
): HyperscriptExtensions<HTMLSelectElement>;
|
696
|
+
|
697
|
+
export declare function nav(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
698
|
+
|
699
|
+
/**
|
700
|
+
* 将对象格式的 Observable 转换为扁平对象的 Observable。
|
701
|
+
*
|
702
|
+
* @param model - 对象格式的 Observable。
|
703
|
+
* @returns 一个 Observable,发出扁平化后的对象。
|
704
|
+
*/
|
705
|
+
export declare function nestedCombineLatest(
|
706
|
+
model: Record<string|number, any>,
|
707
|
+
): Observable<Record<string|number, any>>;
|
708
|
+
|
709
|
+
/**
|
710
|
+
* 追踪对象属性的变化,返回变化属性的键路径和新值。
|
711
|
+
*
|
712
|
+
* @param model - 任意对象或可观察对象。
|
713
|
+
* @returns 合并后的 Observable。
|
714
|
+
*/
|
715
|
+
export declare function nestedMerge(
|
716
|
+
model: Record<string|number, any>
|
717
|
+
): Observable<[ (string | number)[], any ]>;
|
718
|
+
|
719
|
+
/**
|
720
|
+
* 规范化子节点,将非节点转换为文本节点。
|
721
|
+
*
|
722
|
+
* @param childNodes - 子节点数组。
|
723
|
+
* @returns 返回规范化后的节点数组。
|
724
|
+
*/
|
725
|
+
export declare function normalizeChildNodes(
|
726
|
+
childNodes: any[]
|
727
|
+
): Node[];
|
728
|
+
|
729
|
+
/**
|
730
|
+
* 创建一个支持双向绑定的数字输入框。
|
731
|
+
*
|
732
|
+
* @param props - 配置对象,必须包含 number(BehaviorSubject<number>),其余为 <input> 元素属性。
|
733
|
+
* @returns 创建的数字输入框元素。
|
734
|
+
* @throws 如果 props 不是对象,或者 number 不是 BehaviorSubject 会抛出错误。
|
735
|
+
*/
|
736
|
+
export declare function numberbox(props: {
|
737
|
+
number: BehaviorSubject<number>;
|
738
|
+
[key: string]: any;
|
739
|
+
}): HyperscriptExtensions<HTMLInputElement>;
|
740
|
+
|
741
|
+
/**
|
742
|
+
* ObservableArray 是一个可观察的数组,支持 insertBefore、removeChild、replaceChild 操作,
|
743
|
+
* 并通过 RxJS Subject 通知变化,适用于响应式 DOM 操作场景。
|
744
|
+
*/
|
745
|
+
export declare class ObservableArray<T = any> extends Array<T> {
|
746
|
+
/**
|
747
|
+
* 变化通知的 Subject。
|
748
|
+
* 事件元组类型: ['insertBefore', T, number] | ['removeChild', number] | ['replaceChild', T, number]
|
749
|
+
*/
|
750
|
+
action$: Subject<['insertBefore', T, number] | ['removeChild', number] | ['replaceChild', T, number]>;
|
751
|
+
|
752
|
+
/**
|
753
|
+
* 插入元素事件流,发出 [item, index]。
|
754
|
+
*/
|
755
|
+
insertBefore$: Observable<[T, number]>;
|
756
|
+
|
757
|
+
/**
|
758
|
+
* 删除元素事件流,发出 index。
|
759
|
+
*/
|
760
|
+
removeChild$: Observable<number>;
|
761
|
+
|
762
|
+
/**
|
763
|
+
* 替换元素事件流,发出 [item, index]。
|
764
|
+
*/
|
765
|
+
replaceChild$: Observable<[T, number]>;
|
766
|
+
|
767
|
+
constructor();
|
768
|
+
|
769
|
+
/**
|
770
|
+
* 在指定位置插入元素,并通知变化。
|
771
|
+
* @param item 要插入的元素
|
772
|
+
* @param index 插入位置,默认为数组末尾
|
773
|
+
*/
|
774
|
+
insertBefore(item: T, index?: number): void;
|
775
|
+
|
776
|
+
/**
|
777
|
+
* 删除指定位置的元素,并通知变化。
|
778
|
+
* @param index 删除位置,默认为数组末尾
|
779
|
+
*/
|
780
|
+
removeChild(index?: number): void;
|
781
|
+
|
782
|
+
/**
|
783
|
+
* 替换指定位置的元素,并通知变化。
|
784
|
+
* @param item 新元素
|
785
|
+
* @param index 替换位置
|
786
|
+
*/
|
787
|
+
replaceChild(item: T, index: number): void;
|
788
|
+
|
789
|
+
/**
|
790
|
+
* 附加一个默认子元素
|
791
|
+
*/
|
792
|
+
appendChild(): void;
|
793
|
+
}
|
794
|
+
|
795
|
+
export declare function ol(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLOListElement>;
|
796
|
+
|
797
|
+
export declare function optgroup(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLOptGroupElement>;
|
798
|
+
|
799
|
+
export declare function option(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLOptionElement>;
|
800
|
+
|
801
|
+
export declare function output(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLOutputElement>;
|
802
|
+
|
803
|
+
export declare function p(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLParagraphElement>;
|
804
|
+
|
805
|
+
/**
|
806
|
+
* 解析 hyperscript 风格的参数,返回 props 和 childNodes。
|
807
|
+
*
|
808
|
+
* @param args - hyperscript 风格的参数数组。
|
809
|
+
* @returns 包含 props(对象)和 childNodes(数组)的对象。
|
810
|
+
* @throws 如果参数不是数组会抛出错误。
|
811
|
+
*/
|
812
|
+
export declare function parseHyperscriptArgs(
|
813
|
+
args: any[]
|
814
|
+
): { props: Record<string, any>, childNodes: any[] };
|
815
|
+
|
816
|
+
/**
|
817
|
+
* 解析嵌套的 DOM 属性路径,并返回目标对象和属性名。
|
818
|
+
*
|
819
|
+
* @param props - 属性路径字符串,支持嵌套属性(如 "style.color")。
|
820
|
+
* @param obj - 起始对象,通常是一个 DOM 元素。
|
821
|
+
* @returns [目标对象, 属性名],如 [obj.style, "color"]。
|
822
|
+
* @throws 如果路径中的某一级属性不存在或输入无效会抛出错误。
|
823
|
+
*/
|
824
|
+
export declare function parsePropName(
|
825
|
+
props: string,
|
826
|
+
obj: Record<string, any>
|
827
|
+
): [Record<string, any>, string];
|
828
|
+
|
829
|
+
/**
|
830
|
+
*
|
831
|
+
* 拾取对象中的 BehaviorSubject 值,作为叶子节点,忽略其他值。
|
832
|
+
*
|
833
|
+
* @param model - 任意对象,内部递归查找 BehaviorSubject。
|
834
|
+
* @returns 只包含 BehaviorSubject 当前值的对象或数组结构。
|
835
|
+
* @throws 如果结构不符合预期会抛出错误。
|
836
|
+
*
|
837
|
+
*/
|
838
|
+
export declare function pickBehaviorSubject(
|
839
|
+
model: Record<string | number, any> & { pickeys?: string[] }
|
840
|
+
): Record<string | number, any>;
|
841
|
+
|
842
|
+
/**
|
843
|
+
* 数据优先的管道处理工具(从左向右执行)。
|
844
|
+
* 适合一次性数据处理流程。
|
845
|
+
*
|
846
|
+
* @param initialValue - 初始值。
|
847
|
+
* @param fns - 要应用的函数管道(从左向右执行)。
|
848
|
+
* @returns 经过管道处理后的结果。
|
849
|
+
* @throws {TypeError} 当参数包含非函数时抛出错误。
|
850
|
+
*/
|
851
|
+
export declare function pipe(
|
852
|
+
initialValue: any,
|
853
|
+
...fns: Array<(arg: any) => any>
|
854
|
+
): any;
|
855
|
+
|
856
|
+
/**
|
857
|
+
* 为指定的 DOM 元素订阅事件流,并通过 pipe 对事件流进行处理。
|
858
|
+
*
|
859
|
+
* @param elem - 要订阅事件的 DOM 元素。
|
860
|
+
* @returns 一个函数,接受事件名称和处理函数(接收事件流 Observable,返回 Subscription),用于订阅和处理事件,返回元素本身。
|
861
|
+
* @throws 如果参数无效会抛出错误。
|
862
|
+
*/
|
863
|
+
export declare function pipeEvent(
|
864
|
+
elem: HTMLElement
|
865
|
+
): (
|
866
|
+
event: string,
|
867
|
+
subscriber: (event$: Observable<Event>) => Subscription
|
868
|
+
) => HTMLElement;
|
869
|
+
|
870
|
+
/**
|
871
|
+
* 获取对象的嵌套属性。
|
872
|
+
*
|
873
|
+
* @param obj - 源对象或数组。
|
874
|
+
* @param keyPath - 属性访问路径数组。
|
875
|
+
* @returns 路径对应的属性值。
|
876
|
+
* @throws 当路径不存在时抛出 TypeError。
|
877
|
+
*/
|
878
|
+
export declare function pluckProperty(
|
879
|
+
obj: Record<string | number, any>,
|
880
|
+
keyPath: (string | number)[]
|
881
|
+
): any;
|
882
|
+
|
883
|
+
export declare function pre(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLPreElement>;
|
884
|
+
|
885
|
+
export declare function progress(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLProgressElement>;
|
886
|
+
|
887
|
+
export declare function q(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLQuoteElement>;
|
888
|
+
|
889
|
+
/**
|
890
|
+
* 将普通对象序列化为 URL 查询字符串(?key=value&...),对象和数组字段会被序列化为字符串。
|
891
|
+
*
|
892
|
+
* @param data - 需要序列化的普通对象(不能为数组或 null)。
|
893
|
+
* @returns 查询字符串(如无有效字段则返回空字符串)。
|
894
|
+
* @throws 如果输入不是普通对象会抛出错误。
|
895
|
+
*/
|
896
|
+
export declare function queryStringify(data: Record<string, any>): string;
|
897
|
+
|
898
|
+
/**
|
899
|
+
* 创建一个支持 RxJS 数据绑定的 <input type="radio"> 单选按钮。
|
900
|
+
*
|
901
|
+
* @param props - 配置对象,必须包含 checked(BehaviorSubject<boolean>)。
|
902
|
+
* @returns 创建的 <input type="radio"> 元素。
|
903
|
+
* @throws 如果 props 不是对象,或者 checked 不是 BehaviorSubject 会抛出错误。
|
904
|
+
*/
|
905
|
+
export declare function radio(props: {
|
906
|
+
checked: BehaviorSubject<boolean>,
|
907
|
+
[key: string]: any
|
908
|
+
}): HyperscriptExtensions<HTMLInputElement>;
|
909
|
+
|
910
|
+
/**
|
911
|
+
* Creates an array of numbers from 0 to `length - 1`.
|
912
|
+
*
|
913
|
+
* @param length - The length of the array to create.
|
914
|
+
* @returns An array of numbers from 0 to `length - 1`.
|
915
|
+
*/
|
916
|
+
export declare function rangeArray(length: number): number[];
|
917
|
+
|
918
|
+
export declare function rb(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
919
|
+
|
920
|
+
/**
|
921
|
+
* 更新 ViewModel 为新值 src,递归同步 BehaviorSubject、ObservableArray、数组和对象的内容。
|
922
|
+
*
|
923
|
+
* @param model - 需要更新的 ViewModel(可为 BehaviorSubject、ObservableArray、数组或对象)。
|
924
|
+
* @param src - 新值,结构应与 model 对应。
|
925
|
+
* @returns 返回更新后的 model。
|
926
|
+
*/
|
927
|
+
export declare function restore(
|
928
|
+
model: Record<string | number, any>,
|
929
|
+
src: Record<string | number, any>
|
930
|
+
): Record<string | number, any>;
|
931
|
+
|
932
|
+
export declare function rp(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
933
|
+
|
934
|
+
export declare function rt(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
935
|
+
|
936
|
+
export declare function rtc(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
937
|
+
|
938
|
+
export declare function ruby(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
939
|
+
|
940
|
+
export declare function s(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
941
|
+
|
942
|
+
export declare function samp(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
943
|
+
|
944
|
+
export declare function section(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
945
|
+
|
946
|
+
/**
|
947
|
+
* 创建一个支持 RxJS 数据绑定的 <select> 元素(仅单选)。
|
948
|
+
*
|
949
|
+
* @param props - 配置对象,包含 <select> 元素的属性,可选 selectedIndex/value(BehaviorSubject)。
|
950
|
+
* @param options - 一个或多个 <option> 元素。
|
951
|
+
* @returns 创建的 <select> 元素。
|
952
|
+
* @throws 如果 props 不是对象,或者 selectedIndex/value 不是 BehaviorSubject 会抛出错误。
|
953
|
+
*/
|
954
|
+
export declare function select(
|
955
|
+
props: {
|
956
|
+
selectedIndex?: BehaviorSubject<number>,
|
957
|
+
value?: BehaviorSubject<string>,
|
958
|
+
[key: string]: any
|
959
|
+
},
|
960
|
+
...options: HTMLOptionElement[]
|
961
|
+
): HyperscriptExtensions<HTMLSelectElement>;
|
962
|
+
|
963
|
+
/**
|
964
|
+
* 设置一个元素对象的任意嵌套路径属性的值。
|
965
|
+
* 如果是 CSS 类名,值为真则添加类名,值为假则移除类名。
|
966
|
+
* 如果是普通属性或嵌套属性则设置该属性值。
|
967
|
+
*
|
968
|
+
* @param root - 要设置属性的 DOM 元素。
|
969
|
+
* @param key - 属性名称,支持普通属性、嵌套属性(如 "style.color")或以 "." 开头的类名(如 ".active")。
|
970
|
+
* @param value - 要设置的属性值。如果是布尔值,用于控制类名的添加或移除。
|
971
|
+
* @returns 返回元素本身,支持链式调用。
|
972
|
+
* @throws 如果参数无效或设置失败会抛出错误。
|
973
|
+
*/
|
974
|
+
export declare function setProp(
|
975
|
+
root: HTMLElement,
|
976
|
+
key: string,
|
977
|
+
value: any
|
978
|
+
): HTMLElement;
|
979
|
+
|
980
|
+
/**
|
981
|
+
* 为 DOM 元素设置属性,包括静态属性和动态属性(Observable)。
|
982
|
+
*
|
983
|
+
* @param element - 要设置属性的 DOM 元素。
|
984
|
+
* @param props - 包含属性键值对的对象,其中值可以是普通值或 Observable。
|
985
|
+
* @returns 返回元素本身,支持链式调用。
|
986
|
+
* @throws 如果参数无效或设置属性失败会抛出错误。
|
987
|
+
*/
|
988
|
+
export declare function setProps(
|
989
|
+
element: HTMLElement,
|
990
|
+
props: Record<string, any | Observable<any>>
|
991
|
+
): HTMLElement;
|
992
|
+
|
993
|
+
export declare function small(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
994
|
+
|
995
|
+
export declare function span(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLSpanElement>;
|
996
|
+
|
997
|
+
/**
|
998
|
+
* 将对象属性按类型分为两部分:可观察对象(Observable)与普通值(非 Observable)。
|
999
|
+
*
|
1000
|
+
* @param obj - 要分割的对象,其属性值可能是 Observable 或普通值。
|
1001
|
+
* @returns 一个数组,第一个对象包含所有 Observable 属性,第二个对象包含所有非 Observable 属性。
|
1002
|
+
* @throws 如果参数不是一个非空对象会抛出错误。
|
1003
|
+
*/
|
1004
|
+
export declare function splitObjectByObservable(
|
1005
|
+
obj: Record<string, any>
|
1006
|
+
): [Record<string, Observable<any>>, Record<string, any>];
|
1007
|
+
|
1008
|
+
export declare function strong(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
1009
|
+
|
1010
|
+
export declare function sub(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
1011
|
+
|
1012
|
+
/**
|
1013
|
+
* 为指定的 DOM 元素订阅事件流,并将订阅与元素绑定,便于管理。
|
1014
|
+
*
|
1015
|
+
* @param elem - 要订阅事件的 DOM 元素。
|
1016
|
+
* @returns 一个函数,接受事件名称和观察者(函数或观察者对象),用于订阅事件,返回元素本身。
|
1017
|
+
* @throws 如果参数无效会抛出错误。
|
1018
|
+
*/
|
1019
|
+
export declare function subscribeEvent(
|
1020
|
+
elem: HTMLElement
|
1021
|
+
): (
|
1022
|
+
event: string,
|
1023
|
+
observer: ((value: Event) => void) | Partial<Observer<Event>>
|
1024
|
+
) => HTMLElement;
|
1025
|
+
|
1026
|
+
/**
|
1027
|
+
* 订阅一个 Observable,将其发出的值动态设置为指定 DOM 元素的属性值。
|
1028
|
+
*
|
1029
|
+
* @param element - 要设置属性的 DOM 元素。
|
1030
|
+
* @param key - 属性名称,支持普通属性、嵌套属性(如 "style.color")或以 "." 开头的类名(如 ".active")。
|
1031
|
+
* @param value$ - 一个 RxJS Observable ,用于发出属性值。
|
1032
|
+
* @returns 返回元素本身,支持链式调用。
|
1033
|
+
* @throws 如果参数无效或订阅失败会抛出错误。
|
1034
|
+
*/
|
1035
|
+
export declare function subscribeProp(
|
1036
|
+
element: HTMLElement,
|
1037
|
+
key: string,
|
1038
|
+
value$: Observable<any>
|
1039
|
+
): HTMLElement;
|
1040
|
+
|
1041
|
+
export declare function summary(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
1042
|
+
|
1043
|
+
export declare function sup(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
1044
|
+
|
1045
|
+
/**
|
1046
|
+
* 创建静态选项卡组件。
|
1047
|
+
*
|
1048
|
+
* @param props - 选项卡组件的属性,必须包含 tabIndex(BehaviorSubject<number>),可选 rootProps。
|
1049
|
+
* @param tabs - 导航按钮的内容数组,可以是字符串或 HTML 元素。
|
1050
|
+
* @param panels - 内容面板的内容数组,可以是字符串或 HTML 元素。
|
1051
|
+
* @returns 返回一个包含导航栏和内容面板的选项卡组件。
|
1052
|
+
*/
|
1053
|
+
export declare function tabControl(
|
1054
|
+
props: {
|
1055
|
+
tabIndex: BehaviorSubject<number>,
|
1056
|
+
[key: string]: any
|
1057
|
+
},
|
1058
|
+
tabs: Array<string | HTMLElement>,
|
1059
|
+
panels: Array<string | HTMLElement>
|
1060
|
+
): HTMLElement;
|
1061
|
+
|
1062
|
+
export declare function table(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableElement>;
|
1063
|
+
|
1064
|
+
/**
|
1065
|
+
* 选项卡的导航按钮。
|
1066
|
+
*
|
1067
|
+
* @param source - 按钮的内容,可以是字符串或 HTML 元素。
|
1068
|
+
* @returns 返回一个带有 `nav-item` 样式类的 <li> 元素,内部包含一个按钮。
|
1069
|
+
*/
|
1070
|
+
export declare function tabNavItem(
|
1071
|
+
...source: (string | HTMLElement)[]
|
1072
|
+
): HTMLElement;
|
1073
|
+
|
1074
|
+
/**
|
1075
|
+
* 选项卡的内容面板。
|
1076
|
+
*
|
1077
|
+
* @param source - 面板的内容,可以是字符串或 HTML 元素。
|
1078
|
+
* @returns 返回一个带有 `tab-pane` 样式类的 <div> 元素。
|
1079
|
+
*/
|
1080
|
+
export declare function tabPanel(
|
1081
|
+
...source: (string | HTMLElement)[]
|
1082
|
+
): HTMLElement;
|
1083
|
+
|
1084
|
+
/**
|
1085
|
+
* 选项卡组件的基础框架。
|
1086
|
+
*
|
1087
|
+
* @param props - 传递给根容器 <div> 的属性(如 id、className 等)。
|
1088
|
+
* @returns 返回一个包含导航栏和内容面板的 <div> 元素。
|
1089
|
+
*/
|
1090
|
+
export declare function tabRoot(props: { [key: string]: any }): HTMLElement;
|
1091
|
+
|
1092
|
+
export declare function tbody(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableSectionElement>;
|
1093
|
+
|
1094
|
+
export declare function td(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableCellElement>;
|
1095
|
+
|
1096
|
+
/**
|
1097
|
+
* 创建一个支持 RxJS 数据绑定的 <textarea> 元素。
|
1098
|
+
*
|
1099
|
+
* @param props - 配置对象,包含 <textarea> 元素的属性,必须包含 value(BehaviorSubject<string>)。
|
1100
|
+
* @returns 创建的 <textarea> 元素。
|
1101
|
+
* @throws 如果 props 不是对象,或者 value 不是 BehaviorSubject 会抛出错误。
|
1102
|
+
*/
|
1103
|
+
export declare function textarea(
|
1104
|
+
props: {
|
1105
|
+
value: BehaviorSubject<string>,
|
1106
|
+
[key: string]: any
|
1107
|
+
}
|
1108
|
+
): HyperscriptExtensions<HTMLTextAreaElement>;
|
1109
|
+
|
1110
|
+
/**
|
1111
|
+
* 创建一个支持 RxJS 数据绑定的 <input type="text"> 元素。
|
1112
|
+
*
|
1113
|
+
* @param props - 配置对象,包含 <input> 元素的属性,必须包含 value(BehaviorSubject<string>)。
|
1114
|
+
* @returns 创建的 <input type="text"> 元素。
|
1115
|
+
* @throws 如果 props 不是对象,或者 value 不是 BehaviorSubject 会抛出错误。
|
1116
|
+
*/
|
1117
|
+
export declare function textbox(props: {
|
1118
|
+
value: BehaviorSubject<string>,
|
1119
|
+
[key: string]: any
|
1120
|
+
}): HyperscriptExtensions<HTMLInputElement>;
|
1121
|
+
|
1122
|
+
/**
|
1123
|
+
* 创建一个文本节点,支持静态文本和基于 Observable 的动态文本。
|
1124
|
+
*
|
1125
|
+
* @param text - 静态文本(string)或 RxJS Observable。
|
1126
|
+
* @returns 文本节点,若为动态文本节点则带有 unsubscribe 方法。
|
1127
|
+
*/
|
1128
|
+
export declare function textNode(
|
1129
|
+
text: string | Observable<string>
|
1130
|
+
): Text & { subscription?: Subscription, unsubscribe?: () => void };
|
1131
|
+
|
1132
|
+
export declare function tfoot(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableSectionElement>;
|
1133
|
+
|
1134
|
+
export declare function th(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableCellElement>;
|
1135
|
+
|
1136
|
+
export declare function thead(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableSectionElement>;
|
1137
|
+
|
1138
|
+
export declare function time(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTimeElement>;
|
1139
|
+
|
1140
|
+
/**
|
1141
|
+
* 将扁平化的键值对数组转换为嵌套的 JavaScript 对象或数组。
|
1142
|
+
*
|
1143
|
+
* @param flatEntries - 扁平化的键值对数组。每个元素为 [keyPath, value],keyPath 是 (string | number)[]。
|
1144
|
+
* @returns 嵌套的对象或数组。
|
1145
|
+
*/
|
1146
|
+
export declare function tojs(
|
1147
|
+
flatEntries: [ (string | number)[], any ][]
|
1148
|
+
): Record<string|number, any>;
|
1149
|
+
|
1150
|
+
export declare function tr(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTableRowElement>;
|
1151
|
+
|
1152
|
+
export declare function track(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLTrackElement>;
|
1153
|
+
|
1154
|
+
export declare function tt(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
1155
|
+
|
1156
|
+
/**
|
1157
|
+
* JavaScript 基本数据类型名称数组
|
1158
|
+
* typeof 返回的所有类型字符串
|
1159
|
+
*/
|
1160
|
+
export declare const types: string[];
|
1161
|
+
|
1162
|
+
export declare function u(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
1163
|
+
|
1164
|
+
export declare function ul(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLUListElement>;
|
1165
|
+
|
1166
|
+
/**
|
1167
|
+
* 通过不断调用 fn 生成值,直到 fn 返回 falsy。
|
1168
|
+
*
|
1169
|
+
* @param fn - 生成函数,接收当前 seed,返回 [value, nextSeed] 或 falsy。
|
1170
|
+
* @param seed - 初始种子值。
|
1171
|
+
* @returns 由 fn 生成的所有 value 组成的数组。
|
1172
|
+
*/
|
1173
|
+
export declare function unfold<T, S>(
|
1174
|
+
fn: (seed: S) => [T, S] | false | null | undefined,
|
1175
|
+
seed: S
|
1176
|
+
): T[];
|
1177
|
+
|
1178
|
+
/**
|
1179
|
+
* 将任意值序列化为“无引号 JSON”格式的字符串。
|
1180
|
+
*
|
1181
|
+
* @param value - 需要序列化的任意值。
|
1182
|
+
* @returns 无引号 JSON 格式的字符串。
|
1183
|
+
*/
|
1184
|
+
export declare function unquotedJsonStringify(value: any): string;
|
1185
|
+
|
1186
|
+
/**
|
1187
|
+
* unwraps an array of arguments simply. If the array contains a single element that is itself an array,
|
1188
|
+
* it unwraps and returns that element. Otherwise, it returns the original array.
|
1189
|
+
*
|
1190
|
+
* @param args - The array of arguments to process.
|
1191
|
+
* @returns The unwrapped array if the input is a single array, otherwise the original array.
|
1192
|
+
*/
|
1193
|
+
export declare function unwrapArgs<T>(
|
1194
|
+
args: (T|T[])[]
|
1195
|
+
): T[];
|
1196
|
+
|
1197
|
+
export declare function video(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLVideoElement>;
|
1198
|
+
|
1199
|
+
export declare function wbr(props?: { [_: string]: any }, ...childNodes: any[]): HyperscriptExtensions<HTMLElement>;
|
1200
|
+
|
1201
|
+
/**
|
1202
|
+
* Combines two arrays into an array of tuples.
|
1203
|
+
*
|
1204
|
+
* - If the arrays have different lengths, the longer array will be truncated to match the length of the shorter array.
|
1205
|
+
*
|
1206
|
+
* @param a - The first array.
|
1207
|
+
* @param b - The second array.
|
1208
|
+
* @returns An array of tuples, where each tuple contains one element from `a` and one from `b`.
|
1209
|
+
* @throws Will throw an error if either `a` or `b` is not an array.
|
1210
|
+
*/
|
1211
|
+
export declare function zipArray<T, U>(a: T[], b: U[]): [T, U][];
|
1212
|
+
|
1213
|
+
export { }
|
@@ -0,0 +1,11 @@
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
3
|
+
{
|
4
|
+
"tsdocVersion": "0.12",
|
5
|
+
"toolPackages": [
|
6
|
+
{
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
8
|
+
"packageVersion": "7.52.8"
|
9
|
+
}
|
10
|
+
]
|
11
|
+
}
|
package/package.json
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
"description": "A js UI library that uses rxjs to handle dom directly.",
|
33
33
|
"main": "dist/hyperscript-rxjs.js",
|
34
34
|
"types": "dist/hyperscript-rxjs.d.ts",
|
35
|
-
"version": "1.3.
|
35
|
+
"version": "1.3.8",
|
36
36
|
"author": "cuishengli<34696643@qq.com>",
|
37
37
|
"keywords": [
|
38
38
|
"ui",
|