@onekeyfe/react-native-native-list 6.7.0-3 → 6.7.0-31
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 +4 -0
- 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 +35 -7
- 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/NativeListMediaPreviewSlot.kt +66 -31
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +1 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -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 +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1953 -117
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -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 +70 -11
- package/docs/SPEC.md +1170 -13
- package/docs/STYLE_SPEC.md +11 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +237 -51
- package/ios/NativeListActivityDetailsView.swift +30 -11
- 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/NativeListMediaPreviewSlot.swift +122 -61
- package/ios/NativeListMediaTileRenderer.swift +7 -3
- 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 +2 -1
- package/ios/NativeListRowHost.swift +14 -0
- package/ios/NativeListSectionHeaderRenderer.swift +100 -4
- package/ios/RNCNativeListView.swift +1052 -58
- package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
- package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
- package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
- package/ios/tests/NativeListLifecycleTests.swift +2798 -3
- package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
- package/ios/tests/NativeListMediaVisibilityTests.swift +26 -1
- package/ios/tests/NativeListSharedIconTests.swift +236 -0
- package/lib/module/NativeList.js +221 -36
- package/lib/module/NativeList.web.js +167 -46
- 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 +1246 -48
- package/lib/module/web/NativeListGeneratedIcons.js +31 -0
- package/lib/module/web/NativeListWebEngine.js +513 -274
- package/lib/module/web/templates/ActivityRowRenderer.js +120 -87
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
- package/lib/module/web/templates/DataRowRenderer.js +40 -5
- package/lib/module/web/templates/IdentityRowRenderer.js +158 -6
- package/lib/module/web/templates/MarketTableRowRenderer.js +37 -19
- package/lib/module/web/templates/MediaTileRowRenderer.js +4 -14
- 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 +126 -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 +416 -89
- package/src/NativeList.types.ts +24 -2
- package/src/NativeList.web.tsx +295 -89
- package/src/index.ts +2 -0
- package/src/models.ts +263 -144
- package/src/selection.ts +1 -0
- package/src/validation.ts +3013 -152
- package/src/web/NativeListGeneratedIcons.ts +28 -0
- package/src/web/NativeListWebEngine.ts +816 -343
- package/src/web/templates/ActivityRowRenderer.ts +178 -141
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +231 -6
- package/src/web/templates/MarketTableRowRenderer.ts +56 -33
- package/src/web/templates/MediaTileRowRenderer.ts +4 -17
- 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,3 +1,5 @@
|
|
|
1
|
+
import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
|
|
2
|
+
import { nativeListGeneratedIcons as selectorIcons } from './NativeListGeneratedIcons';
|
|
1
3
|
import { applyTextWeight } from './templates/RowText';
|
|
2
4
|
import {
|
|
3
5
|
applyRowContainerStyle,
|
|
@@ -60,7 +62,12 @@ import {
|
|
|
60
62
|
validateOffset,
|
|
61
63
|
type NormalizedPositionScroll,
|
|
62
64
|
} from '../scrolling';
|
|
63
|
-
import {
|
|
65
|
+
import {
|
|
66
|
+
applyValidatedRowPatches,
|
|
67
|
+
containNativeListInput,
|
|
68
|
+
emptyNativeListSnapshot,
|
|
69
|
+
validateSnapshot,
|
|
70
|
+
} from '../validation';
|
|
64
71
|
import { avatarPrefetchWindow } from '../avatarPrefetch';
|
|
65
72
|
import {
|
|
66
73
|
acquireNativeListAvatar,
|
|
@@ -92,8 +99,6 @@ export const WEB_REORDER_ANIMATION = {
|
|
|
92
99
|
const REORDER_TOUCH_LONG_PRESS_MS = 120;
|
|
93
100
|
const MARKET_LONG_PRESS_MS = 800;
|
|
94
101
|
const MARKET_MOVE_CANCEL_PX = 10;
|
|
95
|
-
export const WEB_MARKET_VERIFIED_PATH =
|
|
96
|
-
'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';
|
|
97
102
|
const REORDER_MOUSE_MOVE_THRESHOLD_PX = 5;
|
|
98
103
|
const REORDER_EDGE_RATIO = 0.25;
|
|
99
104
|
const REORDER_MAX_SPEED_ZONE_RATIO = 0.05;
|
|
@@ -795,7 +800,7 @@ export const WEB_LIST_CSS = `
|
|
|
795
800
|
.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}
|
|
796
801
|
|
|
797
802
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
798
|
-
.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)}
|
|
803
|
+
.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)}
|
|
799
804
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
800
805
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
801
806
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
@@ -804,9 +809,7 @@ export const WEB_LIST_CSS = `
|
|
|
804
809
|
.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}
|
|
805
810
|
.ok-native-list-item[data-table-alternate="true"]>.ok-native-list-row{background:var(--nl-bg)}
|
|
806
811
|
.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
807
|
-
.ok-native-list-item[data-native-list-
|
|
808
|
-
.ok-native-list-item[data-native-list-row-press-enabled="true"]>.ok-native-list-row{cursor:pointer}
|
|
809
|
-
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-pressed)}
|
|
812
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-hover)}
|
|
810
813
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-row{background:var(--nl-pressed)}
|
|
811
814
|
.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)}
|
|
812
815
|
.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)}
|
|
@@ -837,16 +840,23 @@ export const WEB_LIST_CSS = `
|
|
|
837
840
|
.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)}
|
|
838
841
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
839
842
|
.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}
|
|
843
|
+
.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}
|
|
844
|
+
.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}
|
|
845
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon:focus-visible:not(:disabled){outline:2px solid var(--nl-accent)}
|
|
846
|
+
.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}
|
|
840
847
|
.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)}
|
|
841
848
|
.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)}
|
|
842
849
|
.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}
|
|
843
850
|
.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}
|
|
844
851
|
.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}
|
|
845
|
-
.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}
|
|
852
|
+
.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}
|
|
846
853
|
.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)}}
|
|
847
|
-
.ok-native-list-
|
|
854
|
+
.ok-native-list-icon-button.ok-native-list-decorative-refresh{min-width:16px;width:16px;height:16px}
|
|
855
|
+
.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}
|
|
856
|
+
.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)}
|
|
848
857
|
.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}
|
|
849
858
|
.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)}
|
|
859
|
+
.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}
|
|
850
860
|
.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)}
|
|
851
861
|
.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}
|
|
852
862
|
.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)}
|
|
@@ -862,7 +872,7 @@ export const WEB_LIST_CSS = `
|
|
|
862
872
|
.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)}
|
|
863
873
|
.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}
|
|
864
874
|
@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)}}
|
|
865
|
-
.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
|
|
875
|
+
.ok-native-list-footer{flex:0 0 auto;min-height:0}.ok-native-list-sticky{position:absolute;z-index:4;left:0;right:0;top:0;pointer-events:auto}.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}
|
|
866
876
|
.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)}
|
|
867
877
|
.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)}
|
|
868
878
|
.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. */
|
|
@@ -895,6 +905,7 @@ export const WEB_LIST_CSS = `
|
|
|
895
905
|
.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)}
|
|
896
906
|
.ok-native-list-root [data-nl-container-border="true"]{position:relative}
|
|
897
907
|
.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}
|
|
908
|
+
.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}
|
|
898
909
|
.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)}
|
|
899
910
|
`;
|
|
900
911
|
|
|
@@ -987,7 +998,10 @@ function configureWebImageRetry(
|
|
|
987
998
|
}
|
|
988
999
|
if (orderedFallbacks !== undefined && retryCount >= retryLimit) {
|
|
989
1000
|
if (fallbackIndex >= orderedFallbacks.length) return;
|
|
990
|
-
|
|
1001
|
+
let nextUri: string | undefined;
|
|
1002
|
+
while (!nextUri && fallbackIndex < orderedFallbacks.length) {
|
|
1003
|
+
nextUri = safeImageUri(orderedFallbacks[fallbackIndex++]);
|
|
1004
|
+
}
|
|
991
1005
|
if (!nextUri) return;
|
|
992
1006
|
event.stopImmediatePropagation();
|
|
993
1007
|
retryCount = 0;
|
|
@@ -1163,316 +1177,31 @@ function paintSelectorImageBackground(
|
|
|
1163
1177
|
if (image.complete && image.naturalWidth > 0) update();
|
|
1164
1178
|
}
|
|
1165
1179
|
|
|
1166
|
-
// OneKey patch: use source SVG paths for selector actions and wallet provider marks.
|
|
1167
|
-
const selectorIcons: Readonly<
|
|
1168
|
-
Record<
|
|
1169
|
-
string,
|
|
1170
|
-
Readonly<{
|
|
1171
|
-
viewBox: string;
|
|
1172
|
-
paths: readonly Readonly<{
|
|
1173
|
-
d: string;
|
|
1174
|
-
fill: string;
|
|
1175
|
-
fillRule: string;
|
|
1176
|
-
opacity: number;
|
|
1177
|
-
}>[];
|
|
1178
|
-
}>
|
|
1179
|
-
>
|
|
1180
|
-
> = {
|
|
1181
|
-
CryptoCoinOutline: {
|
|
1182
|
-
viewBox: '0 0 24 24',
|
|
1183
|
-
paths: [
|
|
1184
|
-
{
|
|
1185
|
-
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',
|
|
1186
|
-
fill: 'currentColor',
|
|
1187
|
-
fillRule: 'nonzero',
|
|
1188
|
-
opacity: 1,
|
|
1189
|
-
},
|
|
1190
|
-
{
|
|
1191
|
-
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',
|
|
1192
|
-
fill: 'currentColor',
|
|
1193
|
-
fillRule: 'evenodd',
|
|
1194
|
-
opacity: 1,
|
|
1195
|
-
},
|
|
1196
|
-
],
|
|
1197
|
-
},
|
|
1198
|
-
GlobusOutline: {
|
|
1199
|
-
viewBox: '0 0 24 24',
|
|
1200
|
-
paths: [
|
|
1201
|
-
{
|
|
1202
|
-
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',
|
|
1203
|
-
fill: 'currentColor',
|
|
1204
|
-
fillRule: 'evenodd',
|
|
1205
|
-
opacity: 1.0,
|
|
1206
|
-
},
|
|
1207
|
-
],
|
|
1208
|
-
},
|
|
1209
|
-
LockSolid: {
|
|
1210
|
-
viewBox: '0 0 24 24',
|
|
1211
|
-
paths: [
|
|
1212
|
-
{
|
|
1213
|
-
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',
|
|
1214
|
-
fill: 'currentColor',
|
|
1215
|
-
fillRule: 'evenodd',
|
|
1216
|
-
opacity: 1.0,
|
|
1217
|
-
},
|
|
1218
|
-
],
|
|
1219
|
-
},
|
|
1220
|
-
GoogleIllus: {
|
|
1221
|
-
viewBox: '0 0 24 24',
|
|
1222
|
-
paths: [
|
|
1223
|
-
{
|
|
1224
|
-
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',
|
|
1225
|
-
fill: '#4285F4',
|
|
1226
|
-
fillRule: 'nonzero',
|
|
1227
|
-
opacity: 1.0,
|
|
1228
|
-
},
|
|
1229
|
-
{
|
|
1230
|
-
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',
|
|
1231
|
-
fill: '#34A853',
|
|
1232
|
-
fillRule: 'nonzero',
|
|
1233
|
-
opacity: 1.0,
|
|
1234
|
-
},
|
|
1235
|
-
{
|
|
1236
|
-
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',
|
|
1237
|
-
fill: '#FBBC05',
|
|
1238
|
-
fillRule: 'nonzero',
|
|
1239
|
-
opacity: 1.0,
|
|
1240
|
-
},
|
|
1241
|
-
{
|
|
1242
|
-
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',
|
|
1243
|
-
fill: '#EA4335',
|
|
1244
|
-
fillRule: 'nonzero',
|
|
1245
|
-
opacity: 1.0,
|
|
1246
|
-
},
|
|
1247
|
-
],
|
|
1248
|
-
},
|
|
1249
|
-
AppleBrand: {
|
|
1250
|
-
viewBox: '0 0 16 20',
|
|
1251
|
-
paths: [
|
|
1252
|
-
{
|
|
1253
|
-
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',
|
|
1254
|
-
fill: 'currentColor',
|
|
1255
|
-
fillRule: 'nonzero',
|
|
1256
|
-
opacity: 1.0,
|
|
1257
|
-
},
|
|
1258
|
-
],
|
|
1259
|
-
},
|
|
1260
|
-
BotIllus: {
|
|
1261
|
-
viewBox: '0 0 24 24',
|
|
1262
|
-
paths: [
|
|
1263
|
-
{
|
|
1264
|
-
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',
|
|
1265
|
-
fill: '#8897A5',
|
|
1266
|
-
fillRule: 'nonzero',
|
|
1267
|
-
opacity: 1.0,
|
|
1268
|
-
},
|
|
1269
|
-
{
|
|
1270
|
-
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',
|
|
1271
|
-
fill: '#3FA9F5',
|
|
1272
|
-
fillRule: 'nonzero',
|
|
1273
|
-
opacity: 1.0,
|
|
1274
|
-
},
|
|
1275
|
-
{
|
|
1276
|
-
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',
|
|
1277
|
-
fill: '#8897A5',
|
|
1278
|
-
fillRule: 'nonzero',
|
|
1279
|
-
opacity: 1.0,
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
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',
|
|
1283
|
-
fill: '#8897A5',
|
|
1284
|
-
fillRule: 'nonzero',
|
|
1285
|
-
opacity: 1.0,
|
|
1286
|
-
},
|
|
1287
|
-
{
|
|
1288
|
-
d: 'M7.5 12.0a1.5 1.5 0 1 0 3.0 0a1.5 1.5 0 1 0 -3.0 0',
|
|
1289
|
-
fill: '#10243E',
|
|
1290
|
-
fillRule: 'nonzero',
|
|
1291
|
-
opacity: 1.0,
|
|
1292
|
-
},
|
|
1293
|
-
{
|
|
1294
|
-
d: 'M13.5 12.0a1.5 1.5 0 1 0 3.0 0a1.5 1.5 0 1 0 -3.0 0',
|
|
1295
|
-
fill: '#10243E',
|
|
1296
|
-
fillRule: 'nonzero',
|
|
1297
|
-
opacity: 1.0,
|
|
1298
|
-
},
|
|
1299
|
-
{
|
|
1300
|
-
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',
|
|
1301
|
-
fill: '#10243E',
|
|
1302
|
-
fillRule: 'nonzero',
|
|
1303
|
-
opacity: 1.0,
|
|
1304
|
-
},
|
|
1305
|
-
],
|
|
1306
|
-
},
|
|
1307
|
-
AllNetworksSolid: {
|
|
1308
|
-
viewBox: '0 0 24 24',
|
|
1309
|
-
paths: [
|
|
1310
|
-
{
|
|
1311
|
-
d: 'M15.333 13.998a1.335 1.335 0 1 1 0 2.67 1.335 1.335 0 0 1 0-2.67',
|
|
1312
|
-
fill: 'currentColor',
|
|
1313
|
-
fillRule: 'nonzero',
|
|
1314
|
-
opacity: 1.0,
|
|
1315
|
-
},
|
|
1316
|
-
{
|
|
1317
|
-
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',
|
|
1318
|
-
fill: 'currentColor',
|
|
1319
|
-
fillRule: 'evenodd',
|
|
1320
|
-
opacity: 1.0,
|
|
1321
|
-
},
|
|
1322
|
-
],
|
|
1323
|
-
},
|
|
1324
|
-
CrossedSmallSolid: {
|
|
1325
|
-
viewBox: '0 0 24 24',
|
|
1326
|
-
paths: [
|
|
1327
|
-
{
|
|
1328
|
-
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',
|
|
1329
|
-
fill: 'currentColor',
|
|
1330
|
-
fillRule: 'nonzero',
|
|
1331
|
-
opacity: 1.0,
|
|
1332
|
-
},
|
|
1333
|
-
],
|
|
1334
|
-
},
|
|
1335
|
-
AccountErrorCustom: {
|
|
1336
|
-
viewBox: '0 0 18 18',
|
|
1337
|
-
paths: [
|
|
1338
|
-
{
|
|
1339
|
-
d: 'M12.5 12.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5',
|
|
1340
|
-
fill: '#000',
|
|
1341
|
-
fillRule: 'nonzero',
|
|
1342
|
-
opacity: 0.447,
|
|
1343
|
-
},
|
|
1344
|
-
{
|
|
1345
|
-
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',
|
|
1346
|
-
fill: '#000',
|
|
1347
|
-
fillRule: 'evenodd',
|
|
1348
|
-
opacity: 0.447,
|
|
1349
|
-
},
|
|
1350
|
-
],
|
|
1351
|
-
},
|
|
1352
|
-
PlusSmallOutline: {
|
|
1353
|
-
viewBox: '0 0 24 24',
|
|
1354
|
-
paths: [
|
|
1355
|
-
{
|
|
1356
|
-
d: 'M13 11h5v2h-5v5h-2v-5H6v-2h5V6h2z',
|
|
1357
|
-
fill: 'currentColor',
|
|
1358
|
-
fillRule: 'nonzero',
|
|
1359
|
-
opacity: 1.0,
|
|
1360
|
-
},
|
|
1361
|
-
],
|
|
1362
|
-
},
|
|
1363
|
-
DotHorOutline: {
|
|
1364
|
-
viewBox: '0 0 24 24',
|
|
1365
|
-
paths: [
|
|
1366
|
-
{
|
|
1367
|
-
d: 'M6 14H2v-4h4zm8 0h-4v-4h4zm8 0h-4v-4h4z',
|
|
1368
|
-
fill: 'currentColor',
|
|
1369
|
-
fillRule: 'nonzero',
|
|
1370
|
-
opacity: 1.0,
|
|
1371
|
-
},
|
|
1372
|
-
],
|
|
1373
|
-
},
|
|
1374
|
-
ChevronRightSmallOutline: {
|
|
1375
|
-
viewBox: '0 0 24 24',
|
|
1376
|
-
paths: [
|
|
1377
|
-
{
|
|
1378
|
-
d: 'M15.414 12 10 17.414 8.586 16l4-4-4-4L10 6.586z',
|
|
1379
|
-
fill: 'currentColor',
|
|
1380
|
-
fillRule: 'nonzero',
|
|
1381
|
-
opacity: 1.0,
|
|
1382
|
-
},
|
|
1383
|
-
],
|
|
1384
|
-
},
|
|
1385
|
-
DragOutline: {
|
|
1386
|
-
viewBox: '0 0 24 24',
|
|
1387
|
-
paths: [
|
|
1388
|
-
{
|
|
1389
|
-
d: 'M11 21H7v-4h4zm6 0h-4v-4h4zm-6-7H7v-4h4zm6 0h-4v-4h4zm-6-7H7V3h4zm6 0h-4V3h4z',
|
|
1390
|
-
fill: 'currentColor',
|
|
1391
|
-
fillRule: 'nonzero',
|
|
1392
|
-
opacity: 1.0,
|
|
1393
|
-
},
|
|
1394
|
-
],
|
|
1395
|
-
},
|
|
1396
|
-
PencilOutline: {
|
|
1397
|
-
viewBox: '0 0 24 24',
|
|
1398
|
-
paths: [
|
|
1399
|
-
{
|
|
1400
|
-
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',
|
|
1401
|
-
fill: 'currentColor',
|
|
1402
|
-
fillRule: 'evenodd',
|
|
1403
|
-
opacity: 1.0,
|
|
1404
|
-
},
|
|
1405
|
-
],
|
|
1406
|
-
},
|
|
1407
|
-
CheckboxCheckedCustom: {
|
|
1408
|
-
viewBox: '0 0 16 16',
|
|
1409
|
-
paths: [
|
|
1410
|
-
{
|
|
1411
|
-
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',
|
|
1412
|
-
fill: 'currentColor',
|
|
1413
|
-
fillRule: 'evenodd',
|
|
1414
|
-
opacity: 1.0,
|
|
1415
|
-
},
|
|
1416
|
-
],
|
|
1417
|
-
},
|
|
1418
|
-
CheckboxIndeterminateCustom: {
|
|
1419
|
-
viewBox: '0 0 16 16',
|
|
1420
|
-
paths: [
|
|
1421
|
-
{
|
|
1422
|
-
d: 'M4 8a1 1 0 0 1 1-1h6a1 1 0 0 1 0 2H5a1 1 0 0 1-1-1',
|
|
1423
|
-
fill: 'currentColor',
|
|
1424
|
-
fillRule: 'evenodd',
|
|
1425
|
-
opacity: 1.0,
|
|
1426
|
-
},
|
|
1427
|
-
],
|
|
1428
|
-
},
|
|
1429
|
-
Circle: {
|
|
1430
|
-
viewBox: '0 0 24 24',
|
|
1431
|
-
paths: [
|
|
1432
|
-
{
|
|
1433
|
-
d: 'M0 12a12 12 0 1 0 24 0a12 12 0 1 0 -24 0',
|
|
1434
|
-
fill: 'currentColor',
|
|
1435
|
-
fillRule: 'nonzero',
|
|
1436
|
-
opacity: 1,
|
|
1437
|
-
},
|
|
1438
|
-
],
|
|
1439
|
-
},
|
|
1440
|
-
BadgeVerifiedSolid: {
|
|
1441
|
-
viewBox: '0 0 24 24',
|
|
1442
|
-
paths: [
|
|
1443
|
-
{
|
|
1444
|
-
d: WEB_MARKET_VERIFIED_PATH,
|
|
1445
|
-
fill: 'currentColor',
|
|
1446
|
-
fillRule: 'evenodd',
|
|
1447
|
-
opacity: 1,
|
|
1448
|
-
},
|
|
1449
|
-
],
|
|
1450
|
-
},
|
|
1451
|
-
};
|
|
1452
1180
|
function applySelectorIcon(element: HTMLElement, name: string) {
|
|
1453
|
-
const
|
|
1454
|
-
if (!
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
'http://www.w3.org/2000/svg',
|
|
1458
|
-
'svg'
|
|
1459
|
-
);
|
|
1460
|
-
svg.setAttribute('viewBox', icon.viewBox);
|
|
1461
|
-
svg.setAttribute('width', '24');
|
|
1462
|
-
svg.setAttribute('height', '24');
|
|
1463
|
-
svg.setAttribute('aria-hidden', 'true');
|
|
1464
|
-
icon.paths.forEach((path) => {
|
|
1465
|
-
const child = element.ownerDocument.createElementNS(
|
|
1181
|
+
const canonical = selectorIcons[name];
|
|
1182
|
+
if (!canonical) return;
|
|
1183
|
+
if (canonical === 'Circle') {
|
|
1184
|
+
const svg = element.ownerDocument.createElementNS(
|
|
1466
1185
|
'http://www.w3.org/2000/svg',
|
|
1467
|
-
'
|
|
1186
|
+
'svg'
|
|
1468
1187
|
);
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1188
|
+
svg.setAttribute('viewBox', '0 0 24 24');
|
|
1189
|
+
svg.setAttribute('width', '24');
|
|
1190
|
+
svg.setAttribute('height', '24');
|
|
1191
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
1192
|
+
const circle = element.ownerDocument.createElementNS(
|
|
1193
|
+
'http://www.w3.org/2000/svg',
|
|
1194
|
+
'circle'
|
|
1195
|
+
);
|
|
1196
|
+
circle.setAttribute('cx', '12');
|
|
1197
|
+
circle.setAttribute('cy', '12');
|
|
1198
|
+
circle.setAttribute('r', '12');
|
|
1199
|
+
circle.setAttribute('fill', 'currentColor');
|
|
1200
|
+
svg.append(circle);
|
|
1201
|
+
element.replaceChildren(svg);
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
element.replaceChildren(createNamedIcon(element.ownerDocument, canonical));
|
|
1476
1205
|
}
|
|
1477
1206
|
|
|
1478
1207
|
function iconGlyph(name: string): string {
|
|
@@ -1554,6 +1283,10 @@ function createVisual(
|
|
|
1554
1283
|
: visualBackground;
|
|
1555
1284
|
const fallbackIcon =
|
|
1556
1285
|
'fallbackIcon' in visual ? visual.fallbackIcon : undefined;
|
|
1286
|
+
const fallbackBackground =
|
|
1287
|
+
fallbackIcon?.backgroundColor ?? 'var(--nl-strong)';
|
|
1288
|
+
if (!source && fallbackIcon?.backgroundColor)
|
|
1289
|
+
frame.style.background = fallbackBackground;
|
|
1557
1290
|
const handlesSourceFallback =
|
|
1558
1291
|
showsSourcePlaceholder &&
|
|
1559
1292
|
(fallbackIcon !== undefined || 'fallbackText' in visual);
|
|
@@ -1569,6 +1302,28 @@ function createVisual(
|
|
|
1569
1302
|
if (image.complete && image.naturalWidth > 0) restoreBackground();
|
|
1570
1303
|
}
|
|
1571
1304
|
if (selectorPresentation) paintSelectorImageBackground(image, frame);
|
|
1305
|
+
if (
|
|
1306
|
+
source?.loadingStrategy === 'skeleton' &&
|
|
1307
|
+
!(image.complete && image.naturalWidth > 0)
|
|
1308
|
+
) {
|
|
1309
|
+
const skeleton = createElement(
|
|
1310
|
+
context.document,
|
|
1311
|
+
'span',
|
|
1312
|
+
'ok-native-list-image-skeleton'
|
|
1313
|
+
);
|
|
1314
|
+
const background = resolvedTheme(context.snapshot).background;
|
|
1315
|
+
const rgb = /^#([0-9a-f]{6})/i.exec(background)?.[1];
|
|
1316
|
+
if (rgb) {
|
|
1317
|
+
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
1318
|
+
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
1319
|
+
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
1320
|
+
if (red * 299 + green * 587 + blue * 114 < 128_000)
|
|
1321
|
+
skeleton.dataset.dark = 'true';
|
|
1322
|
+
}
|
|
1323
|
+
frame.appendChild(skeleton);
|
|
1324
|
+
image.addEventListener('load', () => skeleton.remove(), { once: true });
|
|
1325
|
+
image.addEventListener('error', () => skeleton.remove(), { once: true });
|
|
1326
|
+
}
|
|
1572
1327
|
} else if (!source || showsSourcePlaceholder) {
|
|
1573
1328
|
frame.appendChild(
|
|
1574
1329
|
createElement(
|
|
@@ -1623,13 +1378,29 @@ function createVisual(
|
|
|
1623
1378
|
? visual.fallbackText ?? ''
|
|
1624
1379
|
: ''
|
|
1625
1380
|
);
|
|
1381
|
+
if (
|
|
1382
|
+
'fallbackTextColor' in visual &&
|
|
1383
|
+
visual.fallbackTextColor &&
|
|
1384
|
+
!fallbackIcon
|
|
1385
|
+
)
|
|
1386
|
+
fallback.style.color = visual.fallbackTextColor;
|
|
1626
1387
|
if (fallbackIcon) {
|
|
1627
1388
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1628
1389
|
if (fallbackIcon.tintColor)
|
|
1629
1390
|
fallback.style.color = fallbackIcon.tintColor;
|
|
1391
|
+
if (fallbackIcon.size) {
|
|
1392
|
+
const svg = fallback.querySelector<SVGElement>('svg');
|
|
1393
|
+
if (svg) {
|
|
1394
|
+
svg.style.width = `${fallbackIcon.size}px`;
|
|
1395
|
+
svg.style.height = `${fallbackIcon.size}px`;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1630
1398
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1399
|
+
if (fallbackIcon?.backgroundColor)
|
|
1400
|
+
frame.style.background = fallbackBackground;
|
|
1401
|
+
else
|
|
1402
|
+
fallback.style.backgroundColor =
|
|
1403
|
+
'var(--nl-image-fallback-background, transparent)';
|
|
1633
1404
|
frame.prepend(fallback);
|
|
1634
1405
|
};
|
|
1635
1406
|
if (image) image.addEventListener('error', showFallback, { once: true });
|
|
@@ -1639,6 +1410,9 @@ function createVisual(
|
|
|
1639
1410
|
frame.style.border =
|
|
1640
1411
|
'2px dashed ' + (visual.borderColor ?? 'var(--nl-disabled)');
|
|
1641
1412
|
frame.style.boxSizing = 'border-box';
|
|
1413
|
+
} else if ('borderColor' in visual && visual.borderColor) {
|
|
1414
|
+
frame.style.border = '1px solid ' + visual.borderColor;
|
|
1415
|
+
frame.style.boxSizing = 'border-box';
|
|
1642
1416
|
}
|
|
1643
1417
|
if ('overlays' in visual)
|
|
1644
1418
|
visual.overlays?.forEach((overlay) => {
|
|
@@ -1668,6 +1442,16 @@ function createVisual(
|
|
|
1668
1442
|
corner.style.lineHeight = '16px';
|
|
1669
1443
|
applyTextWeight(corner, '400');
|
|
1670
1444
|
}
|
|
1445
|
+
if (overlay.fontWeight)
|
|
1446
|
+
applyTextWeight(
|
|
1447
|
+
corner,
|
|
1448
|
+
{
|
|
1449
|
+
regular: 400,
|
|
1450
|
+
medium: 500,
|
|
1451
|
+
semibold: 600,
|
|
1452
|
+
bold: 700,
|
|
1453
|
+
}[overlay.fontWeight]
|
|
1454
|
+
);
|
|
1671
1455
|
if (
|
|
1672
1456
|
isWalletText ||
|
|
1673
1457
|
overlay.width !== undefined ||
|
|
@@ -1688,7 +1472,31 @@ function createVisual(
|
|
|
1688
1472
|
if (overlay.image) {
|
|
1689
1473
|
const overlayImage = createImage(context, overlay.image);
|
|
1690
1474
|
if (overlayImage) {
|
|
1475
|
+
if (
|
|
1476
|
+
(overlay.padding ?? 0) > 0 &&
|
|
1477
|
+
(overlay.width ?? size) === (overlay.height ?? size)
|
|
1478
|
+
)
|
|
1479
|
+
overlayImage.style.borderRadius = '50%';
|
|
1691
1480
|
corner.appendChild(overlayImage);
|
|
1481
|
+
if (overlay.fallbackIcon) {
|
|
1482
|
+
overlayImage.addEventListener(
|
|
1483
|
+
'error',
|
|
1484
|
+
() => {
|
|
1485
|
+
disposeWebImageRetries(overlayImage);
|
|
1486
|
+
overlayImage.remove();
|
|
1487
|
+
const glyph = createElement(
|
|
1488
|
+
context.document,
|
|
1489
|
+
'span',
|
|
1490
|
+
'ok-native-list-overlay-fallback'
|
|
1491
|
+
);
|
|
1492
|
+
applySelectorIcon(glyph, overlay.fallbackIcon!.name);
|
|
1493
|
+
if (overlay.fallbackIcon?.tintColor)
|
|
1494
|
+
glyph.style.color = overlay.fallbackIcon.tintColor;
|
|
1495
|
+
corner.appendChild(glyph);
|
|
1496
|
+
},
|
|
1497
|
+
{ once: true }
|
|
1498
|
+
);
|
|
1499
|
+
}
|
|
1692
1500
|
if (selectorPresentation)
|
|
1693
1501
|
paintSelectorImageBackground(
|
|
1694
1502
|
overlayImage,
|
|
@@ -1831,6 +1639,7 @@ function createIconAction(
|
|
|
1831
1639
|
if (element.tagName === 'BUTTON') {
|
|
1832
1640
|
element.setAttribute('type', 'button');
|
|
1833
1641
|
element.toggleAttribute('disabled', Boolean(disabled));
|
|
1642
|
+
if (name === 'DotVerSolid') element.setAttribute('aria-label', '⋮');
|
|
1834
1643
|
}
|
|
1835
1644
|
applySelectorIcon(element, name);
|
|
1836
1645
|
if (actionKey) setData(element, 'nativeListAction', actionKey);
|
|
@@ -1853,8 +1662,44 @@ function createAccessory(
|
|
|
1853
1662
|
context: RenderContext,
|
|
1854
1663
|
rowKey: string,
|
|
1855
1664
|
accessory: TrailingAccessory,
|
|
1856
|
-
slot: number
|
|
1665
|
+
slot: number,
|
|
1666
|
+
rowDisabled: boolean
|
|
1857
1667
|
): HTMLElement {
|
|
1668
|
+
if (accessory.kind === 'button') {
|
|
1669
|
+
const element = createElement(
|
|
1670
|
+
context.document,
|
|
1671
|
+
'button',
|
|
1672
|
+
'ok-native-list-trailing-button',
|
|
1673
|
+
accessory.label
|
|
1674
|
+
) as HTMLButtonElement;
|
|
1675
|
+
element.type = 'button';
|
|
1676
|
+
element.disabled = Boolean(rowDisabled || accessory.disabled);
|
|
1677
|
+
element.setAttribute('aria-disabled', String(element.disabled));
|
|
1678
|
+
element.setAttribute(
|
|
1679
|
+
'aria-label',
|
|
1680
|
+
accessory.accessibilityLabel ?? accessory.label
|
|
1681
|
+
);
|
|
1682
|
+
setData(element, 'testid', accessory.testID);
|
|
1683
|
+
setData(element, 'nativeListAction', accessory.actionKey);
|
|
1684
|
+
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1685
|
+
if (accessory.textColor)
|
|
1686
|
+
element.style.setProperty('--nl-button-text', accessory.textColor);
|
|
1687
|
+
if (accessory.backgroundColor)
|
|
1688
|
+
element.style.setProperty('--nl-button-bg', accessory.backgroundColor);
|
|
1689
|
+
if (accessory.pressedBackgroundColor)
|
|
1690
|
+
element.style.setProperty(
|
|
1691
|
+
'--nl-button-pressed',
|
|
1692
|
+
accessory.pressedBackgroundColor
|
|
1693
|
+
);
|
|
1694
|
+
if (accessory.hoverBackgroundColor)
|
|
1695
|
+
element.style.setProperty(
|
|
1696
|
+
'--nl-button-hover',
|
|
1697
|
+
accessory.hoverBackgroundColor
|
|
1698
|
+
);
|
|
1699
|
+
if (accessory.focusRingColor)
|
|
1700
|
+
element.style.setProperty('--nl-button-focus', accessory.focusRingColor);
|
|
1701
|
+
return element;
|
|
1702
|
+
}
|
|
1858
1703
|
if (accessory.kind === 'checkbox') {
|
|
1859
1704
|
const element = createCheckbox(context, rowKey, accessory);
|
|
1860
1705
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
@@ -1869,9 +1714,21 @@ function createAccessory(
|
|
|
1869
1714
|
accessory.tintColor
|
|
1870
1715
|
);
|
|
1871
1716
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1717
|
+
if (accessory.name === 'RefreshCcwOutline' && !accessory.actionKey) {
|
|
1718
|
+
element.classList.add('ok-native-list-decorative-refresh');
|
|
1719
|
+
const glyph = element.querySelector('svg');
|
|
1720
|
+
glyph?.setAttribute('width', '16');
|
|
1721
|
+
glyph?.setAttribute('height', '16');
|
|
1722
|
+
}
|
|
1723
|
+
if (accessory.buttonStyle === 'tertiary') {
|
|
1724
|
+
element.classList.add('ok-native-list-tertiary-icon');
|
|
1725
|
+
setData(element, 'nativeListAnchorInset', 7);
|
|
1726
|
+
}
|
|
1872
1727
|
setData(element, 'testid', accessory.testID);
|
|
1873
1728
|
if (accessory.hoverActionKey)
|
|
1874
1729
|
setData(element, 'nativeListHoverAction', accessory.hoverActionKey);
|
|
1730
|
+
if (accessory.hoverActionKey && accessory.buttonStyle === 'tertiary')
|
|
1731
|
+
setData(element, 'nativeListIconHelp', true);
|
|
1875
1732
|
if (accessory.accessibilityLabel)
|
|
1876
1733
|
element.setAttribute('aria-label', accessory.accessibilityLabel);
|
|
1877
1734
|
const row = context.snapshot.rows[context.itemIndex];
|
|
@@ -1919,6 +1776,25 @@ function createAccessory(
|
|
|
1919
1776
|
accessory.primary
|
|
1920
1777
|
);
|
|
1921
1778
|
primary.style.color = toneColor(accessory.primaryTone, 'primary');
|
|
1779
|
+
applyValueSegments(primary, accessory.primaryTextSegments, 16, 20, 500);
|
|
1780
|
+
if (accessory.primaryFontWeight === 'medium')
|
|
1781
|
+
applyTextWeight(primary, 500);
|
|
1782
|
+
if (accessory.primaryHelp) {
|
|
1783
|
+
const help = accessory.primaryHelp;
|
|
1784
|
+
primary.tabIndex = 0;
|
|
1785
|
+
primary.setAttribute('role', 'button');
|
|
1786
|
+
if (help.presentation === 'tooltip') {
|
|
1787
|
+
setData(primary, 'nativeListHoverAction', help.actionKey);
|
|
1788
|
+
setData(primary, 'nativeListIconHelp', true);
|
|
1789
|
+
} else {
|
|
1790
|
+
setData(primary, 'nativeListAction', help.actionKey);
|
|
1791
|
+
}
|
|
1792
|
+
if (help.underline === 'dashed') {
|
|
1793
|
+
primary.style.textDecoration = 'underline dashed';
|
|
1794
|
+
primary.style.textUnderlineOffset = '4px';
|
|
1795
|
+
}
|
|
1796
|
+
markActionAnchorSource(primary, 'trailingAccessory', slot);
|
|
1797
|
+
}
|
|
1922
1798
|
const secondary = createElement(
|
|
1923
1799
|
context.document,
|
|
1924
1800
|
'span',
|
|
@@ -1926,6 +1802,13 @@ function createAccessory(
|
|
|
1926
1802
|
accessory.secondary
|
|
1927
1803
|
);
|
|
1928
1804
|
secondary.style.color = toneColor(accessory.secondaryTone, 'secondary');
|
|
1805
|
+
applyValueSegments(
|
|
1806
|
+
secondary,
|
|
1807
|
+
accessory.secondaryTextSegments,
|
|
1808
|
+
14,
|
|
1809
|
+
20,
|
|
1810
|
+
400
|
|
1811
|
+
);
|
|
1929
1812
|
element.replaceChildren(primary, '\n', secondary);
|
|
1930
1813
|
element.classList.add('ok-native-list-amounts');
|
|
1931
1814
|
break;
|
|
@@ -1954,11 +1837,11 @@ function createAccessory(
|
|
|
1954
1837
|
return element;
|
|
1955
1838
|
}
|
|
1956
1839
|
|
|
1957
|
-
function rendererPrimitives(context: RenderContext) {
|
|
1840
|
+
function rendererPrimitives(context: RenderContext, rowDisabled: boolean) {
|
|
1958
1841
|
return {
|
|
1959
1842
|
background: resolvedTheme(context.snapshot).background,
|
|
1960
1843
|
accessory: (key: string, descriptor: TrailingAccessory, slot: number) =>
|
|
1961
|
-
createAccessory(context, key, descriptor, slot),
|
|
1844
|
+
createAccessory(context, key, descriptor, slot, rowDisabled),
|
|
1962
1845
|
visual: (source: LeadingVisual | undefined, presentation?: string) =>
|
|
1963
1846
|
createVisual(context, source, presentation),
|
|
1964
1847
|
thumbnail: (source: ImageSource) =>
|
|
@@ -1979,7 +1862,10 @@ export function createRowBody(
|
|
|
1979
1862
|
context: RenderContext,
|
|
1980
1863
|
row: RowModel
|
|
1981
1864
|
): HTMLElement {
|
|
1982
|
-
return rowRenderer(row).create(
|
|
1865
|
+
return rowRenderer(row).create(
|
|
1866
|
+
context.document,
|
|
1867
|
+
rendererPrimitives(context, Boolean(row.disabled))
|
|
1868
|
+
);
|
|
1983
1869
|
}
|
|
1984
1870
|
|
|
1985
1871
|
export type NativeListWebScrollOptions = Readonly<{
|
|
@@ -2028,6 +1914,7 @@ export class NativeListWebEngine {
|
|
|
2028
1914
|
rail: [],
|
|
2029
1915
|
mediaTile: [],
|
|
2030
1916
|
action: [],
|
|
1917
|
+
buttonGroup: [],
|
|
2031
1918
|
system: [],
|
|
2032
1919
|
activity: [],
|
|
2033
1920
|
dataRow: [],
|
|
@@ -2071,6 +1958,7 @@ export class NativeListWebEngine {
|
|
|
2071
1958
|
private pullDistance = 0;
|
|
2072
1959
|
private virtualizationEnabled: boolean;
|
|
2073
1960
|
private actionAnchor: WebActionAnchorRecord | undefined;
|
|
1961
|
+
private pressedHelpElement: HTMLElement | undefined;
|
|
2074
1962
|
private readonly actionAnchorInstanceId = String(
|
|
2075
1963
|
++webNativeListInstanceCounter
|
|
2076
1964
|
);
|
|
@@ -2091,6 +1979,39 @@ export class NativeListWebEngine {
|
|
|
2091
1979
|
private lastViewportWidth = -1;
|
|
2092
1980
|
private lastViewportHeight = -1;
|
|
2093
1981
|
private destroyed = false;
|
|
1982
|
+
private hasAppliedSnapshot = false;
|
|
1983
|
+
private lastStructuralTransitionId: string | undefined;
|
|
1984
|
+
private structuralFrame: number | undefined;
|
|
1985
|
+
private structuralFinish: number | undefined;
|
|
1986
|
+
private structuralRevision = 0;
|
|
1987
|
+
private structuralAnimations: Animation[] = [];
|
|
1988
|
+
private structuralScrollInterrupted = false;
|
|
1989
|
+
private structuralRenderedHeight: number | undefined;
|
|
1990
|
+
private structuralTargetHeight: number | undefined;
|
|
1991
|
+
private reactFooterHeight = 0;
|
|
1992
|
+
private structuralFooterCompensation = 0;
|
|
1993
|
+
private structuralFooterExpansion = 0;
|
|
1994
|
+
private structuralFooterFromHeight = 0;
|
|
1995
|
+
private structuralFooterElement: HTMLElement | undefined;
|
|
1996
|
+
private structuralFooterStyles:
|
|
1997
|
+
| { marginBottom: string; transform: string; clipPath: string }
|
|
1998
|
+
| undefined;
|
|
1999
|
+
private structuralProgress = 0;
|
|
2000
|
+
private structuralAnchorStyles:
|
|
2001
|
+
| { owner: string; content: string }
|
|
2002
|
+
| undefined;
|
|
2003
|
+
private structuralContentOverflow: string | undefined;
|
|
2004
|
+
private structuralPrefixTransition = false;
|
|
2005
|
+
private structuralTail:
|
|
2006
|
+
| {
|
|
2007
|
+
snapshot: NativeListSnapshot;
|
|
2008
|
+
rows: readonly RowModel[];
|
|
2009
|
+
layout: WebListLayout;
|
|
2010
|
+
firstIndex: number;
|
|
2011
|
+
layer: HTMLElement;
|
|
2012
|
+
mounted: Map<number, HTMLElement>;
|
|
2013
|
+
}
|
|
2014
|
+
| undefined;
|
|
2094
2015
|
private sectionIndexAlignStart = false;
|
|
2095
2016
|
// Renderers report intrinsic height after browser text wrapping.
|
|
2096
2017
|
private measuredRendererHeights = new Map<
|
|
@@ -2157,7 +2078,9 @@ export class NativeListWebEngine {
|
|
|
2157
2078
|
scrollOptions.stickyInset
|
|
2158
2079
|
);
|
|
2159
2080
|
this.document = host.ownerDocument;
|
|
2160
|
-
this.snapshot =
|
|
2081
|
+
this.snapshot =
|
|
2082
|
+
containNativeListInput(() => validateSnapshot(snapshot)) ??
|
|
2083
|
+
emptyNativeListSnapshot();
|
|
2161
2084
|
this.callbacks = callbacks;
|
|
2162
2085
|
this.virtualizationEnabled = virtualizationEnabled;
|
|
2163
2086
|
this.sectionIndexContainer = sectionIndexContainer ?? undefined;
|
|
@@ -2260,6 +2183,12 @@ export class NativeListWebEngine {
|
|
|
2260
2183
|
'ok-collapsible-pager-cancel-scroll-command',
|
|
2261
2184
|
this.handlePagerScrollCommandCancel
|
|
2262
2185
|
);
|
|
2186
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart'])
|
|
2187
|
+
(this.externalScrollHost ?? this.viewport).addEventListener(
|
|
2188
|
+
event,
|
|
2189
|
+
this.handleStructuralUserScroll,
|
|
2190
|
+
{ passive: true }
|
|
2191
|
+
);
|
|
2263
2192
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
2264
2193
|
passive: true,
|
|
2265
2194
|
});
|
|
@@ -2278,6 +2207,7 @@ export class NativeListWebEngine {
|
|
|
2278
2207
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
2279
2208
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
2280
2209
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
2210
|
+
this.root.addEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
2281
2211
|
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
2282
2212
|
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
2283
2213
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -2354,7 +2284,7 @@ export class NativeListWebEngine {
|
|
|
2354
2284
|
);
|
|
2355
2285
|
this.observeSectionIndexTransforms();
|
|
2356
2286
|
this.applyFontFamilies(fontFamiliesJson);
|
|
2357
|
-
this.
|
|
2287
|
+
this.applyValidatedSnapshot(this.snapshot);
|
|
2358
2288
|
}
|
|
2359
2289
|
|
|
2360
2290
|
private validateStickyInset(value = 0): number {
|
|
@@ -2439,14 +2369,442 @@ export class NativeListWebEngine {
|
|
|
2439
2369
|
}
|
|
2440
2370
|
|
|
2441
2371
|
applySnapshot(snapshot: NativeListSnapshot) {
|
|
2442
|
-
const validated =
|
|
2372
|
+
const validated = containNativeListInput(() => {
|
|
2373
|
+
const next = validateSnapshot(snapshot);
|
|
2374
|
+
if (this.externalScrollHost && next.layout.orientation === 'horizontal')
|
|
2375
|
+
throw new Error('External scrolling supports vertical lists only');
|
|
2376
|
+
return next;
|
|
2377
|
+
});
|
|
2378
|
+
if (!validated) return;
|
|
2379
|
+
this.applyValidatedSnapshot(validated);
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
private applyValidatedSnapshot(validated: NativeListSnapshot) {
|
|
2383
|
+
this.pressedHelpElement = undefined;
|
|
2384
|
+
this.invalidateActionAnchor('snapshot');
|
|
2385
|
+
const transition = validated.structuralTransition;
|
|
2386
|
+
const isNewTransition =
|
|
2387
|
+
transition !== undefined &&
|
|
2388
|
+
transition.id !== this.lastStructuralTransitionId;
|
|
2389
|
+
if (transition) this.lastStructuralTransitionId = transition.id;
|
|
2390
|
+
const nextRows = effectiveRows(validated);
|
|
2391
|
+
const changedKeys =
|
|
2392
|
+
this.rows.length !== nextRows.length ||
|
|
2393
|
+
this.rows.some((row, index) => row.key !== nextRows[index]?.key);
|
|
2394
|
+
const incompatibleActivePrefix =
|
|
2395
|
+
this.structuralPrefixTransition &&
|
|
2396
|
+
(validated.layout.kind !== this.snapshot.layout.kind ||
|
|
2397
|
+
validated.layout.orientation !== this.snapshot.layout.orientation ||
|
|
2398
|
+
nextRows.some(
|
|
2399
|
+
(row, index) =>
|
|
2400
|
+
row.height !== this.rows[index]?.height ||
|
|
2401
|
+
row.style?.container?.height !==
|
|
2402
|
+
this.rows[index]?.style?.container?.height
|
|
2403
|
+
));
|
|
2404
|
+
const shouldAnimate =
|
|
2405
|
+
this.hasAppliedSnapshot &&
|
|
2406
|
+
isNewTransition &&
|
|
2407
|
+
changedKeys &&
|
|
2408
|
+
(this.snapshot.layout.kind === 'linear' ||
|
|
2409
|
+
this.snapshot.layout.kind === 'table') &&
|
|
2410
|
+
this.snapshot.layout.orientation !== 'horizontal' &&
|
|
2411
|
+
(validated.layout.kind === 'linear' ||
|
|
2412
|
+
validated.layout.kind === 'table') &&
|
|
2413
|
+
validated.layout.orientation !== 'horizontal' &&
|
|
2414
|
+
(transition?.durationMs ?? 220) > 0 &&
|
|
2415
|
+
!this.document.defaultView?.matchMedia?.(
|
|
2416
|
+
'(prefers-reduced-motion: reduce)'
|
|
2417
|
+
).matches;
|
|
2418
|
+
if (shouldAnimate && transition)
|
|
2419
|
+
this.applyStructuralSnapshot(validated, transition);
|
|
2420
|
+
else {
|
|
2421
|
+
if (isNewTransition || changedKeys || incompatibleActivePrefix)
|
|
2422
|
+
this.cancelStructuralAnimation();
|
|
2423
|
+
this.setSnapshot(validated);
|
|
2424
|
+
}
|
|
2425
|
+
this.hasAppliedSnapshot = true;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
private cancelStructuralAnimation() {
|
|
2429
|
+
this.structuralRevision += 1;
|
|
2430
|
+
if (this.structuralFrame !== undefined)
|
|
2431
|
+
this.document.defaultView?.cancelAnimationFrame(this.structuralFrame);
|
|
2432
|
+
if (this.structuralFinish !== undefined)
|
|
2433
|
+
this.document.defaultView?.clearTimeout(this.structuralFinish);
|
|
2434
|
+
this.structuralFrame = undefined;
|
|
2435
|
+
this.structuralFinish = undefined;
|
|
2436
|
+
this.structuralAnimations.forEach((animation) => animation.cancel());
|
|
2437
|
+
this.structuralAnimations = [];
|
|
2438
|
+
if (this.structuralTail) {
|
|
2439
|
+
disposeWebImageRetries(this.structuralTail.layer);
|
|
2440
|
+
this.structuralTail.layer.remove();
|
|
2441
|
+
this.structuralTail = undefined;
|
|
2442
|
+
}
|
|
2443
|
+
if (this.structuralContentOverflow !== undefined) {
|
|
2444
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
2445
|
+
this.structuralContentOverflow = undefined;
|
|
2446
|
+
}
|
|
2447
|
+
this.structuralPrefixTransition = false;
|
|
2448
|
+
if (this.structuralFooterElement && this.structuralFooterStyles) {
|
|
2449
|
+
this.structuralFooterElement.style.marginBottom =
|
|
2450
|
+
this.structuralFooterStyles.marginBottom;
|
|
2451
|
+
this.structuralFooterElement.style.transform =
|
|
2452
|
+
this.structuralFooterStyles.transform;
|
|
2453
|
+
this.structuralFooterElement.style.clipPath =
|
|
2454
|
+
this.structuralFooterStyles.clipPath;
|
|
2455
|
+
}
|
|
2456
|
+
this.structuralFooterElement = undefined;
|
|
2457
|
+
this.structuralFooterStyles = undefined;
|
|
2458
|
+
this.structuralScrollInterrupted = false;
|
|
2459
|
+
this.structuralRenderedHeight = undefined;
|
|
2460
|
+
this.structuralTargetHeight = undefined;
|
|
2461
|
+
this.structuralFooterCompensation = 0;
|
|
2462
|
+
this.structuralFooterExpansion = 0;
|
|
2463
|
+
this.structuralProgress = 0;
|
|
2464
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2465
|
+
if (this.structuralAnchorStyles) {
|
|
2466
|
+
owner.style.overflowAnchor = this.structuralAnchorStyles.owner;
|
|
2467
|
+
this.content.style.overflowAnchor = this.structuralAnchorStyles.content;
|
|
2468
|
+
this.structuralAnchorStyles = undefined;
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
private handleStructuralUserScroll = (event: Event) => {
|
|
2443
2473
|
if (
|
|
2444
|
-
|
|
2445
|
-
|
|
2474
|
+
event.type === 'pointerdown' &&
|
|
2475
|
+
event.target !== (this.externalScrollHost ?? this.viewport) &&
|
|
2476
|
+
(event as PointerEvent).pointerType !== 'touch'
|
|
2446
2477
|
)
|
|
2447
|
-
|
|
2448
|
-
this.
|
|
2449
|
-
this.
|
|
2478
|
+
return;
|
|
2479
|
+
this.structuralScrollInterrupted = true;
|
|
2480
|
+
if (this.structuralPrefixTransition) {
|
|
2481
|
+
this.cancelStructuralAnimation();
|
|
2482
|
+
this.recomputeLayout();
|
|
2483
|
+
}
|
|
2484
|
+
};
|
|
2485
|
+
|
|
2486
|
+
private updateStructuralTailWindow() {
|
|
2487
|
+
const tail = this.structuralTail;
|
|
2488
|
+
if (!tail) return;
|
|
2489
|
+
const visible = visibleWebLayoutItems(
|
|
2490
|
+
tail.layout,
|
|
2491
|
+
this.currentOffset(),
|
|
2492
|
+
this.viewportLength(),
|
|
2493
|
+
this.viewportLength() * OVERSCAN_VIEWPORTS
|
|
2494
|
+
).filter((item) => item.index >= tail.firstIndex);
|
|
2495
|
+
const desired = new Set(visible.map((item) => item.index));
|
|
2496
|
+
tail.mounted.forEach((element, index) => {
|
|
2497
|
+
if (desired.has(index)) return;
|
|
2498
|
+
disposeWebImageRetries(element);
|
|
2499
|
+
element.remove();
|
|
2500
|
+
tail.mounted.delete(index);
|
|
2501
|
+
});
|
|
2502
|
+
visible.forEach((item) => {
|
|
2503
|
+
if (tail.mounted.has(item.index)) return;
|
|
2504
|
+
const row = tail.rows[item.index];
|
|
2505
|
+
if (!row) return;
|
|
2506
|
+
const element = createElement(
|
|
2507
|
+
this.document,
|
|
2508
|
+
'div',
|
|
2509
|
+
'ok-native-list-item'
|
|
2510
|
+
);
|
|
2511
|
+
element.setAttribute('aria-hidden', 'true');
|
|
2512
|
+
element.style.pointerEvents = 'none';
|
|
2513
|
+
element.style.opacity = String(
|
|
2514
|
+
(row.style?.container?.opacity ?? row.opacity ?? 1) *
|
|
2515
|
+
(row.disabled ? 0.5 : 1)
|
|
2516
|
+
);
|
|
2517
|
+
const body = createRowBody(
|
|
2518
|
+
{
|
|
2519
|
+
document: this.document,
|
|
2520
|
+
snapshot: tail.snapshot,
|
|
2521
|
+
selectedKeys: selectionStateFromSnapshot(tail.snapshot).selectedKeys,
|
|
2522
|
+
itemIndex: item.index,
|
|
2523
|
+
},
|
|
2524
|
+
row
|
|
2525
|
+
);
|
|
2526
|
+
applyRowStyle(body, row);
|
|
2527
|
+
element.append(body);
|
|
2528
|
+
this.positionElement(element, item);
|
|
2529
|
+
tail.layer.append(element);
|
|
2530
|
+
tail.mounted.set(item.index, element);
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
private writeStructuralHeight(height: number) {
|
|
2535
|
+
if (this.externalScrollHost) this.writeExternalHeight(height);
|
|
2536
|
+
else this.content.style.height = `${height}px`;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
private reactFooterElement() {
|
|
2540
|
+
return this.contentBounds?.querySelector<HTMLElement>(
|
|
2541
|
+
'[data-testid="native-list-footer-slot"]'
|
|
2542
|
+
);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
private readReactFooterHeight() {
|
|
2546
|
+
return this.reactFooterElement()?.getBoundingClientRect().height ?? 0;
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
private applyStructuralFooterVisual(progress: number) {
|
|
2550
|
+
const footer = this.structuralFooterElement;
|
|
2551
|
+
if (!footer || this.structuralFooterExpansion <= 0) return;
|
|
2552
|
+
const hidden = this.structuralFooterExpansion * (1 - progress);
|
|
2553
|
+
footer.style.marginBottom = `${-hidden}px`;
|
|
2554
|
+
footer.style.transform = `translateY(${-hidden}px)`;
|
|
2555
|
+
footer.style.clipPath = `inset(${hidden}px 0 0 0)`;
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
private applyStructuralSnapshot(
|
|
2559
|
+
next: NativeListSnapshot,
|
|
2560
|
+
transition: NonNullable<NativeListSnapshot['structuralTransition']>
|
|
2561
|
+
) {
|
|
2562
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2563
|
+
const oldOffset = owner.scrollTop;
|
|
2564
|
+
const oldScrollHeight = owner.scrollHeight;
|
|
2565
|
+
const oldHeight =
|
|
2566
|
+
this.structuralRenderedHeight ??
|
|
2567
|
+
(this.content.getBoundingClientRect().height ||
|
|
2568
|
+
this.layout.contentHeight);
|
|
2569
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
2570
|
+
const oldFooterHeight =
|
|
2571
|
+
this.structuralRenderedHeight === undefined
|
|
2572
|
+
? this.reactFooterHeight
|
|
2573
|
+
: this.structuralFooterFromHeight +
|
|
2574
|
+
(this.reactFooterHeight - this.structuralFooterFromHeight) *
|
|
2575
|
+
this.structuralProgress;
|
|
2576
|
+
const footerDifference = oldFooterHeight - nextFooterHeight;
|
|
2577
|
+
const startHeight = oldHeight + Math.max(0, footerDifference);
|
|
2578
|
+
const oldSnapshot = this.snapshot;
|
|
2579
|
+
const oldRows = this.rows;
|
|
2580
|
+
const oldLayout = this.layout;
|
|
2581
|
+
const oldItems = oldLayout.items;
|
|
2582
|
+
const nextRows = effectiveRows(next);
|
|
2583
|
+
const prefixCount = Math.min(oldRows.length, nextRows.length);
|
|
2584
|
+
const prefixTailChange =
|
|
2585
|
+
oldSnapshot.layout.kind === next.layout.kind &&
|
|
2586
|
+
oldSnapshot.layout.orientation === next.layout.orientation &&
|
|
2587
|
+
oldRows.length !== nextRows.length &&
|
|
2588
|
+
oldRows
|
|
2589
|
+
.slice(0, prefixCount)
|
|
2590
|
+
.every((row, index) => row.key === nextRows[index]?.key);
|
|
2591
|
+
const oldPositions = new Map<string, number>();
|
|
2592
|
+
this.mounted.forEach((element, index) => {
|
|
2593
|
+
const row = this.rows[index];
|
|
2594
|
+
if (row) oldPositions.set(row.key, element.getBoundingClientRect().top);
|
|
2595
|
+
});
|
|
2596
|
+
const nextKeys = new Set(effectiveRows(next).map((row) => row.key));
|
|
2597
|
+
const visibleOffset = this.currentOffset();
|
|
2598
|
+
const visibleSurvivor = oldItems.find(
|
|
2599
|
+
(item) => item.y + item.height > visibleOffset && nextKeys.has(item.key)
|
|
2600
|
+
);
|
|
2601
|
+
const anchor = visibleSurvivor;
|
|
2602
|
+
this.cancelStructuralAnimation();
|
|
2603
|
+
this.structuralScrollInterrupted = false;
|
|
2604
|
+
this.structuralAnchorStyles = {
|
|
2605
|
+
owner: owner.style.overflowAnchor,
|
|
2606
|
+
content: this.content.style.overflowAnchor,
|
|
2607
|
+
};
|
|
2608
|
+
owner.style.overflowAnchor = 'none';
|
|
2609
|
+
this.content.style.overflowAnchor = 'none';
|
|
2610
|
+
this.structuralContentOverflow = this.content.style.overflow;
|
|
2611
|
+
if (prefixTailChange) this.content.style.overflow = 'clip';
|
|
2612
|
+
this.structuralRenderedHeight = startHeight;
|
|
2613
|
+
this.structuralFooterFromHeight = oldFooterHeight;
|
|
2614
|
+
this.structuralFooterCompensation = Math.max(0, footerDifference);
|
|
2615
|
+
this.structuralFooterExpansion = Math.max(0, -footerDifference);
|
|
2616
|
+
this.structuralProgress = 0;
|
|
2617
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
2618
|
+
this.structuralFooterElement = this.reactFooterElement() ?? undefined;
|
|
2619
|
+
if (this.structuralFooterElement) {
|
|
2620
|
+
const style = this.structuralFooterElement.style;
|
|
2621
|
+
this.structuralFooterStyles = {
|
|
2622
|
+
marginBottom: style.marginBottom,
|
|
2623
|
+
transform: style.transform,
|
|
2624
|
+
clipPath: style.clipPath,
|
|
2625
|
+
};
|
|
2626
|
+
this.applyStructuralFooterVisual(0);
|
|
2627
|
+
}
|
|
2628
|
+
this.setSnapshot(next);
|
|
2629
|
+
const newHeight = this.layout.contentHeight;
|
|
2630
|
+
this.structuralTargetHeight = newHeight;
|
|
2631
|
+
const stablePrefixGeometry =
|
|
2632
|
+
prefixTailChange &&
|
|
2633
|
+
oldItems.length === oldRows.length &&
|
|
2634
|
+
this.layout.items.length === nextRows.length &&
|
|
2635
|
+
oldItems.slice(0, prefixCount).every((item, index) => {
|
|
2636
|
+
const nextItem = this.layout.items[index];
|
|
2637
|
+
return (
|
|
2638
|
+
nextItem?.y === item.y &&
|
|
2639
|
+
nextItem?.height === item.height &&
|
|
2640
|
+
nextItem?.width === item.width
|
|
2641
|
+
);
|
|
2642
|
+
});
|
|
2643
|
+
if (!stablePrefixGeometry) {
|
|
2644
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
2645
|
+
this.structuralContentOverflow = undefined;
|
|
2646
|
+
} else {
|
|
2647
|
+
this.structuralPrefixTransition = true;
|
|
2648
|
+
}
|
|
2649
|
+
if (stablePrefixGeometry && nextRows.length < oldRows.length) {
|
|
2650
|
+
const layer = createElement(
|
|
2651
|
+
this.document,
|
|
2652
|
+
'div',
|
|
2653
|
+
'ok-native-list-structural-tail'
|
|
2654
|
+
);
|
|
2655
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
2656
|
+
layer.setAttribute('inert', '');
|
|
2657
|
+
Object.assign(layer.style, {
|
|
2658
|
+
position: 'absolute',
|
|
2659
|
+
inset: '0',
|
|
2660
|
+
pointerEvents: 'none',
|
|
2661
|
+
});
|
|
2662
|
+
this.content.append(layer);
|
|
2663
|
+
this.structuralTail = {
|
|
2664
|
+
snapshot: oldSnapshot,
|
|
2665
|
+
rows: oldRows,
|
|
2666
|
+
layout: oldLayout,
|
|
2667
|
+
firstIndex: prefixCount,
|
|
2668
|
+
layer,
|
|
2669
|
+
mounted: new Map(),
|
|
2670
|
+
};
|
|
2671
|
+
this.updateStructuralTailWindow();
|
|
2672
|
+
}
|
|
2673
|
+
const nextAnchor =
|
|
2674
|
+
anchor && this.layout.items.find((item) => item.key === anchor.key);
|
|
2675
|
+
const delta = nextAnchor && anchor ? nextAnchor.y - anchor.y : 0;
|
|
2676
|
+
let finalScrollHeight = oldScrollHeight + newHeight - oldHeight;
|
|
2677
|
+
if (stablePrefixGeometry && this.externalScrollHost) {
|
|
2678
|
+
const beforeMeasure = owner.scrollTop;
|
|
2679
|
+
const tailLayer = this.structuralTail?.layer;
|
|
2680
|
+
if (tailLayer) tailLayer.style.display = 'none';
|
|
2681
|
+
this.writeStructuralHeight(newHeight);
|
|
2682
|
+
this.applyStructuralFooterVisual(1);
|
|
2683
|
+
finalScrollHeight = owner.scrollHeight;
|
|
2684
|
+
this.writeStructuralHeight(startHeight);
|
|
2685
|
+
this.applyStructuralFooterVisual(0);
|
|
2686
|
+
if (tailLayer) tailLayer.style.display = '';
|
|
2687
|
+
owner.scrollTop = beforeMeasure;
|
|
2688
|
+
}
|
|
2689
|
+
const finalMaxOffset = Math.max(0, finalScrollHeight - owner.clientHeight);
|
|
2690
|
+
let targetOffset = Math.max(0, Math.min(oldOffset + delta, finalMaxOffset));
|
|
2691
|
+
if (
|
|
2692
|
+
!visibleSurvivor &&
|
|
2693
|
+
transition.anchorKey &&
|
|
2694
|
+
!(stablePrefixGeometry && nextRows.length > oldRows.length)
|
|
2695
|
+
) {
|
|
2696
|
+
const fallback = this.layout.items.find(
|
|
2697
|
+
(item) => item.key === transition.anchorKey
|
|
2698
|
+
);
|
|
2699
|
+
if (fallback) {
|
|
2700
|
+
const pagerStickyInset = Number.parseFloat(
|
|
2701
|
+
this.externalScrollHost?.style.getPropertyValue(
|
|
2702
|
+
'--ok-collapsible-pager-sticky-inset'
|
|
2703
|
+
) ?? ''
|
|
2704
|
+
);
|
|
2705
|
+
const effectiveStickyInset = Math.max(
|
|
2706
|
+
this.externalStickyInset,
|
|
2707
|
+
Number.isFinite(pagerStickyInset) ? pagerStickyInset : 0
|
|
2708
|
+
);
|
|
2709
|
+
const fallbackTop = this.externalScrollHost
|
|
2710
|
+
? this.externalGeometry().origin + fallback.y - effectiveStickyInset
|
|
2711
|
+
: resolveWebCollapsiblePagerRawOffset(
|
|
2712
|
+
Math.max(0, fallback.y - this.collapsiblePagerInsets().sticky),
|
|
2713
|
+
this.collapsiblePagerInsets().header
|
|
2714
|
+
);
|
|
2715
|
+
if (
|
|
2716
|
+
stablePrefixGeometry &&
|
|
2717
|
+
this.externalScrollHost &&
|
|
2718
|
+
this.reactFooterHeight > 0
|
|
2719
|
+
) {
|
|
2720
|
+
const footerTop = this.externalGeometry().origin + newHeight;
|
|
2721
|
+
const footerStart = Math.max(
|
|
2722
|
+
0,
|
|
2723
|
+
footerTop + this.reactFooterHeight - owner.clientHeight
|
|
2724
|
+
);
|
|
2725
|
+
const footerEnd = Math.max(0, footerTop - effectiveStickyInset);
|
|
2726
|
+
const nearestVisibleOffset =
|
|
2727
|
+
footerStart <= footerEnd
|
|
2728
|
+
? Math.max(footerStart, Math.min(oldOffset, footerEnd))
|
|
2729
|
+
: footerEnd;
|
|
2730
|
+
targetOffset = Math.max(
|
|
2731
|
+
0,
|
|
2732
|
+
Math.min(nearestVisibleOffset, finalMaxOffset)
|
|
2733
|
+
);
|
|
2734
|
+
} else {
|
|
2735
|
+
targetOffset = Math.min(targetOffset, Math.max(0, fallbackTop));
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
const duration = transition.durationMs ?? 220;
|
|
2740
|
+
const easing = 'cubic-bezier(0.42, 0, 0.58, 1)';
|
|
2741
|
+
this.mounted.forEach((element, index) => {
|
|
2742
|
+
const row = this.rows[index];
|
|
2743
|
+
const previousTop = row && oldPositions.get(row.key);
|
|
2744
|
+
if (previousTop === undefined || typeof element.animate !== 'function')
|
|
2745
|
+
return;
|
|
2746
|
+
const offset = previousTop - element.getBoundingClientRect().top;
|
|
2747
|
+
if (Math.abs(offset) < 0.5) return;
|
|
2748
|
+
this.structuralAnimations.push(
|
|
2749
|
+
element.animate(
|
|
2750
|
+
[
|
|
2751
|
+
{ transform: `translateY(${offset}px)` },
|
|
2752
|
+
{ transform: 'translateY(0)' },
|
|
2753
|
+
],
|
|
2754
|
+
{ duration, easing }
|
|
2755
|
+
)
|
|
2756
|
+
);
|
|
2757
|
+
});
|
|
2758
|
+
const startedAt =
|
|
2759
|
+
this.document.defaultView?.performance.now() ?? Date.now();
|
|
2760
|
+
const revision = this.structuralRevision;
|
|
2761
|
+
const finish = () => {
|
|
2762
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
2763
|
+
const ownsScroll = !this.structuralScrollInterrupted;
|
|
2764
|
+
this.cancelStructuralAnimation();
|
|
2765
|
+
this.recomputeLayout();
|
|
2766
|
+
if (stablePrefixGeometry && ownsScroll) {
|
|
2767
|
+
owner.scrollTop = Math.max(
|
|
2768
|
+
0,
|
|
2769
|
+
Math.min(targetOffset, owner.scrollHeight - owner.clientHeight)
|
|
2770
|
+
);
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2773
|
+
const step = (time: number) => {
|
|
2774
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
2775
|
+
if (
|
|
2776
|
+
this.structuralPrefixTransition &&
|
|
2777
|
+
this.document.defaultView?.matchMedia?.(
|
|
2778
|
+
'(prefers-reduced-motion: reduce)'
|
|
2779
|
+
).matches
|
|
2780
|
+
) {
|
|
2781
|
+
finish();
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
const progress = Math.min(1, (time - startedAt) / duration);
|
|
2785
|
+
const eased = progress * progress * (3 - 2 * progress);
|
|
2786
|
+
this.structuralProgress = eased;
|
|
2787
|
+
const renderedHeight =
|
|
2788
|
+
oldHeight +
|
|
2789
|
+
((this.structuralTargetHeight ?? newHeight) - oldHeight) * eased +
|
|
2790
|
+
this.structuralFooterCompensation * (1 - eased);
|
|
2791
|
+
this.structuralRenderedHeight = renderedHeight;
|
|
2792
|
+
this.writeStructuralHeight(renderedHeight);
|
|
2793
|
+
this.applyStructuralFooterVisual(eased);
|
|
2794
|
+
if (!this.structuralScrollInterrupted)
|
|
2795
|
+
owner.scrollTop = oldOffset + (targetOffset - oldOffset) * eased;
|
|
2796
|
+
this.externalGeometryCache = undefined;
|
|
2797
|
+
this.updateStructuralTailWindow();
|
|
2798
|
+
if (progress < 1)
|
|
2799
|
+
this.structuralFrame =
|
|
2800
|
+
this.document.defaultView?.requestAnimationFrame(step);
|
|
2801
|
+
};
|
|
2802
|
+
this.structuralFrame =
|
|
2803
|
+
this.document.defaultView?.requestAnimationFrame(step);
|
|
2804
|
+
this.structuralFinish = this.document.defaultView?.setTimeout(
|
|
2805
|
+
finish,
|
|
2806
|
+
duration + 40
|
|
2807
|
+
);
|
|
2450
2808
|
}
|
|
2451
2809
|
|
|
2452
2810
|
currentContentHeight(): number {
|
|
@@ -2458,14 +2816,19 @@ export class NativeListWebEngine {
|
|
|
2458
2816
|
}
|
|
2459
2817
|
|
|
2460
2818
|
applyPatches(patches: readonly RowPatch[]) {
|
|
2461
|
-
|
|
2462
|
-
|
|
2819
|
+
const accepted = containNativeListInput(() =>
|
|
2820
|
+
applyValidatedRowPatches(this.snapshot, patches)
|
|
2821
|
+
);
|
|
2822
|
+
if (!accepted || accepted.patches.length === 0) return;
|
|
2823
|
+
patches = accepted.patches;
|
|
2824
|
+
const next = accepted.snapshot;
|
|
2463
2825
|
const selection = new Set(this.selectedKeys);
|
|
2464
2826
|
patches.forEach((patch) => {
|
|
2465
2827
|
const selected =
|
|
2466
2828
|
'selected' in patch.changes ? patch.changes.selected : undefined;
|
|
2467
2829
|
if (selected === true) selection.add(patch.key);
|
|
2468
|
-
else if (selected === false
|
|
2830
|
+
else if (selected === false || selected === null)
|
|
2831
|
+
selection.delete(patch.key);
|
|
2469
2832
|
});
|
|
2470
2833
|
const tableValuesOnly = patches.every((patch) => {
|
|
2471
2834
|
const index = this.rows.findIndex((row) => row.key === patch.key);
|
|
@@ -2643,6 +3006,8 @@ export class NativeListWebEngine {
|
|
|
2643
3006
|
|
|
2644
3007
|
destroy() {
|
|
2645
3008
|
if (this.destroyed) return;
|
|
3009
|
+
this.cancelStructuralAnimation();
|
|
3010
|
+
this.pressedHelpElement = undefined;
|
|
2646
3011
|
this.invalidateActionAnchor('destroy');
|
|
2647
3012
|
this.destroyed = true;
|
|
2648
3013
|
if (this.frameHandle !== undefined) this.cancelFrame(this.frameHandle);
|
|
@@ -2670,6 +3035,11 @@ export class NativeListWebEngine {
|
|
|
2670
3035
|
'ok-collapsible-pager-cancel-scroll-command',
|
|
2671
3036
|
this.handlePagerScrollCommandCancel
|
|
2672
3037
|
);
|
|
3038
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart'])
|
|
3039
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
3040
|
+
event,
|
|
3041
|
+
this.handleStructuralUserScroll
|
|
3042
|
+
);
|
|
2673
3043
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
2674
3044
|
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
2675
3045
|
'ok-collapsible-pager-insets-changed',
|
|
@@ -2684,6 +3054,10 @@ export class NativeListWebEngine {
|
|
|
2684
3054
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
2685
3055
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
2686
3056
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
3057
|
+
this.root.removeEventListener(
|
|
3058
|
+
'pointerdown',
|
|
3059
|
+
this.handleIconHelpPointerDown
|
|
3060
|
+
);
|
|
2687
3061
|
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
2688
3062
|
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
2689
3063
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -2746,6 +3120,7 @@ export class NativeListWebEngine {
|
|
|
2746
3120
|
selectedKeys?: ReadonlySet<string>
|
|
2747
3121
|
) {
|
|
2748
3122
|
this.cancelMarketPointer();
|
|
3123
|
+
this.pressedHelpElement = undefined;
|
|
2749
3124
|
this.measuredRendererHeights.clear();
|
|
2750
3125
|
this.snapshot = snapshot;
|
|
2751
3126
|
this.rows = effectiveRows(snapshot);
|
|
@@ -2766,6 +3141,7 @@ export class NativeListWebEngine {
|
|
|
2766
3141
|
'--nl-row': theme.rowBackground,
|
|
2767
3142
|
'--nl-selected': theme.rowSelectedBackground,
|
|
2768
3143
|
'--nl-pressed': theme.rowPressedBackground,
|
|
3144
|
+
'--nl-hover': theme.rowHoverBackground ?? theme.rowPressedBackground,
|
|
2769
3145
|
'--nl-subdued': theme.subduedBackground,
|
|
2770
3146
|
'--nl-strong': theme.strongBackground,
|
|
2771
3147
|
'--nl-image-fallback-background':
|
|
@@ -2783,6 +3159,7 @@ export class NativeListWebEngine {
|
|
|
2783
3159
|
'--nl-separator': theme.separator,
|
|
2784
3160
|
'--nl-accent': theme.accent,
|
|
2785
3161
|
'--nl-positive': theme.positive,
|
|
3162
|
+
'--nl-success-background': theme.successBackground,
|
|
2786
3163
|
'--nl-negative': theme.negative,
|
|
2787
3164
|
'--nl-critical': theme.criticalBackground,
|
|
2788
3165
|
'--nl-inverse': theme.inverseBackground,
|
|
@@ -2870,13 +3247,37 @@ export class NativeListWebEngine {
|
|
|
2870
3247
|
|
|
2871
3248
|
private recomputeLayout = () => {
|
|
2872
3249
|
if (this.destroyed) return;
|
|
3250
|
+
if (
|
|
3251
|
+
this.structuralPrefixTransition &&
|
|
3252
|
+
this.lastViewportWidth > 0 &&
|
|
3253
|
+
this.viewport.clientWidth > 0 &&
|
|
3254
|
+
this.viewport.clientWidth !== this.lastViewportWidth
|
|
3255
|
+
)
|
|
3256
|
+
this.cancelStructuralAnimation();
|
|
3257
|
+
if (this.structuralRenderedHeight === undefined)
|
|
3258
|
+
this.reactFooterHeight = this.readReactFooterHeight();
|
|
3259
|
+
else {
|
|
3260
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
3261
|
+
const footerDelta = this.reactFooterHeight - nextFooterHeight;
|
|
3262
|
+
if (footerDelta !== 0) {
|
|
3263
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
3264
|
+
const priorCompensation = this.structuralFooterCompensation;
|
|
3265
|
+
const difference = this.structuralFooterFromHeight - nextFooterHeight;
|
|
3266
|
+
this.structuralFooterCompensation = Math.max(0, difference);
|
|
3267
|
+
this.structuralFooterExpansion = Math.max(0, -difference);
|
|
3268
|
+
this.structuralRenderedHeight +=
|
|
3269
|
+
(this.structuralFooterCompensation - priorCompensation) *
|
|
3270
|
+
(1 - this.structuralProgress);
|
|
3271
|
+
this.applyStructuralFooterVisual(this.structuralProgress);
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
2873
3274
|
const cachedWidth = this.lastViewportWidth;
|
|
2874
3275
|
const cachedHeight = this.lastViewportHeight;
|
|
2875
3276
|
const precomputedLayout =
|
|
2876
3277
|
this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0
|
|
2877
3278
|
? this.computeLayout(cachedWidth, cachedHeight)
|
|
2878
3279
|
: undefined;
|
|
2879
|
-
if (precomputedLayout) {
|
|
3280
|
+
if (precomputedLayout && this.structuralRenderedHeight === undefined) {
|
|
2880
3281
|
// Commit appended row extent before measuring React-owned slot changes.
|
|
2881
3282
|
this.writeExternalHeight(
|
|
2882
3283
|
Math.max(this.layout.contentHeight, precomputedLayout.contentHeight)
|
|
@@ -2929,11 +3330,15 @@ export class NativeListWebEngine {
|
|
|
2929
3330
|
? precomputedLayout
|
|
2930
3331
|
: this.computeLayout(viewportWidth, viewportHeight);
|
|
2931
3332
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
2932
|
-
|
|
3333
|
+
const renderedHeight =
|
|
3334
|
+
this.structuralRenderedHeight ?? this.layout.contentHeight;
|
|
3335
|
+
this.content.style.height = String(renderedHeight) + 'px';
|
|
2933
3336
|
if (this.externalScrollHost) {
|
|
2934
|
-
this.writeExternalHeight(
|
|
3337
|
+
this.writeExternalHeight(renderedHeight);
|
|
2935
3338
|
this.externalGeometryCache = undefined;
|
|
2936
3339
|
}
|
|
3340
|
+
if (this.structuralRenderedHeight !== undefined)
|
|
3341
|
+
this.structuralTargetHeight = this.layout.contentHeight;
|
|
2937
3342
|
this.renderSectionIndex(
|
|
2938
3343
|
this.viewport.clientHeight <= 0
|
|
2939
3344
|
? DEFAULT_VIEWPORT_HEIGHT
|
|
@@ -3094,6 +3499,7 @@ export class NativeListWebEngine {
|
|
|
3094
3499
|
}
|
|
3095
3500
|
this.updateVisibleSelection();
|
|
3096
3501
|
this.updateVisibleState();
|
|
3502
|
+
this.updateStructuralTailWindow();
|
|
3097
3503
|
}
|
|
3098
3504
|
|
|
3099
3505
|
private positionElement(element: HTMLElement, item: WebLayoutItem) {
|
|
@@ -3172,7 +3578,7 @@ export class NativeListWebEngine {
|
|
|
3172
3578
|
const body = reusableBody ?? createRowBody(context, row);
|
|
3173
3579
|
if (reusableBody) {
|
|
3174
3580
|
resetRowContainerStyle(body);
|
|
3175
|
-
registered.bind(body, rendererPrimitives(context));
|
|
3581
|
+
registered.bind(body, rendererPrimitives(context, Boolean(row.disabled)));
|
|
3176
3582
|
}
|
|
3177
3583
|
// OneKey patch: explicit selector fields preserve original page geometry.
|
|
3178
3584
|
element.style.contain = row.backgroundFullWidth ? 'layout style' : '';
|
|
@@ -3964,6 +4370,8 @@ export class NativeListWebEngine {
|
|
|
3964
4370
|
}
|
|
3965
4371
|
|
|
3966
4372
|
private invalidateActionAnchorForElement(element: HTMLElement) {
|
|
4373
|
+
if (this.pressedHelpElement && element.contains(this.pressedHelpElement))
|
|
4374
|
+
this.pressedHelpElement = undefined;
|
|
3967
4375
|
const anchor = this.actionAnchor;
|
|
3968
4376
|
if (
|
|
3969
4377
|
anchor &&
|
|
@@ -4076,9 +4484,13 @@ export class NativeListWebEngine {
|
|
|
4076
4484
|
'[data-native-list-row-key]'
|
|
4077
4485
|
);
|
|
4078
4486
|
const row = this.rowAtElement(rowElement);
|
|
4079
|
-
if (
|
|
4487
|
+
if (
|
|
4488
|
+
(row?.type !== 'market' && row?.type !== 'identity') ||
|
|
4489
|
+
!isRowPressEnabled(row)
|
|
4490
|
+
)
|
|
4491
|
+
return;
|
|
4080
4492
|
this.cancelMarketPointer();
|
|
4081
|
-
if (row.pressInActionKey)
|
|
4493
|
+
if (row.type === 'market' && row.pressInActionKey)
|
|
4082
4494
|
this.emitRowAction(
|
|
4083
4495
|
row,
|
|
4084
4496
|
row.pressInActionKey,
|
|
@@ -4097,7 +4509,7 @@ export class NativeListWebEngine {
|
|
|
4097
4509
|
!rowElement.isConnected ||
|
|
4098
4510
|
rowElement.dataset.nativeListBindingEpoch !== bindingEpoch ||
|
|
4099
4511
|
currentRow?.key !== row.key ||
|
|
4100
|
-
currentRow.type !== 'market' ||
|
|
4512
|
+
(currentRow.type !== 'market' && currentRow.type !== 'identity') ||
|
|
4101
4513
|
!isRowPressEnabled(currentRow) ||
|
|
4102
4514
|
!currentRow.longPressActionKey
|
|
4103
4515
|
)
|
|
@@ -4115,7 +4527,7 @@ export class NativeListWebEngine {
|
|
|
4115
4527
|
this.marketPointer = {
|
|
4116
4528
|
pointerId: event.pointerId,
|
|
4117
4529
|
pointerType: event.pointerType,
|
|
4118
|
-
compact: !row.webTable,
|
|
4530
|
+
compact: row.type === 'identity' || !row.webTable,
|
|
4119
4531
|
rowKey: row.key,
|
|
4120
4532
|
startX: event.clientX,
|
|
4121
4533
|
startY: event.clientY,
|
|
@@ -4183,11 +4595,23 @@ export class NativeListWebEngine {
|
|
|
4183
4595
|
action.contains(event.relatedTarget))
|
|
4184
4596
|
)
|
|
4185
4597
|
return;
|
|
4598
|
+
if (action.dataset.nativeListIconHelp === 'true') {
|
|
4599
|
+
if (
|
|
4600
|
+
event.type === 'pointerover' &&
|
|
4601
|
+
(event as PointerEvent).pointerType === 'touch'
|
|
4602
|
+
)
|
|
4603
|
+
return;
|
|
4604
|
+
if (this.pressedHelpElement === action) return;
|
|
4605
|
+
}
|
|
4186
4606
|
if (
|
|
4187
4607
|
action.classList.contains('ok-native-list-market-subtitle-prefix') &&
|
|
4188
4608
|
action.scrollWidth <= action.clientWidth + 1
|
|
4189
4609
|
)
|
|
4190
4610
|
return;
|
|
4611
|
+
this.emitHoverAction(action);
|
|
4612
|
+
};
|
|
4613
|
+
|
|
4614
|
+
private emitHoverAction(action: HTMLElement) {
|
|
4191
4615
|
const rowElement = action.closest<HTMLElement>(
|
|
4192
4616
|
'[data-native-list-row-key]'
|
|
4193
4617
|
);
|
|
@@ -4209,6 +4633,24 @@ export class NativeListWebEngine {
|
|
|
4209
4633
|
// WalletGroup), not the enclosing row's `disabled`.
|
|
4210
4634
|
if (sourceRow && !sourceRow.disabled && actionKey)
|
|
4211
4635
|
this.emitRowAction(sourceRow, actionKey, action, rowElement ?? undefined);
|
|
4636
|
+
}
|
|
4637
|
+
|
|
4638
|
+
private handleIconHelpPointerDown = (event: PointerEvent) => {
|
|
4639
|
+
const target = event.target;
|
|
4640
|
+
if (!(target instanceof Element)) return;
|
|
4641
|
+
const action = target.closest<HTMLElement>(
|
|
4642
|
+
'[data-native-list-icon-help="true"]'
|
|
4643
|
+
);
|
|
4644
|
+
if (!action) return;
|
|
4645
|
+
if (event.pointerType === 'touch') {
|
|
4646
|
+
if (this.actionAnchor?.actionElement === action && this.actionAnchor.open)
|
|
4647
|
+
this.invalidateActionAnchor('pointerLeave');
|
|
4648
|
+
else this.emitHoverAction(action);
|
|
4649
|
+
} else {
|
|
4650
|
+
this.pressedHelpElement = action;
|
|
4651
|
+
if (this.actionAnchor?.actionElement === action)
|
|
4652
|
+
this.invalidateActionAnchor('pointerLeave');
|
|
4653
|
+
}
|
|
4212
4654
|
};
|
|
4213
4655
|
|
|
4214
4656
|
private handleTitlePointerOut = (event: PointerEvent | FocusEvent) => {
|
|
@@ -4223,6 +4665,14 @@ export class NativeListWebEngine {
|
|
|
4223
4665
|
action.contains(event.relatedTarget))
|
|
4224
4666
|
)
|
|
4225
4667
|
return;
|
|
4668
|
+
if (
|
|
4669
|
+
action.dataset.nativeListIconHelp === 'true' &&
|
|
4670
|
+
event.type === 'pointerout' &&
|
|
4671
|
+
(event as PointerEvent).pointerType === 'touch'
|
|
4672
|
+
)
|
|
4673
|
+
return;
|
|
4674
|
+
if (event.type === 'pointerout' && this.pressedHelpElement === action)
|
|
4675
|
+
this.pressedHelpElement = undefined;
|
|
4226
4676
|
if (this.actionAnchor?.actionElement === action)
|
|
4227
4677
|
this.invalidateActionAnchor('pointerLeave');
|
|
4228
4678
|
};
|
|
@@ -4236,6 +4686,11 @@ export class NativeListWebEngine {
|
|
|
4236
4686
|
}
|
|
4237
4687
|
const target = event.target;
|
|
4238
4688
|
if (!(target instanceof Element)) return;
|
|
4689
|
+
if (target.closest('[data-native-list-icon-help="true"]')) {
|
|
4690
|
+
event.preventDefault();
|
|
4691
|
+
event.stopPropagation();
|
|
4692
|
+
return;
|
|
4693
|
+
}
|
|
4239
4694
|
const rowElement = target.closest<HTMLElement>(
|
|
4240
4695
|
'[data-native-list-row-key]'
|
|
4241
4696
|
);
|
|
@@ -4256,6 +4711,10 @@ export class NativeListWebEngine {
|
|
|
4256
4711
|
// member press is blocked by `isRowPressEnabled` in `handleRowPress`.
|
|
4257
4712
|
const action = target.closest<HTMLElement>('[data-native-list-action]');
|
|
4258
4713
|
if (action) {
|
|
4714
|
+
if (action.tagName === 'BUTTON' && action.hasAttribute('disabled'))
|
|
4715
|
+
return;
|
|
4716
|
+
if (action.classList.contains('ok-native-list-trailing-button'))
|
|
4717
|
+
event.stopPropagation();
|
|
4259
4718
|
const scope = action.dataset.selectionScope;
|
|
4260
4719
|
if (scope === 'row') this.activateSelection({ scope: 'row' }, row);
|
|
4261
4720
|
else if (scope === 'section' && action.dataset.selectionKey)
|
|
@@ -4281,6 +4740,19 @@ export class NativeListWebEngine {
|
|
|
4281
4740
|
};
|
|
4282
4741
|
|
|
4283
4742
|
private handleKeyDown = (event: KeyboardEvent) => {
|
|
4743
|
+
if (
|
|
4744
|
+
(event.key === 'Enter' || event.key === ' ') &&
|
|
4745
|
+
event.target instanceof HTMLElement &&
|
|
4746
|
+
event.target.matches('[role="button"][data-native-list-hover-action]')
|
|
4747
|
+
) {
|
|
4748
|
+
event.preventDefault();
|
|
4749
|
+
if (
|
|
4750
|
+
this.actionAnchor?.actionElement !== event.target ||
|
|
4751
|
+
!this.actionAnchor.open
|
|
4752
|
+
)
|
|
4753
|
+
this.emitHoverAction(event.target);
|
|
4754
|
+
return;
|
|
4755
|
+
}
|
|
4284
4756
|
// OneKey patch: non-button title help supports keyboard activation.
|
|
4285
4757
|
if (
|
|
4286
4758
|
(event.key === 'Enter' || event.key === ' ') &&
|
|
@@ -4418,6 +4890,7 @@ export class NativeListWebEngine {
|
|
|
4418
4890
|
|
|
4419
4891
|
private handleScroll = () => {
|
|
4420
4892
|
this.externalGeometryCache = undefined;
|
|
4893
|
+
this.pressedHelpElement = undefined;
|
|
4421
4894
|
this.cancelMarketPointer();
|
|
4422
4895
|
this.invalidateActionAnchor('scroll');
|
|
4423
4896
|
this.scheduleFrame();
|