@onekeyfe/react-native-native-list 6.7.0-6 → 6.7.0-61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +312 -375
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +50 -13
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +209 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +8 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +130 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1978 -136
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListDescriptionTouchPolicyTest.kt +153 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
- package/docs/ROW_TEMPLATES.md +78 -14
- package/docs/SPEC.md +1318 -16
- package/docs/STYLE_SPEC.md +18 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +237 -51
- package/ios/NativeListActivityDetailsView.swift +43 -16
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +167 -30
- package/ios/NativeListDesignAssets.swift +13 -75
- package/ios/NativeListGeneratedIcons.swift +55 -0
- package/ios/NativeListIconBinding.swift +171 -0
- package/ios/NativeListIdentityRenderer.swift +256 -39
- package/ios/NativeListLeadingVisual.swift +127 -28
- package/ios/NativeListMarketRenderer.swift +120 -31
- package/ios/NativeListMediaPlaceholderView.swift +189 -0
- package/ios/NativeListMediaPreviewSlot.swift +122 -61
- package/ios/NativeListMediaTileRenderer.swift +15 -11
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListMetricCardRenderer.swift +4 -2
- package/ios/NativeListModels.swift +42 -2
- package/ios/NativeListRendererRegistry.swift +1 -0
- package/ios/NativeListResolvedText.swift +17 -5
- package/ios/NativeListRowHost.swift +14 -0
- package/ios/NativeListSectionHeaderRenderer.swift +100 -4
- package/ios/NativeListTextLabel.swift +106 -0
- package/ios/RNCNativeListView.swift +1097 -60
- package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
- package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +423 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
- package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
- package/ios/tests/NativeListLifecycleTests.swift +2959 -4
- package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
- package/ios/tests/NativeListMediaVisibilityTests.swift +41 -7
- package/ios/tests/NativeListSharedIconTests.swift +236 -0
- package/lib/module/NativeList.js +236 -38
- package/lib/module/NativeList.web.js +163 -45
- package/lib/module/index.js +1 -1
- package/lib/module/models.js +3 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +1263 -48
- package/lib/module/web/NativeListGeneratedIcons.js +31 -0
- package/lib/module/web/NativeListWebEngine.js +513 -275
- package/lib/module/web/templates/ActivityRowRenderer.js +41 -54
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
- package/lib/module/web/templates/DataRowRenderer.js +56 -5
- package/lib/module/web/templates/IdentityRowRenderer.js +161 -7
- package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
- package/lib/module/web/templates/MediaTileRowRenderer.js +84 -25
- package/lib/module/web/templates/MessageRowRenderer.js +18 -2
- package/lib/module/web/templates/RowContainerStyle.js +1 -0
- package/lib/module/web/templates/RowRendererRegistry.js +3 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/lib/typescript/src/NativeList.d.ts +3 -3
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
- package/lib/typescript/src/NativeList.types.d.ts +20 -2
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +134 -17
- package/lib/typescript/src/validation.d.ts +20 -0
- package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
- package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/package.json +16 -10
- package/react-native-native-list.podspec +2 -6
- package/scripts/generate-icons.mjs +150 -0
- package/scripts/generate-icons.test.mjs +288 -0
- package/scripts/native-list-icons.json +260 -0
- package/src/NativeList.nitro.ts +2 -0
- package/src/NativeList.tsx +439 -91
- package/src/NativeList.types.ts +24 -2
- package/src/NativeList.web.tsx +286 -88
- package/src/index.ts +2 -0
- package/src/models.ts +272 -144
- package/src/selection.ts +1 -0
- package/src/validation.ts +3041 -146
- package/src/web/NativeListGeneratedIcons.ts +28 -0
- package/src/web/NativeListWebEngine.ts +818 -343
- package/src/web/templates/ActivityRowRenderer.ts +71 -91
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +121 -20
- package/src/web/templates/IdentityRowRenderer.ts +234 -9
- package/src/web/templates/MarketTableRowRenderer.ts +53 -33
- package/src/web/templates/MediaTileRowRenderer.ts +90 -28
- package/src/web/templates/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +11 -1
- package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
- package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
|
|
4
|
+
import { nativeListGeneratedIcons as selectorIcons } from "./NativeListGeneratedIcons.js";
|
|
3
5
|
import { applyTextWeight } from "./templates/RowText.js";
|
|
4
6
|
import { applyRowContainerStyle, resetRowContainerStyle } from "./templates/RowContainerStyle.js";
|
|
5
7
|
import { hasExplicitRowHeight, rowSizeModifier } from "./templates/RowElements.js";
|
|
@@ -11,7 +13,7 @@ import { measureRailWidth } from "./templates/RailRowRenderer.js";
|
|
|
11
13
|
import { rowRenderer, rowRendererKey, recycleRowBody } from "./templates/RowRendererRegistry.js";
|
|
12
14
|
import { checkboxStateForKeys, checkboxStateForSection, isRowPressEnabled, isSelectableRow, reduceSelection, selectionStateFromSnapshot } from "../selection.js";
|
|
13
15
|
import { calculateAlignedScrollOffset, resolveLocationIndex, scrollFailure, validateOffset } from "../scrolling.js";
|
|
14
|
-
import {
|
|
16
|
+
import { applyValidatedRowPatches, containNativeListInput, emptyNativeListSnapshot, validateSnapshot } from "../validation.js";
|
|
15
17
|
import { avatarPrefetchWindow } from "../avatarPrefetch.js";
|
|
16
18
|
import { acquireNativeListAvatar, canonicalNativeListAvatarUri } from "./NativeListWebAvatarCache.js";
|
|
17
19
|
const SECTION_INDEX_CONTENT_INSET = 16;
|
|
@@ -37,7 +39,6 @@ export const WEB_REORDER_ANIMATION = {
|
|
|
37
39
|
const REORDER_TOUCH_LONG_PRESS_MS = 120;
|
|
38
40
|
const MARKET_LONG_PRESS_MS = 800;
|
|
39
41
|
const MARKET_MOVE_CANCEL_PX = 10;
|
|
40
|
-
export const WEB_MARKET_VERIFIED_PATH = 'M9.483 11.458v3.5h-1v-3.5z M10.467 2.698a2.03 2.03 0 0 1 3.065 0l1.358 1.564a.03.03 0 0 0 .028.01l2.046-.325a2.03 2.03 0 0 1 2.347 1.971l.037 2.07q0 .016.014.026l1.776 1.066a2.03 2.03 0 0 1 .532 3.019l-1.304 1.609a.03.03 0 0 0-.005.03l.675 1.956a2.03 2.03 0 0 1-1.533 2.656l-2.033.394a.03.03 0 0 0-.023.019l-.741 1.933a2.03 2.03 0 0 1-2.88 1.05l-1.811-1.006a.03.03 0 0 0-.03 0l-1.811 1.005a2.03 2.03 0 0 1-2.88-1.049l-.742-1.933a.03.03 0 0 0-.023-.019l-2.033-.394a2.03 2.03 0 0 1-1.532-2.656l.675-1.957a.03.03 0 0 0-.005-.029l-1.304-1.61a2.03 2.03 0 0 1 .532-3.018l1.776-1.066a.03.03 0 0 0 .014-.026l.035-2.07a2.03 2.03 0 0 1 2.349-1.97l2.045.324a.03.03 0 0 0 .028-.01zm1.516 3.76a.5.5 0 0 0-.447.276l-1.861 3.724H8.483a1 1 0 0 0-1 1v3.5a1 1 0 0 0 1 1h6.692a2 2 0 0 0 1.981-1.73l.341-2.5a2 2 0 0 0-1.982-2.27h-1.939l.197-1.269a1.5 1.5 0 0 0-1.481-1.731z';
|
|
41
42
|
const REORDER_MOUSE_MOVE_THRESHOLD_PX = 5;
|
|
42
43
|
const REORDER_EDGE_RATIO = 0.25;
|
|
43
44
|
const REORDER_MAX_SPEED_ZONE_RATIO = 0.05;
|
|
@@ -182,6 +183,14 @@ function effectiveRows(snapshot) {
|
|
|
182
183
|
if (snapshot.rows.length > 0) return snapshot.rows;
|
|
183
184
|
return snapshot.emptyState ? [snapshot.emptyState] : [];
|
|
184
185
|
}
|
|
186
|
+
function isDarkBackground(color) {
|
|
187
|
+
const rgb = color ? /^#([0-9a-f]{6})/i.exec(color)?.[1] : undefined;
|
|
188
|
+
if (!rgb) return false;
|
|
189
|
+
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
190
|
+
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
191
|
+
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
192
|
+
return red * 299 + green * 587 + blue * 114 < 128_000;
|
|
193
|
+
}
|
|
185
194
|
function resolvedTheme(snapshot) {
|
|
186
195
|
return {
|
|
187
196
|
...defaultTheme,
|
|
@@ -421,7 +430,7 @@ export const WEB_LIST_CSS = `
|
|
|
421
430
|
.ok-native-list-table-secondary{display:block;min-width:0;overflow:clip}.ok-native-list-table-secondary-track{display:flex;flex-direction:column;transition:transform 100ms ease}.ok-native-list-market-table:focus-within .ok-native-list-table-secondary[data-has-hover="true"]>.ok-native-list-table-secondary-track{transform:translateY(calc(-1 * var(--nl-table-secondary-height)))}@media(hover:hover){.ok-native-list-market-table:hover .ok-native-list-table-secondary[data-has-hover="true"]>.ok-native-list-table-secondary-track{transform:translateY(calc(-1 * var(--nl-table-secondary-height)))}}.ok-native-list-market-table button:focus-visible{outline:2px solid var(--nl-accent);outline-offset:1px}.ok-native-list-market-table button:hover{opacity:.75}.ok-native-list-market-table button:active{opacity:.5}
|
|
422
431
|
|
|
423
432
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
424
|
-
.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-synthesis:none;font-family:var(--nl-font-regular)}
|
|
433
|
+
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-hover:#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-synthesis:none;font-family:var(--nl-font-regular)}
|
|
425
434
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
426
435
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
427
436
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
@@ -430,9 +439,7 @@ export const WEB_LIST_CSS = `
|
|
|
430
439
|
.ok-native-list-row{width:100%;height:100%;box-sizing:border-box;display:flex;align-items:center;gap:12px;overflow:hidden;background:var(--nl-row);color:var(--nl-primary);cursor:default;user-select:none;-webkit-user-select:none}
|
|
431
440
|
.ok-native-list-item[data-table-alternate="true"]>.ok-native-list-row{background:var(--nl-bg)}
|
|
432
441
|
.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
433
|
-
.ok-native-list-item[data-native-list-
|
|
434
|
-
.ok-native-list-item[data-native-list-row-press-enabled="true"]>.ok-native-list-row{cursor:pointer}
|
|
435
|
-
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-pressed)}
|
|
442
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-hover)}
|
|
436
443
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-row{background:var(--nl-pressed)}
|
|
437
444
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:not([data-native-list-selected="true"]):hover>.ok-native-list-wallet-row{background:var(--nl-strong)}
|
|
438
445
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:not([data-native-list-selected="true"]):active>.ok-native-list-wallet-row{background:var(--nl-pressed)}
|
|
@@ -463,20 +470,27 @@ export const WEB_LIST_CSS = `
|
|
|
463
470
|
.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)}
|
|
464
471
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
465
472
|
.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}
|
|
473
|
+
.ok-native-list-trailing-button{appearance:none;box-sizing:border-box;flex:0 0 auto;padding:4px 10px;border:1px solid transparent;border-radius:9999px;background:var(--nl-button-bg,var(--nl-strong));color:var(--nl-button-text,var(--nl-primary));font:500 14px/20px var(--nl-font-medium);white-space:nowrap;cursor:default}.ok-native-list-trailing-button:hover:not(:disabled){background:var(--nl-button-hover,var(--nl-strong))}.ok-native-list-trailing-button:active:not(:disabled){background:var(--nl-button-pressed,var(--nl-pressed))}.ok-native-list-trailing-button:focus-visible{outline:2px solid var(--nl-button-focus,var(--nl-accent))}.ok-native-list-trailing-button:disabled{opacity:.4;cursor:default}
|
|
474
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon{box-sizing:border-box;flex:0 0 38px;width:38px;height:38px;margin:-7px;padding:6px;border:1px solid transparent;border-radius:9999px;color:var(--nl-icon-subdued);background:transparent}.ok-native-list-icon-button.ok-native-list-tertiary-icon:hover:not(:disabled){background:var(--nl-hover)}.ok-native-list-icon-button.ok-native-list-tertiary-icon:active:not(:disabled){background:var(--nl-pressed)}.ok-native-list-icon-button.ok-native-list-tertiary-icon:disabled{opacity:.4;cursor:default}
|
|
475
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon:focus-visible:not(:disabled){outline:2px solid var(--nl-accent)}
|
|
476
|
+
.ok-native-list-identity-title-icon{flex:0 0 20px;width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;color:var(--nl-icon);font-size:20px}.ok-native-list-identity-title-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
466
477
|
.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)}
|
|
467
478
|
.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;font-family:var(--nl-font-semibold)}.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)}
|
|
468
479
|
.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}
|
|
469
480
|
.ok-native-list-value{font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}.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}
|
|
470
481
|
.ok-native-list-action-button{appearance:none;border:0;background:transparent;padding:2px;color:var(--nl-accent);cursor:pointer;font:600 12px/16px var(--nl-font-semibold)}.ok-native-list-action-button[data-tone="danger"]{color:var(--nl-negative)}.ok-native-list-action-button:disabled{opacity:.5;cursor:default}
|
|
471
|
-
.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;font-family:var(--nl-font-semibold)}.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}
|
|
482
|
+
.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;font-family:var(--nl-font-semibold)}.ok-native-list-image-skeleton{position:absolute;inset:0;border-radius:inherit;pointer-events:none;animation:ok-native-list-skeleton-light 1.5s linear infinite alternate}.ok-native-list-image-skeleton[data-dark="true"]{animation-name:ok-native-list-skeleton-dark}@keyframes ok-native-list-skeleton-light{0%{background-color:#fafafa}100%{background-color:#cdcdcd}}@keyframes ok-native-list-skeleton-dark{0%{background-color:#111111}100%{background-color:#333333}}@media(prefers-reduced-motion:reduce){.ok-native-list-image-skeleton{animation:none;background-color:var(--nl-strong)}}.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}
|
|
472
483
|
.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;cursor:pointer;font-family:var(--nl-font-medium)}.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)}}
|
|
473
|
-
.ok-native-list-
|
|
484
|
+
.ok-native-list-icon-button.ok-native-list-decorative-refresh{min-width:16px;width:16px;height:16px}
|
|
485
|
+
.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-badge[data-tone="success"]{background:var(--nl-success-background,color-mix(in srgb,var(--nl-positive) 12%,transparent));color:var(--nl-positive)}.ok-native-list-section>.ok-native-list-badge[data-tone="success"]{box-sizing:border-box;height:20px;padding:2px 8px;border-radius:4px;font:500 12px/16px var(--nl-font-medium)}.ok-native-list-badges{display:inline-flex;gap:4px;margin-left:6px;vertical-align:middle}
|
|
486
|
+
.ok-native-list-identity-row .ok-native-list-badge[data-tone="neutral"]{height:20px;box-sizing:border-box;padding:2px 8px;border-radius:4px;background:var(--nl-strong);color:var(--nl-secondary);font-size:12px;line-height:16px;font-weight:500;font-family:var(--nl-font-medium)}
|
|
474
487
|
.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;font-family:var(--nl-font-bold)}.ok-native-list-section[data-variant="summary"] .ok-native-list-section-title{font-size:16px;font-weight:500;color:var(--nl-primary);font-family:var(--nl-font-medium)}.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;letter-spacing:0.8px}.ok-native-list-section-value{margin-left:auto}
|
|
475
488
|
.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);font-family:var(--nl-font-semibold)}.ok-native-list-action-title[data-tone="danger"]{color:var(--nl-negative)}
|
|
489
|
+
.ok-native-list-button-group{padding:0;gap:10px;overflow:visible}.ok-native-list-block-button{position:relative;display:flex;flex:1 1 0;min-width:0;min-height:48px;align-items:center;justify-content:center;gap:8px;padding:12px 8px;border:1px solid color-mix(in srgb,var(--nl-info) 35%,transparent);border-radius:12px;background:transparent;color:var(--nl-info);font:500 14px/20px var(--nl-font-medium);cursor:pointer}.ok-native-list-block-button>span:not(.ok-native-list-spinner){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ok-native-list-block-button>.ok-native-list-spinner{position:static;flex:0 0 20px;width:20px;height:20px;border-top-color:var(--nl-info)}.ok-native-list-block-button:hover:not(:disabled){background:color-mix(in srgb,var(--nl-info) 10%,transparent);border-color:var(--nl-info)}.ok-native-list-block-button:active:not(:disabled){background:color-mix(in srgb,var(--nl-info) 17%,transparent)}.ok-native-list-block-button:focus-visible{outline:2px solid var(--nl-info);outline-offset:1px}.ok-native-list-block-button:disabled{opacity:.4;cursor:default}
|
|
476
490
|
.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)}
|
|
477
491
|
.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}
|
|
478
492
|
.ok-native-list-rail{padding:4px;gap:6px;border-radius:8px}.ok-native-list-rail .ok-native-list-visual{width:20px;height:20px;flex-basis:20px}.ok-native-list-rail .ok-native-list-visual>img,.ok-native-list-rail .ok-native-list-visual-main{width:20px;height:20px}.ok-native-list-rail-title{font-size:12px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}
|
|
479
|
-
.ok-native-list-media{display:block;padding:0 5px;background:transparent;border-radius:16px}.ok-native-list-media-image{display:block;width:100%;aspect-ratio:1;border-radius:10px;background:var(--nl-strong);object-fit:cover}.ok-native-list-media-image[data-state="empty"]{background:transparent}.ok-native-list-media-image[data-state="error"]{display:flex;align-items:center;justify-content:center;color:var(--nl-icon-subdued);font-size:24px}.ok-native-list-media-meta{padding-top:7px}.ok-native-list-media-subtitle-row{display:flex;align-items:center;gap:6px}.ok-native-list-media-subtitle{flex:1;min-width:0;font-size:12px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-media-network{width:14px;height:14px;border-radius:50%}.ok-native-list-media-title{font-size:16px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-medium)}.ok-native-list-media-close{position:absolute;right:9px;top:4px;border:0;background:color-mix(in srgb,var(--nl-inverse) 72%,transparent);color:var(--nl-inverse-text);width:24px;height:24px;border-radius:50%;cursor:pointer;font:18px/20px var(--nl-font-regular)}
|
|
493
|
+
.ok-native-list-media{display:block;padding:0 5px;background:transparent;border-radius:16px}.ok-native-list-media-image{display:block;width:100%;aspect-ratio:1;border-radius:10px;background:var(--nl-strong);object-fit:cover}.ok-native-list-media-image[data-state="empty"]{background:transparent}.ok-native-list-media-image[data-state="error"]{display:flex;align-items:center;justify-content:center;color:var(--nl-icon-subdued);font-size:24px}.ok-native-list-media-meta{padding-top:7px}.ok-native-list-media-subtitle-row{display:flex;align-items:center;gap:6px}.ok-native-list-media-subtitle{flex:1;min-width:0;font-size:12px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-media-network{width:14px;height:14px;border-radius:50%}.ok-native-list-media-title{font-size:16px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-medium)}.ok-native-list-media-fallback{position:absolute;inset:0;overflow:hidden;border-radius:10px;background:var(--nl-strong);color:color-mix(in srgb,var(--nl-disabled) 70%,transparent)}.ok-native-list-media-fallback::after{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--nl-separator) 60%,transparent);pointer-events:none}.ok-native-list-media-sheen,.ok-native-list-media-hatch,.ok-native-list-media-glyph{position:absolute;inset:0;pointer-events:none}.ok-native-list-media-glyph{display:none;align-items:center;justify-content:center}.ok-native-list-media-glyph svg{width:28%;max-width:44px;height:auto}.ok-native-list-media-fallback[data-state="loading"] .ok-native-list-media-glyph[data-glyph="loading"],.ok-native-list-media-fallback[data-state="failed"] .ok-native-list-media-glyph[data-glyph="failed"]{display:flex}.ok-native-list-media-sheen{display:none;overflow:hidden}.ok-native-list-media-fallback[data-state="loading"] .ok-native-list-media-sheen{display:block}.ok-native-list-media-sheen::before{content:"";position:absolute;top:-50%;bottom:-50%;left:0;width:60%;background:linear-gradient(100deg,transparent 0%,var(--nl-media-shine,rgba(255,255,255,.75)) 50%,transparent 100%);transform:translateX(-135%) skewX(-12deg);animation:ok-native-list-media-sweep 1.6s cubic-bezier(.4,0,.2,1) infinite;animation-delay:var(--nl-media-sweep-delay,0s)}@keyframes ok-native-list-media-sweep{0%{transform:translateX(-135%) skewX(-12deg)}70%,100%{transform:translateX(220%) skewX(-12deg)}}.ok-native-list-media-hatch{display:none;background-image:repeating-linear-gradient(135deg,color-mix(in srgb,var(--nl-primary) 4.5%,transparent) 0 1px,transparent 1px 7px);-webkit-mask-image:radial-gradient(circle at 50% 50%,transparent 0 22%,#000 70%);mask-image:radial-gradient(circle at 50% 50%,transparent 0 22%,#000 70%)}.ok-native-list-media-fallback[data-state="failed"] .ok-native-list-media-hatch{display:block}@media(prefers-reduced-motion:reduce){.ok-native-list-media-sheen::before{animation:none;transform:translateX(60%) skewX(-12deg);opacity:.6}}.ok-native-list-media-close{position:absolute;right:9px;top:4px;border:0;background:color-mix(in srgb,var(--nl-inverse) 72%,transparent);color:var(--nl-inverse-text);width:24px;height:24px;border-radius:50%;cursor:pointer;font:18px/20px var(--nl-font-regular)}
|
|
480
494
|
.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)}
|
|
481
495
|
.ok-native-list-data{padding:6px 12px}.ok-native-list-index{flex:0 0 28px;color:var(--nl-secondary);font-size:13px}.ok-native-list-favorite{flex:0 0 24px;color:var(--nl-icon-subdued);font-size:22px}.ok-native-list-favorite[data-active="true"]{color:var(--nl-accent)}.ok-native-list-data-cell{display:flex;flex-direction:column;min-width:0}.ok-native-list-data-cell[data-align="center"]{align-items:center}.ok-native-list-data-cell[data-align="end"]{align-items:flex-end}.ok-native-list-data-primary{display:flex;align-items:center;gap:5px;max-width:100%;font-size:16px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}.ok-native-list-unread{width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--nl-accent)}.ok-native-list-thumbnail{width:64px;height:64px;border-radius:10px;object-fit:cover}
|
|
482
496
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-history{background:var(--nl-selected)}
|
|
@@ -488,7 +502,7 @@ export const WEB_LIST_CSS = `
|
|
|
488
502
|
.ok-native-list-index-preview{position:absolute;z-index:8;right:40px;top:50%;display:flex;width:48px;height:48px;align-items:center;justify-content:center;transform:translateY(-50%) scale(.92);border-radius:14px;background:var(--nl-inverse);color:var(--nl-inverse-text);font-size:22px;font-weight:600;opacity:0;pointer-events:none;transition:opacity .15s ease,transform .15s ease;font-family:var(--nl-font-semibold)}.ok-native-list-index-preview[data-visible="true"]{opacity:1;transform:translateY(-50%) scale(1)}
|
|
489
503
|
.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}
|
|
490
504
|
@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)}}
|
|
491
|
-
.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
|
|
505
|
+
.ok-native-list-footer{flex:0 0 auto;min-height:0}.ok-native-list-sticky{position:absolute;z-index:4;left:0;right:0;top:0;pointer-events:auto}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport{scrollbar-width:none}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport::-webkit-scrollbar,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport::-webkit-scrollbar{display:none}.ok-native-list-index-rail{position:absolute;z-index:6;top:0;right:0;bottom:0;width:${SECTION_INDEX_RAIL_WIDTH}px;touch-action:none;cursor:pointer;font-family:var(--nl-font-regular);font-synthesis:none}.ok-native-list-index-rail[hidden]{display:none}.ok-native-list-index-button{appearance:none;position:absolute;left:15px;display:flex;width:14px;height:14px;align-items:center;justify-content:center;padding:0;transform:translateY(-50%);border:0;border-radius:7px;background:transparent;color:var(--nl-disabled);font-size:10px;font-weight:400;line-height:1;cursor:pointer;opacity:.5;transition:opacity .15s ease;font-family:var(--nl-font-regular)}.ok-native-list-index-rail:hover .ok-native-list-index-button,.ok-native-list-index-rail:focus-within .ok-native-list-index-button,.ok-native-list-index-button[data-active="true"]{opacity:1}.ok-native-list-index-button[data-active="true"]{background:var(--nl-positive);color:var(--nl-inverse-text);font-weight:500;font-family:var(--nl-font-medium)}.ok-native-list-index-button:focus-visible{outline:2px solid var(--nl-positive);outline-offset:1px}
|
|
492
506
|
.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)}
|
|
493
507
|
.ok-native-list-warning{height:auto;display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:14px 12px;border-top:1px solid;border-bottom:1px solid;box-sizing:border-box;cursor:default}.ok-native-list-warning-title,.ok-native-list-warning-message{font-size:14px;line-height:20px;white-space:normal;overflow-wrap:anywhere}.ok-native-list-warning-title{font-weight:500;color:var(--nl-primary);font-family:var(--nl-font-medium)}.ok-native-list-warning-message{font-weight:400;color:var(--nl-secondary);font-family:var(--nl-font-regular)}
|
|
494
508
|
.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. */
|
|
@@ -521,6 +535,7 @@ export const WEB_LIST_CSS = `
|
|
|
521
535
|
.ok-native-list-root .ok-native-list-item>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member>[data-nl-container-background="true"]{background:var(--nl-container-background)}
|
|
522
536
|
.ok-native-list-root [data-nl-container-border="true"]{position:relative}
|
|
523
537
|
.ok-native-list-root [data-nl-container-border="true"]::before{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 var(--nl-container-border-width) var(--nl-container-border-color);z-index:2;pointer-events:none}
|
|
538
|
+
.ok-native-list-root [data-nl-inline-warning="true"][data-nl-container-border="true"]::before{box-shadow:none;border-block:var(--nl-container-border-width) solid var(--nl-container-border-color);border-inline:0;border-radius:0}
|
|
524
539
|
.ok-native-list-root .ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-item[data-native-list-row-press-enabled="true"]:active>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member:hover>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member:active>[data-nl-container-background="true"]{background:var(--nl-pressed)}
|
|
525
540
|
`;
|
|
526
541
|
function createElement(document, tag, className, text) {
|
|
@@ -715,250 +730,25 @@ function paintSelectorImageBackground(image, frame, inset = 0) {
|
|
|
715
730
|
frame.insertBefore(paint, image);
|
|
716
731
|
if (image.complete && image.naturalWidth > 0) update();
|
|
717
732
|
}
|
|
718
|
-
|
|
719
|
-
// OneKey patch: use source SVG paths for selector actions and wallet provider marks.
|
|
720
|
-
const selectorIcons = {
|
|
721
|
-
CryptoCoinOutline: {
|
|
722
|
-
viewBox: '0 0 24 24',
|
|
723
|
-
paths: [{
|
|
724
|
-
d: 'M11 16.387a4.5 4.5 0 0 1 0-8.775V6h2v1.613a4.5 4.5 0 0 1 2.856 2.067l-1.712 1.032a2.5 2.5 0 1 0 0 2.576l1.712 1.032A4.5 4.5 0 0 1 13 16.386V18h-2z',
|
|
725
|
-
fill: 'currentColor',
|
|
726
|
-
fillRule: 'nonzero',
|
|
727
|
-
opacity: 1
|
|
728
|
-
}, {
|
|
729
|
-
d: 'M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0',
|
|
730
|
-
fill: 'currentColor',
|
|
731
|
-
fillRule: 'evenodd',
|
|
732
|
-
opacity: 1
|
|
733
|
-
}]
|
|
734
|
-
},
|
|
735
|
-
GlobusOutline: {
|
|
736
|
-
viewBox: '0 0 24 24',
|
|
737
|
-
paths: [{
|
|
738
|
-
d: 'M12 2c5.185 0 9.448 3.947 9.95 9H22v2h-.05c-.502 5.053-4.765 9-9.95 9s-9.448-3.947-9.95-9H2v-2h.05C2.552 5.947 6.815 2 12 2M9.523 13c.09 1.982.438 3.726.934 5.002.29.746.612 1.282.917 1.614.304.331.517.384.626.384s.322-.053.626-.384c.305-.332.627-.868.917-1.614.496-1.276.845-3.02.934-5.002zm-5.459 0a8 8 0 0 0 4.8 6.36 10 10 0 0 1-.271-.633C7.994 17.187 7.61 15.189 7.52 13zm12.416 0c-.09 2.189-.474 4.187-1.073 5.727a10 10 0 0 1-.271.633 8 8 0 0 0 4.8-6.36zM8.863 4.639A8 8 0 0 0 4.064 11h3.457c.09-2.189.473-4.187 1.072-5.727q.127-.327.27-.634M12 4c-.109 0-.322.053-.626.384-.305.332-.627.868-.917 1.614-.496 1.276-.844 3.02-.934 5.002h4.954c-.09-1.982-.438-3.726-.934-5.002-.29-.746-.612-1.282-.917-1.614C12.322 4.053 12.109 4 12 4m3.136.639q.144.307.271.634c.599 1.54.982 3.538 1.073 5.727h3.456a8 8 0 0 0-4.8-6.361',
|
|
739
|
-
fill: 'currentColor',
|
|
740
|
-
fillRule: 'evenodd',
|
|
741
|
-
opacity: 1.0
|
|
742
|
-
}]
|
|
743
|
-
},
|
|
744
|
-
LockSolid: {
|
|
745
|
-
viewBox: '0 0 24 24',
|
|
746
|
-
paths: [{
|
|
747
|
-
d: 'M12 2a5 5 0 0 1 5 5v2h3v13H4V9h3V7a5 5 0 0 1 5-5m-1 11v5h2v-5zm1-9a3 3 0 0 0-3 3v2h6V7a3 3 0 0 0-3-3',
|
|
748
|
-
fill: 'currentColor',
|
|
749
|
-
fillRule: 'evenodd',
|
|
750
|
-
opacity: 1.0
|
|
751
|
-
}]
|
|
752
|
-
},
|
|
753
|
-
GoogleIllus: {
|
|
754
|
-
viewBox: '0 0 24 24',
|
|
755
|
-
paths: [{
|
|
756
|
-
d: 'M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09',
|
|
757
|
-
fill: '#4285F4',
|
|
758
|
-
fillRule: 'nonzero',
|
|
759
|
-
opacity: 1.0
|
|
760
|
-
}, {
|
|
761
|
-
d: 'M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23',
|
|
762
|
-
fill: '#34A853',
|
|
763
|
-
fillRule: 'nonzero',
|
|
764
|
-
opacity: 1.0
|
|
765
|
-
}, {
|
|
766
|
-
d: 'M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22z',
|
|
767
|
-
fill: '#FBBC05',
|
|
768
|
-
fillRule: 'nonzero',
|
|
769
|
-
opacity: 1.0
|
|
770
|
-
}, {
|
|
771
|
-
d: 'M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53',
|
|
772
|
-
fill: '#EA4335',
|
|
773
|
-
fillRule: 'nonzero',
|
|
774
|
-
opacity: 1.0
|
|
775
|
-
}]
|
|
776
|
-
},
|
|
777
|
-
AppleBrand: {
|
|
778
|
-
viewBox: '0 0 16 20',
|
|
779
|
-
paths: [{
|
|
780
|
-
d: 'M11.67.834c.117 1.074-.315 2.153-.955 2.928-.64.773-1.692 1.378-2.718 1.298-.14-1.054.38-2.151.971-2.836C9.63 1.45 10.746.872 11.67.834M14.994 7.093c-.176.108-1.992 1.224-1.972 3.482.025 2.769 2.428 3.693 2.46 3.705l-.004.015a10.1 10.1 0 0 1-1.264 2.593c-.764 1.116-1.556 2.229-2.806 2.254-.598.011-1-.162-1.416-.343-.437-.19-.891-.386-1.609-.386-.751 0-1.226.203-1.683.398-.397.169-.78.333-1.32.354-1.208.047-2.124-1.207-2.895-2.32C.909 14.57-.294 10.414 1.322 7.612c.803-1.395 2.237-2.275 3.794-2.298.671-.014 1.32.244 1.89.47.434.172.821.326 1.135.326.282 0 .659-.149 1.099-.323.692-.273 1.539-.607 2.41-.518.599.026 2.276.24 3.354 1.818z',
|
|
781
|
-
fill: 'currentColor',
|
|
782
|
-
fillRule: 'nonzero',
|
|
783
|
-
opacity: 1.0
|
|
784
|
-
}]
|
|
785
|
-
},
|
|
786
|
-
BotIllus: {
|
|
787
|
-
viewBox: '0 0 24 24',
|
|
788
|
-
paths: [{
|
|
789
|
-
d: 'M11 2a1 1 0 1 1 2 0v1.8l1.6 1.6a1 1 0 1 1-1.4 1.4L12 5.6l-1.2 1.2a1 1 0 0 1-1.4-1.4L11 3.8z',
|
|
790
|
-
fill: '#8897A5',
|
|
791
|
-
fillRule: 'nonzero',
|
|
792
|
-
opacity: 1.0
|
|
793
|
-
}, {
|
|
794
|
-
d: 'M8.0 6.0h8.0a5.0 5.0 0 0 1 5.0 5.0v4.0a5.0 5.0 0 0 1 -5.0 5.0h-8.0a5.0 5.0 0 0 1 -5.0 -5.0v-4.0a5.0 5.0 0 0 1 5.0 -5.0z',
|
|
795
|
-
fill: '#3FA9F5',
|
|
796
|
-
fillRule: 'nonzero',
|
|
797
|
-
opacity: 1.0
|
|
798
|
-
}, {
|
|
799
|
-
d: 'M3.0 10.0h0.0a1.5 1.5 0 0 1 1.5 1.5v3.0a1.5 1.5 0 0 1 -1.5 1.5h0.0a1.5 1.5 0 0 1 -1.5 -1.5v-3.0a1.5 1.5 0 0 1 1.5 -1.5z',
|
|
800
|
-
fill: '#8897A5',
|
|
801
|
-
fillRule: 'nonzero',
|
|
802
|
-
opacity: 1.0
|
|
803
|
-
}, {
|
|
804
|
-
d: 'M21.0 10.0h0.0a1.5 1.5 0 0 1 1.5 1.5v3.0a1.5 1.5 0 0 1 -1.5 1.5h0.0a1.5 1.5 0 0 1 -1.5 -1.5v-3.0a1.5 1.5 0 0 1 1.5 -1.5z',
|
|
805
|
-
fill: '#8897A5',
|
|
806
|
-
fillRule: 'nonzero',
|
|
807
|
-
opacity: 1.0
|
|
808
|
-
}, {
|
|
809
|
-
d: 'M7.5 12.0a1.5 1.5 0 1 0 3.0 0a1.5 1.5 0 1 0 -3.0 0',
|
|
810
|
-
fill: '#10243E',
|
|
811
|
-
fillRule: 'nonzero',
|
|
812
|
-
opacity: 1.0
|
|
813
|
-
}, {
|
|
814
|
-
d: 'M13.5 12.0a1.5 1.5 0 1 0 3.0 0a1.5 1.5 0 1 0 -3.0 0',
|
|
815
|
-
fill: '#10243E',
|
|
816
|
-
fillRule: 'nonzero',
|
|
817
|
-
opacity: 1.0
|
|
818
|
-
}, {
|
|
819
|
-
d: 'M8.5 15.4c.9.8 2.08 1.2 3.5 1.2s2.6-.4 3.5-1.2c.24-.2.6-.18.8.06.2.23.17.6-.06.8-1.14.98-2.58 1.46-4.24 1.46s-3.1-.48-4.24-1.46a.58.58 0 0 1-.06-.8c.2-.24.56-.26.8-.06',
|
|
820
|
-
fill: '#10243E',
|
|
821
|
-
fillRule: 'nonzero',
|
|
822
|
-
opacity: 1.0
|
|
823
|
-
}]
|
|
824
|
-
},
|
|
825
|
-
AllNetworksSolid: {
|
|
826
|
-
viewBox: '0 0 24 24',
|
|
827
|
-
paths: [{
|
|
828
|
-
d: 'M15.333 13.998a1.335 1.335 0 1 1 0 2.67 1.335 1.335 0 0 1 0-2.67',
|
|
829
|
-
fill: 'currentColor',
|
|
830
|
-
fillRule: 'nonzero',
|
|
831
|
-
opacity: 1.0
|
|
832
|
-
}, {
|
|
833
|
-
d: 'M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0M8 12.668A2 2 0 0 0 6 14.666V16c0 1.103.895 1.997 1.998 1.998h1.334A2 2 0 0 0 11.33 16v-1.334a2 2 0 0 0-1.998-1.998zm7.333 0a2.665 2.665 0 1 0 0 5.33 2.665 2.665 0 0 0 0-5.33M7.999 6.001A2 2 0 0 0 6.001 8v1.334c0 1.103.895 1.998 1.998 1.998h1.334a2 2 0 0 0 1.998-1.998V7.999a2 2 0 0 0-1.998-1.998zm6.667 0A2 2 0 0 0 12.668 8v1.334c0 1.103.895 1.998 1.998 1.998H16a2 2 0 0 0 1.998-1.998V7.999A2 2 0 0 0 16 6.001z',
|
|
834
|
-
fill: 'currentColor',
|
|
835
|
-
fillRule: 'evenodd',
|
|
836
|
-
opacity: 1.0
|
|
837
|
-
}]
|
|
838
|
-
},
|
|
839
|
-
CrossedSmallSolid: {
|
|
840
|
-
viewBox: '0 0 24 24',
|
|
841
|
-
paths: [{
|
|
842
|
-
d: 'M17.87 8.25 14.12 12l3.75 3.75-2.12 2.121-3.75-3.75-3.75 3.75-2.121-2.121L9.879 12l-3.75-3.75 2.12-2.121L12 9.879l3.75-3.75 2.122 2.121Z',
|
|
843
|
-
fill: 'currentColor',
|
|
844
|
-
fillRule: 'nonzero',
|
|
845
|
-
opacity: 1.0
|
|
846
|
-
}]
|
|
847
|
-
},
|
|
848
|
-
AccountErrorCustom: {
|
|
849
|
-
viewBox: '0 0 18 18',
|
|
850
|
-
paths: [{
|
|
851
|
-
d: 'M12.5 12.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5',
|
|
852
|
-
fill: '#000',
|
|
853
|
-
fillRule: 'nonzero',
|
|
854
|
-
opacity: 0.447
|
|
855
|
-
}, {
|
|
856
|
-
d: 'M0 3.5A3.5 3.5 0 0 1 3.5 0h8.088A2.41 2.41 0 0 1 14 2.412V5h1a3 3 0 0 1 3 3v7a3 3 0 0 1-3 3H4a4 4 0 0 1-4-4zm2 3.163V14a2 2 0 0 0 2 2h11a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1H3.5c-.537 0-1.045-.12-1.5-.337M2 3.5A1.5 1.5 0 0 0 3.5 5H12V2.412A.41.41 0 0 0 11.588 2H3.5A1.5 1.5 0 0 0 2 3.5',
|
|
857
|
-
fill: '#000',
|
|
858
|
-
fillRule: 'evenodd',
|
|
859
|
-
opacity: 0.447
|
|
860
|
-
}]
|
|
861
|
-
},
|
|
862
|
-
PlusSmallOutline: {
|
|
863
|
-
viewBox: '0 0 24 24',
|
|
864
|
-
paths: [{
|
|
865
|
-
d: 'M13 11h5v2h-5v5h-2v-5H6v-2h5V6h2z',
|
|
866
|
-
fill: 'currentColor',
|
|
867
|
-
fillRule: 'nonzero',
|
|
868
|
-
opacity: 1.0
|
|
869
|
-
}]
|
|
870
|
-
},
|
|
871
|
-
DotHorOutline: {
|
|
872
|
-
viewBox: '0 0 24 24',
|
|
873
|
-
paths: [{
|
|
874
|
-
d: 'M6 14H2v-4h4zm8 0h-4v-4h4zm8 0h-4v-4h4z',
|
|
875
|
-
fill: 'currentColor',
|
|
876
|
-
fillRule: 'nonzero',
|
|
877
|
-
opacity: 1.0
|
|
878
|
-
}]
|
|
879
|
-
},
|
|
880
|
-
ChevronRightSmallOutline: {
|
|
881
|
-
viewBox: '0 0 24 24',
|
|
882
|
-
paths: [{
|
|
883
|
-
d: 'M15.414 12 10 17.414 8.586 16l4-4-4-4L10 6.586z',
|
|
884
|
-
fill: 'currentColor',
|
|
885
|
-
fillRule: 'nonzero',
|
|
886
|
-
opacity: 1.0
|
|
887
|
-
}]
|
|
888
|
-
},
|
|
889
|
-
DragOutline: {
|
|
890
|
-
viewBox: '0 0 24 24',
|
|
891
|
-
paths: [{
|
|
892
|
-
d: 'M11 21H7v-4h4zm6 0h-4v-4h4zm-6-7H7v-4h4zm6 0h-4v-4h4zm-6-7H7V3h4zm6 0h-4V3h4z',
|
|
893
|
-
fill: 'currentColor',
|
|
894
|
-
fillRule: 'nonzero',
|
|
895
|
-
opacity: 1.0
|
|
896
|
-
}]
|
|
897
|
-
},
|
|
898
|
-
PencilOutline: {
|
|
899
|
-
viewBox: '0 0 24 24',
|
|
900
|
-
paths: [{
|
|
901
|
-
d: 'M22.414 7.5 7.914 22H2v-5.914l14.5-14.5zM4 16.914V20h3.086l9.5-9.5L13.5 7.414zM14.914 6 18 9.086 19.586 7.5 16.5 4.414z',
|
|
902
|
-
fill: 'currentColor',
|
|
903
|
-
fillRule: 'evenodd',
|
|
904
|
-
opacity: 1.0
|
|
905
|
-
}]
|
|
906
|
-
},
|
|
907
|
-
CheckboxCheckedCustom: {
|
|
908
|
-
viewBox: '0 0 16 16',
|
|
909
|
-
paths: [{
|
|
910
|
-
d: 'M12.204 5.043a1 1 0 0 1 0 1.414l-4.5 4.5a1 1 0 0 1-1.414 0l-2-2a1 1 0 1 1 1.414-1.414l1.293 1.293 3.793-3.793a1 1 0 0 1 1.414 0',
|
|
911
|
-
fill: 'currentColor',
|
|
912
|
-
fillRule: 'evenodd',
|
|
913
|
-
opacity: 1.0
|
|
914
|
-
}]
|
|
915
|
-
},
|
|
916
|
-
CheckboxIndeterminateCustom: {
|
|
917
|
-
viewBox: '0 0 16 16',
|
|
918
|
-
paths: [{
|
|
919
|
-
d: 'M4 8a1 1 0 0 1 1-1h6a1 1 0 0 1 0 2H5a1 1 0 0 1-1-1',
|
|
920
|
-
fill: 'currentColor',
|
|
921
|
-
fillRule: 'evenodd',
|
|
922
|
-
opacity: 1.0
|
|
923
|
-
}]
|
|
924
|
-
},
|
|
925
|
-
Circle: {
|
|
926
|
-
viewBox: '0 0 24 24',
|
|
927
|
-
paths: [{
|
|
928
|
-
d: 'M0 12a12 12 0 1 0 24 0a12 12 0 1 0 -24 0',
|
|
929
|
-
fill: 'currentColor',
|
|
930
|
-
fillRule: 'nonzero',
|
|
931
|
-
opacity: 1
|
|
932
|
-
}]
|
|
933
|
-
},
|
|
934
|
-
BadgeVerifiedSolid: {
|
|
935
|
-
viewBox: '0 0 24 24',
|
|
936
|
-
paths: [{
|
|
937
|
-
d: WEB_MARKET_VERIFIED_PATH,
|
|
938
|
-
fill: 'currentColor',
|
|
939
|
-
fillRule: 'evenodd',
|
|
940
|
-
opacity: 1
|
|
941
|
-
}]
|
|
942
|
-
}
|
|
943
|
-
};
|
|
944
733
|
function applySelectorIcon(element, name) {
|
|
945
|
-
const
|
|
946
|
-
if (!
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
734
|
+
const canonical = selectorIcons[name];
|
|
735
|
+
if (!canonical) return;
|
|
736
|
+
if (canonical === 'Circle') {
|
|
737
|
+
const svg = element.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
738
|
+
svg.setAttribute('viewBox', '0 0 24 24');
|
|
739
|
+
svg.setAttribute('width', '24');
|
|
740
|
+
svg.setAttribute('height', '24');
|
|
741
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
742
|
+
const circle = element.ownerDocument.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
743
|
+
circle.setAttribute('cx', '12');
|
|
744
|
+
circle.setAttribute('cy', '12');
|
|
745
|
+
circle.setAttribute('r', '12');
|
|
746
|
+
circle.setAttribute('fill', 'currentColor');
|
|
747
|
+
svg.append(circle);
|
|
748
|
+
element.replaceChildren(svg);
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
element.replaceChildren(createNamedIcon(element.ownerDocument, canonical));
|
|
962
752
|
}
|
|
963
753
|
function iconGlyph(name) {
|
|
964
754
|
const normalized = name.toLocaleLowerCase();
|
|
@@ -1009,6 +799,8 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1009
799
|
const showsSourcePlaceholder = !!source && source.loadingStrategy !== undefined && source.loadingStrategy !== 'none';
|
|
1010
800
|
frame.style.background = showsSourcePlaceholder ? 'var(--nl-strong)' : visualBackground;
|
|
1011
801
|
const fallbackIcon = 'fallbackIcon' in visual ? visual.fallbackIcon : undefined;
|
|
802
|
+
const fallbackBackground = fallbackIcon?.backgroundColor ?? 'var(--nl-strong)';
|
|
803
|
+
if (!source && fallbackIcon?.backgroundColor) frame.style.background = fallbackBackground;
|
|
1012
804
|
const handlesSourceFallback = showsSourcePlaceholder && (fallbackIcon !== undefined || 'fallbackText' in visual);
|
|
1013
805
|
const image = source ? createImage(context, source) : undefined;
|
|
1014
806
|
if (image) {
|
|
@@ -1022,6 +814,17 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1022
814
|
if (image.complete && image.naturalWidth > 0) restoreBackground();
|
|
1023
815
|
}
|
|
1024
816
|
if (selectorPresentation) paintSelectorImageBackground(image, frame);
|
|
817
|
+
if (source?.loadingStrategy === 'skeleton' && !(image.complete && image.naturalWidth > 0)) {
|
|
818
|
+
const skeleton = createElement(context.document, 'span', 'ok-native-list-image-skeleton');
|
|
819
|
+
if (isDarkBackground(resolvedTheme(context.snapshot).background)) skeleton.dataset.dark = 'true';
|
|
820
|
+
frame.appendChild(skeleton);
|
|
821
|
+
image.addEventListener('load', () => skeleton.remove(), {
|
|
822
|
+
once: true
|
|
823
|
+
});
|
|
824
|
+
image.addEventListener('error', () => skeleton.remove(), {
|
|
825
|
+
once: true
|
|
826
|
+
});
|
|
827
|
+
}
|
|
1025
828
|
} else if (!source || showsSourcePlaceholder) {
|
|
1026
829
|
frame.appendChild(createElement(context.document, 'span', 'ok-native-list-visual-fallback', 'fallbackText' in visual ? visual.fallbackText ?? '' : ''));
|
|
1027
830
|
}
|
|
@@ -1045,11 +848,19 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1045
848
|
}
|
|
1046
849
|
frame.querySelector('.ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)')?.remove();
|
|
1047
850
|
const fallback = createElement(context.document, 'span', 'ok-native-list-visual-fallback', fallbackIcon ? undefined : 'fallbackText' in visual ? visual.fallbackText ?? '' : '');
|
|
851
|
+
if ('fallbackTextColor' in visual && visual.fallbackTextColor && !fallbackIcon) fallback.style.color = visual.fallbackTextColor;
|
|
1048
852
|
if (fallbackIcon) {
|
|
1049
853
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1050
854
|
if (fallbackIcon.tintColor) fallback.style.color = fallbackIcon.tintColor;
|
|
855
|
+
if (fallbackIcon.size) {
|
|
856
|
+
const svg = fallback.querySelector('svg');
|
|
857
|
+
if (svg) {
|
|
858
|
+
svg.style.width = `${fallbackIcon.size}px`;
|
|
859
|
+
svg.style.height = `${fallbackIcon.size}px`;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
1051
862
|
}
|
|
1052
|
-
fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
863
|
+
if (fallbackIcon?.backgroundColor) frame.style.background = fallbackBackground;else fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
1053
864
|
frame.prepend(fallback);
|
|
1054
865
|
};
|
|
1055
866
|
if (image) image.addEventListener('error', showFallback, {
|
|
@@ -1059,6 +870,9 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1059
870
|
if ('borderStyle' in visual && visual.borderStyle === 'dashed') {
|
|
1060
871
|
frame.style.border = '2px dashed ' + (visual.borderColor ?? 'var(--nl-disabled)');
|
|
1061
872
|
frame.style.boxSizing = 'border-box';
|
|
873
|
+
} else if ('borderColor' in visual && visual.borderColor) {
|
|
874
|
+
frame.style.border = '1px solid ' + visual.borderColor;
|
|
875
|
+
frame.style.boxSizing = 'border-box';
|
|
1062
876
|
}
|
|
1063
877
|
if ('overlays' in visual) visual.overlays?.forEach(overlay => {
|
|
1064
878
|
const corner = createElement(context.document, 'span', 'ok-native-list-visual-overlay', overlay.text);
|
|
@@ -1072,6 +886,12 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1072
886
|
corner.style.lineHeight = '16px';
|
|
1073
887
|
applyTextWeight(corner, '400');
|
|
1074
888
|
}
|
|
889
|
+
if (overlay.fontWeight) applyTextWeight(corner, {
|
|
890
|
+
regular: 400,
|
|
891
|
+
medium: 500,
|
|
892
|
+
semibold: 600,
|
|
893
|
+
bold: 700
|
|
894
|
+
}[overlay.fontWeight]);
|
|
1075
895
|
if (isWalletText || overlay.width !== undefined || overlay.height !== undefined) corner.style.borderRadius = '9999px';
|
|
1076
896
|
const offsetX = String(-(overlay.offsetX ?? overlay.offset ?? 2)) + 'px';
|
|
1077
897
|
const offsetY = String(-(overlay.offsetY ?? overlay.offset ?? 2)) + 'px';
|
|
@@ -1087,7 +907,20 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1087
907
|
if (overlay.image) {
|
|
1088
908
|
const overlayImage = createImage(context, overlay.image);
|
|
1089
909
|
if (overlayImage) {
|
|
910
|
+
if ((overlay.padding ?? 0) > 0 && (overlay.width ?? size) === (overlay.height ?? size)) overlayImage.style.borderRadius = '50%';
|
|
1090
911
|
corner.appendChild(overlayImage);
|
|
912
|
+
if (overlay.fallbackIcon) {
|
|
913
|
+
overlayImage.addEventListener('error', () => {
|
|
914
|
+
disposeWebImageRetries(overlayImage);
|
|
915
|
+
overlayImage.remove();
|
|
916
|
+
const glyph = createElement(context.document, 'span', 'ok-native-list-overlay-fallback');
|
|
917
|
+
applySelectorIcon(glyph, overlay.fallbackIcon.name);
|
|
918
|
+
if (overlay.fallbackIcon?.tintColor) glyph.style.color = overlay.fallbackIcon.tintColor;
|
|
919
|
+
corner.appendChild(glyph);
|
|
920
|
+
}, {
|
|
921
|
+
once: true
|
|
922
|
+
});
|
|
923
|
+
}
|
|
1091
924
|
if (selectorPresentation) paintSelectorImageBackground(overlayImage, corner, overlay.padding ?? 0);
|
|
1092
925
|
}
|
|
1093
926
|
} else if (overlay.name) applySelectorIcon(corner, overlay.name);
|
|
@@ -1154,6 +987,7 @@ function createIconAction(context, name, actionKey, disabled, tintColor) {
|
|
|
1154
987
|
if (element.tagName === 'BUTTON') {
|
|
1155
988
|
element.setAttribute('type', 'button');
|
|
1156
989
|
element.toggleAttribute('disabled', Boolean(disabled));
|
|
990
|
+
if (name === 'DotVerSolid') element.setAttribute('aria-label', '⋮');
|
|
1157
991
|
}
|
|
1158
992
|
applySelectorIcon(element, name);
|
|
1159
993
|
if (actionKey) setData(element, 'nativeListAction', actionKey);
|
|
@@ -1167,7 +1001,23 @@ function markActionAnchorSource(element, source, slot) {
|
|
|
1167
1001
|
|
|
1168
1002
|
// OneKey patch: the compact zero-count digits share the amount baseline.
|
|
1169
1003
|
|
|
1170
|
-
function createAccessory(context, rowKey, accessory, slot) {
|
|
1004
|
+
function createAccessory(context, rowKey, accessory, slot, rowDisabled) {
|
|
1005
|
+
if (accessory.kind === 'button') {
|
|
1006
|
+
const element = createElement(context.document, 'button', 'ok-native-list-trailing-button', accessory.label);
|
|
1007
|
+
element.type = 'button';
|
|
1008
|
+
element.disabled = Boolean(rowDisabled || accessory.disabled);
|
|
1009
|
+
element.setAttribute('aria-disabled', String(element.disabled));
|
|
1010
|
+
element.setAttribute('aria-label', accessory.accessibilityLabel ?? accessory.label);
|
|
1011
|
+
setData(element, 'testid', accessory.testID);
|
|
1012
|
+
setData(element, 'nativeListAction', accessory.actionKey);
|
|
1013
|
+
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1014
|
+
if (accessory.textColor) element.style.setProperty('--nl-button-text', accessory.textColor);
|
|
1015
|
+
if (accessory.backgroundColor) element.style.setProperty('--nl-button-bg', accessory.backgroundColor);
|
|
1016
|
+
if (accessory.pressedBackgroundColor) element.style.setProperty('--nl-button-pressed', accessory.pressedBackgroundColor);
|
|
1017
|
+
if (accessory.hoverBackgroundColor) element.style.setProperty('--nl-button-hover', accessory.hoverBackgroundColor);
|
|
1018
|
+
if (accessory.focusRingColor) element.style.setProperty('--nl-button-focus', accessory.focusRingColor);
|
|
1019
|
+
return element;
|
|
1020
|
+
}
|
|
1171
1021
|
if (accessory.kind === 'checkbox') {
|
|
1172
1022
|
const element = createCheckbox(context, rowKey, accessory);
|
|
1173
1023
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
@@ -1176,8 +1026,19 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1176
1026
|
if (accessory.kind === 'icon') {
|
|
1177
1027
|
const element = createIconAction(context, accessory.name, accessory.actionKey, accessory.disabled, accessory.tintColor);
|
|
1178
1028
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1029
|
+
if (accessory.name === 'RefreshCcwOutline' && !accessory.actionKey) {
|
|
1030
|
+
element.classList.add('ok-native-list-decorative-refresh');
|
|
1031
|
+
const glyph = element.querySelector('svg');
|
|
1032
|
+
glyph?.setAttribute('width', '16');
|
|
1033
|
+
glyph?.setAttribute('height', '16');
|
|
1034
|
+
}
|
|
1035
|
+
if (accessory.buttonStyle === 'tertiary') {
|
|
1036
|
+
element.classList.add('ok-native-list-tertiary-icon');
|
|
1037
|
+
setData(element, 'nativeListAnchorInset', 7);
|
|
1038
|
+
}
|
|
1179
1039
|
setData(element, 'testid', accessory.testID);
|
|
1180
1040
|
if (accessory.hoverActionKey) setData(element, 'nativeListHoverAction', accessory.hoverActionKey);
|
|
1041
|
+
if (accessory.hoverActionKey && accessory.buttonStyle === 'tertiary') setData(element, 'nativeListIconHelp', true);
|
|
1181
1042
|
if (accessory.accessibilityLabel) element.setAttribute('aria-label', accessory.accessibilityLabel);
|
|
1182
1043
|
const row = context.snapshot.rows[context.itemIndex];
|
|
1183
1044
|
if (row && 'presentation' in row && row.presentation === 'accountSelector') {
|
|
@@ -1210,8 +1071,27 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1210
1071
|
{
|
|
1211
1072
|
const primary = createElement(context.document, 'span', undefined, accessory.primary);
|
|
1212
1073
|
primary.style.color = toneColor(accessory.primaryTone, 'primary');
|
|
1074
|
+
applyValueSegments(primary, accessory.primaryTextSegments, 16, 20, 500);
|
|
1075
|
+
if (accessory.primaryFontWeight === 'medium') applyTextWeight(primary, 500);
|
|
1076
|
+
if (accessory.primaryHelp) {
|
|
1077
|
+
const help = accessory.primaryHelp;
|
|
1078
|
+
primary.tabIndex = 0;
|
|
1079
|
+
primary.setAttribute('role', 'button');
|
|
1080
|
+
if (help.presentation === 'tooltip') {
|
|
1081
|
+
setData(primary, 'nativeListHoverAction', help.actionKey);
|
|
1082
|
+
setData(primary, 'nativeListIconHelp', true);
|
|
1083
|
+
} else {
|
|
1084
|
+
setData(primary, 'nativeListAction', help.actionKey);
|
|
1085
|
+
}
|
|
1086
|
+
if (help.underline === 'dashed') {
|
|
1087
|
+
primary.style.textDecoration = 'underline dashed';
|
|
1088
|
+
primary.style.textUnderlineOffset = '4px';
|
|
1089
|
+
}
|
|
1090
|
+
markActionAnchorSource(primary, 'trailingAccessory', slot);
|
|
1091
|
+
}
|
|
1213
1092
|
const secondary = createElement(context.document, 'span', 'ok-native-list-secondary', accessory.secondary);
|
|
1214
1093
|
secondary.style.color = toneColor(accessory.secondaryTone, 'secondary');
|
|
1094
|
+
applyValueSegments(secondary, accessory.secondaryTextSegments, 14, 20, 400);
|
|
1215
1095
|
element.replaceChildren(primary, '\n', secondary);
|
|
1216
1096
|
element.classList.add('ok-native-list-amounts');
|
|
1217
1097
|
break;
|
|
@@ -1239,10 +1119,10 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1239
1119
|
if (actionKey) markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1240
1120
|
return element;
|
|
1241
1121
|
}
|
|
1242
|
-
function rendererPrimitives(context) {
|
|
1122
|
+
function rendererPrimitives(context, rowDisabled) {
|
|
1243
1123
|
return {
|
|
1244
1124
|
background: resolvedTheme(context.snapshot).background,
|
|
1245
|
-
accessory: (key, descriptor, slot) => createAccessory(context, key, descriptor, slot),
|
|
1125
|
+
accessory: (key, descriptor, slot) => createAccessory(context, key, descriptor, slot, rowDisabled),
|
|
1246
1126
|
visual: (source, presentation) => createVisual(context, source, presentation),
|
|
1247
1127
|
thumbnail: source => createImage(context, source, 'ok-native-list-thumbnail'),
|
|
1248
1128
|
textStyle: applyTextStyleToSlot,
|
|
@@ -1252,7 +1132,7 @@ function rendererPrimitives(context) {
|
|
|
1252
1132
|
};
|
|
1253
1133
|
}
|
|
1254
1134
|
export function createRowBody(context, row) {
|
|
1255
|
-
return rowRenderer(row).create(context.document, rendererPrimitives(context));
|
|
1135
|
+
return rowRenderer(row).create(context.document, rendererPrimitives(context, Boolean(row.disabled)));
|
|
1256
1136
|
}
|
|
1257
1137
|
export class NativeListWebEngine {
|
|
1258
1138
|
rows = [];
|
|
@@ -1270,6 +1150,7 @@ export class NativeListWebEngine {
|
|
|
1270
1150
|
rail: [],
|
|
1271
1151
|
mediaTile: [],
|
|
1272
1152
|
action: [],
|
|
1153
|
+
buttonGroup: [],
|
|
1273
1154
|
system: [],
|
|
1274
1155
|
activity: [],
|
|
1275
1156
|
dataRow: [],
|
|
@@ -1296,6 +1177,16 @@ export class NativeListWebEngine {
|
|
|
1296
1177
|
lastViewportWidth = -1;
|
|
1297
1178
|
lastViewportHeight = -1;
|
|
1298
1179
|
destroyed = false;
|
|
1180
|
+
hasAppliedSnapshot = false;
|
|
1181
|
+
structuralRevision = 0;
|
|
1182
|
+
structuralAnimations = [];
|
|
1183
|
+
structuralScrollInterrupted = false;
|
|
1184
|
+
reactFooterHeight = 0;
|
|
1185
|
+
structuralFooterCompensation = 0;
|
|
1186
|
+
structuralFooterExpansion = 0;
|
|
1187
|
+
structuralFooterFromHeight = 0;
|
|
1188
|
+
structuralProgress = 0;
|
|
1189
|
+
structuralPrefixTransition = false;
|
|
1299
1190
|
sectionIndexAlignStart = false;
|
|
1300
1191
|
// Renderers report intrinsic height after browser text wrapping.
|
|
1301
1192
|
measuredRendererHeights = new Map();
|
|
@@ -1327,7 +1218,7 @@ export class NativeListWebEngine {
|
|
|
1327
1218
|
this.contentBounds = scrollOptions.contentBounds;
|
|
1328
1219
|
this.externalStickyInset = this.validateStickyInset(scrollOptions.stickyInset);
|
|
1329
1220
|
this.document = host.ownerDocument;
|
|
1330
|
-
this.snapshot = validateSnapshot(snapshot);
|
|
1221
|
+
this.snapshot = containNativeListInput(() => validateSnapshot(snapshot)) ?? emptyNativeListSnapshot();
|
|
1331
1222
|
this.callbacks = callbacks;
|
|
1332
1223
|
this.virtualizationEnabled = virtualizationEnabled;
|
|
1333
1224
|
this.sectionIndexContainer = sectionIndexContainer ?? undefined;
|
|
@@ -1384,6 +1275,9 @@ export class NativeListWebEngine {
|
|
|
1384
1275
|
});
|
|
1385
1276
|
}
|
|
1386
1277
|
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1278
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart']) (this.externalScrollHost ?? this.viewport).addEventListener(event, this.handleStructuralUserScroll, {
|
|
1279
|
+
passive: true
|
|
1280
|
+
});
|
|
1387
1281
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
1388
1282
|
passive: true
|
|
1389
1283
|
});
|
|
@@ -1399,6 +1293,7 @@ export class NativeListWebEngine {
|
|
|
1399
1293
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1400
1294
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
1401
1295
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
1296
|
+
this.root.addEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
1402
1297
|
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
1403
1298
|
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
1404
1299
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -1452,7 +1347,7 @@ export class NativeListWebEngine {
|
|
|
1452
1347
|
this.document.fonts?.addEventListener('loadingdone', this.handleWindowResize);
|
|
1453
1348
|
this.observeSectionIndexTransforms();
|
|
1454
1349
|
this.applyFontFamilies(fontFamiliesJson);
|
|
1455
|
-
this.
|
|
1350
|
+
this.applyValidatedSnapshot(this.snapshot);
|
|
1456
1351
|
}
|
|
1457
1352
|
validateStickyInset(value = 0) {
|
|
1458
1353
|
if (!Number.isFinite(value) || value < 0) throw new Error('webStickyInset must be finite and non-negative');
|
|
@@ -1516,10 +1411,291 @@ export class NativeListWebEngine {
|
|
|
1516
1411
|
this.renderWindow();
|
|
1517
1412
|
}
|
|
1518
1413
|
applySnapshot(snapshot) {
|
|
1519
|
-
const validated =
|
|
1520
|
-
|
|
1414
|
+
const validated = containNativeListInput(() => {
|
|
1415
|
+
const next = validateSnapshot(snapshot);
|
|
1416
|
+
if (this.externalScrollHost && next.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1417
|
+
return next;
|
|
1418
|
+
});
|
|
1419
|
+
if (!validated) return;
|
|
1420
|
+
this.applyValidatedSnapshot(validated);
|
|
1421
|
+
}
|
|
1422
|
+
applyValidatedSnapshot(validated) {
|
|
1423
|
+
this.pressedHelpElement = undefined;
|
|
1521
1424
|
this.invalidateActionAnchor('snapshot');
|
|
1522
|
-
|
|
1425
|
+
const transition = validated.structuralTransition;
|
|
1426
|
+
const isNewTransition = transition !== undefined && transition.id !== this.lastStructuralTransitionId;
|
|
1427
|
+
if (transition) this.lastStructuralTransitionId = transition.id;
|
|
1428
|
+
const nextRows = effectiveRows(validated);
|
|
1429
|
+
const changedKeys = this.rows.length !== nextRows.length || this.rows.some((row, index) => row.key !== nextRows[index]?.key);
|
|
1430
|
+
const incompatibleActivePrefix = this.structuralPrefixTransition && (validated.layout.kind !== this.snapshot.layout.kind || validated.layout.orientation !== this.snapshot.layout.orientation || nextRows.some((row, index) => row.height !== this.rows[index]?.height || row.style?.container?.height !== this.rows[index]?.style?.container?.height));
|
|
1431
|
+
const shouldAnimate = this.hasAppliedSnapshot && isNewTransition && changedKeys && (this.snapshot.layout.kind === 'linear' || this.snapshot.layout.kind === 'table') && this.snapshot.layout.orientation !== 'horizontal' && (validated.layout.kind === 'linear' || validated.layout.kind === 'table') && validated.layout.orientation !== 'horizontal' && (transition?.durationMs ?? 220) > 0 && !this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
|
|
1432
|
+
if (shouldAnimate && transition) this.applyStructuralSnapshot(validated, transition);else {
|
|
1433
|
+
if (isNewTransition || changedKeys || incompatibleActivePrefix) this.cancelStructuralAnimation();
|
|
1434
|
+
this.setSnapshot(validated);
|
|
1435
|
+
}
|
|
1436
|
+
this.hasAppliedSnapshot = true;
|
|
1437
|
+
}
|
|
1438
|
+
cancelStructuralAnimation() {
|
|
1439
|
+
this.structuralRevision += 1;
|
|
1440
|
+
if (this.structuralFrame !== undefined) this.document.defaultView?.cancelAnimationFrame(this.structuralFrame);
|
|
1441
|
+
if (this.structuralFinish !== undefined) this.document.defaultView?.clearTimeout(this.structuralFinish);
|
|
1442
|
+
this.structuralFrame = undefined;
|
|
1443
|
+
this.structuralFinish = undefined;
|
|
1444
|
+
this.structuralAnimations.forEach(animation => animation.cancel());
|
|
1445
|
+
this.structuralAnimations = [];
|
|
1446
|
+
if (this.structuralTail) {
|
|
1447
|
+
disposeWebImageRetries(this.structuralTail.layer);
|
|
1448
|
+
this.structuralTail.layer.remove();
|
|
1449
|
+
this.structuralTail = undefined;
|
|
1450
|
+
}
|
|
1451
|
+
if (this.structuralContentOverflow !== undefined) {
|
|
1452
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
1453
|
+
this.structuralContentOverflow = undefined;
|
|
1454
|
+
}
|
|
1455
|
+
this.structuralPrefixTransition = false;
|
|
1456
|
+
if (this.structuralFooterElement && this.structuralFooterStyles) {
|
|
1457
|
+
this.structuralFooterElement.style.marginBottom = this.structuralFooterStyles.marginBottom;
|
|
1458
|
+
this.structuralFooterElement.style.transform = this.structuralFooterStyles.transform;
|
|
1459
|
+
this.structuralFooterElement.style.clipPath = this.structuralFooterStyles.clipPath;
|
|
1460
|
+
}
|
|
1461
|
+
this.structuralFooterElement = undefined;
|
|
1462
|
+
this.structuralFooterStyles = undefined;
|
|
1463
|
+
this.structuralScrollInterrupted = false;
|
|
1464
|
+
this.structuralRenderedHeight = undefined;
|
|
1465
|
+
this.structuralTargetHeight = undefined;
|
|
1466
|
+
this.structuralFooterCompensation = 0;
|
|
1467
|
+
this.structuralFooterExpansion = 0;
|
|
1468
|
+
this.structuralProgress = 0;
|
|
1469
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1470
|
+
if (this.structuralAnchorStyles) {
|
|
1471
|
+
owner.style.overflowAnchor = this.structuralAnchorStyles.owner;
|
|
1472
|
+
this.content.style.overflowAnchor = this.structuralAnchorStyles.content;
|
|
1473
|
+
this.structuralAnchorStyles = undefined;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
handleStructuralUserScroll = event => {
|
|
1477
|
+
if (event.type === 'pointerdown' && event.target !== (this.externalScrollHost ?? this.viewport) && event.pointerType !== 'touch') return;
|
|
1478
|
+
this.structuralScrollInterrupted = true;
|
|
1479
|
+
if (this.structuralPrefixTransition) {
|
|
1480
|
+
this.cancelStructuralAnimation();
|
|
1481
|
+
this.recomputeLayout();
|
|
1482
|
+
}
|
|
1483
|
+
};
|
|
1484
|
+
updateStructuralTailWindow() {
|
|
1485
|
+
const tail = this.structuralTail;
|
|
1486
|
+
if (!tail) return;
|
|
1487
|
+
const visible = visibleWebLayoutItems(tail.layout, this.currentOffset(), this.viewportLength(), this.viewportLength() * OVERSCAN_VIEWPORTS).filter(item => item.index >= tail.firstIndex);
|
|
1488
|
+
const desired = new Set(visible.map(item => item.index));
|
|
1489
|
+
tail.mounted.forEach((element, index) => {
|
|
1490
|
+
if (desired.has(index)) return;
|
|
1491
|
+
disposeWebImageRetries(element);
|
|
1492
|
+
element.remove();
|
|
1493
|
+
tail.mounted.delete(index);
|
|
1494
|
+
});
|
|
1495
|
+
visible.forEach(item => {
|
|
1496
|
+
if (tail.mounted.has(item.index)) return;
|
|
1497
|
+
const row = tail.rows[item.index];
|
|
1498
|
+
if (!row) return;
|
|
1499
|
+
const element = createElement(this.document, 'div', 'ok-native-list-item');
|
|
1500
|
+
element.setAttribute('aria-hidden', 'true');
|
|
1501
|
+
element.style.pointerEvents = 'none';
|
|
1502
|
+
element.style.opacity = String((row.style?.container?.opacity ?? row.opacity ?? 1) * (row.disabled ? 0.5 : 1));
|
|
1503
|
+
const body = createRowBody({
|
|
1504
|
+
document: this.document,
|
|
1505
|
+
snapshot: tail.snapshot,
|
|
1506
|
+
selectedKeys: selectionStateFromSnapshot(tail.snapshot).selectedKeys,
|
|
1507
|
+
itemIndex: item.index
|
|
1508
|
+
}, row);
|
|
1509
|
+
applyRowStyle(body, row);
|
|
1510
|
+
element.append(body);
|
|
1511
|
+
this.positionElement(element, item);
|
|
1512
|
+
tail.layer.append(element);
|
|
1513
|
+
tail.mounted.set(item.index, element);
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
writeStructuralHeight(height) {
|
|
1517
|
+
if (this.externalScrollHost) this.writeExternalHeight(height);else this.content.style.height = `${height}px`;
|
|
1518
|
+
}
|
|
1519
|
+
reactFooterElement() {
|
|
1520
|
+
return this.contentBounds?.querySelector('[data-testid="native-list-footer-slot"]');
|
|
1521
|
+
}
|
|
1522
|
+
readReactFooterHeight() {
|
|
1523
|
+
return this.reactFooterElement()?.getBoundingClientRect().height ?? 0;
|
|
1524
|
+
}
|
|
1525
|
+
applyStructuralFooterVisual(progress) {
|
|
1526
|
+
const footer = this.structuralFooterElement;
|
|
1527
|
+
if (!footer || this.structuralFooterExpansion <= 0) return;
|
|
1528
|
+
const hidden = this.structuralFooterExpansion * (1 - progress);
|
|
1529
|
+
footer.style.marginBottom = `${-hidden}px`;
|
|
1530
|
+
footer.style.transform = `translateY(${-hidden}px)`;
|
|
1531
|
+
footer.style.clipPath = `inset(${hidden}px 0 0 0)`;
|
|
1532
|
+
}
|
|
1533
|
+
applyStructuralSnapshot(next, transition) {
|
|
1534
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1535
|
+
const oldOffset = owner.scrollTop;
|
|
1536
|
+
const oldScrollHeight = owner.scrollHeight;
|
|
1537
|
+
const oldHeight = this.structuralRenderedHeight ?? (this.content.getBoundingClientRect().height || this.layout.contentHeight);
|
|
1538
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
1539
|
+
const oldFooterHeight = this.structuralRenderedHeight === undefined ? this.reactFooterHeight : this.structuralFooterFromHeight + (this.reactFooterHeight - this.structuralFooterFromHeight) * this.structuralProgress;
|
|
1540
|
+
const footerDifference = oldFooterHeight - nextFooterHeight;
|
|
1541
|
+
const startHeight = oldHeight + Math.max(0, footerDifference);
|
|
1542
|
+
const oldSnapshot = this.snapshot;
|
|
1543
|
+
const oldRows = this.rows;
|
|
1544
|
+
const oldLayout = this.layout;
|
|
1545
|
+
const oldItems = oldLayout.items;
|
|
1546
|
+
const nextRows = effectiveRows(next);
|
|
1547
|
+
const prefixCount = Math.min(oldRows.length, nextRows.length);
|
|
1548
|
+
const prefixTailChange = oldSnapshot.layout.kind === next.layout.kind && oldSnapshot.layout.orientation === next.layout.orientation && oldRows.length !== nextRows.length && oldRows.slice(0, prefixCount).every((row, index) => row.key === nextRows[index]?.key);
|
|
1549
|
+
const oldPositions = new Map();
|
|
1550
|
+
this.mounted.forEach((element, index) => {
|
|
1551
|
+
const row = this.rows[index];
|
|
1552
|
+
if (row) oldPositions.set(row.key, element.getBoundingClientRect().top);
|
|
1553
|
+
});
|
|
1554
|
+
const nextKeys = new Set(effectiveRows(next).map(row => row.key));
|
|
1555
|
+
const visibleOffset = this.currentOffset();
|
|
1556
|
+
const visibleSurvivor = oldItems.find(item => item.y + item.height > visibleOffset && nextKeys.has(item.key));
|
|
1557
|
+
const anchor = visibleSurvivor;
|
|
1558
|
+
this.cancelStructuralAnimation();
|
|
1559
|
+
this.structuralScrollInterrupted = false;
|
|
1560
|
+
this.structuralAnchorStyles = {
|
|
1561
|
+
owner: owner.style.overflowAnchor,
|
|
1562
|
+
content: this.content.style.overflowAnchor
|
|
1563
|
+
};
|
|
1564
|
+
owner.style.overflowAnchor = 'none';
|
|
1565
|
+
this.content.style.overflowAnchor = 'none';
|
|
1566
|
+
this.structuralContentOverflow = this.content.style.overflow;
|
|
1567
|
+
if (prefixTailChange) this.content.style.overflow = 'clip';
|
|
1568
|
+
this.structuralRenderedHeight = startHeight;
|
|
1569
|
+
this.structuralFooterFromHeight = oldFooterHeight;
|
|
1570
|
+
this.structuralFooterCompensation = Math.max(0, footerDifference);
|
|
1571
|
+
this.structuralFooterExpansion = Math.max(0, -footerDifference);
|
|
1572
|
+
this.structuralProgress = 0;
|
|
1573
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
1574
|
+
this.structuralFooterElement = this.reactFooterElement() ?? undefined;
|
|
1575
|
+
if (this.structuralFooterElement) {
|
|
1576
|
+
const style = this.structuralFooterElement.style;
|
|
1577
|
+
this.structuralFooterStyles = {
|
|
1578
|
+
marginBottom: style.marginBottom,
|
|
1579
|
+
transform: style.transform,
|
|
1580
|
+
clipPath: style.clipPath
|
|
1581
|
+
};
|
|
1582
|
+
this.applyStructuralFooterVisual(0);
|
|
1583
|
+
}
|
|
1584
|
+
this.setSnapshot(next);
|
|
1585
|
+
const newHeight = this.layout.contentHeight;
|
|
1586
|
+
this.structuralTargetHeight = newHeight;
|
|
1587
|
+
const stablePrefixGeometry = prefixTailChange && oldItems.length === oldRows.length && this.layout.items.length === nextRows.length && oldItems.slice(0, prefixCount).every((item, index) => {
|
|
1588
|
+
const nextItem = this.layout.items[index];
|
|
1589
|
+
return nextItem?.y === item.y && nextItem?.height === item.height && nextItem?.width === item.width;
|
|
1590
|
+
});
|
|
1591
|
+
if (!stablePrefixGeometry) {
|
|
1592
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
1593
|
+
this.structuralContentOverflow = undefined;
|
|
1594
|
+
} else {
|
|
1595
|
+
this.structuralPrefixTransition = true;
|
|
1596
|
+
}
|
|
1597
|
+
if (stablePrefixGeometry && nextRows.length < oldRows.length) {
|
|
1598
|
+
const layer = createElement(this.document, 'div', 'ok-native-list-structural-tail');
|
|
1599
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
1600
|
+
layer.setAttribute('inert', '');
|
|
1601
|
+
Object.assign(layer.style, {
|
|
1602
|
+
position: 'absolute',
|
|
1603
|
+
inset: '0',
|
|
1604
|
+
pointerEvents: 'none'
|
|
1605
|
+
});
|
|
1606
|
+
this.content.append(layer);
|
|
1607
|
+
this.structuralTail = {
|
|
1608
|
+
snapshot: oldSnapshot,
|
|
1609
|
+
rows: oldRows,
|
|
1610
|
+
layout: oldLayout,
|
|
1611
|
+
firstIndex: prefixCount,
|
|
1612
|
+
layer,
|
|
1613
|
+
mounted: new Map()
|
|
1614
|
+
};
|
|
1615
|
+
this.updateStructuralTailWindow();
|
|
1616
|
+
}
|
|
1617
|
+
const nextAnchor = anchor && this.layout.items.find(item => item.key === anchor.key);
|
|
1618
|
+
const delta = nextAnchor && anchor ? nextAnchor.y - anchor.y : 0;
|
|
1619
|
+
let finalScrollHeight = oldScrollHeight + newHeight - oldHeight;
|
|
1620
|
+
if (stablePrefixGeometry && this.externalScrollHost) {
|
|
1621
|
+
const beforeMeasure = owner.scrollTop;
|
|
1622
|
+
const tailLayer = this.structuralTail?.layer;
|
|
1623
|
+
if (tailLayer) tailLayer.style.display = 'none';
|
|
1624
|
+
this.writeStructuralHeight(newHeight);
|
|
1625
|
+
this.applyStructuralFooterVisual(1);
|
|
1626
|
+
finalScrollHeight = owner.scrollHeight;
|
|
1627
|
+
this.writeStructuralHeight(startHeight);
|
|
1628
|
+
this.applyStructuralFooterVisual(0);
|
|
1629
|
+
if (tailLayer) tailLayer.style.display = '';
|
|
1630
|
+
owner.scrollTop = beforeMeasure;
|
|
1631
|
+
}
|
|
1632
|
+
const finalMaxOffset = Math.max(0, finalScrollHeight - owner.clientHeight);
|
|
1633
|
+
let targetOffset = Math.max(0, Math.min(oldOffset + delta, finalMaxOffset));
|
|
1634
|
+
if (!visibleSurvivor && transition.anchorKey && !(stablePrefixGeometry && nextRows.length > oldRows.length)) {
|
|
1635
|
+
const fallback = this.layout.items.find(item => item.key === transition.anchorKey);
|
|
1636
|
+
if (fallback) {
|
|
1637
|
+
const pagerStickyInset = Number.parseFloat(this.externalScrollHost?.style.getPropertyValue('--ok-collapsible-pager-sticky-inset') ?? '');
|
|
1638
|
+
const effectiveStickyInset = Math.max(this.externalStickyInset, Number.isFinite(pagerStickyInset) ? pagerStickyInset : 0);
|
|
1639
|
+
const fallbackTop = this.externalScrollHost ? this.externalGeometry().origin + fallback.y - effectiveStickyInset : resolveWebCollapsiblePagerRawOffset(Math.max(0, fallback.y - this.collapsiblePagerInsets().sticky), this.collapsiblePagerInsets().header);
|
|
1640
|
+
if (stablePrefixGeometry && this.externalScrollHost && this.reactFooterHeight > 0) {
|
|
1641
|
+
const footerTop = this.externalGeometry().origin + newHeight;
|
|
1642
|
+
const footerStart = Math.max(0, footerTop + this.reactFooterHeight - owner.clientHeight);
|
|
1643
|
+
const footerEnd = Math.max(0, footerTop - effectiveStickyInset);
|
|
1644
|
+
const nearestVisibleOffset = footerStart <= footerEnd ? Math.max(footerStart, Math.min(oldOffset, footerEnd)) : footerEnd;
|
|
1645
|
+
targetOffset = Math.max(0, Math.min(nearestVisibleOffset, finalMaxOffset));
|
|
1646
|
+
} else {
|
|
1647
|
+
targetOffset = Math.min(targetOffset, Math.max(0, fallbackTop));
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
const duration = transition.durationMs ?? 220;
|
|
1652
|
+
const easing = 'cubic-bezier(0.42, 0, 0.58, 1)';
|
|
1653
|
+
this.mounted.forEach((element, index) => {
|
|
1654
|
+
const row = this.rows[index];
|
|
1655
|
+
const previousTop = row && oldPositions.get(row.key);
|
|
1656
|
+
if (previousTop === undefined || typeof element.animate !== 'function') return;
|
|
1657
|
+
const offset = previousTop - element.getBoundingClientRect().top;
|
|
1658
|
+
if (Math.abs(offset) < 0.5) return;
|
|
1659
|
+
this.structuralAnimations.push(element.animate([{
|
|
1660
|
+
transform: `translateY(${offset}px)`
|
|
1661
|
+
}, {
|
|
1662
|
+
transform: 'translateY(0)'
|
|
1663
|
+
}], {
|
|
1664
|
+
duration,
|
|
1665
|
+
easing
|
|
1666
|
+
}));
|
|
1667
|
+
});
|
|
1668
|
+
const startedAt = this.document.defaultView?.performance.now() ?? Date.now();
|
|
1669
|
+
const revision = this.structuralRevision;
|
|
1670
|
+
const finish = () => {
|
|
1671
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
1672
|
+
const ownsScroll = !this.structuralScrollInterrupted;
|
|
1673
|
+
this.cancelStructuralAnimation();
|
|
1674
|
+
this.recomputeLayout();
|
|
1675
|
+
if (stablePrefixGeometry && ownsScroll) {
|
|
1676
|
+
owner.scrollTop = Math.max(0, Math.min(targetOffset, owner.scrollHeight - owner.clientHeight));
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1679
|
+
const step = time => {
|
|
1680
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
1681
|
+
if (this.structuralPrefixTransition && this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {
|
|
1682
|
+
finish();
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
const progress = Math.min(1, (time - startedAt) / duration);
|
|
1686
|
+
const eased = progress * progress * (3 - 2 * progress);
|
|
1687
|
+
this.structuralProgress = eased;
|
|
1688
|
+
const renderedHeight = oldHeight + ((this.structuralTargetHeight ?? newHeight) - oldHeight) * eased + this.structuralFooterCompensation * (1 - eased);
|
|
1689
|
+
this.structuralRenderedHeight = renderedHeight;
|
|
1690
|
+
this.writeStructuralHeight(renderedHeight);
|
|
1691
|
+
this.applyStructuralFooterVisual(eased);
|
|
1692
|
+
if (!this.structuralScrollInterrupted) owner.scrollTop = oldOffset + (targetOffset - oldOffset) * eased;
|
|
1693
|
+
this.externalGeometryCache = undefined;
|
|
1694
|
+
this.updateStructuralTailWindow();
|
|
1695
|
+
if (progress < 1) this.structuralFrame = this.document.defaultView?.requestAnimationFrame(step);
|
|
1696
|
+
};
|
|
1697
|
+
this.structuralFrame = this.document.defaultView?.requestAnimationFrame(step);
|
|
1698
|
+
this.structuralFinish = this.document.defaultView?.setTimeout(finish, duration + 40);
|
|
1523
1699
|
}
|
|
1524
1700
|
currentContentHeight() {
|
|
1525
1701
|
return this.layout.contentHeight;
|
|
@@ -1528,12 +1704,14 @@ export class NativeListWebEngine {
|
|
|
1528
1704
|
return this.snapshot;
|
|
1529
1705
|
}
|
|
1530
1706
|
applyPatches(patches) {
|
|
1531
|
-
|
|
1532
|
-
|
|
1707
|
+
const accepted = containNativeListInput(() => applyValidatedRowPatches(this.snapshot, patches));
|
|
1708
|
+
if (!accepted || accepted.patches.length === 0) return;
|
|
1709
|
+
patches = accepted.patches;
|
|
1710
|
+
const next = accepted.snapshot;
|
|
1533
1711
|
const selection = new Set(this.selectedKeys);
|
|
1534
1712
|
patches.forEach(patch => {
|
|
1535
1713
|
const selected = 'selected' in patch.changes ? patch.changes.selected : undefined;
|
|
1536
|
-
if (selected === true) selection.add(patch.key);else if (selected === false) selection.delete(patch.key);
|
|
1714
|
+
if (selected === true) selection.add(patch.key);else if (selected === false || selected === null) selection.delete(patch.key);
|
|
1537
1715
|
});
|
|
1538
1716
|
const tableValuesOnly = patches.every(patch => {
|
|
1539
1717
|
const index = this.rows.findIndex(row => row.key === patch.key);
|
|
@@ -1684,6 +1862,8 @@ export class NativeListWebEngine {
|
|
|
1684
1862
|
}
|
|
1685
1863
|
destroy() {
|
|
1686
1864
|
if (this.destroyed) return;
|
|
1865
|
+
this.cancelStructuralAnimation();
|
|
1866
|
+
this.pressedHelpElement = undefined;
|
|
1687
1867
|
this.invalidateActionAnchor('destroy');
|
|
1688
1868
|
this.destroyed = true;
|
|
1689
1869
|
if (this.frameHandle !== undefined) this.cancelFrame(this.frameHandle);
|
|
@@ -1696,6 +1876,7 @@ export class NativeListWebEngine {
|
|
|
1696
1876
|
this.document.defaultView?.removeEventListener('resize', this.handleWindowResize);
|
|
1697
1877
|
this.pendingScroll = undefined;
|
|
1698
1878
|
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1879
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart']) (this.externalScrollHost ?? this.viewport).removeEventListener(event, this.handleStructuralUserScroll);
|
|
1699
1880
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
1700
1881
|
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1701
1882
|
this.root.removeEventListener('click', this.handleClick);
|
|
@@ -1707,6 +1888,7 @@ export class NativeListWebEngine {
|
|
|
1707
1888
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1708
1889
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1709
1890
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
1891
|
+
this.root.removeEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
1710
1892
|
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
1711
1893
|
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
1712
1894
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -1745,6 +1927,7 @@ export class NativeListWebEngine {
|
|
|
1745
1927
|
}
|
|
1746
1928
|
setSnapshot(snapshot, selectedKeys) {
|
|
1747
1929
|
this.cancelMarketPointer();
|
|
1930
|
+
this.pressedHelpElement = undefined;
|
|
1748
1931
|
this.measuredRendererHeights.clear();
|
|
1749
1932
|
this.snapshot = snapshot;
|
|
1750
1933
|
this.rows = effectiveRows(snapshot);
|
|
@@ -1762,6 +1945,7 @@ export class NativeListWebEngine {
|
|
|
1762
1945
|
'--nl-row': theme.rowBackground,
|
|
1763
1946
|
'--nl-selected': theme.rowSelectedBackground,
|
|
1764
1947
|
'--nl-pressed': theme.rowPressedBackground,
|
|
1948
|
+
'--nl-hover': theme.rowHoverBackground ?? theme.rowPressedBackground,
|
|
1765
1949
|
'--nl-subdued': theme.subduedBackground,
|
|
1766
1950
|
'--nl-strong': theme.strongBackground,
|
|
1767
1951
|
'--nl-image-fallback-background': theme.imageFallbackBackground ?? 'transparent',
|
|
@@ -1778,11 +1962,13 @@ export class NativeListWebEngine {
|
|
|
1778
1962
|
'--nl-separator': theme.separator,
|
|
1779
1963
|
'--nl-accent': theme.accent,
|
|
1780
1964
|
'--nl-positive': theme.positive,
|
|
1965
|
+
'--nl-success-background': theme.successBackground,
|
|
1781
1966
|
'--nl-negative': theme.negative,
|
|
1782
1967
|
'--nl-critical': theme.criticalBackground,
|
|
1783
1968
|
'--nl-inverse': theme.inverseBackground,
|
|
1784
1969
|
'--nl-inverse-text': theme.inverseText,
|
|
1785
|
-
'--nl-info': theme.info
|
|
1970
|
+
'--nl-info': theme.info,
|
|
1971
|
+
'--nl-media-shine': isDarkBackground(theme.background) ? 'rgba(255,255,255,0.07)' : 'rgba(255,255,255,0.75)'
|
|
1786
1972
|
};
|
|
1787
1973
|
Object.entries(values).forEach(([name, value]) => {
|
|
1788
1974
|
if (!value) return;
|
|
@@ -1838,10 +2024,24 @@ export class NativeListWebEngine {
|
|
|
1838
2024
|
}
|
|
1839
2025
|
recomputeLayout = () => {
|
|
1840
2026
|
if (this.destroyed) return;
|
|
2027
|
+
if (this.structuralPrefixTransition && this.lastViewportWidth > 0 && this.viewport.clientWidth > 0 && this.viewport.clientWidth !== this.lastViewportWidth) this.cancelStructuralAnimation();
|
|
2028
|
+
if (this.structuralRenderedHeight === undefined) this.reactFooterHeight = this.readReactFooterHeight();else {
|
|
2029
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
2030
|
+
const footerDelta = this.reactFooterHeight - nextFooterHeight;
|
|
2031
|
+
if (footerDelta !== 0) {
|
|
2032
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
2033
|
+
const priorCompensation = this.structuralFooterCompensation;
|
|
2034
|
+
const difference = this.structuralFooterFromHeight - nextFooterHeight;
|
|
2035
|
+
this.structuralFooterCompensation = Math.max(0, difference);
|
|
2036
|
+
this.structuralFooterExpansion = Math.max(0, -difference);
|
|
2037
|
+
this.structuralRenderedHeight += (this.structuralFooterCompensation - priorCompensation) * (1 - this.structuralProgress);
|
|
2038
|
+
this.applyStructuralFooterVisual(this.structuralProgress);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
1841
2041
|
const cachedWidth = this.lastViewportWidth;
|
|
1842
2042
|
const cachedHeight = this.lastViewportHeight;
|
|
1843
2043
|
const precomputedLayout = this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0 ? this.computeLayout(cachedWidth, cachedHeight) : undefined;
|
|
1844
|
-
if (precomputedLayout) {
|
|
2044
|
+
if (precomputedLayout && this.structuralRenderedHeight === undefined) {
|
|
1845
2045
|
// Commit appended row extent before measuring React-owned slot changes.
|
|
1846
2046
|
this.writeExternalHeight(Math.max(this.layout.contentHeight, precomputedLayout.contentHeight));
|
|
1847
2047
|
}
|
|
@@ -1871,11 +2071,13 @@ export class NativeListWebEngine {
|
|
|
1871
2071
|
const previousHorizontal = this.layout.horizontal;
|
|
1872
2072
|
this.layout = precomputedLayout && viewportWidth === cachedWidth && viewportHeight === cachedHeight ? precomputedLayout : this.computeLayout(viewportWidth, viewportHeight);
|
|
1873
2073
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
1874
|
-
this.
|
|
2074
|
+
const renderedHeight = this.structuralRenderedHeight ?? this.layout.contentHeight;
|
|
2075
|
+
this.content.style.height = String(renderedHeight) + 'px';
|
|
1875
2076
|
if (this.externalScrollHost) {
|
|
1876
|
-
this.writeExternalHeight(
|
|
2077
|
+
this.writeExternalHeight(renderedHeight);
|
|
1877
2078
|
this.externalGeometryCache = undefined;
|
|
1878
2079
|
}
|
|
2080
|
+
if (this.structuralRenderedHeight !== undefined) this.structuralTargetHeight = this.layout.contentHeight;
|
|
1879
2081
|
this.renderSectionIndex(this.viewport.clientHeight <= 0 ? DEFAULT_VIEWPORT_HEIGHT : Math.max(1, viewportHeight), stickyInset);
|
|
1880
2082
|
if (previousHorizontal !== this.layout.horizontal) {
|
|
1881
2083
|
this.viewport.scrollLeft = 0;
|
|
@@ -1983,6 +2185,7 @@ export class NativeListWebEngine {
|
|
|
1983
2185
|
}
|
|
1984
2186
|
this.updateVisibleSelection();
|
|
1985
2187
|
this.updateVisibleState();
|
|
2188
|
+
this.updateStructuralTailWindow();
|
|
1986
2189
|
}
|
|
1987
2190
|
positionElement(element, item) {
|
|
1988
2191
|
element.style.transform = 'translate3d(' + String(item.x) + 'px,' + String(item.y) + 'px,0)';
|
|
@@ -2028,7 +2231,7 @@ export class NativeListWebEngine {
|
|
|
2028
2231
|
const body = reusableBody ?? createRowBody(context, row);
|
|
2029
2232
|
if (reusableBody) {
|
|
2030
2233
|
resetRowContainerStyle(body);
|
|
2031
|
-
registered.bind(body, rendererPrimitives(context));
|
|
2234
|
+
registered.bind(body, rendererPrimitives(context, Boolean(row.disabled)));
|
|
2032
2235
|
}
|
|
2033
2236
|
// OneKey patch: explicit selector fields preserve original page geometry.
|
|
2034
2237
|
element.style.contain = row.backgroundFullWidth ? 'layout style' : '';
|
|
@@ -2510,6 +2713,7 @@ export class NativeListWebEngine {
|
|
|
2510
2713
|
return anchor.actionElement.isConnected && anchor.rowElement.isConnected && anchor.rowElement.contains(anchor.actionElement) && anchor.rowElement.dataset.nativeListBindingEpoch === anchor.bindingEpoch;
|
|
2511
2714
|
}
|
|
2512
2715
|
invalidateActionAnchorForElement(element) {
|
|
2716
|
+
if (this.pressedHelpElement && element.contains(this.pressedHelpElement)) this.pressedHelpElement = undefined;
|
|
2513
2717
|
const anchor = this.actionAnchor;
|
|
2514
2718
|
if (anchor && (element === anchor.rowElement || element.contains(anchor.actionElement))) {
|
|
2515
2719
|
this.invalidateActionAnchor('rebind');
|
|
@@ -2582,9 +2786,9 @@ export class NativeListWebEngine {
|
|
|
2582
2786
|
if (event.target.closest('[data-native-list-action]')) return;
|
|
2583
2787
|
const rowElement = event.target.closest('[data-native-list-row-key]');
|
|
2584
2788
|
const row = this.rowAtElement(rowElement);
|
|
2585
|
-
if (row?.type !== 'market' || !isRowPressEnabled(row)) return;
|
|
2789
|
+
if (row?.type !== 'market' && row?.type !== 'identity' || !isRowPressEnabled(row)) return;
|
|
2586
2790
|
this.cancelMarketPointer();
|
|
2587
|
-
if (row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2791
|
+
if (row.type === 'market' && row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2588
2792
|
if (!row.longPressActionKey || !rowElement) return;
|
|
2589
2793
|
markActionAnchorSource(rowElement, 'row');
|
|
2590
2794
|
const bindingEpoch = rowElement.dataset.nativeListBindingEpoch;
|
|
@@ -2593,7 +2797,7 @@ export class NativeListWebEngine {
|
|
|
2593
2797
|
if (!current || current.pointerId !== event.pointerId) return;
|
|
2594
2798
|
const currentRow = this.rowAtElement(rowElement);
|
|
2595
2799
|
this.marketPointer = undefined;
|
|
2596
|
-
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2800
|
+
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' && currentRow.type !== 'identity' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2597
2801
|
this.marketLongPressFired = true;
|
|
2598
2802
|
this.emitRowAction(currentRow, currentRow.longPressActionKey, rowElement, rowElement, {
|
|
2599
2803
|
x: event.clientX,
|
|
@@ -2604,7 +2808,7 @@ export class NativeListWebEngine {
|
|
|
2604
2808
|
this.marketPointer = {
|
|
2605
2809
|
pointerId: event.pointerId,
|
|
2606
2810
|
pointerType: event.pointerType,
|
|
2607
|
-
compact: !row.webTable,
|
|
2811
|
+
compact: row.type === 'identity' || !row.webTable,
|
|
2608
2812
|
rowKey: row.key,
|
|
2609
2813
|
startX: event.clientX,
|
|
2610
2814
|
startY: event.clientY,
|
|
@@ -2640,7 +2844,14 @@ export class NativeListWebEngine {
|
|
|
2640
2844
|
if (!(target instanceof Element)) return;
|
|
2641
2845
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2642
2846
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
2847
|
+
if (action.dataset.nativeListIconHelp === 'true') {
|
|
2848
|
+
if (event.type === 'pointerover' && event.pointerType === 'touch') return;
|
|
2849
|
+
if (this.pressedHelpElement === action) return;
|
|
2850
|
+
}
|
|
2643
2851
|
if (action.classList.contains('ok-native-list-market-subtitle-prefix') && action.scrollWidth <= action.clientWidth + 1) return;
|
|
2852
|
+
this.emitHoverAction(action);
|
|
2853
|
+
};
|
|
2854
|
+
emitHoverAction(action) {
|
|
2644
2855
|
const rowElement = action.closest('[data-native-list-row-key]');
|
|
2645
2856
|
const row = this.rowAtElement(rowElement);
|
|
2646
2857
|
const memberKey = action.closest('[data-native-list-group-member-key]')?.dataset.nativeListGroupMemberKey;
|
|
@@ -2649,12 +2860,26 @@ export class NativeListWebEngine {
|
|
|
2649
2860
|
// Legacy Web: hover checks only the resolved source (the member for a
|
|
2650
2861
|
// WalletGroup), not the enclosing row's `disabled`.
|
|
2651
2862
|
if (sourceRow && !sourceRow.disabled && actionKey) this.emitRowAction(sourceRow, actionKey, action, rowElement ?? undefined);
|
|
2863
|
+
}
|
|
2864
|
+
handleIconHelpPointerDown = event => {
|
|
2865
|
+
const target = event.target;
|
|
2866
|
+
if (!(target instanceof Element)) return;
|
|
2867
|
+
const action = target.closest('[data-native-list-icon-help="true"]');
|
|
2868
|
+
if (!action) return;
|
|
2869
|
+
if (event.pointerType === 'touch') {
|
|
2870
|
+
if (this.actionAnchor?.actionElement === action && this.actionAnchor.open) this.invalidateActionAnchor('pointerLeave');else this.emitHoverAction(action);
|
|
2871
|
+
} else {
|
|
2872
|
+
this.pressedHelpElement = action;
|
|
2873
|
+
if (this.actionAnchor?.actionElement === action) this.invalidateActionAnchor('pointerLeave');
|
|
2874
|
+
}
|
|
2652
2875
|
};
|
|
2653
2876
|
handleTitlePointerOut = event => {
|
|
2654
2877
|
const target = event.target;
|
|
2655
2878
|
if (!(target instanceof Element)) return;
|
|
2656
2879
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2657
2880
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
2881
|
+
if (action.dataset.nativeListIconHelp === 'true' && event.type === 'pointerout' && event.pointerType === 'touch') return;
|
|
2882
|
+
if (event.type === 'pointerout' && this.pressedHelpElement === action) this.pressedHelpElement = undefined;
|
|
2658
2883
|
if (this.actionAnchor?.actionElement === action) this.invalidateActionAnchor('pointerLeave');
|
|
2659
2884
|
};
|
|
2660
2885
|
handleClick = event => {
|
|
@@ -2666,6 +2891,11 @@ export class NativeListWebEngine {
|
|
|
2666
2891
|
}
|
|
2667
2892
|
const target = event.target;
|
|
2668
2893
|
if (!(target instanceof Element)) return;
|
|
2894
|
+
if (target.closest('[data-native-list-icon-help="true"]')) {
|
|
2895
|
+
event.preventDefault();
|
|
2896
|
+
event.stopPropagation();
|
|
2897
|
+
return;
|
|
2898
|
+
}
|
|
2669
2899
|
const rowElement = target.closest('[data-native-list-row-key]');
|
|
2670
2900
|
const row = this.rowAtElement(rowElement);
|
|
2671
2901
|
if (!row || row.disabled) return;
|
|
@@ -2677,6 +2907,8 @@ export class NativeListWebEngine {
|
|
|
2677
2907
|
// member press is blocked by `isRowPressEnabled` in `handleRowPress`.
|
|
2678
2908
|
const action = target.closest('[data-native-list-action]');
|
|
2679
2909
|
if (action) {
|
|
2910
|
+
if (action.tagName === 'BUTTON' && action.hasAttribute('disabled')) return;
|
|
2911
|
+
if (action.classList.contains('ok-native-list-trailing-button')) event.stopPropagation();
|
|
2680
2912
|
const scope = action.dataset.selectionScope;
|
|
2681
2913
|
if (scope === 'row') this.activateSelection({
|
|
2682
2914
|
scope: 'row'
|
|
@@ -2691,6 +2923,11 @@ export class NativeListWebEngine {
|
|
|
2691
2923
|
this.handleRowPress(sourceRow, rowElement ?? undefined, memberElement ?? rowElement ?? undefined);
|
|
2692
2924
|
};
|
|
2693
2925
|
handleKeyDown = event => {
|
|
2926
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && event.target.matches('[role="button"][data-native-list-hover-action]')) {
|
|
2927
|
+
event.preventDefault();
|
|
2928
|
+
if (this.actionAnchor?.actionElement !== event.target || !this.actionAnchor.open) this.emitHoverAction(event.target);
|
|
2929
|
+
return;
|
|
2930
|
+
}
|
|
2694
2931
|
// OneKey patch: non-button title help supports keyboard activation.
|
|
2695
2932
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && event.target.matches('[role="button"][data-native-list-action]')) {
|
|
2696
2933
|
event.preventDefault();
|
|
@@ -2792,6 +3029,7 @@ export class NativeListWebEngine {
|
|
|
2792
3029
|
};
|
|
2793
3030
|
handleScroll = () => {
|
|
2794
3031
|
this.externalGeometryCache = undefined;
|
|
3032
|
+
this.pressedHelpElement = undefined;
|
|
2795
3033
|
this.cancelMarketPointer();
|
|
2796
3034
|
this.invalidateActionAnchor('scroll');
|
|
2797
3035
|
this.scheduleFrame();
|