@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
|
@@ -60,7 +60,13 @@ import {
|
|
|
60
60
|
validateOffset,
|
|
61
61
|
type NormalizedPositionScroll,
|
|
62
62
|
} from '../scrolling';
|
|
63
|
-
import {
|
|
63
|
+
import {
|
|
64
|
+
applyRowPatches,
|
|
65
|
+
containNativeListInput,
|
|
66
|
+
emptyNativeListSnapshot,
|
|
67
|
+
validatePatches,
|
|
68
|
+
validateSnapshot,
|
|
69
|
+
} from '../validation';
|
|
64
70
|
import { avatarPrefetchWindow } from '../avatarPrefetch';
|
|
65
71
|
import {
|
|
66
72
|
acquireNativeListAvatar,
|
|
@@ -795,7 +801,7 @@ export const WEB_LIST_CSS = `
|
|
|
795
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}
|
|
796
802
|
|
|
797
803
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
798
|
-
.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)}
|
|
799
805
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
800
806
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
801
807
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
@@ -806,7 +812,7 @@ export const WEB_LIST_CSS = `
|
|
|
806
812
|
.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
807
813
|
.ok-native-list-item[data-native-list-disabled="true"]>.ok-native-list-row{cursor:default}
|
|
808
814
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]>.ok-native-list-row{cursor:pointer}
|
|
809
|
-
.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)}
|
|
810
816
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-row{background:var(--nl-pressed)}
|
|
811
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)}
|
|
812
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)}
|
|
@@ -837,16 +843,23 @@ export const WEB_LIST_CSS = `
|
|
|
837
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)}
|
|
838
844
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
839
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}
|
|
840
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)}
|
|
841
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)}
|
|
842
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}
|
|
843
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}
|
|
844
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}
|
|
845
|
-
.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}
|
|
846
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)}}
|
|
847
|
-
.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)}
|
|
848
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}
|
|
849
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}
|
|
850
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)}
|
|
851
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}
|
|
852
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)}
|
|
@@ -895,6 +908,7 @@ export const WEB_LIST_CSS = `
|
|
|
895
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)}
|
|
896
909
|
.ok-native-list-root [data-nl-container-border="true"]{position:relative}
|
|
897
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}
|
|
898
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)}
|
|
899
913
|
`;
|
|
900
914
|
|
|
@@ -1181,6 +1195,45 @@ const selectorIcons: Readonly<
|
|
|
1181
1195
|
}>
|
|
1182
1196
|
>
|
|
1183
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
|
+
},
|
|
1184
1237
|
CryptoCoinOutline: {
|
|
1185
1238
|
viewBox: '0 0 24 24',
|
|
1186
1239
|
paths: [
|
|
@@ -1480,6 +1533,7 @@ function applySelectorIcon(element: HTMLElement, name: string) {
|
|
|
1480
1533
|
|
|
1481
1534
|
function iconGlyph(name: string): string {
|
|
1482
1535
|
const normalized = name.toLocaleLowerCase();
|
|
1536
|
+
if (normalized === 'dotversolid') return '⋮';
|
|
1483
1537
|
if (normalized.includes('chevron')) {
|
|
1484
1538
|
if (normalized.includes('top')) return '⌃';
|
|
1485
1539
|
if (normalized.includes('bottom')) return '⌄';
|
|
@@ -1557,6 +1611,10 @@ function createVisual(
|
|
|
1557
1611
|
: visualBackground;
|
|
1558
1612
|
const fallbackIcon =
|
|
1559
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;
|
|
1560
1618
|
const handlesSourceFallback =
|
|
1561
1619
|
showsSourcePlaceholder &&
|
|
1562
1620
|
(fallbackIcon !== undefined || 'fallbackText' in visual);
|
|
@@ -1572,6 +1630,28 @@ function createVisual(
|
|
|
1572
1630
|
if (image.complete && image.naturalWidth > 0) restoreBackground();
|
|
1573
1631
|
}
|
|
1574
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
|
+
}
|
|
1575
1655
|
} else if (!source || showsSourcePlaceholder) {
|
|
1576
1656
|
frame.appendChild(
|
|
1577
1657
|
createElement(
|
|
@@ -1626,13 +1706,29 @@ function createVisual(
|
|
|
1626
1706
|
? visual.fallbackText ?? ''
|
|
1627
1707
|
: ''
|
|
1628
1708
|
);
|
|
1709
|
+
if (
|
|
1710
|
+
'fallbackTextColor' in visual &&
|
|
1711
|
+
visual.fallbackTextColor &&
|
|
1712
|
+
!fallbackIcon
|
|
1713
|
+
)
|
|
1714
|
+
fallback.style.color = visual.fallbackTextColor;
|
|
1629
1715
|
if (fallbackIcon) {
|
|
1630
1716
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1631
1717
|
if (fallbackIcon.tintColor)
|
|
1632
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
|
+
}
|
|
1633
1726
|
}
|
|
1634
|
-
|
|
1635
|
-
|
|
1727
|
+
if (fallbackIcon?.backgroundColor)
|
|
1728
|
+
frame.style.background = fallbackBackground;
|
|
1729
|
+
else
|
|
1730
|
+
fallback.style.backgroundColor =
|
|
1731
|
+
'var(--nl-image-fallback-background, transparent)';
|
|
1636
1732
|
frame.prepend(fallback);
|
|
1637
1733
|
};
|
|
1638
1734
|
if (image) image.addEventListener('error', showFallback, { once: true });
|
|
@@ -1642,6 +1738,9 @@ function createVisual(
|
|
|
1642
1738
|
frame.style.border =
|
|
1643
1739
|
'2px dashed ' + (visual.borderColor ?? 'var(--nl-disabled)');
|
|
1644
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';
|
|
1645
1744
|
}
|
|
1646
1745
|
if ('overlays' in visual)
|
|
1647
1746
|
visual.overlays?.forEach((overlay) => {
|
|
@@ -1671,6 +1770,16 @@ function createVisual(
|
|
|
1671
1770
|
corner.style.lineHeight = '16px';
|
|
1672
1771
|
applyTextWeight(corner, '400');
|
|
1673
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
|
+
);
|
|
1674
1783
|
if (
|
|
1675
1784
|
isWalletText ||
|
|
1676
1785
|
overlay.width !== undefined ||
|
|
@@ -1691,7 +1800,31 @@ function createVisual(
|
|
|
1691
1800
|
if (overlay.image) {
|
|
1692
1801
|
const overlayImage = createImage(context, overlay.image);
|
|
1693
1802
|
if (overlayImage) {
|
|
1803
|
+
if (
|
|
1804
|
+
(overlay.padding ?? 0) > 0 &&
|
|
1805
|
+
(overlay.width ?? size) === (overlay.height ?? size)
|
|
1806
|
+
)
|
|
1807
|
+
overlayImage.style.borderRadius = '50%';
|
|
1694
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
|
+
}
|
|
1695
1828
|
if (selectorPresentation)
|
|
1696
1829
|
paintSelectorImageBackground(
|
|
1697
1830
|
overlayImage,
|
|
@@ -1856,8 +1989,44 @@ function createAccessory(
|
|
|
1856
1989
|
context: RenderContext,
|
|
1857
1990
|
rowKey: string,
|
|
1858
1991
|
accessory: TrailingAccessory,
|
|
1859
|
-
slot: number
|
|
1992
|
+
slot: number,
|
|
1993
|
+
rowDisabled: boolean
|
|
1860
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
|
+
}
|
|
1861
2030
|
if (accessory.kind === 'checkbox') {
|
|
1862
2031
|
const element = createCheckbox(context, rowKey, accessory);
|
|
1863
2032
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
@@ -1872,9 +2041,21 @@ function createAccessory(
|
|
|
1872
2041
|
accessory.tintColor
|
|
1873
2042
|
);
|
|
1874
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
|
+
}
|
|
1875
2054
|
setData(element, 'testid', accessory.testID);
|
|
1876
2055
|
if (accessory.hoverActionKey)
|
|
1877
2056
|
setData(element, 'nativeListHoverAction', accessory.hoverActionKey);
|
|
2057
|
+
if (accessory.hoverActionKey && accessory.buttonStyle === 'tertiary')
|
|
2058
|
+
setData(element, 'nativeListIconHelp', true);
|
|
1878
2059
|
if (accessory.accessibilityLabel)
|
|
1879
2060
|
element.setAttribute('aria-label', accessory.accessibilityLabel);
|
|
1880
2061
|
const row = context.snapshot.rows[context.itemIndex];
|
|
@@ -1922,6 +2103,24 @@ function createAccessory(
|
|
|
1922
2103
|
accessory.primary
|
|
1923
2104
|
);
|
|
1924
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
|
+
if (help.presentation === 'tooltip') {
|
|
2112
|
+
setData(primary, 'nativeListHoverAction', help.actionKey);
|
|
2113
|
+
setData(primary, 'nativeListIconHelp', true);
|
|
2114
|
+
} else {
|
|
2115
|
+
setData(primary, 'nativeListAction', help.actionKey);
|
|
2116
|
+
primary.setAttribute('role', 'button');
|
|
2117
|
+
}
|
|
2118
|
+
if (help.underline === 'dashed') {
|
|
2119
|
+
primary.style.textDecoration = 'underline dashed';
|
|
2120
|
+
primary.style.textUnderlineOffset = '4px';
|
|
2121
|
+
}
|
|
2122
|
+
markActionAnchorSource(primary, 'trailingAccessory', slot);
|
|
2123
|
+
}
|
|
1925
2124
|
const secondary = createElement(
|
|
1926
2125
|
context.document,
|
|
1927
2126
|
'span',
|
|
@@ -1929,6 +2128,13 @@ function createAccessory(
|
|
|
1929
2128
|
accessory.secondary
|
|
1930
2129
|
);
|
|
1931
2130
|
secondary.style.color = toneColor(accessory.secondaryTone, 'secondary');
|
|
2131
|
+
applyValueSegments(
|
|
2132
|
+
secondary,
|
|
2133
|
+
accessory.secondaryTextSegments,
|
|
2134
|
+
14,
|
|
2135
|
+
20,
|
|
2136
|
+
400
|
|
2137
|
+
);
|
|
1932
2138
|
element.replaceChildren(primary, '\n', secondary);
|
|
1933
2139
|
element.classList.add('ok-native-list-amounts');
|
|
1934
2140
|
break;
|
|
@@ -1957,11 +2163,11 @@ function createAccessory(
|
|
|
1957
2163
|
return element;
|
|
1958
2164
|
}
|
|
1959
2165
|
|
|
1960
|
-
function rendererPrimitives(context: RenderContext) {
|
|
2166
|
+
function rendererPrimitives(context: RenderContext, rowDisabled: boolean) {
|
|
1961
2167
|
return {
|
|
1962
2168
|
background: resolvedTheme(context.snapshot).background,
|
|
1963
2169
|
accessory: (key: string, descriptor: TrailingAccessory, slot: number) =>
|
|
1964
|
-
createAccessory(context, key, descriptor, slot),
|
|
2170
|
+
createAccessory(context, key, descriptor, slot, rowDisabled),
|
|
1965
2171
|
visual: (source: LeadingVisual | undefined, presentation?: string) =>
|
|
1966
2172
|
createVisual(context, source, presentation),
|
|
1967
2173
|
thumbnail: (source: ImageSource) =>
|
|
@@ -1982,7 +2188,10 @@ export function createRowBody(
|
|
|
1982
2188
|
context: RenderContext,
|
|
1983
2189
|
row: RowModel
|
|
1984
2190
|
): HTMLElement {
|
|
1985
|
-
return rowRenderer(row).create(
|
|
2191
|
+
return rowRenderer(row).create(
|
|
2192
|
+
context.document,
|
|
2193
|
+
rendererPrimitives(context, Boolean(row.disabled))
|
|
2194
|
+
);
|
|
1986
2195
|
}
|
|
1987
2196
|
|
|
1988
2197
|
export type NativeListWebScrollOptions = Readonly<{
|
|
@@ -2031,6 +2240,7 @@ export class NativeListWebEngine {
|
|
|
2031
2240
|
rail: [],
|
|
2032
2241
|
mediaTile: [],
|
|
2033
2242
|
action: [],
|
|
2243
|
+
buttonGroup: [],
|
|
2034
2244
|
system: [],
|
|
2035
2245
|
activity: [],
|
|
2036
2246
|
dataRow: [],
|
|
@@ -2074,6 +2284,7 @@ export class NativeListWebEngine {
|
|
|
2074
2284
|
private pullDistance = 0;
|
|
2075
2285
|
private virtualizationEnabled: boolean;
|
|
2076
2286
|
private actionAnchor: WebActionAnchorRecord | undefined;
|
|
2287
|
+
private pressedHelpElement: HTMLElement | undefined;
|
|
2077
2288
|
private readonly actionAnchorInstanceId = String(
|
|
2078
2289
|
++webNativeListInstanceCounter
|
|
2079
2290
|
);
|
|
@@ -2094,6 +2305,26 @@ export class NativeListWebEngine {
|
|
|
2094
2305
|
private lastViewportWidth = -1;
|
|
2095
2306
|
private lastViewportHeight = -1;
|
|
2096
2307
|
private destroyed = false;
|
|
2308
|
+
private hasAppliedSnapshot = false;
|
|
2309
|
+
private lastStructuralTransitionId: string | undefined;
|
|
2310
|
+
private structuralFrame: number | undefined;
|
|
2311
|
+
private structuralFinish: number | undefined;
|
|
2312
|
+
private structuralAnimations: Animation[] = [];
|
|
2313
|
+
private structuralScrollInterrupted = false;
|
|
2314
|
+
private structuralRenderedHeight: number | undefined;
|
|
2315
|
+
private structuralTargetHeight: number | undefined;
|
|
2316
|
+
private reactFooterHeight = 0;
|
|
2317
|
+
private structuralFooterCompensation = 0;
|
|
2318
|
+
private structuralFooterExpansion = 0;
|
|
2319
|
+
private structuralFooterFromHeight = 0;
|
|
2320
|
+
private structuralFooterElement: HTMLElement | undefined;
|
|
2321
|
+
private structuralFooterStyles:
|
|
2322
|
+
| { marginBottom: string; transform: string; clipPath: string }
|
|
2323
|
+
| undefined;
|
|
2324
|
+
private structuralProgress = 0;
|
|
2325
|
+
private structuralAnchorStyles:
|
|
2326
|
+
| { owner: string; content: string }
|
|
2327
|
+
| undefined;
|
|
2097
2328
|
private sectionIndexAlignStart = false;
|
|
2098
2329
|
// Renderers report intrinsic height after browser text wrapping.
|
|
2099
2330
|
private measuredRendererHeights = new Map<
|
|
@@ -2160,7 +2391,9 @@ export class NativeListWebEngine {
|
|
|
2160
2391
|
scrollOptions.stickyInset
|
|
2161
2392
|
);
|
|
2162
2393
|
this.document = host.ownerDocument;
|
|
2163
|
-
this.snapshot =
|
|
2394
|
+
this.snapshot =
|
|
2395
|
+
containNativeListInput(() => validateSnapshot(snapshot)) ??
|
|
2396
|
+
emptyNativeListSnapshot();
|
|
2164
2397
|
this.callbacks = callbacks;
|
|
2165
2398
|
this.virtualizationEnabled = virtualizationEnabled;
|
|
2166
2399
|
this.sectionIndexContainer = sectionIndexContainer ?? undefined;
|
|
@@ -2263,6 +2496,12 @@ export class NativeListWebEngine {
|
|
|
2263
2496
|
'ok-collapsible-pager-cancel-scroll-command',
|
|
2264
2497
|
this.handlePagerScrollCommandCancel
|
|
2265
2498
|
);
|
|
2499
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart'])
|
|
2500
|
+
(this.externalScrollHost ?? this.viewport).addEventListener(
|
|
2501
|
+
event,
|
|
2502
|
+
this.handleStructuralUserScroll,
|
|
2503
|
+
{ passive: true }
|
|
2504
|
+
);
|
|
2266
2505
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
2267
2506
|
passive: true,
|
|
2268
2507
|
});
|
|
@@ -2281,6 +2520,7 @@ export class NativeListWebEngine {
|
|
|
2281
2520
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
2282
2521
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
2283
2522
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
2523
|
+
this.root.addEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
2284
2524
|
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
2285
2525
|
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
2286
2526
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -2442,14 +2682,243 @@ export class NativeListWebEngine {
|
|
|
2442
2682
|
}
|
|
2443
2683
|
|
|
2444
2684
|
applySnapshot(snapshot: NativeListSnapshot) {
|
|
2445
|
-
const validated =
|
|
2685
|
+
const validated = containNativeListInput(() => {
|
|
2686
|
+
const next = validateSnapshot(snapshot);
|
|
2687
|
+
if (this.externalScrollHost && next.layout.orientation === 'horizontal')
|
|
2688
|
+
throw new Error('External scrolling supports vertical lists only');
|
|
2689
|
+
return next;
|
|
2690
|
+
});
|
|
2691
|
+
if (!validated) return;
|
|
2692
|
+
this.pressedHelpElement = undefined;
|
|
2693
|
+
this.invalidateActionAnchor('snapshot');
|
|
2694
|
+
const transition = validated.structuralTransition;
|
|
2695
|
+
const isNewTransition =
|
|
2696
|
+
transition !== undefined &&
|
|
2697
|
+
transition.id !== this.lastStructuralTransitionId;
|
|
2698
|
+
if (transition) this.lastStructuralTransitionId = transition.id;
|
|
2699
|
+
const nextRows = effectiveRows(validated);
|
|
2700
|
+
const changedKeys =
|
|
2701
|
+
this.rows.length !== nextRows.length ||
|
|
2702
|
+
this.rows.some((row, index) => row.key !== nextRows[index]?.key);
|
|
2703
|
+
const shouldAnimate =
|
|
2704
|
+
this.hasAppliedSnapshot &&
|
|
2705
|
+
isNewTransition &&
|
|
2706
|
+
changedKeys &&
|
|
2707
|
+
(validated.layout.kind === 'linear' ||
|
|
2708
|
+
validated.layout.kind === 'table') &&
|
|
2709
|
+
validated.layout.orientation !== 'horizontal' &&
|
|
2710
|
+
(transition?.durationMs ?? 220) > 0 &&
|
|
2711
|
+
!this.document.defaultView?.matchMedia?.(
|
|
2712
|
+
'(prefers-reduced-motion: reduce)'
|
|
2713
|
+
).matches;
|
|
2714
|
+
if (shouldAnimate && transition)
|
|
2715
|
+
this.applyStructuralSnapshot(validated, transition);
|
|
2716
|
+
else {
|
|
2717
|
+
if (isNewTransition || changedKeys) this.cancelStructuralAnimation();
|
|
2718
|
+
this.setSnapshot(validated);
|
|
2719
|
+
}
|
|
2720
|
+
this.hasAppliedSnapshot = true;
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
private cancelStructuralAnimation() {
|
|
2724
|
+
if (this.structuralFrame !== undefined)
|
|
2725
|
+
this.document.defaultView?.cancelAnimationFrame(this.structuralFrame);
|
|
2726
|
+
if (this.structuralFinish !== undefined)
|
|
2727
|
+
this.document.defaultView?.clearTimeout(this.structuralFinish);
|
|
2728
|
+
this.structuralFrame = undefined;
|
|
2729
|
+
this.structuralFinish = undefined;
|
|
2730
|
+
this.structuralAnimations.forEach((animation) => animation.cancel());
|
|
2731
|
+
this.structuralAnimations = [];
|
|
2732
|
+
if (this.structuralFooterElement && this.structuralFooterStyles) {
|
|
2733
|
+
this.structuralFooterElement.style.marginBottom =
|
|
2734
|
+
this.structuralFooterStyles.marginBottom;
|
|
2735
|
+
this.structuralFooterElement.style.transform =
|
|
2736
|
+
this.structuralFooterStyles.transform;
|
|
2737
|
+
this.structuralFooterElement.style.clipPath =
|
|
2738
|
+
this.structuralFooterStyles.clipPath;
|
|
2739
|
+
}
|
|
2740
|
+
this.structuralFooterElement = undefined;
|
|
2741
|
+
this.structuralFooterStyles = undefined;
|
|
2742
|
+
this.structuralScrollInterrupted = false;
|
|
2743
|
+
this.structuralRenderedHeight = undefined;
|
|
2744
|
+
this.structuralTargetHeight = undefined;
|
|
2745
|
+
this.structuralFooterCompensation = 0;
|
|
2746
|
+
this.structuralFooterExpansion = 0;
|
|
2747
|
+
this.structuralProgress = 0;
|
|
2748
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2749
|
+
if (this.structuralAnchorStyles) {
|
|
2750
|
+
owner.style.overflowAnchor = this.structuralAnchorStyles.owner;
|
|
2751
|
+
this.content.style.overflowAnchor = this.structuralAnchorStyles.content;
|
|
2752
|
+
this.structuralAnchorStyles = undefined;
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
|
|
2756
|
+
private handleStructuralUserScroll = (event: Event) => {
|
|
2446
2757
|
if (
|
|
2447
|
-
|
|
2448
|
-
|
|
2758
|
+
event.type === 'pointerdown' &&
|
|
2759
|
+
event.target !== (this.externalScrollHost ?? this.viewport) &&
|
|
2760
|
+
(event as PointerEvent).pointerType !== 'touch'
|
|
2449
2761
|
)
|
|
2450
|
-
|
|
2451
|
-
this.
|
|
2452
|
-
|
|
2762
|
+
return;
|
|
2763
|
+
this.structuralScrollInterrupted = true;
|
|
2764
|
+
};
|
|
2765
|
+
|
|
2766
|
+
private writeStructuralHeight(height: number) {
|
|
2767
|
+
if (this.externalScrollHost) this.writeExternalHeight(height);
|
|
2768
|
+
else this.content.style.height = `${height}px`;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
private reactFooterElement() {
|
|
2772
|
+
return this.contentBounds?.querySelector<HTMLElement>(
|
|
2773
|
+
'[data-testid="native-list-footer-slot"]'
|
|
2774
|
+
);
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2777
|
+
private readReactFooterHeight() {
|
|
2778
|
+
return this.reactFooterElement()?.getBoundingClientRect().height ?? 0;
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
private applyStructuralFooterVisual(progress: number) {
|
|
2782
|
+
const footer = this.structuralFooterElement;
|
|
2783
|
+
if (!footer || this.structuralFooterExpansion <= 0) return;
|
|
2784
|
+
const hidden = this.structuralFooterExpansion * (1 - progress);
|
|
2785
|
+
footer.style.marginBottom = `${-hidden}px`;
|
|
2786
|
+
footer.style.transform = `translateY(${-hidden}px)`;
|
|
2787
|
+
footer.style.clipPath = `inset(${hidden}px 0 0 0)`;
|
|
2788
|
+
}
|
|
2789
|
+
|
|
2790
|
+
private applyStructuralSnapshot(
|
|
2791
|
+
next: NativeListSnapshot,
|
|
2792
|
+
transition: NonNullable<NativeListSnapshot['structuralTransition']>
|
|
2793
|
+
) {
|
|
2794
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
2795
|
+
const oldOffset = owner.scrollTop;
|
|
2796
|
+
const oldScrollHeight = owner.scrollHeight;
|
|
2797
|
+
const oldHeight =
|
|
2798
|
+
this.structuralRenderedHeight ??
|
|
2799
|
+
(this.content.getBoundingClientRect().height ||
|
|
2800
|
+
this.layout.contentHeight);
|
|
2801
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
2802
|
+
const oldFooterHeight =
|
|
2803
|
+
this.structuralRenderedHeight === undefined
|
|
2804
|
+
? this.reactFooterHeight
|
|
2805
|
+
: this.structuralFooterFromHeight +
|
|
2806
|
+
(this.reactFooterHeight - this.structuralFooterFromHeight) *
|
|
2807
|
+
this.structuralProgress;
|
|
2808
|
+
const footerDifference = oldFooterHeight - nextFooterHeight;
|
|
2809
|
+
const startHeight = oldHeight + Math.max(0, footerDifference);
|
|
2810
|
+
const oldItems = this.layout.items;
|
|
2811
|
+
const oldPositions = new Map<string, number>();
|
|
2812
|
+
this.mounted.forEach((element, index) => {
|
|
2813
|
+
const row = this.rows[index];
|
|
2814
|
+
if (row) oldPositions.set(row.key, element.getBoundingClientRect().top);
|
|
2815
|
+
});
|
|
2816
|
+
const nextKeys = new Set(effectiveRows(next).map((row) => row.key));
|
|
2817
|
+
const visibleOffset = this.currentOffset();
|
|
2818
|
+
const visibleSurvivor = oldItems.find(
|
|
2819
|
+
(item) => item.y + item.height > visibleOffset && nextKeys.has(item.key)
|
|
2820
|
+
);
|
|
2821
|
+
const anchor = visibleSurvivor;
|
|
2822
|
+
this.cancelStructuralAnimation();
|
|
2823
|
+
this.structuralScrollInterrupted = false;
|
|
2824
|
+
this.structuralAnchorStyles = {
|
|
2825
|
+
owner: owner.style.overflowAnchor,
|
|
2826
|
+
content: this.content.style.overflowAnchor,
|
|
2827
|
+
};
|
|
2828
|
+
owner.style.overflowAnchor = 'none';
|
|
2829
|
+
this.content.style.overflowAnchor = 'none';
|
|
2830
|
+
this.structuralRenderedHeight = startHeight;
|
|
2831
|
+
this.structuralFooterFromHeight = oldFooterHeight;
|
|
2832
|
+
this.structuralFooterCompensation = Math.max(0, footerDifference);
|
|
2833
|
+
this.structuralFooterExpansion = Math.max(0, -footerDifference);
|
|
2834
|
+
this.structuralProgress = 0;
|
|
2835
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
2836
|
+
this.structuralFooterElement = this.reactFooterElement() ?? undefined;
|
|
2837
|
+
if (this.structuralFooterElement) {
|
|
2838
|
+
const style = this.structuralFooterElement.style;
|
|
2839
|
+
this.structuralFooterStyles = {
|
|
2840
|
+
marginBottom: style.marginBottom,
|
|
2841
|
+
transform: style.transform,
|
|
2842
|
+
clipPath: style.clipPath,
|
|
2843
|
+
};
|
|
2844
|
+
this.applyStructuralFooterVisual(0);
|
|
2845
|
+
}
|
|
2846
|
+
this.setSnapshot(next);
|
|
2847
|
+
const newHeight = this.layout.contentHeight;
|
|
2848
|
+
this.structuralTargetHeight = newHeight;
|
|
2849
|
+
const nextAnchor =
|
|
2850
|
+
anchor && this.layout.items.find((item) => item.key === anchor.key);
|
|
2851
|
+
const delta = nextAnchor && anchor ? nextAnchor.y - anchor.y : 0;
|
|
2852
|
+
const finalScrollHeight = oldScrollHeight + newHeight - oldHeight;
|
|
2853
|
+
const finalMaxOffset = Math.max(0, finalScrollHeight - owner.clientHeight);
|
|
2854
|
+
let targetOffset = Math.max(0, Math.min(oldOffset + delta, finalMaxOffset));
|
|
2855
|
+
if (!visibleSurvivor && transition.anchorKey) {
|
|
2856
|
+
const fallback = this.layout.items.find(
|
|
2857
|
+
(item) => item.key === transition.anchorKey
|
|
2858
|
+
);
|
|
2859
|
+
if (fallback) {
|
|
2860
|
+
const pagerStickyInset = Number.parseFloat(
|
|
2861
|
+
this.externalScrollHost?.style.getPropertyValue(
|
|
2862
|
+
'--ok-collapsible-pager-sticky-inset'
|
|
2863
|
+
) ?? ''
|
|
2864
|
+
);
|
|
2865
|
+
const effectiveStickyInset = Math.max(
|
|
2866
|
+
this.externalStickyInset,
|
|
2867
|
+
Number.isFinite(pagerStickyInset) ? pagerStickyInset : 0
|
|
2868
|
+
);
|
|
2869
|
+
const fallbackTop = this.externalScrollHost
|
|
2870
|
+
? this.externalGeometry().origin + fallback.y - effectiveStickyInset
|
|
2871
|
+
: resolveWebCollapsiblePagerRawOffset(
|
|
2872
|
+
Math.max(0, fallback.y - this.collapsiblePagerInsets().sticky),
|
|
2873
|
+
this.collapsiblePagerInsets().header
|
|
2874
|
+
);
|
|
2875
|
+
targetOffset = Math.min(targetOffset, Math.max(0, fallbackTop));
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
const duration = transition.durationMs ?? 220;
|
|
2879
|
+
const easing = 'cubic-bezier(0.42, 0, 0.58, 1)';
|
|
2880
|
+
this.mounted.forEach((element, index) => {
|
|
2881
|
+
const row = this.rows[index];
|
|
2882
|
+
const previousTop = row && oldPositions.get(row.key);
|
|
2883
|
+
if (previousTop === undefined || typeof element.animate !== 'function')
|
|
2884
|
+
return;
|
|
2885
|
+
const offset = previousTop - element.getBoundingClientRect().top;
|
|
2886
|
+
if (Math.abs(offset) < 0.5) return;
|
|
2887
|
+
this.structuralAnimations.push(
|
|
2888
|
+
element.animate(
|
|
2889
|
+
[
|
|
2890
|
+
{ transform: `translateY(${offset}px)` },
|
|
2891
|
+
{ transform: 'translateY(0)' },
|
|
2892
|
+
],
|
|
2893
|
+
{ duration, easing }
|
|
2894
|
+
)
|
|
2895
|
+
);
|
|
2896
|
+
});
|
|
2897
|
+
const startedAt =
|
|
2898
|
+
this.document.defaultView?.performance.now() ?? Date.now();
|
|
2899
|
+
const step = (time: number) => {
|
|
2900
|
+
const progress = Math.min(1, (time - startedAt) / duration);
|
|
2901
|
+
const eased = progress * progress * (3 - 2 * progress);
|
|
2902
|
+
this.structuralProgress = eased;
|
|
2903
|
+
const renderedHeight =
|
|
2904
|
+
oldHeight +
|
|
2905
|
+
((this.structuralTargetHeight ?? newHeight) - oldHeight) * eased +
|
|
2906
|
+
this.structuralFooterCompensation * (1 - eased);
|
|
2907
|
+
this.structuralRenderedHeight = renderedHeight;
|
|
2908
|
+
this.writeStructuralHeight(renderedHeight);
|
|
2909
|
+
this.applyStructuralFooterVisual(eased);
|
|
2910
|
+
if (!this.structuralScrollInterrupted)
|
|
2911
|
+
owner.scrollTop = oldOffset + (targetOffset - oldOffset) * eased;
|
|
2912
|
+
if (progress < 1)
|
|
2913
|
+
this.structuralFrame =
|
|
2914
|
+
this.document.defaultView?.requestAnimationFrame(step);
|
|
2915
|
+
};
|
|
2916
|
+
this.structuralFrame =
|
|
2917
|
+
this.document.defaultView?.requestAnimationFrame(step);
|
|
2918
|
+
this.structuralFinish = this.document.defaultView?.setTimeout(() => {
|
|
2919
|
+
this.cancelStructuralAnimation();
|
|
2920
|
+
this.recomputeLayout();
|
|
2921
|
+
}, duration + 40);
|
|
2453
2922
|
}
|
|
2454
2923
|
|
|
2455
2924
|
currentContentHeight(): number {
|
|
@@ -2461,8 +2930,16 @@ export class NativeListWebEngine {
|
|
|
2461
2930
|
}
|
|
2462
2931
|
|
|
2463
2932
|
applyPatches(patches: readonly RowPatch[]) {
|
|
2464
|
-
|
|
2465
|
-
|
|
2933
|
+
const accepted = containNativeListInput(() => {
|
|
2934
|
+
const normalized = validatePatches(patches);
|
|
2935
|
+
return {
|
|
2936
|
+
patches: normalized,
|
|
2937
|
+
snapshot: applyRowPatches(this.snapshot, normalized),
|
|
2938
|
+
};
|
|
2939
|
+
});
|
|
2940
|
+
if (!accepted || accepted.patches.length === 0) return;
|
|
2941
|
+
patches = accepted.patches;
|
|
2942
|
+
const next = accepted.snapshot;
|
|
2466
2943
|
const selection = new Set(this.selectedKeys);
|
|
2467
2944
|
patches.forEach((patch) => {
|
|
2468
2945
|
const selected =
|
|
@@ -2646,6 +3123,8 @@ export class NativeListWebEngine {
|
|
|
2646
3123
|
|
|
2647
3124
|
destroy() {
|
|
2648
3125
|
if (this.destroyed) return;
|
|
3126
|
+
this.cancelStructuralAnimation();
|
|
3127
|
+
this.pressedHelpElement = undefined;
|
|
2649
3128
|
this.invalidateActionAnchor('destroy');
|
|
2650
3129
|
this.destroyed = true;
|
|
2651
3130
|
if (this.frameHandle !== undefined) this.cancelFrame(this.frameHandle);
|
|
@@ -2673,6 +3152,11 @@ export class NativeListWebEngine {
|
|
|
2673
3152
|
'ok-collapsible-pager-cancel-scroll-command',
|
|
2674
3153
|
this.handlePagerScrollCommandCancel
|
|
2675
3154
|
);
|
|
3155
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart'])
|
|
3156
|
+
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
3157
|
+
event,
|
|
3158
|
+
this.handleStructuralUserScroll
|
|
3159
|
+
);
|
|
2676
3160
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
2677
3161
|
(this.externalScrollHost ?? this.viewport).removeEventListener(
|
|
2678
3162
|
'ok-collapsible-pager-insets-changed',
|
|
@@ -2687,6 +3171,10 @@ export class NativeListWebEngine {
|
|
|
2687
3171
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
2688
3172
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
2689
3173
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
3174
|
+
this.root.removeEventListener(
|
|
3175
|
+
'pointerdown',
|
|
3176
|
+
this.handleIconHelpPointerDown
|
|
3177
|
+
);
|
|
2690
3178
|
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
2691
3179
|
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
2692
3180
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -2749,6 +3237,7 @@ export class NativeListWebEngine {
|
|
|
2749
3237
|
selectedKeys?: ReadonlySet<string>
|
|
2750
3238
|
) {
|
|
2751
3239
|
this.cancelMarketPointer();
|
|
3240
|
+
this.pressedHelpElement = undefined;
|
|
2752
3241
|
this.measuredRendererHeights.clear();
|
|
2753
3242
|
this.snapshot = snapshot;
|
|
2754
3243
|
this.rows = effectiveRows(snapshot);
|
|
@@ -2769,6 +3258,7 @@ export class NativeListWebEngine {
|
|
|
2769
3258
|
'--nl-row': theme.rowBackground,
|
|
2770
3259
|
'--nl-selected': theme.rowSelectedBackground,
|
|
2771
3260
|
'--nl-pressed': theme.rowPressedBackground,
|
|
3261
|
+
'--nl-hover': theme.rowHoverBackground ?? theme.rowPressedBackground,
|
|
2772
3262
|
'--nl-subdued': theme.subduedBackground,
|
|
2773
3263
|
'--nl-strong': theme.strongBackground,
|
|
2774
3264
|
'--nl-image-fallback-background':
|
|
@@ -2786,6 +3276,7 @@ export class NativeListWebEngine {
|
|
|
2786
3276
|
'--nl-separator': theme.separator,
|
|
2787
3277
|
'--nl-accent': theme.accent,
|
|
2788
3278
|
'--nl-positive': theme.positive,
|
|
3279
|
+
'--nl-success-background': theme.successBackground,
|
|
2789
3280
|
'--nl-negative': theme.negative,
|
|
2790
3281
|
'--nl-critical': theme.criticalBackground,
|
|
2791
3282
|
'--nl-inverse': theme.inverseBackground,
|
|
@@ -2873,13 +3364,30 @@ export class NativeListWebEngine {
|
|
|
2873
3364
|
|
|
2874
3365
|
private recomputeLayout = () => {
|
|
2875
3366
|
if (this.destroyed) return;
|
|
3367
|
+
if (this.structuralRenderedHeight === undefined)
|
|
3368
|
+
this.reactFooterHeight = this.readReactFooterHeight();
|
|
3369
|
+
else {
|
|
3370
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
3371
|
+
const footerDelta = this.reactFooterHeight - nextFooterHeight;
|
|
3372
|
+
if (footerDelta !== 0) {
|
|
3373
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
3374
|
+
const priorCompensation = this.structuralFooterCompensation;
|
|
3375
|
+
const difference = this.structuralFooterFromHeight - nextFooterHeight;
|
|
3376
|
+
this.structuralFooterCompensation = Math.max(0, difference);
|
|
3377
|
+
this.structuralFooterExpansion = Math.max(0, -difference);
|
|
3378
|
+
this.structuralRenderedHeight +=
|
|
3379
|
+
(this.structuralFooterCompensation - priorCompensation) *
|
|
3380
|
+
(1 - this.structuralProgress);
|
|
3381
|
+
this.applyStructuralFooterVisual(this.structuralProgress);
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
2876
3384
|
const cachedWidth = this.lastViewportWidth;
|
|
2877
3385
|
const cachedHeight = this.lastViewportHeight;
|
|
2878
3386
|
const precomputedLayout =
|
|
2879
3387
|
this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0
|
|
2880
3388
|
? this.computeLayout(cachedWidth, cachedHeight)
|
|
2881
3389
|
: undefined;
|
|
2882
|
-
if (precomputedLayout) {
|
|
3390
|
+
if (precomputedLayout && this.structuralRenderedHeight === undefined) {
|
|
2883
3391
|
// Commit appended row extent before measuring React-owned slot changes.
|
|
2884
3392
|
this.writeExternalHeight(
|
|
2885
3393
|
Math.max(this.layout.contentHeight, precomputedLayout.contentHeight)
|
|
@@ -2932,11 +3440,15 @@ export class NativeListWebEngine {
|
|
|
2932
3440
|
? precomputedLayout
|
|
2933
3441
|
: this.computeLayout(viewportWidth, viewportHeight);
|
|
2934
3442
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
2935
|
-
|
|
3443
|
+
const renderedHeight =
|
|
3444
|
+
this.structuralRenderedHeight ?? this.layout.contentHeight;
|
|
3445
|
+
this.content.style.height = String(renderedHeight) + 'px';
|
|
2936
3446
|
if (this.externalScrollHost) {
|
|
2937
|
-
this.writeExternalHeight(
|
|
3447
|
+
this.writeExternalHeight(renderedHeight);
|
|
2938
3448
|
this.externalGeometryCache = undefined;
|
|
2939
3449
|
}
|
|
3450
|
+
if (this.structuralRenderedHeight !== undefined)
|
|
3451
|
+
this.structuralTargetHeight = this.layout.contentHeight;
|
|
2940
3452
|
this.renderSectionIndex(
|
|
2941
3453
|
this.viewport.clientHeight <= 0
|
|
2942
3454
|
? DEFAULT_VIEWPORT_HEIGHT
|
|
@@ -3175,7 +3687,7 @@ export class NativeListWebEngine {
|
|
|
3175
3687
|
const body = reusableBody ?? createRowBody(context, row);
|
|
3176
3688
|
if (reusableBody) {
|
|
3177
3689
|
resetRowContainerStyle(body);
|
|
3178
|
-
registered.bind(body, rendererPrimitives(context));
|
|
3690
|
+
registered.bind(body, rendererPrimitives(context, Boolean(row.disabled)));
|
|
3179
3691
|
}
|
|
3180
3692
|
// OneKey patch: explicit selector fields preserve original page geometry.
|
|
3181
3693
|
element.style.contain = row.backgroundFullWidth ? 'layout style' : '';
|
|
@@ -3967,6 +4479,8 @@ export class NativeListWebEngine {
|
|
|
3967
4479
|
}
|
|
3968
4480
|
|
|
3969
4481
|
private invalidateActionAnchorForElement(element: HTMLElement) {
|
|
4482
|
+
if (this.pressedHelpElement && element.contains(this.pressedHelpElement))
|
|
4483
|
+
this.pressedHelpElement = undefined;
|
|
3970
4484
|
const anchor = this.actionAnchor;
|
|
3971
4485
|
if (
|
|
3972
4486
|
anchor &&
|
|
@@ -4079,9 +4593,13 @@ export class NativeListWebEngine {
|
|
|
4079
4593
|
'[data-native-list-row-key]'
|
|
4080
4594
|
);
|
|
4081
4595
|
const row = this.rowAtElement(rowElement);
|
|
4082
|
-
if (
|
|
4596
|
+
if (
|
|
4597
|
+
(row?.type !== 'market' && row?.type !== 'identity') ||
|
|
4598
|
+
!isRowPressEnabled(row)
|
|
4599
|
+
)
|
|
4600
|
+
return;
|
|
4083
4601
|
this.cancelMarketPointer();
|
|
4084
|
-
if (row.pressInActionKey)
|
|
4602
|
+
if (row.type === 'market' && row.pressInActionKey)
|
|
4085
4603
|
this.emitRowAction(
|
|
4086
4604
|
row,
|
|
4087
4605
|
row.pressInActionKey,
|
|
@@ -4100,7 +4618,7 @@ export class NativeListWebEngine {
|
|
|
4100
4618
|
!rowElement.isConnected ||
|
|
4101
4619
|
rowElement.dataset.nativeListBindingEpoch !== bindingEpoch ||
|
|
4102
4620
|
currentRow?.key !== row.key ||
|
|
4103
|
-
currentRow.type !== 'market' ||
|
|
4621
|
+
(currentRow.type !== 'market' && currentRow.type !== 'identity') ||
|
|
4104
4622
|
!isRowPressEnabled(currentRow) ||
|
|
4105
4623
|
!currentRow.longPressActionKey
|
|
4106
4624
|
)
|
|
@@ -4118,7 +4636,7 @@ export class NativeListWebEngine {
|
|
|
4118
4636
|
this.marketPointer = {
|
|
4119
4637
|
pointerId: event.pointerId,
|
|
4120
4638
|
pointerType: event.pointerType,
|
|
4121
|
-
compact: !row.webTable,
|
|
4639
|
+
compact: row.type === 'identity' || !row.webTable,
|
|
4122
4640
|
rowKey: row.key,
|
|
4123
4641
|
startX: event.clientX,
|
|
4124
4642
|
startY: event.clientY,
|
|
@@ -4186,11 +4704,23 @@ export class NativeListWebEngine {
|
|
|
4186
4704
|
action.contains(event.relatedTarget))
|
|
4187
4705
|
)
|
|
4188
4706
|
return;
|
|
4707
|
+
if (action.dataset.nativeListIconHelp === 'true') {
|
|
4708
|
+
if (
|
|
4709
|
+
event.type === 'pointerover' &&
|
|
4710
|
+
(event as PointerEvent).pointerType === 'touch'
|
|
4711
|
+
)
|
|
4712
|
+
return;
|
|
4713
|
+
if (this.pressedHelpElement === action) return;
|
|
4714
|
+
}
|
|
4189
4715
|
if (
|
|
4190
4716
|
action.classList.contains('ok-native-list-market-subtitle-prefix') &&
|
|
4191
4717
|
action.scrollWidth <= action.clientWidth + 1
|
|
4192
4718
|
)
|
|
4193
4719
|
return;
|
|
4720
|
+
this.emitHoverAction(action);
|
|
4721
|
+
};
|
|
4722
|
+
|
|
4723
|
+
private emitHoverAction(action: HTMLElement) {
|
|
4194
4724
|
const rowElement = action.closest<HTMLElement>(
|
|
4195
4725
|
'[data-native-list-row-key]'
|
|
4196
4726
|
);
|
|
@@ -4212,6 +4742,24 @@ export class NativeListWebEngine {
|
|
|
4212
4742
|
// WalletGroup), not the enclosing row's `disabled`.
|
|
4213
4743
|
if (sourceRow && !sourceRow.disabled && actionKey)
|
|
4214
4744
|
this.emitRowAction(sourceRow, actionKey, action, rowElement ?? undefined);
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
private handleIconHelpPointerDown = (event: PointerEvent) => {
|
|
4748
|
+
const target = event.target;
|
|
4749
|
+
if (!(target instanceof Element)) return;
|
|
4750
|
+
const action = target.closest<HTMLElement>(
|
|
4751
|
+
'[data-native-list-icon-help="true"]'
|
|
4752
|
+
);
|
|
4753
|
+
if (!action) return;
|
|
4754
|
+
if (event.pointerType === 'touch') {
|
|
4755
|
+
if (this.actionAnchor?.actionElement === action && this.actionAnchor.open)
|
|
4756
|
+
this.invalidateActionAnchor('pointerLeave');
|
|
4757
|
+
else this.emitHoverAction(action);
|
|
4758
|
+
} else {
|
|
4759
|
+
this.pressedHelpElement = action;
|
|
4760
|
+
if (this.actionAnchor?.actionElement === action)
|
|
4761
|
+
this.invalidateActionAnchor('pointerLeave');
|
|
4762
|
+
}
|
|
4215
4763
|
};
|
|
4216
4764
|
|
|
4217
4765
|
private handleTitlePointerOut = (event: PointerEvent | FocusEvent) => {
|
|
@@ -4226,6 +4774,14 @@ export class NativeListWebEngine {
|
|
|
4226
4774
|
action.contains(event.relatedTarget))
|
|
4227
4775
|
)
|
|
4228
4776
|
return;
|
|
4777
|
+
if (
|
|
4778
|
+
action.dataset.nativeListIconHelp === 'true' &&
|
|
4779
|
+
event.type === 'pointerout' &&
|
|
4780
|
+
(event as PointerEvent).pointerType === 'touch'
|
|
4781
|
+
)
|
|
4782
|
+
return;
|
|
4783
|
+
if (event.type === 'pointerout' && this.pressedHelpElement === action)
|
|
4784
|
+
this.pressedHelpElement = undefined;
|
|
4229
4785
|
if (this.actionAnchor?.actionElement === action)
|
|
4230
4786
|
this.invalidateActionAnchor('pointerLeave');
|
|
4231
4787
|
};
|
|
@@ -4239,6 +4795,11 @@ export class NativeListWebEngine {
|
|
|
4239
4795
|
}
|
|
4240
4796
|
const target = event.target;
|
|
4241
4797
|
if (!(target instanceof Element)) return;
|
|
4798
|
+
if (target.closest('[data-native-list-icon-help="true"]')) {
|
|
4799
|
+
event.preventDefault();
|
|
4800
|
+
event.stopPropagation();
|
|
4801
|
+
return;
|
|
4802
|
+
}
|
|
4242
4803
|
const rowElement = target.closest<HTMLElement>(
|
|
4243
4804
|
'[data-native-list-row-key]'
|
|
4244
4805
|
);
|
|
@@ -4259,6 +4820,10 @@ export class NativeListWebEngine {
|
|
|
4259
4820
|
// member press is blocked by `isRowPressEnabled` in `handleRowPress`.
|
|
4260
4821
|
const action = target.closest<HTMLElement>('[data-native-list-action]');
|
|
4261
4822
|
if (action) {
|
|
4823
|
+
if (action.tagName === 'BUTTON' && action.hasAttribute('disabled'))
|
|
4824
|
+
return;
|
|
4825
|
+
if (action.classList.contains('ok-native-list-trailing-button'))
|
|
4826
|
+
event.stopPropagation();
|
|
4262
4827
|
const scope = action.dataset.selectionScope;
|
|
4263
4828
|
if (scope === 'row') this.activateSelection({ scope: 'row' }, row);
|
|
4264
4829
|
else if (scope === 'section' && action.dataset.selectionKey)
|
|
@@ -4421,6 +4986,7 @@ export class NativeListWebEngine {
|
|
|
4421
4986
|
|
|
4422
4987
|
private handleScroll = () => {
|
|
4423
4988
|
this.externalGeometryCache = undefined;
|
|
4989
|
+
this.pressedHelpElement = undefined;
|
|
4424
4990
|
this.cancelMarketPointer();
|
|
4425
4991
|
this.invalidateActionAnchor('scroll');
|
|
4426
4992
|
this.scheduleFrame();
|