@lynx-js/types 3.6.1-alpha.0 → 3.7.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,9 +1,25 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `experimental-search-ref-anchor-strategy` property for `<list>` element.
8
+
9
+ - Add `bindstartplay`, `bindcurrentloopcomplete` and `bindfinalloopcomplete` callback for animated image.
10
+
11
+ - Add global `getNapiLoader()` function.
12
+
13
+ - Add `<svg>` element types.
14
+
15
+ - Update `image` typings.
16
+
3
17
  ## 3.6.0
4
18
 
5
19
  ### Minor Changes
6
20
 
21
+ - Add `experimental-update-sticky-for-diff` property for list.
22
+
7
23
  - Add new reporting fields for `ImageLoadEvent`
8
24
 
9
25
  - Add `lynx.stopExposure` and `lynx.resumeExposure` APIs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/types",
3
- "version": "3.6.1-alpha.0",
3
+ "version": "3.7.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lynx",
@@ -4,6 +4,7 @@
4
4
  export interface PerformanceEntry {
5
5
  name: string;
6
6
  entryType: string;
7
+ typeResolved: boolean;
7
8
  }
8
9
 
9
10
  export interface FrameworkRenderingTiming {
@@ -35,6 +36,9 @@ export interface PipelineEntry extends PerformanceEntry {
35
36
  paintEnd: number;
36
37
  frameworkRenderingTiming: FrameworkRenderingTimings[keyof FrameworkRenderingTimings] & FrameworkRenderingTiming;
37
38
  hostPlatformTiming: HostPlatformTiming;
39
+ actualFmp?: PerformanceMetric;
40
+ lynxActualFmp?: PerformanceMetric;
41
+ totalActualFmp?: PerformanceMetric;
38
42
  }
39
43
 
40
44
  export interface LoadBundleEntry extends PipelineEntry {
@@ -48,8 +52,23 @@ export interface LoadBundleEntry extends PipelineEntry {
48
52
  verifyTasmEnd: number;
49
53
  ffiStart: number;
50
54
  ffiEnd: number;
55
+ createLynxStart: number;
56
+ createLynxEnd: number;
57
+ loadCoreStart: number;
58
+ loadCoreEnd: number;
59
+ openTime: number;
60
+ containerInitStart: number;
61
+ containerInitEnd: number;
62
+ prepareTemplateStart: number;
63
+ prepareTemplateEnd: number;
64
+ fcp?: PerformanceMetric;
65
+ lynxFcp: PerformanceMetric;
66
+ totalFcp?: PerformanceMetric;
51
67
  }
52
68
 
69
+ /**
70
+ * @deprecated LoadBundleEntry and ReloadBundleEntry contain all properties of InitContainerEntry
71
+ **/
53
72
  export interface InitContainerEntry extends PerformanceEntry {
54
73
  openTime: number;
55
74
  containerInitStart: number;
@@ -59,11 +78,17 @@ export interface InitContainerEntry extends PerformanceEntry {
59
78
  extraTiming: Record<string, number>;
60
79
  }
61
80
 
81
+ /**
82
+ * @deprecated LoadBundleEntry and ReloadBundleEntry contain all properties of InitLynxviewEntry
83
+ **/
62
84
  export interface InitLynxviewEntry extends PerformanceEntry {
63
85
  createLynxStart: number;
64
86
  createLynxEnd: number;
65
87
  }
66
88
 
89
+ /**
90
+ * @deprecated LoadBundleEntry and ReloadBundleEntry contain all properties of InitBackgroundRuntimeEntry
91
+ **/
67
92
  export interface InitBackgroundRuntimeEntry extends PerformanceEntry {
68
93
  loadCoreStart: number;
69
94
  loadCoreEnd: number;
@@ -78,6 +103,9 @@ export interface PerformanceMetric {
78
103
  endTimestamp: number;
79
104
  }
80
105
 
106
+ /**
107
+ * @deprecated LoadBundleEntry and ReloadBundleEntry contain all properties of MetricFcpEntry
108
+ **/
81
109
  export interface MetricFcpEntry extends PerformanceEntry {
82
110
  fcp: PerformanceMetric;
83
111
  lynxFcp: PerformanceMetric;
@@ -89,11 +117,15 @@ export interface MetricFspEntry extends PerformanceEntry {
89
117
  lynxFsp: PerformanceMetric;
90
118
  totalFsp: PerformanceMetric;
91
119
  fspStatus: string;
92
- contentFillRatioX: number;
93
- contentFillRatioY: number;
94
- contentFillRatioTotalArea: number;
120
+ contentFillPercentageX: number;
121
+ contentFillPercentageY: number;
122
+ contentFillPercentageTotalArea: number;
123
+ containerFillPercentageContainerArea: number;
95
124
  }
96
125
 
126
+ /**
127
+ * @deprecated PipelineEntry contain all properties of MetricActualFmpEntry
128
+ **/
97
129
  export interface MetricActualFmpEntry extends PerformanceEntry {
98
130
  actualFmp: PerformanceMetric;
99
131
  lynxActualFmp: PerformanceMetric;
@@ -118,16 +150,28 @@ export interface ReloadBundleEntry extends PipelineEntry {
118
150
  reloadBackgroundEnd: number;
119
151
  ffiStart: number;
120
152
  ffiEnd: number;
153
+ createLynxStart: number;
154
+ createLynxEnd: number;
155
+ loadCoreStart: number;
156
+ loadCoreEnd: number;
157
+ openTime: number;
158
+ containerInitStart: number;
159
+ containerInitEnd: number;
160
+ prepareTemplateStart: number;
161
+ prepareTemplateEnd: number;
162
+ fcp?: PerformanceMetric;
163
+ lynxFcp: PerformanceMetric;
164
+ totalFcp?: PerformanceMetric;
121
165
  }
122
166
 
123
167
  export interface MemoryUsageEntry extends PerformanceEntry {
124
- sizeBytes: any;
168
+ sizeBytes: number;
125
169
  detail: Record<string, MemoryUsageItem>;
126
170
  }
127
171
 
128
172
  export interface MemoryUsageItem {
129
173
  category: string;
130
- sizeBytes: any;
174
+ sizeBytes: number;
131
175
  detail: Record<string, string>;
132
176
  }
133
177
 
@@ -17,6 +17,7 @@ import { InputProps, InputUIMethods } from './input';
17
17
  import { TextAreaProps, TextAreaUIMethods } from './textarea';
18
18
  import { FrameProps } from './frame';
19
19
  import { OverlayProps} from './overlay';
20
+ import { SVGProps } from './svg';
20
21
 
21
22
 
22
23
  export interface UIMethods {
@@ -50,6 +51,7 @@ export interface IntrinsicElements {
50
51
  'textarea': TextAreaProps;
51
52
  'frame': FrameProps;
52
53
  'overlay': OverlayProps;
54
+ 'svg': SVGProps;
53
55
  }
54
56
 
55
57
  declare module 'react' {
@@ -74,6 +76,7 @@ declare module 'react' {
74
76
  'textarea': TextAreaProps;
75
77
  'frame': FrameProps;
76
78
  'overlay': OverlayProps;
79
+ 'svg': SVGProps;
77
80
  }
78
81
  }
79
82
  }
@@ -31,7 +31,7 @@ export interface FrameProps extends StandardProps {
31
31
  bindload?: (e: FrameLoadEvent) => void;
32
32
 
33
33
  /**
34
- * Pass global props to the nested Lynx page within the frame.
34
+ * Passes `globalProps` to the Lynx page embedded in the frame. The embedded page can read it via `lynx.__globalProps`.
35
35
  * @iOS
36
36
  * @Android
37
37
  * @since 3.6
@@ -18,7 +18,7 @@ export interface ImageProps extends StandardProps {
18
18
  * @PC
19
19
  * @since 0.2
20
20
  */
21
- src?: string;
21
+ 'src'?: string;
22
22
 
23
23
  /**
24
24
  * Specifies image cropping/scaling mode
@@ -33,12 +33,30 @@ export interface ImageProps extends StandardProps {
33
33
  * @Harmony
34
34
  * @PC
35
35
  */
36
- mode?: 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'center';
36
+ 'mode'?: 'scaleToFill' | 'aspectFit' | 'aspectFill' | 'center';
37
37
 
38
38
  /**
39
- * ARGB_8888: 32-bit memory per pixel, supports semi-transparent images
40
- * RGB_565: 16-bit memory per pixel, reduces memory usage but loses transparency
39
+ * `ARGB_8888`: 32-bit memory per pixel, supports semi-transparent images.
40
+ * `RGB_565`: 16-bit memory per pixel, reduces memory usage but loses transparency.
41
+ *
41
42
  * Support PC platform since 3.5
43
+ *
44
+ * :::note
45
+ *
46
+ * Affects the actual memory usage of the image bitmap.
47
+ *
48
+ * Taking an image with a resolution of 1024*768 as an example, the actual memory usage is (1024 * 768 * bits per pixel / 8) Bytes.
49
+ *
50
+ * The default is ARGB_8888. Frontend developers can optimize image memory usage by setting it to RGB_565.
51
+ *
52
+ * ARGB_8888: Each pixel occupies 32 bits of memory and includes an alpha channel.
53
+ * RGB_565: Each pixel occupies 16 bits of memory, which reduces memory usage but results in the loss of transparency.
54
+ * Setting RGB_565 may affect the display of `<image>`'s border-radius. You can set border-radius on the parent view of the `<image>` and add the clip-radius attribute to the parent view.
55
+ *
56
+ * It is not recommended to use RGB_565 when mode="aspectFit", as it may cause black borders in the cropped area.
57
+ *
58
+ * :::
59
+ *
42
60
  * @defaultValue "ARGB_8888"
43
61
  * @Android
44
62
  * @PC
@@ -54,7 +72,7 @@ export interface ImageProps extends StandardProps {
54
72
  * @PC
55
73
  * @since 1.4
56
74
  */
57
- placeholder?: string;
75
+ 'placeholder'?: string;
58
76
 
59
77
  /**
60
78
  * Image blur radius
@@ -68,6 +86,11 @@ export interface ImageProps extends StandardProps {
68
86
 
69
87
  /**
70
88
  * Stretchable area for 9patch images, in percentage or decimal, four values for top, right, bottom, left
89
+ *
90
+ * :::note
91
+ * Using cap-insets does not require the original image to be a 9-patch image.
92
+ * :::
93
+ *
71
94
  * @iOS
72
95
  * @Android
73
96
  * @Harmony
@@ -161,6 +184,7 @@ export interface ImageProps extends StandardProps {
161
184
  * @iOS
162
185
  * @Android
163
186
  * @Harmony
187
+ * @PC
164
188
  * @since 2.12
165
189
  */
166
190
  'tint-color'?: string;
@@ -184,6 +208,33 @@ export interface ImageProps extends StandardProps {
184
208
  * @since 0.2
185
209
  */
186
210
  binderror?: (e: ErrorEvent) => void;
211
+
212
+ /**
213
+ * Triggered when the animated image starts playing.
214
+ * @iOS
215
+ * @Android
216
+ * @Harmony
217
+ * @since 3.7
218
+ */
219
+ bindstartplay?: (e: BaseEvent) => void;
220
+
221
+ /**
222
+ * Triggered when one loop of the animated image finishes playing.
223
+ * @iOS
224
+ * @Android
225
+ * @Harmony
226
+ * @since 3.7
227
+ */
228
+ bindcurrentloopcomplete?: (e: BaseEvent) => void;
229
+
230
+ /**
231
+ * Triggered when the animated image finishes playing all `loop-count` loops. If `loop-count` is not set, this callback will not be triggered.
232
+ * @iOS
233
+ * @Android
234
+ * @Harmony
235
+ * @since 3.7
236
+ */
237
+ bindfinalloopcomplete?: (e: BaseEvent) => void;
187
238
  }
188
239
 
189
240
  export type LoadEvent = BaseEvent<'load', ImageLoadEvent>;
@@ -13,6 +13,7 @@ export * from './text';
13
13
  export * from './view';
14
14
  export * from './input';
15
15
  export * from './textarea';
16
+ export * from './svg';
16
17
  export * from './element';
17
18
  export * from './methods';
18
19
  export * from './attributes';
@@ -36,6 +36,22 @@ export enum ListEventSource {
36
36
  SCROLL = 2,
37
37
  }
38
38
 
39
+ /**
40
+ * The strategy to search the reference anchor for removed on-screen children.
41
+ * NONE: Do not search the reference anchor.
42
+ * TO_START: Search the reference anchor to the start of the list.
43
+ * TO_END: Search the reference anchor to the end of the list.
44
+ * @Android
45
+ * @iOS
46
+ * @Harmony
47
+ * @PC
48
+ */
49
+ export enum ListSearchRefAnchorStrategy {
50
+ NONE = 0,
51
+ TO_START = 1,
52
+ TO_END = 2,
53
+ }
54
+
39
55
  export interface ListAttachedCell {
40
56
  /**
41
57
  * id of list item
@@ -546,6 +562,16 @@ export interface ListProps extends StandardProps {
546
562
  */
547
563
  'preload-buffer-count'?: number;
548
564
 
565
+ /**
566
+ * Determine the strategy to search the reference anchor for removed on-screen children. If set to TO_START or TO_END, we will update reference anchor child for all removed on-screen children before consuming diff info. And in list layout pass, if no valid anchor child can be found from all on screen children, we use the reference anchor child in layout.
567
+ * @defaultValue ListSearchRefAnchorStrategy.NONE
568
+ * @Android
569
+ * @iOS
570
+ * @Harmony
571
+ * @PC
572
+ */
573
+ 'experimental-search-ref-anchor-strategy'?: ListSearchRefAnchorStrategy;
574
+
549
575
  /**
550
576
  * Whether to display the scroll bar of the list, with false on Harmony platform and true on other platforms.
551
577
  * @defaultValue undefined
@@ -565,6 +591,16 @@ export interface ListProps extends StandardProps {
565
591
  */
566
592
  'experimental-recycle-sticky-item'?: boolean;
567
593
 
594
+ /**
595
+ * Whether to using operation from c++ list to insert list-item's platform view. The default value is false, but we recommend to set it to true in the case with MOST_ON_TASM or MULTI_THREAD thread strategy.
596
+ * @defaultValue false
597
+ * @Android
598
+ * @iOS
599
+ * @Harmony
600
+ * @PC
601
+ */
602
+ 'enable-insert-platform-view-operation'?: boolean;
603
+
568
604
  /**
569
605
  * When the content size of a component is smaller than the component itself, decide whether to enable scrolling.
570
606
  * @defaultValue false
@@ -0,0 +1,30 @@
1
+ import { BaseEvent } from '../events';
2
+ import { StandardProps } from '../props';
3
+ export interface SVGProps extends StandardProps {
4
+ /**
5
+ * SVG resource URL
6
+ * @iOS
7
+ * @Android
8
+ * @Harmony
9
+ * @PC
10
+ */
11
+ 'src'?: string;
12
+
13
+ /**
14
+ * SVG XML content
15
+ * @iOS
16
+ * @Android
17
+ * @Harmony
18
+ * @PC
19
+ */
20
+ 'content'?: string;
21
+
22
+ /**
23
+ * SVG Loaded
24
+ * @Android
25
+ * @iOS
26
+ * @Harmony
27
+ * @PC
28
+ */
29
+ bindload?: (e: BaseEvent) => void;
30
+ }
@@ -13,6 +13,10 @@ export type LynxClearTimeout = (timeoutId: number) => void;
13
13
 
14
14
  export type AnyObject = Record<string, any>;
15
15
 
16
+ export interface LynxNapiLoader {
17
+ load: (moduleName: string) => any;
18
+ }
19
+
16
20
  export interface GlobalProps {}
17
21
 
18
22
  export type UnsafeLynx = BackgroundLynx & MainThreadLynx;
@@ -40,6 +44,8 @@ declare global {
40
44
  * below Lynx 3.0, use lynx.cancelAnimationFrame.
41
45
  */
42
46
  function cancelAnimationFrame(requestID?: number): void;
47
+
48
+ function getNapiLoader(): LynxNapiLoader | undefined;
43
49
  }
44
50
 
45
51
  declare function setTimeout(callback: (...args: unknown[]) => unknown, number: number): number;