@onekeyfe/react-native-native-list 6.7.0-4 → 6.7.0-41

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 (214) hide show
  1. package/README.md +4 -0
  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 +35 -7
  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 +149 -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 +3 -2
  23. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  24. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
  25. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1953 -117
  26. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
  27. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  28. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  29. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  30. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  31. package/docs/ROW_TEMPLATES.md +74 -13
  32. package/docs/SPEC.md +1206 -15
  33. package/docs/STYLE_SPEC.md +14 -0
  34. package/ios/HybridNativeList.swift +21 -2
  35. package/ios/NativeListAccessoryStack.swift +237 -51
  36. package/ios/NativeListActivityDetailsView.swift +30 -11
  37. package/ios/NativeListActivityRenderer.swift +8 -2
  38. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  39. package/ios/NativeListDataRowRenderer.swift +167 -30
  40. package/ios/NativeListDesignAssets.swift +13 -75
  41. package/ios/NativeListGeneratedIcons.swift +55 -0
  42. package/ios/NativeListIconBinding.swift +171 -0
  43. package/ios/NativeListIdentityRenderer.swift +256 -39
  44. package/ios/NativeListLeadingVisual.swift +127 -28
  45. package/ios/NativeListMarketRenderer.swift +120 -31
  46. package/ios/NativeListMediaPlaceholderView.swift +189 -0
  47. package/ios/NativeListMediaPreviewSlot.swift +122 -61
  48. package/ios/NativeListMediaTileRenderer.swift +15 -11
  49. package/ios/NativeListMessageRenderer.swift +34 -1
  50. package/ios/NativeListMetricCardRenderer.swift +4 -2
  51. package/ios/NativeListModels.swift +42 -2
  52. package/ios/NativeListRendererRegistry.swift +1 -0
  53. package/ios/NativeListResolvedText.swift +2 -1
  54. package/ios/NativeListRowHost.swift +14 -0
  55. package/ios/NativeListSectionHeaderRenderer.swift +100 -4
  56. package/ios/RNCNativeListView.swift +1053 -58
  57. package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
  58. package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
  59. package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
  60. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  61. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  62. package/ios/tests/NativeListLifecycleTests.swift +2819 -3
  63. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  64. package/ios/tests/NativeListMediaVisibilityTests.swift +26 -1
  65. package/ios/tests/NativeListSharedIconTests.swift +236 -0
  66. package/lib/module/NativeList.js +221 -36
  67. package/lib/module/NativeList.web.js +167 -46
  68. package/lib/module/index.js +1 -1
  69. package/lib/module/models.js +3 -0
  70. package/lib/module/selection.js +1 -1
  71. package/lib/module/validation.js +1246 -48
  72. package/lib/module/web/NativeListGeneratedIcons.js +31 -0
  73. package/lib/module/web/NativeListWebEngine.js +513 -275
  74. package/lib/module/web/templates/ActivityRowRenderer.js +120 -87
  75. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  76. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  77. package/lib/module/web/templates/IdentityRowRenderer.js +158 -6
  78. package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
  79. package/lib/module/web/templates/MediaTileRowRenderer.js +84 -25
  80. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  81. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  82. package/lib/module/web/templates/RowRendererRegistry.js +3 -0
  83. package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
  84. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  85. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  86. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  87. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  88. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  89. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  90. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  91. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  92. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  93. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  94. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  95. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  96. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  97. package/lib/typescript/src/NativeList.d.ts +3 -3
  98. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  99. package/lib/typescript/src/NativeList.types.d.ts +20 -2
  100. package/lib/typescript/src/index.d.ts +2 -2
  101. package/lib/typescript/src/models.d.ts +126 -17
  102. package/lib/typescript/src/validation.d.ts +20 -0
  103. package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
  104. package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
  105. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  106. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  107. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
  108. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  109. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  110. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  111. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  112. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  113. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  114. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  115. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  116. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  117. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  118. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  119. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  120. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  121. package/package.json +16 -10
  122. package/react-native-native-list.podspec +2 -6
  123. package/scripts/generate-icons.mjs +150 -0
  124. package/scripts/generate-icons.test.mjs +288 -0
  125. package/scripts/native-list-icons.json +260 -0
  126. package/src/NativeList.nitro.ts +2 -0
  127. package/src/NativeList.tsx +416 -89
  128. package/src/NativeList.types.ts +24 -2
  129. package/src/NativeList.web.tsx +295 -89
  130. package/src/index.ts +2 -0
  131. package/src/models.ts +263 -144
  132. package/src/selection.ts +1 -0
  133. package/src/validation.ts +3013 -152
  134. package/src/web/NativeListGeneratedIcons.ts +28 -0
  135. package/src/web/NativeListWebEngine.ts +818 -343
  136. package/src/web/templates/ActivityRowRenderer.ts +178 -141
  137. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  138. package/src/web/templates/DataRowRenderer.ts +93 -20
  139. package/src/web/templates/IdentityRowRenderer.ts +231 -6
  140. package/src/web/templates/MarketTableRowRenderer.ts +53 -33
  141. package/src/web/templates/MediaTileRowRenderer.ts +90 -28
  142. package/src/web/templates/MessageRowRenderer.ts +23 -7
  143. package/src/web/templates/RowContainerStyle.ts +2 -0
  144. package/src/web/templates/RowRendererRegistry.ts +11 -1
  145. package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
  146. package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
  147. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
  148. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
  149. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
  150. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
  151. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
  152. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
  153. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
  154. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
  155. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
  156. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
  157. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
  158. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
  159. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
  160. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
  161. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
  162. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
  163. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
  164. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
  165. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
  166. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
  167. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
  168. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
  169. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
  170. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
  171. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
  172. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
  173. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
  174. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
  175. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
  176. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
  177. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
  178. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
  179. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
  180. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
  181. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
  182. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
  183. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
  184. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
  185. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
  186. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
  187. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
  188. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
  189. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
  190. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
  191. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
  192. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
  193. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
  194. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
  195. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
  196. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
  197. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
  198. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
  199. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
  200. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
  201. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
  202. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
  203. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
  204. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
  205. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
  206. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
  207. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
  208. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
  209. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
  210. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
  211. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
  212. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
  213. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
  214. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
