@lynx-js/types 3.3.1 → 3.3.2

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.
@@ -338,14 +338,14 @@ export interface LayoutCompleteEvent extends BaseEvent<'layoutcomplete', {}> {
338
338
  * @Android
339
339
  * @H
340
340
  */
341
- visibleCellsAfterUpdate?: ListItemInfo[];
341
+ visibleItemAfterUpdate?: ListItemInfo[];
342
342
  /**
343
343
  * Cell info of the list before layout.
344
344
  * @iOS
345
345
  * @Android
346
346
  * @H
347
347
  */
348
- visibleCellsBeforeUpdate?: ListItemInfo[];
348
+ visibleItemBeforeUpdate?: ListItemInfo[];
349
349
  /**
350
350
  * The scroll info after layout.
351
351
  * @iOS
@@ -516,6 +516,22 @@ export interface ListProps extends StandardProps {
516
516
  */
517
517
  'sticky-offset'?: number;
518
518
 
519
+ /**
520
+ * The property to control whether recycle sticky item. The default value is true if sdk version >= 3.4 and false if sdk version < 3.4.
521
+ * @defaultValue false
522
+ * @Android
523
+ * @iOS
524
+ */
525
+ 'experimental-recycle-sticky-item'?: boolean;
526
+
527
+ /**
528
+ * The property to set the capacity of sticky item cache. The default value is 1 if thread mode is ALL_ON_UI and 2 if thread mode is MOST_ON_TASM / PART_ON_LAYOUT / MULTI_THREADS.
529
+ * @defaultValue 1
530
+ * @Android
531
+ * @iOS
532
+ */
533
+ 'sticky-buffer-count'?: number;
534
+
519
535
  /**
520
536
  * When enabled, the upper or lower element will also be shifted together with the bounces effect.
521
537
  * @defaultValue false
@@ -691,6 +707,14 @@ export interface ListProps extends StandardProps {
691
707
  */
692
708
  'upper-threshold-item-count'?: number;
693
709
 
710
+ /**
711
+ * The property to control whether to update sticky item for diff. The default value is true if sdk version >= 3.4 and false if sdk version < 3.4.
712
+ * @defaultValue false
713
+ * @Android
714
+ * @iOS
715
+ */
716
+ 'experimental-update-sticky-for-diff'?: boolean;
717
+
694
718
  /**
695
719
  * 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.
696
720
  * @defaultValue 50
@@ -715,6 +739,15 @@ export interface ListProps extends StandardProps {
715
739
  */
716
740
  'needs-visible-cells'?: boolean;
717
741
 
742
+ /**
743
+ * Control whether the list recycle available items before layout, so list can reuse these items in this layout pass. By default, the list will recycle all items after layout.
744
+ * @defaultValue false
745
+ * @Android
746
+ * @iOS
747
+ * @Harmony
748
+ */
749
+ 'experimental-recycle-available-item-before-layout'?: boolean;
750
+
718
751
  /**
719
752
  * Control whether the 'attachedCells' is included in the scroll event callback parameters on native list.
720
753
  * @defaultValue false
@@ -724,6 +757,15 @@ export interface ListProps extends StandardProps {
724
757
  */
725
758
  'need-visible-item-info'?: boolean;
726
759
 
760
+ /**
761
+ * Control whether the span count can be dynamically switched. The default value is true. If set to true, the list will try to maintain stability of layout, and if set to false, the list will layout from the first list-item.
762
+ * @defaultValue true
763
+ * @Android
764
+ * @iOS
765
+ * @Harmony
766
+ */
767
+ 'enable-dynamic-span-count'?: boolean;
768
+
727
769
  /**
728
770
  * 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.
729
771
  * @defaultValue 200
@@ -785,7 +827,7 @@ export interface ListProps extends StandardProps {
785
827
  */
786
828
  'enable-nested-scroll'?: boolean;
787
829
 
788
-
830
+
789
831
  /**
790
832
  * NestedScrollOptions for scrollForward
791
833
  * @since 3.0
@@ -4,11 +4,11 @@
4
4
 
5
5
  import { BaseMethod, Callback } from '../events';
6
6
  import { AutoScrollMethod, ScrollToPositionMethod } from './list';
7
- import { ScrollToMethod } from './scroll-view';
7
+ import { ScrollViewUIMethods } from './scroll-view';
8
8
 
9
9
  export type ListParams = ScrollToPositionMethod;
10
10
 
11
- export type ScrollViewParams = ScrollToMethod | AutoScrollMethod;
11
+ export type ScrollViewParams = ScrollViewUIMethods | AutoScrollMethod;
12
12
 
13
13
  interface BoundingClientRectMethod extends BaseMethod {
14
14
  method: 'boundingClientRect';
@@ -4,7 +4,6 @@
4
4
 
5
5
  import { BaseEvent, BaseMethod, EventHandler } from '../events';
6
6
  import { StandardProps } from '../props';
7
- import { AutoScrollMethod } from './list';
8
7
  import {
9
8
  ContentSizeChangedEvent,
10
9
  ScrollEndEvent,
@@ -18,172 +17,101 @@ import {
18
17
  } from './common';
19
18
 
20
19
  export interface ScrollViewProps extends StandardProps {
21
- /**
22
- * Scroll horizontaly.
23
- * @defaultValue false
24
- * @since 1.4
25
- * @iOS
26
- * @Android
27
- * @H
28
- */
29
- 'scroll-x'?: boolean;
30
-
31
- /**
32
- * Scroll vertically
33
- * @defaultValue false
34
- * @since 1.4
35
- * @iOS
36
- * @Android
37
- * @H
38
- */
39
- 'scroll-y'?: boolean;
40
-
41
20
  /**
42
21
  * Replacement of scroll-x and scroll-y
22
+ * @defaultValue 'vertical'
43
23
  * @since 3.0
44
24
  * @iOS
45
25
  * @Android
46
- * @H
26
+ * @Harmony
27
+ * @PC
47
28
  */
48
29
  'scroll-orientation'?: 'vertical' | 'horizontal';
49
30
 
50
31
  /**
51
32
  * Enable bounce effect
52
- * @defaultValue false
33
+ * @defaultValue true
53
34
  * @since 1.4
54
35
  * @iOS
55
- * @Android
56
- * @H
36
+ * @Harmony
37
+ * @PC
57
38
  */
58
39
  bounces?: boolean;
59
40
 
60
41
  /**
61
42
  * Enable dragging
62
- * @defaultValue false
43
+ * @defaultValue true
63
44
  * @since 1.4
64
45
  * @iOS
65
46
  * @Android 2.2
66
- * @H
47
+ * @Harmony
48
+ * @PC
67
49
  */
68
50
  'enable-scroll'?: boolean;
69
51
 
70
52
  /**
71
53
  * Enable scrollbar
72
- * @defaultValue false
54
+ * @defaultValue true
73
55
  * @since 1.4
74
56
  * @iOS
75
- * @Android
76
- * @H
57
+ * @Harmony
58
+ * @PC
77
59
  */
78
60
  'scroll-bar-enable'?: boolean;
79
61
 
80
62
  /**
81
- * Not recommended to use. Please use upper-threshold-item-count instead. Set upper threshold to bindscrolltoupper event.
63
+ * Set upper threshold to bindscrolltoupper event.
82
64
  * @defaultValue 0
83
65
  * @since 1.4
84
66
  * @iOS
85
67
  * @Android
86
- * @H
68
+ * @Harmony
69
+ * @PC
87
70
  */
88
71
  'upper-threshold'?: number;
89
72
 
90
73
  /**
91
- * Not recommended to use. Please use lower-threshold-item-count instead. Set upper threshold to bindscrolltoupper event.
74
+ * Set upper threshold to bindscrolltoupper event.
92
75
  * @defaultValue 0
93
76
  * @since 1.4
94
77
  * @iOS
95
78
  * @Android
96
- * @H
79
+ * @Harmony
80
+ * @PC
97
81
  */
98
82
  'lower-threshold'?: number;
99
83
 
100
84
  /**
101
- * Please use initial-scroll-offset or ScrollTo method. Set the content offset from the top.
102
- * @defaultValue 0
103
- * @since 1.4
104
- * @deprecated 2.17
105
- * @iOS
106
- * @Android
107
- * @H
108
- */
109
- 'scroll-top'?: number;
110
-
111
- /**
112
- * Please use initial-scroll-offset or ScrollTo method. Set the content offset from the left.
113
- * @defaultValue 0
114
- * @since 1.4
115
- * @deprecated 2.17
116
- * @iOS
117
- * @Android
118
- * @H
119
- */
120
- 'scroll-left'?: number;
121
-
122
- /**
123
- * Initial scroll position, only effective once
85
+ * Initial scroll position, only effective once, in PX
124
86
  * @defaultValue 0
125
87
  * @since 2.17
126
88
  * @iOS
127
89
  * @Android
128
- * @H
90
+ * @Harmony
91
+ * @PC
129
92
  */
130
93
  'initial-scroll-offset'?: number;
131
94
 
132
- /**
133
- * Please use initial-scroll-index or ScrollTo method。Set the first item at the first screen
134
- * @defaultValue 0
135
- * @since 2.1
136
- * @deprecated 2.17
137
- * @iOS
138
- * @Android
139
- */
140
- 'scroll-to-index'?: number;
141
-
142
95
  /**
143
96
  * Scroll to specified child node on first screen, only effective once. All direct child nodes must be flatten=false.
144
97
  * @defaultValue 0
145
98
  * @since 2.17
146
99
  * @iOS
147
100
  * @Android
148
- * @H
101
+ * @Harmony
102
+ * @PC
149
103
  */
150
104
  'initial-scroll-to-index'?: number;
151
105
 
152
- /**
153
- * On iOS, force-can-scroll should be used with ios-block-gesture-class and ios-recognized-view-tag. Can be used alone on Android.
154
- * @defaultValue false
155
- * @since 2.10.1
156
- * @iOS
157
- * @Android
158
- * @H
159
- */
160
- 'force-can-scroll'?: boolean;
161
-
162
- /**
163
- * Force-can-scroll should be used with ios-block-gesture-class、ios-recognized-view-tag. Specify the class name of scrollable container that should be blocked by force-can-scroll. Given by container's developer.
164
- * @defaultValue none
165
- * @since 2.10.1
166
- * @iOS
167
- */
168
- 'ios-block-gesture-class'?: string;
169
-
170
- /**
171
- * force-can-scroll should be used with ios-block-gesture-class、ios-recognized-view-tag. Specify scrollable container's tag, the UIView's tag. Set and given by container's developer.
172
- * @defaultValue none
173
- * @since 2.10.1
174
- * @iOS
175
- */
176
- 'ios-recognized-view-tag'?: number;
177
-
178
106
  /**
179
107
  * This event is triggered when the upper/left edge of the scrolling area intersects with the visible area defined by the upperThreshold.
180
108
  * @defaultValue none
181
109
  * @since 1.4
182
110
  * @iOS
183
111
  * @Android
184
- * @H
112
+ * @Harmony
185
113
  */
186
- bindscrolltoupper?: EventHandler<ScrollToUpperEvent>;
114
+ bindscrolltoupper?: (e: ScrollToUpperEvent) => void;
187
115
 
188
116
  /**
189
117
  * This event is triggered when the lower/right edge of the scrolling area intersects with the visible area defined by the lowerThreshold.
@@ -191,9 +119,9 @@ export interface ScrollViewProps extends StandardProps {
191
119
  * @since 1.4
192
120
  * @iOS
193
121
  * @Android
194
- * @H
122
+ * @Harmony
195
123
  */
196
- bindscrolltolower?: EventHandler<ScrollToLowerEvent>;
124
+ bindscrolltolower?: (e: ScrollToLowerEvent) => void;
197
125
 
198
126
  /**
199
127
  * This event is triggered when the scrollview is scrolling.
@@ -201,9 +129,10 @@ export interface ScrollViewProps extends StandardProps {
201
129
  * @since 1.4
202
130
  * @iOS
203
131
  * @Android
204
- * @H
132
+ * @Harmony
133
+ * @PC
205
134
  */
206
- bindscroll?: EventHandler<ScrollEvent>;
135
+ bindscroll?: (e: ScrollEvent) => void;
207
136
 
208
137
  /**
209
138
  * This event is triggered when the scrollview's scroll ended.
@@ -211,9 +140,10 @@ export interface ScrollViewProps extends StandardProps {
211
140
  * @since 1.6
212
141
  * @iOS
213
142
  * @Android
214
- * @H
143
+ * @Harmony
144
+ * @PC
215
145
  */
216
- bindscrollend?: EventHandler<ScrollEndEvent>;
146
+ bindscrollend?: (e: ScrollEndEvent) => void;
217
147
 
218
148
  /**
219
149
  * This event is triggered when the scrollview's content size changed.
@@ -221,42 +151,19 @@ export interface ScrollViewProps extends StandardProps {
221
151
  * @since 1.6
222
152
  * @iOS
223
153
  * @Android
224
- * @H
225
- */
226
- bindcontentsizechanged?: EventHandler<ContentSizeChangedEvent>;
227
-
228
- /**
229
- * scrollview scrolls to upper edge
230
- * @defaultValue none
231
- * @since 3.0
232
- * @iOS
233
- * @Android
234
- * @H
154
+ * @Harmony
235
155
  */
236
- bindscrolltoupperedge?: EventHandler<ScrollToUpperEdgeEvent>;
237
-
238
- /**
239
- * scrollview scrolls to lower edge
240
- * @defaultValue none
241
- * @since 3.0
242
- * @iOS
243
- * @Android
244
- * @H
245
- */
246
- bindscrolltoloweredge?: EventHandler<ScrollToLowerEdgeEvent>;
247
-
248
- /**
249
- * scrollview scrolls to normal position. Not at upper or lower edge
250
- * @defaultValue none
251
- * @since 3.0
252
- * @iOS
253
- * @Android
254
- * @H
255
- */
256
- bindscrolltonormalstate?: EventHandler<ScrollToNormalStateEvent>;
156
+ bindcontentsizechanged?: (e: ContentSizeChangedEvent) => void;
257
157
  }
