@onekeyfe/react-native-native-list 6.7.0-1 → 6.7.0-11
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 +1 -1
- package/docs/SPEC.md +449 -14
- package/ios/HybridNativeList.swift +11 -3
- package/ios/RNCNativeListView.swift +10 -6
- package/ios/tests/NativeListLifecycleTests.swift +28 -0
- package/lib/module/NativeList.js +42 -21
- package/lib/module/NativeList.web.js +163 -32
- package/lib/module/ScrollEdgeEffect.js +8 -0
- package/lib/module/index.js +1 -0
- package/lib/module/validation.js +358 -47
- package/lib/module/web/NativeListWebEngine.js +373 -67
- package/lib/module/web/templates/ActivityRowRenderer.js +484 -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/RowRendererRegistry.js +5 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +34 -1
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +10 -6
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -2
- package/lib/nitrogen/generated/android/c++/JNativeListScrollEdgeEffect.hpp +61 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +3 -3
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +1 -1
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt +24 -0
- package/lib/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +3 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +8 -4
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +4 -4
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -1
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +3 -3
- package/lib/nitrogen/generated/ios/swift/NativeListScrollEdgeEffect.swift +44 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -2
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +5 -2
- package/lib/nitrogen/generated/shared/c++/NativeListScrollEdgeEffect.hpp +80 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +4 -3
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -1
- package/lib/typescript/src/NativeList.d.ts +2 -2
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -1
- package/lib/typescript/src/NativeList.types.d.ts +14 -3
- package/lib/typescript/src/NativeList.web.d.ts +2 -2
- package/lib/typescript/src/ScrollEdgeEffect.d.ts +5 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/models.d.ts +71 -1
- package/lib/typescript/src/validation.d.ts +3 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +26 -1
- package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
- 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 +1 -1
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +10 -6
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -2
- package/nitrogen/generated/android/c++/JNativeListScrollEdgeEffect.hpp +61 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/NativeListScrollEdgeEffect.kt +24 -0
- package/nitrogen/generated/ios/NativeListModule-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +8 -4
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +4 -4
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +3 -3
- package/nitrogen/generated/ios/swift/NativeListScrollEdgeEffect.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -2
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +5 -2
- package/nitrogen/generated/shared/c++/NativeListScrollEdgeEffect.hpp +80 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -2
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +4 -3
- package/nitrogen/generated/shared/json/NativeListConfig.json +1 -1
- package/package.json +3 -3
- package/react-native-native-list.podspec +4 -1
- package/src/NativeList.nitro.ts +3 -1
- package/src/NativeList.tsx +102 -60
- package/src/NativeList.types.ts +15 -3
- package/src/NativeList.web.tsx +264 -65
- package/src/ScrollEdgeEffect.ts +4 -0
- package/src/index.ts +2 -0
- package/src/models.ts +93 -0
- package/src/validation.ts +785 -72
- package/src/web/NativeListWebEngine.ts +625 -100
- package/src/web/templates/ActivityRowRenderer.ts +723 -7
- 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/RowRendererRegistry.ts +10 -5
- package/src/web/templates/SectionHeaderRowRenderer.ts +42 -1
|
@@ -5,12 +5,13 @@ import { applyRowContainerStyle, resetRowContainerStyle } from "./templates/RowC
|
|
|
5
5
|
import { hasExplicitRowHeight, rowSizeModifier } from "./templates/RowElements.js";
|
|
6
6
|
import { applyTextStyleToSlot, applyValueSegments } from "./templates/RowText.js";
|
|
7
7
|
import { setMarketQuoteContent } from "./templates/MarketRowRenderer.js";
|
|
8
|
+
import { canPatchMarketTableValues, updateMarketTableValues } from "./templates/MarketTableRowRenderer.js";
|
|
8
9
|
export { resolveWebMarketLayoutStyle } from "./templates/MarketRowRenderer.js";
|
|
9
10
|
import { measureRailWidth } from "./templates/RailRowRenderer.js";
|
|
10
11
|
import { rowRenderer, rowRendererKey, recycleRowBody } from "./templates/RowRendererRegistry.js";
|
|
11
12
|
import { checkboxStateForKeys, checkboxStateForSection, isRowPressEnabled, isSelectableRow, reduceSelection, selectionStateFromSnapshot } from "../selection.js";
|
|
12
13
|
import { calculateAlignedScrollOffset, resolveLocationIndex, scrollFailure, validateOffset } from "../scrolling.js";
|
|
13
|
-
import { applyRowPatches, validateSnapshot } from "../validation.js";
|
|
14
|
+
import { applyRowPatches, containNativeListInput, emptyNativeListSnapshot, validatePatches, validateSnapshot } from "../validation.js";
|
|
14
15
|
import { avatarPrefetchWindow } from "../avatarPrefetch.js";
|
|
15
16
|
import { acquireNativeListAvatar, canonicalNativeListAvatarUri } from "./NativeListWebAvatarCache.js";
|
|
16
17
|
const SECTION_INDEX_CONTENT_INSET = 16;
|
|
@@ -130,6 +131,7 @@ export function isWebRowReorderable(snapshot, row) {
|
|
|
130
131
|
if (row.type === 'rail' && row.draggable) return true;
|
|
131
132
|
if (row.type === 'identity' && row.draggable) return true;
|
|
132
133
|
if (row.type === 'walletGroup' && row.draggable) return true;
|
|
134
|
+
if (row.type === 'market' && row.webTable?.draggable) return true;
|
|
133
135
|
return (row.type === 'identity' || row.type === 'action') && Boolean(row.trailing?.some(accessory => accessory.kind === 'drag'));
|
|
134
136
|
}
|
|
135
137
|
export function moveWebReorderRow(rows, fromIndex, toIndex) {
|
|
@@ -274,7 +276,7 @@ export function computeWebListLayout(snapshot, viewportWidth, viewportHeight, co
|
|
|
274
276
|
};
|
|
275
277
|
}
|
|
276
278
|
const columns = snapshot.layout.gridColumns ?? 2;
|
|
277
|
-
const itemWidth =
|
|
279
|
+
const itemWidth = (availableWidth - spacing * (columns - 1)) / columns;
|
|
278
280
|
let y = padding.top;
|
|
279
281
|
let column = 0;
|
|
280
282
|
let bandStart = y;
|
|
@@ -416,12 +418,15 @@ export function webMarketImageBindDeltaForPatches(patches) {
|
|
|
416
418
|
|
|
417
419
|
// OneKey patch: selector names must shrink before the sidebar clips their contents.
|
|
418
420
|
export const WEB_LIST_CSS = `
|
|
421
|
+
.ok-native-list-table-secondary{display:block;min-width:0;overflow:clip}.ok-native-list-table-secondary-track{display:flex;flex-direction:column;transition:transform 100ms ease}.ok-native-list-market-table:focus-within .ok-native-list-table-secondary[data-has-hover="true"]>.ok-native-list-table-secondary-track{transform:translateY(calc(-1 * var(--nl-table-secondary-height)))}@media(hover:hover){.ok-native-list-market-table:hover .ok-native-list-table-secondary[data-has-hover="true"]>.ok-native-list-table-secondary-track{transform:translateY(calc(-1 * var(--nl-table-secondary-height)))}}.ok-native-list-market-table button:focus-visible{outline:2px solid var(--nl-accent);outline-offset:1px}.ok-native-list-market-table button:hover{opacity:.75}.ok-native-list-market-table button:active{opacity:.5}
|
|
422
|
+
|
|
419
423
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
420
|
-
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-family:var(--nl-font-regular)
|
|
424
|
+
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-synthesis:none;font-family:var(--nl-font-regular)}
|
|
421
425
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
422
426
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
423
427
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
424
428
|
.ok-native-list-item{position:absolute;left:0;top:0;box-sizing:border-box;contain:layout paint style;outline:none}
|
|
429
|
+
.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}
|
|
425
430
|
.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}
|
|
426
431
|
.ok-native-list-item[data-table-alternate="true"]>.ok-native-list-row{background:var(--nl-bg)}
|
|
427
432
|
.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
@@ -446,7 +451,7 @@ export const WEB_LIST_CSS = `
|
|
|
446
451
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-row>*{visibility:hidden}
|
|
447
452
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-wallet-group{border-color:transparent;background:var(--nl-pressed)}
|
|
448
453
|
.ok-native-list-item[data-native-list-dragging="true"]>.ok-native-list-wallet-group>*{visibility:hidden}
|
|
449
|
-
.ok-native-list-reorder-preview{position:fixed;left:0;top:0;z-index:100001;pointer-events:none;overflow:hidden;border-radius:12px;box-shadow:0 4px 24px rgba(0,0,0,.12);transform-origin:center;will-change:transform;font-
|
|
454
|
+
.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}
|
|
450
455
|
.ok-native-list-reorder-preview>.ok-native-list-row{background:var(--nl-pressed);cursor:grabbing}
|
|
451
456
|
.ok-native-list-reorder-preview[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
452
457
|
.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)}
|
|
@@ -459,29 +464,33 @@ export const WEB_LIST_CSS = `
|
|
|
459
464
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
460
465
|
.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}
|
|
461
466
|
.ok-native-list-account-row .ok-native-list-visual,.ok-native-list-account-action-row .ok-native-list-visual{width:32px;height:32px;flex-basis:32px}.ok-native-list-account-row .ok-native-list-visual>img,.ok-native-list-account-row .ok-native-list-visual-main,.ok-native-list-account-action-row .ok-native-list-visual>img,.ok-native-list-account-action-row .ok-native-list-visual-main{width:32px;height:32px}.ok-native-list-account-row .ok-native-list-visual>.ok-native-list-visual-corner{width:20px;height:20px;padding:2px}.ok-native-list-account-action-row .ok-native-list-visual{border-radius:8px!important}.ok-native-list-wallet-row .ok-native-list-title{color:var(--nl-secondary);font-size:12px;line-height:16px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-wallet-row .ok-native-list-title{color:var(--nl-primary)}.ok-native-list-account-row .ok-native-list-title{font-size:16px;line-height:20px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-account-row .ok-native-list-secondary{font-size:14px;line-height:20px;font-weight:400;font-family:var(--nl-font-regular)}
|
|
462
|
-
.ok-native-list-flex{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:center}.ok-native-list-title{font-size:15px;line-height:20px;font-weight:600;
|
|
467
|
+
.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)}
|
|
463
468
|
.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}
|
|
464
|
-
.ok-native-list-value{font-size:14px;line-height:20px;font-weight:500;font-family:var(--nl-font-medium)
|
|
465
|
-
.ok-native-list-action-button{appearance:none;border:0;background:transparent;padding:2px;color:var(--nl-accent);font:600 12px/16px var(--nl-font-semibold)
|
|
466
|
-
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;font-family:var(--nl-font-semibold)
|
|
467
|
-
.ok-native-list-accessories{display:flex;align-items:center;gap:10px;min-width:0}.ok-native-list-accessory{font-size:14px;color:var(--nl-primary);white-space:nowrap}.ok-native-list-accessory-secondary{color:var(--nl-secondary)}.ok-native-list-icon-button{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;border:0;background:transparent;color:var(--nl-icon);font-size:20px;line-height:1;font-weight:500;font-family:var(--nl-font-medium)
|
|
469
|
+
.ok-native-list-value{font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}.ok-native-list-time{font-size:11px;line-height:16px;color:var(--nl-secondary);align-self:flex-start}.ok-native-list-amounts{display:flex;flex-direction:column;align-items:flex-end;min-width:0}.ok-native-list-actions{display:flex;gap:16px;margin-top:6px}
|
|
470
|
+
.ok-native-list-action-button{appearance:none;border:0;background:transparent;padding:2px;color:var(--nl-accent);cursor:pointer;font:600 12px/16px var(--nl-font-semibold)}.ok-native-list-action-button[data-tone="danger"]{color:var(--nl-negative)}.ok-native-list-action-button:disabled{opacity:.5;cursor:default}
|
|
471
|
+
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;overflow:hidden;font-family:var(--nl-font-semibold)}.ok-native-list-visual>.ok-native-list-visual-corner{position:absolute;right:-4px;bottom:-4px;width:18px;height:18px;padding:2px;border-radius:50%;background:var(--nl-row);object-fit:cover}.ok-native-list-stacked{display:flex;align-items:center;width:48px;flex-basis:48px}.ok-native-list-stacked img{width:28px;height:28px;border:2px solid var(--nl-row);border-radius:50%;object-fit:cover;margin-left:-10px}.ok-native-list-stacked img:first-child{margin-left:0}
|
|
472
|
+
.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)}}
|
|
468
473
|
.ok-native-list-badge{display:inline-flex;align-items:center;max-width:100%;height:18px;padding:0 5px;border-radius:5px;background:color-mix(in srgb,var(--nl-accent) 12%,transparent);color:var(--nl-accent);font-size:11px;line-height:18px;white-space:nowrap}.ok-native-list-badge[data-tone="danger"]{background:var(--nl-critical);color:var(--nl-negative)}.ok-native-list-badges{display:inline-flex;gap:4px;margin-left:6px;vertical-align:middle}
|
|
469
|
-
.ok-native-list-section{padding:0 8px;background:var(--nl-bg);gap:8px}.ok-native-list-section[data-variant="summary"]{padding:0 20px}.ok-native-list-section[data-variant="gallery"]{padding:0 12px}.ok-native-list-section[data-variant="history"]{padding:0 8px}.ok-native-list-section-title{font-size:13px;line-height:18px;font-weight:700;
|
|
470
|
-
.ok-native-list-action-row{justify-content:space-between;padding:0 16px}.ok-native-list-action-title{font-size:15px;font-weight:600;
|
|
474
|
+
.ok-native-list-section{padding:0 8px;background:var(--nl-bg);gap:8px}.ok-native-list-section[data-variant="summary"]{padding:0 20px}.ok-native-list-section[data-variant="gallery"]{padding:0 12px}.ok-native-list-section[data-variant="history"]{padding:0 8px}.ok-native-list-section-title{font-size:13px;line-height:18px;font-weight:700;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-bold)}.ok-native-list-section[data-variant="summary"] .ok-native-list-section-title{font-size:16px;font-weight:500;color:var(--nl-primary);font-family:var(--nl-font-medium)}.ok-native-list-section[data-variant="gallery"] .ok-native-list-section-title{font-size:16px;color:var(--nl-primary)}.ok-native-list-section[data-variant="history"] .ok-native-list-section-title{font-size:12px;line-height:16px;letter-spacing:0.8px}.ok-native-list-section-value{margin-left:auto}
|
|
475
|
+
.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)}
|
|
471
476
|
.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)}
|
|
472
477
|
.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}
|
|
473
|
-
.ok-native-list-rail{padding:4px;gap:6px;border-radius:8px}.ok-native-list-rail .ok-native-list-visual{width:20px;height:20px;flex-basis:20px}.ok-native-list-rail .ok-native-list-visual>img,.ok-native-list-rail .ok-native-list-visual-main{width:20px;height:20px}.ok-native-list-rail-title{font-size:12px;font-weight:500;font-family:var(--nl-font-medium)
|
|
474
|
-
.ok-native-list-media{display:block;padding:0 5px;background:transparent;border-radius:16px}.ok-native-list-media-image{display:block;width:100%;aspect-ratio:1;border-radius:10px;background:var(--nl-strong);object-fit:cover}.ok-native-list-media-image[data-state="empty"]{background:transparent}.ok-native-list-media-image[data-state="error"]{display:flex;align-items:center;justify-content:center;color:var(--nl-icon-subdued);font-size:24px}.ok-native-list-media-meta{padding-top:7px}.ok-native-list-media-subtitle-row{display:flex;align-items:center;gap:6px}.ok-native-list-media-subtitle{flex:1;min-width:0;font-size:12px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-media-network{width:14px;height:14px;border-radius:50%}.ok-native-list-media-title{font-size:16px;font-weight:500;
|
|
478
|
+
.ok-native-list-rail{padding:4px;gap:6px;border-radius:8px}.ok-native-list-rail .ok-native-list-visual{width:20px;height:20px;flex-basis:20px}.ok-native-list-rail .ok-native-list-visual>img,.ok-native-list-rail .ok-native-list-visual-main{width:20px;height:20px}.ok-native-list-rail-title{font-size:12px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}
|
|
479
|
+
.ok-native-list-media{display:block;padding:0 5px;background:transparent;border-radius:16px}.ok-native-list-media-image{display:block;width:100%;aspect-ratio:1;border-radius:10px;background:var(--nl-strong);object-fit:cover}.ok-native-list-media-image[data-state="empty"]{background:transparent}.ok-native-list-media-image[data-state="error"]{display:flex;align-items:center;justify-content:center;color:var(--nl-icon-subdued);font-size:24px}.ok-native-list-media-meta{padding-top:7px}.ok-native-list-media-subtitle-row{display:flex;align-items:center;gap:6px}.ok-native-list-media-subtitle{flex:1;min-width:0;font-size:12px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-media-network{width:14px;height:14px;border-radius:50%}.ok-native-list-media-title{font-size:16px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-medium)}.ok-native-list-media-close{position:absolute;right:9px;top:4px;border:0;background:color-mix(in srgb,var(--nl-inverse) 72%,transparent);color:var(--nl-inverse-text);width:24px;height:24px;border-radius:50%;cursor:pointer;font:18px/20px var(--nl-font-regular)}
|
|
475
480
|
.ok-native-list-metric{display:flex;flex-direction:column;align-items:flex-start;padding:12px;border-radius:12px;gap:5px;background:var(--nl-row)}.ok-native-list-metric-value{font-size:22px;line-height:28px;font-weight:700;font-family:var(--nl-font-bold)}.ok-native-list-composite{display:flex;flex-direction:column;align-items:stretch;padding:14px;border-radius:12px;gap:12px;background:var(--nl-subdued)}.ok-native-list-composite-heading{font-size:14px;letter-spacing:1px;color:var(--nl-secondary)}.ok-native-list-composite-row{display:flex;gap:12px}.ok-native-list-composite-cell{flex:1;min-width:0}.ok-native-list-composite-cell[data-shaded="true"]{padding:10px;border-radius:10px;background:color-mix(in srgb,var(--nl-primary) 5%,transparent)}.ok-native-list-composite-value{font-size:18px;font-weight:600;font-family:var(--nl-font-semibold)}.ok-native-list-divider{height:1px;background:var(--nl-separator)}.ok-native-list-progress{height:4px;border-radius:2px;overflow:hidden;background:var(--nl-negative)}.ok-native-list-progress>span{display:block;height:100%;border-radius:2px;background:var(--nl-positive)}
|
|
476
|
-
.ok-native-list-data{padding:6px 12px}.ok-native-list-index{flex:0 0 28px;color:var(--nl-secondary);font-size:13px}.ok-native-list-favorite{flex:0 0 24px;color:var(--nl-icon-subdued);font-size:22px}.ok-native-list-favorite[data-active="true"]{color:var(--nl-accent)}.ok-native-list-data-cell{display:flex;flex-direction:column;min-width:0}.ok-native-list-data-cell[data-align="center"]{align-items:center}.ok-native-list-data-cell[data-align="end"]{align-items:flex-end}.ok-native-list-data-primary{display:flex;align-items:center;gap:5px;max-width:100%;font-size:16px;font-weight:500;font-family:var(--nl-font-medium)
|
|
477
|
-
.ok-native-list-
|
|
481
|
+
.ok-native-list-data{padding:6px 12px}.ok-native-list-index{flex:0 0 28px;color:var(--nl-secondary);font-size:13px}.ok-native-list-favorite{flex:0 0 24px;color:var(--nl-icon-subdued);font-size:22px}.ok-native-list-favorite[data-active="true"]{color:var(--nl-accent)}.ok-native-list-data-cell{display:flex;flex-direction:column;min-width:0}.ok-native-list-data-cell[data-align="center"]{align-items:center}.ok-native-list-data-cell[data-align="end"]{align-items:flex-end}.ok-native-list-data-primary{display:flex;align-items:center;gap:5px;max-width:100%;font-size:16px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}.ok-native-list-unread{width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--nl-accent)}.ok-native-list-thumbnail{width:64px;height:64px;border-radius:10px;object-fit:cover}
|
|
482
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-history{background:var(--nl-selected)}
|
|
483
|
+
.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}
|
|
484
|
+
.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)}
|
|
485
|
+
.ok-native-list-market-table .ok-native-list-visual-fallback>svg{width:28px;height:28px}
|
|
486
|
+
.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)}
|
|
478
487
|
.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}
|
|
479
|
-
.ok-native-list-index-preview{position:absolute;z-index:8;right:40px;top:50%;display:flex;width:48px;height:48px;align-items:center;justify-content:center;transform:translateY(-50%) scale(.92);border-radius:14px;background:var(--nl-inverse);color:var(--nl-inverse-text);font-size:22px;font-weight:600;
|
|
488
|
+
.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)}
|
|
480
489
|
.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}
|
|
481
490
|
@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)}}
|
|
482
|
-
.ok-native-list-footer{flex:0 0 auto;min-height:0}.ok-native-list-sticky{position:absolute;z-index:4;left:0;right:0;top:0;pointer-events:auto;box-shadow:0 1px 0 var(--nl-separator)}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport{scrollbar-width:none}.ok-native-list-viewport-frame:has(>.ok-native-list-index-rail:not([hidden]))>.ok-native-list-viewport::-webkit-scrollbar,.ok-native-list-viewport-frame[data-section-index-visible="true"]>.ok-native-list-viewport::-webkit-scrollbar{display:none}.ok-native-list-index-rail{position:absolute;z-index:6;top:0;right:0;bottom:0;width:${SECTION_INDEX_RAIL_WIDTH}px;touch-action:none;cursor:pointer;font-
|
|
491
|
+
.ok-native-list-footer{flex:0 0 auto;min-height:0}.ok-native-list-sticky{position:absolute;z-index:4;left:0;right:0;top:0;pointer-events:auto;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}
|
|
483
492
|
.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)}
|
|
484
|
-
.ok-native-list-warning{height:auto;display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:14px 12px;border-top:1px solid;border-bottom:1px solid;box-sizing:border-box;cursor:default}.ok-native-list-warning-title,.ok-native-list-warning-message{font-size:14px;line-height:20px;white-space:normal;overflow-wrap:anywhere}.ok-native-list-warning-title{font-weight:500;
|
|
493
|
+
.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)}
|
|
485
494
|
.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. */
|
|
486
495
|
.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))}
|
|
487
496
|
.ok-native-list-checkbox[data-selector="networkSelector"]::after{display:none}
|
|
@@ -493,7 +502,7 @@ export const WEB_LIST_CSS = `
|
|
|
493
502
|
/* OneKey patch: selected group members use the same primary title color as standalone wallets. */
|
|
494
503
|
.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)}
|
|
495
504
|
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges{height:18px}
|
|
496
|
-
.ok-native-list-wallet-row[data-native-list-selector="walletSidebar"] .ok-native-list-wallet-badges>.ok-native-list-badge{font-size:11px;line-height:14px;font-weight:400;
|
|
505
|
+
.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)}
|
|
497
506
|
.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)}
|
|
498
507
|
.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}
|
|
499
508
|
.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%}
|
|
@@ -552,10 +561,12 @@ function disposeWebImageRetries(element) {
|
|
|
552
561
|
function configureWebImageRetry(image, source, initialUri) {
|
|
553
562
|
const fallbackUri = source.fallbackUri ? safeImageUri(source.fallbackUri) : undefined;
|
|
554
563
|
const retryLimit = Number.isFinite(source.retryTimes) ? Math.max(0, Math.floor(source.retryTimes ?? 0)) : 0;
|
|
555
|
-
|
|
564
|
+
const orderedFallbacks = source.fallbackUris;
|
|
565
|
+
if (!fallbackUri && retryLimit === 0 && orderedFallbacks === undefined) return;
|
|
556
566
|
const view = image.ownerDocument.defaultView;
|
|
557
567
|
let currentUri = initialUri;
|
|
558
568
|
let usedFallback = false;
|
|
569
|
+
let fallbackIndex = 0;
|
|
559
570
|
let retryCount = 0;
|
|
560
571
|
let retryTimer;
|
|
561
572
|
let disposed = false;
|
|
@@ -568,7 +579,20 @@ function configureWebImageRetry(image, source, initialUri) {
|
|
|
568
579
|
event.stopImmediatePropagation();
|
|
569
580
|
return;
|
|
570
581
|
}
|
|
571
|
-
if (
|
|
582
|
+
if (orderedFallbacks !== undefined && retryCount >= retryLimit) {
|
|
583
|
+
if (fallbackIndex >= orderedFallbacks.length) return;
|
|
584
|
+
let nextUri;
|
|
585
|
+
while (!nextUri && fallbackIndex < orderedFallbacks.length) {
|
|
586
|
+
nextUri = safeImageUri(orderedFallbacks[fallbackIndex++]);
|
|
587
|
+
}
|
|
588
|
+
if (!nextUri) return;
|
|
589
|
+
event.stopImmediatePropagation();
|
|
590
|
+
retryCount = 0;
|
|
591
|
+
currentUri = nextUri;
|
|
592
|
+
image.src = currentUri;
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (orderedFallbacks === undefined && fallbackUri && !usedFallback && fallbackUri !== currentUri) {
|
|
572
596
|
event.stopImmediatePropagation();
|
|
573
597
|
usedFallback = true;
|
|
574
598
|
currentUri = fallbackUri;
|
|
@@ -599,6 +623,12 @@ function configureWebAvatar(image, source, uri) {
|
|
|
599
623
|
configureWebImageRetry(image, source, resolvedUri);
|
|
600
624
|
image.src = resolvedUri;
|
|
601
625
|
}, () => {
|
|
626
|
+
if (source.fallbackUris !== undefined) {
|
|
627
|
+
configureWebImageRetry(image, source, uri);
|
|
628
|
+
const ImageEvent = image.ownerDocument.defaultView?.Event;
|
|
629
|
+
if (ImageEvent) image.dispatchEvent(new ImageEvent('error'));
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
602
632
|
const fallbackUri = source.fallbackUri ? safeImageUri(source.fallbackUri) : undefined;
|
|
603
633
|
if (fallbackUri) {
|
|
604
634
|
configureWebImageRetry(image, source, fallbackUri);
|
|
@@ -688,6 +718,20 @@ function paintSelectorImageBackground(image, frame, inset = 0) {
|
|
|
688
718
|
|
|
689
719
|
// OneKey patch: use source SVG paths for selector actions and wallet provider marks.
|
|
690
720
|
const selectorIcons = {
|
|
721
|
+
CryptoCoinOutline: {
|
|
722
|
+
viewBox: '0 0 24 24',
|
|
723
|
+
paths: [{
|
|
724
|
+
d: 'M11 16.387a4.5 4.5 0 0 1 0-8.775V6h2v1.613a4.5 4.5 0 0 1 2.856 2.067l-1.712 1.032a2.5 2.5 0 1 0 0 2.576l1.712 1.032A4.5 4.5 0 0 1 13 16.386V18h-2z',
|
|
725
|
+
fill: 'currentColor',
|
|
726
|
+
fillRule: 'nonzero',
|
|
727
|
+
opacity: 1
|
|
728
|
+
}, {
|
|
729
|
+
d: 'M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0',
|
|
730
|
+
fill: 'currentColor',
|
|
731
|
+
fillRule: 'evenodd',
|
|
732
|
+
opacity: 1
|
|
733
|
+
}]
|
|
734
|
+
},
|
|
691
735
|
GlobusOutline: {
|
|
692
736
|
viewBox: '0 0 24 24',
|
|
693
737
|
paths: [{
|
|
@@ -1005,6 +1049,7 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1005
1049
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1006
1050
|
if (fallbackIcon.tintColor) fallback.style.color = fallbackIcon.tintColor;
|
|
1007
1051
|
}
|
|
1052
|
+
fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
1008
1053
|
frame.prepend(fallback);
|
|
1009
1054
|
};
|
|
1010
1055
|
if (image) image.addEventListener('error', showFallback, {
|
|
@@ -1230,6 +1275,7 @@ export class NativeListWebEngine {
|
|
|
1230
1275
|
dataRow: [],
|
|
1231
1276
|
metricCard: [],
|
|
1232
1277
|
market: [],
|
|
1278
|
+
marketTable: [],
|
|
1233
1279
|
identity: [],
|
|
1234
1280
|
sectionHeader: []
|
|
1235
1281
|
};
|
|
@@ -1255,31 +1301,45 @@ export class NativeListWebEngine {
|
|
|
1255
1301
|
measuredRendererHeights = new Map();
|
|
1256
1302
|
notifyScrollCommandAccepted() {
|
|
1257
1303
|
if (this.destroyed) return;
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1304
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1305
|
+
const EventConstructor = owner.ownerDocument.defaultView?.Event;
|
|
1306
|
+
if (EventConstructor) owner.dispatchEvent(new EventConstructor('ok-native-list-scroll-command-accepted'));
|
|
1260
1307
|
}
|
|
1261
1308
|
handlePagerScrollCommandCancel = event => {
|
|
1262
|
-
|
|
1309
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1310
|
+
if (this.destroyed || event.target !== owner) return;
|
|
1263
1311
|
this.pendingScroll = undefined;
|
|
1264
|
-
|
|
1265
|
-
left:
|
|
1266
|
-
top:
|
|
1312
|
+
const options = {
|
|
1313
|
+
left: owner.scrollLeft,
|
|
1314
|
+
top: owner.scrollTop,
|
|
1267
1315
|
behavior: 'instant'
|
|
1268
|
-
}
|
|
1316
|
+
};
|
|
1317
|
+
if (this.externalScrollHost) {
|
|
1318
|
+
const scrollTo = owner.ownerDocument.defaultView?.Element.prototype.scrollTo ?? owner.scrollTo;
|
|
1319
|
+
scrollTo.call(owner, options);
|
|
1320
|
+
} else this.viewport.scrollTo(options);
|
|
1269
1321
|
};
|
|
1270
|
-
constructor(host, snapshot, callbacks, virtualizationEnabled = true, sectionIndexContainer, fontFamiliesJson = '{}') {
|
|
1322
|
+
constructor(host, snapshot, callbacks, virtualizationEnabled = true, sectionIndexContainer, fontFamiliesJson = '{}', scrollOptions = {}) {
|
|
1323
|
+
if (scrollOptions.scrollHost && (!(scrollOptions.scrollHost instanceof host.ownerDocument.defaultView.HTMLElement) || !scrollOptions.scrollHost.contains(host))) throw new Error('webScrollHost must be an ancestor HTMLElement in the same document');
|
|
1324
|
+
this.ownsRefresh = scrollOptions.ownsRefresh === true;
|
|
1325
|
+
if (scrollOptions.scrollHost && snapshot.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1326
|
+
this.externalScrollHost = scrollOptions.scrollHost;
|
|
1327
|
+
this.contentBounds = scrollOptions.contentBounds;
|
|
1328
|
+
this.externalStickyInset = this.validateStickyInset(scrollOptions.stickyInset);
|
|
1271
1329
|
this.document = host.ownerDocument;
|
|
1272
|
-
this.snapshot = validateSnapshot(snapshot);
|
|
1330
|
+
this.snapshot = containNativeListInput(() => validateSnapshot(snapshot)) ?? emptyNativeListSnapshot();
|
|
1273
1331
|
this.callbacks = callbacks;
|
|
1274
1332
|
this.virtualizationEnabled = virtualizationEnabled;
|
|
1275
1333
|
this.sectionIndexContainer = sectionIndexContainer ?? undefined;
|
|
1276
1334
|
this.previousHostPosition = host.style.position;
|
|
1277
1335
|
if (!host.style.position) host.style.position = 'relative';
|
|
1278
1336
|
this.root = createElement(this.document, 'div', 'ok-native-list-root');
|
|
1337
|
+
setData(this.root, 'nativeListParentScroll', !!this.externalScrollHost);
|
|
1279
1338
|
const style = this.document.createElement('style');
|
|
1280
1339
|
style.textContent = WEB_LIST_CSS;
|
|
1281
1340
|
this.viewportFrame = createElement(this.document, 'div', 'ok-native-list-viewport-frame');
|
|
1282
1341
|
this.viewport = createElement(this.document, 'div', 'ok-native-list-viewport');
|
|
1342
|
+
this.pullTarget = this.externalScrollHost && this.ownsRefresh ? this.externalScrollHost : this.viewport;
|
|
1283
1343
|
this.viewport.setAttribute('role', 'list');
|
|
1284
1344
|
this.content = createElement(this.document, 'div', 'ok-native-list-content');
|
|
1285
1345
|
this.footer = createElement(this.document, 'div', 'ok-native-list-footer');
|
|
@@ -1300,18 +1360,47 @@ export class NativeListWebEngine {
|
|
|
1300
1360
|
this.viewportFrame.append(this.viewport, this.sticky, this.indexRail, this.refreshIndicator);
|
|
1301
1361
|
this.root.append(style, this.viewportFrame, this.footer);
|
|
1302
1362
|
host.appendChild(this.root);
|
|
1303
|
-
|
|
1363
|
+
if (this.externalScrollHost) {
|
|
1364
|
+
Object.assign(this.root.style, {
|
|
1365
|
+
position: 'relative',
|
|
1366
|
+
inset: 'auto',
|
|
1367
|
+
overflow: 'visible',
|
|
1368
|
+
flex: 'none'
|
|
1369
|
+
});
|
|
1370
|
+
Object.assign(this.viewportFrame.style, {
|
|
1371
|
+
overflow: 'visible',
|
|
1372
|
+
flex: 'none'
|
|
1373
|
+
});
|
|
1374
|
+
Object.assign(this.viewport.style, {
|
|
1375
|
+
position: 'relative',
|
|
1376
|
+
inset: 'auto',
|
|
1377
|
+
overflow: 'visible',
|
|
1378
|
+
scrollbarGutter: 'auto'
|
|
1379
|
+
});
|
|
1380
|
+
this.content.style.minHeight = '0';
|
|
1381
|
+
this.externalScrollHost.addEventListener('scroll', this.handleExternalScroll, {
|
|
1382
|
+
passive: true,
|
|
1383
|
+
capture: true
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1304
1387
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
1305
1388
|
passive: true
|
|
1306
1389
|
});
|
|
1307
|
-
this.viewport.addEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1390
|
+
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1308
1391
|
this.root.addEventListener('click', this.handleClick);
|
|
1392
|
+
this.root.addEventListener('contextmenu', this.handleMarketContextMenu);
|
|
1309
1393
|
this.root.addEventListener('pointerdown', this.handleMarketPointerDown);
|
|
1310
1394
|
this.root.addEventListener('pointermove', this.handleMarketPointerMove);
|
|
1395
|
+
this.root.addEventListener('touchmove', this.handleMarketTouchMove, {
|
|
1396
|
+
passive: true
|
|
1397
|
+
});
|
|
1311
1398
|
this.root.addEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1312
1399
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1313
1400
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
1314
1401
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
1402
|
+
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
1403
|
+
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
1315
1404
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
1316
1405
|
this.root.addEventListener('keydown', this.handleKeyDown);
|
|
1317
1406
|
this.viewport.addEventListener('pointerdown', this.handleReorderPointerDown, {
|
|
@@ -1334,25 +1423,68 @@ export class NativeListWebEngine {
|
|
|
1334
1423
|
this.indexRail.addEventListener('pointerup', this.handleIndexPointerEnd);
|
|
1335
1424
|
this.indexRail.addEventListener('pointercancel', this.handleIndexPointerEnd);
|
|
1336
1425
|
this.indexRail.addEventListener('click', this.handleIndexClick);
|
|
1337
|
-
this.
|
|
1426
|
+
this.pullTarget.addEventListener('pointerdown', this.handlePullStart, {
|
|
1338
1427
|
passive: true
|
|
1339
1428
|
});
|
|
1340
|
-
this.
|
|
1429
|
+
this.pullTarget.addEventListener('pointermove', this.handlePullMove, {
|
|
1341
1430
|
passive: false
|
|
1342
1431
|
});
|
|
1343
|
-
this.
|
|
1344
|
-
this.
|
|
1432
|
+
this.pullTarget.addEventListener('pointerup', this.handlePullEnd);
|
|
1433
|
+
this.pullTarget.addEventListener('pointercancel', this.handlePullEnd);
|
|
1345
1434
|
const ResizeObserverConstructor = this.document.defaultView?.ResizeObserver;
|
|
1346
1435
|
if (ResizeObserverConstructor) {
|
|
1347
1436
|
this.resizeObserver = new ResizeObserverConstructor(() => this.recomputeLayout());
|
|
1348
1437
|
this.resizeObserver.observe(this.viewport);
|
|
1438
|
+
if (this.externalScrollHost) {
|
|
1439
|
+
this.resizeObserver.observe(this.externalScrollHost);
|
|
1440
|
+
let ancestor = host;
|
|
1441
|
+
while (ancestor && ancestor !== this.externalScrollHost) {
|
|
1442
|
+
this.resizeObserver.observe(ancestor);
|
|
1443
|
+
for (const sibling of ancestor.parentElement?.children ?? []) {
|
|
1444
|
+
if (sibling instanceof this.document.defaultView.HTMLElement) this.resizeObserver.observe(sibling);
|
|
1445
|
+
}
|
|
1446
|
+
ancestor = ancestor.parentElement;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1349
1449
|
} else {
|
|
1350
1450
|
this.document.defaultView?.addEventListener('resize', this.handleWindowResize);
|
|
1351
1451
|
}
|
|
1452
|
+
this.document.fonts?.addEventListener('loadingdone', this.handleWindowResize);
|
|
1352
1453
|
this.observeSectionIndexTransforms();
|
|
1353
1454
|
this.applyFontFamilies(fontFamiliesJson);
|
|
1354
1455
|
this.applySnapshot(this.snapshot);
|
|
1355
1456
|
}
|
|
1457
|
+
validateStickyInset(value = 0) {
|
|
1458
|
+
if (!Number.isFinite(value) || value < 0) throw new Error('webStickyInset must be finite and non-negative');
|
|
1459
|
+
return value;
|
|
1460
|
+
}
|
|
1461
|
+
setStickyInset(value = 0) {
|
|
1462
|
+
const next = this.validateStickyInset(value);
|
|
1463
|
+
if (next === this.externalStickyInset) return;
|
|
1464
|
+
this.externalStickyInset = next;
|
|
1465
|
+
this.recomputeLayout();
|
|
1466
|
+
}
|
|
1467
|
+
externalGeometry() {
|
|
1468
|
+
return this.externalGeometryCache ??= this.readExternalGeometry();
|
|
1469
|
+
}
|
|
1470
|
+
readExternalGeometry() {
|
|
1471
|
+
const host = this.externalScrollHost;
|
|
1472
|
+
const hostRect = host.getBoundingClientRect();
|
|
1473
|
+
const bodyRect = this.viewport.getBoundingClientRect();
|
|
1474
|
+
const boundsRect = (this.contentBounds ?? this.root).getBoundingClientRect();
|
|
1475
|
+
const top = hostRect.top + host.clientTop + this.externalStickyInset;
|
|
1476
|
+
const bottom = hostRect.top + host.clientTop + host.clientHeight;
|
|
1477
|
+
return {
|
|
1478
|
+
origin: bodyRect.top - hostRect.top - host.clientTop + host.scrollTop,
|
|
1479
|
+
containerOrigin: boundsRect.top - hostRect.top - host.clientTop + host.scrollTop,
|
|
1480
|
+
end: boundsRect.bottom - hostRect.top - host.clientTop + host.scrollTop,
|
|
1481
|
+
top,
|
|
1482
|
+
bottom,
|
|
1483
|
+
offset: top - bodyRect.top,
|
|
1484
|
+
viewportLength: Math.max(0, bottom - top),
|
|
1485
|
+
visible: bodyRect.width > 0 && bodyRect.right > hostRect.left && bodyRect.left < hostRect.right && host.clientHeight > 0 && boundsRect.bottom > top && boundsRect.top < bottom
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1356
1488
|
fontFamiliesJson = '{}';
|
|
1357
1489
|
applyFontFamilies(json) {
|
|
1358
1490
|
const families = JSON.parse(json);
|
|
@@ -1384,19 +1516,44 @@ export class NativeListWebEngine {
|
|
|
1384
1516
|
this.renderWindow();
|
|
1385
1517
|
}
|
|
1386
1518
|
applySnapshot(snapshot) {
|
|
1387
|
-
const validated =
|
|
1519
|
+
const validated = containNativeListInput(() => {
|
|
1520
|
+
const next = validateSnapshot(snapshot);
|
|
1521
|
+
if (this.externalScrollHost && next.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1522
|
+
return next;
|
|
1523
|
+
});
|
|
1524
|
+
if (!validated) return;
|
|
1388
1525
|
this.invalidateActionAnchor('snapshot');
|
|
1389
1526
|
this.setSnapshot(validated);
|
|
1390
1527
|
}
|
|
1528
|
+
currentContentHeight() {
|
|
1529
|
+
return this.layout.contentHeight;
|
|
1530
|
+
}
|
|
1531
|
+
currentSnapshot() {
|
|
1532
|
+
return this.snapshot;
|
|
1533
|
+
}
|
|
1391
1534
|
applyPatches(patches) {
|
|
1392
|
-
|
|
1393
|
-
|
|
1535
|
+
const accepted = containNativeListInput(() => {
|
|
1536
|
+
const normalized = validatePatches(patches);
|
|
1537
|
+
return {
|
|
1538
|
+
patches: normalized,
|
|
1539
|
+
snapshot: applyRowPatches(this.snapshot, normalized)
|
|
1540
|
+
};
|
|
1541
|
+
});
|
|
1542
|
+
if (!accepted || accepted.patches.length === 0) return;
|
|
1543
|
+
patches = accepted.patches;
|
|
1544
|
+
const next = accepted.snapshot;
|
|
1394
1545
|
const selection = new Set(this.selectedKeys);
|
|
1395
1546
|
patches.forEach(patch => {
|
|
1396
1547
|
const selected = 'selected' in patch.changes ? patch.changes.selected : undefined;
|
|
1397
1548
|
if (selected === true) selection.add(patch.key);else if (selected === false) selection.delete(patch.key);
|
|
1398
1549
|
});
|
|
1399
|
-
|
|
1550
|
+
const tableValuesOnly = patches.every(patch => {
|
|
1551
|
+
const index = this.rows.findIndex(row => row.key === patch.key);
|
|
1552
|
+
const before = this.rows[index],
|
|
1553
|
+
after = next.rows[index];
|
|
1554
|
+
return patch.type === 'market' && before?.type === 'market' && after?.type === 'market' && Object.keys(patch.changes).every(key => MARKET_QUOTE_PATCH_FIELDS.has(key) || key === 'webTable') && canPatchMarketTableValues(before, after);
|
|
1555
|
+
});
|
|
1556
|
+
if (webMarketImageBindDeltaForPatches(patches) === 0 || tableValuesOnly) {
|
|
1400
1557
|
this.snapshot = next;
|
|
1401
1558
|
this.rows = effectiveRows(next);
|
|
1402
1559
|
this.selectedKeys = selection;
|
|
@@ -1405,11 +1562,11 @@ export class NativeListWebEngine {
|
|
|
1405
1562
|
const row = this.rows[index];
|
|
1406
1563
|
const element = this.mounted.get(index);
|
|
1407
1564
|
if (row?.type === 'market' && element) {
|
|
1408
|
-
setMarketQuoteContent(element, row);
|
|
1565
|
+
if (row.webTable) updateMarketTableValues(element, row);else setMarketQuoteContent(element, row);
|
|
1409
1566
|
element.dataset.renderSignature = webRowRenderSignature(row);
|
|
1410
1567
|
}
|
|
1411
1568
|
if (row?.type === 'market' && this.sticky.dataset.nativeListRowKey === row.key) {
|
|
1412
|
-
setMarketQuoteContent(this.sticky, row);
|
|
1569
|
+
if (row.webTable) updateMarketTableValues(this.sticky, row);else setMarketQuoteContent(this.sticky, row);
|
|
1413
1570
|
this.sticky.dataset.renderSignature = webRowRenderSignature(row);
|
|
1414
1571
|
}
|
|
1415
1572
|
});
|
|
@@ -1479,7 +1636,10 @@ export class NativeListWebEngine {
|
|
|
1479
1636
|
};
|
|
1480
1637
|
return;
|
|
1481
1638
|
}
|
|
1482
|
-
this.
|
|
1639
|
+
if (this.externalScrollHost) {
|
|
1640
|
+
const geometry = this.externalGeometry();
|
|
1641
|
+
this.writeExternalOffset(geometry.containerOrigin + offset, animated);
|
|
1642
|
+
} else this.scrollToAbsoluteOffset(offset, animated);
|
|
1483
1643
|
}
|
|
1484
1644
|
scrollToEnd(animated) {
|
|
1485
1645
|
this.notifyScrollCommandAccepted();
|
|
@@ -1490,7 +1650,10 @@ export class NativeListWebEngine {
|
|
|
1490
1650
|
};
|
|
1491
1651
|
return;
|
|
1492
1652
|
}
|
|
1493
|
-
|
|
1653
|
+
if (this.externalScrollHost) {
|
|
1654
|
+
const geometry = this.externalGeometry();
|
|
1655
|
+
this.writeExternalOffset(geometry.end - this.externalScrollHost.clientHeight, animated);
|
|
1656
|
+
} else this.scrollToAbsoluteOffset(Math.max(0, this.contentLength() - this.viewportLength()), animated);
|
|
1494
1657
|
}
|
|
1495
1658
|
scrollToLocation(params, scroll) {
|
|
1496
1659
|
const index = resolveLocationIndex(this.snapshot.rows, params);
|
|
@@ -1539,19 +1702,25 @@ export class NativeListWebEngine {
|
|
|
1539
1702
|
if (this.sectionIndexTransformFrame !== undefined) this.cancelFrame(this.sectionIndexTransformFrame);
|
|
1540
1703
|
if (this.reorderMovementTimer !== undefined) this.document.defaultView?.clearTimeout(this.reorderMovementTimer);
|
|
1541
1704
|
this.resizeObserver?.disconnect();
|
|
1705
|
+
this.externalScrollHost?.removeEventListener('scroll', this.handleExternalScroll, true);
|
|
1706
|
+
this.document.fonts?.removeEventListener('loadingdone', this.handleWindowResize);
|
|
1542
1707
|
this.sectionIndexTransformObserver?.disconnect();
|
|
1543
1708
|
this.document.defaultView?.removeEventListener('resize', this.handleWindowResize);
|
|
1544
1709
|
this.pendingScroll = undefined;
|
|
1545
|
-
this.viewport.removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1710
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1546
1711
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
1547
|
-
this.viewport.removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1712
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1548
1713
|
this.root.removeEventListener('click', this.handleClick);
|
|
1714
|
+
this.root.removeEventListener('contextmenu', this.handleMarketContextMenu);
|
|
1549
1715
|
this.cancelMarketPointer();
|
|
1550
1716
|
this.root.removeEventListener('pointerdown', this.handleMarketPointerDown);
|
|
1551
1717
|
this.root.removeEventListener('pointermove', this.handleMarketPointerMove);
|
|
1718
|
+
this.root.removeEventListener('touchmove', this.handleMarketTouchMove);
|
|
1552
1719
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1553
1720
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1554
1721
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
1722
|
+
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
1723
|
+
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
1555
1724
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
1556
1725
|
this.root.removeEventListener('keydown', this.handleKeyDown);
|
|
1557
1726
|
this.cancelPointerReorder(true);
|
|
@@ -1567,10 +1736,10 @@ export class NativeListWebEngine {
|
|
|
1567
1736
|
this.indexRail.removeEventListener('pointerup', this.handleIndexPointerEnd);
|
|
1568
1737
|
this.indexRail.removeEventListener('pointercancel', this.handleIndexPointerEnd);
|
|
1569
1738
|
this.indexRail.removeEventListener('click', this.handleIndexClick);
|
|
1570
|
-
this.
|
|
1571
|
-
this.
|
|
1572
|
-
this.
|
|
1573
|
-
this.
|
|
1739
|
+
this.pullTarget.removeEventListener('pointerdown', this.handlePullStart);
|
|
1740
|
+
this.pullTarget.removeEventListener('pointermove', this.handlePullMove);
|
|
1741
|
+
this.pullTarget.removeEventListener('pointerup', this.handlePullEnd);
|
|
1742
|
+
this.pullTarget.removeEventListener('pointercancel', this.handlePullEnd);
|
|
1574
1743
|
const host = this.root.parentElement;
|
|
1575
1744
|
disposeWebImageRetries(this.root);
|
|
1576
1745
|
Object.values(this.pool).forEach(elements => elements.forEach(disposeWebImageRetries));
|
|
@@ -1607,6 +1776,7 @@ export class NativeListWebEngine {
|
|
|
1607
1776
|
'--nl-pressed': theme.rowPressedBackground,
|
|
1608
1777
|
'--nl-subdued': theme.subduedBackground,
|
|
1609
1778
|
'--nl-strong': theme.strongBackground,
|
|
1779
|
+
'--nl-image-fallback-background': theme.imageFallbackBackground ?? 'transparent',
|
|
1610
1780
|
'--nl-primary': theme.primaryText,
|
|
1611
1781
|
'--nl-secondary': theme.secondaryText,
|
|
1612
1782
|
'--nl-disabled': theme.disabledText,
|
|
@@ -1653,8 +1823,47 @@ export class NativeListWebEngine {
|
|
|
1653
1823
|
if (value === undefined) this.root.style.removeProperty(name);else this.root.style.setProperty(name, value);
|
|
1654
1824
|
});
|
|
1655
1825
|
}
|
|
1826
|
+
computeLayout(viewportWidth, viewportHeight) {
|
|
1827
|
+
const measuredSnapshot = {
|
|
1828
|
+
...this.snapshot,
|
|
1829
|
+
rows: this.snapshot.rows.map(row => row.style?.container?.height === undefined && row.height === undefined && this.measuredRendererHeights.get(row.key)?.signature === webRowRenderSignature(row) ? {
|
|
1830
|
+
...row,
|
|
1831
|
+
height: this.measuredRendererHeights.get(row.key).height
|
|
1832
|
+
} : row)
|
|
1833
|
+
};
|
|
1834
|
+
let layout = computeWebListLayout(measuredSnapshot, viewportWidth, viewportHeight, this.reorderCompactKey);
|
|
1835
|
+
if (this.externalScrollHost) {
|
|
1836
|
+
const padding = paddingValues(this.snapshot);
|
|
1837
|
+
layout = {
|
|
1838
|
+
...layout,
|
|
1839
|
+
contentHeight: Math.max(padding.top, ...layout.items.map(item => item.y + item.height)) + padding.bottom
|
|
1840
|
+
};
|
|
1841
|
+
}
|
|
1842
|
+
return layout;
|
|
1843
|
+
}
|
|
1844
|
+
writeExternalHeight(height) {
|
|
1845
|
+
const value = String(height) + 'px';
|
|
1846
|
+
this.content.style.height = value;
|
|
1847
|
+
this.viewport.style.height = value;
|
|
1848
|
+
this.viewportFrame.style.height = value;
|
|
1849
|
+
this.root.style.height = value;
|
|
1850
|
+
}
|
|
1656
1851
|
recomputeLayout = () => {
|
|
1657
1852
|
if (this.destroyed) return;
|
|
1853
|
+
const cachedWidth = this.lastViewportWidth;
|
|
1854
|
+
const cachedHeight = this.lastViewportHeight;
|
|
1855
|
+
const precomputedLayout = this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0 ? this.computeLayout(cachedWidth, cachedHeight) : undefined;
|
|
1856
|
+
if (precomputedLayout) {
|
|
1857
|
+
// Commit appended row extent before measuring React-owned slot changes.
|
|
1858
|
+
this.writeExternalHeight(Math.max(this.layout.contentHeight, precomputedLayout.contentHeight));
|
|
1859
|
+
}
|
|
1860
|
+
this.externalGeometryCache = undefined;
|
|
1861
|
+
if (this.externalScrollHost) {
|
|
1862
|
+
const geometry = this.externalGeometry();
|
|
1863
|
+
const previousOrigin = this.externalOrigin;
|
|
1864
|
+
this.externalOrigin = geometry.origin;
|
|
1865
|
+
if (previousOrigin !== undefined && geometry.origin !== previousOrigin && this.externalScrollHost.scrollTop > previousOrigin && geometry.visible) this.externalScrollHost.scrollTop += geometry.origin - previousOrigin;
|
|
1866
|
+
}
|
|
1658
1867
|
const viewportWidth = this.viewport.clientWidth;
|
|
1659
1868
|
const viewportHeight = this.snapshot.layout.orientation === 'horizontal' ? this.viewport.clientHeight : this.verticalScrollMetrics().viewportLength;
|
|
1660
1869
|
const stickyInset = this.snapshot.layout.orientation === 'horizontal' ? 0 : this.collapsiblePagerInsets().sticky;
|
|
@@ -1672,16 +1881,13 @@ export class NativeListWebEngine {
|
|
|
1672
1881
|
this.lastViewportWidth = viewportWidth;
|
|
1673
1882
|
this.lastViewportHeight = viewportHeight;
|
|
1674
1883
|
const previousHorizontal = this.layout.horizontal;
|
|
1675
|
-
|
|
1676
|
-
...this.snapshot,
|
|
1677
|
-
rows: this.snapshot.rows.map(row => row.style?.container?.height === undefined && row.height === undefined && this.measuredRendererHeights.get(row.key)?.signature === webRowRenderSignature(row) ? {
|
|
1678
|
-
...row,
|
|
1679
|
-
height: this.measuredRendererHeights.get(row.key).height
|
|
1680
|
-
} : row)
|
|
1681
|
-
};
|
|
1682
|
-
this.layout = computeWebListLayout(measuredSnapshot, viewportWidth, viewportHeight, this.reorderCompactKey);
|
|
1884
|
+
this.layout = precomputedLayout && viewportWidth === cachedWidth && viewportHeight === cachedHeight ? precomputedLayout : this.computeLayout(viewportWidth, viewportHeight);
|
|
1683
1885
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
1684
1886
|
this.content.style.height = String(this.layout.contentHeight) + 'px';
|
|
1887
|
+
if (this.externalScrollHost) {
|
|
1888
|
+
this.writeExternalHeight(this.layout.contentHeight);
|
|
1889
|
+
this.externalGeometryCache = undefined;
|
|
1890
|
+
}
|
|
1685
1891
|
this.renderSectionIndex(this.viewport.clientHeight <= 0 ? DEFAULT_VIEWPORT_HEIGHT : Math.max(1, viewportHeight), stickyInset);
|
|
1686
1892
|
if (previousHorizontal !== this.layout.horizontal) {
|
|
1687
1893
|
this.viewport.scrollLeft = 0;
|
|
@@ -1691,6 +1897,11 @@ export class NativeListWebEngine {
|
|
|
1691
1897
|
this.performPendingScroll();
|
|
1692
1898
|
};
|
|
1693
1899
|
updateAvatarWindow() {
|
|
1900
|
+
if (this.externalScrollHost && !this.externalGeometry().visible) {
|
|
1901
|
+
this.avatarLeases.forEach(lease => lease());
|
|
1902
|
+
this.avatarLeases.clear();
|
|
1903
|
+
return;
|
|
1904
|
+
}
|
|
1694
1905
|
const offset = this.currentOffset();
|
|
1695
1906
|
if (offset !== this.avatarOffset) this.avatarDirection = Math.sign(offset - this.avatarOffset);
|
|
1696
1907
|
this.avatarOffset = offset;
|
|
@@ -1729,7 +1940,7 @@ export class NativeListWebEngine {
|
|
|
1729
1940
|
renderWindow() {
|
|
1730
1941
|
this.updateAvatarWindow();
|
|
1731
1942
|
const viewportLength = this.viewportLength();
|
|
1732
|
-
const visible = webLayoutItemsForMount(this.layout, this.currentOffset(), viewportLength, this.virtualizationEnabled, viewportLength * OVERSCAN_VIEWPORTS);
|
|
1943
|
+
const visible = this.externalScrollHost && !this.externalGeometry().visible ? [] : webLayoutItemsForMount(this.layout, this.currentOffset(), viewportLength, this.virtualizationEnabled, viewportLength * OVERSCAN_VIEWPORTS);
|
|
1733
1944
|
const desired = new Set(visible.map(item => item.index));
|
|
1734
1945
|
this.mounted.forEach((element, index) => {
|
|
1735
1946
|
const nextRow = this.rows[index];
|
|
@@ -1799,6 +2010,7 @@ export class NativeListWebEngine {
|
|
|
1799
2010
|
const bindingEpoch = String(++this.bindingEpochCounter);
|
|
1800
2011
|
element.className = overlay ? 'ok-native-list-item ok-native-list-sticky' : 'ok-native-list-item';
|
|
1801
2012
|
setData(element, 'nativeListRowKey', row.key);
|
|
2013
|
+
setData(element, 'nativeListMediaGallery', row.type === 'mediaTile' && row.variant === 'gallery' ? 'true' : undefined);
|
|
1802
2014
|
setData(element, 'nativeListBindingEpoch', bindingEpoch);
|
|
1803
2015
|
setData(element, 'nativeListRowIndex', index);
|
|
1804
2016
|
setData(element, 'nativeListDisabled', Boolean(row.disabled));
|
|
@@ -2075,7 +2287,7 @@ export class NativeListWebEngine {
|
|
|
2075
2287
|
if (!Number.isNaN(stickyIndex)) update(this.sticky, this.rows[stickyIndex]);
|
|
2076
2288
|
}
|
|
2077
2289
|
updateVisibleState() {
|
|
2078
|
-
const visible = visibleWebLayoutItems(this.layout, this.currentOffset(), this.viewportLength());
|
|
2290
|
+
const visible = this.externalScrollHost && !this.externalGeometry().visible ? [] : visibleWebLayoutItems(this.layout, this.currentOffset(), this.viewportLength());
|
|
2079
2291
|
const first = visible[0];
|
|
2080
2292
|
const last = visible.at(-1);
|
|
2081
2293
|
const signature = String(first?.index ?? -1) + ':' + String(last?.index ?? -1) + ':' + (first?.key ?? '') + ':' + (last?.key ?? '');
|
|
@@ -2126,6 +2338,7 @@ export class NativeListWebEngine {
|
|
|
2126
2338
|
this.sticky.style.right = 'auto';
|
|
2127
2339
|
this.sticky.style.width = String(item.width) + 'px';
|
|
2128
2340
|
this.sticky.style.height = String(item.height) + 'px';
|
|
2341
|
+
if (this.externalScrollHost) this.sticky.style.top = String(Math.max(0, this.currentOffset())) + 'px';
|
|
2129
2342
|
let nextIndex = -1;
|
|
2130
2343
|
for (let cursor = index + 1; cursor < this.rows.length; cursor += 1) {
|
|
2131
2344
|
const candidate = this.rows[cursor];
|
|
@@ -2146,7 +2359,7 @@ export class NativeListWebEngine {
|
|
|
2146
2359
|
this.indexRail.querySelectorAll('[data-section-key]').forEach(button => setData(button, 'active', button.dataset.sectionKey === activeKey));
|
|
2147
2360
|
}
|
|
2148
2361
|
checkEndReached(lastVisibleIndex) {
|
|
2149
|
-
if (!this.snapshot.capabilities?.loadMore || this.reachedGeneration === this.snapshot.generation || this.rows.length === 0) return;
|
|
2362
|
+
if (this.externalScrollHost && !this.externalGeometry().visible || !this.snapshot.capabilities?.loadMore || this.reachedGeneration === this.snapshot.generation || this.rows.length === 0) return;
|
|
2150
2363
|
const threshold = Math.max(1, Math.ceil(this.rows.length * (this.snapshot.capabilities.endReachedThreshold ?? 0.2)));
|
|
2151
2364
|
if (lastVisibleIndex < this.rows.length - threshold) return;
|
|
2152
2365
|
this.reachedGeneration = this.snapshot.generation;
|
|
@@ -2160,6 +2373,7 @@ export class NativeListWebEngine {
|
|
|
2160
2373
|
this.callbacks.onScrollToIndexFailed?.(scrollFailure(this.rows, index, reason, average));
|
|
2161
2374
|
}
|
|
2162
2375
|
canScroll() {
|
|
2376
|
+
if (this.externalScrollHost) return this.viewport.clientWidth > 0 && this.externalScrollHost.clientHeight > 0;
|
|
2163
2377
|
const viewportLength = this.layout.horizontal ? this.viewport.clientWidth : this.viewport.clientHeight;
|
|
2164
2378
|
return viewportLength > 0 && this.layout.items.length > 0;
|
|
2165
2379
|
}
|
|
@@ -2167,16 +2381,25 @@ export class NativeListWebEngine {
|
|
|
2167
2381
|
if (this.layout.horizontal) {
|
|
2168
2382
|
return this.viewport.clientWidth || DEFAULT_VIEWPORT_WIDTH;
|
|
2169
2383
|
}
|
|
2384
|
+
if (this.externalScrollHost) return this.externalGeometry().viewportLength;
|
|
2170
2385
|
if (this.viewport.clientHeight <= 0) return DEFAULT_VIEWPORT_HEIGHT;
|
|
2171
2386
|
return Math.max(1, this.verticalScrollMetrics().viewportLength);
|
|
2172
2387
|
}
|
|
2173
2388
|
contentLength() {
|
|
2389
|
+
if (this.externalScrollHost) {
|
|
2390
|
+
const geometry = this.externalGeometry();
|
|
2391
|
+
return Math.max(this.layout.contentHeight, geometry.end - geometry.origin);
|
|
2392
|
+
}
|
|
2174
2393
|
return this.layout.horizontal ? this.layout.contentWidth : this.layout.contentHeight;
|
|
2175
2394
|
}
|
|
2176
2395
|
currentOffset() {
|
|
2177
2396
|
return this.layout.horizontal ? this.viewport.scrollLeft : this.verticalScrollMetrics().offset;
|
|
2178
2397
|
}
|
|
2179
2398
|
collapsiblePagerInsets() {
|
|
2399
|
+
if (this.externalScrollHost) return {
|
|
2400
|
+
header: 0,
|
|
2401
|
+
sticky: this.externalStickyInset
|
|
2402
|
+
};
|
|
2180
2403
|
const readInset = name => {
|
|
2181
2404
|
const parsed = Number.parseFloat(this.viewport.style.getPropertyValue(name));
|
|
2182
2405
|
return Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
|
@@ -2187,13 +2410,29 @@ export class NativeListWebEngine {
|
|
|
2187
2410
|
};
|
|
2188
2411
|
}
|
|
2189
2412
|
verticalScrollMetrics() {
|
|
2413
|
+
if (this.externalScrollHost) return this.externalGeometry();
|
|
2190
2414
|
const insets = this.collapsiblePagerInsets();
|
|
2191
2415
|
return resolveWebCollapsiblePagerScrollMetrics(this.viewport.scrollTop, this.viewport.clientHeight, insets.header, insets.sticky);
|
|
2192
2416
|
}
|
|
2193
2417
|
handleCollapsiblePagerInsetsChanged = () => {
|
|
2194
2418
|
this.recomputeLayout();
|
|
2195
2419
|
};
|
|
2420
|
+
writeExternalOffset(rawOffset, animated) {
|
|
2421
|
+
this.externalGeometryCache = undefined;
|
|
2422
|
+
const host = this.externalScrollHost;
|
|
2423
|
+
const scrollTo = host.ownerDocument.defaultView?.Element.prototype.scrollTo ?? host.scrollTo;
|
|
2424
|
+
scrollTo.call(host, {
|
|
2425
|
+
top: Math.max(0, Math.min(host.scrollHeight - host.clientHeight, rawOffset)),
|
|
2426
|
+
behavior: animated ? 'smooth' : 'auto'
|
|
2427
|
+
});
|
|
2428
|
+
this.scheduleFrame();
|
|
2429
|
+
}
|
|
2196
2430
|
scrollToAbsoluteOffset(offset, animated) {
|
|
2431
|
+
if (this.externalScrollHost) {
|
|
2432
|
+
const geometry = this.externalGeometry();
|
|
2433
|
+
this.writeExternalOffset(geometry.origin + offset - this.externalStickyInset, animated);
|
|
2434
|
+
return;
|
|
2435
|
+
}
|
|
2197
2436
|
const resolved = Math.min(Math.max(0, offset), Math.max(0, this.contentLength() - this.viewportLength()));
|
|
2198
2437
|
const rawOffset = this.layout.horizontal ? resolved : resolveWebCollapsiblePagerRawOffset(resolved, this.collapsiblePagerInsets().header);
|
|
2199
2438
|
this.viewport.scrollTo(this.layout.horizontal ? {
|
|
@@ -2242,13 +2481,16 @@ export class NativeListWebEngine {
|
|
|
2242
2481
|
this.renderFooter();
|
|
2243
2482
|
this.callbacks.onSelectionDelta?.(result.delta);
|
|
2244
2483
|
}
|
|
2245
|
-
emitRowAction(row, actionKey, actionElement, rowElement) {
|
|
2484
|
+
emitRowAction(row, actionKey, actionElement, rowElement, windowPoint) {
|
|
2246
2485
|
const anchor = actionElement && rowElement ? this.createActionAnchor(actionElement, rowElement) : undefined;
|
|
2247
2486
|
this.callbacks.onRowAction?.({
|
|
2248
2487
|
rowKey: row.key,
|
|
2249
2488
|
actionKey,
|
|
2250
2489
|
sectionKey: row.sectionKey,
|
|
2251
|
-
anchor
|
|
2490
|
+
anchor,
|
|
2491
|
+
...(windowPoint && Number.isFinite(windowPoint.x) && Number.isFinite(windowPoint.y) ? {
|
|
2492
|
+
windowPoint
|
|
2493
|
+
} : {})
|
|
2252
2494
|
});
|
|
2253
2495
|
}
|
|
2254
2496
|
createActionAnchor(actionElement, rowElement, sourceOverride) {
|
|
@@ -2329,6 +2571,23 @@ export class NativeListWebEngine {
|
|
|
2329
2571
|
this.document.defaultView?.clearTimeout(state.timer);
|
|
2330
2572
|
this.marketPointer = undefined;
|
|
2331
2573
|
}
|
|
2574
|
+
handleMarketContextMenu = event => {
|
|
2575
|
+
if (!(event.target instanceof Element) || event.target.closest('[data-native-list-action]')) return;
|
|
2576
|
+
const element = event.target.closest('[data-native-list-row-key]');
|
|
2577
|
+
const row = this.rowAtElement(element);
|
|
2578
|
+
if (row?.type !== 'market' || !row.webTable?.contextMenuActionKey || !element || !isRowPressEnabled(row)) return;
|
|
2579
|
+
event.preventDefault();
|
|
2580
|
+
this.cancelMarketPointer();
|
|
2581
|
+
markActionAnchorSource(element, 'row');
|
|
2582
|
+
const rect = element.getBoundingClientRect();
|
|
2583
|
+
this.emitRowAction(row, row.webTable.contextMenuActionKey, element, element, event.clientX || event.clientY ? {
|
|
2584
|
+
x: event.clientX,
|
|
2585
|
+
y: event.clientY
|
|
2586
|
+
} : {
|
|
2587
|
+
x: rect.left + rect.width / 2,
|
|
2588
|
+
y: rect.top + rect.height / 2
|
|
2589
|
+
});
|
|
2590
|
+
};
|
|
2332
2591
|
handleMarketPointerDown = event => {
|
|
2333
2592
|
if (event.button !== 0 || !(event.target instanceof Element)) return;
|
|
2334
2593
|
this.marketLongPressFired = false;
|
|
@@ -2340,16 +2599,24 @@ export class NativeListWebEngine {
|
|
|
2340
2599
|
if (row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2341
2600
|
if (!row.longPressActionKey || !rowElement) return;
|
|
2342
2601
|
markActionAnchorSource(rowElement, 'row');
|
|
2602
|
+
const bindingEpoch = rowElement.dataset.nativeListBindingEpoch;
|
|
2343
2603
|
const timer = this.document.defaultView?.setTimeout(() => {
|
|
2344
2604
|
const current = this.marketPointer;
|
|
2345
2605
|
if (!current || current.pointerId !== event.pointerId) return;
|
|
2606
|
+
const currentRow = this.rowAtElement(rowElement);
|
|
2346
2607
|
this.marketPointer = undefined;
|
|
2608
|
+
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2347
2609
|
this.marketLongPressFired = true;
|
|
2348
|
-
this.emitRowAction(
|
|
2610
|
+
this.emitRowAction(currentRow, currentRow.longPressActionKey, rowElement, rowElement, {
|
|
2611
|
+
x: event.clientX,
|
|
2612
|
+
y: event.clientY
|
|
2613
|
+
});
|
|
2349
2614
|
}, MARKET_LONG_PRESS_MS);
|
|
2350
2615
|
if (timer === undefined) return;
|
|
2351
2616
|
this.marketPointer = {
|
|
2352
2617
|
pointerId: event.pointerId,
|
|
2618
|
+
pointerType: event.pointerType,
|
|
2619
|
+
compact: !row.webTable,
|
|
2353
2620
|
rowKey: row.key,
|
|
2354
2621
|
startX: event.clientX,
|
|
2355
2622
|
startY: event.clientY,
|
|
@@ -2359,7 +2626,21 @@ export class NativeListWebEngine {
|
|
|
2359
2626
|
handleMarketPointerMove = event => {
|
|
2360
2627
|
const state = this.marketPointer;
|
|
2361
2628
|
if (!state || state.pointerId !== event.pointerId) return;
|
|
2362
|
-
if (
|
|
2629
|
+
if (state.compact && state.pointerType === 'touch') return;
|
|
2630
|
+
const row = this.rows.find(item => item.key === state.rowKey);
|
|
2631
|
+
const threshold = row?.type === 'market' && !row.webTable ? 3 : MARKET_MOVE_CANCEL_PX;
|
|
2632
|
+
if (Math.abs(event.clientX - state.startX) > threshold || Math.abs(event.clientY - state.startY) > threshold) this.cancelMarketPointer();
|
|
2633
|
+
};
|
|
2634
|
+
handleMarketTouchMove = event => {
|
|
2635
|
+
const state = this.marketPointer;
|
|
2636
|
+
if (!state?.compact || state.pointerType !== 'touch' || !(event.target instanceof Element) || event.target.closest('[data-native-list-row-key]')?.dataset.nativeListRowKey !== state.rowKey) return;
|
|
2637
|
+
if (event.touches.length > 1) {
|
|
2638
|
+
this.cancelMarketPointer();
|
|
2639
|
+
return;
|
|
2640
|
+
}
|
|
2641
|
+
const touch = event.touches[0] ?? event.changedTouches[0];
|
|
2642
|
+
if (!touch || !Number.isFinite(touch.clientX) || !Number.isFinite(touch.clientY)) return;
|
|
2643
|
+
if (Math.abs(touch.clientX - state.startX) > 3 || Math.abs(touch.clientY - state.startY) > 3) this.cancelMarketPointer();
|
|
2363
2644
|
};
|
|
2364
2645
|
handleMarketPointerEnd = event => {
|
|
2365
2646
|
if (this.marketPointer?.pointerId === event.pointerId) this.cancelMarketPointer();
|
|
@@ -2371,6 +2652,7 @@ export class NativeListWebEngine {
|
|
|
2371
2652
|
if (!(target instanceof Element)) return;
|
|
2372
2653
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2373
2654
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
2655
|
+
if (action.classList.contains('ok-native-list-market-subtitle-prefix') && action.scrollWidth <= action.clientWidth + 1) return;
|
|
2374
2656
|
const rowElement = action.closest('[data-native-list-row-key]');
|
|
2375
2657
|
const row = this.rowAtElement(rowElement);
|
|
2376
2658
|
const memberKey = action.closest('[data-native-list-group-member-key]')?.dataset.nativeListGroupMemberKey;
|
|
@@ -2516,7 +2798,12 @@ export class NativeListWebEngine {
|
|
|
2516
2798
|
preventScroll: true
|
|
2517
2799
|
});
|
|
2518
2800
|
}
|
|
2801
|
+
handleExternalScroll = event => {
|
|
2802
|
+
const target = event.target;
|
|
2803
|
+
if (target === this.externalScrollHost || target instanceof Element && target !== this.root && this.externalScrollHost?.contains(target) && target.contains(this.root)) this.handleScroll();
|
|
2804
|
+
};
|
|
2519
2805
|
handleScroll = () => {
|
|
2806
|
+
this.externalGeometryCache = undefined;
|
|
2520
2807
|
this.cancelMarketPointer();
|
|
2521
2808
|
this.invalidateActionAnchor('scroll');
|
|
2522
2809
|
this.scheduleFrame();
|
|
@@ -2530,6 +2817,8 @@ export class NativeListWebEngine {
|
|
|
2530
2817
|
if (this.frameHandle !== undefined || this.destroyed) return;
|
|
2531
2818
|
this.frameHandle = this.requestFrame(() => {
|
|
2532
2819
|
this.frameHandle = undefined;
|
|
2820
|
+
this.externalGeometryCache = undefined;
|
|
2821
|
+
if (this.externalScrollHost) this.externalOrigin = this.externalGeometry().origin;
|
|
2533
2822
|
if (this.virtualizationEnabled) this.renderWindow();else {
|
|
2534
2823
|
this.updateAvatarWindow();
|
|
2535
2824
|
this.updateVisibleState();
|
|
@@ -2592,7 +2881,7 @@ export class NativeListWebEngine {
|
|
|
2592
2881
|
this.selectIndexPosition(entry.position);
|
|
2593
2882
|
};
|
|
2594
2883
|
handlePullStart = event => {
|
|
2595
|
-
if (this.pointerReorder?.pointerId === event.pointerId || !this.snapshot.capabilities?.pullToRefresh || this.
|
|
2884
|
+
if (this.pointerReorder?.pointerId === event.pointerId || !this.snapshot.capabilities?.pullToRefresh || !!this.externalScrollHost && !this.ownsRefresh || this.pullTarget.scrollTop > 0 || event.pointerType !== 'touch' && event.pointerType !== 'pen') return;
|
|
2596
2885
|
this.pullStartY = event.clientY;
|
|
2597
2886
|
this.pullDistance = 0;
|
|
2598
2887
|
};
|
|
@@ -2668,6 +2957,7 @@ export class NativeListWebEngine {
|
|
|
2668
2957
|
if (this.pointerReorder !== state) return;
|
|
2669
2958
|
this.clearReorderLongPress(state);
|
|
2670
2959
|
state.active = true;
|
|
2960
|
+
this.cancelMarketPointer();
|
|
2671
2961
|
state.activatedAt = Date.now();
|
|
2672
2962
|
state.viewportRect = this.reorderViewportRect();
|
|
2673
2963
|
this.captureReorderPointer(state);
|
|
@@ -2744,6 +3034,10 @@ export class NativeListWebEngine {
|
|
|
2744
3034
|
this.cancelPointerReorder(true);
|
|
2745
3035
|
};
|
|
2746
3036
|
setCurrentOffset(offset) {
|
|
3037
|
+
if (this.externalScrollHost) {
|
|
3038
|
+
this.scrollToAbsoluteOffset(offset, false);
|
|
3039
|
+
return;
|
|
3040
|
+
}
|
|
2747
3041
|
const maximum = Math.max(0, this.contentLength() - this.viewportLength());
|
|
2748
3042
|
const next = Math.max(0, Math.min(maximum, offset));
|
|
2749
3043
|
if (this.layout.horizontal) this.viewport.scrollLeft = next;else {
|
|
@@ -2801,7 +3095,7 @@ export class NativeListWebEngine {
|
|
|
2801
3095
|
const viewportRect = this.viewport.getBoundingClientRect();
|
|
2802
3096
|
const insets = this.collapsiblePagerInsets();
|
|
2803
3097
|
const left = viewportRect.left + destinationLayout.x - this.viewport.scrollLeft;
|
|
2804
|
-
const top = viewportRect.top + destinationLayout.y + insets.header + insets.sticky - this.viewport.scrollTop;
|
|
3098
|
+
const top = this.externalScrollHost ? viewportRect.top + destinationLayout.y : viewportRect.top + destinationLayout.y + insets.header + insets.sticky - this.viewport.scrollTop;
|
|
2805
3099
|
this.reorderPreview.getBoundingClientRect();
|
|
2806
3100
|
this.reorderPreview.style.transition = 'transform ' + String(REORDER_DROP_TRANSITION_MS) + 'ms ' + WEB_REORDER_ANIMATION.dropTimingFunction + ', box-shadow ' + String(REORDER_DROP_TRANSITION_MS) + 'ms ' + WEB_REORDER_ANIMATION.dropTimingFunction;
|
|
2807
3101
|
this.reorderPreview.style.boxShadow = 'none';
|
|
@@ -2851,6 +3145,18 @@ export class NativeListWebEngine {
|
|
|
2851
3145
|
this.reorderPreview.style.transform = 'translate3d(' + String(x) + 'px,' + String(y) + 'px,0)';
|
|
2852
3146
|
}
|
|
2853
3147
|
reorderViewportRect() {
|
|
3148
|
+
if (this.externalScrollHost) {
|
|
3149
|
+
const geometry = this.externalGeometry();
|
|
3150
|
+
const body = this.viewport.getBoundingClientRect();
|
|
3151
|
+
return {
|
|
3152
|
+
left: body.left,
|
|
3153
|
+
right: body.right,
|
|
3154
|
+
width: body.width,
|
|
3155
|
+
top: geometry.top,
|
|
3156
|
+
bottom: geometry.bottom,
|
|
3157
|
+
height: geometry.viewportLength
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
2854
3160
|
const {
|
|
2855
3161
|
left,
|
|
2856
3162
|
top,
|