@lynx-js/types 3.5.10-beta.0 → 3.6.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.
package/CHANGELOG.md CHANGED
@@ -1,7 +1,25 @@
1
1
  # CHANGELOG
2
- ## 3.5.10
2
+
3
+ ## 3.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add new reporting fields for `ImageLoadEvent`
8
+
9
+ - Add `lynx.stopExposure` and `lynx.resumeExposure` APIs.
10
+
3
11
  - Fix list-type to avoid incompatible type error.
4
12
 
13
+ - Introduce `item-key` on `list.scrollToPosition`.
14
+
15
+ - Introduce `enable-scroll-bar` property for `<textarea>` element.
16
+
17
+ - Support `bindload` on `frame` element.
18
+
19
+ - Introduce `<overlay>` element.
20
+
21
+ - Introduce `global-props` property for `<frame>` element.
22
+
5
23
  ## 3.5.9
6
24
  - Update `list` and `list-item` typings.
7
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/types",
3
- "version": "3.5.10-beta.0",
3
+ "version": "3.6.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lynx",
@@ -88,6 +88,10 @@ export interface MetricFspEntry extends PerformanceEntry {
88
88
  fsp: PerformanceMetric;
89
89
  lynxFsp: PerformanceMetric;
90
90
  totalFsp: PerformanceMetric;
91
+ fspStatus: string;
92
+ contentFillRatioX: number;
93
+ contentFillRatioY: number;
94
+ contentFillRatioTotalArea: number;
91
95
  }
92
96
 
