@onekeyfe/react-native-native-list 6.7.0-alpha.344 → 6.7.0-alpha.354
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 +7 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +240 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +7 -4
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -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 +135 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +43 -14
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +17 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +22 -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 +585 -21
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +1 -0
- package/docs/ROW_TEMPLATES.md +60 -9
- package/docs/SPEC.md +361 -8
- package/docs/STYLE_SPEC.md +6 -0
- package/ios/HybridNativeList.swift +10 -0
- package/ios/NativeListAccessoryStack.swift +220 -37
- package/ios/NativeListActivityDetailsView.swift +18 -8
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +105 -8
- package/ios/NativeListDesignAssets.swift +3 -0
- package/ios/NativeListIdentityRenderer.swift +119 -4
- package/ios/NativeListLeadingVisual.swift +49 -14
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListModels.swift +16 -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 +331 -29
- 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_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_refresh_ccw_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +56 -0
- package/ios/tests/NativeListLifecycleTests.swift +890 -3
- package/lib/module/NativeList.js +64 -27
- package/lib/module/NativeList.web.js +84 -17
- package/lib/module/models.js +1 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +532 -18
- package/lib/module/web/NativeListWebEngine.js +391 -24
- package/lib/module/web/templates/ActivityRowRenderer.js +8 -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/MessageRowRenderer.js +18 -2
- package/lib/module/web/templates/RowContainerStyle.js +1 -0
- package/lib/module/web/templates/RowRendererRegistry.js +3 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +6 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +11 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +1 -0
- package/lib/typescript/src/NativeList.d.ts +2 -2
- package/lib/typescript/src/NativeList.nitro.d.ts +1 -0
- package/lib/typescript/src/NativeList.types.d.ts +8 -0
- package/lib/typescript/src/models.d.ts +101 -9
- package/lib/typescript/src/validation.d.ts +13 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +26 -0
- 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/MessageRowRenderer.d.ts +9 -3
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +5 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +6 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +7 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +6 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +11 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +2 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +3 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +1 -0
- package/package.json +3 -3
- package/react-native-native-list.podspec +1 -0
- package/src/NativeList.nitro.ts +1 -0
- package/src/NativeList.tsx +155 -69
- package/src/NativeList.types.ts +9 -0
- package/src/NativeList.web.tsx +159 -49
- package/src/models.ts +113 -3
- package/src/selection.ts +1 -0
- package/src/validation.ts +1156 -18
- package/src/web/NativeListWebEngine.ts +594 -28
- package/src/web/templates/ActivityRowRenderer.ts +14 -6
- 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/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +11 -1
- package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
|
@@ -11,7 +11,7 @@ import { measureRailWidth } from "./templates/RailRowRenderer.js";
|
|
|
11
11
|
import { rowRenderer, rowRendererKey, recycleRowBody } from "./templates/RowRendererRegistry.js";
|
|
12
12
|
import { checkboxStateForKeys, checkboxStateForSection, isRowPressEnabled, isSelectableRow, reduceSelection, selectionStateFromSnapshot } from "../selection.js";
|
|
13
13
|
import { calculateAlignedScrollOffset, resolveLocationIndex, scrollFailure, validateOffset } from "../scrolling.js";
|
|
14
|
-
import { applyRowPatches, validateSnapshot } from "../validation.js";
|
|
14
|
+
import { applyRowPatches, containNativeListInput, emptyNativeListSnapshot, validatePatches, validateSnapshot } from "../validation.js";
|
|
15
15
|
import { avatarPrefetchWindow } from "../avatarPrefetch.js";
|
|
16
16
|
import { acquireNativeListAvatar, canonicalNativeListAvatarUri } from "./NativeListWebAvatarCache.js";
|
|
17
17
|
const SECTION_INDEX_CONTENT_INSET = 16;
|
|
@@ -421,7 +421,7 @@ export const WEB_LIST_CSS = `
|
|
|
421
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
422
|
|
|
423
423
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
424
|
-
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-synthesis:none;font-family:var(--nl-font-regular)}
|
|
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)}
|
|
425
425
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
426
426
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
427
427
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
@@ -432,7 +432,7 @@ export const WEB_LIST_CSS = `
|
|
|
432
432
|
.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
433
433
|
.ok-native-list-item[data-native-list-disabled="true"]>.ok-native-list-row{cursor:default}
|
|
434
434
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]>.ok-native-list-row{cursor:pointer}
|
|
435
|
-
.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)}
|
|
436
436
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-row{background:var(--nl-pressed)}
|
|
437
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)}
|
|
438
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)}
|
|
@@ -463,16 +463,23 @@ export const WEB_LIST_CSS = `
|
|
|
463
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)}
|
|
464
464
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
465
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}
|
|
466
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)}
|
|
467
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)}
|
|
468
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}
|
|
469
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}
|
|
470
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}
|
|
471
|
-
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;overflow:hidden;font-family:var(--nl-font-semibold)}.ok-native-list-visual>.ok-native-list-visual-corner{position:absolute;right:-4px;bottom:-4px;width:18px;height:18px;padding:2px;border-radius:50%;background:var(--nl-row);object-fit:cover}.ok-native-list-stacked{display:flex;align-items:center;width:48px;flex-basis:48px}.ok-native-list-stacked img{width:28px;height:28px;border:2px solid var(--nl-row);border-radius:50%;object-fit:cover;margin-left:-10px}.ok-native-list-stacked img:first-child{margin-left:0}
|
|
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}
|
|
472
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)}}
|
|
473
|
-
.ok-native-list-
|
|
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)}
|
|
474
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}
|
|
475
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}
|
|
476
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)}
|
|
477
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}
|
|
478
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)}
|
|
@@ -521,6 +528,7 @@ export const WEB_LIST_CSS = `
|
|
|
521
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)}
|
|
522
529
|
.ok-native-list-root [data-nl-container-border="true"]{position:relative}
|
|
523
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}
|
|
524
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)}
|
|
525
533
|
`;
|
|
526
534
|
function createElement(document, tag, className, text) {
|
|
@@ -718,6 +726,38 @@ function paintSelectorImageBackground(image, frame, inset = 0) {
|
|
|
718
726
|
|
|
719
727
|
// OneKey patch: use source SVG paths for selector actions and wallet provider marks.
|
|
720
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
|
+
TicketOutline: {
|
|
739
|
+
viewBox: '0 0 24 24',
|
|
740
|
+
paths: [{
|
|
741
|
+
d: 'M16 17.01h-2V15h2v2.01Zm0-4h-2V11h2v2.01Zm0-4h-2V7h2v2.01Z',
|
|
742
|
+
fill: 'currentColor',
|
|
743
|
+
fillRule: 'nonzero',
|
|
744
|
+
opacity: 1
|
|
745
|
+
}, {
|
|
746
|
+
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',
|
|
747
|
+
fill: 'currentColor',
|
|
748
|
+
fillRule: 'evenodd',
|
|
749
|
+
opacity: 1
|
|
750
|
+
}]
|
|
751
|
+
},
|
|
752
|
+
GasSolid: {
|
|
753
|
+
viewBox: '0 0 24 24',
|
|
754
|
+
paths: [{
|
|
755
|
+
d: 'M15 9h4v7h1V8.414L17.586 6 19 4.586l3 3V18h-5v-7h-2v8h1v2H2v-2h1V3h12zM6 9v2h6V9z',
|
|
756
|
+
fill: 'currentColor',
|
|
757
|
+
fillRule: 'evenodd',
|
|
758
|
+
opacity: 1
|
|
759
|
+
}]
|
|
760
|
+
},
|
|
721
761
|
CryptoCoinOutline: {
|
|
722
762
|
viewBox: '0 0 24 24',
|
|
723
763
|
paths: [{
|
|
@@ -962,6 +1002,7 @@ function applySelectorIcon(element, name) {
|
|
|
962
1002
|
}
|
|
963
1003
|
function iconGlyph(name) {
|
|
964
1004
|
const normalized = name.toLocaleLowerCase();
|
|
1005
|
+
if (normalized === 'dotversolid') return '⋮';
|
|
965
1006
|
if (normalized.includes('chevron')) {
|
|
966
1007
|
if (normalized.includes('top')) return '⌃';
|
|
967
1008
|
if (normalized.includes('bottom')) return '⌄';
|
|
@@ -1009,6 +1050,8 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1009
1050
|
const showsSourcePlaceholder = !!source && source.loadingStrategy !== undefined && source.loadingStrategy !== 'none';
|
|
1010
1051
|
frame.style.background = showsSourcePlaceholder ? 'var(--nl-strong)' : visualBackground;
|
|
1011
1052
|
const fallbackIcon = 'fallbackIcon' in visual ? visual.fallbackIcon : undefined;
|
|
1053
|
+
const fallbackBackground = fallbackIcon?.backgroundColor ?? 'var(--nl-strong)';
|
|
1054
|
+
if (!source && fallbackIcon?.backgroundColor) frame.style.background = fallbackBackground;
|
|
1012
1055
|
const handlesSourceFallback = showsSourcePlaceholder && (fallbackIcon !== undefined || 'fallbackText' in visual);
|
|
1013
1056
|
const image = source ? createImage(context, source) : undefined;
|
|
1014
1057
|
if (image) {
|
|
@@ -1022,6 +1065,24 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1022
1065
|
if (image.complete && image.naturalWidth > 0) restoreBackground();
|
|
1023
1066
|
}
|
|
1024
1067
|
if (selectorPresentation) paintSelectorImageBackground(image, frame);
|
|
1068
|
+
if (source?.loadingStrategy === 'skeleton' && !(image.complete && image.naturalWidth > 0)) {
|
|
1069
|
+
const skeleton = createElement(context.document, 'span', 'ok-native-list-image-skeleton');
|
|
1070
|
+
const background = resolvedTheme(context.snapshot).background;
|
|
1071
|
+
const rgb = /^#([0-9a-f]{6})/i.exec(background)?.[1];
|
|
1072
|
+
if (rgb) {
|
|
1073
|
+
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
1074
|
+
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
1075
|
+
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
1076
|
+
if (red * 299 + green * 587 + blue * 114 < 128_000) skeleton.dataset.dark = 'true';
|
|
1077
|
+
}
|
|
1078
|
+
frame.appendChild(skeleton);
|
|
1079
|
+
image.addEventListener('load', () => skeleton.remove(), {
|
|
1080
|
+
once: true
|
|
1081
|
+
});
|
|
1082
|
+
image.addEventListener('error', () => skeleton.remove(), {
|
|
1083
|
+
once: true
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1025
1086
|
} else if (!source || showsSourcePlaceholder) {
|
|
1026
1087
|
frame.appendChild(createElement(context.document, 'span', 'ok-native-list-visual-fallback', 'fallbackText' in visual ? visual.fallbackText ?? '' : ''));
|
|
1027
1088
|
}
|
|
@@ -1045,11 +1106,19 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1045
1106
|
}
|
|
1046
1107
|
frame.querySelector('.ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)')?.remove();
|
|
1047
1108
|
const fallback = createElement(context.document, 'span', 'ok-native-list-visual-fallback', fallbackIcon ? undefined : 'fallbackText' in visual ? visual.fallbackText ?? '' : '');
|
|
1109
|
+
if ('fallbackTextColor' in visual && visual.fallbackTextColor && !fallbackIcon) fallback.style.color = visual.fallbackTextColor;
|
|
1048
1110
|
if (fallbackIcon) {
|
|
1049
1111
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1050
1112
|
if (fallbackIcon.tintColor) fallback.style.color = fallbackIcon.tintColor;
|
|
1113
|
+
if (fallbackIcon.size) {
|
|
1114
|
+
const svg = fallback.querySelector('svg');
|
|
1115
|
+
if (svg) {
|
|
1116
|
+
svg.style.width = `${fallbackIcon.size}px`;
|
|
1117
|
+
svg.style.height = `${fallbackIcon.size}px`;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1051
1120
|
}
|
|
1052
|
-
fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
1121
|
+
if (fallbackIcon?.backgroundColor) frame.style.background = fallbackBackground;else fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
1053
1122
|
frame.prepend(fallback);
|
|
1054
1123
|
};
|
|
1055
1124
|
if (image) image.addEventListener('error', showFallback, {
|
|
@@ -1059,6 +1128,9 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1059
1128
|
if ('borderStyle' in visual && visual.borderStyle === 'dashed') {
|
|
1060
1129
|
frame.style.border = '2px dashed ' + (visual.borderColor ?? 'var(--nl-disabled)');
|
|
1061
1130
|
frame.style.boxSizing = 'border-box';
|
|
1131
|
+
} else if ('borderColor' in visual && visual.borderColor) {
|
|
1132
|
+
frame.style.border = '1px solid ' + visual.borderColor;
|
|
1133
|
+
frame.style.boxSizing = 'border-box';
|
|
1062
1134
|
}
|
|
1063
1135
|
if ('overlays' in visual) visual.overlays?.forEach(overlay => {
|
|
1064
1136
|
const corner = createElement(context.document, 'span', 'ok-native-list-visual-overlay', overlay.text);
|
|
@@ -1072,6 +1144,12 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1072
1144
|
corner.style.lineHeight = '16px';
|
|
1073
1145
|
applyTextWeight(corner, '400');
|
|
1074
1146
|
}
|
|
1147
|
+
if (overlay.fontWeight) applyTextWeight(corner, {
|
|
1148
|
+
regular: 400,
|
|
1149
|
+
medium: 500,
|
|
1150
|
+
semibold: 600,
|
|
1151
|
+
bold: 700
|
|
1152
|
+
}[overlay.fontWeight]);
|
|
1075
1153
|
if (isWalletText || overlay.width !== undefined || overlay.height !== undefined) corner.style.borderRadius = '9999px';
|
|
1076
1154
|
const offsetX = String(-(overlay.offsetX ?? overlay.offset ?? 2)) + 'px';
|
|
1077
1155
|
const offsetY = String(-(overlay.offsetY ?? overlay.offset ?? 2)) + 'px';
|
|
@@ -1087,7 +1165,20 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1087
1165
|
if (overlay.image) {
|
|
1088
1166
|
const overlayImage = createImage(context, overlay.image);
|
|
1089
1167
|
if (overlayImage) {
|
|
1168
|
+
if ((overlay.padding ?? 0) > 0 && (overlay.width ?? size) === (overlay.height ?? size)) overlayImage.style.borderRadius = '50%';
|
|
1090
1169
|
corner.appendChild(overlayImage);
|
|
1170
|
+
if (overlay.fallbackIcon) {
|
|
1171
|
+
overlayImage.addEventListener('error', () => {
|
|
1172
|
+
disposeWebImageRetries(overlayImage);
|
|
1173
|
+
overlayImage.remove();
|
|
1174
|
+
const glyph = createElement(context.document, 'span', 'ok-native-list-overlay-fallback');
|
|
1175
|
+
applySelectorIcon(glyph, overlay.fallbackIcon.name);
|
|
1176
|
+
if (overlay.fallbackIcon?.tintColor) glyph.style.color = overlay.fallbackIcon.tintColor;
|
|
1177
|
+
corner.appendChild(glyph);
|
|
1178
|
+
}, {
|
|
1179
|
+
once: true
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1091
1182
|
if (selectorPresentation) paintSelectorImageBackground(overlayImage, corner, overlay.padding ?? 0);
|
|
1092
1183
|
}
|
|
1093
1184
|
} else if (overlay.name) applySelectorIcon(corner, overlay.name);
|
|
@@ -1167,7 +1258,23 @@ function markActionAnchorSource(element, source, slot) {
|
|
|
1167
1258
|
|
|
1168
1259
|
// OneKey patch: the compact zero-count digits share the amount baseline.
|
|
1169
1260
|
|
|
1170
|
-
function createAccessory(context, rowKey, accessory, slot) {
|
|
1261
|
+
function createAccessory(context, rowKey, accessory, slot, rowDisabled) {
|
|
1262
|
+
if (accessory.kind === 'button') {
|
|
1263
|
+
const element = createElement(context.document, 'button', 'ok-native-list-trailing-button', accessory.label);
|
|
1264
|
+
element.type = 'button';
|
|
1265
|
+
element.disabled = Boolean(rowDisabled || accessory.disabled);
|
|
1266
|
+
element.setAttribute('aria-disabled', String(element.disabled));
|
|
1267
|
+
element.setAttribute('aria-label', accessory.accessibilityLabel ?? accessory.label);
|
|
1268
|
+
setData(element, 'testid', accessory.testID);
|
|
1269
|
+
setData(element, 'nativeListAction', accessory.actionKey);
|
|
1270
|
+
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1271
|
+
if (accessory.textColor) element.style.setProperty('--nl-button-text', accessory.textColor);
|
|
1272
|
+
if (accessory.backgroundColor) element.style.setProperty('--nl-button-bg', accessory.backgroundColor);
|
|
1273
|
+
if (accessory.pressedBackgroundColor) element.style.setProperty('--nl-button-pressed', accessory.pressedBackgroundColor);
|
|
1274
|
+
if (accessory.hoverBackgroundColor) element.style.setProperty('--nl-button-hover', accessory.hoverBackgroundColor);
|
|
1275
|
+
if (accessory.focusRingColor) element.style.setProperty('--nl-button-focus', accessory.focusRingColor);
|
|
1276
|
+
return element;
|
|
1277
|
+
}
|
|
1171
1278
|
if (accessory.kind === 'checkbox') {
|
|
1172
1279
|
const element = createCheckbox(context, rowKey, accessory);
|
|
1173
1280
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
@@ -1176,8 +1283,19 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1176
1283
|
if (accessory.kind === 'icon') {
|
|
1177
1284
|
const element = createIconAction(context, accessory.name, accessory.actionKey, accessory.disabled, accessory.tintColor);
|
|
1178
1285
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1286
|
+
if (accessory.name === 'RefreshCcwOutline' && !accessory.actionKey) {
|
|
1287
|
+
element.classList.add('ok-native-list-decorative-refresh');
|
|
1288
|
+
const glyph = element.querySelector('svg');
|
|
1289
|
+
glyph?.setAttribute('width', '16');
|
|
1290
|
+
glyph?.setAttribute('height', '16');
|
|
1291
|
+
}
|
|
1292
|
+
if (accessory.buttonStyle === 'tertiary') {
|
|
1293
|
+
element.classList.add('ok-native-list-tertiary-icon');
|
|
1294
|
+
setData(element, 'nativeListAnchorInset', 7);
|
|
1295
|
+
}
|
|
1179
1296
|
setData(element, 'testid', accessory.testID);
|
|
1180
1297
|
if (accessory.hoverActionKey) setData(element, 'nativeListHoverAction', accessory.hoverActionKey);
|
|
1298
|
+
if (accessory.hoverActionKey && accessory.buttonStyle === 'tertiary') setData(element, 'nativeListIconHelp', true);
|
|
1181
1299
|
if (accessory.accessibilityLabel) element.setAttribute('aria-label', accessory.accessibilityLabel);
|
|
1182
1300
|
const row = context.snapshot.rows[context.itemIndex];
|
|
1183
1301
|
if (row && 'presentation' in row && row.presentation === 'accountSelector') {
|
|
@@ -1210,8 +1328,26 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1210
1328
|
{
|
|
1211
1329
|
const primary = createElement(context.document, 'span', undefined, accessory.primary);
|
|
1212
1330
|
primary.style.color = toneColor(accessory.primaryTone, 'primary');
|
|
1331
|
+
applyValueSegments(primary, accessory.primaryTextSegments, 16, 20, 500);
|
|
1332
|
+
if (accessory.primaryFontWeight === 'medium') applyTextWeight(primary, 500);
|
|
1333
|
+
if (accessory.primaryHelp) {
|
|
1334
|
+
const help = accessory.primaryHelp;
|
|
1335
|
+
if (help.presentation === 'tooltip') {
|
|
1336
|
+
setData(primary, 'nativeListHoverAction', help.actionKey);
|
|
1337
|
+
setData(primary, 'nativeListIconHelp', true);
|
|
1338
|
+
} else {
|
|
1339
|
+
setData(primary, 'nativeListAction', help.actionKey);
|
|
1340
|
+
primary.setAttribute('role', 'button');
|
|
1341
|
+
}
|
|
1342
|
+
if (help.underline === 'dashed') {
|
|
1343
|
+
primary.style.textDecoration = 'underline dashed';
|
|
1344
|
+
primary.style.textUnderlineOffset = '4px';
|
|
1345
|
+
}
|
|
1346
|
+
markActionAnchorSource(primary, 'trailingAccessory', slot);
|
|
1347
|
+
}
|
|
1213
1348
|
const secondary = createElement(context.document, 'span', 'ok-native-list-secondary', accessory.secondary);
|
|
1214
1349
|
secondary.style.color = toneColor(accessory.secondaryTone, 'secondary');
|
|
1350
|
+
applyValueSegments(secondary, accessory.secondaryTextSegments, 14, 20, 400);
|
|
1215
1351
|
element.replaceChildren(primary, '\n', secondary);
|
|
1216
1352
|
element.classList.add('ok-native-list-amounts');
|
|
1217
1353
|
break;
|
|
@@ -1239,10 +1375,10 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1239
1375
|
if (actionKey) markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1240
1376
|
return element;
|
|
1241
1377
|
}
|
|
1242
|
-
function rendererPrimitives(context) {
|
|
1378
|
+
function rendererPrimitives(context, rowDisabled) {
|
|
1243
1379
|
return {
|
|
1244
1380
|
background: resolvedTheme(context.snapshot).background,
|
|
1245
|
-
accessory: (key, descriptor, slot) => createAccessory(context, key, descriptor, slot),
|
|
1381
|
+
accessory: (key, descriptor, slot) => createAccessory(context, key, descriptor, slot, rowDisabled),
|
|
1246
1382
|
visual: (source, presentation) => createVisual(context, source, presentation),
|
|
1247
1383
|
thumbnail: source => createImage(context, source, 'ok-native-list-thumbnail'),
|
|
1248
1384
|
textStyle: applyTextStyleToSlot,
|
|
@@ -1252,7 +1388,7 @@ function rendererPrimitives(context) {
|
|
|
1252
1388
|
};
|
|
1253
1389
|
}
|
|
1254
1390
|
export function createRowBody(context, row) {
|
|
1255
|
-
return rowRenderer(row).create(context.document, rendererPrimitives(context));
|
|
1391
|
+
return rowRenderer(row).create(context.document, rendererPrimitives(context, Boolean(row.disabled)));
|
|
1256
1392
|
}
|
|
1257
1393
|
export class NativeListWebEngine {
|
|
1258
1394
|
rows = [];
|
|
@@ -1270,6 +1406,7 @@ export class NativeListWebEngine {
|
|
|
1270
1406
|
rail: [],
|
|
1271
1407
|
mediaTile: [],
|
|
1272
1408
|
action: [],
|
|
1409
|
+
buttonGroup: [],
|
|
1273
1410
|
system: [],
|
|
1274
1411
|
activity: [],
|
|
1275
1412
|
dataRow: [],
|
|
@@ -1296,6 +1433,14 @@ export class NativeListWebEngine {
|
|
|
1296
1433
|
lastViewportWidth = -1;
|
|
1297
1434
|
lastViewportHeight = -1;
|
|
1298
1435
|
destroyed = false;
|
|
1436
|
+
hasAppliedSnapshot = false;
|
|
1437
|
+
structuralAnimations = [];
|
|
1438
|
+
structuralScrollInterrupted = false;
|
|
1439
|
+
reactFooterHeight = 0;
|
|
1440
|
+
structuralFooterCompensation = 0;
|
|
1441
|
+
structuralFooterExpansion = 0;
|
|
1442
|
+
structuralFooterFromHeight = 0;
|
|
1443
|
+
structuralProgress = 0;
|
|
1299
1444
|
sectionIndexAlignStart = false;
|
|
1300
1445
|
// Renderers report intrinsic height after browser text wrapping.
|
|
1301
1446
|
measuredRendererHeights = new Map();
|
|
@@ -1327,7 +1472,7 @@ export class NativeListWebEngine {
|
|
|
1327
1472
|
this.contentBounds = scrollOptions.contentBounds;
|
|
1328
1473
|
this.externalStickyInset = this.validateStickyInset(scrollOptions.stickyInset);
|
|
1329
1474
|
this.document = host.ownerDocument;
|
|
1330
|
-
this.snapshot = validateSnapshot(snapshot);
|
|
1475
|
+
this.snapshot = containNativeListInput(() => validateSnapshot(snapshot)) ?? emptyNativeListSnapshot();
|
|
1331
1476
|
this.callbacks = callbacks;
|
|
1332
1477
|
this.virtualizationEnabled = virtualizationEnabled;
|
|
1333
1478
|
this.sectionIndexContainer = sectionIndexContainer ?? undefined;
|
|
@@ -1384,6 +1529,9 @@ export class NativeListWebEngine {
|
|
|
1384
1529
|
});
|
|
1385
1530
|
}
|
|
1386
1531
|
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1532
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart']) (this.externalScrollHost ?? this.viewport).addEventListener(event, this.handleStructuralUserScroll, {
|
|
1533
|
+
passive: true
|
|
1534
|
+
});
|
|
1387
1535
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
1388
1536
|
passive: true
|
|
1389
1537
|
});
|
|
@@ -1399,6 +1547,7 @@ export class NativeListWebEngine {
|
|
|
1399
1547
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1400
1548
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
1401
1549
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
1550
|
+
this.root.addEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
1402
1551
|
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
1403
1552
|
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
1404
1553
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -1516,10 +1665,168 @@ export class NativeListWebEngine {
|
|
|
1516
1665
|
this.renderWindow();
|
|
1517
1666
|
}
|
|
1518
1667
|
applySnapshot(snapshot) {
|
|
1519
|
-
const validated =
|
|
1520
|
-
|
|
1668
|
+
const validated = containNativeListInput(() => {
|
|
1669
|
+
const next = validateSnapshot(snapshot);
|
|
1670
|
+
if (this.externalScrollHost && next.layout.orientation === 'horizontal') throw new Error('External scrolling supports vertical lists only');
|
|
1671
|
+
return next;
|
|
1672
|
+
});
|
|
1673
|
+
if (!validated) return;
|
|
1674
|
+
this.pressedHelpElement = undefined;
|
|
1521
1675
|
this.invalidateActionAnchor('snapshot');
|
|
1522
|
-
|
|
1676
|
+
const transition = validated.structuralTransition;
|
|
1677
|
+
const isNewTransition = transition !== undefined && transition.id !== this.lastStructuralTransitionId;
|
|
1678
|
+
if (transition) this.lastStructuralTransitionId = transition.id;
|
|
1679
|
+
const nextRows = effectiveRows(validated);
|
|
1680
|
+
const changedKeys = this.rows.length !== nextRows.length || this.rows.some((row, index) => row.key !== nextRows[index]?.key);
|
|
1681
|
+
const shouldAnimate = this.hasAppliedSnapshot && isNewTransition && changedKeys && (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;
|
|
1682
|
+
if (shouldAnimate && transition) this.applyStructuralSnapshot(validated, transition);else {
|
|
1683
|
+
if (isNewTransition || changedKeys) this.cancelStructuralAnimation();
|
|
1684
|
+
this.setSnapshot(validated);
|
|
1685
|
+
}
|
|
1686
|
+
this.hasAppliedSnapshot = true;
|
|
1687
|
+
}
|
|
1688
|
+
cancelStructuralAnimation() {
|
|
1689
|
+
if (this.structuralFrame !== undefined) this.document.defaultView?.cancelAnimationFrame(this.structuralFrame);
|
|
1690
|
+
if (this.structuralFinish !== undefined) this.document.defaultView?.clearTimeout(this.structuralFinish);
|
|
1691
|
+
this.structuralFrame = undefined;
|
|
1692
|
+
this.structuralFinish = undefined;
|
|
1693
|
+
this.structuralAnimations.forEach(animation => animation.cancel());
|
|
1694
|
+
this.structuralAnimations = [];
|
|
1695
|
+
if (this.structuralFooterElement && this.structuralFooterStyles) {
|
|
1696
|
+
this.structuralFooterElement.style.marginBottom = this.structuralFooterStyles.marginBottom;
|
|
1697
|
+
this.structuralFooterElement.style.transform = this.structuralFooterStyles.transform;
|
|
1698
|
+
this.structuralFooterElement.style.clipPath = this.structuralFooterStyles.clipPath;
|
|
1699
|
+
}
|
|
1700
|
+
this.structuralFooterElement = undefined;
|
|
1701
|
+
this.structuralFooterStyles = undefined;
|
|
1702
|
+
this.structuralScrollInterrupted = false;
|
|
1703
|
+
this.structuralRenderedHeight = undefined;
|
|
1704
|
+
this.structuralTargetHeight = undefined;
|
|
1705
|
+
this.structuralFooterCompensation = 0;
|
|
1706
|
+
this.structuralFooterExpansion = 0;
|
|
1707
|
+
this.structuralProgress = 0;
|
|
1708
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1709
|
+
if (this.structuralAnchorStyles) {
|
|
1710
|
+
owner.style.overflowAnchor = this.structuralAnchorStyles.owner;
|
|
1711
|
+
this.content.style.overflowAnchor = this.structuralAnchorStyles.content;
|
|
1712
|
+
this.structuralAnchorStyles = undefined;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
handleStructuralUserScroll = event => {
|
|
1716
|
+
if (event.type === 'pointerdown' && event.target !== (this.externalScrollHost ?? this.viewport) && event.pointerType !== 'touch') return;
|
|
1717
|
+
this.structuralScrollInterrupted = true;
|
|
1718
|
+
};
|
|
1719
|
+
writeStructuralHeight(height) {
|
|
1720
|
+
if (this.externalScrollHost) this.writeExternalHeight(height);else this.content.style.height = `${height}px`;
|
|
1721
|
+
}
|
|
1722
|
+
reactFooterElement() {
|
|
1723
|
+
return this.contentBounds?.querySelector('[data-testid="native-list-footer-slot"]');
|
|
1724
|
+
}
|
|
1725
|
+
readReactFooterHeight() {
|
|
1726
|
+
return this.reactFooterElement()?.getBoundingClientRect().height ?? 0;
|
|
1727
|
+
}
|
|
1728
|
+
applyStructuralFooterVisual(progress) {
|
|
1729
|
+
const footer = this.structuralFooterElement;
|
|
1730
|
+
if (!footer || this.structuralFooterExpansion <= 0) return;
|
|
1731
|
+
const hidden = this.structuralFooterExpansion * (1 - progress);
|
|
1732
|
+
footer.style.marginBottom = `${-hidden}px`;
|
|
1733
|
+
footer.style.transform = `translateY(${-hidden}px)`;
|
|
1734
|
+
footer.style.clipPath = `inset(${hidden}px 0 0 0)`;
|
|
1735
|
+
}
|
|
1736
|
+
applyStructuralSnapshot(next, transition) {
|
|
1737
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1738
|
+
const oldOffset = owner.scrollTop;
|
|
1739
|
+
const oldScrollHeight = owner.scrollHeight;
|
|
1740
|
+
const oldHeight = this.structuralRenderedHeight ?? (this.content.getBoundingClientRect().height || this.layout.contentHeight);
|
|
1741
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
1742
|
+
const oldFooterHeight = this.structuralRenderedHeight === undefined ? this.reactFooterHeight : this.structuralFooterFromHeight + (this.reactFooterHeight - this.structuralFooterFromHeight) * this.structuralProgress;
|
|
1743
|
+
const footerDifference = oldFooterHeight - nextFooterHeight;
|
|
1744
|
+
const startHeight = oldHeight + Math.max(0, footerDifference);
|
|
1745
|
+
const oldItems = this.layout.items;
|
|
1746
|
+
const oldPositions = new Map();
|
|
1747
|
+
this.mounted.forEach((element, index) => {
|
|
1748
|
+
const row = this.rows[index];
|
|
1749
|
+
if (row) oldPositions.set(row.key, element.getBoundingClientRect().top);
|
|
1750
|
+
});
|
|
1751
|
+
const nextKeys = new Set(effectiveRows(next).map(row => row.key));
|
|
1752
|
+
const visibleOffset = this.currentOffset();
|
|
1753
|
+
const visibleSurvivor = oldItems.find(item => item.y + item.height > visibleOffset && nextKeys.has(item.key));
|
|
1754
|
+
const anchor = visibleSurvivor;
|
|
1755
|
+
this.cancelStructuralAnimation();
|
|
1756
|
+
this.structuralScrollInterrupted = false;
|
|
1757
|
+
this.structuralAnchorStyles = {
|
|
1758
|
+
owner: owner.style.overflowAnchor,
|
|
1759
|
+
content: this.content.style.overflowAnchor
|
|
1760
|
+
};
|
|
1761
|
+
owner.style.overflowAnchor = 'none';
|
|
1762
|
+
this.content.style.overflowAnchor = 'none';
|
|
1763
|
+
this.structuralRenderedHeight = startHeight;
|
|
1764
|
+
this.structuralFooterFromHeight = oldFooterHeight;
|
|
1765
|
+
this.structuralFooterCompensation = Math.max(0, footerDifference);
|
|
1766
|
+
this.structuralFooterExpansion = Math.max(0, -footerDifference);
|
|
1767
|
+
this.structuralProgress = 0;
|
|
1768
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
1769
|
+
this.structuralFooterElement = this.reactFooterElement() ?? undefined;
|
|
1770
|
+
if (this.structuralFooterElement) {
|
|
1771
|
+
const style = this.structuralFooterElement.style;
|
|
1772
|
+
this.structuralFooterStyles = {
|
|
1773
|
+
marginBottom: style.marginBottom,
|
|
1774
|
+
transform: style.transform,
|
|
1775
|
+
clipPath: style.clipPath
|
|
1776
|
+
};
|
|
1777
|
+
this.applyStructuralFooterVisual(0);
|
|
1778
|
+
}
|
|
1779
|
+
this.setSnapshot(next);
|
|
1780
|
+
const newHeight = this.layout.contentHeight;
|
|
1781
|
+
this.structuralTargetHeight = newHeight;
|
|
1782
|
+
const nextAnchor = anchor && this.layout.items.find(item => item.key === anchor.key);
|
|
1783
|
+
const delta = nextAnchor && anchor ? nextAnchor.y - anchor.y : 0;
|
|
1784
|
+
const finalScrollHeight = oldScrollHeight + newHeight - oldHeight;
|
|
1785
|
+
const finalMaxOffset = Math.max(0, finalScrollHeight - owner.clientHeight);
|
|
1786
|
+
let targetOffset = Math.max(0, Math.min(oldOffset + delta, finalMaxOffset));
|
|
1787
|
+
if (!visibleSurvivor && transition.anchorKey) {
|
|
1788
|
+
const fallback = this.layout.items.find(item => item.key === transition.anchorKey);
|
|
1789
|
+
if (fallback) {
|
|
1790
|
+
const pagerStickyInset = Number.parseFloat(this.externalScrollHost?.style.getPropertyValue('--ok-collapsible-pager-sticky-inset') ?? '');
|
|
1791
|
+
const effectiveStickyInset = Math.max(this.externalStickyInset, Number.isFinite(pagerStickyInset) ? pagerStickyInset : 0);
|
|
1792
|
+
const fallbackTop = this.externalScrollHost ? this.externalGeometry().origin + fallback.y - effectiveStickyInset : resolveWebCollapsiblePagerRawOffset(Math.max(0, fallback.y - this.collapsiblePagerInsets().sticky), this.collapsiblePagerInsets().header);
|
|
1793
|
+
targetOffset = Math.min(targetOffset, Math.max(0, fallbackTop));
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
const duration = transition.durationMs ?? 220;
|
|
1797
|
+
const easing = 'cubic-bezier(0.42, 0, 0.58, 1)';
|
|
1798
|
+
this.mounted.forEach((element, index) => {
|
|
1799
|
+
const row = this.rows[index];
|
|
1800
|
+
const previousTop = row && oldPositions.get(row.key);
|
|
1801
|
+
if (previousTop === undefined || typeof element.animate !== 'function') return;
|
|
1802
|
+
const offset = previousTop - element.getBoundingClientRect().top;
|
|
1803
|
+
if (Math.abs(offset) < 0.5) return;
|
|
1804
|
+
this.structuralAnimations.push(element.animate([{
|
|
1805
|
+
transform: `translateY(${offset}px)`
|
|
1806
|
+
}, {
|
|
1807
|
+
transform: 'translateY(0)'
|
|
1808
|
+
}], {
|
|
1809
|
+
duration,
|
|
1810
|
+
easing
|
|
1811
|
+
}));
|
|
1812
|
+
});
|
|
1813
|
+
const startedAt = this.document.defaultView?.performance.now() ?? Date.now();
|
|
1814
|
+
const step = time => {
|
|
1815
|
+
const progress = Math.min(1, (time - startedAt) / duration);
|
|
1816
|
+
const eased = progress * progress * (3 - 2 * progress);
|
|
1817
|
+
this.structuralProgress = eased;
|
|
1818
|
+
const renderedHeight = oldHeight + ((this.structuralTargetHeight ?? newHeight) - oldHeight) * eased + this.structuralFooterCompensation * (1 - eased);
|
|
1819
|
+
this.structuralRenderedHeight = renderedHeight;
|
|
1820
|
+
this.writeStructuralHeight(renderedHeight);
|
|
1821
|
+
this.applyStructuralFooterVisual(eased);
|
|
1822
|
+
if (!this.structuralScrollInterrupted) owner.scrollTop = oldOffset + (targetOffset - oldOffset) * eased;
|
|
1823
|
+
if (progress < 1) this.structuralFrame = this.document.defaultView?.requestAnimationFrame(step);
|
|
1824
|
+
};
|
|
1825
|
+
this.structuralFrame = this.document.defaultView?.requestAnimationFrame(step);
|
|
1826
|
+
this.structuralFinish = this.document.defaultView?.setTimeout(() => {
|
|
1827
|
+
this.cancelStructuralAnimation();
|
|
1828
|
+
this.recomputeLayout();
|
|
1829
|
+
}, duration + 40);
|
|
1523
1830
|
}
|
|
1524
1831
|
currentContentHeight() {
|
|
1525
1832
|
return this.layout.contentHeight;
|
|
@@ -1528,8 +1835,16 @@ export class NativeListWebEngine {
|
|
|
1528
1835
|
return this.snapshot;
|
|
1529
1836
|
}
|
|
1530
1837
|
applyPatches(patches) {
|
|
1531
|
-
|
|
1532
|
-
|
|
1838
|
+
const accepted = containNativeListInput(() => {
|
|
1839
|
+
const normalized = validatePatches(patches);
|
|
1840
|
+
return {
|
|
1841
|
+
patches: normalized,
|
|
1842
|
+
snapshot: applyRowPatches(this.snapshot, normalized)
|
|
1843
|
+
};
|
|
1844
|
+
});
|
|
1845
|
+
if (!accepted || accepted.patches.length === 0) return;
|
|
1846
|
+
patches = accepted.patches;
|
|
1847
|
+
const next = accepted.snapshot;
|
|
1533
1848
|
const selection = new Set(this.selectedKeys);
|
|
1534
1849
|
patches.forEach(patch => {
|
|
1535
1850
|
const selected = 'selected' in patch.changes ? patch.changes.selected : undefined;
|
|
@@ -1684,6 +1999,8 @@ export class NativeListWebEngine {
|
|
|
1684
1999
|
}
|
|
1685
2000
|
destroy() {
|
|
1686
2001
|
if (this.destroyed) return;
|
|
2002
|
+
this.cancelStructuralAnimation();
|
|
2003
|
+
this.pressedHelpElement = undefined;
|
|
1687
2004
|
this.invalidateActionAnchor('destroy');
|
|
1688
2005
|
this.destroyed = true;
|
|
1689
2006
|
if (this.frameHandle !== undefined) this.cancelFrame(this.frameHandle);
|
|
@@ -1696,6 +2013,7 @@ export class NativeListWebEngine {
|
|
|
1696
2013
|
this.document.defaultView?.removeEventListener('resize', this.handleWindowResize);
|
|
1697
2014
|
this.pendingScroll = undefined;
|
|
1698
2015
|
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
2016
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart']) (this.externalScrollHost ?? this.viewport).removeEventListener(event, this.handleStructuralUserScroll);
|
|
1699
2017
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
1700
2018
|
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1701
2019
|
this.root.removeEventListener('click', this.handleClick);
|
|
@@ -1707,6 +2025,7 @@ export class NativeListWebEngine {
|
|
|
1707
2025
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1708
2026
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1709
2027
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
2028
|
+
this.root.removeEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
1710
2029
|
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
1711
2030
|
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
1712
2031
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -1745,6 +2064,7 @@ export class NativeListWebEngine {
|
|
|
1745
2064
|
}
|
|
1746
2065
|
setSnapshot(snapshot, selectedKeys) {
|
|
1747
2066
|
this.cancelMarketPointer();
|
|
2067
|
+
this.pressedHelpElement = undefined;
|
|
1748
2068
|
this.measuredRendererHeights.clear();
|
|
1749
2069
|
this.snapshot = snapshot;
|
|
1750
2070
|
this.rows = effectiveRows(snapshot);
|
|
@@ -1762,6 +2082,7 @@ export class NativeListWebEngine {
|
|
|
1762
2082
|
'--nl-row': theme.rowBackground,
|
|
1763
2083
|
'--nl-selected': theme.rowSelectedBackground,
|
|
1764
2084
|
'--nl-pressed': theme.rowPressedBackground,
|
|
2085
|
+
'--nl-hover': theme.rowHoverBackground ?? theme.rowPressedBackground,
|
|
1765
2086
|
'--nl-subdued': theme.subduedBackground,
|
|
1766
2087
|
'--nl-strong': theme.strongBackground,
|
|
1767
2088
|
'--nl-image-fallback-background': theme.imageFallbackBackground ?? 'transparent',
|
|
@@ -1778,6 +2099,7 @@ export class NativeListWebEngine {
|
|
|
1778
2099
|
'--nl-separator': theme.separator,
|
|
1779
2100
|
'--nl-accent': theme.accent,
|
|
1780
2101
|
'--nl-positive': theme.positive,
|
|
2102
|
+
'--nl-success-background': theme.successBackground,
|
|
1781
2103
|
'--nl-negative': theme.negative,
|
|
1782
2104
|
'--nl-critical': theme.criticalBackground,
|
|
1783
2105
|
'--nl-inverse': theme.inverseBackground,
|
|
@@ -1838,10 +2160,23 @@ export class NativeListWebEngine {
|
|
|
1838
2160
|
}
|
|
1839
2161
|
recomputeLayout = () => {
|
|
1840
2162
|
if (this.destroyed) return;
|
|
2163
|
+
if (this.structuralRenderedHeight === undefined) this.reactFooterHeight = this.readReactFooterHeight();else {
|
|
2164
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
2165
|
+
const footerDelta = this.reactFooterHeight - nextFooterHeight;
|
|
2166
|
+
if (footerDelta !== 0) {
|
|
2167
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
2168
|
+
const priorCompensation = this.structuralFooterCompensation;
|
|
2169
|
+
const difference = this.structuralFooterFromHeight - nextFooterHeight;
|
|
2170
|
+
this.structuralFooterCompensation = Math.max(0, difference);
|
|
2171
|
+
this.structuralFooterExpansion = Math.max(0, -difference);
|
|
2172
|
+
this.structuralRenderedHeight += (this.structuralFooterCompensation - priorCompensation) * (1 - this.structuralProgress);
|
|
2173
|
+
this.applyStructuralFooterVisual(this.structuralProgress);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
1841
2176
|
const cachedWidth = this.lastViewportWidth;
|
|
1842
2177
|
const cachedHeight = this.lastViewportHeight;
|
|
1843
2178
|
const precomputedLayout = this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0 ? this.computeLayout(cachedWidth, cachedHeight) : undefined;
|
|
1844
|
-
if (precomputedLayout) {
|
|
2179
|
+
if (precomputedLayout && this.structuralRenderedHeight === undefined) {
|
|
1845
2180
|
// Commit appended row extent before measuring React-owned slot changes.
|
|
1846
2181
|
this.writeExternalHeight(Math.max(this.layout.contentHeight, precomputedLayout.contentHeight));
|
|
1847
2182
|
}
|
|
@@ -1871,11 +2206,13 @@ export class NativeListWebEngine {
|
|
|
1871
2206
|
const previousHorizontal = this.layout.horizontal;
|
|
1872
2207
|
this.layout = precomputedLayout && viewportWidth === cachedWidth && viewportHeight === cachedHeight ? precomputedLayout : this.computeLayout(viewportWidth, viewportHeight);
|
|
1873
2208
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
1874
|
-
this.
|
|
2209
|
+
const renderedHeight = this.structuralRenderedHeight ?? this.layout.contentHeight;
|
|
2210
|
+
this.content.style.height = String(renderedHeight) + 'px';
|
|
1875
2211
|
if (this.externalScrollHost) {
|
|
1876
|
-
this.writeExternalHeight(
|
|
2212
|
+
this.writeExternalHeight(renderedHeight);
|
|
1877
2213
|
this.externalGeometryCache = undefined;
|
|
1878
2214
|
}
|
|
2215
|
+
if (this.structuralRenderedHeight !== undefined) this.structuralTargetHeight = this.layout.contentHeight;
|
|
1879
2216
|
this.renderSectionIndex(this.viewport.clientHeight <= 0 ? DEFAULT_VIEWPORT_HEIGHT : Math.max(1, viewportHeight), stickyInset);
|
|
1880
2217
|
if (previousHorizontal !== this.layout.horizontal) {
|
|
1881
2218
|
this.viewport.scrollLeft = 0;
|
|
@@ -2028,7 +2365,7 @@ export class NativeListWebEngine {
|
|
|
2028
2365
|
const body = reusableBody ?? createRowBody(context, row);
|
|
2029
2366
|
if (reusableBody) {
|
|
2030
2367
|
resetRowContainerStyle(body);
|
|
2031
|
-
registered.bind(body, rendererPrimitives(context));
|
|
2368
|
+
registered.bind(body, rendererPrimitives(context, Boolean(row.disabled)));
|
|
2032
2369
|
}
|
|
2033
2370
|
// OneKey patch: explicit selector fields preserve original page geometry.
|
|
2034
2371
|
element.style.contain = row.backgroundFullWidth ? 'layout style' : '';
|
|
@@ -2510,6 +2847,7 @@ export class NativeListWebEngine {
|
|
|
2510
2847
|
return anchor.actionElement.isConnected && anchor.rowElement.isConnected && anchor.rowElement.contains(anchor.actionElement) && anchor.rowElement.dataset.nativeListBindingEpoch === anchor.bindingEpoch;
|
|
2511
2848
|
}
|
|
2512
2849
|
invalidateActionAnchorForElement(element) {
|
|
2850
|
+
if (this.pressedHelpElement && element.contains(this.pressedHelpElement)) this.pressedHelpElement = undefined;
|
|
2513
2851
|
const anchor = this.actionAnchor;
|
|
2514
2852
|
if (anchor && (element === anchor.rowElement || element.contains(anchor.actionElement))) {
|
|
2515
2853
|
this.invalidateActionAnchor('rebind');
|
|
@@ -2582,9 +2920,9 @@ export class NativeListWebEngine {
|
|
|
2582
2920
|
if (event.target.closest('[data-native-list-action]')) return;
|
|
2583
2921
|
const rowElement = event.target.closest('[data-native-list-row-key]');
|
|
2584
2922
|
const row = this.rowAtElement(rowElement);
|
|
2585
|
-
if (row?.type !== 'market' || !isRowPressEnabled(row)) return;
|
|
2923
|
+
if (row?.type !== 'market' && row?.type !== 'identity' || !isRowPressEnabled(row)) return;
|
|
2586
2924
|
this.cancelMarketPointer();
|
|
2587
|
-
if (row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2925
|
+
if (row.type === 'market' && row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2588
2926
|
if (!row.longPressActionKey || !rowElement) return;
|
|
2589
2927
|
markActionAnchorSource(rowElement, 'row');
|
|
2590
2928
|
const bindingEpoch = rowElement.dataset.nativeListBindingEpoch;
|
|
@@ -2593,7 +2931,7 @@ export class NativeListWebEngine {
|
|
|
2593
2931
|
if (!current || current.pointerId !== event.pointerId) return;
|
|
2594
2932
|
const currentRow = this.rowAtElement(rowElement);
|
|
2595
2933
|
this.marketPointer = undefined;
|
|
2596
|
-
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2934
|
+
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' && currentRow.type !== 'identity' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2597
2935
|
this.marketLongPressFired = true;
|
|
2598
2936
|
this.emitRowAction(currentRow, currentRow.longPressActionKey, rowElement, rowElement, {
|
|
2599
2937
|
x: event.clientX,
|
|
@@ -2604,7 +2942,7 @@ export class NativeListWebEngine {
|
|
|
2604
2942
|
this.marketPointer = {
|
|
2605
2943
|
pointerId: event.pointerId,
|
|
2606
2944
|
pointerType: event.pointerType,
|
|
2607
|
-
compact: !row.webTable,
|
|
2945
|
+
compact: row.type === 'identity' || !row.webTable,
|
|
2608
2946
|
rowKey: row.key,
|
|
2609
2947
|
startX: event.clientX,
|
|
2610
2948
|
startY: event.clientY,
|
|
@@ -2640,7 +2978,14 @@ export class NativeListWebEngine {
|
|
|
2640
2978
|
if (!(target instanceof Element)) return;
|
|
2641
2979
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2642
2980
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
2981
|
+
if (action.dataset.nativeListIconHelp === 'true') {
|
|
2982
|
+
if (event.type === 'pointerover' && event.pointerType === 'touch') return;
|
|
2983
|
+
if (this.pressedHelpElement === action) return;
|
|
2984
|
+
}
|
|
2643
2985
|
if (action.classList.contains('ok-native-list-market-subtitle-prefix') && action.scrollWidth <= action.clientWidth + 1) return;
|
|
2986
|
+
this.emitHoverAction(action);
|
|
2987
|
+
};
|
|
2988
|
+
emitHoverAction(action) {
|
|
2644
2989
|
const rowElement = action.closest('[data-native-list-row-key]');
|
|
2645
2990
|
const row = this.rowAtElement(rowElement);
|
|
2646
2991
|
const memberKey = action.closest('[data-native-list-group-member-key]')?.dataset.nativeListGroupMemberKey;
|
|
@@ -2649,12 +2994,26 @@ export class NativeListWebEngine {
|
|
|
2649
2994
|
// Legacy Web: hover checks only the resolved source (the member for a
|
|
2650
2995
|
// WalletGroup), not the enclosing row's `disabled`.
|
|
2651
2996
|
if (sourceRow && !sourceRow.disabled && actionKey) this.emitRowAction(sourceRow, actionKey, action, rowElement ?? undefined);
|
|
2997
|
+
}
|
|
2998
|
+
handleIconHelpPointerDown = event => {
|
|
2999
|
+
const target = event.target;
|
|
3000
|
+
if (!(target instanceof Element)) return;
|
|
3001
|
+
const action = target.closest('[data-native-list-icon-help="true"]');
|
|
3002
|
+
if (!action) return;
|
|
3003
|
+
if (event.pointerType === 'touch') {
|
|
3004
|
+
if (this.actionAnchor?.actionElement === action && this.actionAnchor.open) this.invalidateActionAnchor('pointerLeave');else this.emitHoverAction(action);
|
|
3005
|
+
} else {
|
|
3006
|
+
this.pressedHelpElement = action;
|
|
3007
|
+
if (this.actionAnchor?.actionElement === action) this.invalidateActionAnchor('pointerLeave');
|
|
3008
|
+
}
|
|
2652
3009
|
};
|
|
2653
3010
|
handleTitlePointerOut = event => {
|
|
2654
3011
|
const target = event.target;
|
|
2655
3012
|
if (!(target instanceof Element)) return;
|
|
2656
3013
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2657
3014
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
3015
|
+
if (action.dataset.nativeListIconHelp === 'true' && event.type === 'pointerout' && event.pointerType === 'touch') return;
|
|
3016
|
+
if (event.type === 'pointerout' && this.pressedHelpElement === action) this.pressedHelpElement = undefined;
|
|
2658
3017
|
if (this.actionAnchor?.actionElement === action) this.invalidateActionAnchor('pointerLeave');
|
|
2659
3018
|
};
|
|
2660
3019
|
handleClick = event => {
|
|
@@ -2666,6 +3025,11 @@ export class NativeListWebEngine {
|
|
|
2666
3025
|
}
|
|
2667
3026
|
const target = event.target;
|
|
2668
3027
|
if (!(target instanceof Element)) return;
|
|
3028
|
+
if (target.closest('[data-native-list-icon-help="true"]')) {
|
|
3029
|
+
event.preventDefault();
|
|
3030
|
+
event.stopPropagation();
|
|
3031
|
+
return;
|
|
3032
|
+
}
|
|
2669
3033
|
const rowElement = target.closest('[data-native-list-row-key]');
|
|
2670
3034
|
const row = this.rowAtElement(rowElement);
|
|
2671
3035
|
if (!row || row.disabled) return;
|
|
@@ -2677,6 +3041,8 @@ export class NativeListWebEngine {
|
|
|
2677
3041
|
// member press is blocked by `isRowPressEnabled` in `handleRowPress`.
|
|
2678
3042
|
const action = target.closest('[data-native-list-action]');
|
|
2679
3043
|
if (action) {
|
|
3044
|
+
if (action.tagName === 'BUTTON' && action.hasAttribute('disabled')) return;
|
|
3045
|
+
if (action.classList.contains('ok-native-list-trailing-button')) event.stopPropagation();
|
|
2680
3046
|
const scope = action.dataset.selectionScope;
|
|
2681
3047
|
if (scope === 'row') this.activateSelection({
|
|
2682
3048
|
scope: 'row'
|
|
@@ -2792,6 +3158,7 @@ export class NativeListWebEngine {
|
|
|
2792
3158
|
};
|
|
2793
3159
|
handleScroll = () => {
|
|
2794
3160
|
this.externalGeometryCache = undefined;
|
|
3161
|
+
this.pressedHelpElement = undefined;
|
|
2795
3162
|
this.cancelMarketPointer();
|
|
2796
3163
|
this.invalidateActionAnchor('scroll');
|
|
2797
3164
|
this.scheduleFrame();
|