@onekeyfe/react-native-native-list 6.7.0-1 → 6.7.0-3

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 (82) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +1 -1
  2. package/docs/SPEC.md +380 -11
  3. package/ios/HybridNativeList.swift +11 -3
  4. package/ios/RNCNativeListView.swift +10 -6
  5. package/ios/tests/NativeListLifecycleTests.swift +28 -0
  6. package/lib/module/NativeList.js +4 -2
  7. package/lib/module/NativeList.web.js +135 -29
  8. package/lib/module/ScrollEdgeEffect.js +8 -0
  9. package/lib/module/index.js +1 -0
  10. package/lib/module/validation.js +143 -34
  11. package/lib/module/web/NativeListWebEngine.js +353 -62
  12. package/lib/module/web/templates/ActivityRowRenderer.js +432 -5
  13. package/lib/module/web/templates/MarketRowRenderer.js +8 -3
  14. package/lib/module/web/templates/MarketTableRowRenderer.js +576 -0
  15. package/lib/module/web/templates/MediaTileRowRenderer.js +260 -5
  16. package/lib/module/web/templates/RowRendererRegistry.js +5 -3
  17. package/lib/module/web/templates/SectionHeaderRowRenderer.js +34 -1
  18. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +10 -6
  19. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -2
  20. package/lib/nitrogen/generated/android/c++/JNativeListScrollEdgeEffect.hpp +61 -0
  21. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +3 -3
  22. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +1 -1
  23. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt +24 -0
  24. package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +3 -0
  25. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +8 -4
  26. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +4 -4
  27. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -1
  28. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +3 -3
  29. package/lib/nitrogen/generated/ios/swift/NativeListScrollEdgeEffect.swift +44 -0
  30. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -2
  31. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +5 -2
  32. package/lib/nitrogen/generated/shared/c++/NativeListScrollEdgeEffect.hpp +80 -0
  33. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -2
  34. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +4 -3
  35. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -1
  36. package/lib/typescript/src/NativeList.nitro.d.ts +2 -1
  37. package/lib/typescript/src/NativeList.types.d.ts +14 -3
  38. package/lib/typescript/src/NativeList.web.d.ts +2 -2
  39. package/lib/typescript/src/ScrollEdgeEffect.d.ts +5 -0
  40. package/lib/typescript/src/index.d.ts +1 -0
  41. package/lib/typescript/src/models.d.ts +71 -1
  42. package/lib/typescript/src/web/NativeListWebEngine.d.ts +26 -1
  43. package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
  44. package/lib/typescript/src/web/templates/MarketTableRowRenderer.d.ts +17 -0
  45. package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +3 -3
  46. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +1 -1
  47. package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
  48. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +10 -6
  49. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -2
  50. package/nitrogen/generated/android/c++/JNativeListScrollEdgeEffect.hpp +61 -0
  51. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +3 -3
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +1 -1
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt +24 -0
  54. package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +3 -0
  55. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +8 -4
  56. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +4 -4
  57. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -1
  58. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +3 -3
  59. package/nitrogen/generated/ios/swift/NativeListScrollEdgeEffect.swift +44 -0
  60. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -2
  61. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +5 -2
  62. package/nitrogen/generated/shared/c++/NativeListScrollEdgeEffect.hpp +80 -0
  63. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -2
  64. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +4 -3
  65. package/nitrogen/generated/shared/json/NativeListConfig.json +1 -1
  66. package/package.json +3 -3
  67. package/react-native-native-list.podspec +4 -1
  68. package/src/NativeList.nitro.ts +3 -1
  69. package/src/NativeList.tsx +6 -2
  70. package/src/NativeList.types.ts +15 -3
  71. package/src/NativeList.web.tsx +183 -38
  72. package/src/ScrollEdgeEffect.ts +4 -0
  73. package/src/index.ts +2 -0
  74. package/src/models.ts +93 -0
  75. package/src/validation.ts +348 -58
  76. package/src/web/NativeListWebEngine.ts +600 -95
  77. package/src/web/templates/ActivityRowRenderer.ts +656 -7
  78. package/src/web/templates/MarketRowRenderer.ts +19 -3
  79. package/src/web/templates/MarketTableRowRenderer.ts +752 -0
  80. package/src/web/templates/MediaTileRowRenderer.ts +313 -5
  81. package/src/web/templates/RowRendererRegistry.ts +10 -5
  82. package/src/web/templates/SectionHeaderRowRenderer.ts +42 -1