93
97
  export interface MetricActualFmpEntry extends PerformanceEntry {
@@ -16,6 +16,7 @@ import { ViewProps } from './view';
16
16
  import { InputProps, InputUIMethods } from './input';
17
17
  import { TextAreaProps, TextAreaUIMethods } from './textarea';
18
18
  import { FrameProps } from './frame';
19
+ import { OverlayProps} from './overlay';
19
20
 
20
21
 
21
22
  export interface UIMethods {
@@ -48,6 +49,7 @@ export interface IntrinsicElements {
48
49
  'input': InputProps;
49
50
  'textarea': TextAreaProps;
50
51
  'frame': FrameProps;
52
+ 'overlay': OverlayProps;
51
53
  }
52
54
 
53
55
  declare module 'react' {
@@ -71,6 +73,7 @@ declare module 'react' {
71
73
  'input': InputProps;
72
74
  'textarea': TextAreaProps;
73
75
  'frame': FrameProps;
76
+ 'overlay': OverlayProps;
74
77
  }
75
78
  }
76
79
  }
@@ -3,11 +3,11 @@
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
5
  import { StandardProps } from '../props';
6
+ import { BaseEvent, BaseEventOrig, Target } from '../events';
6
7
 
7
8
  export interface FrameProps extends StandardProps {
8
9
  /**
9
10
  * Sets the loading path for the frame resource.
10
- * @defaultValue undefined
11
11
  * @iOS
12
12
  * @Android
13
13
  * @since 3.4
@@ -16,10 +16,53 @@ export interface FrameProps extends StandardProps {
16
16
 
17
17
  /**
18
18
  * Passes data to the nested Lynx page within the frame.
19
- * @defaultValue undefined
20
19
  * @iOS
21
20
  * @Android
22
21
  * @since 3.4
23
22
  */
24
23
  data?: Record<string, unknown> | undefined;
25
- }
24
+
25
+ /**
26
+ * Bind frame load event callback.
27
+ * @iOS
28
+ * @Android
29
+ * @since 3.6
30
+ */
31
+ bindload?: (e: FrameLoadEvent) => void;
32
+
33
+ /**
34
+ * Pass global props to the nested Lynx page within the frame.
35
+ * @iOS
36
+ * @Android
37
+ * @since 3.6
38
+ */
39
+ 'global-props'?: Record<string, unknown>;
40
+ }
41
+
42
+ export interface BaseFrameLoadInfo {
43
+ /**
44
+ * The loaded url of the frame.
45
+ * @Android
46
+ * @iOS
47
+ * @since 3.6
48
+ */
49
+ url: string;
50
+
51
+ /**
52
+ * Frame loaded status code.
53
+ * @Android
54
+ * @iOS
55
+ * @since 3.6
56
+ */
57
+ statusCode: number;
58
+
59
+ /**
60
+ * Frame loaded status message.
61
+ * @Android
62
+ * @iOS
63
+ * @since 3.6
64
+ */
65
+ statusMessage: string;
66
+ }
67
+
68
+ export type FrameLoadEvent = BaseEvent<'bindload', BaseFrameLoadInfo>;
@@ -119,8 +119,8 @@ export interface ImageProps extends StandardProps {
119
119
  'prefetch-height'?: string;
120
120
 
121
121
  /**
122
- * When set to true and the <image> element has no width or height,
123
- * the size of the <image> will be automatically adjusted
122
+ * When set to true and the `<image>` element has no width or height,
123
+ * the size of the `<image>` will be automatically adjusted
124
124
  * to match the image's original dimensions after the image is successfully loaded,
125
125
  * ensuring that the aspect ratio is maintained.
126
126
  * @defaultValue false
@@ -133,7 +133,7 @@ export interface ImageProps extends StandardProps {
133
133
  'auto-size'?: boolean;
134
134
 
135
135
  /**
136
- * When set to true, the <image> will only clear the previously displayed image resource after a new image has successfully loaded.
136
+ * When set to true, the `<image>` will only clear the previously displayed image resource after a new image has successfully loaded.
137
137
  * The default behavior is to clear the image resource before starting a new load.
138
138
  * 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.
139
139
  * @defaultValue false
@@ -157,7 +157,7 @@ export interface ImageProps extends StandardProps {
157
157
  'autoplay'?: boolean;
158
158
 
159
159
  /**
160
- * Changes the color of all non-transparent pixels to the tint-color specified. The value is a <color>.
160
+ * Changes the color of all non-transparent pixels to the tint-color specified. The value is a `<color>`.
161
161
  * @iOS
162
162
  * @Android
163
163
  * @Harmony
@@ -18,3 +18,4 @@ export * from './methods';
18
18
  export * from './attributes';
19
19
  export * from './common';
20
20
  export * from './frame';
21
+ export * from './overlay';
@@ -661,6 +661,15 @@ export interface ScrollToPositionParams {
661
661
  */
662
662
  offset?: number;
663
663
 
664
+ /**
665
+ * Specify the unique identifier of the node to scroll to. If `item-key` is specified, `index` will be ignored.
666
+ * @Android
667
+ * @iOS
668
+ * @Harmony
669
+ * @since 3.6
670
+ */
671
+ itemKey?: string;
672
+
664
673
  /**
665
674
  * Enable scroll animation during scroll.
666
675
  * @defaultValue false
@@ -0,0 +1,131 @@
1
+ // Copyright 2025 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 { StandardProps } from '../props';
6
+ import { BaseEvent } from '../events';
7
+
8
+ export enum OverlayTouchState {
9
+ OverlayTouchStateDown = 0,
10
+ OverlayTouchStateMove = 1,
11
+ OverlayTouchStateUp = 2,
12
+ OverlayTouchStateCancel = 3,
13
+ }
14
+
15
+ export interface OverlayError {
16
+ /**
17
+ * Error code: 0 - Display normally; non-0 - Unable to display, you can try to solve it by using the preloading scheme mentioned below for adapting containers.
18
+ * @Android
19
+ */
20
+ errorCode: string;
21
+ /**
22
+ * Error message
23
+ * @Android
24
+ */
25
+ errorMsg: string;
26
+ }
27
+
28
+ export interface OverlayTouch {
29
+ /**
30
+ * x position relative to the window, in px
31
+ * @Android
32
+ * @iOS
33
+ * @PC
34
+ */
35
+ x: number;
36
+ /**
37
+ * y position relative to the window, in px
38
+ * @Android
39
+ * @iOS
40
+ * @PC
41
+ */
42
+ y: number;
43
+ /**
44
+ * Touch state
45
+ * @Android
46
+ * @iOS
47
+ * @PC
48
+ */
49
+ state: OverlayTouchState;
50
+ }
51
+
52
+ export interface OverlayProps extends Omit<StandardProps, 'binderror'> {
53
+
54
+ /**
55
+ * Control whether the overlay is displayed
56
+ * @Android
57
+ * @iOS
58
+ * @Harmony
59
+ * @PC
60
+ * @defaultValue false
61
+ */
62
+ visible?: boolean;
63
+
64
+ /**
65
+ * Introduces the concept of layers, which are divided into four levels. The larger the layer, the closer it is to the bottom. By default, it is the first level. The layers are arranged in order from 1 to 4. The displayed layer is specified and is not affected by the order of display. Within each layer, the arrangement is based on the 'last in, first out' logic. The layer cannot be dynamically adjusted when the overlay is displayed, and can only be adjusted when it is hidden. * @Android
66
+ * @iOS
67
+ * @Android
68
+ * @Harmony
69
+ * @PC
70
+ * @defaultValue 1
71
+ */
72
+ level?: 1 | 2 | 3 | 4;
73
+
74
+ /**
75
+ * When overlay is displayed, 'true' allows swiping right to close the current page, 'false' does not allow it
76
+ * @iOS
77
+ * @defaultValue false
78
+ */
79
+ 'ios-enable-swipe-back'?: boolean;
80
+
81
+ /**
82
+ * Specifies the level at which the overlay content resides on iOS. window: Mounted on the window, the top level of the app; top: Mounted on the topViewController; page: Mounted on UINavigationController; others: customize the name of class in the client.
83
+ * @iOS
84
+ * @defaultValue 'window'
85
+ */
86
+ mode?: 'window' | 'top' | 'page' | string;
87
+
88
+ /**
89
+ * Callback when the overlay is displayed
90
+ * @Android
91
+ * @iOS
92
+ * @Harmony
93
+ * @PC
94
+ */
95
+ bindshowoverlay?: (e: BaseEvent) => void;
96
+
97
+ /**
98
+ * Callback when the overlay is hidden.
99
+ * @Android
100
+ * @iOS
101
+ * @Harmony
102
+ * @PC
103
+ */
104
+ binddismissoverlay?: (e: BaseEvent) => void;
105
+
106
+ /**
107
+ * Callback when the back button is clicked.
108
+ * @Android
109
+ * @Harmony
110
+ * @PC
111
+ */
112
+ bindrequestclose?: (e: BaseEvent) => void;
113
+
114
+ /**
115
+ * Callback when touch on the overlay
116
+ * @Android
117
+ * @iOS
118
+ * @PC
119
+ */
120
+ bindoverlaytouch?: (e: OverlayTouchEvent) => void;
121
+
122
+ /**
123
+ * Callback when touch on the overlay
124
+ * @Android
125
+ * @since 2.18
126
+ */
127
+ binderror?: (e: OverlayErrorEvent) => void;
128
+ }
129
+
130
+ export type OverlayTouchEvent = BaseEvent<'bindoverlaytouch', OverlayTouch>;
131
+ export type OverlayErrorEvent = BaseEvent<'binderror', OverlayError>;
@@ -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, BaseMethod, EventHandler } from '../events';
5
+ import { BaseEvent, BaseMethod, EventHandler, Callback } from '../events';
6
6
  import { StandardProps } from '../props';
