@onekeyfe/react-native-native-list 6.7.0-6 → 6.7.0-61

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 (216) hide show
  1. package/README.md +312 -375
  2. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  3. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +50 -13
  5. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
  6. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
  7. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  8. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
  10. package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
  12. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
  13. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
  14. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
  15. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
  16. package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
  17. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  18. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +209 -3
  19. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
  20. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  21. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -0
  22. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +8 -3
  23. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  24. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +130 -1
  25. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1978 -136
  26. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
  27. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListDescriptionTouchPolicyTest.kt +153 -0
  28. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  29. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  30. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  31. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  32. package/docs/ROW_TEMPLATES.md +78 -14
  33. package/docs/SPEC.md +1318 -16
  34. package/docs/STYLE_SPEC.md +18 -0
  35. package/ios/HybridNativeList.swift +21 -2
  36. package/ios/NativeListAccessoryStack.swift +237 -51
  37. package/ios/NativeListActivityDetailsView.swift +43 -16
  38. package/ios/NativeListActivityRenderer.swift +8 -2
  39. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  40. package/ios/NativeListDataRowRenderer.swift +167 -30
  41. package/ios/NativeListDesignAssets.swift +13 -75
  42. package/ios/NativeListGeneratedIcons.swift +55 -0
  43. package/ios/NativeListIconBinding.swift +171 -0
  44. package/ios/NativeListIdentityRenderer.swift +256 -39
  45. package/ios/NativeListLeadingVisual.swift +127 -28
  46. package/ios/NativeListMarketRenderer.swift +120 -31
  47. package/ios/NativeListMediaPlaceholderView.swift +189 -0
  48. package/ios/NativeListMediaPreviewSlot.swift +122 -61
  49. package/ios/NativeListMediaTileRenderer.swift +15 -11
  50. package/ios/NativeListMessageRenderer.swift +34 -1
  51. package/ios/NativeListMetricCardRenderer.swift +4 -2
  52. package/ios/NativeListModels.swift +42 -2
  53. package/ios/NativeListRendererRegistry.swift +1 -0
  54. package/ios/NativeListResolvedText.swift +17 -5
  55. package/ios/NativeListRowHost.swift +14 -0
  56. package/ios/NativeListSectionHeaderRenderer.swift +100 -4
  57. package/ios/NativeListTextLabel.swift +106 -0
  58. package/ios/RNCNativeListView.swift +1097 -60
  59. package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
  60. package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
  61. package/ios/tests/NativeListActivityPresentationTests.swift +423 -0
  62. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  63. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  64. package/ios/tests/NativeListLifecycleTests.swift +2959 -4
  65. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  66. package/ios/tests/NativeListMediaVisibilityTests.swift +41 -7
  67. package/ios/tests/NativeListSharedIconTests.swift +236 -0
  68. package/lib/module/NativeList.js +236 -38
  69. package/lib/module/NativeList.web.js +163 -45
  70. package/lib/module/index.js +1 -1
  71. package/lib/module/models.js +3 -0
  72. package/lib/module/selection.js +1 -1
  73. package/lib/module/validation.js +1263 -48
  74. package/lib/module/web/NativeListGeneratedIcons.js +31 -0
  75. package/lib/module/web/NativeListWebEngine.js +513 -275
  76. package/lib/module/web/templates/ActivityRowRenderer.js +41 -54
  77. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  78. package/lib/module/web/templates/DataRowRenderer.js +56 -5
  79. package/lib/module/web/templates/IdentityRowRenderer.js +161 -7
  80. package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
  81. package/lib/module/web/templates/MediaTileRowRenderer.js +84 -25
  82. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  83. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  84. package/lib/module/web/templates/RowRendererRegistry.js +3 -0
  85. package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
  86. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  87. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  88. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  89. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  90. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  91. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  92. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  93. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  94. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  95. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  96. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  97. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  98. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  99. package/lib/typescript/src/NativeList.d.ts +3 -3
  100. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  101. package/lib/typescript/src/NativeList.types.d.ts +20 -2
  102. package/lib/typescript/src/index.d.ts +2 -2
  103. package/lib/typescript/src/models.d.ts +134 -17
  104. package/lib/typescript/src/validation.d.ts +20 -0
  105. package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
  106. package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
  107. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  108. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  109. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
  110. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  111. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  112. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  114. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  115. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  116. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  117. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  118. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  119. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  120. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  121. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  122. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  123. package/package.json +16 -10
  124. package/react-native-native-list.podspec +2 -6
  125. package/scripts/generate-icons.mjs +150 -0
  126. package/scripts/generate-icons.test.mjs +288 -0
  127. package/scripts/native-list-icons.json +260 -0
  128. package/src/NativeList.nitro.ts +2 -0
  129. package/src/NativeList.tsx +439 -91
  130. package/src/NativeList.types.ts +24 -2
  131. package/src/NativeList.web.tsx +286 -88
  132. package/src/index.ts +2 -0
  133. package/src/models.ts +272 -144
  134. package/src/selection.ts +1 -0
  135. package/src/validation.ts +3041 -146
  136. package/src/web/NativeListGeneratedIcons.ts +28 -0
  137. package/src/web/NativeListWebEngine.ts +818 -343
  138. package/src/web/templates/ActivityRowRenderer.ts +71 -91
  139. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  140. package/src/web/templates/DataRowRenderer.ts +121 -20
  141. package/src/web/templates/IdentityRowRenderer.ts +234 -9
  142. package/src/web/templates/MarketTableRowRenderer.ts +53 -33
  143. package/src/web/templates/MediaTileRowRenderer.ts +90 -28
  144. package/src/web/templates/MessageRowRenderer.ts +23 -7
  145. package/src/web/templates/RowContainerStyle.ts +2 -0
  146. package/src/web/templates/RowRendererRegistry.ts +11 -1
  147. package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
  148. package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
  149. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
  150. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
  151. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
  152. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
  153. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
  154. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
  155. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
  156. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
  157. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
  158. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
  159. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
  160. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
  161. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
  162. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
  163. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
  164. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
  165. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
  166. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
  167. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
  168. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
  169. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
  170. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
  171. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
  172. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
  173. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
  174. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
  175. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
  176. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
  177. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
  178. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
  179. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
  180. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
  181. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
  182. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
  183. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
  184. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
  185. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
  186. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
  187. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
  188. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
  189. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
  190. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
  191. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
  192. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
  193. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
  194. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
  195. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
  196. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
  197. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
  198. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
  199. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
  200. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
  201. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
  202. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
  203. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
  204. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
  205. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
  206. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
  207. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
  208. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
  209. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
  210. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
  211. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
  212. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
  213. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
  214. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
  215. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
  216. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
