@lynx-js/types 0.0.1 → 3.2.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 +55 -0
- package/README.md +56 -0
- package/package.json +53 -6
- package/types/background-thread/animation.d.ts +47 -0
- package/types/background-thread/app.d.ts +28 -0
- package/types/background-thread/event.d.ts +97 -0
- package/types/background-thread/fetch.d.ts +152 -0
- package/types/background-thread/index.d.ts +11 -0
- package/types/background-thread/lynx-performance-entry.d.ts +83 -0
- package/types/background-thread/lynx.d.ts +144 -0
- package/types/background-thread/native-modules.d.ts +21 -0
- package/types/background-thread/nodes-ref.d.ts +110 -0
- package/types/background-thread/performance.d.ts +100 -0
- package/types/common/console.d.ts +14 -0
- package/types/common/csstype.d.ts +99 -0
- package/types/common/element/attributes.d.ts +59 -0
- package/types/common/element/common.d.ts +41 -0
- package/types/common/element/component.d.ts +17 -0
- package/types/common/element/element.d.ts +59 -0
- package/types/common/element/filter-image.d.ts +67 -0
- package/types/common/element/image.d.ts +121 -0
- package/types/common/element/index.d.ts +16 -0
- package/types/common/element/list.d.ts +1161 -0
- package/types/common/element/methods.d.ts +84 -0
- package/types/common/element/page.d.ts +10 -0
- package/types/common/element/scroll-view.d.ts +280 -0
- package/types/common/element/text.d.ts +97 -0
- package/types/common/element/view.d.ts +7 -0
- package/types/common/events.d.ts +448 -0
- package/types/common/global.d.ts +47 -0
- package/types/common/index.d.ts +13 -0
- package/types/common/lynx.d.ts +35 -0
- package/types/common/performance.d.ts +78 -0
- package/types/common/props.d.ts +119 -0
- package/types/common/system-info.d.ts +46 -0
- package/types/index.d.ts +8 -0
- package/types/main-thread/element.d.ts +85 -0
- package/types/main-thread/events.d.ts +20 -0
- package/types/main-thread/index.d.ts +7 -0
- package/types/main-thread/lynx.d.ts +28 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Copyright 2024 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 { CommonLynx, GlobalProps } from '../common';
|
|
6
|
+
import { AnimationElement } from './animation';
|
|
7
|
+
import { BeforePublishEvent, GlobalEventEmitter, IntersectionObserver } from './event';
|
|
8
|
+
import { SelectorQuery } from './nodes-ref';
|
|
9
|
+
import { Performance } from './performance';
|
|
10
|
+
import { Response } from './fetch';
|
|
11
|
+
|
|
12
|
+
export * from './fetch';
|
|
13
|
+
|
|
14
|
+
export interface LoadDynamicComponentSuccessResult {
|
|
15
|
+
code: 0;
|
|
16
|
+
detail?: {
|
|
17
|
+
schema: string;
|
|
18
|
+
errMsg: '';
|
|
19
|
+
cache: boolean;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface LoadDynamicComponentFailedResult {
|
|
24
|
+
// E_DYNAMIC_COMPONENT_LOAD_BAD_RESPONSE = 160102,
|
|
25
|
+
// E_DYNAMIC_COMPONENT_LOAD_EMPTY_FILE = 160102,
|
|
26
|
+
// E_DYNAMIC_COMPONENT_LOAD_DECODE_FAIL = 160103,
|
|
27
|
+
code: 160101 | 160102 | 160103;
|
|
28
|
+
detail?: {
|
|
29
|
+
url: string;
|
|
30
|
+
errMsg: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type LoadDynamicComponentFunc = {
|
|
35
|
+
(url: string, options?: Record<string, any>): Promise<LoadDynamicComponentSuccessResult | LoadDynamicComponentFailedResult>;
|
|
36
|
+
(id: string | string[], url: string, options?: Record<string, any>): Promise<LoadDynamicComponentSuccessResult | LoadDynamicComponentFailedResult>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//TODO(liyanbo.monster): migrate component type.
|
|
40
|
+
export type CreateIntersectionObserverFunc = (
|
|
41
|
+
component: unknown,
|
|
42
|
+
options?: {
|
|
43
|
+
thresholds?: [];
|
|
44
|
+
initialRatio?: number;
|
|
45
|
+
observeAll?: boolean;
|
|
46
|
+
}
|
|
47
|
+
) => IntersectionObserver;
|
|
48
|
+
|
|
49
|
+
export interface ResourcePrefetchData {
|
|
50
|
+
data: {
|
|
51
|
+
uri: string;
|
|
52
|
+
type: 'image' | 'video';
|
|
53
|
+
param?: {
|
|
54
|
+
priority?: 'high' | 'medium' | 'low';
|
|
55
|
+
cacheTarget?: 'disk' | 'bitmap';
|
|
56
|
+
preloadKey?: string;
|
|
57
|
+
size: number;
|
|
58
|
+
};
|
|
59
|
+
}[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ResourcePrefetchResult {
|
|
63
|
+
code: number;
|
|
64
|
+
msg: string;
|
|
65
|
+
details: {
|
|
66
|
+
code: number;
|
|
67
|
+
msg: string;
|
|
68
|
+
uri: string;
|
|
69
|
+
type: 'image' | 'video';
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type GetElementByIdFunc = (id: string) => AnimationElement;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Lynx provide `background-thread lynx` public api.
|
|
77
|
+
*/
|
|
78
|
+
export interface Lynx extends CommonLynx {
|
|
79
|
+
/**
|
|
80
|
+
* @description Properties inside `lynx.__globalProps` is NOT managed by Lynx, so you MUST extends this interface yourself
|
|
81
|
+
* @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
82
|
+
*/
|
|
83
|
+
__globalProps: GlobalProps;
|
|
84
|
+
__presetData: Record<string, unknown>; // readonly data injected by client via LynxBackgroundRuntimeOptions
|
|
85
|
+
|
|
86
|
+
performance: Performance;
|
|
87
|
+
|
|
88
|
+
beforePublishEvent: BeforePublishEvent;
|
|
89
|
+
|
|
90
|
+
getElementById: GetElementByIdFunc;
|
|
91
|
+
|
|
92
|
+
// cancelAnimationFrame(animationId: number): void;
|
|
93
|
+
|
|
94
|
+
// requestAnimationFrame(callback: () => void): number;
|
|
95
|
+
|
|
96
|
+
cancelResourcePrefetch(data: ResourcePrefetchData, callback: (res: ResourcePrefetchResult) => void): void;
|
|
97
|
+
|
|
98
|
+
createIntersectionObserver: CreateIntersectionObserverFunc;
|
|
99
|
+
|
|
100
|
+
createSelectorQuery(): SelectorQuery;
|
|
101
|
+
|
|
102
|
+
getJSModule<Module = unknown>(name: string): Module;
|
|
103
|
+
|
|
104
|
+
getJSModule(name: 'GlobalEventEmitter'): GlobalEventEmitter;
|
|
105
|
+
|
|
106
|
+
setSharedData<T>(dataKey: string, dataVal: T): void;
|
|
107
|
+
getSharedData<T = unknown>(dataKey: string): T;
|
|
108
|
+
|
|
109
|
+
loadDynamicComponent: LoadDynamicComponentFunc;
|
|
110
|
+
|
|
111
|
+
registerModule<Module extends object>(name: string, module: Module): void;
|
|
112
|
+
|
|
113
|
+
registerSharedDataObserver<T>(callback: (data: T) => void): void;
|
|
114
|
+
|
|
115
|
+
removeSharedDataObserver<T>(callback: (data: T) => void): void;
|
|
116
|
+
|
|
117
|
+
reload(value: object, callback: () => void): void;
|
|
118
|
+
|
|
119
|
+
requestResourcePrefetch(data: ResourcePrefetchData, callback: (res: ResourcePrefetchResult) => void): void;
|
|
120
|
+
|
|
121
|
+
requireModuleAsync<T>(path: string, callback: (error: Error | null, exports?: T) => void): void;
|
|
122
|
+
|
|
123
|
+
requireModule<T>(path: string, entryName?: string): T;
|
|
124
|
+
|
|
125
|
+
resumeExposure(): void;
|
|
126
|
+
stopExposure(options?: { sendEvent: boolean }): void;
|
|
127
|
+
|
|
128
|
+
setObserverFrameRate(options?: { forPageRect?: number; forExposureCheck?: number }): void;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @description subset of Fetch API
|
|
132
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
|
|
133
|
+
* @since 2.18
|
|
134
|
+
*/
|
|
135
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @description queue microtask
|
|
139
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/queueMicrotask
|
|
140
|
+
* @since 3.1
|
|
141
|
+
*/
|
|
142
|
+
queueMicrotask(callback: () => void): void;
|
|
143
|
+
|
|
144
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2024 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 { AnyObject } from '../common';
|
|
6
|
+
import { NODE_REF_INVOKE_ERROR_CODE } from './nodes-ref';
|
|
7
|
+
|
|
8
|
+
export interface NativeModules {
|
|
9
|
+
LynxUIMethodModule?: {
|
|
10
|
+
invokeUIMethod?(componentId: string, ancestors: string[], method: string, params: AnyObject, callback: (res: { code: NODE_REF_INVOKE_ERROR_CODE }) => void): void;
|
|
11
|
+
};
|
|
12
|
+
NetworkingModule?: any;
|
|
13
|
+
LynxTestModule?: any;
|
|
14
|
+
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
|
|
17
|
+
bridge: {
|
|
18
|
+
call: (name: string, params: Record<string, unknown>, cb: (...args: unknown[]) => void) => void;
|
|
19
|
+
on: (name: string, cb: (...args: unknown[]) => void) => void;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Copyright 2024 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 { AnyObject } from '../common';
|
|
6
|
+
|
|
7
|
+
export enum NODE_REF_INVOKE_ERROR_CODE {
|
|
8
|
+
SUCCESS = 0,
|
|
9
|
+
UNKNOWN = 1,
|
|
10
|
+
NODE_NOT_FOUND = 2,
|
|
11
|
+
METHOD_NOT_FOUND = 3,
|
|
12
|
+
PARAM_INVALID = 4, // Determined by the implementer of the component.
|
|
13
|
+
SELECTOR_NOT_SUPPORTED = 5, // Currently only supports ID selectors.
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface uiMethodOptions {
|
|
17
|
+
method: string;
|
|
18
|
+
params?: AnyObject;
|
|
19
|
+
success?(res: any): void;
|
|
20
|
+
fail?(res: { code: NODE_REF_INVOKE_ERROR_CODE; data?: any }): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface uiFieldsOptions {
|
|
24
|
+
id?: boolean;
|
|
25
|
+
dataset?: boolean;
|
|
26
|
+
tag?: boolean;
|
|
27
|
+
query?: boolean;
|
|
28
|
+
unique_id?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface PathData {
|
|
32
|
+
data: Array<{
|
|
33
|
+
tag: string;
|
|
34
|
+
id: string;
|
|
35
|
+
class: string[];
|
|
36
|
+
dataSet: Record<string, unknown>;
|
|
37
|
+
// index of parent's children
|
|
38
|
+
index: number;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface FieldsParams {
|
|
43
|
+
id?: boolean;
|
|
44
|
+
dataset?: boolean;
|
|
45
|
+
tag?: boolean;
|
|
46
|
+
index?: boolean;
|
|
47
|
+
class?: boolean;
|
|
48
|
+
attribute?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface FieldsData {
|
|
52
|
+
id: string;
|
|
53
|
+
tag: string;
|
|
54
|
+
dataset: Record<string, unknown>;
|
|
55
|
+
index: number;
|
|
56
|
+
class: Array<string>;
|
|
57
|
+
attribute: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type PathCallback = (data: PathData, status: { data: string; code: number }) => void;
|
|
61
|
+
|
|
62
|
+
export interface NodesRef {
|
|
63
|
+
invoke(options: uiMethodOptions): SelectorQuery;
|
|
64
|
+
|
|
65
|
+
path(callback: PathCallback): SelectorQuery;
|
|
66
|
+
|
|
67
|
+
fields<T extends FieldsParams>(
|
|
68
|
+
fields: Required<FieldsParams> extends Record<keyof T, boolean> ? T : FieldsParams,
|
|
69
|
+
callback: (
|
|
70
|
+
data: {
|
|
71
|
+
[K in keyof Required<FieldsParams> as T[K] extends true ? K : never]: FieldsData[K];
|
|
72
|
+
},
|
|
73
|
+
status: { data: string; code: number }
|
|
74
|
+
) => void
|
|
75
|
+
): SelectorQuery;
|
|
76
|
+
|
|
77
|
+
setNativeProps(nativeProps: Record<string, any>): SelectorQuery;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface SelectorQuery {
|
|
81
|
+
/**
|
|
82
|
+
* Selects a single node by CSS selector.
|
|
83
|
+
* @param selector CSS selector
|
|
84
|
+
*/
|
|
85
|
+
select(selector: string): NodesRef;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Selects all nodes satisfying CSS selector.
|
|
89
|
+
* @param selector CSS selector
|
|
90
|
+
*/
|
|
91
|
+
selectAll(selector: string): NodesRef;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Select root node of the component.
|
|
95
|
+
*/
|
|
96
|
+
selectRoot(): NodesRef;
|
|
97
|
+
|
|
98
|
+
// /**
|
|
99
|
+
// * Selects a single node by element id.
|
|
100
|
+
// * When a touch event is triggered, the element id of the node is passed to the event handler as 'uid',
|
|
101
|
+
// * by which can a node be selected in its event handler.
|
|
102
|
+
// */
|
|
103
|
+
// selectUniqueID(uniqueId: string | number): NodesRef;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Execute all tasks in the task queue.
|
|
107
|
+
* When `this._fire_immediately` is set to true, this method is called automatically.
|
|
108
|
+
*/
|
|
109
|
+
exec(): void;
|
|
110
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Copyright 2024 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 { CommonPerformance } from "../common/performance";
|
|
6
|
+
import { PerformanceEntry } from "./lynx-performance-entry";
|
|
7
|
+
|
|
8
|
+
export interface SetupTimingInfo {
|
|
9
|
+
create_lynx_start: number;
|
|
10
|
+
create_lynx_end: number;
|
|
11
|
+
load_core_start: number;
|
|
12
|
+
load_core_end: number;
|
|
13
|
+
load_app_start: number;
|
|
14
|
+
load_app_end: number;
|
|
15
|
+
load_template_start: number;
|
|
16
|
+
load_template_end: number;
|
|
17
|
+
decode_start: number;
|
|
18
|
+
decode_end: number;
|
|
19
|
+
lepus_excute_start: number;
|
|
20
|
+
lepus_excute_end: number;
|
|
21
|
+
set_init_data_start: number;
|
|
22
|
+
set_init_data_end: number;
|
|
23
|
+
data_processor_start: number;
|
|
24
|
+
data_processor_end: number;
|
|
25
|
+
create_vdom_start: number;
|
|
26
|
+
create_vdom_end: number;
|
|
27
|
+
dispatch_start: number;
|
|
28
|
+
dispatch_end: number;
|
|
29
|
+
layout_start: number;
|
|
30
|
+
layout_end: number;
|
|
31
|
+
ui_operation_flush_start: number;
|
|
32
|
+
ui_operation_flush_end: number;
|
|
33
|
+
draw_end: number;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface UpdateTimingInfo {
|
|
37
|
+
set_state_trigger?: number;
|
|
38
|
+
create_vdom_start?: number;
|
|
39
|
+
create_vdom_end?: number;
|
|
40
|
+
dispatch_start?: number;
|
|
41
|
+
dispatch_end?: number;
|
|
42
|
+
layout_start?: number;
|
|
43
|
+
layout_end?: number;
|
|
44
|
+
ui_operation_flush_start?: number;
|
|
45
|
+
ui_operation_flush_end?: number;
|
|
46
|
+
draw_end: number;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
export interface ExtraTimingInfo {
|
|
50
|
+
prepare_template_start?: number;
|
|
51
|
+
prepare_template_end?: number;
|
|
52
|
+
container_init_start?: number;
|
|
53
|
+
container_init_end?: number;
|
|
54
|
+
open_time?: number;
|
|
55
|
+
[key: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface MetricsTimingInfo {
|
|
59
|
+
tti?: number;
|
|
60
|
+
lynx_tti?: number;
|
|
61
|
+
total_tti?: number;
|
|
62
|
+
fcp?: number;
|
|
63
|
+
lynx_fcp?: number;
|
|
64
|
+
total_fcp?: number;
|
|
65
|
+
actual_fmp?: number;
|
|
66
|
+
lynx_actual_fmp?: number;
|
|
67
|
+
total_actual_fmp?: number;
|
|
68
|
+
[key: string]: unknown;
|
|
69
|
+
}
|
|
70
|
+
export interface TimingInfo {
|
|
71
|
+
extra_timing: ExtraTimingInfo;
|
|
72
|
+
setup_timing: SetupTimingInfo;
|
|
73
|
+
update_timings: {
|
|
74
|
+
[key: string]: UpdateTimingInfo;
|
|
75
|
+
};
|
|
76
|
+
metrics: MetricsTimingInfo;
|
|
77
|
+
has_reload: boolean;
|
|
78
|
+
thread_strategy: number;
|
|
79
|
+
url: string;
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
}
|
|
82
|
+
export interface TimingListener {
|
|
83
|
+
onSetup: (info: TimingInfo) => void;
|
|
84
|
+
onUpdate: (info: TimingInfo) => void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface Performance extends CommonPerformance {
|
|
88
|
+
addTimingListener(listener: TimingListener): void;
|
|
89
|
+
removeTimingListener(listener: TimingListener): void;
|
|
90
|
+
removeAllTimingListener(): void;
|
|
91
|
+
createObserver(callback: PerformanceCallback): PerformanceObserver;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
export type PerformanceCallback = (entry: PerformanceEntry) => void;
|
|
96
|
+
export interface PerformanceObserver {
|
|
97
|
+
observe(name: string[]): void;
|
|
98
|
+
disconnect(): void;
|
|
99
|
+
onPerformanceEvent(entry: PerformanceEntry): void
|
|
100
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
export interface Console {
|
|
6
|
+
debug(...args: any[]): void;
|
|
7
|
+
error(...args: any[]): void;
|
|
8
|
+
group(label?: string): void;
|
|
9
|
+
groupEnd(): void;
|
|
10
|
+
info(...args: any[]): void;
|
|
11
|
+
log(...args: any[]): void;
|
|
12
|
+
alog(...args: any[]): void;
|
|
13
|
+
warn(...args: any[]): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Copyright 2024 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 * as CSS from 'csstype';
|
|
6
|
+
|
|
7
|
+
export type Modify<T, R> = Omit<T, keyof R> & R;
|
|
8
|
+
|
|
9
|
+
export type CSSProperties = Modify<
|
|
10
|
+
CSS.Properties<string | number>,
|
|
11
|
+
{
|
|
12
|
+
position?: 'absolute' | 'relative' | 'fixed' | 'sticky';
|
|
13
|
+
boxSizing?: 'border-box' | 'content-box' | 'auto';
|
|
14
|
+
display?: 'none' | 'flex' | 'grid' | 'linear' | 'relative' | 'block' | 'auto';
|
|
15
|
+
overflow?: 'hidden' | 'visible' | (string & {});
|
|
16
|
+
whiteSpace?: 'normal' | 'nowrap';
|
|
17
|
+
textAlign?: 'left' | 'center' | 'right' | 'start' | 'end';
|
|
18
|
+
textOverflow?: 'clip' | 'ellipsis';
|
|
19
|
+
fontWeight?: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
20
|
+
flexDirection?: 'column' | 'row' | 'row-reverse' | 'column-reverse';
|
|
21
|
+
flexWrap?: 'wrap' | 'nowrap' | 'wrap-reverse';
|
|
22
|
+
alignContent?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'space-between' | 'space-around' | 'start' | 'end';
|
|
23
|
+
justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'start' | 'end';
|
|
24
|
+
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
25
|
+
transform?:
|
|
26
|
+
| 'translate'
|
|
27
|
+
| 'translateX'
|
|
28
|
+
| 'translateY'
|
|
29
|
+
| 'translateZ'
|
|
30
|
+
| 'translate'
|
|
31
|
+
| 'translate3d'
|
|
32
|
+
| 'translate3D'
|
|
33
|
+
| 'rotate'
|
|
34
|
+
| 'rotateX'
|
|
35
|
+
| 'rotateY'
|
|
36
|
+
| 'rotateZ'
|
|
37
|
+
| 'scale'
|
|
38
|
+
| 'scaleX'
|
|
39
|
+
| 'scaleY'
|
|
40
|
+
| (string & {});
|
|
41
|
+
animationTimingFunction?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-ease-out' | 'ease' | 'ease-in-out' | 'square-bezier' | 'cubic-bezier' | (string & {});
|
|
42
|
+
borderStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | 'hidden' | 'none' | (string & {});
|
|
43
|
+
transformOrigin?: 'left' | 'right' | 'top' | 'bottom' | 'center' | (string & {});
|
|
44
|
+
linearOrientation?: 'horizontal' | 'vertical' | 'horizontal-reverse' | 'vertical-reverse';
|
|
45
|
+
linearGravity?: 'none' | 'top' | 'bottom' | 'left' | 'right' | 'center-vertical' | 'center-horizontal' | 'space-between' | 'start' | 'end' | 'center';
|
|
46
|
+
linearLayoutGravity?:
|
|
47
|
+
| 'none'
|
|
48
|
+
| 'top'
|
|
49
|
+
| 'bottom'
|
|
50
|
+
| 'left'
|
|
51
|
+
| 'right'
|
|
52
|
+
| 'center-vertical'
|
|
53
|
+
| 'center-horizontal'
|
|
54
|
+
| 'fill-vertical'
|
|
55
|
+
| 'fill-horizontal'
|
|
56
|
+
| 'center'
|
|
57
|
+
| 'stretch'
|
|
58
|
+
| 'start'
|
|
59
|
+
| 'end';
|
|
60
|
+
layoutAnimationCreateTimingFunction?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-ease-out' | 'ease' | 'ease-in-out' | 'square-bezier' | 'cubic-bezier' | (string & {});
|
|
61
|
+
layoutAnimationCreateProperty?: 'opacity' | 'scaleX' | 'scaleY' | 'scaleXY' | (string & {});
|
|
62
|
+
layoutAnimationDeleteTimingFunction?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-ease-out' | 'ease' | 'ease-in-out' | 'square-bezier' | 'cubic-bezier' | (string & {});
|
|
63
|
+
layoutAnimationDeleteProperty?: 'opacity' | 'scaleX' | 'scaleY' | 'scaleXY' | (string & {});
|
|
64
|
+
layoutAnimationUpdateTimingFunction?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-ease-out' | 'ease' | 'ease-in-out' | 'square-bezier' | 'cubic-bezier' | (string & {});
|
|
65
|
+
textDecoration?: 'none' | 'underline' | 'line-through' | (string & {});
|
|
66
|
+
visibility?: 'hidden' | 'visible' | 'none' | 'collapse';
|
|
67
|
+
transitionProperty?:
|
|
68
|
+
| 'none'
|
|
69
|
+
| 'opacity'
|
|
70
|
+
| 'scaleX'
|
|
71
|
+
| 'scaleY'
|
|
72
|
+
| 'scaleXY'
|
|
73
|
+
| 'width'
|
|
74
|
+
| 'height'
|
|
75
|
+
| 'background-color'
|
|
76
|
+
| 'visibility'
|
|
77
|
+
| 'left'
|
|
78
|
+
| 'top'
|
|
79
|
+
| 'right'
|
|
80
|
+
| 'bottom'
|
|
81
|
+
| 'transform'
|
|
82
|
+
| 'all'
|
|
83
|
+
| (string & {});
|
|
84
|
+
transitionTimingFunction?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-ease-out' | 'ease' | 'ease-in-out' | 'square-bezier' | 'cubic-bezier' | (string & {});
|
|
85
|
+
borderLeftStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | 'hidden' | 'none' | (string & {});
|
|
86
|
+
borderRightStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | 'hidden' | 'none' | (string & {});
|
|
87
|
+
borderTopStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | 'hidden' | 'none' | (string & {});
|
|
88
|
+
borderBottomStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | 'hidden' | 'none' | (string & {});
|
|
89
|
+
overflowX?: 'hidden' | 'visible' | (string & {});
|
|
90
|
+
overflowY?: 'hidden' | 'visible' | (string & {});
|
|
91
|
+
wordBreak?: 'normal' | 'break-all' | 'keep-all';
|
|
92
|
+
outlineStyle?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | 'hidden' | 'none' | (string & {});
|
|
93
|
+
verticalAlign?: 'baseline' | 'sub' | 'super' | 'top' | 'text-top' | 'middle' | 'bottom' | 'text-bottom' | (string & {});
|
|
94
|
+
direction?: 'normal' | 'lynx-rtl' | 'rtl' | 'ltr';
|
|
95
|
+
relativeCenter?: 'none' | 'vertical' | 'horizontal' | 'both';
|
|
96
|
+
linearCrossGravity?: 'none' | 'start' | 'end' | 'center' | 'stretch';
|
|
97
|
+
listMainAxisGap?: 'grayscale' | (string & {});
|
|
98
|
+
}
|
|
99
|
+
>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright 2024 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 { CSSProperties } from '../csstype';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* IntrinsicAttributes specifies extra properties used by the JSX framework
|
|
9
|
+
* which are not generally used by the components’ props or arguments.
|
|
10
|
+
* @see https://www.typescriptlang.org/docs/handbook/jsx.html#attribute-type-checking
|
|
11
|
+
*
|
|
12
|
+
* But in Lynx, we use this interface to specify the extra attributes
|
|
13
|
+
* just for Lynx components.
|
|
14
|
+
* @see Lynx/tasm/component_attributes.cc
|
|
15
|
+
*/
|
|
16
|
+
export interface IntrinsicAttributes {
|
|
17
|
+
/**
|
|
18
|
+
* A type helper for Lynx, DO NOT SET THIS.
|
|
19
|
+
*/
|
|
20
|
+
__empty?: false;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The name of the component
|
|
24
|
+
*/
|
|
25
|
+
name?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The style set to the view of component.
|
|
29
|
+
*
|
|
30
|
+
* Has no effect when `removeComponentElement` enabled.
|
|
31
|
+
*/
|
|
32
|
+
style?: string | CSSProperties;
|
|
33
|
+
|
|
34
|
+
// /**
|
|
35
|
+
// * The CSS classes set to the view of component.
|
|
36
|
+
// *
|
|
37
|
+
// * Has no effect when `removeComponentElement` enabled.
|
|
38
|
+
// */
|
|
39
|
+
// className?: string;
|
|
40
|
+
class?: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Set to `true` to enable overlapping rendering
|
|
44
|
+
*/
|
|
45
|
+
overlap?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type LynxIntrinsicAttributes = IntrinsicAttributes;
|
|
49
|
+
|
|
50
|
+
declare global {
|
|
51
|
+
namespace JSX {
|
|
52
|
+
interface IntrinsicAttributes extends LynxIntrinsicAttributes {
|
|
53
|
+
/**
|
|
54
|
+
* A type helper for Lynx, DO NOT SET THIS.
|
|
55
|
+
*/
|
|
56
|
+
__empty?: never;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2024 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 { BaseEvent } from '../events';
|
|
6
|
+
export interface BaseScrollInfo {
|
|
7
|
+
/**
|
|
8
|
+
* scroll top from start
|
|
9
|
+
*/
|
|
10
|
+
scrollTop: number;
|
|
11
|
+
/**
|
|
12
|
+
* scroll left from start
|
|
13
|
+
*/
|
|
14
|
+
scrollLeft: number;
|
|
15
|
+
/**
|
|
16
|
+
* scroll content height
|
|
17
|
+
*/
|
|
18
|
+
scrollHeight: number;
|
|
19
|
+
/**
|
|
20
|
+
* scroll content width
|
|
21
|
+
*/
|
|
22
|
+
scrollWidth: number;
|
|
23
|
+
/**
|
|
24
|
+
* X-axis scroll delta for this scroll. It's always 0 in some non-scroll related events.
|
|
25
|
+
*/
|
|
26
|
+
deltaX: number;
|
|
27
|
+
/**
|
|
28
|
+
* Y-axis scroll delta for this scroll. It's always 0 in some non-scroll related events.
|
|
29
|
+
*/
|
|
30
|
+
deltaY: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ScrollToLowerEvent extends BaseEvent<'scrolltolower', BaseScrollInfo> {}
|
|
34
|
+
export interface ScrollToUpperEvent extends BaseEvent<'scrolltoupper', BaseScrollInfo> {}
|
|
35
|
+
export interface ScrollEvent extends BaseEvent<'scroll', BaseScrollInfo> {}
|
|
36
|
+
export interface ScrollEndEvent extends BaseEvent<'scrollend', BaseScrollInfo> {}
|
|
37
|
+
export interface ContentSizeChangedEvent extends BaseEvent<'contentsizechanged', BaseScrollInfo> {}
|
|
38
|
+
export interface ScrollToUpperEdgeEvent extends BaseEvent<'scrolltoupperedge', BaseScrollInfo> {}
|
|
39
|
+
export interface ScrollToLowerEdgeEvent extends BaseEvent<'scrolltoloweredge', BaseScrollInfo> {}
|
|
40
|
+
export interface ScrollToNormalStateEvent extends BaseEvent<'scrolltonormalstate', BaseScrollInfo> {}
|
|
41
|
+
export interface ScrollToNormalStateEvent extends BaseEvent<'scrolltonormalstate', BaseScrollInfo> {}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright 2024 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
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Dynamic Component
|
|
9
|
+
*/
|
|
10
|
+
export interface ComponentProps extends StandardProps {
|
|
11
|
+
/**
|
|
12
|
+
* Component name
|
|
13
|
+
*/
|
|
14
|
+
'is'?: string;
|
|
15
|
+
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright 2024 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 { NoProps } from '../props';
|
|
7
|
+
import { ComponentProps } from './component';
|
|
8
|
+
import { FilterImageProps } from './filter-image';
|
|
9
|
+
import { ImageProps } from './image';
|
|
10
|
+
import { ListItemProps, ListProps, ListRowProps, ListUIMethods } from './list';
|
|
11
|
+
import { PageProps } from './page';
|
|
12
|
+
import { ScrollViewProps, ScrollViewUIMethods } from './scroll-view';
|
|
13
|
+
import { TextProps } from './text';
|
|
14
|
+
import { ViewProps } from './view';
|
|
15
|
+
|
|
16
|
+
export interface UIMethods {
|
|
17
|
+
'list': ListUIMethods;
|
|
18
|
+
'scroll-view': ScrollViewUIMethods;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// add also to global.JSX.IntrinsicElements
|
|
22
|
+
export interface IntrinsicElements {
|
|
23
|
+
'component': ComponentProps;
|
|
24
|
+
'filter-image': FilterImageProps;
|
|
25
|
+
'image': ImageProps;
|
|
26
|
+
'inline-image': ImageProps;
|
|
27
|
+
'inline-text': TextProps;
|
|
28
|
+
'inline-truncation': NoProps;
|
|
29
|
+
'list': ListProps;
|
|
30
|
+
'list-item': ListItemProps;
|
|
31
|
+
'list-row': ListRowProps;
|
|
32
|
+
'page': PageProps;
|
|
33
|
+
'scroll-view': ScrollViewProps;
|
|
34
|
+
'text': TextProps;
|
|
35
|
+
'view': ViewProps;
|
|
36
|
+
'raw-text': StandardProps & { text: number | string };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module 'react' {
|
|
40
|
+
namespace JSX {
|
|
41
|
+
// Should copy from above IntrinsicElements
|
|
42
|
+
interface IntrinsicElements {
|
|
43
|
+
'component': ComponentProps;
|
|
44
|
+
'filter-image': FilterImageProps;
|
|
45
|
+
'image': ImageProps;
|
|
46
|
+
'inline-image': ImageProps;
|
|
47
|
+
'inline-text': TextProps;
|
|
48
|
+
'inline-truncation': NoProps;
|
|
49
|
+
'list': ListProps;
|
|
50
|
+
'list-item': ListItemProps;
|
|
51
|
+
'list-row': ListRowProps;
|
|
52
|
+
'page': PageProps;
|
|
53
|
+
'scroll-view': ScrollViewProps;
|
|
54
|
+
'text': TextProps;
|
|
55
|
+
'view': ViewProps;
|
|
56
|
+
'raw-text': StandardProps & { text: number | string };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|