@@ -2,8 +2,9 @@
2
2
 
3
3
  import { createElement, tagSlot, markActionAnchorSource } from "./RowElements.js";
4
4
  import { RowVisualStyle } from "./RowVisual.js";
5
+ import { applyTextWeight, applyValueSegments } from "./RowText.js";
5
6
  const views = new WeakMap();
6
- function bind(body, row, primitives) {
7
+ function bindLegacy(body, row, primitives) {
7
8
  const v = views.get(body);
8
9
  v.primitives = primitives;
9
10
  body.style.cssText = '';
@@ -45,7 +46,7 @@ function bind(body, row, primitives) {
45
46
  v.actions.appendChild(button);
46
47
  });
47
48
  }
48
- function create(document, row, primitives) {
49
+ function createLegacy(document, row, primitives) {
49
50
  const body = createElement(document, 'div', 'ok-native-list-row ok-native-list-standard');
50
51
  body.dataset.nlRenderer = 'activity';
51
52
  const column = createElement(document, 'span', 'ok-native-list-flex');
@@ -69,10 +70,10 @@ function create(document, row, primitives) {
69
70
  visualKey: '',
70
71
  primitives
71
72
  });
72
- bind(body, row, primitives);
73
+ bindLegacy(body, row, primitives);
73
74
  return body;
74
75
  }
