@onekeyfe/react-native-native-list 3.0.179-alpha.2026101503 → 3.0.179-alpha.302
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/LICENSE +36 -0
- package/README.md +32 -3
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +22 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +8 -8
- package/android/src/main/java/com/onekey/nativelist/NativeListActionRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +6 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +11 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +5 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +7 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +5 -5
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +8 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListMetricCardRenderer.kt +14 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +28 -15
- package/android/src/main/java/com/onekey/nativelist/NativeListRailRenderer.kt +4 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListRowHost.kt +1 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +20 -20
- package/android/src/main/java/com/onekey/nativelist/NativeListSystemRenderer.kt +3 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +104 -18
- package/android/src/main/java/com/onekey/nativelist/NativeListWalletGroupRenderer.kt +6 -5
- package/docs/SPEC.md +69 -19
- package/docs/STYLE_SPEC.md +12 -2
- package/ios/HybridNativeList.swift +15 -21
- package/ios/NativeListAccessoryStack.swift +14 -10
- package/ios/NativeListActionRenderer.swift +7 -4
- package/ios/NativeListActivityDetailsView.swift +63 -24
- package/ios/NativeListActivityRenderer.swift +19 -10
- package/ios/NativeListDataRowRenderer.swift +23 -19
- package/ios/NativeListDesignAssets.swift +43 -34
- package/ios/NativeListIdentityRenderer.swift +23 -19
- package/ios/NativeListLeadingVisual.swift +9 -4
- package/ios/NativeListMarketRenderer.swift +19 -11
- package/ios/NativeListMediaTileRenderer.swift +11 -7
- package/ios/NativeListMessageRenderer.swift +20 -10
- package/ios/NativeListMetricCardRenderer.swift +16 -12
- package/ios/NativeListRailRenderer.swift +9 -7
- package/ios/NativeListRendererCell.swift +6 -4
- package/ios/NativeListRendererRegistry.swift +8 -3
- package/ios/NativeListResolvedText.swift +3 -3
- package/ios/NativeListRowHost.swift +7 -2
- package/ios/NativeListSectionHeaderRenderer.swift +22 -19
- package/ios/NativeListSystemRenderer.swift +18 -16
- package/ios/NativeListTextStyles.swift +18 -12
- package/ios/NativeListWalletGroupRenderer.swift +6 -4
- package/ios/RNCNativeListView.swift +38 -92
- package/ios/tests/NativeListActivityPresentationTests.swift +5 -3
- package/ios/tests/NativeListLifecycleTests.swift +77 -2
- package/lib/module/NativeList.js +8 -24
- package/lib/module/NativeList.web.js +8 -3
- package/lib/module/fonts.js +44 -0
- package/lib/module/index.js +1 -0
- package/lib/module/web/NativeListWebEngine.js +48 -24
- package/lib/module/web/templates/ActionRowRenderer.js +2 -1
- package/lib/module/web/templates/IdentityRowRenderer.js +4 -3
- package/lib/module/web/templates/MarketRowRenderer.js +2 -1
- package/lib/module/web/templates/RowText.js +13 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +3 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
- package/lib/typescript/src/NativeList.nitro.d.ts +1 -2
- package/lib/typescript/src/NativeList.types.d.ts +0 -4
- package/lib/typescript/src/fonts.d.ts +10 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +4 -1
- package/lib/typescript/src/web/templates/RowText.d.ts +1 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -18
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -4
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +2 -8
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -12
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -12
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +6 -17
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -4
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -4
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -4
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -6
- package/nitrogen/generated/shared/json/NativeListConfig.json +1 -2
- package/package.json +4 -5
- package/react-native-native-list.podspec +0 -1
- package/src/NativeList.nitro.ts +1 -2
- package/src/NativeList.tsx +4 -25
- package/src/NativeList.types.ts +0 -4
- package/src/NativeList.web.tsx +10 -3
- package/src/fonts.ts +64 -0
- package/src/index.ts +3 -0
- package/src/web/NativeListWebEngine.ts +53 -24
- package/src/web/templates/ActionRowRenderer.ts +2 -1
- package/src/web/templates/IdentityRowRenderer.ts +4 -3
- package/src/web/templates/MarketRowRenderer.ts +4 -2
- package/src/web/templates/RowText.ts +15 -3
- package/src/web/templates/SectionHeaderRowRenderer.ts +6 -3
- package/common/fonts/Roobert-Bold.ttf +0 -0
- package/common/fonts/Roobert-Medium.ttf +0 -0
- package/common/fonts/Roobert-Regular.ttf +0 -0
- package/common/fonts/Roobert-SemiBold.ttf +0 -0
|
@@ -76,7 +76,7 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
76
76
|
"style": ["title": ["color": "#FFAA00"]],
|
|
77
77
|
])
|
|
78
78
|
cell.bind(item: item, theme: nil, layout: "sectioned", selected: false,
|
|
79
|
-
|
|
79
|
+
checkboxState: { _, _, fallback in fallback }, fonts: NativeListFontFamilies())
|
|
80
80
|
}
|
|
81
81
|
try bind(loading: true)
|
|
82
82
|
let spinner = try XCTUnwrap(cell.root.arrangedSubviews.first as? UIActivityIndicatorView)
|
|
@@ -106,7 +106,7 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
106
106
|
|
|
107
107
|
func bind(_ item: NativeListItem) {
|
|
108
108
|
cell.bind(item: item, theme: nil, layout: "linear", selected: false,
|
|
109
|
-
|
|
109
|
+
checkboxState: { _, _, fallback in fallback }, fonts: NativeListFontFamilies())
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
bind(first)
|
|
@@ -166,6 +166,81 @@ final class NativeListLifecycleTests: XCTestCase {
|
|
|
166
166
|
XCTAssertTrue(second.isHidden)
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
func testFontResolversMeasureBindResetAndKeepIndependentInstances() throws {
|
|
170
|
+
let first = NativeListFontFamilies(names: ["regular": "Courier", "bold": "Courier-Bold"])
|
|
171
|
+
let second = NativeListFontFamilies(names: ["regular": "Georgia", "bold": "Georgia-Bold"])
|
|
172
|
+
XCTAssertNotNil(UIFont(name: "Courier", size: 16))
|
|
173
|
+
XCTAssertNotNil(UIFont(name: "Georgia", size: 16))
|
|
174
|
+
func resolve(_ fonts: NativeListFontFamilies) -> NativeListResolvedText {
|
|
175
|
+
NativeListResolvedText(
|
|
176
|
+
"WWWWiiii", style: nil, size: 16, color: .label,
|
|
177
|
+
lineHeight: 24, lines: 1, fonts: fonts)
|
|
178
|
+
}
|
|
179
|
+
let a = resolve(first)
|
|
180
|
+
let b = resolve(second)
|
|
181
|
+
let label = NativeListTextLabel()
|
|
182
|
+
a.bind(label)
|
|
183
|
+
XCTAssertEqual(label.font.fontName, a.font.fontName)
|
|
184
|
+
XCTAssertEqual(a.measureWidth(), ceil(a.attributed(direction: .leftToRight).size().width))
|
|
185
|
+
XCTAssertNotEqual(a.font.fontName, b.font.fontName)
|
|
186
|
+
XCTAssertNotEqual(a.measureWidth(), b.measureWidth())
|
|
187
|
+
b.bind(label)
|
|
188
|
+
XCTAssertEqual(label.font.fontName, "Georgia")
|
|
189
|
+
resolve(NativeListFontFamilies()).bind(label)
|
|
190
|
+
XCTAssertEqual(label.font.fontName, UIFont.systemFont(ofSize: 16).fontName)
|
|
191
|
+
XCTAssertEqual(a.font.fontName, "Courier")
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
func testUnstyledLeadingVisualAndFooterRebindConfiguredFonts() throws {
|
|
195
|
+
let first = NativeListFontFamilies(names: ["regular": "Courier", "bold": "Courier-Bold"])
|
|
196
|
+
let second = NativeListFontFamilies(names: ["regular": "Georgia", "bold": "Georgia-Bold"])
|
|
197
|
+
let visual = NativeListLeadingVisual()
|
|
198
|
+
for fonts in [first, second] {
|
|
199
|
+
visual.bind(
|
|
200
|
+
["kind": "account", "fallbackText": "A"], style: [:], key: "a", theme: nil,
|
|
201
|
+
isUnread: false, fonts: fonts)
|
|
202
|
+
XCTAssertEqual(
|
|
203
|
+
visual.fallbackTextView.font.fontName, fonts.font(ofSize: 13, weight: .bold).fontName)
|
|
204
|
+
}
|
|
205
|
+
let view = NativeListView(frame: CGRect(x: 0, y: 0, width: 320, height: 480))
|
|
206
|
+
view.setFontFamiliesJson("{\"regular\":\"Courier\",\"medium\":\"Courier\"}")
|
|
207
|
+
view.applySnapshotJson(
|
|
208
|
+
try snapshot(footer: [
|
|
209
|
+
"key": "footer", "type": "action", "title": "Continue", "actionKey": "continue",
|
|
210
|
+
]))
|
|
211
|
+
let footer = try XCTUnwrap(footerCell(in: view))
|
|
212
|
+
func labels(_ view: UIView) -> [UILabel] {
|
|
213
|
+
(view as? UILabel).map { [$0] } ?? view.subviews.flatMap(labels)
|
|
214
|
+
}
|
|
215
|
+
XCTAssertEqual(labels(footer).first { $0.text == "Continue" }?.font.fontName, "Courier")
|
|
216
|
+
view.setFontFamiliesJson("{\"regular\":\"Georgia\",\"medium\":\"Georgia\"}")
|
|
217
|
+
XCTAssertEqual(labels(footer).first { $0.text == "Continue" }?.font.fontName, "Georgia")
|
|
218
|
+
XCTAssertEqual(footer.accessibilityLabel, "Continue")
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
func testNestedWalletMembersAndDragBadgeFollowEachBindMapping() throws {
|
|
222
|
+
let group = NativeListWalletGroupCell(frame: CGRect(x: 0, y: 0, width: 320, height: 200))
|
|
223
|
+
let item = try NativeListItem(data: [
|
|
224
|
+
"type": "walletGroup", "key": "group",
|
|
225
|
+
"parent": ["type": "identity", "key": "parent", "title": "Parent", "variant": "wallet"],
|
|
226
|
+
"children": [["type": "identity", "key": "child", "title": "Child", "variant": "wallet"]],
|
|
227
|
+
])
|
|
228
|
+
func labels(_ view: UIView) -> [UILabel] {
|
|
229
|
+
(view as? UILabel).map { [$0] } ?? view.subviews.flatMap(labels)
|
|
230
|
+
}
|
|
231
|
+
for face in ["Courier", "Georgia"] {
|
|
232
|
+
let fonts = NativeListFontFamilies(names: ["regular": face, "medium": face, "semibold": face])
|
|
233
|
+
group.bind(
|
|
234
|
+
item: item, theme: nil, layout: "linear", selected: false,
|
|
235
|
+
checkboxState: { _, _, fallback in fallback }, fonts: fonts)
|
|
236
|
+
let rendered = labels(group)
|
|
237
|
+
let members = rendered.filter { ["Parent", "Child"].contains($0.text ?? "") }
|
|
238
|
+
XCTAssertGreaterThanOrEqual(members.count, 2)
|
|
239
|
+
XCTAssertTrue(members.allSatisfy { $0.font.fontName == face })
|
|
240
|
+
XCTAssertEqual(rendered.first { $0.text == "+1" }?.font.fontName, face)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
169
244
|
private func snapshot(footer: [String: Any]?) throws -> String {
|
|
170
245
|
var value: [String: Any] = [
|
|
171
246
|
"schemaVersion": 1, "generation": 1, "layout": ["kind": "linear"], "rows": [],
|
package/lib/module/NativeList.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { useNativeListFontFamiliesJson } from "./fonts.js";
|
|
3
4
|
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
5
|
import { OneKeyImageCache, OneKeyImageCachePolicy } from '@onekeyfe/react-native-image';
|
|
5
6
|
import { NativeAvatarPrefetchModel, NativeAvatarPrefetchQueue } from "./avatarPrefetch.js";
|
|
6
|
-
import {
|
|
7
|
+
import { View } from 'react-native';
|
|
7
8
|
import { callback, getHostComponent } from 'react-native-nitro-modules';
|
|
8
9
|
import { isSelectableRow } from "./selection.js";
|
|
9
10
|
import { normalizeIndexScroll, normalizeKeyScroll, normalizePositionScroll, resolveLocationIndex, scrollFailure, validateOffset } from "./scrolling.js";
|
|
10
11
|
import { applyRowPatches, serializePatches, serializeSnapshot } from "./validation.js";
|
|
11
|
-
import { jsx as _jsx
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
const NativeListConfig = require('../nitrogen/generated/shared/json/NativeListConfig.json');
|
|
13
14
|
const NativeListHost = getHostComponent('NativeList', () => NativeListConfig);
|
|
14
15
|
export function preloadNativeListAvatarImages(sources) {
|
|
@@ -30,8 +31,6 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
|
30
31
|
listHeader,
|
|
31
32
|
listFooter,
|
|
32
33
|
listEmpty,
|
|
33
|
-
topOverlay,
|
|
34
|
-
topScrollEdgeEffect,
|
|
35
34
|
scrollPositionThresholds,
|
|
36
35
|
webVirtualizationEnabled: _webVirtualizationEnabled,
|
|
37
36
|
webSectionIndexContainerRef: _webSectionIndexContainerRef,
|
|
@@ -52,9 +51,8 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
|
52
51
|
initialScrollViewOffset,
|
|
53
52
|
...viewProps
|
|
54
53
|
}, forwardedRef) {
|
|
54
|
+
const fontFamiliesJson = useNativeListFontFamiliesJson();
|
|
55
55
|
const [slotHeights, setSlotHeights] = useState([0, 0, 0]);
|
|
56
|
-
const [topOverlayHeight, setTopOverlayHeight] = useState(0);
|
|
57
|
-
const hasTopOverlay = Platform?.OS === 'ios' && parseInt(String(Platform.Version), 10) >= 26 && topScrollEdgeEffect === 'hard' && topOverlay != null;
|
|
58
56
|
const containerSlotHeightsJson = JSON.stringify(slotHeights);
|
|
59
57
|
const slotInset = snapshot.layout.contentPaddingHorizontal ?? snapshot.layout.contentPadding ?? 0;
|
|
60
58
|
if (snapshot.layout.orientation === 'horizontal' && (listHeader || listEmpty || listFooter)) {
|
|
@@ -317,17 +315,16 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
|
317
315
|
callbacksRef.current.onVisibleRangeChanged?.(payload);
|
|
318
316
|
})
|
|
319
317
|
}), []);
|
|
320
|
-
return /*#__PURE__*/
|
|
318
|
+
return /*#__PURE__*/_jsx(NativeListHost, {
|
|
321
319
|
...viewProps,
|
|
322
320
|
...nativeCallbacks,
|
|
321
|
+
fontFamiliesJson: fontFamiliesJson,
|
|
323
322
|
snapshotJson: snapshotJson,
|
|
324
323
|
containerSlotHeightsJson: containerSlotHeightsJson,
|
|
325
|
-
topScrollEdgeHard: hasTopOverlay,
|
|
326
|
-
topOverlayHeight: hasTopOverlay ? topOverlayHeight : 0,
|
|
327
324
|
scrollPositionThresholdsJson: scrollPositionThresholdsJson,
|
|
328
325
|
keyboardDismissMode: keyboardDismissMode,
|
|
329
326
|
keyboardShouldPersistTaps: normalizedKeyboardShouldPersistTaps,
|
|
330
|
-
children:
|
|
327
|
+
children: slotContents.map((content, index) => /*#__PURE__*/_jsx(View, {
|
|
331
328
|
collapsable: false,
|
|
332
329
|
style: {
|
|
333
330
|
position: 'absolute',
|
|
@@ -340,20 +337,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
|
340
337
|
setSlotHeights(previous => previous[index] === height ? previous : previous.map((value, slot) => slot === index ? height : value));
|
|
341
338
|
},
|
|
342
339
|
children: content
|
|
343
|
-
}, index))
|
|
344
|
-
collapsable: false,
|
|
345
|
-
style: {
|
|
346
|
-
position: 'absolute',
|
|
347
|
-
top: 0,
|
|
348
|
-
left: 0,
|
|
349
|
-
right: 0
|
|
350
|
-
},
|
|
351
|
-
onLayout: event => {
|
|
352
|
-
const height = Math.ceil(event.nativeEvent.layout.height);
|
|
353
|
-
setTopOverlayHeight(previous => previous === height ? previous : height);
|
|
354
|
-
},
|
|
355
|
-
children: topOverlay
|
|
356
|
-
}) : null]
|
|
340
|
+
}, index))
|
|
357
341
|
});
|
|
358
342
|
});
|
|
359
343
|
//# sourceMappingURL=NativeList.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { useNativeListFontFamiliesJson } from "./fonts.js";
|
|
3
4
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
5
|
import { View } from 'react-native';
|
|
5
6
|
import { normalizeIndexScroll, normalizeKeyScroll, normalizePositionScroll, resolveLocationIndex, scrollFailure, validateOffset } from "./scrolling.js";
|
|
@@ -25,8 +26,6 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
|
25
26
|
listHeader: _listHeader,
|
|
26
27
|
listEmpty: _listEmpty,
|
|
27
28
|
listFooter: _listFooter,
|
|
28
|
-
topOverlay: _topOverlay,
|
|
29
|
-
topScrollEdgeEffect: _topScrollEdgeEffect,
|
|
30
29
|
scrollPositionThresholds: _scrollPositionThresholds,
|
|
31
30
|
onScrollPositionThresholdChange: _onScrollPositionThresholdChange,
|
|
32
31
|
webVirtualizationEnabled = true,
|
|
@@ -47,6 +46,9 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
|
47
46
|
initialScrollViewOffset,
|
|
48
47
|
...viewProps
|
|
49
48
|
}, forwardedRef) {
|
|
49
|
+
const fontFamiliesJson = useNativeListFontFamiliesJson();
|
|
50
|
+
const fontFamiliesJsonRef = useRef(fontFamiliesJson);
|
|
51
|
+
fontFamiliesJsonRef.current = fontFamiliesJson;
|
|
50
52
|
const [host, setHost] = useState(null);
|
|
51
53
|
const engineRef = useRef(undefined);
|
|
52
54
|
const webVirtualizationEnabledRef = useRef(webVirtualizationEnabled);
|
|
@@ -89,7 +91,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
|
89
91
|
const didApplyInitialScroll = useRef(false);
|
|
90
92
|
useEffect(() => {
|
|
91
93
|
if (!host) return;
|
|
92
|
-
const engine = new NativeListWebEngine(host, snapshotRef.current, callbacksRef.current, webVirtualizationEnabledRef.current, webSectionIndexContainerRef?.current);
|
|
94
|
+
const engine = new NativeListWebEngine(host, snapshotRef.current, callbacksRef.current, webVirtualizationEnabledRef.current, webSectionIndexContainerRef?.current, fontFamiliesJsonRef.current);
|
|
93
95
|
engineRef.current = engine;
|
|
94
96
|
appliedSnapshotRef.current = snapshotRef.current;
|
|
95
97
|
const pending = pendingPatchesRef.current;
|
|
@@ -105,6 +107,9 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
|
|
|
105
107
|
if (engineRef.current === engine) engineRef.current = undefined;
|
|
106
108
|
};
|
|
107
109
|
}, [host, webSectionIndexContainerRef]);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
engineRef.current?.setFontFamiliesJson(fontFamiliesJson);
|
|
112
|
+
}, [fontFamiliesJson]);
|
|
108
113
|
useEffect(() => {
|
|
109
114
|
engineRef.current?.setVirtualizationEnabled(webVirtualizationEnabled);
|
|
110
115
|
}, [webVirtualizationEnabled]);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useSyncExternalStore } from 'react';
|
|
4
|
+
const weights = ['regular', 'medium', 'semibold', 'bold'];
|
|
5
|
+
let configuration = '{}';
|
|
6
|
+
const listeners = new Set();
|
|
7
|
+
|
|
8
|
+
/** Configure names already provided by the host in this JavaScript runtime. */
|
|
9
|
+
export function configureNativeListFonts(families) {
|
|
10
|
+
if (!families || typeof families !== 'object' || Array.isArray(families)) {
|
|
11
|
+
throw new TypeError('NativeList font families must be an object');
|
|
12
|
+
}
|
|
13
|
+
if (Object.keys(families).some(key => !weights.includes(key))) {
|
|
14
|
+
throw new TypeError('Unknown NativeList font weight');
|
|
15
|
+
}
|
|
16
|
+
const normalized = {};
|
|
17
|
+
for (const weight of weights) {
|
|
18
|
+
const name = families[weight];
|
|
19
|
+
if (name === undefined) continue;
|
|
20
|
+
if (typeof name !== 'string' || Array.from(name).some(character => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127)) {
|
|
21
|
+
throw new TypeError(`Invalid NativeList ${weight} font family`);
|
|
22
|
+
}
|
|
23
|
+
const trimmed = name.trim();
|
|
24
|
+
if (trimmed.length === 0 || trimmed.length > 128) {
|
|
25
|
+
throw new TypeError(`Invalid NativeList ${weight} font family`);
|
|
26
|
+
}
|
|
27
|
+
normalized[weight] = trimmed;
|
|
28
|
+
}
|
|
29
|
+
const next = JSON.stringify(normalized);
|
|
30
|
+
if (next === configuration) return;
|
|
31
|
+
configuration = next;
|
|
32
|
+
listeners.forEach(listener => listener());
|
|
33
|
+
}
|
|
34
|
+
function subscribe(listener) {
|
|
35
|
+
listeners.add(listener);
|
|
36
|
+
return () => listeners.delete(listener);
|
|
37
|
+
}
|
|
38
|
+
function getSnapshot() {
|
|
39
|
+
return configuration;
|
|
40
|
+
}
|
|
41
|
+
export function useNativeListFontFamiliesJson() {
|
|
42
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=fonts.js.map
|
package/lib/module/index.js
CHANGED
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
export { NativeList, preloadNativeListAvatarImages } from './NativeList';
|
|
4
4
|
export { applyRowPatches, serializePatches, serializeSnapshot, validatePatches, validateSnapshot } from "./validation.js";
|
|
5
5
|
export { checkboxStateForKeys, checkboxStateForSection, isSelectableRow, reduceSelection, selectionStateFromSnapshot } from "./selection.js";
|
|
6
|
+
export { configureNativeListFonts } from "./fonts.js";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { applyTextWeight } from "./templates/RowText.js";
|
|
3
4
|
import { applyRowContainerStyle, resetRowContainerStyle } from "./templates/RowContainerStyle.js";
|
|
4
5
|
import { hasExplicitRowHeight, rowSizeModifier } from "./templates/RowElements.js";
|
|
5
6
|
import { applyTextStyleToSlot, applyValueSegments } from "./templates/RowText.js";
|
|
@@ -416,7 +417,7 @@ export function webMarketImageBindDeltaForPatches(patches) {
|
|
|
416
417
|
// OneKey patch: selector names must shrink before the sidebar clips their contents.
|
|
417
418
|
export const WEB_LIST_CSS = `
|
|
418
419
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
419
|
-
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-family:
|
|
420
|
+
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-family:var(--nl-font-regular);font-synthesis:none}
|
|
420
421
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
421
422
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
422
423
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
@@ -445,10 +446,10 @@ export const WEB_LIST_CSS = `
|
|
|
445
446
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-row>*{visibility:hidden}
|
|
446
447
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-wallet-group{border-color:transparent;background:var(--nl-pressed)}
|
|
447
448
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-wallet-group>*{visibility:hidden}
|
|
448
|
-
.ok-native-list-reorder-preview{position:fixed;left:0;top:0;z-index:100001;pointer-events:none;overflow:hidden;border-radius:12px;box-shadow:0 4px 24px rgba(0,0,0,.12);transform-origin:center;will-change:transform;font-family:
|
|
449
|
+
.ok-native-list-reorder-preview{position:fixed;left:0;top:0;z-index:100001;pointer-events:none;overflow:hidden;border-radius:12px;box-shadow:0 4px 24px rgba(0,0,0,.12);transform-origin:center;will-change:transform;font-synthesis:none;font-family:var(--nl-font-regular)}
|
|
449
450
|
.ok-native-list-reorder-preview>.ok-native-list-row{background:var(--nl-pressed);cursor:grabbing}
|
|
450
451
|
.ok-native-list-reorder-preview[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
451
|
-
.ok-native-list-reorder-count{position:absolute;right:4px;bottom:4px;display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:24px;height:24px;padding:0 6px;border:1px solid var(--nl-row);border-radius:12px;background:var(--nl-inverse);color:var(--nl-inverse-text);font-size:12px;line-height:22px;font-weight:600}
|
|
452
|
+
.ok-native-list-reorder-count{position:absolute;right:4px;bottom:4px;display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:24px;height:24px;padding:0 6px;border:1px solid var(--nl-row);border-radius:12px;background:var(--nl-inverse);color:var(--nl-inverse-text);font-size:12px;line-height:22px;font-weight:600;font-family:var(--nl-font-semibold)}
|
|
452
453
|
.ok-native-list-item[data-separator="true"]>.ok-native-list-row{border-bottom:1px solid var(--nl-separator-color,var(--nl-separator))}
|
|
453
454
|
/* An inset separator keeps the transparent border so the row's height is unchanged, and paints the visible line with a logical-inset overlay so it follows RTL. */
|
|
454
455
|
.ok-native-list-root[data-separator-inset="true"] .ok-native-list-item[data-separator="true"]>.ok-native-list-row{position:relative;border-bottom-color:transparent}
|
|
@@ -457,30 +458,30 @@ export const WEB_LIST_CSS = `
|
|
|
457
458
|
.ok-native-list-item[data-group-position="last"]>.ok-native-list-row{border-radius:0 0 var(--nl-group-radius,12px) var(--nl-group-radius,12px)}
|
|
458
459
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
459
460
|
.ok-native-list-standard{padding:8px 12px}.ok-native-list-network-row{padding:0 12px}.ok-native-list-wallet-row{padding:4px 8px;flex-direction:column;justify-content:center;gap:4px}.ok-native-list-account-row{padding:4px 12px;gap:8px}
|
|
460
|
-
.ok-native-list-account-row .ok-native-list-visual,.ok-native-list-account-action-row .ok-native-list-visual{width:32px;height:32px;flex-basis:32px}.ok-native-list-account-row .ok-native-list-visual>img,.ok-native-list-account-row .ok-native-list-visual-main,.ok-native-list-account-action-row .ok-native-list-visual>img,.ok-native-list-account-action-row .ok-native-list-visual-main{width:32px;height:32px}.ok-native-list-account-row .ok-native-list-visual>.ok-native-list-visual-corner{width:20px;height:20px;padding:2px}.ok-native-list-account-action-row .ok-native-list-visual{border-radius:8px!important}.ok-native-list-wallet-row .ok-native-list-title{color:var(--nl-secondary);font-size:12px;line-height:16px;font-weight:400}.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-wallet-row .ok-native-list-title{color:var(--nl-primary)}.ok-native-list-account-row .ok-native-list-title{font-size:16px;line-height:20px;font-weight:400}.ok-native-list-account-row .ok-native-list-secondary{font-size:14px;line-height:20px;font-weight:400}
|
|
461
|
-
.ok-native-list-flex{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:center}.ok-native-list-title{font-size:15px;line-height:20px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-secondary{font-size:13px;line-height:18px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-tertiary{color:var(--nl-secondary)}.ok-native-list-info{color:var(--nl-info)}
|
|
461
|
+
.ok-native-list-account-row .ok-native-list-visual,.ok-native-list-account-action-row .ok-native-list-visual{width:32px;height:32px;flex-basis:32px}.ok-native-list-account-row .ok-native-list-visual>img,.ok-native-list-account-row .ok-native-list-visual-main,.ok-native-list-account-action-row .ok-native-list-visual>img,.ok-native-list-account-action-row .ok-native-list-visual-main{width:32px;height:32px}.ok-native-list-account-row .ok-native-list-visual>.ok-native-list-visual-corner{width:20px;height:20px;padding:2px}.ok-native-list-account-action-row .ok-native-list-visual{border-radius:8px!important}.ok-native-list-wallet-row .ok-native-list-title{color:var(--nl-secondary);font-size:12px;line-height:16px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-wallet-row .ok-native-list-title{color:var(--nl-primary)}.ok-native-list-account-row .ok-native-list-title{font-size:16px;line-height:20px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-account-row .ok-native-list-secondary{font-size:14px;line-height:20px;font-weight:400;font-family:var(--nl-font-regular)}
|
|
462
|
+
.ok-native-list-flex{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:center}.ok-native-list-title{font-size:15px;line-height:20px;font-weight:600;font-family:var(--nl-font-semibold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-secondary{font-size:13px;line-height:18px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-tertiary{color:var(--nl-secondary)}.ok-native-list-info{color:var(--nl-info)}
|
|
462
463
|
.ok-native-list-identity-row .ok-native-list-title,.ok-native-list-identity-row .ok-native-list-amounts>span:first-child{font-size:16px;line-height:20px}.ok-native-list-identity-row .ok-native-list-secondary{font-size:14px;line-height:20px}
|
|
463
|
-
.ok-native-list-value{font-size:14px;line-height:20px;font-weight:500;white-space:nowrap}.ok-native-list-time{font-size:11px;line-height:16px;color:var(--nl-secondary);align-self:flex-start}.ok-native-list-amounts{display:flex;flex-direction:column;align-items:flex-end;min-width:0}.ok-native-list-actions{display:flex;gap:16px;margin-top:6px}
|
|
464
|
-
.ok-native-list-action-button{appearance:none;border:0;background:transparent;padding:2px;color:var(--nl-accent);font:600 12px/16px
|
|
465
|
-
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;overflow:hidden}.ok-native-list-visual>.ok-native-list-visual-corner{position:absolute;right:-4px;bottom:-4px;width:18px;height:18px;padding:2px;border-radius:50%;background:var(--nl-row);object-fit:cover}.ok-native-list-stacked{display:flex;align-items:center;width:48px;flex-basis:48px}.ok-native-list-stacked img{width:28px;height:28px;border:2px solid var(--nl-row);border-radius:50%;object-fit:cover;margin-left:-10px}.ok-native-list-stacked img:first-child{margin-left:0}
|
|
466
|
-
.ok-native-list-accessories{display:flex;align-items:center;gap:10px;min-width:0}.ok-native-list-accessory{font-size:14px;color:var(--nl-primary);white-space:nowrap}.ok-native-list-accessory-secondary{color:var(--nl-secondary)}.ok-native-list-icon-button{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;border:0;background:transparent;color:var(--nl-icon);font-size:20px;line-height:1;font-weight:500;font-family:
|
|
464
|
+
.ok-native-list-value{font-size:14px;line-height:20px;font-weight:500;font-family:var(--nl-font-medium);white-space:nowrap}.ok-native-list-time{font-size:11px;line-height:16px;color:var(--nl-secondary);align-self:flex-start}.ok-native-list-amounts{display:flex;flex-direction:column;align-items:flex-end;min-width:0}.ok-native-list-actions{display:flex;gap:16px;margin-top:6px}
|
|
465
|
+
.ok-native-list-action-button{appearance:none;border:0;background:transparent;padding:2px;color:var(--nl-accent);font:600 12px/16px var(--nl-font-semibold);cursor:pointer}.ok-native-list-action-button[data-tone="danger"]{color:var(--nl-negative)}.ok-native-list-action-button:disabled{opacity:.5;cursor:default}
|
|
466
|
+
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;font-family:var(--nl-font-semibold);overflow:hidden}.ok-native-list-visual>.ok-native-list-visual-corner{position:absolute;right:-4px;bottom:-4px;width:18px;height:18px;padding:2px;border-radius:50%;background:var(--nl-row);object-fit:cover}.ok-native-list-stacked{display:flex;align-items:center;width:48px;flex-basis:48px}.ok-native-list-stacked img{width:28px;height:28px;border:2px solid var(--nl-row);border-radius:50%;object-fit:cover;margin-left:-10px}.ok-native-list-stacked img:first-child{margin-left:0}
|
|
467
|
+
.ok-native-list-accessories{display:flex;align-items:center;gap:10px;min-width:0}.ok-native-list-accessory{font-size:14px;color:var(--nl-primary);white-space:nowrap}.ok-native-list-accessory-secondary{color:var(--nl-secondary)}.ok-native-list-icon-button{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;border:0;background:transparent;color:var(--nl-icon);font-size:20px;line-height:1;font-weight:500;font-family:var(--nl-font-medium);cursor:pointer}.ok-native-list-checkbox{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:20px;height:20px;border:2px solid color-mix(in srgb,var(--nl-primary) 19%,transparent);border-radius:5px;background:var(--nl-row);cursor:pointer}.ok-native-list-checkbox[data-state="checked"],.ok-native-list-checkbox[data-state="indeterminate"]{border-color:transparent;background:var(--nl-primary)}.ok-native-list-checkbox[data-state="checked"]::after{content:"";width:6px;height:10px;margin-top:-2px;border-right:2px solid var(--nl-row);border-bottom:2px solid var(--nl-row);transform:rotate(45deg)}.ok-native-list-checkbox[data-state="indeterminate"]::after{content:"";width:8px;height:2px;border-radius:1px;background:var(--nl-row)}.ok-native-list-spinner{width:16px;height:16px;border:2px solid var(--nl-separator);border-top-color:var(--nl-primary);border-radius:50%;animation:ok-native-list-spin .8s linear infinite}@keyframes ok-native-list-spin{to{transform:rotate(360deg)}}
|
|
467
468
|
.ok-native-list-badge{display:inline-flex;align-items:center;max-width:100%;height:18px;padding:0 5px;border-radius:5px;background:color-mix(in srgb,var(--nl-accent) 12%,transparent);color:var(--nl-accent);font-size:11px;line-height:18px;white-space:nowrap}.ok-native-list-badge[data-tone="danger"]{background:var(--nl-critical);color:var(--nl-negative)}.ok-native-list-badges{display:inline-flex;gap:4px;margin-left:6px;vertical-align:middle}
|
|
468
|
-
.ok-native-list-section{padding:0 8px;background:var(--nl-bg);gap:8px}.ok-native-list-section[data-variant="summary"]{padding:0 20px}.ok-native-list-section[data-variant="gallery"]{padding:0 12px}.ok-native-list-section[data-variant="history"]{padding:0 8px}.ok-native-list-section-title{font-size:13px;line-height:18px;font-weight:700;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-section[data-variant="summary"] .ok-native-list-section-title{font-size:16px;font-weight:500;color:var(--nl-primary)}.ok-native-list-section[data-variant="gallery"] .ok-native-list-section-title{font-size:16px;color:var(--nl-primary)}.ok-native-list-section[data-variant="history"] .ok-native-list-section-title{font-size:12px;line-height:16px}.ok-native-list-section-value{margin-left:auto}
|
|
469
|
-
.ok-native-list-action-row{justify-content:space-between;padding:0 16px}.ok-native-list-action-title{font-size:15px;font-weight:600;color:var(--nl-accent)}.ok-native-list-action-title[data-tone="danger"]{color:var(--nl-negative)}
|
|
470
|
-
.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}
|
|
469
|
+
.ok-native-list-section{padding:0 8px;background:var(--nl-bg);gap:8px}.ok-native-list-section[data-variant="summary"]{padding:0 20px}.ok-native-list-section[data-variant="gallery"]{padding:0 12px}.ok-native-list-section[data-variant="history"]{padding:0 8px}.ok-native-list-section-title{font-size:13px;line-height:18px;font-weight:700;font-family:var(--nl-font-bold);color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-section[data-variant="summary"] .ok-native-list-section-title{font-size:16px;font-weight:500;font-family:var(--nl-font-medium);color:var(--nl-primary)}.ok-native-list-section[data-variant="gallery"] .ok-native-list-section-title{font-size:16px;color:var(--nl-primary)}.ok-native-list-section[data-variant="history"] .ok-native-list-section-title{font-size:12px;line-height:16px}.ok-native-list-section-value{margin-left:auto}
|
|
470
|
+
.ok-native-list-action-row{justify-content:space-between;padding:0 16px}.ok-native-list-action-title{font-size:15px;font-weight:600;font-family:var(--nl-font-semibold);color:var(--nl-accent)}.ok-native-list-action-title[data-tone="danger"]{color:var(--nl-negative)}
|
|
471
|
+
.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)}
|
|
471
472
|
.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}
|
|
472
|
-
.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}
|
|
473
|
-
.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}.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%;font:18px/20px
|
|
474
|
-
.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}.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}.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)}
|
|
475
|
-
.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}.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}
|
|
476
|
-
.ok-native-list-market{padding:12px 20px;gap:14px}.ok-native-list-market>.ok-native-list-visual{width:32px;height:32px;flex-basis:32px}.ok-native-list-market[data-variant="stock"]>.ok-native-list-visual{width:40px;height:40px;flex-basis:40px}.ok-native-list-market>.ok-native-list-visual>.ok-native-list-visual-main{width:100%;height:100%}.ok-native-list-market-main{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:center}.ok-native-list-market-title-line{display:flex;align-items:center;min-width:0;gap:4px}.ok-native-list-market-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--nl-primary);font-size:16px;line-height:24px;font-weight:500}.ok-native-list-market-subtitle{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--nl-secondary);font-size:14px;line-height:20px;font-weight:400}.ok-native-list-market-badge{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;box-sizing:border-box;max-width:72px;height:18px;padding:0 5px;border:0;border-radius:4px;background:var(--nl-strong);color:var(--nl-secondary);font:500 11px/18px
|
|
473
|
+
.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;font-family:var(--nl-font-medium);white-space:nowrap}
|
|
474
|
+
.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;font-family:var(--nl-font-medium);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.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%;font:18px/20px var(--nl-font-regular);cursor:pointer}
|
|
475
|
+
.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)}
|
|
476
|
+
.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;font-family:var(--nl-font-medium);white-space:nowrap}.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}
|
|
477
|
+
.ok-native-list-market{padding:12px 20px;gap:14px}.ok-native-list-market>.ok-native-list-visual{width:32px;height:32px;flex-basis:32px}.ok-native-list-market[data-variant="stock"]>.ok-native-list-visual{width:40px;height:40px;flex-basis:40px}.ok-native-list-market>.ok-native-list-visual>.ok-native-list-visual-main{width:100%;height:100%}.ok-native-list-market-main{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:center}.ok-native-list-market-title-line{display:flex;align-items:center;min-width:0;gap:4px}.ok-native-list-market-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--nl-primary);font-size:16px;line-height:24px;font-weight:500;font-family:var(--nl-font-medium)}.ok-native-list-market-subtitle{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--nl-secondary);font-size:14px;line-height:20px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-market-badge{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;box-sizing:border-box;max-width:72px;height:18px;padding:0 5px;border:0;border-radius:4px;background:var(--nl-strong);color:var(--nl-secondary);font:500 11px/18px var(--nl-font-medium);overflow:hidden;white-space:nowrap}.ok-native-list-market-badge img{width:14px;height:14px;object-fit:contain}.ok-native-list-market-trailing{display:flex;flex:0 0 auto;align-items:center;gap:8px}.ok-native-list-market-price{max-width:112px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right;color:var(--nl-primary);font-size:16px;line-height:24px;font-weight:500;font-family:var(--nl-font-medium);font-variant-numeric:tabular-nums}.ok-native-list-market-change{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:80px;height:32px;border-radius:8px;color:#fff;background:#8d8d8d;font-size:14px;line-height:20px;font-weight:500;font-family:var(--nl-font-medium);font-variant-numeric:tabular-nums;white-space:nowrap}.ok-native-list-market-change[data-tone="positive"]{background:var(--nl-positive)}.ok-native-list-market-change[data-tone="negative"]{background:var(--nl-negative)}
|
|
477
478
|
.ok-native-list-market-badge>svg,.ok-native-list-market-badge>.ok-native-list-market-badge-icon>svg{display:block;width:16px;height:16px;flex:0 0 16px}.ok-native-list-system[data-native-list-presentation="market"]{box-sizing:border-box;padding:12px 20px}.ok-native-list-system[data-native-list-presentation="market"]>.ok-native-list-spinner{width:32px;height:32px}
|
|
478
|
-
.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}.ok-native-list-index-preview[data-visible="true"]{opacity:1;transform:translateY(-50%) scale(1)}
|
|
479
|
+
.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;font-family:var(--nl-font-semibold);opacity:0;pointer-events:none;transition:opacity .15s ease,transform .15s ease}.ok-native-list-index-preview[data-visible="true"]{opacity:1;transform:translateY(-50%) scale(1)}
|
|
479
480
|
.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}
|
|
480
481
|
@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)}}
|
|
481
|
-
.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;box-shadow:0 1px 0 var(--nl-separator)}.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:
|
|
482
|
+
.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;box-shadow:0 1px 0 var(--nl-separator)}.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-synthesis:none;font-family:var(--nl-font-regular)}.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-family:inherit;font-size:10px;font-weight:400;font-family:var(--nl-font-regular);line-height:1;cursor:pointer;opacity:.5;transition:opacity .15s ease}.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}
|
|
482
483
|
.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)}
|
|
483
|
-
.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)}.ok-native-list-warning-message{font-weight:400;color:var(--nl-secondary)}
|
|
484
|
+
.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;font-family:var(--nl-font-medium);color:var(--nl-primary)}.ok-native-list-warning-message{font-weight:400;font-family:var(--nl-font-regular);color:var(--nl-secondary)}
|
|
484
485
|
.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. */
|
|
485
486
|
.ok-native-list-checkbox[data-selector="networkSelector"]{padding:0;border-radius:4px;border-color:var(--nl-checkbox-border,var(--nl-separator));background:var(--nl-checkbox-icon,var(--nl-inverse-text))}
|
|
486
487
|
.ok-native-list-checkbox[data-selector="networkSelector"]::after{display:none}
|
|
@@ -492,7 +493,7 @@ export const WEB_LIST_CSS = `
|
|
|
492
493
|
/* OneKey patch: selected group members use the same primary title color as standalone wallets. */
|
|
493
494
|
.ok-native-list-wallet-member[data-native-list-selected="true"]>.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-title{color:var(--nl-primary)}
|
|
494
495
|
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges{height:18px}
|
|
495
|
-
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges>.ok-native-list-badge{font-size:11px;line-height:14px;font-weight:400;height:18px;padding:2px 6px;border-radius:4px;background:var(--nl-subdued);color:var(--nl-secondary)}
|
|
496
|
+
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges>.ok-native-list-badge{font-size:11px;line-height:14px;font-weight:400;font-family:var(--nl-font-regular);height:18px;padding:2px 6px;border-radius:4px;background:var(--nl-subdued);color:var(--nl-secondary)}
|
|
496
497
|
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges>.ok-native-list-badge[data-tone="warning"]{background:var(--nl-caution-background);color:var(--nl-caution)}
|
|
497
498
|
.ok-native-list-account-row[data-native-list-selector="accountSelector"] .ok-native-list-accessories>.ok-native-list-icon-button{box-sizing:border-box;flex:0 0 38px;width:38px;height:38px;margin:-7px;padding:7px}
|
|
498
499
|
.ok-native-list-account-row[data-native-list-selector="accountSelector"] .ok-native-list-accessories>.ok-native-list-icon-button[data-native-list-action]:not([data-native-list-account-control="createAddress"]):hover{background:var(--nl-strong);border-radius:50%}
|
|
@@ -500,7 +501,7 @@ export const WEB_LIST_CSS = `
|
|
|
500
501
|
/* OneKey patch: AccountSelectorAccountListItem fixes the borderless Plus slot at top18/right20. */
|
|
501
502
|
.ok-native-list-account-row[data-native-list-selector="accountSelector"]>.ok-native-list-accessories[data-native-list-account-control="createAddress"]{position:absolute;top:18px;right:12px}
|
|
502
503
|
.ok-native-list-account-row[data-native-list-selector="accountSelector"] .ok-native-list-accessories>[data-native-list-account-control="createAddress"]{flex-basis:36px;width:36px;height:36px;padding:6px;border-radius:8px}
|
|
503
|
-
.ok-native-list-account-action-row{padding-left:12px;padding-right:12px}.ok-native-list-account-action-row .ok-native-list-action-title{font-size:16px;line-height:24px;font-weight:400}.ok-native-list-account-action-row .ok-native-list-action-title[data-tone="primary"]{color:var(--nl-primary)}
|
|
504
|
+
.ok-native-list-account-action-row{padding-left:12px;padding-right:12px}.ok-native-list-account-action-row .ok-native-list-action-title{font-size:16px;line-height:24px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-account-action-row .ok-native-list-action-title[data-tone="primary"]{color:var(--nl-primary)}
|
|
504
505
|
/* OneKey patch: account selector wallets and accounts keep the default cursor instead of pointer or grab affordances.
|
|
505
506
|
Only the row surface is matched: cursor inherits, so plain children follow the row, while icon buttons,
|
|
506
507
|
checkboxes, and action buttons keep advertising themselves with their own pointer cursor. */
|
|
@@ -1024,7 +1025,7 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1024
1025
|
if (isWalletText) {
|
|
1025
1026
|
corner.style.fontSize = '12px';
|
|
1026
1027
|
corner.style.lineHeight = '16px';
|
|
1027
|
-
corner
|
|
1028
|
+
applyTextWeight(corner, '400');
|
|
1028
1029
|
}
|
|
1029
1030
|
if (isWalletText || overlay.width !== undefined || overlay.height !== undefined) corner.style.borderRadius = '9999px';
|
|
1030
1031
|
const offsetX = String(-(overlay.offsetX ?? overlay.offset ?? 2)) + 'px';
|
|
@@ -1266,7 +1267,7 @@ export class NativeListWebEngine {
|
|
|
1266
1267
|
behavior: 'instant'
|
|
1267
1268
|
});
|
|
1268
1269
|
};
|
|
1269
|
-
constructor(host, snapshot, callbacks, virtualizationEnabled = true, sectionIndexContainer) {
|
|
1270
|
+
constructor(host, snapshot, callbacks, virtualizationEnabled = true, sectionIndexContainer, fontFamiliesJson = '{}') {
|
|
1270
1271
|
this.document = host.ownerDocument;
|
|
1271
1272
|
this.snapshot = validateSnapshot(snapshot);
|
|
1272
1273
|
this.callbacks = callbacks;
|
|
@@ -1349,8 +1350,31 @@ export class NativeListWebEngine {
|
|
|
1349
1350
|
this.document.defaultView?.addEventListener('resize', this.handleWindowResize);
|
|
1350
1351
|
}
|
|
1351
1352
|
this.observeSectionIndexTransforms();
|
|
1353
|
+
this.applyFontFamilies(fontFamiliesJson);
|
|
1352
1354
|
this.applySnapshot(this.snapshot);
|
|
1353
1355
|
}
|
|
1356
|
+
fontFamiliesJson = '{}';
|
|
1357
|
+
applyFontFamilies(json) {
|
|
1358
|
+
const families = JSON.parse(json);
|
|
1359
|
+
const fallback = '-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif';
|
|
1360
|
+
for (const face of ['regular', 'medium', 'semibold', 'bold']) {
|
|
1361
|
+
const name = families[face];
|
|
1362
|
+
const family = name === undefined ? fallback : `${JSON.stringify(name)},${fallback}`;
|
|
1363
|
+
for (const element of [this.root, this.indexRail, this.reorderPreview]) {
|
|
1364
|
+
element.style.setProperty(`--nl-font-${face}`, family);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
this.fontFamiliesJson = json;
|
|
1368
|
+
}
|
|
1369
|
+
setFontFamiliesJson(json) {
|
|
1370
|
+
if (json === this.fontFamiliesJson || this.destroyed) return;
|
|
1371
|
+
this.invalidateActionAnchor('layout');
|
|
1372
|
+
this.cancelPointerReorder(true);
|
|
1373
|
+
this.cancelKeyboardReorder();
|
|
1374
|
+
this.applyFontFamilies(json);
|
|
1375
|
+
this.measuredRendererHeights.clear();
|
|
1376
|
+
this.recomputeLayout();
|
|
1377
|
+
}
|
|
1354
1378
|
updateCallbacks(callbacks) {
|
|
1355
1379
|
this.callbacks = callbacks;
|
|
1356
1380
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { applyTextWeight } from "./RowText.js";
|
|
3
4
|
import { applyTabularNumbers, hasExplicitRowHeight } from "./RowElements.js";
|
|
4
5
|
import { RowVisualStyle } from "./RowVisual.js";
|
|
5
6
|
const views = new WeakMap();
|
|
@@ -16,7 +17,7 @@ function bind(body, row, primitives) {
|
|
|
16
17
|
v.title.style.cssText = '';
|
|
17
18
|
v.title.textContent = row.title;
|
|
18
19
|
v.title.dataset.tone = row.tone ?? '';
|
|
19
|
-
if (row.presentation === 'accountSelector' && row.icon) v.title
|
|
20
|
+
if (row.presentation === 'accountSelector' && row.icon) applyTextWeight(v.title, '500');
|
|
20
21
|
if (style?.title) primitives.textStyle(v.title, style.title);
|
|
21
22
|
const visualKey = JSON.stringify([row.key, row.icon]);
|
|
22
23
|
if (v.visualKey !== visualKey) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { applyTextWeight } from "./RowText.js";
|
|
3
4
|
import { applyTabularNumbers, hasExplicitRowHeight } from "./RowElements.js";
|
|
4
5
|
import { createElement, setData, tagSlot, markActionAnchorSource, createTextColumn, createBadge } from "./RowElements.js";
|
|
5
6
|
import { applyTextLayout, applyTextStyleToSlot, applyValueSegments } from "./RowText.js";
|
|
@@ -240,7 +241,7 @@ function bind(body, row, primitives) {
|
|
|
240
241
|
if (fallback) {
|
|
241
242
|
fallback.style.fontSize = '19px';
|
|
242
243
|
fallback.style.lineHeight = '27px';
|
|
243
|
-
fallback
|
|
244
|
+
applyTextWeight(fallback, '600');
|
|
244
245
|
fallback.style.color = 'var(--nl-inverse-text)';
|
|
245
246
|
}
|
|
246
247
|
}
|
|
@@ -251,12 +252,12 @@ function bind(body, row, primitives) {
|
|
|
251
252
|
if (title) {
|
|
252
253
|
title.style.fontSize = '16px';
|
|
253
254
|
title.style.lineHeight = '24px';
|
|
254
|
-
title
|
|
255
|
+
applyTextWeight(title, '500');
|
|
255
256
|
}
|
|
256
257
|
body.querySelectorAll('.ok-native-list-accessory').forEach(value => {
|
|
257
258
|
value.style.fontSize = '16px';
|
|
258
259
|
value.style.lineHeight = '24px';
|
|
259
|
-
value
|
|
260
|
+
applyTextWeight(value, '500');
|
|
260
261
|
});
|
|
261
262
|
}
|
|
262
263
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { applyTextWeight } from "./RowText.js";
|
|
3
4
|
import { createElement, setData, markActionAnchorSource } from "./RowElements.js";
|
|
4
5
|
import { applyTextStyleToSlot, applyValueSegments, fontWeight } from "./RowText.js";
|
|
5
6
|
import { RowVisualStyle } from "./RowVisual.js";
|
|
@@ -24,7 +25,7 @@ export function resolveWebMarketLayoutStyle(row) {
|
|
|
24
25
|
function applyMarketTextStyle(element, style, defaults) {
|
|
25
26
|
element.style.fontSize = String(style?.fontSize ?? defaults.fontSize) + 'px';
|
|
26
27
|
element.style.lineHeight = String(style?.lineHeight ?? defaults.lineHeight) + 'px';
|
|
27
|
-
element
|
|
28
|
+
applyTextWeight(element, String(fontWeight(style?.fontWeight, defaults.weight)));
|
|
28
29
|
element.style.color = style?.color ?? '';
|
|
29
30
|
element.style.textAlign = style?.alignment ?? defaults.alignment;
|
|
30
31
|
element.style.whiteSpace = (style?.lines ?? 1) > 1 ? 'normal' : 'nowrap';
|
|
@@ -6,7 +6,7 @@ export function applyValueSegments(element, segments, fontSize = 16, lineHeight
|
|
|
6
6
|
element.textContent = '';
|
|
7
7
|
element.style.fontSize = String(fontSize) + 'px';
|
|
8
8
|
element.style.lineHeight = String(lineHeight) + 'px';
|
|
9
|
-
element
|
|
9
|
+
applyTextWeight(element, String(weight));
|
|
10
10
|
segments.forEach(segment => {
|
|
11
11
|
const span = createElement(element.ownerDocument, 'span', undefined, segment.text);
|
|
12
12
|
if (segment.style === 'subscript') {
|
|
@@ -94,7 +94,7 @@ export function applyTextLayout(element, style, defaultLines) {
|
|
|
94
94
|
export function applyTextStyleToSlot(element, style, defaultLines) {
|
|
95
95
|
if (style.fontSize !== undefined) element.style.fontSize = String(style.fontSize) + 'px';
|
|
96
96
|
if (style.lineHeight !== undefined) element.style.lineHeight = String(style.lineHeight) + 'px';
|
|
97
|
-
if (style.fontWeight !== undefined) element
|
|
97
|
+
if (style.fontWeight !== undefined) applyTextWeight(element, String(fontWeight(style.fontWeight, 400)));
|
|
98
98
|
if (style.color !== undefined) element.style.color = style.color;
|
|
99
99
|
// Explicit overrides also apply to rich text runs, but never to sibling badges.
|
|
100
100
|
// Subscript segments keep their legacy size relative to the field size.
|
|
@@ -104,7 +104,7 @@ export function applyTextStyleToSlot(element, style, defaultLines) {
|
|
|
104
104
|
if (style.fontSize !== undefined) {
|
|
105
105
|
if (subscript) applySubscriptMetrics(run, style.fontSize);else run.style.fontSize = String(style.fontSize) + 'px';
|
|
106
106
|
}
|
|
107
|
-
if (style.fontWeight !== undefined) run
|
|
107
|
+
if (style.fontWeight !== undefined) applyTextWeight(run, String(fontWeight(style.fontWeight, 400)));
|
|
108
108
|
if (style.lineHeight !== undefined && !subscript) run.style.lineHeight = String(style.lineHeight) + 'px';
|
|
109
109
|
if (style.lines !== undefined || style.truncate !== undefined) run.style.whiteSpace = 'inherit';
|
|
110
110
|
});
|
|
@@ -118,4 +118,14 @@ export function fontWeight(value, fallback) {
|
|
|
118
118
|
if (value === 'regular') return 400;
|
|
119
119
|
return fallback;
|
|
120
120
|
}
|
|
121
|
+
export function applyTextWeight(element, weight) {
|
|
122
|
+
element.style.fontWeight = String(weight);
|
|
123
|
+
const face = {
|
|
124
|
+
'400': 'regular',
|
|
125
|
+
'500': 'medium',
|
|
126
|
+
'600': 'semibold',
|
|
127
|
+
'700': 'bold'
|
|
128
|
+
}[String(weight)] ?? 'regular';
|
|
129
|
+
element.style.fontFamily = `var(--nl-font-${face})`;
|
|
130
|
+
}
|
|
121
131
|
//# sourceMappingURL=RowText.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { applyTextWeight } from "./RowText.js";
|
|
3
4
|
import { applyTabularNumbers, hasExplicitRowHeight } from "./RowElements.js";
|
|
4
5
|
import { createElement, setData, tagSlot, markActionAnchorSource, createTextColumn } from "./RowElements.js";
|
|
5
6
|
import { applyValueSegments } from "./RowText.js";
|
|
@@ -36,7 +37,7 @@ function createSectionHeader(document, primitives, row) {
|
|
|
36
37
|
body.style.gap = row.checkbox ? '12px' : '8px';
|
|
37
38
|
title.style.fontSize = row.variant === 'summary' ? '16px' : '14px';
|
|
38
39
|
title.style.lineHeight = row.variant === 'summary' ? '24px' : '20px';
|
|
39
|
-
title
|
|
40
|
+
applyTextWeight(title, row.variant === 'summary' || row.titleActionKey && !row.checkbox ? '500' : '600');
|
|
40
41
|
if (row.titleActionKey) {
|
|
41
42
|
const text = createElement(document, 'span', 'ok-native-list-section-title-text', row.title);
|
|
42
43
|
text.style.overflow = 'hidden';
|
|
@@ -80,7 +81,7 @@ function createSectionHeader(document, primitives, row) {
|
|
|
80
81
|
value.style.fontFamily = 'inherit';
|
|
81
82
|
value.style.fontSize = '16px';
|
|
82
83
|
value.style.lineHeight = '24px';
|
|
83
|
-
value
|
|
84
|
+
applyTextWeight(value, '500');
|
|
84
85
|
if (row.valueActionKey) {
|
|
85
86
|
value.style.color = 'var(--nl-secondary)';
|
|
86
87
|
value.style.padding = '0';
|