7
7
  import {
8
8
  ContentSizeChangedEvent,
@@ -232,4 +232,41 @@ export interface ScrollViewAutoScrollMethod extends BaseMethod {
232
232
  };
233
233
  }
234
234
 
235
- export type ScrollViewUIMethods = ScrollViewScrollToMethod | ScrollViewScrollByMethod | ScrollViewAutoScrollMethod;
235
+ /**
236
+ * Get scroll info
237
+ * @Android
238
+ * @iOS
239
+ * @Harmony
240
+ * @PC
241
+ */
242
+ export interface ScrollViewGetScrollInfoMethod extends BaseMethod {
243
+ method: 'getScrollInfo';
244
+ success?: Callback<{
245
+ /**
246
+ * Content offset on X-axis, in PX
247
+ * @Android
248
+ * @iOS
249
+ * @Harmony
250
+ * @PC
251
+ */
252
+ scrollX: number;
253
+ /**
254
+ * Content offset on Y-axis, in PX
255
+ * @Android
256
+ * @iOS
257
+ * @Harmony
258
+ * @PC
259
+ */
260
+ scrollY: number;
261
+ /**
262
+ * Total scrollable range along orientation, in PX
263
+ * @Android
264
+ * @iOS
265
+ * @Harmony
266
+ * @PC
267
+ */
268
+ scrollRange: number;
269
+ }>;
270
+ }
271
+
272
+ export type ScrollViewUIMethods = ScrollViewScrollToMethod | ScrollViewScrollByMethod | ScrollViewAutoScrollMethod | ScrollViewGetScrollInfoMethod;
@@ -192,6 +192,15 @@ export interface TextAreaProps extends Omit<StandardProps, 'bindfocus' | 'bindbl
192
192
  */
