@lynx-js/types 0.0.1 → 3.2.0

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +56 -0
  3. package/package.json +53 -6
  4. package/types/background-thread/animation.d.ts +47 -0
  5. package/types/background-thread/app.d.ts +28 -0
  6. package/types/background-thread/event.d.ts +97 -0
  7. package/types/background-thread/fetch.d.ts +152 -0
  8. package/types/background-thread/index.d.ts +11 -0
  9. package/types/background-thread/lynx-performance-entry.d.ts +83 -0
  10. package/types/background-thread/lynx.d.ts +144 -0
  11. package/types/background-thread/native-modules.d.ts +21 -0
  12. package/types/background-thread/nodes-ref.d.ts +110 -0
  13. package/types/background-thread/performance.d.ts +100 -0
  14. package/types/common/console.d.ts +14 -0
  15. package/types/common/csstype.d.ts +99 -0
  16. package/types/common/element/attributes.d.ts +59 -0
  17. package/types/common/element/common.d.ts +41 -0
  18. package/types/common/element/component.d.ts +17 -0
  19. package/types/common/element/element.d.ts +59 -0
  20. package/types/common/element/filter-image.d.ts +67 -0
  21. package/types/common/element/image.d.ts +121 -0
  22. package/types/common/element/index.d.ts +16 -0
  23. package/types/common/element/list.d.ts +1161 -0
  24. package/types/common/element/methods.d.ts +84 -0
  25. package/types/common/element/page.d.ts +10 -0
  26. package/types/common/element/scroll-view.d.ts +280 -0
  27. package/types/common/element/text.d.ts +97 -0
  28. package/types/common/element/view.d.ts +7 -0
  29. package/types/common/events.d.ts +448 -0
  30. package/types/common/global.d.ts +47 -0
  31. package/types/common/index.d.ts +13 -0
  32. package/types/common/lynx.d.ts +35 -0
  33. package/types/common/performance.d.ts +78 -0
  34. package/types/common/props.d.ts +119 -0
  35. package/types/common/system-info.d.ts +46 -0
  36. package/types/index.d.ts +8 -0
  37. package/types/main-thread/element.d.ts +85 -0
  38. package/types/main-thread/events.d.ts +20 -0
  39. package/types/main-thread/index.d.ts +7 -0
  40. package/types/main-thread/lynx.d.ts +28 -0
