@onekeyfe/react-native-native-list 6.7.0-2 → 6.7.0-20
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/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +245 -9
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +29 -3
- 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 +87 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +193 -10
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +147 -33
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +145 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +51 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -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 +1920 -109
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +29 -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 +60 -9
- package/docs/SPEC.md +1004 -17
- package/docs/STYLE_SPEC.md +6 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +235 -39
- package/ios/NativeListActivityDetailsView.swift +18 -8
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +155 -27
- package/ios/NativeListDesignAssets.swift +9 -0
- package/ios/NativeListIdentityRenderer.swift +191 -30
- package/ios/NativeListLeadingVisual.swift +119 -22
- package/ios/NativeListMessageRenderer.swift +34 -1
- 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 +88 -0
- package/ios/RNCNativeListView.swift +1031 -55
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +1 -0
- package/ios/tests/NativeListAccessoryStackTests.swift +89 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
- package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
- package/ios/tests/NativeListLifecycleTests.swift +2720 -3
- package/lib/module/NativeList.js +200 -32
- package/lib/module/NativeList.web.js +262 -32
- package/lib/module/index.js +1 -1
- package/lib/module/models.js +1 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +776 -52
- package/lib/module/web/NativeListWebEngine.js +919 -79
- package/lib/module/web/templates/ActivityRowRenderer.js +487 -7
- 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 +90 -4
- package/lib/module/web/templates/MarketRowRenderer.js +8 -3
- package/lib/module/web/templates/MarketTableRowRenderer.js +577 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +260 -5
- 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 +8 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +70 -3
- 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 +29 -1
- package/lib/typescript/src/NativeList.web.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +176 -10
- package/lib/typescript/src/validation.d.ts +15 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +58 -1
- package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
- 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/MarketTableRowRenderer.d.ts +17 -0
- package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +3 -3
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +10 -4
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
- 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 +3 -3
- package/react-native-native-list.podspec +1 -0
- package/src/NativeList.nitro.ts +2 -0
- package/src/NativeList.tsx +391 -82
- package/src/NativeList.types.ts +34 -1
- package/src/NativeList.web.tsx +420 -65
- package/src/index.ts +2 -0
- package/src/models.ts +210 -3
- package/src/selection.ts +1 -0
- package/src/validation.ts +1635 -76
- package/src/web/NativeListWebEngine.ts +1476 -112
- package/src/web/templates/ActivityRowRenderer.ts +732 -8
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +150 -5
- package/src/web/templates/MarketRowRenderer.ts +19 -3
- package/src/web/templates/MarketTableRowRenderer.ts +755 -0
- package/src/web/templates/MediaTileRowRenderer.ts +313 -5
- package/src/web/templates/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +21 -6
- package/src/web/templates/SectionHeaderRowRenderer.ts +89 -5
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
import { hasExplicitRowHeight, rowSizeModifier } from './templates/RowElements';
|
|
7
7
|
import { applyTextStyleToSlot, applyValueSegments } from './templates/RowText';
|
|
8
8
|
import { setMarketQuoteContent } from './templates/MarketRowRenderer';
|
|
9
|
+
import {
|
|
10
|
+
canPatchMarketTableValues,
|
|
11
|
+
updateMarketTableValues,
|
|
12
|
+
} from './templates/MarketTableRowRenderer';
|
|
9
13
|
export {
|
|
10
14
|
resolveWebMarketLayoutStyle,
|
|
11
15
|
type WebMarketLayoutStyle,
|
|
@@ -56,7 +60,13 @@ import {
|
|
|
56
60
|
validateOffset,
|
|
57
61
|
type NormalizedPositionScroll,
|
|
58
62
|
} from '../scrolling';
|
|
59
|
-
import {
|
|
63
|
+
import {
|
|
64
|
+
applyRowPatches,
|
|
65
|
+
containNativeListInput,
|
|
66
|
+
emptyNativeListSnapshot,
|
|
67
|
+
validatePatches,
|
|
68
|
+
validateSnapshot,
|
|
69
|
+
} from '../validation';
|
|
60
70
|
import { avatarPrefetchWindow } from '../avatarPrefetch';
|
|
61
71
|
import {
|
|
62
72
|
acquireNativeListAvatar,
|
|
@@ -311,6 +321,7 @@ export function isWebRowReorderable(
|
|
|
311
321
|
if (row.type === 'rail' && row.draggable) return true;
|
|
312
322
|
if (row.type === 'identity' && row.draggable) return true;
|
|
313
323
|
if (row.type === 'walletGroup' && row.draggable) return true;
|
|
324
|
+
if (row.type === 'market' && row.webTable?.draggable) return true;
|
|
314
325
|
return (
|
|
315
326
|
(row.type === 'identity' || row.type === 'action') &&
|
|
316
327
|
Boolean(row.trailing?.some((accessory) => accessory.kind === 'drag'))
|
|
@@ -563,9 +574,7 @@ export function computeWebListLayout(
|
|
|
563
574
|
}
|
|
564
575
|
|
|
565
576
|
const columns = snapshot.layout.gridColumns ?? 2;
|
|
566
|
-
const itemWidth =
|
|
567
|
-
(availableWidth - spacing * (columns - 1)) / columns
|
|
568
|
-
);
|
|
577
|
+
const itemWidth = (availableWidth - spacing * (columns - 1)) / columns;
|
|
569
578
|
let y = padding.top;
|
|
570
579
|
let column = 0;
|
|
571
580
|
let bandStart = y;
|
|
@@ -789,18 +798,21 @@ export function webMarketImageBindDeltaForPatches(
|
|
|
789
798
|
|
|
790
799
|
// OneKey patch: selector names must shrink before the sidebar clips their contents.
|
|
791
800
|
export const WEB_LIST_CSS = `
|
|
801
|
+
.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}
|
|
802
|
+
|
|
792
803
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
793
|
-
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-family:var(--nl-font-regular)
|
|
804
|
+
.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)}
|
|
794
805
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
795
806
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
796
807
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
797
808
|
.ok-native-list-item{position:absolute;left:0;top:0;box-sizing:border-box;contain:layout paint style;outline:none}
|
|
809
|
+
.ok-native-list-item[data-native-list-media-gallery="true"]{pointer-events:none}.ok-native-list-item[data-native-list-media-gallery="true"]>.ok-native-list-media{pointer-events:auto}
|
|
798
810
|
.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}
|
|
799
811
|
.ok-native-list-item[data-table-alternate="true"]>.ok-native-list-row{background:var(--nl-bg)}
|
|
800
812
|
.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
801
813
|
.ok-native-list-item[data-native-list-disabled="true"]>.ok-native-list-row{cursor:default}
|
|
802
814
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]>.ok-native-list-row{cursor:pointer}
|
|
803
|
-
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-
|
|
815
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-hover)}
|
|
804
816
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-row{background:var(--nl-pressed)}
|
|
805
817
|
.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)}
|
|
806
818
|
.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)}
|
|
@@ -819,7 +831,7 @@ export const WEB_LIST_CSS = `
|
|
|
819
831
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-row>*{visibility:hidden}
|
|
820
832
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-wallet-group{border-color:transparent;background:var(--nl-pressed)}
|
|
821
833
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-wallet-group>*{visibility:hidden}
|
|
822
|
-
.ok-native-list-reorder-preview{position:fixed;left:0;top:0;z-index:100001;pointer-events:none;overflow:hidden;border-radius:12px;box-shadow:0 4px 24px rgba(0,0,0,.12);transform-origin:center;will-change:transform;font-
|
|
834
|
+
.ok-native-list-reorder-preview{position:fixed;left:0;top:0;z-index:100001;pointer-events:none;overflow:hidden;border-radius:12px;box-shadow:0 4px 24px rgba(0,0,0,.12);transform-origin:center;will-change:transform;font-family:var(--nl-font-regular);font-synthesis:none}
|
|
823
835
|
.ok-native-list-reorder-preview>.ok-native-list-row{background:var(--nl-pressed);cursor:grabbing}
|
|
824
836
|
.ok-native-list-reorder-preview[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
825
837
|
.ok-native-list-reorder-count{position:absolute;right:4px;bottom:4px;display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:24px;height:24px;padding:0 6px;border:1px solid var(--nl-row);border-radius:12px;background:var(--nl-inverse);color:var(--nl-inverse-text);font-size:12px;line-height:22px;font-weight:600;font-family:var(--nl-font-semibold)}
|
|
@@ -831,30 +843,41 @@ export const WEB_LIST_CSS = `
|
|
|
831
843
|
.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)}
|
|
832
844
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
833
845
|
.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}
|
|
846
|
+
.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:pointer}.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}
|
|
847
|
+
.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}
|
|
848
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon:focus-visible:not(:disabled){outline:2px solid var(--nl-accent)}
|
|
849
|
+
.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}
|
|
834
850
|
.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)}
|
|
835
|
-
.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;
|
|
851
|
+
.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)}
|
|
836
852
|
.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}
|
|
837
|
-
.ok-native-list-value{font-size:14px;line-height:20px;font-weight:500;font-family:var(--nl-font-medium)
|
|
838
|
-
.ok-native-list-action-button{appearance:none;border:0;background:transparent;padding:2px;color:var(--nl-accent);font:600 12px/16px var(--nl-font-semibold)
|
|
839
|
-
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;font-family:var(--nl-font-semibold);
|
|
840
|
-
.ok-native-list-accessories{display:flex;align-items:center;gap:10px;min-width:0}.ok-native-list-accessory{font-size:14px;color:var(--nl-primary);white-space:nowrap}.ok-native-list-accessory-secondary{color:var(--nl-secondary)}.ok-native-list-icon-button{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;border:0;background:transparent;color:var(--nl-icon);font-size:20px;line-height:1;font-weight:500;font-family:var(--nl-font-medium)
|
|
841
|
-
.ok-native-list-
|
|
842
|
-
.ok-native-list-
|
|
843
|
-
.ok-native-list-
|
|
853
|
+
.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}
|
|
854
|
+
.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}
|
|
855
|
+
.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}
|
|
856
|
+
.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)}}
|
|
857
|
+
.ok-native-list-icon-button.ok-native-list-decorative-refresh{min-width:16px;width:16px;height:16px}
|
|
858
|
+
.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}
|
|
859
|
+
.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)}
|
|
860
|
+
.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}
|
|
861
|
+
.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)}
|
|
862
|
+
.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}
|
|
844
863
|
.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)}
|
|
845
864
|
.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}
|
|
846
|
-
.ok-native-list-rail{padding:4px;gap:6px;border-radius:8px}.ok-native-list-rail .ok-native-list-visual{width:20px;height:20px;flex-basis:20px}.ok-native-list-rail .ok-native-list-visual>img,.ok-native-list-rail .ok-native-list-visual-main{width:20px;height:20px}.ok-native-list-rail-title{font-size:12px;font-weight:500;font-family:var(--nl-font-medium)
|
|
847
|
-
.ok-native-list-media{display:block;padding:0 5px;background:transparent;border-radius:16px}.ok-native-list-media-image{display:block;width:100%;aspect-ratio:1;border-radius:10px;background:var(--nl-strong);object-fit:cover}.ok-native-list-media-image[data-state="empty"]{background:transparent}.ok-native-list-media-image[data-state="error"]{display:flex;align-items:center;justify-content:center;color:var(--nl-icon-subdued);font-size:24px}.ok-native-list-media-meta{padding-top:7px}.ok-native-list-media-subtitle-row{display:flex;align-items:center;gap:6px}.ok-native-list-media-subtitle{flex:1;min-width:0;font-size:12px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-media-network{width:14px;height:14px;border-radius:50%}.ok-native-list-media-title{font-size:16px;font-weight:500;
|
|
865
|
+
.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)}
|
|
866
|
+
.ok-native-list-media{display:block;padding:0 5px;background:transparent;border-radius:16px}.ok-native-list-media-image{display:block;width:100%;aspect-ratio:1;border-radius:10px;background:var(--nl-strong);object-fit:cover}.ok-native-list-media-image[data-state="empty"]{background:transparent}.ok-native-list-media-image[data-state="error"]{display:flex;align-items:center;justify-content:center;color:var(--nl-icon-subdued);font-size:24px}.ok-native-list-media-meta{padding-top:7px}.ok-native-list-media-subtitle-row{display:flex;align-items:center;gap:6px}.ok-native-list-media-subtitle{flex:1;min-width:0;font-size:12px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-media-network{width:14px;height:14px;border-radius:50%}.ok-native-list-media-title{font-size:16px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-medium)}.ok-native-list-media-close{position:absolute;right:9px;top:4px;border:0;background:color-mix(in srgb,var(--nl-inverse) 72%,transparent);color:var(--nl-inverse-text);width:24px;height:24px;border-radius:50%;cursor:pointer;font:18px/20px var(--nl-font-regular)}
|
|
848
867
|
.ok-native-list-metric{display:flex;flex-direction:column;align-items:flex-start;padding:12px;border-radius:12px;gap:5px;background:var(--nl-row)}.ok-native-list-metric-value{font-size:22px;line-height:28px;font-weight:700;font-family:var(--nl-font-bold)}.ok-native-list-composite{display:flex;flex-direction:column;align-items:stretch;padding:14px;border-radius:12px;gap:12px;background:var(--nl-subdued)}.ok-native-list-composite-heading{font-size:14px;letter-spacing:1px;color:var(--nl-secondary)}.ok-native-list-composite-row{display:flex;gap:12px}.ok-native-list-composite-cell{flex:1;min-width:0}.ok-native-list-composite-cell[data-shaded="true"]{padding:10px;border-radius:10px;background:color-mix(in srgb,var(--nl-primary) 5%,transparent)}.ok-native-list-composite-value{font-size:18px;font-weight:600;font-family:var(--nl-font-semibold)}.ok-native-list-divider{height:1px;background:var(--nl-separator)}.ok-native-list-progress{height:4px;border-radius:2px;overflow:hidden;background:var(--nl-negative)}.ok-native-list-progress>span{display:block;height:100%;border-radius:2px;background:var(--nl-positive)}
|
|
849
|
-
.ok-native-list-data{padding:6px 12px}.ok-native-list-index{flex:0 0 28px;color:var(--nl-secondary);font-size:13px}.ok-native-list-favorite{flex:0 0 24px;color:var(--nl-icon-subdued);font-size:22px}.ok-native-list-favorite[data-active="true"]{color:var(--nl-accent)}.ok-native-list-data-cell{display:flex;flex-direction:column;min-width:0}.ok-native-list-data-cell[data-align="center"]{align-items:center}.ok-native-list-data-cell[data-align="end"]{align-items:flex-end}.ok-native-list-data-primary{display:flex;align-items:center;gap:5px;max-width:100%;font-size:16px;font-weight:500;font-family:var(--nl-font-medium)
|
|
850
|
-
.ok-native-list-
|
|
868
|
+
.ok-native-list-data{padding:6px 12px}.ok-native-list-index{flex:0 0 28px;color:var(--nl-secondary);font-size:13px}.ok-native-list-favorite{flex:0 0 24px;color:var(--nl-icon-subdued);font-size:22px}.ok-native-list-favorite[data-active="true"]{color:var(--nl-accent)}.ok-native-list-data-cell{display:flex;flex-direction:column;min-width:0}.ok-native-list-data-cell[data-align="center"]{align-items:center}.ok-native-list-data-cell[data-align="end"]{align-items:flex-end}.ok-native-list-data-primary{display:flex;align-items:center;gap:5px;max-width:100%;font-size:16px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}.ok-native-list-unread{width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--nl-accent)}.ok-native-list-thumbnail{width:64px;height:64px;border-radius:10px;object-fit:cover}
|
|
869
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-history{background:var(--nl-selected)}
|
|
870
|
+
.ok-native-list-root[data-native-list-parent-scroll="true"] .ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-market:not([data-variant="stock"]){opacity:.8}
|
|
871
|
+
.ok-native-list-root[data-native-list-parent-scroll="true"] .ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-market[data-variant="stock"]{background:var(--nl-selected)}
|
|
872
|
+
.ok-native-list-market-table .ok-native-list-visual-fallback>svg{width:28px;height:28px}
|
|
873
|
+
.ok-native-list-market{padding:12px 20px;gap:14px}.ok-native-list-market>.ok-native-list-visual{width:32px;height:32px;flex-basis:32px}.ok-native-list-market[data-variant="stock"]>.ok-native-list-visual{width:40px;height:40px;flex-basis:40px}.ok-native-list-market>.ok-native-list-visual>.ok-native-list-visual-main{width:100%;height:100%}.ok-native-list-market-main{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:center}.ok-native-list-market-title-line{display:flex;align-items:center;min-width:0;gap:4px}.ok-native-list-market-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--nl-primary);font-size:16px;line-height:24px;font-weight:500;font-family:var(--nl-font-medium)}.ok-native-list-market-subtitle{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--nl-secondary);font-size:14px;line-height:20px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-market-badge{display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center;box-sizing:border-box;max-width:72px;height:18px;padding:0 5px;border:0;border-radius:4px;background:var(--nl-strong);color:var(--nl-secondary);overflow:hidden;white-space:nowrap;font:500 11px/18px var(--nl-font-medium);font-variant-numeric:tabular-nums}.ok-native-list-market-badge img{width:14px;height:14px;object-fit:contain}.ok-native-list-market-trailing{display:flex;flex:0 0 auto;align-items:center;gap:8px}.ok-native-list-market-price{max-width:112px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right;color:var(--nl-primary);font-size:16px;line-height:24px;font-weight:500;font-variant-numeric:tabular-nums;font-family:var(--nl-font-medium)}.ok-native-list-market-change{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:80px;height:32px;border-radius:8px;color:#fff;background:#8d8d8d;font-size:14px;line-height:20px;font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap;font-family:var(--nl-font-medium)}.ok-native-list-market-change[data-tone="positive"]{background:var(--nl-positive)}.ok-native-list-market-change[data-tone="negative"]{background:var(--nl-negative)}
|
|
851
874
|
.ok-native-list-market-badge>svg,.ok-native-list-market-badge>.ok-native-list-market-badge-icon>svg{display:block;width:16px;height:16px;flex:0 0 16px}.ok-native-list-system[data-native-list-presentation="market"]{box-sizing:border-box;padding:12px 20px}.ok-native-list-system[data-native-list-presentation="market"]>.ok-native-list-spinner{width:32px;height:32px}
|
|
852
|
-
.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;
|
|
875
|
+
.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)}
|
|
853
876
|
.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}
|
|
854
877
|
@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)}}
|
|
855
|
-
.ok-native-list-footer{flex:0 0 auto;min-height:0}.ok-native-list-sticky{position:absolute;z-index:4;left:0;right:0;top:0;pointer-events:auto;box-shadow:0 1px 0 var(--nl-separator)}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport{scrollbar-width:none}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport::-webkit-scrollbar,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport::-webkit-scrollbar{display:none}.ok-native-list-index-rail{position:absolute;z-index:6;top:0;right:0;bottom:0;width:${SECTION_INDEX_RAIL_WIDTH}px;touch-action:none;cursor:pointer;font-
|
|
878
|
+
.ok-native-list-footer{flex:0 0 auto;min-height:0}.ok-native-list-sticky{position:absolute;z-index:4;left:0;right:0;top:0;pointer-events:auto;box-shadow:0 1px 0 var(--nl-separator)}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport{scrollbar-width:none}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport::-webkit-scrollbar,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport::-webkit-scrollbar{display:none}.ok-native-list-index-rail{position:absolute;z-index:6;top:0;right:0;bottom:0;width:${SECTION_INDEX_RAIL_WIDTH}px;touch-action:none;cursor:pointer;font-family: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}
|
|
856
879
|
.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)}
|
|
857
|
-
.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;
|
|
880
|
+
.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)}
|
|
858
881
|
.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. */
|
|
859
882
|
.ok-native-list-checkbox[data-selector="networkSelector"]{padding:0;border-radius:4px;border-color:var(--nl-checkbox-border,var(--nl-separator));background:var(--nl-checkbox-icon,var(--nl-inverse-text))}
|
|
860
883
|
.ok-native-list-checkbox[data-selector="networkSelector"]::after{display:none}
|
|
@@ -866,7 +889,7 @@ export const WEB_LIST_CSS = `
|
|
|
866
889
|
/* OneKey patch: selected group members use the same primary title color as standalone wallets. */
|
|
867
890
|
.ok-native-list-wallet-member[data-native-list-selected="true"]>.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-title{color:var(--nl-primary)}
|
|
868
891
|
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges{height:18px}
|
|
869
|
-
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges>.ok-native-list-badge{font-size:11px;line-height:14px;font-weight:400;
|
|
892
|
+
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges>.ok-native-list-badge{font-size:11px;line-height:14px;font-weight:400;height:18px;padding:2px 6px;border-radius:4px;background:var(--nl-subdued);color:var(--nl-secondary);font-family:var(--nl-font-regular)}
|
|
870
893
|
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges>.ok-native-list-badge[data-tone="warning"]{background:var(--nl-caution-background);color:var(--nl-caution)}
|
|
871
894
|
.ok-native-list-account-row[data-native-list-selector="accountSelector"] .ok-native-list-accessories>.ok-native-list-icon-button{box-sizing:border-box;flex:0 0 38px;width:38px;height:38px;margin:-7px;padding:7px}
|
|
872
895
|
.ok-native-list-account-row[data-native-list-selector="accountSelector"] .ok-native-list-accessories>.ok-native-list-icon-button[data-native-list-action]:not([data-native-list-account-control="createAddress"]):hover{background:var(--nl-strong);border-radius:50%}
|
|
@@ -885,6 +908,7 @@ export const WEB_LIST_CSS = `
|
|
|
885
908
|
.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)}
|
|
886
909
|
.ok-native-list-root [data-nl-container-border="true"]{position:relative}
|
|
887
910
|
.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}
|
|
911
|
+
.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}
|
|
888
912
|
.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)}
|
|
889
913
|
`;
|
|
890
914
|
|
|
@@ -956,10 +980,13 @@ function configureWebImageRetry(
|
|
|
956
980
|
const retryLimit = Number.isFinite(source.retryTimes)
|
|
957
981
|
? Math.max(0, Math.floor(source.retryTimes ?? 0))
|
|
958
982
|
: 0;
|
|
959
|
-
|
|
983
|
+
const orderedFallbacks = source.fallbackUris;
|
|
984
|
+
if (!fallbackUri && retryLimit === 0 && orderedFallbacks === undefined)
|
|
985
|
+
return;
|
|
960
986
|
const view = image.ownerDocument.defaultView;
|
|
961
987
|
let currentUri = initialUri;
|
|
962
988
|
let usedFallback = false;
|
|
989
|
+
let fallbackIndex = 0;
|
|
963
990
|
let retryCount = 0;
|
|
964
991
|
let retryTimer: number | undefined;
|
|
965
992
|
let disposed = false;
|
|
@@ -972,7 +999,25 @@ function configureWebImageRetry(
|
|
|
972
999
|
event.stopImmediatePropagation();
|
|
973
1000
|
return;
|
|
974
1001
|
}
|
|
975
|
-
if (
|
|
1002
|
+
if (orderedFallbacks !== undefined && retryCount >= retryLimit) {
|
|
1003
|
+
if (fallbackIndex >= orderedFallbacks.length) return;
|
|
1004
|
+
let nextUri: string | undefined;
|
|
1005
|
+
while (!nextUri && fallbackIndex < orderedFallbacks.length) {
|
|
1006
|
+
nextUri = safeImageUri(orderedFallbacks[fallbackIndex++]);
|
|
1007
|
+
}
|
|
1008
|
+
if (!nextUri) return;
|
|
1009
|
+
event.stopImmediatePropagation();
|
|
1010
|
+
retryCount = 0;
|
|
1011
|
+
currentUri = nextUri;
|
|
1012
|
+
image.src = currentUri;
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
if (
|
|
1016
|
+
orderedFallbacks === undefined &&
|
|
1017
|
+
fallbackUri &&
|
|
1018
|
+
!usedFallback &&
|
|
1019
|
+
fallbackUri !== currentUri
|
|
1020
|
+
) {
|
|
976
1021
|
event.stopImmediatePropagation();
|
|
977
1022
|
usedFallback = true;
|
|
978
1023
|
currentUri = fallbackUri;
|
|
@@ -1012,6 +1057,12 @@ function configureWebAvatar(
|
|
|
1012
1057
|
image.src = resolvedUri;
|
|
1013
1058
|
},
|
|
1014
1059
|
() => {
|
|
1060
|
+
if (source.fallbackUris !== undefined) {
|
|
1061
|
+
configureWebImageRetry(image, source, uri);
|
|
1062
|
+
const ImageEvent = image.ownerDocument.defaultView?.Event;
|
|
1063
|
+
if (ImageEvent) image.dispatchEvent(new ImageEvent('error'));
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1015
1066
|
const fallbackUri = source.fallbackUri
|
|
1016
1067
|
? safeImageUri(source.fallbackUri)
|
|
1017
1068
|
: undefined;
|
|
@@ -1144,6 +1195,118 @@ const selectorIcons: Readonly<
|
|
|
1144
1195
|
}>
|
|
1145
1196
|
>
|
|
1146
1197
|
> = {
|
|
1198
|
+
RefreshCcwOutline: {
|
|
1199
|
+
viewBox: '0 0 24 24',
|
|
1200
|
+
paths: [
|
|
1201
|
+
{
|
|
1202
|
+
d: 'M5 12a7 7 0 0 0 7 7 7.15 7.15 0 0 0 4.955-2h-2.943v-2h6v6h-2v-2.257A9.148 9.148 0 0 1 12 21a9 9 0 0 1-9-9v-1h2v1Zm1-6.754A9.148 9.148 0 0 1 12 3a9 9 0 0 1 9 9v1h-2v-1a7 7 0 0 0-7-7 7.15 7.15 0 0 0-4.955 2H10v2H4V3h2v2.246Z',
|
|
1203
|
+
fill: 'currentColor',
|
|
1204
|
+
fillRule: 'nonzero',
|
|
1205
|
+
opacity: 1,
|
|
1206
|
+
},
|
|
1207
|
+
],
|
|
1208
|
+
},
|
|
1209
|
+
DotVerSolid: {
|
|
1210
|
+
viewBox: '0 0 24 24',
|
|
1211
|
+
paths: [
|
|
1212
|
+
{
|
|
1213
|
+
d: 'M14 18v4h-4v-4zm0-4h-4v-4h4zm0-8h-4V2h4z',
|
|
1214
|
+
fill: 'currentColor',
|
|
1215
|
+
fillRule: 'nonzero',
|
|
1216
|
+
opacity: 1,
|
|
1217
|
+
},
|
|
1218
|
+
],
|
|
1219
|
+
},
|
|
1220
|
+
Document2Outline: {
|
|
1221
|
+
viewBox: '0 0 24 24',
|
|
1222
|
+
paths: [
|
|
1223
|
+
{
|
|
1224
|
+
d: 'M12 16H8v-2h4zm4-4H8v-2h8zm0-4H8V6h8z',
|
|
1225
|
+
fill: 'currentColor',
|
|
1226
|
+
fillRule: 'nonzero',
|
|
1227
|
+
opacity: 1,
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
d: 'M20 22H4V2h16zM6 20h12V4H6z',
|
|
1231
|
+
fill: 'currentColor',
|
|
1232
|
+
fillRule: 'evenodd',
|
|
1233
|
+
opacity: 1,
|
|
1234
|
+
},
|
|
1235
|
+
],
|
|
1236
|
+
},
|
|
1237
|
+
WalletOutline: {
|
|
1238
|
+
viewBox: '0 0 24 24',
|
|
1239
|
+
paths: [
|
|
1240
|
+
{
|
|
1241
|
+
d: 'M15.5 13.25a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5',
|
|
1242
|
+
fill: 'currentColor',
|
|
1243
|
+
fillRule: 'nonzero',
|
|
1244
|
+
opacity: 1,
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
d: 'M17 8h4v13H7a4 4 0 0 1-4-4V6.5A3.5 3.5 0 0 1 6.5 3H17zM5 17a2 2 0 0 0 2 2h12v-9H6.5c-.537 0-1.045-.12-1.5-.337zM6.5 5a1.5 1.5 0 1 0 0 3H15V5z',
|
|
1248
|
+
fill: 'currentColor',
|
|
1249
|
+
fillRule: 'evenodd',
|
|
1250
|
+
opacity: 1,
|
|
1251
|
+
},
|
|
1252
|
+
],
|
|
1253
|
+
},
|
|
1254
|
+
PlusLargeOutline: {
|
|
1255
|
+
viewBox: '0 0 24 24',
|
|
1256
|
+
paths: [
|
|
1257
|
+
{
|
|
1258
|
+
d: 'M13 11h8v2h-8v8h-2v-8H3v-2h8V3h2z',
|
|
1259
|
+
fill: 'currentColor',
|
|
1260
|
+
fillRule: 'nonzero',
|
|
1261
|
+
opacity: 1,
|
|
1262
|
+
},
|
|
1263
|
+
],
|
|
1264
|
+
},
|
|
1265
|
+
TicketOutline: {
|
|
1266
|
+
viewBox: '0 0 24 24',
|
|
1267
|
+
paths: [
|
|
1268
|
+
{
|
|
1269
|
+
d: 'M16 17.01h-2V15h2v2.01Zm0-4h-2V11h2v2.01Zm0-4h-2V7h2v2.01Z',
|
|
1270
|
+
fill: 'currentColor',
|
|
1271
|
+
fillRule: 'nonzero',
|
|
1272
|
+
opacity: 1,
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
d: 'm22 9.927-.629.252c-1.661.665-1.661 2.977 0 3.642l.629.252V20H2v-5.927l.629-.252c1.661-.665 1.661-2.977 0-3.642L2 9.927V4h20v5.927ZM4 8.636c2.5 1.52 2.499 5.207 0 6.727V18h16v-2.637c-2.499-1.52-2.5-5.208 0-6.727V6H4v2.636Z',
|
|
1276
|
+
fill: 'currentColor',
|
|
1277
|
+
fillRule: 'evenodd',
|
|
1278
|
+
opacity: 1,
|
|
1279
|
+
},
|
|
1280
|
+
],
|
|
1281
|
+
},
|
|
1282
|
+
GasSolid: {
|
|
1283
|
+
viewBox: '0 0 24 24',
|
|
1284
|
+
paths: [
|
|
1285
|
+
{
|
|
1286
|
+
d: 'M15 9h4v7h1V8.414L17.586 6 19 4.586l3 3V18h-5v-7h-2v8h1v2H2v-2h1V3h12zM6 9v2h6V9z',
|
|
1287
|
+
fill: 'currentColor',
|
|
1288
|
+
fillRule: 'evenodd',
|
|
1289
|
+
opacity: 1,
|
|
1290
|
+
},
|
|
1291
|
+
],
|
|
1292
|
+
},
|
|
1293
|
+
CryptoCoinOutline: {
|
|
1294
|
+
viewBox: '0 0 24 24',
|
|
1295
|
+
paths: [
|
|
1296
|
+
{
|
|
1297
|
+
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',
|
|
1298
|
+
fill: 'currentColor',
|
|
1299
|
+
fillRule: 'nonzero',
|
|
1300
|
+
opacity: 1,
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
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',
|
|
1304
|
+
fill: 'currentColor',
|
|
1305
|
+
fillRule: 'evenodd',
|
|
1306
|
+
opacity: 1,
|
|
1307
|
+
},
|
|
1308
|
+
],
|
|
1309
|
+
},
|
|
1147
1310
|
GlobusOutline: {
|
|
1148
1311
|
viewBox: '0 0 24 24',
|
|
1149
1312
|
paths: [
|
|
@@ -1426,6 +1589,7 @@ function applySelectorIcon(element: HTMLElement, name: string) {
|
|
|
1426
1589
|
|
|
1427
1590
|
function iconGlyph(name: string): string {
|
|
1428
1591
|
const normalized = name.toLocaleLowerCase();
|
|
1592
|
+
if (normalized === 'dotversolid') return '⋮';
|
|
1429
1593
|
if (normalized.includes('chevron')) {
|
|
1430
1594
|
if (normalized.includes('top')) return '⌃';
|
|
1431
1595
|
if (normalized.includes('bottom')) return '⌄';
|
|
@@ -1503,6 +1667,10 @@ function createVisual(
|
|
|
1503
1667
|
: visualBackground;
|
|
1504
1668
|
const fallbackIcon =
|
|
1505
1669
|
'fallbackIcon' in visual ? visual.fallbackIcon : undefined;
|
|
1670
|
+
const fallbackBackground =
|
|
1671
|
+
fallbackIcon?.backgroundColor ?? 'var(--nl-strong)';
|
|
1672
|
+
if (!source && fallbackIcon?.backgroundColor)
|
|
1673
|
+
frame.style.background = fallbackBackground;
|
|
1506
1674
|
const handlesSourceFallback =
|
|
1507
1675
|
showsSourcePlaceholder &&
|
|
1508
1676
|
(fallbackIcon !== undefined || 'fallbackText' in visual);
|
|
@@ -1518,6 +1686,28 @@ function createVisual(
|
|
|
1518
1686
|
if (image.complete && image.naturalWidth > 0) restoreBackground();
|
|
1519
1687
|
}
|
|
1520
1688
|
if (selectorPresentation) paintSelectorImageBackground(image, frame);
|
|
1689
|
+
if (
|
|
1690
|
+
source?.loadingStrategy === 'skeleton' &&
|
|
1691
|
+
!(image.complete && image.naturalWidth > 0)
|
|
1692
|
+
) {
|
|
1693
|
+
const skeleton = createElement(
|
|
1694
|
+
context.document,
|
|
1695
|
+
'span',
|
|
1696
|
+
'ok-native-list-image-skeleton'
|
|
1697
|
+
);
|
|
1698
|
+
const background = resolvedTheme(context.snapshot).background;
|
|
1699
|
+
const rgb = /^#([0-9a-f]{6})/i.exec(background)?.[1];
|
|
1700
|
+
if (rgb) {
|
|
1701
|
+
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
1702
|
+
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
1703
|
+
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
1704
|
+
if (red * 299 + green * 587 + blue * 114 < 128_000)
|
|
1705
|
+
skeleton.dataset.dark = 'true';
|
|
1706
|
+
}
|
|
1707
|
+
frame.appendChild(skeleton);
|
|
1708
|
+
image.addEventListener('load', () => skeleton.remove(), { once: true });
|
|
1709
|
+
image.addEventListener('error', () => skeleton.remove(), { once: true });
|
|
1710
|
+
}
|
|
1521
1711
|
} else if (!source || showsSourcePlaceholder) {
|
|
1522
1712
|
frame.appendChild(
|
|
1523
1713
|
createElement(
|
|
@@ -1572,11 +1762,29 @@ function createVisual(
|
|
|
1572
1762
|
? visual.fallbackText ?? ''
|
|
1573
1763
|
: ''
|
|
1574
1764
|
);
|
|
1765
|
+
if (
|
|
1766
|
+
'fallbackTextColor' in visual &&
|
|
1767
|
+
visual.fallbackTextColor &&
|
|
1768
|
+
!fallbackIcon
|
|
1769
|
+
)
|
|
1770
|
+
fallback.style.color = visual.fallbackTextColor;
|
|
1575
1771
|
if (fallbackIcon) {
|
|
1576
1772
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1577
1773
|
if (fallbackIcon.tintColor)
|
|
1578
1774
|
fallback.style.color = fallbackIcon.tintColor;
|
|
1775
|
+
if (fallbackIcon.size) {
|
|
1776
|
+
const svg = fallback.querySelector<SVGElement>('svg');
|
|
1777
|
+
if (svg) {
|
|
1778
|
+
svg.style.width = `${fallbackIcon.size}px`;
|
|
1779
|
+
svg.style.height = `${fallbackIcon.size}px`;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1579
1782
|
}
|
|
1783
|
+
if (fallbackIcon?.backgroundColor)
|
|
1784
|
+
frame.style.background = fallbackBackground;
|
|
1785
|
+
else
|
|
1786
|
+
fallback.style.backgroundColor =
|
|
1787
|
+
'var(--nl-image-fallback-background, transparent)';
|
|
1580
1788
|
frame.prepend(fallback);
|
|
1581
1789
|
};
|
|
1582
1790
|
if (image) image.addEventListener('error', showFallback, { once: true });
|
|
@@ -1586,6 +1794,9 @@ function createVisual(
|
|
|
1586
1794
|
frame.style.border =
|
|
1587
1795
|
'2px dashed ' + (visual.borderColor ?? 'var(--nl-disabled)');
|
|
1588
1796
|
frame.style.boxSizing = 'border-box';
|
|
1797
|
+
} else if ('borderColor' in visual && visual.borderColor) {
|
|
1798
|
+
frame.style.border = '1px solid ' + visual.borderColor;
|
|
1799
|
+
frame.style.boxSizing = 'border-box';
|
|
1589
1800
|
}
|
|
1590
1801
|
if ('overlays' in visual)
|
|
1591
1802
|
visual.overlays?.forEach((overlay) => {
|
|
@@ -1615,6 +1826,16 @@ function createVisual(
|
|
|
1615
1826
|
corner.style.lineHeight = '16px';
|
|
1616
1827
|
applyTextWeight(corner, '400');
|
|
1617
1828
|
}
|
|
1829
|
+
if (overlay.fontWeight)
|
|
1830
|
+
applyTextWeight(
|
|
1831
|
+
corner,
|
|
1832
|
+
{
|
|
1833
|
+
regular: 400,
|
|
1834
|
+
medium: 500,
|
|
1835
|
+
semibold: 600,
|
|
1836
|
+
bold: 700,
|
|
1837
|
+
}[overlay.fontWeight]
|
|
1838
|
+
);
|
|
1618
1839
|
if (
|
|
1619
1840
|
isWalletText ||
|
|
1620
1841
|
overlay.width !== undefined ||
|
|
@@ -1635,7 +1856,31 @@ function createVisual(
|
|
|
1635
1856
|
if (overlay.image) {
|
|
1636
1857
|
const overlayImage = createImage(context, overlay.image);
|
|
1637
1858
|
if (overlayImage) {
|
|
1859
|
+
if (
|
|
1860
|
+
(overlay.padding ?? 0) > 0 &&
|
|
1861
|
+
(overlay.width ?? size) === (overlay.height ?? size)
|
|
1862
|
+
)
|
|
1863
|
+
overlayImage.style.borderRadius = '50%';
|
|
1638
1864
|
corner.appendChild(overlayImage);
|
|
1865
|
+
if (overlay.fallbackIcon) {
|
|
1866
|
+
overlayImage.addEventListener(
|
|
1867
|
+
'error',
|
|
1868
|
+
() => {
|
|
1869
|
+
disposeWebImageRetries(overlayImage);
|
|
1870
|
+
overlayImage.remove();
|
|
1871
|
+
const glyph = createElement(
|
|
1872
|
+
context.document,
|
|
1873
|
+
'span',
|
|
1874
|
+
'ok-native-list-overlay-fallback'
|
|
1875
|
+
);
|
|
1876
|
+
applySelectorIcon(glyph, overlay.fallbackIcon!.name);
|
|
1877
|
+
if (overlay.fallbackIcon?.tintColor)
|
|
1878
|
+
glyph.style.color = overlay.fallbackIcon.tintColor;
|
|
1879
|
+
corner.appendChild(glyph);
|
|
1880
|
+
},
|
|
1881
|
+
{ once: true }
|
|
1882
|
+
);
|
|
1883
|
+
}
|
|
1639
1884
|
if (selectorPresentation)
|
|
1640
1885
|
paintSelectorImageBackground(
|
|
1641
1886
|
overlayImage,
|
|
@@ -1800,8 +2045,44 @@ function createAccessory(
|
|
|
1800
2045
|
context: RenderContext,
|
|
1801
2046
|
rowKey: string,
|
|
1802
2047
|
accessory: TrailingAccessory,
|
|
1803
|
-
slot: number
|
|
2048
|
+
slot: number,
|
|
2049
|
+
rowDisabled: boolean
|
|
1804
2050
|
): HTMLElement {
|
|
2051
|
+
if (accessory.kind === 'button') {
|
|
2052
|
+
const element = createElement(
|
|
2053
|
+
context.document,
|
|
2054
|
+
'button',
|
|
2055
|
+
'ok-native-list-trailing-button',
|
|
2056
|
+
accessory.label
|
|
2057
|
+
) as HTMLButtonElement;
|
|
2058
|
+
element.type = 'button';
|
|
2059
|
+
element.disabled = Boolean(rowDisabled || accessory.disabled);
|
|
2060
|
+
element.setAttribute('aria-disabled', String(element.disabled));
|
|
2061
|
+
element.setAttribute(
|
|
2062
|
+
'aria-label',
|
|
2063
|
+
accessory.accessibilityLabel ?? accessory.label
|
|
2064
|
+
);
|
|
2065
|
+
setData(element, 'testid', accessory.testID);
|
|
2066
|
+
setData(element, 'nativeListAction', accessory.actionKey);
|
|
2067
|
+
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
2068
|
+
if (accessory.textColor)
|
|
2069
|
+
element.style.setProperty('--nl-button-text', accessory.textColor);
|
|
2070
|
+
if (accessory.backgroundColor)
|
|
2071
|
+
element.style.setProperty('--nl-button-bg', accessory.backgroundColor);
|
|
2072
|
+
if (accessory.pressedBackgroundColor)
|
|
2073
|
+
element.style.setProperty(
|
|
2074
|
+
'--nl-button-pressed',
|
|
2075
|
+
accessory.pressedBackgroundColor
|
|
2076
|
+
);
|
|
2077
|
+
if (accessory.hoverBackgroundColor)
|
|
2078
|
+
element.style.setProperty(
|
|
2079
|
+
'--nl-button-hover',
|
|
2080
|
+
accessory.hoverBackgroundColor
|
|
2081
|
+
);
|
|
2082
|
+
if (accessory.focusRingColor)
|
|
2083
|
+
element.style.setProperty('--nl-button-focus', accessory.focusRingColor);
|
|
2084
|
+
return element;
|
|
2085
|
+
}
|
|
1805
2086
|
if (accessory.kind === 'checkbox') {
|
|
1806
2087
|
const element = createCheckbox(context, rowKey, accessory);
|
|
1807
2088
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
@@ -1816,9 +2097,21 @@ function createAccessory(
|
|
|
1816
2097
|
accessory.tintColor
|
|
1817
2098
|
);
|
|
1818
2099
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
2100
|
+
if (accessory.name === 'RefreshCcwOutline' && !accessory.actionKey) {
|
|
2101
|
+
element.classList.add('ok-native-list-decorative-refresh');
|
|
2102
|
+
const glyph = element.querySelector('svg');
|
|
2103
|
+
glyph?.setAttribute('width', '16');
|
|
2104
|
+
glyph?.setAttribute('height', '16');
|
|
2105
|
+
}
|
|
2106
|
+
if (accessory.buttonStyle === 'tertiary') {
|
|
2107
|
+
element.classList.add('ok-native-list-tertiary-icon');
|
|
2108
|
+
setData(element, 'nativeListAnchorInset', 7);
|
|
2109
|
+
}
|
|
1819
2110
|
setData(element, 'testid', accessory.testID);
|
|
1820
2111
|
if (accessory.hoverActionKey)
|
|
1821
2112
|
setData(element, 'nativeListHoverAction', accessory.hoverActionKey);
|
|
2113
|
+
if (accessory.hoverActionKey && accessory.buttonStyle === 'tertiary')
|
|
2114
|
+
setData(element, 'nativeListIconHelp', true);
|
|
1822
2115
|
if (accessory.accessibilityLabel)
|
|
1823
2116
|
element.setAttribute('aria-label', accessory.accessibilityLabel);
|
|
1824
2117
|
const row = context.snapshot.rows[context.itemIndex];
|
|
@@ -1866,6 +2159,25 @@ function createAccessory(
|
|
|
1866
2159
|
accessory.primary
|
|
1867
2160
|
);
|
|
1868
2161
|
primary.style.color = toneColor(accessory.primaryTone, 'primary');
|
|
2162
|
+
applyValueSegments(primary, accessory.primaryTextSegments, 16, 20, 500);
|
|
2163
|
+
if (accessory.primaryFontWeight === 'medium')
|
|
2164
|
+
applyTextWeight(primary, 500);
|
|
2165
|
+
if (accessory.primaryHelp) {
|
|
2166
|
+
const help = accessory.primaryHelp;
|
|
2167
|
+
primary.tabIndex = 0;
|
|
2168
|
+
primary.setAttribute('role', 'button');
|
|
2169
|
+
if (help.presentation === 'tooltip') {
|
|
2170
|
+
setData(primary, 'nativeListHoverAction', help.actionKey);
|
|
2171
|
+
setData(primary, 'nativeListIconHelp', true);
|
|
2172
|
+
} else {
|
|
2173
|
+
setData(primary, 'nativeListAction', help.actionKey);
|
|
2174
|
+
}
|
|
2175
|
+
if (help.underline === 'dashed') {
|
|
2176
|
+
primary.style.textDecoration = 'underline dashed';
|
|
2177
|
+
primary.style.textUnderlineOffset = '4px';
|
|
2178
|
+
}
|
|
2179
|
+
markActionAnchorSource(primary, 'trailingAccessory', slot);
|
|
2180
|
+
}
|
|
1869
2181
|
const secondary = createElement(
|
|
1870
2182
|
context.document,
|
|
1871
2183
|
'span',
|
|
@@ -1873,6 +2185,13 @@ function createAccessory(
|
|
|
1873
2185
|
accessory.secondary
|
|
1874
2186
|
);
|
|
1875
2187
|
secondary.style.color = toneColor(accessory.secondaryTone, 'secondary');
|
|
2188
|
+
applyValueSegments(
|
|
2189
|
+
secondary,
|
|
2190
|
+
accessory.secondaryTextSegments,
|
|
2191
|
+
14,
|
|
2192
|
+
20,
|
|
2193
|
+
400
|
|
2194
|
+
);
|
|
1876
2195
|
element.replaceChildren(primary, '\n', secondary);
|
|
1877
2196
|
element.classList.add('ok-native-list-amounts');
|
|
1878
2197
|
break;
|
|
@@ -1901,11 +2220,11 @@ function createAccessory(
|
|
|
1901
2220
|
return element;
|
|
1902
2221
|
}
|
|
1903
2222
|
|
|
1904
|
-
function rendererPrimitives(context: RenderContext) {
|
|
2223
|
+
function rendererPrimitives(context: RenderContext, rowDisabled: boolean) {
|
|
1905
2224
|
return {
|
|
1906
2225
|
background: resolvedTheme(context.snapshot).background,
|
|
1907
2226
|
accessory: (key: string, descriptor: TrailingAccessory, slot: number) =>
|
|
1908
|
-
createAccessory(context, key, descriptor, slot),
|
|
2227
|
+
createAccessory(context, key, descriptor, slot, rowDisabled),
|
|
1909
2228
|
visual: (source: LeadingVisual | undefined, presentation?: string) =>
|
|
1910
2229
|
createVisual(context, source, presentation),
|
|
1911
2230
|
thumbnail: (source: ImageSource) =>
|
|
@@ -1926,10 +2245,29 @@ export function createRowBody(
|
|
|
1926
2245
|
context: RenderContext,
|
|
1927
2246
|
row: RowModel
|
|
1928
2247
|
): HTMLElement {
|
|
1929
|
-
return rowRenderer(row).create(
|
|
2248
|
+
return rowRenderer(row).create(
|
|
2249
|
+
context.document,
|
|
2250
|
+
rendererPrimitives(context, Boolean(row.disabled))
|
|
2251
|
+
);
|
|
1930
2252
|
}
|
|
1931
2253
|
|
|
2254
|
+
export type NativeListWebScrollOptions = Readonly<{
|
|
2255
|
+
scrollHost?: HTMLElement;
|
|
2256
|
+
contentBounds?: HTMLElement;
|
|
2257
|
+
stickyInset?: number;
|
|
2258
|
+
ownsRefresh?: boolean;
|
|
2259
|
+
}>;
|
|
2260
|
+
|
|
1932
2261
|
export class NativeListWebEngine {
|
|
2262
|
+
private readonly externalScrollHost: HTMLElement | undefined;
|
|
2263
|
+
private readonly ownsRefresh: boolean;
|
|
2264
|
+
private readonly pullTarget: HTMLElement;
|
|
2265
|
+
private readonly contentBounds: HTMLElement | undefined;
|
|
2266
|
+
private externalStickyInset: number;
|
|
2267
|
+
private externalOrigin: number | undefined;
|
|
2268
|
+
private externalGeometryCache:
|
|
2269
|
+
| ReturnType<NativeListWebEngine['readExternalGeometry']>
|
|
2270
|
+
| undefined;
|
|
1933
2271
|
private readonly document: Document;
|
|
1934
2272
|
private readonly root: HTMLElement;
|
|
1935
2273
|
private readonly viewportFrame: HTMLElement;
|
|
@@ -1959,11 +2297,13 @@ export class NativeListWebEngine {
|
|
|
1959
2297
|
rail: [],
|
|
1960
2298
|
mediaTile: [],
|
|
1961
2299
|
action: [],
|
|
2300
|
+
buttonGroup: [],
|
|
1962
2301
|
system: [],
|
|
1963
2302
|
activity: [],
|
|
1964
2303
|
dataRow: [],
|
|
1965
2304
|
metricCard: [],
|
|
1966
2305
|
market: [],
|
|
2306
|
+
marketTable: [],
|
|
1967
2307
|
identity: [],
|
|
1968
2308
|
sectionHeader: [],
|
|
1969
2309
|
};
|
|
@@ -2001,6 +2341,7 @@ export class NativeListWebEngine {
|
|
|
2001
2341
|
private pullDistance = 0;
|
|
2002
2342
|
private virtualizationEnabled: boolean;
|
|
2003
2343
|
private actionAnchor: WebActionAnchorRecord | undefined;
|
|
2344
|
+
private pressedHelpElement: HTMLElement | undefined;
|
|
2004
2345
|
private readonly actionAnchorInstanceId = String(
|
|
2005
2346
|
++webNativeListInstanceCounter
|
|
2006
2347
|
);
|
|
@@ -2009,6 +2350,8 @@ export class NativeListWebEngine {
|
|
|
2009
2350
|
private marketPointer:
|
|
2010
2351
|
| Readonly<{
|
|
2011
2352
|
pointerId: number;
|
|
2353
|
+
pointerType: string;
|
|
2354
|
+
compact: boolean;
|
|
2012
2355
|
rowKey: string;
|
|
2013
2356
|
startX: number;
|
|
2014
2357
|
startY: number;
|
|
@@ -2019,6 +2362,39 @@ export class NativeListWebEngine {
|
|
|
2019
2362
|
private lastViewportWidth = -1;
|
|
2020
2363
|
private lastViewportHeight = -1;
|
|
2021
2364
|
private destroyed = false;
|
|
2365
|
+
private hasAppliedSnapshot = false;
|
|
2366
|
+
private lastStructuralTransitionId: string | undefined;
|
|
2367
|
+
private structuralFrame: number | undefined;
|
|
2368
|
+
private structuralFinish: number | undefined;
|
|
2369
|
+
private structuralRevision = 0;
|
|
2370
|
+
private structuralAnimations: Animation[] = [];
|
|
2371
|
+
private structuralScrollInterrupted = false;
|
|
2372
|
+
private structuralRenderedHeight: number | undefined;
|
|
2373
|
+
private structuralTargetHeight: number | undefined;
|
|
2374
|
+
private reactFooterHeight = 0;
|
|
2375
|
+
private structuralFooterCompensation = 0;
|
|
2376
|
+
private structuralFooterExpansion = 0;
|
|
2377
|
+
private structuralFooterFromHeight = 0;
|
|
2378
|
+
private structuralFooterElement: HTMLElement | undefined;
|
|
2379
|
+
private structuralFooterStyles:
|
|
2380
|
+
| { marginBottom: string; transform: string; clipPath: string }
|
|
2381
|
+
| undefined;
|
|
2382
|
+
private structuralProgress = 0;
|
|
2383
|
+
private structuralAnchorStyles:
|
|
2384
|
+
| { owner: string; content: string }
|
|
2385
|
+
| undefined;
|
|
2386
|
+
private structuralContentOverflow: string | undefined;
|
|
2387
|
+
private structuralPrefixTransition = false;
|
|
2388
|
+
private structuralTail:
|
|
2389
|
+
| {
|
|
2390
|
+
snapshot: NativeListSnapshot;
|
|
2391
|
+
rows: readonly RowModel[];
|
|
2392
|
+
layout: WebListLayout;
|
|
2393
|
+
firstIndex: number;
|
|
2394
|
+
layer: HTMLElement;
|
|
2395
|
+
mounted: Map<number, HTMLElement>;
|
|
2396
|
+
}
|
|
2397
|
+
| undefined;
|
|
2022
2398
|
private sectionIndexAlignStart = false;
|
|
2023
2399
|
// Renderers report intrinsic height after browser text wrapping.
|
|
2024
2400
|
private measuredRendererHeights = new Map<
|
|
@@ -2028,21 +2404,29 @@ export class NativeListWebEngine {
|
|
|
2028
2404
|
|
|
2029
2405
|
private notifyScrollCommandAccepted() {
|
|
2030
2406
|
if (this.destroyed) return;
|
|
2031
|
-
const
|
|
2407
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2408
|
+
const EventConstructor = owner.ownerDocument.defaultView?.Event;
|
|
2032
2409
|
if (EventConstructor)
|
|
2033
|
-
|
|
2410
|
+
owner.dispatchEvent(
|
|
2034
2411
|
new EventConstructor('ok-native-list-scroll-command-accepted')
|
|
2035
2412
|
);
|
|
2036
2413
|
}
|
|
2037
2414
|
|
|
2038
2415
|
private readonly handlePagerScrollCommandCancel = (event: Event) => {
|
|
2039
|
-
|
|
2416
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2417
|
+
if (this.destroyed || event.target !== owner) return;
|
|
2040
2418
|
this.pendingScroll = undefined;
|
|
2041
|
-
|
|
2042
|
-
left:
|
|
2043
|
-
top:
|
|
2419
|
+
const options: ScrollToOptions = {
|
|
2420
|
+
left: owner.scrollLeft,
|
|
2421
|
+
top: owner.scrollTop,
|
|
2044
2422
|
behavior: 'instant',
|
|
2045
|
-
}
|
|
2423
|
+
};
|
|
2424
|
+
if (this.externalScrollHost) {
|
|
2425
|
+
const scrollTo: (options: ScrollToOptions) => void =
|
|
2426
|
+
owner.ownerDocument.defaultView?.Element.prototype.scrollTo ??
|
|
2427
|
+
owner.scrollTo;
|
|
2428
|
+
scrollTo.call(owner, options);
|
|
2429
|
+
} else this.viewport.scrollTo(options);
|
|
2046
2430
|
};
|
|
2047
2431
|
|
|
2048
2432
|
constructor(
|
|
@@ -2051,10 +2435,35 @@ export class NativeListWebEngine {
|
|
|
2051
2435
|
callbacks: NativeListWebCallbacks,
|
|
2052
2436
|
virtualizationEnabled = true,
|
|
2053
2437
|
sectionIndexContainer?: HTMLElement | null,
|
|
2054
|
-
fontFamiliesJson = '{}'
|
|
2438
|
+
fontFamiliesJson = '{}',
|
|
2439
|
+
scrollOptions: NativeListWebScrollOptions = {}
|
|
2055
2440
|
) {
|
|
2441
|
+
if (
|
|
2442
|
+
scrollOptions.scrollHost &&
|
|
2443
|
+
(!(
|
|
2444
|
+
scrollOptions.scrollHost instanceof
|
|
2445
|
+
host.ownerDocument.defaultView!.HTMLElement
|
|
2446
|
+
) ||
|
|
2447
|
+
!scrollOptions.scrollHost.contains(host))
|
|
2448
|
+
)
|
|
2449
|
+
throw new Error(
|
|
2450
|
+
'webScrollHost must be an ancestor HTMLElement in the same document'
|
|
2451
|
+
);
|
|
2452
|
+
this.ownsRefresh = scrollOptions.ownsRefresh === true;
|
|
2453
|
+
if (
|
|
2454
|
+
scrollOptions.scrollHost &&
|
|
2455
|
+
snapshot.layout.orientation === 'horizontal'
|
|
2456
|
+
)
|
|
2457
|
+
throw new Error('External scrolling supports vertical lists only');
|
|
2458
|
+
this.externalScrollHost = scrollOptions.scrollHost;
|
|
2459
|
+
this.contentBounds = scrollOptions.contentBounds;
|
|
2460
|
+
this.externalStickyInset = this.validateStickyInset(
|
|
2461
|
+
scrollOptions.stickyInset
|
|
2462
|
+
);
|
|
2056
2463
|
this.document = host.ownerDocument;
|
|
2057
|
-
this.snapshot =
|
|
2464
|
+
this.snapshot =
|
|
2465
|
+
containNativeListInput(() => validateSnapshot(snapshot)) ??
|
|
2466
|
+
emptyNativeListSnapshot();
|
|
2058
2467
|
this.callbacks = callbacks;
|
|
2059
2468
|
this.virtualizationEnabled = virtualizationEnabled;
|
|
2060
2469
|
this.sectionIndexContainer = sectionIndexContainer ?? undefined;
|
|
@@ -2062,6 +2471,7 @@ export class NativeListWebEngine {
|
|
|
2062
2471
|
if (!host.style.position) host.style.position = 'relative';
|
|
2063
2472
|
|
|
2064
2473
|
this.root = createElement(this.document, 'div', 'ok-native-list-root');
|
|
2474
|
+
setData(this.root, 'nativeListParentScroll', !!this.externalScrollHost);
|
|
2065
2475
|
const style = this.document.createElement('style');
|
|
2066
2476
|
style.textContent = WEB_LIST_CSS;
|
|
2067
2477
|
this.viewportFrame = createElement(
|
|
@@ -2074,6 +2484,10 @@ export class NativeListWebEngine {
|
|
|
2074
2484
|
'div',
|
|
2075
2485
|
'ok-native-list-viewport'
|
|
2076
2486
|
);
|
|
2487
|
+
this.pullTarget =
|
|
2488
|
+
this.externalScrollHost && this.ownsRefresh
|
|
2489
|
+
? this.externalScrollHost
|
|
2490
|
+
: this.viewport;
|
|
2077
2491
|
this.viewport.setAttribute('role', 'list');
|
|
2078
2492
|
this.content = createElement(
|
|
2079
2493
|
this.document,
|
|
@@ -2120,25 +2534,65 @@ export class NativeListWebEngine {
|
|
|
2120
2534
|
);
|
|
2121
2535
|
this.root.append(style, this.viewportFrame, this.footer);
|
|
2122
2536
|
host.appendChild(this.root);
|
|
2537
|
+
if (this.externalScrollHost) {
|
|
2538
|
+
Object.assign(this.root.style, {
|
|
2539
|
+
position: 'relative',
|
|
2540
|
+
inset: 'auto',
|
|
2541
|
+
overflow: 'visible',
|
|
2542
|
+
flex: 'none',
|
|
2543
|
+
});
|
|
2544
|
+
Object.assign(this.viewportFrame.style, {
|
|
2545
|
+
overflow: 'visible',
|
|
2546
|
+
flex: 'none',
|
|
2547
|
+
});
|
|
2548
|
+
Object.assign(this.viewport.style, {
|
|
2549
|
+
position: 'relative',
|
|
2550
|
+
inset: 'auto',
|
|
2551
|
+
overflow: 'visible',
|
|
2552
|
+
scrollbarGutter: 'auto',
|
|
2553
|
+
});
|
|
2554
|
+
this.content.style.minHeight = '0';
|
|
2555
|
+
this.externalScrollHost.addEventListener(
|
|
2556
|
+
'scroll',
|
|
2557
|
+
this.handleExternalScroll,
|
|
2558
|
+
{
|
|
2559
|
+
passive: true,
|
|
2560
|
+
capture: true,
|
|
2561
|
+
}
|
|
2562
|
+
);
|
|
2563
|
+
}
|
|
2123
2564
|
|
|
2124
|
-
this.viewport.addEventListener(
|
|
2565
|
+
(this.externalScrollHost ?? this.viewport).addEventListener(
|
|
2125
2566
|
'ok-collapsible-pager-cancel-scroll-command',
|
|
2126
2567
|
this.handlePagerScrollCommandCancel
|
|
2127
2568
|
);
|
|
2569
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart'])
|
|
2570
|
+
(this.externalScrollHost ?? this.viewport).addEventListener(
|
|
2571
|
+
event,
|
|
2572
|
+
this.handleStructuralUserScroll,
|
|
2573
|
+
{ passive: true }
|
|
2574
|
+
);
|
|
2128
2575
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
2129
2576
|
passive: true,
|
|
2130
2577
|
});
|
|
2131
|
-
this.viewport.addEventListener(
|
|
2578
|
+
(this.externalScrollHost ?? this.viewport).addEventListener(
|
|
2132
2579
|
'ok-collapsible-pager-insets-changed',
|
|
2133
2580
|
this.handleCollapsiblePagerInsetsChanged
|
|
2134
2581
|
);
|
|
2135
2582
|
this.root.addEventListener('click', this.handleClick);
|
|
2583
|
+
this.root.addEventListener('contextmenu', this.handleMarketContextMenu);
|
|
2136
2584
|
this.root.addEventListener('pointerdown', this.handleMarketPointerDown);
|
|
2137
2585
|
this.root.addEventListener('pointermove', this.handleMarketPointerMove);
|
|
2586
|
+
this.root.addEventListener('touchmove', this.handleMarketTouchMove, {
|
|
2587
|
+
passive: true,
|
|
2588
|
+
});
|
|
2138
2589
|
this.root.addEventListener('pointerup', this.handleMarketPointerEnd);
|
|
2139
2590
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
2140
2591
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
2141
2592
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
2593
|
+
this.root.addEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
2594
|
+
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
2595
|
+
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
2142
2596
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
2143
2597
|
this.root.addEventListener('keydown', this.handleKeyDown);
|
|
2144
2598
|
this.viewport.addEventListener(
|
|
@@ -2174,14 +2628,14 @@ export class NativeListWebEngine {
|
|
|
2174
2628
|
this.handleIndexPointerEnd
|
|
2175
2629
|
);
|
|
2176
2630
|
this.indexRail.addEventListener('click', this.handleIndexClick);
|
|
2177
|
-
this.
|
|
2631
|
+
this.pullTarget.addEventListener('pointerdown', this.handlePullStart, {
|
|
2178
2632
|
passive: true,
|
|
2179
2633
|
});
|
|
2180
|
-
this.
|
|
2634
|
+
this.pullTarget.addEventListener('pointermove', this.handlePullMove, {
|
|
2181
2635
|
passive: false,
|
|
2182
2636
|
});
|
|
2183
|
-
this.
|
|
2184
|
-
this.
|
|
2637
|
+
this.pullTarget.addEventListener('pointerup', this.handlePullEnd);
|
|
2638
|
+
this.pullTarget.addEventListener('pointercancel', this.handlePullEnd);
|
|
2185
2639
|
|
|
2186
2640
|
const ResizeObserverConstructor = this.document.defaultView?.ResizeObserver;
|
|
2187
2641
|
if (ResizeObserverConstructor) {
|
|
@@ -2189,15 +2643,76 @@ export class NativeListWebEngine {
|
|
|
2189
2643
|
this.recomputeLayout()
|
|
2190
2644
|
);
|
|
2191
2645
|
this.resizeObserver.observe(this.viewport);
|
|
2646
|
+
if (this.externalScrollHost) {
|
|
2647
|
+
this.resizeObserver.observe(this.externalScrollHost);
|
|
2648
|
+
let ancestor: HTMLElement | null = host;
|
|
2649
|
+
while (ancestor && ancestor !== this.externalScrollHost) {
|
|
2650
|
+
this.resizeObserver.observe(ancestor);
|
|
2651
|
+
for (const sibling of ancestor.parentElement?.children ?? []) {
|
|
2652
|
+
if (sibling instanceof this.document.defaultView!.HTMLElement)
|
|
2653
|
+
this.resizeObserver.observe(sibling);
|
|
2654
|
+
}
|
|
2655
|
+
ancestor = ancestor.parentElement;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2192
2658
|
} else {
|
|
2193
2659
|
this.document.defaultView?.addEventListener(
|
|
2194
2660
|
'resize',
|
|
2195
2661
|
this.handleWindowResize
|
|
2196
2662
|
);
|
|
2197
2663
|
}
|
|
2664
|
+
this.document.fonts?.addEventListener(
|
|
2665
|
+
'loadingdone',
|
|
2666
|
+
this.handleWindowResize
|
|
2667
|
+
);
|
|
2198
2668
|
this.observeSectionIndexTransforms();
|
|
2199
2669
|
this.applyFontFamilies(fontFamiliesJson);
|
|
2200
|
-
this.
|
|
2670
|
+
this.applyValidatedSnapshot(this.snapshot);
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
private validateStickyInset(value = 0): number {
|
|
2674
|
+
if (!Number.isFinite(value) || value < 0)
|
|
2675
|
+
throw new Error('webStickyInset must be finite and non-negative');
|
|
2676
|
+
return value;
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
setStickyInset(value = 0) {
|
|
2680
|
+
const next = this.validateStickyInset(value);
|
|
2681
|
+
if (next === this.externalStickyInset) return;
|
|
2682
|
+
this.externalStickyInset = next;
|
|
2683
|
+
this.recomputeLayout();
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
private externalGeometry() {
|
|
2687
|
+
return (this.externalGeometryCache ??= this.readExternalGeometry());
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
private readExternalGeometry() {
|
|
2691
|
+
const host = this.externalScrollHost!;
|
|
2692
|
+
const hostRect = host.getBoundingClientRect();
|
|
2693
|
+
const bodyRect = this.viewport.getBoundingClientRect();
|
|
2694
|
+
const boundsRect = (
|
|
2695
|
+
this.contentBounds ?? this.root
|
|
2696
|
+
).getBoundingClientRect();
|
|
2697
|
+
const top = hostRect.top + host.clientTop + this.externalStickyInset;
|
|
2698
|
+
const bottom = hostRect.top + host.clientTop + host.clientHeight;
|
|
2699
|
+
return {
|
|
2700
|
+
origin: bodyRect.top - hostRect.top - host.clientTop + host.scrollTop,
|
|
2701
|
+
containerOrigin:
|
|
2702
|
+
boundsRect.top - hostRect.top - host.clientTop + host.scrollTop,
|
|
2703
|
+
end: boundsRect.bottom - hostRect.top - host.clientTop + host.scrollTop,
|
|
2704
|
+
top,
|
|
2705
|
+
bottom,
|
|
2706
|
+
offset: top - bodyRect.top,
|
|
2707
|
+
viewportLength: Math.max(0, bottom - top),
|
|
2708
|
+
visible:
|
|
2709
|
+
bodyRect.width > 0 &&
|
|
2710
|
+
bodyRect.right > hostRect.left &&
|
|
2711
|
+
bodyRect.left < hostRect.right &&
|
|
2712
|
+
host.clientHeight > 0 &&
|
|
2713
|
+
boundsRect.bottom > top &&
|
|
2714
|
+
boundsRect.top < bottom,
|
|
2715
|
+
};
|
|
2201
2716
|
}
|
|
2202
2717
|
|
|
2203
2718
|
private fontFamiliesJson = '{}';
|
|
@@ -2237,14 +2752,463 @@ export class NativeListWebEngine {
|
|
|
2237
2752
|
}
|
|
2238
2753
|
|
|
2239
2754
|
applySnapshot(snapshot: NativeListSnapshot) {
|
|
2240
|
-
const validated =
|
|
2755
|
+
const validated = containNativeListInput(() => {
|
|
2756
|
+
const next = validateSnapshot(snapshot);
|
|
2757
|
+
if (this.externalScrollHost && next.layout.orientation === 'horizontal')
|
|
2758
|
+
throw new Error('External scrolling supports vertical lists only');
|
|
2759
|
+
return next;
|
|
2760
|
+
});
|
|
2761
|
+
if (!validated) return;
|
|
2762
|
+
this.applyValidatedSnapshot(validated);
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
private applyValidatedSnapshot(validated: NativeListSnapshot) {
|
|
2766
|
+
this.pressedHelpElement = undefined;
|
|
2241
2767
|
this.invalidateActionAnchor('snapshot');
|
|
2242
|
-
|
|
2768
|
+
const transition = validated.structuralTransition;
|
|
2769
|
+
const isNewTransition =
|
|
2770
|
+
transition !== undefined &&
|
|
2771
|
+
transition.id !== this.lastStructuralTransitionId;
|
|
2772
|
+
if (transition) this.lastStructuralTransitionId = transition.id;
|
|
2773
|
+
const nextRows = effectiveRows(validated);
|
|
2774
|
+
const changedKeys =
|
|
2775
|
+
this.rows.length !== nextRows.length ||
|
|
2776
|
+
this.rows.some((row, index) => row.key !== nextRows[index]?.key);
|
|
2777
|
+
const incompatibleActivePrefix =
|
|
2778
|
+
this.structuralPrefixTransition &&
|
|
2779
|
+
(validated.layout.kind !== this.snapshot.layout.kind ||
|
|
2780
|
+
validated.layout.orientation !== this.snapshot.layout.orientation ||
|
|
2781
|
+
nextRows.some(
|
|
2782
|
+
(row, index) =>
|
|
2783
|
+
row.height !== this.rows[index]?.height ||
|
|
2784
|
+
row.style?.container?.height !==
|
|
2785
|
+
this.rows[index]?.style?.container?.height
|
|
2786
|
+
));
|
|
2787
|
+
const shouldAnimate =
|
|
2788
|
+
this.hasAppliedSnapshot &&
|
|
2789
|
+
isNewTransition &&
|
|
2790
|
+
changedKeys &&
|
|
2791
|
+
(this.snapshot.layout.kind === 'linear' ||
|
|
2792
|
+
this.snapshot.layout.kind === 'table') &&
|
|
2793
|
+
this.snapshot.layout.orientation !== 'horizontal' &&
|
|
2794
|
+
(validated.layout.kind === 'linear' ||
|
|
2795
|
+
validated.layout.kind === 'table') &&
|
|
2796
|
+
validated.layout.orientation !== 'horizontal' &&
|
|
2797
|
+
(transition?.durationMs ?? 220) > 0 &&
|
|
2798
|
+
!this.document.defaultView?.matchMedia?.(
|
|
2799
|
+
'(prefers-reduced-motion: reduce)'
|
|
2800
|
+
).matches;
|
|
2801
|
+
if (shouldAnimate && transition)
|
|
2802
|
+
this.applyStructuralSnapshot(validated, transition);
|
|
2803
|
+
else {
|
|
2804
|
+
if (isNewTransition || changedKeys || incompatibleActivePrefix)
|
|
2805
|
+
this.cancelStructuralAnimation();
|
|
2806
|
+
this.setSnapshot(validated);
|
|
2807
|
+
}
|
|
2808
|
+
this.hasAppliedSnapshot = true;
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
private cancelStructuralAnimation() {
|
|
2812
|
+
this.structuralRevision += 1;
|
|
2813
|
+
if (this.structuralFrame !== undefined)
|
|
2814
|
+
this.document.defaultView?.cancelAnimationFrame(this.structuralFrame);
|
|
2815
|
+
if (this.structuralFinish !== undefined)
|
|
2816
|
+
this.document.defaultView?.clearTimeout(this.structuralFinish);
|
|
2817
|
+
this.structuralFrame = undefined;
|
|
2818
|
+
this.structuralFinish = undefined;
|
|
2819
|
+
this.structuralAnimations.forEach((animation) => animation.cancel());
|
|
2820
|
+
this.structuralAnimations = [];
|
|
2821
|
+
if (this.structuralTail) {
|
|
2822
|
+
disposeWebImageRetries(this.structuralTail.layer);
|
|
2823
|
+
this.structuralTail.layer.remove();
|
|
2824
|
+
this.structuralTail = undefined;
|
|
2825
|
+
}
|
|
2826
|
+
if (this.structuralContentOverflow !== undefined) {
|
|
2827
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
2828
|
+
this.structuralContentOverflow = undefined;
|
|
2829
|
+
}
|
|
2830
|
+
this.structuralPrefixTransition = false;
|
|
2831
|
+
if (this.structuralFooterElement && this.structuralFooterStyles) {
|
|
2832
|
+
this.structuralFooterElement.style.marginBottom =
|
|
2833
|
+
this.structuralFooterStyles.marginBottom;
|
|
2834
|
+
this.structuralFooterElement.style.transform =
|
|
2835
|
+
this.structuralFooterStyles.transform;
|
|
2836
|
+
this.structuralFooterElement.style.clipPath =
|
|
2837
|
+
this.structuralFooterStyles.clipPath;
|
|
2838
|
+
}
|
|
2839
|
+
this.structuralFooterElement = undefined;
|
|
2840
|
+
this.structuralFooterStyles = undefined;
|
|
2841
|
+
this.structuralScrollInterrupted = false;
|
|
2842
|
+
this.structuralRenderedHeight = undefined;
|
|
2843
|
+
this.structuralTargetHeight = undefined;
|
|
2844
|
+
this.structuralFooterCompensation = 0;
|
|
2845
|
+
this.structuralFooterExpansion = 0;
|
|
2846
|
+
this.structuralProgress = 0;
|
|
2847
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2848
|
+
if (this.structuralAnchorStyles) {
|
|
2849
|
+
owner.style.overflowAnchor = this.structuralAnchorStyles.owner;
|
|
2850
|
+
this.content.style.overflowAnchor = this.structuralAnchorStyles.content;
|
|
2851
|
+
this.structuralAnchorStyles = undefined;
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
private handleStructuralUserScroll = (event: Event) => {
|
|
2856
|
+
if (
|
|
2857
|
+
event.type === 'pointerdown' &&
|
|
2858
|
+
event.target !== (this.externalScrollHost ?? this.viewport) &&
|
|
2859
|
+
(event as PointerEvent).pointerType !== 'touch'
|
|
2860
|
+
)
|
|
2861
|
+
return;
|
|
2862
|
+
this.structuralScrollInterrupted = true;
|
|
2863
|
+
if (this.structuralPrefixTransition) {
|
|
2864
|
+
this.cancelStructuralAnimation();
|
|
2865
|
+
this.recomputeLayout();
|
|
2866
|
+
}
|
|
2867
|
+
};
|
|
2868
|
+
|
|
2869
|
+
private updateStructuralTailWindow() {
|
|
2870
|
+
const tail = this.structuralTail;
|
|
2871
|
+
if (!tail) return;
|
|
2872
|
+
const visible = visibleWebLayoutItems(
|
|
2873
|
+
tail.layout,
|
|
2874
|
+
this.currentOffset(),
|
|
2875
|
+
this.viewportLength(),
|
|
2876
|
+
this.viewportLength() * OVERSCAN_VIEWPORTS
|
|
2877
|
+
).filter((item) => item.index >= tail.firstIndex);
|
|
2878
|
+
const desired = new Set(visible.map((item) => item.index));
|
|
2879
|
+
tail.mounted.forEach((element, index) => {
|
|
2880
|
+
if (desired.has(index)) return;
|
|
2881
|
+
disposeWebImageRetries(element);
|
|
2882
|
+
element.remove();
|
|
2883
|
+
tail.mounted.delete(index);
|
|
2884
|
+
});
|
|
2885
|
+
visible.forEach((item) => {
|
|
2886
|
+
if (tail.mounted.has(item.index)) return;
|
|
2887
|
+
const row = tail.rows[item.index];
|
|
2888
|
+
if (!row) return;
|
|
2889
|
+
const element = createElement(
|
|
2890
|
+
this.document,
|
|
2891
|
+
'div',
|
|
2892
|
+
'ok-native-list-item'
|
|
2893
|
+
);
|
|
2894
|
+
element.setAttribute('aria-hidden', 'true');
|
|
2895
|
+
element.style.pointerEvents = 'none';
|
|
2896
|
+
element.style.opacity = String(
|
|
2897
|
+
(row.style?.container?.opacity ?? row.opacity ?? 1) *
|
|
2898
|
+
(row.disabled ? 0.5 : 1)
|
|
2899
|
+
);
|
|
2900
|
+
const body = createRowBody(
|
|
2901
|
+
{
|
|
2902
|
+
document: this.document,
|
|
2903
|
+
snapshot: tail.snapshot,
|
|
2904
|
+
selectedKeys: selectionStateFromSnapshot(tail.snapshot).selectedKeys,
|
|
2905
|
+
itemIndex: item.index,
|
|
2906
|
+
},
|
|
2907
|
+
row
|
|
2908
|
+
);
|
|
2909
|
+
applyRowStyle(body, row);
|
|
2910
|
+
element.append(body);
|
|
2911
|
+
this.positionElement(element, item);
|
|
2912
|
+
tail.layer.append(element);
|
|
2913
|
+
tail.mounted.set(item.index, element);
|
|
2914
|
+
});
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
private writeStructuralHeight(height: number) {
|
|
2918
|
+
if (this.externalScrollHost) this.writeExternalHeight(height);
|
|
2919
|
+
else this.content.style.height = `${height}px`;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
private reactFooterElement() {
|
|
2923
|
+
return this.contentBounds?.querySelector<HTMLElement>(
|
|
2924
|
+
'[data-testid="native-list-footer-slot"]'
|
|
2925
|
+
);
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
private readReactFooterHeight() {
|
|
2929
|
+
return this.reactFooterElement()?.getBoundingClientRect().height ?? 0;
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
private applyStructuralFooterVisual(progress: number) {
|
|
2933
|
+
const footer = this.structuralFooterElement;
|
|
2934
|
+
if (!footer || this.structuralFooterExpansion <= 0) return;
|
|
2935
|
+
const hidden = this.structuralFooterExpansion * (1 - progress);
|
|
2936
|
+
footer.style.marginBottom = `${-hidden}px`;
|
|
2937
|
+
footer.style.transform = `translateY(${-hidden}px)`;
|
|
2938
|
+
footer.style.clipPath = `inset(${hidden}px 0 0 0)`;
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
private applyStructuralSnapshot(
|
|
2942
|
+
next: NativeListSnapshot,
|
|
2943
|
+
transition: NonNullable<NativeListSnapshot['structuralTransition']>
|
|
2944
|
+
) {
|
|
2945
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2946
|
+
const oldOffset = owner.scrollTop;
|
|
2947
|
+
const oldScrollHeight = owner.scrollHeight;
|
|
2948
|
+
const oldHeight =
|
|
2949
|
+
this.structuralRenderedHeight ??
|
|
2950
|
+
(this.content.getBoundingClientRect().height ||
|
|
2951
|
+
this.layout.contentHeight);
|
|
2952
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
2953
|
+
const oldFooterHeight =
|
|
2954
|
+
this.structuralRenderedHeight === undefined
|
|
2955
|
+
? this.reactFooterHeight
|
|
2956
|
+
: this.structuralFooterFromHeight +
|
|
2957
|
+
(this.reactFooterHeight - this.structuralFooterFromHeight) *
|
|
2958
|
+
this.structuralProgress;
|
|
2959
|
+
const footerDifference = oldFooterHeight - nextFooterHeight;
|
|
2960
|
+
const startHeight = oldHeight + Math.max(0, footerDifference);
|
|
2961
|
+
const oldSnapshot = this.snapshot;
|
|
2962
|
+
const oldRows = this.rows;
|
|
2963
|
+
const oldLayout = this.layout;
|
|
2964
|
+
const oldItems = oldLayout.items;
|
|
2965
|
+
const nextRows = effectiveRows(next);
|
|
2966
|
+
const prefixCount = Math.min(oldRows.length, nextRows.length);
|
|
2967
|
+
const prefixTailChange =
|
|
2968
|
+
oldSnapshot.layout.kind === next.layout.kind &&
|
|
2969
|
+
oldSnapshot.layout.orientation === next.layout.orientation &&
|
|
2970
|
+
oldRows.length !== nextRows.length &&
|
|
2971
|
+
oldRows
|
|
2972
|
+
.slice(0, prefixCount)
|
|
2973
|
+
.every((row, index) => row.key === nextRows[index]?.key);
|
|
2974
|
+
const oldPositions = new Map<string, number>();
|
|
2975
|
+
this.mounted.forEach((element, index) => {
|
|
2976
|
+
const row = this.rows[index];
|
|
2977
|
+
if (row) oldPositions.set(row.key, element.getBoundingClientRect().top);
|
|
2978
|
+
});
|
|
2979
|
+
const nextKeys = new Set(effectiveRows(next).map((row) => row.key));
|
|
2980
|
+
const visibleOffset = this.currentOffset();
|
|
2981
|
+
const visibleSurvivor = oldItems.find(
|
|
2982
|
+
(item) => item.y + item.height > visibleOffset && nextKeys.has(item.key)
|
|
2983
|
+
);
|
|
2984
|
+
const anchor = visibleSurvivor;
|
|
2985
|
+
this.cancelStructuralAnimation();
|
|
2986
|
+
this.structuralScrollInterrupted = false;
|
|
2987
|
+
this.structuralAnchorStyles = {
|
|
2988
|
+
owner: owner.style.overflowAnchor,
|
|
2989
|
+
content: this.content.style.overflowAnchor,
|
|
2990
|
+
};
|
|
2991
|
+
owner.style.overflowAnchor = 'none';
|
|
2992
|
+
this.content.style.overflowAnchor = 'none';
|
|
2993
|
+
this.structuralContentOverflow = this.content.style.overflow;
|
|
2994
|
+
if (prefixTailChange) this.content.style.overflow = 'clip';
|
|
2995
|
+
this.structuralRenderedHeight = startHeight;
|
|
2996
|
+
this.structuralFooterFromHeight = oldFooterHeight;
|
|
2997
|
+
this.structuralFooterCompensation = Math.max(0, footerDifference);
|
|
2998
|
+
this.structuralFooterExpansion = Math.max(0, -footerDifference);
|
|
2999
|
+
this.structuralProgress = 0;
|
|
3000
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
3001
|
+
this.structuralFooterElement = this.reactFooterElement() ?? undefined;
|
|
3002
|
+
if (this.structuralFooterElement) {
|
|
3003
|
+
const style = this.structuralFooterElement.style;
|
|
3004
|
+
this.structuralFooterStyles = {
|
|
3005
|
+
marginBottom: style.marginBottom,
|
|
3006
|
+
transform: style.transform,
|
|
3007
|
+
clipPath: style.clipPath,
|
|
3008
|
+
};
|
|
3009
|
+
this.applyStructuralFooterVisual(0);
|
|
3010
|
+
}
|
|
3011
|
+
this.setSnapshot(next);
|
|
3012
|
+
const newHeight = this.layout.contentHeight;
|
|
3013
|
+
this.structuralTargetHeight = newHeight;
|
|
3014
|
+
const stablePrefixGeometry =
|
|
3015
|
+
prefixTailChange &&
|
|
3016
|
+
oldItems.length === oldRows.length &&
|
|
3017
|
+
this.layout.items.length === nextRows.length &&
|
|
3018
|
+
oldItems.slice(0, prefixCount).every((item, index) => {
|
|
3019
|
+
const nextItem = this.layout.items[index];
|
|
3020
|
+
return (
|
|
3021
|
+
nextItem?.y === item.y &&
|
|
3022
|
+
nextItem?.height === item.height &&
|
|
3023
|
+
nextItem?.width === item.width
|
|
3024
|
+
);
|
|
3025
|
+
});
|
|
3026
|
+
if (!stablePrefixGeometry) {
|
|
3027
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
3028
|
+
this.structuralContentOverflow = undefined;
|
|
3029
|
+
} else {
|
|
3030
|
+
this.structuralPrefixTransition = true;
|
|
3031
|
+
}
|
|
3032
|
+
if (stablePrefixGeometry && nextRows.length < oldRows.length) {
|
|
3033
|
+
const layer = createElement(
|
|
3034
|
+
this.document,
|
|
3035
|
+
'div',
|
|
3036
|
+
'ok-native-list-structural-tail'
|
|
3037
|
+
);
|
|
3038
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
3039
|
+
layer.setAttribute('inert', '');
|
|
3040
|
+
Object.assign(layer.style, {
|
|
3041
|
+
position: 'absolute',
|
|
3042
|
+
inset: '0',
|
|
3043
|
+
pointerEvents: 'none',
|
|
3044
|
+
});
|
|
3045
|
+
this.content.append(layer);
|
|
3046
|
+
this.structuralTail = {
|
|
3047
|
+
snapshot: oldSnapshot,
|
|
3048
|
+
rows: oldRows,
|
|
3049
|
+
layout: oldLayout,
|
|
3050
|
+
firstIndex: prefixCount,
|
|
3051
|
+
layer,
|
|
3052
|
+
mounted: new Map(),
|
|
3053
|
+
};
|
|
3054
|
+
this.updateStructuralTailWindow();
|
|
3055
|
+
}
|
|
3056
|
+
const nextAnchor =
|
|
3057
|
+
anchor && this.layout.items.find((item) => item.key === anchor.key);
|
|
3058
|
+
const delta = nextAnchor && anchor ? nextAnchor.y - anchor.y : 0;
|
|
3059
|
+
let finalScrollHeight = oldScrollHeight + newHeight - oldHeight;
|
|
3060
|
+
if (stablePrefixGeometry && this.externalScrollHost) {
|
|
3061
|
+
const beforeMeasure = owner.scrollTop;
|
|
3062
|
+
const tailLayer = this.structuralTail?.layer;
|
|
3063
|
+
if (tailLayer) tailLayer.style.display = 'none';
|
|
3064
|
+
this.writeStructuralHeight(newHeight);
|
|
3065
|
+
this.applyStructuralFooterVisual(1);
|
|
3066
|
+
finalScrollHeight = owner.scrollHeight;
|
|
3067
|
+
this.writeStructuralHeight(startHeight);
|
|
3068
|
+
this.applyStructuralFooterVisual(0);
|
|
3069
|
+
if (tailLayer) tailLayer.style.display = '';
|
|
3070
|
+
owner.scrollTop = beforeMeasure;
|
|
3071
|
+
}
|
|
3072
|
+
const finalMaxOffset = Math.max(0, finalScrollHeight - owner.clientHeight);
|
|
3073
|
+
let targetOffset = Math.max(0, Math.min(oldOffset + delta, finalMaxOffset));
|
|
3074
|
+
if (
|
|
3075
|
+
!visibleSurvivor &&
|
|
3076
|
+
transition.anchorKey &&
|
|
3077
|
+
!(stablePrefixGeometry && nextRows.length > oldRows.length)
|
|
3078
|
+
) {
|
|
3079
|
+
const fallback = this.layout.items.find(
|
|
3080
|
+
(item) => item.key === transition.anchorKey
|
|
3081
|
+
);
|
|
3082
|
+
if (fallback) {
|
|
3083
|
+
const pagerStickyInset = Number.parseFloat(
|
|
3084
|
+
this.externalScrollHost?.style.getPropertyValue(
|
|
3085
|
+
'--ok-collapsible-pager-sticky-inset'
|
|
3086
|
+
) ?? ''
|
|
3087
|
+
);
|
|
3088
|
+
const effectiveStickyInset = Math.max(
|
|
3089
|
+
this.externalStickyInset,
|
|
3090
|
+
Number.isFinite(pagerStickyInset) ? pagerStickyInset : 0
|
|
3091
|
+
);
|
|
3092
|
+
const fallbackTop = this.externalScrollHost
|
|
3093
|
+
? this.externalGeometry().origin + fallback.y - effectiveStickyInset
|
|
3094
|
+
: resolveWebCollapsiblePagerRawOffset(
|
|
3095
|
+
Math.max(0, fallback.y - this.collapsiblePagerInsets().sticky),
|
|
3096
|
+
this.collapsiblePagerInsets().header
|
|
3097
|
+
);
|
|
3098
|
+
if (
|
|
3099
|
+
stablePrefixGeometry &&
|
|
3100
|
+
this.externalScrollHost &&
|
|
3101
|
+
this.reactFooterHeight > 0
|
|
3102
|
+
) {
|
|
3103
|
+
const footerTop = this.externalGeometry().origin + newHeight;
|
|
3104
|
+
const footerStart = Math.max(
|
|
3105
|
+
0,
|
|
3106
|
+
footerTop + this.reactFooterHeight - owner.clientHeight
|
|
3107
|
+
);
|
|
3108
|
+
const footerEnd = Math.max(0, footerTop - effectiveStickyInset);
|
|
3109
|
+
const nearestVisibleOffset =
|
|
3110
|
+
footerStart <= footerEnd
|
|
3111
|
+
? Math.max(footerStart, Math.min(oldOffset, footerEnd))
|
|
3112
|
+
: footerEnd;
|
|
3113
|
+
targetOffset = Math.max(
|
|
3114
|
+
0,
|
|
3115
|
+
Math.min(nearestVisibleOffset, finalMaxOffset)
|
|
3116
|
+
);
|
|
3117
|
+
} else {
|
|
3118
|
+
targetOffset = Math.min(targetOffset, Math.max(0, fallbackTop));
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
const duration = transition.durationMs ?? 220;
|
|
3123
|
+
const easing = 'cubic-bezier(0.42, 0, 0.58, 1)';
|
|
3124
|
+
this.mounted.forEach((element, index) => {
|
|
3125
|
+
const row = this.rows[index];
|
|
3126
|
+
const previousTop = row && oldPositions.get(row.key);
|
|
3127
|
+
if (previousTop === undefined || typeof element.animate !== 'function')
|
|
3128
|
+
return;
|
|
3129
|
+
const offset = previousTop - element.getBoundingClientRect().top;
|
|
3130
|
+
if (Math.abs(offset) < 0.5) return;
|
|
3131
|
+
this.structuralAnimations.push(
|
|
3132
|
+
element.animate(
|
|
3133
|
+
[
|
|
3134
|
+
{ transform: `translateY(${offset}px)` },
|
|
3135
|
+
{ transform: 'translateY(0)' },
|
|
3136
|
+
],
|
|
3137
|
+
{ duration, easing }
|
|
3138
|
+
)
|
|
3139
|
+
);
|
|
3140
|
+
});
|
|
3141
|
+
const startedAt =
|
|
3142
|
+
this.document.defaultView?.performance.now() ?? Date.now();
|
|
3143
|
+
const revision = this.structuralRevision;
|
|
3144
|
+
const finish = () => {
|
|
3145
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
3146
|
+
const ownsScroll = !this.structuralScrollInterrupted;
|
|
3147
|
+
this.cancelStructuralAnimation();
|
|
3148
|
+
this.recomputeLayout();
|
|
3149
|
+
if (stablePrefixGeometry && ownsScroll) {
|
|
3150
|
+
owner.scrollTop = Math.max(
|
|
3151
|
+
0,
|
|
3152
|
+
Math.min(targetOffset, owner.scrollHeight - owner.clientHeight)
|
|
3153
|
+
);
|
|
3154
|
+
}
|
|
3155
|
+
};
|
|
3156
|
+
const step = (time: number) => {
|
|
3157
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
3158
|
+
if (
|
|
3159
|
+
this.structuralPrefixTransition &&
|
|
3160
|
+
this.document.defaultView?.matchMedia?.(
|
|
3161
|
+
'(prefers-reduced-motion: reduce)'
|
|
3162
|
+
).matches
|
|
3163
|
+
) {
|
|
3164
|
+
finish();
|
|
3165
|
+
return;
|
|
3166
|
+
}
|
|
3167
|
+
const progress = Math.min(1, (time - startedAt) / duration);
|
|
3168
|
+
const eased = progress * progress * (3 - 2 * progress);
|
|
3169
|
+
this.structuralProgress = eased;
|
|
3170
|
+
const renderedHeight =
|
|
3171
|
+
oldHeight +
|
|
3172
|
+
((this.structuralTargetHeight ?? newHeight) - oldHeight) * eased +
|
|
3173
|
+
this.structuralFooterCompensation * (1 - eased);
|
|
3174
|
+
this.structuralRenderedHeight = renderedHeight;
|
|
3175
|
+
this.writeStructuralHeight(renderedHeight);
|
|
3176
|
+
this.applyStructuralFooterVisual(eased);
|
|
3177
|
+
if (!this.structuralScrollInterrupted)
|
|
3178
|
+
owner.scrollTop = oldOffset + (targetOffset - oldOffset) * eased;
|
|
3179
|
+
this.externalGeometryCache = undefined;
|
|
3180
|
+
this.updateStructuralTailWindow();
|
|
3181
|
+
if (progress < 1)
|
|
3182
|
+
this.structuralFrame =
|
|
3183
|
+
this.document.defaultView?.requestAnimationFrame(step);
|
|
3184
|
+
};
|
|
3185
|
+
this.structuralFrame =
|
|
3186
|
+
this.document.defaultView?.requestAnimationFrame(step);
|
|
3187
|
+
this.structuralFinish = this.document.defaultView?.setTimeout(
|
|
3188
|
+
finish,
|
|
3189
|
+
duration + 40
|
|
3190
|
+
);
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
currentContentHeight(): number {
|
|
3194
|
+
return this.layout.contentHeight;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
currentSnapshot(): NativeListSnapshot {
|
|
3198
|
+
return this.snapshot;
|
|
2243
3199
|
}
|
|
2244
3200
|
|
|
2245
3201
|
applyPatches(patches: readonly RowPatch[]) {
|
|
2246
|
-
|
|
2247
|
-
|
|
3202
|
+
const accepted = containNativeListInput(() => {
|
|
3203
|
+
const normalized = validatePatches(patches);
|
|
3204
|
+
return {
|
|
3205
|
+
patches: normalized,
|
|
3206
|
+
snapshot: applyRowPatches(this.snapshot, normalized),
|
|
3207
|
+
};
|
|
3208
|
+
});
|
|
3209
|
+
if (!accepted || accepted.patches.length === 0) return;
|
|
3210
|
+
patches = accepted.patches;
|
|
3211
|
+
const next = accepted.snapshot;
|
|
2248
3212
|
const selection = new Set(this.selectedKeys);
|
|
2249
3213
|
patches.forEach((patch) => {
|
|
2250
3214
|
const selected =
|
|
@@ -2252,7 +3216,21 @@ export class NativeListWebEngine {
|
|
|
2252
3216
|
if (selected === true) selection.add(patch.key);
|
|
2253
3217
|
else if (selected === false) selection.delete(patch.key);
|
|
2254
3218
|
});
|
|
2255
|
-
|
|
3219
|
+
const tableValuesOnly = patches.every((patch) => {
|
|
3220
|
+
const index = this.rows.findIndex((row) => row.key === patch.key);
|
|
3221
|
+
const before = this.rows[index],
|
|
3222
|
+
after = next.rows[index];
|
|
3223
|
+
return (
|
|
3224
|
+
patch.type === 'market' &&
|
|
3225
|
+
before?.type === 'market' &&
|
|
3226
|
+
after?.type === 'market' &&
|
|
3227
|
+
Object.keys(patch.changes).every(
|
|
3228
|
+
(key) => MARKET_QUOTE_PATCH_FIELDS.has(key) || key === 'webTable'
|
|
3229
|
+
) &&
|
|
3230
|
+
canPatchMarketTableValues(before, after)
|
|
3231
|
+
);
|
|
3232
|
+
});
|
|
3233
|
+
if (webMarketImageBindDeltaForPatches(patches) === 0 || tableValuesOnly) {
|
|
2256
3234
|
this.snapshot = next;
|
|
2257
3235
|
this.rows = effectiveRows(next);
|
|
2258
3236
|
this.selectedKeys = selection;
|
|
@@ -2261,14 +3239,16 @@ export class NativeListWebEngine {
|
|
|
2261
3239
|
const row = this.rows[index];
|
|
2262
3240
|
const element = this.mounted.get(index);
|
|
2263
3241
|
if (row?.type === 'market' && element) {
|
|
2264
|
-
|
|
3242
|
+
if (row.webTable) updateMarketTableValues(element, row);
|
|
3243
|
+
else setMarketQuoteContent(element, row);
|
|
2265
3244
|
element.dataset.renderSignature = webRowRenderSignature(row);
|
|
2266
3245
|
}
|
|
2267
3246
|
if (
|
|
2268
3247
|
row?.type === 'market' &&
|
|
2269
3248
|
this.sticky.dataset.nativeListRowKey === row.key
|
|
2270
3249
|
) {
|
|
2271
|
-
|
|
3250
|
+
if (row.webTable) updateMarketTableValues(this.sticky, row);
|
|
3251
|
+
else setMarketQuoteContent(this.sticky, row);
|
|
2272
3252
|
this.sticky.dataset.renderSignature = webRowRenderSignature(row);
|
|
2273
3253
|
}
|
|
2274
3254
|
});
|
|
@@ -2332,7 +3312,10 @@ export class NativeListWebEngine {
|
|
|
2332
3312
|
this.pendingScroll = { kind: 'offset', offset, animated };
|
|
2333
3313
|
return;
|
|
2334
3314
|
}
|
|
2335
|
-
this.
|
|
3315
|
+
if (this.externalScrollHost) {
|
|
3316
|
+
const geometry = this.externalGeometry();
|
|
3317
|
+
this.writeExternalOffset(geometry.containerOrigin + offset, animated);
|
|
3318
|
+
} else this.scrollToAbsoluteOffset(offset, animated);
|
|
2336
3319
|
}
|
|
2337
3320
|
|
|
2338
3321
|
scrollToEnd(animated: boolean) {
|
|
@@ -2341,10 +3324,17 @@ export class NativeListWebEngine {
|
|
|
2341
3324
|
this.pendingScroll = { kind: 'end', animated };
|
|
2342
3325
|
return;
|
|
2343
3326
|
}
|
|
2344
|
-
this.
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
3327
|
+
if (this.externalScrollHost) {
|
|
3328
|
+
const geometry = this.externalGeometry();
|
|
3329
|
+
this.writeExternalOffset(
|
|
3330
|
+
geometry.end - this.externalScrollHost.clientHeight,
|
|
3331
|
+
animated
|
|
3332
|
+
);
|
|
3333
|
+
} else
|
|
3334
|
+
this.scrollToAbsoluteOffset(
|
|
3335
|
+
Math.max(0, this.contentLength() - this.viewportLength()),
|
|
3336
|
+
animated
|
|
3337
|
+
);
|
|
2348
3338
|
}
|
|
2349
3339
|
|
|
2350
3340
|
scrollToLocation(
|
|
@@ -2402,6 +3392,8 @@ export class NativeListWebEngine {
|
|
|
2402
3392
|
|
|
2403
3393
|
destroy() {
|
|
2404
3394
|
if (this.destroyed) return;
|
|
3395
|
+
this.cancelStructuralAnimation();
|
|
3396
|
+
this.pressedHelpElement = undefined;
|
|
2405
3397
|
this.invalidateActionAnchor('destroy');
|
|
2406
3398
|
this.destroyed = true;
|
|
2407
3399
|
if (this.frameHandle !== undefined) this.cancelFrame(this.frameHandle);
|
|
@@ -2410,28 +3402,50 @@ export class NativeListWebEngine {
|
|
|
2410
3402
|
if (this.reorderMovementTimer !== undefined)
|
|
2411
3403
|
this.document.defaultView?.clearTimeout(this.reorderMovementTimer);
|
|
2412
3404
|
this.resizeObserver?.disconnect();
|
|
3405
|
+
this.externalScrollHost?.removeEventListener(
|
|
3406
|
+
'scroll',
|
|
3407
|
+
this.handleExternalScroll,
|
|
3408
|
+
true
|
|
3409
|
+
);
|
|
3410
|
+
this.document.fonts?.removeEventListener(
|
|
3411
|
+
'loadingdone',
|
|
3412
|
+
this.handleWindowResize
|
|
3413
|
+
);
|
|
2413
3414
|
this.sectionIndexTransformObserver?.disconnect();
|
|
2414
3415
|
this.document.defaultView?.removeEventListener(
|
|
2415
3416
|
'resize',
|
|
2416
3417
|
this.handleWindowResize
|
|
2417
3418
|
);
|
|
2418
3419
|
this.pendingScroll = undefined;
|
|
2419
|
-
this.viewport.removeEventListener(
|
|
3420
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
2420
3421
|
'ok-collapsible-pager-cancel-scroll-command',
|
|
2421
3422
|
this.handlePagerScrollCommandCancel
|
|
2422
3423
|
);
|
|
3424
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart'])
|
|
3425
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
3426
|
+
event,
|
|
3427
|
+
this.handleStructuralUserScroll
|
|
3428
|
+
);
|
|
2423
3429
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
2424
|
-
this.viewport.removeEventListener(
|
|
3430
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
2425
3431
|
'ok-collapsible-pager-insets-changed',
|
|
2426
3432
|
this.handleCollapsiblePagerInsetsChanged
|
|
2427
3433
|
);
|
|
2428
3434
|
this.root.removeEventListener('click', this.handleClick);
|
|
3435
|
+
this.root.removeEventListener('contextmenu', this.handleMarketContextMenu);
|
|
2429
3436
|
this.cancelMarketPointer();
|
|
2430
3437
|
this.root.removeEventListener('pointerdown', this.handleMarketPointerDown);
|
|
2431
3438
|
this.root.removeEventListener('pointermove', this.handleMarketPointerMove);
|
|
3439
|
+
this.root.removeEventListener('touchmove', this.handleMarketTouchMove);
|
|
2432
3440
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
2433
3441
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
2434
3442
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
3443
|
+
this.root.removeEventListener(
|
|
3444
|
+
'pointerdown',
|
|
3445
|
+
this.handleIconHelpPointerDown
|
|
3446
|
+
);
|
|
3447
|
+
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
3448
|
+
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
2435
3449
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
2436
3450
|
this.root.removeEventListener('keydown', this.handleKeyDown);
|
|
2437
3451
|
this.cancelPointerReorder(true);
|
|
@@ -2465,10 +3479,10 @@ export class NativeListWebEngine {
|
|
|
2465
3479
|
this.handleIndexPointerEnd
|
|
2466
3480
|
);
|
|
2467
3481
|
this.indexRail.removeEventListener('click', this.handleIndexClick);
|
|
2468
|
-
this.
|
|
2469
|
-
this.
|
|
2470
|
-
this.
|
|
2471
|
-
this.
|
|
3482
|
+
this.pullTarget.removeEventListener('pointerdown', this.handlePullStart);
|
|
3483
|
+
this.pullTarget.removeEventListener('pointermove', this.handlePullMove);
|
|
3484
|
+
this.pullTarget.removeEventListener('pointerup', this.handlePullEnd);
|
|
3485
|
+
this.pullTarget.removeEventListener('pointercancel', this.handlePullEnd);
|
|
2472
3486
|
const host = this.root.parentElement;
|
|
2473
3487
|
disposeWebImageRetries(this.root);
|
|
2474
3488
|
Object.values(this.pool).forEach((elements) =>
|
|
@@ -2492,6 +3506,7 @@ export class NativeListWebEngine {
|
|
|
2492
3506
|
selectedKeys?: ReadonlySet<string>
|
|
2493
3507
|
) {
|
|
2494
3508
|
this.cancelMarketPointer();
|
|
3509
|
+
this.pressedHelpElement = undefined;
|
|
2495
3510
|
this.measuredRendererHeights.clear();
|
|
2496
3511
|
this.snapshot = snapshot;
|
|
2497
3512
|
this.rows = effectiveRows(snapshot);
|
|
@@ -2512,8 +3527,11 @@ export class NativeListWebEngine {
|
|
|
2512
3527
|
'--nl-row': theme.rowBackground,
|
|
2513
3528
|
'--nl-selected': theme.rowSelectedBackground,
|
|
2514
3529
|
'--nl-pressed': theme.rowPressedBackground,
|
|
3530
|
+
'--nl-hover': theme.rowHoverBackground ?? theme.rowPressedBackground,
|
|
2515
3531
|
'--nl-subdued': theme.subduedBackground,
|
|
2516
3532
|
'--nl-strong': theme.strongBackground,
|
|
3533
|
+
'--nl-image-fallback-background':
|
|
3534
|
+
theme.imageFallbackBackground ?? 'transparent',
|
|
2517
3535
|
'--nl-primary': theme.primaryText,
|
|
2518
3536
|
'--nl-secondary': theme.secondaryText,
|
|
2519
3537
|
'--nl-disabled': theme.disabledText,
|
|
@@ -2527,6 +3545,7 @@ export class NativeListWebEngine {
|
|
|
2527
3545
|
'--nl-separator': theme.separator,
|
|
2528
3546
|
'--nl-accent': theme.accent,
|
|
2529
3547
|
'--nl-positive': theme.positive,
|
|
3548
|
+
'--nl-success-background': theme.successBackground,
|
|
2530
3549
|
'--nl-negative': theme.negative,
|
|
2531
3550
|
'--nl-critical': theme.criticalBackground,
|
|
2532
3551
|
'--nl-inverse': theme.inverseBackground,
|
|
@@ -2566,8 +3585,103 @@ export class NativeListWebEngine {
|
|
|
2566
3585
|
});
|
|
2567
3586
|
}
|
|
2568
3587
|
|
|
3588
|
+
private computeLayout(
|
|
3589
|
+
viewportWidth: number,
|
|
3590
|
+
viewportHeight: number
|
|
3591
|
+
): WebListLayout {
|
|
3592
|
+
const measuredSnapshot: NativeListSnapshot = {
|
|
3593
|
+
...this.snapshot,
|
|
3594
|
+
rows: this.snapshot.rows.map((row) =>
|
|
3595
|
+
row.style?.container?.height === undefined &&
|
|
3596
|
+
row.height === undefined &&
|
|
3597
|
+
this.measuredRendererHeights.get(row.key)?.signature ===
|
|
3598
|
+
webRowRenderSignature(row)
|
|
3599
|
+
? {
|
|
3600
|
+
...row,
|
|
3601
|
+
height: this.measuredRendererHeights.get(row.key)!.height,
|
|
3602
|
+
}
|
|
3603
|
+
: row
|
|
3604
|
+
),
|
|
3605
|
+
};
|
|
3606
|
+
let layout = computeWebListLayout(
|
|
3607
|
+
measuredSnapshot,
|
|
3608
|
+
viewportWidth,
|
|
3609
|
+
viewportHeight,
|
|
3610
|
+
this.reorderCompactKey
|
|
3611
|
+
);
|
|
3612
|
+
if (this.externalScrollHost) {
|
|
3613
|
+
const padding = paddingValues(this.snapshot);
|
|
3614
|
+
layout = {
|
|
3615
|
+
...layout,
|
|
3616
|
+
contentHeight:
|
|
3617
|
+
Math.max(
|
|
3618
|
+
padding.top,
|
|
3619
|
+
...layout.items.map((item) => item.y + item.height)
|
|
3620
|
+
) + padding.bottom,
|
|
3621
|
+
};
|
|
3622
|
+
}
|
|
3623
|
+
return layout;
|
|
3624
|
+
}
|
|
3625
|
+
|
|
3626
|
+
private writeExternalHeight(height: number) {
|
|
3627
|
+
const value = String(height) + 'px';
|
|
3628
|
+
this.content.style.height = value;
|
|
3629
|
+
this.viewport.style.height = value;
|
|
3630
|
+
this.viewportFrame.style.height = value;
|
|
3631
|
+
this.root.style.height = value;
|
|
3632
|
+
}
|
|
3633
|
+
|
|
2569
3634
|
private recomputeLayout = () => {
|
|
2570
3635
|
if (this.destroyed) return;
|
|
3636
|
+
if (
|
|
3637
|
+
this.structuralPrefixTransition &&
|
|
3638
|
+
this.lastViewportWidth > 0 &&
|
|
3639
|
+
this.viewport.clientWidth > 0 &&
|
|
3640
|
+
this.viewport.clientWidth !== this.lastViewportWidth
|
|
3641
|
+
)
|
|
3642
|
+
this.cancelStructuralAnimation();
|
|
3643
|
+
if (this.structuralRenderedHeight === undefined)
|
|
3644
|
+
this.reactFooterHeight = this.readReactFooterHeight();
|
|
3645
|
+
else {
|
|
3646
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
3647
|
+
const footerDelta = this.reactFooterHeight - nextFooterHeight;
|
|
3648
|
+
if (footerDelta !== 0) {
|
|
3649
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
3650
|
+
const priorCompensation = this.structuralFooterCompensation;
|
|
3651
|
+
const difference = this.structuralFooterFromHeight - nextFooterHeight;
|
|
3652
|
+
this.structuralFooterCompensation = Math.max(0, difference);
|
|
3653
|
+
this.structuralFooterExpansion = Math.max(0, -difference);
|
|
3654
|
+
this.structuralRenderedHeight +=
|
|
3655
|
+
(this.structuralFooterCompensation - priorCompensation) *
|
|
3656
|
+
(1 - this.structuralProgress);
|
|
3657
|
+
this.applyStructuralFooterVisual(this.structuralProgress);
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
const cachedWidth = this.lastViewportWidth;
|
|
3661
|
+
const cachedHeight = this.lastViewportHeight;
|
|
3662
|
+
const precomputedLayout =
|
|
3663
|
+
this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0
|
|
3664
|
+
? this.computeLayout(cachedWidth, cachedHeight)
|
|
3665
|
+
: undefined;
|
|
3666
|
+
if (precomputedLayout && this.structuralRenderedHeight === undefined) {
|
|
3667
|
+
// Commit appended row extent before measuring React-owned slot changes.
|
|
3668
|
+
this.writeExternalHeight(
|
|
3669
|
+
Math.max(this.layout.contentHeight, precomputedLayout.contentHeight)
|
|
3670
|
+
);
|
|
3671
|
+
}
|
|
3672
|
+
this.externalGeometryCache = undefined;
|
|
3673
|
+
if (this.externalScrollHost) {
|
|
3674
|
+
const geometry = this.externalGeometry();
|
|
3675
|
+
const previousOrigin = this.externalOrigin;
|
|
3676
|
+
this.externalOrigin = geometry.origin;
|
|
3677
|
+
if (
|
|
3678
|
+
previousOrigin !== undefined &&
|
|
3679
|
+
geometry.origin !== previousOrigin &&
|
|
3680
|
+
this.externalScrollHost.scrollTop > previousOrigin &&
|
|
3681
|
+
geometry.visible
|
|
3682
|
+
)
|
|
3683
|
+
this.externalScrollHost.scrollTop += geometry.origin - previousOrigin;
|
|
3684
|
+
}
|
|
2571
3685
|
const viewportWidth = this.viewport.clientWidth;
|
|
2572
3686
|
const viewportHeight =
|
|
2573
3687
|
this.snapshot.layout.orientation === 'horizontal'
|
|
@@ -2595,28 +3709,22 @@ export class NativeListWebEngine {
|
|
|
2595
3709
|
this.lastViewportWidth = viewportWidth;
|
|
2596
3710
|
this.lastViewportHeight = viewportHeight;
|
|
2597
3711
|
const previousHorizontal = this.layout.horizontal;
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
this.
|
|
2604
|
-
webRowRenderSignature(row)
|
|
2605
|
-
? {
|
|
2606
|
-
...row,
|
|
2607
|
-
height: this.measuredRendererHeights.get(row.key)!.height,
|
|
2608
|
-
}
|
|
2609
|
-
: row
|
|
2610
|
-
),
|
|
2611
|
-
};
|
|
2612
|
-
this.layout = computeWebListLayout(
|
|
2613
|
-
measuredSnapshot,
|
|
2614
|
-
viewportWidth,
|
|
2615
|
-
viewportHeight,
|
|
2616
|
-
this.reorderCompactKey
|
|
2617
|
-
);
|
|
3712
|
+
this.layout =
|
|
3713
|
+
precomputedLayout &&
|
|
3714
|
+
viewportWidth === cachedWidth &&
|
|
3715
|
+
viewportHeight === cachedHeight
|
|
3716
|
+
? precomputedLayout
|
|
3717
|
+
: this.computeLayout(viewportWidth, viewportHeight);
|
|
2618
3718
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
2619
|
-
|
|
3719
|
+
const renderedHeight =
|
|
3720
|
+
this.structuralRenderedHeight ?? this.layout.contentHeight;
|
|
3721
|
+
this.content.style.height = String(renderedHeight) + 'px';
|
|
3722
|
+
if (this.externalScrollHost) {
|
|
3723
|
+
this.writeExternalHeight(renderedHeight);
|
|
3724
|
+
this.externalGeometryCache = undefined;
|
|
3725
|
+
}
|
|
3726
|
+
if (this.structuralRenderedHeight !== undefined)
|
|
3727
|
+
this.structuralTargetHeight = this.layout.contentHeight;
|
|
2620
3728
|
this.renderSectionIndex(
|
|
2621
3729
|
this.viewport.clientHeight <= 0
|
|
2622
3730
|
? DEFAULT_VIEWPORT_HEIGHT
|
|
@@ -2632,6 +3740,11 @@ export class NativeListWebEngine {
|
|
|
2632
3740
|
};
|
|
2633
3741
|
|
|
2634
3742
|
private updateAvatarWindow() {
|
|
3743
|
+
if (this.externalScrollHost && !this.externalGeometry().visible) {
|
|
3744
|
+
this.avatarLeases.forEach((lease) => lease());
|
|
3745
|
+
this.avatarLeases.clear();
|
|
3746
|
+
return;
|
|
3747
|
+
}
|
|
2635
3748
|
const offset = this.currentOffset();
|
|
2636
3749
|
if (offset !== this.avatarOffset)
|
|
2637
3750
|
this.avatarDirection = Math.sign(offset - this.avatarOffset);
|
|
@@ -2688,13 +3801,16 @@ export class NativeListWebEngine {
|
|
|
2688
3801
|
private renderWindow() {
|
|
2689
3802
|
this.updateAvatarWindow();
|
|
2690
3803
|
const viewportLength = this.viewportLength();
|
|
2691
|
-
const visible =
|
|
2692
|
-
this.
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
3804
|
+
const visible =
|
|
3805
|
+
this.externalScrollHost && !this.externalGeometry().visible
|
|
3806
|
+
? []
|
|
3807
|
+
: webLayoutItemsForMount(
|
|
3808
|
+
this.layout,
|
|
3809
|
+
this.currentOffset(),
|
|
3810
|
+
viewportLength,
|
|
3811
|
+
this.virtualizationEnabled,
|
|
3812
|
+
viewportLength * OVERSCAN_VIEWPORTS
|
|
3813
|
+
);
|
|
2698
3814
|
const desired = new Set(visible.map((item) => item.index));
|
|
2699
3815
|
this.mounted.forEach((element, index) => {
|
|
2700
3816
|
const nextRow = this.rows[index];
|
|
@@ -2769,6 +3885,7 @@ export class NativeListWebEngine {
|
|
|
2769
3885
|
}
|
|
2770
3886
|
this.updateVisibleSelection();
|
|
2771
3887
|
this.updateVisibleState();
|
|
3888
|
+
this.updateStructuralTailWindow();
|
|
2772
3889
|
}
|
|
2773
3890
|
|
|
2774
3891
|
private positionElement(element: HTMLElement, item: WebLayoutItem) {
|
|
@@ -2797,6 +3914,11 @@ export class NativeListWebEngine {
|
|
|
2797
3914
|
? 'ok-native-list-item ok-native-list-sticky'
|
|
2798
3915
|
: 'ok-native-list-item';
|
|
2799
3916
|
setData(element, 'nativeListRowKey', row.key);
|
|
3917
|
+
setData(
|
|
3918
|
+
element,
|
|
3919
|
+
'nativeListMediaGallery',
|
|
3920
|
+
row.type === 'mediaTile' && row.variant === 'gallery' ? 'true' : undefined
|
|
3921
|
+
);
|
|
2800
3922
|
setData(element, 'nativeListBindingEpoch', bindingEpoch);
|
|
2801
3923
|
setData(element, 'nativeListRowIndex', index);
|
|
2802
3924
|
setData(element, 'nativeListDisabled', Boolean(row.disabled));
|
|
@@ -2842,7 +3964,7 @@ export class NativeListWebEngine {
|
|
|
2842
3964
|
const body = reusableBody ?? createRowBody(context, row);
|
|
2843
3965
|
if (reusableBody) {
|
|
2844
3966
|
resetRowContainerStyle(body);
|
|
2845
|
-
registered.bind(body, rendererPrimitives(context));
|
|
3967
|
+
registered.bind(body, rendererPrimitives(context, Boolean(row.disabled)));
|
|
2846
3968
|
}
|
|
2847
3969
|
// OneKey patch: explicit selector fields preserve original page geometry.
|
|
2848
3970
|
element.style.contain = row.backgroundFullWidth ? 'layout style' : '';
|
|
@@ -3221,11 +4343,14 @@ export class NativeListWebEngine {
|
|
|
3221
4343
|
}
|
|
3222
4344
|
|
|
3223
4345
|
private updateVisibleState() {
|
|
3224
|
-
const visible =
|
|
3225
|
-
this.
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
4346
|
+
const visible =
|
|
4347
|
+
this.externalScrollHost && !this.externalGeometry().visible
|
|
4348
|
+
? []
|
|
4349
|
+
: visibleWebLayoutItems(
|
|
4350
|
+
this.layout,
|
|
4351
|
+
this.currentOffset(),
|
|
4352
|
+
this.viewportLength()
|
|
4353
|
+
);
|
|
3229
4354
|
const first = visible[0];
|
|
3230
4355
|
const last = visible.at(-1);
|
|
3231
4356
|
const signature =
|
|
@@ -3295,6 +4420,8 @@ export class NativeListWebEngine {
|
|
|
3295
4420
|
this.sticky.style.right = 'auto';
|
|
3296
4421
|
this.sticky.style.width = String(item.width) + 'px';
|
|
3297
4422
|
this.sticky.style.height = String(item.height) + 'px';
|
|
4423
|
+
if (this.externalScrollHost)
|
|
4424
|
+
this.sticky.style.top = String(Math.max(0, this.currentOffset())) + 'px';
|
|
3298
4425
|
let nextIndex = -1;
|
|
3299
4426
|
for (let cursor = index + 1; cursor < this.rows.length; cursor += 1) {
|
|
3300
4427
|
const candidate = this.rows[cursor];
|
|
@@ -3333,6 +4460,7 @@ export class NativeListWebEngine {
|
|
|
3333
4460
|
|
|
3334
4461
|
private checkEndReached(lastVisibleIndex: number) {
|
|
3335
4462
|
if (
|
|
4463
|
+
(this.externalScrollHost && !this.externalGeometry().visible) ||
|
|
3336
4464
|
!this.snapshot.capabilities?.loadMore ||
|
|
3337
4465
|
this.reachedGeneration === this.snapshot.generation ||
|
|
3338
4466
|
this.rows.length === 0
|
|
@@ -3371,6 +4499,11 @@ export class NativeListWebEngine {
|
|
|
3371
4499
|
}
|
|
3372
4500
|
|
|
3373
4501
|
private canScroll(): boolean {
|
|
4502
|
+
if (this.externalScrollHost)
|
|
4503
|
+
return (
|
|
4504
|
+
this.viewport.clientWidth > 0 &&
|
|
4505
|
+
this.externalScrollHost.clientHeight > 0
|
|
4506
|
+
);
|
|
3374
4507
|
const viewportLength = this.layout.horizontal
|
|
3375
4508
|
? this.viewport.clientWidth
|
|
3376
4509
|
: this.viewport.clientHeight;
|
|
@@ -3381,11 +4514,19 @@ export class NativeListWebEngine {
|
|
|
3381
4514
|
if (this.layout.horizontal) {
|
|
3382
4515
|
return this.viewport.clientWidth || DEFAULT_VIEWPORT_WIDTH;
|
|
3383
4516
|
}
|
|
4517
|
+
if (this.externalScrollHost) return this.externalGeometry().viewportLength;
|
|
3384
4518
|
if (this.viewport.clientHeight <= 0) return DEFAULT_VIEWPORT_HEIGHT;
|
|
3385
4519
|
return Math.max(1, this.verticalScrollMetrics().viewportLength);
|
|
3386
4520
|
}
|
|
3387
4521
|
|
|
3388
4522
|
private contentLength(): number {
|
|
4523
|
+
if (this.externalScrollHost) {
|
|
4524
|
+
const geometry = this.externalGeometry();
|
|
4525
|
+
return Math.max(
|
|
4526
|
+
this.layout.contentHeight,
|
|
4527
|
+
geometry.end - geometry.origin
|
|
4528
|
+
);
|
|
4529
|
+
}
|
|
3389
4530
|
return this.layout.horizontal
|
|
3390
4531
|
? this.layout.contentWidth
|
|
3391
4532
|
: this.layout.contentHeight;
|
|
@@ -3401,6 +4542,8 @@ export class NativeListWebEngine {
|
|
|
3401
4542
|
header: number;
|
|
3402
4543
|
sticky: number;
|
|
3403
4544
|
}> {
|
|
4545
|
+
if (this.externalScrollHost)
|
|
4546
|
+
return { header: 0, sticky: this.externalStickyInset };
|
|
3404
4547
|
const readInset = (name: string) => {
|
|
3405
4548
|
const parsed = Number.parseFloat(
|
|
3406
4549
|
this.viewport.style.getPropertyValue(name)
|
|
@@ -3414,6 +4557,7 @@ export class NativeListWebEngine {
|
|
|
3414
4557
|
}
|
|
3415
4558
|
|
|
3416
4559
|
private verticalScrollMetrics(): WebCollapsiblePagerScrollMetrics {
|
|
4560
|
+
if (this.externalScrollHost) return this.externalGeometry();
|
|
3417
4561
|
const insets = this.collapsiblePagerInsets();
|
|
3418
4562
|
return resolveWebCollapsiblePagerScrollMetrics(
|
|
3419
4563
|
this.viewport.scrollTop,
|
|
@@ -3427,7 +4571,31 @@ export class NativeListWebEngine {
|
|
|
3427
4571
|
this.recomputeLayout();
|
|
3428
4572
|
};
|
|
3429
4573
|
|
|
4574
|
+
private writeExternalOffset(rawOffset: number, animated: boolean) {
|
|
4575
|
+
this.externalGeometryCache = undefined;
|
|
4576
|
+
const host = this.externalScrollHost!;
|
|
4577
|
+
const scrollTo: (options: ScrollToOptions) => void =
|
|
4578
|
+
host.ownerDocument.defaultView?.Element.prototype.scrollTo ??
|
|
4579
|
+
host.scrollTo;
|
|
4580
|
+
scrollTo.call(host, {
|
|
4581
|
+
top: Math.max(
|
|
4582
|
+
0,
|
|
4583
|
+
Math.min(host.scrollHeight - host.clientHeight, rawOffset)
|
|
4584
|
+
),
|
|
4585
|
+
behavior: animated ? 'smooth' : 'auto',
|
|
4586
|
+
});
|
|
4587
|
+
this.scheduleFrame();
|
|
4588
|
+
}
|
|
4589
|
+
|
|
3430
4590
|
private scrollToAbsoluteOffset(offset: number, animated: boolean) {
|
|
4591
|
+
if (this.externalScrollHost) {
|
|
4592
|
+
const geometry = this.externalGeometry();
|
|
4593
|
+
this.writeExternalOffset(
|
|
4594
|
+
geometry.origin + offset - this.externalStickyInset,
|
|
4595
|
+
animated
|
|
4596
|
+
);
|
|
4597
|
+
return;
|
|
4598
|
+
}
|
|
3431
4599
|
const resolved = Math.min(
|
|
3432
4600
|
Math.max(0, offset),
|
|
3433
4601
|
Math.max(0, this.contentLength() - this.viewportLength())
|
|
@@ -3507,7 +4675,8 @@ export class NativeListWebEngine {
|
|
|
3507
4675
|
row: RowModel,
|
|
3508
4676
|
actionKey: string,
|
|
3509
4677
|
actionElement?: HTMLElement,
|
|
3510
|
-
rowElement?: HTMLElement
|
|
4678
|
+
rowElement?: HTMLElement,
|
|
4679
|
+
windowPoint?: RowActionEvent['windowPoint']
|
|
3511
4680
|
) {
|
|
3512
4681
|
const anchor =
|
|
3513
4682
|
actionElement && rowElement
|
|
@@ -3518,6 +4687,11 @@ export class NativeListWebEngine {
|
|
|
3518
4687
|
actionKey,
|
|
3519
4688
|
sectionKey: row.sectionKey,
|
|
3520
4689
|
anchor,
|
|
4690
|
+
...(windowPoint &&
|
|
4691
|
+
Number.isFinite(windowPoint.x) &&
|
|
4692
|
+
Number.isFinite(windowPoint.y)
|
|
4693
|
+
? { windowPoint }
|
|
4694
|
+
: {}),
|
|
3521
4695
|
});
|
|
3522
4696
|
}
|
|
3523
4697
|
|
|
@@ -3582,6 +4756,8 @@ export class NativeListWebEngine {
|
|
|
3582
4756
|
}
|
|
3583
4757
|
|
|
3584
4758
|
private invalidateActionAnchorForElement(element: HTMLElement) {
|
|
4759
|
+
if (this.pressedHelpElement && element.contains(this.pressedHelpElement))
|
|
4760
|
+
this.pressedHelpElement = undefined;
|
|
3585
4761
|
const anchor = this.actionAnchor;
|
|
3586
4762
|
if (
|
|
3587
4763
|
anchor &&
|
|
@@ -3654,6 +4830,38 @@ export class NativeListWebEngine {
|
|
|
3654
4830
|
this.marketPointer = undefined;
|
|
3655
4831
|
}
|
|
3656
4832
|
|
|
4833
|
+
private handleMarketContextMenu = (event: MouseEvent) => {
|
|
4834
|
+
if (
|
|
4835
|
+
!(event.target instanceof Element) ||
|
|
4836
|
+
event.target.closest('[data-native-list-action]')
|
|
4837
|
+
)
|
|
4838
|
+
return;
|
|
4839
|
+
const element = event.target.closest<HTMLElement>(
|
|
4840
|
+
'[data-native-list-row-key]'
|
|
4841
|
+
);
|
|
4842
|
+
const row = this.rowAtElement(element);
|
|
4843
|
+
if (
|
|
4844
|
+
row?.type !== 'market' ||
|
|
4845
|
+
!row.webTable?.contextMenuActionKey ||
|
|
4846
|
+
!element ||
|
|
4847
|
+
!isRowPressEnabled(row)
|
|
4848
|
+
)
|
|
4849
|
+
return;
|
|
4850
|
+
event.preventDefault();
|
|
4851
|
+
this.cancelMarketPointer();
|
|
4852
|
+
markActionAnchorSource(element, 'row');
|
|
4853
|
+
const rect = element.getBoundingClientRect();
|
|
4854
|
+
this.emitRowAction(
|
|
4855
|
+
row,
|
|
4856
|
+
row.webTable.contextMenuActionKey,
|
|
4857
|
+
element,
|
|
4858
|
+
element,
|
|
4859
|
+
event.clientX || event.clientY
|
|
4860
|
+
? { x: event.clientX, y: event.clientY }
|
|
4861
|
+
: { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 }
|
|
4862
|
+
);
|
|
4863
|
+
};
|
|
4864
|
+
|
|
3657
4865
|
private handleMarketPointerDown = (event: PointerEvent) => {
|
|
3658
4866
|
if (event.button !== 0 || !(event.target instanceof Element)) return;
|
|
3659
4867
|
this.marketLongPressFired = false;
|
|
@@ -3662,9 +4870,13 @@ export class NativeListWebEngine {
|
|
|
3662
4870
|
'[data-native-list-row-key]'
|
|
3663
4871
|
);
|
|
3664
4872
|
const row = this.rowAtElement(rowElement);
|
|
3665
|
-
if (
|
|
4873
|
+
if (
|
|
4874
|
+
(row?.type !== 'market' && row?.type !== 'identity') ||
|
|
4875
|
+
!isRowPressEnabled(row)
|
|
4876
|
+
)
|
|
4877
|
+
return;
|
|
3666
4878
|
this.cancelMarketPointer();
|
|
3667
|
-
if (row.pressInActionKey)
|
|
4879
|
+
if (row.type === 'market' && row.pressInActionKey)
|
|
3668
4880
|
this.emitRowAction(
|
|
3669
4881
|
row,
|
|
3670
4882
|
row.pressInActionKey,
|
|
@@ -3673,16 +4885,35 @@ export class NativeListWebEngine {
|
|
|
3673
4885
|
);
|
|
3674
4886
|
if (!row.longPressActionKey || !rowElement) return;
|
|
3675
4887
|
markActionAnchorSource(rowElement, 'row');
|
|
4888
|
+
const bindingEpoch = rowElement.dataset.nativeListBindingEpoch;
|
|
3676
4889
|
const timer = this.document.defaultView?.setTimeout(() => {
|
|
3677
4890
|
const current = this.marketPointer;
|
|
3678
4891
|
if (!current || current.pointerId !== event.pointerId) return;
|
|
4892
|
+
const currentRow = this.rowAtElement(rowElement);
|
|
3679
4893
|
this.marketPointer = undefined;
|
|
4894
|
+
if (
|
|
4895
|
+
!rowElement.isConnected ||
|
|
4896
|
+
rowElement.dataset.nativeListBindingEpoch !== bindingEpoch ||
|
|
4897
|
+
currentRow?.key !== row.key ||
|
|
4898
|
+
(currentRow.type !== 'market' && currentRow.type !== 'identity') ||
|
|
4899
|
+
!isRowPressEnabled(currentRow) ||
|
|
4900
|
+
!currentRow.longPressActionKey
|
|
4901
|
+
)
|
|
4902
|
+
return;
|
|
3680
4903
|
this.marketLongPressFired = true;
|
|
3681
|
-
this.emitRowAction(
|
|
4904
|
+
this.emitRowAction(
|
|
4905
|
+
currentRow,
|
|
4906
|
+
currentRow.longPressActionKey,
|
|
4907
|
+
rowElement,
|
|
4908
|
+
rowElement,
|
|
4909
|
+
{ x: event.clientX, y: event.clientY }
|
|
4910
|
+
);
|
|
3682
4911
|
}, MARKET_LONG_PRESS_MS);
|
|
3683
4912
|
if (timer === undefined) return;
|
|
3684
4913
|
this.marketPointer = {
|
|
3685
4914
|
pointerId: event.pointerId,
|
|
4915
|
+
pointerType: event.pointerType,
|
|
4916
|
+
compact: row.type === 'identity' || !row.webTable,
|
|
3686
4917
|
rowKey: row.key,
|
|
3687
4918
|
startX: event.clientX,
|
|
3688
4919
|
startY: event.clientY,
|
|
@@ -3693,9 +4924,41 @@ export class NativeListWebEngine {
|
|
|
3693
4924
|
private handleMarketPointerMove = (event: PointerEvent) => {
|
|
3694
4925
|
const state = this.marketPointer;
|
|
3695
4926
|
if (!state || state.pointerId !== event.pointerId) return;
|
|
4927
|
+
if (state.compact && state.pointerType === 'touch') return;
|
|
4928
|
+
const row = this.rows.find((item) => item.key === state.rowKey);
|
|
4929
|
+
const threshold =
|
|
4930
|
+
row?.type === 'market' && !row.webTable ? 3 : MARKET_MOVE_CANCEL_PX;
|
|
3696
4931
|
if (
|
|
3697
|
-
Math.abs(event.clientX - state.startX) >
|
|
3698
|
-
Math.abs(event.clientY - state.startY) >
|
|
4932
|
+
Math.abs(event.clientX - state.startX) > threshold ||
|
|
4933
|
+
Math.abs(event.clientY - state.startY) > threshold
|
|
4934
|
+
)
|
|
4935
|
+
this.cancelMarketPointer();
|
|
4936
|
+
};
|
|
4937
|
+
|
|
4938
|
+
private handleMarketTouchMove = (event: TouchEvent) => {
|
|
4939
|
+
const state = this.marketPointer;
|
|
4940
|
+
if (
|
|
4941
|
+
!state?.compact ||
|
|
4942
|
+
state.pointerType !== 'touch' ||
|
|
4943
|
+
!(event.target instanceof Element) ||
|
|
4944
|
+
event.target.closest<HTMLElement>('[data-native-list-row-key]')?.dataset
|
|
4945
|
+
.nativeListRowKey !== state.rowKey
|
|
4946
|
+
)
|
|
4947
|
+
return;
|
|
4948
|
+
if (event.touches.length > 1) {
|
|
4949
|
+
this.cancelMarketPointer();
|
|
4950
|
+
return;
|
|
4951
|
+
}
|
|
4952
|
+
const touch = event.touches[0] ?? event.changedTouches[0];
|
|
4953
|
+
if (
|
|
4954
|
+
!touch ||
|
|
4955
|
+
!Number.isFinite(touch.clientX) ||
|
|
4956
|
+
!Number.isFinite(touch.clientY)
|
|
4957
|
+
)
|
|
4958
|
+
return;
|
|
4959
|
+
if (
|
|
4960
|
+
Math.abs(touch.clientX - state.startX) > 3 ||
|
|
4961
|
+
Math.abs(touch.clientY - state.startY) > 3
|
|
3699
4962
|
)
|
|
3700
4963
|
this.cancelMarketPointer();
|
|
3701
4964
|
};
|
|
@@ -3706,7 +4969,7 @@ export class NativeListWebEngine {
|
|
|
3706
4969
|
};
|
|
3707
4970
|
|
|
3708
4971
|
// OneKey patch: hover opens the same anchored help action as native taps.
|
|
3709
|
-
private handleTitlePointerOver = (event: PointerEvent) => {
|
|
4972
|
+
private handleTitlePointerOver = (event: PointerEvent | FocusEvent) => {
|
|
3710
4973
|
const target = event.target;
|
|
3711
4974
|
if (!(target instanceof Element)) return;
|
|
3712
4975
|
const action = target.closest<HTMLElement>(
|
|
@@ -3718,6 +4981,23 @@ export class NativeListWebEngine {
|
|
|
3718
4981
|
action.contains(event.relatedTarget))
|
|
3719
4982
|
)
|
|
3720
4983
|
return;
|
|
4984
|
+
if (action.dataset.nativeListIconHelp === 'true') {
|
|
4985
|
+
if (
|
|
4986
|
+
event.type === 'pointerover' &&
|
|
4987
|
+
(event as PointerEvent).pointerType === 'touch'
|
|
4988
|
+
)
|
|
4989
|
+
return;
|
|
4990
|
+
if (this.pressedHelpElement === action) return;
|
|
4991
|
+
}
|
|
4992
|
+
if (
|
|
4993
|
+
action.classList.contains('ok-native-list-market-subtitle-prefix') &&
|
|
4994
|
+
action.scrollWidth <= action.clientWidth + 1
|
|
4995
|
+
)
|
|
4996
|
+
return;
|
|
4997
|
+
this.emitHoverAction(action);
|
|
4998
|
+
};
|
|
4999
|
+
|
|
5000
|
+
private emitHoverAction(action: HTMLElement) {
|
|
3721
5001
|
const rowElement = action.closest<HTMLElement>(
|
|
3722
5002
|
'[data-native-list-row-key]'
|
|
3723
5003
|
);
|
|
@@ -3739,9 +5019,27 @@ export class NativeListWebEngine {
|
|
|
3739
5019
|
// WalletGroup), not the enclosing row's `disabled`.
|
|
3740
5020
|
if (sourceRow && !sourceRow.disabled && actionKey)
|
|
3741
5021
|
this.emitRowAction(sourceRow, actionKey, action, rowElement ?? undefined);
|
|
5022
|
+
}
|
|
5023
|
+
|
|
5024
|
+
private handleIconHelpPointerDown = (event: PointerEvent) => {
|
|
5025
|
+
const target = event.target;
|
|
5026
|
+
if (!(target instanceof Element)) return;
|
|
5027
|
+
const action = target.closest<HTMLElement>(
|
|
5028
|
+
'[data-native-list-icon-help="true"]'
|
|
5029
|
+
);
|
|
5030
|
+
if (!action) return;
|
|
5031
|
+
if (event.pointerType === 'touch') {
|
|
5032
|
+
if (this.actionAnchor?.actionElement === action && this.actionAnchor.open)
|
|
5033
|
+
this.invalidateActionAnchor('pointerLeave');
|
|
5034
|
+
else this.emitHoverAction(action);
|
|
5035
|
+
} else {
|
|
5036
|
+
this.pressedHelpElement = action;
|
|
5037
|
+
if (this.actionAnchor?.actionElement === action)
|
|
5038
|
+
this.invalidateActionAnchor('pointerLeave');
|
|
5039
|
+
}
|
|
3742
5040
|
};
|
|
3743
5041
|
|
|
3744
|
-
private handleTitlePointerOut = (event: PointerEvent) => {
|
|
5042
|
+
private handleTitlePointerOut = (event: PointerEvent | FocusEvent) => {
|
|
3745
5043
|
const target = event.target;
|
|
3746
5044
|
if (!(target instanceof Element)) return;
|
|
3747
5045
|
const action = target.closest<HTMLElement>(
|
|
@@ -3753,6 +5051,14 @@ export class NativeListWebEngine {
|
|
|
3753
5051
|
action.contains(event.relatedTarget))
|
|
3754
5052
|
)
|
|
3755
5053
|
return;
|
|
5054
|
+
if (
|
|
5055
|
+
action.dataset.nativeListIconHelp === 'true' &&
|
|
5056
|
+
event.type === 'pointerout' &&
|
|
5057
|
+
(event as PointerEvent).pointerType === 'touch'
|
|
5058
|
+
)
|
|
5059
|
+
return;
|
|
5060
|
+
if (event.type === 'pointerout' && this.pressedHelpElement === action)
|
|
5061
|
+
this.pressedHelpElement = undefined;
|
|
3756
5062
|
if (this.actionAnchor?.actionElement === action)
|
|
3757
5063
|
this.invalidateActionAnchor('pointerLeave');
|
|
3758
5064
|
};
|
|
@@ -3766,6 +5072,11 @@ export class NativeListWebEngine {
|
|
|
3766
5072
|
}
|
|
3767
5073
|
const target = event.target;
|
|
3768
5074
|
if (!(target instanceof Element)) return;
|
|
5075
|
+
if (target.closest('[data-native-list-icon-help="true"]')) {
|
|
5076
|
+
event.preventDefault();
|
|
5077
|
+
event.stopPropagation();
|
|
5078
|
+
return;
|
|
5079
|
+
}
|
|
3769
5080
|
const rowElement = target.closest<HTMLElement>(
|
|
3770
5081
|
'[data-native-list-row-key]'
|
|
3771
5082
|
);
|
|
@@ -3786,6 +5097,10 @@ export class NativeListWebEngine {
|
|
|
3786
5097
|
// member press is blocked by `isRowPressEnabled` in `handleRowPress`.
|
|
3787
5098
|
const action = target.closest<HTMLElement>('[data-native-list-action]');
|
|
3788
5099
|
if (action) {
|
|
5100
|
+
if (action.tagName === 'BUTTON' && action.hasAttribute('disabled'))
|
|
5101
|
+
return;
|
|
5102
|
+
if (action.classList.contains('ok-native-list-trailing-button'))
|
|
5103
|
+
event.stopPropagation();
|
|
3789
5104
|
const scope = action.dataset.selectionScope;
|
|
3790
5105
|
if (scope === 'row') this.activateSelection({ scope: 'row' }, row);
|
|
3791
5106
|
else if (scope === 'section' && action.dataset.selectionKey)
|
|
@@ -3811,6 +5126,19 @@ export class NativeListWebEngine {
|
|
|
3811
5126
|
};
|
|
3812
5127
|
|
|
3813
5128
|
private handleKeyDown = (event: KeyboardEvent) => {
|
|
5129
|
+
if (
|
|
5130
|
+
(event.key === 'Enter' || event.key === ' ') &&
|
|
5131
|
+
event.target instanceof HTMLElement &&
|
|
5132
|
+
event.target.matches('[role="button"][data-native-list-hover-action]')
|
|
5133
|
+
) {
|
|
5134
|
+
event.preventDefault();
|
|
5135
|
+
if (
|
|
5136
|
+
this.actionAnchor?.actionElement !== event.target ||
|
|
5137
|
+
!this.actionAnchor.open
|
|
5138
|
+
)
|
|
5139
|
+
this.emitHoverAction(event.target);
|
|
5140
|
+
return;
|
|
5141
|
+
}
|
|
3814
5142
|
// OneKey patch: non-button title help supports keyboard activation.
|
|
3815
5143
|
if (
|
|
3816
5144
|
(event.key === 'Enter' || event.key === ' ') &&
|
|
@@ -3934,7 +5262,21 @@ export class NativeListWebEngine {
|
|
|
3934
5262
|
?.focus({ preventScroll: true });
|
|
3935
5263
|
}
|
|
3936
5264
|
|
|
5265
|
+
private handleExternalScroll = (event: Event) => {
|
|
5266
|
+
const target = event.target;
|
|
5267
|
+
if (
|
|
5268
|
+
target === this.externalScrollHost ||
|
|
5269
|
+
(target instanceof Element &&
|
|
5270
|
+
target !== this.root &&
|
|
5271
|
+
this.externalScrollHost?.contains(target) &&
|
|
5272
|
+
target.contains(this.root))
|
|
5273
|
+
)
|
|
5274
|
+
this.handleScroll();
|
|
5275
|
+
};
|
|
5276
|
+
|
|
3937
5277
|
private handleScroll = () => {
|
|
5278
|
+
this.externalGeometryCache = undefined;
|
|
5279
|
+
this.pressedHelpElement = undefined;
|
|
3938
5280
|
this.cancelMarketPointer();
|
|
3939
5281
|
this.invalidateActionAnchor('scroll');
|
|
3940
5282
|
this.scheduleFrame();
|
|
@@ -3950,6 +5292,9 @@ export class NativeListWebEngine {
|
|
|
3950
5292
|
if (this.frameHandle !== undefined || this.destroyed) return;
|
|
3951
5293
|
this.frameHandle = this.requestFrame(() => {
|
|
3952
5294
|
this.frameHandle = undefined;
|
|
5295
|
+
this.externalGeometryCache = undefined;
|
|
5296
|
+
if (this.externalScrollHost)
|
|
5297
|
+
this.externalOrigin = this.externalGeometry().origin;
|
|
3953
5298
|
if (this.virtualizationEnabled) this.renderWindow();
|
|
3954
5299
|
else {
|
|
3955
5300
|
this.updateAvatarWindow();
|
|
@@ -4050,7 +5395,8 @@ export class NativeListWebEngine {
|
|
|
4050
5395
|
if (
|
|
4051
5396
|
this.pointerReorder?.pointerId === event.pointerId ||
|
|
4052
5397
|
!this.snapshot.capabilities?.pullToRefresh ||
|
|
4053
|
-
this.
|
|
5398
|
+
(!!this.externalScrollHost && !this.ownsRefresh) ||
|
|
5399
|
+
this.pullTarget.scrollTop > 0 ||
|
|
4054
5400
|
(event.pointerType !== 'touch' && event.pointerType !== 'pen')
|
|
4055
5401
|
)
|
|
4056
5402
|
return;
|
|
@@ -4149,6 +5495,7 @@ export class NativeListWebEngine {
|
|
|
4149
5495
|
if (this.pointerReorder !== state) return;
|
|
4150
5496
|
this.clearReorderLongPress(state);
|
|
4151
5497
|
state.active = true;
|
|
5498
|
+
this.cancelMarketPointer();
|
|
4152
5499
|
state.activatedAt = Date.now();
|
|
4153
5500
|
state.viewportRect = this.reorderViewportRect();
|
|
4154
5501
|
this.captureReorderPointer(state);
|
|
@@ -4247,6 +5594,10 @@ export class NativeListWebEngine {
|
|
|
4247
5594
|
};
|
|
4248
5595
|
|
|
4249
5596
|
private setCurrentOffset(offset: number) {
|
|
5597
|
+
if (this.externalScrollHost) {
|
|
5598
|
+
this.scrollToAbsoluteOffset(offset, false);
|
|
5599
|
+
return;
|
|
5600
|
+
}
|
|
4250
5601
|
const maximum = Math.max(0, this.contentLength() - this.viewportLength());
|
|
4251
5602
|
const next = Math.max(0, Math.min(maximum, offset));
|
|
4252
5603
|
if (this.layout.horizontal) this.viewport.scrollLeft = next;
|
|
@@ -4339,12 +5690,13 @@ export class NativeListWebEngine {
|
|
|
4339
5690
|
const insets = this.collapsiblePagerInsets();
|
|
4340
5691
|
const left =
|
|
4341
5692
|
viewportRect.left + destinationLayout.x - this.viewport.scrollLeft;
|
|
4342
|
-
const top =
|
|
4343
|
-
viewportRect.top +
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
5693
|
+
const top = this.externalScrollHost
|
|
5694
|
+
? viewportRect.top + destinationLayout.y
|
|
5695
|
+
: viewportRect.top +
|
|
5696
|
+
destinationLayout.y +
|
|
5697
|
+
insets.header +
|
|
5698
|
+
insets.sticky -
|
|
5699
|
+
this.viewport.scrollTop;
|
|
4348
5700
|
this.reorderPreview.getBoundingClientRect();
|
|
4349
5701
|
this.reorderPreview.style.transition =
|
|
4350
5702
|
'transform ' +
|
|
@@ -4416,6 +5768,18 @@ export class NativeListWebEngine {
|
|
|
4416
5768
|
}
|
|
4417
5769
|
|
|
4418
5770
|
private reorderViewportRect() {
|
|
5771
|
+
if (this.externalScrollHost) {
|
|
5772
|
+
const geometry = this.externalGeometry();
|
|
5773
|
+
const body = this.viewport.getBoundingClientRect();
|
|
5774
|
+
return {
|
|
5775
|
+
left: body.left,
|
|
5776
|
+
right: body.right,
|
|
5777
|
+
width: body.width,
|
|
5778
|
+
top: geometry.top,
|
|
5779
|
+
bottom: geometry.bottom,
|
|
5780
|
+
height: geometry.viewportLength,
|
|
5781
|
+
};
|
|
5782
|
+
}
|
|
4419
5783
|
const { left, top, right, bottom, width, height } =
|
|
4420
5784
|
this.viewport.getBoundingClientRect();
|
|
4421
5785
|
return { left, top, right, bottom, width, height };
|