@onekeyfe/react-native-native-list 6.7.0-alpha.466 → 6.8.0-10
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/README.md +312 -379
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +15 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +60 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +75 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +25 -19
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListDescriptionTouchPolicyTest.kt +153 -0
- package/docs/ROW_TEMPLATES.md +11 -4
- package/docs/SPEC.md +296 -20
- package/docs/STYLE_SPEC.md +12 -0
- package/ios/NativeListActivityDetailsView.swift +13 -5
- package/ios/NativeListMediaPlaceholderView.swift +189 -0
- package/ios/NativeListMediaPreviewSlot.swift +122 -61
- package/ios/NativeListMediaTileRenderer.swift +13 -13
- package/ios/NativeListResolvedText.swift +15 -4
- package/ios/NativeListTextLabel.swift +106 -0
- package/ios/RNCNativeListView.swift +129 -32
- package/ios/tests/NativeListActivityPresentationTests.swift +270 -0
- package/ios/tests/NativeListLifecycleTests.swift +369 -40
- package/ios/tests/NativeListMediaVisibilityTests.swift +41 -7
- package/lib/module/NativeList.js +17 -4
- package/lib/module/NativeList.web.js +3 -1
- package/lib/module/validation.js +53 -4
- package/lib/module/web/NativeListGeneratedIcons.js +1 -0
- package/lib/module/web/NativeListWebEngine.js +13 -11
- package/lib/module/web/templates/ActivityRowRenderer.js +29 -23
- package/lib/module/web/templates/DataRowRenderer.js +54 -1
- package/lib/module/web/templates/IdentityRowRenderer.js +3 -1
- package/lib/module/web/templates/MediaTileRowRenderer.js +84 -15
- package/lib/typescript/src/models.d.ts +18 -1
- package/package.json +1 -1
- package/scripts/generate-icons.test.mjs +1 -0
- package/scripts/native-list-icons.json +1 -1
- package/src/NativeList.tsx +25 -4
- package/src/NativeList.web.tsx +1 -1
- package/src/models.ts +18 -0
- package/src/validation.ts +96 -1
- package/src/web/NativeListGeneratedIcons.ts +1 -0
- package/src/web/NativeListWebEngine.ts +16 -11
- package/src/web/templates/ActivityRowRenderer.ts +42 -32
- package/src/web/templates/DataRowRenderer.ts +76 -1
- package/src/web/templates/IdentityRowRenderer.ts +3 -3
- package/src/web/templates/MediaTileRowRenderer.ts +90 -15
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
|
|
4
3
|
const views = new WeakMap();
|
|
5
4
|
function bindLegacy(body, row, primitives) {
|
|
6
5
|
const v = views.get(body);
|
|
@@ -123,6 +122,79 @@ function recycleLegacy(body) {
|
|
|
123
122
|
v.imageKey = v.networkKey = '';
|
|
124
123
|
}
|
|
125
124
|
const galleries = new WeakMap();
|
|
125
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
126
|
+
let glyphMaskId = 0;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Placeholder glyphs share one 24pt geometry with the iOS and Android renderers:
|
|
130
|
+
* a rounded frame with a sun and a ridge; the failed glyph adds a slash and cuts
|
|
131
|
+
* a gap into the frame around it.
|
|
132
|
+
*/
|
|
133
|
+
function createMediaGlyph(document, state) {
|
|
134
|
+
const svg = document.createElementNS(SVG_NS, 'svg');
|
|
135
|
+
svg.setAttribute('viewBox', '0 0 24 24');
|
|
136
|
+
svg.setAttribute('fill', 'none');
|
|
137
|
+
svg.setAttribute('stroke', 'currentColor');
|
|
138
|
+
svg.setAttribute('stroke-width', '1.5');
|
|
139
|
+
svg.setAttribute('stroke-linecap', 'round');
|
|
140
|
+
svg.setAttribute('stroke-linejoin', 'round');
|
|
141
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
142
|
+
const shape = (tag, attributes) => {
|
|
143
|
+
const node = document.createElementNS(SVG_NS, tag);
|
|
144
|
+
Object.entries(attributes).forEach(([key, value]) => node.setAttribute(key, value));
|
|
145
|
+
return node;
|
|
146
|
+
};
|
|
147
|
+
const picture = shape('g', {});
|
|
148
|
+
picture.append(shape('rect', {
|
|
149
|
+
x: '3',
|
|
150
|
+
y: '3',
|
|
151
|
+
width: '18',
|
|
152
|
+
height: '18',
|
|
153
|
+
rx: '4'
|
|
154
|
+
}), shape('circle', {
|
|
155
|
+
cx: '9',
|
|
156
|
+
cy: '9',
|
|
157
|
+
r: '1.6'
|
|
158
|
+
}), shape('path', {
|
|
159
|
+
d: 'M5 20.5L14.5 11L21 17.5'
|
|
160
|
+
}));
|
|
161
|
+
if (state === 'failed') {
|
|
162
|
+
glyphMaskId += 1;
|
|
163
|
+
const id = `ok-native-list-media-cut-${glyphMaskId}`;
|
|
164
|
+
const mask = shape('mask', {
|
|
165
|
+
id,
|
|
166
|
+
maskUnits: 'userSpaceOnUse'
|
|
167
|
+
});
|
|
168
|
+
mask.append(shape('rect', {
|
|
169
|
+
x: '0',
|
|
170
|
+
y: '0',
|
|
171
|
+
width: '24',
|
|
172
|
+
height: '24',
|
|
173
|
+
fill: '#fff',
|
|
174
|
+
stroke: 'none'
|
|
175
|
+
}), shape('path', {
|
|
176
|
+
d: 'M2.6 -0.6L24.6 21.4L21.4 24.6L-0.6 2.6Z',
|
|
177
|
+
fill: '#000',
|
|
178
|
+
stroke: 'none'
|
|
179
|
+
}));
|
|
180
|
+
picture.setAttribute('mask', `url(#${id})`);
|
|
181
|
+
svg.append(mask, picture, shape('path', {
|
|
182
|
+
d: 'M3 3L21 21'
|
|
183
|
+
}));
|
|
184
|
+
} else svg.append(picture);
|
|
185
|
+
const wrap = document.createElement('div');
|
|
186
|
+
wrap.className = 'ok-native-list-media-glyph';
|
|
187
|
+
wrap.dataset.glyph = state;
|
|
188
|
+
wrap.append(svg);
|
|
189
|
+
return wrap;
|
|
190
|
+
}
|
|
191
|
+
const SWEEP_PERIOD_MS = 1600;
|
|
192
|
+
function setPlaceholderState(v, state) {
|
|
193
|
+
v.fallback.dataset.state = state;
|
|
194
|
+
if (state === 'loading')
|
|
195
|
+
// Keep every loading tile on one sweep phase, including recycled rows.
|
|
196
|
+
v.fallback.style.setProperty('--nl-media-sweep-delay', `-${Math.round(performance.now() % SWEEP_PERIOD_MS)}ms`);
|
|
197
|
+
}
|
|
126
198
|
const isGalleryMedia = row => row.variant === 'gallery' && (!row.image || !!row.media && !row.imageState);
|
|
127
199
|
function clearGalleryMedia(v) {
|
|
128
200
|
v.epoch += 1;
|
|
@@ -149,18 +221,7 @@ function initGallery(body, primitives) {
|
|
|
149
221
|
};
|
|
150
222
|
const frame = element('ok-native-list-media-image');
|
|
151
223
|
const fallback = element('ok-native-list-media-fallback');
|
|
152
|
-
|
|
153
|
-
fallback.append(svg);
|
|
154
|
-
Object.assign(fallback.style, {
|
|
155
|
-
position: 'absolute',
|
|
156
|
-
inset: '0',
|
|
157
|
-
display: 'flex',
|
|
158
|
-
alignItems: 'center',
|
|
159
|
-
justifyContent: 'center',
|
|
160
|
-
color: 'var(--nl-disabled)',
|
|
161
|
-
borderRadius: '10px',
|
|
162
|
-
background: 'var(--nl-strong)'
|
|
163
|
-
});
|
|
224
|
+
fallback.append(element('ok-native-list-media-hatch'), element('ok-native-list-media-sheen'), createMediaGlyph(document, 'loading'), createMediaGlyph(document, 'failed'));
|
|
164
225
|
const metadata = element('ok-native-list-media-meta');
|
|
165
226
|
const subtitleLine = element('ok-native-list-media-subtitle-row');
|
|
166
227
|
const subtitle = element('ok-native-list-media-subtitle');
|
|
@@ -240,10 +301,14 @@ function bindGallery(body, row, primitives) {
|
|
|
240
301
|
v.fallback.style.visibility = 'visible';
|
|
241
302
|
const epoch = v.epoch;
|
|
242
303
|
const source = row.imageState ? undefined : row.media?.source;
|
|
304
|
+
setPlaceholderState(v, source?.uri && row.media?.probeOrder.length ? 'loading' : 'failed');
|
|
243
305
|
const probe = attempt => {
|
|
244
306
|
if (v.epoch !== epoch) return;
|
|
245
307
|
const kind = row.media?.probeOrder[attempt];
|
|
246
|
-
if (!source?.uri || !kind)
|
|
308
|
+
if (!source?.uri || !kind) {
|
|
309
|
+
setPlaceholderState(v, 'failed');
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
247
312
|
const media = body.ownerDocument.createElement(kind === 'video' ? 'video' : 'img');
|
|
248
313
|
v.frame.style.borderRadius = kind === 'video' ? '0' : '10px';
|
|
249
314
|
Object.assign(media.style, {
|
|
@@ -284,7 +349,11 @@ function bindGallery(body, row, primitives) {
|
|
|
284
349
|
probe(attempt + 1);
|
|
285
350
|
};
|
|
286
351
|
const ready = () => {
|
|
287
|
-
if (v.epoch === epoch && v.media === media)
|
|
352
|
+
if (v.epoch === epoch && v.media === media) {
|
|
353
|
+
v.fallback.style.visibility = 'hidden';
|
|
354
|
+
// Stops the sweep animation behind the picture.
|
|
355
|
+
setPlaceholderState(v, 'loaded');
|
|
356
|
+
}
|
|
288
357
|
};
|
|
289
358
|
if (media.tagName === 'VIDEO') media.onloadeddata = ready;else media.onload = ready;
|
|
290
359
|
v.media = media;
|
|
@@ -493,6 +493,14 @@ export type ActivityRow = RowBase & Readonly<{
|
|
|
493
493
|
hidden?: boolean;
|
|
494
494
|
}>;
|
|
495
495
|
descriptionActionKey?: string;
|
|
496
|
+
/**
|
|
497
|
+
* UTF-16 offset into `description` where the text that opens
|
|
498
|
+
* `descriptionActionKey` starts; the text before it stays plain. An integer
|
|
499
|
+
* in `0...description.length`: `0`, the default, makes the whole
|
|
500
|
+
* description the action and `description.length` leaves no action text.
|
|
501
|
+
* Ignored without `descriptionActionKey`.
|
|
502
|
+
*/
|
|
503
|
+
descriptionActionStart?: number;
|
|
496
504
|
footerActions?: readonly FooterAction[];
|
|
497
505
|
style?: ActivityRowStyle;
|
|
498
506
|
}>;
|
|
@@ -516,6 +524,15 @@ export type DataColumn = Readonly<{
|
|
|
516
524
|
textSegments?: readonly ValueTextSegment[];
|
|
517
525
|
titleIcon?: IdentityRow['titleIcon'];
|
|
518
526
|
secondaryTitleIcon?: IdentityRow['titleIcon'];
|
|
527
|
+
/**
|
|
528
|
+
* Web-only passive label before the primary column text. The caller supplies
|
|
529
|
+
* both colors as #RRGGBB or #RRGGBBAA; native renderers ignore the field.
|
|
530
|
+
*/
|
|
531
|
+
webLeadingBadge?: Readonly<{
|
|
532
|
+
text: string;
|
|
533
|
+
textColor: string;
|
|
534
|
+
backgroundColor: string;
|
|
535
|
+
}>;
|
|
519
536
|
secondaryLeadingText?: string;
|
|
520
537
|
secondaryText?: string;
|
|
521
538
|
secondaryTextSegments?: readonly ValueTextSegment[];
|
|
@@ -888,7 +905,7 @@ export type RowPatch = Readonly<{
|
|
|
888
905
|
}> | Readonly<{
|
|
889
906
|
type: 'activity';
|
|
890
907
|
key: string;
|
|
891
|
-
changes: PatchClearableChanges<ActivityRow, CommonPatchFields | 'title' | 'description' | 'status' | 'amounts' | 'badges' | 'presentation' | 'fee' | 'descriptionActionKey' | 'primaryAmount' | 'secondaryAmount' | 'leading' | 'hideLeading' | 'secondaryLeading' | 'footerActions'>;
|
|
908
|
+
changes: PatchClearableChanges<ActivityRow, CommonPatchFields | 'title' | 'description' | 'status' | 'amounts' | 'badges' | 'presentation' | 'fee' | 'descriptionActionKey' | 'descriptionActionStart' | 'primaryAmount' | 'secondaryAmount' | 'leading' | 'hideLeading' | 'secondaryLeading' | 'footerActions'>;
|
|
892
909
|
}> | Readonly<{
|
|
893
910
|
type: 'message';
|
|
894
911
|
key: string;
|
package/package.json
CHANGED
package/src/NativeList.tsx
CHANGED
|
@@ -185,10 +185,21 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
185
185
|
}
|
|
186
186
|
const expandedEpoch = disclosureSlotMounts.current.expandedEpoch;
|
|
187
187
|
const toggleEpoch = disclosureSlotMounts.current.toggleEpoch;
|
|
188
|
+
const iosHeaderPresent = Platform.OS === 'ios' && listHeader != null;
|
|
188
189
|
const [slotMeasurements, setSlotMeasurements] = useState({
|
|
189
190
|
heights: [0, 0, 0, 0, 0, 0],
|
|
190
191
|
readyEpochs: [-1, -1, -1, -1, -1, -1],
|
|
192
|
+
iosHeaderPresent,
|
|
193
|
+
headerEpoch: 0,
|
|
191
194
|
});
|
|
195
|
+
if (slotMeasurements.iosHeaderPresent !== iosHeaderPresent) {
|
|
196
|
+
setSlotMeasurements({
|
|
197
|
+
...slotMeasurements,
|
|
198
|
+
iosHeaderPresent,
|
|
199
|
+
headerEpoch: slotMeasurements.headerEpoch + 1,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
const headerEpoch = slotMeasurements.headerEpoch;
|
|
192
203
|
const hasSidecar = listSidecar !== undefined;
|
|
193
204
|
const sidecarWidth = sidecarLayout?.width;
|
|
194
205
|
const sidecarGap = sidecarLayout?.gap;
|
|
@@ -321,7 +332,12 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
321
332
|
parseInt(String(Platform.Version), 10) >= 26 &&
|
|
322
333
|
(topScrollEdgeEffect === 'hard' || topScrollEdgeEffect === 'soft') &&
|
|
323
334
|
topOverlay != null;
|
|
324
|
-
const containerSlotHeightsJson = JSON.stringify(
|
|
335
|
+
const containerSlotHeightsJson = JSON.stringify(
|
|
336
|
+
Platform.OS === 'ios' &&
|
|
337
|
+
(!iosHeaderPresent || slotMeasurements.readyEpochs[0] !== headerEpoch)
|
|
338
|
+
? [iosHeaderPresent ? null : 0, ...slotHeights.slice(1)]
|
|
339
|
+
: slotHeights
|
|
340
|
+
);
|
|
325
341
|
const defaultSlotInset =
|
|
326
342
|
snapshot.layout.contentPaddingHorizontal ??
|
|
327
343
|
snapshot.layout.contentPadding ??
|
|
@@ -351,6 +367,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
351
367
|
return;
|
|
352
368
|
}
|
|
353
369
|
setSlotMeasurements((previous) => {
|
|
370
|
+
if (index === 0 && epoch !== previous.headerEpoch) return previous;
|
|
354
371
|
if (
|
|
355
372
|
previous.heights[index] === height &&
|
|
356
373
|
previous.readyEpochs[index] === epoch
|
|
@@ -361,7 +378,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
361
378
|
const readyEpochs = [...previous.readyEpochs];
|
|
362
379
|
heights[index] = height;
|
|
363
380
|
readyEpochs[index] = epoch;
|
|
364
|
-
return { heights, readyEpochs };
|
|
381
|
+
return { ...previous, heights, readyEpochs };
|
|
365
382
|
});
|
|
366
383
|
};
|
|
367
384
|
const sidecarLayoutJson = sidecarLayout
|
|
@@ -835,7 +852,11 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
835
852
|
>
|
|
836
853
|
{slotContents.map((content, index) => (
|
|
837
854
|
<View
|
|
838
|
-
key={
|
|
855
|
+
key={
|
|
856
|
+
index === 0 && Platform.OS === 'ios'
|
|
857
|
+
? `header-${headerEpoch}`
|
|
858
|
+
: index
|
|
859
|
+
}
|
|
839
860
|
collapsable={false}
|
|
840
861
|
style={{
|
|
841
862
|
position: 'absolute',
|
|
@@ -849,7 +870,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
849
870
|
recordSlotLayout(
|
|
850
871
|
index,
|
|
851
872
|
Math.ceil(event.nativeEvent.layout.height),
|
|
852
|
-
0
|
|
873
|
+
index === 0 ? headerEpoch : 0
|
|
853
874
|
);
|
|
854
875
|
}
|
|
855
876
|
}}
|
package/src/NativeList.web.tsx
CHANGED
|
@@ -617,7 +617,7 @@ export const NativeList = forwardRef<NativeListRef, NativeListProps>(
|
|
|
617
617
|
pointerEvents={slotState.disclosurePresent ? 'auto' : 'none'}
|
|
618
618
|
style={
|
|
619
619
|
slotState.disclosurePresent
|
|
620
|
-
?
|
|
620
|
+
? { marginHorizontal: -padding }
|
|
621
621
|
: collapsedExpandedContentStyle
|
|
622
622
|
}
|
|
623
623
|
>
|
package/src/models.ts
CHANGED
|
@@ -616,6 +616,14 @@ export type ActivityRow = RowBase &
|
|
|
616
616
|
hidden?: boolean;
|
|
617
617
|
}>;
|
|
618
618
|
descriptionActionKey?: string;
|
|
619
|
+
/**
|
|
620
|
+
* UTF-16 offset into `description` where the text that opens
|
|
621
|
+
* `descriptionActionKey` starts; the text before it stays plain. An integer
|
|
622
|
+
* in `0...description.length`: `0`, the default, makes the whole
|
|
623
|
+
* description the action and `description.length` leaves no action text.
|
|
624
|
+
* Ignored without `descriptionActionKey`.
|
|
625
|
+
*/
|
|
626
|
+
descriptionActionStart?: number;
|
|
619
627
|
footerActions?: readonly FooterAction[];
|
|
620
628
|
style?: ActivityRowStyle;
|
|
621
629
|
}>;
|
|
@@ -642,6 +650,15 @@ export type DataColumn = Readonly<{
|
|
|
642
650
|
textSegments?: readonly ValueTextSegment[];
|
|
643
651
|
titleIcon?: IdentityRow['titleIcon'];
|
|
644
652
|
secondaryTitleIcon?: IdentityRow['titleIcon'];
|
|
653
|
+
/**
|
|
654
|
+
* Web-only passive label before the primary column text. The caller supplies
|
|
655
|
+
* both colors as #RRGGBB or #RRGGBBAA; native renderers ignore the field.
|
|
656
|
+
*/
|
|
657
|
+
webLeadingBadge?: Readonly<{
|
|
658
|
+
text: string;
|
|
659
|
+
textColor: string;
|
|
660
|
+
backgroundColor: string;
|
|
661
|
+
}>;
|
|
645
662
|
secondaryLeadingText?: string;
|
|
646
663
|
secondaryText?: string;
|
|
647
664
|
secondaryTextSegments?: readonly ValueTextSegment[];
|
|
@@ -1131,6 +1148,7 @@ export type RowPatch =
|
|
|
1131
1148
|
| 'presentation'
|
|
1132
1149
|
| 'fee'
|
|
1133
1150
|
| 'descriptionActionKey'
|
|
1151
|
+
| 'descriptionActionStart'
|
|
1134
1152
|
| 'primaryAmount'
|
|
1135
1153
|
| 'secondaryAmount'
|
|
1136
1154
|
| 'leading'
|
package/src/validation.ts
CHANGED
|
@@ -1344,6 +1344,32 @@ function assertButtonGroup(
|
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
1346
|
|
|
1347
|
+
// A passive label: its text and two caller colors, with no action or style slot.
|
|
1348
|
+
function assertWebLeadingBadge(value: unknown, path: string): void {
|
|
1349
|
+
if (value === undefined) return;
|
|
1350
|
+
const badge = protocolObject(value, path);
|
|
1351
|
+
assertUnknownKeys(
|
|
1352
|
+
badge,
|
|
1353
|
+
['text', 'textColor', 'backgroundColor'],
|
|
1354
|
+
path,
|
|
1355
|
+
'web leading badge key'
|
|
1356
|
+
);
|
|
1357
|
+
if (
|
|
1358
|
+
typeof badge.text !== 'string' ||
|
|
1359
|
+
!badge.text.trim() ||
|
|
1360
|
+
badge.text.length > MAX_TEXT_LENGTH
|
|
1361
|
+
)
|
|
1362
|
+
fail(`${path}.text`, 'must be non-blank within the text limit');
|
|
1363
|
+
for (const field of ['textColor', 'backgroundColor']) {
|
|
1364
|
+
const color = badge[field];
|
|
1365
|
+
if (
|
|
1366
|
+
typeof color !== 'string' ||
|
|
1367
|
+
!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(color)
|
|
1368
|
+
)
|
|
1369
|
+
fail(`${path}.${field}`, 'must be #RRGGBB or #RRGGBBAA');
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1347
1373
|
function assertIdentityExtras(
|
|
1348
1374
|
row: Pick<
|
|
1349
1375
|
IdentityRow,
|
|
@@ -1621,6 +1647,11 @@ function assertVisual(row: RowModel, path: string): void {
|
|
|
1621
1647
|
});
|
|
1622
1648
|
}
|
|
1623
1649
|
|
|
1650
|
+
/** The type half of the `descriptionActionStart` contract; the range needs the row. */
|
|
1651
|
+
function isDescriptionActionStart(value: unknown): value is number {
|
|
1652
|
+
return Number.isSafeInteger(value) && (value as number) >= 0;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1624
1655
|
function assertActivity(row: Partial<ActivityRow>, path: string): void {
|
|
1625
1656
|
if (row.hideLeading !== undefined && typeof row.hideLeading !== 'boolean')
|
|
1626
1657
|
fail(`${path}.hideLeading`, 'must be boolean');
|
|
@@ -1633,6 +1664,11 @@ function assertActivity(row: Partial<ActivityRow>, path: string): void {
|
|
|
1633
1664
|
fail(`${path}.presentation`, 'must be stacked or table');
|
|
1634
1665
|
if (row.descriptionActionKey !== undefined)
|
|
1635
1666
|
assertKey(row.descriptionActionKey, `${path}.descriptionActionKey`);
|
|
1667
|
+
if (
|
|
1668
|
+
row.descriptionActionStart !== undefined &&
|
|
1669
|
+
!isDescriptionActionStart(row.descriptionActionStart)
|
|
1670
|
+
)
|
|
1671
|
+
fail(`${path}.descriptionActionStart`, 'must be a non-negative integer');
|
|
1636
1672
|
if ((row.amounts?.length ?? 0) > 32)
|
|
1637
1673
|
fail(`${path}.amounts`, 'supports at most 32 amount lines');
|
|
1638
1674
|
const amountKeys = new Set<string>();
|
|
@@ -1899,6 +1935,13 @@ function assertRow(
|
|
|
1899
1935
|
break;
|
|
1900
1936
|
case 'activity':
|
|
1901
1937
|
assertActivity(row, path);
|
|
1938
|
+
// Checked on the complete row only: a patch may carry the offset
|
|
1939
|
+
// without the description it points into.
|
|
1940
|
+
if ((row.descriptionActionStart ?? 0) > (row.description?.length ?? 0))
|
|
1941
|
+
fail(
|
|
1942
|
+
`${path}.descriptionActionStart`,
|
|
1943
|
+
'must not exceed the description length'
|
|
1944
|
+
);
|
|
1902
1945
|
break;
|
|
1903
1946
|
case 'message':
|
|
1904
1947
|
if (
|
|
@@ -1922,6 +1965,10 @@ function assertRow(
|
|
|
1922
1965
|
assertKey(column.key, `${path}.columns[${columnIndex}].key`);
|
|
1923
1966
|
assertText(column.text, `${path}.columns[${columnIndex}].text`);
|
|
1924
1967
|
assertIdentityExtras(column, `${path}.columns[${columnIndex}]`);
|
|
1968
|
+
assertWebLeadingBadge(
|
|
1969
|
+
column.webLeadingBadge,
|
|
1970
|
+
`${path}.columns[${columnIndex}].webLeadingBadge`
|
|
1971
|
+
);
|
|
1925
1972
|
for (const field of [
|
|
1926
1973
|
'textSegments',
|
|
1927
1974
|
'secondaryTextSegments',
|
|
@@ -2449,6 +2496,7 @@ const ROW_FIELDS: Readonly<Record<string, readonly string[]>> = {
|
|
|
2449
2496
|
'presentation',
|
|
2450
2497
|
'fee',
|
|
2451
2498
|
'descriptionActionKey',
|
|
2499
|
+
'descriptionActionStart',
|
|
2452
2500
|
'footerActions',
|
|
2453
2501
|
],
|
|
2454
2502
|
message: [
|
|
@@ -2616,6 +2664,7 @@ const PATCH_FIELDS: Readonly<Record<string, readonly string[]>> = {
|
|
|
2616
2664
|
'amounts',
|
|
2617
2665
|
'fee',
|
|
2618
2666
|
'descriptionActionKey',
|
|
2667
|
+
'descriptionActionStart',
|
|
2619
2668
|
'footerActions',
|
|
2620
2669
|
],
|
|
2621
2670
|
message: [
|
|
@@ -3029,7 +3078,13 @@ function assertRowProtocol(row: RowModel, path: string): void {
|
|
|
3029
3078
|
row.columns.forEach((column, index) => {
|
|
3030
3079
|
const columnPath = `${path}.columns[${index}]`;
|
|
3031
3080
|
protocolObject(column, columnPath);
|
|
3032
|
-
if (isDevelopment())
|
|
3081
|
+
if (isDevelopment()) {
|
|
3082
|
+
assertIdentityExtras(column, columnPath);
|
|
3083
|
+
assertWebLeadingBadge(
|
|
3084
|
+
column.webLeadingBadge,
|
|
3085
|
+
`${columnPath}.webLeadingBadge`
|
|
3086
|
+
);
|
|
3087
|
+
}
|
|
3033
3088
|
});
|
|
3034
3089
|
if (isDevelopment())
|
|
3035
3090
|
assertTrailingAccessories(row.trailing, `${path}.trailing`);
|
|
@@ -3488,6 +3543,7 @@ const NESTED_DECORATION_FIELDS: Readonly<Record<string, readonly string[]>> = {
|
|
|
3488
3543
|
'textSegments',
|
|
3489
3544
|
'titleIcon',
|
|
3490
3545
|
'secondaryTitleIcon',
|
|
3546
|
+
'webLeadingBadge',
|
|
3491
3547
|
'secondaryLeadingText',
|
|
3492
3548
|
'secondaryText',
|
|
3493
3549
|
'secondaryTextSegments',
|
|
@@ -3562,6 +3618,26 @@ const NESTED_DECORATION_FIELDS: Readonly<Record<string, readonly string[]>> = {
|
|
|
3562
3618
|
|
|
3563
3619
|
function sanitizeDecoration(value: unknown, field: string): unknown {
|
|
3564
3620
|
if (value === undefined || value === null) return undefined;
|
|
3621
|
+
// All or nothing: a badge without valid text and both colors is dropped, and
|
|
3622
|
+
// only its three declared fields are kept.
|
|
3623
|
+
if (field === 'webLeadingBadge') {
|
|
3624
|
+
if (
|
|
3625
|
+
!isRecord(value) ||
|
|
3626
|
+
typeof value.text !== 'string' ||
|
|
3627
|
+
!value.text.trim() ||
|
|
3628
|
+
value.text.length > MAX_TEXT_LENGTH
|
|
3629
|
+
)
|
|
3630
|
+
return undefined;
|
|
3631
|
+
const { textColor, backgroundColor } = value;
|
|
3632
|
+
if (
|
|
3633
|
+
typeof textColor !== 'string' ||
|
|
3634
|
+
!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(textColor) ||
|
|
3635
|
+
typeof backgroundColor !== 'string' ||
|
|
3636
|
+
!/^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(backgroundColor)
|
|
3637
|
+
)
|
|
3638
|
+
return undefined;
|
|
3639
|
+
return { text: value.text, textColor, backgroundColor };
|
|
3640
|
+
}
|
|
3565
3641
|
if (
|
|
3566
3642
|
!Array.isArray(value) &&
|
|
3567
3643
|
[
|
|
@@ -3931,6 +4007,11 @@ function sanitizeRowForProduction(row: RowModel): RowModel {
|
|
|
3931
4007
|
delete next[field];
|
|
3932
4008
|
continue;
|
|
3933
4009
|
}
|
|
4010
|
+
if (field === 'descriptionActionStart') {
|
|
4011
|
+
// Renderers clamp an offset past the text; anything else has no meaning.
|
|
4012
|
+
if (!isDescriptionActionStart(value)) delete next[field];
|
|
4013
|
+
continue;
|
|
4014
|
+
}
|
|
3934
4015
|
if (field === 'parent' && isRecord(value))
|
|
3935
4016
|
next[field] = sanitizeRowForProduction(value as unknown as RowModel);
|
|
3936
4017
|
else if (field === 'children' && Array.isArray(value))
|
|
@@ -4377,6 +4458,10 @@ function assertPatchChanges(patch: PatchValues, index: number): void {
|
|
|
4377
4458
|
assertKey(column.key, `${path}.columns[${columnIndex}].key`);
|
|
4378
4459
|
assertText(column.text, `${path}.columns[${columnIndex}].text`);
|
|
4379
4460
|
assertIdentityExtras(column, `${path}.columns[${columnIndex}]`);
|
|
4461
|
+
assertWebLeadingBadge(
|
|
4462
|
+
column.webLeadingBadge,
|
|
4463
|
+
`${path}.columns[${columnIndex}].webLeadingBadge`
|
|
4464
|
+
);
|
|
4380
4465
|
for (const field of [
|
|
4381
4466
|
'textSegments',
|
|
4382
4467
|
'secondaryTextSegments',
|
|
@@ -4862,6 +4947,16 @@ function mergeAndValidateSingleRow(
|
|
|
4862
4947
|
)
|
|
4863
4948
|
changes.subtitle = null;
|
|
4864
4949
|
}
|
|
4950
|
+
// The offset points into one specific description string, so a patch that
|
|
4951
|
+
// replaces the description without restating it falls back to the default.
|
|
4952
|
+
if (
|
|
4953
|
+
previous.type === 'activity' &&
|
|
4954
|
+
'description' in changes &&
|
|
4955
|
+
changes.description !== previous.description &&
|
|
4956
|
+
!('descriptionActionStart' in changes) &&
|
|
4957
|
+
previous.descriptionActionStart !== undefined
|
|
4958
|
+
)
|
|
4959
|
+
changes.descriptionActionStart = null;
|
|
4865
4960
|
const merged = { ...previous } as unknown as Record<string, unknown>;
|
|
4866
4961
|
for (const [field, value] of Object.entries(changes)) {
|
|
4867
4962
|
if (value === null) delete merged[field];
|
|
@@ -18,6 +18,7 @@ export const nativeListGeneratedIcons: Readonly<Record<string, string>> = {
|
|
|
18
18
|
GasSolid: 'GasSolid',
|
|
19
19
|
GlobusOutline: 'GlobusOutline',
|
|
20
20
|
GoogleIllus: 'GoogleIllus',
|
|
21
|
+
InfoCircleOutline: 'InfoCircleOutline',
|
|
21
22
|
LockSolid: 'LockSolid',
|
|
22
23
|
PencilOutline: 'PencilOutline',
|
|
23
24
|
PlusLargeOutline: 'PlusLargeOutline',
|
|
@@ -418,6 +418,15 @@ function effectiveRows(snapshot: NativeListSnapshot): readonly RowModel[] {
|
|
|
418
418
|
return snapshot.emptyState ? [snapshot.emptyState] : [];
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
+
function isDarkBackground(color: string | undefined) {
|
|
422
|
+
const rgb = color ? /^#([0-9a-f]{6})/i.exec(color)?.[1] : undefined;
|
|
423
|
+
if (!rgb) return false;
|
|
424
|
+
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
425
|
+
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
426
|
+
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
427
|
+
return red * 299 + green * 587 + blue * 114 < 128_000;
|
|
428
|
+
}
|
|
429
|
+
|
|
421
430
|
function resolvedTheme(snapshot: NativeListSnapshot): NativeListTheme {
|
|
422
431
|
return { ...defaultTheme, ...snapshot.theme };
|
|
423
432
|
}
|
|
@@ -860,7 +869,7 @@ export const WEB_LIST_CSS = `
|
|
|
860
869
|
.ok-native-list-account-action-row{justify-content:flex-start;gap:12px;padding:0 12px}.ok-native-list-account-action-row .ok-native-list-action-title{color:var(--nl-secondary);font-size:16px;line-height:24px;font-weight:400;font-family:var(--nl-font-regular)}
|
|
861
870
|
.ok-native-list-system{justify-content:center;padding:8px 12px;background:var(--nl-bg);color:var(--nl-secondary);cursor:default}.ok-native-list-system[data-variant="retry"],.ok-native-list-system[data-variant="noMatch"],.ok-native-list-system[data-variant="end"]{justify-content:flex-start}.ok-native-list-system[data-variant="retry"]{cursor:pointer}
|
|
862
871
|
.ok-native-list-rail{padding:4px;gap:6px;border-radius:8px}.ok-native-list-rail .ok-native-list-visual{width:20px;height:20px;flex-basis:20px}.ok-native-list-rail .ok-native-list-visual>img,.ok-native-list-rail .ok-native-list-visual-main{width:20px;height:20px}.ok-native-list-rail-title{font-size:12px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}
|
|
863
|
-
.ok-native-list-media{display:block;padding:0 5px;background:transparent;border-radius:16px}.ok-native-list-media-image{display:block;width:100%;aspect-ratio:1;border-radius:10px;background:var(--nl-strong);object-fit:cover}.ok-native-list-media-image[data-state="empty"]{background:transparent}.ok-native-list-media-image[data-state="error"]{display:flex;align-items:center;justify-content:center;color:var(--nl-icon-subdued);font-size:24px}.ok-native-list-media-meta{padding-top:7px}.ok-native-list-media-subtitle-row{display:flex;align-items:center;gap:6px}.ok-native-list-media-subtitle{flex:1;min-width:0;font-size:12px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-media-network{width:14px;height:14px;border-radius:50%}.ok-native-list-media-title{font-size:16px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-medium)}.ok-native-list-media-close{position:absolute;right:9px;top:4px;border:0;background:color-mix(in srgb,var(--nl-inverse) 72%,transparent);color:var(--nl-inverse-text);width:24px;height:24px;border-radius:50%;cursor:pointer;font:18px/20px var(--nl-font-regular)}
|
|
872
|
+
.ok-native-list-media{display:block;padding:0 5px;background:transparent;border-radius:16px}.ok-native-list-media-image{display:block;width:100%;aspect-ratio:1;border-radius:10px;background:var(--nl-strong);object-fit:cover}.ok-native-list-media-image[data-state="empty"]{background:transparent}.ok-native-list-media-image[data-state="error"]{display:flex;align-items:center;justify-content:center;color:var(--nl-icon-subdued);font-size:24px}.ok-native-list-media-meta{padding-top:7px}.ok-native-list-media-subtitle-row{display:flex;align-items:center;gap:6px}.ok-native-list-media-subtitle{flex:1;min-width:0;font-size:12px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-media-network{width:14px;height:14px;border-radius:50%}.ok-native-list-media-title{font-size:16px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-medium)}.ok-native-list-media-fallback{position:absolute;inset:0;overflow:hidden;border-radius:10px;background:var(--nl-strong);color:color-mix(in srgb,var(--nl-disabled) 70%,transparent)}.ok-native-list-media-fallback::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--nl-separator) 60%,transparent);pointer-events:none}.ok-native-list-media-sheen,.ok-native-list-media-hatch,.ok-native-list-media-glyph{position:absolute;inset:0;pointer-events:none}.ok-native-list-media-glyph{display:none;align-items:center;justify-content:center}.ok-native-list-media-glyph svg{width:28%;max-width:44px;height:auto}.ok-native-list-media-fallback[data-state="loading"] .ok-native-list-media-glyph[data-glyph="loading"],.ok-native-list-media-fallback[data-state="failed"] .ok-native-list-media-glyph[data-glyph="failed"]{display:flex}.ok-native-list-media-sheen{display:none;overflow:hidden}.ok-native-list-media-fallback[data-state="loading"] .ok-native-list-media-sheen{display:block}.ok-native-list-media-sheen::before{content:"";position:absolute;top:-50%;bottom:-50%;left:0;width:60%;background:linear-gradient(100deg,transparent 0%,var(--nl-media-shine,rgba(255,255,255,.75)) 50%,transparent 100%);transform:translateX(-135%) skewX(-12deg);animation:ok-native-list-media-sweep 1.6s cubic-bezier(.4,0,.2,1) infinite;animation-delay:var(--nl-media-sweep-delay,0s)}@keyframes ok-native-list-media-sweep{0%{transform:translateX(-135%) skewX(-12deg)}70%,100%{transform:translateX(220%) skewX(-12deg)}}.ok-native-list-media-hatch{display:none;background-image:repeating-linear-gradient(135deg,color-mix(in srgb,var(--nl-primary) 4.5%,transparent) 0 1px,transparent 1px 7px);-webkit-mask-image:radial-gradient(circle at 50% 50%,transparent 0 22%,#000 70%);mask-image:radial-gradient(circle at 50% 50%,transparent 0 22%,#000 70%)}.ok-native-list-media-fallback[data-state="failed"] .ok-native-list-media-hatch{display:block}@media(prefers-reduced-motion:reduce){.ok-native-list-media-sheen::before{animation:none;transform:translateX(60%) skewX(-12deg);opacity:.6}}.ok-native-list-media-close{position:absolute;right:9px;top:4px;border:0;background:color-mix(in srgb,var(--nl-inverse) 72%,transparent);color:var(--nl-inverse-text);width:24px;height:24px;border-radius:50%;cursor:pointer;font:18px/20px var(--nl-font-regular)}
|
|
864
873
|
.ok-native-list-metric{display:flex;flex-direction:column;align-items:flex-start;padding:12px;border-radius:12px;gap:5px;background:var(--nl-row)}.ok-native-list-metric-value{font-size:22px;line-height:28px;font-weight:700;font-family:var(--nl-font-bold)}.ok-native-list-composite{display:flex;flex-direction:column;align-items:stretch;padding:14px;border-radius:12px;gap:12px;background:var(--nl-subdued)}.ok-native-list-composite-heading{font-size:14px;letter-spacing:1px;color:var(--nl-secondary)}.ok-native-list-composite-row{display:flex;gap:12px}.ok-native-list-composite-cell{flex:1;min-width:0}.ok-native-list-composite-cell[data-shaded="true"]{padding:10px;border-radius:10px;background:color-mix(in srgb,var(--nl-primary) 5%,transparent)}.ok-native-list-composite-value{font-size:18px;font-weight:600;font-family:var(--nl-font-semibold)}.ok-native-list-divider{height:1px;background:var(--nl-separator)}.ok-native-list-progress{height:4px;border-radius:2px;overflow:hidden;background:var(--nl-negative)}.ok-native-list-progress>span{display:block;height:100%;border-radius:2px;background:var(--nl-positive)}
|
|
865
874
|
.ok-native-list-data{padding:6px 12px}.ok-native-list-index{flex:0 0 28px;color:var(--nl-secondary);font-size:13px}.ok-native-list-favorite{flex:0 0 24px;color:var(--nl-icon-subdued);font-size:22px}.ok-native-list-favorite[data-active="true"]{color:var(--nl-accent)}.ok-native-list-data-cell{display:flex;flex-direction:column;min-width:0}.ok-native-list-data-cell[data-align="center"]{align-items:center}.ok-native-list-data-cell[data-align="end"]{align-items:flex-end}.ok-native-list-data-primary{display:flex;align-items:center;gap:5px;max-width:100%;font-size:16px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}.ok-native-list-unread{width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--nl-accent)}.ok-native-list-thumbnail{width:64px;height:64px;border-radius:10px;object-fit:cover}
|
|
866
875
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-history{background:var(--nl-selected)}
|
|
@@ -872,7 +881,7 @@ export const WEB_LIST_CSS = `
|
|
|
872
881
|
.ok-native-list-index-preview{position:absolute;z-index:8;right:40px;top:50%;display:flex;width:48px;height:48px;align-items:center;justify-content:center;transform:translateY(-50%) scale(.92);border-radius:14px;background:var(--nl-inverse);color:var(--nl-inverse-text);font-size:22px;font-weight:600;opacity:0;pointer-events:none;transition:opacity .15s ease,transform .15s ease;font-family:var(--nl-font-semibold)}.ok-native-list-index-preview[data-visible="true"]{opacity:1;transform:translateY(-50%) scale(1)}
|
|
873
882
|
.ok-native-list-row.ok-native-list-market-skeleton{padding:12px 20px;gap:0}.ok-native-list-skeleton-left{display:flex;align-items:center;gap:12px;flex:1}.ok-native-list-skeleton-text{display:flex;flex-direction:column;gap:4px}.ok-native-list-skeleton-right{display:flex;align-items:center;gap:8px}.ok-native-list-skeleton-mark{display:block;flex-shrink:0;border-radius:8px;animation:ok-native-list-skeleton 1.5s linear infinite alternate}@keyframes ok-native-list-skeleton{from{background-color:var(--nl-skeleton-base)}to{background-color:var(--nl-skeleton-highlight)}}.ok-native-list-market-spinner{display:block;width:20px;height:20px;flex-shrink:0;color:var(--nl-icon);animation:ok-native-list-spin .75s linear infinite}
|
|
874
883
|
@media (prefers-reduced-motion:reduce){.ok-native-list-index-preview,.ok-native-list-refresh{transition:none}.ok-native-list-spinner,.ok-native-list-market-spinner{animation:none}.ok-native-list-skeleton-mark{animation:none;background:var(--nl-skeleton-base)}}
|
|
875
|
-
.ok-native-list-footer{flex:0 0 auto;min-height:0}.ok-native-list-sticky{position:absolute;z-index:4;left:0;right:0;top:0;pointer-events:auto
|
|
884
|
+
.ok-native-list-footer{flex:0 0 auto;min-height:0}.ok-native-list-sticky{position:absolute;z-index:4;left:0;right:0;top:0;pointer-events:auto}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport{scrollbar-width:none}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport::-webkit-scrollbar,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport::-webkit-scrollbar{display:none}.ok-native-list-index-rail{position:absolute;z-index:6;top:0;right:0;bottom:0;width:${SECTION_INDEX_RAIL_WIDTH}px;touch-action:none;cursor:pointer;font-family:var(--nl-font-regular);font-synthesis:none}.ok-native-list-index-rail[hidden]{display:none}.ok-native-list-index-button{appearance:none;position:absolute;left:15px;display:flex;width:14px;height:14px;align-items:center;justify-content:center;padding:0;transform:translateY(-50%);border:0;border-radius:7px;background:transparent;color:var(--nl-disabled);font-size:10px;font-weight:400;line-height:1;cursor:pointer;opacity:.5;transition:opacity .15s ease;font-family:var(--nl-font-regular)}.ok-native-list-index-rail:hover .ok-native-list-index-button,.ok-native-list-index-rail:focus-within .ok-native-list-index-button,.ok-native-list-index-button[data-active="true"]{opacity:1}.ok-native-list-index-button[data-active="true"]{background:var(--nl-positive);color:var(--nl-inverse-text);font-weight:500;font-family:var(--nl-font-medium)}.ok-native-list-index-button:focus-visible{outline:2px solid var(--nl-positive);outline-offset:1px}
|
|
876
885
|
.ok-native-list-refresh{position:absolute;z-index:7;left:50%;top:8px;display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;background:var(--nl-inverse);color:var(--nl-inverse-text);font-size:12px;opacity:0;transform:translate(-50%,-16px);transition:opacity .15s ease,transform .15s ease;pointer-events:none}.ok-native-list-refresh[data-visible="true"]{opacity:1;transform:translate(-50%,0)}
|
|
877
886
|
.ok-native-list-warning{height:auto;display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:14px 12px;border-top:1px solid;border-bottom:1px solid;box-sizing:border-box;cursor:default}.ok-native-list-warning-title,.ok-native-list-warning-message{font-size:14px;line-height:20px;white-space:normal;overflow-wrap:anywhere}.ok-native-list-warning-title{font-weight:500;color:var(--nl-primary);font-family:var(--nl-font-medium)}.ok-native-list-warning-message{font-weight:400;color:var(--nl-secondary);font-family:var(--nl-font-regular)}
|
|
878
887
|
.ok-native-list-subtitle-segments{display:flex;align-items:center;min-width:0;max-width:100%;height:20px}.ok-native-list-subtitle-segments>.ok-native-list-secondary{flex:0 1 auto;min-width:0}.ok-native-list-subtitle-dot{flex:0 0 4px;width:4px;height:4px;margin:0 6px;border-radius:50%;background:var(--nl-disabled)}.ok-native-list-wallet-row>.ok-native-list-flex{flex:0 1 auto;width:100%;align-items:center}.ok-native-list-wallet-badges{display:flex;gap:4px;justify-content:center;margin-top:4px;height:20px;max-width:100%}.ok-native-list-wallet-badges>.ok-native-list-badge{background:var(--nl-strong);color:var(--nl-secondary);font-size:12px;line-height:16px;height:20px;box-sizing:border-box;padding:2px 4px}.ok-native-list-visual-overlay{position:absolute;display:flex;align-items:center;justify-content:center;box-sizing:border-box;border-radius:50%;overflow:hidden;line-height:1;font-size:10px}.ok-native-list-visual-overlay img,.ok-native-list-visual-overlay svg{width:100%;height:100%;object-fit:contain}/* OneKey patch: selector controls follow their original semantic colors and geometry. */
|
|
@@ -1311,15 +1320,8 @@ function createVisual(
|
|
|
1311
1320
|
'span',
|
|
1312
1321
|
'ok-native-list-image-skeleton'
|
|
1313
1322
|
);
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
if (rgb) {
|
|
1317
|
-
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
1318
|
-
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
1319
|
-
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
1320
|
-
if (red * 299 + green * 587 + blue * 114 < 128_000)
|
|
1321
|
-
skeleton.dataset.dark = 'true';
|
|
1322
|
-
}
|
|
1323
|
+
if (isDarkBackground(resolvedTheme(context.snapshot).background))
|
|
1324
|
+
skeleton.dataset.dark = 'true';
|
|
1323
1325
|
frame.appendChild(skeleton);
|
|
1324
1326
|
image.addEventListener('load', () => skeleton.remove(), { once: true });
|
|
1325
1327
|
image.addEventListener('error', () => skeleton.remove(), { once: true });
|
|
@@ -3165,6 +3167,9 @@ export class NativeListWebEngine {
|
|
|
3165
3167
|
'--nl-inverse': theme.inverseBackground,
|
|
3166
3168
|
'--nl-inverse-text': theme.inverseText,
|
|
3167
3169
|
'--nl-info': theme.info,
|
|
3170
|
+
'--nl-media-shine': isDarkBackground(theme.background)
|
|
3171
|
+
? 'rgba(255,255,255,0.07)'
|
|
3172
|
+
: 'rgba(255,255,255,0.75)',
|
|
3168
3173
|
};
|
|
3169
3174
|
Object.entries(values).forEach(([name, value]) => {
|
|
3170
3175
|
if (!value) return;
|