@lynx-js/types 3.3.0 → 3.3.2

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,5 +1,62 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.5.0
4
+ - Add a new `flowIds` subfield to the TraceOption parameter in the Trace API to support one-to-many trace associations.
5
+ - Refactor event definitions for improved IDE compatibility.
6
+
7
+ ## 3.4.9
8
+ - Add more interface for `scroll-view`.
9
+
10
+ ## 3.4.8
11
+ - Introduce `disabled` for input and textarea.
12
+
13
+ ## 3.4.6
14
+ - fix `TextCodecHelper` defines.
15
+ - Update `fetch` defines for chunk streaming.
16
+
17
+ ## 3.4.5
18
+ - Complete the documentation for image related APIs.
19
+
20
+ ## 3.4.4
21
+ - Complete the documentation for text related APIs.
22
+
23
+ ## 3.4.3
24
+ - Add `font-variation-settings`,`font-feature-settings` and `font-optical-sizing` CSS properties.
25
+ - Add `experimental-recycle-available-item-before-layout` and `enable-dynamic-span-count` property for list.
26
+
27
+ ## 3.4.2
28
+ - And `lynx.fetchBundle` api defines.
29
+ - And `ResponseHandler` defines.
30
+
31
+ ## 3.4.1
32
+
33
+ - Add the following properties: `custom-context-menu`, `custom-text-selection`, `text-selection`.
34
+ - Add the following methods: `setTextSelection`, `getTextBoundingRect`, `getSelectedText`.
35
+ - Add `bindselectionchange` event.
36
+ - Add `addFont` method.
37
+
38
+ ## 3.4.0
39
+
40
+ ### Major Changes
41
+
42
+ - Introduce <input> and <textarea>
43
+
44
+ ## 3.3.2
45
+ - SelectorQuery FieldsParams adds query attribute
46
+ - Revert automatically generated cssTypes
47
+ - Add typing for the runtime interfaces.
48
+ - Codegen longhand and shorthand properties from css_defines
49
+ - Add `experimental-recycle-sticky-item` and `sticky-buffer-count` for list
50
+ - Add `experimental-update-sticky-for-diff` for list
51
+ - Add ReloadBundleEntry to standardize the timing of reload behavior.
52
+ - Add typing for MessageEvent.
53
+
54
+ ## 3.3.1
55
+
56
+ - Codegen csstype.d.ts from css_defines
57
+ - Rename `visibleCellsAfterUpdate` to `visibleItemAfterUpdate` for `list`
58
+ - Rename `visibleCellsBeforeUpdate` to `visibleItemBeforeUpdate` for `list`
59
+
3
60
  ## 3.3.0
4
61
 
5
62
  ### Major Changes
@@ -12,6 +69,7 @@
12
69
  - Add some missing types of built-in element `list`
13
70
  - Add some missing types of built-in element `image`
14
71
  - Add more events like `LayoutChangeEvent` into `MainThread` namespace
72
+ - Add animate operate function in selectorQuery
15
73
 
16
74
  In this commit, we add `AnimationEvent`, `TransitionEvent`, `LayoutChangeEvent`, `UIAppearanceEvent` into `MainThread` namespace.
17
75
  Now you can use like this:
package/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "name": "@lynx-js/types",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "description": "",
5
- "keywords": ["lynx" , "types"],
5
+ "keywords": [
6
+ "lynx",
7
+ "types"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/lynx-family/lynx.git"
12
+ },
6
13
  "license": "Apache-2.0",
7
14
  "author": "Lynx Authors",
8
- "types":"types/index.d.ts",
15
+ "types": "types/index.d.ts",
9
16
  "main": "types/index.d.ts",
10
17
  "scripts": {
11
- "test": "vitest --typecheck --run & tsc --noEmit"
18
+ "test": "vitest --typecheck --run && tsc --noEmit"
12
19
  },
13
20
  "exports": {
14
21
  ".": {
@@ -38,11 +45,21 @@
38
45
  "background": [
39
46
  "./types/background-thread/index.d.ts"
40
47
  ],
41
- "common": ["./types/common/index.d.ts"],
42
- "element": ["./types/common/element/index.d.ts"],
43
- "events": ["./types/common/events.d.ts"],
44
- "props": ["./types/common/props.d.ts"],
45
- "main-thread": ["./types/main-thread/index.d.ts"]
48
+ "common": [
49
+ "./types/common/index.d.ts"
50
+ ],
51
+ "element": [
52
+ "./types/common/element/index.d.ts"
53
+ ],
54
+ "events": [
55
+ "./types/common/events.d.ts"
56
+ ],
57
+ "props": [
58
+ "./types/common/props.d.ts"
59
+ ],
60
+ "main-thread": [
61
+ "./types/main-thread/index.d.ts"
62
+ ]
46
63
  }
47
64
  },
