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