75
- function recycle(body) {
76
+ function recycleLegacy(body) {
76
77
  const v = views.get(body);
77
78
  if (!v) return;
78
79
  v.visuals.forEach(node => {
@@ -84,12 +85,438 @@ function recycle(body) {
84
85
  v.visualKey = '';
85
86
  v.actions.replaceChildren();
86
87
  }
88
+ const histories = new WeakMap();
89
+ const isHistory = row => row.presentation !== undefined || row.amounts !== undefined;
90
+ const ellipsis = 'min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;';
91
+ function valueText(node, text, segments, size, line, weight) {
92
+ node.textContent = text ?? '';
93
+ applyTextWeight(node, weight);
94
+ applyValueSegments(node, segments, size, line, weight);
95
+ }
96
+ function createHistory(body, primitives) {
97
+ const document = body.ownerDocument;
98
+ const node = name => createElement(document, 'div', `ok-native-list-history-${name}`);
99
+ const content = node('content');
100
+ const identity = node('identity');
101
+ const visual = node('visual');
102
+ const text = node('text');
103
+ const titleLine = node('title-line');
104
+ const title = tagSlot(node('title'), 'title');
105
+ const badges = node('badges');
106
+ const description = node('description');
107
+ 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);
113
+ const amounts = node('amounts');
114
+ const fee = node('fee');
115
+ const feeLabel = node('fee-label');
116
+ const feeValues = node('fee-values');
117
+ const feePrimary = node('fee-primary');
118
+ const feeSecondary = node('fee-secondary');
119
+ const actions = node('actions');
120
+ titleLine.append(title, badges);
121
+ text.append(titleLine, description);
122
+ identity.append(visual, text);
123
+ feeValues.append(feePrimary, feeSecondary);
124
+ fee.append(feeLabel, feeValues);
125
+ content.append(identity, amounts, fee);
126
+ body.replaceChildren(content, actions);
127
+ const v = {
128
+ content,
129
+ identity,
130
+ visual,
131
+ text,
132
+ titleLine,
133
+ title,
134
+ badges,
135
+ description,
136
+ descriptionTime,
137
+ descriptionDot,
138
+ descriptionAddress,
139
+ amounts,
140
+ amountRows: new Map(),
141
+ fee,
142
+ feeLabel,
143
+ feeValues,
144
+ feePrimary,
145
+ feeSecondary,
146
+ actions,
147
+ actionButtons: new Map(),
148
+ visualKey: '',
149
+ primitives
150
+ };
151
+ histories.set(body, v);
152
+ return v;
153
+ }
154
+ const historyIconPaths = {
155
+ ArrowTopOutline: ['M19.414 10 18 11.414l-5-5V21h-2V6.414l-5 5L4.586 10 12 2.586z'],
156
+ ArrowBottomOutline: ['m13 17.586 5-5L19.414 14 12 21.414 4.586 14 6 12.586l5 5V3h2z'],
157
+ 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'],
158
+ 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'],
159
+ 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'],
160
+ 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'],
161
+ Document2Outline: ['M12 16H8v-2h4zm4-4H8v-2h8zm0-4H8V6h8z', 'M20 22H4V2h16zM6 20h12V4H6z'],
162
+ 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'],
163
+ 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'],
164
+ DotHorOutline: ['M6 14H2v-4h4zm8 0h-4v-4h4zm8 0h-4v-4h4z']
165
+ };
166
+ function historyIcon(node, source, size) {
167
+ const name = source?.kind === 'icon' ? source.name : source?.kind === 'token' ? source.fallbackIcon?.name : undefined;
168
+ const paths = name && historyIconPaths[name];
169
+ if (!paths) return;
170
+ const placeholder = node.querySelector('.ok-native-list-visual-fallback');
171
+ if (!placeholder && source && 'image' in source && source.image) return;
172
+ const fallback = placeholder ?? node;
173
+ Object.assign(fallback.style, {
174
+ display: 'flex',
175
+ alignItems: 'center',
176
+ justifyContent: 'center',
177
+ width: '100%',
178
+ height: '100%'
179
+ });
180
+ 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;
181
+ const svg = node.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'svg');
182
+ svg.setAttribute('viewBox', '0 0 24 24');
183
+ svg.setAttribute('width', String(size));
184
+ svg.setAttribute('height', String(size));
185
+ svg.setAttribute('fill', 'currentColor');
186
+ svg.setAttribute('aria-hidden', 'true');
187
+ for (const d of paths) {
188
+ const path = node.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'path');
189
+ path.setAttribute('d', d);
190
+ path.setAttribute('fill-rule', 'evenodd');
191
+ svg.append(path);
192
+ }
193
+ fallback.replaceChildren(svg);
194
+ }
195
+ function bindHistory(body, row, primitives) {
196
+ const v = histories.get(body) ?? createHistory(body, primitives);
197
+ v.primitives = primitives;
198
+ const table = row.presentation === 'table';
199
+ const footer = Boolean(row.footerActions?.length);
200
+ body.className = 'ok-native-list-row ok-native-list-history';
201
+ body.style.cssText = '';
202
+ body.removeAttribute('data-nl-container-background');
203
+ body.removeAttribute('data-nl-container-border');
204
+ Object.assign(body.style, {
205
+ display: 'flex',
206
+ flexDirection: 'column',
207
+ alignItems: 'stretch',
208
+ justifyContent: 'flex-start',
209
+ width: 'calc(100% - 16px)',
210
+ margin: '0 8px',
211
+ padding: `${table ? 12 : 8}px 12px`,
212
+ height: !table && !footer && row.height !== 60 ? 'calc(100% - 8px)' : '100%',
213
+ borderRadius: '12px',
214
+ gap: '8px'
215
+ });
216
+ Object.assign(v.content.style, {
217
+ display: 'flex',
218
+ alignItems: 'center',
219
+ gap: '12px',
220
+ minWidth: '0',
221
+ width: '100%'
222
+ });
223
+ Object.assign(v.identity.style, {
224
+ display: 'flex',
225
+ alignItems: 'center',
226
+ gap: '12px',
227
+ minWidth: '0',
228
+ flex: '1 1 0'
229
+ });
230
+ Object.assign(v.visual.style, {
231
+ position: 'relative',
232
+ width: '40px',
233
+ height: '40px',
234
+ flex: '0 0 40px'
235
+ });
236
+ const visualKey = JSON.stringify([row.key, row.leading, row.secondaryLeading]);
237
+ if (v.visualKey !== visualKey) {
238
+ Array.from(v.visual.children).forEach(n => primitives.dispose(n));
239
+ v.visual.replaceChildren();
240
+ const sources = [row.leading, row.secondaryLeading].filter(Boolean);
241
+ sources.forEach((source, index) => {
242
+ const visual = primitives.visual(source);
243
+ if (!visual) return;
244
+ const size = sources.length > 1 ? index ? 28 : 24 : 40;
245
+ new RowVisualStyle(visual).apply(row.style?.image, size, size, 0);
246
+ Object.assign(visual.style, {
247
+ display: 'inline-flex',
248
+ alignItems: 'center',
249
+ justifyContent: 'center'
250
+ });
251
+ if (sources.length > 1) Object.assign(visual.style, {
252
+ position: 'absolute',
253
+ left: index ? '12px' : '0',
254
+ top: index ? '12px' : '0',
255
+ border: index ? '2px solid var(--nl-row)' : '0',
256
+ boxSizing: 'border-box'
257
+ });
258
+ historyIcon(visual, source, table || sources.length > 1 ? 24 : 28);
259
+ if (!table && sources.length > 1) {
260
+ const token = visual.ownerDocument.createElement('span');
261
+ Object.assign(token.style, {
262
+ display: 'flex',
263
+ alignItems: 'center',
264
+ justifyContent: 'center',
265
+ position: 'relative',
266
+ width: '24px',
267
+ height: '24px',
268
+ flex: '0 0 24px',
269
+ borderRadius: 'inherit',
270
+ boxSizing: 'border-box',
271
+ overflow: 'hidden',
272
+ background: source && 'backgroundColor' in source ? source.backgroundColor ?? '' : '',
273
+ border: source && 'borderColor' in source && source.borderColor ? `1px solid ${source.borderColor}` : '0'
274
+ });
275
+ token.append(...Array.from(visual.children).filter(child => !child.classList.contains('ok-native-list-visual-corner')));
276
+ const fallback = token.querySelector(':scope > .ok-native-list-visual-fallback');
277
+ if (fallback) {
278
+ fallback.style.width = '24px';
279
+ fallback.style.height = '24px';
280
+ fallback.style.flexShrink = '0';
281
+ }
282
+ const mainImage = token.querySelector(':scope > .ok-native-list-visual-main');
283
+ if (mainImage) {
284
+ mainImage.style.width = '100%';
285
+ mainImage.style.height = '100%';
286
+ }
287
+ visual.append(token);
288
+ }
289
+ if (table) {
290
+ visual.style.background = source && 'backgroundColor' in source && source.backgroundColor ? source.backgroundColor : 'var(--nl-strong)';
291
+ const borderColor = source && 'borderColor' in source && source.borderColor ? source.borderColor : 'var(--nl-separator)';
292
+ visual.style.border = `1px solid ${borderColor}`;
293
+ visual.style.boxSizing = 'border-box';
294
+ } else if (sources.length === 1 && source?.kind === 'token') {
295
+ visual.style.border = source.borderColor ? `1px solid ${source.borderColor}` : '0';
296
+ visual.style.boxSizing = 'border-box';
297
+ const mainImage = visual.querySelector(':scope > .ok-native-list-visual-main');
298
+ if (mainImage) {
299
+ mainImage.style.width = '100%';
300
+ mainImage.style.height = '100%';
301
+ }
302
+ }
303
+ v.visual.append(visual);
304
+ });
305
+ v.visualKey = visualKey;
306
+ }
307
+ Object.assign(v.text.style, {
308
+ minWidth: '0',
309
+ flex: '1 1 auto',
310
+ display: 'flex',
311
+ flexDirection: 'column',
312
+ gap: table ? '4px' : '0'
313
+ });
314
+ Object.assign(v.titleLine.style, {
315
+ display: 'flex',
316
+ alignItems: 'center',
317
+ minWidth: '0'
318
+ });
319
+ v.title.style.cssText = ellipsis + `font-size:${table ? 14 : 16}px;line-height:${table ? 20 : 24}px;font-weight:500;`;
320
+ v.title.textContent = row.title;
321
+ applyTextWeight(v.title, 500);
322
+ if (row.style?.title) primitives.textStyle(v.title, row.style.title);
323
+ v.badges.style.cssText = 'display:flex;flex:0 0 auto;gap:8px;margin-left:8px';
324
+ v.badges.replaceChildren();
325
+ for (const badge of row.badges ?? []) {
326
+ const element = createElement(body.ownerDocument, 'span', 'ok-native-list-badge', badge.text);
327
+ element.dataset.tone = badge.tone ?? '';
328
+ element.style.cssText = 'height:20px;font-size:12px;line-height:16px;padding:2px 8px;border-radius:4px;box-sizing:border-box';
329
+ applyTextWeight(element, 500);
330
+ if (badge.tone === 'neutral') Object.assign(element.style, {
331
+ background: 'var(--nl-strong)',
332
+ color: 'var(--nl-secondary)'
333
+ });
334
+ if (badge.tone === 'warning') Object.assign(element.style, {
335
+ background: 'var(--nl-caution-background,color-mix(in srgb,var(--nl-caution) 12%,transparent))',
336
+ color: 'var(--nl-caution)'
337
+ });
338
+ v.badges.append(element);
339
+ }
340
+ v.badges.style.display = row.badges?.length ? 'flex' : 'none';
341
+ 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;';
342
+ applyTextWeight(v.description, 400);
343
+ const split = row.description?.indexOf(' • ') ?? -1;
344
+ v.descriptionTime.textContent = split >= 0 ? row.description.slice(0, split) : '';
345
+ v.descriptionTime.style.display = split >= 0 ? 'inline' : 'none';
346
+ v.descriptionTime.style.flexShrink = '0';
347
+ v.descriptionDot.style.cssText = `flex-shrink:0;margin:0 4px;display:${split >= 0 ? 'inline' : 'none'}`;
348
+ 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;';
349
+ v.descriptionAddress.textContent = split >= 0 ? row.description.slice(split + 3) : row.description ?? '';
350
+ v.description.style.display = row.description ? 'flex' : 'none';
351
+ v.descriptionAddress.tabIndex = row.descriptionActionKey ? 0 : -1;
352
+ if (row.descriptionActionKey) {
353
+ v.descriptionAddress.dataset.nativeListAction = row.descriptionActionKey;
354
+ markActionAnchorSource(v.descriptionAddress, 'description');
355
+ v.descriptionAddress.style.cursor = 'pointer';
356
+ } else {
357
+ delete v.descriptionAddress.dataset.nativeListAction;
358
+ delete v.descriptionAddress.dataset.nativeListAnchorSource;
359
+ v.descriptionAddress.style.cursor = 'inherit';
360
+ }
361
+ if (row.style?.description) primitives.textStyle(v.description, row.style.description);
362
+ v.description.style.display = row.description ? 'flex' : 'none';
363
+ Object.assign(v.amounts.style, {
364
+ display: 'flex',
365
+ flexDirection: 'column',
366
+ minWidth: '0',
367
+ gap: table ? '4px' : '0',
368
+ flex: table ? '1 1 0' : '0 1 auto',
369
+ maxWidth: table ? '50%' : '50%',
370
+ alignItems: table ? 'stretch' : 'flex-end',
371
+ alignSelf: table ? 'stretch' : 'center'
372
+ });
373
+ const amountKeys = new Set();
374
+ for (const amount of row.amounts ?? []) {
375
+ amountKeys.add(amount.key);
376
+ let view = v.amountRows.get(amount.key);
377
+ if (!view) {
378
+ const element = createElement(body.ownerDocument, 'div');
379
+ const primary = tagSlot(createElement(body.ownerDocument, 'span'), 'primaryAmount');
380
+ const secondary = tagSlot(createElement(body.ownerDocument, 'span'), 'secondaryAmount');
381
+ element.append(primary, secondary);
382
+ view = {
383
+ element,
384
+ primary,
385
+ secondary,
386
+ visualKey: ''
387
+ };
388
+ v.amountRows.set(amount.key, view);
389
+ }
390
+ view.element.style.cssText = `display:flex;align-items:center;gap:4px;min-width:0;max-width:100%;${table ? '' : 'justify-content:flex-end;'}`;
391
+ const secondary = amount.tone === 'secondary';
392
+ const size = table || secondary ? 14 : 16;
393
+ const line = table || secondary ? 20 : 24;
394
+ const weight = table || secondary ? 400 : 500;
395
+ view.primary.style.cssText = ellipsis + `font-size:${size}px;line-height:${line}px;font-weight:${weight};color:${amount.tone === 'positive' ? 'var(--nl-positive)' : amount.tone === 'negative' ? 'var(--nl-negative)' : secondary ? 'var(--nl-secondary)' : 'var(--nl-primary)'};`;
396
+ valueText(view.primary, amount.text, amount.textSegments, size, line, weight);
397
+ const roleStyle = secondary ? row.style?.secondaryAmount : row.style?.primaryAmount;
398
+ if (roleStyle) primitives.textStyle(view.primary, roleStyle);
399
+ view.secondary.style.cssText = ellipsis + 'font-size:14px;line-height:20px;font-weight:400;color:var(--nl-secondary);';
400
+ valueText(view.secondary, amount.secondaryText, amount.secondaryTextSegments, 14, 20, 400);
401
+ view.secondary.hidden = !table || !amount.secondaryText;
402
+ const amountVisualKey = JSON.stringify(table ? amount.leading : undefined);
403
+ if (view.visualKey !== amountVisualKey) {
404
+ if (view.visual) {
405
+ primitives.dispose(view.visual);
406
+ view.visual.remove();
407
+ }
408
+ view.visual = table ? primitives.visual(amount.leading) : undefined;
409
+ if (view.visual) {
410
+ new RowVisualStyle(view.visual).apply({
411
+ width: 20,
412
+ height: 20
413
+ }, 20, 20, 0);
414
+ historyIcon(view.visual, amount.leading, 16);
415
+ if (amount.leading?.kind === 'token' && amount.leading.image) {
416
+ view.visual.style.border = amount.leading.borderColor ? `1px solid ${amount.leading.borderColor}` : '0';
417
+ view.visual.style.boxSizing = 'border-box';
418
+ }
419
+ view.element.prepend(view.visual);
420
+ }
421
+ view.visualKey = amountVisualKey;
422
+ }
423
+ v.amounts.append(view.element);
424
+ }
425
+ for (const [key, view] of v.amountRows) {
426
+ if (!amountKeys.has(key)) {
427
+ if (view.visual) primitives.dispose(view.visual);
428
+ view.element.remove();
429
+ v.amountRows.delete(key);
430
+ }
431
+ }
432
+ v.fee.style.cssText = 'display:flex;flex-direction:column;flex:.6 1 0;min-width:0;gap:4px';
433
+ v.fee.hidden = !table || !row.fee;
434
+ v.fee.style.display = table && row.fee ? 'flex' : 'none';
435
+ v.fee.style.opacity = row.fee?.hidden ? '0' : '1';
436
+ v.feeLabel.style.cssText = 'font-size:14px;line-height:20px;color:var(--nl-secondary);';
437
+ v.feeLabel.textContent = row.fee?.label ?? '';
438
+ applyTextWeight(v.feeLabel, 400);
439
+ v.feeValues.style.cssText = 'display:flex;align-items:center;gap:4px;min-width:0';
440
+ v.feePrimary.style.cssText = ellipsis + 'font-size:14px;line-height:20px;font-weight:400;';
441
+ v.feeSecondary.style.cssText = ellipsis + 'font-size:14px;line-height:20px;font-weight:400;color:var(--nl-secondary);';
442
+ valueText(v.feePrimary, row.fee?.primary, row.fee?.primaryTextSegments, 14, 20, 400);
443
+ valueText(v.feeSecondary, row.fee?.secondary, row.fee?.secondaryTextSegments, 14, 20, 400);
444
+ v.actions.style.cssText = 'display:flex;gap:12px;padding-left:52px;padding-bottom:4px;';
445
+ v.actions.style.display = footer ? 'flex' : 'none';
446
+ const actionKeys = new Set();
447
+ for (const [index, action] of (row.footerActions ?? []).entries()) {
448
+ actionKeys.add(action.key);
449
+ let button = v.actionButtons.get(action.key);
450
+ if (!button) {
451
+ button = createElement(body.ownerDocument, 'button', 'ok-native-list-action-button');
452
+ button.type = 'button';
453
+ v.actionButtons.set(action.key, button);
454
+ }
455
+ if (button.textContent !== action.label) button.textContent = action.label;
456
+ button.toggleAttribute('disabled', Boolean(action.disabled));
457
+ button.dataset.nativeListAction = action.key;
458
+ markActionAnchorSource(button, 'footerAction', index);
459
+ button.style.cssText = 'font-family:inherit;font-size:14px;line-height:20px;font-weight:500;padding:4px 10px;border:1px solid transparent;border-radius:8px;background:var(--nl-strong);color:var(--nl-primary);white-space:nowrap;';
460
+ applyTextWeight(button, 500);
461
+ if (action.tone === 'primary') Object.assign(button.style, {
462
+ background: 'var(--nl-primary)',
463
+ color: 'var(--nl-inverse-text)'
464
+ });
465
+ if (v.actions.children[index] !== button) v.actions.insertBefore(button, v.actions.children[index] ?? null);
466
+ }
467
+ for (const [key, button] of v.actionButtons) {
468
+ if (!actionKeys.has(key)) {
469
+ button.remove();
470
+ v.actionButtons.delete(key);
471
+ }
472
+ }
473
+ }
474
+ function recycle(body) {
475
+ const v = histories.get(body);
476
+ if (v) {
477
+ Array.from(v.visual.children).forEach(n => v.primitives.dispose(n));
478
+ for (const view of v.amountRows.values()) if (view.visual) v.primitives.dispose(view.visual);
479
+ histories.delete(body);
480
+ }
481
+ recycleLegacy(body);
482
+ views.delete(body);
483
+ }
484
+ function bind(body, row, primitives) {
485
+ if (isHistory(row)) {
486
+ if (views.has(body)) {
487
+ recycleLegacy(body);
488
+ views.delete(body);
489
+ }
490
+ bindHistory(body, row, primitives);
491
+ } else {
492
+ if (histories.has(body)) recycle(body);
493
+ if (!views.has(body)) {
494
+ const initial = createLegacy(body.ownerDocument, row, primitives);
495
+ body.replaceChildren(...Array.from(initial.childNodes));
496
+ body.className = initial.className;
497
+ views.set(body, views.get(initial));
498
+ views.delete(initial);
499
+ }
500
+ bindLegacy(body, row, primitives);
501
+ }
502
+ }
503
+ function create(document, row, primitives) {
504
+ const body = document.createElement('div');
505
+ body.dataset.nlRenderer = 'activity';
506
+ bind(body, row, primitives);
507
+ return body;
508
+ }
87
509
  export const activityRowRenderer = {
88
510
  key: 'activity',
89
511
  create,
90
512
  bind,
91
513
  recycle,
92
- measure: (row, _width) => row.footerActions?.length ? 100 : 60,
514
+ measure: (row, _width) => {
515
+ if (!isHistory(row)) return row.footerActions?.length ? 100 : 60;
516
+ const extra = row.presentation === 'table' ? Math.max(0, (row.amounts?.length ?? 0) - 2) * 24 : 0;
517
+ if (row.footerActions?.length) return (row.presentation === 'table' ? 68 : 60) + extra + 42;
518
+ return 68 + extra;
519
+ },
93
520
  measureRendered: (_body, _row) => undefined
94
521
  };
95
522
  //# sourceMappingURL=ActivityRowRenderer.js.map
@@ -114,8 +114,8 @@ function createMarketRow(document, primitives, row) {
114
114
  }
115
115
  image.style.objectFit = style?.image?.contentFit === 'center' ? 'none' : style?.image?.contentFit ?? image.style.objectFit;
116
116
  } else {
117
- image.style.width = '20px';
118
- image.style.height = '20px';
117
+ image.style.width = String(row.leading.kind === 'token' ? row.leading.networkImage?.width ?? 16 : 16) + 'px';
118
+ image.style.height = String(row.leading.kind === 'token' ? row.leading.networkImage?.height ?? 16 : 16) + 'px';
119
119
  if (borderColor) {
120
120
  image.style.right = '-5px';
121
121
  image.style.bottom = '-5px';
@@ -187,8 +187,13 @@ function createMarketRow(document, primitives, row) {
187
187
  weight: 400,
188
188
  alignment: 'start'
189
189
  });
190
+ if (row.subtitlePrefix.hoverActionKey) {
191
+ prefix.dataset.nativeListHoverAction = row.subtitlePrefix.hoverActionKey;
192
+ prefix.dataset.nativeListAnchorSource = 'row';
193
+ prefix.tabIndex = 0;
194
+ }
190
195
  prefix.style.display = 'block';
191
- prefix.style.flex = '1 1 auto';
196
+ prefix.style.flex = '0 1 auto';
192
197
  prefix.style.minWidth = '0';
193
198
  prefix.style.overflow = 'hidden';
194
199
  prefix.style.textOverflow = 'ellipsis';