@lynx-js/types 3.3.2 → 3.4.3

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,16 +11,14 @@ import { StandardProps } from '../props';
11
11
  export interface TextProps extends StandardProps {
12
12
  /**
13
13
  * Maximum number of lines for text display
14
- * @Android
15
- * @iOS
16
- * @Harmony
17
- * @PC
14
+ * @defaultValue "-1"
18
15
  * @since 1.0
19
16
  */
20
17
  'text-maxline'?: string;
21
18
 
22
19
  /**
23
20
  * Maximum number of characters for text display
21
+ * @defaultValue ""
24
22
  * @since 1.0
25
23
  * @deprecated Suggest preprocessing the text content length.
26
24
  */
@@ -29,7 +27,6 @@ export interface TextProps extends StandardProps {
29
27
  /**
30
28
  * Whether font-size is affected by system font scaling
31
29
  * @defaultValue false
32
- * @deprecated
33
30
  * @since 1.6
34
31
  */
35
32
  'enable-font-scaling'?: boolean;
@@ -45,18 +42,15 @@ export interface TextProps extends StandardProps {
45
42
  /**
46
43
  * By default, if text truncation occurs, the color of the inserted ... will be specified by the style on the nearest inline-text. If this attribute is enabled, the color of ... will be specified by the style on the outermost text tag.
47
44
  * @defaultValue false
48
- * @Android
49
- * @iOS
50
45
  * @since 2.0
51
46
  */
52
47
  'tail-color-convert'?: boolean;
53
48
 
54
49
  /**
55
50
  * Set single-line plain text to be centered and aligned within the line. Inline text settings are not supported. Recommended only when the default font doesn't meet center alignment needs, as it increases text measurement time.
56
- * @defaultValue 'normal'
51
+ * @defaultValue normal
57
52
  * @iOS
58
53
  * @Android
59
- * @PC
60
54
  * @since 2.12
61
55
  */
62
56
  'text-single-line-vertical-align'?: 'normal' | 'bottom' | 'center' | 'top';
@@ -116,17 +110,11 @@ export interface TextProps extends StandardProps {
116
110
  /**
117
111
  * Text layout event
118
112
  * @since 2.7
119
- * @Android
120
- * @iOS
121
- * @Harmony
122
- * @PC
123
113
  */
124
114
  bindlayout?: (e: LayoutEvent) => void;
125
115
 
126
116
  /**
127
117
  * Text selection change event
128
- * @Android
129
- * @iOS
130
118
  * @since 2.18
131
119
  */
132
120
  bindselectionchange?: (e: SelectionChangeEvent) => void;
@@ -217,7 +205,6 @@ interface SetTextSelectionMethod extends BaseMethod {
217
205
  * Gets the bounding rectangle of the text.
218
206
  * @Android
219
207
  * @iOS
220
- * @PC
221
208
  * @since 2.18
222
209
  */
223
210
  interface GetTextBoundingRectMethod extends BaseMethod {
@@ -152,7 +152,7 @@ export interface TextAreaProps extends Omit<StandardProps, 'bindfocus' | 'bindbl
152
152
  */
153
153
  'line-spacing'?: number | `${number}px` | `${number}rpx`;
154
154
  /**
155
- * Readonly
155
+ * Interaction enabled
156
156
  * @defaultValue false
157
157
  * @Android
158
158
  * @iOS
@@ -162,16 +162,6 @@ export interface TextAreaProps extends Omit<StandardProps, 'bindfocus' | 'bindbl
162
162
  */
163
163
  readonly?: boolean;
164
164
 
165
- /**
166
- * Interaction enabled
167
- * @defaultValue false
168
- * @Android
169
- * @iOS
170
- * @Harmony
171
- * @since 3.5
172
- */
173
- disabled?: boolean;
174
-
175
165
  /**
176
166
  * Show soft input keyboard while focused
177
167
  * @defaultValue true
@@ -173,25 +173,33 @@ export interface BaseTransitionEvent<T> extends BaseEventOrig<{}, T> {
173
173
  export interface TransitionEvent extends BaseTransitionEvent<Target> {}
174
174
 
175
175
  export interface BaseImageLoadEvent<T> extends BaseEventOrig<{}, T> {
176
+ detail: {
176
177
  width: number;
177
178
  height: number;
179
+ };
178
180
  }
179
181
 
180
182
  export interface ImageLoadEvent extends BaseImageLoadEvent<Target> {
183
+ detail: {
181
184
  width: number;
182
185
  height: number;
186
+ };
183
187
  }
184
188
 
185
189
  export interface BaseImageErrorEvent<T> extends BaseEventOrig<{}, T> {
190
+ detail: {
186
191
  errMsg: string;
187
192
  error_code: number;
188
193
  lynx_categorized_code: number;
194
+ };
189
195
  }
190
196
 
191
197
  export interface ImageErrorEvent extends BaseImageErrorEvent<Target> {
198
+ detail: {
192
199
  errMsg: string;
193
200
  error_code: number;
194
201
  lynx_categorized_code: number;
202
+ };
195
203
  }
196
204
 
197
205
  export interface TextLineInfo {
@@ -446,83 +454,11 @@ export interface LynxBindCatchEvent<T = any> {
446
454
  LongTap?: EventHandler<BaseTouchEvent<T>>;
447
455
  }
448
456
 
449
- type PrefixedEvent<E> = {
450
- bind?: E;
451
- catch?: E;
452
- 'capture-bind'?: E;
453
- 'capture-catch'?: E;
454
- 'global-bind'?: E;
455
- }
456
-
457
- // Helper interfaces for each event, providing explicit properties
458
- // for bind, catch, capture-bind, capture-catch, and global-bind prefixes.
459
- interface BGLoadProps<T> { bindbgload?: LynxEvent<T>['BGLoad']; catchbgload?: LynxEvent<T>['BGLoad']; 'capture-bindbgload'?: LynxEvent<T>['BGLoad']; 'capture-catchbgload'?: LynxEvent<T>['BGLoad']; 'global-bindbgload'?: LynxEvent<T>['BGLoad']; }
460
- interface BGErrorProps<T> { bindbgerror?: LynxEvent<T>['BGError']; catchbgerror?: LynxEvent<T>['BGError']; 'capture-bindbgerror'?: LynxEvent<T>['BGError']; 'capture-catchbgerror'?: LynxEvent<T>['BGError']; 'global-bindbgerror'?: LynxEvent<T>['BGError']; }
461
- interface TouchStartProps<T> { bindtouchstart?: LynxEvent<T>['TouchStart']; catchtouchstart?: LynxEvent<T>['TouchStart']; 'capture-bindtouchstart'?: LynxEvent<T>['TouchStart']; 'capture-catchtouchstart'?: LynxEvent<T>['TouchStart']; 'global-bindtouchstart'?: LynxEvent<T>['TouchStart']; }
462
- interface TouchMoveProps<T> { bindtouchmove?: LynxEvent<T>['TouchMove']; catchtouchmove?: LynxEvent<T>['TouchMove']; 'capture-bindtouchmove'?: LynxEvent<T>['TouchMove']; 'capture-catchtouchmove'?: LynxEvent<T>['TouchMove']; 'global-bindtouchmove'?: LynxEvent<T>['TouchMove']; }
463
- interface TouchCancelProps<T> { bindtouchcancel?: LynxEvent<T>['TouchCancel']; catchtouchcancel?: LynxEvent<T>['TouchCancel']; 'capture-bindtouchcancel'?: LynxEvent<T>['TouchCancel']; 'capture-catchtouchcancel'?: LynxEvent<T>['TouchCancel']; 'global-bindtouchcancel'?: LynxEvent<T>['TouchCancel']; }
464
- interface TouchEndProps<T> { bindtouchend?: LynxEvent<T>['TouchEnd']; catchtouchend?: LynxEvent<T>['TouchEnd']; 'capture-bindtouchend'?: LynxEvent<T>['TouchEnd']; 'capture-catchtouchend'?: LynxEvent<T>['TouchEnd']; 'global-bindtouchend'?: LynxEvent<T>['TouchEnd']; }
465
- interface LongPressProps<T> { bindlongpress?: LynxEvent<T>['LongPress']; catchlongpress?: LynxEvent<T>['LongPress']; 'capture-bindlongpress'?: LynxEvent<T>['LongPress']; 'capture-catchlongpress'?: LynxEvent<T>['LongPress']; 'global-bindlongpress'?: LynxEvent<T>['LongPress']; }
466
- interface TransitionStartProps<T> { bindtransitionstart?: LynxEvent<T>['TransitionStart']; catchtransitionstart?: LynxEvent<T>['TransitionStart']; 'capture-bindtransitionstart'?: LynxEvent<T>['TransitionStart']; 'capture-catchtransitionstart'?: LynxEvent<T>['TransitionStart']; 'global-bindtransitionstart'?: LynxEvent<T>['TransitionStart']; }
467
- interface TransitionCancelProps<T> { bindtransitioncancel?: LynxEvent<T>['TransitionCancel']; catchtransitioncancel?: LynxEvent<T>['TransitionCancel']; 'capture-bindtransitioncancel'?: LynxEvent<T>['TransitionCancel']; 'capture-catchtransitioncancel'?: LynxEvent<T>['TransitionCancel']; 'global-bindtransitioncancel'?: LynxEvent<T>['TransitionCancel']; }
468
- interface TransitionEndProps<T> { bindtransitionend?: LynxEvent<T>['TransitionEnd']; catchtransitionend?: LynxEvent<T>['TransitionEnd']; 'capture-bindtransitionend'?: LynxEvent<T>['TransitionEnd']; 'capture-catchtransitionend'?: LynxEvent<T>['TransitionEnd']; 'global-bindtransitionend'?: LynxEvent<T>['TransitionEnd']; }
469
- interface AnimationStartProps<T> { bindanimationstart?: LynxEvent<T>['AnimationStart']; catchanimationstart?: LynxEvent<T>['AnimationStart']; 'capture-bindanimationstart'?: LynxEvent<T>['AnimationStart']; 'capture-catchanimationstart'?: LynxEvent<T>['AnimationStart']; 'global-bindanimationstart'?: LynxEvent<T>['AnimationStart']; }
470
- interface AnimationIterationProps<T> { bindanimationiteration?: LynxEvent<T>['AnimationIteration']; catchanimationiteration?: LynxEvent<T>['AnimationIteration']; 'capture-bindanimationiteration'?: LynxEvent<T>['AnimationIteration']; 'capture-catchanimationiteration'?: LynxEvent<T>['AnimationIteration']; 'global-bindanimationiteration'?: LynxEvent<T>['AnimationIteration']; }
471
- interface AnimationCancelProps<T> { bindanimationcancel?: LynxEvent<T>['AnimationCancel']; catchanimationcancel?: LynxEvent<T>['AnimationCancel']; 'capture-bindanimationcancel'?: LynxEvent<T>['AnimationCancel']; 'capture-catchanimationcancel'?: LynxEvent<T>['AnimationCancel']; 'global-bindanimationcancel'?: LynxEvent<T>['AnimationCancel']; }
472
- interface AnimationEndProps<T> { bindanimationend?: LynxEvent<T>['AnimationEnd']; catchanimationend?: LynxEvent<T>['AnimationEnd']; 'capture-bindanimationend'?: LynxEvent<T>['AnimationEnd']; 'capture-catchanimationend'?: LynxEvent<T>['AnimationEnd']; 'global-bindanimationend'?: LynxEvent<T>['AnimationEnd']; }
473
- interface MouseDownProps<T> { bindmousedown?: LynxEvent<T>['MouseDown']; catchmousedown?: LynxEvent<T>['MouseDown']; 'capture-bindmousedown'?: LynxEvent<T>['MouseDown']; 'capture-catchmousedown'?: LynxEvent<T>['MouseDown']; 'global-bindmousedown'?: LynxEvent<T>['MouseDown']; }
474
- interface MouseUpProps<T> { bindmouseup?: LynxEvent<T>['MouseUp']; catchmouseup?: LynxEvent<T>['MouseUp']; 'capture-bindmouseup'?: LynxEvent<T>['MouseUp']; 'capture-catchmouseup'?: LynxEvent<T>['MouseUp']; 'global-bindmouseup'?: LynxEvent<T>['MouseUp']; }
475
- interface MouseMoveProps<T> { bindmousemove?: LynxEvent<T>['MouseMove']; catchmousemove?: LynxEvent<T>['MouseMove']; 'capture-bindmousemove'?: LynxEvent<T>['MouseMove']; 'capture-catchmousemove'?: LynxEvent<T>['MouseMove']; 'global-bindmousemove'?: LynxEvent<T>['MouseMove']; }
476
- interface MouseClickProps<T> { bindmouseclick?: LynxEvent<T>['MouseClick']; catchmouseclick?: LynxEvent<T>['MouseClick']; 'capture-bindmouseclick'?: LynxEvent<T>['MouseClick']; 'capture-catchmouseclick'?: LynxEvent<T>['MouseClick']; 'global-bindmouseclick'?: LynxEvent<T>['MouseClick']; }
477
- 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']; }
478
- 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']; }
479
- 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']; }
480
- 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']; }
481
- 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']; }
482
- 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']; }
483
- interface BlurProps<T> { bindblur?: LynxEvent<T>['Blur']; catchblur?: LynxEvent<T>['Blur']; 'capture-bindblur'?: LynxEvent<T>['Blur']; 'capture-catchblur'?: LynxEvent<T>['Blur']; 'global-bindblur'?: LynxEvent<T>['Blur']; }
484
- interface LayoutChangeProps<T> { bindlayoutchange?: LynxEvent<T>['LayoutChange']; catchlayoutchange?: LynxEvent<T>['LayoutChange']; 'capture-bindlayoutchange'?: LynxEvent<T>['LayoutChange']; 'capture-catchlayoutchange'?: LynxEvent<T>['LayoutChange']; 'global-bindlayoutchange'?: LynxEvent<T>['LayoutChange']; }
485
- interface UIAppearProps<T> { binduiappear?: LynxEvent<T>['UIAppear']; catchuiappear?: LynxEvent<T>['UIAppear']; 'capture-binduiappear'?: LynxEvent<T>['UIAppear']; 'capture-catchuiappear'?: LynxEvent<T>['UIAppear']; 'global-binduiappear'?: LynxEvent<T>['UIAppear']; }
486
- interface UIDisappearProps<T> { binduidisappear?: LynxEvent<T>['UIDisappear']; catchuidisappear?: LynxEvent<T>['UIDisappear']; 'capture-binduidisappear'?: LynxEvent<T>['UIDisappear']; 'capture-catchuidisappear'?: LynxEvent<T>['UIDisappear']; 'global-binduidisappear'?: LynxEvent<T>['UIDisappear']; }
487
- interface AccessibilityActionProps<T> { bindaccessibilityaction?: LynxEvent<T>['AccessibilityAction']; catchaccessibilityaction?: LynxEvent<T>['AccessibilityAction']; 'capture-bindaccessibilityaction'?: LynxEvent<T>['AccessibilityAction']; 'capture-catchaccessibilityaction'?: LynxEvent<T>['AccessibilityAction']; 'global-bindaccessibilityaction'?: LynxEvent<T>['AccessibilityAction']; }
488
- interface TapProps<T> { bindtap?: LynxBindCatchEvent<T>['Tap']; catchtap?: LynxBindCatchEvent<T>['Tap']; 'capture-bindtap'?: LynxBindCatchEvent<T>['Tap']; 'capture-catchtap'?: LynxBindCatchEvent<T>['Tap']; 'global-bindtap'?: LynxBindCatchEvent<T>['Tap']; }
489
- interface LongTapProps<T> { bindlongtap?: LynxBindCatchEvent<T>['LongTap']; catchlongtap?: LynxBindCatchEvent<T>['LongTap']; 'capture-bindlongtap'?: LynxBindCatchEvent<T>['LongTap']; 'capture-catchlongtap'?: LynxBindCatchEvent<T>['LongTap']; 'global-bindlongtap'?: LynxBindCatchEvent<T>['LongTap']; }
490
-
491
- /**
492
- * A combination of all possible event properties, statically defined for IDE-friendliness.
493
- * This replaces the previous dynamic mapped type.
494
- */
495
- export type LynxEventPropsBase<T> = BGLoadProps<T> &
496
- BGErrorProps<T> &
497
- TouchStartProps<T> &
498
- TouchMoveProps<T> &
499
- TouchCancelProps<T> &
500
- TouchEndProps<T> &
501
- LongPressProps<T> &
502
- TransitionStartProps<T> &
503
- TransitionCancelProps<T> &
504
- TransitionEndProps<T> &
505
- AnimationStartProps<T> &
506
- AnimationIterationProps<T> &
507
- AnimationCancelProps<T> &
508
- AnimationEndProps<T> &
509
- MouseDownProps<T> &
510
- MouseUpProps<T> &
511
- MouseMoveProps<T> &
512
- MouseClickProps<T> &
513
- MouseDblClickProps<T> &
514
- MouseLongPressProps<T> &
515
- WheelProps<T> &
516
- KeyDownProps<T> &
517
- KeyUpProps<T> &
518
- FocusProps<T> &
519
- BlurProps<T> &
520
- LayoutChangeProps<T> &
521
- UIAppearProps<T> &
522
- UIDisappearProps<T> &
523
- AccessibilityActionProps<T> &
524
- TapProps<T> &
525
- LongTapProps<T>;
457
+ export type LynxEventPropsBase<T> = {
458
+ [K in keyof LynxEvent<T> as Lowercase<`bind${K}` | `catch${K}` | `capture-bind${K}` | `capture-catch${K}` | `global-bind${K}`>]: LynxEvent<T>[K];
459
+ } & {
460
+ [K in keyof LynxBindCatchEvent<T> as Lowercase<`bind${K}` | `catch${K}` | `capture-bind${K}` | `capture-catch${K}` | `global-bind${K}`>]: LynxBindCatchEvent<T>[K];
461
+ };
526
462
 
527
463
  export type LynxEventProps = LynxEventPropsBase<Target>;
528
464
 
@@ -3,7 +3,7 @@
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
5
  import { SystemInfo } from './system-info';
6
- import { Lynx as BackgroundLynx, NativeModules as INativeModules, GetElementByIdFunc, ITextCodecHelper } from '../background-thread';
6
+ import { Lynx as BackgroundLynx, NativeModules as INativeModules, GetElementByIdFunc } from '../background-thread';
7
7
  import { Lynx as MainThreadLynx } from '../main-thread';
8
8
  import { CommonLynx } from './lynx';
9
9
 
@@ -25,7 +25,6 @@ declare global {
25
25
  var getElementById: GetElementByIdFunc;
26
26
 
27
27
  var NativeModules: INativeModules;
28
- var TextCodecHelper: ITextCodecHelper;
29
28
 
30
29
  /**
31
30
  * @description requestAnimationFrame
@@ -39,8 +38,7 @@ declare global {
39
38
  * @since 3.0
40
39
  * below Lynx 3.0, use lynx.cancelAnimationFrame.
41
40
  */
42
- function cancelAnimationFrame(requestID?: number): void;
43
-
41
+ function cancelAnimationFrame(requestID?: number): void;
44
42
  }
45
43
 
46
44
  declare function setTimeout(callback: (...args: unknown[]) => unknown, number: number): number;
@@ -7,18 +7,9 @@
7
7
  */
8
8
  export interface TraceOption {
9
9
  /**
10
- * An optional unique identifier for tracing a single event flow.
11
- *
12
- * Note: If `flowIds` is set, this parameter will be ignored.
10
+ * An optional unique identifier for tracing the event flow.
13
11
  */
14
12
  flowId?: number;
15
-
16
- /**
17
- * An optional unique identifier for tracing multiple event flows.
18
- * Support from Lynx 3.5
19
- */
20
- flowIds?: number[];
21
-
22
13
  /**
23
14
  * An optional collection of key-value pairs providing additional context for the tracing event.
24
15
  */
@@ -5,6 +5,26 @@
5
5
  import { CSSProperties } from '../common';
6
6
 
7
7
  export interface Element {
8
+ styles: CSSProperties;
9
+ attributes: Record<string, any>;
10
+ scrollBy: (
11
+ width: number,
12
+ height: number
13
+ ) => {
14
+ consumedX: number;
15
+ consumedY: number;
16
+ unconsumedX: number;
17
+ unconsumedY: number;
18
+ };
19
+ getBoundingClientRect: () => {
20
+ width: number;
21
+ height: number;
22
+ top: number;
23
+ bottom: number;
24
+ left: number;
25
+ right: number;
26
+ };
27
+
8
28
  /**
9
29
  * Set an attribute.
10
30
  * @param attributeName The name of the attribute.