@lynx-js/types 3.3.0 → 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.
@@ -11,7 +11,11 @@ import { StandardProps } from '../props';
11
11
  export interface ImageProps extends StandardProps {
12
12
  /**
13
13
  * Supports http/https/base64
14
- * @defaultValue ""
14
+ * @defaultValue undefined
15
+ * @iOS
16
+ * @Android
17
+ * @Harmony
18
+ * @PC
15
19
  * @since 0.2
16
20
  */
17
21
  src?: string;
@@ -22,8 +26,12 @@ export interface ImageProps extends StandardProps {
22
26
  * aspectFit: Scales the image while preserving aspect ratio so that the long side is fully visible
23
27
  * aspectFill: Scales the image while preserving aspect ratio, ensuring the short side fills the element
24
28
  * center: Does not scale the image; image is centered
25
- * @defaultValue "scaleToFill"
29
+ * @defaultValue 'scaleToFill'
26
30
  * @since 0.2
31
+ * @iOS
32
+ * @Android
33
+ * @Harmony
34
+ * @PC
27
35
  */
28
36
  mode?: 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'center';
29
37
 
@@ -31,72 +39,93 @@ export interface ImageProps extends StandardProps {
31
39
  * ARGB_8888: 32-bit memory per pixel, supports semi-transparent images
32
40
  * RGB_565: 16-bit memory per pixel, reduces memory usage but loses transparency
33
41
  * @defaultValue "ARGB_8888"
42
+ * @Android
34
43
  * @since 1.4
35
44
  */
36
45
  'image-config'?: 'ARGB_8888' | 'RGB_565';
37
46
 
38
47
  /**
39
48
  * Placeholder image, used same as src
40
- * @defaultValue ""
49
+ * @iOS
50
+ * @Android
51
+ * @Harmony
52
+ * @PC
41
53
  * @since 1.4
42
54
  */
43
55
  placeholder?: string;
44
56
 
45
57
  /**
46
58
  * Image blur radius
47
- * @defaultValue "3px"
59
+ * @iOS
60
+ * @Android
61
+ * @Harmony
62
+ * @PC
48
63
  * @since 0.2
49
64
  */
50
65
  'blur-radius'?: string;
51
66
 
52
67
  /**
53
68
  * Stretchable area for 9patch images, in percentage or decimal, four values for top, right, bottom, left
54
- * @defaultValue "0.2 10% 0.3 20%"
69
+ * @iOS
70
+ * @Android
71
+ * @Harmony
72
+ * @PC
55
73
  * @since 1.4
56
74
  */
57
75
  'cap-insets'?: string;
58
76
 
59
77
  /**
60
- * Number of times an animated image plays
78
+ * Adjust the scale of stretchable area for 9patch images
61
79
  * @defaultValue 1
80
+ * @iOS
81
+ * @Android
82
+ * @Harmony
83
+ * @PC
84
+ * @since 1.4
85
+ */
86
+ 'cap-insets-scale'?: number;
87
+
88
+ /**
89
+ * Number of times an animated image plays, 0 stands for infinite
90
+ * @defaultValue 0
91
+ * @iOS
92
+ * @Android
93
+ * @Harmony
94
+ * @PC
62
95
  * @since 1.4
63
96
  */
64
97
  'loop-count'?: number;
65
98
 
66
99
  /**
67
100
  * Image won't load if its size is 0, but will load if prefetch-width is set
68
- * @defaultValue "100px"
101
+ * @defaultValue "0px"
102
+ * @deprecated
103
+ * @iOS
104
+ * @Android
69
105
  * @since 1.4
70
106
  */
71
107
  'prefetch-width'?: string;
72
108
 
73
109
  /**
74
110
  * Image won't load if its size is 0, but will load if prefetch-height is set
75
- * @defaultValue "100px"
111
+ * @defaultValue "0px"
112
+ * @deprecated
113
+ * @iOS
114
+ * @Android
76
115
  * @since 1.4
77
116
  */
78
117
  'prefetch-height'?: string;
79
118
 
80
- /**
81
- * If true, URL mapping is skipped. LynxView's custom ImageInterceptor won't work
82
- * @defaultValue false
83
- * @since 1.5
84
- */
85
- 'skip-redirection'?: boolean;
86
-
87
- /**
88
- * Reduces the chance of OOM by downsampling large images, requires container support
89
- * @defaultValue false
90
- * @since iOS 2.0
91
- */
92
- downsampling?: boolean;
93
-
94
119
  /**
95
120
  * When set to true and the <image> element has no width or height,
96
121
  * the size of the <image> will be automatically adjusted
97
122
  * to match the image's original dimensions after the image is successfully loaded,
98
123
  * ensuring that the aspect ratio is maintained.
99
124
  * @defaultValue false
125
+ * @iOS
126
+ * @Android
127
+ * @Harmony
128
+ * @PC
100
129
  * @since 2.6
101
130
  */
102
131
  'auto-size'?: boolean;
@@ -106,6 +135,10 @@ export interface ImageProps extends StandardProps {
106
135
  * The default behavior is to clear the image resource before starting a new load.
107
136
  * This can resolve flickering issues when the image src is switched and reloaded. It is not recommended to enable this in scenarios where there is node reuse in views like lists.
108
137
  * @defaultValue false
138
+ * @iOS
139
+ * @Android
140
+ * @Harmony
141
+ * @PC
109
142
  * @since 2.7
110
143
  */
111
144
  'defer-src-invalidation'?: boolean;
@@ -113,66 +146,42 @@ export interface ImageProps extends StandardProps {
113
146
  /**
114
147
  * Specifies whether the animated image should start playing automatically once it is loaded.
115
148
  * @defaultValue true
149
+ * @iOS
150
+ * @Android
151
+ * @Harmony
152
+ * @PC
116
153
  * @since 2.11
117
154
  */
118
155
  'autoplay'?: boolean;
119
156
 
120
157
  /**
121
158
  * Changes the color of all non-transparent pixels to the tint-color specified. The value is a <color>.
122
- * @defaultValue ""
159
+ * @iOS
160
+ * @Android
161
+ * @Harmony
123
162
  * @since 2.12
124
163
  */
125
164
  'tint-color'?: string;
126
165
 
127
- /**
128
- * Support outputting image monitoring information in bindload
129
- * @defaultValue false
130
- * @since 2.12
131
- */
132
- 'extra-load-info'?: boolean;
133
-
134
- /**
135
- * Disables unexpected iOS built-in animations
136
- * @defaultValue true
137
- * @since iOS 2.0
138
- */
139
- 'implicit-animation'?: boolean;
140
-
141
- /**
142
- * Add custom parameters to image
143
- * @since 2.17
144
- */
145
- 'additional-custom-info'?: { [key: string]: string };
146
-
147
166
  /**
148
167
  * Image load success event
168
+ * @iOS
169
+ * @Android
170
+ * @Harmony
171
+ * @PC
149
172
  * @since 0.2
150
173
  */
151
174
  bindload?: (e: LoadEvent) => void;
152
175
 
153
176
  /**
154
177
  * Image load error event
178
+ * @iOS
179
+ * @Android
180
+ * @Harmony
181
+ * @PC
155
182
  * @since 0.2
156
183
  */
157
184
  binderror?: (e: ErrorEvent) => void;
158
-
159
- /**
160
- * The animation will call back when it starts playing.
161
- * @since 2.11
162
- */
163
- bindstartplay?: (e: BaseEvent) => void;
164
-
165
- /**
166
- * Call back after one loop time of the animation is played.
167
- * @since 2.11
168
- */
169
- bindcurrentloopcomplete?: (e: BaseEvent) => void;
170
-
171
- /**
172
- * It will be called after the animation has been played for all loop-count times. If the loop-count is not set, it will not be called back.
173
- * @since 2.11
174
- */
175
- bindfinalloopcomplete?: (e: BaseEvent) => void;
176
185
  }
177
186
 
178
187
  export type LoadEvent = BaseEvent<'load', ImageLoadEvent>;
@@ -180,8 +189,10 @@ export type ErrorEvent = BaseEvent<'error', ImageErrorEvent>;
180
189
 
181
190
  /**
182
191
  * Restart the animation playback method controlled by the front end, and the animation playback progress and loop count will be reset.
183
- * @Android
184
192
  * @iOS
193
+ * @Android
194
+ * @Harmony
195
+ * @PC
185
196
  * @deprecated Deprecated. Some scenarios may not call back the call result. It is recommended to use resumeAnimation instead.
186
197
  */
187
198
  export interface ImageStartAnimMethod extends BaseMethod {
@@ -190,8 +201,10 @@ export interface ImageStartAnimMethod extends BaseMethod {
190
201
 
191
202
  /**
192
203
  * Resumes the animation, without resetting the loop-count.
193
- * @Android
194
204
  * @iOS
205
+ * @Android
206
+ * @Harmony
207
+ * @PC
195
208
  * @since 2.11
196
209
  */
197
210
  export interface ImageResumeAnimMethod extends BaseMethod {
@@ -200,8 +213,10 @@ export interface ImageResumeAnimMethod extends BaseMethod {
200
213
 
201
214
  /**
202
215
  * Pauses the animation, without resetting the loop-count.
203
- * @Android
204
216
  * @iOS
217
+ * @Android
218
+ * @Harmony
219
+ * @PC
205
220
  * @since 2.11
206
221
  */
207
222
  export interface ImagePauseAnimMethod extends BaseMethod {
@@ -210,8 +225,10 @@ export interface ImagePauseAnimMethod extends BaseMethod {
210
225
 
211
226
  /**
212
227
  * Stops the animation, and it will reset the loop-count.
213
- * @Android
214
228
  * @iOS
229
+ * @Android
230
+ * @Harmony
231
+ * @PC
215
232
  * @since 2.11
216
233
  */
217
234
  export interface ImageStopAnimMethod extends BaseMethod {
@@ -10,6 +10,8 @@ export * from './page';
10
10
  export * from './scroll-view';
11
11
  export * from './text';
12
12
  export * from './view';
13
+ export * from './input';
14
+ export * from './textarea';
13
15
  export * from './element';
14
16
  export * from './methods';
15
17
  export * from './attributes';
@@ -0,0 +1,386 @@
1
+ import { BaseEvent, BaseMethod, Callback } from '../events';
2
+ import { StandardProps } from '../props';
3
+
4
+ export interface InputFocusEvent {
5
+ /**
6
+ * Input content
7
+ * @Android
8
+ * @iOS
9
+ * @Harmony
10
+ * @Web
11
+ * @since 3.4
12
+ */
13
+ value: string;
14
+ }
15
+
16
+ export interface InputBlurEvent {
17
+ /**
18
+ * Input content
19
+ * @Android
20
+ * @iOS
21
+ * @Harmony
22
+ * @Web
23
+ * @since 3.4
24
+ */
25
+ value: string;
26
+ }
27
+
28
+ export interface InputConfirmEvent {
29
+ /**
30
+ * Input content
31
+ * @Android
32
+ * @iOS
33
+ * @Harmony
34
+ * @Web
35
+ * @since 3.4
36
+ */
37
+ value: string;
38
+ }
39
+
40
+ export interface InputInputEvent {
41
+ /**
42
+ * Input content
43
+ * @Android
44
+ * @iOS
45
+ * @Harmony
46
+ * @Web
47
+ * @since 3.4
48
+ */
49
+ value: string;
50
+ /**
51
+ * The start position of the selection
52
+ * @Android
53
+ * @iOS
54
+ * @Harmony
55
+ * @Web
56
+ * @since 3.4
57
+ */
58
+ selectionStart: number;
59
+ /**
60
+ * The end position of the selection
61
+ * @Android
62
+ * @iOS
63
+ * @Harmony
64
+ * @Web
65
+ * @since 3.4
66
+ */
67
+ selectionEnd: number;
68
+ /**
69
+ * Is composing or not
70
+ * @iOS
71
+ * @Android
72
+ * @Harmony
73
+ * @Web
74
+ * @since 3.4
75
+ */
76
+ isComposing?: boolean;
77
+ }
78
+
79
+ export interface InputSelectionEvent {
80
+ /**
81
+ * The start position of the selection
82
+ * @Android
83
+ * @iOS
84
+ * @Harmony
85
+ * @Web
86
+ * @since 3.4
87
+ */
88
+ selectionStart: number;
89
+ /**
90
+ * The end position of the selection
91
+ * @Android
92
+ * @iOS
93
+ * @Harmony
94
+ * @Web
95
+ * @since 3.4
96
+ */
97
+ selectionEnd: number;
98
+ }
99
+
100
+ export interface InputProps extends Omit<StandardProps, 'bindfocus' | 'bindblur'> {
101
+ /**
102
+ * Placeholder
103
+ * @Android
104
+ * @iOS
105
+ * @Harmony
106
+ * @Web
107
+ * @since 3.4
108
+ */
109
+ placeholder?: string
110
+ /**
111
+ * The type of confirm button
112
+ * @defaultValue 'send'
113
+ * @Android
114
+ * @iOS
115
+ * @Harmony
116
+ * @Web
117
+ * @since 3.4
118
+ */
119
+ 'confirm-type'?: 'send' | 'search' | 'go' | 'done' | 'next';
120
+ /**
121
+ * Max input length
122
+ * @defaultValue 140
123
+ * @Android
124
+ * @iOS
125
+ * @Harmony
126
+ * @Web
127
+ * @since 3.4
128
+ */
129
+ maxlength?: number;
130
+ /**
131
+ * Readonly
132
+ * @defaultValue false
133
+ * @Android
134
+ * @iOS
135
+ * @Harmony
136
+ * @Web
137
+ * @since 3.4
138
+ */
139
+ readonly?: boolean;
140
+ /**
141
+ * Interaction enabled
142
+ * @defaultValue false
143
+ * @Android
144
+ * @iOS
145
+ * @Harmony
146
+ * @since 3.5
147
+ */
148
+ disabled?: boolean;
149
+ /**
150
+ * Show soft input keyboard while focused
151
+ * @defaultValue true
152
+ * @Android
153
+ * @iOS
154
+ * @Harmony
155
+ * @since 3.4
156
+ */
157
+ 'show-soft-input-on-focus'?: boolean;
158
+
159
+ /**
160
+ * Filter the input content and process it in the form of regular expressions
161
+ * @defaultValue undefined
162
+ * @Android
163
+ * @iOS
164
+ * @Harmony
165
+ * @Web
166
+ * @since 3.4
167
+ */
168
+ 'input-filter'?: string;
169
+
170
+ /**
171
+ * Input content type
172
+ * @defaultValue "text"
173
+ * @Android
174
+ * @iOS
175
+ * @Harmony
176
+ * @Web
177
+ * @since 3.4
178
+ */
179
+ type?: 'text' | 'number' | 'digit' | 'password' | 'tel' | 'email';
180
+
181
+ /**
182
+ * Auto correct input content on iOS
183
+ * @defaultValue true
184
+ * @iOS
185
+ * @since 3.4
186
+ */
187
+ 'ios-auto-correct'?: boolean;
188
+
189
+ /**
190
+ * Check spelling issue on iOS
191
+ * @defaultValue true
192
+ * @iOS
193
+ * @Web
194
+ * @since 3.4
195
+ */
196
+ 'ios-spell-check'?: boolean;
197
+
198
+ /**
199
+ * Whether to enter the full-screen input mode when in landscape screen, in which the keyboard and input box will take up the entire screen
200
+ * @defaultValue true
201
+ * @Android
202
+ * @since 3.4
203
+ */
204
+ 'android-fullscreen-mode'?: boolean;
205
+
206
+ /**
207
+ * Focused
208
+ * @Android
209
+ * @iOS
210
+ * @Harmony
211
+ * @Web
212
+ * @since 3.4
213
+ */
214
+ bindfocus?: (e: BaseEvent<'bindfocus', InputFocusEvent>) => void;
215
+
216
+ /**
217
+ * Blurred
218
+ * @Android
219
+ * @iOS
220
+ * @Harmony
221
+ * @Web
222
+ * @since 3.4
223
+ */
224
+ bindblur?: (e: BaseEvent<'bindblur', InputBlurEvent>) => void;
225
+
226
+ /**
227
+ * Confirm button clicked
228
+ * @Android
229
+ * @iOS
230
+ * @Harmony
231
+ * @Web
232
+ * @since 3.4
233
+ */
234
+ bindconfirm?: (e: BaseEvent<'bindconfirm', InputConfirmEvent>) => void;
235
+
236
+ /**
237
+ * Input content changed
238
+ * @Android
239
+ * @iOS
240
+ * @Harmony
241
+ * @Web
242
+ * @since 3.4
243
+ */
244
+ bindinput?: (e: BaseEvent<'bindinput', InputInputEvent>) => void;
245
+
246
+ /**
247
+ * Input selection changed
248
+ * @Android
249
+ * @iOS
250
+ * @Harmony
251
+ * @Web
252
+ * @since 3.4
253
+ */
254
+ bindselection?: (e: BaseEvent<'bindselection', InputSelectionEvent>) => void;
255
+ }
256
+
257
+ /**
258
+ * Require focus
259
+ * @Android
260
+ * @iOS
261
+ * @Harmony
262
+ * @Web
263
+ * @since 3.4
264
+ */
265
+ export interface InputFocusMethod extends BaseMethod {
266
+ method: 'focus';
267
+ }
268
+
269
+ /**
270
+ * Release focus
271
+ * @Android
272
+ * @iOS
273
+ * @Harmony
274
+ * @Web
275
+ * @since 3.4
276
+ */
277
+ export interface InputBlurMethod extends BaseMethod {
278
+ method: 'blur';
279
+ }
280
+
281
+ /**
282
+ * Get input content
283
+ * @Android
284
+ * @iOS
285
+ * @Harmony
286
+ * @Web
287
+ * @since 3.4
288
+ */
289
+ export interface InputGetValueMethod extends BaseMethod {
290
+ method: 'getValue';
291
+ success?: Callback<{
292
+ /**
293
+ * Input content
294
+ * @Android
295
+ * @iOS
296
+ * @Harmony
297
+ * @Web
298
+ * @since 3.4
299
+ */
300
+ value: string;
301
+ /**
302
+ * Begin position of the selection
303
+ * @Android
304
+ * @iOS
305
+ * @Harmony
306
+ * @Web
307
+ * @since 3.4
308
+ */
309
+ selectionStart: number;
310
+ /**
311
+ * End position of the selection
312
+ * @Android
313
+ * @iOS
314
+ * @Harmony
315
+ * @Web
316
+ * @since 3.4
317
+ */
318
+ selectionEnd: number;
319
+ /**
320
+ * Is composing or not, iOS only
321
+ * @Android
322
+ * @iOS
323
+ * @Harmony
324
+ * @Web
325
+ * @since 3.4
326
+ */
327
+ isComposing: boolean;
328
+ }>;
329
+ }
330
+
331
+ /**
332
+ * Set input content
333
+ * @Android
334
+ * @iOS
335
+ * @Harmony
336
+ * @Web
337
+ * @since 3.4
338
+ */
339
+ export interface InputSetValueMethod extends BaseMethod {
340
+ method: 'setValue';
341
+ params: {
342
+ /**
343
+ * Input content
344
+ * @Android
345
+ * @iOS
346
+ * @Harmony
347
+ * @Web
348
+ * @since 3.4
349
+ */
350
+ value: string;
351
+ };
352
+ }
353
+
354
+ /**
355
+ * Set selection range
356
+ * @Android
357
+ * @iOS
358
+ * @Harmony
359
+ * @Web
360
+ * @since 3.4
361
+ */
362
+ export interface InputSetSelectionRangeMethod extends BaseMethod {
363
+ method: 'setSelectionRange';
364
+ params: {
365
+ /**
366
+ * Start position of the selection
367
+ * @Android
368
+ * @iOS
369
+ * @Harmony
370
+ * @Web
371
+ * @since 3.4
372
+ */
373
+ selectionStart: number;
374
+ /**
375
+ * End position of the selection
376
+ * @Android
377
+ * @iOS
378
+ * @Harmony
379
+ * @Web
380
+ * @since 3.4
381
+ */
382
+ selectionEnd: number;
383
+ };
384
+ }
385
+
386
+ export type InputUIMethods = InputFocusMethod | InputBlurMethod | InputGetValueMethod | InputSetValueMethod | InputSetSelectionRangeMethod;