193
193
  'input-filter'?: string;
194
194
 
195
+ /**
196
+ * Whether to show scroll bar, on HarmonyOS, the scroll bar will always be shown
197
+ * @defaultValue false
198
+ * @Android
199
+ * @iOS
200
+ * @since 3.6
201
+ */
202
+ 'enable-scroll-bar'?: boolean;
203
+
195
204
  /**
196
205
  * Input content type
197
206
  * @defaultValue "text"
@@ -116,8 +116,14 @@ export interface BaseMouseEvent<T> extends BaseEventOrig<{}, T> {
116
116
  * @PC
117
117
  */
118
118
  buttons: number;
119
- /**
120
- * clientX
119
+
120
+ /**
121
+ * Current scale factor. Greater than 1 means zoom in. Less than 1 means zoom out.
122
+ * @PC
123
+ */
124
+ scale: number;
125
+ /**
126
+ * clientX
121
127
  * @PC
122
128
  */
123
129
  x: number;
@@ -283,8 +289,69 @@ export interface BaseImageLoadEvent<T> extends BaseEventOrig<{}, T> {
283
289
  }
284
290
 
285
291
  export interface ImageLoadEvent extends BaseImageLoadEvent<Target> {
286
- width: number;
287
- height: number;
292
+ /**
293
+ * Image start loading timestamp, Unit (ms).
294
+ * @Android
295
+ * @iOS
296
+ * @since 3.6
297
+ */
298
+ load_start?: number;
299
+
300
+ /**
301
+ * Image loading completion timestamp, Unit (ms). It mainly includes image downloading and image decoding.
302
+ * @Android
303
+ * @iOS
304
+ * @since 3.6
305
+ */
306
+ load_finish?: number;
307
+
308
+ /**
309
+ * Image loading duration (load_finish - load_start), Unit (ms).
310
+ * @Android
311
+ * @iOS
312
+ * @since 3.6
313
+ */
314
+ cost?: number;
315
+
316
+ /**
317
+ * image URI.
318
+ * @Android
319
+ * @iOS
320
+ * @since 3.6
321
+ */
322
+ src?: string;
323
+
324
+ /**
325
+ * image view width. Unit: (px)
326
+ * @Android
327
+ * @iOS
328
+ * @since 3.6
329
+ */
330
+ view_width?: number,
331
+
332
+ /**
333
+ * image view height. Unit: (px)
334
+ * @Android
335
+ * @iOS
336
+ * @since 3.6
337
+ */
338
+ view_height?: number;
339
+
340
+ /**
341
+ * Image memory size, Unit: Byte (B).
342
+ * @Android
343
+ * @iOS
344
+ * @since 3.6
345
+ */
346
+ memory_cost?: number;
347
+
348
+ /**
349
+ * Source of image, network download, memory cache or disk cache.
350
+ * @Android
351
+ * @iOS
352
+ * @since 3.6
353
+ */
354
+ origin?: number;
288
355
  }
289
356
 
290
357
 