48
65
  "files": [
@@ -45,3 +45,13 @@ export interface Animation {
45
45
 
46
46
  play(): void;
47
47
  }
48
+
49
+ export interface KeyframeEffectV2 {
50
+ readonly keyframes: Array<Record<string, any>>;
51
+ readonly options: Record<string, any>;
52
+ }
53
+
54
+ export interface AnimationV2 {
55
+ readonly effect: KeyframeEffectV2;
56
+ readonly id: string;
57
+ }
@@ -74,6 +74,10 @@ export declare var Request: {
74
74
  new (input: RequestInfo | URL, init?: RequestInit): Request;
75
75
  };
76
76
 
77
+ export interface LynxExtension {
78
+ useStreaming?: boolean;
79
+ }
80
+
77
81
  /**
78
82
  * @description This Fetch API interface represents the response to a request.
79
83
  * @see https://developer.mozilla.org/docs/Web/API/Response
@@ -95,6 +99,11 @@ export interface RequestInit {
95
99
  * @since 2.18
96
100
  */
97
101
  method?: string;
102
+ /**
103
+ * @description Lynx extension, currently used for requesting chunk streaming
104
+ * @since 3.4
105
+ */
106
+ lynxExtension?: LynxExtension;
98
107
  }
99
108
 
100
109
  /**
@@ -133,6 +142,12 @@ export interface Response extends Body {
133
142
  * @since 2.18
134
143
  */
135
144
  readonly url: string;
