@onekeyfe/react-native-native-list 6.7.0-alpha.354 → 6.7.0-alpha.362

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 (112) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +0 -7
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +7 -240
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -7
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +3 -6
  5. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +0 -12
  6. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +7 -87
  7. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +1 -135
  8. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +14 -43
  9. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +0 -25
  10. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +2 -17
  11. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +0 -22
  12. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +0 -2
  13. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +0 -2
  14. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +2 -3
  15. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +0 -69
  16. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +1 -55
  17. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +21 -585
  18. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +0 -1
  19. package/docs/ROW_TEMPLATES.md +9 -60
  20. package/docs/SPEC.md +5 -317
  21. package/docs/STYLE_SPEC.md +0 -6
  22. package/ios/HybridNativeList.swift +0 -10
  23. package/ios/NativeListAccessoryStack.swift +37 -220
  24. package/ios/NativeListActivityDetailsView.swift +8 -18
  25. package/ios/NativeListActivityRenderer.swift +2 -8
  26. package/ios/NativeListDataRowRenderer.swift +8 -105
  27. package/ios/NativeListDesignAssets.swift +0 -3
  28. package/ios/NativeListIdentityRenderer.swift +4 -119
  29. package/ios/NativeListLeadingVisual.swift +14 -49
  30. package/ios/NativeListMessageRenderer.swift +1 -34
  31. package/ios/NativeListModels.swift +2 -16
  32. package/ios/NativeListRendererRegistry.swift +0 -1
  33. package/ios/NativeListResolvedText.swift +1 -2
  34. package/ios/NativeListRowHost.swift +0 -14
  35. package/ios/NativeListSectionHeaderRenderer.swift +0 -88
  36. package/ios/RNCNativeListView.swift +29 -331
  37. package/ios/tests/NativeListActivityPresentationTests.swift +0 -56
  38. package/ios/tests/NativeListLifecycleTests.swift +3 -890
  39. package/lib/module/NativeList.js +21 -39
  40. package/lib/module/NativeList.web.js +4 -51
  41. package/lib/module/models.js +0 -1
  42. package/lib/module/selection.js +1 -1
  43. package/lib/module/validation.js +8 -320
  44. package/lib/module/web/NativeListWebEngine.js +18 -373
  45. package/lib/module/web/templates/ActivityRowRenderer.js +7 -8
  46. package/lib/module/web/templates/DataRowRenderer.js +5 -40
  47. package/lib/module/web/templates/IdentityRowRenderer.js +4 -90
  48. package/lib/module/web/templates/MessageRowRenderer.js +2 -18
  49. package/lib/module/web/templates/RowContainerStyle.js +0 -1
  50. package/lib/module/web/templates/RowRendererRegistry.js +0 -3
  51. package/lib/module/web/templates/SectionHeaderRowRenderer.js +2 -36
  52. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
  53. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
  54. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
  55. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
  56. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
  57. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
  58. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
  59. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
  60. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
  61. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
  62. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
  63. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
  64. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
  65. package/lib/typescript/src/NativeList.nitro.d.ts +0 -1
  66. package/lib/typescript/src/NativeList.types.d.ts +0 -8
  67. package/lib/typescript/src/models.d.ts +9 -101
  68. package/lib/typescript/src/validation.d.ts +0 -10
  69. package/lib/typescript/src/web/NativeListWebEngine.d.ts +0 -26
  70. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  71. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +3 -9
  72. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
  73. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
  74. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
  76. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
  77. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
  78. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
  79. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
  80. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
  81. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
  82. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
  83. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
  84. package/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
  85. package/package.json +3 -3
  86. package/react-native-native-list.podspec +0 -1
  87. package/src/NativeList.nitro.ts +0 -1
  88. package/src/NativeList.tsx +24 -72
  89. package/src/NativeList.types.ts +0 -9
  90. package/src/NativeList.web.tsx +8 -72
  91. package/src/models.ts +3 -113
  92. package/src/selection.ts +0 -1
  93. package/src/validation.ts +6 -721
  94. package/src/web/NativeListWebEngine.ts +19 -568
  95. package/src/web/templates/ActivityRowRenderer.ts +6 -14
  96. package/src/web/templates/DataRowRenderer.ts +20 -93
  97. package/src/web/templates/IdentityRowRenderer.ts +5 -150
  98. package/src/web/templates/MessageRowRenderer.ts +7 -23
  99. package/src/web/templates/RowContainerStyle.ts +0 -2
  100. package/src/web/templates/RowRendererRegistry.ts +1 -11
  101. package/src/web/templates/SectionHeaderRowRenderer.ts +4 -47
  102. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +0 -102
  103. package/ios/NativeListButtonGroupRenderer.swift +0 -89
  104. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +0 -15
  105. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +0 -4
  106. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +0 -15
  107. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +0 -3
  108. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +0 -15
  109. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +0 -3
  110. package/lib/module/web/templates/ButtonGroupRowRenderer.js +0 -47
  111. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +0 -14
  112. package/src/web/templates/ButtonGroupRowRenderer.ts +0 -58
