@lynx-js/types 3.4.3 → 3.5.9
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 +66 -11
- package/package.json +1 -1
- package/types/background-thread/fetch.d.ts +43 -2
- package/types/background-thread/index.d.ts +1 -0
- package/types/background-thread/lynx-performance-entry.d.ts +17 -0
- package/types/background-thread/lynx.d.ts +8 -1
- package/types/background-thread/nodes-ref.d.ts +30 -12
- package/types/background-thread/text-encoder-decoder.d.ts +15 -21
- package/types/common/csstype.d.ts +105 -239
- package/types/common/element/element.d.ts +10 -4
- package/types/common/element/frame.d.ts +25 -0
- package/types/common/element/image.d.ts +84 -74
- package/types/common/element/index.d.ts +2 -0
- package/types/common/element/input.d.ts +10 -2
- package/types/common/element/list-item.d.ts +67 -0
- package/types/common/element/list.d.ts +380 -850
- package/types/common/element/methods.d.ts +175 -18
- package/types/common/element/scroll-view.d.ts +92 -137
- package/types/common/element/text.d.ts +16 -3
- package/types/common/element/textarea.d.ts +11 -1
- package/types/common/events.d.ts +522 -100
- package/types/common/global.d.ts +2 -1
- package/types/common/performance.d.ts +11 -2
- package/types/common/props.d.ts +332 -28
- package/types/common/system-info.d.ts +9 -1
- package/types/main-thread/animation.d.ts +114 -0
- package/types/main-thread/element.d.ts +12 -20
- package/types/main-thread/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,68 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
|
+
## 3.5.10
|
|
3
|
+
- Fix list-type to avoid incompatible type error.
|
|
4
|
+
|
|
5
|
+
## 3.5.9
|
|
6
|
+
- Update `list` and `list-item` typings.
|
|
7
|
+
|
|
8
|
+
## 3.5.8
|
|
9
|
+
- Update common typings on elements.
|
|
10
|
+
|
|
11
|
+
## 3.5.6
|
|
12
|
+
- The `flowIds` parameter in the Trace API supports passing an undefined value.
|
|
13
|
+
|
|
14
|
+
## 3.5.5
|
|
15
|
+
- Add the `pointer-events` CSS property.
|
|
16
|
+
|
|
17
|
+
## 3.5.4
|
|
18
|
+
- Add `event-through-active-regions`, `enable-exposure-ui-clip` properties.
|
|
19
|
+
|
|
20
|
+
## 3.5.3
|
|
21
|
+
- Add `harmony-scroll-edge-effect` property for scroll container.
|
|
22
|
+
|
|
23
|
+
## 3.5.2
|
|
24
|
+
- Add `EventSource` types.
|
|
25
|
+
|
|
26
|
+
## 3.5.1
|
|
27
|
+
- Add `frame` element types.
|
|
28
|
+
|
|
29
|
+
## 3.5.0
|
|
30
|
+
|
|
31
|
+
### Major Changes
|
|
32
|
+
- Update into Lynx3.5.
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Add a new `flowIds` subfield to the TraceOption parameter in the Trace API to support one-to-many trace associations.
|
|
37
|
+
- Add `pc`, `windows`, `macOS` and `Harmony` platforms to System info.
|
|
38
|
+
- Refactor event definitions for improved IDE compatibility.
|
|
39
|
+
|
|
40
|
+
## 3.4.11
|
|
41
|
+
- Fix types of `selectAll()` of `SelectorQuery`.
|
|
42
|
+
|
|
43
|
+
## 3.4.10
|
|
44
|
+
- Add `animate` for `MainThread.Element`
|
|
45
|
+
|
|
46
|
+
## 3.4.9
|
|
47
|
+
- Add more interface for `scroll-view`.
|
|
48
|
+
|
|
49
|
+
## 3.4.8
|
|
50
|
+
- Introduce `disabled` for input and textarea.
|
|
51
|
+
|
|
52
|
+
## 3.4.6
|
|
53
|
+
- fix `TextCodecHelper` defines.
|
|
54
|
+
- Update `fetch` defines for chunk streaming.
|
|
55
|
+
|
|
56
|
+
## 3.4.5
|
|
57
|
+
- Complete the documentation for image related APIs.
|
|
58
|
+
- Add `recyclable` property for list-item.
|
|
59
|
+
|
|
60
|
+
## 3.4.4
|
|
61
|
+
- Complete the documentation for text related APIs.
|
|
2
62
|
|
|
3
63
|
## 3.4.3
|
|
4
64
|
- Add `font-variation-settings`,`font-feature-settings` and `font-optical-sizing` CSS properties.
|
|
5
|
-
- Add `experimental-recycle-available-item-before-layout` property for list.
|
|
65
|
+
- Add `experimental-recycle-available-item-before-layout` and `enable-dynamic-span-count` property for list.
|
|
6
66
|
|
|
7
67
|
## 3.4.2
|
|
8
68
|
- And `lynx.fetchBundle` api defines.
|
|
@@ -21,24 +81,19 @@
|
|
|
21
81
|
|
|
22
82
|
- Introduce <input> and <textarea>
|
|
23
83
|
|
|
24
|
-
## 3.3.
|
|
25
|
-
|
|
84
|
+
## 3.3.2
|
|
85
|
+
- SelectorQuery FieldsParams adds query attribute
|
|
86
|
+
- Revert automatically generated cssTypes
|
|
26
87
|
- Add typing for the runtime interfaces.
|
|
27
|
-
|
|
28
|
-
## 3.3.3
|
|
29
|
-
|
|
30
|
-
- [Infra][Types] Codegen longhand and shorthand properties from css_defines
|
|
88
|
+
- Codegen longhand and shorthand properties from css_defines
|
|
31
89
|
- Add `experimental-recycle-sticky-item` and `sticky-buffer-count` for list
|
|
32
90
|
- Add `experimental-update-sticky-for-diff` for list
|
|
33
91
|
- Add ReloadBundleEntry to standardize the timing of reload behavior.
|
|
34
|
-
|
|
35
|
-
## 3.3.2
|
|
36
|
-
|
|
37
92
|
- Add typing for MessageEvent.
|
|
38
93
|
|
|
39
94
|
## 3.3.1
|
|
40
95
|
|
|
41
|
-
-
|
|
96
|
+
- Codegen csstype.d.ts from css_defines
|
|
42
97
|
- Rename `visibleCellsAfterUpdate` to `visibleItemAfterUpdate` for `list`
|
|
43
98
|
- Rename `visibleCellsBeforeUpdate` to `visibleItemBeforeUpdate` for `list`
|
|
44
99
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
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
|
+
import { MessageEvent } from '../common/lynx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description EventSource to support SSE protocol
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventSource
|
|
9
|
+
* @since 3.5
|
|
10
|
+
*/
|
|
11
|
+
export interface EventSource {
|
|
12
|
+
new(url: string | URL, options?: RequestInit): EventSource;
|
|
13
|
+
|
|
14
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
|
|
15
|
+
onerror: ((this: EventSource, ev: Event) => any) | null;
|
|
16
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
|
|
17
|
+
onmessage: ((this: EventSource, ev: MessageEvent) => any) | null;
|
|
18
|
+
/**
|
|
19
|
+
* The **`close()`** method of the EventSource interface closes the connection, if one is made, and sets the ```js-nolint close() ``` None.
|
|
20
|
+
*
|
|
21
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
|
|
22
|
+
*/
|
|
23
|
+
close(): void;
|
|
24
|
+
addEventListener<K extends keyof EventSourceEventMap>(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any): void;
|
|
25
|
+
addEventListener(type: string, listener: (event: MessageEvent) => void): void;
|
|
26
|
+
removeEventListener<K extends keyof EventSourceEventMap>(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any): void;
|
|
27
|
+
removeEventListener(type: string, listener: (event: MessageEvent) => void): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
4
30
|
/**
|
|
5
31
|
* @description Http Body
|
|
6
32
|
* @since 2.18
|
|
@@ -71,9 +97,13 @@ export interface Request extends Body {
|
|
|
71
97
|
*/
|
|
72
98
|
export declare var Request: {
|
|
73
99
|
prototype: Request;
|
|
74
|
-
new
|
|
100
|
+
new(input: RequestInfo | URL, init?: RequestInit): Request;
|
|
75
101
|
};
|
|
76
102
|
|
|
103
|
+
export interface LynxExtension {
|
|
104
|
+
useStreaming?: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
77
107
|
/**
|
|
78
108
|
* @description This Fetch API interface represents the response to a request.
|
|
79
109
|
* @see https://developer.mozilla.org/docs/Web/API/Response
|
|
@@ -95,6 +125,11 @@ export interface RequestInit {
|
|
|
95
125
|
* @since 2.18
|
|
96
126
|
*/
|
|
97
127
|
method?: string;
|
|
128
|
+
/**
|
|
129
|
+
* @description Lynx extension, currently used for requesting chunk streaming
|
|
130
|
+
* @since 3.4
|
|
131
|
+
*/
|
|
132
|
+
lynxExtension?: LynxExtension;
|
|
98
133
|
}
|
|
99
134
|
|
|
100
135
|
/**
|
|
@@ -133,6 +168,12 @@ export interface Response extends Body {
|
|
|
133
168
|
* @since 2.18
|
|
134
169
|
*/
|
|
135
170
|
readonly url: string;
|
|
171
|
+
/**
|
|
172
|
+
* @description body of ReadableStream
|
|
173
|
+
* @see https://developer.mozilla.org/docs/Web/API/Response/body
|
|
174
|
+
* @since 3.4
|
|
175
|
+
*/
|
|
176
|
+
readonly body: ReadableStream;
|
|
136
177
|
/**
|
|
137
178
|
* @description clone()
|
|
138
179
|
* @see https://developer.mozilla.org/docs/Web/API/Response/clone
|
|
@@ -148,5 +189,5 @@ export interface Response extends Body {
|
|
|
148
189
|
*/
|
|
149
190
|
export declare var Response: {
|
|
150
191
|
prototype: Response;
|
|
151
|
-
new
|
|
192
|
+
new(body?: BodyInit | null, init?: ResponseInit): Response;
|
|
152
193
|
};
|
|
@@ -84,12 +84,29 @@ export interface MetricFcpEntry extends PerformanceEntry {
|
|
|
84
84
|
totalFcp: PerformanceMetric;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export interface MetricFspEntry extends PerformanceEntry {
|
|
88
|
+
fsp: PerformanceMetric;
|
|
89
|
+
lynxFsp: PerformanceMetric;
|
|
90
|
+
totalFsp: PerformanceMetric;
|
|
91
|
+
}
|
|
92
|
+
|
|
87
93
|
export interface MetricActualFmpEntry extends PerformanceEntry {
|
|
88
94
|
actualFmp: PerformanceMetric;
|
|
89
95
|
lynxActualFmp: PerformanceMetric;
|
|
90
96
|
totalActualFmp: PerformanceMetric;
|
|
91
97
|
}
|
|
92
98
|
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Due to the influence of long tasks on this metric, the statistical results are
|
|
101
|
+
* inaccurate, so this type has been deprecated.
|
|
102
|
+
* Since version 3.3, you will no longer receive this event.
|
|
103
|
+
**/
|
|
104
|
+
export interface MetricTtiEntry extends PerformanceEntry {
|
|
105
|
+
tti: PerformanceMetric;
|
|
106
|
+
lynxTti: PerformanceMetric;
|
|
107
|
+
totalTti: PerformanceMetric;
|
|
108
|
+
}
|
|
109
|
+
|
|
93
110
|
export interface ReloadBundleEntry extends PipelineEntry {
|
|
94
111
|
reloadBundleStart: number;
|
|
95
112
|
reloadBundleEnd: number;
|
|
@@ -7,7 +7,7 @@ import { AnimationElement } from './animation';
|
|
|
7
7
|
import { BeforePublishEvent, GlobalEventEmitter, IntersectionObserver } from './event';
|
|
8
8
|
import { SelectorQuery } from './nodes-ref';
|
|
9
9
|
import { Performance } from './performance';
|
|
10
|
-
import { Response } from './fetch';
|
|
10
|
+
import { Response, RequestInit, EventSource } from './fetch';
|
|
11
11
|
|
|
12
12
|
export * from './fetch';
|
|
13
13
|
|
|
@@ -135,6 +135,13 @@ export interface Lynx extends CommonLynx {
|
|
|
135
135
|
|
|
136
136
|
setObserverFrameRate(options?: { forPageRect?: number; forExposureCheck?: number }): void;
|
|
137
137
|
|
|
138
|
+
/**
|
|
139
|
+
* @description EventSource to support SSE protocol
|
|
140
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventSource
|
|
141
|
+
* @since 3.5
|
|
142
|
+
*/
|
|
143
|
+
EventSource: EventSource;
|
|
144
|
+
|
|
138
145
|
/**
|
|
139
146
|
* @description subset of Fetch API
|
|
140
147
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
|
@@ -47,6 +47,7 @@ export interface FieldsParams {
|
|
|
47
47
|
index?: boolean;
|
|
48
48
|
class?: boolean;
|
|
49
49
|
attribute?: boolean;
|
|
50
|
+
query?:boolean;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
export interface FieldsData {
|
|
@@ -56,11 +57,24 @@ export interface FieldsData {
|
|
|
56
57
|
index: number;
|
|
57
58
|
class: Array<string>;
|
|
58
59
|
attribute: Record<string, unknown>;
|
|
60
|
+
query:SelectorQuery;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
export type PathCallback = (data: PathData, status: { data: string; code: number }) => void;
|
|
63
|
+
export type PathCallback = (data: PathData | null, status: { data: string; code: number }) => void;
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
interface BaseNodesRef {
|
|
66
|
+
animate(animations: AnimationV2[] | AnimationV2): SelectorQuery;
|
|
67
|
+
|
|
68
|
+
playAnimation(ids: string[] | string): SelectorQuery;
|
|
69
|
+
|
|
70
|
+
pauseAnimation(ids: string[] | string): SelectorQuery;
|
|
71
|
+
|
|
72
|
+
cancelAnimation(ids: string[] | string): SelectorQuery;
|
|
73
|
+
|
|
74
|
+
setNativeProps(nativeProps: Record<string, any>): SelectorQuery;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface NodesRef extends BaseNodesRef {
|
|
64
78
|
invoke(options: uiMethodOptions): SelectorQuery;
|
|
65
79
|
|
|
66
80
|
path(callback: PathCallback): SelectorQuery;
|
|
@@ -70,20 +84,24 @@ export interface NodesRef {
|
|
|
70
84
|
callback: (
|
|
71
85
|
data: {
|
|
72
86
|
[K in keyof Required<FieldsParams> as T[K] extends true ? K : never]: FieldsData[K];
|
|
73
|
-
},
|
|
87
|
+
} | null,
|
|
74
88
|
status: { data: string; code: number }
|
|
75
89
|
) => void
|
|
76
90
|
): SelectorQuery;
|
|
91
|
+
}
|
|
77
92
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
playAnimation(ids: string[] | string): SelectorQuery;
|
|
81
|
-
|
|
82
|
-
pauseAnimation(ids: string[] | string): SelectorQuery;
|
|
93
|
+
export interface MultiNodesRef extends BaseNodesRef {
|
|
94
|
+
path(callback: (data: PathData[], status: { data: string; code: number }) => void): SelectorQuery;
|
|
83
95
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
fields<T extends FieldsParams>(
|
|
97
|
+
fields: Required<FieldsParams> extends Record<keyof T, boolean> ? T : FieldsParams,
|
|
98
|
+
callback: (
|
|
99
|
+
data: {
|
|
100
|
+
[K in keyof Required<FieldsParams> as T[K] extends true ? K : never]: FieldsData[K];
|
|
101
|
+
}[],
|
|
102
|
+
status: { data: string; code: number }
|
|
103
|
+
) => void
|
|
104
|
+
): SelectorQuery;
|
|
87
105
|
}
|
|
88
106
|
|
|
89
107
|
export interface SelectorQuery {
|
|
@@ -97,7 +115,7 @@ export interface SelectorQuery {
|
|
|
97
115
|
* Selects all nodes satisfying CSS selector.
|
|
98
116
|
* @param selector CSS selector
|
|
99
117
|
*/
|
|
100
|
-
selectAll(selector: string):
|
|
118
|
+
selectAll(selector: string): MultiNodesRef;
|
|
101
119
|
|
|
102
120
|
/**
|
|
103
121
|
* Select root node of the component.
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
type TypedArray =
|
|
7
|
-
| Int8Array
|
|
8
|
-
| Uint8Array
|
|
9
|
-
| Uint8ClampedArray
|
|
10
|
-
| Int16Array
|
|
11
|
-
| Uint16Array
|
|
12
|
-
| Int32Array
|
|
13
|
-
| Uint32Array
|
|
14
|
-
| Float32Array
|
|
15
|
-
| Float64Array;
|
|
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.
|
|
16
4
|
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
export interface ITextCodecHelper {
|
|
6
|
+
/**
|
|
7
|
+
* @description decode array buffer to string
|
|
8
|
+
* @since 3.4
|
|
9
|
+
*/
|
|
10
|
+
decode(input: ArrayBuffer): string;
|
|
11
|
+
/**
|
|
12
|
+
* @description encode string to array buffer
|
|
13
|
+
* @since 3.4
|
|
14
|
+
*/
|
|
15
|
+
encode(input: string): ArrayBuffer;
|
|
16
|
+
}
|