@onekeyfe/react-native-native-list 3.0.179-alpha.2026101503 → 3.0.179-alpha.302
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/LICENSE +36 -0
- package/README.md +32 -3
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +22 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +8 -8
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +6 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +11 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +5 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +7 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +8 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +28 -15
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +1 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +104 -18
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +6 -5
- package/docs/SPEC.md +69 -19
- package/docs/STYLE_SPEC.md +12 -2
- package/ios/HybridNativeList.swift +15 -21
- package/ios/NativeListAccessoryStack.swift +14 -10
- package/ios/NativeListActionRenderer.swift +7 -4
- package/ios/NativeListActivityDetailsView.swift +63 -24
- package/ios/NativeListActivityRenderer.swift +19 -10
- package/ios/NativeListDataRowRenderer.swift +23 -19
- package/ios/NativeListDesignAssets.swift +43 -34
- package/ios/NativeListIdentityRenderer.swift +23 -19
- package/ios/NativeListLeadingVisual.swift +9 -4
- package/ios/NativeListMarketRenderer.swift +19 -11
- package/ios/NativeListMediaTileRenderer.swift +11 -7
- package/ios/NativeListMessageRenderer.swift +20 -10
- package/ios/NativeListMetricCardRenderer.swift +16 -12
- package/ios/NativeListRailRenderer.swift +9 -7
- package/ios/NativeListRendererCell.swift +6 -4
- package/ios/NativeListRendererRegistry.swift +8 -3
- package/ios/NativeListResolvedText.swift +3 -3
- package/ios/NativeListRowHost.swift +7 -2
- package/ios/NativeListSectionHeaderRenderer.swift +22 -19
- package/ios/NativeListSystemRenderer.swift +18 -16
- package/ios/NativeListTextStyles.swift +18 -12
- package/ios/NativeListWalletGroupRenderer.swift +6 -4
- package/ios/RNCNativeListView.swift +38 -92
- package/ios/tests/NativeListActivityPresentationTests.swift +5 -3
- package/ios/tests/NativeListLifecycleTests.swift +77 -2
- package/lib/module/NativeList.js +8 -24
- package/lib/module/NativeList.web.js +8 -3
- package/lib/module/fonts.js +44 -0
- package/lib/module/index.js +1 -0
- package/lib/module/web/NativeListWebEngine.js +48 -24
- package/lib/module/web/templates/ActionRowRenderer.js +2 -1
- package/lib/module/web/templates/IdentityRowRenderer.js +4 -3
- package/lib/module/web/templates/MarketRowRenderer.js +2 -1
- package/lib/module/web/templates/RowText.js +13 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +3 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
- package/lib/typescript/src/NativeList.nitro.d.ts +1 -2
- package/lib/typescript/src/NativeList.types.d.ts +0 -4
- package/lib/typescript/src/fonts.d.ts +10 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +4 -1
- package/lib/typescript/src/web/templates/RowText.d.ts +1 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
- package/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
- package/package.json +4 -5
- package/react-native-native-list.podspec +0 -1
- package/src/NativeList.nitro.ts +1 -2
- package/src/NativeList.tsx +4 -25
- package/src/NativeList.types.ts +0 -4
- package/src/NativeList.web.tsx +10 -3
- package/src/fonts.ts +64 -0
- package/src/index.ts +3 -0
- package/src/web/NativeListWebEngine.ts +53 -24
- package/src/web/templates/ActionRowRenderer.ts +2 -1
- package/src/web/templates/IdentityRowRenderer.ts +4 -3
- package/src/web/templates/MarketRowRenderer.ts +4 -2
- package/src/web/templates/RowText.ts +15 -3
- package/src/web/templates/SectionHeaderRowRenderer.ts +6 -3
- package/common/fonts/Roobert-Bold.ttf +0 -0
- package/common/fonts/Roobert-Medium.ttf +0 -0
- package/common/fonts/Roobert-Regular.ttf +0 -0
- package/common/fonts/Roobert-SemiBold.ttf +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { applyTextWeight } from './RowText';
|
|
1
2
|
import type { MarketRow, MarketTextStyle } from '../../models';
|
|
2
3
|
import { createElement, setData, markActionAnchorSource } from './RowElements';
|
|
3
4
|
import {
|
|
@@ -60,8 +61,9 @@ function applyMarketTextStyle(
|
|
|
60
61
|
element.style.fontSize = String(style?.fontSize ?? defaults.fontSize) + 'px';
|
|
61
62
|
element.style.lineHeight =
|
|
62
63
|
String(style?.lineHeight ?? defaults.lineHeight) + 'px';
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
applyTextWeight(
|
|
65
|
+
element,
|
|
66
|
+
String(fontWeight(style?.fontWeight, defaults.weight))
|
|
65
67
|
);
|
|
66
68
|
element.style.color = style?.color ?? '';
|
|
67
69
|
element.style.textAlign = style?.alignment ?? defaults.alignment;
|
|
@@ -13,7 +13,7 @@ export function applyValueSegments(
|
|
|
13
13
|
element.textContent = '';
|
|
14
14
|
element.style.fontSize = String(fontSize) + 'px';
|
|
15
15
|
element.style.lineHeight = String(lineHeight) + 'px';
|
|
16
|
-
element
|
|
16
|
+
applyTextWeight(element, String(weight));
|
|
17
17
|
segments.forEach((segment) => {
|
|
18
18
|
const span = createElement(
|
|
19
19
|
element.ownerDocument,
|
|
@@ -148,7 +148,7 @@ export function applyTextStyleToSlot(
|
|
|
148
148
|
if (style.lineHeight !== undefined)
|
|
149
149
|
element.style.lineHeight = String(style.lineHeight) + 'px';
|
|
150
150
|
if (style.fontWeight !== undefined)
|
|
151
|
-
element
|
|
151
|
+
applyTextWeight(element, String(fontWeight(style.fontWeight, 400)));
|
|
152
152
|
if (style.color !== undefined) element.style.color = style.color;
|
|
153
153
|
// Explicit overrides also apply to rich text runs, but never to sibling badges.
|
|
154
154
|
// Subscript segments keep their legacy size relative to the field size.
|
|
@@ -160,7 +160,7 @@ export function applyTextStyleToSlot(
|
|
|
160
160
|
else run.style.fontSize = String(style.fontSize) + 'px';
|
|
161
161
|
}
|
|
162
162
|
if (style.fontWeight !== undefined)
|
|
163
|
-
run
|
|
163
|
+
applyTextWeight(run, String(fontWeight(style.fontWeight, 400)));
|
|
164
164
|
if (style.lineHeight !== undefined && !subscript)
|
|
165
165
|
run.style.lineHeight = String(style.lineHeight) + 'px';
|
|
166
166
|
if (style.lines !== undefined || style.truncate !== undefined)
|
|
@@ -179,3 +179,15 @@ export function fontWeight(
|
|
|
179
179
|
if (value === 'regular') return 400;
|
|
180
180
|
return fallback;
|
|
181
181
|
}
|
|
182
|
+
|
|
183
|
+
export function applyTextWeight(
|
|
184
|
+
element: HTMLElement,
|
|
185
|
+
weight: string | number
|
|
186
|
+
): void {
|
|
187
|
+
element.style.fontWeight = String(weight);
|
|
188
|
+
const face =
|
|
189
|
+
{ '400': 'regular', '500': 'medium', '600': 'semibold', '700': 'bold' }[
|
|
190
|
+
String(weight)
|
|
191
|
+
] ?? 'regular';
|
|
192
|
+
element.style.fontFamily = `var(--nl-font-${face})`;
|
|
193
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { applyTextWeight } from './RowText';
|
|
1
2
|
import { applyTabularNumbers, hasExplicitRowHeight } from './RowElements';
|
|
2
3
|
import type { SectionHeaderRow } from '../../models';
|
|
3
4
|
import {
|
|
@@ -56,10 +57,12 @@ function createSectionHeader(
|
|
|
56
57
|
body.style.gap = row.checkbox ? '12px' : '8px';
|
|
57
58
|
title.style.fontSize = row.variant === 'summary' ? '16px' : '14px';
|
|
58
59
|
title.style.lineHeight = row.variant === 'summary' ? '24px' : '20px';
|
|
59
|
-
|
|
60
|
+
applyTextWeight(
|
|
61
|
+
title,
|
|
60
62
|
row.variant === 'summary' || (row.titleActionKey && !row.checkbox)
|
|
61
63
|
? '500'
|
|
62
|
-
: '600'
|
|
64
|
+
: '600'
|
|
65
|
+
);
|
|
63
66
|
if (row.titleActionKey) {
|
|
64
67
|
const text = createElement(
|
|
65
68
|
document,
|
|
@@ -129,7 +132,7 @@ function createSectionHeader(
|
|
|
129
132
|
value.style.fontFamily = 'inherit';
|
|
130
133
|
value.style.fontSize = '16px';
|
|
131
134
|
value.style.lineHeight = '24px';
|
|
132
|
-
value
|
|
135
|
+
applyTextWeight(value, '500');
|
|
133
136
|
if (row.valueActionKey) {
|
|
134
137
|
value.style.color = 'var(--nl-secondary)';
|
|
135
138
|
value.style.padding = '0';
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|