145
+ /**
146
+ * @description body of ReadableStream
147
+ * @see https://developer.mozilla.org/docs/Web/API/Response/body
148
+ * @since 3.4
149
+ */
150
+ readonly body: ReadableStream;
136
151
  /**
137
152
  * @description clone()
138
153
  * @see https://developer.mozilla.org/docs/Web/API/Response/clone
@@ -9,3 +9,4 @@ export * from './nodes-ref';
9
9
  export * from './performance';
10
10
  export * from './native-modules';
11
11
  export * from './lynx-performance-entry';
12
+ export * from './text-encoder-decoder';
@@ -7,12 +7,12 @@ export interface PerformanceEntry {
7
7
  }
8
8
 
9
9
  export interface FrameworkRenderingTiming {
10
- vmExecuteStart?: number;
11
- vmExecuteEnd?: number;
12
- dataProcessorStart?: number;
13
- dataProcessorEnd?: number;
14
- setInitDataStart?: number;
15
- setInitDataEnd?: number;
10
+ vmExecuteStart: number;
11
+ vmExecuteEnd: number;
12
+ dataProcessorStart: number;
13
+ dataProcessorEnd: number;
14
+ setInitDataStart: number;
15
+ setInitDataEnd: number;
16
16
  }
17
17
 
18
18
  export interface FrameworkRenderingTimings {
@@ -34,6 +34,7 @@ export interface PipelineEntry extends PerformanceEntry {
34
34
  layoutUiOperationExecuteEnd: number;
35
35
  paintEnd: number;
36
36
  frameworkRenderingTiming: FrameworkRenderingTimings[keyof FrameworkRenderingTimings] & FrameworkRenderingTiming;
37
+ hostPlatformTiming: HostPlatformTiming;
37
38
  }
38
39
 
39
40
  export interface LoadBundleEntry extends PipelineEntry {
@@ -43,6 +44,10 @@ export interface LoadBundleEntry extends PipelineEntry {
43
44
  parseEnd: number;
44
45
  loadBackgroundStart: number;
45
46
  loadBackgroundEnd: number;
47
+ verifyTasmStart: number;
48
+ verifyTasmEnd: number;
49
+ ffiStart: number;
50
+ ffiEnd: number;
46
51
  }
47
52
 
48
53
  export interface InitContainerEntry extends PerformanceEntry {
@@ -79,14 +84,60 @@ export interface MetricFcpEntry extends PerformanceEntry {
79
84
  totalFcp: PerformanceMetric;
80
85
  }
81
86
 
82
- export interface MetricTtiEntry extends PerformanceEntry {
83
- tti: PerformanceMetric;
84
- lynxTti: PerformanceMetric;
85
- totalTti: PerformanceMetric;
86
- }
87
-
88
87
  export interface MetricActualFmpEntry extends PerformanceEntry {
89
88
  actualFmp: PerformanceMetric;
90
89
  lynxActualFmp: PerformanceMetric;
91
90
  totalActualFmp: PerformanceMetric;
92
91
  }
92
+
93
+ export interface ReloadBundleEntry extends PipelineEntry {
94
+ reloadBundleStart: number;
95
+ reloadBundleEnd: number;
96
+ reloadBackgroundStart: number;
97
+ reloadBackgroundEnd: number;
98
+ ffiStart: number;
99
+ ffiEnd: number;
100
+ }
101
+
102
+ export interface MemoryUsageEntry extends PerformanceEntry {
103
+ sizeBytes: any;
104
+ detail: Record<string, MemoryUsageItem>;
105
+ }
106
+
107
+ export interface MemoryUsageItem {
108
+ category: string;
109
+ sizeBytes: any;
110
+ detail: Record<string, string>;
111
+ }
112
+
113
+ export interface LazyBundleEntry extends PerformanceEntry {
114
+ componentUrl: string;
115
+ mode: string;
116
+ size: number;
117
+ sync: boolean;
118
+ loadSuccess: boolean;
119
+ requireStart: number;
120
+ requireEnd: number;
121
+ decodeStart: number;
122
+ decodeEnd: number;
123
+ }
124
+
125
+ export interface AndroidHostPlatformTiming {
126
+ hostPlatformType: 'Android';
127
+ measureStart: number;
128
+ measureEnd: number;
129
+ layoutStart: number;
130
+ layoutEnd: number;
131
+ drawStart: number;
132
+ drawEnd: number;
133
+ }
134
+
135
+ export interface IOSHostPlatformTiming {
136
+ hostPlatformType: 'iOS';
137
+ }
138
+
139
+ export interface HarmonyHostPlatformTiming {
140
+ hostPlatformType: 'Harmony';
141
+ }
142
+
143
+ export type HostPlatformTiming = AndroidHostPlatformTiming | IOSHostPlatformTiming | HarmonyHostPlatformTiming
@@ -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 } from './fetch';
11
11
 
12
12
  export * from './fetch';
13
13
 
@@ -70,6 +70,11 @@ export interface ResourcePrefetchResult {
70
70
  }[];
71
71
  }
72
72
 
73
+ export interface FontFace {
74
+ 'font-family': string;
75
+ 'src': string;
76
+ }
77
+
73
78
  export type GetElementByIdFunc = (id: string) => AnimationElement;
74
79
 
75
80
  /**
@@ -150,4 +155,9 @@ export interface Lynx extends CommonLynx {
150
155
  */
151
156
  onError?: (error: Error) => void;
152
157
 
158
+ /**
159
+ * @description Dynamic add font
160
+ * @since 2.12
161
+ */
162
+ addFont(fontFace: FontFace, callback?: () => void): void;
153
163
  }
@@ -3,6 +3,7 @@
3
3
  // LICENSE file in the root directory of this source tree.
4
4
 
5
5
  import { AnyObject } from '../common';
6
+ import { AnimationV2 } from './animation';
6
7
 
7
8
  export enum NODE_REF_INVOKE_ERROR_CODE {
8
9
  SUCCESS = 0,
@@ -46,6 +47,7 @@ export interface FieldsParams {
46
47
  index?: boolean;
47
48
  class?: boolean;
48
49
  attribute?: boolean;
50
+ query?:boolean;
49
51
  }
50
52
 
51
53
  export interface FieldsData {
@@ -55,6 +57,7 @@ export interface FieldsData {
55
57
  index: number;
56
58
  class: Array<string>;
57
59
  attribute: Record<string, unknown>;
60
+ query:SelectorQuery;
58
61
  }
59
62
 
60
63
  export type PathCallback = (data: PathData, status: { data: string; code: number }) => void;
@@ -74,6 +77,14 @@ export interface NodesRef {
74
77
  ) => void
75
78
  ): SelectorQuery;
76
79
 
80
+ animate(animations: AnimationV2[] | AnimationV2): SelectorQuery;
81
+
82
+ playAnimation(ids: string[] | string): SelectorQuery;
83
+
84
+ pauseAnimation(ids: string[] | string): SelectorQuery;
85
+
86
+ cancelAnimation(ids: string[] | string): SelectorQuery;
87
+
77
88
  setNativeProps(nativeProps: Record<string, any>): SelectorQuery;
78
89
  }
