@onekeyfe/react-native-native-list 6.7.0-2 → 6.7.0-20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +245 -9
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +29 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +87 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +193 -10
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +147 -33
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +145 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +51 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1920 -109
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +29 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
- package/docs/ROW_TEMPLATES.md +60 -9
- package/docs/SPEC.md +1004 -17
- package/docs/STYLE_SPEC.md +6 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +235 -39
- package/ios/NativeListActivityDetailsView.swift +18 -8
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +155 -27
- package/ios/NativeListDesignAssets.swift +9 -0
- package/ios/NativeListIdentityRenderer.swift +191 -30
- package/ios/NativeListLeadingVisual.swift +119 -22
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListModels.swift +42 -2
- package/ios/NativeListRendererRegistry.swift +1 -0
- package/ios/NativeListResolvedText.swift +2 -1
- package/ios/NativeListRowHost.swift +14 -0
- package/ios/NativeListSectionHeaderRenderer.swift +88 -0
- package/ios/RNCNativeListView.swift +1031 -55
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +1 -0
- package/ios/tests/NativeListAccessoryStackTests.swift +89 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
- package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
- package/ios/tests/NativeListLifecycleTests.swift +2720 -3
- package/lib/module/NativeList.js +200 -32
- package/lib/module/NativeList.web.js +262 -32
- package/lib/module/index.js +1 -1
- package/lib/module/models.js +1 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +776 -52
- package/lib/module/web/NativeListWebEngine.js +919 -79
- package/lib/module/web/templates/ActivityRowRenderer.js +487 -7
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
- package/lib/module/web/templates/DataRowRenderer.js +40 -5
- package/lib/module/web/templates/IdentityRowRenderer.js +90 -4
- package/lib/module/web/templates/MarketRowRenderer.js +8 -3
- package/lib/module/web/templates/MarketTableRowRenderer.js +577 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +260 -5
- package/lib/module/web/templates/MessageRowRenderer.js +18 -2
- package/lib/module/web/templates/RowContainerStyle.js +1 -0
- package/lib/module/web/templates/RowRendererRegistry.js +8 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +70 -3
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/lib/typescript/src/NativeList.d.ts +3 -3
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
- package/lib/typescript/src/NativeList.types.d.ts +29 -1
- package/lib/typescript/src/NativeList.web.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +176 -10
- package/lib/typescript/src/validation.d.ts +15 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +58 -1
- package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
- package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
- package/lib/typescript/src/web/templates/MarketTableRowRenderer.d.ts +17 -0
- package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +3 -3
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +10 -4
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/package.json +3 -3
- package/react-native-native-list.podspec +1 -0
- package/src/NativeList.nitro.ts +2 -0
- package/src/NativeList.tsx +391 -82
- package/src/NativeList.types.ts +34 -1
- package/src/NativeList.web.tsx +420 -65
- package/src/index.ts +2 -0
- package/src/models.ts +210 -3
- package/src/selection.ts +1 -0
- package/src/validation.ts +1635 -76
- package/src/web/NativeListWebEngine.ts +1476 -112
- package/src/web/templates/ActivityRowRenderer.ts +732 -8
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +150 -5
- package/src/web/templates/MarketRowRenderer.ts +19 -3
- package/src/web/templates/MarketTableRowRenderer.ts +755 -0
- package/src/web/templates/MediaTileRowRenderer.ts +313 -5
- package/src/web/templates/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +21 -6
- package/src/web/templates/SectionHeaderRowRenderer.ts +89 -5
|
@@ -5,12 +5,13 @@ import { applyRowContainerStyle, resetRowContainerStyle } from "./templates/RowC
|
|
|
5
5
|
import { hasExplicitRowHeight, rowSizeModifier } from "./templates/RowElements.js";
|
|
6
6
|
import { applyTextStyleToSlot, applyValueSegments } from "./templates/RowText.js";
|
|
7
7
|
import { setMarketQuoteContent } from "./templates/MarketRowRenderer.js";
|
|
8
|
+
import { canPatchMarketTableValues, updateMarketTableValues } from "./templates/MarketTableRowRenderer.js";
|
|
8
9
|
export { resolveWebMarketLayoutStyle } from "./templates/MarketRowRenderer.js";
|
|
9
10
|
import { measureRailWidth } from "./templates/RailRowRenderer.js";
|
|
10
11
|
import { rowRenderer, rowRendererKey, recycleRowBody } from "./templates/RowRendererRegistry.js";
|
|
11
12
|
import { checkboxStateForKeys, checkboxStateForSection, isRowPressEnabled, isSelectableRow, reduceSelection, selectionStateFromSnapshot } from "../selection.js";
|
|
12
13
|
import { calculateAlignedScrollOffset, resolveLocationIndex, scrollFailure, validateOffset } from "../scrolling.js";
|
|
13
|
-
import { applyRowPatches, validateSnapshot } from "../validation.js";
|
|
14
|
+
import { applyRowPatches, containNativeListInput, emptyNativeListSnapshot, validatePatches, validateSnapshot } from "../validation.js";
|
|
14
15
|
import { avatarPrefetchWindow } from "../avatarPrefetch.js";
|
|
15
16
|
import { acquireNativeListAvatar, canonicalNativeListAvatarUri } from "./NativeListWebAvatarCache.js";
|
|
16
17
|
const SECTION_INDEX_CONTENT_INSET = 16;
|
|
@@ -130,6 +131,7 @@ export function isWebRowReorderable(snapshot, row) {
|
|
|
130
131
|
if (row.type === 'rail' && row.draggable) return true;
|
|
131
132
|
if (row.type === 'identity' && row.draggable) return true;
|
|
132
133
|
if (row.type === 'walletGroup' && row.draggable) return true;
|
|
134
|
+
if (row.type === 'market' && row.webTable?.draggable) return true;
|
|
133
135
|
return (row.type === 'identity' || row.type === 'action') && Boolean(row.trailing?.some(accessory => accessory.kind === 'drag'));
|
|
134
136
|
}
|
|
135
137
|
export function moveWebReorderRow(rows, fromIndex, toIndex) {
|
|
@@ -274,7 +276,7 @@ export function computeWebListLayout(snapshot, viewportWidth, viewportHeight, co
|
|
|
274
276
|
};
|
|
275
277
|
}
|
|
276
278
|
const columns = snapshot.layout.gridColumns ?? 2;
|
|
277
|
-
const itemWidth =
|
|
279
|
+
const itemWidth = (availableWidth - spacing * (columns - 1)) / columns;
|
|
278
280
|
let y = padding.top;
|
|
279
281
|
let column = 0;
|
|
280
282
|
let bandStart = y;
|
|
@@ -416,18 +418,21 @@ 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-hover:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-synthesis:none;font-family:var(--nl-font-regular)}
|
|
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)}
|
|
428
433
|
.ok-native-list-item[data-native-list-disabled="true"]>.ok-native-list-row{cursor:default}
|
|
429
434
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]>.ok-native-list-row{cursor:pointer}
|
|
430
|
-
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-
|
|
435
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-hover)}
|
|
431
436
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-row{background:var(--nl-pressed)}
|
|
432
437
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:not([data-native-list-selected="true"]):hover>.ok-native-list-wallet-row{background:var(--nl-strong)}
|
|
433
438
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:not([data-native-list-selected="true"]):active>.ok-native-list-wallet-row{background:var(--nl-pressed)}
|
|
@@ -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)}
|
|
@@ -458,30 +463,41 @@ export const WEB_LIST_CSS = `
|
|
|
458
463
|
.ok-native-list-item[data-group-position="last"]>.ok-native-list-row{border-radius:0 0 var(--nl-group-radius,12px) var(--nl-group-radius,12px)}
|
|
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}
|
|
466
|
+
.ok-native-list-trailing-button{appearance:none;box-sizing:border-box;flex:0 0 auto;padding:4px 10px;border:1px solid transparent;border-radius:9999px;background:var(--nl-button-bg,var(--nl-strong));color:var(--nl-button-text,var(--nl-primary));font:500 14px/20px var(--nl-font-medium);white-space:nowrap;cursor:pointer}.ok-native-list-trailing-button:hover:not(:disabled){background:var(--nl-button-hover,var(--nl-strong))}.ok-native-list-trailing-button:active:not(:disabled){background:var(--nl-button-pressed,var(--nl-pressed))}.ok-native-list-trailing-button:focus-visible{outline:2px solid var(--nl-button-focus,var(--nl-accent))}.ok-native-list-trailing-button:disabled{opacity:.4;cursor:default}
|
|
467
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon{box-sizing:border-box;flex:0 0 38px;width:38px;height:38px;margin:-7px;padding:6px;border:1px solid transparent;border-radius:9999px;color:var(--nl-icon-subdued);background:transparent}.ok-native-list-icon-button.ok-native-list-tertiary-icon:hover:not(:disabled){background:var(--nl-hover)}.ok-native-list-icon-button.ok-native-list-tertiary-icon:active:not(:disabled){background:var(--nl-pressed)}.ok-native-list-icon-button.ok-native-list-tertiary-icon:disabled{opacity:.4;cursor:default}
|
|
468
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon:focus-visible:not(:disabled){outline:2px solid var(--nl-accent)}
|
|
469
|
+
.ok-native-list-identity-title-icon{flex:0 0 20px;width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;color:var(--nl-icon);font-size:20px}.ok-native-list-identity-title-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
461
470
|
.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;
|
|
471
|
+
.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
472
|
.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)
|
|
468
|
-
.ok-native-list-
|
|
469
|
-
.ok-native-list-
|
|
470
|
-
.ok-native-list-
|
|
473
|
+
.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}
|
|
474
|
+
.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}
|
|
475
|
+
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;overflow:hidden;font-family:var(--nl-font-semibold)}.ok-native-list-image-skeleton{position:absolute;inset:0;border-radius:inherit;pointer-events:none;animation:ok-native-list-skeleton-light 1.5s linear infinite alternate}.ok-native-list-image-skeleton[data-dark="true"]{animation-name:ok-native-list-skeleton-dark}@keyframes ok-native-list-skeleton-light{0%{background-color:#fafafa}100%{background-color:#cdcdcd}}@keyframes ok-native-list-skeleton-dark{0%{background-color:#111111}100%{background-color:#333333}}@media(prefers-reduced-motion:reduce){.ok-native-list-image-skeleton{animation:none;background-color:var(--nl-strong)}}.ok-native-list-visual>.ok-native-list-visual-corner{position:absolute;right:-4px;bottom:-4px;width:18px;height:18px;padding:2px;border-radius:50%;background:var(--nl-row);object-fit:cover}.ok-native-list-stacked{display:flex;align-items:center;width:48px;flex-basis:48px}.ok-native-list-stacked img{width:28px;height:28px;border:2px solid var(--nl-row);border-radius:50%;object-fit:cover;margin-left:-10px}.ok-native-list-stacked img:first-child{margin-left:0}
|
|
476
|
+
.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)}}
|
|
477
|
+
.ok-native-list-icon-button.ok-native-list-decorative-refresh{min-width:16px;width:16px;height:16px}
|
|
478
|
+
.ok-native-list-badge{display:inline-flex;align-items:center;max-width:100%;height:18px;padding:0 5px;border-radius:5px;background:color-mix(in srgb,var(--nl-accent) 12%,transparent);color:var(--nl-accent);font-size:11px;line-height:18px;white-space:nowrap}.ok-native-list-badge[data-tone="danger"]{background:var(--nl-critical);color:var(--nl-negative)}.ok-native-list-badge[data-tone="success"]{background:var(--nl-success-background,color-mix(in srgb,var(--nl-positive) 12%,transparent));color:var(--nl-positive)}.ok-native-list-section>.ok-native-list-badge[data-tone="success"]{box-sizing:border-box;height:20px;padding:2px 8px;border-radius:4px;font:500 12px/16px var(--nl-font-medium)}.ok-native-list-badges{display:inline-flex;gap:4px;margin-left:6px;vertical-align:middle}
|
|
479
|
+
.ok-native-list-identity-row .ok-native-list-badge[data-tone="neutral"]{height:20px;box-sizing:border-box;padding:2px 8px;border-radius:4px;background:var(--nl-strong);color:var(--nl-secondary);font-size:12px;line-height:16px;font-weight:500;font-family:var(--nl-font-medium)}
|
|
480
|
+
.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}
|
|
481
|
+
.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)}
|
|
482
|
+
.ok-native-list-button-group{padding:0;gap:10px;overflow:visible}.ok-native-list-block-button{position:relative;display:flex;flex:1 1 0;min-width:0;min-height:48px;align-items:center;justify-content:center;gap:8px;padding:12px 8px;border:1px solid color-mix(in srgb,var(--nl-info) 35%,transparent);border-radius:12px;background:transparent;color:var(--nl-info);font:500 14px/20px var(--nl-font-medium);cursor:pointer}.ok-native-list-block-button>span:not(.ok-native-list-spinner){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ok-native-list-block-button>.ok-native-list-spinner{position:static;flex:0 0 20px;width:20px;height:20px;border-top-color:var(--nl-info)}.ok-native-list-block-button:hover:not(:disabled){background:color-mix(in srgb,var(--nl-info) 10%,transparent);border-color:var(--nl-info)}.ok-native-list-block-button:active:not(:disabled){background:color-mix(in srgb,var(--nl-info) 17%,transparent)}.ok-native-list-block-button:focus-visible{outline:2px solid var(--nl-info);outline-offset:1px}.ok-native-list-block-button:disabled{opacity:.4;cursor:default}
|
|
471
483
|
.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
484
|
.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;
|
|
485
|
+
.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)}
|
|
486
|
+
.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
487
|
.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-
|
|
488
|
+
.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}
|
|
489
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-history{background:var(--nl-selected)}
|
|
490
|
+
.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}
|
|
491
|
+
.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)}
|
|
492
|
+
.ok-native-list-market-table .ok-native-list-visual-fallback>svg{width:28px;height:28px}
|
|
493
|
+
.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
494
|
.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;
|
|
495
|
+
.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
496
|
.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
497
|
@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-
|
|
498
|
+
.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
499
|
.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;
|
|
500
|
+
.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
501
|
.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
502
|
.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
503
|
.ok-native-list-checkbox[data-selector="networkSelector"]::after{display:none}
|
|
@@ -493,7 +509,7 @@ export const WEB_LIST_CSS = `
|
|
|
493
509
|
/* OneKey patch: selected group members use the same primary title color as standalone wallets. */
|
|
494
510
|
.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
511
|
.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;
|
|
512
|
+
.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
513
|
.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
514
|
.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
515
|
.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%}
|
|
@@ -512,6 +528,7 @@ export const WEB_LIST_CSS = `
|
|
|
512
528
|
.ok-native-list-root .ok-native-list-item>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member>[data-nl-container-background="true"]{background:var(--nl-container-background)}
|
|
513
529
|
.ok-native-list-root [data-nl-container-border="true"]{position:relative}
|
|
514
530
|
.ok-native-list-root [data-nl-container-border="true"]::before{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 var(--nl-container-border-width) var(--nl-container-border-color);z-index:2;pointer-events:none}
|
|
531
|
+
.ok-native-list-root [data-nl-inline-warning="true"][data-nl-container-border="true"]::before{box-shadow:none;border-block:var(--nl-container-border-width) solid var(--nl-container-border-color);border-inline:0;border-radius:0}
|
|
515
532
|
.ok-native-list-root .ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-item[data-native-list-row-press-enabled="true"]:active>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member:hover>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member:active>[data-nl-container-background="true"]{background:var(--nl-pressed)}
|
|
516
533
|
`;
|
|
517
534
|
function createElement(document, tag, className, text) {
|
|
@@ -552,10 +569,12 @@ function disposeWebImageRetries(element) {
|
|
|
552
569
|
function configureWebImageRetry(image, source, initialUri) {
|
|
553
570
|
const fallbackUri = source.fallbackUri ? safeImageUri(source.fallbackUri) : undefined;
|
|
554
571
|
const retryLimit = Number.isFinite(source.retryTimes) ? Math.max(0, Math.floor(source.retryTimes ?? 0)) : 0;
|
|
555
|
-
|
|
572
|
+
const orderedFallbacks = source.fallbackUris;
|
|
573
|
+
if (!fallbackUri && retryLimit === 0 && orderedFallbacks === undefined) return;
|
|
556
574
|
const view = image.ownerDocument.defaultView;
|
|
557
575
|
let currentUri = initialUri;
|
|
558
576
|
let usedFallback = false;
|
|
577
|
+
let fallbackIndex = 0;
|
|
559
578
|
let retryCount = 0;
|
|
560
579
|
let retryTimer;
|
|
561
580
|
let disposed = false;
|
|
@@ -568,7 +587,20 @@ function configureWebImageRetry(image, source, initialUri) {
|
|
|
568
587
|
event.stopImmediatePropagation();
|
|
569
588
|
return;
|
|
570
589
|
}
|
|
571
|
-
if (
|
|
590
|
+
if (orderedFallbacks !== undefined && retryCount >= retryLimit) {
|
|
591
|
+
if (fallbackIndex >= orderedFallbacks.length) return;
|
|
592
|
+
let nextUri;
|
|
593
|
+
while (!nextUri && fallbackIndex < orderedFallbacks.length) {
|
|
594
|
+
nextUri = safeImageUri(orderedFallbacks[fallbackIndex++]);
|
|
595
|
+
}
|
|
596
|
+
if (!nextUri) return;
|
|
597
|
+
event.stopImmediatePropagation();
|
|
598
|
+
retryCount = 0;
|
|
599
|
+
currentUri = nextUri;
|
|
600
|
+
image.src = currentUri;
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
if (orderedFallbacks === undefined && fallbackUri && !usedFallback && fallbackUri !== currentUri) {
|
|
572
604
|
event.stopImmediatePropagation();
|
|
573
605
|
usedFallback = true;
|
|
574
606
|
currentUri = fallbackUri;
|
|
@@ -599,6 +631,12 @@ function configureWebAvatar(image, source, uri) {
|
|
|
599
631
|
configureWebImageRetry(image, source, resolvedUri);
|
|
600
632
|
image.src = resolvedUri;
|
|
601
633
|
}, () => {
|
|
634
|
+
if (source.fallbackUris !== undefined) {
|
|
635
|
+
configureWebImageRetry(image, source, uri);
|
|
636
|
+
const ImageEvent = image.ownerDocument.defaultView?.Event;
|
|
637
|
+
if (ImageEvent) image.dispatchEvent(new ImageEvent('error'));
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
602
640
|
const fallbackUri = source.fallbackUri ? safeImageUri(source.fallbackUri) : undefined;
|
|
603
641
|
if (fallbackUri) {
|
|
604
642
|
configureWebImageRetry(image, source, fallbackUri);
|
|
@@ -688,6 +726,98 @@ function paintSelectorImageBackground(image, frame, inset = 0) {
|
|
|
688
726
|
|
|
689
727
|
// OneKey patch: use source SVG paths for selector actions and wallet provider marks.
|
|
690
728
|
const selectorIcons = {
|
|
729
|
+
RefreshCcwOutline: {
|
|
730
|
+
viewBox: '0 0 24 24',
|
|
731
|
+
paths: [{
|
|
732
|
+
d: 'M5 12a7 7 0 0 0 7 7 7.15 7.15 0 0 0 4.955-2h-2.943v-2h6v6h-2v-2.257A9.148 9.148 0 0 1 12 21a9 9 0 0 1-9-9v-1h2v1Zm1-6.754A9.148 9.148 0 0 1 12 3a9 9 0 0 1 9 9v1h-2v-1a7 7 0 0 0-7-7 7.15 7.15 0 0 0-4.955 2H10v2H4V3h2v2.246Z',
|
|
733
|
+
fill: 'currentColor',
|
|
734
|
+
fillRule: 'nonzero',
|
|
735
|
+
opacity: 1
|
|
736
|
+
}]
|
|
737
|
+
},
|
|
738
|
+
DotVerSolid: {
|
|
739
|
+
viewBox: '0 0 24 24',
|
|
740
|
+
paths: [{
|
|
741
|
+
d: 'M14 18v4h-4v-4zm0-4h-4v-4h4zm0-8h-4V2h4z',
|
|
742
|
+
fill: 'currentColor',
|
|
743
|
+
fillRule: 'nonzero',
|
|
744
|
+
opacity: 1
|
|
745
|
+
}]
|
|
746
|
+
},
|
|
747
|
+
Document2Outline: {
|
|
748
|
+
viewBox: '0 0 24 24',
|
|
749
|
+
paths: [{
|
|
750
|
+
d: 'M12 16H8v-2h4zm4-4H8v-2h8zm0-4H8V6h8z',
|
|
751
|
+
fill: 'currentColor',
|
|
752
|
+
fillRule: 'nonzero',
|
|
753
|
+
opacity: 1
|
|
754
|
+
}, {
|
|
755
|
+
d: 'M20 22H4V2h16zM6 20h12V4H6z',
|
|
756
|
+
fill: 'currentColor',
|
|
757
|
+
fillRule: 'evenodd',
|
|
758
|
+
opacity: 1
|
|
759
|
+
}]
|
|
760
|
+
},
|
|
761
|
+
WalletOutline: {
|
|
762
|
+
viewBox: '0 0 24 24',
|
|
763
|
+
paths: [{
|
|
764
|
+
d: 'M15.5 13.25a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5',
|
|
765
|
+
fill: 'currentColor',
|
|
766
|
+
fillRule: 'nonzero',
|
|
767
|
+
opacity: 1
|
|
768
|
+
}, {
|
|
769
|
+
d: 'M17 8h4v13H7a4 4 0 0 1-4-4V6.5A3.5 3.5 0 0 1 6.5 3H17zM5 17a2 2 0 0 0 2 2h12v-9H6.5c-.537 0-1.045-.12-1.5-.337zM6.5 5a1.5 1.5 0 1 0 0 3H15V5z',
|
|
770
|
+
fill: 'currentColor',
|
|
771
|
+
fillRule: 'evenodd',
|
|
772
|
+
opacity: 1
|
|
773
|
+
}]
|
|
774
|
+
},
|
|
775
|
+
PlusLargeOutline: {
|
|
776
|
+
viewBox: '0 0 24 24',
|
|
777
|
+
paths: [{
|
|
778
|
+
d: 'M13 11h8v2h-8v8h-2v-8H3v-2h8V3h2z',
|
|
779
|
+
fill: 'currentColor',
|
|
780
|
+
fillRule: 'nonzero',
|
|
781
|
+
opacity: 1
|
|
782
|
+
}]
|
|
783
|
+
},
|
|
784
|
+
TicketOutline: {
|
|
785
|
+
viewBox: '0 0 24 24',
|
|
786
|
+
paths: [{
|
|
787
|
+
d: 'M16 17.01h-2V15h2v2.01Zm0-4h-2V11h2v2.01Zm0-4h-2V7h2v2.01Z',
|
|
788
|
+
fill: 'currentColor',
|
|
789
|
+
fillRule: 'nonzero',
|
|
790
|
+
opacity: 1
|
|
791
|
+
}, {
|
|
792
|
+
d: 'm22 9.927-.629.252c-1.661.665-1.661 2.977 0 3.642l.629.252V20H2v-5.927l.629-.252c1.661-.665 1.661-2.977 0-3.642L2 9.927V4h20v5.927ZM4 8.636c2.5 1.52 2.499 5.207 0 6.727V18h16v-2.637c-2.499-1.52-2.5-5.208 0-6.727V6H4v2.636Z',
|
|
793
|
+
fill: 'currentColor',
|
|
794
|
+
fillRule: 'evenodd',
|
|
795
|
+
opacity: 1
|
|
796
|
+
}]
|
|
797
|
+
},
|
|
798
|
+
GasSolid: {
|
|
799
|
+
viewBox: '0 0 24 24',
|
|
800
|
+
paths: [{
|
|
801
|
+
d: 'M15 9h4v7h1V8.414L17.586 6 19 4.586l3 3V18h-5v-7h-2v8h1v2H2v-2h1V3h12zM6 9v2h6V9z',
|
|
802
|
+
fill: 'currentColor',
|
|
803
|
+
fillRule: 'evenodd',
|
|
804
|
+
opacity: 1
|
|
805
|
+
}]
|
|
806
|
+
},
|
|
807
|
+
CryptoCoinOutline: {
|
|
808
|
+
viewBox: '0 0 24 24',
|
|
809
|
+
paths: [{
|
|
810
|
+
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',
|
|
811
|
+
fill: 'currentColor',
|
|
812
|
+
fillRule: 'nonzero',
|
|
813
|
+
opacity: 1
|
|
814
|
+
}, {
|
|
815
|
+
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',
|
|
816
|
+
fill: 'currentColor',
|
|
817
|
+
fillRule: 'evenodd',
|
|
818
|
+
opacity: 1
|
|
819
|
+
}]
|
|
820
|
+
},
|
|
691
821
|
GlobusOutline: {
|
|
692
822
|
viewBox: '0 0 24 24',
|
|
693
823
|
paths: [{
|
|
@@ -918,6 +1048,7 @@ function applySelectorIcon(element, name) {
|
|
|
918
1048
|
}
|
|
919
1049
|
function iconGlyph(name) {
|
|
920
1050
|
const normalized = name.toLocaleLowerCase();
|
|
1051
|
+
if (normalized === 'dotversolid') return '⋮';
|
|
921
1052
|
if (normalized.includes('chevron')) {
|
|
922
1053
|
if (normalized.includes('top')) return '⌃';
|
|
923
1054
|
if (normalized.includes('bottom')) return '⌄';
|
|
@@ -965,6 +1096,8 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
965
1096
|
const showsSourcePlaceholder = !!source && source.loadingStrategy !== undefined && source.loadingStrategy !== 'none';
|
|
966
1097
|
frame.style.background = showsSourcePlaceholder ? 'var(--nl-strong)' : visualBackground;
|
|
967
1098
|
const fallbackIcon = 'fallbackIcon' in visual ? visual.fallbackIcon : undefined;
|
|
1099
|
+
const fallbackBackground = fallbackIcon?.backgroundColor ?? 'var(--nl-strong)';
|
|
1100
|
+
if (!source && fallbackIcon?.backgroundColor) frame.style.background = fallbackBackground;
|
|
968
1101
|
const handlesSourceFallback = showsSourcePlaceholder && (fallbackIcon !== undefined || 'fallbackText' in visual);
|
|
969
1102
|
const image = source ? createImage(context, source) : undefined;
|
|
970
1103
|
if (image) {
|
|
@@ -978,6 +1111,24 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
978
1111
|
if (image.complete && image.naturalWidth > 0) restoreBackground();
|
|
979
1112
|
}
|
|
980
1113
|
if (selectorPresentation) paintSelectorImageBackground(image, frame);
|
|
1114
|
+
if (source?.loadingStrategy === 'skeleton' && !(image.complete && image.naturalWidth > 0)) {
|
|
1115
|
+
const skeleton = createElement(context.document, 'span', 'ok-native-list-image-skeleton');
|
|
1116
|
+
const background = resolvedTheme(context.snapshot).background;
|
|
1117
|
+
const rgb = /^#([0-9a-f]{6})/i.exec(background)?.[1];
|
|
1118
|
+
if (rgb) {
|
|
1119
|
+
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
1120
|
+
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
1121
|
+
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
1122
|
+
if (red * 299 + green * 587 + blue * 114 < 128_000) skeleton.dataset.dark = 'true';
|
|
1123
|
+
}
|
|
1124
|
+
frame.appendChild(skeleton);
|
|
1125
|
+
image.addEventListener('load', () => skeleton.remove(), {
|
|
1126
|
+
once: true
|
|
1127
|
+
});
|
|
1128
|
+
image.addEventListener('error', () => skeleton.remove(), {
|
|
1129
|
+
once: true
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
981
1132
|
} else if (!source || showsSourcePlaceholder) {
|
|
982
1133
|
frame.appendChild(createElement(context.document, 'span', 'ok-native-list-visual-fallback', 'fallbackText' in visual ? visual.fallbackText ?? '' : ''));
|
|
983
1134
|
}
|
|
@@ -1001,10 +1152,19 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1001
1152
|
}
|
|
1002
1153
|
frame.querySelector('.ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)')?.remove();
|
|
1003
1154
|
const fallback = createElement(context.document, 'span', 'ok-native-list-visual-fallback', fallbackIcon ? undefined : 'fallbackText' in visual ? visual.fallbackText ?? '' : '');
|
|
1155
|
+
if ('fallbackTextColor' in visual && visual.fallbackTextColor && !fallbackIcon) fallback.style.color = visual.fallbackTextColor;
|
|
1004
1156
|
if (fallbackIcon) {
|
|
1005
1157
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1006
1158
|
if (fallbackIcon.tintColor) fallback.style.color = fallbackIcon.tintColor;
|
|
1159
|
+
if (fallbackIcon.size) {
|
|
1160
|
+
const svg = fallback.querySelector('svg');
|
|
1161
|
+
if (svg) {
|
|
1162
|
+
svg.style.width = `${fallbackIcon.size}px`;
|
|
1163
|
+
svg.style.height = `${fallbackIcon.size}px`;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1007
1166
|
}
|
|
1167
|
+
if (fallbackIcon?.backgroundColor) frame.style.background = fallbackBackground;else fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
1008
1168
|
frame.prepend(fallback);
|
|
1009
1169
|
};
|
|
1010
1170
|
if (image) image.addEventListener('error', showFallback, {
|
|
@@ -1014,6 +1174,9 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1014
1174
|
if ('borderStyle' in visual && visual.borderStyle === 'dashed') {
|
|
1015
1175
|
frame.style.border = '2px dashed ' + (visual.borderColor ?? 'var(--nl-disabled)');
|
|
1016
1176
|
frame.style.boxSizing = 'border-box';
|
|
1177
|
+
} else if ('borderColor' in visual && visual.borderColor) {
|
|
1178
|
+
frame.style.border = '1px solid ' + visual.borderColor;
|
|
1179
|
+
frame.style.boxSizing = 'border-box';
|
|
1017
1180
|
}
|
|
1018
1181
|
if ('overlays' in visual) visual.overlays?.forEach(overlay => {
|
|
1019
1182
|
const corner = createElement(context.document, 'span', 'ok-native-list-visual-overlay', overlay.text);
|
|
@@ -1027,6 +1190,12 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1027
1190
|
corner.style.lineHeight = '16px';
|
|
1028
1191
|
applyTextWeight(corner, '400');
|
|
1029
1192
|
}
|
|
1193
|
+
if (overlay.fontWeight) applyTextWeight(corner, {
|
|
1194
|
+
regular: 400,
|
|
1195
|
+
medium: 500,
|
|
1196
|
+
semibold: 600,
|
|
1197
|
+
bold: 700
|
|
1198
|
+
}[overlay.fontWeight]);
|
|
1030
1199
|
if (isWalletText || overlay.width !== undefined || overlay.height !== undefined) corner.style.borderRadius = '9999px';
|
|
1031
1200
|
const offsetX = String(-(overlay.offsetX ?? overlay.offset ?? 2)) + 'px';
|
|
1032
1201
|
const offsetY = String(-(overlay.offsetY ?? overlay.offset ?? 2)) + 'px';
|
|
@@ -1042,7 +1211,20 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1042
1211
|
if (overlay.image) {
|
|
1043
1212
|
const overlayImage = createImage(context, overlay.image);
|
|
1044
1213
|
if (overlayImage) {
|
|
1214
|
+
if ((overlay.padding ?? 0) > 0 && (overlay.width ?? size) === (overlay.height ?? size)) overlayImage.style.borderRadius = '50%';
|
|
1045
1215
|
corner.appendChild(overlayImage);
|
|
1216
|
+
if (overlay.fallbackIcon) {
|
|
1217
|
+
overlayImage.addEventListener('error', () => {
|
|
1218
|
+
disposeWebImageRetries(overlayImage);
|
|
1219
|
+
overlayImage.remove();
|
|
1220
|
+
const glyph = createElement(context.document, 'span', 'ok-native-list-overlay-fallback');
|
|
1221
|
+
applySelectorIcon(glyph, overlay.fallbackIcon.name);
|
|
1222
|
+
if (overlay.fallbackIcon?.tintColor) glyph.style.color = overlay.fallbackIcon.tintColor;
|
|
1223
|
+
corner.appendChild(glyph);
|
|
1224
|
+
}, {
|
|
1225
|
+
once: true
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1046
1228
|
if (selectorPresentation) paintSelectorImageBackground(overlayImage, corner, overlay.padding ?? 0);
|
|
1047
1229
|
}
|
|
1048
1230
|
} else if (overlay.name) applySelectorIcon(corner, overlay.name);
|
|
@@ -1122,7 +1304,23 @@ function markActionAnchorSource(element, source, slot) {
|
|
|
1122
1304
|
|
|
1123
1305
|
// OneKey patch: the compact zero-count digits share the amount baseline.
|
|
1124
1306
|
|
|
1125
|
-
function createAccessory(context, rowKey, accessory, slot) {
|
|
1307
|
+
function createAccessory(context, rowKey, accessory, slot, rowDisabled) {
|
|
1308
|
+
if (accessory.kind === 'button') {
|
|
1309
|
+
const element = createElement(context.document, 'button', 'ok-native-list-trailing-button', accessory.label);
|
|
1310
|
+
element.type = 'button';
|
|
1311
|
+
element.disabled = Boolean(rowDisabled || accessory.disabled);
|
|
1312
|
+
element.setAttribute('aria-disabled', String(element.disabled));
|
|
1313
|
+
element.setAttribute('aria-label', accessory.accessibilityLabel ?? accessory.label);
|
|
1314
|
+
setData(element, 'testid', accessory.testID);
|
|
1315
|
+
setData(element, 'nativeListAction', accessory.actionKey);
|
|
1316
|
+
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1317
|
+
if (accessory.textColor) element.style.setProperty('--nl-button-text', accessory.textColor);
|
|
1318
|
+
if (accessory.backgroundColor) element.style.setProperty('--nl-button-bg', accessory.backgroundColor);
|
|
1319
|
+
if (accessory.pressedBackgroundColor) element.style.setProperty('--nl-button-pressed', accessory.pressedBackgroundColor);
|
|
1320
|
+
if (accessory.hoverBackgroundColor) element.style.setProperty('--nl-button-hover', accessory.hoverBackgroundColor);
|
|
1321
|
+
if (accessory.focusRingColor) element.style.setProperty('--nl-button-focus', accessory.focusRingColor);
|
|
1322
|
+
return element;
|
|
1323
|
+
}
|
|
1126
1324
|
if (accessory.kind === 'checkbox') {
|
|
1127
1325
|
const element = createCheckbox(context, rowKey, accessory);
|
|
1128
1326
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
@@ -1131,8 +1329,19 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1131
1329
|
if (accessory.kind === 'icon') {
|
|
1132
1330
|
const element = createIconAction(context, accessory.name, accessory.actionKey, accessory.disabled, accessory.tintColor);
|
|
1133
1331
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1332
|
+
if (accessory.name === 'RefreshCcwOutline' && !accessory.actionKey) {
|
|
1333
|
+
element.classList.add('ok-native-list-decorative-refresh');
|
|
1334
|
+
const glyph = element.querySelector('svg');
|
|
1335
|
+
glyph?.setAttribute('width', '16');
|
|
1336
|
+
glyph?.setAttribute('height', '16');
|
|
1337
|
+
}
|
|
1338
|
+
if (accessory.buttonStyle === 'tertiary') {
|
|
1339
|
+
element.classList.add('ok-native-list-tertiary-icon');
|
|
1340
|
+
setData(element, 'nativeListAnchorInset', 7);
|
|
1341
|
+
}
|
|
1134
1342
|
setData(element, 'testid', accessory.testID);
|
|
1135
1343
|
if (accessory.hoverActionKey) setData(element, 'nativeListHoverAction', accessory.hoverActionKey);
|
|
1344
|
+
if (accessory.hoverActionKey && accessory.buttonStyle === 'tertiary') setData(element, 'nativeListIconHelp', true);
|
|
1136
1345
|
if (accessory.accessibilityLabel) element.setAttribute('aria-label', accessory.accessibilityLabel);
|
|
1137
1346
|
const row = context.snapshot.rows[context.itemIndex];
|
|
1138
1347
|
if (row && 'presentation' in row && row.presentation === 'accountSelector') {
|
|
@@ -1165,8 +1374,27 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1165
1374
|
{
|
|
1166
1375
|
const primary = createElement(context.document, 'span', undefined, accessory.primary);
|
|
1167
1376
|
primary.style.color = toneColor(accessory.primaryTone, 'primary');
|
|
1377
|
+
applyValueSegments(primary, accessory.primaryTextSegments, 16, 20, 500);
|
|
1378
|
+
if (accessory.primaryFontWeight === 'medium') applyTextWeight(primary, 500);
|
|
1379
|
+
if (accessory.primaryHelp) {
|
|
1380
|
+
const help = accessory.primaryHelp;
|
|
1381
|
+
primary.tabIndex = 0;
|
|
1382
|
+
primary.setAttribute('role', 'button');
|
|
1383
|
+
if (help.presentation === 'tooltip') {
|
|
1384
|
+
setData(primary, 'nativeListHoverAction', help.actionKey);
|
|
1385
|
+
setData(primary, 'nativeListIconHelp', true);
|
|
1386
|
+
} else {
|
|
1387
|
+
setData(primary, 'nativeListAction', help.actionKey);
|
|
1388
|
+
}
|
|
1389
|
+
if (help.underline === 'dashed') {
|
|
1390
|
+
primary.style.textDecoration = 'underline dashed';
|
|
1391
|
+
primary.style.textUnderlineOffset = '4px';
|
|
1392
|
+
}
|
|
1393
|
+
markActionAnchorSource(primary, 'trailingAccessory', slot);
|
|
1394
|
+
}
|
|
1168
1395
|
const secondary = createElement(context.document, 'span', 'ok-native-list-secondary', accessory.secondary);
|
|
1169
1396
|
secondary.style.color = toneColor(accessory.secondaryTone, 'secondary');
|
|
1397
|
+
applyValueSegments(secondary, accessory.secondaryTextSegments, 14, 20, 400);
|
|
1170
1398
|
element.replaceChildren(primary, '\n', secondary);
|
|
1171
1399
|
element.classList.add('ok-native-list-amounts');
|
|
1172
1400
|
break;
|
|
@@ -1194,10 +1422,10 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1194
1422
|
if (actionKey) markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1195
1423
|
return element;
|
|
1196
1424
|
}
|
|
1197
|
-
function rendererPrimitives(context) {
|
|
1425
|
+
function rendererPrimitives(context, rowDisabled) {
|
|
1198
1426
|
return {
|
|
1199
1427
|
background: resolvedTheme(context.snapshot).background,
|
|
1200
|
-
accessory: (key, descriptor, slot) => createAccessory(context, key, descriptor, slot),
|
|
1428
|
+
accessory: (key, descriptor, slot) => createAccessory(context, key, descriptor, slot, rowDisabled),
|
|
1201
1429
|
visual: (source, presentation) => createVisual(context, source, presentation),
|
|
1202
1430
|
thumbnail: source => createImage(context, source, 'ok-native-list-thumbnail'),
|
|
1203
1431
|
textStyle: applyTextStyleToSlot,
|
|
@@ -1207,7 +1435,7 @@ function rendererPrimitives(context) {
|
|
|
1207
1435
|
};
|
|
1208
1436
|
}
|
|
1209
1437
|
export function createRowBody(context, row) {
|
|
1210
|
-
return rowRenderer(row).create(context.document, rendererPrimitives(context));
|
|
1438
|
+
return rowRenderer(row).create(context.document, rendererPrimitives(context, Boolean(row.disabled)));
|
|
1211
1439
|
}
|
|
1212
1440
|
export class NativeListWebEngine {
|
|
1213
1441
|
rows = [];
|
|
@@ -1225,11 +1453,13 @@ export class NativeListWebEngine {
|
|
|
1225
1453
|
rail: [],
|
|
1226
1454
|
mediaTile: [],
|
|
1227
1455
|
action: [],
|
|
1456
|
+
buttonGroup: [],
|
|
1228
1457
|
system: [],
|
|
1229
1458
|
activity: [],
|
|
1230
1459
|
dataRow: [],
|
|
1231
1460
|
metricCard: [],
|
|
1232
1461
|
market: [],
|
|
1462
|
+
marketTable: [],
|
|
1233
1463
|
identity: [],
|
|
1234
1464
|
sectionHeader: []
|
|
1235
1465
|
};
|
|
@@ -1250,36 +1480,60 @@ export class NativeListWebEngine {
|
|
|
1250
1480
|
lastViewportWidth = -1;
|
|
1251
1481
|
lastViewportHeight = -1;
|
|
1252
1482
|
destroyed = false;
|
|
1483
|
+
hasAppliedSnapshot = false;
|
|
1484
|
+
structuralRevision = 0;
|
|
1485
|
+
structuralAnimations = [];
|
|
1486
|
+
structuralScrollInterrupted = false;
|
|
1487
|
+
reactFooterHeight = 0;
|
|
1488
|
+
structuralFooterCompensation = 0;
|
|
1489
|
+
structuralFooterExpansion = 0;
|
|
1490
|
+
structuralFooterFromHeight = 0;
|
|
1491
|
+
structuralProgress = 0;
|
|
1492
|
+
structuralPrefixTransition = false;
|
|
1253
1493
|
sectionIndexAlignStart = false;
|
|
1254
1494
|
// Renderers report intrinsic height after browser text wrapping.
|
|
1255
1495
|
measuredRendererHeights = new Map();
|
|
1256
1496
|
notifyScrollCommandAccepted() {
|
|
1257
1497
|
if (this.destroyed) return;
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1498
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1499
|
+
const EventConstructor = owner.ownerDocument.defaultView?.Event;
|
|
1500
|
+
if (EventConstructor) owner.dispatchEvent(new EventConstructor('ok-native-list-scroll-command-accepted'));
|
|
1260
1501
|
}
|
|
1261
1502
|
handlePagerScrollCommandCancel = event => {
|
|
1262
|
-
|
|
1503
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1504
|
+
if (this.destroyed || event.target !== owner) return;
|
|
1263
1505
|
this.pendingScroll = undefined;
|
|
1264
|
-
|
|
1265
|
-
left:
|
|
1266
|
-
top:
|
|
1506
|
+
const options = {
|
|
1507
|
+
left: owner.scrollLeft,
|
|
1508
|
+
top: owner.scrollTop,
|
|
1267
1509
|
behavior: 'instant'
|
|
1268
|
-
}
|
|
1510
|
+
};
|
|
1511
|
+
if (this.externalScrollHost) {
|
|
1512
|
+
const scrollTo = owner.ownerDocument.defaultView?.Element.prototype.scrollTo ?? owner.scrollTo;
|
|
1513
|
+
scrollTo.call(owner, options);
|
|
1514
|
+
} else this.viewport.scrollTo(options);
|
|
1269
1515
|
};
|
|
1270
|
-
constructor(host, snapshot, callbacks, virtualizationEnabled = true, sectionIndexContainer, fontFamiliesJson = '{}') {
|
|
1516
|
+
constructor(host, snapshot, callbacks, virtualizationEnabled = true, sectionIndexContainer, fontFamiliesJson = '{}', scrollOptions = {}) {
|
|
1517
|
+
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');
|
|
1518
|
+
this.ownsRefresh = scrollOptions.ownsRefresh === true;
|
|
1519
|
+
if (scrollOptions.scrollHost && snapshot.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1520
|
+
this.externalScrollHost = scrollOptions.scrollHost;
|
|
1521
|
+
this.contentBounds = scrollOptions.contentBounds;
|
|
1522
|
+
this.externalStickyInset = this.validateStickyInset(scrollOptions.stickyInset);
|
|
1271
1523
|
this.document = host.ownerDocument;
|
|
1272
|
-
this.snapshot = validateSnapshot(snapshot);
|
|
1524
|
+
this.snapshot = containNativeListInput(() => validateSnapshot(snapshot)) ?? emptyNativeListSnapshot();
|
|
1273
1525
|
this.callbacks = callbacks;
|
|
1274
1526
|
this.virtualizationEnabled = virtualizationEnabled;
|
|
1275
1527
|
this.sectionIndexContainer = sectionIndexContainer ?? undefined;
|
|
1276
1528
|
this.previousHostPosition = host.style.position;
|
|
1277
1529
|
if (!host.style.position) host.style.position = 'relative';
|
|
1278
1530
|
this.root = createElement(this.document, 'div', 'ok-native-list-root');
|
|
1531
|
+
setData(this.root, 'nativeListParentScroll', !!this.externalScrollHost);
|
|
1279
1532
|
const style = this.document.createElement('style');
|
|
1280
1533
|
style.textContent = WEB_LIST_CSS;
|
|
1281
1534
|
this.viewportFrame = createElement(this.document, 'div', 'ok-native-list-viewport-frame');
|
|
1282
1535
|
this.viewport = createElement(this.document, 'div', 'ok-native-list-viewport');
|
|
1536
|
+
this.pullTarget = this.externalScrollHost && this.ownsRefresh ? this.externalScrollHost : this.viewport;
|
|
1283
1537
|
this.viewport.setAttribute('role', 'list');
|
|
1284
1538
|
this.content = createElement(this.document, 'div', 'ok-native-list-content');
|
|
1285
1539
|
this.footer = createElement(this.document, 'div', 'ok-native-list-footer');
|
|
@@ -1300,18 +1554,51 @@ export class NativeListWebEngine {
|
|
|
1300
1554
|
this.viewportFrame.append(this.viewport, this.sticky, this.indexRail, this.refreshIndicator);
|
|
1301
1555
|
this.root.append(style, this.viewportFrame, this.footer);
|
|
1302
1556
|
host.appendChild(this.root);
|
|
1303
|
-
|
|
1557
|
+
if (this.externalScrollHost) {
|
|
1558
|
+
Object.assign(this.root.style, {
|
|
1559
|
+
position: 'relative',
|
|
1560
|
+
inset: 'auto',
|
|
1561
|
+
overflow: 'visible',
|
|
1562
|
+
flex: 'none'
|
|
1563
|
+
});
|
|
1564
|
+
Object.assign(this.viewportFrame.style, {
|
|
1565
|
+
overflow: 'visible',
|
|
1566
|
+
flex: 'none'
|
|
1567
|
+
});
|
|
1568
|
+
Object.assign(this.viewport.style, {
|
|
1569
|
+
position: 'relative',
|
|
1570
|
+
inset: 'auto',
|
|
1571
|
+
overflow: 'visible',
|
|
1572
|
+
scrollbarGutter: 'auto'
|
|
1573
|
+
});
|
|
1574
|
+
this.content.style.minHeight = '0';
|
|
1575
|
+
this.externalScrollHost.addEventListener('scroll', this.handleExternalScroll, {
|
|
1576
|
+
passive: true,
|
|
1577
|
+
capture: true
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1581
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart']) (this.externalScrollHost ?? this.viewport).addEventListener(event, this.handleStructuralUserScroll, {
|
|
1582
|
+
passive: true
|
|
1583
|
+
});
|
|
1304
1584
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
1305
1585
|
passive: true
|
|
1306
1586
|
});
|
|
1307
|
-
this.viewport.addEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1587
|
+
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1308
1588
|
this.root.addEventListener('click', this.handleClick);
|
|
1589
|
+
this.root.addEventListener('contextmenu', this.handleMarketContextMenu);
|
|
1309
1590
|
this.root.addEventListener('pointerdown', this.handleMarketPointerDown);
|
|
1310
1591
|
this.root.addEventListener('pointermove', this.handleMarketPointerMove);
|
|
1592
|
+
this.root.addEventListener('touchmove', this.handleMarketTouchMove, {
|
|
1593
|
+
passive: true
|
|
1594
|
+
});
|
|
1311
1595
|
this.root.addEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1312
1596
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1313
1597
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
1314
1598
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
1599
|
+
this.root.addEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
1600
|
+
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
1601
|
+
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
1315
1602
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
1316
1603
|
this.root.addEventListener('keydown', this.handleKeyDown);
|
|
1317
1604
|
this.viewport.addEventListener('pointerdown', this.handleReorderPointerDown, {
|
|
@@ -1334,24 +1621,67 @@ export class NativeListWebEngine {
|
|
|
1334
1621
|
this.indexRail.addEventListener('pointerup', this.handleIndexPointerEnd);
|
|
1335
1622
|
this.indexRail.addEventListener('pointercancel', this.handleIndexPointerEnd);
|
|
1336
1623
|
this.indexRail.addEventListener('click', this.handleIndexClick);
|
|
1337
|
-
this.
|
|
1624
|
+
this.pullTarget.addEventListener('pointerdown', this.handlePullStart, {
|
|
1338
1625
|
passive: true
|
|
1339
1626
|
});
|
|
1340
|
-
this.
|
|
1627
|
+
this.pullTarget.addEventListener('pointermove', this.handlePullMove, {
|
|
1341
1628
|
passive: false
|
|
1342
1629
|
});
|
|
1343
|
-
this.
|
|
1344
|
-
this.
|
|
1630
|
+
this.pullTarget.addEventListener('pointerup', this.handlePullEnd);
|
|
1631
|
+
this.pullTarget.addEventListener('pointercancel', this.handlePullEnd);
|
|
1345
1632
|
const ResizeObserverConstructor = this.document.defaultView?.ResizeObserver;
|
|
1346
1633
|
if (ResizeObserverConstructor) {
|
|
1347
1634
|
this.resizeObserver = new ResizeObserverConstructor(() => this.recomputeLayout());
|
|
1348
1635
|
this.resizeObserver.observe(this.viewport);
|
|
1636
|
+
if (this.externalScrollHost) {
|
|
1637
|
+
this.resizeObserver.observe(this.externalScrollHost);
|
|
1638
|
+
let ancestor = host;
|
|
1639
|
+
while (ancestor && ancestor !== this.externalScrollHost) {
|
|
1640
|
+
this.resizeObserver.observe(ancestor);
|
|
1641
|
+
for (const sibling of ancestor.parentElement?.children ?? []) {
|
|
1642
|
+
if (sibling instanceof this.document.defaultView.HTMLElement) this.resizeObserver.observe(sibling);
|
|
1643
|
+
}
|
|
1644
|
+
ancestor = ancestor.parentElement;
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1349
1647
|
} else {
|
|
1350
1648
|
this.document.defaultView?.addEventListener('resize', this.handleWindowResize);
|
|
1351
1649
|
}
|
|
1650
|
+
this.document.fonts?.addEventListener('loadingdone', this.handleWindowResize);
|
|
1352
1651
|
this.observeSectionIndexTransforms();
|
|
1353
1652
|
this.applyFontFamilies(fontFamiliesJson);
|
|
1354
|
-
this.
|
|
1653
|
+
this.applyValidatedSnapshot(this.snapshot);
|
|
1654
|
+
}
|
|
1655
|
+
validateStickyInset(value = 0) {
|
|
1656
|
+
if (!Number.isFinite(value) || value < 0) throw new Error('webStickyInset must be finite and non-negative');
|
|
1657
|
+
return value;
|
|
1658
|
+
}
|
|
1659
|
+
setStickyInset(value = 0) {
|
|
1660
|
+
const next = this.validateStickyInset(value);
|
|
1661
|
+
if (next === this.externalStickyInset) return;
|
|
1662
|
+
this.externalStickyInset = next;
|
|
1663
|
+
this.recomputeLayout();
|
|
1664
|
+
}
|
|
1665
|
+
externalGeometry() {
|
|
1666
|
+
return this.externalGeometryCache ??= this.readExternalGeometry();
|
|
1667
|
+
}
|
|
1668
|
+
readExternalGeometry() {
|
|
1669
|
+
const host = this.externalScrollHost;
|
|
1670
|
+
const hostRect = host.getBoundingClientRect();
|
|
1671
|
+
const bodyRect = this.viewport.getBoundingClientRect();
|
|
1672
|
+
const boundsRect = (this.contentBounds ?? this.root).getBoundingClientRect();
|
|
1673
|
+
const top = hostRect.top + host.clientTop + this.externalStickyInset;
|
|
1674
|
+
const bottom = hostRect.top + host.clientTop + host.clientHeight;
|
|
1675
|
+
return {
|
|
1676
|
+
origin: bodyRect.top - hostRect.top - host.clientTop + host.scrollTop,
|
|
1677
|
+
containerOrigin: boundsRect.top - hostRect.top - host.clientTop + host.scrollTop,
|
|
1678
|
+
end: boundsRect.bottom - hostRect.top - host.clientTop + host.scrollTop,
|
|
1679
|
+
top,
|
|
1680
|
+
bottom,
|
|
1681
|
+
offset: top - bodyRect.top,
|
|
1682
|
+
viewportLength: Math.max(0, bottom - top),
|
|
1683
|
+
visible: bodyRect.width > 0 && bodyRect.right > hostRect.left && bodyRect.left < hostRect.right && host.clientHeight > 0 && boundsRect.bottom > top && boundsRect.top < bottom
|
|
1684
|
+
};
|
|
1355
1685
|
}
|
|
1356
1686
|
fontFamiliesJson = '{}';
|
|
1357
1687
|
applyFontFamilies(json) {
|
|
@@ -1384,19 +1714,321 @@ export class NativeListWebEngine {
|
|
|
1384
1714
|
this.renderWindow();
|
|
1385
1715
|
}
|
|
1386
1716
|
applySnapshot(snapshot) {
|
|
1387
|
-
const validated =
|
|
1717
|
+
const validated = containNativeListInput(() => {
|
|
1718
|
+
const next = validateSnapshot(snapshot);
|
|
1719
|
+
if (this.externalScrollHost && next.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1720
|
+
return next;
|
|
1721
|
+
});
|
|
1722
|
+
if (!validated) return;
|
|
1723
|
+
this.applyValidatedSnapshot(validated);
|
|
1724
|
+
}
|
|
1725
|
+
applyValidatedSnapshot(validated) {
|
|
1726
|
+
this.pressedHelpElement = undefined;
|
|
1388
1727
|
this.invalidateActionAnchor('snapshot');
|
|
1389
|
-
|
|
1728
|
+
const transition = validated.structuralTransition;
|
|
1729
|
+
const isNewTransition = transition !== undefined && transition.id !== this.lastStructuralTransitionId;
|
|
1730
|
+
if (transition) this.lastStructuralTransitionId = transition.id;
|
|
1731
|
+
const nextRows = effectiveRows(validated);
|
|
1732
|
+
const changedKeys = this.rows.length !== nextRows.length || this.rows.some((row, index) => row.key !== nextRows[index]?.key);
|
|
1733
|
+
const incompatibleActivePrefix = this.structuralPrefixTransition && (validated.layout.kind !== this.snapshot.layout.kind || validated.layout.orientation !== this.snapshot.layout.orientation || nextRows.some((row, index) => row.height !== this.rows[index]?.height || row.style?.container?.height !== this.rows[index]?.style?.container?.height));
|
|
1734
|
+
const shouldAnimate = this.hasAppliedSnapshot && isNewTransition && changedKeys && (this.snapshot.layout.kind === 'linear' || this.snapshot.layout.kind === 'table') && this.snapshot.layout.orientation !== 'horizontal' && (validated.layout.kind === 'linear' || validated.layout.kind === 'table') && validated.layout.orientation !== 'horizontal' && (transition?.durationMs ?? 220) > 0 && !this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
|
|
1735
|
+
if (shouldAnimate && transition) this.applyStructuralSnapshot(validated, transition);else {
|
|
1736
|
+
if (isNewTransition || changedKeys || incompatibleActivePrefix) this.cancelStructuralAnimation();
|
|
1737
|
+
this.setSnapshot(validated);
|
|
1738
|
+
}
|
|
1739
|
+
this.hasAppliedSnapshot = true;
|
|
1740
|
+
}
|
|
1741
|
+
cancelStructuralAnimation() {
|
|
1742
|
+
this.structuralRevision += 1;
|
|
1743
|
+
if (this.structuralFrame !== undefined) this.document.defaultView?.cancelAnimationFrame(this.structuralFrame);
|
|
1744
|
+
if (this.structuralFinish !== undefined) this.document.defaultView?.clearTimeout(this.structuralFinish);
|
|
1745
|
+
this.structuralFrame = undefined;
|
|
1746
|
+
this.structuralFinish = undefined;
|
|
1747
|
+
this.structuralAnimations.forEach(animation => animation.cancel());
|
|
1748
|
+
this.structuralAnimations = [];
|
|
1749
|
+
if (this.structuralTail) {
|
|
1750
|
+
disposeWebImageRetries(this.structuralTail.layer);
|
|
1751
|
+
this.structuralTail.layer.remove();
|
|
1752
|
+
this.structuralTail = undefined;
|
|
1753
|
+
}
|
|
1754
|
+
if (this.structuralContentOverflow !== undefined) {
|
|
1755
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
1756
|
+
this.structuralContentOverflow = undefined;
|
|
1757
|
+
}
|
|
1758
|
+
this.structuralPrefixTransition = false;
|
|
1759
|
+
if (this.structuralFooterElement && this.structuralFooterStyles) {
|
|
1760
|
+
this.structuralFooterElement.style.marginBottom = this.structuralFooterStyles.marginBottom;
|
|
1761
|
+
this.structuralFooterElement.style.transform = this.structuralFooterStyles.transform;
|
|
1762
|
+
this.structuralFooterElement.style.clipPath = this.structuralFooterStyles.clipPath;
|
|
1763
|
+
}
|
|
1764
|
+
this.structuralFooterElement = undefined;
|
|
1765
|
+
this.structuralFooterStyles = undefined;
|
|
1766
|
+
this.structuralScrollInterrupted = false;
|
|
1767
|
+
this.structuralRenderedHeight = undefined;
|
|
1768
|
+
this.structuralTargetHeight = undefined;
|
|
1769
|
+
this.structuralFooterCompensation = 0;
|
|
1770
|
+
this.structuralFooterExpansion = 0;
|
|
1771
|
+
this.structuralProgress = 0;
|
|
1772
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1773
|
+
if (this.structuralAnchorStyles) {
|
|
1774
|
+
owner.style.overflowAnchor = this.structuralAnchorStyles.owner;
|
|
1775
|
+
this.content.style.overflowAnchor = this.structuralAnchorStyles.content;
|
|
1776
|
+
this.structuralAnchorStyles = undefined;
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
handleStructuralUserScroll = event => {
|
|
1780
|
+
if (event.type === 'pointerdown' && event.target !== (this.externalScrollHost ?? this.viewport) && event.pointerType !== 'touch') return;
|
|
1781
|
+
this.structuralScrollInterrupted = true;
|
|
1782
|
+
if (this.structuralPrefixTransition) {
|
|
1783
|
+
this.cancelStructuralAnimation();
|
|
1784
|
+
this.recomputeLayout();
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
updateStructuralTailWindow() {
|
|
1788
|
+
const tail = this.structuralTail;
|
|
1789
|
+
if (!tail) return;
|
|
1790
|
+
const visible = visibleWebLayoutItems(tail.layout, this.currentOffset(), this.viewportLength(), this.viewportLength() * OVERSCAN_VIEWPORTS).filter(item => item.index >= tail.firstIndex);
|
|
1791
|
+
const desired = new Set(visible.map(item => item.index));
|
|
1792
|
+
tail.mounted.forEach((element, index) => {
|
|
1793
|
+
if (desired.has(index)) return;
|
|
1794
|
+
disposeWebImageRetries(element);
|
|
1795
|
+
element.remove();
|
|
1796
|
+
tail.mounted.delete(index);
|
|
1797
|
+
});
|
|
1798
|
+
visible.forEach(item => {
|
|
1799
|
+
if (tail.mounted.has(item.index)) return;
|
|
1800
|
+
const row = tail.rows[item.index];
|
|
1801
|
+
if (!row) return;
|
|
1802
|
+
const element = createElement(this.document, 'div', 'ok-native-list-item');
|
|
1803
|
+
element.setAttribute('aria-hidden', 'true');
|
|
1804
|
+
element.style.pointerEvents = 'none';
|
|
1805
|
+
element.style.opacity = String((row.style?.container?.opacity ?? row.opacity ?? 1) * (row.disabled ? 0.5 : 1));
|
|
1806
|
+
const body = createRowBody({
|
|
1807
|
+
document: this.document,
|
|
1808
|
+
snapshot: tail.snapshot,
|
|
1809
|
+
selectedKeys: selectionStateFromSnapshot(tail.snapshot).selectedKeys,
|
|
1810
|
+
itemIndex: item.index
|
|
1811
|
+
}, row);
|
|
1812
|
+
applyRowStyle(body, row);
|
|
1813
|
+
element.append(body);
|
|
1814
|
+
this.positionElement(element, item);
|
|
1815
|
+
tail.layer.append(element);
|
|
1816
|
+
tail.mounted.set(item.index, element);
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
writeStructuralHeight(height) {
|
|
1820
|
+
if (this.externalScrollHost) this.writeExternalHeight(height);else this.content.style.height = `${height}px`;
|
|
1821
|
+
}
|
|
1822
|
+
reactFooterElement() {
|
|
1823
|
+
return this.contentBounds?.querySelector('[data-testid="native-list-footer-slot"]');
|
|
1824
|
+
}
|
|
1825
|
+
readReactFooterHeight() {
|
|
1826
|
+
return this.reactFooterElement()?.getBoundingClientRect().height ?? 0;
|
|
1827
|
+
}
|
|
1828
|
+
applyStructuralFooterVisual(progress) {
|
|
1829
|
+
const footer = this.structuralFooterElement;
|
|
1830
|
+
if (!footer || this.structuralFooterExpansion <= 0) return;
|
|
1831
|
+
const hidden = this.structuralFooterExpansion * (1 - progress);
|
|
1832
|
+
footer.style.marginBottom = `${-hidden}px`;
|
|
1833
|
+
footer.style.transform = `translateY(${-hidden}px)`;
|
|
1834
|
+
footer.style.clipPath = `inset(${hidden}px 0 0 0)`;
|
|
1835
|
+
}
|
|
1836
|
+
applyStructuralSnapshot(next, transition) {
|
|
1837
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1838
|
+
const oldOffset = owner.scrollTop;
|
|
1839
|
+
const oldScrollHeight = owner.scrollHeight;
|
|
1840
|
+
const oldHeight = this.structuralRenderedHeight ?? (this.content.getBoundingClientRect().height || this.layout.contentHeight);
|
|
1841
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
1842
|
+
const oldFooterHeight = this.structuralRenderedHeight === undefined ? this.reactFooterHeight : this.structuralFooterFromHeight + (this.reactFooterHeight - this.structuralFooterFromHeight) * this.structuralProgress;
|
|
1843
|
+
const footerDifference = oldFooterHeight - nextFooterHeight;
|
|
1844
|
+
const startHeight = oldHeight + Math.max(0, footerDifference);
|
|
1845
|
+
const oldSnapshot = this.snapshot;
|
|
1846
|
+
const oldRows = this.rows;
|
|
1847
|
+
const oldLayout = this.layout;
|
|
1848
|
+
const oldItems = oldLayout.items;
|
|
1849
|
+
const nextRows = effectiveRows(next);
|
|
1850
|
+
const prefixCount = Math.min(oldRows.length, nextRows.length);
|
|
1851
|
+
const prefixTailChange = oldSnapshot.layout.kind === next.layout.kind && oldSnapshot.layout.orientation === next.layout.orientation && oldRows.length !== nextRows.length && oldRows.slice(0, prefixCount).every((row, index) => row.key === nextRows[index]?.key);
|
|
1852
|
+
const oldPositions = new Map();
|
|
1853
|
+
this.mounted.forEach((element, index) => {
|
|
1854
|
+
const row = this.rows[index];
|
|
1855
|
+
if (row) oldPositions.set(row.key, element.getBoundingClientRect().top);
|
|
1856
|
+
});
|
|
1857
|
+
const nextKeys = new Set(effectiveRows(next).map(row => row.key));
|
|
1858
|
+
const visibleOffset = this.currentOffset();
|
|
1859
|
+
const visibleSurvivor = oldItems.find(item => item.y + item.height > visibleOffset && nextKeys.has(item.key));
|
|
1860
|
+
const anchor = visibleSurvivor;
|
|
1861
|
+
this.cancelStructuralAnimation();
|
|
1862
|
+
this.structuralScrollInterrupted = false;
|
|
1863
|
+
this.structuralAnchorStyles = {
|
|
1864
|
+
owner: owner.style.overflowAnchor,
|
|
1865
|
+
content: this.content.style.overflowAnchor
|
|
1866
|
+
};
|
|
1867
|
+
owner.style.overflowAnchor = 'none';
|
|
1868
|
+
this.content.style.overflowAnchor = 'none';
|
|
1869
|
+
this.structuralContentOverflow = this.content.style.overflow;
|
|
1870
|
+
if (prefixTailChange) this.content.style.overflow = 'clip';
|
|
1871
|
+
this.structuralRenderedHeight = startHeight;
|
|
1872
|
+
this.structuralFooterFromHeight = oldFooterHeight;
|
|
1873
|
+
this.structuralFooterCompensation = Math.max(0, footerDifference);
|
|
1874
|
+
this.structuralFooterExpansion = Math.max(0, -footerDifference);
|
|
1875
|
+
this.structuralProgress = 0;
|
|
1876
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
1877
|
+
this.structuralFooterElement = this.reactFooterElement() ?? undefined;
|
|
1878
|
+
if (this.structuralFooterElement) {
|
|
1879
|
+
const style = this.structuralFooterElement.style;
|
|
1880
|
+
this.structuralFooterStyles = {
|
|
1881
|
+
marginBottom: style.marginBottom,
|
|
1882
|
+
transform: style.transform,
|
|
1883
|
+
clipPath: style.clipPath
|
|
1884
|
+
};
|
|
1885
|
+
this.applyStructuralFooterVisual(0);
|
|
1886
|
+
}
|
|
1887
|
+
this.setSnapshot(next);
|
|
1888
|
+
const newHeight = this.layout.contentHeight;
|
|
1889
|
+
this.structuralTargetHeight = newHeight;
|
|
1890
|
+
const stablePrefixGeometry = prefixTailChange && oldItems.length === oldRows.length && this.layout.items.length === nextRows.length && oldItems.slice(0, prefixCount).every((item, index) => {
|
|
1891
|
+
const nextItem = this.layout.items[index];
|
|
1892
|
+
return nextItem?.y === item.y && nextItem?.height === item.height && nextItem?.width === item.width;
|
|
1893
|
+
});
|
|
1894
|
+
if (!stablePrefixGeometry) {
|
|
1895
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
1896
|
+
this.structuralContentOverflow = undefined;
|
|
1897
|
+
} else {
|
|
1898
|
+
this.structuralPrefixTransition = true;
|
|
1899
|
+
}
|
|
1900
|
+
if (stablePrefixGeometry && nextRows.length < oldRows.length) {
|
|
1901
|
+
const layer = createElement(this.document, 'div', 'ok-native-list-structural-tail');
|
|
1902
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
1903
|
+
layer.setAttribute('inert', '');
|
|
1904
|
+
Object.assign(layer.style, {
|
|
1905
|
+
position: 'absolute',
|
|
1906
|
+
inset: '0',
|
|
1907
|
+
pointerEvents: 'none'
|
|
1908
|
+
});
|
|
1909
|
+
this.content.append(layer);
|
|
1910
|
+
this.structuralTail = {
|
|
1911
|
+
snapshot: oldSnapshot,
|
|
1912
|
+
rows: oldRows,
|
|
1913
|
+
layout: oldLayout,
|
|
1914
|
+
firstIndex: prefixCount,
|
|
1915
|
+
layer,
|
|
1916
|
+
mounted: new Map()
|
|
1917
|
+
};
|
|
1918
|
+
this.updateStructuralTailWindow();
|
|
1919
|
+
}
|
|
1920
|
+
const nextAnchor = anchor && this.layout.items.find(item => item.key === anchor.key);
|
|
1921
|
+
const delta = nextAnchor && anchor ? nextAnchor.y - anchor.y : 0;
|
|
1922
|
+
let finalScrollHeight = oldScrollHeight + newHeight - oldHeight;
|
|
1923
|
+
if (stablePrefixGeometry && this.externalScrollHost) {
|
|
1924
|
+
const beforeMeasure = owner.scrollTop;
|
|
1925
|
+
const tailLayer = this.structuralTail?.layer;
|
|
1926
|
+
if (tailLayer) tailLayer.style.display = 'none';
|
|
1927
|
+
this.writeStructuralHeight(newHeight);
|
|
1928
|
+
this.applyStructuralFooterVisual(1);
|
|
1929
|
+
finalScrollHeight = owner.scrollHeight;
|
|
1930
|
+
this.writeStructuralHeight(startHeight);
|
|
1931
|
+
this.applyStructuralFooterVisual(0);
|
|
1932
|
+
if (tailLayer) tailLayer.style.display = '';
|
|
1933
|
+
owner.scrollTop = beforeMeasure;
|
|
1934
|
+
}
|
|
1935
|
+
const finalMaxOffset = Math.max(0, finalScrollHeight - owner.clientHeight);
|
|
1936
|
+
let targetOffset = Math.max(0, Math.min(oldOffset + delta, finalMaxOffset));
|
|
1937
|
+
if (!visibleSurvivor && transition.anchorKey && !(stablePrefixGeometry && nextRows.length > oldRows.length)) {
|
|
1938
|
+
const fallback = this.layout.items.find(item => item.key === transition.anchorKey);
|
|
1939
|
+
if (fallback) {
|
|
1940
|
+
const pagerStickyInset = Number.parseFloat(this.externalScrollHost?.style.getPropertyValue('--ok-collapsible-pager-sticky-inset') ?? '');
|
|
1941
|
+
const effectiveStickyInset = Math.max(this.externalStickyInset, Number.isFinite(pagerStickyInset) ? pagerStickyInset : 0);
|
|
1942
|
+
const fallbackTop = this.externalScrollHost ? this.externalGeometry().origin + fallback.y - effectiveStickyInset : resolveWebCollapsiblePagerRawOffset(Math.max(0, fallback.y - this.collapsiblePagerInsets().sticky), this.collapsiblePagerInsets().header);
|
|
1943
|
+
if (stablePrefixGeometry && this.externalScrollHost && this.reactFooterHeight > 0) {
|
|
1944
|
+
const footerTop = this.externalGeometry().origin + newHeight;
|
|
1945
|
+
const footerStart = Math.max(0, footerTop + this.reactFooterHeight - owner.clientHeight);
|
|
1946
|
+
const footerEnd = Math.max(0, footerTop - effectiveStickyInset);
|
|
1947
|
+
const nearestVisibleOffset = footerStart <= footerEnd ? Math.max(footerStart, Math.min(oldOffset, footerEnd)) : footerEnd;
|
|
1948
|
+
targetOffset = Math.max(0, Math.min(nearestVisibleOffset, finalMaxOffset));
|
|
1949
|
+
} else {
|
|
1950
|
+
targetOffset = Math.min(targetOffset, Math.max(0, fallbackTop));
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
const duration = transition.durationMs ?? 220;
|
|
1955
|
+
const easing = 'cubic-bezier(0.42, 0, 0.58, 1)';
|
|
1956
|
+
this.mounted.forEach((element, index) => {
|
|
1957
|
+
const row = this.rows[index];
|
|
1958
|
+
const previousTop = row && oldPositions.get(row.key);
|
|
1959
|
+
if (previousTop === undefined || typeof element.animate !== 'function') return;
|
|
1960
|
+
const offset = previousTop - element.getBoundingClientRect().top;
|
|
1961
|
+
if (Math.abs(offset) < 0.5) return;
|
|
1962
|
+
this.structuralAnimations.push(element.animate([{
|
|
1963
|
+
transform: `translateY(${offset}px)`
|
|
1964
|
+
}, {
|
|
1965
|
+
transform: 'translateY(0)'
|
|
1966
|
+
}], {
|
|
1967
|
+
duration,
|
|
1968
|
+
easing
|
|
1969
|
+
}));
|
|
1970
|
+
});
|
|
1971
|
+
const startedAt = this.document.defaultView?.performance.now() ?? Date.now();
|
|
1972
|
+
const revision = this.structuralRevision;
|
|
1973
|
+
const finish = () => {
|
|
1974
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
1975
|
+
const ownsScroll = !this.structuralScrollInterrupted;
|
|
1976
|
+
this.cancelStructuralAnimation();
|
|
1977
|
+
this.recomputeLayout();
|
|
1978
|
+
if (stablePrefixGeometry && ownsScroll) {
|
|
1979
|
+
owner.scrollTop = Math.max(0, Math.min(targetOffset, owner.scrollHeight - owner.clientHeight));
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
const step = time => {
|
|
1983
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
1984
|
+
if (this.structuralPrefixTransition && this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {
|
|
1985
|
+
finish();
|
|
1986
|
+
return;
|
|
1987
|
+
}
|
|
1988
|
+
const progress = Math.min(1, (time - startedAt) / duration);
|
|
1989
|
+
const eased = progress * progress * (3 - 2 * progress);
|
|
1990
|
+
this.structuralProgress = eased;
|
|
1991
|
+
const renderedHeight = oldHeight + ((this.structuralTargetHeight ?? newHeight) - oldHeight) * eased + this.structuralFooterCompensation * (1 - eased);
|
|
1992
|
+
this.structuralRenderedHeight = renderedHeight;
|
|
1993
|
+
this.writeStructuralHeight(renderedHeight);
|
|
1994
|
+
this.applyStructuralFooterVisual(eased);
|
|
1995
|
+
if (!this.structuralScrollInterrupted) owner.scrollTop = oldOffset + (targetOffset - oldOffset) * eased;
|
|
1996
|
+
this.externalGeometryCache = undefined;
|
|
1997
|
+
this.updateStructuralTailWindow();
|
|
1998
|
+
if (progress < 1) this.structuralFrame = this.document.defaultView?.requestAnimationFrame(step);
|
|
1999
|
+
};
|
|
2000
|
+
this.structuralFrame = this.document.defaultView?.requestAnimationFrame(step);
|
|
2001
|
+
this.structuralFinish = this.document.defaultView?.setTimeout(finish, duration + 40);
|
|
2002
|
+
}
|
|
2003
|
+
currentContentHeight() {
|
|
2004
|
+
return this.layout.contentHeight;
|
|
2005
|
+
}
|
|
2006
|
+
currentSnapshot() {
|
|
2007
|
+
return this.snapshot;
|
|
1390
2008
|
}
|
|
1391
2009
|
applyPatches(patches) {
|
|
1392
|
-
|
|
1393
|
-
|
|
2010
|
+
const accepted = containNativeListInput(() => {
|
|
2011
|
+
const normalized = validatePatches(patches);
|
|
2012
|
+
return {
|
|
2013
|
+
patches: normalized,
|
|
2014
|
+
snapshot: applyRowPatches(this.snapshot, normalized)
|
|
2015
|
+
};
|
|
2016
|
+
});
|
|
2017
|
+
if (!accepted || accepted.patches.length === 0) return;
|
|
2018
|
+
patches = accepted.patches;
|
|
2019
|
+
const next = accepted.snapshot;
|
|
1394
2020
|
const selection = new Set(this.selectedKeys);
|
|
1395
2021
|
patches.forEach(patch => {
|
|
1396
2022
|
const selected = 'selected' in patch.changes ? patch.changes.selected : undefined;
|
|
1397
2023
|
if (selected === true) selection.add(patch.key);else if (selected === false) selection.delete(patch.key);
|
|
1398
2024
|
});
|
|
1399
|
-
|
|
2025
|
+
const tableValuesOnly = patches.every(patch => {
|
|
2026
|
+
const index = this.rows.findIndex(row => row.key === patch.key);
|
|
2027
|
+
const before = this.rows[index],
|
|
2028
|
+
after = next.rows[index];
|
|
2029
|
+
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);
|
|
2030
|
+
});
|
|
2031
|
+
if (webMarketImageBindDeltaForPatches(patches) === 0 || tableValuesOnly) {
|
|
1400
2032
|
this.snapshot = next;
|
|
1401
2033
|
this.rows = effectiveRows(next);
|
|
1402
2034
|
this.selectedKeys = selection;
|
|
@@ -1405,11 +2037,11 @@ export class NativeListWebEngine {
|
|
|
1405
2037
|
const row = this.rows[index];
|
|
1406
2038
|
const element = this.mounted.get(index);
|
|
1407
2039
|
if (row?.type === 'market' && element) {
|
|
1408
|
-
setMarketQuoteContent(element, row);
|
|
2040
|
+
if (row.webTable) updateMarketTableValues(element, row);else setMarketQuoteContent(element, row);
|
|
1409
2041
|
element.dataset.renderSignature = webRowRenderSignature(row);
|
|
1410
2042
|
}
|
|
1411
2043
|
if (row?.type === 'market' && this.sticky.dataset.nativeListRowKey === row.key) {
|
|
1412
|
-
setMarketQuoteContent(this.sticky, row);
|
|
2044
|
+
if (row.webTable) updateMarketTableValues(this.sticky, row);else setMarketQuoteContent(this.sticky, row);
|
|
1413
2045
|
this.sticky.dataset.renderSignature = webRowRenderSignature(row);
|
|
1414
2046
|
}
|
|
1415
2047
|
});
|
|
@@ -1479,7 +2111,10 @@ export class NativeListWebEngine {
|
|
|
1479
2111
|
};
|
|
1480
2112
|
return;
|
|
1481
2113
|
}
|
|
1482
|
-
this.
|
|
2114
|
+
if (this.externalScrollHost) {
|
|
2115
|
+
const geometry = this.externalGeometry();
|
|
2116
|
+
this.writeExternalOffset(geometry.containerOrigin + offset, animated);
|
|
2117
|
+
} else this.scrollToAbsoluteOffset(offset, animated);
|
|
1483
2118
|
}
|
|
1484
2119
|
scrollToEnd(animated) {
|
|
1485
2120
|
this.notifyScrollCommandAccepted();
|
|
@@ -1490,7 +2125,10 @@ export class NativeListWebEngine {
|
|
|
1490
2125
|
};
|
|
1491
2126
|
return;
|
|
1492
2127
|
}
|
|
1493
|
-
|
|
2128
|
+
if (this.externalScrollHost) {
|
|
2129
|
+
const geometry = this.externalGeometry();
|
|
2130
|
+
this.writeExternalOffset(geometry.end - this.externalScrollHost.clientHeight, animated);
|
|
2131
|
+
} else this.scrollToAbsoluteOffset(Math.max(0, this.contentLength() - this.viewportLength()), animated);
|
|
1494
2132
|
}
|
|
1495
2133
|
scrollToLocation(params, scroll) {
|
|
1496
2134
|
const index = resolveLocationIndex(this.snapshot.rows, params);
|
|
@@ -1533,25 +2171,35 @@ export class NativeListWebEngine {
|
|
|
1533
2171
|
}
|
|
1534
2172
|
destroy() {
|
|
1535
2173
|
if (this.destroyed) return;
|
|
2174
|
+
this.cancelStructuralAnimation();
|
|
2175
|
+
this.pressedHelpElement = undefined;
|
|
1536
2176
|
this.invalidateActionAnchor('destroy');
|
|
1537
2177
|
this.destroyed = true;
|
|
1538
2178
|
if (this.frameHandle !== undefined) this.cancelFrame(this.frameHandle);
|
|
1539
2179
|
if (this.sectionIndexTransformFrame !== undefined) this.cancelFrame(this.sectionIndexTransformFrame);
|
|
1540
2180
|
if (this.reorderMovementTimer !== undefined) this.document.defaultView?.clearTimeout(this.reorderMovementTimer);
|
|
1541
2181
|
this.resizeObserver?.disconnect();
|
|
2182
|
+
this.externalScrollHost?.removeEventListener('scroll', this.handleExternalScroll, true);
|
|
2183
|
+
this.document.fonts?.removeEventListener('loadingdone', this.handleWindowResize);
|
|
1542
2184
|
this.sectionIndexTransformObserver?.disconnect();
|
|
1543
2185
|
this.document.defaultView?.removeEventListener('resize', this.handleWindowResize);
|
|
1544
2186
|
this.pendingScroll = undefined;
|
|
1545
|
-
this.viewport.removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
2187
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
2188
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart']) (this.externalScrollHost ?? this.viewport).removeEventListener(event, this.handleStructuralUserScroll);
|
|
1546
2189
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
1547
|
-
this.viewport.removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
2190
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1548
2191
|
this.root.removeEventListener('click', this.handleClick);
|
|
2192
|
+
this.root.removeEventListener('contextmenu', this.handleMarketContextMenu);
|
|
1549
2193
|
this.cancelMarketPointer();
|
|
1550
2194
|
this.root.removeEventListener('pointerdown', this.handleMarketPointerDown);
|
|
1551
2195
|
this.root.removeEventListener('pointermove', this.handleMarketPointerMove);
|
|
2196
|
+
this.root.removeEventListener('touchmove', this.handleMarketTouchMove);
|
|
1552
2197
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1553
2198
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1554
2199
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
2200
|
+
this.root.removeEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
2201
|
+
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
2202
|
+
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
1555
2203
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
1556
2204
|
this.root.removeEventListener('keydown', this.handleKeyDown);
|
|
1557
2205
|
this.cancelPointerReorder(true);
|
|
@@ -1567,10 +2215,10 @@ export class NativeListWebEngine {
|
|
|
1567
2215
|
this.indexRail.removeEventListener('pointerup', this.handleIndexPointerEnd);
|
|
1568
2216
|
this.indexRail.removeEventListener('pointercancel', this.handleIndexPointerEnd);
|
|
1569
2217
|
this.indexRail.removeEventListener('click', this.handleIndexClick);
|
|
1570
|
-
this.
|
|
1571
|
-
this.
|
|
1572
|
-
this.
|
|
1573
|
-
this.
|
|
2218
|
+
this.pullTarget.removeEventListener('pointerdown', this.handlePullStart);
|
|
2219
|
+
this.pullTarget.removeEventListener('pointermove', this.handlePullMove);
|
|
2220
|
+
this.pullTarget.removeEventListener('pointerup', this.handlePullEnd);
|
|
2221
|
+
this.pullTarget.removeEventListener('pointercancel', this.handlePullEnd);
|
|
1574
2222
|
const host = this.root.parentElement;
|
|
1575
2223
|
disposeWebImageRetries(this.root);
|
|
1576
2224
|
Object.values(this.pool).forEach(elements => elements.forEach(disposeWebImageRetries));
|
|
@@ -1588,6 +2236,7 @@ export class NativeListWebEngine {
|
|
|
1588
2236
|
}
|
|
1589
2237
|
setSnapshot(snapshot, selectedKeys) {
|
|
1590
2238
|
this.cancelMarketPointer();
|
|
2239
|
+
this.pressedHelpElement = undefined;
|
|
1591
2240
|
this.measuredRendererHeights.clear();
|
|
1592
2241
|
this.snapshot = snapshot;
|
|
1593
2242
|
this.rows = effectiveRows(snapshot);
|
|
@@ -1605,8 +2254,10 @@ export class NativeListWebEngine {
|
|
|
1605
2254
|
'--nl-row': theme.rowBackground,
|
|
1606
2255
|
'--nl-selected': theme.rowSelectedBackground,
|
|
1607
2256
|
'--nl-pressed': theme.rowPressedBackground,
|
|
2257
|
+
'--nl-hover': theme.rowHoverBackground ?? theme.rowPressedBackground,
|
|
1608
2258
|
'--nl-subdued': theme.subduedBackground,
|
|
1609
2259
|
'--nl-strong': theme.strongBackground,
|
|
2260
|
+
'--nl-image-fallback-background': theme.imageFallbackBackground ?? 'transparent',
|
|
1610
2261
|
'--nl-primary': theme.primaryText,
|
|
1611
2262
|
'--nl-secondary': theme.secondaryText,
|
|
1612
2263
|
'--nl-disabled': theme.disabledText,
|
|
@@ -1620,6 +2271,7 @@ export class NativeListWebEngine {
|
|
|
1620
2271
|
'--nl-separator': theme.separator,
|
|
1621
2272
|
'--nl-accent': theme.accent,
|
|
1622
2273
|
'--nl-positive': theme.positive,
|
|
2274
|
+
'--nl-success-background': theme.successBackground,
|
|
1623
2275
|
'--nl-negative': theme.negative,
|
|
1624
2276
|
'--nl-critical': theme.criticalBackground,
|
|
1625
2277
|
'--nl-inverse': theme.inverseBackground,
|
|
@@ -1653,8 +2305,61 @@ export class NativeListWebEngine {
|
|
|
1653
2305
|
if (value === undefined) this.root.style.removeProperty(name);else this.root.style.setProperty(name, value);
|
|
1654
2306
|
});
|
|
1655
2307
|
}
|
|
2308
|
+
computeLayout(viewportWidth, viewportHeight) {
|
|
2309
|
+
const measuredSnapshot = {
|
|
2310
|
+
...this.snapshot,
|
|
2311
|
+
rows: this.snapshot.rows.map(row => row.style?.container?.height === undefined && row.height === undefined && this.measuredRendererHeights.get(row.key)?.signature === webRowRenderSignature(row) ? {
|
|
2312
|
+
...row,
|
|
2313
|
+
height: this.measuredRendererHeights.get(row.key).height
|
|
2314
|
+
} : row)
|
|
2315
|
+
};
|
|
2316
|
+
let layout = computeWebListLayout(measuredSnapshot, viewportWidth, viewportHeight, this.reorderCompactKey);
|
|
2317
|
+
if (this.externalScrollHost) {
|
|
2318
|
+
const padding = paddingValues(this.snapshot);
|
|
2319
|
+
layout = {
|
|
2320
|
+
...layout,
|
|
2321
|
+
contentHeight: Math.max(padding.top, ...layout.items.map(item => item.y + item.height)) + padding.bottom
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
return layout;
|
|
2325
|
+
}
|
|
2326
|
+
writeExternalHeight(height) {
|
|
2327
|
+
const value = String(height) + 'px';
|
|
2328
|
+
this.content.style.height = value;
|
|
2329
|
+
this.viewport.style.height = value;
|
|
2330
|
+
this.viewportFrame.style.height = value;
|
|
2331
|
+
this.root.style.height = value;
|
|
2332
|
+
}
|
|
1656
2333
|
recomputeLayout = () => {
|
|
1657
2334
|
if (this.destroyed) return;
|
|
2335
|
+
if (this.structuralPrefixTransition && this.lastViewportWidth > 0 && this.viewport.clientWidth > 0 && this.viewport.clientWidth !== this.lastViewportWidth) this.cancelStructuralAnimation();
|
|
2336
|
+
if (this.structuralRenderedHeight === undefined) this.reactFooterHeight = this.readReactFooterHeight();else {
|
|
2337
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
2338
|
+
const footerDelta = this.reactFooterHeight - nextFooterHeight;
|
|
2339
|
+
if (footerDelta !== 0) {
|
|
2340
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
2341
|
+
const priorCompensation = this.structuralFooterCompensation;
|
|
2342
|
+
const difference = this.structuralFooterFromHeight - nextFooterHeight;
|
|
2343
|
+
this.structuralFooterCompensation = Math.max(0, difference);
|
|
2344
|
+
this.structuralFooterExpansion = Math.max(0, -difference);
|
|
2345
|
+
this.structuralRenderedHeight += (this.structuralFooterCompensation - priorCompensation) * (1 - this.structuralProgress);
|
|
2346
|
+
this.applyStructuralFooterVisual(this.structuralProgress);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
const cachedWidth = this.lastViewportWidth;
|
|
2350
|
+
const cachedHeight = this.lastViewportHeight;
|
|
2351
|
+
const precomputedLayout = this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0 ? this.computeLayout(cachedWidth, cachedHeight) : undefined;
|
|
2352
|
+
if (precomputedLayout && this.structuralRenderedHeight === undefined) {
|
|
2353
|
+
// Commit appended row extent before measuring React-owned slot changes.
|
|
2354
|
+
this.writeExternalHeight(Math.max(this.layout.contentHeight, precomputedLayout.contentHeight));
|
|
2355
|
+
}
|
|
2356
|
+
this.externalGeometryCache = undefined;
|
|
2357
|
+
if (this.externalScrollHost) {
|
|
2358
|
+
const geometry = this.externalGeometry();
|
|
2359
|
+
const previousOrigin = this.externalOrigin;
|
|
2360
|
+
this.externalOrigin = geometry.origin;
|
|
2361
|
+
if (previousOrigin !== undefined && geometry.origin !== previousOrigin && this.externalScrollHost.scrollTop > previousOrigin && geometry.visible) this.externalScrollHost.scrollTop += geometry.origin - previousOrigin;
|
|
2362
|
+
}
|
|
1658
2363
|
const viewportWidth = this.viewport.clientWidth;
|
|
1659
2364
|
const viewportHeight = this.snapshot.layout.orientation === 'horizontal' ? this.viewport.clientHeight : this.verticalScrollMetrics().viewportLength;
|
|
1660
2365
|
const stickyInset = this.snapshot.layout.orientation === 'horizontal' ? 0 : this.collapsiblePagerInsets().sticky;
|
|
@@ -1672,16 +2377,15 @@ export class NativeListWebEngine {
|
|
|
1672
2377
|
this.lastViewportWidth = viewportWidth;
|
|
1673
2378
|
this.lastViewportHeight = viewportHeight;
|
|
1674
2379
|
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);
|
|
2380
|
+
this.layout = precomputedLayout && viewportWidth === cachedWidth && viewportHeight === cachedHeight ? precomputedLayout : this.computeLayout(viewportWidth, viewportHeight);
|
|
1683
2381
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
1684
|
-
this.
|
|
2382
|
+
const renderedHeight = this.structuralRenderedHeight ?? this.layout.contentHeight;
|
|
2383
|
+
this.content.style.height = String(renderedHeight) + 'px';
|
|
2384
|
+
if (this.externalScrollHost) {
|
|
2385
|
+
this.writeExternalHeight(renderedHeight);
|
|
2386
|
+
this.externalGeometryCache = undefined;
|
|
2387
|
+
}
|
|
2388
|
+
if (this.structuralRenderedHeight !== undefined) this.structuralTargetHeight = this.layout.contentHeight;
|
|
1685
2389
|
this.renderSectionIndex(this.viewport.clientHeight <= 0 ? DEFAULT_VIEWPORT_HEIGHT : Math.max(1, viewportHeight), stickyInset);
|
|
1686
2390
|
if (previousHorizontal !== this.layout.horizontal) {
|
|
1687
2391
|
this.viewport.scrollLeft = 0;
|
|
@@ -1691,6 +2395,11 @@ export class NativeListWebEngine {
|
|
|
1691
2395
|
this.performPendingScroll();
|
|
1692
2396
|
};
|
|
1693
2397
|
updateAvatarWindow() {
|
|
2398
|
+
if (this.externalScrollHost && !this.externalGeometry().visible) {
|
|
2399
|
+
this.avatarLeases.forEach(lease => lease());
|
|
2400
|
+
this.avatarLeases.clear();
|
|
2401
|
+
return;
|
|
2402
|
+
}
|
|
1694
2403
|
const offset = this.currentOffset();
|
|
1695
2404
|
if (offset !== this.avatarOffset) this.avatarDirection = Math.sign(offset - this.avatarOffset);
|
|
1696
2405
|
this.avatarOffset = offset;
|
|
@@ -1729,7 +2438,7 @@ export class NativeListWebEngine {
|
|
|
1729
2438
|
renderWindow() {
|
|
1730
2439
|
this.updateAvatarWindow();
|
|
1731
2440
|
const viewportLength = this.viewportLength();
|
|
1732
|
-
const visible = webLayoutItemsForMount(this.layout, this.currentOffset(), viewportLength, this.virtualizationEnabled, viewportLength * OVERSCAN_VIEWPORTS);
|
|
2441
|
+
const visible = this.externalScrollHost && !this.externalGeometry().visible ? [] : webLayoutItemsForMount(this.layout, this.currentOffset(), viewportLength, this.virtualizationEnabled, viewportLength * OVERSCAN_VIEWPORTS);
|
|
1733
2442
|
const desired = new Set(visible.map(item => item.index));
|
|
1734
2443
|
this.mounted.forEach((element, index) => {
|
|
1735
2444
|
const nextRow = this.rows[index];
|
|
@@ -1784,6 +2493,7 @@ export class NativeListWebEngine {
|
|
|
1784
2493
|
}
|
|
1785
2494
|
this.updateVisibleSelection();
|
|
1786
2495
|
this.updateVisibleState();
|
|
2496
|
+
this.updateStructuralTailWindow();
|
|
1787
2497
|
}
|
|
1788
2498
|
positionElement(element, item) {
|
|
1789
2499
|
element.style.transform = 'translate3d(' + String(item.x) + 'px,' + String(item.y) + 'px,0)';
|
|
@@ -1799,6 +2509,7 @@ export class NativeListWebEngine {
|
|
|
1799
2509
|
const bindingEpoch = String(++this.bindingEpochCounter);
|
|
1800
2510
|
element.className = overlay ? 'ok-native-list-item ok-native-list-sticky' : 'ok-native-list-item';
|
|
1801
2511
|
setData(element, 'nativeListRowKey', row.key);
|
|
2512
|
+
setData(element, 'nativeListMediaGallery', row.type === 'mediaTile' && row.variant === 'gallery' ? 'true' : undefined);
|
|
1802
2513
|
setData(element, 'nativeListBindingEpoch', bindingEpoch);
|
|
1803
2514
|
setData(element, 'nativeListRowIndex', index);
|
|
1804
2515
|
setData(element, 'nativeListDisabled', Boolean(row.disabled));
|
|
@@ -1828,7 +2539,7 @@ export class NativeListWebEngine {
|
|
|
1828
2539
|
const body = reusableBody ?? createRowBody(context, row);
|
|
1829
2540
|
if (reusableBody) {
|
|
1830
2541
|
resetRowContainerStyle(body);
|
|
1831
|
-
registered.bind(body, rendererPrimitives(context));
|
|
2542
|
+
registered.bind(body, rendererPrimitives(context, Boolean(row.disabled)));
|
|
1832
2543
|
}
|
|
1833
2544
|
// OneKey patch: explicit selector fields preserve original page geometry.
|
|
1834
2545
|
element.style.contain = row.backgroundFullWidth ? 'layout style' : '';
|
|
@@ -2075,7 +2786,7 @@ export class NativeListWebEngine {
|
|
|
2075
2786
|
if (!Number.isNaN(stickyIndex)) update(this.sticky, this.rows[stickyIndex]);
|
|
2076
2787
|
}
|
|
2077
2788
|
updateVisibleState() {
|
|
2078
|
-
const visible = visibleWebLayoutItems(this.layout, this.currentOffset(), this.viewportLength());
|
|
2789
|
+
const visible = this.externalScrollHost && !this.externalGeometry().visible ? [] : visibleWebLayoutItems(this.layout, this.currentOffset(), this.viewportLength());
|
|
2079
2790
|
const first = visible[0];
|
|
2080
2791
|
const last = visible.at(-1);
|
|
2081
2792
|
const signature = String(first?.index ?? -1) + ':' + String(last?.index ?? -1) + ':' + (first?.key ?? '') + ':' + (last?.key ?? '');
|
|
@@ -2126,6 +2837,7 @@ export class NativeListWebEngine {
|
|
|
2126
2837
|
this.sticky.style.right = 'auto';
|
|
2127
2838
|
this.sticky.style.width = String(item.width) + 'px';
|
|
2128
2839
|
this.sticky.style.height = String(item.height) + 'px';
|
|
2840
|
+
if (this.externalScrollHost) this.sticky.style.top = String(Math.max(0, this.currentOffset())) + 'px';
|
|
2129
2841
|
let nextIndex = -1;
|
|
2130
2842
|
for (let cursor = index + 1; cursor < this.rows.length; cursor += 1) {
|
|
2131
2843
|
const candidate = this.rows[cursor];
|
|
@@ -2146,7 +2858,7 @@ export class NativeListWebEngine {
|
|
|
2146
2858
|
this.indexRail.querySelectorAll('[data-section-key]').forEach(button => setData(button, 'active', button.dataset.sectionKey === activeKey));
|
|
2147
2859
|
}
|
|
2148
2860
|
checkEndReached(lastVisibleIndex) {
|
|
2149
|
-
if (!this.snapshot.capabilities?.loadMore || this.reachedGeneration === this.snapshot.generation || this.rows.length === 0) return;
|
|
2861
|
+
if (this.externalScrollHost && !this.externalGeometry().visible || !this.snapshot.capabilities?.loadMore || this.reachedGeneration === this.snapshot.generation || this.rows.length === 0) return;
|
|
2150
2862
|
const threshold = Math.max(1, Math.ceil(this.rows.length * (this.snapshot.capabilities.endReachedThreshold ?? 0.2)));
|
|
2151
2863
|
if (lastVisibleIndex < this.rows.length - threshold) return;
|
|
2152
2864
|
this.reachedGeneration = this.snapshot.generation;
|
|
@@ -2160,6 +2872,7 @@ export class NativeListWebEngine {
|
|
|
2160
2872
|
this.callbacks.onScrollToIndexFailed?.(scrollFailure(this.rows, index, reason, average));
|
|
2161
2873
|
}
|
|
2162
2874
|
canScroll() {
|
|
2875
|
+
if (this.externalScrollHost) return this.viewport.clientWidth > 0 && this.externalScrollHost.clientHeight > 0;
|
|
2163
2876
|
const viewportLength = this.layout.horizontal ? this.viewport.clientWidth : this.viewport.clientHeight;
|
|
2164
2877
|
return viewportLength > 0 && this.layout.items.length > 0;
|
|
2165
2878
|
}
|
|
@@ -2167,16 +2880,25 @@ export class NativeListWebEngine {
|
|
|
2167
2880
|
if (this.layout.horizontal) {
|
|
2168
2881
|
return this.viewport.clientWidth || DEFAULT_VIEWPORT_WIDTH;
|
|
2169
2882
|
}
|
|
2883
|
+
if (this.externalScrollHost) return this.externalGeometry().viewportLength;
|
|
2170
2884
|
if (this.viewport.clientHeight <= 0) return DEFAULT_VIEWPORT_HEIGHT;
|
|
2171
2885
|
return Math.max(1, this.verticalScrollMetrics().viewportLength);
|
|
2172
2886
|
}
|
|
2173
2887
|
contentLength() {
|
|
2888
|
+
if (this.externalScrollHost) {
|
|
2889
|
+
const geometry = this.externalGeometry();
|
|
2890
|
+
return Math.max(this.layout.contentHeight, geometry.end - geometry.origin);
|
|
2891
|
+
}
|
|
2174
2892
|
return this.layout.horizontal ? this.layout.contentWidth : this.layout.contentHeight;
|
|
2175
2893
|
}
|
|
2176
2894
|
currentOffset() {
|
|
2177
2895
|
return this.layout.horizontal ? this.viewport.scrollLeft : this.verticalScrollMetrics().offset;
|
|
2178
2896
|
}
|
|
2179
2897
|
collapsiblePagerInsets() {
|
|
2898
|
+
if (this.externalScrollHost) return {
|
|
2899
|
+
header: 0,
|
|
2900
|
+
sticky: this.externalStickyInset
|
|
2901
|
+
};
|
|
2180
2902
|
const readInset = name => {
|
|
2181
2903
|
const parsed = Number.parseFloat(this.viewport.style.getPropertyValue(name));
|
|
2182
2904
|
return Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
|
@@ -2187,13 +2909,29 @@ export class NativeListWebEngine {
|
|
|
2187
2909
|
};
|
|
2188
2910
|
}
|
|
2189
2911
|
verticalScrollMetrics() {
|
|
2912
|
+
if (this.externalScrollHost) return this.externalGeometry();
|
|
2190
2913
|
const insets = this.collapsiblePagerInsets();
|
|
2191
2914
|
return resolveWebCollapsiblePagerScrollMetrics(this.viewport.scrollTop, this.viewport.clientHeight, insets.header, insets.sticky);
|
|
2192
2915
|
}
|
|
2193
2916
|
handleCollapsiblePagerInsetsChanged = () => {
|
|
2194
2917
|
this.recomputeLayout();
|
|
2195
2918
|
};
|
|
2919
|
+
writeExternalOffset(rawOffset, animated) {
|
|
2920
|
+
this.externalGeometryCache = undefined;
|
|
2921
|
+
const host = this.externalScrollHost;
|
|
2922
|
+
const scrollTo = host.ownerDocument.defaultView?.Element.prototype.scrollTo ?? host.scrollTo;
|
|
2923
|
+
scrollTo.call(host, {
|
|
2924
|
+
top: Math.max(0, Math.min(host.scrollHeight - host.clientHeight, rawOffset)),
|
|
2925
|
+
behavior: animated ? 'smooth' : 'auto'
|
|
2926
|
+
});
|
|
2927
|
+
this.scheduleFrame();
|
|
2928
|
+
}
|
|
2196
2929
|
scrollToAbsoluteOffset(offset, animated) {
|
|
2930
|
+
if (this.externalScrollHost) {
|
|
2931
|
+
const geometry = this.externalGeometry();
|
|
2932
|
+
this.writeExternalOffset(geometry.origin + offset - this.externalStickyInset, animated);
|
|
2933
|
+
return;
|
|
2934
|
+
}
|
|
2197
2935
|
const resolved = Math.min(Math.max(0, offset), Math.max(0, this.contentLength() - this.viewportLength()));
|
|
2198
2936
|
const rawOffset = this.layout.horizontal ? resolved : resolveWebCollapsiblePagerRawOffset(resolved, this.collapsiblePagerInsets().header);
|
|
2199
2937
|
this.viewport.scrollTo(this.layout.horizontal ? {
|
|
@@ -2242,13 +2980,16 @@ export class NativeListWebEngine {
|
|
|
2242
2980
|
this.renderFooter();
|
|
2243
2981
|
this.callbacks.onSelectionDelta?.(result.delta);
|
|
2244
2982
|
}
|
|
2245
|
-
emitRowAction(row, actionKey, actionElement, rowElement) {
|
|
2983
|
+
emitRowAction(row, actionKey, actionElement, rowElement, windowPoint) {
|
|
2246
2984
|
const anchor = actionElement && rowElement ? this.createActionAnchor(actionElement, rowElement) : undefined;
|
|
2247
2985
|
this.callbacks.onRowAction?.({
|
|
2248
2986
|
rowKey: row.key,
|
|
2249
2987
|
actionKey,
|
|
2250
2988
|
sectionKey: row.sectionKey,
|
|
2251
|
-
anchor
|
|
2989
|
+
anchor,
|
|
2990
|
+
...(windowPoint && Number.isFinite(windowPoint.x) && Number.isFinite(windowPoint.y) ? {
|
|
2991
|
+
windowPoint
|
|
2992
|
+
} : {})
|
|
2252
2993
|
});
|
|
2253
2994
|
}
|
|
2254
2995
|
createActionAnchor(actionElement, rowElement, sourceOverride) {
|
|
@@ -2280,6 +3021,7 @@ export class NativeListWebEngine {
|
|
|
2280
3021
|
return anchor.actionElement.isConnected && anchor.rowElement.isConnected && anchor.rowElement.contains(anchor.actionElement) && anchor.rowElement.dataset.nativeListBindingEpoch === anchor.bindingEpoch;
|
|
2281
3022
|
}
|
|
2282
3023
|
invalidateActionAnchorForElement(element) {
|
|
3024
|
+
if (this.pressedHelpElement && element.contains(this.pressedHelpElement)) this.pressedHelpElement = undefined;
|
|
2283
3025
|
const anchor = this.actionAnchor;
|
|
2284
3026
|
if (anchor && (element === anchor.rowElement || element.contains(anchor.actionElement))) {
|
|
2285
3027
|
this.invalidateActionAnchor('rebind');
|
|
@@ -2329,27 +3071,52 @@ export class NativeListWebEngine {
|
|
|
2329
3071
|
this.document.defaultView?.clearTimeout(state.timer);
|
|
2330
3072
|
this.marketPointer = undefined;
|
|
2331
3073
|
}
|
|
3074
|
+
handleMarketContextMenu = event => {
|
|
3075
|
+
if (!(event.target instanceof Element) || event.target.closest('[data-native-list-action]')) return;
|
|
3076
|
+
const element = event.target.closest('[data-native-list-row-key]');
|
|
3077
|
+
const row = this.rowAtElement(element);
|
|
3078
|
+
if (row?.type !== 'market' || !row.webTable?.contextMenuActionKey || !element || !isRowPressEnabled(row)) return;
|
|
3079
|
+
event.preventDefault();
|
|
3080
|
+
this.cancelMarketPointer();
|
|
3081
|
+
markActionAnchorSource(element, 'row');
|
|
3082
|
+
const rect = element.getBoundingClientRect();
|
|
3083
|
+
this.emitRowAction(row, row.webTable.contextMenuActionKey, element, element, event.clientX || event.clientY ? {
|
|
3084
|
+
x: event.clientX,
|
|
3085
|
+
y: event.clientY
|
|
3086
|
+
} : {
|
|
3087
|
+
x: rect.left + rect.width / 2,
|
|
3088
|
+
y: rect.top + rect.height / 2
|
|
3089
|
+
});
|
|
3090
|
+
};
|
|
2332
3091
|
handleMarketPointerDown = event => {
|
|
2333
3092
|
if (event.button !== 0 || !(event.target instanceof Element)) return;
|
|
2334
3093
|
this.marketLongPressFired = false;
|
|
2335
3094
|
if (event.target.closest('[data-native-list-action]')) return;
|
|
2336
3095
|
const rowElement = event.target.closest('[data-native-list-row-key]');
|
|
2337
3096
|
const row = this.rowAtElement(rowElement);
|
|
2338
|
-
if (row?.type !== 'market' || !isRowPressEnabled(row)) return;
|
|
3097
|
+
if (row?.type !== 'market' && row?.type !== 'identity' || !isRowPressEnabled(row)) return;
|
|
2339
3098
|
this.cancelMarketPointer();
|
|
2340
|
-
if (row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
3099
|
+
if (row.type === 'market' && row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2341
3100
|
if (!row.longPressActionKey || !rowElement) return;
|
|
2342
3101
|
markActionAnchorSource(rowElement, 'row');
|
|
3102
|
+
const bindingEpoch = rowElement.dataset.nativeListBindingEpoch;
|
|
2343
3103
|
const timer = this.document.defaultView?.setTimeout(() => {
|
|
2344
3104
|
const current = this.marketPointer;
|
|
2345
3105
|
if (!current || current.pointerId !== event.pointerId) return;
|
|
3106
|
+
const currentRow = this.rowAtElement(rowElement);
|
|
2346
3107
|
this.marketPointer = undefined;
|
|
3108
|
+
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' && currentRow.type !== 'identity' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2347
3109
|
this.marketLongPressFired = true;
|
|
2348
|
-
this.emitRowAction(
|
|
3110
|
+
this.emitRowAction(currentRow, currentRow.longPressActionKey, rowElement, rowElement, {
|
|
3111
|
+
x: event.clientX,
|
|
3112
|
+
y: event.clientY
|
|
3113
|
+
});
|
|
2349
3114
|
}, MARKET_LONG_PRESS_MS);
|
|
2350
3115
|
if (timer === undefined) return;
|
|
2351
3116
|
this.marketPointer = {
|
|
2352
3117
|
pointerId: event.pointerId,
|
|
3118
|
+
pointerType: event.pointerType,
|
|
3119
|
+
compact: row.type === 'identity' || !row.webTable,
|
|
2353
3120
|
rowKey: row.key,
|
|
2354
3121
|
startX: event.clientX,
|
|
2355
3122
|
startY: event.clientY,
|
|
@@ -2359,7 +3126,21 @@ export class NativeListWebEngine {
|
|
|
2359
3126
|
handleMarketPointerMove = event => {
|
|
2360
3127
|
const state = this.marketPointer;
|
|
2361
3128
|
if (!state || state.pointerId !== event.pointerId) return;
|
|
2362
|
-
if (
|
|
3129
|
+
if (state.compact && state.pointerType === 'touch') return;
|
|
3130
|
+
const row = this.rows.find(item => item.key === state.rowKey);
|
|
3131
|
+
const threshold = row?.type === 'market' && !row.webTable ? 3 : MARKET_MOVE_CANCEL_PX;
|
|
3132
|
+
if (Math.abs(event.clientX - state.startX) > threshold || Math.abs(event.clientY - state.startY) > threshold) this.cancelMarketPointer();
|
|
3133
|
+
};
|
|
3134
|
+
handleMarketTouchMove = event => {
|
|
3135
|
+
const state = this.marketPointer;
|
|
3136
|
+
if (!state?.compact || state.pointerType !== 'touch' || !(event.target instanceof Element) || event.target.closest('[data-native-list-row-key]')?.dataset.nativeListRowKey !== state.rowKey) return;
|
|
3137
|
+
if (event.touches.length > 1) {
|
|
3138
|
+
this.cancelMarketPointer();
|
|
3139
|
+
return;
|
|
3140
|
+
}
|
|
3141
|
+
const touch = event.touches[0] ?? event.changedTouches[0];
|
|
3142
|
+
if (!touch || !Number.isFinite(touch.clientX) || !Number.isFinite(touch.clientY)) return;
|
|
3143
|
+
if (Math.abs(touch.clientX - state.startX) > 3 || Math.abs(touch.clientY - state.startY) > 3) this.cancelMarketPointer();
|
|
2363
3144
|
};
|
|
2364
3145
|
handleMarketPointerEnd = event => {
|
|
2365
3146
|
if (this.marketPointer?.pointerId === event.pointerId) this.cancelMarketPointer();
|
|
@@ -2371,6 +3152,14 @@ export class NativeListWebEngine {
|
|
|
2371
3152
|
if (!(target instanceof Element)) return;
|
|
2372
3153
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2373
3154
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
3155
|
+
if (action.dataset.nativeListIconHelp === 'true') {
|
|
3156
|
+
if (event.type === 'pointerover' && event.pointerType === 'touch') return;
|
|
3157
|
+
if (this.pressedHelpElement === action) return;
|
|
3158
|
+
}
|
|
3159
|
+
if (action.classList.contains('ok-native-list-market-subtitle-prefix') && action.scrollWidth <= action.clientWidth + 1) return;
|
|
3160
|
+
this.emitHoverAction(action);
|
|
3161
|
+
};
|
|
3162
|
+
emitHoverAction(action) {
|
|
2374
3163
|
const rowElement = action.closest('[data-native-list-row-key]');
|
|
2375
3164
|
const row = this.rowAtElement(rowElement);
|
|
2376
3165
|
const memberKey = action.closest('[data-native-list-group-member-key]')?.dataset.nativeListGroupMemberKey;
|
|
@@ -2379,12 +3168,26 @@ export class NativeListWebEngine {
|
|
|
2379
3168
|
// Legacy Web: hover checks only the resolved source (the member for a
|
|
2380
3169
|
// WalletGroup), not the enclosing row's `disabled`.
|
|
2381
3170
|
if (sourceRow && !sourceRow.disabled && actionKey) this.emitRowAction(sourceRow, actionKey, action, rowElement ?? undefined);
|
|
3171
|
+
}
|
|
3172
|
+
handleIconHelpPointerDown = event => {
|
|
3173
|
+
const target = event.target;
|
|
3174
|
+
if (!(target instanceof Element)) return;
|
|
3175
|
+
const action = target.closest('[data-native-list-icon-help="true"]');
|
|
3176
|
+
if (!action) return;
|
|
3177
|
+
if (event.pointerType === 'touch') {
|
|
3178
|
+
if (this.actionAnchor?.actionElement === action && this.actionAnchor.open) this.invalidateActionAnchor('pointerLeave');else this.emitHoverAction(action);
|
|
3179
|
+
} else {
|
|
3180
|
+
this.pressedHelpElement = action;
|
|
3181
|
+
if (this.actionAnchor?.actionElement === action) this.invalidateActionAnchor('pointerLeave');
|
|
3182
|
+
}
|
|
2382
3183
|
};
|
|
2383
3184
|
handleTitlePointerOut = event => {
|
|
2384
3185
|
const target = event.target;
|
|
2385
3186
|
if (!(target instanceof Element)) return;
|
|
2386
3187
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2387
3188
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
3189
|
+
if (action.dataset.nativeListIconHelp === 'true' && event.type === 'pointerout' && event.pointerType === 'touch') return;
|
|
3190
|
+
if (event.type === 'pointerout' && this.pressedHelpElement === action) this.pressedHelpElement = undefined;
|
|
2388
3191
|
if (this.actionAnchor?.actionElement === action) this.invalidateActionAnchor('pointerLeave');
|
|
2389
3192
|
};
|
|
2390
3193
|
handleClick = event => {
|
|
@@ -2396,6 +3199,11 @@ export class NativeListWebEngine {
|
|
|
2396
3199
|
}
|
|
2397
3200
|
const target = event.target;
|
|
2398
3201
|
if (!(target instanceof Element)) return;
|
|
3202
|
+
if (target.closest('[data-native-list-icon-help="true"]')) {
|
|
3203
|
+
event.preventDefault();
|
|
3204
|
+
event.stopPropagation();
|
|
3205
|
+
return;
|
|
3206
|
+
}
|
|
2399
3207
|
const rowElement = target.closest('[data-native-list-row-key]');
|
|
2400
3208
|
const row = this.rowAtElement(rowElement);
|
|
2401
3209
|
if (!row || row.disabled) return;
|
|
@@ -2407,6 +3215,8 @@ export class NativeListWebEngine {
|
|
|
2407
3215
|
// member press is blocked by `isRowPressEnabled` in `handleRowPress`.
|
|
2408
3216
|
const action = target.closest('[data-native-list-action]');
|
|
2409
3217
|
if (action) {
|
|
3218
|
+
if (action.tagName === 'BUTTON' && action.hasAttribute('disabled')) return;
|
|
3219
|
+
if (action.classList.contains('ok-native-list-trailing-button')) event.stopPropagation();
|
|
2410
3220
|
const scope = action.dataset.selectionScope;
|
|
2411
3221
|
if (scope === 'row') this.activateSelection({
|
|
2412
3222
|
scope: 'row'
|
|
@@ -2421,6 +3231,11 @@ export class NativeListWebEngine {
|
|
|
2421
3231
|
this.handleRowPress(sourceRow, rowElement ?? undefined, memberElement ?? rowElement ?? undefined);
|
|
2422
3232
|
};
|
|
2423
3233
|
handleKeyDown = event => {
|
|
3234
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && event.target.matches('[role="button"][data-native-list-hover-action]')) {
|
|
3235
|
+
event.preventDefault();
|
|
3236
|
+
if (this.actionAnchor?.actionElement !== event.target || !this.actionAnchor.open) this.emitHoverAction(event.target);
|
|
3237
|
+
return;
|
|
3238
|
+
}
|
|
2424
3239
|
// OneKey patch: non-button title help supports keyboard activation.
|
|
2425
3240
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && event.target.matches('[role="button"][data-native-list-action]')) {
|
|
2426
3241
|
event.preventDefault();
|
|
@@ -2516,7 +3331,13 @@ export class NativeListWebEngine {
|
|
|
2516
3331
|
preventScroll: true
|
|
2517
3332
|
});
|
|
2518
3333
|
}
|
|
3334
|
+
handleExternalScroll = event => {
|
|
3335
|
+
const target = event.target;
|
|
3336
|
+
if (target === this.externalScrollHost || target instanceof Element && target !== this.root && this.externalScrollHost?.contains(target) && target.contains(this.root)) this.handleScroll();
|
|
3337
|
+
};
|
|
2519
3338
|
handleScroll = () => {
|
|
3339
|
+
this.externalGeometryCache = undefined;
|
|
3340
|
+
this.pressedHelpElement = undefined;
|
|
2520
3341
|
this.cancelMarketPointer();
|
|
2521
3342
|
this.invalidateActionAnchor('scroll');
|
|
2522
3343
|
this.scheduleFrame();
|
|
@@ -2530,6 +3351,8 @@ export class NativeListWebEngine {
|
|
|
2530
3351
|
if (this.frameHandle !== undefined || this.destroyed) return;
|
|
2531
3352
|
this.frameHandle = this.requestFrame(() => {
|
|
2532
3353
|
this.frameHandle = undefined;
|
|
3354
|
+
this.externalGeometryCache = undefined;
|
|
3355
|
+
if (this.externalScrollHost) this.externalOrigin = this.externalGeometry().origin;
|
|
2533
3356
|
if (this.virtualizationEnabled) this.renderWindow();else {
|
|
2534
3357
|
this.updateAvatarWindow();
|
|
2535
3358
|
this.updateVisibleState();
|
|
@@ -2592,7 +3415,7 @@ export class NativeListWebEngine {
|
|
|
2592
3415
|
this.selectIndexPosition(entry.position);
|
|
2593
3416
|
};
|
|
2594
3417
|
handlePullStart = event => {
|
|
2595
|
-
if (this.pointerReorder?.pointerId === event.pointerId || !this.snapshot.capabilities?.pullToRefresh || this.
|
|
3418
|
+
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
3419
|
this.pullStartY = event.clientY;
|
|
2597
3420
|
this.pullDistance = 0;
|
|
2598
3421
|
};
|
|
@@ -2668,6 +3491,7 @@ export class NativeListWebEngine {
|
|
|
2668
3491
|
if (this.pointerReorder !== state) return;
|
|
2669
3492
|
this.clearReorderLongPress(state);
|
|
2670
3493
|
state.active = true;
|
|
3494
|
+
this.cancelMarketPointer();
|
|
2671
3495
|
state.activatedAt = Date.now();
|
|
2672
3496
|
state.viewportRect = this.reorderViewportRect();
|
|
2673
3497
|
this.captureReorderPointer(state);
|
|
@@ -2744,6 +3568,10 @@ export class NativeListWebEngine {
|
|
|
2744
3568
|
this.cancelPointerReorder(true);
|
|
2745
3569
|
};
|
|
2746
3570
|
setCurrentOffset(offset) {
|
|
3571
|
+
if (this.externalScrollHost) {
|
|
3572
|
+
this.scrollToAbsoluteOffset(offset, false);
|
|
3573
|
+
return;
|
|
3574
|
+
}
|
|
2747
3575
|
const maximum = Math.max(0, this.contentLength() - this.viewportLength());
|
|
2748
3576
|
const next = Math.max(0, Math.min(maximum, offset));
|
|
2749
3577
|
if (this.layout.horizontal) this.viewport.scrollLeft = next;else {
|
|
@@ -2801,7 +3629,7 @@ export class NativeListWebEngine {
|
|
|
2801
3629
|
const viewportRect = this.viewport.getBoundingClientRect();
|
|
2802
3630
|
const insets = this.collapsiblePagerInsets();
|
|
2803
3631
|
const left = viewportRect.left + destinationLayout.x - this.viewport.scrollLeft;
|
|
2804
|
-
const top = viewportRect.top + destinationLayout.y + insets.header + insets.sticky - this.viewport.scrollTop;
|
|
3632
|
+
const top = this.externalScrollHost ? viewportRect.top + destinationLayout.y : viewportRect.top + destinationLayout.y + insets.header + insets.sticky - this.viewport.scrollTop;
|
|
2805
3633
|
this.reorderPreview.getBoundingClientRect();
|
|
2806
3634
|
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
3635
|
this.reorderPreview.style.boxShadow = 'none';
|
|
@@ -2851,6 +3679,18 @@ export class NativeListWebEngine {
|
|
|
2851
3679
|
this.reorderPreview.style.transform = 'translate3d(' + String(x) + 'px,' + String(y) + 'px,0)';
|
|
2852
3680
|
}
|
|
2853
3681
|
reorderViewportRect() {
|
|
3682
|
+
if (this.externalScrollHost) {
|
|
3683
|
+
const geometry = this.externalGeometry();
|
|
3684
|
+
const body = this.viewport.getBoundingClientRect();
|
|
3685
|
+
return {
|
|
3686
|
+
left: body.left,
|
|
3687
|
+
right: body.right,
|
|
3688
|
+
width: body.width,
|
|
3689
|
+
top: geometry.top,
|
|
3690
|
+
bottom: geometry.bottom,
|
|
3691
|
+
height: geometry.viewportLength
|
|
3692
|
+
};
|
|
3693
|
+
}
|
|
2854
3694
|
const {
|
|
2855
3695
|
left,
|
|
2856
3696
|
top,
|