@onekeyfe/react-native-native-list 3.0.157-alpha.248 → 3.0.157-alpha.250
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 +21 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +711 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +169 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +243 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +20 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +487 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +820 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListImageSlot.kt +147 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +453 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +997 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +234 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +232 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +551 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +24 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +475 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +143 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +42 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +415 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +163 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +70 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +748 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +464 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +174 -104
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +407 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListSelectorBackgroundColorTest.kt +34 -0
- package/docs/DESIGN.md +518 -9
- package/docs/MIGRATION_BASELINE.md +117 -0
- package/docs/ROW_TEMPLATES.md +359 -0
- package/docs/SPEC.md +358 -0
- package/docs/STYLE_SPEC.md +978 -0
- package/docs/images/list-capabilities.svg +39 -0
- package/docs/images/row-action.svg +17 -0
- package/docs/images/row-activity.svg +24 -0
- package/docs/images/row-data.svg +24 -0
- package/docs/images/row-identity.svg +25 -0
- package/docs/images/row-market.svg +23 -0
- package/docs/images/row-media-tile.svg +26 -0
- package/docs/images/row-message.svg +20 -0
- package/docs/images/row-metric-card.svg +33 -0
- package/docs/images/row-rail.svg +18 -0
- package/docs/images/row-section-header.svg +19 -0
- package/docs/images/row-style-regions.svg +30 -0
- package/docs/images/row-system.svg +30 -0
- package/docs/images/row-wallet-group.svg +26 -0
- package/ios/NativeListAccessoryStack.swift +680 -0
- package/ios/NativeListActionRenderer.swift +108 -0
- package/ios/NativeListActivityRenderer.swift +179 -0
- package/ios/NativeListDataRowRenderer.swift +444 -0
- package/ios/NativeListIdentityRenderer.swift +685 -0
- package/ios/NativeListImageSlot.swift +140 -0
- package/ios/NativeListLeadingVisual.swift +372 -0
- package/ios/NativeListMarketRenderer.swift +698 -0
- package/ios/NativeListMediaTileRenderer.swift +184 -0
- package/ios/NativeListMessageRenderer.swift +168 -0
- package/ios/NativeListMetricCardRenderer.swift +420 -0
- package/ios/NativeListModels.swift +32 -0
- package/ios/NativeListRailRenderer.swift +152 -0
- package/ios/NativeListRendererCell.swift +311 -0
- package/ios/NativeListRendererRegistry.swift +50 -0
- package/ios/NativeListResolvedText.swift +122 -0
- package/ios/NativeListRowHost.swift +63 -0
- package/ios/NativeListSectionHeaderRenderer.swift +708 -0
- package/ios/NativeListSystemRenderer.swift +568 -0
- package/ios/NativeListTextLabel.swift +42 -0
- package/ios/NativeListTextStyles.swift +236 -0
- package/ios/NativeListWalletGroupRenderer.swift +255 -0
- package/ios/RNCNativeListView.swift +111 -180
- package/lib/module/models.js +54 -0
- package/lib/module/validation.js +324 -26
- package/lib/module/web/NativeListWebEngine.js +148 -936
- package/lib/module/web/templates/ActionRowRenderer.js +97 -0
- package/lib/module/web/templates/ActivityRowRenderer.js +95 -0
- package/lib/module/web/templates/DataRowRenderer.js +145 -0
- package/lib/module/web/templates/IdentityRowRenderer.js +289 -0
- package/lib/module/web/templates/MarketRowRenderer.js +310 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +132 -0
- package/lib/module/web/templates/MessageRowRenderer.js +165 -0
- package/lib/module/web/templates/MetricCardRowRenderer.js +172 -0
- package/lib/module/web/templates/RailRowRenderer.js +98 -0
- package/lib/module/web/templates/RowContainerStyle.js +100 -0
- package/lib/module/web/templates/RowElements.js +93 -0
- package/lib/module/web/templates/RowRendererRegistry.js +70 -0
- package/lib/module/web/templates/RowText.js +121 -0
- package/lib/module/web/templates/RowVisual.js +43 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +146 -0
- package/lib/module/web/templates/SystemRowRenderer.js +161 -0
- package/lib/module/web/templates/WalletGroupRowRenderer.js +96 -0
- package/lib/typescript/src/models.d.ts +166 -13
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +18 -16
- package/lib/typescript/src/web/templates/ActionRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/DataRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +16 -0
- package/lib/typescript/src/web/templates/MarketRowRenderer.d.ts +30 -0
- package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +44 -0
- package/lib/typescript/src/web/templates/MetricCardRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/RailRowRenderer.d.ts +28 -0
- package/lib/typescript/src/web/templates/RowContainerStyle.d.ts +9 -0
- package/lib/typescript/src/web/templates/RowElements.d.ts +38 -0
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +83 -0
- package/lib/typescript/src/web/templates/RowText.d.ts +9 -0
- package/lib/typescript/src/web/templates/RowVisual.d.ts +20 -0
- package/lib/typescript/src/web/templates/SectionHeaderRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/SystemRowRenderer.d.ts +16 -0
- package/lib/typescript/src/web/templates/WalletGroupRowRenderer.d.ts +20 -0
- package/package.json +3 -3
- package/src/models.ts +281 -19
- package/src/validation.ts +501 -46
- package/src/web/NativeListWebEngine.ts +361 -1932
- package/src/web/templates/ActionRowRenderer.ts +123 -0
- package/src/web/templates/ActivityRowRenderer.ts +159 -0
- package/src/web/templates/DataRowRenderer.ts +212 -0
- package/src/web/templates/IdentityRowRenderer.ts +527 -0
- package/src/web/templates/MarketRowRenderer.ts +467 -0
- package/src/web/templates/MediaTileRowRenderer.ts +182 -0
- package/src/web/templates/MessageRowRenderer.ts +306 -0
- package/src/web/templates/MetricCardRowRenderer.ts +337 -0
- package/src/web/templates/RailRowRenderer.ts +136 -0
- package/src/web/templates/RowContainerStyle.ts +131 -0
- package/src/web/templates/RowElements.ts +160 -0
- package/src/web/templates/RowRendererRegistry.ts +111 -0
- package/src/web/templates/RowText.ts +181 -0
- package/src/web/templates/RowVisual.ts +115 -0
- package/src/web/templates/SectionHeaderRowRenderer.ts +243 -0
- package/src/web/templates/SystemRowRenderer.ts +282 -0
- package/src/web/templates/WalletGroupRowRenderer.ts +131 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +0 -4538
- package/ios/NativeListCell.swift +0 -4300
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { RowModel } from '../../models';
|
|
2
|
+
export type RowRendererKey = RowModel['type'];
|
|
3
|
+
export declare function rowRenderer(row: RowModel): {
|
|
4
|
+
key: string;
|
|
5
|
+
appliesSizePreset: boolean;
|
|
6
|
+
create: (document: Document, primitives: Readonly<{
|
|
7
|
+
background: string;
|
|
8
|
+
icon: (element: HTMLElement, name: string) => void;
|
|
9
|
+
iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
|
|
10
|
+
accessory: (rowKey: string, descriptor: import("../..").TrailingAccessory, slot: number) => HTMLElement;
|
|
11
|
+
visual: (source: import("../..").LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
|
|
12
|
+
thumbnail: (source: Readonly<{
|
|
13
|
+
uri: string;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
headers?: Readonly<Record<string, string>>;
|
|
17
|
+
contentFit?: import("../..").ImageContentFit;
|
|
18
|
+
cachePolicy?: import("../..").ImageCachePolicy;
|
|
19
|
+
autoplay?: boolean;
|
|
20
|
+
optimizeTos?: boolean;
|
|
21
|
+
overscan?: number;
|
|
22
|
+
loadingStrategy?: import("../..").ImageLoadingStrategy;
|
|
23
|
+
fallbackUri?: string;
|
|
24
|
+
retryTimes?: number;
|
|
25
|
+
}>) => HTMLElement | undefined;
|
|
26
|
+
textStyle: (element: HTMLElement, style: Readonly<{
|
|
27
|
+
token?: import("../..").NativeListTypographyToken;
|
|
28
|
+
fontSize?: number;
|
|
29
|
+
fontWeight?: "regular" | "medium" | "semibold" | "bold";
|
|
30
|
+
color?: string;
|
|
31
|
+
lineHeight?: number;
|
|
32
|
+
lines?: 1 | 2 | 3;
|
|
33
|
+
truncate?: "tail" | "clip";
|
|
34
|
+
alignment?: "start" | "center" | "end";
|
|
35
|
+
verticalAlignment?: "top" | "center" | "bottom";
|
|
36
|
+
offsetY?: number;
|
|
37
|
+
}>, defaultLines?: number) => void;
|
|
38
|
+
dispose: (element: HTMLElement) => void;
|
|
39
|
+
}>) => HTMLElement;
|
|
40
|
+
bind: (body: HTMLElement, primitives: Readonly<{
|
|
41
|
+
background: string;
|
|
42
|
+
icon: (element: HTMLElement, name: string) => void;
|
|
43
|
+
iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
|
|
44
|
+
accessory: (rowKey: string, descriptor: import("../..").TrailingAccessory, slot: number) => HTMLElement;
|
|
45
|
+
visual: (source: import("../..").LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
|
|
46
|
+
thumbnail: (source: Readonly<{
|
|
47
|
+
uri: string;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
headers?: Readonly<Record<string, string>>;
|
|
51
|
+
contentFit?: import("../..").ImageContentFit;
|
|
52
|
+
cachePolicy?: import("../..").ImageCachePolicy;
|
|
53
|
+
autoplay?: boolean;
|
|
54
|
+
optimizeTos?: boolean;
|
|
55
|
+
overscan?: number;
|
|
56
|
+
loadingStrategy?: import("../..").ImageLoadingStrategy;
|
|
57
|
+
fallbackUri?: string;
|
|
58
|
+
retryTimes?: number;
|
|
59
|
+
}>) => HTMLElement | undefined;
|
|
60
|
+
textStyle: (element: HTMLElement, style: Readonly<{
|
|
61
|
+
token?: import("../..").NativeListTypographyToken;
|
|
62
|
+
fontSize?: number;
|
|
63
|
+
fontWeight?: "regular" | "medium" | "semibold" | "bold";
|
|
64
|
+
color?: string;
|
|
65
|
+
lineHeight?: number;
|
|
66
|
+
lines?: 1 | 2 | 3;
|
|
67
|
+
truncate?: "tail" | "clip";
|
|
68
|
+
alignment?: "start" | "center" | "end";
|
|
69
|
+
verticalAlignment?: "top" | "center" | "bottom";
|
|
70
|
+
offsetY?: number;
|
|
71
|
+
}>, defaultLines?: number) => void;
|
|
72
|
+
dispose: (element: HTMLElement) => void;
|
|
73
|
+
}>) => void;
|
|
74
|
+
measure: (width: number, layout?: string) => number;
|
|
75
|
+
measureRendered: (body: HTMLElement) => number | undefined;
|
|
76
|
+
reorderPreview: (body: HTMLElement) => {
|
|
77
|
+
element: HTMLElement;
|
|
78
|
+
height: number;
|
|
79
|
+
} | undefined;
|
|
80
|
+
};
|
|
81
|
+
export declare function rowRendererKey(row: RowModel): RowRendererKey;
|
|
82
|
+
export declare function recycleRowBody(body: HTMLElement): boolean;
|
|
83
|
+
//# sourceMappingURL=RowRendererRegistry.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NativeListTextStyle } from '../../models';
|
|
2
|
+
export declare function applyValueSegments(element: HTMLElement, segments: readonly Readonly<{
|
|
3
|
+
text: string;
|
|
4
|
+
style?: 'subscript';
|
|
5
|
+
}>[] | undefined, fontSize?: number, lineHeight?: number, weight?: number): void;
|
|
6
|
+
export declare function applyTextLayout(element: HTMLElement, style: NativeListTextStyle, defaultLines?: number): void;
|
|
7
|
+
export declare function applyTextStyleToSlot(element: HTMLElement, style: NativeListTextStyle, defaultLines?: number): void;
|
|
8
|
+
export declare function fontWeight(value: NativeListTextStyle['fontWeight'] | undefined, fallback: number): number;
|
|
9
|
+
//# sourceMappingURL=RowText.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TrailingAccessory, ImageSource, LeadingVisual, NativeListTextStyle, NativeListImageStyle } from '../../models';
|
|
2
|
+
export type RowPrimitives = Readonly<{
|
|
3
|
+
background: string;
|
|
4
|
+
icon: (element: HTMLElement, name: string) => void;
|
|
5
|
+
iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
|
|
6
|
+
accessory: (rowKey: string, descriptor: TrailingAccessory, slot: number) => HTMLElement;
|
|
7
|
+
visual: (source: LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
|
|
8
|
+
thumbnail: (source: ImageSource) => HTMLElement | undefined;
|
|
9
|
+
textStyle: (element: HTMLElement, style: NativeListTextStyle, defaultLines?: number) => void;
|
|
10
|
+
dispose: (element: HTMLElement) => void;
|
|
11
|
+
}>;
|
|
12
|
+
/** Restores factory geometry without touching async loading visibility. */
|
|
13
|
+
export declare class RowVisualStyle {
|
|
14
|
+
private readonly view;
|
|
15
|
+
private readonly defaults;
|
|
16
|
+
constructor(view: HTMLElement);
|
|
17
|
+
restore(): void;
|
|
18
|
+
apply(image: NativeListImageStyle | undefined, width: number, height: number, margin: number): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=RowVisual.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SectionHeaderRow } from '../../models';
|
|
2
|
+
import type { RowPrimitives } from './RowVisual';
|
|
3
|
+
declare function bind(body: HTMLElement, row: SectionHeaderRow, primitives: RowPrimitives): void;
|
|
4
|
+
declare function create(document: Document, row: SectionHeaderRow, primitives: RowPrimitives): HTMLDivElement;
|
|
5
|
+
export declare const sectionHeaderRowRenderer: {
|
|
6
|
+
key: "sectionHeader";
|
|
7
|
+
create: typeof create;
|
|
8
|
+
bind: typeof bind;
|
|
9
|
+
recycle: (body: HTMLElement) => void;
|
|
10
|
+
appliesSizePreset: (row: SectionHeaderRow) => boolean;
|
|
11
|
+
measure: (row: SectionHeaderRow, _width: number, layout?: string) => 32 | 28 | 16 | 68 | 47 | 56 | 30 | 36;
|
|
12
|
+
measureRendered: (_body: HTMLElement, _row: SectionHeaderRow) => number | undefined;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=SectionHeaderRowRenderer.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SystemRow } from '../../models';
|
|
2
|
+
import type { RowPrimitives } from './RowVisual';
|
|
3
|
+
declare function bind(body: HTMLElement, row: SystemRow, primitives: RowPrimitives): void;
|
|
4
|
+
declare function create(document: Document, row: SystemRow, primitives: RowPrimitives): HTMLDivElement;
|
|
5
|
+
declare function measure(row: SystemRow, width: number): number;
|
|
6
|
+
export declare const systemRowRenderer: {
|
|
7
|
+
key: "system";
|
|
8
|
+
appliesSizePreset: (row: SystemRow) => boolean;
|
|
9
|
+
create: typeof create;
|
|
10
|
+
bind: typeof bind;
|
|
11
|
+
measure: typeof measure;
|
|
12
|
+
measureRendered: (body: HTMLElement, row: SystemRow) => number | undefined;
|
|
13
|
+
recycle: (body: HTMLElement) => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=SystemRowRenderer.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WalletGroupRow } from '../../models';
|
|
2
|
+
import type { RowPrimitives } from './RowVisual';
|
|
3
|
+
declare function bind(body: HTMLElement, row: WalletGroupRow, primitives: RowPrimitives): void;
|
|
4
|
+
declare function create(document: Document, row: WalletGroupRow, primitives: RowPrimitives): HTMLDivElement;
|
|
5
|
+
declare function recycle(body: HTMLElement): void;
|
|
6
|
+
export declare const walletGroupRowRenderer: {
|
|
7
|
+
key: "walletGroup";
|
|
8
|
+
reorderPreview: (body: HTMLElement, row: WalletGroupRow) => {
|
|
9
|
+
element: HTMLElement;
|
|
10
|
+
height: number;
|
|
11
|
+
} | undefined;
|
|
12
|
+
create: typeof create;
|
|
13
|
+
bind: typeof bind;
|
|
14
|
+
recycle: typeof recycle;
|
|
15
|
+
appliesSizePreset: () => boolean;
|
|
16
|
+
measure: (row: WalletGroupRow, width: number) => number;
|
|
17
|
+
measureRendered: (_body: HTMLElement, _row: WalletGroupRow) => number | undefined;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=WalletGroupRowRenderer.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-list",
|
|
3
|
-
"version": "3.0.157-alpha.
|
|
3
|
+
"version": "3.0.157-alpha.250",
|
|
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",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"typescript": "^5.9.2"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@onekeyfe/react-native-image": "3.0.157-alpha.
|
|
87
|
-
"@onekeyfe/react-native-native-logger": "3.0.157-alpha.
|
|
86
|
+
"@onekeyfe/react-native-image": "3.0.157-alpha.250",
|
|
87
|
+
"@onekeyfe/react-native-native-logger": "3.0.157-alpha.250",
|
|
88
88
|
"react": "*",
|
|
89
89
|
"react-native": "*",
|
|
90
90
|
"react-native-nitro-modules": "0.37.0"
|
package/src/models.ts
CHANGED
|
@@ -34,16 +34,42 @@ export type BadgeModel = Readonly<{
|
|
|
34
34
|
tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
35
35
|
}>;
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Named typography steps, shared with the application's design scale. Resolved
|
|
39
|
+
* to fontSize/lineHeight/fontWeight in JavaScript before the snapshot is
|
|
40
|
+
* serialized, so no native renderer needs to know the vocabulary.
|
|
41
|
+
* See docs/STYLE_SPEC.md §3.2.
|
|
42
|
+
*/
|
|
43
|
+
export type NativeListTypographyToken =
|
|
44
|
+
| '$headingXl'
|
|
45
|
+
| '$headingLg'
|
|
46
|
+
| '$headingMd'
|
|
47
|
+
| '$headingSm'
|
|
48
|
+
| '$headingXs'
|
|
49
|
+
| '$bodyLg'
|
|
50
|
+
| '$bodyMd'
|
|
51
|
+
| '$bodySm'
|
|
52
|
+
| '$bodyXs';
|
|
53
|
+
|
|
54
|
+
export type NativeListTextStyle = Readonly<{
|
|
55
|
+
token?: NativeListTypographyToken;
|
|
38
56
|
fontSize?: number;
|
|
39
57
|
fontWeight?: 'regular' | 'medium' | 'semibold' | 'bold';
|
|
40
58
|
color?: string;
|
|
41
59
|
lineHeight?: number;
|
|
42
|
-
lines
|
|
60
|
+
/** Maximum visible lines; does not reserve empty lines or enlarge the row. */
|
|
61
|
+
lines?: 1 | 2 | 3;
|
|
62
|
+
truncate?: 'tail' | 'clip';
|
|
43
63
|
alignment?: 'start' | 'center' | 'end';
|
|
64
|
+
verticalAlignment?: 'top' | 'center' | 'bottom';
|
|
65
|
+
/** Optical translation in logical units; does not affect layout. */
|
|
66
|
+
offsetY?: number;
|
|
44
67
|
}>;
|
|
45
68
|
|
|
46
|
-
|
|
69
|
+
/** Retained alias: Market shipped this name before the style surface was shared. */
|
|
70
|
+
export type MarketTextStyle = NativeListTextStyle;
|
|
71
|
+
|
|
72
|
+
export type NativeListImageStyle = Readonly<{
|
|
47
73
|
width?: number;
|
|
48
74
|
height?: number;
|
|
49
75
|
shape?: 'circle' | 'rounded' | 'square';
|
|
@@ -51,29 +77,224 @@ export type MarketImageStyle = Readonly<{
|
|
|
51
77
|
contentFit?: ImageContentFit;
|
|
52
78
|
}>;
|
|
53
79
|
|
|
54
|
-
export type
|
|
80
|
+
export type MarketImageStyle = NativeListImageStyle;
|
|
81
|
+
|
|
82
|
+
export type NativeListRowContainerStyle = Readonly<{
|
|
83
|
+
/** Explicit row height in logical units; overrides RowBase.height. */
|
|
84
|
+
height?: number;
|
|
85
|
+
backgroundColor?: string;
|
|
86
|
+
opacity?: number;
|
|
87
|
+
cornerRadius?: number;
|
|
88
|
+
borderWidth?: number;
|
|
89
|
+
borderColor?: string;
|
|
90
|
+
contentVerticalAlignment?: 'top' | 'center' | 'bottom';
|
|
91
|
+
}>;
|
|
92
|
+
|
|
93
|
+
/** Local box vocabulary. Each template exposes only parameters for its own slots. */
|
|
94
|
+
export type RowBoxStyle = Readonly<{
|
|
95
|
+
container?: NativeListRowContainerStyle;
|
|
55
96
|
horizontalPadding?: number;
|
|
56
97
|
verticalPadding?: number;
|
|
57
98
|
leadingGap?: number;
|
|
58
|
-
/**
|
|
99
|
+
/** Gap between the template's text rows. Omission preserves its default. */
|
|
59
100
|
lineGap?: number;
|
|
60
101
|
titleBadgeGap?: number;
|
|
61
|
-
/** OneKey patch: keep badges next to the intrinsic title width. */
|
|
62
|
-
titleBadgeLayout?: 'inline';
|
|
63
102
|
trailingGap?: number;
|
|
64
|
-
|
|
65
|
-
contentTrailingGap?: number;
|
|
66
|
-
subtitleTrailingPadding?: number;
|
|
67
|
-
image?: MarketImageStyle;
|
|
68
|
-
title?: MarketTextStyle;
|
|
69
|
-
subtitle?: MarketTextStyle;
|
|
70
|
-
price?: MarketTextStyle;
|
|
71
|
-
change?: MarketTextStyle;
|
|
72
|
-
changeWidth?: number;
|
|
73
|
-
changeHeight?: number;
|
|
74
|
-
changeCornerRadius?: number;
|
|
103
|
+
image?: NativeListImageStyle;
|
|
75
104
|
}>;
|
|
76
105
|
|
|
106
|
+
/** Template-owned slots determine which local box parameters exist, on every platform. */
|
|
107
|
+
export const ROW_BOX_STYLE_KEYS_BY_TYPE = {
|
|
108
|
+
identity: [
|
|
109
|
+
'horizontalPadding',
|
|
110
|
+
'verticalPadding',
|
|
111
|
+
'leadingGap',
|
|
112
|
+
'lineGap',
|
|
113
|
+
'titleBadgeGap',
|
|
114
|
+
'trailingGap',
|
|
115
|
+
'image',
|
|
116
|
+
],
|
|
117
|
+
walletGroup: ['horizontalPadding', 'verticalPadding'],
|
|
118
|
+
rail: [
|
|
119
|
+
'horizontalPadding',
|
|
120
|
+
'verticalPadding',
|
|
121
|
+
'leadingGap',
|
|
122
|
+
'titleBadgeGap',
|
|
123
|
+
'trailingGap',
|
|
124
|
+
'image',
|
|
125
|
+
],
|
|
126
|
+
activity: [
|
|
127
|
+
'horizontalPadding',
|
|
128
|
+
'verticalPadding',
|
|
129
|
+
'leadingGap',
|
|
130
|
+
'lineGap',
|
|
131
|
+
'trailingGap',
|
|
132
|
+
'image',
|
|
133
|
+
],
|
|
134
|
+
message: [
|
|
135
|
+
'horizontalPadding',
|
|
136
|
+
'verticalPadding',
|
|
137
|
+
'leadingGap',
|
|
138
|
+
'lineGap',
|
|
139
|
+
'image',
|
|
140
|
+
],
|
|
141
|
+
dataRow: [
|
|
142
|
+
'horizontalPadding',
|
|
143
|
+
'verticalPadding',
|
|
144
|
+
'leadingGap',
|
|
145
|
+
'lineGap',
|
|
146
|
+
'titleBadgeGap',
|
|
147
|
+
'image',
|
|
148
|
+
],
|
|
149
|
+
market: [
|
|
150
|
+
'horizontalPadding',
|
|
151
|
+
'verticalPadding',
|
|
152
|
+
'leadingGap',
|
|
153
|
+
'lineGap',
|
|
154
|
+
'titleBadgeGap',
|
|
155
|
+
'trailingGap',
|
|
156
|
+
'image',
|
|
157
|
+
],
|
|
158
|
+
mediaTile: [
|
|
159
|
+
'horizontalPadding',
|
|
160
|
+
'verticalPadding',
|
|
161
|
+
'leadingGap',
|
|
162
|
+
'lineGap',
|
|
163
|
+
'image',
|
|
164
|
+
],
|
|
165
|
+
metricCard: [
|
|
166
|
+
'horizontalPadding',
|
|
167
|
+
'verticalPadding',
|
|
168
|
+
'leadingGap',
|
|
169
|
+
'lineGap',
|
|
170
|
+
'image',
|
|
171
|
+
],
|
|
172
|
+
sectionHeader: [
|
|
173
|
+
'horizontalPadding',
|
|
174
|
+
'verticalPadding',
|
|
175
|
+
'lineGap',
|
|
176
|
+
'trailingGap',
|
|
177
|
+
],
|
|
178
|
+
action: [
|
|
179
|
+
'horizontalPadding',
|
|
180
|
+
'verticalPadding',
|
|
181
|
+
'leadingGap',
|
|
182
|
+
'trailingGap',
|
|
183
|
+
'image',
|
|
184
|
+
],
|
|
185
|
+
system: ['horizontalPadding', 'verticalPadding', 'lineGap'],
|
|
186
|
+
} as const;
|
|
187
|
+
|
|
188
|
+
type TemplateBoxStyle<T extends keyof typeof ROW_BOX_STYLE_KEYS_BY_TYPE> = Pick<
|
|
189
|
+
RowBoxStyle,
|
|
190
|
+
(typeof ROW_BOX_STYLE_KEYS_BY_TYPE)[T][number] | 'container'
|
|
191
|
+
>;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* A style key names the model field it modifies, never the view that carries
|
|
195
|
+
* it. Each template renderer owns its views and maps the key to whichever view
|
|
196
|
+
* renders that field (for example metricCard `value` is its large number), so
|
|
197
|
+
* the same key name keeps one meaning across platforms. See docs/STYLE_SPEC.md §4.
|
|
198
|
+
*/
|
|
199
|
+
export type IdentityRowStyle = TemplateBoxStyle<'identity'> &
|
|
200
|
+
Readonly<{
|
|
201
|
+
title?: NativeListTextStyle;
|
|
202
|
+
subtitle?: NativeListTextStyle;
|
|
203
|
+
tertiary?: NativeListTextStyle;
|
|
204
|
+
badge?: NativeListTextStyle;
|
|
205
|
+
value?: NativeListTextStyle;
|
|
206
|
+
valueSecondary?: NativeListTextStyle;
|
|
207
|
+
}>;
|
|
208
|
+
|
|
209
|
+
export type WalletGroupRowStyle = TemplateBoxStyle<'walletGroup'>;
|
|
210
|
+
|
|
211
|
+
export type RailRowStyle = TemplateBoxStyle<'rail'> &
|
|
212
|
+
Readonly<{
|
|
213
|
+
title?: NativeListTextStyle;
|
|
214
|
+
badge?: NativeListTextStyle;
|
|
215
|
+
status?: NativeListTextStyle;
|
|
216
|
+
}>;
|
|
217
|
+
|
|
218
|
+
export type ActivityRowStyle = TemplateBoxStyle<'activity'> &
|
|
219
|
+
Readonly<{
|
|
220
|
+
title?: NativeListTextStyle;
|
|
221
|
+
description?: NativeListTextStyle;
|
|
222
|
+
status?: NativeListTextStyle;
|
|
223
|
+
primaryAmount?: NativeListTextStyle;
|
|
224
|
+
secondaryAmount?: NativeListTextStyle;
|
|
225
|
+
}>;
|
|
226
|
+
|
|
227
|
+
export type MessageRowStyle = TemplateBoxStyle<'message'> &
|
|
228
|
+
Readonly<{
|
|
229
|
+
title?: NativeListTextStyle;
|
|
230
|
+
body?: NativeListTextStyle;
|
|
231
|
+
time?: NativeListTextStyle;
|
|
232
|
+
}>;
|
|
233
|
+
|
|
234
|
+
export type DataRowStyle = TemplateBoxStyle<'dataRow'> &
|
|
235
|
+
Readonly<{
|
|
236
|
+
columns?: NativeListTextStyle;
|
|
237
|
+
columnSecondary?: NativeListTextStyle;
|
|
238
|
+
index?: NativeListTextStyle;
|
|
239
|
+
}>;
|
|
240
|
+
|
|
241
|
+
export type MarketRowStyle = TemplateBoxStyle<'market'> &
|
|
242
|
+
Readonly<{
|
|
243
|
+
/** OneKey patch: keep badges next to the intrinsic title width. */
|
|
244
|
+
titleBadgeLayout?: 'inline';
|
|
245
|
+
/** OneKey patch: preserve separate Market content and subtitle insets. */
|
|
246
|
+
contentTrailingGap?: number;
|
|
247
|
+
subtitleTrailingPadding?: number;
|
|
248
|
+
title?: NativeListTextStyle;
|
|
249
|
+
subtitle?: NativeListTextStyle;
|
|
250
|
+
price?: NativeListTextStyle;
|
|
251
|
+
change?: NativeListTextStyle;
|
|
252
|
+
changeWidth?: number;
|
|
253
|
+
changeHeight?: number;
|
|
254
|
+
changeCornerRadius?: number;
|
|
255
|
+
}>;
|
|
256
|
+
|
|
257
|
+
export type MediaTileRowStyle = TemplateBoxStyle<'mediaTile'> &
|
|
258
|
+
Readonly<{
|
|
259
|
+
title?: NativeListTextStyle;
|
|
260
|
+
subtitle?: NativeListTextStyle;
|
|
261
|
+
badge?: NativeListTextStyle;
|
|
262
|
+
}>;
|
|
263
|
+
|
|
264
|
+
export type MetricCardRowStyle = TemplateBoxStyle<'metricCard'> &
|
|
265
|
+
Readonly<{
|
|
266
|
+
/** Standard-card label or composite-card heading. */
|
|
267
|
+
title?: NativeListTextStyle;
|
|
268
|
+
/** Large number in the standard template; absent in composite variants. */
|
|
269
|
+
value?: NativeListTextStyle;
|
|
270
|
+
subtitle?: NativeListTextStyle;
|
|
271
|
+
trend?: NativeListTextStyle;
|
|
272
|
+
}>;
|
|
273
|
+
|
|
274
|
+
export type SectionHeaderRowStyle = TemplateBoxStyle<'sectionHeader'> &
|
|
275
|
+
Readonly<{
|
|
276
|
+
title?: NativeListTextStyle;
|
|
277
|
+
subtitle?: NativeListTextStyle;
|
|
278
|
+
value?: NativeListTextStyle;
|
|
279
|
+
}>;
|
|
280
|
+
|
|
281
|
+
export type ActionRowStyle = TemplateBoxStyle<'action'> &
|
|
282
|
+
Readonly<{
|
|
283
|
+
title?: NativeListTextStyle;
|
|
284
|
+
value?: NativeListTextStyle;
|
|
285
|
+
}>;
|
|
286
|
+
|
|
287
|
+
export type SystemRowStyle = TemplateBoxStyle<'system'> &
|
|
288
|
+
Readonly<{
|
|
289
|
+
title?: NativeListTextStyle;
|
|
290
|
+
message?: NativeListTextStyle;
|
|
291
|
+
/**
|
|
292
|
+
* Retry button text. Web draws a retry button only for the Market retry;
|
|
293
|
+
* a non-Market Web retry is message-only, so this has no target there.
|
|
294
|
+
*/
|
|
295
|
+
actionText?: NativeListTextStyle;
|
|
296
|
+
}>;
|
|
297
|
+
|
|
77
298
|
export type MarketBadgeModel = Readonly<{
|
|
78
299
|
key: string;
|
|
79
300
|
text?: string;
|
|
@@ -273,6 +494,7 @@ export type IdentityRow = RowBase &
|
|
|
273
494
|
badges?: readonly BadgeModel[];
|
|
274
495
|
trailing?: readonly TrailingAccessory[];
|
|
275
496
|
draggable?: boolean;
|
|
497
|
+
style?: IdentityRowStyle;
|
|
276
498
|
}>;
|
|
277
499
|
|
|
278
500
|
export type WalletGroupRow = RowBase &
|
|
@@ -281,6 +503,7 @@ export type WalletGroupRow = RowBase &
|
|
|
281
503
|
parent: IdentityRow;
|
|
282
504
|
children: readonly IdentityRow[];
|
|
283
505
|
draggable?: boolean;
|
|
506
|
+
style?: WalletGroupRowStyle;
|
|
284
507
|
}>;
|
|
285
508
|
|
|
286
509
|
export type RailRow = RowBase &
|
|
@@ -291,6 +514,7 @@ export type RailRow = RowBase &
|
|
|
291
514
|
status?: 'none' | 'online' | 'warning' | 'error';
|
|
292
515
|
badge?: BadgeModel;
|
|
293
516
|
draggable?: boolean;
|
|
517
|
+
style?: RailRowStyle;
|
|
294
518
|
}>;
|
|
295
519
|
|
|
296
520
|
export type ActivityRow = RowBase &
|
|
@@ -304,6 +528,7 @@ export type ActivityRow = RowBase &
|
|
|
304
528
|
primaryAmount?: string;
|
|
305
529
|
secondaryAmount?: string;
|
|
306
530
|
footerActions?: readonly FooterAction[];
|
|
531
|
+
style?: ActivityRowStyle;
|
|
307
532
|
}>;
|
|
308
533
|
|
|
309
534
|
export type MessageRow = RowBase &
|
|
@@ -316,6 +541,7 @@ export type MessageRow = RowBase &
|
|
|
316
541
|
bodyLines?: 1 | 2 | 3;
|
|
317
542
|
time: string;
|
|
318
543
|
thumbnail?: ImageSource;
|
|
544
|
+
style?: MessageRowStyle;
|
|
319
545
|
}>;
|
|
320
546
|
|
|
321
547
|
export type DataColumn = Readonly<{
|
|
@@ -340,6 +566,7 @@ export type DataRow = RowBase &
|
|
|
340
566
|
badges?: readonly BadgeModel[];
|
|
341
567
|
favorite?: boolean;
|
|
342
568
|
favoriteActive?: boolean;
|
|
569
|
+
style?: DataRowStyle;
|
|
343
570
|
}>;
|
|
344
571
|
|
|
345
572
|
/** Native Market quote row. All values are already localized/formatted strings. */
|
|
@@ -381,6 +608,7 @@ export type MediaTileRow = RowBase &
|
|
|
381
608
|
subtitle?: string;
|
|
382
609
|
badge?: BadgeModel;
|
|
383
610
|
closeActionKey?: string;
|
|
611
|
+
style?: MediaTileRowStyle;
|
|
384
612
|
}>;
|
|
385
613
|
|
|
386
614
|
/** Compact KPI card for dashboards and grids. */
|
|
@@ -405,6 +633,7 @@ export type MetricCardRow = RowBase &
|
|
|
405
633
|
badge?: BadgeModel;
|
|
406
634
|
metrics?: readonly MetricValue[];
|
|
407
635
|
progress?: number;
|
|
636
|
+
style?: MetricCardRowStyle;
|
|
408
637
|
}>;
|
|
409
638
|
|
|
410
639
|
export type SectionHeaderRow = RowBase &
|
|
@@ -427,6 +656,7 @@ export type SectionHeaderRow = RowBase &
|
|
|
427
656
|
titleIcon?: Extract<TrailingAccessory, { kind: 'icon' }>;
|
|
428
657
|
valueIcon?: Extract<TrailingAccessory, { kind: 'icon' }>;
|
|
429
658
|
checkbox?: Extract<TrailingAccessory, { kind: 'checkbox' }>;
|
|
659
|
+
style?: SectionHeaderRowStyle;
|
|
430
660
|
}>;
|
|
431
661
|
|
|
432
662
|
export type ActionRow = RowBase &
|
|
@@ -439,9 +669,11 @@ export type ActionRow = RowBase &
|
|
|
439
669
|
icon?: Extract<LeadingVisual, { kind: 'icon' }>;
|
|
440
670
|
checkbox?: Extract<TrailingAccessory, { kind: 'checkbox' }>;
|
|
441
671
|
trailing?: readonly TrailingAccessory[];
|
|
672
|
+
style?: ActionRowStyle;
|
|
442
673
|
}>;
|
|
443
674
|
|
|
444
675
|
export type SystemRow = RowBase &
|
|
676
|
+
Readonly<{ style?: SystemRowStyle }> &
|
|
445
677
|
(
|
|
446
678
|
| Readonly<{
|
|
447
679
|
type: 'system';
|
|
@@ -529,6 +761,34 @@ export type SectionIndexConfig = Readonly<{
|
|
|
529
761
|
centeredInWindow?: boolean;
|
|
530
762
|
}>;
|
|
531
763
|
|
|
764
|
+
export type NativeListSeparatorStyle = Readonly<{
|
|
765
|
+
/**
|
|
766
|
+
* Leading inset in logical pixels. Omitted keeps each platform's own default,
|
|
767
|
+
* which is not the same everywhere — see docs/STYLE_SPEC.md §6.2.
|
|
768
|
+
*/
|
|
769
|
+
inset?: number;
|
|
770
|
+
/**
|
|
771
|
+
* Overrides the `separator` theme token for this list only. Must be
|
|
772
|
+
* `#RRGGBB` or `#RRGGBBAA`, like every row style color.
|
|
773
|
+
*/
|
|
774
|
+
color?: string;
|
|
775
|
+
}>;
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* List chrome that every platform can honour. Pull to refresh, the section index
|
|
779
|
+
* rail and the reorder preview are deliberately absent: the first two are system
|
|
780
|
+
* controls or three independent constant sets, and the third is drawn with
|
|
781
|
+
* platform-specific primitives. See docs/STYLE_SPEC.md §5.
|
|
782
|
+
*/
|
|
783
|
+
export type NativeListListStyle = Readonly<{
|
|
784
|
+
separator?: NativeListSeparatorStyle;
|
|
785
|
+
/**
|
|
786
|
+
* Corner radius of a `groupId` card, `0…40` logical units. Does not affect
|
|
787
|
+
* rail or media tiles.
|
|
788
|
+
*/
|
|
789
|
+
groupCornerRadius?: number;
|
|
790
|
+
}>;
|
|
791
|
+
|
|
532
792
|
export type NativeListSnapshot = Readonly<{
|
|
533
793
|
schemaVersion: 1;
|
|
534
794
|
generation: number;
|
|
@@ -560,6 +820,7 @@ export type NativeListSnapshot = Readonly<{
|
|
|
560
820
|
emptyState?: ActionRow | SystemRow;
|
|
561
821
|
fixedFooter?: ActionRow | SystemRow;
|
|
562
822
|
theme?: NativeListTheme;
|
|
823
|
+
listStyle?: NativeListListStyle;
|
|
563
824
|
}>;
|
|
564
825
|
|
|
565
826
|
// OneKey patch: include selector-only mutable presentation fields.
|
|
@@ -575,7 +836,8 @@ type CommonPatchFields =
|
|
|
575
836
|
| 'heightRounding'
|
|
576
837
|
| 'opacity'
|
|
577
838
|
| 'pressDisabled'
|
|
578
|
-
| 'accessibilityLabel'
|
|
839
|
+
| 'accessibilityLabel'
|
|
840
|
+
| 'style';
|
|
579
841
|
|
|
580
842
|
export type RowPatch =
|
|
581
843
|
| Readonly<{
|