79
90
 
@@ -1,22 +1,16 @@
1
- export interface TextEncoder {
2
- encode(str: string): ArrayBuffer;
3
- encoding: 'utf-8';
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 TextDecoder {
18
- decode(buffer: ArrayBuffer | TypedArray | DataView): string;
19
- encoding: 'utf-8';
20
- fatal: false;
21
- ignoreBOM: true;
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
+ }
@@ -97,5 +97,37 @@ export type CSSProperties = Modify<
97
97
  relativeCenter?: 'none' | 'vertical' | 'horizontal' | 'both';
98
98
  linearCrossGravity?: 'none' | 'start' | 'end' | 'center' | 'stretch';
99
99
  listMainAxisGap?: 'grayscale' | (string & {});
100
+ fontVariationSettings?: string;
101
+ fontFeatureSettings?: string;
102
+ fontOpticalSizing?: 'none' | 'auto';
100
103
  }
101
104
  >;
105
+
106
+ export type Shorthands =
107
+ // layout
108
+ "flexFlow" | "padding" | "margin" | "flex" | "backgroundPosition" |
109
+ // typography
110
+ "outline" | "textDecoration" |
111
+ // visual
112
+ "border" | "borderRight" | "borderLeft" | "borderTop" | "borderBottom" | "borderRadius" | "borderWidth" | "background" | "borderColor" | "borderStyle" |
113
+ // animation
114
+ "transition" | "animation" |
115
+ // other
116
+ "mask" | "gap" | "overflow" | "whiteSpace";
117
+ export type Longhands =
118
+ // layout
119
+ "marginInlineStart" | "marginInlineEnd" | "paddingInlineStart" | "paddingInlineEnd" | "gridTemplateColumns" | "gridTemplateRows" | "gridAutoColumns" | "gridAutoRows" | "gridColumnSpan" | "gridRowSpan" | "gridColumnStart" | "gridColumnEnd" | "gridRowStart" | "gridRowEnd" | "gridColumnGap" | "gridRowGap" | "gridAutoFlow" | "maskPosition" | "display" | "paddingLeft" | "paddingRight" | "paddingTop" | "paddingBottom" | "marginLeft" | "marginRight" | "marginTop" | "marginBottom" | "position" | "flexGrow" | "flexShrink" | "flexBasis" | "flexDirection" | "flexWrap" |
120
+ // typography
121
+ "outlineColor" | "outlineStyle" | "outlineWidth" | "textDecorationColor" | "linearCrossGravity" | "borderInlineStartColor" | "borderInlineEndColor" | "borderInlineStartWidth" | "borderInlineEndWidth" | "borderInlineStartStyle" | "borderInlineEndStyle" | "relativeAlignInlineStart" | "relativeAlignInlineEnd" | "relativeInlineStartOf" | "relativeInlineEndOf" | "insetInlineStart" | "insetInlineEnd" | "linearDirection" | "textIndent" | "textStroke" | "textStrokeWidth" | "textStrokeColor" | "XAutoFontSize" | "XAutoFontSizePresetSizes" | "fontVariationSettings" | "fontFeatureSettings" | "fontOpticalSizing" | "textAlign" | "lineHeight" | "textOverflow" | "fontSize" | "fontWeight" | "fontFamily" | "fontStyle" | "lineSpacing" | "linearOrientation" | "linearWeightSum" | "linearWeight" | "linearGravity" | "linearLayoutGravity" | "adaptFontSize" | "textShadow" |
122
+ // visual
123
+ "borderTopColor" | "backgroundOrigin" | "backgroundRepeat" | "backgroundSize" | "borderBottomColor" | "borderLeftStyle" | "borderRightStyle" | "borderTopStyle" | "borderBottomStyle" | "backgroundClip" | "caretColor" | "borderTopLeftRadius" | "borderBottomLeftRadius" | "borderTopRightRadius" | "borderBottomRightRadius" | "borderStartStartRadius" | "borderEndStartRadius" | "borderStartEndRadius" | "borderEndEndRadius" | "borderLeftWidth" | "borderRightWidth" | "borderTopWidth" | "borderBottomWidth" | "XAnimationColorInterpolation" | "XHandleColor" | "color" | "backgroundColor" | "borderLeftColor" | "borderRightColor" | "backgroundImage" |
124
+ // animation
125
+ "transitionProperty" | "transitionDuration" | "transitionDelay" | "transitionTimingFunction" | "implicitAnimation" | "enterTransitionName" | "exitTransitionName" | "pauseTransitionName" | "resumeTransitionName" | "animationName" | "animationDuration" | "animationTimingFunction" | "animationDelay" | "animationIterationCount" | "animationDirection" | "animationFillMode" | "animationPlayState" | "layoutAnimationCreateDuration" | "layoutAnimationCreateTimingFunction" | "layoutAnimationCreateDelay" | "layoutAnimationCreateProperty" | "layoutAnimationDeleteDuration" | "layoutAnimationDeleteTimingFunction" | "layoutAnimationDeleteDelay" | "layoutAnimationDeleteProperty" | "layoutAnimationUpdateDuration" | "layoutAnimationUpdateTimingFunction" | "layoutAnimationUpdateDelay" |
126
+ // other
127
+ "top" | "visibility" | "content" | "overflowX" | "overflowY" | "wordBreak" | "verticalAlign" | "direction" | "relativeId" | "relativeAlignTop" | "relativeAlignRight" | "relativeAlignBottom" | "relativeAlignLeft" | "relativeTopOf" | "relativeRightOf" | "relativeBottomOf" | "relativeLeftOf" | "relativeLayoutOnce" | "relativeCenter" | "zIndex" | "maskImage" | "justifyItems" | "justifySelf" | "filter" | "listMainAxisGap" | "listCrossAxisGap" | "perspective" | "cursor" | "clipPath" | "left" | "maskRepeat" | "maskClip" | "maskOrigin" | "maskSize" | "columnGap" | "rowGap" | "imageRendering" | "hyphens" | "XAppRegion" | "XHandleSize" | "offsetDistance" | "offsetPath" | "offsetRotate" | "opacity" | "height" | "width" | "maxWidth" | "minWidth" | "right" | "maxHeight" | "minHeight" | "bottom" | "letterSpacing" | "alignItems" | "alignSelf" | "alignContent" | "justifyContent" | "boxSizing" | "transform" | "order" | "boxShadow" | "transformOrigin" | "aspectRatio";
128
+
129
+ // Since `Shorthands` and `Longhands` are auto generated, there may be properties
130
+ // such as `gridColumnSpan` is not manually defined in `CSSProperties` yet.
131
+ // Use `& keyof CSSProperties` to ensure only the defined keys are included to avoid type error.
132
+ export type CSSPropertiesWithShorthands = Pick<CSSProperties, Shorthands & keyof CSSProperties>;
133
+ export type CSSPropertiesWithLonghands = Pick<CSSProperties, Longhands & keyof CSSProperties>;
@@ -10,13 +10,19 @@ import { ImageProps, ImageUIMethods } from './image';
10
10
  import { ListItemProps, ListProps, ListRowProps, ListUIMethods } from './list';