258
158
 
259
- export interface ScrollToMethod extends BaseMethod {
159
+ /**
160
+ * Scroll to specified position
161
+ * @Android
162
+ * @iOS
163
+ * @Harmony
164
+ * @PC
165
+ */
166
+ export interface ScrollViewScrollToMethod extends BaseMethod {
260
167
  method: 'scrollTo';
261
168
  params: {
262
169
  /**
@@ -277,4 +184,52 @@ export interface ScrollToMethod extends BaseMethod {
277
184
  };
278
185
  }
279
186
 
280
- export type ScrollViewUIMethods = ScrollToMethod | AutoScrollMethod;
187
+ /**
188
+ * Scroll by specified offset
189
+ * @Android
190
+ * @iOS
191
+ * @Harmony
192
+ * @PC
193
+ */
194
+ export interface ScrollViewScrollByMethod extends BaseMethod {
195
+ method: 'scrollBy';
196
+ params: {
197
+ /**
198
+ * Offset to scroll
199
+ */
200
+ offset?: number;
201
+ };
202
+ }
203
+
204
+
205
+
206
+ /**
207
+ * Automatic scrolling
208
+ * @Android
209
+ * @iOS
210
+ * @Harmony
211
+ * @PC
212
+ */
213
+ export interface ScrollViewAutoScrollMethod extends BaseMethod {
214
+ method: 'autoScroll';
215
+ params: {
216
+ /**
217
+ * 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).
218
+ * @Android
219
+ * @iOS
220
+ * @Harmony
221
+ * @PC
222
+ */
223
+ rate: number;
224
+ /**
225
+ * Start/stop automatic scrolling.
226
+ * @Android
227
+ * @iOS
228
+ * @Harmony
229
+ * @PC
230
+ */
231
+ start: boolean;
232
+ };
233
+ }
234
+
235
+ export type ScrollViewUIMethods = ScrollViewScrollToMethod | ScrollViewScrollByMethod | ScrollViewAutoScrollMethod;
@@ -2,7 +2,7 @@
2
2
  // Licensed under the Apache License Version 2.0 that can be found in the
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
- import { BaseEvent, TextLayoutEventDetail } from '../events';
5
+ import { BaseEvent, Callback, BaseMethod, TextLayoutEventDetail, TextSelectionChangeEventDetail } from '../events';
6
6
  import { StandardProps } from '../props';
7
7
 
8
8
  /**
@@ -11,14 +11,16 @@ import { StandardProps } from '../props';
11
11
  export interface TextProps extends StandardProps {
12
12
  /**
13
13
  * Maximum number of lines for text display
14
- * @defaultValue "-1"
14
+ * @Android
15
+ * @iOS
16
+ * @Harmony
17
+ * @PC
15
18
  * @since 1.0
16
19
  */
17
20
  'text-maxline'?: string;
18
21
 
19
22
  /**
20
23
  * Maximum number of characters for text display
21
- * @defaultValue ""
22
24
  * @since 1.0
23
25
  * @deprecated Suggest preprocessing the text content length.
24
26
  */
@@ -27,6 +29,7 @@ export interface TextProps extends StandardProps {
27
29
  /**
28
30
  * Whether font-size is affected by system font scaling
29
31
  * @defaultValue false
32
+ * @deprecated
30
33
  * @since 1.6
31
34
  */
32
35
  'enable-font-scaling'?: boolean;
@@ -42,22 +45,18 @@ export interface TextProps extends StandardProps {
42
45
  /**
43
46
  * By default, if text truncation occurs, the color of the inserted ... will be specified by the style on the nearest inline-text. If this attribute is enabled, the color of ... will be specified by the style on the outermost text tag.
44
47
  * @defaultValue false
48
+ * @Android
49
+ * @iOS
45
50
  * @since 2.0
46
51
  */
47
52
  'tail-color-convert'?: boolean;
48
53
 
49
- /**
50
- * Enable long press to select text
51
- * @defaultValue false
52
- * @since 2.5
53
- */
54
- 'text-selection'?: boolean;
55
-
56
54
  /**
57
55
  * Set single-line plain text to be centered and aligned within the line. Inline text settings are not supported. Recommended only when the default font doesn't meet center alignment needs, as it increases text measurement time.
58
- * @defaultValue normal
56
+ * @defaultValue 'normal'
59
57
  * @iOS
60
58
  * @Android
59
+ * @PC
61
60
  * @since 2.12
62
61
  */
63
62
  'text-single-line-vertical-align'?: 'normal' | 'bottom' | 'center' | 'top';
@@ -87,11 +86,175 @@ export interface TextProps extends StandardProps {
87
86
  */
88
87
  'text-fake-bold'?: boolean;
89
88
 
89
+ /**
90
+ * Sets whether to enable text selection.
91
+ * @defaultValue false
92
+ * @Android
93
+ * @iOS
94
+ * @since 2.18
95
+ */
96
+ 'text-selection'?: boolean;
97
+
98
+ /**
99
+ * Used to set whether to turn on the custom pop-up context menu after selection and copying. It takes effect after enabling text-selection.
100
+ * @defaultValue false
101
+ * @Android
102
+ * @iOS
103
+ * @since 2.18
104
+ */
105
+ 'custom-context-menu'?: boolean;
106
+
107
+ /**
108
+ * Used to set whether to enable the custom text selection function. When it is enabled, the element will no longer handle the gesture logic related to selection and copying. It takes effect after enabling text-selection.
109
+ * @defaultValue false
110
+ * @Android
111
+ * @iOS
112
+ * @since 2.18
113
+ */
114
+ 'custom-text-selection'?: boolean;
115
+
90
116
  /**
91
117
  * Text layout event
92
118
  * @since 2.7
119
+ * @Android
120
+ * @iOS
121
+ * @Harmony
122
+ * @PC
93
123
  */
94
124
  bindlayout?: (e: LayoutEvent) => void;
125
+
126
+ /**
127
+ * Text selection change event
128
+ * @Android
129
+ * @iOS
130
+ * @since 2.18
131
+ */
132
+ bindselectionchange?: (e: SelectionChangeEvent) => void;
95
133
  }
96
134
 
97
135
  export type LayoutEvent = BaseEvent<'layout', TextLayoutEventDetail>;
136
+
137
+ export type SelectionChangeEvent = BaseEvent<
138
+ 'selectionchange',
139
+ TextSelectionChangeEventDetail
140
+ >;
141
+
142
+ interface Rect {
143
+ left: number;
144
+ right: number;
145
+ top: number;
146
+ bottom: number;
147
+ width: number;
148
+ height: number;
149
+ }
150
+
151
+ interface Handle {
152
+ /**
153
+ * Center X of handle
154
+ */
155
+ x: number;
156
+ /**
157
+ * Center Y of handle
158
+ */
159
+ y: number;
160
+ /**
161
+ * Touch radius of the handle
162
+ */
163
+ radius: number;
164
+ }
165
+
166
+ /**
167
+ * Sets the text selection.
168
+ * @Android
169
+ * @iOS
170
+ * @since 2.18
171
+ */
172
+ interface SetTextSelectionMethod extends BaseMethod {
173
+ method: 'setTextSelection';
174
+ params: {
175
+ /**
176
+ * X-coordinate of the selection start relative to the element
177
+ */
178
+ startX: number;
179
+ /**
180
+ * Y-coordinate of the selection start relative to the element
181
+ */
182
+ startY: number;
183
+ /**
184
+ * X-coordinate of the selection end relative to the element
185
+ */
186
+ endX: number;
187
+ /**
188
+ * Y-coordinate of the selection end relative to the element
189
+ */
190
+ endY: number;
191
+ /**
192
+ * Whether to show the start handle, default is true
193
+ */
194
+ showStartHandle?: boolean;
195
+ /**
196
+ * Whether to show the end handle, default is true
197
+ */
198
+ showEndHandle?: boolean;
199
+ };
200
+ success?: Callback<{
201
+ /**
202
+ * Bounding rectangle of the selected text
203
+ */
204
+ boundingRect: Rect;
205
+ /**
206
+ * Rectangles of the selected text
207
+ */
208
+ boxes: Rect[];
209
+ /**
210
+ * Handles of the selected text
211
+ */
212
+ handles: Handle[]
213
+ }>;
214
+ }
215
+
216
+ /**
217
+ * Gets the bounding rectangle of the text.
218
+ * @Android
219
+ * @iOS
220
+ * @PC
221
+ * @since 2.18
222
+ */
223
+ interface GetTextBoundingRectMethod extends BaseMethod {
224
+ method: 'getTextBoundingRect';
225
+ params: {
226
+ /**
227
+ * Start index of the text
228
+ */
229
+ start: number;
230
+ /**
231
+ * End index of the text
232
+ */
233
+ end: number;
234
+ };
235
+ success?: Callback<{
236
+ /**
237
+ * Bounding rectangle of the text
238
+ */
239
+ boundingRect: Rect;
240
+ /**
241
+ * Rectangles of the text
242
+ */
243
+ boxes: Rect[];
244
+ }>;
245
+ }
246
+
247
+ /**
248
+ * Gets the selected text.
249
+ * @Android
250
+ * @iOS
251
+ * @since 2.18
252
+ */
253
+ interface GetSelectedTextMethod extends BaseMethod {
254
+ method: 'getSelectedText';
255
+ success?: Callback<{
256
+ selectedText: string;
257
+ }>;
258
+ }
259
+
260
+ export type TextUIMethods = SetTextSelectionMethod | GetTextBoundingRectMethod | GetSelectedTextMethod;