@@ -0,0 +1,1161 @@
1
+ // Copyright 2024 The Lynx Authors. All rights reserved.
2
+ // Licensed under the Apache License Version 2.0 that can be found in the
3
+ // LICENSE file in the root directory of this source tree.
4
+
5
+ import { AppearanceEvent, BaseEvent, BaseMethod, EventHandler } from '../events';
6
+ import { StandardProps } from '../props';
7
+
8
+ export enum ListEventSource {
9
+ DIFF = 0,
10
+ LAYOUT = 1,
11
+ SCROLL = 2,
12
+ }
13
+
14
+ /** The enum value of list batch render strategy.
15
+ * DEFAULT: The default value with the normal list's rendering process.
16
+ * BATCH_RENDER: Use batch render and the list will batch render multiple items.
17
+ * ASYNC_RESOLVE_PROPERTY: Use batch render and enable async resolve property of the list item.
18
+ * ASYNC_RESOLVE_PROPERTY_AND_ELEMENT_TREE (Recommended): Use batch render and enable async resolve property and element tree of the list item.
19
+ * @Android
20
+ * @iOS
21
+ */
22
+ export enum BatchRenderStrategy {
23
+ DEFAULT = 0,
24
+ BATCH_RENDER = 1,
25
+ ASYNC_RESOLVE_PROPERTY = 2,
26
+ ASYNC_RESOLVE_PROPERTY_AND_ELEMENT_TREE = 3
27
+ }
28
+
29
+ export interface ListScrollInfo {
30
+ /**
31
+ * scroll left from start
32
+ * @Android
33
+ * @iOS
34
+ */
35
+ scrollLeft: number;
36
+ /**
37
+ * scroll top from start
38
+ * @Android
39
+ * @iOS
40
+ */
41
+ scrollTop: number;
42
+ /**
43
+ * scroll content width
44
+ * @Android
45
+ * @iOS
46
+ */
47
+ scrollWidth: number;
48
+ /**
49
+ * scroll content height
50
+ * @Android
51
+ * @iOS
52
+ */
53
+ scrollHeight: number;
54
+ /**
55
+ * list width
56
+ * @Android
57
+ * @iOS
58
+ */
59
+ listWidth: number;
60
+ /**
61
+ * list height
62
+ * @Android
63
+ * @iOS
64
+ */
65
+ listHeight: number;
66
+ /**
67
+ * X-axis scroll delta for this scroll. It's always 0 in some non-scroll related events.
68
+ * @Android
69
+ * @iOS
70
+ */
71
+ deltaX: number;
72
+ /**
73
+ * Y-axis scroll delta for this scroll. It's always 0 in some non-scroll related events.
74
+ * @Android
75
+ * @iOS
76
+ */
77
+ deltaY: number;
78
+ /**
79
+ * Source of the event.
80
+ * @Android
81
+ * @iOS
82
+ */
83
+ eventSource: ListEventSource;
84
+ }
85
+
86
+ export interface ListScrollEvent extends BaseEvent<'scroll', ListScrollInfo> {}
87
+ export interface ListScrollToLowerEvent extends BaseEvent<'scrolltolower', ListScrollInfo> {}
88
+ export interface ListScrollToUpperEvent extends BaseEvent<'scrolltoupper', ListScrollInfo> {}
89
+ export interface ListScrollToUpperEdgeEvent extends BaseEvent<'scrolltoupperedge', ListScrollInfo> {}
90
+ export interface ListScrollToLowerEdgeEvent extends BaseEvent<'scrolltoloweredge', ListScrollInfo> {}
91
+ export interface ListScrollToNormalStateEvent extends BaseEvent<'scrolltonormalstate', ListScrollInfo> {}
92
+
93
+ export interface ListItemSnapAlignment {
94
+ /**
95
+ * Paging factor, 0.0 means align to the top, while 1.0 means align to the bottom.
96
+ * @Android
97
+ * @iOS
98
+ */
99
+ factor: number;
100
+ /**
101
+ * In addition to the parameter of factor, an offset for alignment can be set, in px.
102
+ * @Android
103
+ * @iOS
104
+ */
105
+ offset: number;
106
+ }
107
+
108
+ export interface ListItemInfo {
109
+ /**
110
+ * Height of the item, in px.
111
+ * @Android
112
+ * @iOS
113
+ * @H
114
+ */
115
+ height: number;
116
+ /**
117
+ * Width of the item, in px.
118
+ * @Android
119
+ * @iOS
120
+ * @H
121
+ */
122
+ width: number;
123
+ /**
124
+ * ItemKey of the list-item.
125
+ * @Android
126
+ * @iOS
127
+ * @H
128
+ */
129
+ itemKey: string;
130
+ /**
131
+ * When the list is running in multi-thread mode, this property indicates whether the item is currently being rendered and has not finished rendering. In this state, the item will have a default height that is the same as the list's height or an estimated height if one has been set.
132
+ * @Android
133
+ * @iOS
134
+ * @H
135
+ */
136
+ isBinding: boolean;
137
+ /**
138
+ * The x coordinate of the item's top-left corner, in px. The axis is based on the total length of the content rather than the visible area or screen.
139
+ * @Android
140
+ * @iOS
141
+ * @H
142
+ */
143
+ originX: number;
144
+ /**
145
+ * The y coordinate of the item's top-left corner, in px. The axis is based on the total length of the content rather than the visible area or screen.
146
+ * @Android
147
+ * @iOS
148
+ * @H
149
+ */
150
+ originY: number;
151
+ /**
152
+ * Show if the list-item is currently being updated in this layout.
153
+ * @Android
154
+ * @iOS
155
+ * @H
156
+ */
157
+ updated: boolean;
158
+ }
159
+
160
+ export interface ListAttachedCell {
161
+ /**
162
+ * id
163
+ * @iOS
164
+ * @Android
165
+ */
166
+ id: string;
167
+ /**
168
+ * bottom
169
+ * @iOS
170
+ * @Android
171
+ */
172
+ bottom: number;
173
+ /**
174
+ * top
175
+ * @iOS
176
+ * @Android
177
+ */
178
+ top: number;
179
+ /**
180
+ * left
181
+ * @iOS
182
+ * @Android
183
+ */
184
+ left: number;
185
+ /**
186
+ * right
187
+ * @iOS
188
+ * @Android
189
+ */
190
+ right: number;
191
+ /**
192
+ * postion
193
+ * @iOS
194
+ * @Android
195
+ */
196
+ position: number;
197
+ }
198
+
199
+ export interface ListDetail {
200
+ /**
201
+ * scroll top from start
202
+ * @iOS
203
+ * @Android
204
+ */
205
+ scrollTop: number;
206
+ /**
207
+ * scrolling delta at y axis
208
+ * @iOS
209
+ * @Android
210
+ */
211
+ deltaY: number;
212
+ /**
213
+ * attached cells
214
+ * @iOS
215
+ * @Android
216
+ */
217
+ attachedCells: ListAttachedCell[];
218
+ }
219
+
220
+ export interface ListEvent<T> extends BaseEvent<T, ListDetail> {}
221
+
222
+ export enum ListScrollState {
223
+ SCROLL_STATE_STOP = 1,
224
+ SCROLL_STATE_DRAGGING = 2,
225
+ SCROLL_STATE_DECELERATE = 3,
226
+ }
227
+
228
+ export interface ListScrollStateChangeEvent extends BaseEvent<'scrollstatechange', {}> {
229
+ detail: {
230
+ /**
231
+ * scroll state
232
+ * @iOS
233
+ * @Android
234
+ */
235
+ state: ListScrollState;
236
+ };
237
+ }
238
+
239
+ export interface ListLayoutFinishEvent extends BaseEvent<'layoutcomplete', {}> {
240
+ detail: {
241
+ /**
242
+ * timestamp, in ms
243
+ * @iOS
244
+ * @Android
245
+ */
246
+ timestamp: number;
247
+ /**
248
+ * All the component names after this layout
249
+ * @iOS
250
+ * @Android
251
+ */
252
+ cells: string[];
253
+ };
254
+ }
255
+
256
+ interface ListDebugInfoEvent extends BaseEvent<'debuginfo', {}> {
257
+ detail: {};
258
+ }
259
+
260
+ export interface ListSnapEvent extends BaseEvent<'snap', {}> {
261
+ detail: {
262
+ /**
263
+ * Will snap to a position.
264
+ * @iOS
265
+ * @Android
266
+ */
267
+ position: number;
268
+ /**
269
+ * Current scrolling left offset, in px.
270
+ * @iOS
271
+ * @Android
272
+ */
273
+ currentScrollLeft: number;
274
+ /**
275
+ * Current scrolling top offset, in px.
276
+ * @iOS
277
+ * @Android
278
+ */
279
+ currentScrollTop: number;
280
+ /**
281
+ * Snap scrolling left offset, in px.
282
+ * @iOS
283
+ * @Android
284
+ */
285
+ targetScrollLeft: number;
286
+ /**
287
+ * Snap scrolling top offset, in px.
288
+ * @iOS
289
+ * @Android
290
+ */
291
+ targetScrollTop: number;
292
+ };
293
+ }
294
+
295
+ export interface LayoutCompleteEvent extends BaseEvent<'layoutcomplete', {}> {
296
+ /**
297
+ * Layout details
298
+ * @iOS
299
+ * @Android
300
+ * @H
301
+ * @Since 2.15
302
+ */
303
+ detail: {
304
+ /**
305
+ * Connected to a setState.
306
+ * @iOS
307
+ * @Android
308
+ * @H
309
+ */
310
+ 'layout-id': number;
311
+ /**
312
+ * The diffResult of current layout change. If this diffResult is undefined, it means that the layout is triggered by a list-item update.
313
+ * @iOS
314
+ * @Android
315
+ * @H
316
+ */
317
+ diffResult?: {
318
+ insertions: number[];
319
+ // eslint-disable-next-line
320
+ move_from: number[];
321
+ // eslint-disable-next-line
322
+ move_to: number[];
323
+ removals: number[];
324
+ // eslint-disable-next-line
325
+ update_from: number[];
326
+ // eslint-disable-next-line
327
+ update_to: number[];
328
+ };
329
+ /**
330
+ * Cell info of the list after layout.
331
+ * @iOS
332
+ * @Android
333
+ * @H
334
+ */
335
+ visibleCellsAfterUpdate?: ListItemInfo[];
336
+ /**
337
+ * Cell info of the list before layout.
338
+ * @iOS
339
+ * @Android
340
+ * @H
341
+ */
342
+ visibleCellsBeforeUpdate?: ListItemInfo[];
343
+ /**
344
+ * The scroll info after layout.
345
+ * @iOS
346
+ * @Android
347
+ * @H
348
+ */
349
+ scrollInfo: ListScrollInfo;
350
+ /**
351
+ * The unit of event's parameters.
352
+ * @iOS
353
+ * @Android
354
+ * @H
355
+ */
356
+ eventUnit: string;
357
+ };
358
+ }
359
+
360
+ /**
361
+ * list. A list does not support adaptive height and the 'height' property must be specified for the <list> tag in order to set its height.
362
+ */
363
+ export interface ListProps extends StandardProps {
364
+ /**
365
+ * Whether to display the scrollbar of the list
366
+ * @defaultValue true
367
+ * @iOS
368
+ */
369
+ 'scroll-bar-enable'?: boolean;
370
+
371
+ /**
372
+ * Control whether list should produce bounces effect when scrolling past its content boundaries.
373
+ * @defaultValue true
374
+ * @iOS
375
+ */
376
+ bounces?: boolean;
377
+
378
+ /**
379
+ * z-index is undefined by default. When enabled, z-index will be assigned in ascending order for each item.
380
+ * @defaultValue false
381
+ * @iOS
382
+ */
383
+ 'ios-index-as-z-index'?: boolean;
384
+
385
+ /**
386
+ * To solve the flickering issue of list, it's recommended to enable it.
387
+ * @defaultValue false
388
+ * @iOS
389
+ */
390
+ 'ios-fixed-content-offset'?: boolean;
391
+
392
+ /**
393
+ * To solve the flickering issue of list, it's only necessary to enable when using bottom-up layout. It's recommended to understand the principle before using.
394
+ * @defaultValue false
395
+ * @iOS
396
+ */
397
+ 'ios-fix-offset-from-start'?: boolean;
398
+
399
+ /**
400
+ * Interrupt List rendering switch. It is usually used when creating drag-and-drop effects to prevent the list from refreshing child nodes.
401
+ * @defaultValue false
402
+ * @Android
403
+ */
404
+ 'no-invalidate'?: boolean;
405
+
406
+ /**
407
+ * Under asynchronous layout, it is recommended to enable this property if a child node renders blank.
408
+ * @defaultValue false
409
+ * @Android
410
+ */
411
+ 'component-init-measure'?: boolean;
412
+
413
+ /**
414
+ * Control whether dataSet can be used as the unique identifier. It will call RecyclerView.setHasStableIds() internally.
415
+ * @defaultValue false
416
+ * @Android
417
+ */
418
+ 'android-diffable'?: boolean;
419
+
420
+ /**
421
+ * ”upperBounce“ can only forbid bounces effect at top or left (right for RTL); ”lowerBounce“ can only forbid bounces effect at bottom or right (left for RTL). iOS uses bounces to implement refresh-view. This prop can be used when you need a refresh-view without bounces on the other side.
422
+ * @defaultValue "none"
423
+ * @iOS
424
+ */
425
+ 'ios-forbid-single-sided-bounce'?: 'upperBounce' | 'lowerBounce' | 'none';
426
+
427
+ /**
428
+ * Control whether list should produce over-scroll effect when scrolling past its content boundaries.
429
+ * @defaultValue false
430
+ * @Android
431
+ */
432
+ 'over-scroll'?: boolean;
433
+
434
+ /**
435
+ * Whether to allow scrolling for a list.
436
+ * @defaultValue true
437
+ * @Android
438
+ * @iOS
439
+ */
440
+ 'enable-scroll'?: boolean;
441
+
442
+ /**
443
+ * Whether to allow scrolling for a list. It's recommended to enable 'enable-scroll=true' and disable 'touch-scroll' on Android.
444
+ * @defaultValue true
445
+ * @Android
446
+ */
447
+ 'touch-scroll'?: boolean;
448
+
449
+ /**
450
+ * layout type of the list
451
+ * @defaultValue "single"
452
+ * @Android
453
+ * @iOS
454
+ */
455
+ 'list-type'?: 'single' | 'flow' | 'waterfall';
456
+
457
+ /**
458
+ * The number of columns for a list, only effective when list-type is 'flow' or 'waterfall'.
459
+ * @defaultValue 0
460
+ * @Android
461
+ * @iOS
462
+ */
463
+ 'column-count'?: number;
464
+
465
+ /**
466
+ * Control the horizontal and vertical scrolling direction of a list. If it is horizontal scrolling, you need to also set the CSS layout property 'style="display:linear; linear-orientation:horizontal"
467
+ * @defaultValue undefined
468
+ * @Android
469
+ * @iOS
470
+ */
471
+ 'vertical-orientation'?: boolean;
472
+
473
+ /**
474
+ * Replacement of vertical-orientation
475
+ * @since 3.0
476
+ * @iOS
477
+ * @Android
478
+ * @H
479
+ */
480
+ 'scroll-orientation'?: 'vertical' | 'horizontal';
481
+
482
+ /**
483
+ * Control the list to fill the elements from the bottom. It is used in reverse layout scenarios such as message list.
484
+ * @defaultValue false
485
+ * @Android
486
+ */
487
+ 'android-stack-from-end'?: boolean;
488
+
489
+ /**
490
+ * Control the switch of RTL (Right-to-Left) mode, the order of vertical two-column layout will also be mirrored and upside-down.
491
+ * @defaultValue false
492
+ * @Android
493
+ * @iOS
494
+ */
495
+ 'enable-rtl'?: boolean;
496
+
497
+ /**
498
+ * The ceiling or floor effect is not compatible with flatten.
499
+ * @defaultValue false
500
+ * @Android
501
+ * @iOS
502
+ */
503
+ sticky?: boolean;
504
+
505
+ /**
506
+ * The distance between the ceiling or floor position and the top or bottom of the list, in pixels.
507
+ * @defaultValue 0
508
+ * @Android
509
+ * @iOS
510
+ */
511
+ 'sticky-offset'?: number;
512
+
513
+ /**
514
+ * When enabled, the upper or lower element will also be shifted together with the bounces effect.
515
+ * @defaultValue false
516
+ * @iOS
517
+ */
518
+ 'sticky-with-bounces'?: boolean;
519
+
520
+ /**
521
+ * Rollback to the older version's sticky feature.
522
+ * @defaultValue false
523
+ * @Android
524
+ * @iOS
525
+ * @deprecated since 2.14
526
+ */
527
+ 'use-old-sticky'?: boolean;
528
+
529
+ /**
530
+ * To solve the conflict between list and x-refresh-view
531
+ * @defaultValue false
532
+ * @experimental
533
+ * @iOS
534
+ * @since 2.18
535
+ */
536
+ 'experimental-disable-filter-scroll'?: boolean;
537
+
538
+ /**
539
+ * Limit the inertia scrolling distance of asynchronous list to this value multiplied by the height (width) of the list, in order to reduce the chance of white screen. When it is set to 'auto', it will automatically calculate the rendering distance in preload-buffer when asynchronous list is enabled to ensure there is no white screen, but the inertia scrolling experience may be abnormal.
540
+ * @defaultValue undefined
541
+ * @experimental
542
+ * @Android
543
+ * @iOS
544
+ * @since 2.17
545
+ */
546
+ 'experimental-max-fling-distance-ratio'?: 'auto' | number;
547
+
548
+ /**
549
+ * Attempt to increase the CPU frequency if a gesture is set to the list
550
+ * @defaultValue false
551
+ * @experimental
552
+ * @iOS
553
+ * @since 2.18
554
+ */
555
+ 'experimental-ios-gesture-frequency-increasing'?: boolean;
556
+
557
+ /**
558
+ * On iOS, force-can-scroll should be used with ios-block-gesture-class and ios-recognized-view-tag. Can be used alone on Android.
559
+ * @defaultValue false
560
+ * @iOS
561
+ * @Android
562
+ * @since 3.1
563
+ */
564
+ 'force-can-scroll'?: boolean;
565
+
566
+ /**
567
+ * Whether to scroll to the top when the iOS status bar is clicked. Note that even if it is set to true, it may not scroll to the top. In such cas, you need to check the behavior of other scrollable components.{@link https://developer.apple.com/documentation/uikit/uiscrollview/1619421-scrollstotop?language=objc | Reference }
568
+ * @defaultValue undefined
569
+ * @iOS
570
+ * @since 2.16
571
+ */
572
+ 'ios-scrolls-to-top'?: boolean;
573
+
574
+ /**
575
+ * There are stability issues. Please use `<Component align-height={true}/>` instead. It is not recommended to use.
576
+ * @defaultValue false
577
+ * @iOS
578
+ * @deprecated since 2.10
579
+ */
580
+ 'ios-enable-align-height'?: boolean;
581
+
582
+ /**
583
+ * Deprecated
584
+ * @defaultValue true
585
+ * @iOS
586
+ * @deprecated since 2.10
587
+ */
588
+ 'ios-no-recursive-layout'?: boolean;
589
+
590
+ /**
591
+ * Deprecated
592
+ * @defaultValue true
593
+ * @iOS
594
+ * @deprecated since 2.10
595
+ */
596
+ 'ios-force-reload-data'?: boolean;
597
+
598
+ /**
599
+ * Deprecated
600
+ * @defaultValue true
601
+ * @iOS
602
+ * @deprecated since 2.10
603
+ */
604
+ 'ios-update-valid-layout'?: boolean;
605
+
606
+ /**
607
+ * Deprecated
608
+ * @defaultValue false
609
+ * @iOS
610
+ * @deprecated since 2.10
611
+ */
612
+ 'ios-enable-adjust-offset-for-selfsizing'?: boolean;
613
+
614
+ /**
615
+ * In Android, this attribute controls whether the list uses the RecyclerView's ItemDecoration to implement the main-axis-gap and cross-axis-gap.
616
+ * @defaultValue false
617
+ * @Android
618
+ */
619
+ 'android-enable-gap-item-decoration'?: boolean;
620
+
621
+ /**
622
+ * In some Android scenarios, the element that is currently being ceilinged or floored may not be correctly measured and laid out, resulting in blank rendering. Therefore, it is recommended to enable it.
623
+ * @defaultValue false
624
+ * @Android
625
+ */
626
+ 'android-trigger-sticky-layout'?: boolean;
627
+
628
+ /**
629
+ * Specify this property as 'default' to enable update animation for the list.
630
+ * @defaultValue "none"
631
+ * @Android
632
+ * @iOS
633
+ */
634
+ 'update-animation'?: 'none' | 'default';
635
+
636
+ /**
637
+ * Indicates whether to use the new exposure strategy. The new exposure strategy handles the situation where the node is covered, such as the list nested in x-viewpager-ng or x-swiper. The performance of the new exposure strategy is slightly worse than the old one, but the result is more accurate.
638
+ * @defaultValue false
639
+ * @Android
640
+ */
641
+ 'enable-new-exposure-strategy'?: boolean;
642
+
643
+ /**
644
+ * Allows notification to send disappear event. It is recommended to enable.
645
+ * @defaultValue false
646
+ * @Android
647
+ */
648
+ 'enable-disappear'?: boolean;
649
+
650
+ /**
651
+ * Enable asynchronous strategy
652
+ * @defaultValue false
653
+ * @Android
654
+ * @iOS
655
+ */
656
+ 'enable-async-list'?: boolean;
657
+
658
+ /**
659
+ * Cache the size when rendering components in child nodes of List. It is only allowed to enable under asynchronous mode.
660
+ * @defaultValue false
661
+ * @Android
662
+ */
663
+ 'enable-size-cache'?: boolean;
664
+
665
+ /**
666
+ * The maximum scrolling speed of the list, with a value between [0,1].
667
+ * @defaultValue 1.0
668
+ * @Android
669
+ */
670
+ 'max-fling-velocity-percent'?: number;
671
+
672
+ /**
673
+ * When scrolling down, when the number of remaining displayable child nodes at the bottom is first less than lower-threshold-item-count, a scrolltolower event is triggered. If lower-threshold-item-count is specified, lower-threshold is not effective.
674
+ * @defaultValue none
675
+ * @Android
676
+ * @iOS
677
+ */
678
+ 'lower-threshold-item-count'?: number;
679
+
680
+ /**
681
+ * When scrolling up, when the number of remaining displayable child nodes at the top is first less than upper-threshold-item-count, a scrolltoupper event is triggered. If upper-threshold-item-count is specified, upper-threshold is not effective.
682
+ * @defaultValue none
683
+ * @Android
684
+ * @iOS
685
+ */
686
+ 'upper-threshold-item-count'?: number;
687
+
688
+ /**
689
+ * During a single sliding process, when the upper_distance is first smaller than the value specified by upper-threshold, a scrolltoupper event is triggered. When upper_distance is already smaller than the value specified by upper-threshold, the scrolltoupper event will no longer be triggered.
690
+ * @defaultValue 50
691
+ * @Android
692
+ * @iOS
693
+ */
694
+ 'upper-threshold'?: number;
695
+
696
+ /**
697
+ * During a single sliding process, when the lower_distance is first smaller than the value specified by lower-threshold, a scrolltolower event is triggered. When lower_distance is already smaller than the value specified by lower-threshold, the scrolltolower event will no longer be triggered.
698
+ * @defaultValue 50
699
+ * @Android
700
+ * @iOS
701
+ */
702
+ 'lower-threshold'?: number;
703
+
704
+ /**
705
+ * Control whether the 'attachedCells' is included in the scroll event callback parameters.
706
+ * @defaultValue false
707
+ * @Android
708
+ * @iOS
709
+ */
710
+ 'needs-visible-cells'?: boolean;
711
+
712
+ /**
713
+ * Specify the callback frequency of the scroll event by passing in a value, which specifies how many milliseconds (ms) <list> will call the scroll callback event during scrolling.
714
+ * @defaultValue 200
715
+ * @Android
716
+ * @iOS
717
+ */
718
+ 'scroll-event-throttle'?: number;
719
+
720
+ /**
721
+ * List scrolling event refactoring switch. It is recommended to enable it.
722
+ * @defaultValue false
723
+ * @iOS
724
+ */
725
+ 'ios-scroll-emitter-helper'?: boolean;
726
+
727
+ /**
728
+ * Solve the problem of inaccurate sliding distance in the list scrolling event callback. It is recommended to enable it.
729
+ * @defaultValue false
730
+ * @Android
731
+ */
732
+ 'android-new-scroll-top'?: boolean;
733
+
734
+ /**
735
+ * Allow frontend code to specify the automatic positioning of the list after rendering, only valid for single columns.
736
+ * @defaultValue 0
737
+ * @Android
738
+ * @iOS
739
+ */
740
+ 'initial-scroll-index'?: number;
741
+
742
+ /**
743
+ * The difference of double-sided page turning effect: On Android, it controls scrolling one child node at a time; on iOS, it controls scrolling one list viewport distance at a time.
744
+ * @defaultValue false
745
+ * @Android
746
+ * @iOS
747
+ * @experimental
748
+ */
749
+ 'paging-enabled'?: boolean;
750
+
751
+ /**
752
+ * Enable the paging effect, and after each scroll, the list-item will stop at a specified position. For list-type:single only/
753
+ * @defaultValue undefined
754
+ * @Android
755
+ * @iOS
756
+ * @experimental
757
+ */
758
+ 'item-snap'?: ListItemSnapAlignment;
759
+
760
+ /**
761
+ * Notify the parent view not to intercept the event. Enable this when the list is in a client container (RecyclerView) and needs to be scrollable.
762
+ * @defaultValue false
763
+ * @Android
764
+ */
765
+ 'android-preference-consume-gesture'?: boolean;
766
+
767
+ /** scroll-view and list can be nested for scrolling. The scrolling of the child view triggered by a single gesture can drive the scrolling of the parent view when the inertial scrolling touches the edge.
768
+ * @defaultValue false
769
+ * @iOS
770
+ */
771
+ 'enable-nested-scroll'?: boolean;
772
+
773
+
774
+ /**
775
+ * NestedScrollOptions for scrollForward
776
+ * @since 3.0
777
+ * @H
778
+ */
779
+ 'temporary-nested-scroll-forward'?: 'selfOnly' | 'selfFirst'|'parentFirst'|'parallel';
780
+
781
+ /**
782
+ * NestedScrollOptions for scrollBackward
783
+ * @since 3.0
784
+ * @H
785
+ */
786
+ 'temporary-nested-scroll-backward'?: 'selfOnly' | 'selfFirst'|'parentFirst'|'parallel' ;
787
+
788
+ /**
789
+ * Preload count.
790
+ * @defaultValue 0
791
+ * @Android
792
+ * @iOS
793
+ * @experimental
794
+ */
795
+ 'preload-buffer-count'?: number;
796
+
797
+ /**
798
+ * Whether to enable the self-preloading strategy of the list system.
799
+ * @defaultValue 0
800
+ * @Android
801
+ * @experimental
802
+ */
803
+ 'android-enable-item-prefetch'?: boolean;
804
+
805
+ /**
806
+ * Determine whether the list is laid out from the top or from the bottom.
807
+ * @defaultValue 'fromBegin'
808
+ * @iOS
809
+ * @experimental
810
+ */
811
+ 'anchor-priority'?: 'fromBegin' | 'fromEnd';
812
+
813
+ /**
814
+ * When all nodes on the screen are deleted, find the anchor point outside the top/bottom area.
815
+ * @defaultValue 'toTop'
816
+ * @iOS
817
+ * @experimental
818
+ */
819
+ 'delete-regress-policy'?: 'toTop' | 'toBottom';
820
+
821
+ /**
822
+ * Using 'outside' can make the inserted element visible at the edge of the screen, and using 'inside' can make the inserted element invisible at the edge of the screen.
823
+ * @defaultValue 'inside'
824
+ * @iOS
825
+ * @experimental
826
+ */
827
+ 'insert-anchor-mode'?: 'outside' | 'inside';
828
+
829
+ /**
830
+ * "The dot element is positioned at the fully visible position (show) or at the point just invisible (hide), and no adjustment is made by default."
831
+ * @defaultValue 'noAdjustment'
832
+ * @iOS
833
+ * @experimental
834
+ */
835
+ 'anchor-visibility'?: 'noAdjustment' | 'show' | 'hide';
836
+
837
+ /**
838
+ * 'anchor-align-to-bottom' will keep the bottom of the anchor at the same distance from the visible area, while 'anchor-align-to-top' will keep the top of the anchor at the same distance from the visible area.
839
+ * @defaultValue 'toTop'
840
+ * @iOS
841
+ * @experimental
842
+ */
843
+ 'anchor-align'?: 'toBottom' | 'toTop';
844
+
845
+ /**
846
+ * From version 2.17 and above, you can directly use should-request-state-restore instead of internal-cell-appear-notification/internal-cell-prepare-for-reuse-notification/internal-cell-disappear-notification. The lifecycle of element layer reuse solves the problem of reuse status disorder in the UI layer. It is recommended to enable it when there is <scroll-view/> in the list item.
847
+ * @defaultValue false
848
+ * @deprecated 2.17
849
+ * @iOS
850
+ * @Android
851
+ */
852
+ 'internal-cell-appear-notification'?: boolean;
853
+
854
+ /**
855
+ * From version 2.17 and above, you can directly use should-request-state-restore instead of internal-cell-appear-notification/internal-cell-prepare-for-reuse-notification/internal-cell-disappear-notification. The lifecycle of element layer reuse solves the problem of reuse status disorder in the UI layer. It is recommended to enable it when there is <scroll-view/> in the list item.
856
+ * @defaultValue false
857
+ * @deprecated 2.17
858
+ * @iOS
859
+ * @Android
860
+ */
861
+ 'internal-cell-disappear-notification'?: boolean;
862
+
863
+ /**
864
+ * From version 2.17 and above, you can directly use should-request-state-restore instead of internal-cell-appear-notification/internal-cell-prepare-for-reuse-notification/internal-cell-disappear-notification. The lifecycle of element layer reuse solves the problem of reuse status disorder in the UI layer. It is recommended to enable it when there is <scroll-view/> in the list item.
865
+ * @defaultValue false
866
+ * @deprecated 2.17
867
+ * @iOS
868
+ * @Android
869
+ */
870
+ 'internal-cell-prepare-for-reuse-notification'?: boolean;
871
+
872
+ /**
873
+ * The lifecycle of element layer reuse. It solves the problem of reuse status disorder in the UI layer. It is recommended to enable it when there is <scroll-view/> in the list item. It replaces internal-cell-appear-notification, internal-cell-disappear-notification, and internal-cell-prepare-for-reuse-notification.
874
+ * @defaultValue false
875
+ * @since 2.17
876
+ * @iOS
877
+ * @Android
878
+ */
879
+ 'should-request-state-restore'?: boolean;
880
+
881
+ /**
882
+ * After the layout of the list is completed, preload the vdom of the remaining nodes in advance to improve the scrolling frame rate of the subsequent list.
883
+ * @defaultValue false
884
+ * @experimental
885
+ * @iOS
886
+ * @Android
887
+ * @since 2.17
888
+ */
889
+ 'experimental-enable-preload-section'?: boolean;
890
+
891
+ /**
892
+ * Since RecyclerView is a collection ViewGroup that includes virtual children (items that are in the Adapter but not visible in the UI), it employs a more involved focus search strategy that differs from other ViewGroups, which may lead to unexpected scroll behavior. This property is used to control whether the focus search strategy is enabled, and if set to false, the focus search strategy of RecyclerView will be disabled and directly return the current focused view in focusSearch method.
893
+ * @defaultValue true
894
+ * @Android
895
+ * @since 2.17
896
+ */
897
+ 'android-enable-focus-search'?: boolean;
898
+
899
+ /**
900
+ * Warning: It is not recommended to enable it in the production environment. Adjust the level of detail for bindlistdebugevent, with 0 meaning no output, 1 meaning outputting warnings, 2 meaning outputting information, and 3 meaning outputting detailed debug information.
901
+ * @defaultValue 2
902
+ * @iOS
903
+ * @Android
904
+ * @since 2.18
905
+ */
906
+ 'list-debug-info-level'?: number;
907
+
908
+ /**
909
+ * The strategy of list batch rendering in Fiber arch. The value of this property can be set to the value of Enum BatchRenderStrategy.
910
+ * @defaultValue BatchRenderStrategy.DEFAULT
911
+ * @iOS
912
+ * @Android
913
+ * @since 3.1
914
+ */
915
+ 'experimental-batch-render-strategy'?: BatchRenderStrategy;
916
+
917
+ /**
918
+ * Scroll event.
919
+ * @Android
920
+ * @iOS
921
+ */
922
+ bindscroll?: EventHandler<ListScrollEvent>;
923
+
924
+ /**
925
+ * Callback function for scrolling to the top.
926
+ * @Android
927
+ * @iOS
928
+ */
929
+ bindscrolltoupper?: EventHandler<ListScrollToUpperEvent>;
930
+
931
+ /**
932
+ * Callback function for scrolling to the bottom.
933
+ * @Android
934
+ * @iOS
935
+ */
936
+ bindscrolltolower?: EventHandler<ListScrollToLowerEvent>;
937
+
938
+ /**
939
+ * This callback function is triggered when the scrolling state of the list changes.
940
+ * @Android
941
+ * @iOS
942
+ */
943
+ bindscrollstatechange?: EventHandler<ListScrollStateChangeEvent>;
944
+ /**
945
+ * This callback function will be triggered when the first screen of the list has finished rendering. On iOS, this callback function will be triggered when list has an update.
946
+ * @Android
947
+ * @iOS
948
+ */
949
+ bindlayoutcomplete?: EventHandler<ListLayoutFinishEvent> | EventHandler<LayoutCompleteEvent>;
950
+ /**
951
+ * Warning: It is not recommended to enable it in the production environment. Output debug information for the list.
952
+ * @since 2.18
953
+ * @Android
954
+ * @iOS
955
+ */
956
+ bindlistdebugevent?: EventHandler<ListDebugInfoEvent>;
957
+ /**
958
+ * scrollview scrolls to upper edge
959
+ * @since 3.0
960
+ * @iOS
961
+ * @Android
962
+ * @H
963
+ */
964
+ bindscrolltoupperedge?: EventHandler<ListScrollToUpperEdgeEvent>;
965
+
966
+ /**
967
+ * scrollview scrolls to lower edge
968
+ * @since 3.0
969
+ * @iOS
970
+ * @Android
971
+ * @H
972
+ */
973
+ bindscrolltoloweredge?: EventHandler<ListScrollToLowerEdgeEvent>;
974
+
975
+ /**
976
+ * scrollview scrolls to normal position. Not at upper or lower edge
977
+ * @since 3.0
978
+ * @iOS
979
+ * @Android
980
+ * @H
981
+ */
982
+ bindscrolltonormalstate?: EventHandler<ListScrollToNormalStateEvent>;
983
+ }
984
+
985
+ export interface ListItemProps extends StandardProps {
986
+ /**
987
+ * sticky top effect. Not compatible with flatten.
988
+ * @defaultValue false
989
+ * @Android
990
+ * @iOS
991
+ */
992
+ 'sticky-top'?: boolean;
993
+
994
+ /**
995
+ * sticky bottom effect. Not compatible with flatten.
996
+ * @defaultValue false
997
+ * @Android
998
+ * @iOS
999
+ */
1000
+ 'sticky-bottom'?: boolean;
1001
+
1002
+ /**
1003
+ * Preset height to control the placeholder height of the view while the list component has not finished rendering. The more accurately it is set, the less flickering the list will have.
1004
+ * @defaultValue undefined
1005
+ * @Android
1006
+ * @iOS
1007
+ */
1008
+ 'estimated-height-px'?: number;
1009
+
1010
+ /**
1011
+ * Preset size in main scroll axis to control the placeholder size of the view while the list component has not finished rendering. The more accurately it is set, the less flickering the list will have.
1012
+ * @defaultValue undefined
1013
+ * @Android
1014
+ * @iOS
1015
+ */
1016
+ 'estimated-main-axis-size-px'?: number;
1017
+
1018
+ /**
1019
+ * Snap callback
1020
+ * @Android
1021
+ * @iOS
1022
+ */
1023
+ bindsnap?: EventHandler<ListEvent<'snap'>>;
1024
+
1025
+ /**
1026
+ * @Android
1027
+ * @iOS
1028
+ */
1029
+ 'item-key': string;
1030
+
1031
+ bindnodeappear?: EventHandler<AppearanceEvent>;
1032
+ bindnodedisappear?: EventHandler<AppearanceEvent>;
1033
+ }
1034
+
1035
+ export interface ListRowProps extends ListItemProps {}
1036
+
1037
+ /**
1038
+ * Automatic scrolling
1039
+ * @Android
1040
+ * @iOS
1041
+ */
1042
+ export interface AutoScrollMethod extends BaseMethod {
1043
+ method: 'autoScroll';
1044
+ params: {
1045
+ /**
1046
+ * The distance of each second's scrolling, which supports positive and negative values. The unit of distance can be "px", "rpx", "ppx", or null (for iOS, the value must be greater than 1/screen.scale px).
1047
+ * @Android
1048
+ * @iOS
1049
+ */
1050
+ rate: string;
1051
+ /**
1052
+ * Start/stop automatic scrolling.
1053
+ * @defaultValue false
1054
+ * @Android
1055
+ * @iOS
1056
+ */
1057
+ start: boolean;
1058
+ /**
1059
+ * Whether to stop automatically when sliding to the bottom.
1060
+ * @defaultValue true
1061
+ * @Android
1062
+ * @iOS
1063
+ */
1064
+ autoStop: boolean;
1065
+ };
1066
+ }
1067
+
1068
+ /**
1069
+ * Get the info of the currently displayed list item.
1070
+ * @Android
1071
+ * @iOS
1072
+ */
1073
+ export interface GetVisibleCellsMethod extends BaseMethod {
1074
+ method: 'getVisibleCells';
1075
+ }
1076
+
1077
+ /**
1078
+ * Get the index of the currently displayed list item.
1079
+ * @Android
1080
+ */
1081
+ export interface GetVisibleItemsPositionsMethod extends BaseMethod {
1082
+ method: 'getVisibleItemsPositions';
1083
+ }
1084
+
1085
+ /**
1086
+ * Remove current sticky view.
1087
+ * @Android
1088
+ */
1089
+ export interface RemoveStickyViewMethod extends BaseMethod {
1090
+ method: 'removeStickyView';
1091
+ }
1092
+
1093
+ /**
1094
+ * Init the cache of the list.
1095
+ * @Android
1096
+ */
1097
+ export interface InitCacheMethod extends BaseMethod {
1098
+ method: 'initCache';
1099
+ }
1100
+
1101
+ /**
1102
+ * Scroll the list to the specified position.
1103
+ * @Android
1104
+ * @iOS
1105
+ */
1106
+ export interface ScrollToPositionMethod extends BaseMethod {
1107
+ method: 'scrollToPosition';
1108
+ params: {
1109
+ /**
1110
+ * From version 2.17 and above, it is recommended to use 'index' instead. Specify the index of the node to scroll to, with a value range of [0, itemCount).
1111
+ * @deprecated 2.17
1112
+ * @Android
1113
+ * @iOS
1114
+ */
1115
+ position: number;
1116
+
1117
+ /**
1118
+ * Specify the index of the node to scroll to, with a value range of [0, itemCount).
1119
+ * @since 2.17
1120
+ * @Android
1121
+ * @iOS
1122
+ */
1123
+ index: number;
1124
+
1125
+ /**
1126
+ * Specify the alignment method when scrolling to a target position.
1127
+ * "none": Scroll to make the node fully visible in the list. If the node is above the visible range of the list, it will scroll to align the top of the node with the top of the list. If the node is below the visible range of the list, it will scroll to align the bottom of the node with the bottom of the list. If the node is within the visible range of the list, no movement will occur.
1128
+ * "bottom": Scroll to make the node fully visible in the list and align the bottom of the node with the bottom of the list.
1129
+ * "top": Scroll to make the node fully visible in the list and align the top of the node with the top of the list.
1130
+ * "middle": Scroll to make the node fully visible in the list and align the center of the node with the center of the list. This is only supported in LynxSDK 2.12 and above.
1131
+ * @defaultValue none
1132
+ * @Android
1133
+ * @iOS
1134
+ */
1135
+ alignTo?: 'none' | 'bottom' | 'top' | 'middle';
1136
+
1137
+ /**
1138
+ * Align the node with alignTo, and then move the node downward by a length of offset.
1139
+ * @Android
1140
+ * @iOS
1141
+ */
1142
+ offset?: number;
1143
+
1144
+ /**
1145
+ * Enable scroll animation during scroll.
1146
+ * @defaultValue false
1147
+ * @Android
1148
+ * @iOS
1149
+ */
1150
+ smooth?: boolean;
1151
+
1152
+ /**
1153
+ * When enabled, it uses the refactored logic which helps to solve some existing bugs. It is recommended to enable it.
1154
+ * @defaultValue false
1155
+ * @iOS
1156
+ */
1157
+ useScroller?: boolean;
1158
+ };
1159
+ }
1160
+
1161
+ export type ListUIMethods = ScrollToPositionMethod | AutoScrollMethod | GetVisibleCellsMethod | GetVisibleItemsPositionsMethod | RemoveStickyViewMethod | InitCacheMethod;