11
11
  import { PageProps } from './page';
12
12
  import { ScrollViewProps, ScrollViewUIMethods } from './scroll-view';
13
- import { TextProps } from './text';
13
+ import { TextProps, TextUIMethods } from './text';
14
14
  import { ViewProps } from './view';
15
+ import { InputProps, InputUIMethods } from './input';
16
+ import { TextAreaProps, TextAreaUIMethods } from './textarea';
17
+
15
18
 
16
19
  export interface UIMethods {
17
20
  'list': ListUIMethods;
18
21
  'scroll-view': ScrollViewUIMethods;
19
22
  'image': ImageUIMethods;
23
+ 'input': InputUIMethods;
24
+ 'textarea': TextAreaUIMethods;
25
+ 'text': TextUIMethods;
20
26
  }
21
27
 
22
28
  type LynxComponentProps = ComponentProps;
@@ -37,6 +43,8 @@ export interface IntrinsicElements {
37
43
  'text': TextProps;
38
44
  'view': ViewProps;
39
45
  'raw-text': StandardProps & { text: number | string };
46
+ 'input': InputProps;
47
+ 'textarea': TextAreaProps;
40
48
  }
41
49
 
42
50
  declare module 'react' {
@@ -57,6 +65,8 @@ declare module 'react' {
57
65
  'text': TextProps;
58
66
  'view': ViewProps;
59
67
  'raw-text': StandardProps & { text: number | string };
68
+ 'input': InputProps;
69
+ 'textarea': TextAreaProps;
60
70
  }
61
71
  }
62
72
  }