3
4
  import { createElement, tagSlot, markActionAnchorSource } from "./RowElements.js";
4
5
  import { RowVisualStyle } from "./RowVisual.js";
5
6
  import { applyTextWeight, applyValueSegments } from "./RowText.js";
@@ -22,13 +23,13 @@ function bindLegacy(body, row, primitives) {
22
23
  node.hidden = !row[key];
23
24
  if (style?.[key]) primitives.textStyle(node, style[key]);
24
25
  }
25
- const visualKey = JSON.stringify([row.key, row.leading, row.secondaryLeading]);
26
+ const visualKey = JSON.stringify([row.key, row.hideLeading, row.leading, row.secondaryLeading]);
26
27
  if (v.visualKey !== visualKey) {
27
28
  v.visuals.forEach(node => {
28
29
  primitives.dispose(node);
29
30
  node.remove();
30
31
  });
31
- v.visuals = [row.leading, row.secondaryLeading].map(source => primitives.visual(source)).filter(node => !!node);
32
+ v.visuals = (row.hideLeading ? [] : [row.leading, row.secondaryLeading]).map(source => primitives.visual(source)).filter(node => !!node);
32
33
  v.visuals.forEach(node => body.insertBefore(node, v.column));
33
34
  v.visualStyles = v.visuals.map(node => new RowVisualStyle(node));
34
35
  v.visualKey = visualKey;
@@ -88,6 +89,8 @@ function recycleLegacy(body) {
88
89
  const histories = new WeakMap();
89
90
  const isHistory = row => row.presentation !== undefined || row.amounts !== undefined;
90
91
  const ellipsis = 'min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;';
92
+ /** Width a description prefix always leaves for the action text after it. */
93
+ const descriptionActionReserve = '3em';
91
94
  function valueText(node, text, segments, size, line, weight) {
92
95
  node.textContent = text ?? '';
93
96
  applyTextWeight(node, weight);
@@ -105,11 +108,10 @@ function createHistory(body, primitives) {
105
108
  const badges = node('badges');
106
109
  const description = node('description');
107
110
  description.dataset.nlSlot = 'description';
108
- const descriptionTime = createElement(document, 'span');
109
- const descriptionDot = createElement(document, 'span', undefined, '•');
110
- const descriptionAddress = createElement(document, 'button');
111
- descriptionAddress.type = 'button';
112
- description.append(descriptionTime, descriptionDot, descriptionAddress);
111
+ const descriptionPrefix = createElement(document, 'span');
112
+ const descriptionAction = createElement(document, 'button');
113
+ descriptionAction.type = 'button';
114
+ description.append(descriptionPrefix, descriptionAction);
113
115
  const amounts = node('amounts');
114
116
  const fee = node('fee');
115
117
  const feeLabel = node('fee-label');
@@ -133,9 +135,8 @@ function createHistory(body, primitives) {
133
135
  title,
134
136
  badges,
135
137
  description,
136
- descriptionTime,
137
- descriptionDot,
138
- descriptionAddress,
138
+ descriptionPrefix,
139
+ descriptionAction,
139
140
  amounts,
140
141
  amountRows: new Map(),
141
142
  fee,
@@ -152,22 +153,10 @@ function createHistory(body, primitives) {
152
153
  histories.set(body, v);
153
154
  return v;
154
155
  }
155
- const historyIconPaths = {
156
- ArrowTopOutline: ['M19.414 10 18 11.414l-5-5V21h-2V6.414l-5 5L4.586 10 12 2.586z'],
157
- ArrowBottomOutline: ['m13 17.586 5-5L19.414 14 12 21.414 4.586 14 6 12.586l5 5V3h2z'],
158
- SwitchHorOutline: ['m9.414 13-3 3H21v2H6.414l3 3L8 22.414 2.586 17 8 11.586zm12-6L16 12.414 14.586 11l3-3H3V6h14.586l-3-3L16 1.586z'],
159
- CoinsOutline: ['M9 3a7 7 0 0 1 6.328 4.008 7 7 0 1 1-6.657 9.983A7 7 0 0 1 9 3m5.718 6.008a5 5 0 1 0 .566 9.985 5 5 0 0 0-.566-9.985M9 5a5 5 0 0 0-.941 9.91 7 7 0 0 1 5.11-7.667A4.99 4.99 0 0 0 8.999 5Z'],
160
- ShieldCheckDoneOutline: ['M15.914 9.75 11 14.664 8.086 11.75 9.5 10.336l1.5 1.5 3.5-3.5z', 'M12.325 2.055 21 5.036v6.876c0 2.807-1.149 4.83-2.813 6.404-1.615 1.53-3.745 2.66-5.712 3.722l-.475.256-.475-.256c-1.967-1.061-4.097-2.192-5.713-3.722C4.15 16.741 3 14.72 3 11.912V5.036l8.675-2.981.325-.113zM5 6.463v5.45c0 2.165.851 3.686 2.188 4.951 1.275 1.208 2.965 2.154 4.812 3.154 1.847-1 3.537-1.946 4.813-3.154C18.148 15.6 19 14.078 19 11.912v-5.45l-7-2.405z'],
161
- UnlockedOutline: ['M13 18h-2v-5h2z', 'M12 2a5 5 0 0 1 5 5h-2a3 3 0 0 0-6 0v2h11v13H4V9h3V7a5 5 0 0 1 5-5M6 20h12v-9H6z'],
162
- Document2Outline: ['M12 16H8v-2h4zm4-4H8v-2h8zm0-4H8V6h8z', 'M20 22H4V2h16zM6 20h12V4H6z'],
163
- CryptoCoinOutline: ['M11 16.387a4.5 4.5 0 0 1 0-8.775V6h2v1.613a4.5 4.5 0 0 1 2.856 2.067l-1.712 1.032a2.5 2.5 0 1 0 0 2.576l1.712 1.032A4.5 4.5 0 0 1 13 16.386V18h-2z', 'M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0'],
164
- ImageSquareWavesOutline: ['M14.25 7a2 2 0 1 1 0 4 2 2 0 0 1 0-4', 'M21 21H3V3h18zM5 16.414V19h12.586L14 15.414l-2 2-4-4zm0-2.828 3-3 4 4 2-2 5 5V5H5z'],
165
- DotHorOutline: ['M6 14H2v-4h4zm8 0h-4v-4h4zm8 0h-4v-4h4z']
166
- };
156
+ const historyIconNames = new Set(['ArrowTopOutline', 'ArrowBottomOutline', 'SwitchHorOutline', 'CoinsOutline', 'ShieldCheckDoneOutline', 'UnlockedOutline', 'Document2Outline', 'CryptoCoinOutline', 'ImageSquareWavesOutline', 'DotHorOutline']);
167
157
  function historyIcon(node, source, size) {
168
158
  const name = source?.kind === 'icon' ? source.name : source?.kind === 'token' ? source.fallbackIcon?.name : undefined;
169
- const paths = name && historyIconPaths[name];
170
- if (!paths) return;
159
+ if (!name || !historyIconNames.has(name)) return;
171
160
  const placeholder = node.querySelector('.ok-native-list-visual-fallback');
172
161
  if (!placeholder && source && 'image' in source && source.image) return;
173
162
  const fallback = placeholder ?? node;
@@ -179,18 +168,9 @@ function historyIcon(node, source, size) {
179
168
  height: '100%'
180
169
  });
181
170
  if (source?.kind === 'icon' && source.tintColor) fallback.style.color = source.tintColor;else if (source && 'fallbackIcon' in source && source.fallbackIcon?.tintColor) fallback.style.color = source.fallbackIcon.tintColor;
182
- const svg = node.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'svg');
183
- svg.setAttribute('viewBox', '0 0 24 24');
171
+ const svg = createNamedIcon(node.ownerDocument, name);
184
172
  svg.setAttribute('width', String(size));
185
173
  svg.setAttribute('height', String(size));
186
- svg.setAttribute('fill', 'currentColor');
187
- svg.setAttribute('aria-hidden', 'true');
188
- for (const d of paths) {
189
- const path = node.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'path');
190
- path.setAttribute('d', d);
191
- path.setAttribute('fill-rule', 'evenodd');
192
- svg.append(path);
193
- }
194
174
  fallback.replaceChildren(svg);
195
175
  }
196
176
  function bindHistory(body, row, primitives) {
@@ -224,22 +204,23 @@ function bindHistory(body, row, primitives) {
224
204
  Object.assign(v.identity.style, {
225
205
  display: 'flex',
226
206
  alignItems: 'center',
227
- gap: '12px',
207
+ gap: row.hideLeading ? '0' : '12px',
228
208
  minWidth: '0',
229
209
  flex: '1 1 0'
230
210
  });
231
211
  Object.assign(v.visual.style, {
212
+ display: row.hideLeading ? 'none' : '',
232
213
  position: 'relative',
233
214
  width: '40px',
234
215
  height: '40px',
235
216
  flex: '0 0 40px'
236
217
  });
237
- const visualKey = JSON.stringify([row.key, row.leading, row.secondaryLeading]);
218
+ const visualKey = JSON.stringify([row.key, row.hideLeading, row.leading, row.secondaryLeading]);
238
219
  if (v.visualKey !== visualKey) {
239
220
  Array.from(v.visual.children).forEach(n => primitives.dispose(n));
240
221
  v.visual.replaceChildren();
241
222
  v.visuals = [];
242
- const sources = [row.leading, row.secondaryLeading].filter(Boolean);
223
+ const sources = row.hideLeading ? [] : [row.leading, row.secondaryLeading].filter(Boolean);
243
224
  sources.forEach(source => {
244
225
  const visual = primitives.visual(source);
245
226
  if (!visual) return;
@@ -263,7 +244,7 @@ function bindHistory(body, row, primitives) {
263
244
  });
264
245
  v.visualKey = visualKey;
265
246
  }
266
- const sources = [row.leading, row.secondaryLeading].filter(Boolean);
247
+ const sources = row.hideLeading ? [] : [row.leading, row.secondaryLeading].filter(Boolean);
267
248
  v.visuals.forEach((retained, index) => {
268
249
  const {
269
250
  node: visual,
@@ -392,23 +373,29 @@ function bindHistory(body, row, primitives) {
392
373
  v.badges.style.display = row.badges?.length ? 'flex' : 'none';
393
374
  v.description.style.cssText = ellipsis + 'display:flex;max-width:100%;color:var(--nl-secondary);font-family:inherit;font-size:14px;line-height:20px;font-weight:400;font-variant-numeric:tabular-nums;';
394
375
  applyTextWeight(v.description, 400);
395
- const split = row.description?.indexOf(' • ') ?? -1;
396
- v.descriptionTime.textContent = split >= 0 ? row.description.slice(0, split) : '';
397
- v.descriptionTime.style.display = split >= 0 ? 'inline' : 'none';
398
- v.descriptionTime.style.flexShrink = '0';
399
- v.descriptionDot.style.cssText = `flex-shrink:0;margin:0 4px;display:${split >= 0 ? 'inline' : 'none'}`;
400
- v.descriptionAddress.style.cssText = ellipsis + 'appearance:none;display:block;max-width:100%;border:0;padding:0;background:transparent;text-align:left;color:inherit;font:inherit;font-variant-numeric:inherit;';
401
- v.descriptionAddress.textContent = split >= 0 ? row.description.slice(split + 3) : row.description ?? '';
376
+ // The caller states where the action text starts; the string is not parsed.
377
+ const description = row.description ?? '';
378
+ const actionStart = row.descriptionActionKey ? Math.min(Math.max(row.descriptionActionStart ?? 0, 0), description.length) : 0;
379
+ const actionText = description.slice(actionStart);
380
+ const boundAction = row.descriptionActionKey && actionText ? row.descriptionActionKey : '';
381
+ // `pre` keeps the space a prefix ends with; a line break stays a space.
382
+ v.descriptionPrefix.textContent = description.slice(0, actionStart).replace(/\r\n|[\r\n]/g, ' ');
383
+ // The prefix keeps its width and the action truncates first, as the tail of
384
+ // the one native label does. A prefix wider than the row is capped instead,
385
+ // or it would squeeze the action to nothing and leave no pointer target.
386
+ v.descriptionPrefix.style.cssText = `${ellipsis}flex-shrink:0;max-width:${actionText ? `calc(100% - ${descriptionActionReserve})` : '100%'};white-space:pre;display:${actionStart > 0 ? 'block' : 'none'}`;
387
+ v.descriptionAction.style.cssText = `${ellipsis}appearance:none;max-width:100%;border:0;padding:0;background:transparent;text-align:left;color:inherit;font:inherit;font-variant-numeric:inherit;display:${actionText ? 'block' : 'none'};`;
388
+ v.descriptionAction.textContent = actionText;
402
389
  v.description.style.display = row.description ? 'flex' : 'none';
403
- v.descriptionAddress.tabIndex = row.descriptionActionKey ? 0 : -1;
404
- if (row.descriptionActionKey) {
405
- v.descriptionAddress.dataset.nativeListAction = row.descriptionActionKey;
406
- markActionAnchorSource(v.descriptionAddress, 'description');
407
- v.descriptionAddress.style.cursor = 'pointer';
390
+ v.descriptionAction.tabIndex = boundAction ? 0 : -1;
391
+ if (boundAction) {
392
+ v.descriptionAction.dataset.nativeListAction = boundAction;
393
+ markActionAnchorSource(v.descriptionAction, 'description');
394
+ v.descriptionAction.style.cursor = 'pointer';
408
395
  } else {
409
- delete v.descriptionAddress.dataset.nativeListAction;
410
- delete v.descriptionAddress.dataset.nativeListAnchorSource;
411
- v.descriptionAddress.style.cursor = 'inherit';
396
+ delete v.descriptionAction.dataset.nativeListAction;
397
+ delete v.descriptionAction.dataset.nativeListAnchorSource;
398
+ v.descriptionAction.style.cursor = 'inherit';
412
399
  }
413
400
  if (row.style?.description) primitives.textStyle(v.description, row.style.description);
414
401
  v.description.style.display = row.description ? 'flex' : 'none';
@@ -493,7 +480,7 @@ function bindHistory(body, row, primitives) {
493
480
  v.feeSecondary.style.cssText = ellipsis + 'font-size:14px;line-height:20px;font-weight:400;color:var(--nl-secondary);';
494
481
  valueText(v.feePrimary, row.fee?.primary, row.fee?.primaryTextSegments, 14, 20, 400);
495
482
  valueText(v.feeSecondary, row.fee?.secondary, row.fee?.secondaryTextSegments, 14, 20, 400);
496
- v.actions.style.cssText = 'display:flex;gap:12px;padding-left:52px;padding-bottom:4px;';
483
+ v.actions.style.cssText = `display:flex;gap:12px;padding-left:${row.hideLeading ? 0 : 52}px;padding-bottom:4px;`;
497
484
  v.actions.style.display = footer ? 'flex' : 'none';
498
485
  const actionKeys = new Set();
499
486
  for (const [index, action] of (row.footerActions ?? []).entries()) {
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ import { markActionAnchorSource } from "./RowElements.js";
4
+ function bind(body, row) {
5
+ body.replaceChildren();
6
+ body.className = 'ok-native-list-row ok-native-list-button-group';
7
+ body.removeAttribute('data-nl-container-background');
8
+ body.removeAttribute('data-nl-container-border');
9
+ row.buttons.forEach((descriptor, index) => {
10
+ const button = body.ownerDocument.createElement('button');
11
+ button.type = 'button';
12
+ button.className = 'ok-native-list-block-button';
13
+ button.dataset.nativeListAction = descriptor.actionKey;
14
+ button.dataset.nlButtonKey = descriptor.key;
15
+ button.dataset.nlSlot = `button-${index}`;
16
+ if (descriptor.testID) button.dataset.testid = descriptor.testID;
17
+ button.setAttribute('aria-label', descriptor.accessibilityLabel ?? descriptor.label);
18
+ button.disabled = Boolean(row.disabled || descriptor.disabled || descriptor.loading);
19
+ button.setAttribute('aria-busy', descriptor.loading ? 'true' : 'false');
20
+ markActionAnchorSource(button, 'buttonGroup', index);
21
+ const label = body.ownerDocument.createElement('span');
22
+ label.textContent = descriptor.label;
23
+ if (descriptor.loading) {
24
+ const spinner = body.ownerDocument.createElement('span');
25
+ spinner.className = 'ok-native-list-spinner';
26
+ spinner.setAttribute('role', 'progressbar');
27
+ button.appendChild(spinner);
28
+ }
29
+ button.appendChild(label);
30
+ body.appendChild(button);
31
+ });
32
+ }
33
+ function create(document, row, _primitives) {
34
+ const body = document.createElement('div');
35
+ body.dataset.nlRenderer = 'buttonGroup';
36
+ bind(body, row);
37
+ return body;
38
+ }
39
+ export const buttonGroupRowRenderer = {
40
+ key: 'buttonGroup',
41
+ create,
42
+ bind,
43
+ recycle: body => body.replaceChildren(),
44
+ measure: (_row, _width) => 64,
45
+ measureRendered: body => body.scrollHeight
46
+ };
47
+ //# sourceMappingURL=ButtonGroupRowRenderer.js.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import { createElement, tagSlot } from "./RowElements.js";
3
+ import { createElement, markActionAnchorSource, setData, tagSlot } from "./RowElements.js";
4
+ import { applyValueSegments, fontWeight } from "./RowText.js";
4
5
  import { RowVisualStyle } from "./RowVisual.js";
5
6
  const views = new WeakMap();
6
7
  const tone = (value, fallback) => value === 'positive' ? 'var(--nl-positive)' : value === 'negative' ? 'var(--nl-negative)' : value === 'secondary' ? 'var(--nl-secondary)' : `var(--nl-${fallback})`;
@@ -11,11 +12,21 @@ function bind(body, row, primitives) {
11
12
  body.removeAttribute('data-nl-container-background');
12
13
  body.removeAttribute('data-nl-container-border');
13
14
  const style = row.style;
15
+ const isTokenTable = row.index === undefined && !row.favorite && !row.checkbox && row.columns.length === 4 && row.columns[0]?.key === 'asset' && row.columns[1]?.key === 'balance' && row.columns[2]?.key === 'price' && row.columns[3]?.key === 'swapSpacer';
16
+ if (isTokenTable) {
17
+ // Match the legacy four equal columns, including the icon in the first.
18
+ body.style.display = 'grid';
19
+ body.style.gridTemplateColumns = 'repeat(4, minmax(0, 1fr))';
20
+ body.style.gap = '0';
21
+ }
14
22
  if (style?.horizontalPadding !== undefined) body.style.paddingInline = `${style.horizontalPadding}px`;
15
23
  if (style?.verticalPadding !== undefined) body.style.paddingBlock = `${style.verticalPadding}px`;
16
24
  v.controls.replaceChildren();
17
25
  if (row.checkbox) v.controls.appendChild(primitives.accessory(row.key, row.checkbox, 0));
18
26
  v.controls.style.display = 'contents';
27
+ v.trailing.replaceChildren();
28
+ row.trailing?.forEach((accessory, index) => v.trailing.appendChild(primitives.accessory(row.key, accessory, index)));
29
+ v.trailing.hidden = !row.trailing?.length;
19
30
  v.index.style.cssText = '';
20
31
  v.index.hidden = row.index === undefined;
21
32
  v.index.textContent = String(row.index ?? '');
@@ -35,6 +46,9 @@ function bind(body, row, primitives) {
35
46
  v.visualKey = visualKey;
36
47
  }
37
48
  v.visualStyle?.apply(style?.image, style?.image?.width ?? 40, style?.image?.height ?? 40, (style?.leadingGap ?? 12) - 12);
49
+ if (v.visual) v.visual.style.gridArea = isTokenTable ? '1 / 1' : '';
50
+ v.trailing.style.gridArea = isTokenTable ? '1 / 4' : '';
51
+ v.trailing.style.justifySelf = isTokenTable ? 'end' : '';
38
52
  v.columns.forEach((cell, index) => {
39
53
  const column = row.columns[index];
40
54
  cell.body.hidden = !column;
@@ -47,6 +61,12 @@ function bind(body, row, primitives) {
47
61
  cell.body.hidden = false;
48
62
  cell.body.style.flex = String(column.weight ?? 1);
49
63
  cell.body.style.display = 'flex';
64
+ if (isTokenTable) {
65
+ cell.body.style.gridArea = `1 / ${index + 1}`;
66
+ if (index === 0 && v.visual) {
67
+ cell.body.style.marginInlineStart = `${(style?.image?.width ?? 40) + (style?.leadingGap ?? 12)}px`;
68
+ }
69
+ }
50
70
  cell.body.dataset.align = column.alignment ?? 'start';
51
71
  if (style?.lineGap !== undefined) cell.body.style.rowGap = `${style.lineGap}px`;
52
72
  cell.primaryLine.style.cssText = '';
@@ -54,7 +74,26 @@ function bind(body, row, primitives) {
54
74
  if (style?.titleBadgeGap !== undefined) cell.primaryLine.style.gap = `${style.titleBadgeGap}px`;
55
75
  cell.primary.style.cssText = '';
56
76
  cell.primary.textContent = column.text;
77
+ applyValueSegments(cell.primary, column.textSegments, style?.columns?.fontSize ?? 14, style?.columns?.lineHeight ?? 20, fontWeight(style?.columns?.fontWeight, 500));
57
78
  if (style?.columns) primitives.textStyle(cell.primary, style.columns);
79
+ cell.titleIcons.replaceChildren();
80
+ if (column.titleIcon || column.secondaryTitleIcon) {
81
+ cell.primary.style.minWidth = '0';
82
+ cell.primary.style.overflow = 'hidden';
83
+ cell.primary.style.textOverflow = 'ellipsis';
84
+ cell.primary.style.whiteSpace = 'nowrap';
85
+ [column.titleIcon, column.secondaryTitleIcon].filter(icon => icon !== undefined).forEach(descriptor => {
86
+ const icon = primitives.iconAction(descriptor.name, undefined, undefined, descriptor.tintColor);
87
+ icon.className = 'ok-native-list-identity-title-icon';
88
+ if (descriptor.hoverActionKey) {
89
+ setData(icon, 'nativeListHoverAction', descriptor.hoverActionKey);
90
+ setData(icon, 'nativeListIconHelp', true);
91
+ markActionAnchorSource(icon, 'leadingAction');
92
+ }
93
+ if (descriptor.accessibilityLabel) icon.setAttribute('aria-label', descriptor.accessibilityLabel);else icon.setAttribute('aria-hidden', 'true');
94
+ cell.titleIcons.appendChild(icon);
95
+ });
96
+ }
58
97
  cell.badges.replaceChildren();
59
98
  cell.badges.style.display = 'contents';
60
99
  if (column.key === 'asset') row.badges?.forEach(badge => {
@@ -64,17 +103,22 @@ function bind(body, row, primitives) {
64
103
  });
65
104
  // Legacy Web layout: secondary leading text sits inline before the primary
66
105
  // text; secondary text is a direct line below it, toned by secondaryTone.
67
- cell.secondaryLine.style.display = column.secondaryText ? 'contents' : 'none';
68
- [column.secondaryLeadingText, column.secondaryText].forEach((text, slot) => {
106
+ const secondaryText = column.secondaryTextSegments?.length ? column.secondaryTextSegments.map(segment => segment.text).join('') : column.secondaryText;
107
+ cell.secondaryLine.style.display = secondaryText ? 'contents' : 'none';
108
+ [column.secondaryLeadingText, secondaryText].forEach((text, slot) => {
69
109
  const label = cell.secondary[slot];
70
110
  label.hidden = !text;
71
111
  if (!text) label.remove();else if (slot === 0) cell.primaryLine.insertBefore(label, cell.primary);else cell.secondaryLine.appendChild(label);
72
112
  label.style.cssText = '';
73
113
  label.textContent = text ?? '';
114
+ if (slot === 1) {
115
+ applyValueSegments(label, column.secondaryTextSegments, style?.columnSecondary?.fontSize ?? 12, style?.columnSecondary?.lineHeight ?? 16, fontWeight(style?.columnSecondary?.fontWeight, 400));
116
+ }
74
117
  if (slot === 1) label.style.color = tone(column.secondaryTone, 'secondary');
75
118
  if (style?.columnSecondary) primitives.textStyle(label, style.columnSecondary);
76
119
  });
77
120
  });
121
+ body.appendChild(v.trailing);
78
122
  }
79
123
  function create(document, row, primitives) {
80
124
  const body = createElement(document, 'div', 'ok-native-list-row ok-native-list-data');
@@ -82,6 +126,7 @@ function create(document, row, primitives) {
82
126
  const index = tagSlot(createElement(document, 'span', 'ok-native-list-index'), 'index');
83
127
  const favorite = createElement(document, 'span', 'ok-native-list-favorite');
84
128
  const controls = createElement(document, 'span');
129
+ const trailing = createElement(document, 'span', 'ok-native-list-accessories');
85
130
  body.append(controls, index, favorite);
86
131
  const columns = Array.from({
87
132
  length: 4
@@ -89,8 +134,10 @@ function create(document, row, primitives) {
89
134
  const cell = createElement(document, 'span', 'ok-native-list-data-cell');
90
135
  const primaryLine = createElement(document, 'span', 'ok-native-list-data-primary');
91
136
  const primary = tagSlot(createElement(document, 'span'), 'columns');
137
+ const titleIcons = createElement(document, 'span');
138
+ titleIcons.style.display = 'contents';
92
139
  const badges = createElement(document, 'span');
93
- primaryLine.append(primary, badges);
140
+ primaryLine.append(primary, titleIcons, badges);
94
141
  const secondaryLine = createElement(document, 'span', 'ok-native-list-data-secondary-line');
95
142
  const secondary = Array.from({
96
143
  length: 2
@@ -102,15 +149,18 @@ function create(document, row, primitives) {
102
149
  body: cell,
103
150
  primaryLine,
104
151
  primary,
152
+ titleIcons,
105
153
  badges,
106
154
  secondaryLine,
107
155
  secondary
108
156
  };
109
157
  });
158
+ body.appendChild(trailing);
110
159
  views.set(body, {
111
160
  favorite,
112
161
  index,
113
162
  controls,
163
+ trailing,
114
164
  columns,
115
165
  visualKey: '',
116
166
  primitives
@@ -129,6 +179,7 @@ function recycle(body) {
129
179
  v.visualStyle = undefined;
130
180
  v.visualKey = '';
131
181
  v.controls.replaceChildren();
182
+ v.trailing.replaceChildren();
132
183
  }
133
184
  export const dataRowRenderer = {
134
185
  key: 'dataRow',
@@ -137,7 +188,7 @@ export const dataRowRenderer = {
137
188
  recycle,
138
189
  // Legacy presets: table rows without secondary text are 8 units shorter.
139
190
  measure: (row, _width, layout) => {
140
- const secondary = row.columns.some(column => column.secondaryText);
191
+ const secondary = row.columns.some(column => column.secondaryTextSegments?.length ? column.secondaryTextSegments.some(segment => segment.text.length > 0) : !!column.secondaryText);
141
192
  return (secondary ? 60 : 56) + (layout === 'table' && !secondary ? -8 : 0);
142
193
  },
143
194
  measureRendered: (_body, _row) => undefined
@@ -100,6 +100,117 @@ function createIdentityRow(document, primitives, row) {
100
100
  });
101
101
  column.insertBefore(segments, titleElement.nextSibling);
102
102
  }
103
+ if (row.titleIcon || row.secondaryTitleIcon || row.titleImage) {
104
+ const badgeLine = titleElement.querySelector(':scope > .ok-native-list-badges');
105
+ const titleText = createElement(document, 'span', 'ok-native-list-identity-title-text');
106
+ while (titleElement.firstChild && titleElement.firstChild !== badgeLine) titleText.appendChild(titleElement.firstChild);
107
+ titleElement.prepend(titleText);
108
+ // The title slot tag moves with the text. `applyTextLayout` writes the
109
+ // single-line clamp (`display: block`, nowrap, ellipsis) onto the slot
110
+ // element; left on this container it would undo the flex row below and
111
+ // leave the inline-flex glyph baseline-aligned above the title (OK-66402).
112
+ if (titleElement.hasAttribute('data-nl-slot')) {
113
+ titleElement.removeAttribute('data-nl-slot');
114
+ tagSlot(titleText, 'title');
115
+ }
116
+ const icons = [row.titleIcon, row.secondaryTitleIcon].filter(icon => icon !== undefined).map(descriptor => {
117
+ const icon = primitives.iconAction(descriptor.name, undefined, undefined, descriptor.tintColor);
118
+ icon.className = 'ok-native-list-identity-title-icon';
119
+ if (descriptor.hoverActionKey) {
120
+ setData(icon, 'nativeListHoverAction', descriptor.hoverActionKey);
121
+ setData(icon, 'nativeListIconHelp', true);
122
+ markActionAnchorSource(icon, 'leadingAction');
123
+ }
124
+ if (descriptor.accessibilityLabel) icon.setAttribute('aria-label', descriptor.accessibilityLabel);else icon.setAttribute('aria-hidden', 'true');
125
+ return icon;
126
+ });
127
+ if (row.titleImage) {
128
+ const descriptor = row.titleImage;
129
+ const holder = createElement(document, 'span', 'ok-native-list-identity-title-image');
130
+ Object.assign(holder.style, {
131
+ flex: `0 0 ${descriptor.image.width}px`,
132
+ width: `${descriptor.image.width}px`,
133
+ height: `${descriptor.image.height}px`,
134
+ borderRadius: '50%',
135
+ overflow: 'hidden'
136
+ });
137
+ const image = primitives.thumbnail(descriptor.image);
138
+ if (image) {
139
+ Object.assign(image.style, {
140
+ width: '100%',
141
+ height: '100%',
142
+ borderRadius: 'inherit',
143
+ objectFit: descriptor.image.contentFit === 'center' ? 'none' : descriptor.image.contentFit ?? 'cover'
144
+ });
145
+ image.setAttribute('alt', '');
146
+ holder.appendChild(image);
147
+ }
148
+ if (descriptor.hoverActionKey) {
149
+ setData(holder, 'nativeListHoverAction', descriptor.hoverActionKey);
150
+ setData(holder, 'nativeListIconHelp', true);
151
+ markActionAnchorSource(holder, 'leadingAction');
152
+ }
153
+ if (descriptor.accessibilityLabel) {
154
+ holder.setAttribute('role', 'img');
155
+ holder.setAttribute('aria-label', descriptor.accessibilityLabel);
156
+ } else holder.setAttribute('aria-hidden', 'true');
157
+ icons.push(holder);
158
+ }
159
+ titleText.after(...icons);
160
+ titleElement.style.display = 'flex';
161
+ titleElement.style.alignItems = 'center';
162
+ titleElement.style.gap = '4px';
163
+ }
164
+ if (row.titleSuffixes?.length) {
165
+ const badges = titleElement.querySelector(':scope > .ok-native-list-badges');
166
+ let titleText = titleElement.querySelector(':scope > .ok-native-list-identity-title-text, :scope > [data-nl-slot="title"]');
167
+ if (!titleText) {
168
+ titleText = tagSlot(createElement(document, 'span', 'ok-native-list-identity-title-text'), 'title');
169
+ while (titleElement.firstChild && titleElement.firstChild !== badges) titleText.appendChild(titleElement.firstChild);
170
+ titleElement.prepend(titleText);
171
+ titleElement.removeAttribute('data-nl-slot');
172
+ } else if (titleElement.hasAttribute('data-nl-slot')) {
173
+ titleElement.removeAttribute('data-nl-slot');
174
+ tagSlot(titleText, 'title');
175
+ }
176
+ titleElement.style.display = 'flex';
177
+ titleElement.style.alignItems = 'center';
178
+ titleText.style.flex = '0 1 auto';
179
+ titleText.style.minWidth = 'min(80px, 100%)';
180
+ titleText.style.overflow = 'hidden';
181
+ titleText.style.textOverflow = 'ellipsis';
182
+ titleText.style.whiteSpace = 'nowrap';
183
+ row.titleSuffixes.forEach(suffix => {
184
+ const label = createElement(document, 'span', 'ok-native-list-identity-title-suffix', suffix.text);
185
+ label.style.flex = '0 1 auto';
186
+ label.style.minWidth = '0';
187
+ label.style.marginInlineStart = row.titleIcon || row.secondaryTitleIcon || row.titleImage ? '4px' : '8px';
188
+ label.style.maxWidth = suffix.maxWidth === undefined ? '' : `${suffix.maxWidth}px`;
189
+ label.style.overflow = 'hidden';
190
+ label.style.textOverflow = 'ellipsis';
191
+ label.style.whiteSpace = 'nowrap';
192
+ label.style.fontSize = '12px';
193
+ label.style.lineHeight = '16px';
194
+ label.style.fontWeight = '400';
195
+ label.style.fontFamily = 'var(--nl-font-regular)';
196
+ label.style.color = suffix.tone === 'disabled' ? 'var(--nl-disabled)' : 'var(--nl-secondary)';
197
+ titleElement.insertBefore(label, badges);
198
+ });
199
+ }
200
+ if (row.badges?.length && !row.titleIcon && !row.secondaryTitleIcon && !row.titleImage) {
201
+ const titleText = titleElement.querySelector(':scope > [data-nl-slot="title"]');
202
+ const badges = titleElement.querySelector(':scope > .ok-native-list-badges');
203
+ titleElement.style.display = 'flex';
204
+ titleElement.style.alignItems = 'center';
205
+ if (titleText) {
206
+ titleText.style.flex = '0 1 auto';
207
+ titleText.style.minWidth = row.titleSuffixes?.length ? 'min(80px, 100%)' : '0';
208
+ }
209
+ if (badges) {
210
+ badges.style.flex = '0 1 auto';
211
+ badges.style.minWidth = '0';
212
+ }
213
+ }
103
214
  if (presentation === 'walletSidebar' && row.badges?.length) {
104
215
  const badges = createElement(document, 'span', 'ok-native-list-wallet-badges');
105
216
  row.badges.forEach(badge => badges.appendChild(createBadge(document, badge)));
@@ -107,9 +218,12 @@ function createIdentityRow(document, primitives, row) {
107
218
  }
108
219
  for (const key of ['title', 'subtitle']) {
109
220
  const lines = row.style?.[key]?.lines ?? row[`${key}Lines`];
110
- if (lines !== undefined) column.querySelectorAll(`[data-nl-slot="${key}"]`).forEach(text => applyTextLayout(text, {
111
- lines
112
- }));
221
+ if (lines !== undefined) column.querySelectorAll(`[data-nl-slot="${key}"]`).forEach(text => {
222
+ applyTextLayout(text, lines === 0 ? {} : {
223
+ lines
224
+ }, lines === 0 ? 0 : undefined);
225
+ if (key === 'subtitle') text.style.overflowWrap = lines === 1 ? '' : 'anywhere';
226
+ });
113
227
  }
114
228
  }
115
229
  body.appendChild(column);
@@ -125,6 +239,17 @@ function applyIdentityStyle(body, row) {
125
239
  if (box.verticalPadding !== undefined) body.style.paddingBlock = String(box.verticalPadding) + 'px';
126
240
  const vertical = row.type === 'identity' && row.presentation === 'walletSidebar';
127
241
  const leading = body.querySelector(':scope > .ok-native-list-visual, :scope > .ok-native-list-stacked');
242
+ if (row.style?.leadingContentMaxWidthRatio !== undefined && !vertical) {
243
+ const column = body.querySelector(':scope > .ok-native-list-flex');
244
+ const trailing = body.querySelector(':scope > .ok-native-list-accessories');
245
+ const visualWidth = leading ? row.style.image?.width ?? (row.presentation === 'accountSelector' || row.presentation === 'networkSelector' ? 32 : 40) : 0;
246
+ const gap = leading ? row.style.leadingGap ?? 12 : 0;
247
+ if (column) {
248
+ column.style.flex = '0 1 auto';
249
+ column.style.maxWidth = `calc(${row.style.leadingContentMaxWidthRatio * 100}% - ${visualWidth + gap}px)`;
250
+ }
251
+ if (trailing) trailing.style.marginInlineStart = 'auto';
252
+ }
128
253
  const defaultGap = body.style.gap || (row.type === 'identity' && row.presentation === 'walletSidebar' ? '4px' : row.type === 'identity' && row.presentation === 'accountSelector' ? '8px' : '12px');
129
254
  if (box.lineGap !== undefined) {
130
255
  const targets = body.querySelectorAll(':scope > .ok-native-list-flex');
@@ -144,7 +269,9 @@ function applyIdentityStyle(body, row) {
144
269
  }
145
270
  if (box.trailingGap !== undefined) {
146
271
  const gap = String(box.trailingGap) + 'px';
147
- body.querySelectorAll('.ok-native-list-accessories, .ok-native-list-amounts').forEach(trailing => {
272
+ // The accessory row only. A value pair is one accessory whose two lines
273
+ // are a flex column, so a gap there would push the lines apart.
274
+ body.querySelectorAll('.ok-native-list-accessories').forEach(trailing => {
148
275
  trailing.style.gap = gap;
149
276
  });
150
277
  }
@@ -161,7 +288,7 @@ function applyIdentityStyle(body, row) {
161
288
  // Clip the bitmap itself; decorations may extend beyond the visual slot.
162
289
  leading.style.overflow = leading.matches('img') ? 'hidden' : 'visible';
163
290
  }
164
- const images = leading.matches('img') ? [leading] : leading.querySelectorAll(':scope > img, :scope > .ok-native-list-visual-fallback');
291
+ const images = leading.matches('img') ? [leading] : leading.querySelectorAll(':scope > img:not(.ok-native-list-visual-corner), :scope > .ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)');
165
292
  images.forEach(bitmap => {
166
293
  if (bitmap !== leading) {
167
294
  if (image.width !== undefined) bitmap.style.width = '100%';
@@ -185,8 +312,22 @@ function bind(body, row, primitives) {
185
312
  const v = views.get(body);
186
313
  v.primitives = primitives;
187
314
  let used = false;
315
+ let usedTitleImage = false;
188
316
  const next = createIdentityRow(body.ownerDocument, {
189
317
  ...primitives,
318
+ thumbnail: source => {
319
+ usedTitleImage = true;
320
+ const key = JSON.stringify([row.key, source]);
321
+ if (v.titleImage?.key !== key) {
322
+ if (v.titleImage) primitives.dispose(v.titleImage.node);
323
+ const node = primitives.thumbnail(source);
324
+ v.titleImage = node ? {
325
+ key,
326
+ node
327
+ } : undefined;
328
+ }
329
+ return v.titleImage?.node;
330
+ },
190
331
  visual: (source, presentation) => {
191
332
  used = true;
192
333
  const key = JSON.stringify([row.key, source, presentation]);
@@ -211,6 +352,10 @@ function bind(body, row, primitives) {
211
352
  primitives.dispose(v.visual.node);
212
353
  v.visual = undefined;
213
354
  }
355
+ if (!usedTitleImage && v.titleImage) {
356
+ primitives.dispose(v.titleImage.node);
357
+ v.titleImage = undefined;
358
+ }
214
359
  body.replaceChildren(...Array.from(next.childNodes));
215
360
  body.className = next.className;
216
361
  body.style.cssText = next.style.cssText;
@@ -262,6 +407,7 @@ function bind(body, row, primitives) {
262
407
  }
263
408
  }
264
409
  applyIdentityStyle(body, row);
410
+ body.style.height = row.contentHeight === 'auto' && !hasExplicitRowHeight(row) ? 'auto' : '100%';
265
411
  }
266
412
  function create(document, row, primitives) {
267
413
  const body = document.createElement('div');
@@ -275,7 +421,11 @@ function create(document, row, primitives) {
275
421
  function recycle(body) {
276
422
  const v = views.get(body);
277
423
  if (v?.visual) v.primitives.dispose(v.visual.node);
278
- if (v) v.visual = undefined;
424
+ if (v?.titleImage) v.primitives.dispose(v.titleImage.node);
425
+ if (v) {
426
+ v.visual = undefined;
427
+ v.titleImage = undefined;
428
+ }
279
429
  body.replaceChildren();
280
430
  }
281
431
  export const identityRowRenderer = {
@@ -285,6 +435,10 @@ export const identityRowRenderer = {
285
435
  recycle,
286
436
  appliesSizePreset: row => !row.presentation,
287
437
  measure: (row, _width) => row.presentation === 'walletSidebar' ? 68 + (row.badges?.length ? 24 : 0) : row.presentation === 'networkSelector' ? 47 : row.presentation === 'accountSelector' ? 58 : row.tertiary ? 72 : row.subtitle ? 60 : 56,
288
- measureRendered: (_body, _row) => undefined
438
+ measureRendered: (body, row) => {
439
+ if (row.contentHeight !== 'auto' || hasExplicitRowHeight(row)) return undefined;
440
+ const height = body.offsetHeight;
441
+ return height > 0 ? height : undefined;
442
+ }
289
443
  };
290
444
  //# sourceMappingURL=IdentityRowRenderer.js.map