@onekeyfe/react-native-native-list 3.0.179-alpha.2026101502 → 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.
Files changed (113) hide show
  1. package/LICENSE +36 -0
  2. package/README.md +32 -3
  3. package/android/build.gradle +0 -1
  4. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +22 -3
  5. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +8 -8
  6. package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +5 -5
  7. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -4
  8. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -6
  9. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +6 -1
  10. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +11 -11
  11. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +20 -20
  12. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +5 -4
  13. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +7 -7
  14. package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +5 -5
  15. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +8 -7
  16. package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
  17. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +28 -15
  18. package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +4 -4
  19. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +3 -3
  20. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +3 -2
  21. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -4
  22. package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +1 -1
  23. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +20 -20
  24. package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +3 -3
  25. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +104 -18
  26. package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +6 -5
  27. package/docs/SPEC.md +69 -19
  28. package/docs/STYLE_SPEC.md +12 -2
  29. package/ios/HybridNativeList.swift +15 -21
  30. package/ios/NativeListAccessoryStack.swift +14 -10
  31. package/ios/NativeListActionRenderer.swift +7 -4
  32. package/ios/NativeListActivityDetailsView.swift +63 -24
  33. package/ios/NativeListActivityRenderer.swift +19 -10
  34. package/ios/NativeListDataRowRenderer.swift +23 -19
  35. package/ios/NativeListDesignAssets.swift +43 -34
  36. package/ios/NativeListIdentityRenderer.swift +23 -19
  37. package/ios/NativeListLeadingVisual.swift +9 -4
  38. package/ios/NativeListMarketRenderer.swift +19 -11
  39. package/ios/NativeListMediaTileRenderer.swift +11 -7
  40. package/ios/NativeListMessageRenderer.swift +20 -10
  41. package/ios/NativeListMetricCardRenderer.swift +16 -12
  42. package/ios/NativeListRailRenderer.swift +9 -7
  43. package/ios/NativeListRendererCell.swift +6 -4
  44. package/ios/NativeListRendererRegistry.swift +8 -3
  45. package/ios/NativeListResolvedText.swift +3 -3
  46. package/ios/NativeListRowHost.swift +7 -2
  47. package/ios/NativeListSectionHeaderRenderer.swift +22 -19
  48. package/ios/NativeListSystemRenderer.swift +18 -16
  49. package/ios/NativeListTextStyles.swift +18 -12
  50. package/ios/NativeListWalletGroupRenderer.swift +6 -4
  51. package/ios/RNCNativeListView.swift +38 -92
  52. package/ios/tests/NativeListActivityPresentationTests.swift +5 -3
  53. package/ios/tests/NativeListLifecycleTests.swift +77 -2
  54. package/lib/module/NativeList.js +8 -24
  55. package/lib/module/NativeList.web.js +8 -3
  56. package/lib/module/fonts.js +44 -0
  57. package/lib/module/index.js +1 -0
  58. package/lib/module/web/NativeListWebEngine.js +48 -24
  59. package/lib/module/web/templates/ActionRowRenderer.js +2 -1
  60. package/lib/module/web/templates/IdentityRowRenderer.js +4 -3
  61. package/lib/module/web/templates/MarketRowRenderer.js +2 -1
  62. package/lib/module/web/templates/RowText.js +13 -3
  63. package/lib/module/web/templates/SectionHeaderRowRenderer.js +3 -2
  64. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
  65. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
  66. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
  67. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
  68. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
  69. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
  70. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
  71. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
  72. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
  73. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
  74. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
  75. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
  76. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
  77. package/lib/typescript/src/NativeList.nitro.d.ts +1 -2
  78. package/lib/typescript/src/NativeList.types.d.ts +0 -4
  79. package/lib/typescript/src/fonts.d.ts +10 -0
  80. package/lib/typescript/src/index.d.ts +2 -0
  81. package/lib/typescript/src/web/NativeListWebEngine.d.ts +4 -1
  82. package/lib/typescript/src/web/templates/RowText.d.ts +1 -0
  83. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
  84. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
  85. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
  87. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
  88. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
  89. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
  90. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
  91. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
  92. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
  93. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
  94. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
  95. package/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
  96. package/package.json +4 -5
  97. package/react-native-native-list.podspec +0 -1
  98. package/src/NativeList.nitro.ts +1 -2
  99. package/src/NativeList.tsx +4 -25
  100. package/src/NativeList.types.ts +0 -4
  101. package/src/NativeList.web.tsx +10 -3
  102. package/src/fonts.ts +64 -0
  103. package/src/index.ts +3 -0
  104. package/src/web/NativeListWebEngine.ts +53 -24
  105. package/src/web/templates/ActionRowRenderer.ts +2 -1
  106. package/src/web/templates/IdentityRowRenderer.ts +4 -3
  107. package/src/web/templates/MarketRowRenderer.ts +4 -2
  108. package/src/web/templates/RowText.ts +15 -3
  109. package/src/web/templates/SectionHeaderRowRenderer.ts +6 -3
  110. package/common/fonts/Roobert-Bold.ttf +0 -0
  111. package/common/fonts/Roobert-Medium.ttf +0 -0
  112. package/common/fonts/Roobert-Regular.ttf +0 -0
  113. 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
- element.style.fontWeight = String(
64
- fontWeight(style?.fontWeight, defaults.weight)
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.style.fontWeight = String(weight);
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.style.fontWeight = String(fontWeight(style.fontWeight, 400));
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.style.fontWeight = String(fontWeight(style.fontWeight, 400));
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
- title.style.fontWeight =
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.style.fontWeight = '500';
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