@@ -226,6 +226,171 @@ function createIdentityRow(
226
226
  });
227
227
  column.insertBefore(segments, titleElement.nextSibling);
228
228
  }
229
+ if (row.titleIcon || row.secondaryTitleIcon || row.titleImage) {
230
+ const badgeLine = titleElement.querySelector<HTMLElement>(
231
+ ':scope > .ok-native-list-badges'
232
+ );
233
+ const titleText = createElement(
234
+ document,
235
+ 'span',
236
+ 'ok-native-list-identity-title-text'
237
+ );
238
+ while (titleElement.firstChild && titleElement.firstChild !== badgeLine)
239
+ titleText.appendChild(titleElement.firstChild);
240
+ titleElement.prepend(titleText);
241
+ // The title slot tag moves with the text. `applyTextLayout` writes the
242
+ // single-line clamp (`display: block`, nowrap, ellipsis) onto the slot
243
+ // element; left on this container it would undo the flex row below and
244
+ // leave the inline-flex glyph baseline-aligned above the title (OK-66402).
245
+ if (titleElement.hasAttribute('data-nl-slot')) {
246
+ titleElement.removeAttribute('data-nl-slot');
247
+ tagSlot(titleText, 'title');
248
+ }
249
+ const icons = [row.titleIcon, row.secondaryTitleIcon]
250
+ .filter((icon): icon is NonNullable<typeof icon> => icon !== undefined)
251
+ .map((descriptor) => {
252
+ const icon = primitives.iconAction(
253
+ descriptor.name,
254
+ undefined,
255
+ undefined,
256
+ descriptor.tintColor
257
+ );
258
+ icon.className = 'ok-native-list-identity-title-icon';
259
+ if (descriptor.hoverActionKey) {
260
+ setData(icon, 'nativeListHoverAction', descriptor.hoverActionKey);
261
+ setData(icon, 'nativeListIconHelp', true);
262
+ markActionAnchorSource(icon, 'leadingAction');
263
+ }
264
+ if (descriptor.accessibilityLabel)
265
+ icon.setAttribute('aria-label', descriptor.accessibilityLabel);
266
+ else icon.setAttribute('aria-hidden', 'true');
267
+ return icon;
268
+ });
269
+ if (row.titleImage) {
270
+ const descriptor = row.titleImage;
271
+ const holder = createElement(
272
+ document,
273
+ 'span',
274
+ 'ok-native-list-identity-title-image'
275
+ );
276
+ Object.assign(holder.style, {
277
+ flex: `0 0 ${descriptor.image.width}px`,
278
+ width: `${descriptor.image.width}px`,
279
+ height: `${descriptor.image.height}px`,
280
+ borderRadius: '50%',
281
+ overflow: 'hidden',
282
+ });
283
+ const image = primitives.thumbnail(descriptor.image);
284
+ if (image) {
285
+ Object.assign(image.style, {
286
+ width: '100%',
287
+ height: '100%',
288
+ borderRadius: 'inherit',
289
+ objectFit:
290
+ descriptor.image.contentFit === 'center'
291
+ ? 'none'
292
+ : descriptor.image.contentFit ?? 'cover',
293
+ });
294
+ image.setAttribute('alt', '');
295
+ holder.appendChild(image);
296
+ }
297
+ if (descriptor.hoverActionKey) {
298
+ setData(holder, 'nativeListHoverAction', descriptor.hoverActionKey);
299
+ setData(holder, 'nativeListIconHelp', true);
300
+ markActionAnchorSource(holder, 'leadingAction');
301
+ }
302
+ if (descriptor.accessibilityLabel) {
303
+ holder.setAttribute('role', 'img');
304
+ holder.setAttribute('aria-label', descriptor.accessibilityLabel);
305
+ } else holder.setAttribute('aria-hidden', 'true');
306
+ icons.push(holder);
307
+ }
308
+ titleText.after(...icons);
309
+ titleElement.style.display = 'flex';
310
+ titleElement.style.alignItems = 'center';
311
+ titleElement.style.gap = '4px';
312
+ }
313
+ if (row.titleSuffixes?.length) {
314
+ const badges = titleElement.querySelector(
315
+ ':scope > .ok-native-list-badges'
316
+ );
317
+ let titleText = titleElement.querySelector<HTMLElement>(
318
+ ':scope > .ok-native-list-identity-title-text, :scope > [data-nl-slot="title"]'
319
+ );
320
+ if (!titleText) {
321
+ titleText = tagSlot(
322
+ createElement(document, 'span', 'ok-native-list-identity-title-text'),
323
+ 'title'
324
+ );
325
+ while (titleElement.firstChild && titleElement.firstChild !== badges)
326
+ titleText.appendChild(titleElement.firstChild);
327
+ titleElement.prepend(titleText);
328
+ titleElement.removeAttribute('data-nl-slot');
329
+ } else if (titleElement.hasAttribute('data-nl-slot')) {
330
+ titleElement.removeAttribute('data-nl-slot');
331
+ tagSlot(titleText, 'title');
332
+ }
333
+ titleElement.style.display = 'flex';
334
+ titleElement.style.alignItems = 'center';
335
+ titleText.style.flex = '0 1 auto';
336
+ titleText.style.minWidth = 'min(80px, 100%)';
337
+ titleText.style.overflow = 'hidden';
338
+ titleText.style.textOverflow = 'ellipsis';
339
+ titleText.style.whiteSpace = 'nowrap';
340
+ row.titleSuffixes.forEach((suffix) => {
341
+ const label = createElement(
342
+ document,
343
+ 'span',
344
+ 'ok-native-list-identity-title-suffix',
345
+ suffix.text
346
+ );
347
+ label.style.flex = '0 1 auto';
348
+ label.style.minWidth = '0';
349
+ label.style.marginInlineStart =
350
+ row.titleIcon || row.secondaryTitleIcon || row.titleImage
351
+ ? '4px'
352
+ : '8px';
353
+ label.style.maxWidth =
354
+ suffix.maxWidth === undefined ? '' : `${suffix.maxWidth}px`;
355
+ label.style.overflow = 'hidden';
356
+ label.style.textOverflow = 'ellipsis';
357
+ label.style.whiteSpace = 'nowrap';
358
+ label.style.fontSize = '12px';
359
+ label.style.lineHeight = '16px';
360
+ label.style.fontWeight = '400';
361
+ label.style.fontFamily = 'var(--nl-font-regular)';
362
+ label.style.color =
363
+ suffix.tone === 'disabled'
364
+ ? 'var(--nl-disabled)'
365
+ : 'var(--nl-secondary)';
366
+ titleElement.insertBefore(label, badges);
367
+ });
368
+ }
369
+ if (
370
+ row.badges?.length &&
371
+ !row.titleIcon &&
372
+ !row.secondaryTitleIcon &&
373
+ !row.titleImage
374
+ ) {
375
+ const titleText = titleElement.querySelector<HTMLElement>(
376
+ ':scope > [data-nl-slot="title"]'
377
+ );
378
+ const badges = titleElement.querySelector<HTMLElement>(
379
+ ':scope > .ok-native-list-badges'
380
+ );
381
+ titleElement.style.display = 'flex';
382
+ titleElement.style.alignItems = 'center';
383
+ if (titleText) {
384
+ titleText.style.flex = '0 1 auto';
385
+ titleText.style.minWidth = row.titleSuffixes?.length
386
+ ? 'min(80px, 100%)'
387
+ : '0';
388
+ }
389
+ if (badges) {
390
+ badges.style.flex = '0 1 auto';
391
+ badges.style.minWidth = '0';
392
+ }
393
+ }
229
394
  if (presentation === 'walletSidebar' && row.badges?.length) {
230
395
  const badges = createElement(
231
396
  document,
@@ -242,7 +407,15 @@ function createIdentityRow(
242
407
  if (lines !== undefined)
243
408
  column
244
409
  .querySelectorAll<HTMLElement>(`[data-nl-slot="${key}"]`)
245
- .forEach((text) => applyTextLayout(text, { lines }));
410
+ .forEach((text) => {
411
+ applyTextLayout(
412
+ text,
413
+ lines === 0 ? {} : { lines },
414
+ lines === 0 ? 0 : undefined
415
+ );
416
+ if (key === 'subtitle')
417
+ text.style.overflowWrap = lines === 1 ? '' : 'anywhere';
418
+ });
246
419
  }
247
420
  }
248
421
  body.appendChild(column);
@@ -272,6 +445,29 @@ function applyIdentityStyle(body: HTMLElement, row: IdentityRow) {
272
445
  const leading = body.querySelector<HTMLElement>(
273
446
  ':scope > .ok-native-list-visual, :scope > .ok-native-list-stacked'
274
447
  );
448
+ if (row.style?.leadingContentMaxWidthRatio !== undefined && !vertical) {
449
+ const column = body.querySelector<HTMLElement>(
450
+ ':scope > .ok-native-list-flex'
451
+ );
452
+ const trailing = body.querySelector<HTMLElement>(
453
+ ':scope > .ok-native-list-accessories'
454
+ );
455
+ const visualWidth = leading
456
+ ? row.style.image?.width ??
457
+ (row.presentation === 'accountSelector' ||
458
+ row.presentation === 'networkSelector'
459
+ ? 32
460
+ : 40)
461
+ : 0;
462
+ const gap = leading ? row.style.leadingGap ?? 12 : 0;
463
+ if (column) {
464
+ column.style.flex = '0 1 auto';
465
+ column.style.maxWidth = `calc(${
466
+ row.style.leadingContentMaxWidthRatio * 100
467
+ }% - ${visualWidth + gap}px)`;
468
+ }
469
+ if (trailing) trailing.style.marginInlineStart = 'auto';
470
+ }
275
471
  const defaultGap =
276
472
  body.style.gap ||
277
473
  (row.type === 'identity' && row.presentation === 'walletSidebar'
@@ -343,7 +539,7 @@ function applyIdentityStyle(body: HTMLElement, row: IdentityRow) {
343
539
  const images = leading.matches('img')
344
540
  ? [leading]
345
541
  : leading.querySelectorAll<HTMLElement>(
346
- ':scope > img, :scope > .ok-native-list-visual-fallback'
542
+ ':scope > img:not(.ok-native-list-visual-corner), :scope > .ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)'
347
543
  );
348
544
  images.forEach((bitmap) => {
349
545
  if (bitmap !== leading) {
@@ -373,6 +569,7 @@ type Views = {
373
569
  node: HTMLElement;
374
570
  defaults: RowVisualStyle;
375
571
  };
572
+ titleImage?: { key: string; node: HTMLElement };
376
573
  primitives: RowPrimitives;
377
574
  };
378
575
  const views = new WeakMap<HTMLElement, Views>();
@@ -380,10 +577,21 @@ function bind(body: HTMLElement, row: IdentityRow, primitives: RowPrimitives) {
380
577
  const v = views.get(body)!;
381
578
  v.primitives = primitives;
382
579
  let used = false;
580
+ let usedTitleImage = false;
383
581
  const next = createIdentityRow(
384
582
  body.ownerDocument,
385
583
  {
386
584
  ...primitives,
585
+ thumbnail: (source) => {
586
+ usedTitleImage = true;
587
+ const key = JSON.stringify([row.key, source]);
588
+ if (v.titleImage?.key !== key) {
589
+ if (v.titleImage) primitives.dispose(v.titleImage.node);
590
+ const node = primitives.thumbnail(source);
591
+ v.titleImage = node ? { key, node } : undefined;
592
+ }
593
+ return v.titleImage?.node;
594
+ },
387
595
  visual: (source, presentation) => {
388
596
  used = true;
389
597
  const key = JSON.stringify([row.key, source, presentation]);
@@ -410,6 +618,10 @@ function bind(body: HTMLElement, row: IdentityRow, primitives: RowPrimitives) {
410
618
  primitives.dispose(v.visual.node);
411
619
  v.visual = undefined;
412
620
  }
621
+ if (!usedTitleImage && v.titleImage) {
622
+ primitives.dispose(v.titleImage.node);
623
+ v.titleImage = undefined;
624
+ }
413
625
  body.replaceChildren(...Array.from(next.childNodes));
414
626
  body.className = next.className;
415
627
  body.style.cssText = next.style.cssText;
@@ -485,6 +697,10 @@ function bind(body: HTMLElement, row: IdentityRow, primitives: RowPrimitives) {
485
697
  }
486
698
 
487
699
  applyIdentityStyle(body, row);
700
+ body.style.height =
701
+ row.contentHeight === 'auto' && !hasExplicitRowHeight(row)
702
+ ? 'auto'
703
+ : '100%';
488
704
  }
489
705
  function create(
490
706
  document: Document,
@@ -500,7 +716,11 @@ function create(
500
716
  function recycle(body: HTMLElement) {
501
717
  const v = views.get(body);
502
718
  if (v?.visual) v.primitives.dispose(v.visual.node);
503
- if (v) v.visual = undefined;
719
+ if (v?.titleImage) v.primitives.dispose(v.titleImage.node);
720
+ if (v) {
721
+ v.visual = undefined;
722
+ v.titleImage = undefined;
723
+ }
504
724
  body.replaceChildren();
505
725
  }
506
726
  export const identityRowRenderer = {
@@ -522,7 +742,12 @@ export const identityRowRenderer = {
522
742
  ? 60
523
743
  : 56,
524
744
  measureRendered: (
525
- _body: HTMLElement,
526
- _row: IdentityRow
527
- ): number | undefined => undefined,
745
+ body: HTMLElement,
746
+ row: IdentityRow
747
+ ): number | undefined => {
748
+ if (row.contentHeight !== 'auto' || hasExplicitRowHeight(row))
749
+ return undefined;
750
+ const height = body.offsetHeight;
751
+ return height > 0 ? height : undefined;
752
+ },
528
753
  };
@@ -1,3 +1,4 @@
1
+ import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
1
2
  import type {
2
3
  MarketRow,
3
4
  WebMarketTableCell,
@@ -14,6 +15,7 @@ type CellViews = {
14
15
  signature: string;
15
16
  visual?: HTMLElement;
16
17
  visualKey?: string;
18
+ visualImageKey?: string;
17
19
  title?: HTMLElement;
18
20
  resting?: HTMLElement;
19
21
  hover?: HTMLElement;
@@ -26,10 +28,6 @@ const views = new WeakMap<HTMLElement, Views>();
26
28
  const columnSignatures = new WeakMap<readonly WebMarketTableColumn[], string>();
27
29
  let sparklineId = 0;
28
30
  const svgNamespace = 'http://www.w3.org/2000/svg';
29
- const outlineStar =
30
- 'm15.455 7.243 7.729 1.123-5.592 5.45 1.32 7.698L12 17.879l-6.911 3.635 1.32-7.698-5.592-5.45 7.728-1.123L12 .24zM9.872 9.071l-4.759.69 3.444 3.358-.814 4.738L12 15.62l.465.245 3.791 1.993-.813-4.739 3.443-3.357-4.758-.69L12 4.758z';
31
- const solidStar =
32
- 'm15.405 7.313 7.84 1.034-5.735 5.443 1.44 7.774L12 17.793l-6.948 3.771 1.44-7.774L.756 8.347l7.839-1.034L12 .178z';
33
31
  function columnsSignature(columns: readonly WebMarketTableColumn[]) {
34
32
  let signature = columnSignatures.get(columns);
35
33
  if (signature === undefined) {
@@ -176,19 +174,13 @@ function action(
176
174
  flexShrink: '0',
177
175
  });
178
176
  }
179
- function icon(document: Document, d: string, size: number): SVGSVGElement {
180
- const svg = document.createElementNS(svgNamespace, 'svg');
181
- svg.setAttribute('viewBox', '0 0 24 24');
177
+ function icon(document: Document, name: string, size: number): SVGSVGElement {
178
+ const svg = createNamedIcon(document, name);
182
179
  svg.setAttribute('width', String(size));
183
180
  svg.setAttribute('height', String(size));
184
- svg.setAttribute('aria-hidden', 'true');
185
- svg.setAttribute('fill', 'currentColor');
186
- const path = document.createElementNS(svgNamespace, 'path');
187
- path.setAttribute('d', d);
188
- path.setAttribute('fill-rule', 'evenodd');
189
- svg.appendChild(path);
190
181
  return svg;
191
182
  }
183
+
192
184
  function drawSparkline(
193
185
  element: HTMLElement,
194
186
  cell: Extract<WebMarketTableCell, { kind: 'sparkline' }>
@@ -287,11 +279,42 @@ function updateCell(
287
279
  if (cell.kind === 'asset') {
288
280
  const visualKey = JSON.stringify(cell.leading);
289
281
  if (view.visualKey !== visualKey) {
290
- if (view.visual) {
291
- primitives.dispose(view.visual);
292
- view.visual.remove();
282
+ const visualImageKey = JSON.stringify(
283
+ cell.leading?.kind === 'token'
284
+ ? { ...cell.leading, overlays: undefined }
285
+ : cell.leading
286
+ );
287
+ if (
288
+ view.visual &&
289
+ cell.leading?.kind === 'token' &&
290
+ view.visualImageKey === visualImageKey
291
+ ) {
292
+ // Keep the main frame: its load/error callbacks own its visibility.
293
+ for (const overlay of view.visual.querySelectorAll<HTMLElement>(
294
+ ':scope > .ok-native-list-visual-overlay'
295
+ )) {
296
+ primitives.dispose(overlay);
297
+ overlay.remove();
298
+ }
299
+ const overlayVisual = primitives.visual({
300
+ kind: 'token',
301
+ overlays: cell.leading.overlays,
302
+ });
303
+ if (overlayVisual) {
304
+ for (const overlay of overlayVisual.querySelectorAll<HTMLElement>(
305
+ ':scope > .ok-native-list-visual-overlay'
306
+ ))
307
+ view.visual.appendChild(overlay);
308
+ primitives.dispose(overlayVisual);
309
+ }
310
+ } else {
311
+ if (view.visual) {
312
+ primitives.dispose(view.visual);
313
+ view.visual.remove();
314
+ }
315
+ view.visual = primitives.visual(cell.leading);
293
316
  }
294
- view.visual = primitives.visual(cell.leading);
317
+ view.visualImageKey = visualImageKey;
295
318
  view.visualKey = visualKey;
296
319
  if (view.visual)
297
320
  Object.assign(view.visual.style, {
@@ -453,11 +476,7 @@ function updateCell(
453
476
  );
454
477
  if (badge.actionKey) node.dataset.nativeListHoverAction = 'true';
455
478
  node.textContent = '';
456
- const svg = icon(
457
- document,
458
- 'M9.483 11.458v3.5h-1v-3.5z M10.467 2.698a2.03 2.03 0 0 1 3.065 0l1.358 1.564a.03.03 0 0 0 .028.01l2.046-.325a2.03 2.03 0 0 1 2.347 1.971l.037 2.07q0 .016.014.026l1.776 1.066a2.03 2.03 0 0 1 .532 3.019l-1.304 1.609a.03.03 0 0 0-.005.03l.675 1.956a2.03 2.03 0 0 1-1.533 2.656l-2.033.394a.03.03 0 0 0-.023.019l-.741 1.933a2.03 2.03 0 0 1-2.88 1.05l-1.811-1.006a.03.03 0 0 0-.03 0l-1.811 1.005a2.03 2.03 0 0 1-2.88-1.049l-.742-1.933a.03.03 0 0 0-.023-.019l-2.033-.394a2.03 2.03 0 0 1-1.532-2.656l.675-1.957a.03.03 0 0 0-.005-.029l-1.304-1.61a2.03 2.03 0 0 1 .532-3.018l1.776-1.066a.03.03 0 0 0 .014-.026l.035-2.07a2.03 2.03 0 0 1 2.349-1.97l2.045.324a.03.03 0 0 0 .028-.01zm1.516 3.76a.5.5 0 0 0-.447.276l-1.861 3.724H8.483a1 1 0 0 0-1 1v3.5a1 1 0 0 0 1 1h6.692a2 2 0 0 0 1.981-1.73l.341-2.5a2 2 0 0 0-1.982-2.27h-1.939l.197-1.269a1.5 1.5 0 0 0-1.481-1.731z',
459
- 14
460
- );
479
+ const svg = icon(document, 'BadgeRecognizedSolid', 14);
461
480
  node.appendChild(svg);
462
481
  }
463
482
  title.appendChild(node);
@@ -578,13 +597,7 @@ function updateCell(
578
597
  );
579
598
  button.style.padding = '0';
580
599
  button.style.color = 'var(--nl-icon-subdued)';
581
- button.appendChild(
582
- icon(
583
- document,
584
- 'M21 17h-4v4H3V7h4V3h14zM5 19h10V9H5zM9 7h8v8h2V5H9z',
585
- 14
586
- )
587
- );
600
+ button.appendChild(icon(document, 'Copy3Outline', 14));
588
601
  hoverFrame.appendChild(button);
589
602
  }
590
603
  track.appendChild(hoverFrame);
@@ -613,12 +626,19 @@ function updateCell(
613
626
  : 'var(--nl-icon-subdued)';
614
627
  let svg = button.querySelector('svg');
615
628
  if (!svg) {
616
- svg = icon(document, cell.active ? solidStar : outlineStar, 16);
629
+ svg = icon(document, cell.active ? 'StarSolid' : 'StarOutline', 16);
617
630
  button.appendChild(svg);
618
631
  }
619
- svg
620
- .querySelector('path')
621
- ?.setAttribute('d', cell.active ? solidStar : outlineStar);
632
+ const name = cell.active ? 'StarSolid' : 'StarOutline';
633
+ if (
634
+ !svg
635
+ .querySelector('use')
636
+ ?.getAttribute('href')
637
+ ?.endsWith(`#onekey-${name}`)
638
+ ) {
639
+ const replacement = icon(document, name, 16);
640
+ svg.replaceWith(replacement);
641
+ }
622
642
  if (!button.parentElement) element.appendChild(button);
623
643
  } else if (cell.kind === 'sparkline') drawSparkline(element, cell);
624
644
  else {
@@ -191,6 +191,78 @@ type GalleryViews = {
191
191
  leave: () => void;
192
192
  };
193
193
  const galleries = new WeakMap<HTMLElement, GalleryViews>();
194
+ type MediaPlaceholderState = 'loading' | 'failed';
195
+ type MediaPlaceholderPhase = MediaPlaceholderState | 'loaded';
196
+ const SVG_NS = 'http://www.w3.org/2000/svg';
197
+ let glyphMaskId = 0;
198
+
199
+ /**
200
+ * Placeholder glyphs share one 24pt geometry with the iOS and Android renderers:
201
+ * a rounded frame with a sun and a ridge; the failed glyph adds a slash and cuts
202
+ * a gap into the frame around it.
203
+ */
204
+ function createMediaGlyph(document: Document, state: MediaPlaceholderState) {
205
+ const svg = document.createElementNS(SVG_NS, 'svg');
206
+ svg.setAttribute('viewBox', '0 0 24 24');
207
+ svg.setAttribute('fill', 'none');
208
+ svg.setAttribute('stroke', 'currentColor');
209
+ svg.setAttribute('stroke-width', '1.5');
210
+ svg.setAttribute('stroke-linecap', 'round');
211
+ svg.setAttribute('stroke-linejoin', 'round');
212
+ svg.setAttribute('aria-hidden', 'true');
213
+ const shape = (tag: string, attributes: Record<string, string>) => {
214
+ const node = document.createElementNS(SVG_NS, tag);
215
+ Object.entries(attributes).forEach(([key, value]) =>
216
+ node.setAttribute(key, value)
217
+ );
218
+ return node;
219
+ };
220
+ const picture = shape('g', {});
221
+ picture.append(
222
+ shape('rect', { x: '3', y: '3', width: '18', height: '18', rx: '4' }),
223
+ shape('circle', { cx: '9', cy: '9', r: '1.6' }),
224
+ shape('path', { d: 'M5 20.5L14.5 11L21 17.5' })
225
+ );
226
+ if (state === 'failed') {
227
+ glyphMaskId += 1;
228
+ const id = `ok-native-list-media-cut-${glyphMaskId}`;
229
+ const mask = shape('mask', { id, maskUnits: 'userSpaceOnUse' });
230
+ mask.append(
231
+ shape('rect', {
232
+ x: '0',
233
+ y: '0',
234
+ width: '24',
235
+ height: '24',
236
+ fill: '#fff',
237
+ stroke: 'none',
238
+ }),
239
+ shape('path', {
240
+ d: 'M2.6 -0.6L24.6 21.4L21.4 24.6L-0.6 2.6Z',
241
+ fill: '#000',
242
+ stroke: 'none',
243
+ })
244
+ );
245
+ picture.setAttribute('mask', `url(#${id})`);
246
+ svg.append(mask, picture, shape('path', { d: 'M3 3L21 21' }));
247
+ } else svg.append(picture);
248
+ const wrap = document.createElement('div');
249
+ wrap.className = 'ok-native-list-media-glyph';
250
+ wrap.dataset.glyph = state;
251
+ wrap.append(svg);
252
+ return wrap;
253
+ }
254
+
255
+ const SWEEP_PERIOD_MS = 1600;
256
+
257
+ function setPlaceholderState(v: GalleryViews, state: MediaPlaceholderPhase) {
258
+ v.fallback.dataset.state = state;
259
+ if (state === 'loading')
260
+ // Keep every loading tile on one sweep phase, including recycled rows.
261
+ v.fallback.style.setProperty(
262
+ '--nl-media-sweep-delay',
263
+ `-${Math.round(performance.now() % SWEEP_PERIOD_MS)}ms`
264
+ );
265
+ }
194
266
  const isGalleryMedia = (row: MediaTileRow) =>
195
267
  row.variant === 'gallery' && (!row.image || (!!row.media && !row.imageState));
196
268
 
@@ -220,32 +292,12 @@ function initGallery(body: HTMLElement, primitives: RowPrimitives) {
220
292
  };
221
293
  const frame = element('ok-native-list-media-image');
222
294
  const fallback = element('ok-native-list-media-fallback');
223
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
224
- svg.setAttribute('viewBox', '0 0 24 24');
225
- svg.setAttribute('width', '24');
226
- svg.setAttribute('height', '24');
227
- svg.setAttribute('aria-hidden', 'true');
228
- svg.setAttribute('fill', 'currentColor');
229
- for (const d of [
230
- 'M14.25 7a2 2 0 1 1 0 4 2 2 0 0 1 0-4',
231
- 'M21 21H3V3h18zM5 16.414V19h12.586L14 15.414l-2 2-4-4zm0-2.828 3-3 4 4 2-2 5 5V5H5z',
232
- ]) {
233
- const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
234
- path.setAttribute('d', d);
235
- path.setAttribute('fill-rule', 'evenodd');
236
- svg.append(path);
237
- }
238
- fallback.append(svg);
239
- Object.assign(fallback.style, {
240
- position: 'absolute',
241
- inset: '0',
242
- display: 'flex',
243
- alignItems: 'center',
244
- justifyContent: 'center',
245
- color: 'var(--nl-disabled)',
246
- borderRadius: '10px',
247
- background: 'var(--nl-strong)',
248
- });
295
+ fallback.append(
296
+ element('ok-native-list-media-hatch'),
297
+ element('ok-native-list-media-sheen'),
298
+ createMediaGlyph(document, 'loading'),
299
+ createMediaGlyph(document, 'failed')
300
+ );
249
301
  const metadata = element('ok-native-list-media-meta');
250
302
  const subtitleLine = element('ok-native-list-media-subtitle-row');
251
303
  const subtitle = element('ok-native-list-media-subtitle');
@@ -333,10 +385,17 @@ function bindGallery(
333
385
  v.fallback.style.visibility = 'visible';
334
386
  const epoch = v.epoch;
335
387
  const source = row.imageState ? undefined : row.media?.source;
388
+ setPlaceholderState(
389
+ v,
390
+ source?.uri && row.media?.probeOrder.length ? 'loading' : 'failed'
391
+ );
336
392
  const probe = (attempt: number) => {
337
393
  if (v.epoch !== epoch) return;
338
394
  const kind = row.media?.probeOrder[attempt];
339
- if (!source?.uri || !kind) return;
395
+ if (!source?.uri || !kind) {
396
+ setPlaceholderState(v, 'failed');
397
+ return;
398
+ }
340
399
  const media = body.ownerDocument.createElement(
341
400
  kind === 'video' ? 'video' : 'img'
342
401
  );
@@ -382,8 +441,11 @@ function bindGallery(
382
441
  probe(attempt + 1);
383
442
  };
384
443
  const ready = () => {
385
- if (v.epoch === epoch && v.media === media)
444
+ if (v.epoch === epoch && v.media === media) {
386
445
  v.fallback.style.visibility = 'hidden';
446
+ // Stops the sweep animation behind the picture.
447
+ setPlaceholderState(v, 'loaded');
448
+ }
387
449
  };
388
450
  if (media.tagName === 'VIDEO') media.onloadeddata = ready;
389
451
  else media.onload = ready;
@@ -4,10 +4,8 @@ import type { MessageRow, NativeListTextStyle } from '../../models';
4
4
 
5
5
  type Text = Readonly<{
6
6
  value: string;
7
- style: Required<
8
- Pick<NativeListTextStyle, 'fontSize' | 'lineHeight' | 'lines'>
9
- > &
10
- NativeListTextStyle;
7
+ style: Required<Pick<NativeListTextStyle, 'fontSize' | 'lineHeight'>> &
8
+ Omit<NativeListTextStyle, 'lines'> & { lines: 0 | 1 | 2 | 3 };
11
9
  }>;
12
10
  export function resolveMessageRow(row: MessageRow) {
13
11
  const text = (
@@ -15,7 +13,7 @@ export function resolveMessageRow(row: MessageRow) {
15
13
  style: NativeListTextStyle | undefined,
16
14
  fontSize: number,
17
15
  lineHeight: number,
18
- lines: 1 | 2 | 3,
16
+ lines: 0 | 1 | 2 | 3,
19
17
  color: string,
20
18
  fontWeight: NativeListTextStyle['fontWeight'] = 'regular'
21
19
  ): Text => ({
@@ -117,6 +115,9 @@ export function bindMessageRow(
117
115
  body.style.cssText = '';
118
116
  body.removeAttribute('data-nl-container-background');
119
117
  body.removeAttribute('data-nl-container-border');
118
+ if (row.presentation === 'inlineWarning')
119
+ body.setAttribute('data-nl-inline-warning', 'true');
120
+ else body.removeAttribute('data-nl-inline-warning');
120
121
  body.style.padding = `${resolved.verticalPadding}px ${resolved.horizontalPadding}px`;
121
122
  body.style.height = resolved.automaticHeight ? 'auto' : '100%';
122
123
  views.column.style.cssText = '';
@@ -128,7 +129,19 @@ export function bindMessageRow(
128
129
  ] as const) {
129
130
  view.style.cssText = '';
130
131
  view.textContent = text.value;
131
- primitives.textStyle(view, text.style);
132
+ const { lines, ...textStyle } = text.style;
133
+ primitives.textStyle(
134
+ view,
135
+ lines === 0 ? textStyle : { ...textStyle, lines }
136
+ );
137
+ if (lines === 0) {
138
+ view.style.whiteSpace = 'pre-wrap';
139
+ view.style.overflow = 'visible';
140
+ view.style.textOverflow = 'clip';
141
+ view.style.maxHeight = 'none';
142
+ view.style.removeProperty('-webkit-line-clamp');
143
+ view.style.removeProperty('-webkit-box-orient');
144
+ }
132
145
  }
133
146
  views.unread.style.cssText = '';
134
147
  if (row.body) {
@@ -258,7 +271,10 @@ export function measureMessageRow(
258
271
  ),
259
272
  0
260
273
  );
261
- return Math.min(text.style.lines, lines) * text.style.lineHeight;
274
+ return (
275
+ (text.style.lines === 0 ? lines : Math.min(text.style.lines, lines)) *
276
+ text.style.lineHeight
277
+ );
262
278
  };
263
279
  const timeWidth = Math.min(
264
280
  availableWidth / 3,
@@ -88,6 +88,8 @@ export function applyRowContainerStyle(body: HTMLElement, row: RowModel): void {
88
88
  }
89
89
  if (container.cornerRadius !== undefined)
90
90
  set(body, 'border-radius', `${container.cornerRadius}px`);
91
+ if (row.type === 'message' && row.presentation === 'inlineWarning')
92
+ set(body, 'border-radius', '0px');
91
93
  if (container.borderWidth !== undefined) {
92
94
  // Paint above member backgrounds without changing the content box or hit targets.
93
95
  body.setAttribute('data-nl-container-border', 'true');