@@ -720,7 +787,13 @@ export interface LynxEvent<T> {
720
787
  */
721
788
  Wheel?: EventHandler<BaseWheelEvent<T>>;
722
789
 
723
- /**
790
+ /**
791
+ * Zoom gesture in the trackpaad
792
+ * @PC
793
+ */
794
+ Zoom?: EventHandler<BaseMouseEvent<T>>;
795
+
796
+ /**
724
797
  * Keyboard (or remote control) button pressed.
725
798
  * @PC
726
799
  */
@@ -835,6 +908,7 @@ interface MouseClickProps<T> { bindmouseclick?: LynxEvent<T>['MouseClick']; catc
835
908
  interface MouseDblClickProps<T> { bindmousedblclick?: LynxEvent<T>['MouseDblClick']; catchmousedblclick?: LynxEvent<T>['MouseDblClick']; 'capture-bindmousedblclick'?: LynxEvent<T>['MouseDblClick']; 'capture-catchmousedblclick'?: LynxEvent<T>['MouseDblClick']; 'global-bindmousedblclick'?: LynxEvent<T>['MouseDblClick']; }
836
909
  interface MouseLongPressProps<T> { bindmouselongpress?: LynxEvent<T>['MouseLongPress']; catchmouselongpress?: LynxEvent<T>['MouseLongPress']; 'capture-bindmouselongpress'?: LynxEvent<T>['MouseLongPress']; 'capture-catchmouselongpress'?: LynxEvent<T>['MouseLongPress']; 'global-bindmouselongpress'?: LynxEvent<T>['MouseLongPress']; }
837
910
  interface WheelProps<T> { bindwheel?: LynxEvent<T>['Wheel']; catchwheel?: LynxEvent<T>['Wheel']; 'capture-bindwheel'?: LynxEvent<T>['Wheel']; 'capture-catchwheel'?: LynxEvent<T>['Wheel']; 'global-bindwheel'?: LynxEvent<T>['Wheel']; }
911
+ interface ZoomProps<T> { bindzoom?: LynxEvent<T>['Zoom']; catchzoom?: LynxEvent<T>['Zoom']; 'capture-bindzoom'?: LynxEvent<T>['Zoom']; 'capture-catchzoom'?: LynxEvent<T>['Zoom']; 'global-bindzoom'?: LynxEvent<T>['Zoom']; }
838
912
  interface KeyDownProps<T> { bindkeydown?: LynxEvent<T>['KeyDown']; catchkeydown?: LynxEvent<T>['KeyDown']; 'capture-bindkeydown'?: LynxEvent<T>['KeyDown']; 'capture-catchkeydown'?: LynxEvent<T>['KeyDown']; 'global-bindkeydown'?: LynxEvent<T>['KeyDown']; }
839
913
  interface KeyUpProps<T> { bindkeyup?: LynxEvent<T>['KeyUp']; catchkeyup?: LynxEvent<T>['KeyUp']; 'capture-bindkeyup'?: LynxEvent<T>['KeyUp']; 'capture-catchkeyup'?: LynxEvent<T>['KeyUp']; 'global-bindkeyup'?: LynxEvent<T>['KeyUp']; }
840
914
  interface FocusProps<T> { bindfocus?: LynxEvent<T>['Focus']; catchfocus?: LynxEvent<T>['Focus']; 'capture-bindfocus'?: LynxEvent<T>['Focus']; 'capture-catchfocus'?: LynxEvent<T>['Focus']; 'global-bindfocus'?: LynxEvent<T>['Focus']; }
@@ -871,6 +945,7 @@ export type LynxEventPropsBase<T> = BGLoadProps<T> &
871
945
  MouseDblClickProps<T> &
872
946
  MouseLongPressProps<T> &
873
947
  WheelProps<T> &
948
+ ZoomProps<T> &
874
949
  KeyDownProps<T> &
875
950
  KeyUpProps<T> &
876
951
  FocusProps<T> &
@@ -92,4 +92,6 @@ export interface CommonLynx {
92
92
  getNative(): ContextProxy;
93
93
  getEngine(): ContextProxy;
94
94
  fetchBundle(url: string, options?: {}): ResponseHandler;
95
+ stopExposure(options?: { sendEvent: boolean }): void;
96
+ resumeExposure(): void;
95
97
  }