@onekeyfe/react-native-native-list 6.7.0-1 → 6.7.0-3
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 +380 -11
- package/ios/HybridNativeList.swift +11 -3
- package/ios/RNCNativeListView.swift +10 -6
- package/ios/tests/NativeListLifecycleTests.swift +28 -0
- package/lib/module/NativeList.js +4 -2
- package/lib/module/NativeList.web.js +135 -29
- package/lib/module/ScrollEdgeEffect.js +8 -0
- package/lib/module/index.js +1 -0
- package/lib/module/validation.js +143 -34
- package/lib/module/web/NativeListWebEngine.js +353 -62
- package/lib/module/web/templates/ActivityRowRenderer.js +432 -5
- package/lib/module/web/templates/MarketRowRenderer.js +8 -3
- package/lib/module/web/templates/MarketTableRowRenderer.js +576 -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.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/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 +6 -2
- package/src/NativeList.types.ts +15 -3
- package/src/NativeList.web.tsx +183 -38
- package/src/ScrollEdgeEffect.ts +4 -0
- package/src/index.ts +2 -0
- package/src/models.ts +93 -0
- package/src/validation.ts +348 -58
- package/src/web/NativeListWebEngine.ts +600 -95
- package/src/web/templates/ActivityRowRenderer.ts +656 -7
- package/src/web/templates/MarketRowRenderer.ts +19 -3
- package/src/web/templates/MarketTableRowRenderer.ts +752 -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,6 +5,7 @@ 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";
|
|
@@ -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,17 @@ 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
|
+
const nextUri = safeImageUri(orderedFallbacks[fallbackIndex++]);
|
|
585
|
+
if (!nextUri) return;
|
|
586
|
+
event.stopImmediatePropagation();
|
|
587
|
+
retryCount = 0;
|
|
588
|
+
currentUri = nextUri;
|
|
589
|
+
image.src = currentUri;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
if (orderedFallbacks === undefined && fallbackUri && !usedFallback && fallbackUri !== currentUri) {
|
|
572
593
|
event.stopImmediatePropagation();
|
|
573
594
|
usedFallback = true;
|
|
574
595
|
currentUri = fallbackUri;
|
|
@@ -599,6 +620,12 @@ function configureWebAvatar(image, source, uri) {
|
|
|
599
620
|
configureWebImageRetry(image, source, resolvedUri);
|
|
600
621
|
image.src = resolvedUri;
|
|
601
622
|
}, () => {
|
|
623
|
+
if (source.fallbackUris !== undefined) {
|
|
624
|
+
configureWebImageRetry(image, source, uri);
|
|
625
|
+
const ImageEvent = image.ownerDocument.defaultView?.Event;
|
|
626
|
+
if (ImageEvent) image.dispatchEvent(new ImageEvent('error'));
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
602
629
|
const fallbackUri = source.fallbackUri ? safeImageUri(source.fallbackUri) : undefined;
|
|
603
630
|
if (fallbackUri) {
|
|
604
631
|
configureWebImageRetry(image, source, fallbackUri);
|
|
@@ -688,6 +715,20 @@ function paintSelectorImageBackground(image, frame, inset = 0) {
|
|
|
688
715
|
|
|
689
716
|
// OneKey patch: use source SVG paths for selector actions and wallet provider marks.
|
|
690
717
|
const selectorIcons = {
|
|
718
|
+
CryptoCoinOutline: {
|
|
719
|
+
viewBox: '0 0 24 24',
|
|
720
|
+
paths: [{
|
|
721
|
+
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',
|
|
722
|
+
fill: 'currentColor',
|
|
723
|
+
fillRule: 'nonzero',
|
|
724
|
+
opacity: 1
|
|
725
|
+
}, {
|
|
726
|
+
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',
|
|
727
|
+
fill: 'currentColor',
|
|
728
|
+
fillRule: 'evenodd',
|
|
729
|
+
opacity: 1
|
|
730
|
+
}]
|
|
731
|
+
},
|
|
691
732
|
GlobusOutline: {
|
|
692
733
|
viewBox: '0 0 24 24',
|
|
693
734
|
paths: [{
|
|
@@ -1005,6 +1046,7 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1005
1046
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1006
1047
|
if (fallbackIcon.tintColor) fallback.style.color = fallbackIcon.tintColor;
|
|
1007
1048
|
}
|
|
1049
|
+
fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
1008
1050
|
frame.prepend(fallback);
|
|
1009
1051
|
};
|
|
1010
1052
|
if (image) image.addEventListener('error', showFallback, {
|
|
@@ -1230,6 +1272,7 @@ export class NativeListWebEngine {
|
|
|
1230
1272
|
dataRow: [],
|
|
1231
1273
|
metricCard: [],
|
|
1232
1274
|
market: [],
|
|
1275
|
+
marketTable: [],
|
|
1233
1276
|
identity: [],
|
|
1234
1277
|
sectionHeader: []
|
|
1235
1278
|
};
|
|
@@ -1255,19 +1298,31 @@ export class NativeListWebEngine {
|
|
|
1255
1298
|
measuredRendererHeights = new Map();
|
|
1256
1299
|
notifyScrollCommandAccepted() {
|
|
1257
1300
|
if (this.destroyed) return;
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1301
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1302
|
+
const EventConstructor = owner.ownerDocument.defaultView?.Event;
|
|
1303
|
+
if (EventConstructor) owner.dispatchEvent(new EventConstructor('ok-native-list-scroll-command-accepted'));
|
|
1260
1304
|
}
|
|
1261
1305
|
handlePagerScrollCommandCancel = event => {
|
|
1262
|
-
|
|
1306
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1307
|
+
if (this.destroyed || event.target !== owner) return;
|
|
1263
1308
|
this.pendingScroll = undefined;
|
|
1264
|
-
|
|
1265
|
-
left:
|
|
1266
|
-
top:
|
|
1309
|
+
const options = {
|
|
1310
|
+
left: owner.scrollLeft,
|
|
1311
|
+
top: owner.scrollTop,
|
|
1267
1312
|
behavior: 'instant'
|
|
1268
|
-
}
|
|
1313
|
+
};
|
|
1314
|
+
if (this.externalScrollHost) {
|
|
1315
|
+
const scrollTo = owner.ownerDocument.defaultView?.Element.prototype.scrollTo ?? owner.scrollTo;
|
|
1316
|
+
scrollTo.call(owner, options);
|
|
1317
|
+
} else this.viewport.scrollTo(options);
|
|
1269
1318
|
};
|
|
1270
|
-
constructor(host, snapshot, callbacks, virtualizationEnabled = true, sectionIndexContainer, fontFamiliesJson = '{}') {
|
|
1319
|
+
constructor(host, snapshot, callbacks, virtualizationEnabled = true, sectionIndexContainer, fontFamiliesJson = '{}', scrollOptions = {}) {
|
|
1320
|
+
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');
|
|
1321
|
+
this.ownsRefresh = scrollOptions.ownsRefresh === true;
|
|
1322
|
+
if (scrollOptions.scrollHost && snapshot.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1323
|
+
this.externalScrollHost = scrollOptions.scrollHost;
|
|
1324
|
+
this.contentBounds = scrollOptions.contentBounds;
|
|
1325
|
+
this.externalStickyInset = this.validateStickyInset(scrollOptions.stickyInset);
|
|
1271
1326
|
this.document = host.ownerDocument;
|
|
1272
1327
|
this.snapshot = validateSnapshot(snapshot);
|
|
1273
1328
|
this.callbacks = callbacks;
|
|
@@ -1276,10 +1331,12 @@ export class NativeListWebEngine {
|
|
|
1276
1331
|
this.previousHostPosition = host.style.position;
|
|
1277
1332
|
if (!host.style.position) host.style.position = 'relative';
|
|
1278
1333
|
this.root = createElement(this.document, 'div', 'ok-native-list-root');
|
|
1334
|
+
setData(this.root, 'nativeListParentScroll', !!this.externalScrollHost);
|
|
1279
1335
|
const style = this.document.createElement('style');
|
|
1280
1336
|
style.textContent = WEB_LIST_CSS;
|
|
1281
1337
|
this.viewportFrame = createElement(this.document, 'div', 'ok-native-list-viewport-frame');
|
|
1282
1338
|
this.viewport = createElement(this.document, 'div', 'ok-native-list-viewport');
|
|
1339
|
+
this.pullTarget = this.externalScrollHost && this.ownsRefresh ? this.externalScrollHost : this.viewport;
|
|
1283
1340
|
this.viewport.setAttribute('role', 'list');
|
|
1284
1341
|
this.content = createElement(this.document, 'div', 'ok-native-list-content');
|
|
1285
1342
|
this.footer = createElement(this.document, 'div', 'ok-native-list-footer');
|
|
@@ -1300,18 +1357,47 @@ export class NativeListWebEngine {
|
|
|
1300
1357
|
this.viewportFrame.append(this.viewport, this.sticky, this.indexRail, this.refreshIndicator);
|
|
1301
1358
|
this.root.append(style, this.viewportFrame, this.footer);
|
|
1302
1359
|
host.appendChild(this.root);
|
|
1303
|
-
|
|
1360
|
+
if (this.externalScrollHost) {
|
|
1361
|
+
Object.assign(this.root.style, {
|
|
1362
|
+
position: 'relative',
|
|
1363
|
+
inset: 'auto',
|
|
1364
|
+
overflow: 'visible',
|
|
1365
|
+
flex: 'none'
|
|
1366
|
+
});
|
|
1367
|
+
Object.assign(this.viewportFrame.style, {
|
|
1368
|
+
overflow: 'visible',
|
|
1369
|
+
flex: 'none'
|
|
1370
|
+
});
|
|
1371
|
+
Object.assign(this.viewport.style, {
|
|
1372
|
+
position: 'relative',
|
|
1373
|
+
inset: 'auto',
|
|
1374
|
+
overflow: 'visible',
|
|
1375
|
+
scrollbarGutter: 'auto'
|
|
1376
|
+
});
|
|
1377
|
+
this.content.style.minHeight = '0';
|
|
1378
|
+
this.externalScrollHost.addEventListener('scroll', this.handleExternalScroll, {
|
|
1379
|
+
passive: true,
|
|
1380
|
+
capture: true
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1304
1384
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
1305
1385
|
passive: true
|
|
1306
1386
|
});
|
|
1307
|
-
this.viewport.addEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1387
|
+
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1308
1388
|
this.root.addEventListener('click', this.handleClick);
|
|
1389
|
+
this.root.addEventListener('contextmenu', this.handleMarketContextMenu);
|
|
1309
1390
|
this.root.addEventListener('pointerdown', this.handleMarketPointerDown);
|
|
1310
1391
|
this.root.addEventListener('pointermove', this.handleMarketPointerMove);
|
|
1392
|
+
this.root.addEventListener('touchmove', this.handleMarketTouchMove, {
|
|
1393
|
+
passive: true
|
|
1394
|
+
});
|
|
1311
1395
|
this.root.addEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1312
1396
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1313
1397
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
1314
1398
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
1399
|
+
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
1400
|
+
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
1315
1401
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
1316
1402
|
this.root.addEventListener('keydown', this.handleKeyDown);
|
|
1317
1403
|
this.viewport.addEventListener('pointerdown', this.handleReorderPointerDown, {
|
|
@@ -1334,25 +1420,68 @@ export class NativeListWebEngine {
|
|
|
1334
1420
|
this.indexRail.addEventListener('pointerup', this.handleIndexPointerEnd);
|
|
1335
1421
|
this.indexRail.addEventListener('pointercancel', this.handleIndexPointerEnd);
|
|
1336
1422
|
this.indexRail.addEventListener('click', this.handleIndexClick);
|
|
1337
|
-
this.
|
|
1423
|
+
this.pullTarget.addEventListener('pointerdown', this.handlePullStart, {
|
|
1338
1424
|
passive: true
|
|
1339
1425
|
});
|
|
1340
|
-
this.
|
|
1426
|
+
this.pullTarget.addEventListener('pointermove', this.handlePullMove, {
|
|
1341
1427
|
passive: false
|
|
1342
1428
|
});
|
|
1343
|
-
this.
|
|
1344
|
-
this.
|
|
1429
|
+
this.pullTarget.addEventListener('pointerup', this.handlePullEnd);
|
|
1430
|
+
this.pullTarget.addEventListener('pointercancel', this.handlePullEnd);
|
|
1345
1431
|
const ResizeObserverConstructor = this.document.defaultView?.ResizeObserver;
|
|
1346
1432
|
if (ResizeObserverConstructor) {
|
|
1347
1433
|
this.resizeObserver = new ResizeObserverConstructor(() => this.recomputeLayout());
|
|
1348
1434
|
this.resizeObserver.observe(this.viewport);
|
|
1435
|
+
if (this.externalScrollHost) {
|
|
1436
|
+
this.resizeObserver.observe(this.externalScrollHost);
|
|
1437
|
+
let ancestor = host;
|
|
1438
|
+
while (ancestor && ancestor !== this.externalScrollHost) {
|
|
1439
|
+
this.resizeObserver.observe(ancestor);
|
|
1440
|
+
for (const sibling of ancestor.parentElement?.children ?? []) {
|
|
1441
|
+
if (sibling instanceof this.document.defaultView.HTMLElement) this.resizeObserver.observe(sibling);
|
|
1442
|
+
}
|
|
1443
|
+
ancestor = ancestor.parentElement;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1349
1446
|
} else {
|
|
1350
1447
|
this.document.defaultView?.addEventListener('resize', this.handleWindowResize);
|
|
1351
1448
|
}
|
|
1449
|
+
this.document.fonts?.addEventListener('loadingdone', this.handleWindowResize);
|
|
1352
1450
|
this.observeSectionIndexTransforms();
|
|
1353
1451
|
this.applyFontFamilies(fontFamiliesJson);
|
|
1354
1452
|
this.applySnapshot(this.snapshot);
|
|
1355
1453
|
}
|
|
1454
|
+
validateStickyInset(value = 0) {
|
|
1455
|
+
if (!Number.isFinite(value) || value < 0) throw new Error('webStickyInset must be finite and non-negative');
|
|
1456
|
+
return value;
|
|
1457
|
+
}
|
|
1458
|
+
setStickyInset(value = 0) {
|
|
1459
|
+
const next = this.validateStickyInset(value);
|
|
1460
|
+
if (next === this.externalStickyInset) return;
|
|
1461
|
+
this.externalStickyInset = next;
|
|
1462
|
+
this.recomputeLayout();
|
|
1463
|
+
}
|
|
1464
|
+
externalGeometry() {
|
|
1465
|
+
return this.externalGeometryCache ??= this.readExternalGeometry();
|
|
1466
|
+
}
|
|
1467
|
+
readExternalGeometry() {
|
|
1468
|
+
const host = this.externalScrollHost;
|
|
1469
|
+
const hostRect = host.getBoundingClientRect();
|
|
1470
|
+
const bodyRect = this.viewport.getBoundingClientRect();
|
|
1471
|
+
const boundsRect = (this.contentBounds ?? this.root).getBoundingClientRect();
|
|
1472
|
+
const top = hostRect.top + host.clientTop + this.externalStickyInset;
|
|
1473
|
+
const bottom = hostRect.top + host.clientTop + host.clientHeight;
|
|
1474
|
+
return {
|
|
1475
|
+
origin: bodyRect.top - hostRect.top - host.clientTop + host.scrollTop,
|
|
1476
|
+
containerOrigin: boundsRect.top - hostRect.top - host.clientTop + host.scrollTop,
|
|
1477
|
+
end: boundsRect.bottom - hostRect.top - host.clientTop + host.scrollTop,
|
|
1478
|
+
top,
|
|
1479
|
+
bottom,
|
|
1480
|
+
offset: top - bodyRect.top,
|
|
1481
|
+
viewportLength: Math.max(0, bottom - top),
|
|
1482
|
+
visible: bodyRect.width > 0 && bodyRect.right > hostRect.left && bodyRect.left < hostRect.right && host.clientHeight > 0 && boundsRect.bottom > top && boundsRect.top < bottom
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1356
1485
|
fontFamiliesJson = '{}';
|
|
1357
1486
|
applyFontFamilies(json) {
|
|
1358
1487
|
const families = JSON.parse(json);
|
|
@@ -1385,9 +1514,16 @@ export class NativeListWebEngine {
|
|
|
1385
1514
|
}
|
|
1386
1515
|
applySnapshot(snapshot) {
|
|
1387
1516
|
const validated = validateSnapshot(snapshot);
|
|
1517
|
+
if (this.externalScrollHost && validated.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1388
1518
|
this.invalidateActionAnchor('snapshot');
|
|
1389
1519
|
this.setSnapshot(validated);
|
|
1390
1520
|
}
|
|
1521
|
+
currentContentHeight() {
|
|
1522
|
+
return this.layout.contentHeight;
|
|
1523
|
+
}
|
|
1524
|
+
currentSnapshot() {
|
|
1525
|
+
return this.snapshot;
|
|
1526
|
+
}
|
|
1391
1527
|
applyPatches(patches) {
|
|
1392
1528
|
if (patches.length === 0) return;
|
|
1393
1529
|
const next = applyRowPatches(this.snapshot, patches);
|
|
@@ -1396,7 +1532,13 @@ export class NativeListWebEngine {
|
|
|
1396
1532
|
const selected = 'selected' in patch.changes ? patch.changes.selected : undefined;
|
|
1397
1533
|
if (selected === true) selection.add(patch.key);else if (selected === false) selection.delete(patch.key);
|
|
1398
1534
|
});
|
|
1399
|
-
|
|
1535
|
+
const tableValuesOnly = patches.every(patch => {
|
|
1536
|
+
const index = this.rows.findIndex(row => row.key === patch.key);
|
|
1537
|
+
const before = this.rows[index],
|
|
1538
|
+
after = next.rows[index];
|
|
1539
|
+
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);
|
|
1540
|
+
});
|
|
1541
|
+
if (webMarketImageBindDeltaForPatches(patches) === 0 || tableValuesOnly) {
|
|
1400
1542
|
this.snapshot = next;
|
|
1401
1543
|
this.rows = effectiveRows(next);
|
|
1402
1544
|
this.selectedKeys = selection;
|
|
@@ -1405,11 +1547,11 @@ export class NativeListWebEngine {
|
|
|
1405
1547
|
const row = this.rows[index];
|
|
1406
1548
|
const element = this.mounted.get(index);
|
|
1407
1549
|
if (row?.type === 'market' && element) {
|
|
1408
|
-
setMarketQuoteContent(element, row);
|
|
1550
|
+
if (row.webTable) updateMarketTableValues(element, row);else setMarketQuoteContent(element, row);
|
|
1409
1551
|
element.dataset.renderSignature = webRowRenderSignature(row);
|
|
1410
1552
|
}
|
|
1411
1553
|
if (row?.type === 'market' && this.sticky.dataset.nativeListRowKey === row.key) {
|
|
1412
|
-
setMarketQuoteContent(this.sticky, row);
|
|
1554
|
+
if (row.webTable) updateMarketTableValues(this.sticky, row);else setMarketQuoteContent(this.sticky, row);
|
|
1413
1555
|
this.sticky.dataset.renderSignature = webRowRenderSignature(row);
|
|
1414
1556
|
}
|
|
1415
1557
|
});
|
|
@@ -1479,7 +1621,10 @@ export class NativeListWebEngine {
|
|
|
1479
1621
|
};
|
|
1480
1622
|
return;
|
|
1481
1623
|
}
|
|
1482
|
-
this.
|
|
1624
|
+
if (this.externalScrollHost) {
|
|
1625
|
+
const geometry = this.externalGeometry();
|
|
1626
|
+
this.writeExternalOffset(geometry.containerOrigin + offset, animated);
|
|
1627
|
+
} else this.scrollToAbsoluteOffset(offset, animated);
|
|
1483
1628
|
}
|
|
1484
1629
|
scrollToEnd(animated) {
|
|
1485
1630
|
this.notifyScrollCommandAccepted();
|
|
@@ -1490,7 +1635,10 @@ export class NativeListWebEngine {
|
|
|
1490
1635
|
};
|
|
1491
1636
|
return;
|
|
1492
1637
|
}
|
|
1493
|
-
|
|
1638
|
+
if (this.externalScrollHost) {
|
|
1639
|
+
const geometry = this.externalGeometry();
|
|
1640
|
+
this.writeExternalOffset(geometry.end - this.externalScrollHost.clientHeight, animated);
|
|
1641
|
+
} else this.scrollToAbsoluteOffset(Math.max(0, this.contentLength() - this.viewportLength()), animated);
|
|
1494
1642
|
}
|
|
1495
1643
|
scrollToLocation(params, scroll) {
|
|
1496
1644
|
const index = resolveLocationIndex(this.snapshot.rows, params);
|
|
@@ -1539,19 +1687,25 @@ export class NativeListWebEngine {
|
|
|
1539
1687
|
if (this.sectionIndexTransformFrame !== undefined) this.cancelFrame(this.sectionIndexTransformFrame);
|
|
1540
1688
|
if (this.reorderMovementTimer !== undefined) this.document.defaultView?.clearTimeout(this.reorderMovementTimer);
|
|
1541
1689
|
this.resizeObserver?.disconnect();
|
|
1690
|
+
this.externalScrollHost?.removeEventListener('scroll', this.handleExternalScroll, true);
|
|
1691
|
+
this.document.fonts?.removeEventListener('loadingdone', this.handleWindowResize);
|
|
1542
1692
|
this.sectionIndexTransformObserver?.disconnect();
|
|
1543
1693
|
this.document.defaultView?.removeEventListener('resize', this.handleWindowResize);
|
|
1544
1694
|
this.pendingScroll = undefined;
|
|
1545
|
-
this.viewport.removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1695
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1546
1696
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
1547
|
-
this.viewport.removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1697
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1548
1698
|
this.root.removeEventListener('click', this.handleClick);
|
|
1699
|
+
this.root.removeEventListener('contextmenu', this.handleMarketContextMenu);
|
|
1549
1700
|
this.cancelMarketPointer();
|
|
1550
1701
|
this.root.removeEventListener('pointerdown', this.handleMarketPointerDown);
|
|
1551
1702
|
this.root.removeEventListener('pointermove', this.handleMarketPointerMove);
|
|
1703
|
+
this.root.removeEventListener('touchmove', this.handleMarketTouchMove);
|
|
1552
1704
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1553
1705
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1554
1706
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
1707
|
+
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
1708
|
+
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
1555
1709
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
1556
1710
|
this.root.removeEventListener('keydown', this.handleKeyDown);
|
|
1557
1711
|
this.cancelPointerReorder(true);
|
|
@@ -1567,10 +1721,10 @@ export class NativeListWebEngine {
|
|
|
1567
1721
|
this.indexRail.removeEventListener('pointerup', this.handleIndexPointerEnd);
|
|
1568
1722
|
this.indexRail.removeEventListener('pointercancel', this.handleIndexPointerEnd);
|
|
1569
1723
|
this.indexRail.removeEventListener('click', this.handleIndexClick);
|
|
1570
|
-
this.
|
|
1571
|
-
this.
|
|
1572
|
-
this.
|
|
1573
|
-
this.
|
|
1724
|
+
this.pullTarget.removeEventListener('pointerdown', this.handlePullStart);
|
|
1725
|
+
this.pullTarget.removeEventListener('pointermove', this.handlePullMove);
|
|
1726
|
+
this.pullTarget.removeEventListener('pointerup', this.handlePullEnd);
|
|
1727
|
+
this.pullTarget.removeEventListener('pointercancel', this.handlePullEnd);
|
|
1574
1728
|
const host = this.root.parentElement;
|
|
1575
1729
|
disposeWebImageRetries(this.root);
|
|
1576
1730
|
Object.values(this.pool).forEach(elements => elements.forEach(disposeWebImageRetries));
|
|
@@ -1607,6 +1761,7 @@ export class NativeListWebEngine {
|
|
|
1607
1761
|
'--nl-pressed': theme.rowPressedBackground,
|
|
1608
1762
|
'--nl-subdued': theme.subduedBackground,
|
|
1609
1763
|
'--nl-strong': theme.strongBackground,
|
|
1764
|
+
'--nl-image-fallback-background': theme.imageFallbackBackground ?? 'transparent',
|
|
1610
1765
|
'--nl-primary': theme.primaryText,
|
|
1611
1766
|
'--nl-secondary': theme.secondaryText,
|
|
1612
1767
|
'--nl-disabled': theme.disabledText,
|
|
@@ -1653,8 +1808,47 @@ export class NativeListWebEngine {
|
|
|
1653
1808
|
if (value === undefined) this.root.style.removeProperty(name);else this.root.style.setProperty(name, value);
|
|
1654
1809
|
});
|
|
1655
1810
|
}
|
|
1811
|
+
computeLayout(viewportWidth, viewportHeight) {
|
|
1812
|
+
const measuredSnapshot = {
|
|
1813
|
+
...this.snapshot,
|
|
1814
|
+
rows: this.snapshot.rows.map(row => row.style?.container?.height === undefined && row.height === undefined && this.measuredRendererHeights.get(row.key)?.signature === webRowRenderSignature(row) ? {
|
|
1815
|
+
...row,
|
|
1816
|
+
height: this.measuredRendererHeights.get(row.key).height
|
|
1817
|
+
} : row)
|
|
1818
|
+
};
|
|
1819
|
+
let layout = computeWebListLayout(measuredSnapshot, viewportWidth, viewportHeight, this.reorderCompactKey);
|
|
1820
|
+
if (this.externalScrollHost) {
|
|
1821
|
+
const padding = paddingValues(this.snapshot);
|
|
1822
|
+
layout = {
|
|
1823
|
+
...layout,
|
|
1824
|
+
contentHeight: Math.max(padding.top, ...layout.items.map(item => item.y + item.height)) + padding.bottom
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
return layout;
|
|
1828
|
+
}
|
|
1829
|
+
writeExternalHeight(height) {
|
|
1830
|
+
const value = String(height) + 'px';
|
|
1831
|
+
this.content.style.height = value;
|
|
1832
|
+
this.viewport.style.height = value;
|
|
1833
|
+
this.viewportFrame.style.height = value;
|
|
1834
|
+
this.root.style.height = value;
|
|
1835
|
+
}
|
|
1656
1836
|
recomputeLayout = () => {
|
|
1657
1837
|
if (this.destroyed) return;
|
|
1838
|
+
const cachedWidth = this.lastViewportWidth;
|
|
1839
|
+
const cachedHeight = this.lastViewportHeight;
|
|
1840
|
+
const precomputedLayout = this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0 ? this.computeLayout(cachedWidth, cachedHeight) : undefined;
|
|
1841
|
+
if (precomputedLayout) {
|
|
1842
|
+
// Commit appended row extent before measuring React-owned slot changes.
|
|
1843
|
+
this.writeExternalHeight(Math.max(this.layout.contentHeight, precomputedLayout.contentHeight));
|
|
1844
|
+
}
|
|
1845
|
+
this.externalGeometryCache = undefined;
|
|
1846
|
+
if (this.externalScrollHost) {
|
|
1847
|
+
const geometry = this.externalGeometry();
|
|
1848
|
+
const previousOrigin = this.externalOrigin;
|
|
1849
|
+
this.externalOrigin = geometry.origin;
|
|
1850
|
+
if (previousOrigin !== undefined && geometry.origin !== previousOrigin && this.externalScrollHost.scrollTop > previousOrigin && geometry.visible) this.externalScrollHost.scrollTop += geometry.origin - previousOrigin;
|
|
1851
|
+
}
|
|
1658
1852
|
const viewportWidth = this.viewport.clientWidth;
|
|
1659
1853
|
const viewportHeight = this.snapshot.layout.orientation === 'horizontal' ? this.viewport.clientHeight : this.verticalScrollMetrics().viewportLength;
|
|
1660
1854
|
const stickyInset = this.snapshot.layout.orientation === 'horizontal' ? 0 : this.collapsiblePagerInsets().sticky;
|
|
@@ -1672,16 +1866,13 @@ export class NativeListWebEngine {
|
|
|
1672
1866
|
this.lastViewportWidth = viewportWidth;
|
|
1673
1867
|
this.lastViewportHeight = viewportHeight;
|
|
1674
1868
|
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);
|
|
1869
|
+
this.layout = precomputedLayout && viewportWidth === cachedWidth && viewportHeight === cachedHeight ? precomputedLayout : this.computeLayout(viewportWidth, viewportHeight);
|
|
1683
1870
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
1684
1871
|
this.content.style.height = String(this.layout.contentHeight) + 'px';
|
|
1872
|
+
if (this.externalScrollHost) {
|
|
1873
|
+
this.writeExternalHeight(this.layout.contentHeight);
|
|
1874
|
+
this.externalGeometryCache = undefined;
|
|
1875
|
+
}
|
|
1685
1876
|
this.renderSectionIndex(this.viewport.clientHeight <= 0 ? DEFAULT_VIEWPORT_HEIGHT : Math.max(1, viewportHeight), stickyInset);
|
|
1686
1877
|
if (previousHorizontal !== this.layout.horizontal) {
|
|
1687
1878
|
this.viewport.scrollLeft = 0;
|
|
@@ -1691,6 +1882,11 @@ export class NativeListWebEngine {
|
|
|
1691
1882
|
this.performPendingScroll();
|
|
1692
1883
|
};
|
|
1693
1884
|
updateAvatarWindow() {
|
|
1885
|
+
if (this.externalScrollHost && !this.externalGeometry().visible) {
|
|
1886
|
+
this.avatarLeases.forEach(lease => lease());
|
|
1887
|
+
this.avatarLeases.clear();
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1694
1890
|
const offset = this.currentOffset();
|
|
1695
1891
|
if (offset !== this.avatarOffset) this.avatarDirection = Math.sign(offset - this.avatarOffset);
|
|
1696
1892
|
this.avatarOffset = offset;
|
|
@@ -1729,7 +1925,7 @@ export class NativeListWebEngine {
|
|
|
1729
1925
|
renderWindow() {
|
|
1730
1926
|
this.updateAvatarWindow();
|
|
1731
1927
|
const viewportLength = this.viewportLength();
|
|
1732
|
-
const visible = webLayoutItemsForMount(this.layout, this.currentOffset(), viewportLength, this.virtualizationEnabled, viewportLength * OVERSCAN_VIEWPORTS);
|
|
1928
|
+
const visible = this.externalScrollHost && !this.externalGeometry().visible ? [] : webLayoutItemsForMount(this.layout, this.currentOffset(), viewportLength, this.virtualizationEnabled, viewportLength * OVERSCAN_VIEWPORTS);
|
|
1733
1929
|
const desired = new Set(visible.map(item => item.index));
|
|
1734
1930
|
this.mounted.forEach((element, index) => {
|
|
1735
1931
|
const nextRow = this.rows[index];
|
|
@@ -1799,6 +1995,7 @@ export class NativeListWebEngine {
|
|
|
1799
1995
|
const bindingEpoch = String(++this.bindingEpochCounter);
|
|
1800
1996
|
element.className = overlay ? 'ok-native-list-item ok-native-list-sticky' : 'ok-native-list-item';
|
|
1801
1997
|
setData(element, 'nativeListRowKey', row.key);
|
|
1998
|
+
setData(element, 'nativeListMediaGallery', row.type === 'mediaTile' && row.variant === 'gallery' ? 'true' : undefined);
|
|
1802
1999
|
setData(element, 'nativeListBindingEpoch', bindingEpoch);
|
|
1803
2000
|
setData(element, 'nativeListRowIndex', index);
|
|
1804
2001
|
setData(element, 'nativeListDisabled', Boolean(row.disabled));
|
|
@@ -2075,7 +2272,7 @@ export class NativeListWebEngine {
|
|
|
2075
2272
|
if (!Number.isNaN(stickyIndex)) update(this.sticky, this.rows[stickyIndex]);
|
|
2076
2273
|
}
|
|
2077
2274
|
updateVisibleState() {
|
|
2078
|
-
const visible = visibleWebLayoutItems(this.layout, this.currentOffset(), this.viewportLength());
|
|
2275
|
+
const visible = this.externalScrollHost && !this.externalGeometry().visible ? [] : visibleWebLayoutItems(this.layout, this.currentOffset(), this.viewportLength());
|
|
2079
2276
|
const first = visible[0];
|
|
2080
2277
|
const last = visible.at(-1);
|
|
2081
2278
|
const signature = String(first?.index ?? -1) + ':' + String(last?.index ?? -1) + ':' + (first?.key ?? '') + ':' + (last?.key ?? '');
|
|
@@ -2126,6 +2323,7 @@ export class NativeListWebEngine {
|
|
|
2126
2323
|
this.sticky.style.right = 'auto';
|
|
2127
2324
|
this.sticky.style.width = String(item.width) + 'px';
|
|
2128
2325
|
this.sticky.style.height = String(item.height) + 'px';
|
|
2326
|
+
if (this.externalScrollHost) this.sticky.style.top = String(Math.max(0, this.currentOffset())) + 'px';
|
|
2129
2327
|
let nextIndex = -1;
|
|
2130
2328
|
for (let cursor = index + 1; cursor < this.rows.length; cursor += 1) {
|
|
2131
2329
|
const candidate = this.rows[cursor];
|
|
@@ -2146,7 +2344,7 @@ export class NativeListWebEngine {
|
|
|
2146
2344
|
this.indexRail.querySelectorAll('[data-section-key]').forEach(button => setData(button, 'active', button.dataset.sectionKey === activeKey));
|
|
2147
2345
|
}
|
|
2148
2346
|
checkEndReached(lastVisibleIndex) {
|
|
2149
|
-
if (!this.snapshot.capabilities?.loadMore || this.reachedGeneration === this.snapshot.generation || this.rows.length === 0) return;
|
|
2347
|
+
if (this.externalScrollHost && !this.externalGeometry().visible || !this.snapshot.capabilities?.loadMore || this.reachedGeneration === this.snapshot.generation || this.rows.length === 0) return;
|
|
2150
2348
|
const threshold = Math.max(1, Math.ceil(this.rows.length * (this.snapshot.capabilities.endReachedThreshold ?? 0.2)));
|
|
2151
2349
|
if (lastVisibleIndex < this.rows.length - threshold) return;
|
|
2152
2350
|
this.reachedGeneration = this.snapshot.generation;
|
|
@@ -2160,6 +2358,7 @@ export class NativeListWebEngine {
|
|
|
2160
2358
|
this.callbacks.onScrollToIndexFailed?.(scrollFailure(this.rows, index, reason, average));
|
|
2161
2359
|
}
|
|
2162
2360
|
canScroll() {
|
|
2361
|
+
if (this.externalScrollHost) return this.viewport.clientWidth > 0 && this.externalScrollHost.clientHeight > 0;
|
|
2163
2362
|
const viewportLength = this.layout.horizontal ? this.viewport.clientWidth : this.viewport.clientHeight;
|
|
2164
2363
|
return viewportLength > 0 && this.layout.items.length > 0;
|
|
2165
2364
|
}
|
|
@@ -2167,16 +2366,25 @@ export class NativeListWebEngine {
|
|
|
2167
2366
|
if (this.layout.horizontal) {
|
|
2168
2367
|
return this.viewport.clientWidth || DEFAULT_VIEWPORT_WIDTH;
|
|
2169
2368
|
}
|
|
2369
|
+
if (this.externalScrollHost) return this.externalGeometry().viewportLength;
|
|
2170
2370
|
if (this.viewport.clientHeight <= 0) return DEFAULT_VIEWPORT_HEIGHT;
|
|
2171
2371
|
return Math.max(1, this.verticalScrollMetrics().viewportLength);
|
|
2172
2372
|
}
|
|
2173
2373
|
contentLength() {
|
|
2374
|
+
if (this.externalScrollHost) {
|
|
2375
|
+
const geometry = this.externalGeometry();
|
|
2376
|
+
return Math.max(this.layout.contentHeight, geometry.end - geometry.origin);
|
|
2377
|
+
}
|
|
2174
2378
|
return this.layout.horizontal ? this.layout.contentWidth : this.layout.contentHeight;
|
|
2175
2379
|
}
|
|
2176
2380
|
currentOffset() {
|
|
2177
2381
|
return this.layout.horizontal ? this.viewport.scrollLeft : this.verticalScrollMetrics().offset;
|
|
2178
2382
|
}
|
|
2179
2383
|
collapsiblePagerInsets() {
|
|
2384
|
+
if (this.externalScrollHost) return {
|
|
2385
|
+
header: 0,
|
|
2386
|
+
sticky: this.externalStickyInset
|
|
2387
|
+
};
|
|
2180
2388
|
const readInset = name => {
|
|
2181
2389
|
const parsed = Number.parseFloat(this.viewport.style.getPropertyValue(name));
|
|
2182
2390
|
return Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
|
@@ -2187,13 +2395,29 @@ export class NativeListWebEngine {
|
|
|
2187
2395
|
};
|
|
2188
2396
|
}
|
|
2189
2397
|
verticalScrollMetrics() {
|
|
2398
|
+
if (this.externalScrollHost) return this.externalGeometry();
|
|
2190
2399
|
const insets = this.collapsiblePagerInsets();
|
|
2191
2400
|
return resolveWebCollapsiblePagerScrollMetrics(this.viewport.scrollTop, this.viewport.clientHeight, insets.header, insets.sticky);
|
|
2192
2401
|
}
|
|
2193
2402
|
handleCollapsiblePagerInsetsChanged = () => {
|
|
2194
2403
|
this.recomputeLayout();
|
|
2195
2404
|
};
|
|
2405
|
+
writeExternalOffset(rawOffset, animated) {
|
|
2406
|
+
this.externalGeometryCache = undefined;
|
|
2407
|
+
const host = this.externalScrollHost;
|
|
2408
|
+
const scrollTo = host.ownerDocument.defaultView?.Element.prototype.scrollTo ?? host.scrollTo;
|
|
2409
|
+
scrollTo.call(host, {
|
|
2410
|
+
top: Math.max(0, Math.min(host.scrollHeight - host.clientHeight, rawOffset)),
|
|
2411
|
+
behavior: animated ? 'smooth' : 'auto'
|
|
2412
|
+
});
|
|
2413
|
+
this.scheduleFrame();
|
|
2414
|
+
}
|
|
2196
2415
|
scrollToAbsoluteOffset(offset, animated) {
|
|
2416
|
+
if (this.externalScrollHost) {
|
|
2417
|
+
const geometry = this.externalGeometry();
|
|
2418
|
+
this.writeExternalOffset(geometry.origin + offset - this.externalStickyInset, animated);
|
|
2419
|
+
return;
|
|
2420
|
+
}
|
|
2197
2421
|
const resolved = Math.min(Math.max(0, offset), Math.max(0, this.contentLength() - this.viewportLength()));
|
|
2198
2422
|
const rawOffset = this.layout.horizontal ? resolved : resolveWebCollapsiblePagerRawOffset(resolved, this.collapsiblePagerInsets().header);
|
|
2199
2423
|
this.viewport.scrollTo(this.layout.horizontal ? {
|
|
@@ -2242,13 +2466,16 @@ export class NativeListWebEngine {
|
|
|
2242
2466
|
this.renderFooter();
|
|
2243
2467
|
this.callbacks.onSelectionDelta?.(result.delta);
|
|
2244
2468
|
}
|
|
2245
|
-
emitRowAction(row, actionKey, actionElement, rowElement) {
|
|
2469
|
+
emitRowAction(row, actionKey, actionElement, rowElement, windowPoint) {
|
|
2246
2470
|
const anchor = actionElement && rowElement ? this.createActionAnchor(actionElement, rowElement) : undefined;
|
|
2247
2471
|
this.callbacks.onRowAction?.({
|
|
2248
2472
|
rowKey: row.key,
|
|
2249
2473
|
actionKey,
|
|
2250
2474
|
sectionKey: row.sectionKey,
|
|
2251
|
-
anchor
|
|
2475
|
+
anchor,
|
|
2476
|
+
...(windowPoint && Number.isFinite(windowPoint.x) && Number.isFinite(windowPoint.y) ? {
|
|
2477
|
+
windowPoint
|
|
2478
|
+
} : {})
|
|
2252
2479
|
});
|
|
2253
2480
|
}
|
|
2254
2481
|
createActionAnchor(actionElement, rowElement, sourceOverride) {
|
|
@@ -2329,6 +2556,23 @@ export class NativeListWebEngine {
|
|
|
2329
2556
|
this.document.defaultView?.clearTimeout(state.timer);
|
|
2330
2557
|
this.marketPointer = undefined;
|
|
2331
2558
|
}
|
|
2559
|
+
handleMarketContextMenu = event => {
|
|
2560
|
+
if (!(event.target instanceof Element) || event.target.closest('[data-native-list-action]')) return;
|
|
2561
|
+
const element = event.target.closest('[data-native-list-row-key]');
|
|
2562
|
+
const row = this.rowAtElement(element);
|
|
2563
|
+
if (row?.type !== 'market' || !row.webTable?.contextMenuActionKey || !element || !isRowPressEnabled(row)) return;
|
|
2564
|
+
event.preventDefault();
|
|
2565
|
+
this.cancelMarketPointer();
|
|
2566
|
+
markActionAnchorSource(element, 'row');
|
|
2567
|
+
const rect = element.getBoundingClientRect();
|
|
2568
|
+
this.emitRowAction(row, row.webTable.contextMenuActionKey, element, element, event.clientX || event.clientY ? {
|
|
2569
|
+
x: event.clientX,
|
|
2570
|
+
y: event.clientY
|
|
2571
|
+
} : {
|
|
2572
|
+
x: rect.left + rect.width / 2,
|
|
2573
|
+
y: rect.top + rect.height / 2
|
|
2574
|
+
});
|
|
2575
|
+
};
|
|
2332
2576
|
handleMarketPointerDown = event => {
|
|
2333
2577
|
if (event.button !== 0 || !(event.target instanceof Element)) return;
|
|
2334
2578
|
this.marketLongPressFired = false;
|
|
@@ -2340,16 +2584,24 @@ export class NativeListWebEngine {
|
|
|
2340
2584
|
if (row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2341
2585
|
if (!row.longPressActionKey || !rowElement) return;
|
|
2342
2586
|
markActionAnchorSource(rowElement, 'row');
|
|
2587
|
+
const bindingEpoch = rowElement.dataset.nativeListBindingEpoch;
|
|
2343
2588
|
const timer = this.document.defaultView?.setTimeout(() => {
|
|
2344
2589
|
const current = this.marketPointer;
|
|
2345
2590
|
if (!current || current.pointerId !== event.pointerId) return;
|
|
2591
|
+
const currentRow = this.rowAtElement(rowElement);
|
|
2346
2592
|
this.marketPointer = undefined;
|
|
2593
|
+
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2347
2594
|
this.marketLongPressFired = true;
|
|
2348
|
-
this.emitRowAction(
|
|
2595
|
+
this.emitRowAction(currentRow, currentRow.longPressActionKey, rowElement, rowElement, {
|
|
2596
|
+
x: event.clientX,
|
|
2597
|
+
y: event.clientY
|
|
2598
|
+
});
|
|
2349
2599
|
}, MARKET_LONG_PRESS_MS);
|
|
2350
2600
|
if (timer === undefined) return;
|
|
2351
2601
|
this.marketPointer = {
|
|
2352
2602
|
pointerId: event.pointerId,
|
|
2603
|
+
pointerType: event.pointerType,
|
|
2604
|
+
compact: !row.webTable,
|
|
2353
2605
|
rowKey: row.key,
|
|
2354
2606
|
startX: event.clientX,
|
|
2355
2607
|
startY: event.clientY,
|
|
@@ -2359,7 +2611,21 @@ export class NativeListWebEngine {
|
|
|
2359
2611
|
handleMarketPointerMove = event => {
|
|
2360
2612
|
const state = this.marketPointer;
|
|
2361
2613
|
if (!state || state.pointerId !== event.pointerId) return;
|
|
2362
|
-
if (
|
|
2614
|
+
if (state.compact && state.pointerType === 'touch') return;
|
|
2615
|
+
const row = this.rows.find(item => item.key === state.rowKey);
|
|
2616
|
+
const threshold = row?.type === 'market' && !row.webTable ? 3 : MARKET_MOVE_CANCEL_PX;
|
|
2617
|
+
if (Math.abs(event.clientX - state.startX) > threshold || Math.abs(event.clientY - state.startY) > threshold) this.cancelMarketPointer();
|
|
2618
|
+
};
|
|
2619
|
+
handleMarketTouchMove = event => {
|
|
2620
|
+
const state = this.marketPointer;
|
|
2621
|
+
if (!state?.compact || state.pointerType !== 'touch' || !(event.target instanceof Element) || event.target.closest('[data-native-list-row-key]')?.dataset.nativeListRowKey !== state.rowKey) return;
|
|
2622
|
+
if (event.touches.length > 1) {
|
|
2623
|
+
this.cancelMarketPointer();
|
|
2624
|
+
return;
|
|
2625
|
+
}
|
|
2626
|
+
const touch = event.touches[0] ?? event.changedTouches[0];
|
|
2627
|
+
if (!touch || !Number.isFinite(touch.clientX) || !Number.isFinite(touch.clientY)) return;
|
|
2628
|
+
if (Math.abs(touch.clientX - state.startX) > 3 || Math.abs(touch.clientY - state.startY) > 3) this.cancelMarketPointer();
|
|
2363
2629
|
};
|
|
2364
2630
|
handleMarketPointerEnd = event => {
|
|
2365
2631
|
if (this.marketPointer?.pointerId === event.pointerId) this.cancelMarketPointer();
|
|
@@ -2371,6 +2637,7 @@ export class NativeListWebEngine {
|
|
|
2371
2637
|
if (!(target instanceof Element)) return;
|
|
2372
2638
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2373
2639
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
2640
|
+
if (action.classList.contains('ok-native-list-market-subtitle-prefix') && action.scrollWidth <= action.clientWidth + 1) return;
|
|
2374
2641
|
const rowElement = action.closest('[data-native-list-row-key]');
|
|
2375
2642
|
const row = this.rowAtElement(rowElement);
|
|
2376
2643
|
const memberKey = action.closest('[data-native-list-group-member-key]')?.dataset.nativeListGroupMemberKey;
|
|
@@ -2516,7 +2783,12 @@ export class NativeListWebEngine {
|
|
|
2516
2783
|
preventScroll: true
|
|
2517
2784
|
});
|
|
2518
2785
|
}
|
|
2786
|
+
handleExternalScroll = event => {
|
|
2787
|
+
const target = event.target;
|
|
2788
|
+
if (target === this.externalScrollHost || target instanceof Element && target !== this.root && this.externalScrollHost?.contains(target) && target.contains(this.root)) this.handleScroll();
|
|
2789
|
+
};
|
|
2519
2790
|
handleScroll = () => {
|
|
2791
|
+
this.externalGeometryCache = undefined;
|
|
2520
2792
|
this.cancelMarketPointer();
|
|
2521
2793
|
this.invalidateActionAnchor('scroll');
|
|
2522
2794
|
this.scheduleFrame();
|
|
@@ -2530,6 +2802,8 @@ export class NativeListWebEngine {
|
|
|
2530
2802
|
if (this.frameHandle !== undefined || this.destroyed) return;
|
|
2531
2803
|
this.frameHandle = this.requestFrame(() => {
|
|
2532
2804
|
this.frameHandle = undefined;
|
|
2805
|
+
this.externalGeometryCache = undefined;
|
|
2806
|
+
if (this.externalScrollHost) this.externalOrigin = this.externalGeometry().origin;
|
|
2533
2807
|
if (this.virtualizationEnabled) this.renderWindow();else {
|
|
2534
2808
|
this.updateAvatarWindow();
|
|
2535
2809
|
this.updateVisibleState();
|
|
@@ -2592,7 +2866,7 @@ export class NativeListWebEngine {
|
|
|
2592
2866
|
this.selectIndexPosition(entry.position);
|
|
2593
2867
|
};
|
|
2594
2868
|
handlePullStart = event => {
|
|
2595
|
-
if (this.pointerReorder?.pointerId === event.pointerId || !this.snapshot.capabilities?.pullToRefresh || this.
|
|
2869
|
+
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
2870
|
this.pullStartY = event.clientY;
|
|
2597
2871
|
this.pullDistance = 0;
|
|
2598
2872
|
};
|
|
@@ -2668,6 +2942,7 @@ export class NativeListWebEngine {
|
|
|
2668
2942
|
if (this.pointerReorder !== state) return;
|
|
2669
2943
|
this.clearReorderLongPress(state);
|
|
2670
2944
|
state.active = true;
|
|
2945
|
+
this.cancelMarketPointer();
|
|
2671
2946
|
state.activatedAt = Date.now();
|
|
2672
2947
|
state.viewportRect = this.reorderViewportRect();
|
|
2673
2948
|
this.captureReorderPointer(state);
|
|
@@ -2744,6 +3019,10 @@ export class NativeListWebEngine {
|
|
|
2744
3019
|
this.cancelPointerReorder(true);
|
|
2745
3020
|
};
|
|
2746
3021
|
setCurrentOffset(offset) {
|
|
3022
|
+
if (this.externalScrollHost) {
|
|
3023
|
+
this.scrollToAbsoluteOffset(offset, false);
|
|
3024
|
+
return;
|
|
3025
|
+
}
|
|
2747
3026
|
const maximum = Math.max(0, this.contentLength() - this.viewportLength());
|
|
2748
3027
|
const next = Math.max(0, Math.min(maximum, offset));
|
|
2749
3028
|
if (this.layout.horizontal) this.viewport.scrollLeft = next;else {
|
|
@@ -2801,7 +3080,7 @@ export class NativeListWebEngine {
|
|
|
2801
3080
|
const viewportRect = this.viewport.getBoundingClientRect();
|
|
2802
3081
|
const insets = this.collapsiblePagerInsets();
|
|
2803
3082
|
const left = viewportRect.left + destinationLayout.x - this.viewport.scrollLeft;
|
|
2804
|
-
const top = viewportRect.top + destinationLayout.y + insets.header + insets.sticky - this.viewport.scrollTop;
|
|
3083
|
+
const top = this.externalScrollHost ? viewportRect.top + destinationLayout.y : viewportRect.top + destinationLayout.y + insets.header + insets.sticky - this.viewport.scrollTop;
|
|
2805
3084
|
this.reorderPreview.getBoundingClientRect();
|
|
2806
3085
|
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
3086
|
this.reorderPreview.style.boxShadow = 'none';
|
|
@@ -2851,6 +3130,18 @@ export class NativeListWebEngine {
|
|
|
2851
3130
|
this.reorderPreview.style.transform = 'translate3d(' + String(x) + 'px,' + String(y) + 'px,0)';
|
|
2852
3131
|
}
|
|
2853
3132
|
reorderViewportRect() {
|
|
3133
|
+
if (this.externalScrollHost) {
|
|
3134
|
+
const geometry = this.externalGeometry();
|
|
3135
|
+
const body = this.viewport.getBoundingClientRect();
|
|
3136
|
+
return {
|
|
3137
|
+
left: body.left,
|
|
3138
|
+
right: body.right,
|
|
3139
|
+
width: body.width,
|
|
3140
|
+
top: geometry.top,
|
|
3141
|
+
bottom: geometry.bottom,
|
|
3142
|
+
height: geometry.viewportLength
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
2854
3145
|
const {
|
|
2855
3146
|
left,
|
|
2856
3147
|
top,
|