@onekeyfe/react-native-native-list 3.0.157-alpha.248 → 3.0.157-alpha.250
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 +21 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +711 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +169 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +243 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +20 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +487 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +820 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListImageSlot.kt +147 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +453 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +997 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +234 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +232 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +551 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +24 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +475 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +143 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +42 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +415 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +163 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +70 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +748 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +464 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +174 -104
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +407 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListSelectorBackgroundColorTest.kt +34 -0
- package/docs/DESIGN.md +518 -9
- package/docs/MIGRATION_BASELINE.md +117 -0
- package/docs/ROW_TEMPLATES.md +359 -0
- package/docs/SPEC.md +358 -0
- package/docs/STYLE_SPEC.md +978 -0
- package/docs/images/list-capabilities.svg +39 -0
- package/docs/images/row-action.svg +17 -0
- package/docs/images/row-activity.svg +24 -0
- package/docs/images/row-data.svg +24 -0
- package/docs/images/row-identity.svg +25 -0
- package/docs/images/row-market.svg +23 -0
- package/docs/images/row-media-tile.svg +26 -0
- package/docs/images/row-message.svg +20 -0
- package/docs/images/row-metric-card.svg +33 -0
- package/docs/images/row-rail.svg +18 -0
- package/docs/images/row-section-header.svg +19 -0
- package/docs/images/row-style-regions.svg +30 -0
- package/docs/images/row-system.svg +30 -0
- package/docs/images/row-wallet-group.svg +26 -0
- package/ios/NativeListAccessoryStack.swift +680 -0
- package/ios/NativeListActionRenderer.swift +108 -0
- package/ios/NativeListActivityRenderer.swift +179 -0
- package/ios/NativeListDataRowRenderer.swift +444 -0
- package/ios/NativeListIdentityRenderer.swift +685 -0
- package/ios/NativeListImageSlot.swift +140 -0
- package/ios/NativeListLeadingVisual.swift +372 -0
- package/ios/NativeListMarketRenderer.swift +698 -0
- package/ios/NativeListMediaTileRenderer.swift +184 -0
- package/ios/NativeListMessageRenderer.swift +168 -0
- package/ios/NativeListMetricCardRenderer.swift +420 -0
- package/ios/NativeListModels.swift +32 -0
- package/ios/NativeListRailRenderer.swift +152 -0
- package/ios/NativeListRendererCell.swift +311 -0
- package/ios/NativeListRendererRegistry.swift +50 -0
- package/ios/NativeListResolvedText.swift +122 -0
- package/ios/NativeListRowHost.swift +63 -0
- package/ios/NativeListSectionHeaderRenderer.swift +708 -0
- package/ios/NativeListSystemRenderer.swift +568 -0
- package/ios/NativeListTextLabel.swift +42 -0
- package/ios/NativeListTextStyles.swift +236 -0
- package/ios/NativeListWalletGroupRenderer.swift +255 -0
- package/ios/RNCNativeListView.swift +111 -180
- package/lib/module/models.js +54 -0
- package/lib/module/validation.js +324 -26
- package/lib/module/web/NativeListWebEngine.js +148 -936
- package/lib/module/web/templates/ActionRowRenderer.js +97 -0
- package/lib/module/web/templates/ActivityRowRenderer.js +95 -0
- package/lib/module/web/templates/DataRowRenderer.js +145 -0
- package/lib/module/web/templates/IdentityRowRenderer.js +289 -0
- package/lib/module/web/templates/MarketRowRenderer.js +310 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +132 -0
- package/lib/module/web/templates/MessageRowRenderer.js +165 -0
- package/lib/module/web/templates/MetricCardRowRenderer.js +172 -0
- package/lib/module/web/templates/RailRowRenderer.js +98 -0
- package/lib/module/web/templates/RowContainerStyle.js +100 -0
- package/lib/module/web/templates/RowElements.js +93 -0
- package/lib/module/web/templates/RowRendererRegistry.js +70 -0
- package/lib/module/web/templates/RowText.js +121 -0
- package/lib/module/web/templates/RowVisual.js +43 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +146 -0
- package/lib/module/web/templates/SystemRowRenderer.js +161 -0
- package/lib/module/web/templates/WalletGroupRowRenderer.js +96 -0
- package/lib/typescript/src/models.d.ts +166 -13
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +18 -16
- package/lib/typescript/src/web/templates/ActionRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/DataRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +16 -0
- package/lib/typescript/src/web/templates/MarketRowRenderer.d.ts +30 -0
- package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +44 -0
- package/lib/typescript/src/web/templates/MetricCardRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/RailRowRenderer.d.ts +28 -0
- package/lib/typescript/src/web/templates/RowContainerStyle.d.ts +9 -0
- package/lib/typescript/src/web/templates/RowElements.d.ts +38 -0
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +83 -0
- package/lib/typescript/src/web/templates/RowText.d.ts +9 -0
- package/lib/typescript/src/web/templates/RowVisual.d.ts +20 -0
- package/lib/typescript/src/web/templates/SectionHeaderRowRenderer.d.ts +15 -0
- package/lib/typescript/src/web/templates/SystemRowRenderer.d.ts +16 -0
- package/lib/typescript/src/web/templates/WalletGroupRowRenderer.d.ts +20 -0
- package/package.json +3 -3
- package/src/models.ts +281 -19
- package/src/validation.ts +501 -46
- package/src/web/NativeListWebEngine.ts +361 -1932
- package/src/web/templates/ActionRowRenderer.ts +123 -0
- package/src/web/templates/ActivityRowRenderer.ts +159 -0
- package/src/web/templates/DataRowRenderer.ts +212 -0
- package/src/web/templates/IdentityRowRenderer.ts +527 -0
- package/src/web/templates/MarketRowRenderer.ts +467 -0
- package/src/web/templates/MediaTileRowRenderer.ts +182 -0
- package/src/web/templates/MessageRowRenderer.ts +306 -0
- package/src/web/templates/MetricCardRowRenderer.ts +337 -0
- package/src/web/templates/RailRowRenderer.ts +136 -0
- package/src/web/templates/RowContainerStyle.ts +131 -0
- package/src/web/templates/RowElements.ts +160 -0
- package/src/web/templates/RowRendererRegistry.ts +111 -0
- package/src/web/templates/RowText.ts +181 -0
- package/src/web/templates/RowVisual.ts +115 -0
- package/src/web/templates/SectionHeaderRowRenderer.ts +243 -0
- package/src/web/templates/SystemRowRenderer.ts +282 -0
- package/src/web/templates/WalletGroupRowRenderer.ts +131 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRowView.kt +0 -4538
- package/ios/NativeListCell.swift +0 -4300
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { applyTabularNumbers, hasExplicitRowHeight } from "./RowElements.js";
|
|
4
|
+
import { RowVisualStyle } from "./RowVisual.js";
|
|
5
|
+
const views = new WeakMap();
|
|
6
|
+
function bind(body, row, primitives) {
|
|
7
|
+
const v = views.get(body);
|
|
8
|
+
v.primitives = primitives;
|
|
9
|
+
body.className = 'ok-native-list-row ok-native-list-action-row' + (row.presentation === 'accountSelector' ? ' ok-native-list-account-action-row' : '');
|
|
10
|
+
body.style.cssText = '';
|
|
11
|
+
body.removeAttribute('data-nl-container-background');
|
|
12
|
+
body.removeAttribute('data-nl-container-border');
|
|
13
|
+
const style = row.style;
|
|
14
|
+
if (style?.horizontalPadding !== undefined) body.style.paddingInline = `${style.horizontalPadding}px`;
|
|
15
|
+
if (style?.verticalPadding !== undefined) body.style.paddingBlock = `${style.verticalPadding}px`;
|
|
16
|
+
v.title.style.cssText = '';
|
|
17
|
+
v.title.textContent = row.title;
|
|
18
|
+
v.title.dataset.tone = row.tone ?? '';
|
|
19
|
+
if (row.presentation === 'accountSelector' && row.icon) v.title.style.fontWeight = '500';
|
|
20
|
+
if (style?.title) primitives.textStyle(v.title, style.title);
|
|
21
|
+
const visualKey = JSON.stringify([row.key, row.icon]);
|
|
22
|
+
if (v.visualKey !== visualKey) {
|
|
23
|
+
if (v.visual) {
|
|
24
|
+
primitives.dispose(v.visual);
|
|
25
|
+
v.visual.remove();
|
|
26
|
+
}
|
|
27
|
+
v.visual = primitives.visual(row.icon);
|
|
28
|
+
v.visualStyle = v.visual ? new RowVisualStyle(v.visual) : undefined;
|
|
29
|
+
if (v.visual) body.insertBefore(v.visual, v.title);
|
|
30
|
+
v.visualKey = visualKey;
|
|
31
|
+
}
|
|
32
|
+
if (v.visualStyle && v.visual) {
|
|
33
|
+
const size = row.presentation === 'accountSelector' ? 32 : 40;
|
|
34
|
+
v.visualStyle.apply(style?.image, style?.image?.width ?? size, style?.image?.height ?? size, (style?.leadingGap ?? 12) - 12);
|
|
35
|
+
}
|
|
36
|
+
v.controls.replaceChildren();
|
|
37
|
+
v.controls.style.cssText = '';
|
|
38
|
+
v.controls.removeAttribute('data-native-list-account-control');
|
|
39
|
+
const descriptors = row.trailing ?? [];
|
|
40
|
+
if (row.checkbox) v.controls.appendChild(primitives.accessory(row.key, row.checkbox, 0));
|
|
41
|
+
if (descriptors.length) {
|
|
42
|
+
const trailing = body.ownerDocument.createElement('span');
|
|
43
|
+
trailing.className = 'ok-native-list-accessories';
|
|
44
|
+
if (style?.trailingGap !== undefined) trailing.style.gap = `${style.trailingGap}px`;
|
|
45
|
+
if (hasExplicitRowHeight(row) && row.presentation === 'accountSelector' && descriptors.length === 1 && descriptors[0]?.kind === 'icon' && descriptors[0].name === 'PlusSmallOutline') trailing.dataset.nativeListAccountControl = 'createAddress';
|
|
46
|
+
let valueIndex = 0;
|
|
47
|
+
descriptors.forEach((descriptor, index) => {
|
|
48
|
+
const node = primitives.accessory(row.key, descriptor, index);
|
|
49
|
+
if (descriptor.kind === 'value' || descriptor.kind === 'valuePair') {
|
|
50
|
+
node.dataset.nlSlot = valueIndex++ === 0 ? 'value' : 'valueSecondary';
|
|
51
|
+
if (node.dataset.nlSlot === 'value' && style?.value) primitives.textStyle(node, style.value);
|
|
52
|
+
}
|
|
53
|
+
trailing.appendChild(node);
|
|
54
|
+
});
|
|
55
|
+
v.controls.appendChild(trailing);
|
|
56
|
+
}
|
|
57
|
+
v.controls.style.display = 'contents';
|
|
58
|
+
if (row.presentation === 'accountSelector') applyTabularNumbers(body);
|
|
59
|
+
}
|
|
60
|
+
function create(document, row, primitives) {
|
|
61
|
+
const body = document.createElement('div');
|
|
62
|
+
body.dataset.nlRenderer = 'action';
|
|
63
|
+
const title = document.createElement('span');
|
|
64
|
+
title.className = 'ok-native-list-action-title';
|
|
65
|
+
title.dataset.nlSlot = 'title';
|
|
66
|
+
const controls = document.createElement('span');
|
|
67
|
+
body.append(title, controls);
|
|
68
|
+
views.set(body, {
|
|
69
|
+
title,
|
|
70
|
+
controls,
|
|
71
|
+
visualKey: '',
|
|
72
|
+
primitives
|
|
73
|
+
});
|
|
74
|
+
bind(body, row, primitives);
|
|
75
|
+
return body;
|
|
76
|
+
}
|
|
77
|
+
function recycle(body) {
|
|
78
|
+
const v = views.get(body);
|
|
79
|
+
if (!v) return;
|
|
80
|
+
if (v.visual) {
|
|
81
|
+
v.primitives.dispose(v.visual);
|
|
82
|
+
v.visual.remove();
|
|
83
|
+
}
|
|
84
|
+
v.visual = undefined;
|
|
85
|
+
v.visualStyle = undefined;
|
|
86
|
+
v.visualKey = '';
|
|
87
|
+
v.controls.replaceChildren();
|
|
88
|
+
}
|
|
89
|
+
export const actionRowRenderer = {
|
|
90
|
+
key: 'action',
|
|
91
|
+
create,
|
|
92
|
+
bind,
|
|
93
|
+
recycle,
|
|
94
|
+
measure: (row, _width) => row.presentation === 'accountSelector' ? 48 : row.icon ? 60 : 44,
|
|
95
|
+
measureRendered: (_body, _row) => undefined
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=ActionRowRenderer.js.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createElement, tagSlot, markActionAnchorSource } from "./RowElements.js";
|
|
4
|
+
import { RowVisualStyle } from "./RowVisual.js";
|
|
5
|
+
const views = new WeakMap();
|
|
6
|
+
function bind(body, row, primitives) {
|
|
7
|
+
const v = views.get(body);
|
|
8
|
+
v.primitives = primitives;
|
|
9
|
+
body.style.cssText = '';
|
|
10
|
+
body.removeAttribute('data-nl-container-background');
|
|
11
|
+
body.removeAttribute('data-nl-container-border');
|
|
12
|
+
const style = row.style;
|
|
13
|
+
if (style?.horizontalPadding !== undefined) body.style.paddingInline = `${style.horizontalPadding}px`;
|
|
14
|
+
if (style?.verticalPadding !== undefined) body.style.paddingBlock = `${style.verticalPadding}px`;
|
|
15
|
+
v.column.style.rowGap = style?.lineGap !== undefined ? `${style.lineGap}px` : '';
|
|
16
|
+
v.amounts.style.gap = style?.trailingGap !== undefined ? `${style.trailingGap}px` : '';
|
|
17
|
+
for (const key of ['title', 'description', 'status', 'primaryAmount', 'secondaryAmount']) {
|
|
18
|
+
const node = v.fields[key];
|
|
19
|
+
node.style.cssText = '';
|
|
20
|
+
node.textContent = row[key] ?? '';
|
|
21
|
+
node.hidden = !row[key];
|
|
22
|
+
if (style?.[key]) primitives.textStyle(node, style[key]);
|
|
23
|
+
}
|
|
24
|
+
const visualKey = JSON.stringify([row.key, row.leading, row.secondaryLeading]);
|
|
25
|
+
if (v.visualKey !== visualKey) {
|
|
26
|
+
v.visuals.forEach(node => {
|
|
27
|
+
primitives.dispose(node);
|
|
28
|
+
node.remove();
|
|
29
|
+
});
|
|
30
|
+
v.visuals = [row.leading, row.secondaryLeading].map(source => primitives.visual(source)).filter(node => !!node);
|
|
31
|
+
v.visuals.forEach(node => body.insertBefore(node, v.column));
|
|
32
|
+
v.visualStyles = v.visuals.map(node => new RowVisualStyle(node));
|
|
33
|
+
v.visualKey = visualKey;
|
|
34
|
+
}
|
|
35
|
+
if (v.visualStyles[0]) v.visualStyles[0].apply(style?.image, style?.image?.width ?? 40, style?.image?.height ?? 40, (style?.leadingGap ?? 12) - 12);
|
|
36
|
+
v.actions.replaceChildren();
|
|
37
|
+
v.actions.hidden = !row.footerActions?.length;
|
|
38
|
+
row.footerActions?.forEach((action, index) => {
|
|
39
|
+
const button = createElement(body.ownerDocument, 'button', 'ok-native-list-action-button', action.label);
|
|
40
|
+
button.setAttribute('type', 'button');
|
|
41
|
+
button.toggleAttribute('disabled', Boolean(action.disabled));
|
|
42
|
+
button.dataset.tone = action.tone ?? '';
|
|
43
|
+
button.dataset.nativeListAction = action.key;
|
|
44
|
+
markActionAnchorSource(button, 'footerAction', index);
|
|
45
|
+
v.actions.appendChild(button);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function create(document, row, primitives) {
|
|
49
|
+
const body = createElement(document, 'div', 'ok-native-list-row ok-native-list-standard');
|
|
50
|
+
body.dataset.nlRenderer = 'activity';
|
|
51
|
+
const column = createElement(document, 'span', 'ok-native-list-flex');
|
|
52
|
+
const amounts = createElement(document, 'span', 'ok-native-list-amounts');
|
|
53
|
+
const actions = createElement(document, 'span', 'ok-native-list-actions');
|
|
54
|
+
const fields = {};
|
|
55
|
+
for (const key of ['title', 'description', 'status', 'primaryAmount', 'secondaryAmount']) {
|
|
56
|
+
const node = tagSlot(createElement(document, 'span', key === 'title' ? 'ok-native-list-title' : key === 'primaryAmount' ? 'ok-native-list-value' : 'ok-native-list-secondary'), key);
|
|
57
|
+
fields[key] = node;
|
|
58
|
+
(key.endsWith('Amount') ? amounts : column).appendChild(node);
|
|
59
|
+
}
|
|
60
|
+
column.appendChild(actions);
|
|
61
|
+
body.append(column, amounts);
|
|
62
|
+
views.set(body, {
|
|
63
|
+
column,
|
|
64
|
+
amounts,
|
|
65
|
+
actions,
|
|
66
|
+
fields,
|
|
67
|
+
visuals: [],
|
|
68
|
+
visualStyles: [],
|
|
69
|
+
visualKey: '',
|
|
70
|
+
primitives
|
|
71
|
+
});
|
|
72
|
+
bind(body, row, primitives);
|
|
73
|
+
return body;
|
|
74
|
+
}
|
|
75
|
+
function recycle(body) {
|
|
76
|
+
const v = views.get(body);
|
|
77
|
+
if (!v) return;
|
|
78
|
+
v.visuals.forEach(node => {
|
|
79
|
+
v.primitives.dispose(node);
|
|
80
|
+
node.remove();
|
|
81
|
+
});
|
|
82
|
+
v.visuals = [];
|
|
83
|
+
v.visualStyles = [];
|
|
84
|
+
v.visualKey = '';
|
|
85
|
+
v.actions.replaceChildren();
|
|
86
|
+
}
|
|
87
|
+
export const activityRowRenderer = {
|
|
88
|
+
key: 'activity',
|
|
89
|
+
create,
|
|
90
|
+
bind,
|
|
91
|
+
recycle,
|
|
92
|
+
measure: (row, _width) => row.footerActions?.length ? 100 : 60,
|
|
93
|
+
measureRendered: (_body, _row) => undefined
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=ActivityRowRenderer.js.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createElement, tagSlot } from "./RowElements.js";
|
|
4
|
+
import { RowVisualStyle } from "./RowVisual.js";
|
|
5
|
+
const views = new WeakMap();
|
|
6
|
+
const tone = (value, fallback) => value === 'positive' ? 'var(--nl-positive)' : value === 'negative' ? 'var(--nl-negative)' : value === 'secondary' ? 'var(--nl-secondary)' : `var(--nl-${fallback})`;
|
|
7
|
+
function bind(body, row, primitives) {
|
|
8
|
+
const v = views.get(body);
|
|
9
|
+
v.primitives = primitives;
|
|
10
|
+
body.style.cssText = '';
|
|
11
|
+
body.removeAttribute('data-nl-container-background');
|
|
12
|
+
body.removeAttribute('data-nl-container-border');
|
|
13
|
+
const style = row.style;
|
|
14
|
+
if (style?.horizontalPadding !== undefined) body.style.paddingInline = `${style.horizontalPadding}px`;
|
|
15
|
+
if (style?.verticalPadding !== undefined) body.style.paddingBlock = `${style.verticalPadding}px`;
|
|
16
|
+
v.controls.replaceChildren();
|
|
17
|
+
if (row.checkbox) v.controls.appendChild(primitives.accessory(row.key, row.checkbox, 0));
|
|
18
|
+
v.controls.style.display = 'contents';
|
|
19
|
+
v.index.style.cssText = '';
|
|
20
|
+
v.index.hidden = row.index === undefined;
|
|
21
|
+
v.index.textContent = String(row.index ?? '');
|
|
22
|
+
if (style?.index) primitives.textStyle(v.index, style.index);
|
|
23
|
+
v.favorite.hidden = !row.favorite;
|
|
24
|
+
v.favorite.textContent = row.favoriteActive ? '★' : '☆';
|
|
25
|
+
v.favorite.dataset.active = String(!!row.favoriteActive);
|
|
26
|
+
const visualKey = JSON.stringify([row.key, row.leading]);
|
|
27
|
+
if (visualKey !== v.visualKey) {
|
|
28
|
+
if (v.visual) {
|
|
29
|
+
primitives.dispose(v.visual);
|
|
30
|
+
v.visual.remove();
|
|
31
|
+
}
|
|
32
|
+
v.visual = primitives.visual(row.leading);
|
|
33
|
+
v.visualStyle = v.visual ? new RowVisualStyle(v.visual) : undefined;
|
|
34
|
+
if (v.visual) body.insertBefore(v.visual, v.columns[0].body);
|
|
35
|
+
v.visualKey = visualKey;
|
|
36
|
+
}
|
|
37
|
+
v.visualStyle?.apply(style?.image, style?.image?.width ?? 40, style?.image?.height ?? 40, (style?.leadingGap ?? 12) - 12);
|
|
38
|
+
v.columns.forEach((cell, index) => {
|
|
39
|
+
const column = row.columns[index];
|
|
40
|
+
cell.body.hidden = !column;
|
|
41
|
+
if (!column) {
|
|
42
|
+
cell.body.remove();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
body.appendChild(cell.body);
|
|
46
|
+
cell.body.style.cssText = '';
|
|
47
|
+
cell.body.hidden = false;
|
|
48
|
+
cell.body.style.flex = String(column.weight ?? 1);
|
|
49
|
+
cell.body.style.display = 'flex';
|
|
50
|
+
cell.body.dataset.align = column.alignment ?? 'start';
|
|
51
|
+
if (style?.lineGap !== undefined) cell.body.style.rowGap = `${style.lineGap}px`;
|
|
52
|
+
cell.primaryLine.style.cssText = '';
|
|
53
|
+
cell.primaryLine.style.color = tone(column.tone, 'primary');
|
|
54
|
+
if (style?.titleBadgeGap !== undefined) cell.primaryLine.style.gap = `${style.titleBadgeGap}px`;
|
|
55
|
+
cell.primary.style.cssText = '';
|
|
56
|
+
cell.primary.textContent = column.text;
|
|
57
|
+
if (style?.columns) primitives.textStyle(cell.primary, style.columns);
|
|
58
|
+
cell.badges.replaceChildren();
|
|
59
|
+
cell.badges.style.display = 'contents';
|
|
60
|
+
if (column.key === 'asset') row.badges?.forEach(badge => {
|
|
61
|
+
const label = tagSlot(createElement(body.ownerDocument, 'span', 'ok-native-list-badge', badge.text), 'badge');
|
|
62
|
+
label.dataset.tone = badge.tone ?? '';
|
|
63
|
+
cell.badges.appendChild(label);
|
|
64
|
+
});
|
|
65
|
+
// Legacy Web layout: secondary leading text sits inline before the primary
|
|
66
|
+
// text; secondary text is a direct line below it, toned by secondaryTone.
|
|
67
|
+
cell.secondaryLine.style.display = column.secondaryText ? 'contents' : 'none';
|
|
68
|
+
[column.secondaryLeadingText, column.secondaryText].forEach((text, slot) => {
|
|
69
|
+
const label = cell.secondary[slot];
|
|
70
|
+
label.hidden = !text;
|
|
71
|
+
if (!text) label.remove();else if (slot === 0) cell.primaryLine.insertBefore(label, cell.primary);else cell.secondaryLine.appendChild(label);
|
|
72
|
+
label.style.cssText = '';
|
|
73
|
+
label.textContent = text ?? '';
|
|
74
|
+
if (slot === 1) label.style.color = tone(column.secondaryTone, 'secondary');
|
|
75
|
+
if (style?.columnSecondary) primitives.textStyle(label, style.columnSecondary);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function create(document, row, primitives) {
|
|
80
|
+
const body = createElement(document, 'div', 'ok-native-list-row ok-native-list-data');
|
|
81
|
+
body.dataset.nlRenderer = 'dataRow';
|
|
82
|
+
const index = tagSlot(createElement(document, 'span', 'ok-native-list-index'), 'index');
|
|
83
|
+
const favorite = createElement(document, 'span', 'ok-native-list-favorite');
|
|
84
|
+
const controls = createElement(document, 'span');
|
|
85
|
+
body.append(controls, index, favorite);
|
|
86
|
+
const columns = Array.from({
|
|
87
|
+
length: 4
|
|
88
|
+
}, () => {
|
|
89
|
+
const cell = createElement(document, 'span', 'ok-native-list-data-cell');
|
|
90
|
+
const primaryLine = createElement(document, 'span', 'ok-native-list-data-primary');
|
|
91
|
+
const primary = tagSlot(createElement(document, 'span'), 'columns');
|
|
92
|
+
const badges = createElement(document, 'span');
|
|
93
|
+
primaryLine.append(primary, badges);
|
|
94
|
+
const secondaryLine = createElement(document, 'span', 'ok-native-list-data-secondary-line');
|
|
95
|
+
const secondary = Array.from({
|
|
96
|
+
length: 2
|
|
97
|
+
}, () => tagSlot(createElement(document, 'span', 'ok-native-list-secondary'), 'columnSecondary'));
|
|
98
|
+
secondaryLine.append(...secondary);
|
|
99
|
+
cell.append(primaryLine, secondaryLine);
|
|
100
|
+
body.appendChild(cell);
|
|
101
|
+
return {
|
|
102
|
+
body: cell,
|
|
103
|
+
primaryLine,
|
|
104
|
+
primary,
|
|
105
|
+
badges,
|
|
106
|
+
secondaryLine,
|
|
107
|
+
secondary
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
views.set(body, {
|
|
111
|
+
favorite,
|
|
112
|
+
index,
|
|
113
|
+
controls,
|
|
114
|
+
columns,
|
|
115
|
+
visualKey: '',
|
|
116
|
+
primitives
|
|
117
|
+
});
|
|
118
|
+
bind(body, row, primitives);
|
|
119
|
+
return body;
|
|
120
|
+
}
|
|
121
|
+
function recycle(body) {
|
|
122
|
+
const v = views.get(body);
|
|
123
|
+
if (!v) return;
|
|
124
|
+
if (v.visual) {
|
|
125
|
+
v.primitives.dispose(v.visual);
|
|
126
|
+
v.visual.remove();
|
|
127
|
+
}
|
|
128
|
+
v.visual = undefined;
|
|
129
|
+
v.visualStyle = undefined;
|
|
130
|
+
v.visualKey = '';
|
|
131
|
+
v.controls.replaceChildren();
|
|
132
|
+
}
|
|
133
|
+
export const dataRowRenderer = {
|
|
134
|
+
key: 'dataRow',
|
|
135
|
+
create,
|
|
136
|
+
bind,
|
|
137
|
+
recycle,
|
|
138
|
+
// Legacy presets: table rows without secondary text are 8 units shorter.
|
|
139
|
+
measure: (row, _width, layout) => {
|
|
140
|
+
const secondary = row.columns.some(column => column.secondaryText);
|
|
141
|
+
return (secondary ? 60 : 56) + (layout === 'table' && !secondary ? -8 : 0);
|
|
142
|
+
},
|
|
143
|
+
measureRendered: (_body, _row) => undefined
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=DataRowRenderer.js.map
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { applyTabularNumbers, hasExplicitRowHeight } from "./RowElements.js";
|
|
4
|
+
import { createElement, setData, tagSlot, markActionAnchorSource, createTextColumn, createBadge } from "./RowElements.js";
|
|
5
|
+
import { applyTextLayout, applyTextStyleToSlot, applyValueSegments } from "./RowText.js";
|
|
6
|
+
import { RowVisualStyle } from "./RowVisual.js";
|
|
7
|
+
function toneColor(tone, fallback) {
|
|
8
|
+
if (tone === 'positive') return 'var(--nl-positive)';
|
|
9
|
+
if (tone === 'negative') return 'var(--nl-negative)';
|
|
10
|
+
if (tone === 'secondary') return 'var(--nl-secondary)';
|
|
11
|
+
return fallback === 'secondary' ? 'var(--nl-secondary)' : 'var(--nl-primary)';
|
|
12
|
+
}
|
|
13
|
+
function appendAccessories(parent, document, primitives, row, accessories) {
|
|
14
|
+
if (!accessories?.length) return;
|
|
15
|
+
const container = createElement(document, 'span', 'ok-native-list-accessories');
|
|
16
|
+
if (row && hasExplicitRowHeight(row) && 'presentation' in row && row.presentation === 'networkSelector') {
|
|
17
|
+
container.style.gap = accessories.some(accessory => accessory.kind === 'checkbox') ? '12px' : '20px';
|
|
18
|
+
}
|
|
19
|
+
if (row && hasExplicitRowHeight(row) && 'presentation' in row && row.presentation === 'accountSelector' && accessories.length === 1 && accessories[0]?.kind === 'icon' && accessories[0].name === 'PlusSmallOutline') {
|
|
20
|
+
setData(container, 'nativeListAccountControl', 'createAddress');
|
|
21
|
+
}
|
|
22
|
+
let valueIndex = 0;
|
|
23
|
+
accessories.forEach((accessory, slot) => {
|
|
24
|
+
const element = primitives.accessory(row.key, accessory, slot);
|
|
25
|
+
if (accessory.kind === 'value' || accessory.kind === 'valuePair') {
|
|
26
|
+
tagSlot(element, valueIndex++ === 0 ? 'value' : 'valueSecondary');
|
|
27
|
+
}
|
|
28
|
+
container.appendChild(element);
|
|
29
|
+
});
|
|
30
|
+
parent.appendChild(container);
|
|
31
|
+
}
|
|
32
|
+
function createIdentityRow(document, primitives, row) {
|
|
33
|
+
const presentation = row.presentation;
|
|
34
|
+
const body = createElement(document, 'div', ['ok-native-list-row', 'ok-native-list-standard', !presentation ? 'ok-native-list-identity-row' : '', presentation === 'networkSelector' ? 'ok-native-list-network-row' : '', presentation === 'walletSidebar' ? 'ok-native-list-wallet-row' : '', presentation === 'accountSelector' ? 'ok-native-list-account-row' : ''].filter(Boolean).join(' '));
|
|
35
|
+
setData(body, 'nativeListSelector', hasExplicitRowHeight(row) ? presentation : undefined);
|
|
36
|
+
if (row.titleActionKey && row.titleActionOnHover) {
|
|
37
|
+
setData(body, 'nativeListHoverAction', row.titleActionKey);
|
|
38
|
+
markActionAnchorSource(body, 'leadingAction');
|
|
39
|
+
}
|
|
40
|
+
if (row.leadingAction) {
|
|
41
|
+
const action = primitives.iconAction(row.leadingAction.name, row.leadingAction.actionKey, row.leadingAction.disabled, row.leadingAction.tintColor);
|
|
42
|
+
markActionAnchorSource(action, 'leadingAction');
|
|
43
|
+
body.appendChild(action);
|
|
44
|
+
}
|
|
45
|
+
const visual = primitives.visual(row.leading, hasExplicitRowHeight(row) ? presentation : undefined);
|
|
46
|
+
if (visual && true && hasExplicitRowHeight(row) && row.presentation === 'walletSidebar' && 'fallbackIcon' in row.leading && row.leading.fallbackIcon?.name === 'LockSolid') {
|
|
47
|
+
// OneKey patch: hidden-wallet locks use WalletAvatar's full 40-point icon.
|
|
48
|
+
const icon = visual.querySelector('.ok-native-list-visual-fallback svg');
|
|
49
|
+
if (icon) {
|
|
50
|
+
icon.style.width = '40px';
|
|
51
|
+
icon.style.height = '40px';
|
|
52
|
+
}
|
|
53
|
+
const fallback = visual.querySelector('.ok-native-list-visual-fallback');
|
|
54
|
+
if (fallback) {
|
|
55
|
+
fallback.style.borderRadius = '0';
|
|
56
|
+
fallback.style.overflow = 'visible';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (visual && true && hasExplicitRowHeight(row) && row.presentation === 'walletSidebar' && 'borderStyle' in row.leading && row.leading.borderStyle === 'dashed') visual.style.borderWidth = '1px';
|
|
60
|
+
if (visual) body.appendChild(visual);
|
|
61
|
+
const title = row.title;
|
|
62
|
+
const subtitle = row.subtitle;
|
|
63
|
+
const column = createTextColumn(document, title, subtitle, row.tertiary, row.tertiaryTone, presentation !== 'walletSidebar' ? row.badges : undefined, {
|
|
64
|
+
title: 'title',
|
|
65
|
+
subtitle: 'subtitle',
|
|
66
|
+
tertiary: 'tertiary'
|
|
67
|
+
});
|
|
68
|
+
{
|
|
69
|
+
const titleElement = column.firstElementChild;
|
|
70
|
+
if (row.titleMatch?.length) {
|
|
71
|
+
const textTarget = titleElement.querySelector('[data-nl-slot="title"]') ?? titleElement;
|
|
72
|
+
const firstText = textTarget.firstChild;
|
|
73
|
+
if (firstText) firstText.remove();
|
|
74
|
+
const fragment = document.createDocumentFragment();
|
|
75
|
+
let offset = 0;
|
|
76
|
+
row.titleMatch.forEach(({
|
|
77
|
+
start,
|
|
78
|
+
end
|
|
79
|
+
}) => {
|
|
80
|
+
fragment.appendChild(document.createTextNode(row.title.slice(offset, start)));
|
|
81
|
+
const match = createElement(document, 'span', 'ok-native-list-info', row.title.slice(start, end));
|
|
82
|
+
fragment.appendChild(match);
|
|
83
|
+
offset = end;
|
|
84
|
+
});
|
|
85
|
+
fragment.appendChild(document.createTextNode(row.title.slice(offset)));
|
|
86
|
+
textTarget.prepend(fragment);
|
|
87
|
+
}
|
|
88
|
+
if (row.subtitleSegments?.length) {
|
|
89
|
+
column.querySelector('.ok-native-list-secondary')?.remove();
|
|
90
|
+
const segments = createElement(document, 'span', 'ok-native-list-subtitle-segments');
|
|
91
|
+
row.subtitleSegments.forEach(segment => {
|
|
92
|
+
if (segment.separatorBefore) segments.appendChild(createElement(document, 'span', 'ok-native-list-subtitle-dot'));
|
|
93
|
+
const text = createElement(document, 'span', 'ok-native-list-secondary', segment.text);
|
|
94
|
+
tagSlot(text, 'subtitle');
|
|
95
|
+
applyValueSegments(text, segment.textSegments, 14, 20, 400);
|
|
96
|
+
setData(text, 'tone', segment.tone);
|
|
97
|
+
text.style.color = segment.tone === 'disabled' ? 'var(--nl-disabled)' : segment.tone === 'caution' ? 'var(--nl-caution)' : toneColor(segment.tone, 'secondary');
|
|
98
|
+
segments.appendChild(text);
|
|
99
|
+
});
|
|
100
|
+
column.insertBefore(segments, titleElement.nextSibling);
|
|
101
|
+
}
|
|
102
|
+
if (presentation === 'walletSidebar' && row.badges?.length) {
|
|
103
|
+
const badges = createElement(document, 'span', 'ok-native-list-wallet-badges');
|
|
104
|
+
row.badges.forEach(badge => badges.appendChild(createBadge(document, badge)));
|
|
105
|
+
column.appendChild(badges);
|
|
106
|
+
}
|
|
107
|
+
for (const key of ['title', 'subtitle']) {
|
|
108
|
+
const lines = row.style?.[key]?.lines ?? row[`${key}Lines`];
|
|
109
|
+
if (lines !== undefined) column.querySelectorAll(`[data-nl-slot="${key}"]`).forEach(text => applyTextLayout(text, {
|
|
110
|
+
lines
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
body.appendChild(column);
|
|
115
|
+
appendAccessories(body, document, primitives, row, row.trailing);
|
|
116
|
+
return body;
|
|
117
|
+
}
|
|
118
|
+
const ROW_BOX_STYLE_KEYS = new Set(['container', 'horizontalPadding', 'verticalPadding', 'leadingGap', 'lineGap', 'titleBadgeGap', 'trailingGap', 'image']);
|
|
119
|
+
function applyIdentityStyle(body, row) {
|
|
120
|
+
const style = row.style;
|
|
121
|
+
if (!style) return;
|
|
122
|
+
const box = style;
|
|
123
|
+
if (box.horizontalPadding !== undefined) body.style.paddingInline = String(box.horizontalPadding) + 'px';
|
|
124
|
+
if (box.verticalPadding !== undefined) body.style.paddingBlock = String(box.verticalPadding) + 'px';
|
|
125
|
+
const vertical = row.type === 'identity' && row.presentation === 'walletSidebar';
|
|
126
|
+
const leading = body.querySelector(':scope > .ok-native-list-visual, :scope > .ok-native-list-stacked');
|
|
127
|
+
const defaultGap = body.style.gap || (row.type === 'identity' && row.presentation === 'walletSidebar' ? '4px' : row.type === 'identity' && row.presentation === 'accountSelector' ? '8px' : '12px');
|
|
128
|
+
if (box.lineGap !== undefined) {
|
|
129
|
+
const targets = body.querySelectorAll(':scope > .ok-native-list-flex');
|
|
130
|
+
targets.forEach(column => {
|
|
131
|
+
column.style.rowGap = String(box.lineGap) + 'px';
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (leading && box.leadingGap !== undefined) {
|
|
135
|
+
const gap = 'calc(' + String(box.leadingGap) + 'px - ' + defaultGap + ')';
|
|
136
|
+
if (vertical) leading.style.marginBottom = gap;else leading.style.marginInlineEnd = gap;
|
|
137
|
+
}
|
|
138
|
+
if (box.titleBadgeGap !== undefined) {
|
|
139
|
+
const gap = String(box.titleBadgeGap) + 'px';
|
|
140
|
+
body.querySelectorAll('.ok-native-list-badges, .ok-native-list-wallet-badges').forEach(badges => {
|
|
141
|
+
if (badges.classList.contains('ok-native-list-wallet-badges')) badges.style.marginTop = box.lineGap === undefined ? gap : 'calc(' + gap + ' - ' + String(box.lineGap) + 'px)';else badges.style.marginInlineStart = gap;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (box.trailingGap !== undefined) {
|
|
145
|
+
const gap = String(box.trailingGap) + 'px';
|
|
146
|
+
body.querySelectorAll('.ok-native-list-accessories, .ok-native-list-amounts').forEach(trailing => {
|
|
147
|
+
trailing.style.gap = gap;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (leading && box.image) {
|
|
151
|
+
const image = box.image;
|
|
152
|
+
if (image.width !== undefined) {
|
|
153
|
+
leading.style.width = String(image.width) + 'px';
|
|
154
|
+
if (!vertical) leading.style.flexBasis = String(image.width) + 'px';
|
|
155
|
+
}
|
|
156
|
+
if (image.height !== undefined) leading.style.height = String(image.height) + 'px';
|
|
157
|
+
const radius = image.cornerRadius !== undefined ? String(image.cornerRadius) + 'px' : image.shape === 'circle' ? '50%' : image.shape === 'square' ? '0px' : image.shape === 'rounded' ? '10px' : undefined;
|
|
158
|
+
if (radius !== undefined) {
|
|
159
|
+
leading.style.setProperty('border-radius', radius, 'important');
|
|
160
|
+
// Clip the bitmap itself; decorations may extend beyond the visual slot.
|
|
161
|
+
leading.style.overflow = leading.matches('img') ? 'hidden' : 'visible';
|
|
162
|
+
}
|
|
163
|
+
const images = leading.matches('img') ? [leading] : leading.querySelectorAll(':scope > img, :scope > .ok-native-list-visual-fallback');
|
|
164
|
+
images.forEach(bitmap => {
|
|
165
|
+
if (bitmap !== leading) {
|
|
166
|
+
if (image.width !== undefined) bitmap.style.width = '100%';
|
|
167
|
+
if (image.height !== undefined) bitmap.style.height = '100%';
|
|
168
|
+
}
|
|
169
|
+
if (radius !== undefined) bitmap.style.borderRadius = radius;
|
|
170
|
+
if (image.contentFit !== undefined) bitmap.style.objectFit = image.contentFit === 'center' ? 'none' : image.contentFit;
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
Object.keys(style).forEach(key => {
|
|
174
|
+
if (ROW_BOX_STYLE_KEYS.has(key)) return;
|
|
175
|
+
const slotStyle = style[key];
|
|
176
|
+
if (!slotStyle) return;
|
|
177
|
+
body.querySelectorAll('[data-nl-slot="' + key + '"]').forEach(element => {
|
|
178
|
+
applyTextStyleToSlot(element, slotStyle);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const views = new WeakMap();
|
|
183
|
+
function bind(body, row, primitives) {
|
|
184
|
+
const v = views.get(body);
|
|
185
|
+
v.primitives = primitives;
|
|
186
|
+
let used = false;
|
|
187
|
+
const next = createIdentityRow(body.ownerDocument, {
|
|
188
|
+
...primitives,
|
|
189
|
+
visual: (source, presentation) => {
|
|
190
|
+
used = true;
|
|
191
|
+
const key = JSON.stringify([row.key, source, presentation]);
|
|
192
|
+
if (v.visual?.key !== key) {
|
|
193
|
+
if (v.visual) primitives.dispose(v.visual.node);
|
|
194
|
+
const node = primitives.visual(source, presentation);
|
|
195
|
+
if (!node) {
|
|
196
|
+
v.visual = undefined;
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
v.visual = {
|
|
200
|
+
key,
|
|
201
|
+
node,
|
|
202
|
+
defaults: new RowVisualStyle(node)
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
v.visual.defaults.restore();
|
|
206
|
+
return v.visual.node;
|
|
207
|
+
}
|
|
208
|
+
}, row);
|
|
209
|
+
if (!used && v.visual) {
|
|
210
|
+
primitives.dispose(v.visual.node);
|
|
211
|
+
v.visual = undefined;
|
|
212
|
+
}
|
|
213
|
+
body.replaceChildren(...Array.from(next.childNodes));
|
|
214
|
+
body.className = next.className;
|
|
215
|
+
body.style.cssText = next.style.cssText;
|
|
216
|
+
if (row.presentation && ['accountSelector', 'networkSelector', 'walletSidebar'].includes(row.presentation)) applyTabularNumbers(body);
|
|
217
|
+
for (const name of body.getAttributeNames()) if (name.startsWith('data-') && name !== 'data-nl-renderer') body.removeAttribute(name);
|
|
218
|
+
for (const name of next.getAttributeNames()) if (name.startsWith('data-')) body.setAttribute(name, next.getAttribute(name));
|
|
219
|
+
if (row.type === 'identity' && hasExplicitRowHeight(row)) {
|
|
220
|
+
const title = body.querySelector('.ok-native-list-title');
|
|
221
|
+
if (row.presentation === 'accountSelector') {
|
|
222
|
+
body.style.gap = '12px';
|
|
223
|
+
body.style.borderRadius = '12px';
|
|
224
|
+
if ('shape' in row.leading && row.leading.shape === 'rounded') {
|
|
225
|
+
const visual = body.querySelector('.ok-native-list-visual');
|
|
226
|
+
if (visual) visual.style.borderRadius = '8px';
|
|
227
|
+
}
|
|
228
|
+
if (title) title.style.lineHeight = '24px';
|
|
229
|
+
}
|
|
230
|
+
if (row.presentation === 'networkSelector') {
|
|
231
|
+
body.style.borderRadius = '12px';
|
|
232
|
+
const visual = body.querySelector('.ok-native-list-visual');
|
|
233
|
+
if (visual) {
|
|
234
|
+
visual.style.width = '32px';
|
|
235
|
+
visual.style.height = '32px';
|
|
236
|
+
visual.style.flexBasis = '32px';
|
|
237
|
+
}
|
|
238
|
+
if (row.leading.kind === 'network' && !row.leading.image && !row.leading.fallbackIcon && row.leading.fallbackText) {
|
|
239
|
+
const fallback = visual?.querySelector('.ok-native-list-visual-fallback');
|
|
240
|
+
if (fallback) {
|
|
241
|
+
fallback.style.fontSize = '19px';
|
|
242
|
+
fallback.style.lineHeight = '27px';
|
|
243
|
+
fallback.style.fontWeight = '600';
|
|
244
|
+
fallback.style.color = 'var(--nl-inverse-text)';
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
visual?.querySelectorAll('.ok-native-list-visual-main').forEach(image => {
|
|
248
|
+
image.style.width = '32px';
|
|
249
|
+
image.style.height = '32px';
|
|
250
|
+
});
|
|
251
|
+
if (title) {
|
|
252
|
+
title.style.fontSize = '16px';
|
|
253
|
+
title.style.lineHeight = '24px';
|
|
254
|
+
title.style.fontWeight = '500';
|
|
255
|
+
}
|
|
256
|
+
body.querySelectorAll('.ok-native-list-accessory').forEach(value => {
|
|
257
|
+
value.style.fontSize = '16px';
|
|
258
|
+
value.style.lineHeight = '24px';
|
|
259
|
+
value.style.fontWeight = '500';
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
applyIdentityStyle(body, row);
|
|
264
|
+
}
|
|
265
|
+
function create(document, row, primitives) {
|
|
266
|
+
const body = document.createElement('div');
|
|
267
|
+
body.dataset.nlRenderer = 'identity';
|
|
268
|
+
views.set(body, {
|
|
269
|
+
primitives
|
|
270
|
+
});
|
|
271
|
+
bind(body, row, primitives);
|
|
272
|
+
return body;
|
|
273
|
+
}
|
|
274
|
+
function recycle(body) {
|
|
275
|
+
const v = views.get(body);
|
|
276
|
+
if (v?.visual) v.primitives.dispose(v.visual.node);
|
|
277
|
+
if (v) v.visual = undefined;
|
|
278
|
+
body.replaceChildren();
|
|
279
|
+
}
|
|
280
|
+
export const identityRowRenderer = {
|
|
281
|
+
key: 'identity',
|
|
282
|
+
create,
|
|
283
|
+
bind,
|
|
284
|
+
recycle,
|
|
285
|
+
appliesSizePreset: row => !row.presentation,
|
|
286
|
+
measure: (row, _width) => row.presentation === 'walletSidebar' ? 68 + (row.badges?.length ? 24 : 0) : row.presentation === 'networkSelector' ? 47 : row.presentation === 'accountSelector' ? 58 : row.tertiary ? 72 : row.subtitle ? 60 : 56,
|
|
287
|
+
measureRendered: (_body, _row) => undefined
|
|
288
|
+
};
|
|
289
|
+
//# sourceMappingURL=IdentityRowRenderer.js.map
|