@onekeyfe/react-native-native-list 3.0.114 → 3.0.116
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/README.md +57 -3
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +47 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +795 -30
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +445 -91
- package/ios/NativeListCell.swift +655 -20
- package/ios/NativeListDesignAssets.swift +8 -0
- package/ios/RNCNativeListView.swift +275 -42
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +1 -0
- package/lib/module/validation.js +145 -1
- package/lib/module/web/NativeListWebEngine.js +461 -51
- package/lib/typescript/src/models.d.ts +108 -2
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +37 -3
- package/package.json +4 -2
- package/src/models.ts +144 -3
- package/src/validation.ts +250 -0
- package/src/web/NativeListWebEngine.ts +766 -91
|
@@ -28,6 +28,70 @@ export type BadgeModel = Readonly<{
|
|
|
28
28
|
text: string;
|
|
29
29
|
tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
30
30
|
}>;
|
|
31
|
+
export type MarketTextStyle = Readonly<{
|
|
32
|
+
fontSize?: number;
|
|
33
|
+
fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
34
|
+
color?: string;
|
|
35
|
+
lineHeight?: number;
|
|
36
|
+
lines?: 1 | 2;
|
|
37
|
+
alignment?: 'start' | 'center' | 'end';
|
|
38
|
+
}>;
|
|
39
|
+
export type MarketImageStyle = Readonly<{
|
|
40
|
+
width?: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
shape?: 'circle' | 'rounded' | 'square';
|
|
43
|
+
cornerRadius?: number;
|
|
44
|
+
contentFit?: ImageContentFit;
|
|
45
|
+
}>;
|
|
46
|
+
export type MarketRowStyle = Readonly<{
|
|
47
|
+
horizontalPadding?: number;
|
|
48
|
+
verticalPadding?: number;
|
|
49
|
+
leadingGap?: number;
|
|
50
|
+
/** Space between title and subtitle; 0 by default, bounded to 0..16. */
|
|
51
|
+
lineGap?: number;
|
|
52
|
+
titleBadgeGap?: number;
|
|
53
|
+
/** OneKey patch: keep badges next to the intrinsic title width. */
|
|
54
|
+
titleBadgeLayout?: 'inline';
|
|
55
|
+
trailingGap?: number;
|
|
56
|
+
/** OneKey patch: preserve separate Market content and subtitle insets. */
|
|
57
|
+
contentTrailingGap?: number;
|
|
58
|
+
subtitleTrailingPadding?: number;
|
|
59
|
+
image?: MarketImageStyle;
|
|
60
|
+
title?: MarketTextStyle;
|
|
61
|
+
subtitle?: MarketTextStyle;
|
|
62
|
+
price?: MarketTextStyle;
|
|
63
|
+
change?: MarketTextStyle;
|
|
64
|
+
changeWidth?: number;
|
|
65
|
+
changeHeight?: number;
|
|
66
|
+
changeCornerRadius?: number;
|
|
67
|
+
}>;
|
|
68
|
+
export type MarketBadgeModel = Readonly<{
|
|
69
|
+
key: string;
|
|
70
|
+
text?: string;
|
|
71
|
+
/** Finite native glyph set; currently only the community verified mark. */
|
|
72
|
+
iconName?: 'verified';
|
|
73
|
+
icon?: ImageSource;
|
|
74
|
+
tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
75
|
+
textColor?: string;
|
|
76
|
+
backgroundColor?: string;
|
|
77
|
+
actionKey?: string;
|
|
78
|
+
accessibilityLabel?: string;
|
|
79
|
+
/** OneKey patch: optional Market badge metrics; legacy native defaults remain unchanged. */
|
|
80
|
+
style?: Readonly<{
|
|
81
|
+
fontSize?: number;
|
|
82
|
+
fontWeight?: MarketTextStyle['fontWeight'];
|
|
83
|
+
lineHeight?: number;
|
|
84
|
+
height?: number;
|
|
85
|
+
horizontalPadding?: number;
|
|
86
|
+
}>;
|
|
87
|
+
}>;
|
|
88
|
+
export type MarketChangeModel = Readonly<{
|
|
89
|
+
text: string;
|
|
90
|
+
textSegments?: readonly ValueTextSegment[];
|
|
91
|
+
tone: 'positive' | 'negative' | 'neutral';
|
|
92
|
+
textColor?: string;
|
|
93
|
+
backgroundColor?: string;
|
|
94
|
+
}>;
|
|
31
95
|
export type SelectorTextSegment = Readonly<{
|
|
32
96
|
text: string;
|
|
33
97
|
textSegments?: readonly ValueTextSegment[];
|
|
@@ -261,6 +325,33 @@ export type DataRow = RowBase & Readonly<{
|
|
|
261
325
|
favorite?: boolean;
|
|
262
326
|
favoriteActive?: boolean;
|
|
263
327
|
}>;
|
|
328
|
+
/** Native Market quote row. All values are already localized/formatted strings. */
|
|
329
|
+
export type MarketRow = RowBase & Readonly<{
|
|
330
|
+
type: 'market';
|
|
331
|
+
variant: 'token' | 'stock' | 'perp';
|
|
332
|
+
leading: LeadingVisual;
|
|
333
|
+
title: string;
|
|
334
|
+
subtitle?: string;
|
|
335
|
+
/** OneKey patch: localized name shrinks independently of the volume. */
|
|
336
|
+
subtitlePrefix?: Readonly<{
|
|
337
|
+
text: string;
|
|
338
|
+
gap?: number;
|
|
339
|
+
maxWidth?: number;
|
|
340
|
+
style?: MarketTextStyle;
|
|
341
|
+
}>;
|
|
342
|
+
subtitleSegments?: readonly ValueTextSegment[];
|
|
343
|
+
price: string;
|
|
344
|
+
priceSegments?: readonly ValueTextSegment[];
|
|
345
|
+
change: MarketChangeModel;
|
|
346
|
+
badges?: readonly MarketBadgeModel[];
|
|
347
|
+
pressActionKey?: string;
|
|
348
|
+
pressInActionKey?: string;
|
|
349
|
+
longPressActionKey?: string;
|
|
350
|
+
diagnostics?: Readonly<{
|
|
351
|
+
imageBindActionKey?: string;
|
|
352
|
+
}>;
|
|
353
|
+
style?: MarketRowStyle;
|
|
354
|
+
}>;
|
|
264
355
|
export type MediaTileRow = RowBase & Readonly<{
|
|
265
356
|
type: 'mediaTile';
|
|
266
357
|
variant: 'gallery' | 'browserPreview';
|
|
@@ -335,12 +426,16 @@ export type ActionRow = RowBase & Readonly<{
|
|
|
335
426
|
export type SystemRow = RowBase & (Readonly<{
|
|
336
427
|
type: 'system';
|
|
337
428
|
variant: 'loading';
|
|
429
|
+
presentation?: 'market';
|
|
430
|
+
loadingStyle?: 'skeleton' | 'spinner';
|
|
338
431
|
message?: string;
|
|
339
432
|
}> | Readonly<{
|
|
340
433
|
type: 'system';
|
|
341
434
|
variant: 'retry';
|
|
435
|
+
presentation?: 'market';
|
|
342
436
|
message: string;
|
|
343
437
|
actionKey: string;
|
|
438
|
+
actionText?: string;
|
|
344
439
|
}> | Readonly<{
|
|
345
440
|
type: 'system';
|
|
346
441
|
variant: 'warning';
|
|
@@ -350,17 +445,19 @@ export type SystemRow = RowBase & (Readonly<{
|
|
|
350
445
|
}> | Readonly<{
|
|
351
446
|
type: 'system';
|
|
352
447
|
variant: 'noMatch';
|
|
448
|
+
presentation?: 'market';
|
|
353
449
|
message: string;
|
|
354
450
|
}> | Readonly<{
|
|
355
451
|
type: 'system';
|
|
356
452
|
variant: 'end';
|
|
453
|
+
presentation?: 'market';
|
|
357
454
|
message?: string;
|
|
358
455
|
}> | Readonly<{
|
|
359
456
|
type: 'system';
|
|
360
457
|
variant: 'spacer';
|
|
361
458
|
height: number;
|
|
362
459
|
}>);
|
|
363
|
-
export type RowModel = IdentityRow | WalletGroupRow | RailRow | ActivityRow | MessageRow | DataRow | MediaTileRow | MetricCardRow | SectionHeaderRow | ActionRow | SystemRow;
|
|
460
|
+
export type RowModel = IdentityRow | WalletGroupRow | RailRow | ActivityRow | MessageRow | DataRow | MarketRow | MediaTileRow | MetricCardRow | SectionHeaderRow | ActionRow | SystemRow;
|
|
364
461
|
export type NativeListTheme = Readonly<{
|
|
365
462
|
checkboxBackground?: string;
|
|
366
463
|
checkboxBorder?: string;
|
|
@@ -445,6 +542,10 @@ export type RowPatch = Readonly<{
|
|
|
445
542
|
type: 'dataRow';
|
|
446
543
|
key: string;
|
|
447
544
|
changes: Partial<Pick<DataRow, CommonPatchFields | 'leading' | 'columns' | 'checkbox' | 'index' | 'badge' | 'badges' | 'favorite' | 'favoriteActive'>>;
|
|
545
|
+
}> | Readonly<{
|
|
546
|
+
type: 'market';
|
|
547
|
+
key: string;
|
|
548
|
+
changes: Partial<Pick<MarketRow, CommonPatchFields | 'leading' | 'title' | 'subtitle' | 'subtitleSegments' | 'price' | 'priceSegments' | 'change' | 'badges' | 'pressActionKey' | 'pressInActionKey' | 'longPressActionKey' | 'diagnostics' | 'style'>>;
|
|
448
549
|
}> | Readonly<{
|
|
449
550
|
type: 'mediaTile';
|
|
450
551
|
key: string;
|
|
@@ -470,7 +571,7 @@ export type RowPatch = Readonly<{
|
|
|
470
571
|
message?: string;
|
|
471
572
|
}>;
|
|
472
573
|
}>;
|
|
473
|
-
export type NativeListActionSource = 'row' | 'leadingAction' | 'trailingAccessory' | 'footerAction' | 'mediaClose';
|
|
574
|
+
export type NativeListActionSource = 'row' | 'marketBadge' | 'leadingAction' | 'trailingAccessory' | 'footerAction' | 'mediaClose';
|
|
474
575
|
export type NativeListWindowRect = Readonly<{
|
|
475
576
|
x: number;
|
|
476
577
|
y: number;
|
|
@@ -482,6 +583,11 @@ export type NativeListActionAnchor = Readonly<{
|
|
|
482
583
|
token: string;
|
|
483
584
|
/** Window-relative logical units: CSS px on Web, points on iOS, dp on Android. */
|
|
484
585
|
windowRect: NativeListWindowRect;
|
|
586
|
+
/** Actual long-press point, in the same logical units as windowRect. */
|
|
587
|
+
windowPoint?: Readonly<{
|
|
588
|
+
x: number;
|
|
589
|
+
y: number;
|
|
590
|
+
}>;
|
|
485
591
|
source: NativeListActionSource;
|
|
486
592
|
slot?: number;
|
|
487
593
|
generation: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionAnchorInvalidatedEvent, NativeListSnapshot, NativeListActionAnchor, NativeListActionSource, ReorderEvent, RowActionEvent, RowModel, RowPatch, SelectionDeltaEvent, VisibleRangeChangedEvent } from '../models';
|
|
1
|
+
import type { ActionAnchorInvalidatedEvent, MarketRow, NativeListSnapshot, NativeListActionAnchor, NativeListActionSource, ReorderEvent, RowActionEvent, RowModel, RowPatch, SelectionDeltaEvent, VisibleRangeChangedEvent } from '../models';
|
|
2
2
|
import type { ActionAnchorState, ScrollToIndexFailedInfo, ScrollToLocationParams } from '../NativeList.types';
|
|
3
3
|
import { type NormalizedPositionScroll } from '../scrolling';
|
|
4
4
|
export declare const WEB_REORDER_ANIMATION: {
|
|
@@ -7,6 +7,7 @@ export declare const WEB_REORDER_ANIMATION: {
|
|
|
7
7
|
readonly dropDurationMs: 80;
|
|
8
8
|
readonly dropTimingFunction: "ease";
|
|
9
9
|
};
|
|
10
|
+
export declare const WEB_MARKET_VERIFIED_PATH = "M9.483 11.458v3.5h-1v-3.5z M10.467 2.698a2.03 2.03 0 0 1 3.065 0l1.358 1.564a.03.03 0 0 0 .028.01l2.046-.325a2.03 2.03 0 0 1 2.347 1.971l.037 2.07q0 .016.014.026l1.776 1.066a2.03 2.03 0 0 1 .532 3.019l-1.304 1.609a.03.03 0 0 0-.005.03l.675 1.956a2.03 2.03 0 0 1-1.533 2.656l-2.033.394a.03.03 0 0 0-.023.019l-.741 1.933a2.03 2.03 0 0 1-2.88 1.05l-1.811-1.006a.03.03 0 0 0-.03 0l-1.811 1.005a2.03 2.03 0 0 1-2.88-1.049l-.742-1.933a.03.03 0 0 0-.023-.019l-2.033-.394a2.03 2.03 0 0 1-1.532-2.656l.675-1.957a.03.03 0 0 0-.005-.029l-1.304-1.61a2.03 2.03 0 0 1 .532-3.018l1.776-1.066a.03.03 0 0 0 .014-.026l.035-2.07a2.03 2.03 0 0 1 2.349-1.97l2.045.324a.03.03 0 0 0 .028-.01zm1.516 3.76a.5.5 0 0 0-.447.276l-1.861 3.724H8.483a1 1 0 0 0-1 1v3.5a1 1 0 0 0 1 1h6.692a2 2 0 0 0 1.981-1.73l.341-2.5a2 2 0 0 0-1.982-2.27h-1.939l.197-1.269a1.5 1.5 0 0 0-1.481-1.731z";
|
|
10
11
|
export type WebLayoutItem = Readonly<{
|
|
11
12
|
index: number;
|
|
12
13
|
key: string;
|
|
@@ -21,6 +22,21 @@ export type WebListLayout = Readonly<{
|
|
|
21
22
|
contentHeight: number;
|
|
22
23
|
horizontal: boolean;
|
|
23
24
|
}>;
|
|
25
|
+
export type WebMarketLayoutStyle = Readonly<{
|
|
26
|
+
horizontalPadding: number;
|
|
27
|
+
verticalPadding: number;
|
|
28
|
+
leadingGap: number;
|
|
29
|
+
titleBadgeGap: number;
|
|
30
|
+
trailingGap: number;
|
|
31
|
+
imageWidth: number;
|
|
32
|
+
imageHeight: number;
|
|
33
|
+
imageCornerRadius: number;
|
|
34
|
+
changeWidth: number;
|
|
35
|
+
changeHeight: number;
|
|
36
|
+
changeCornerRadius: number;
|
|
37
|
+
}>;
|
|
38
|
+
/** Resolves every reusable Market geometry field, including legacy defaults. */
|
|
39
|
+
export declare function resolveWebMarketLayoutStyle(row: MarketRow): WebMarketLayoutStyle;
|
|
24
40
|
export type NativeListWebCallbacks = Readonly<{
|
|
25
41
|
onRowAction?: (event: RowActionEvent) => void;
|
|
26
42
|
onActionAnchorInvalidated?: (event: ActionAnchorInvalidatedEvent) => void;
|
|
@@ -50,8 +66,17 @@ export declare function estimateWebRowHeight(row: RowModel, snapshot: NativeList
|
|
|
50
66
|
export declare function computeWebListLayout(snapshot: NativeListSnapshot, viewportWidth: number, viewportHeight: number, compactRowKey?: string): WebListLayout;
|
|
51
67
|
export declare function webWalletGroupReorderBadge(row: RowModel): string | undefined;
|
|
52
68
|
export declare function visibleWebLayoutItems(layout: WebListLayout, offset: number, viewportLength: number, overscan?: number): readonly WebLayoutItem[];
|
|
69
|
+
export type WebCollapsiblePagerScrollMetrics = Readonly<{
|
|
70
|
+
offset: number;
|
|
71
|
+
viewportLength: number;
|
|
72
|
+
}>;
|
|
73
|
+
export declare function resolveWebCollapsiblePagerScrollMetrics(rawOffset: number, rawViewportLength: number, headerInset: number, stickyInset: number): WebCollapsiblePagerScrollMetrics;
|
|
74
|
+
export declare function resolveWebCollapsiblePagerRawOffset(logicalOffset: number, headerInset: number): number;
|
|
53
75
|
export declare function webLayoutItemsForMount(layout: WebListLayout, offset: number, viewportLength: number, virtualizationEnabled: boolean, overscan?: number): readonly WebLayoutItem[];
|
|
54
76
|
export declare function webRowRenderSignature(row: RowModel): string;
|
|
77
|
+
export declare function isWebMarketQuotePatch(patch: RowPatch): boolean;
|
|
78
|
+
/** Number of Market image-binding passes caused by one Web patch transaction. */
|
|
79
|
+
export declare function webMarketImageBindDeltaForPatches(patches: readonly RowPatch[]): 0 | 1;
|
|
55
80
|
export declare const WEB_LIST_CSS: string;
|
|
56
81
|
export declare class NativeListWebEngine {
|
|
57
82
|
private readonly document;
|
|
@@ -62,7 +87,6 @@ export declare class NativeListWebEngine {
|
|
|
62
87
|
private readonly footer;
|
|
63
88
|
private readonly sticky;
|
|
64
89
|
private readonly indexRail;
|
|
65
|
-
private readonly indexPreview;
|
|
66
90
|
private readonly refreshIndicator;
|
|
67
91
|
private readonly reorderPreview;
|
|
68
92
|
private readonly previousHostPosition;
|
|
@@ -82,7 +106,6 @@ export declare class NativeListWebEngine {
|
|
|
82
106
|
private avatarDirection;
|
|
83
107
|
private reachedGeneration;
|
|
84
108
|
private stickyKey;
|
|
85
|
-
private previewTimer;
|
|
86
109
|
private sectionIndexEntries;
|
|
87
110
|
private pointerReorder;
|
|
88
111
|
private keyboardReorder;
|
|
@@ -101,6 +124,8 @@ export declare class NativeListWebEngine {
|
|
|
101
124
|
private readonly actionAnchorInstanceId;
|
|
102
125
|
private actionAnchorCounter;
|
|
103
126
|
private bindingEpochCounter;
|
|
127
|
+
private marketPointer;
|
|
128
|
+
private marketLongPressFired;
|
|
104
129
|
private lastViewportWidth;
|
|
105
130
|
private lastViewportHeight;
|
|
106
131
|
private destroyed;
|
|
@@ -128,6 +153,7 @@ export declare class NativeListWebEngine {
|
|
|
128
153
|
private renderElement;
|
|
129
154
|
private renderFooter;
|
|
130
155
|
private sectionIndexVisibleEntryIndices;
|
|
156
|
+
private sectionIndexMetrics;
|
|
131
157
|
private renderSectionIndex;
|
|
132
158
|
private updateVisibleSelection;
|
|
133
159
|
private updateVisibleState;
|
|
@@ -139,6 +165,9 @@ export declare class NativeListWebEngine {
|
|
|
139
165
|
private viewportLength;
|
|
140
166
|
private contentLength;
|
|
141
167
|
private currentOffset;
|
|
168
|
+
private collapsiblePagerInsets;
|
|
169
|
+
private verticalScrollMetrics;
|
|
170
|
+
private handleCollapsiblePagerInsetsChanged;
|
|
142
171
|
private scrollToAbsoluteOffset;
|
|
143
172
|
private performPendingScroll;
|
|
144
173
|
private rowAtElement;
|
|
@@ -152,6 +181,10 @@ export declare class NativeListWebEngine {
|
|
|
152
181
|
private invalidateActionAnchor;
|
|
153
182
|
private emitActionAnchorInvalidated;
|
|
154
183
|
private handleRowPress;
|
|
184
|
+
private cancelMarketPointer;
|
|
185
|
+
private handleMarketPointerDown;
|
|
186
|
+
private handleMarketPointerMove;
|
|
187
|
+
private handleMarketPointerEnd;
|
|
155
188
|
private handleTitlePointerOver;
|
|
156
189
|
private handleTitlePointerOut;
|
|
157
190
|
private handleClick;
|
|
@@ -168,6 +201,7 @@ export declare class NativeListWebEngine {
|
|
|
168
201
|
private selectIndexPosition;
|
|
169
202
|
private sectionIndexEntryAtEvent;
|
|
170
203
|
private handleIndexPointer;
|
|
204
|
+
private handleIndexPointerEnd;
|
|
171
205
|
private handleIndexClick;
|
|
172
206
|
private handlePullStart;
|
|
173
207
|
private handlePullMove;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-list",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.116",
|
|
4
4
|
"description": "Template-driven native RecyclerView and UICollectionView for React Native",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"eslint-config-prettier": "^10.1.8",
|
|
74
74
|
"eslint-plugin-prettier": "^5.5.4",
|
|
75
75
|
"jest": "^29.7.0",
|
|
76
|
+
"jsdom": "26.1.0",
|
|
76
77
|
"nitrogen": "0.37.0",
|
|
77
78
|
"prettier": "^2.8.8",
|
|
78
79
|
"react": "19.2.3",
|
|
@@ -82,7 +83,8 @@
|
|
|
82
83
|
"typescript": "^5.9.2"
|
|
83
84
|
},
|
|
84
85
|
"peerDependencies": {
|
|
85
|
-
"@onekeyfe/react-native-image": "3.0.
|
|
86
|
+
"@onekeyfe/react-native-image": "3.0.116",
|
|
87
|
+
"@onekeyfe/react-native-native-logger": "3.0.116",
|
|
86
88
|
"react": "*",
|
|
87
89
|
"react-native": "*",
|
|
88
90
|
"react-native-nitro-modules": "0.37.0"
|
package/src/models.ts
CHANGED
|
@@ -33,6 +33,75 @@ export type BadgeModel = Readonly<{
|
|
|
33
33
|
tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
34
34
|
}>;
|
|
35
35
|
|
|
36
|
+
export type MarketTextStyle = Readonly<{
|
|
37
|
+
fontSize?: number;
|
|
38
|
+
fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
39
|
+
color?: string;
|
|
40
|
+
lineHeight?: number;
|
|
41
|
+
lines?: 1 | 2;
|
|
42
|
+
alignment?: 'start' | 'center' | 'end';
|
|
43
|
+
}>;
|
|
44
|
+
|
|
45
|
+
export type MarketImageStyle = Readonly<{
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
shape?: 'circle' | 'rounded' | 'square';
|
|
49
|
+
cornerRadius?: number;
|
|
50
|
+
contentFit?: ImageContentFit;
|
|
51
|
+
}>;
|
|
52
|
+
|
|
53
|
+
export type MarketRowStyle = Readonly<{
|
|
54
|
+
horizontalPadding?: number;
|
|
55
|
+
verticalPadding?: number;
|
|
56
|
+
leadingGap?: number;
|
|
57
|
+
/** Space between title and subtitle; 0 by default, bounded to 0..16. */
|
|
58
|
+
lineGap?: number;
|
|
59
|
+
titleBadgeGap?: number;
|
|
60
|
+
/** OneKey patch: keep badges next to the intrinsic title width. */
|
|
61
|
+
titleBadgeLayout?: 'inline';
|
|
62
|
+
trailingGap?: number;
|
|
63
|
+
/** OneKey patch: preserve separate Market content and subtitle insets. */
|
|
64
|
+
contentTrailingGap?: number;
|
|
65
|
+
subtitleTrailingPadding?: number;
|
|
66
|
+
image?: MarketImageStyle;
|
|
67
|
+
title?: MarketTextStyle;
|
|
68
|
+
subtitle?: MarketTextStyle;
|
|
69
|
+
price?: MarketTextStyle;
|
|
70
|
+
change?: MarketTextStyle;
|
|
71
|
+
changeWidth?: number;
|
|
72
|
+
changeHeight?: number;
|
|
73
|
+
changeCornerRadius?: number;
|
|
74
|
+
}>;
|
|
75
|
+
|
|
76
|
+
export type MarketBadgeModel = Readonly<{
|
|
77
|
+
key: string;
|
|
78
|
+
text?: string;
|
|
79
|
+
/** Finite native glyph set; currently only the community verified mark. */
|
|
80
|
+
iconName?: 'verified';
|
|
81
|
+
icon?: ImageSource;
|
|
82
|
+
tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
83
|
+
textColor?: string;
|
|
84
|
+
backgroundColor?: string;
|
|
85
|
+
actionKey?: string;
|
|
86
|
+
accessibilityLabel?: string;
|
|
87
|
+
/** OneKey patch: optional Market badge metrics; legacy native defaults remain unchanged. */
|
|
88
|
+
style?: Readonly<{
|
|
89
|
+
fontSize?: number;
|
|
90
|
+
fontWeight?: MarketTextStyle['fontWeight'];
|
|
91
|
+
lineHeight?: number;
|
|
92
|
+
height?: number;
|
|
93
|
+
horizontalPadding?: number;
|
|
94
|
+
}>;
|
|
95
|
+
}>;
|
|
96
|
+
|
|
97
|
+
export type MarketChangeModel = Readonly<{
|
|
98
|
+
text: string;
|
|
99
|
+
textSegments?: readonly ValueTextSegment[];
|
|
100
|
+
tone: 'positive' | 'negative' | 'neutral';
|
|
101
|
+
textColor?: string;
|
|
102
|
+
backgroundColor?: string;
|
|
103
|
+
}>;
|
|
104
|
+
|
|
36
105
|
// OneKey patch: keep selector decoration and text data serializable.
|
|
37
106
|
export type SelectorTextSegment = Readonly<{
|
|
38
107
|
text: string;
|
|
@@ -272,6 +341,33 @@ export type DataRow = RowBase &
|
|
|
272
341
|
favoriteActive?: boolean;
|
|
273
342
|
}>;
|
|
274
343
|
|
|
344
|
+
/** Native Market quote row. All values are already localized/formatted strings. */
|
|
345
|
+
export type MarketRow = RowBase &
|
|
346
|
+
Readonly<{
|
|
347
|
+
type: 'market';
|
|
348
|
+
variant: 'token' | 'stock' | 'perp';
|
|
349
|
+
leading: LeadingVisual;
|
|
350
|
+
title: string;
|
|
351
|
+
subtitle?: string;
|
|
352
|
+
/** OneKey patch: localized name shrinks independently of the volume. */
|
|
353
|
+
subtitlePrefix?: Readonly<{
|
|
354
|
+
text: string;
|
|
355
|
+
gap?: number;
|
|
356
|
+
maxWidth?: number;
|
|
357
|
+
style?: MarketTextStyle;
|
|
358
|
+
}>;
|
|
359
|
+
subtitleSegments?: readonly ValueTextSegment[];
|
|
360
|
+
price: string;
|
|
361
|
+
priceSegments?: readonly ValueTextSegment[];
|
|
362
|
+
change: MarketChangeModel;
|
|
363
|
+
badges?: readonly MarketBadgeModel[];
|
|
364
|
+
pressActionKey?: string;
|
|
365
|
+
pressInActionKey?: string;
|
|
366
|
+
longPressActionKey?: string;
|
|
367
|
+
diagnostics?: Readonly<{ imageBindActionKey?: string }>;
|
|
368
|
+
style?: MarketRowStyle;
|
|
369
|
+
}>;
|
|
370
|
+
|
|
275
371
|
export type MediaTileRow = RowBase &
|
|
276
372
|
Readonly<{
|
|
277
373
|
type: 'mediaTile';
|
|
@@ -345,12 +441,20 @@ export type ActionRow = RowBase &
|
|
|
345
441
|
|
|
346
442
|
export type SystemRow = RowBase &
|
|
347
443
|
(
|
|
348
|
-
| Readonly<{
|
|
444
|
+
| Readonly<{
|
|
445
|
+
type: 'system';
|
|
446
|
+
variant: 'loading';
|
|
447
|
+
presentation?: 'market';
|
|
448
|
+
loadingStyle?: 'skeleton' | 'spinner';
|
|
449
|
+
message?: string;
|
|
450
|
+
}>
|
|
349
451
|
| Readonly<{
|
|
350
452
|
type: 'system';
|
|
351
453
|
variant: 'retry';
|
|
454
|
+
presentation?: 'market';
|
|
352
455
|
message: string;
|
|
353
456
|
actionKey: string;
|
|
457
|
+
actionText?: string;
|
|
354
458
|
}>
|
|
355
459
|
| Readonly<{
|
|
356
460
|
type: 'system';
|
|
@@ -359,8 +463,18 @@ export type SystemRow = RowBase &
|
|
|
359
463
|
message: string;
|
|
360
464
|
borderColor?: string;
|
|
361
465
|
}>
|
|
362
|
-
| Readonly<{
|
|
363
|
-
|
|
466
|
+
| Readonly<{
|
|
467
|
+
type: 'system';
|
|
468
|
+
variant: 'noMatch';
|
|
469
|
+
presentation?: 'market';
|
|
470
|
+
message: string;
|
|
471
|
+
}>
|
|
472
|
+
| Readonly<{
|
|
473
|
+
type: 'system';
|
|
474
|
+
variant: 'end';
|
|
475
|
+
presentation?: 'market';
|
|
476
|
+
message?: string;
|
|
477
|
+
}>
|
|
364
478
|
| Readonly<{ type: 'system'; variant: 'spacer'; height: number }>
|
|
365
479
|
);
|
|
366
480
|
|
|
@@ -371,6 +485,7 @@ export type RowModel =
|
|
|
371
485
|
| ActivityRow
|
|
372
486
|
| MessageRow
|
|
373
487
|
| DataRow
|
|
488
|
+
| MarketRow
|
|
374
489
|
| MediaTileRow
|
|
375
490
|
| MetricCardRow
|
|
376
491
|
| SectionHeaderRow
|
|
@@ -545,6 +660,29 @@ export type RowPatch =
|
|
|
545
660
|
>
|
|
546
661
|
>;
|
|
547
662
|
}>
|
|
663
|
+
| Readonly<{
|
|
664
|
+
type: 'market';
|
|
665
|
+
key: string;
|
|
666
|
+
changes: Partial<
|
|
667
|
+
Pick<
|
|
668
|
+
MarketRow,
|
|
669
|
+
| CommonPatchFields
|
|
670
|
+
| 'leading'
|
|
671
|
+
| 'title'
|
|
672
|
+
| 'subtitle'
|
|
673
|
+
| 'subtitleSegments'
|
|
674
|
+
| 'price'
|
|
675
|
+
| 'priceSegments'
|
|
676
|
+
| 'change'
|
|
677
|
+
| 'badges'
|
|
678
|
+
| 'pressActionKey'
|
|
679
|
+
| 'pressInActionKey'
|
|
680
|
+
| 'longPressActionKey'
|
|
681
|
+
| 'diagnostics'
|
|
682
|
+
| 'style'
|
|
683
|
+
>
|
|
684
|
+
>;
|
|
685
|
+
}>
|
|
548
686
|
| Readonly<{
|
|
549
687
|
type: 'mediaTile';
|
|
550
688
|
key: string;
|
|
@@ -629,6 +767,7 @@ export type RowPatch =
|
|
|
629
767
|
|
|
630
768
|
export type NativeListActionSource =
|
|
631
769
|
| 'row'
|
|
770
|
+
| 'marketBadge'
|
|
632
771
|
| 'leadingAction'
|
|
633
772
|
| 'trailingAccessory'
|
|
634
773
|
| 'footerAction'
|
|
@@ -646,6 +785,8 @@ export type NativeListActionAnchor = Readonly<{
|
|
|
646
785
|
token: string;
|
|
647
786
|
/** Window-relative logical units: CSS px on Web, points on iOS, dp on Android. */
|
|
648
787
|
windowRect: NativeListWindowRect;
|
|
788
|
+
/** Actual long-press point, in the same logical units as windowRect. */
|
|
789
|
+
windowPoint?: Readonly<{ x: number; y: number }>;
|
|
649
790
|
source: NativeListActionSource;
|
|
650
791
|
slot?: number;
|
|
651
792
|
generation: number;
|