@onekeyfe/react-native-native-list 6.7.0-alpha.324 → 6.7.0-alpha.335
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 +405 -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 +140 -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 +356 -62
- 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.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 +191 -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 +603 -95
- 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,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,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,19 +1301,31 @@ 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
1330
|
this.snapshot = validateSnapshot(snapshot);
|
|
1273
1331
|
this.callbacks = callbacks;
|
|
@@ -1276,10 +1334,12 @@ export class NativeListWebEngine {
|
|
|
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);
|
|
@@ -1385,9 +1517,16 @@ export class NativeListWebEngine {
|
|
|
1385
1517
|
}
|
|
1386
1518
|
applySnapshot(snapshot) {
|
|
1387
1519
|
const validated = validateSnapshot(snapshot);
|
|
1520
|
+
if (this.externalScrollHost && validated.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1388
1521
|
this.invalidateActionAnchor('snapshot');
|
|
1389
1522
|
this.setSnapshot(validated);
|
|
1390
1523
|
}
|
|
1524
|
+
currentContentHeight() {
|
|
1525
|
+
return this.layout.contentHeight;
|
|
1526
|
+
}
|
|
1527
|
+
currentSnapshot() {
|
|
1528
|
+
return this.snapshot;
|
|
1529
|
+
}
|
|
1391
1530
|
applyPatches(patches) {
|
|
1392
1531
|
if (patches.length === 0) return;
|
|
1393
1532
|
const next = applyRowPatches(this.snapshot, patches);
|
|
@@ -1396,7 +1535,13 @@ export class NativeListWebEngine {
|
|
|
1396
1535
|
const selected = 'selected' in patch.changes ? patch.changes.selected : undefined;
|
|
1397
1536
|
if (selected === true) selection.add(patch.key);else if (selected === false) selection.delete(patch.key);
|
|
1398
1537
|
});
|
|
1399
|
-
|
|
1538
|
+
const tableValuesOnly = patches.every(patch => {
|
|
1539
|
+
const index = this.rows.findIndex(row => row.key === patch.key);
|
|
1540
|
+
const before = this.rows[index],
|
|
1541
|
+
after = next.rows[index];
|
|
1542
|
+
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);
|
|
1543
|
+
});
|
|
1544
|
+
if (webMarketImageBindDeltaForPatches(patches) === 0 || tableValuesOnly) {
|
|
1400
1545
|
this.snapshot = next;
|
|
1401
1546
|
this.rows = effectiveRows(next);
|
|
1402
1547
|
this.selectedKeys = selection;
|
|
@@ -1405,11 +1550,11 @@ export class NativeListWebEngine {
|
|
|
1405
1550
|
const row = this.rows[index];
|
|
1406
1551
|
const element = this.mounted.get(index);
|
|
1407
1552
|
if (row?.type === 'market' && element) {
|
|
1408
|
-
setMarketQuoteContent(element, row);
|
|
1553
|
+
if (row.webTable) updateMarketTableValues(element, row);else setMarketQuoteContent(element, row);
|
|
1409
1554
|
element.dataset.renderSignature = webRowRenderSignature(row);
|
|
1410
1555
|
}
|
|
1411
1556
|
if (row?.type === 'market' && this.sticky.dataset.nativeListRowKey === row.key) {
|
|
1412
|
-
setMarketQuoteContent(this.sticky, row);
|
|
1557
|
+
if (row.webTable) updateMarketTableValues(this.sticky, row);else setMarketQuoteContent(this.sticky, row);
|
|
1413
1558
|
this.sticky.dataset.renderSignature = webRowRenderSignature(row);
|
|
1414
1559
|
}
|
|
1415
1560
|
});
|
|
@@ -1479,7 +1624,10 @@ export class NativeListWebEngine {
|
|
|
1479
1624
|
};
|
|
1480
1625
|
return;
|
|
1481
1626
|
}
|
|
1482
|
-
this.
|
|
1627
|
+
if (this.externalScrollHost) {
|
|
1628
|
+
const geometry = this.externalGeometry();
|
|
1629
|
+
this.writeExternalOffset(geometry.containerOrigin + offset, animated);
|
|
1630
|
+
} else this.scrollToAbsoluteOffset(offset, animated);
|
|
1483
1631
|
}
|
|
1484
1632
|
scrollToEnd(animated) {
|
|
1485
1633
|
this.notifyScrollCommandAccepted();
|
|
@@ -1490,7 +1638,10 @@ export class NativeListWebEngine {
|
|
|
1490
1638
|
};
|
|
1491
1639
|
return;
|
|
1492
1640
|
}
|
|
1493
|
-
|
|
1641
|
+
if (this.externalScrollHost) {
|
|
1642
|
+
const geometry = this.externalGeometry();
|
|
1643
|
+
this.writeExternalOffset(geometry.end - this.externalScrollHost.clientHeight, animated);
|
|
1644
|
+
} else this.scrollToAbsoluteOffset(Math.max(0, this.contentLength() - this.viewportLength()), animated);
|
|
1494
1645
|
}
|
|
1495
1646
|
scrollToLocation(params, scroll) {
|
|
1496
1647
|
const index = resolveLocationIndex(this.snapshot.rows, params);
|
|
@@ -1539,19 +1690,25 @@ export class NativeListWebEngine {
|
|
|
1539
1690
|
if (this.sectionIndexTransformFrame !== undefined) this.cancelFrame(this.sectionIndexTransformFrame);
|
|
1540
1691
|
if (this.reorderMovementTimer !== undefined) this.document.defaultView?.clearTimeout(this.reorderMovementTimer);
|
|
1541
1692
|
this.resizeObserver?.disconnect();
|
|
1693
|
+
this.externalScrollHost?.removeEventListener('scroll', this.handleExternalScroll, true);
|
|
1694
|
+
this.document.fonts?.removeEventListener('loadingdone', this.handleWindowResize);
|
|
1542
1695
|
this.sectionIndexTransformObserver?.disconnect();
|
|
1543
1696
|
this.document.defaultView?.removeEventListener('resize', this.handleWindowResize);
|
|
1544
1697
|
this.pendingScroll = undefined;
|
|
1545
|
-
this.viewport.removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1698
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1546
1699
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
1547
|
-
this.viewport.removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1700
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1548
1701
|
this.root.removeEventListener('click', this.handleClick);
|
|
1702
|
+
this.root.removeEventListener('contextmenu', this.handleMarketContextMenu);
|
|
1549
1703
|
this.cancelMarketPointer();
|
|
1550
1704
|
this.root.removeEventListener('pointerdown', this.handleMarketPointerDown);
|
|
1551
1705
|
this.root.removeEventListener('pointermove', this.handleMarketPointerMove);
|
|
1706
|
+
this.root.removeEventListener('touchmove', this.handleMarketTouchMove);
|
|
1552
1707
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1553
1708
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1554
1709
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
1710
|
+
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
1711
|
+
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
1555
1712
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
1556
1713
|
this.root.removeEventListener('keydown', this.handleKeyDown);
|
|
1557
1714
|
this.cancelPointerReorder(true);
|
|
@@ -1567,10 +1724,10 @@ export class NativeListWebEngine {
|
|
|
1567
1724
|
this.indexRail.removeEventListener('pointerup', this.handleIndexPointerEnd);
|
|
1568
1725
|
this.indexRail.removeEventListener('pointercancel', this.handleIndexPointerEnd);
|
|
1569
1726
|
this.indexRail.removeEventListener('click', this.handleIndexClick);
|
|
1570
|
-
this.
|
|
1571
|
-
this.
|
|
1572
|
-
this.
|
|
1573
|
-
this.
|
|
1727
|
+
this.pullTarget.removeEventListener('pointerdown', this.handlePullStart);
|
|
1728
|
+
this.pullTarget.removeEventListener('pointermove', this.handlePullMove);
|
|
1729
|
+
this.pullTarget.removeEventListener('pointerup', this.handlePullEnd);
|
|
1730
|
+
this.pullTarget.removeEventListener('pointercancel', this.handlePullEnd);
|
|
1574
1731
|
const host = this.root.parentElement;
|
|
1575
1732
|
disposeWebImageRetries(this.root);
|
|
1576
1733
|
Object.values(this.pool).forEach(elements => elements.forEach(disposeWebImageRetries));
|
|
@@ -1607,6 +1764,7 @@ export class NativeListWebEngine {
|
|
|
1607
1764
|
'--nl-pressed': theme.rowPressedBackground,
|
|
1608
1765
|
'--nl-subdued': theme.subduedBackground,
|
|
1609
1766
|
'--nl-strong': theme.strongBackground,
|
|
1767
|
+
'--nl-image-fallback-background': theme.imageFallbackBackground ?? 'transparent',
|
|
1610
1768
|
'--nl-primary': theme.primaryText,
|
|
1611
1769
|
'--nl-secondary': theme.secondaryText,
|
|
1612
1770
|
'--nl-disabled': theme.disabledText,
|
|
@@ -1653,8 +1811,47 @@ export class NativeListWebEngine {
|
|
|
1653
1811
|
if (value === undefined) this.root.style.removeProperty(name);else this.root.style.setProperty(name, value);
|
|
1654
1812
|
});
|
|
1655
1813
|
}
|
|
1814
|
+
computeLayout(viewportWidth, viewportHeight) {
|
|
1815
|
+
const measuredSnapshot = {
|
|
1816
|
+
...this.snapshot,
|
|
1817
|
+
rows: this.snapshot.rows.map(row => row.style?.container?.height === undefined && row.height === undefined && this.measuredRendererHeights.get(row.key)?.signature === webRowRenderSignature(row) ? {
|
|
1818
|
+
...row,
|
|
1819
|
+
height: this.measuredRendererHeights.get(row.key).height
|
|
1820
|
+
} : row)
|
|
1821
|
+
};
|
|
1822
|
+
let layout = computeWebListLayout(measuredSnapshot, viewportWidth, viewportHeight, this.reorderCompactKey);
|
|
1823
|
+
if (this.externalScrollHost) {
|
|
1824
|
+
const padding = paddingValues(this.snapshot);
|
|
1825
|
+
layout = {
|
|
1826
|
+
...layout,
|
|
1827
|
+
contentHeight: Math.max(padding.top, ...layout.items.map(item => item.y + item.height)) + padding.bottom
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
return layout;
|
|
1831
|
+
}
|
|
1832
|
+
writeExternalHeight(height) {
|
|
1833
|
+
const value = String(height) + 'px';
|
|
1834
|
+
this.content.style.height = value;
|
|
1835
|
+
this.viewport.style.height = value;
|
|
1836
|
+
this.viewportFrame.style.height = value;
|
|
1837
|
+
this.root.style.height = value;
|
|
1838
|
+
}
|
|
1656
1839
|
recomputeLayout = () => {
|
|
1657
1840
|
if (this.destroyed) return;
|
|
1841
|
+
const cachedWidth = this.lastViewportWidth;
|
|
1842
|
+
const cachedHeight = this.lastViewportHeight;
|
|
1843
|
+
const precomputedLayout = this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0 ? this.computeLayout(cachedWidth, cachedHeight) : undefined;
|
|
1844
|
+
if (precomputedLayout) {
|
|
1845
|
+
// Commit appended row extent before measuring React-owned slot changes.
|
|
1846
|
+
this.writeExternalHeight(Math.max(this.layout.contentHeight, precomputedLayout.contentHeight));
|
|
1847
|
+
}
|
|
1848
|
+
this.externalGeometryCache = undefined;
|
|
1849
|
+
if (this.externalScrollHost) {
|
|
1850
|
+
const geometry = this.externalGeometry();
|
|
1851
|
+
const previousOrigin = this.externalOrigin;
|
|
1852
|
+
this.externalOrigin = geometry.origin;
|
|
1853
|
+
if (previousOrigin !== undefined && geometry.origin !== previousOrigin && this.externalScrollHost.scrollTop > previousOrigin && geometry.visible) this.externalScrollHost.scrollTop += geometry.origin - previousOrigin;
|
|
1854
|
+
}
|
|
1658
1855
|
const viewportWidth = this.viewport.clientWidth;
|
|
1659
1856
|
const viewportHeight = this.snapshot.layout.orientation === 'horizontal' ? this.viewport.clientHeight : this.verticalScrollMetrics().viewportLength;
|
|
1660
1857
|
const stickyInset = this.snapshot.layout.orientation === 'horizontal' ? 0 : this.collapsiblePagerInsets().sticky;
|
|
@@ -1672,16 +1869,13 @@ export class NativeListWebEngine {
|
|
|
1672
1869
|
this.lastViewportWidth = viewportWidth;
|
|
1673
1870
|
this.lastViewportHeight = viewportHeight;
|
|
1674
1871
|
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);
|
|
1872
|
+
this.layout = precomputedLayout && viewportWidth === cachedWidth && viewportHeight === cachedHeight ? precomputedLayout : this.computeLayout(viewportWidth, viewportHeight);
|
|
1683
1873
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
1684
1874
|
this.content.style.height = String(this.layout.contentHeight) + 'px';
|
|
1875
|
+
if (this.externalScrollHost) {
|
|
1876
|
+
this.writeExternalHeight(this.layout.contentHeight);
|
|
1877
|
+
this.externalGeometryCache = undefined;
|
|
1878
|
+
}
|
|
1685
1879
|
this.renderSectionIndex(this.viewport.clientHeight <= 0 ? DEFAULT_VIEWPORT_HEIGHT : Math.max(1, viewportHeight), stickyInset);
|
|
1686
1880
|
if (previousHorizontal !== this.layout.horizontal) {
|
|
1687
1881
|
this.viewport.scrollLeft = 0;
|
|
@@ -1691,6 +1885,11 @@ export class NativeListWebEngine {
|
|
|
1691
1885
|
this.performPendingScroll();
|
|
1692
1886
|
};
|
|
1693
1887
|
updateAvatarWindow() {
|
|
1888
|
+
if (this.externalScrollHost && !this.externalGeometry().visible) {
|
|
1889
|
+
this.avatarLeases.forEach(lease => lease());
|
|
1890
|
+
this.avatarLeases.clear();
|
|
1891
|
+
return;
|
|
1892
|
+
}
|
|
1694
1893
|
const offset = this.currentOffset();
|
|
1695
1894
|
if (offset !== this.avatarOffset) this.avatarDirection = Math.sign(offset - this.avatarOffset);
|
|
1696
1895
|
this.avatarOffset = offset;
|
|
@@ -1729,7 +1928,7 @@ export class NativeListWebEngine {
|
|
|
1729
1928
|
renderWindow() {
|
|
1730
1929
|
this.updateAvatarWindow();
|
|
1731
1930
|
const viewportLength = this.viewportLength();
|
|
1732
|
-
const visible = webLayoutItemsForMount(this.layout, this.currentOffset(), viewportLength, this.virtualizationEnabled, viewportLength * OVERSCAN_VIEWPORTS);
|
|
1931
|
+
const visible = this.externalScrollHost && !this.externalGeometry().visible ? [] : webLayoutItemsForMount(this.layout, this.currentOffset(), viewportLength, this.virtualizationEnabled, viewportLength * OVERSCAN_VIEWPORTS);
|
|
1733
1932
|
const desired = new Set(visible.map(item => item.index));
|
|
1734
1933
|
this.mounted.forEach((element, index) => {
|
|
1735
1934
|
const nextRow = this.rows[index];
|
|
@@ -1799,6 +1998,7 @@ export class NativeListWebEngine {
|
|
|
1799
1998
|
const bindingEpoch = String(++this.bindingEpochCounter);
|
|
1800
1999
|
element.className = overlay ? 'ok-native-list-item ok-native-list-sticky' : 'ok-native-list-item';
|
|
1801
2000
|
setData(element, 'nativeListRowKey', row.key);
|
|
2001
|
+
setData(element, 'nativeListMediaGallery', row.type === 'mediaTile' && row.variant === 'gallery' ? 'true' : undefined);
|
|
1802
2002
|
setData(element, 'nativeListBindingEpoch', bindingEpoch);
|
|
1803
2003
|
setData(element, 'nativeListRowIndex', index);
|
|
1804
2004
|
setData(element, 'nativeListDisabled', Boolean(row.disabled));
|
|
@@ -2075,7 +2275,7 @@ export class NativeListWebEngine {
|
|
|
2075
2275
|
if (!Number.isNaN(stickyIndex)) update(this.sticky, this.rows[stickyIndex]);
|
|
2076
2276
|
}
|
|
2077
2277
|
updateVisibleState() {
|
|
2078
|
-
const visible = visibleWebLayoutItems(this.layout, this.currentOffset(), this.viewportLength());
|
|
2278
|
+
const visible = this.externalScrollHost && !this.externalGeometry().visible ? [] : visibleWebLayoutItems(this.layout, this.currentOffset(), this.viewportLength());
|
|
2079
2279
|
const first = visible[0];
|
|
2080
2280
|
const last = visible.at(-1);
|
|
2081
2281
|
const signature = String(first?.index ?? -1) + ':' + String(last?.index ?? -1) + ':' + (first?.key ?? '') + ':' + (last?.key ?? '');
|
|
@@ -2126,6 +2326,7 @@ export class NativeListWebEngine {
|
|
|
2126
2326
|
this.sticky.style.right = 'auto';
|
|
2127
2327
|
this.sticky.style.width = String(item.width) + 'px';
|
|
2128
2328
|
this.sticky.style.height = String(item.height) + 'px';
|
|
2329
|
+
if (this.externalScrollHost) this.sticky.style.top = String(Math.max(0, this.currentOffset())) + 'px';
|
|
2129
2330
|
let nextIndex = -1;
|
|
2130
2331
|
for (let cursor = index + 1; cursor < this.rows.length; cursor += 1) {
|
|
2131
2332
|
const candidate = this.rows[cursor];
|
|
@@ -2146,7 +2347,7 @@ export class NativeListWebEngine {
|
|
|
2146
2347
|
this.indexRail.querySelectorAll('[data-section-key]').forEach(button => setData(button, 'active', button.dataset.sectionKey === activeKey));
|
|
2147
2348
|
}
|
|
2148
2349
|
checkEndReached(lastVisibleIndex) {
|
|
2149
|
-
if (!this.snapshot.capabilities?.loadMore || this.reachedGeneration === this.snapshot.generation || this.rows.length === 0) return;
|
|
2350
|
+
if (this.externalScrollHost && !this.externalGeometry().visible || !this.snapshot.capabilities?.loadMore || this.reachedGeneration === this.snapshot.generation || this.rows.length === 0) return;
|
|
2150
2351
|
const threshold = Math.max(1, Math.ceil(this.rows.length * (this.snapshot.capabilities.endReachedThreshold ?? 0.2)));
|
|
2151
2352
|
if (lastVisibleIndex < this.rows.length - threshold) return;
|
|
2152
2353
|
this.reachedGeneration = this.snapshot.generation;
|
|
@@ -2160,6 +2361,7 @@ export class NativeListWebEngine {
|
|
|
2160
2361
|
this.callbacks.onScrollToIndexFailed?.(scrollFailure(this.rows, index, reason, average));
|
|
2161
2362
|
}
|
|
2162
2363
|
canScroll() {
|
|
2364
|
+
if (this.externalScrollHost) return this.viewport.clientWidth > 0 && this.externalScrollHost.clientHeight > 0;
|
|
2163
2365
|
const viewportLength = this.layout.horizontal ? this.viewport.clientWidth : this.viewport.clientHeight;
|
|
2164
2366
|
return viewportLength > 0 && this.layout.items.length > 0;
|
|
2165
2367
|
}
|
|
@@ -2167,16 +2369,25 @@ export class NativeListWebEngine {
|
|
|
2167
2369
|
if (this.layout.horizontal) {
|
|
2168
2370
|
return this.viewport.clientWidth || DEFAULT_VIEWPORT_WIDTH;
|
|
2169
2371
|
}
|
|
2372
|
+
if (this.externalScrollHost) return this.externalGeometry().viewportLength;
|
|
2170
2373
|
if (this.viewport.clientHeight <= 0) return DEFAULT_VIEWPORT_HEIGHT;
|
|
2171
2374
|
return Math.max(1, this.verticalScrollMetrics().viewportLength);
|
|
2172
2375
|
}
|
|
2173
2376
|
contentLength() {
|
|
2377
|
+
if (this.externalScrollHost) {
|
|
2378
|
+
const geometry = this.externalGeometry();
|
|
2379
|
+
return Math.max(this.layout.contentHeight, geometry.end - geometry.origin);
|
|
2380
|
+
}
|
|
2174
2381
|
return this.layout.horizontal ? this.layout.contentWidth : this.layout.contentHeight;
|
|
2175
2382
|
}
|
|
2176
2383
|
currentOffset() {
|
|
2177
2384
|
return this.layout.horizontal ? this.viewport.scrollLeft : this.verticalScrollMetrics().offset;
|
|
2178
2385
|
}
|
|
2179
2386
|
collapsiblePagerInsets() {
|
|
2387
|
+
if (this.externalScrollHost) return {
|
|
2388
|
+
header: 0,
|
|
2389
|
+
sticky: this.externalStickyInset
|
|
2390
|
+
};
|
|
2180
2391
|
const readInset = name => {
|
|
2181
2392
|
const parsed = Number.parseFloat(this.viewport.style.getPropertyValue(name));
|
|
2182
2393
|
return Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
|
@@ -2187,13 +2398,29 @@ export class NativeListWebEngine {
|
|
|
2187
2398
|
};
|
|
2188
2399
|
}
|
|
2189
2400
|
verticalScrollMetrics() {
|
|
2401
|
+
if (this.externalScrollHost) return this.externalGeometry();
|
|
2190
2402
|
const insets = this.collapsiblePagerInsets();
|
|
2191
2403
|
return resolveWebCollapsiblePagerScrollMetrics(this.viewport.scrollTop, this.viewport.clientHeight, insets.header, insets.sticky);
|
|
2192
2404
|
}
|
|
2193
2405
|
handleCollapsiblePagerInsetsChanged = () => {
|
|
2194
2406
|
this.recomputeLayout();
|
|
2195
2407
|
};
|
|
2408
|
+
writeExternalOffset(rawOffset, animated) {
|
|
2409
|
+
this.externalGeometryCache = undefined;
|
|
2410
|
+
const host = this.externalScrollHost;
|
|
2411
|
+
const scrollTo = host.ownerDocument.defaultView?.Element.prototype.scrollTo ?? host.scrollTo;
|
|
2412
|
+
scrollTo.call(host, {
|
|
2413
|
+
top: Math.max(0, Math.min(host.scrollHeight - host.clientHeight, rawOffset)),
|
|
2414
|
+
behavior: animated ? 'smooth' : 'auto'
|
|
2415
|
+
});
|
|
2416
|
+
this.scheduleFrame();
|
|
2417
|
+
}
|
|
2196
2418
|
scrollToAbsoluteOffset(offset, animated) {
|
|
2419
|
+
if (this.externalScrollHost) {
|
|
2420
|
+
const geometry = this.externalGeometry();
|
|
2421
|
+
this.writeExternalOffset(geometry.origin + offset - this.externalStickyInset, animated);
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2197
2424
|
const resolved = Math.min(Math.max(0, offset), Math.max(0, this.contentLength() - this.viewportLength()));
|
|
2198
2425
|
const rawOffset = this.layout.horizontal ? resolved : resolveWebCollapsiblePagerRawOffset(resolved, this.collapsiblePagerInsets().header);
|
|
2199
2426
|
this.viewport.scrollTo(this.layout.horizontal ? {
|
|
@@ -2242,13 +2469,16 @@ export class NativeListWebEngine {
|
|
|
2242
2469
|
this.renderFooter();
|
|
2243
2470
|
this.callbacks.onSelectionDelta?.(result.delta);
|
|
2244
2471
|
}
|
|
2245
|
-
emitRowAction(row, actionKey, actionElement, rowElement) {
|
|
2472
|
+
emitRowAction(row, actionKey, actionElement, rowElement, windowPoint) {
|
|
2246
2473
|
const anchor = actionElement && rowElement ? this.createActionAnchor(actionElement, rowElement) : undefined;
|
|
2247
2474
|
this.callbacks.onRowAction?.({
|
|
2248
2475
|
rowKey: row.key,
|
|
2249
2476
|
actionKey,
|
|
2250
2477
|
sectionKey: row.sectionKey,
|
|
2251
|
-
anchor
|
|
2478
|
+
anchor,
|
|
2479
|
+
...(windowPoint && Number.isFinite(windowPoint.x) && Number.isFinite(windowPoint.y) ? {
|
|
2480
|
+
windowPoint
|
|
2481
|
+
} : {})
|
|
2252
2482
|
});
|
|
2253
2483
|
}
|
|
2254
2484
|
createActionAnchor(actionElement, rowElement, sourceOverride) {
|
|
@@ -2329,6 +2559,23 @@ export class NativeListWebEngine {
|
|
|
2329
2559
|
this.document.defaultView?.clearTimeout(state.timer);
|
|
2330
2560
|
this.marketPointer = undefined;
|
|
2331
2561
|
}
|
|
2562
|
+
handleMarketContextMenu = event => {
|
|
2563
|
+
if (!(event.target instanceof Element) || event.target.closest('[data-native-list-action]')) return;
|
|
2564
|
+
const element = event.target.closest('[data-native-list-row-key]');
|
|
2565
|
+
const row = this.rowAtElement(element);
|
|
2566
|
+
if (row?.type !== 'market' || !row.webTable?.contextMenuActionKey || !element || !isRowPressEnabled(row)) return;
|
|
2567
|
+
event.preventDefault();
|
|
2568
|
+
this.cancelMarketPointer();
|
|
2569
|
+
markActionAnchorSource(element, 'row');
|
|
2570
|
+
const rect = element.getBoundingClientRect();
|
|
2571
|
+
this.emitRowAction(row, row.webTable.contextMenuActionKey, element, element, event.clientX || event.clientY ? {
|
|
2572
|
+
x: event.clientX,
|
|
2573
|
+
y: event.clientY
|
|
2574
|
+
} : {
|
|
2575
|
+
x: rect.left + rect.width / 2,
|
|
2576
|
+
y: rect.top + rect.height / 2
|
|
2577
|
+
});
|
|
2578
|
+
};
|
|
2332
2579
|
handleMarketPointerDown = event => {
|
|
2333
2580
|
if (event.button !== 0 || !(event.target instanceof Element)) return;
|
|
2334
2581
|
this.marketLongPressFired = false;
|
|
@@ -2340,16 +2587,24 @@ export class NativeListWebEngine {
|
|
|
2340
2587
|
if (row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2341
2588
|
if (!row.longPressActionKey || !rowElement) return;
|
|
2342
2589
|
markActionAnchorSource(rowElement, 'row');
|
|
2590
|
+
const bindingEpoch = rowElement.dataset.nativeListBindingEpoch;
|
|
2343
2591
|
const timer = this.document.defaultView?.setTimeout(() => {
|
|
2344
2592
|
const current = this.marketPointer;
|
|
2345
2593
|
if (!current || current.pointerId !== event.pointerId) return;
|
|
2594
|
+
const currentRow = this.rowAtElement(rowElement);
|
|
2346
2595
|
this.marketPointer = undefined;
|
|
2596
|
+
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2347
2597
|
this.marketLongPressFired = true;
|
|
2348
|
-
this.emitRowAction(
|
|
2598
|
+
this.emitRowAction(currentRow, currentRow.longPressActionKey, rowElement, rowElement, {
|
|
2599
|
+
x: event.clientX,
|
|
2600
|
+
y: event.clientY
|
|
2601
|
+
});
|
|
2349
2602
|
}, MARKET_LONG_PRESS_MS);
|
|
2350
2603
|
if (timer === undefined) return;
|
|
2351
2604
|
this.marketPointer = {
|
|
2352
2605
|
pointerId: event.pointerId,
|
|
2606
|
+
pointerType: event.pointerType,
|
|
2607
|
+
compact: !row.webTable,
|
|
2353
2608
|
rowKey: row.key,
|
|
2354
2609
|
startX: event.clientX,
|
|
2355
2610
|
startY: event.clientY,
|
|
@@ -2359,7 +2614,21 @@ export class NativeListWebEngine {
|
|
|
2359
2614
|
handleMarketPointerMove = event => {
|
|
2360
2615
|
const state = this.marketPointer;
|
|
2361
2616
|
if (!state || state.pointerId !== event.pointerId) return;
|
|
2362
|
-
if (
|
|
2617
|
+
if (state.compact && state.pointerType === 'touch') return;
|
|
2618
|
+
const row = this.rows.find(item => item.key === state.rowKey);
|
|
2619
|
+
const threshold = row?.type === 'market' && !row.webTable ? 3 : MARKET_MOVE_CANCEL_PX;
|
|
2620
|
+
if (Math.abs(event.clientX - state.startX) > threshold || Math.abs(event.clientY - state.startY) > threshold) this.cancelMarketPointer();
|
|
2621
|
+
};
|
|
2622
|
+
handleMarketTouchMove = event => {
|
|
2623
|
+
const state = this.marketPointer;
|
|
2624
|
+
if (!state?.compact || state.pointerType !== 'touch' || !(event.target instanceof Element) || event.target.closest('[data-native-list-row-key]')?.dataset.nativeListRowKey !== state.rowKey) return;
|
|
2625
|
+
if (event.touches.length > 1) {
|
|
2626
|
+
this.cancelMarketPointer();
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
const touch = event.touches[0] ?? event.changedTouches[0];
|
|
2630
|
+
if (!touch || !Number.isFinite(touch.clientX) || !Number.isFinite(touch.clientY)) return;
|
|
2631
|
+
if (Math.abs(touch.clientX - state.startX) > 3 || Math.abs(touch.clientY - state.startY) > 3) this.cancelMarketPointer();
|
|
2363
2632
|
};
|
|
2364
2633
|
handleMarketPointerEnd = event => {
|
|
2365
2634
|
if (this.marketPointer?.pointerId === event.pointerId) this.cancelMarketPointer();
|
|
@@ -2371,6 +2640,7 @@ export class NativeListWebEngine {
|
|
|
2371
2640
|
if (!(target instanceof Element)) return;
|
|
2372
2641
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2373
2642
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
2643
|
+
if (action.classList.contains('ok-native-list-market-subtitle-prefix') && action.scrollWidth <= action.clientWidth + 1) return;
|
|
2374
2644
|
const rowElement = action.closest('[data-native-list-row-key]');
|
|
2375
2645
|
const row = this.rowAtElement(rowElement);
|
|
2376
2646
|
const memberKey = action.closest('[data-native-list-group-member-key]')?.dataset.nativeListGroupMemberKey;
|
|
@@ -2516,7 +2786,12 @@ export class NativeListWebEngine {
|
|
|
2516
2786
|
preventScroll: true
|
|
2517
2787
|
});
|
|
2518
2788
|
}
|
|
2789
|
+
handleExternalScroll = event => {
|
|
2790
|
+
const target = event.target;
|
|
2791
|
+
if (target === this.externalScrollHost || target instanceof Element && target !== this.root && this.externalScrollHost?.contains(target) && target.contains(this.root)) this.handleScroll();
|
|
2792
|
+
};
|
|
2519
2793
|
handleScroll = () => {
|
|
2794
|
+
this.externalGeometryCache = undefined;
|
|
2520
2795
|
this.cancelMarketPointer();
|
|
2521
2796
|
this.invalidateActionAnchor('scroll');
|
|
2522
2797
|
this.scheduleFrame();
|
|
@@ -2530,6 +2805,8 @@ export class NativeListWebEngine {
|
|
|
2530
2805
|
if (this.frameHandle !== undefined || this.destroyed) return;
|
|
2531
2806
|
this.frameHandle = this.requestFrame(() => {
|
|
2532
2807
|
this.frameHandle = undefined;
|
|
2808
|
+
this.externalGeometryCache = undefined;
|
|
2809
|
+
if (this.externalScrollHost) this.externalOrigin = this.externalGeometry().origin;
|
|
2533
2810
|
if (this.virtualizationEnabled) this.renderWindow();else {
|
|
2534
2811
|
this.updateAvatarWindow();
|
|
2535
2812
|
this.updateVisibleState();
|
|
@@ -2592,7 +2869,7 @@ export class NativeListWebEngine {
|
|
|
2592
2869
|
this.selectIndexPosition(entry.position);
|
|
2593
2870
|
};
|
|
2594
2871
|
handlePullStart = event => {
|
|
2595
|
-
if (this.pointerReorder?.pointerId === event.pointerId || !this.snapshot.capabilities?.pullToRefresh || this.
|
|
2872
|
+
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
2873
|
this.pullStartY = event.clientY;
|
|
2597
2874
|
this.pullDistance = 0;
|
|
2598
2875
|
};
|
|
@@ -2668,6 +2945,7 @@ export class NativeListWebEngine {
|
|
|
2668
2945
|
if (this.pointerReorder !== state) return;
|
|
2669
2946
|
this.clearReorderLongPress(state);
|
|
2670
2947
|
state.active = true;
|
|
2948
|
+
this.cancelMarketPointer();
|
|
2671
2949
|
state.activatedAt = Date.now();
|
|
2672
2950
|
state.viewportRect = this.reorderViewportRect();
|
|
2673
2951
|
this.captureReorderPointer(state);
|
|
@@ -2744,6 +3022,10 @@ export class NativeListWebEngine {
|
|
|
2744
3022
|
this.cancelPointerReorder(true);
|
|
2745
3023
|
};
|
|
2746
3024
|
setCurrentOffset(offset) {
|
|
3025
|
+
if (this.externalScrollHost) {
|
|
3026
|
+
this.scrollToAbsoluteOffset(offset, false);
|
|
3027
|
+
return;
|
|
3028
|
+
}
|
|
2747
3029
|
const maximum = Math.max(0, this.contentLength() - this.viewportLength());
|
|
2748
3030
|
const next = Math.max(0, Math.min(maximum, offset));
|
|
2749
3031
|
if (this.layout.horizontal) this.viewport.scrollLeft = next;else {
|
|
@@ -2801,7 +3083,7 @@ export class NativeListWebEngine {
|
|
|
2801
3083
|
const viewportRect = this.viewport.getBoundingClientRect();
|
|
2802
3084
|
const insets = this.collapsiblePagerInsets();
|
|
2803
3085
|
const left = viewportRect.left + destinationLayout.x - this.viewport.scrollLeft;
|
|
2804
|
-
const top = viewportRect.top + destinationLayout.y + insets.header + insets.sticky - this.viewport.scrollTop;
|
|
3086
|
+
const top = this.externalScrollHost ? viewportRect.top + destinationLayout.y : viewportRect.top + destinationLayout.y + insets.header + insets.sticky - this.viewport.scrollTop;
|
|
2805
3087
|
this.reorderPreview.getBoundingClientRect();
|
|
2806
3088
|
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
3089
|
this.reorderPreview.style.boxShadow = 'none';
|
|
@@ -2851,6 +3133,18 @@ export class NativeListWebEngine {
|
|
|
2851
3133
|
this.reorderPreview.style.transform = 'translate3d(' + String(x) + 'px,' + String(y) + 'px,0)';
|
|
2852
3134
|
}
|
|
2853
3135
|
reorderViewportRect() {
|
|
3136
|
+
if (this.externalScrollHost) {
|
|
3137
|
+
const geometry = this.externalGeometry();
|
|
3138
|
+
const body = this.viewport.getBoundingClientRect();
|
|
3139
|
+
return {
|
|
3140
|
+
left: body.left,
|
|
3141
|
+
right: body.right,
|
|
3142
|
+
width: body.width,
|
|
3143
|
+
top: geometry.top,
|
|
3144
|
+
bottom: geometry.bottom,
|
|
3145
|
+
height: geometry.viewportLength
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
2854
3148
|
const {
|
|
2855
3149
|
left,
|
|
2856
3150
|
top,
|