@onekeyfe/react-native-native-list 6.7.0-16 → 6.7.0-17
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 +240 -11
- 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 +177 -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 +33 -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 +1877 -41
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +1 -0
- package/docs/ROW_TEMPLATES.md +60 -9
- package/docs/SPEC.md +401 -5
- package/docs/STYLE_SPEC.md +6 -0
- package/ios/HybridNativeList.swift +17 -2
- package/ios/NativeListAccessoryStack.swift +227 -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 +3 -0
- package/ios/NativeListIdentityRenderer.swift +166 -30
- package/ios/NativeListLeadingVisual.swift +49 -14
- 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 +984 -53
- 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 +2494 -3
- package/lib/module/NativeList.js +171 -28
- package/lib/module/NativeList.web.js +54 -4
- package/lib/module/models.js +1 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +331 -8
- package/lib/module/web/NativeListWebEngine.js +503 -18
- 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 +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 +1 -1
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
- package/lib/typescript/src/NativeList.types.d.ts +18 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/models.d.ts +105 -9
- package/lib/typescript/src/validation.d.ts +10 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +31 -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 +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 +307 -44
- package/src/NativeList.types.ts +22 -0
- package/src/NativeList.web.tsx +75 -8
- package/src/index.ts +1 -0
- package/src/models.ts +117 -3
- package/src/selection.ts +1 -0
- package/src/validation.ts +742 -6
- package/src/web/NativeListWebEngine.ts +798 -19
- 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
|
@@ -801,7 +801,7 @@ export const WEB_LIST_CSS = `
|
|
|
801
801
|
.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}
|
|
802
802
|
|
|
803
803
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
804
|
-
.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)}
|
|
804
|
+
.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)}
|
|
805
805
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
806
806
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
807
807
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
@@ -812,7 +812,7 @@ export const WEB_LIST_CSS = `
|
|
|
812
812
|
.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
813
813
|
.ok-native-list-item[data-native-list-disabled="true"]>.ok-native-list-row{cursor:default}
|
|
814
814
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]>.ok-native-list-row{cursor:pointer}
|
|
815
|
-
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-
|
|
815
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-hover)}
|
|
816
816
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-row{background:var(--nl-pressed)}
|
|
817
817
|
.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)}
|
|
818
818
|
.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)}
|
|
@@ -843,16 +843,23 @@ export const WEB_LIST_CSS = `
|
|
|
843
843
|
.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)}
|
|
844
844
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
845
845
|
.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}
|
|
846
|
+
.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}
|
|
847
|
+
.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}
|
|
848
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon:focus-visible:not(:disabled){outline:2px solid var(--nl-accent)}
|
|
849
|
+
.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}
|
|
846
850
|
.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)}
|
|
847
851
|
.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)}
|
|
848
852
|
.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}
|
|
849
853
|
.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}
|
|
850
854
|
.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}
|
|
851
|
-
.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}
|
|
855
|
+
.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}
|
|
852
856
|
.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)}}
|
|
853
|
-
.ok-native-list-
|
|
857
|
+
.ok-native-list-icon-button.ok-native-list-decorative-refresh{min-width:16px;width:16px;height:16px}
|
|
858
|
+
.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}
|
|
859
|
+
.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)}
|
|
854
860
|
.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}
|
|
855
861
|
.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)}
|
|
862
|
+
.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}
|
|
856
863
|
.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)}
|
|
857
864
|
.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}
|
|
858
865
|
.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)}
|
|
@@ -901,6 +908,7 @@ export const WEB_LIST_CSS = `
|
|
|
901
908
|
.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)}
|
|
902
909
|
.ok-native-list-root [data-nl-container-border="true"]{position:relative}
|
|
903
910
|
.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}
|
|
911
|
+
.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}
|
|
904
912
|
.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)}
|
|
905
913
|
`;
|
|
906
914
|
|
|
@@ -1187,6 +1195,45 @@ const selectorIcons: Readonly<
|
|
|
1187
1195
|
}>
|
|
1188
1196
|
>
|
|
1189
1197
|
> = {
|
|
1198
|
+
RefreshCcwOutline: {
|
|
1199
|
+
viewBox: '0 0 24 24',
|
|
1200
|
+
paths: [
|
|
1201
|
+
{
|
|
1202
|
+
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',
|
|
1203
|
+
fill: 'currentColor',
|
|
1204
|
+
fillRule: 'nonzero',
|
|
1205
|
+
opacity: 1,
|
|
1206
|
+
},
|
|
1207
|
+
],
|
|
1208
|
+
},
|
|
1209
|
+
TicketOutline: {
|
|
1210
|
+
viewBox: '0 0 24 24',
|
|
1211
|
+
paths: [
|
|
1212
|
+
{
|
|
1213
|
+
d: 'M16 17.01h-2V15h2v2.01Zm0-4h-2V11h2v2.01Zm0-4h-2V7h2v2.01Z',
|
|
1214
|
+
fill: 'currentColor',
|
|
1215
|
+
fillRule: 'nonzero',
|
|
1216
|
+
opacity: 1,
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
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',
|
|
1220
|
+
fill: 'currentColor',
|
|
1221
|
+
fillRule: 'evenodd',
|
|
1222
|
+
opacity: 1,
|
|
1223
|
+
},
|
|
1224
|
+
],
|
|
1225
|
+
},
|
|
1226
|
+
GasSolid: {
|
|
1227
|
+
viewBox: '0 0 24 24',
|
|
1228
|
+
paths: [
|
|
1229
|
+
{
|
|
1230
|
+
d: 'M15 9h4v7h1V8.414L17.586 6 19 4.586l3 3V18h-5v-7h-2v8h1v2H2v-2h1V3h12zM6 9v2h6V9z',
|
|
1231
|
+
fill: 'currentColor',
|
|
1232
|
+
fillRule: 'evenodd',
|
|
1233
|
+
opacity: 1,
|
|
1234
|
+
},
|
|
1235
|
+
],
|
|
1236
|
+
},
|
|
1190
1237
|
CryptoCoinOutline: {
|
|
1191
1238
|
viewBox: '0 0 24 24',
|
|
1192
1239
|
paths: [
|
|
@@ -1486,6 +1533,7 @@ function applySelectorIcon(element: HTMLElement, name: string) {
|
|
|
1486
1533
|
|
|
1487
1534
|
function iconGlyph(name: string): string {
|
|
1488
1535
|
const normalized = name.toLocaleLowerCase();
|
|
1536
|
+
if (normalized === 'dotversolid') return '⋮';
|
|
1489
1537
|
if (normalized.includes('chevron')) {
|
|
1490
1538
|
if (normalized.includes('top')) return '⌃';
|
|
1491
1539
|
if (normalized.includes('bottom')) return '⌄';
|
|
@@ -1563,6 +1611,10 @@ function createVisual(
|
|
|
1563
1611
|
: visualBackground;
|
|
1564
1612
|
const fallbackIcon =
|
|
1565
1613
|
'fallbackIcon' in visual ? visual.fallbackIcon : undefined;
|
|
1614
|
+
const fallbackBackground =
|
|
1615
|
+
fallbackIcon?.backgroundColor ?? 'var(--nl-strong)';
|
|
1616
|
+
if (!source && fallbackIcon?.backgroundColor)
|
|
1617
|
+
frame.style.background = fallbackBackground;
|
|
1566
1618
|
const handlesSourceFallback =
|
|
1567
1619
|
showsSourcePlaceholder &&
|
|
1568
1620
|
(fallbackIcon !== undefined || 'fallbackText' in visual);
|
|
@@ -1578,6 +1630,28 @@ function createVisual(
|
|
|
1578
1630
|
if (image.complete && image.naturalWidth > 0) restoreBackground();
|
|
1579
1631
|
}
|
|
1580
1632
|
if (selectorPresentation) paintSelectorImageBackground(image, frame);
|
|
1633
|
+
if (
|
|
1634
|
+
source?.loadingStrategy === 'skeleton' &&
|
|
1635
|
+
!(image.complete && image.naturalWidth > 0)
|
|
1636
|
+
) {
|
|
1637
|
+
const skeleton = createElement(
|
|
1638
|
+
context.document,
|
|
1639
|
+
'span',
|
|
1640
|
+
'ok-native-list-image-skeleton'
|
|
1641
|
+
);
|
|
1642
|
+
const background = resolvedTheme(context.snapshot).background;
|
|
1643
|
+
const rgb = /^#([0-9a-f]{6})/i.exec(background)?.[1];
|
|
1644
|
+
if (rgb) {
|
|
1645
|
+
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
1646
|
+
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
1647
|
+
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
1648
|
+
if (red * 299 + green * 587 + blue * 114 < 128_000)
|
|
1649
|
+
skeleton.dataset.dark = 'true';
|
|
1650
|
+
}
|
|
1651
|
+
frame.appendChild(skeleton);
|
|
1652
|
+
image.addEventListener('load', () => skeleton.remove(), { once: true });
|
|
1653
|
+
image.addEventListener('error', () => skeleton.remove(), { once: true });
|
|
1654
|
+
}
|
|
1581
1655
|
} else if (!source || showsSourcePlaceholder) {
|
|
1582
1656
|
frame.appendChild(
|
|
1583
1657
|
createElement(
|
|
@@ -1632,13 +1706,29 @@ function createVisual(
|
|
|
1632
1706
|
? visual.fallbackText ?? ''
|
|
1633
1707
|
: ''
|
|
1634
1708
|
);
|
|
1709
|
+
if (
|
|
1710
|
+
'fallbackTextColor' in visual &&
|
|
1711
|
+
visual.fallbackTextColor &&
|
|
1712
|
+
!fallbackIcon
|
|
1713
|
+
)
|
|
1714
|
+
fallback.style.color = visual.fallbackTextColor;
|
|
1635
1715
|
if (fallbackIcon) {
|
|
1636
1716
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1637
1717
|
if (fallbackIcon.tintColor)
|
|
1638
1718
|
fallback.style.color = fallbackIcon.tintColor;
|
|
1719
|
+
if (fallbackIcon.size) {
|
|
1720
|
+
const svg = fallback.querySelector<SVGElement>('svg');
|
|
1721
|
+
if (svg) {
|
|
1722
|
+
svg.style.width = `${fallbackIcon.size}px`;
|
|
1723
|
+
svg.style.height = `${fallbackIcon.size}px`;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1639
1726
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1727
|
+
if (fallbackIcon?.backgroundColor)
|
|
1728
|
+
frame.style.background = fallbackBackground;
|
|
1729
|
+
else
|
|
1730
|
+
fallback.style.backgroundColor =
|
|
1731
|
+
'var(--nl-image-fallback-background, transparent)';
|
|
1642
1732
|
frame.prepend(fallback);
|
|
1643
1733
|
};
|
|
1644
1734
|
if (image) image.addEventListener('error', showFallback, { once: true });
|
|
@@ -1648,6 +1738,9 @@ function createVisual(
|
|
|
1648
1738
|
frame.style.border =
|
|
1649
1739
|
'2px dashed ' + (visual.borderColor ?? 'var(--nl-disabled)');
|
|
1650
1740
|
frame.style.boxSizing = 'border-box';
|
|
1741
|
+
} else if ('borderColor' in visual && visual.borderColor) {
|
|
1742
|
+
frame.style.border = '1px solid ' + visual.borderColor;
|
|
1743
|
+
frame.style.boxSizing = 'border-box';
|
|
1651
1744
|
}
|
|
1652
1745
|
if ('overlays' in visual)
|
|
1653
1746
|
visual.overlays?.forEach((overlay) => {
|
|
@@ -1677,6 +1770,16 @@ function createVisual(
|
|
|
1677
1770
|
corner.style.lineHeight = '16px';
|
|
1678
1771
|
applyTextWeight(corner, '400');
|
|
1679
1772
|
}
|
|
1773
|
+
if (overlay.fontWeight)
|
|
1774
|
+
applyTextWeight(
|
|
1775
|
+
corner,
|
|
1776
|
+
{
|
|
1777
|
+
regular: 400,
|
|
1778
|
+
medium: 500,
|
|
1779
|
+
semibold: 600,
|
|
1780
|
+
bold: 700,
|
|
1781
|
+
}[overlay.fontWeight]
|
|
1782
|
+
);
|
|
1680
1783
|
if (
|
|
1681
1784
|
isWalletText ||
|
|
1682
1785
|
overlay.width !== undefined ||
|
|
@@ -1697,7 +1800,31 @@ function createVisual(
|
|
|
1697
1800
|
if (overlay.image) {
|
|
1698
1801
|
const overlayImage = createImage(context, overlay.image);
|
|
1699
1802
|
if (overlayImage) {
|
|
1803
|
+
if (
|
|
1804
|
+
(overlay.padding ?? 0) > 0 &&
|
|
1805
|
+
(overlay.width ?? size) === (overlay.height ?? size)
|
|
1806
|
+
)
|
|
1807
|
+
overlayImage.style.borderRadius = '50%';
|
|
1700
1808
|
corner.appendChild(overlayImage);
|
|
1809
|
+
if (overlay.fallbackIcon) {
|
|
1810
|
+
overlayImage.addEventListener(
|
|
1811
|
+
'error',
|
|
1812
|
+
() => {
|
|
1813
|
+
disposeWebImageRetries(overlayImage);
|
|
1814
|
+
overlayImage.remove();
|
|
1815
|
+
const glyph = createElement(
|
|
1816
|
+
context.document,
|
|
1817
|
+
'span',
|
|
1818
|
+
'ok-native-list-overlay-fallback'
|
|
1819
|
+
);
|
|
1820
|
+
applySelectorIcon(glyph, overlay.fallbackIcon!.name);
|
|
1821
|
+
if (overlay.fallbackIcon?.tintColor)
|
|
1822
|
+
glyph.style.color = overlay.fallbackIcon.tintColor;
|
|
1823
|
+
corner.appendChild(glyph);
|
|
1824
|
+
},
|
|
1825
|
+
{ once: true }
|
|
1826
|
+
);
|
|
1827
|
+
}
|
|
1701
1828
|
if (selectorPresentation)
|
|
1702
1829
|
paintSelectorImageBackground(
|
|
1703
1830
|
overlayImage,
|
|
@@ -1862,8 +1989,44 @@ function createAccessory(
|
|
|
1862
1989
|
context: RenderContext,
|
|
1863
1990
|
rowKey: string,
|
|
1864
1991
|
accessory: TrailingAccessory,
|
|
1865
|
-
slot: number
|
|
1992
|
+
slot: number,
|
|
1993
|
+
rowDisabled: boolean
|
|
1866
1994
|
): HTMLElement {
|
|
1995
|
+
if (accessory.kind === 'button') {
|
|
1996
|
+
const element = createElement(
|
|
1997
|
+
context.document,
|
|
1998
|
+
'button',
|
|
1999
|
+
'ok-native-list-trailing-button',
|
|
2000
|
+
accessory.label
|
|
2001
|
+
) as HTMLButtonElement;
|
|
2002
|
+
element.type = 'button';
|
|
2003
|
+
element.disabled = Boolean(rowDisabled || accessory.disabled);
|
|
2004
|
+
element.setAttribute('aria-disabled', String(element.disabled));
|
|
2005
|
+
element.setAttribute(
|
|
2006
|
+
'aria-label',
|
|
2007
|
+
accessory.accessibilityLabel ?? accessory.label
|
|
2008
|
+
);
|
|
2009
|
+
setData(element, 'testid', accessory.testID);
|
|
2010
|
+
setData(element, 'nativeListAction', accessory.actionKey);
|
|
2011
|
+
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
2012
|
+
if (accessory.textColor)
|
|
2013
|
+
element.style.setProperty('--nl-button-text', accessory.textColor);
|
|
2014
|
+
if (accessory.backgroundColor)
|
|
2015
|
+
element.style.setProperty('--nl-button-bg', accessory.backgroundColor);
|
|
2016
|
+
if (accessory.pressedBackgroundColor)
|
|
2017
|
+
element.style.setProperty(
|
|
2018
|
+
'--nl-button-pressed',
|
|
2019
|
+
accessory.pressedBackgroundColor
|
|
2020
|
+
);
|
|
2021
|
+
if (accessory.hoverBackgroundColor)
|
|
2022
|
+
element.style.setProperty(
|
|
2023
|
+
'--nl-button-hover',
|
|
2024
|
+
accessory.hoverBackgroundColor
|
|
2025
|
+
);
|
|
2026
|
+
if (accessory.focusRingColor)
|
|
2027
|
+
element.style.setProperty('--nl-button-focus', accessory.focusRingColor);
|
|
2028
|
+
return element;
|
|
2029
|
+
}
|
|
1867
2030
|
if (accessory.kind === 'checkbox') {
|
|
1868
2031
|
const element = createCheckbox(context, rowKey, accessory);
|
|
1869
2032
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
@@ -1878,9 +2041,21 @@ function createAccessory(
|
|
|
1878
2041
|
accessory.tintColor
|
|
1879
2042
|
);
|
|
1880
2043
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
2044
|
+
if (accessory.name === 'RefreshCcwOutline' && !accessory.actionKey) {
|
|
2045
|
+
element.classList.add('ok-native-list-decorative-refresh');
|
|
2046
|
+
const glyph = element.querySelector('svg');
|
|
2047
|
+
glyph?.setAttribute('width', '16');
|
|
2048
|
+
glyph?.setAttribute('height', '16');
|
|
2049
|
+
}
|
|
2050
|
+
if (accessory.buttonStyle === 'tertiary') {
|
|
2051
|
+
element.classList.add('ok-native-list-tertiary-icon');
|
|
2052
|
+
setData(element, 'nativeListAnchorInset', 7);
|
|
2053
|
+
}
|
|
1881
2054
|
setData(element, 'testid', accessory.testID);
|
|
1882
2055
|
if (accessory.hoverActionKey)
|
|
1883
2056
|
setData(element, 'nativeListHoverAction', accessory.hoverActionKey);
|
|
2057
|
+
if (accessory.hoverActionKey && accessory.buttonStyle === 'tertiary')
|
|
2058
|
+
setData(element, 'nativeListIconHelp', true);
|
|
1884
2059
|
if (accessory.accessibilityLabel)
|
|
1885
2060
|
element.setAttribute('aria-label', accessory.accessibilityLabel);
|
|
1886
2061
|
const row = context.snapshot.rows[context.itemIndex];
|
|
@@ -1928,6 +2103,25 @@ function createAccessory(
|
|
|
1928
2103
|
accessory.primary
|
|
1929
2104
|
);
|
|
1930
2105
|
primary.style.color = toneColor(accessory.primaryTone, 'primary');
|
|
2106
|
+
applyValueSegments(primary, accessory.primaryTextSegments, 16, 20, 500);
|
|
2107
|
+
if (accessory.primaryFontWeight === 'medium')
|
|
2108
|
+
applyTextWeight(primary, 500);
|
|
2109
|
+
if (accessory.primaryHelp) {
|
|
2110
|
+
const help = accessory.primaryHelp;
|
|
2111
|
+
primary.tabIndex = 0;
|
|
2112
|
+
primary.setAttribute('role', 'button');
|
|
2113
|
+
if (help.presentation === 'tooltip') {
|
|
2114
|
+
setData(primary, 'nativeListHoverAction', help.actionKey);
|
|
2115
|
+
setData(primary, 'nativeListIconHelp', true);
|
|
2116
|
+
} else {
|
|
2117
|
+
setData(primary, 'nativeListAction', help.actionKey);
|
|
2118
|
+
}
|
|
2119
|
+
if (help.underline === 'dashed') {
|
|
2120
|
+
primary.style.textDecoration = 'underline dashed';
|
|
2121
|
+
primary.style.textUnderlineOffset = '4px';
|
|
2122
|
+
}
|
|
2123
|
+
markActionAnchorSource(primary, 'trailingAccessory', slot);
|
|
2124
|
+
}
|
|
1931
2125
|
const secondary = createElement(
|
|
1932
2126
|
context.document,
|
|
1933
2127
|
'span',
|
|
@@ -1935,6 +2129,13 @@ function createAccessory(
|
|
|
1935
2129
|
accessory.secondary
|
|
1936
2130
|
);
|
|
1937
2131
|
secondary.style.color = toneColor(accessory.secondaryTone, 'secondary');
|
|
2132
|
+
applyValueSegments(
|
|
2133
|
+
secondary,
|
|
2134
|
+
accessory.secondaryTextSegments,
|
|
2135
|
+
14,
|
|
2136
|
+
20,
|
|
2137
|
+
400
|
|
2138
|
+
);
|
|
1938
2139
|
element.replaceChildren(primary, '\n', secondary);
|
|
1939
2140
|
element.classList.add('ok-native-list-amounts');
|
|
1940
2141
|
break;
|
|
@@ -1963,11 +2164,11 @@ function createAccessory(
|
|
|
1963
2164
|
return element;
|
|
1964
2165
|
}
|
|
1965
2166
|
|
|
1966
|
-
function rendererPrimitives(context: RenderContext) {
|
|
2167
|
+
function rendererPrimitives(context: RenderContext, rowDisabled: boolean) {
|
|
1967
2168
|
return {
|
|
1968
2169
|
background: resolvedTheme(context.snapshot).background,
|
|
1969
2170
|
accessory: (key: string, descriptor: TrailingAccessory, slot: number) =>
|
|
1970
|
-
createAccessory(context, key, descriptor, slot),
|
|
2171
|
+
createAccessory(context, key, descriptor, slot, rowDisabled),
|
|
1971
2172
|
visual: (source: LeadingVisual | undefined, presentation?: string) =>
|
|
1972
2173
|
createVisual(context, source, presentation),
|
|
1973
2174
|
thumbnail: (source: ImageSource) =>
|
|
@@ -1988,7 +2189,10 @@ export function createRowBody(
|
|
|
1988
2189
|
context: RenderContext,
|
|
1989
2190
|
row: RowModel
|
|
1990
2191
|
): HTMLElement {
|
|
1991
|
-
return rowRenderer(row).create(
|
|
2192
|
+
return rowRenderer(row).create(
|
|
2193
|
+
context.document,
|
|
2194
|
+
rendererPrimitives(context, Boolean(row.disabled))
|
|
2195
|
+
);
|
|
1992
2196
|
}
|
|
1993
2197
|
|
|
1994
2198
|
export type NativeListWebScrollOptions = Readonly<{
|
|
@@ -2037,6 +2241,7 @@ export class NativeListWebEngine {
|
|
|
2037
2241
|
rail: [],
|
|
2038
2242
|
mediaTile: [],
|
|
2039
2243
|
action: [],
|
|
2244
|
+
buttonGroup: [],
|
|
2040
2245
|
system: [],
|
|
2041
2246
|
activity: [],
|
|
2042
2247
|
dataRow: [],
|
|
@@ -2080,6 +2285,7 @@ export class NativeListWebEngine {
|
|
|
2080
2285
|
private pullDistance = 0;
|
|
2081
2286
|
private virtualizationEnabled: boolean;
|
|
2082
2287
|
private actionAnchor: WebActionAnchorRecord | undefined;
|
|
2288
|
+
private pressedHelpElement: HTMLElement | undefined;
|
|
2083
2289
|
private readonly actionAnchorInstanceId = String(
|
|
2084
2290
|
++webNativeListInstanceCounter
|
|
2085
2291
|
);
|
|
@@ -2100,6 +2306,39 @@ export class NativeListWebEngine {
|
|
|
2100
2306
|
private lastViewportWidth = -1;
|
|
2101
2307
|
private lastViewportHeight = -1;
|
|
2102
2308
|
private destroyed = false;
|
|
2309
|
+
private hasAppliedSnapshot = false;
|
|
2310
|
+
private lastStructuralTransitionId: string | undefined;
|
|
2311
|
+
private structuralFrame: number | undefined;
|
|
2312
|
+
private structuralFinish: number | undefined;
|
|
2313
|
+
private structuralRevision = 0;
|
|
2314
|
+
private structuralAnimations: Animation[] = [];
|
|
2315
|
+
private structuralScrollInterrupted = false;
|
|
2316
|
+
private structuralRenderedHeight: number | undefined;
|
|
2317
|
+
private structuralTargetHeight: number | undefined;
|
|
2318
|
+
private reactFooterHeight = 0;
|
|
2319
|
+
private structuralFooterCompensation = 0;
|
|
2320
|
+
private structuralFooterExpansion = 0;
|
|
2321
|
+
private structuralFooterFromHeight = 0;
|
|
2322
|
+
private structuralFooterElement: HTMLElement | undefined;
|
|
2323
|
+
private structuralFooterStyles:
|
|
2324
|
+
| { marginBottom: string; transform: string; clipPath: string }
|
|
2325
|
+
| undefined;
|
|
2326
|
+
private structuralProgress = 0;
|
|
2327
|
+
private structuralAnchorStyles:
|
|
2328
|
+
| { owner: string; content: string }
|
|
2329
|
+
| undefined;
|
|
2330
|
+
private structuralContentOverflow: string | undefined;
|
|
2331
|
+
private structuralPrefixTransition = false;
|
|
2332
|
+
private structuralTail:
|
|
2333
|
+
| {
|
|
2334
|
+
snapshot: NativeListSnapshot;
|
|
2335
|
+
rows: readonly RowModel[];
|
|
2336
|
+
layout: WebListLayout;
|
|
2337
|
+
firstIndex: number;
|
|
2338
|
+
layer: HTMLElement;
|
|
2339
|
+
mounted: Map<number, HTMLElement>;
|
|
2340
|
+
}
|
|
2341
|
+
| undefined;
|
|
2103
2342
|
private sectionIndexAlignStart = false;
|
|
2104
2343
|
// Renderers report intrinsic height after browser text wrapping.
|
|
2105
2344
|
private measuredRendererHeights = new Map<
|
|
@@ -2271,6 +2510,12 @@ export class NativeListWebEngine {
|
|
|
2271
2510
|
'ok-collapsible-pager-cancel-scroll-command',
|
|
2272
2511
|
this.handlePagerScrollCommandCancel
|
|
2273
2512
|
);
|
|
2513
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart'])
|
|
2514
|
+
(this.externalScrollHost ?? this.viewport).addEventListener(
|
|
2515
|
+
event,
|
|
2516
|
+
this.handleStructuralUserScroll,
|
|
2517
|
+
{ passive: true }
|
|
2518
|
+
);
|
|
2274
2519
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
2275
2520
|
passive: true,
|
|
2276
2521
|
});
|
|
@@ -2289,6 +2534,7 @@ export class NativeListWebEngine {
|
|
|
2289
2534
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
2290
2535
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
2291
2536
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
2537
|
+
this.root.addEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
2292
2538
|
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
2293
2539
|
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
2294
2540
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -2457,8 +2703,431 @@ export class NativeListWebEngine {
|
|
|
2457
2703
|
return next;
|
|
2458
2704
|
});
|
|
2459
2705
|
if (!validated) return;
|
|
2706
|
+
this.pressedHelpElement = undefined;
|
|
2460
2707
|
this.invalidateActionAnchor('snapshot');
|
|
2461
|
-
|
|
2708
|
+
const transition = validated.structuralTransition;
|
|
2709
|
+
const isNewTransition =
|
|
2710
|
+
transition !== undefined &&
|
|
2711
|
+
transition.id !== this.lastStructuralTransitionId;
|
|
2712
|
+
if (transition) this.lastStructuralTransitionId = transition.id;
|
|
2713
|
+
const nextRows = effectiveRows(validated);
|
|
2714
|
+
const changedKeys =
|
|
2715
|
+
this.rows.length !== nextRows.length ||
|
|
2716
|
+
this.rows.some((row, index) => row.key !== nextRows[index]?.key);
|
|
2717
|
+
const incompatibleActivePrefix =
|
|
2718
|
+
this.structuralPrefixTransition &&
|
|
2719
|
+
(validated.layout.kind !== this.snapshot.layout.kind ||
|
|
2720
|
+
validated.layout.orientation !== this.snapshot.layout.orientation ||
|
|
2721
|
+
nextRows.some(
|
|
2722
|
+
(row, index) =>
|
|
2723
|
+
row.height !== this.rows[index]?.height ||
|
|
2724
|
+
row.style?.container?.height !==
|
|
2725
|
+
this.rows[index]?.style?.container?.height
|
|
2726
|
+
));
|
|
2727
|
+
const shouldAnimate =
|
|
2728
|
+
this.hasAppliedSnapshot &&
|
|
2729
|
+
isNewTransition &&
|
|
2730
|
+
changedKeys &&
|
|
2731
|
+
(this.snapshot.layout.kind === 'linear' ||
|
|
2732
|
+
this.snapshot.layout.kind === 'table') &&
|
|
2733
|
+
this.snapshot.layout.orientation !== 'horizontal' &&
|
|
2734
|
+
(validated.layout.kind === 'linear' ||
|
|
2735
|
+
validated.layout.kind === 'table') &&
|
|
2736
|
+
validated.layout.orientation !== 'horizontal' &&
|
|
2737
|
+
(transition?.durationMs ?? 220) > 0 &&
|
|
2738
|
+
!this.document.defaultView?.matchMedia?.(
|
|
2739
|
+
'(prefers-reduced-motion: reduce)'
|
|
2740
|
+
).matches;
|
|
2741
|
+
if (shouldAnimate && transition)
|
|
2742
|
+
this.applyStructuralSnapshot(validated, transition);
|
|
2743
|
+
else {
|
|
2744
|
+
if (isNewTransition || changedKeys || incompatibleActivePrefix)
|
|
2745
|
+
this.cancelStructuralAnimation();
|
|
2746
|
+
this.setSnapshot(validated);
|
|
2747
|
+
}
|
|
2748
|
+
this.hasAppliedSnapshot = true;
|
|
2749
|
+
}
|
|
2750
|
+
|
|
2751
|
+
private cancelStructuralAnimation() {
|
|
2752
|
+
this.structuralRevision += 1;
|
|
2753
|
+
if (this.structuralFrame !== undefined)
|
|
2754
|
+
this.document.defaultView?.cancelAnimationFrame(this.structuralFrame);
|
|
2755
|
+
if (this.structuralFinish !== undefined)
|
|
2756
|
+
this.document.defaultView?.clearTimeout(this.structuralFinish);
|
|
2757
|
+
this.structuralFrame = undefined;
|
|
2758
|
+
this.structuralFinish = undefined;
|
|
2759
|
+
this.structuralAnimations.forEach((animation) => animation.cancel());
|
|
2760
|
+
this.structuralAnimations = [];
|
|
2761
|
+
if (this.structuralTail) {
|
|
2762
|
+
disposeWebImageRetries(this.structuralTail.layer);
|
|
2763
|
+
this.structuralTail.layer.remove();
|
|
2764
|
+
this.structuralTail = undefined;
|
|
2765
|
+
}
|
|
2766
|
+
if (this.structuralContentOverflow !== undefined) {
|
|
2767
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
2768
|
+
this.structuralContentOverflow = undefined;
|
|
2769
|
+
}
|
|
2770
|
+
this.structuralPrefixTransition = false;
|
|
2771
|
+
if (this.structuralFooterElement && this.structuralFooterStyles) {
|
|
2772
|
+
this.structuralFooterElement.style.marginBottom =
|
|
2773
|
+
this.structuralFooterStyles.marginBottom;
|
|
2774
|
+
this.structuralFooterElement.style.transform =
|
|
2775
|
+
this.structuralFooterStyles.transform;
|
|
2776
|
+
this.structuralFooterElement.style.clipPath =
|
|
2777
|
+
this.structuralFooterStyles.clipPath;
|
|
2778
|
+
}
|
|
2779
|
+
this.structuralFooterElement = undefined;
|
|
2780
|
+
this.structuralFooterStyles = undefined;
|
|
2781
|
+
this.structuralScrollInterrupted = false;
|
|
2782
|
+
this.structuralRenderedHeight = undefined;
|
|
2783
|
+
this.structuralTargetHeight = undefined;
|
|
2784
|
+
this.structuralFooterCompensation = 0;
|
|
2785
|
+
this.structuralFooterExpansion = 0;
|
|
2786
|
+
this.structuralProgress = 0;
|
|
2787
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2788
|
+
if (this.structuralAnchorStyles) {
|
|
2789
|
+
owner.style.overflowAnchor = this.structuralAnchorStyles.owner;
|
|
2790
|
+
this.content.style.overflowAnchor = this.structuralAnchorStyles.content;
|
|
2791
|
+
this.structuralAnchorStyles = undefined;
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
|
|
2795
|
+
private handleStructuralUserScroll = (event: Event) => {
|
|
2796
|
+
if (
|
|
2797
|
+
event.type === 'pointerdown' &&
|
|
2798
|
+
event.target !== (this.externalScrollHost ?? this.viewport) &&
|
|
2799
|
+
(event as PointerEvent).pointerType !== 'touch'
|
|
2800
|
+
)
|
|
2801
|
+
return;
|
|
2802
|
+
this.structuralScrollInterrupted = true;
|
|
2803
|
+
if (this.structuralPrefixTransition) {
|
|
2804
|
+
this.cancelStructuralAnimation();
|
|
2805
|
+
this.recomputeLayout();
|
|
2806
|
+
}
|
|
2807
|
+
};
|
|
2808
|
+
|
|
2809
|
+
private updateStructuralTailWindow() {
|
|
2810
|
+
const tail = this.structuralTail;
|
|
2811
|
+
if (!tail) return;
|
|
2812
|
+
const visible = visibleWebLayoutItems(
|
|
2813
|
+
tail.layout,
|
|
2814
|
+
this.currentOffset(),
|
|
2815
|
+
this.viewportLength(),
|
|
2816
|
+
this.viewportLength() * OVERSCAN_VIEWPORTS
|
|
2817
|
+
).filter((item) => item.index >= tail.firstIndex);
|
|
2818
|
+
const desired = new Set(visible.map((item) => item.index));
|
|
2819
|
+
tail.mounted.forEach((element, index) => {
|
|
2820
|
+
if (desired.has(index)) return;
|
|
2821
|
+
disposeWebImageRetries(element);
|
|
2822
|
+
element.remove();
|
|
2823
|
+
tail.mounted.delete(index);
|
|
2824
|
+
});
|
|
2825
|
+
visible.forEach((item) => {
|
|
2826
|
+
if (tail.mounted.has(item.index)) return;
|
|
2827
|
+
const row = tail.rows[item.index];
|
|
2828
|
+
if (!row) return;
|
|
2829
|
+
const element = createElement(
|
|
2830
|
+
this.document,
|
|
2831
|
+
'div',
|
|
2832
|
+
'ok-native-list-item'
|
|
2833
|
+
);
|
|
2834
|
+
element.setAttribute('aria-hidden', 'true');
|
|
2835
|
+
element.style.pointerEvents = 'none';
|
|
2836
|
+
element.style.opacity = String(
|
|
2837
|
+
(row.style?.container?.opacity ?? row.opacity ?? 1) *
|
|
2838
|
+
(row.disabled ? 0.5 : 1)
|
|
2839
|
+
);
|
|
2840
|
+
const body = createRowBody(
|
|
2841
|
+
{
|
|
2842
|
+
document: this.document,
|
|
2843
|
+
snapshot: tail.snapshot,
|
|
2844
|
+
selectedKeys: selectionStateFromSnapshot(tail.snapshot).selectedKeys,
|
|
2845
|
+
itemIndex: item.index,
|
|
2846
|
+
},
|
|
2847
|
+
row
|
|
2848
|
+
);
|
|
2849
|
+
applyRowStyle(body, row);
|
|
2850
|
+
element.append(body);
|
|
2851
|
+
this.positionElement(element, item);
|
|
2852
|
+
tail.layer.append(element);
|
|
2853
|
+
tail.mounted.set(item.index, element);
|
|
2854
|
+
});
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
private writeStructuralHeight(height: number) {
|
|
2858
|
+
if (this.externalScrollHost) this.writeExternalHeight(height);
|
|
2859
|
+
else this.content.style.height = `${height}px`;
|
|
2860
|
+
}
|
|
2861
|
+
|
|
2862
|
+
private reactFooterElement() {
|
|
2863
|
+
return this.contentBounds?.querySelector<HTMLElement>(
|
|
2864
|
+
'[data-testid="native-list-footer-slot"]'
|
|
2865
|
+
);
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
private readReactFooterHeight() {
|
|
2869
|
+
return this.reactFooterElement()?.getBoundingClientRect().height ?? 0;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
private applyStructuralFooterVisual(progress: number) {
|
|
2873
|
+
const footer = this.structuralFooterElement;
|
|
2874
|
+
if (!footer || this.structuralFooterExpansion <= 0) return;
|
|
2875
|
+
const hidden = this.structuralFooterExpansion * (1 - progress);
|
|
2876
|
+
footer.style.marginBottom = `${-hidden}px`;
|
|
2877
|
+
footer.style.transform = `translateY(${-hidden}px)`;
|
|
2878
|
+
footer.style.clipPath = `inset(${hidden}px 0 0 0)`;
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
private applyStructuralSnapshot(
|
|
2882
|
+
next: NativeListSnapshot,
|
|
2883
|
+
transition: NonNullable<NativeListSnapshot['structuralTransition']>
|
|
2884
|
+
) {
|
|
2885
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2886
|
+
const oldOffset = owner.scrollTop;
|
|
2887
|
+
const oldScrollHeight = owner.scrollHeight;
|
|
2888
|
+
const oldHeight =
|
|
2889
|
+
this.structuralRenderedHeight ??
|
|
2890
|
+
(this.content.getBoundingClientRect().height ||
|
|
2891
|
+
this.layout.contentHeight);
|
|
2892
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
2893
|
+
const oldFooterHeight =
|
|
2894
|
+
this.structuralRenderedHeight === undefined
|
|
2895
|
+
? this.reactFooterHeight
|
|
2896
|
+
: this.structuralFooterFromHeight +
|
|
2897
|
+
(this.reactFooterHeight - this.structuralFooterFromHeight) *
|
|
2898
|
+
this.structuralProgress;
|
|
2899
|
+
const footerDifference = oldFooterHeight - nextFooterHeight;
|
|
2900
|
+
const startHeight = oldHeight + Math.max(0, footerDifference);
|
|
2901
|
+
const oldSnapshot = this.snapshot;
|
|
2902
|
+
const oldRows = this.rows;
|
|
2903
|
+
const oldLayout = this.layout;
|
|
2904
|
+
const oldItems = oldLayout.items;
|
|
2905
|
+
const nextRows = effectiveRows(next);
|
|
2906
|
+
const prefixCount = Math.min(oldRows.length, nextRows.length);
|
|
2907
|
+
const prefixTailChange =
|
|
2908
|
+
oldSnapshot.layout.kind === next.layout.kind &&
|
|
2909
|
+
oldSnapshot.layout.orientation === next.layout.orientation &&
|
|
2910
|
+
oldRows.length !== nextRows.length &&
|
|
2911
|
+
oldRows
|
|
2912
|
+
.slice(0, prefixCount)
|
|
2913
|
+
.every((row, index) => row.key === nextRows[index]?.key);
|
|
2914
|
+
const oldPositions = new Map<string, number>();
|
|
2915
|
+
this.mounted.forEach((element, index) => {
|
|
2916
|
+
const row = this.rows[index];
|
|
2917
|
+
if (row) oldPositions.set(row.key, element.getBoundingClientRect().top);
|
|
2918
|
+
});
|
|
2919
|
+
const nextKeys = new Set(effectiveRows(next).map((row) => row.key));
|
|
2920
|
+
const visibleOffset = this.currentOffset();
|
|
2921
|
+
const visibleSurvivor = oldItems.find(
|
|
2922
|
+
(item) => item.y + item.height > visibleOffset && nextKeys.has(item.key)
|
|
2923
|
+
);
|
|
2924
|
+
const anchor = visibleSurvivor;
|
|
2925
|
+
this.cancelStructuralAnimation();
|
|
2926
|
+
this.structuralScrollInterrupted = false;
|
|
2927
|
+
this.structuralAnchorStyles = {
|
|
2928
|
+
owner: owner.style.overflowAnchor,
|
|
2929
|
+
content: this.content.style.overflowAnchor,
|
|
2930
|
+
};
|
|
2931
|
+
owner.style.overflowAnchor = 'none';
|
|
2932
|
+
this.content.style.overflowAnchor = 'none';
|
|
2933
|
+
this.structuralContentOverflow = this.content.style.overflow;
|
|
2934
|
+
if (prefixTailChange) this.content.style.overflow = 'clip';
|
|
2935
|
+
this.structuralRenderedHeight = startHeight;
|
|
2936
|
+
this.structuralFooterFromHeight = oldFooterHeight;
|
|
2937
|
+
this.structuralFooterCompensation = Math.max(0, footerDifference);
|
|
2938
|
+
this.structuralFooterExpansion = Math.max(0, -footerDifference);
|
|
2939
|
+
this.structuralProgress = 0;
|
|
2940
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
2941
|
+
this.structuralFooterElement = this.reactFooterElement() ?? undefined;
|
|
2942
|
+
if (this.structuralFooterElement) {
|
|
2943
|
+
const style = this.structuralFooterElement.style;
|
|
2944
|
+
this.structuralFooterStyles = {
|
|
2945
|
+
marginBottom: style.marginBottom,
|
|
2946
|
+
transform: style.transform,
|
|
2947
|
+
clipPath: style.clipPath,
|
|
2948
|
+
};
|
|
2949
|
+
this.applyStructuralFooterVisual(0);
|
|
2950
|
+
}
|
|
2951
|
+
this.setSnapshot(next);
|
|
2952
|
+
const newHeight = this.layout.contentHeight;
|
|
2953
|
+
this.structuralTargetHeight = newHeight;
|
|
2954
|
+
const stablePrefixGeometry =
|
|
2955
|
+
prefixTailChange &&
|
|
2956
|
+
oldItems.length === oldRows.length &&
|
|
2957
|
+
this.layout.items.length === nextRows.length &&
|
|
2958
|
+
oldItems.slice(0, prefixCount).every((item, index) => {
|
|
2959
|
+
const nextItem = this.layout.items[index];
|
|
2960
|
+
return (
|
|
2961
|
+
nextItem?.y === item.y &&
|
|
2962
|
+
nextItem?.height === item.height &&
|
|
2963
|
+
nextItem?.width === item.width
|
|
2964
|
+
);
|
|
2965
|
+
});
|
|
2966
|
+
if (!stablePrefixGeometry) {
|
|
2967
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
2968
|
+
this.structuralContentOverflow = undefined;
|
|
2969
|
+
} else {
|
|
2970
|
+
this.structuralPrefixTransition = true;
|
|
2971
|
+
}
|
|
2972
|
+
if (stablePrefixGeometry && nextRows.length < oldRows.length) {
|
|
2973
|
+
const layer = createElement(
|
|
2974
|
+
this.document,
|
|
2975
|
+
'div',
|
|
2976
|
+
'ok-native-list-structural-tail'
|
|
2977
|
+
);
|
|
2978
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
2979
|
+
layer.setAttribute('inert', '');
|
|
2980
|
+
Object.assign(layer.style, {
|
|
2981
|
+
position: 'absolute',
|
|
2982
|
+
inset: '0',
|
|
2983
|
+
pointerEvents: 'none',
|
|
2984
|
+
});
|
|
2985
|
+
this.content.append(layer);
|
|
2986
|
+
this.structuralTail = {
|
|
2987
|
+
snapshot: oldSnapshot,
|
|
2988
|
+
rows: oldRows,
|
|
2989
|
+
layout: oldLayout,
|
|
2990
|
+
firstIndex: prefixCount,
|
|
2991
|
+
layer,
|
|
2992
|
+
mounted: new Map(),
|
|
2993
|
+
};
|
|
2994
|
+
this.updateStructuralTailWindow();
|
|
2995
|
+
}
|
|
2996
|
+
const nextAnchor =
|
|
2997
|
+
anchor && this.layout.items.find((item) => item.key === anchor.key);
|
|
2998
|
+
const delta = nextAnchor && anchor ? nextAnchor.y - anchor.y : 0;
|
|
2999
|
+
let finalScrollHeight = oldScrollHeight + newHeight - oldHeight;
|
|
3000
|
+
if (stablePrefixGeometry && this.externalScrollHost) {
|
|
3001
|
+
const beforeMeasure = owner.scrollTop;
|
|
3002
|
+
const tailLayer = this.structuralTail?.layer;
|
|
3003
|
+
if (tailLayer) tailLayer.style.display = 'none';
|
|
3004
|
+
this.writeStructuralHeight(newHeight);
|
|
3005
|
+
this.applyStructuralFooterVisual(1);
|
|
3006
|
+
finalScrollHeight = owner.scrollHeight;
|
|
3007
|
+
this.writeStructuralHeight(startHeight);
|
|
3008
|
+
this.applyStructuralFooterVisual(0);
|
|
3009
|
+
if (tailLayer) tailLayer.style.display = '';
|
|
3010
|
+
owner.scrollTop = beforeMeasure;
|
|
3011
|
+
}
|
|
3012
|
+
const finalMaxOffset = Math.max(0, finalScrollHeight - owner.clientHeight);
|
|
3013
|
+
let targetOffset = Math.max(0, Math.min(oldOffset + delta, finalMaxOffset));
|
|
3014
|
+
if (
|
|
3015
|
+
!visibleSurvivor &&
|
|
3016
|
+
transition.anchorKey &&
|
|
3017
|
+
!(stablePrefixGeometry && nextRows.length > oldRows.length)
|
|
3018
|
+
) {
|
|
3019
|
+
const fallback = this.layout.items.find(
|
|
3020
|
+
(item) => item.key === transition.anchorKey
|
|
3021
|
+
);
|
|
3022
|
+
if (fallback) {
|
|
3023
|
+
const pagerStickyInset = Number.parseFloat(
|
|
3024
|
+
this.externalScrollHost?.style.getPropertyValue(
|
|
3025
|
+
'--ok-collapsible-pager-sticky-inset'
|
|
3026
|
+
) ?? ''
|
|
3027
|
+
);
|
|
3028
|
+
const effectiveStickyInset = Math.max(
|
|
3029
|
+
this.externalStickyInset,
|
|
3030
|
+
Number.isFinite(pagerStickyInset) ? pagerStickyInset : 0
|
|
3031
|
+
);
|
|
3032
|
+
const fallbackTop = this.externalScrollHost
|
|
3033
|
+
? this.externalGeometry().origin + fallback.y - effectiveStickyInset
|
|
3034
|
+
: resolveWebCollapsiblePagerRawOffset(
|
|
3035
|
+
Math.max(0, fallback.y - this.collapsiblePagerInsets().sticky),
|
|
3036
|
+
this.collapsiblePagerInsets().header
|
|
3037
|
+
);
|
|
3038
|
+
if (
|
|
3039
|
+
stablePrefixGeometry &&
|
|
3040
|
+
this.externalScrollHost &&
|
|
3041
|
+
this.reactFooterHeight > 0
|
|
3042
|
+
) {
|
|
3043
|
+
const footerTop = this.externalGeometry().origin + newHeight;
|
|
3044
|
+
const footerStart = Math.max(
|
|
3045
|
+
0,
|
|
3046
|
+
footerTop + this.reactFooterHeight - owner.clientHeight
|
|
3047
|
+
);
|
|
3048
|
+
const footerEnd = Math.max(0, footerTop - effectiveStickyInset);
|
|
3049
|
+
const nearestVisibleOffset =
|
|
3050
|
+
footerStart <= footerEnd
|
|
3051
|
+
? Math.max(footerStart, Math.min(oldOffset, footerEnd))
|
|
3052
|
+
: footerEnd;
|
|
3053
|
+
targetOffset = Math.max(
|
|
3054
|
+
0,
|
|
3055
|
+
Math.min(nearestVisibleOffset, finalMaxOffset)
|
|
3056
|
+
);
|
|
3057
|
+
} else {
|
|
3058
|
+
targetOffset = Math.min(targetOffset, Math.max(0, fallbackTop));
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
const duration = transition.durationMs ?? 220;
|
|
3063
|
+
const easing = 'cubic-bezier(0.42, 0, 0.58, 1)';
|
|
3064
|
+
this.mounted.forEach((element, index) => {
|
|
3065
|
+
const row = this.rows[index];
|
|
3066
|
+
const previousTop = row && oldPositions.get(row.key);
|
|
3067
|
+
if (previousTop === undefined || typeof element.animate !== 'function')
|
|
3068
|
+
return;
|
|
3069
|
+
const offset = previousTop - element.getBoundingClientRect().top;
|
|
3070
|
+
if (Math.abs(offset) < 0.5) return;
|
|
3071
|
+
this.structuralAnimations.push(
|
|
3072
|
+
element.animate(
|
|
3073
|
+
[
|
|
3074
|
+
{ transform: `translateY(${offset}px)` },
|
|
3075
|
+
{ transform: 'translateY(0)' },
|
|
3076
|
+
],
|
|
3077
|
+
{ duration, easing }
|
|
3078
|
+
)
|
|
3079
|
+
);
|
|
3080
|
+
});
|
|
3081
|
+
const startedAt =
|
|
3082
|
+
this.document.defaultView?.performance.now() ?? Date.now();
|
|
3083
|
+
const revision = this.structuralRevision;
|
|
3084
|
+
const finish = () => {
|
|
3085
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
3086
|
+
const ownsScroll = !this.structuralScrollInterrupted;
|
|
3087
|
+
this.cancelStructuralAnimation();
|
|
3088
|
+
this.recomputeLayout();
|
|
3089
|
+
if (stablePrefixGeometry && ownsScroll) {
|
|
3090
|
+
owner.scrollTop = Math.max(
|
|
3091
|
+
0,
|
|
3092
|
+
Math.min(targetOffset, owner.scrollHeight - owner.clientHeight)
|
|
3093
|
+
);
|
|
3094
|
+
}
|
|
3095
|
+
};
|
|
3096
|
+
const step = (time: number) => {
|
|
3097
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
3098
|
+
if (
|
|
3099
|
+
this.structuralPrefixTransition &&
|
|
3100
|
+
this.document.defaultView?.matchMedia?.(
|
|
3101
|
+
'(prefers-reduced-motion: reduce)'
|
|
3102
|
+
).matches
|
|
3103
|
+
) {
|
|
3104
|
+
finish();
|
|
3105
|
+
return;
|
|
3106
|
+
}
|
|
3107
|
+
const progress = Math.min(1, (time - startedAt) / duration);
|
|
3108
|
+
const eased = progress * progress * (3 - 2 * progress);
|
|
3109
|
+
this.structuralProgress = eased;
|
|
3110
|
+
const renderedHeight =
|
|
3111
|
+
oldHeight +
|
|
3112
|
+
((this.structuralTargetHeight ?? newHeight) - oldHeight) * eased +
|
|
3113
|
+
this.structuralFooterCompensation * (1 - eased);
|
|
3114
|
+
this.structuralRenderedHeight = renderedHeight;
|
|
3115
|
+
this.writeStructuralHeight(renderedHeight);
|
|
3116
|
+
this.applyStructuralFooterVisual(eased);
|
|
3117
|
+
if (!this.structuralScrollInterrupted)
|
|
3118
|
+
owner.scrollTop = oldOffset + (targetOffset - oldOffset) * eased;
|
|
3119
|
+
this.externalGeometryCache = undefined;
|
|
3120
|
+
this.updateStructuralTailWindow();
|
|
3121
|
+
if (progress < 1)
|
|
3122
|
+
this.structuralFrame =
|
|
3123
|
+
this.document.defaultView?.requestAnimationFrame(step);
|
|
3124
|
+
};
|
|
3125
|
+
this.structuralFrame =
|
|
3126
|
+
this.document.defaultView?.requestAnimationFrame(step);
|
|
3127
|
+
this.structuralFinish = this.document.defaultView?.setTimeout(
|
|
3128
|
+
finish,
|
|
3129
|
+
duration + 40
|
|
3130
|
+
);
|
|
2462
3131
|
}
|
|
2463
3132
|
|
|
2464
3133
|
currentContentHeight(): number {
|
|
@@ -2663,6 +3332,8 @@ export class NativeListWebEngine {
|
|
|
2663
3332
|
|
|
2664
3333
|
destroy() {
|
|
2665
3334
|
if (this.destroyed) return;
|
|
3335
|
+
this.cancelStructuralAnimation();
|
|
3336
|
+
this.pressedHelpElement = undefined;
|
|
2666
3337
|
this.invalidateActionAnchor('destroy');
|
|
2667
3338
|
this.destroyed = true;
|
|
2668
3339
|
if (this.frameHandle !== undefined) this.cancelFrame(this.frameHandle);
|
|
@@ -2690,6 +3361,11 @@ export class NativeListWebEngine {
|
|
|
2690
3361
|
'ok-collapsible-pager-cancel-scroll-command',
|
|
2691
3362
|
this.handlePagerScrollCommandCancel
|
|
2692
3363
|
);
|
|
3364
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart'])
|
|
3365
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
3366
|
+
event,
|
|
3367
|
+
this.handleStructuralUserScroll
|
|
3368
|
+
);
|
|
2693
3369
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
2694
3370
|
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
2695
3371
|
'ok-collapsible-pager-insets-changed',
|
|
@@ -2704,6 +3380,10 @@ export class NativeListWebEngine {
|
|
|
2704
3380
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
2705
3381
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
2706
3382
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
3383
|
+
this.root.removeEventListener(
|
|
3384
|
+
'pointerdown',
|
|
3385
|
+
this.handleIconHelpPointerDown
|
|
3386
|
+
);
|
|
2707
3387
|
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
2708
3388
|
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
2709
3389
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -2766,6 +3446,7 @@ export class NativeListWebEngine {
|
|
|
2766
3446
|
selectedKeys?: ReadonlySet<string>
|
|
2767
3447
|
) {
|
|
2768
3448
|
this.cancelMarketPointer();
|
|
3449
|
+
this.pressedHelpElement = undefined;
|
|
2769
3450
|
this.measuredRendererHeights.clear();
|
|
2770
3451
|
this.snapshot = snapshot;
|
|
2771
3452
|
this.rows = effectiveRows(snapshot);
|
|
@@ -2786,6 +3467,7 @@ export class NativeListWebEngine {
|
|
|
2786
3467
|
'--nl-row': theme.rowBackground,
|
|
2787
3468
|
'--nl-selected': theme.rowSelectedBackground,
|
|
2788
3469
|
'--nl-pressed': theme.rowPressedBackground,
|
|
3470
|
+
'--nl-hover': theme.rowHoverBackground ?? theme.rowPressedBackground,
|
|
2789
3471
|
'--nl-subdued': theme.subduedBackground,
|
|
2790
3472
|
'--nl-strong': theme.strongBackground,
|
|
2791
3473
|
'--nl-image-fallback-background':
|
|
@@ -2803,6 +3485,7 @@ export class NativeListWebEngine {
|
|
|
2803
3485
|
'--nl-separator': theme.separator,
|
|
2804
3486
|
'--nl-accent': theme.accent,
|
|
2805
3487
|
'--nl-positive': theme.positive,
|
|
3488
|
+
'--nl-success-background': theme.successBackground,
|
|
2806
3489
|
'--nl-negative': theme.negative,
|
|
2807
3490
|
'--nl-critical': theme.criticalBackground,
|
|
2808
3491
|
'--nl-inverse': theme.inverseBackground,
|
|
@@ -2890,13 +3573,37 @@ export class NativeListWebEngine {
|
|
|
2890
3573
|
|
|
2891
3574
|
private recomputeLayout = () => {
|
|
2892
3575
|
if (this.destroyed) return;
|
|
3576
|
+
if (
|
|
3577
|
+
this.structuralPrefixTransition &&
|
|
3578
|
+
this.lastViewportWidth > 0 &&
|
|
3579
|
+
this.viewport.clientWidth > 0 &&
|
|
3580
|
+
this.viewport.clientWidth !== this.lastViewportWidth
|
|
3581
|
+
)
|
|
3582
|
+
this.cancelStructuralAnimation();
|
|
3583
|
+
if (this.structuralRenderedHeight === undefined)
|
|
3584
|
+
this.reactFooterHeight = this.readReactFooterHeight();
|
|
3585
|
+
else {
|
|
3586
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
3587
|
+
const footerDelta = this.reactFooterHeight - nextFooterHeight;
|
|
3588
|
+
if (footerDelta !== 0) {
|
|
3589
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
3590
|
+
const priorCompensation = this.structuralFooterCompensation;
|
|
3591
|
+
const difference = this.structuralFooterFromHeight - nextFooterHeight;
|
|
3592
|
+
this.structuralFooterCompensation = Math.max(0, difference);
|
|
3593
|
+
this.structuralFooterExpansion = Math.max(0, -difference);
|
|
3594
|
+
this.structuralRenderedHeight +=
|
|
3595
|
+
(this.structuralFooterCompensation - priorCompensation) *
|
|
3596
|
+
(1 - this.structuralProgress);
|
|
3597
|
+
this.applyStructuralFooterVisual(this.structuralProgress);
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
2893
3600
|
const cachedWidth = this.lastViewportWidth;
|
|
2894
3601
|
const cachedHeight = this.lastViewportHeight;
|
|
2895
3602
|
const precomputedLayout =
|
|
2896
3603
|
this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0
|
|
2897
3604
|
? this.computeLayout(cachedWidth, cachedHeight)
|
|
2898
3605
|
: undefined;
|
|
2899
|
-
if (precomputedLayout) {
|
|
3606
|
+
if (precomputedLayout && this.structuralRenderedHeight === undefined) {
|
|
2900
3607
|
// Commit appended row extent before measuring React-owned slot changes.
|
|
2901
3608
|
this.writeExternalHeight(
|
|
2902
3609
|
Math.max(this.layout.contentHeight, precomputedLayout.contentHeight)
|
|
@@ -2949,11 +3656,15 @@ export class NativeListWebEngine {
|
|
|
2949
3656
|
? precomputedLayout
|
|
2950
3657
|
: this.computeLayout(viewportWidth, viewportHeight);
|
|
2951
3658
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
2952
|
-
|
|
3659
|
+
const renderedHeight =
|
|
3660
|
+
this.structuralRenderedHeight ?? this.layout.contentHeight;
|
|
3661
|
+
this.content.style.height = String(renderedHeight) + 'px';
|
|
2953
3662
|
if (this.externalScrollHost) {
|
|
2954
|
-
this.writeExternalHeight(
|
|
3663
|
+
this.writeExternalHeight(renderedHeight);
|
|
2955
3664
|
this.externalGeometryCache = undefined;
|
|
2956
3665
|
}
|
|
3666
|
+
if (this.structuralRenderedHeight !== undefined)
|
|
3667
|
+
this.structuralTargetHeight = this.layout.contentHeight;
|
|
2957
3668
|
this.renderSectionIndex(
|
|
2958
3669
|
this.viewport.clientHeight <= 0
|
|
2959
3670
|
? DEFAULT_VIEWPORT_HEIGHT
|
|
@@ -3114,6 +3825,7 @@ export class NativeListWebEngine {
|
|
|
3114
3825
|
}
|
|
3115
3826
|
this.updateVisibleSelection();
|
|
3116
3827
|
this.updateVisibleState();
|
|
3828
|
+
this.updateStructuralTailWindow();
|
|
3117
3829
|
}
|
|
3118
3830
|
|
|
3119
3831
|
private positionElement(element: HTMLElement, item: WebLayoutItem) {
|
|
@@ -3192,7 +3904,7 @@ export class NativeListWebEngine {
|
|
|
3192
3904
|
const body = reusableBody ?? createRowBody(context, row);
|
|
3193
3905
|
if (reusableBody) {
|
|
3194
3906
|
resetRowContainerStyle(body);
|
|
3195
|
-
registered.bind(body, rendererPrimitives(context));
|
|
3907
|
+
registered.bind(body, rendererPrimitives(context, Boolean(row.disabled)));
|
|
3196
3908
|
}
|
|
3197
3909
|
// OneKey patch: explicit selector fields preserve original page geometry.
|
|
3198
3910
|
element.style.contain = row.backgroundFullWidth ? 'layout style' : '';
|
|
@@ -3984,6 +4696,8 @@ export class NativeListWebEngine {
|
|
|
3984
4696
|
}
|
|
3985
4697
|
|
|
3986
4698
|
private invalidateActionAnchorForElement(element: HTMLElement) {
|
|
4699
|
+
if (this.pressedHelpElement && element.contains(this.pressedHelpElement))
|
|
4700
|
+
this.pressedHelpElement = undefined;
|
|
3987
4701
|
const anchor = this.actionAnchor;
|
|
3988
4702
|
if (
|
|
3989
4703
|
anchor &&
|
|
@@ -4096,9 +4810,13 @@ export class NativeListWebEngine {
|
|
|
4096
4810
|
'[data-native-list-row-key]'
|
|
4097
4811
|
);
|
|
4098
4812
|
const row = this.rowAtElement(rowElement);
|
|
4099
|
-
if (
|
|
4813
|
+
if (
|
|
4814
|
+
(row?.type !== 'market' && row?.type !== 'identity') ||
|
|
4815
|
+
!isRowPressEnabled(row)
|
|
4816
|
+
)
|
|
4817
|
+
return;
|
|
4100
4818
|
this.cancelMarketPointer();
|
|
4101
|
-
if (row.pressInActionKey)
|
|
4819
|
+
if (row.type === 'market' && row.pressInActionKey)
|
|
4102
4820
|
this.emitRowAction(
|
|
4103
4821
|
row,
|
|
4104
4822
|
row.pressInActionKey,
|
|
@@ -4117,7 +4835,7 @@ export class NativeListWebEngine {
|
|
|
4117
4835
|
!rowElement.isConnected ||
|
|
4118
4836
|
rowElement.dataset.nativeListBindingEpoch !== bindingEpoch ||
|
|
4119
4837
|
currentRow?.key !== row.key ||
|
|
4120
|
-
currentRow.type !== 'market' ||
|
|
4838
|
+
(currentRow.type !== 'market' && currentRow.type !== 'identity') ||
|
|
4121
4839
|
!isRowPressEnabled(currentRow) ||
|
|
4122
4840
|
!currentRow.longPressActionKey
|
|
4123
4841
|
)
|
|
@@ -4135,7 +4853,7 @@ export class NativeListWebEngine {
|
|
|
4135
4853
|
this.marketPointer = {
|
|
4136
4854
|
pointerId: event.pointerId,
|
|
4137
4855
|
pointerType: event.pointerType,
|
|
4138
|
-
compact: !row.webTable,
|
|
4856
|
+
compact: row.type === 'identity' || !row.webTable,
|
|
4139
4857
|
rowKey: row.key,
|
|
4140
4858
|
startX: event.clientX,
|
|
4141
4859
|
startY: event.clientY,
|
|
@@ -4203,11 +4921,23 @@ export class NativeListWebEngine {
|
|
|
4203
4921
|
action.contains(event.relatedTarget))
|
|
4204
4922
|
)
|
|
4205
4923
|
return;
|
|
4924
|
+
if (action.dataset.nativeListIconHelp === 'true') {
|
|
4925
|
+
if (
|
|
4926
|
+
event.type === 'pointerover' &&
|
|
4927
|
+
(event as PointerEvent).pointerType === 'touch'
|
|
4928
|
+
)
|
|
4929
|
+
return;
|
|
4930
|
+
if (this.pressedHelpElement === action) return;
|
|
4931
|
+
}
|
|
4206
4932
|
if (
|
|
4207
4933
|
action.classList.contains('ok-native-list-market-subtitle-prefix') &&
|
|
4208
4934
|
action.scrollWidth <= action.clientWidth + 1
|
|
4209
4935
|
)
|
|
4210
4936
|
return;
|
|
4937
|
+
this.emitHoverAction(action);
|
|
4938
|
+
};
|
|
4939
|
+
|
|
4940
|
+
private emitHoverAction(action: HTMLElement) {
|
|
4211
4941
|
const rowElement = action.closest<HTMLElement>(
|
|
4212
4942
|
'[data-native-list-row-key]'
|
|
4213
4943
|
);
|
|
@@ -4229,6 +4959,24 @@ export class NativeListWebEngine {
|
|
|
4229
4959
|
// WalletGroup), not the enclosing row's `disabled`.
|
|
4230
4960
|
if (sourceRow && !sourceRow.disabled && actionKey)
|
|
4231
4961
|
this.emitRowAction(sourceRow, actionKey, action, rowElement ?? undefined);
|
|
4962
|
+
}
|
|
4963
|
+
|
|
4964
|
+
private handleIconHelpPointerDown = (event: PointerEvent) => {
|
|
4965
|
+
const target = event.target;
|
|
4966
|
+
if (!(target instanceof Element)) return;
|
|
4967
|
+
const action = target.closest<HTMLElement>(
|
|
4968
|
+
'[data-native-list-icon-help="true"]'
|
|
4969
|
+
);
|
|
4970
|
+
if (!action) return;
|
|
4971
|
+
if (event.pointerType === 'touch') {
|
|
4972
|
+
if (this.actionAnchor?.actionElement === action && this.actionAnchor.open)
|
|
4973
|
+
this.invalidateActionAnchor('pointerLeave');
|
|
4974
|
+
else this.emitHoverAction(action);
|
|
4975
|
+
} else {
|
|
4976
|
+
this.pressedHelpElement = action;
|
|
4977
|
+
if (this.actionAnchor?.actionElement === action)
|
|
4978
|
+
this.invalidateActionAnchor('pointerLeave');
|
|
4979
|
+
}
|
|
4232
4980
|
};
|
|
4233
4981
|
|
|
4234
4982
|
private handleTitlePointerOut = (event: PointerEvent | FocusEvent) => {
|
|
@@ -4243,6 +4991,14 @@ export class NativeListWebEngine {
|
|
|
4243
4991
|
action.contains(event.relatedTarget))
|
|
4244
4992
|
)
|
|
4245
4993
|
return;
|
|
4994
|
+
if (
|
|
4995
|
+
action.dataset.nativeListIconHelp === 'true' &&
|
|
4996
|
+
event.type === 'pointerout' &&
|
|
4997
|
+
(event as PointerEvent).pointerType === 'touch'
|
|
4998
|
+
)
|
|
4999
|
+
return;
|
|
5000
|
+
if (event.type === 'pointerout' && this.pressedHelpElement === action)
|
|
5001
|
+
this.pressedHelpElement = undefined;
|
|
4246
5002
|
if (this.actionAnchor?.actionElement === action)
|
|
4247
5003
|
this.invalidateActionAnchor('pointerLeave');
|
|
4248
5004
|
};
|
|
@@ -4256,6 +5012,11 @@ export class NativeListWebEngine {
|
|
|
4256
5012
|
}
|
|
4257
5013
|
const target = event.target;
|
|
4258
5014
|
if (!(target instanceof Element)) return;
|
|
5015
|
+
if (target.closest('[data-native-list-icon-help="true"]')) {
|
|
5016
|
+
event.preventDefault();
|
|
5017
|
+
event.stopPropagation();
|
|
5018
|
+
return;
|
|
5019
|
+
}
|
|
4259
5020
|
const rowElement = target.closest<HTMLElement>(
|
|
4260
5021
|
'[data-native-list-row-key]'
|
|
4261
5022
|
);
|
|
@@ -4276,6 +5037,10 @@ export class NativeListWebEngine {
|
|
|
4276
5037
|
// member press is blocked by `isRowPressEnabled` in `handleRowPress`.
|
|
4277
5038
|
const action = target.closest<HTMLElement>('[data-native-list-action]');
|
|
4278
5039
|
if (action) {
|
|
5040
|
+
if (action.tagName === 'BUTTON' && action.hasAttribute('disabled'))
|
|
5041
|
+
return;
|
|
5042
|
+
if (action.classList.contains('ok-native-list-trailing-button'))
|
|
5043
|
+
event.stopPropagation();
|
|
4279
5044
|
const scope = action.dataset.selectionScope;
|
|
4280
5045
|
if (scope === 'row') this.activateSelection({ scope: 'row' }, row);
|
|
4281
5046
|
else if (scope === 'section' && action.dataset.selectionKey)
|
|
@@ -4301,6 +5066,19 @@ export class NativeListWebEngine {
|
|
|
4301
5066
|
};
|
|
4302
5067
|
|
|
4303
5068
|
private handleKeyDown = (event: KeyboardEvent) => {
|
|
5069
|
+
if (
|
|
5070
|
+
(event.key === 'Enter' || event.key === ' ') &&
|
|
5071
|
+
event.target instanceof HTMLElement &&
|
|
5072
|
+
event.target.matches('[role="button"][data-native-list-hover-action]')
|
|
5073
|
+
) {
|
|
5074
|
+
event.preventDefault();
|
|
5075
|
+
if (
|
|
5076
|
+
this.actionAnchor?.actionElement !== event.target ||
|
|
5077
|
+
!this.actionAnchor.open
|
|
5078
|
+
)
|
|
5079
|
+
this.emitHoverAction(event.target);
|
|
5080
|
+
return;
|
|
5081
|
+
}
|
|
4304
5082
|
// OneKey patch: non-button title help supports keyboard activation.
|
|
4305
5083
|
if (
|
|
4306
5084
|
(event.key === 'Enter' || event.key === ' ') &&
|
|
@@ -4438,6 +5216,7 @@ export class NativeListWebEngine {
|
|
|
4438
5216
|
|
|
4439
5217
|
private handleScroll = () => {
|
|
4440
5218
|
this.externalGeometryCache = undefined;
|
|
5219
|
+
this.pressedHelpElement = undefined;
|
|
4441
5220
|
this.cancelMarketPointer();
|
|
4442
5221
|
this.invalidateActionAnchor('scroll');
|
|
4443
5222
|
this.scheduleFrame();
|