@onekeyfe/react-native-native-list 6.7.0-3 → 6.7.0-5
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.
- package/docs/SPEC.md +18 -2
- package/lib/module/web/NativeListWebEngine.js +4 -1
- package/lib/module/web/templates/ActivityRowRenderer.js +109 -57
- package/lib/module/web/templates/MarketTableRowRenderer.js +1 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +2 -2
- package/package.json +3 -3
- package/src/web/NativeListWebEngine.ts +4 -1
- package/src/web/templates/ActivityRowRenderer.ts +150 -83
- package/src/web/templates/MarketTableRowRenderer.ts +3 -0
- package/src/web/templates/MediaTileRowRenderer.ts +2 -2
package/docs/SPEC.md
CHANGED
|
@@ -953,6 +953,11 @@ matching the consumer's existing finite logo group. Geometry/badge/image changes
|
|
|
953
953
|
use normal rebind and release replaced image leases; price-only updates retain
|
|
954
954
|
these nodes. No native caller emits these Web-only fields.
|
|
955
955
|
|
|
956
|
+
Web gallery media follows the shared input precedence: media wins over image,
|
|
957
|
+
unless an explicit empty/error imageState suppresses media probing. An empty/error
|
|
958
|
+
gallery without either source retains the gallery fallback surface when
|
|
959
|
+
imageState explicitly selects that state.
|
|
960
|
+
|
|
956
961
|
Web gallery media preserves the consuming NFT card presentation: healthy image
|
|
957
962
|
and exhausted fallback surfaces have a10px radius, while a healthy video surface
|
|
958
963
|
has square corners. The image/video frame uses the list page background; only
|
|
@@ -1008,8 +1013,9 @@ sources without changing default native mapper output.
|
|
|
1008
1013
|
|
|
1009
1014
|
ImageSource.fallbackUris is an optional Web-only ordered continuation after uri.
|
|
1010
1015
|
It retains the complete caller-provided sequence (no truncation or deduplication).
|
|
1011
|
-
|
|
1012
|
-
|
|
1016
|
+
Empty or unusable continuation entries are skipped in order until a usable URI
|
|
1017
|
+
is found or the complete sequence is exhausted. Exhaustion reaches the declared
|
|
1018
|
+
visual fallback. Skipped entries consume no retry budget; each usable URI
|
|
1013
1019
|
uses its declared retryTimes before proceeding; Market Web callers pass the
|
|
1014
1020
|
existing ImageV2 default of one retry per source. This array path does not change
|
|
1015
1021
|
legacy fallbackUri switching/retry order when fallbackUris is absent. Native
|
|
@@ -1177,3 +1183,13 @@ listener on destroy. It measures the new content origin before Pager restores
|
|
|
1177
1183
|
its C+B offset; a later ResizeObserver must not add that inset a second time.
|
|
1178
1184
|
Ordinary subsequent slot-height changes retain the existing content-anchor
|
|
1179
1185
|
compensation. Standalone lists continue listening on their own viewport.
|
|
1186
|
+
|
|
1187
|
+
### Web History retained visual binding
|
|
1188
|
+
|
|
1189
|
+
Implemented contract: same-source History visuals retain their image, placeholder
|
|
1190
|
+
and corner nodes while image styles or table/stacked presentation change. Every
|
|
1191
|
+
bind restores the factory geometry and applies the current image style and
|
|
1192
|
+
presentation, including clearing omitted radius/contentFit/shape overrides.
|
|
1193
|
+
Presentation wrapper changes move the existing nodes and preserve asynchronous
|
|
1194
|
+
loading/error visibility; they do not recreate or reload an unchanged source.
|
|
1195
|
+
Changing the source set retains the existing rebuild/disposal behavior.
|
|
@@ -581,7 +581,10 @@ function configureWebImageRetry(image, source, initialUri) {
|
|
|
581
581
|
}
|
|
582
582
|
if (orderedFallbacks !== undefined && retryCount >= retryLimit) {
|
|
583
583
|
if (fallbackIndex >= orderedFallbacks.length) return;
|
|
584
|
-
|
|
584
|
+
let nextUri;
|
|
585
|
+
while (!nextUri && fallbackIndex < orderedFallbacks.length) {
|
|
586
|
+
nextUri = safeImageUri(orderedFallbacks[fallbackIndex++]);
|
|
587
|
+
}
|
|
585
588
|
if (!nextUri) return;
|
|
586
589
|
event.stopImmediatePropagation();
|
|
587
590
|
retryCount = 0;
|
|
@@ -146,6 +146,7 @@ function createHistory(body, primitives) {
|
|
|
146
146
|
actions,
|
|
147
147
|
actionButtons: new Map(),
|
|
148
148
|
visualKey: '',
|
|
149
|
+
visuals: [],
|
|
149
150
|
primitives
|
|
150
151
|
};
|
|
151
152
|
histories.set(body, v);
|
|
@@ -237,73 +238,124 @@ function bindHistory(body, row, primitives) {
|
|
|
237
238
|
if (v.visualKey !== visualKey) {
|
|
238
239
|
Array.from(v.visual.children).forEach(n => primitives.dispose(n));
|
|
239
240
|
v.visual.replaceChildren();
|
|
241
|
+
v.visuals = [];
|
|
240
242
|
const sources = [row.leading, row.secondaryLeading].filter(Boolean);
|
|
241
|
-
sources.forEach(
|
|
243
|
+
sources.forEach(source => {
|
|
242
244
|
const visual = primitives.visual(source);
|
|
243
245
|
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
246
|
historyIcon(visual, source, table || sources.length > 1 ? 24 : 28);
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
overflow: 'hidden',
|
|
272
|
-
background: source && 'backgroundColor' in source ? source.backgroundColor ?? '' : '',
|
|
273
|
-
border: source && 'borderColor' in source && source.borderColor ? `1px solid ${source.borderColor}` : '0'
|
|
247
|
+
const retained = {
|
|
248
|
+
node: visual,
|
|
249
|
+
style: new RowVisualStyle(visual),
|
|
250
|
+
background: visual.style.background,
|
|
251
|
+
loaded: false
|
|
252
|
+
};
|
|
253
|
+
// Only placeholder-backed sources restore their frame background on load.
|
|
254
|
+
const image = source && 'image' in source ? source.image : undefined;
|
|
255
|
+
if (image?.loadingStrategy && image.loadingStrategy !== 'none') {
|
|
256
|
+
visual.querySelector('.ok-native-list-visual-main')?.addEventListener('load', () => {
|
|
257
|
+
retained.background = source && 'backgroundColor' in source && source.backgroundColor ? source.backgroundColor : 'transparent';
|
|
258
|
+
retained.loaded = true;
|
|
274
259
|
});
|
|
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
260
|
}
|
|
261
|
+
v.visuals.push(retained);
|
|
303
262
|
v.visual.append(visual);
|
|
304
263
|
});
|
|
305
264
|
v.visualKey = visualKey;
|
|
306
265
|
}
|
|
266
|
+
const sources = [row.leading, row.secondaryLeading].filter(Boolean);
|
|
267
|
+
v.visuals.forEach((retained, index) => {
|
|
268
|
+
const {
|
|
269
|
+
node: visual,
|
|
270
|
+
style,
|
|
271
|
+
background,
|
|
272
|
+
loaded
|
|
273
|
+
} = retained;
|
|
274
|
+
const source = sources[index];
|
|
275
|
+
const previousToken = visual.querySelector(':scope > .ok-native-list-history-token');
|
|
276
|
+
if (previousToken) {
|
|
277
|
+
visual.append(...Array.from(previousToken.children));
|
|
278
|
+
previousToken.remove();
|
|
279
|
+
}
|
|
280
|
+
const currentFallback = visual.querySelector(':scope > .ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)');
|
|
281
|
+
if (currentFallback && retained.fallback !== currentFallback) {
|
|
282
|
+
retained.fallback = currentFallback;
|
|
283
|
+
retained.fallbackStyle = new RowVisualStyle(currentFallback);
|
|
284
|
+
}
|
|
285
|
+
// A terminal image error creates a new fallback node after the factory bind.
|
|
286
|
+
retained.fallbackStyle?.restore();
|
|
287
|
+
const size = sources.length > 1 ? index ? 28 : 24 : 40;
|
|
288
|
+
style.apply(row.style?.image, size, size, 0);
|
|
289
|
+
Object.assign(visual.style, {
|
|
290
|
+
background,
|
|
291
|
+
position: '',
|
|
292
|
+
left: '',
|
|
293
|
+
top: ''
|
|
294
|
+
});
|
|
295
|
+
const svg = visual.querySelector('.ok-native-list-visual-fallback > svg');
|
|
296
|
+
if (svg) {
|
|
297
|
+
const iconSize = String(table || sources.length > 1 ? 24 : 28);
|
|
298
|
+
svg.setAttribute('width', iconSize);
|
|
299
|
+
svg.setAttribute('height', iconSize);
|
|
300
|
+
}
|
|
301
|
+
Object.assign(visual.style, {
|
|
302
|
+
display: 'inline-flex',
|
|
303
|
+
alignItems: 'center',
|
|
304
|
+
justifyContent: 'center'
|
|
305
|
+
});
|
|
306
|
+
if (sources.length > 1) Object.assign(visual.style, {
|
|
307
|
+
position: 'absolute',
|
|
308
|
+
left: index ? '12px' : '0',
|
|
309
|
+
top: index ? '12px' : '0',
|
|
310
|
+
border: index ? '2px solid var(--nl-row)' : '0',
|
|
311
|
+
boxSizing: 'border-box'
|
|
312
|
+
});
|
|
313
|
+
if (!table && sources.length > 1) {
|
|
314
|
+
const token = visual.ownerDocument.createElement('span');
|
|
315
|
+
token.className = 'ok-native-list-history-token';
|
|
316
|
+
Object.assign(token.style, {
|
|
317
|
+
display: 'flex',
|
|
318
|
+
alignItems: 'center',
|
|
319
|
+
justifyContent: 'center',
|
|
320
|
+
position: 'relative',
|
|
321
|
+
width: '24px',
|
|
322
|
+
height: '24px',
|
|
323
|
+
flex: '0 0 24px',
|
|
324
|
+
borderRadius: 'inherit',
|
|
325
|
+
boxSizing: 'border-box',
|
|
326
|
+
overflow: 'hidden',
|
|
327
|
+
background: source && 'backgroundColor' in source ? source.backgroundColor ?? '' : '',
|
|
328
|
+
border: source && 'borderColor' in source && source.borderColor ? `1px solid ${source.borderColor}` : '0'
|
|
329
|
+
});
|
|
330
|
+
token.append(...Array.from(visual.children).filter(child => !child.classList.contains('ok-native-list-visual-corner')));
|
|
331
|
+
const fallback = token.querySelector(':scope > .ok-native-list-visual-fallback');
|
|
332
|
+
if (fallback) {
|
|
333
|
+
fallback.style.width = '24px';
|
|
334
|
+
fallback.style.height = '24px';
|
|
335
|
+
fallback.style.flexShrink = '0';
|
|
336
|
+
}
|
|
337
|
+
const mainImage = token.querySelector(':scope > .ok-native-list-visual-main');
|
|
338
|
+
if (mainImage) {
|
|
339
|
+
mainImage.style.width = '100%';
|
|
340
|
+
mainImage.style.height = '100%';
|
|
341
|
+
}
|
|
342
|
+
visual.append(token);
|
|
343
|
+
}
|
|
344
|
+
if (table) {
|
|
345
|
+
visual.style.background = loaded ? background : source && 'backgroundColor' in source && source.backgroundColor ? source.backgroundColor : 'var(--nl-strong)';
|
|
346
|
+
const borderColor = source && 'borderColor' in source && source.borderColor ? source.borderColor : 'var(--nl-separator)';
|
|
347
|
+
visual.style.border = `1px solid ${borderColor}`;
|
|
348
|
+
visual.style.boxSizing = 'border-box';
|
|
349
|
+
} else if (sources.length === 1 && source?.kind === 'token') {
|
|
350
|
+
visual.style.border = source.borderColor ? `1px solid ${source.borderColor}` : '0';
|
|
351
|
+
visual.style.boxSizing = 'border-box';
|
|
352
|
+
const mainImage = visual.querySelector(':scope > .ok-native-list-visual-main');
|
|
353
|
+
if (mainImage) {
|
|
354
|
+
mainImage.style.width = '100%';
|
|
355
|
+
mainImage.style.height = '100%';
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
});
|
|
307
359
|
Object.assign(v.text.style, {
|
|
308
360
|
minWidth: '0',
|
|
309
361
|
flex: '1 1 auto',
|
|
@@ -239,6 +239,7 @@ function updateCell(view, cell, primitives, index) {
|
|
|
239
239
|
view.resting?.replaceChildren(...(cell.secondary ?? []).map(part => textPart(document, part, true)));
|
|
240
240
|
if (view.hover) {
|
|
241
241
|
const button = view.hover.querySelector('button');
|
|
242
|
+
view.hover.parentElement?.querySelector('button')?.setAttribute('aria-label', cell.hoverActionLabel ?? 'Copy address');
|
|
242
243
|
for (const child of [...view.hover.children]) if (child !== button) child.remove();
|
|
243
244
|
for (const part of cell.hoverSecondary ?? []) view.hover.insertBefore(textPart(document, part, true), button);
|
|
244
245
|
}
|
|
@@ -122,7 +122,7 @@ function recycleLegacy(body) {
|
|
|
122
122
|
v.imageKey = v.networkKey = '';
|
|
123
123
|
}
|
|
124
124
|
const galleries = new WeakMap();
|
|
125
|
-
const isGalleryMedia = row => row.variant === 'gallery' && !row.image;
|
|
125
|
+
const isGalleryMedia = row => row.variant === 'gallery' && (!row.image || !!row.media && !row.imageState);
|
|
126
126
|
function clearGalleryMedia(v) {
|
|
127
127
|
v.epoch += 1;
|
|
128
128
|
v.frame.style.borderRadius = '10px';
|
|
@@ -249,7 +249,7 @@ function bindGallery(body, row, primitives) {
|
|
|
249
249
|
v.mediaKey = mediaKey;
|
|
250
250
|
v.fallback.style.visibility = 'visible';
|
|
251
251
|
const epoch = v.epoch;
|
|
252
|
-
const source = row.media?.source;
|
|
252
|
+
const source = row.imageState ? undefined : row.media?.source;
|
|
253
253
|
const probe = attempt => {
|
|
254
254
|
if (v.epoch !== epoch) return;
|
|
255
255
|
const kind = row.media?.probeOrder[attempt];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-native-list",
|
|
3
|
-
"version": "6.7.0-
|
|
3
|
+
"version": "6.7.0-5",
|
|
4
4
|
"description": "Template-driven native RecyclerView and UICollectionView for React Native",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"typescript": "^5.9.2"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@onekeyfe/react-native-image": "6.7.0-
|
|
90
|
-
"@onekeyfe/react-native-native-logger": "6.7.0-
|
|
89
|
+
"@onekeyfe/react-native-image": "6.7.0-5",
|
|
90
|
+
"@onekeyfe/react-native-native-logger": "6.7.0-5",
|
|
91
91
|
"react": "*",
|
|
92
92
|
"react-native": "*",
|
|
93
93
|
"react-native-nitro-modules": "0.37.0"
|
|
@@ -987,7 +987,10 @@ function configureWebImageRetry(
|
|
|
987
987
|
}
|
|
988
988
|
if (orderedFallbacks !== undefined && retryCount >= retryLimit) {
|
|
989
989
|
if (fallbackIndex >= orderedFallbacks.length) return;
|
|
990
|
-
|
|
990
|
+
let nextUri: string | undefined;
|
|
991
|
+
while (!nextUri && fallbackIndex < orderedFallbacks.length) {
|
|
992
|
+
nextUri = safeImageUri(orderedFallbacks[fallbackIndex++]);
|
|
993
|
+
}
|
|
991
994
|
if (!nextUri) return;
|
|
992
995
|
event.stopImmediatePropagation();
|
|
993
996
|
retryCount = 0;
|
|
@@ -179,6 +179,14 @@ type HistoryViews = {
|
|
|
179
179
|
actions: HTMLElement;
|
|
180
180
|
actionButtons: Map<string, HTMLButtonElement>;
|
|
181
181
|
visualKey: string;
|
|
182
|
+
visuals: {
|
|
183
|
+
node: HTMLElement;
|
|
184
|
+
style: RowVisualStyle;
|
|
185
|
+
background: string;
|
|
186
|
+
loaded: boolean;
|
|
187
|
+
fallback?: HTMLElement;
|
|
188
|
+
fallbackStyle?: RowVisualStyle;
|
|
189
|
+
}[];
|
|
182
190
|
primitives: RowPrimitives;
|
|
183
191
|
};
|
|
184
192
|
const histories = new WeakMap<HTMLElement, HistoryViews>();
|
|
@@ -255,6 +263,7 @@ function createHistory(body: HTMLElement, primitives: RowPrimitives) {
|
|
|
255
263
|
actions,
|
|
256
264
|
actionButtons: new Map(),
|
|
257
265
|
visualKey: '',
|
|
266
|
+
visuals: [],
|
|
258
267
|
primitives,
|
|
259
268
|
};
|
|
260
269
|
histories.set(body, v);
|
|
@@ -400,98 +409,156 @@ function bindHistory(
|
|
|
400
409
|
primitives.dispose(n as HTMLElement)
|
|
401
410
|
);
|
|
402
411
|
v.visual.replaceChildren();
|
|
412
|
+
v.visuals = [];
|
|
403
413
|
const sources = [row.leading, row.secondaryLeading].filter(Boolean);
|
|
404
|
-
sources.forEach((source
|
|
414
|
+
sources.forEach((source) => {
|
|
405
415
|
const visual = primitives.visual(source);
|
|
406
416
|
if (!visual) return;
|
|
407
|
-
const size = sources.length > 1 ? (index ? 28 : 24) : 40;
|
|
408
|
-
new RowVisualStyle(visual).apply(row.style?.image, size, size, 0);
|
|
409
|
-
Object.assign(visual.style, {
|
|
410
|
-
display: 'inline-flex',
|
|
411
|
-
alignItems: 'center',
|
|
412
|
-
justifyContent: 'center',
|
|
413
|
-
});
|
|
414
|
-
if (sources.length > 1)
|
|
415
|
-
Object.assign(visual.style, {
|
|
416
|
-
position: 'absolute',
|
|
417
|
-
left: index ? '12px' : '0',
|
|
418
|
-
top: index ? '12px' : '0',
|
|
419
|
-
border: index ? '2px solid var(--nl-row)' : '0',
|
|
420
|
-
boxSizing: 'border-box',
|
|
421
|
-
});
|
|
422
417
|
historyIcon(visual, source, table || sources.length > 1 ? 24 : 28);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
source && 'borderColor' in source && source.borderColor
|
|
442
|
-
? `1px solid ${source.borderColor}`
|
|
443
|
-
: '0',
|
|
444
|
-
});
|
|
445
|
-
token.append(
|
|
446
|
-
...Array.from(visual.children).filter(
|
|
447
|
-
(child) => !child.classList.contains('ok-native-list-visual-corner')
|
|
448
|
-
)
|
|
449
|
-
);
|
|
450
|
-
const fallback = token.querySelector<HTMLElement>(
|
|
451
|
-
':scope > .ok-native-list-visual-fallback'
|
|
452
|
-
);
|
|
453
|
-
if (fallback) {
|
|
454
|
-
fallback.style.width = '24px';
|
|
455
|
-
fallback.style.height = '24px';
|
|
456
|
-
fallback.style.flexShrink = '0';
|
|
457
|
-
}
|
|
458
|
-
const mainImage = token.querySelector<HTMLImageElement>(
|
|
459
|
-
':scope > .ok-native-list-visual-main'
|
|
460
|
-
);
|
|
461
|
-
if (mainImage) {
|
|
462
|
-
mainImage.style.width = '100%';
|
|
463
|
-
mainImage.style.height = '100%';
|
|
464
|
-
}
|
|
465
|
-
visual.append(token);
|
|
466
|
-
}
|
|
467
|
-
if (table) {
|
|
468
|
-
visual.style.background =
|
|
469
|
-
source && 'backgroundColor' in source && source.backgroundColor
|
|
470
|
-
? source.backgroundColor
|
|
471
|
-
: 'var(--nl-strong)';
|
|
472
|
-
const borderColor =
|
|
473
|
-
source && 'borderColor' in source && source.borderColor
|
|
474
|
-
? source.borderColor
|
|
475
|
-
: 'var(--nl-separator)';
|
|
476
|
-
visual.style.border = `1px solid ${borderColor}`;
|
|
477
|
-
visual.style.boxSizing = 'border-box';
|
|
478
|
-
} else if (sources.length === 1 && source?.kind === 'token') {
|
|
479
|
-
visual.style.border = source.borderColor
|
|
480
|
-
? `1px solid ${source.borderColor}`
|
|
481
|
-
: '0';
|
|
482
|
-
visual.style.boxSizing = 'border-box';
|
|
483
|
-
const mainImage = visual.querySelector<HTMLImageElement>(
|
|
484
|
-
':scope > .ok-native-list-visual-main'
|
|
485
|
-
);
|
|
486
|
-
if (mainImage) {
|
|
487
|
-
mainImage.style.width = '100%';
|
|
488
|
-
mainImage.style.height = '100%';
|
|
489
|
-
}
|
|
418
|
+
const retained = {
|
|
419
|
+
node: visual,
|
|
420
|
+
style: new RowVisualStyle(visual),
|
|
421
|
+
background: visual.style.background,
|
|
422
|
+
loaded: false,
|
|
423
|
+
};
|
|
424
|
+
// Only placeholder-backed sources restore their frame background on load.
|
|
425
|
+
const image = source && 'image' in source ? source.image : undefined;
|
|
426
|
+
if (image?.loadingStrategy && image.loadingStrategy !== 'none') {
|
|
427
|
+
visual
|
|
428
|
+
.querySelector('.ok-native-list-visual-main')
|
|
429
|
+
?.addEventListener('load', () => {
|
|
430
|
+
retained.background =
|
|
431
|
+
source && 'backgroundColor' in source && source.backgroundColor
|
|
432
|
+
? source.backgroundColor
|
|
433
|
+
: 'transparent';
|
|
434
|
+
retained.loaded = true;
|
|
435
|
+
});
|
|
490
436
|
}
|
|
437
|
+
v.visuals.push(retained);
|
|
491
438
|
v.visual.append(visual);
|
|
492
439
|
});
|
|
493
440
|
v.visualKey = visualKey;
|
|
494
441
|
}
|
|
442
|
+
const sources = [row.leading, row.secondaryLeading].filter(Boolean);
|
|
443
|
+
v.visuals.forEach((retained, index) => {
|
|
444
|
+
const { node: visual, style, background, loaded } = retained;
|
|
445
|
+
const source = sources[index];
|
|
446
|
+
const previousToken = visual.querySelector<HTMLElement>(
|
|
447
|
+
':scope > .ok-native-list-history-token'
|
|
448
|
+
);
|
|
449
|
+
if (previousToken) {
|
|
450
|
+
visual.append(...Array.from(previousToken.children));
|
|
451
|
+
previousToken.remove();
|
|
452
|
+
}
|
|
453
|
+
const currentFallback = visual.querySelector<HTMLElement>(
|
|
454
|
+
':scope > .ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)'
|
|
455
|
+
);
|
|
456
|
+
if (currentFallback && retained.fallback !== currentFallback) {
|
|
457
|
+
retained.fallback = currentFallback;
|
|
458
|
+
retained.fallbackStyle = new RowVisualStyle(currentFallback);
|
|
459
|
+
}
|
|
460
|
+
// A terminal image error creates a new fallback node after the factory bind.
|
|
461
|
+
retained.fallbackStyle?.restore();
|
|
462
|
+
const size = sources.length > 1 ? (index ? 28 : 24) : 40;
|
|
463
|
+
style.apply(row.style?.image, size, size, 0);
|
|
464
|
+
Object.assign(visual.style, {
|
|
465
|
+
background,
|
|
466
|
+
position: '',
|
|
467
|
+
left: '',
|
|
468
|
+
top: '',
|
|
469
|
+
});
|
|
470
|
+
const svg = visual.querySelector<SVGElement>(
|
|
471
|
+
'.ok-native-list-visual-fallback > svg'
|
|
472
|
+
);
|
|
473
|
+
if (svg) {
|
|
474
|
+
const iconSize = String(table || sources.length > 1 ? 24 : 28);
|
|
475
|
+
svg.setAttribute('width', iconSize);
|
|
476
|
+
svg.setAttribute('height', iconSize);
|
|
477
|
+
}
|
|
478
|
+
Object.assign(visual.style, {
|
|
479
|
+
display: 'inline-flex',
|
|
480
|
+
alignItems: 'center',
|
|
481
|
+
justifyContent: 'center',
|
|
482
|
+
});
|
|
483
|
+
if (sources.length > 1)
|
|
484
|
+
Object.assign(visual.style, {
|
|
485
|
+
position: 'absolute',
|
|
486
|
+
left: index ? '12px' : '0',
|
|
487
|
+
top: index ? '12px' : '0',
|
|
488
|
+
border: index ? '2px solid var(--nl-row)' : '0',
|
|
489
|
+
boxSizing: 'border-box',
|
|
490
|
+
});
|
|
491
|
+
if (!table && sources.length > 1) {
|
|
492
|
+
const token = visual.ownerDocument.createElement('span');
|
|
493
|
+
token.className = 'ok-native-list-history-token';
|
|
494
|
+
Object.assign(token.style, {
|
|
495
|
+
display: 'flex',
|
|
496
|
+
alignItems: 'center',
|
|
497
|
+
justifyContent: 'center',
|
|
498
|
+
position: 'relative',
|
|
499
|
+
width: '24px',
|
|
500
|
+
height: '24px',
|
|
501
|
+
flex: '0 0 24px',
|
|
502
|
+
borderRadius: 'inherit',
|
|
503
|
+
boxSizing: 'border-box',
|
|
504
|
+
overflow: 'hidden',
|
|
505
|
+
background:
|
|
506
|
+
source && 'backgroundColor' in source
|
|
507
|
+
? source.backgroundColor ?? ''
|
|
508
|
+
: '',
|
|
509
|
+
border:
|
|
510
|
+
source && 'borderColor' in source && source.borderColor
|
|
511
|
+
? `1px solid ${source.borderColor}`
|
|
512
|
+
: '0',
|
|
513
|
+
});
|
|
514
|
+
token.append(
|
|
515
|
+
...Array.from(visual.children).filter(
|
|
516
|
+
(child) => !child.classList.contains('ok-native-list-visual-corner')
|
|
517
|
+
)
|
|
518
|
+
);
|
|
519
|
+
const fallback = token.querySelector<HTMLElement>(
|
|
520
|
+
':scope > .ok-native-list-visual-fallback'
|
|
521
|
+
);
|
|
522
|
+
if (fallback) {
|
|
523
|
+
fallback.style.width = '24px';
|
|
524
|
+
fallback.style.height = '24px';
|
|
525
|
+
fallback.style.flexShrink = '0';
|
|
526
|
+
}
|
|
527
|
+
const mainImage = token.querySelector<HTMLImageElement>(
|
|
528
|
+
':scope > .ok-native-list-visual-main'
|
|
529
|
+
);
|
|
530
|
+
if (mainImage) {
|
|
531
|
+
mainImage.style.width = '100%';
|
|
532
|
+
mainImage.style.height = '100%';
|
|
533
|
+
}
|
|
534
|
+
visual.append(token);
|
|
535
|
+
}
|
|
536
|
+
if (table) {
|
|
537
|
+
visual.style.background = loaded
|
|
538
|
+
? background
|
|
539
|
+
: source && 'backgroundColor' in source && source.backgroundColor
|
|
540
|
+
? source.backgroundColor
|
|
541
|
+
: 'var(--nl-strong)';
|
|
542
|
+
const borderColor =
|
|
543
|
+
source && 'borderColor' in source && source.borderColor
|
|
544
|
+
? source.borderColor
|
|
545
|
+
: 'var(--nl-separator)';
|
|
546
|
+
visual.style.border = `1px solid ${borderColor}`;
|
|
547
|
+
visual.style.boxSizing = 'border-box';
|
|
548
|
+
} else if (sources.length === 1 && source?.kind === 'token') {
|
|
549
|
+
visual.style.border = source.borderColor
|
|
550
|
+
? `1px solid ${source.borderColor}`
|
|
551
|
+
: '0';
|
|
552
|
+
visual.style.boxSizing = 'border-box';
|
|
553
|
+
const mainImage = visual.querySelector<HTMLImageElement>(
|
|
554
|
+
':scope > .ok-native-list-visual-main'
|
|
555
|
+
);
|
|
556
|
+
if (mainImage) {
|
|
557
|
+
mainImage.style.width = '100%';
|
|
558
|
+
mainImage.style.height = '100%';
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
});
|
|
495
562
|
Object.assign(v.text.style, {
|
|
496
563
|
minWidth: '0',
|
|
497
564
|
flex: '1 1 auto',
|
|
@@ -344,6 +344,9 @@ function updateCell(
|
|
|
344
344
|
);
|
|
345
345
|
if (view.hover) {
|
|
346
346
|
const button = view.hover.querySelector('button');
|
|
347
|
+
view.hover.parentElement
|
|
348
|
+
?.querySelector('button')
|
|
349
|
+
?.setAttribute('aria-label', cell.hoverActionLabel ?? 'Copy address');
|
|
347
350
|
for (const child of [...view.hover.children])
|
|
348
351
|
if (child !== button) child.remove();
|
|
349
352
|
for (const part of cell.hoverSecondary ?? [])
|
|
@@ -192,7 +192,7 @@ type GalleryViews = {
|
|
|
192
192
|
};
|
|
193
193
|
const galleries = new WeakMap<HTMLElement, GalleryViews>();
|
|
194
194
|
const isGalleryMedia = (row: MediaTileRow) =>
|
|
195
|
-
row.variant === 'gallery' && !row.image;
|
|
195
|
+
row.variant === 'gallery' && (!row.image || (!!row.media && !row.imageState));
|
|
196
196
|
|
|
197
197
|
function clearGalleryMedia(v: GalleryViews) {
|
|
198
198
|
v.epoch += 1;
|
|
@@ -332,7 +332,7 @@ function bindGallery(
|
|
|
332
332
|
v.mediaKey = mediaKey;
|
|
333
333
|
v.fallback.style.visibility = 'visible';
|
|
334
334
|
const epoch = v.epoch;
|
|
335
|
-
const source = row.media?.source;
|
|
335
|
+
const source = row.imageState ? undefined : row.media?.source;
|
|
336
336
|
const probe = (attempt: number) => {
|
|
337
337
|
if (v.epoch !== epoch) return;
|
|
338
338
|
const kind = row.media?.probeOrder[attempt];
|