@@ -47,7 +47,6 @@ function bindLegacy(
47
47
  }
48
48
  const visualKey = JSON.stringify([
49
49
  row.key,
50
- row.hideLeading,
51
50
  row.leading,
52
51
  row.secondaryLeading,
53
52
  ]);
@@ -56,7 +55,7 @@ function bindLegacy(
56
55
  primitives.dispose(node);
57
56
  node.remove();
58
57
  });
59
- v.visuals = (row.hideLeading ? [] : [row.leading, row.secondaryLeading])
58
+ v.visuals = [row.leading, row.secondaryLeading]
60
59
  .map((source) => primitives.visual(source))
61
60
  .filter((node): node is HTMLElement => !!node);
62
61
  v.visuals.forEach((node) => body.insertBefore(node, v.column));
@@ -390,12 +389,11 @@ function bindHistory(
390
389
  Object.assign(v.identity.style, {
391
390
  display: 'flex',
392
391
  alignItems: 'center',
393
- gap: row.hideLeading ? '0' : '12px',
392
+ gap: '12px',
394
393
  minWidth: '0',
395
394
  flex: '1 1 0',
396
395
  });
397
396
  Object.assign(v.visual.style, {
398
- display: row.hideLeading ? 'none' : '',
399
397
  position: 'relative',
400
398
  width: '40px',
401
399
  height: '40px',
@@ -403,7 +401,6 @@ function bindHistory(
403
401
  });
404
402
  const visualKey = JSON.stringify([
405
403
  row.key,
406
- row.hideLeading,
407
404
  row.leading,
408
405
  row.secondaryLeading,
409
406
  ]);
@@ -413,9 +410,7 @@ function bindHistory(
413
410
  );
414
411
  v.visual.replaceChildren();
415
412
  v.visuals = [];
416
- const sources = row.hideLeading
417
- ? []
418
- : [row.leading, row.secondaryLeading].filter(Boolean);
413
+ const sources = [row.leading, row.secondaryLeading].filter(Boolean);
419
414
  sources.forEach((source) => {
420
415
  const visual = primitives.visual(source);
421
416
  if (!visual) return;
@@ -444,9 +439,7 @@ function bindHistory(
444
439
  });
445
440
  v.visualKey = visualKey;
446
441
  }
447
- const sources = row.hideLeading
448
- ? []
449
- : [row.leading, row.secondaryLeading].filter(Boolean);
442
+ const sources = [row.leading, row.secondaryLeading].filter(Boolean);
450
443
  v.visuals.forEach((retained, index) => {
451
444
  const { node: visual, style, background, loaded } = retained;
452
445
  const source = sources[index];
@@ -780,9 +773,8 @@ function bindHistory(
780
773
  20,
781
774
  400
782
775
  );
783
- v.actions.style.cssText = `display:flex;gap:12px;padding-left:${
784
- row.hideLeading ? 0 : 52
785
- }px;padding-bottom:4px;`;
776
+ v.actions.style.cssText =
777
+ 'display:flex;gap:12px;padding-left:52px;padding-bottom:4px;';
786
778
  v.actions.style.display = footer ? 'flex' : 'none';
787
779
  const actionKeys = new Set<string>();
788
780
  for (const [index, action] of (row.footerActions ?? []).entries()) {
@@ -1,17 +1,10 @@
1
1
  import type { DataRow, TextTone } from '../../models';
2
- import {
3
- createElement,
4
- markActionAnchorSource,
5
- setData,
6
- tagSlot,
7
- } from './RowElements';
8
- import { applyValueSegments, fontWeight } from './RowText';
2
+ import { createElement, tagSlot } from './RowElements';
9
3
  import { RowVisualStyle, type RowPrimitives } from './RowVisual';
10
4
  type ColumnViews = {
11
5
  body: HTMLElement;
12
6
  primaryLine: HTMLElement;
13
7
  primary: HTMLElement;
14
- titleIcons: HTMLElement;
15
8
  badges: HTMLElement;
16
9
  secondaryLine: HTMLElement;
17
10
  secondary: HTMLElement[];
@@ -20,7 +13,6 @@ type Views = {
20
13
  favorite: HTMLElement;
21
14
  index: HTMLElement;
22
15
  controls: HTMLElement;
23
- trailing: HTMLElement;
24
16
  columns: ColumnViews[];
25
17
  visual?: HTMLElement;
26
18
  visualStyle?: RowVisualStyle;
@@ -51,11 +43,6 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
51
43
  if (row.checkbox)
52
44
  v.controls.appendChild(primitives.accessory(row.key, row.checkbox, 0));
53
45
  v.controls.style.display = 'contents';
54
- v.trailing.replaceChildren();
55
- row.trailing?.forEach((accessory, index) =>
56
- v.trailing.appendChild(primitives.accessory(row.key, accessory, index))
57
- );
58
- v.trailing.hidden = !row.trailing?.length;
59
46
  v.index.style.cssText = '';
60
47
  v.index.hidden = row.index === undefined;
61
48
  v.index.textContent = String(row.index ?? '');
@@ -101,41 +88,7 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
101
88
  cell.primaryLine.style.gap = `${style.titleBadgeGap}px`;
102
89
  cell.primary.style.cssText = '';
103
90
  cell.primary.textContent = column.text;
104
- applyValueSegments(
105
- cell.primary,
106
- column.textSegments,
107
- style?.columns?.fontSize ?? 14,
108
- style?.columns?.lineHeight ?? 20,
109
- fontWeight(style?.columns?.fontWeight, 500)
110
- );
111
91
  if (style?.columns) primitives.textStyle(cell.primary, style.columns);
112
- cell.titleIcons.replaceChildren();
113
- if (column.titleIcon || column.secondaryTitleIcon) {
114
- cell.primary.style.minWidth = '0';
115
- cell.primary.style.overflow = 'hidden';
116
- cell.primary.style.textOverflow = 'ellipsis';
117
- cell.primary.style.whiteSpace = 'nowrap';
118
- [column.titleIcon, column.secondaryTitleIcon]
119
- .filter((icon): icon is NonNullable<typeof icon> => icon !== undefined)
120
- .forEach((descriptor) => {
121
- const icon = primitives.iconAction(
122
- descriptor.name,
123
- undefined,
124
- undefined,
125
- descriptor.tintColor
126
- );
127
- icon.className = 'ok-native-list-identity-title-icon';
128
- if (descriptor.hoverActionKey) {
129
- setData(icon, 'nativeListHoverAction', descriptor.hoverActionKey);
130
- setData(icon, 'nativeListIconHelp', true);
131
- markActionAnchorSource(icon, 'leadingAction');
132
- }
133
- if (descriptor.accessibilityLabel)
134
- icon.setAttribute('aria-label', descriptor.accessibilityLabel);
135
- else icon.setAttribute('aria-hidden', 'true');
136
- cell.titleIcons.appendChild(icon);
137
- });
138
- }
139
92
  cell.badges.replaceChildren();
140
93
  cell.badges.style.display = 'contents';
141
94
  if (column.key === 'asset')
@@ -154,34 +107,25 @@ function bind(body: HTMLElement, row: DataRow, primitives: RowPrimitives) {
154
107
  });
155
108
  // Legacy Web layout: secondary leading text sits inline before the primary
156
109
  // text; secondary text is a direct line below it, toned by secondaryTone.
157
- const secondaryText = column.secondaryTextSegments?.length
158
- ? column.secondaryTextSegments.map((segment) => segment.text).join('')
159
- : column.secondaryText;
160
- cell.secondaryLine.style.display = secondaryText ? 'contents' : 'none';
161
- [column.secondaryLeadingText, secondaryText].forEach((text, slot) => {
162
- const label = cell.secondary[slot]!;
163
- label.hidden = !text;
164
- if (!text) label.remove();
165
- else if (slot === 0) cell.primaryLine.insertBefore(label, cell.primary);
166
- else cell.secondaryLine.appendChild(label);
167
- label.style.cssText = '';
168
- label.textContent = text ?? '';
169
- if (slot === 1) {
170
- applyValueSegments(
171
- label,
172
- column.secondaryTextSegments,
173
- style?.columnSecondary?.fontSize ?? 12,
174
- style?.columnSecondary?.lineHeight ?? 16,
175
- fontWeight(style?.columnSecondary?.fontWeight, 400)
176
- );
110
+ cell.secondaryLine.style.display = column.secondaryText
111
+ ? 'contents'
112
+ : 'none';
113
+ [column.secondaryLeadingText, column.secondaryText].forEach(
114
+ (text, slot) => {
115
+ const label = cell.secondary[slot]!;
116
+ label.hidden = !text;
117
+ if (!text) label.remove();
118
+ else if (slot === 0) cell.primaryLine.insertBefore(label, cell.primary);
119
+ else cell.secondaryLine.appendChild(label);
120
+ label.style.cssText = '';
121
+ label.textContent = text ?? '';
122
+ if (slot === 1)
123
+ label.style.color = tone(column.secondaryTone, 'secondary');
124
+ if (style?.columnSecondary)
125
+ primitives.textStyle(label, style.columnSecondary);
177
126
  }
178
- if (slot === 1)
179
- label.style.color = tone(column.secondaryTone, 'secondary');
180
- if (style?.columnSecondary)
181
- primitives.textStyle(label, style.columnSecondary);
182
- });
127
+ );
183
128
  });
184
- body.appendChild(v.trailing);
185
129
  }
186
130
  function create(document: Document, row: DataRow, primitives: RowPrimitives) {
187
131
  const body = createElement(
@@ -196,11 +140,6 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
196
140
  );
197
141
  const favorite = createElement(document, 'span', 'ok-native-list-favorite');
198
142
  const controls = createElement(document, 'span');
199
- const trailing = createElement(
200
- document,
201
- 'span',
202
- 'ok-native-list-accessories'
203
- );
204
143
  body.append(controls, index, favorite);
205
144
  const columns = Array.from({ length: 4 }, () => {
206
145
  const cell = createElement(document, 'span', 'ok-native-list-data-cell');
@@ -210,10 +149,8 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
210
149
  'ok-native-list-data-primary'
211
150
  );
212
151
  const primary = tagSlot(createElement(document, 'span'), 'columns');
213
- const titleIcons = createElement(document, 'span');
214
- titleIcons.style.display = 'contents';
215
152
  const badges = createElement(document, 'span');
216
- primaryLine.append(primary, titleIcons, badges);
153
+ primaryLine.append(primary, badges);
217
154
  const secondaryLine = createElement(
218
155
  document,
219
156
  'span',
@@ -232,18 +169,15 @@ function create(document: Document, row: DataRow, primitives: RowPrimitives) {
232
169
  body: cell,
233
170
  primaryLine,
234
171
  primary,
235
- titleIcons,
236
172
  badges,
237
173
  secondaryLine,
238
174
  secondary,
239
175
  };
240
176
  });
241
- body.appendChild(trailing);
242
177
  views.set(body, {
243
178
  favorite,
244
179
  index,
245
180
  controls,
246
- trailing,
247
181
  columns,
248
182
  visualKey: '',
249
183
  primitives,
@@ -262,7 +196,6 @@ function recycle(body: HTMLElement) {
262
196
  v.visualStyle = undefined;
263
197
  v.visualKey = '';
264
198
  v.controls.replaceChildren();
265
- v.trailing.replaceChildren();
266
199
  }
267
200
  export const dataRowRenderer = {
268
201
  key: 'dataRow' as const,
@@ -271,13 +204,7 @@ export const dataRowRenderer = {
271
204
  recycle,
272
205
  // Legacy presets: table rows without secondary text are 8 units shorter.
273
206
  measure: (row: DataRow, _width: number, layout?: string) => {
274
- const secondary = row.columns.some((column) =>
275
- column.secondaryTextSegments?.length
276
- ? column.secondaryTextSegments.some(
277
- (segment) => segment.text.length > 0
278
- )
279
- : !!column.secondaryText
280
- );
207
+ const secondary = row.columns.some((column) => column.secondaryText);
281
208
  return (secondary ? 60 : 56) + (layout === 'table' && !secondary ? -8 : 0);
282
209
  },
283
210
  measureRendered: (_body: HTMLElement, _row: DataRow): number | undefined =>
@@ -226,117 +226,6 @@ function createIdentityRow(
226
226
  });
227
227
  column.insertBefore(segments, titleElement.nextSibling);
228
228
  }
229
- if (row.titleIcon || row.secondaryTitleIcon) {
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
- const icons = [row.titleIcon, row.secondaryTitleIcon]
242
- .filter((icon): icon is NonNullable<typeof icon> => icon !== undefined)
243
- .map((descriptor) => {
244
- const icon = primitives.iconAction(
245
- descriptor.name,
246
- undefined,
247
- undefined,
248
- descriptor.tintColor
249
- );
250
- icon.className = 'ok-native-list-identity-title-icon';
251
- if (descriptor.hoverActionKey) {
252
- setData(icon, 'nativeListHoverAction', descriptor.hoverActionKey);
253
- setData(icon, 'nativeListIconHelp', true);
254
- markActionAnchorSource(icon, 'leadingAction');
255
- }
256
- if (descriptor.accessibilityLabel)
257
- icon.setAttribute('aria-label', descriptor.accessibilityLabel);
258
- else icon.setAttribute('aria-hidden', 'true');
259
- return icon;
260
- });
261
- titleText.after(...icons);
262
- titleElement.style.display = 'flex';
263
- titleElement.style.alignItems = 'center';
264
- titleElement.style.gap = '4px';
265
- }
266
- if (row.titleSuffixes?.length) {
267
- const badges = titleElement.querySelector(
268
- ':scope > .ok-native-list-badges'
269
- );
270
- let titleText = titleElement.querySelector<HTMLElement>(
271
- ':scope > .ok-native-list-identity-title-text, :scope > [data-nl-slot="title"]'
272
- );
273
- if (!titleText) {
274
- titleText = tagSlot(
275
- createElement(document, 'span', 'ok-native-list-identity-title-text'),
276
- 'title'
277
- );
278
- while (titleElement.firstChild && titleElement.firstChild !== badges)
279
- titleText.appendChild(titleElement.firstChild);
280
- titleElement.prepend(titleText);
281
- titleElement.removeAttribute('data-nl-slot');
282
- } else if (titleElement.hasAttribute('data-nl-slot')) {
283
- titleElement.removeAttribute('data-nl-slot');
284
- tagSlot(titleText, 'title');
285
- }
286
- titleElement.style.display = 'flex';
287
- titleElement.style.alignItems = 'center';
288
- titleText.style.flex = '0 1 auto';
289
- titleText.style.minWidth = 'min(80px, 100%)';
290
- titleText.style.overflow = 'hidden';
291
- titleText.style.textOverflow = 'ellipsis';
292
- titleText.style.whiteSpace = 'nowrap';
293
- row.titleSuffixes.forEach((suffix) => {
294
- const label = createElement(
295
- document,
296
- 'span',
297
- 'ok-native-list-identity-title-suffix',
298
- suffix.text
299
- );
300
- label.style.flex = '0 1 auto';
301
- label.style.minWidth = '0';
302
- label.style.marginInlineStart =
303
- row.titleIcon || row.secondaryTitleIcon ? '4px' : '8px';
304
- label.style.maxWidth =
305
- suffix.maxWidth === undefined ? '' : `${suffix.maxWidth}px`;
306
- label.style.overflow = 'hidden';
307
- label.style.textOverflow = 'ellipsis';
308
- label.style.whiteSpace = 'nowrap';
309
- label.style.fontSize = '12px';
310
- label.style.lineHeight = '16px';
311
- label.style.fontWeight = '400';
312
- label.style.fontFamily = 'var(--nl-font-regular)';
313
- label.style.color =
314
- suffix.tone === 'disabled'
315
- ? 'var(--nl-disabled)'
316
- : 'var(--nl-secondary)';
317
- titleElement.insertBefore(label, badges);
318
- });
319
- }
320
- if (row.badges?.length && !row.titleIcon && !row.secondaryTitleIcon) {
321
- const titleText = titleElement.querySelector<HTMLElement>(
322
- ':scope > [data-nl-slot="title"]'
323
- );
324
- const badges = titleElement.querySelector<HTMLElement>(
325
- ':scope > .ok-native-list-badges'
326
- );
327
- titleElement.style.display = 'flex';
328
- titleElement.style.alignItems = 'center';
329
- if (titleText) {
330
- titleText.style.flex = '0 1 auto';
331
- titleText.style.minWidth = row.titleSuffixes?.length
332
- ? 'min(80px, 100%)'
333
- : '0';
334
- }
335
- if (badges) {
336
- badges.style.flex = '0 1 auto';
337
- badges.style.minWidth = '0';
338
- }
339
- }
340
229
  if (presentation === 'walletSidebar' && row.badges?.length) {
341
230
  const badges = createElement(
342
231
  document,
@@ -353,13 +242,7 @@ function createIdentityRow(
353
242
  if (lines !== undefined)
354
243
  column
355
244
  .querySelectorAll<HTMLElement>(`[data-nl-slot="${key}"]`)
356
- .forEach((text) =>
357
- applyTextLayout(
358
- text,
359
- lines === 0 ? {} : { lines },
360
- lines === 0 ? 0 : undefined
361
- )
362
- );
245
+ .forEach((text) => applyTextLayout(text, { lines }));
363
246
  }
364
247
  }
365
248
  body.appendChild(column);
@@ -389,29 +272,6 @@ function applyIdentityStyle(body: HTMLElement, row: IdentityRow) {
389
272
  const leading = body.querySelector<HTMLElement>(
390
273
  ':scope > .ok-native-list-visual, :scope > .ok-native-list-stacked'
391
274
  );
392
- if (row.style?.leadingContentMaxWidthRatio !== undefined && !vertical) {
393
- const column = body.querySelector<HTMLElement>(
394
- ':scope > .ok-native-list-flex'
395
- );
396
- const trailing = body.querySelector<HTMLElement>(
397
- ':scope > .ok-native-list-accessories'
398
- );
399
- const visualWidth = leading
400
- ? row.style.image?.width ??
401
- (row.presentation === 'accountSelector' ||
402
- row.presentation === 'networkSelector'
403
- ? 32
404
- : 40)
405
- : 0;
406
- const gap = leading ? row.style.leadingGap ?? 12 : 0;
407
- if (column) {
408
- column.style.flex = '0 1 auto';
409
- column.style.maxWidth = `calc(${
410
- row.style.leadingContentMaxWidthRatio * 100
411
- }% - ${visualWidth + gap}px)`;
412
- }
413
- if (trailing) trailing.style.marginInlineStart = 'auto';
414
- }
415
275
  const defaultGap =
416
276
  body.style.gap ||
417
277
  (row.type === 'identity' && row.presentation === 'walletSidebar'
@@ -483,7 +343,7 @@ function applyIdentityStyle(body: HTMLElement, row: IdentityRow) {
483
343
  const images = leading.matches('img')
484
344
  ? [leading]
485
345
  : leading.querySelectorAll<HTMLElement>(
486
- ':scope > img:not(.ok-native-list-visual-corner), :scope > .ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)'
346
+ ':scope > img, :scope > .ok-native-list-visual-fallback'
487
347
  );
488
348
  images.forEach((bitmap) => {
489
349
  if (bitmap !== leading) {
@@ -662,12 +522,7 @@ export const identityRowRenderer = {
662
522
  ? 60
663
523
  : 56,
664
524
  measureRendered: (
665
- body: HTMLElement,
666
- row: IdentityRow
667
- ): number | undefined => {
668
- if (row.contentHeight !== 'auto' || hasExplicitRowHeight(row))
669
- return undefined;
670
- const height = body.getBoundingClientRect().height;
671
- return height > 0 ? height : undefined;
672
- },
525
+ _body: HTMLElement,
526
+ _row: IdentityRow
527
+ ): number | undefined => undefined,
673
528
  };
@@ -4,8 +4,10 @@ import type { MessageRow, NativeListTextStyle } from '../../models';
4
4
 
5
5
  type Text = Readonly<{
6
6
  value: string;
7
- style: Required<Pick<NativeListTextStyle, 'fontSize' | 'lineHeight'>> &
8
- Omit<NativeListTextStyle, 'lines'> & { lines: 0 | 1 | 2 | 3 };
7
+ style: Required<
8
+ Pick<NativeListTextStyle, 'fontSize' | 'lineHeight' | 'lines'>
9
+ > &
10
+ NativeListTextStyle;
9
11
  }>;
10
12
  export function resolveMessageRow(row: MessageRow) {
11
13
  const text = (
@@ -13,7 +15,7 @@ export function resolveMessageRow(row: MessageRow) {
13
15
  style: NativeListTextStyle | undefined,
14
16
  fontSize: number,
15
17
  lineHeight: number,
16
- lines: 0 | 1 | 2 | 3,
18
+ lines: 1 | 2 | 3,
17
19
  color: string,
18
20
  fontWeight: NativeListTextStyle['fontWeight'] = 'regular'
19
21
  ): Text => ({
@@ -115,9 +117,6 @@ export function bindMessageRow(
115
117
  body.style.cssText = '';
116
118
  body.removeAttribute('data-nl-container-background');
117
119
  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');
121
120
  body.style.padding = `${resolved.verticalPadding}px ${resolved.horizontalPadding}px`;
122
121
  body.style.height = resolved.automaticHeight ? 'auto' : '100%';
123
122
  views.column.style.cssText = '';
@@ -129,19 +128,7 @@ export function bindMessageRow(
129
128
  ] as const) {
130
129
  view.style.cssText = '';
131
130
  view.textContent = text.value;
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
- }
131
+ primitives.textStyle(view, text.style);
145
132
  }
146
133
  views.unread.style.cssText = '';
147
134
  if (row.body) {
@@ -271,10 +258,7 @@ export function measureMessageRow(
271
258
  ),
272
259
  0
273
260
  );
274
- return (
275
- (text.style.lines === 0 ? lines : Math.min(text.style.lines, lines)) *
276
- text.style.lineHeight
277
- );
261
+ return Math.min(text.style.lines, lines) * text.style.lineHeight;
278
262
  };
279
263
  const timeWidth = Math.min(
280
264
  availableWidth / 3,
@@ -88,8 +88,6 @@ 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');
93
91
  if (container.borderWidth !== undefined) {
94
92
  // Paint above member backgrounds without changing the content box or hit targets.
95
93
  body.setAttribute('data-nl-container-border', 'true');
@@ -16,15 +16,8 @@ import type { SystemRow } from '../../models';
16
16
  import { systemRowRenderer } from './SystemRowRenderer';
17
17
  import type { ActionRow } from '../../models';
18
18
  import { actionRowRenderer } from './ActionRowRenderer';
19
- import { buttonGroupRowRenderer } from './ButtonGroupRowRenderer';
20
19
  import { mediaTileRowRenderer } from './MediaTileRowRenderer';
21
- import type {
22
- ButtonGroupRow,
23
- MessageRow,
24
- RailRow,
25
- MediaTileRow,
26
- RowModel,
27
- } from '../../models';
20
+ import type { MessageRow, RailRow, MediaTileRow, RowModel } from '../../models';
28
21
  import { messageRowRenderer } from './MessageRowRenderer';
29
22
  import type { RowPrimitives } from './RowVisual';
30
23
  import { railRowRenderer } from './RailRowRenderer';
@@ -78,8 +71,6 @@ const factories = {
78
71
  registration(activityRowRenderer, row as ActivityRow),
79
72
  system: (row: RowModel) => registration(systemRowRenderer, row as SystemRow),
80
73
  action: (row: RowModel) => registration(actionRowRenderer, row as ActionRow),
81
- buttonGroup: (row: RowModel) =>
82
- registration(buttonGroupRowRenderer, row as ButtonGroupRow),
83
74
  message: (row: RowModel) =>
84
75
  registration(messageRowRenderer, row as MessageRow),
85
76
  rail: (row: RowModel) => registration(railRowRenderer, row as RailRow),
@@ -100,7 +91,6 @@ const renderers = {
100
91
  activity: activityRowRenderer,
101
92
  system: systemRowRenderer,
102
93
  action: actionRowRenderer,
103
- buttonGroup: buttonGroupRowRenderer,
104
94
  message: messageRowRenderer,
105
95
  rail: railRowRenderer,
106
96
  mediaTile: mediaTileRowRenderer,
@@ -1,6 +1,6 @@
1
1
  import { applyTextWeight } from './RowText';
2
2
  import { applyTabularNumbers, hasExplicitRowHeight } from './RowElements';
3
- import type { RowTextHelp, SectionHeaderRow } from '../../models';
3
+ import type { SectionHeaderRow } from '../../models';
4
4
  import {
5
5
  createElement,
6
6
  setData,
@@ -10,21 +10,6 @@ import {
10
10
  } from './RowElements';
11
11
  import { applyValueSegments } from './RowText';
12
12
  import type { RowPrimitives } from './RowVisual';
13
-
14
- function bindHelp(target: HTMLElement, help: RowTextHelp) {
15
- markActionAnchorSource(target, 'trailingAccessory', 0);
16
- if (help.presentation === 'tooltip') {
17
- setData(target, 'nativeListHoverAction', help.actionKey);
18
- setData(target, 'nativeListIconHelp', true);
19
- } else {
20
- setData(target, 'nativeListAction', help.actionKey);
21
- target.setAttribute('role', 'button');
22
- }
23
- if (help.underline === 'dashed') {
24
- target.style.textDecoration = 'underline dashed';
25
- target.style.textUnderlineOffset = '4px';
26
- }
27
- }
28
13
  function createSectionHeader(
29
14
  document: Document,
30
15
  primitives: RowPrimitives,
@@ -51,16 +36,6 @@ function createSectionHeader(
51
36
  const column = createTextColumn(document, row.title, row.subtitle);
52
37
  const title = column.firstElementChild as HTMLElement;
53
38
  title.classList.add('ok-native-list-section-title');
54
- if (row.leadingBadge) {
55
- const badge = createElement(
56
- document,
57
- 'span',
58
- 'ok-native-list-badge',
59
- row.leadingBadge.text
60
- );
61
- if (row.leadingBadge.tone) setData(badge, 'tone', row.leadingBadge.tone);
62
- body.appendChild(badge);
63
- }
64
39
  if (row.titleActionKey) {
65
40
  setData(title, 'nativeListAction', row.titleActionKey);
66
41
  markActionAnchorSource(title, 'leadingAction');
@@ -75,12 +50,6 @@ function createSectionHeader(
75
50
  }
76
51
  if (row.titleActionOnHover) setData(title, 'nativeListHoverAction', true);
77
52
  }
78
- if (row.style?.titleDecoration === 'none')
79
- title.style.textDecoration = 'none';
80
- if (row.style?.titleDecoration === 'dashed') {
81
- title.style.textDecoration = 'underline dashed';
82
- title.style.textUnderlineOffset = '4px';
83
- }
84
53
  if (row.presentation === 'networkSelector' && hasExplicitRowHeight(row)) {
85
54
  body.style.padding =
86
55
  row.variant === 'summary' ? '24px 12px 20px' : '0 12px';
@@ -191,10 +160,8 @@ function createSectionHeader(
191
160
  const value = tagSlot(
192
161
  createElement(
193
162
  document,
194
- row.valueActionKey || row.valueHelp?.presentation === 'popover'
195
- ? 'button'
196
- : 'span',
197
- row.valueActionKey || row.valueHelp?.presentation === 'popover'
163
+ row.valueActionKey ? 'button' : 'span',
164
+ row.valueActionKey
198
165
  ? 'ok-native-list-action-button ok-native-list-section-value'
199
166
  : 'ok-native-list-value ok-native-list-section-value',
200
167
  row.value
@@ -219,17 +186,7 @@ function createSectionHeader(
219
186
  setData(value, 'nativeListAction', row.valueActionKey);
220
187
  markActionAnchorSource(value, 'trailingAccessory', 0);
221
188
  }
222
- if (row.valueHelp) bindHelp(value, row.valueHelp);
223
- if (row.style?.valuePlacement === 'afterTitle') {
224
- value.style.marginLeft = '0';
225
- value.style.flexShrink = '0';
226
- value.style.alignSelf = 'center';
227
- title.insertAdjacentElement('afterend', value);
228
- column.style.flexDirection = 'row';
229
- column.style.alignItems = 'center';
230
- column.style.justifyContent = 'flex-start';
231
- column.style.gap = '8px';
232
- } else body.appendChild(value);
189
+ body.appendChild(value);
233
190
  }
234
191
  if (row.valueIcon) {
235
192
  const valueIcon = primitives.iconAction(