@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
|
@@ -421,7 +421,7 @@ export const WEB_LIST_CSS = `
|
|
|
421
421
|
.ok-native-list-table-secondary{display:block;min-width:0;overflow:clip}.ok-native-list-table-secondary-track{display:flex;flex-direction:column;transition:transform 100ms ease}.ok-native-list-market-table:focus-within .ok-native-list-table-secondary[data-has-hover="true"]>.ok-native-list-table-secondary-track{transform:translateY(calc(-1 * var(--nl-table-secondary-height)))}@media(hover:hover){.ok-native-list-market-table:hover .ok-native-list-table-secondary[data-has-hover="true"]>.ok-native-list-table-secondary-track{transform:translateY(calc(-1 * var(--nl-table-secondary-height)))}}.ok-native-list-market-table button:focus-visible{outline:2px solid var(--nl-accent);outline-offset:1px}.ok-native-list-market-table button:hover{opacity:.75}.ok-native-list-market-table button:active{opacity:.5}
|
|
422
422
|
|
|
423
423
|
[data-native-list-selector="walletSidebar"] .ok-native-list-title{max-width:100%;min-width:0}
|
|
424
|
-
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-synthesis:none;font-family:var(--nl-font-regular)}
|
|
424
|
+
.ok-native-list-root{--nl-bg:#f7f7f7;--nl-row:#fff;--nl-selected:#eaf2ff;--nl-pressed:#e8e8e8;--nl-hover:#e8e8e8;--nl-subdued:#f9f9f9;--nl-strong:#0000000f;--nl-primary:#111;--nl-secondary:#6b7280;--nl-disabled:#8d8d8d;--nl-icon:#111;--nl-icon-subdued:#8d8d8d;--nl-separator:#e5e7eb;--nl-accent:#2f6bff;--nl-positive:#15803d;--nl-negative:#dc2626;--nl-critical:#feecec;--nl-inverse:#202020;--nl-inverse-text:#fcfcfc;--nl-info:#0d74ce;position:absolute;inset:0;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;background:var(--nl-bg);color:var(--nl-primary);font-synthesis:none;font-family:var(--nl-font-regular)}
|
|
425
425
|
.ok-native-list-viewport-frame{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden}
|
|
426
426
|
.ok-native-list-viewport{position:absolute;inset:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;scrollbar-gutter:stable}
|
|
427
427
|
.ok-native-list-content{position:relative;min-width:100%;min-height:100%}
|
|
@@ -432,7 +432,7 @@ export const WEB_LIST_CSS = `
|
|
|
432
432
|
.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-row{background:var(--nl-selected)}
|
|
433
433
|
.ok-native-list-item[data-native-list-disabled="true"]>.ok-native-list-row{cursor:default}
|
|
434
434
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]>.ok-native-list-row{cursor:pointer}
|
|
435
|
-
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-
|
|
435
|
+
.ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>.ok-native-list-row{background:var(--nl-hover)}
|
|
436
436
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:active>.ok-native-list-row{background:var(--nl-pressed)}
|
|
437
437
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:not([data-native-list-selected="true"]):hover>.ok-native-list-wallet-row{background:var(--nl-strong)}
|
|
438
438
|
.ok-native-list-item[data-native-list-row-press-enabled="true"]:not([data-native-list-selected="true"]):active>.ok-native-list-wallet-row{background:var(--nl-pressed)}
|
|
@@ -463,16 +463,23 @@ export const WEB_LIST_CSS = `
|
|
|
463
463
|
.ok-native-list-item[data-group-position="last"]>.ok-native-list-row{border-radius:0 0 var(--nl-group-radius,12px) var(--nl-group-radius,12px)}
|
|
464
464
|
.ok-native-list-item[data-group-position="single"]>.ok-native-list-row{border-radius:var(--nl-group-radius,12px)}
|
|
465
465
|
.ok-native-list-standard{padding:8px 12px}.ok-native-list-network-row{padding:0 12px}.ok-native-list-wallet-row{padding:4px 8px;flex-direction:column;justify-content:center;gap:4px}.ok-native-list-account-row{padding:4px 12px;gap:8px}
|
|
466
|
+
.ok-native-list-trailing-button{appearance:none;box-sizing:border-box;flex:0 0 auto;padding:4px 10px;border:1px solid transparent;border-radius:9999px;background:var(--nl-button-bg,var(--nl-strong));color:var(--nl-button-text,var(--nl-primary));font:500 14px/20px var(--nl-font-medium);white-space:nowrap;cursor:pointer}.ok-native-list-trailing-button:hover:not(:disabled){background:var(--nl-button-hover,var(--nl-strong))}.ok-native-list-trailing-button:active:not(:disabled){background:var(--nl-button-pressed,var(--nl-pressed))}.ok-native-list-trailing-button:focus-visible{outline:2px solid var(--nl-button-focus,var(--nl-accent))}.ok-native-list-trailing-button:disabled{opacity:.4;cursor:default}
|
|
467
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon{box-sizing:border-box;flex:0 0 38px;width:38px;height:38px;margin:-7px;padding:6px;border:1px solid transparent;border-radius:9999px;color:var(--nl-icon-subdued);background:transparent}.ok-native-list-icon-button.ok-native-list-tertiary-icon:hover:not(:disabled){background:var(--nl-hover)}.ok-native-list-icon-button.ok-native-list-tertiary-icon:active:not(:disabled){background:var(--nl-pressed)}.ok-native-list-icon-button.ok-native-list-tertiary-icon:disabled{opacity:.4;cursor:default}
|
|
468
|
+
.ok-native-list-icon-button.ok-native-list-tertiary-icon:focus-visible:not(:disabled){outline:2px solid var(--nl-accent)}
|
|
469
|
+
.ok-native-list-identity-title-icon{flex:0 0 20px;width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;color:var(--nl-icon);font-size:20px}.ok-native-list-identity-title-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
466
470
|
.ok-native-list-account-row .ok-native-list-visual,.ok-native-list-account-action-row .ok-native-list-visual{width:32px;height:32px;flex-basis:32px}.ok-native-list-account-row .ok-native-list-visual>img,.ok-native-list-account-row .ok-native-list-visual-main,.ok-native-list-account-action-row .ok-native-list-visual>img,.ok-native-list-account-action-row .ok-native-list-visual-main{width:32px;height:32px}.ok-native-list-account-row .ok-native-list-visual>.ok-native-list-visual-corner{width:20px;height:20px;padding:2px}.ok-native-list-account-action-row .ok-native-list-visual{border-radius:8px!important}.ok-native-list-wallet-row .ok-native-list-title{color:var(--nl-secondary);font-size:12px;line-height:16px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-item[data-native-list-selected="true"]>.ok-native-list-wallet-row .ok-native-list-title{color:var(--nl-primary)}.ok-native-list-account-row .ok-native-list-title{font-size:16px;line-height:20px;font-weight:400;font-family:var(--nl-font-regular)}.ok-native-list-account-row .ok-native-list-secondary{font-size:14px;line-height:20px;font-weight:400;font-family:var(--nl-font-regular)}
|
|
467
471
|
.ok-native-list-flex{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:center}.ok-native-list-title{font-size:15px;line-height:20px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-semibold)}.ok-native-list-secondary{font-size:13px;line-height:18px;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ok-native-list-tertiary{color:var(--nl-secondary)}.ok-native-list-info{color:var(--nl-info)}
|
|
468
472
|
.ok-native-list-identity-row .ok-native-list-title,.ok-native-list-identity-row .ok-native-list-amounts>span:first-child{font-size:16px;line-height:20px}.ok-native-list-identity-row .ok-native-list-secondary{font-size:14px;line-height:20px}
|
|
469
473
|
.ok-native-list-value{font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}.ok-native-list-time{font-size:11px;line-height:16px;color:var(--nl-secondary);align-self:flex-start}.ok-native-list-amounts{display:flex;flex-direction:column;align-items:flex-end;min-width:0}.ok-native-list-actions{display:flex;gap:16px;margin-top:6px}
|
|
470
474
|
.ok-native-list-action-button{appearance:none;border:0;background:transparent;padding:2px;color:var(--nl-accent);cursor:pointer;font:600 12px/16px var(--nl-font-semibold)}.ok-native-list-action-button[data-tone="danger"]{color:var(--nl-negative)}.ok-native-list-action-button:disabled{opacity:.5;cursor:default}
|
|
471
|
-
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;overflow:hidden;font-family:var(--nl-font-semibold)}.ok-native-list-visual>.ok-native-list-visual-corner{position:absolute;right:-4px;bottom:-4px;width:18px;height:18px;padding:2px;border-radius:50%;background:var(--nl-row);object-fit:cover}.ok-native-list-stacked{display:flex;align-items:center;width:48px;flex-basis:48px}.ok-native-list-stacked img{width:28px;height:28px;border:2px solid var(--nl-row);border-radius:50%;object-fit:cover;margin-left:-10px}.ok-native-list-stacked img:first-child{margin-left:0}
|
|
475
|
+
.ok-native-list-visual{position:relative;flex:0 0 40px;width:40px;height:40px;border-radius:20px;overflow:visible;background:var(--nl-strong)}.ok-native-list-visual>img,.ok-native-list-visual-main{display:block;width:40px;height:40px;border-radius:inherit;object-fit:cover}.ok-native-list-visual-fallback{display:flex;width:100%;height:100%;align-items:center;justify-content:center;border-radius:inherit;color:var(--nl-primary);font-size:15px;font-weight:600;overflow:hidden;font-family:var(--nl-font-semibold)}.ok-native-list-image-skeleton{position:absolute;inset:0;border-radius:inherit;pointer-events:none;animation:ok-native-list-skeleton-light 1.5s linear infinite alternate}.ok-native-list-image-skeleton[data-dark="true"]{animation-name:ok-native-list-skeleton-dark}@keyframes ok-native-list-skeleton-light{0%{background-color:#fafafa}100%{background-color:#cdcdcd}}@keyframes ok-native-list-skeleton-dark{0%{background-color:#111111}100%{background-color:#333333}}@media(prefers-reduced-motion:reduce){.ok-native-list-image-skeleton{animation:none;background-color:var(--nl-strong)}}.ok-native-list-visual>.ok-native-list-visual-corner{position:absolute;right:-4px;bottom:-4px;width:18px;height:18px;padding:2px;border-radius:50%;background:var(--nl-row);object-fit:cover}.ok-native-list-stacked{display:flex;align-items:center;width:48px;flex-basis:48px}.ok-native-list-stacked img{width:28px;height:28px;border:2px solid var(--nl-row);border-radius:50%;object-fit:cover;margin-left:-10px}.ok-native-list-stacked img:first-child{margin-left:0}
|
|
472
476
|
.ok-native-list-accessories{display:flex;align-items:center;gap:10px;min-width:0}.ok-native-list-accessory{font-size:14px;color:var(--nl-primary);white-space:nowrap}.ok-native-list-accessory-secondary{color:var(--nl-secondary)}.ok-native-list-icon-button{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:24px;border:0;background:transparent;color:var(--nl-icon);font-size:20px;line-height:1;font-weight:500;cursor:pointer;font-family:var(--nl-font-medium)}.ok-native-list-checkbox{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:20px;height:20px;border:2px solid color-mix(in srgb,var(--nl-primary) 19%,transparent);border-radius:5px;background:var(--nl-row);cursor:pointer}.ok-native-list-checkbox[data-state="checked"],.ok-native-list-checkbox[data-state="indeterminate"]{border-color:transparent;background:var(--nl-primary)}.ok-native-list-checkbox[data-state="checked"]::after{content:"";width:6px;height:10px;margin-top:-2px;border-right:2px solid var(--nl-row);border-bottom:2px solid var(--nl-row);transform:rotate(45deg)}.ok-native-list-checkbox[data-state="indeterminate"]::after{content:"";width:8px;height:2px;border-radius:1px;background:var(--nl-row)}.ok-native-list-spinner{width:16px;height:16px;border:2px solid var(--nl-separator);border-top-color:var(--nl-primary);border-radius:50%;animation:ok-native-list-spin .8s linear infinite}@keyframes ok-native-list-spin{to{transform:rotate(360deg)}}
|
|
473
|
-
.ok-native-list-
|
|
477
|
+
.ok-native-list-icon-button.ok-native-list-decorative-refresh{min-width:16px;width:16px;height:16px}
|
|
478
|
+
.ok-native-list-badge{display:inline-flex;align-items:center;max-width:100%;height:18px;padding:0 5px;border-radius:5px;background:color-mix(in srgb,var(--nl-accent) 12%,transparent);color:var(--nl-accent);font-size:11px;line-height:18px;white-space:nowrap}.ok-native-list-badge[data-tone="danger"]{background:var(--nl-critical);color:var(--nl-negative)}.ok-native-list-badge[data-tone="success"]{background:var(--nl-success-background,color-mix(in srgb,var(--nl-positive) 12%,transparent));color:var(--nl-positive)}.ok-native-list-section>.ok-native-list-badge[data-tone="success"]{box-sizing:border-box;height:20px;padding:2px 8px;border-radius:4px;font:500 12px/16px var(--nl-font-medium)}.ok-native-list-badges{display:inline-flex;gap:4px;margin-left:6px;vertical-align:middle}
|
|
479
|
+
.ok-native-list-identity-row .ok-native-list-badge[data-tone="neutral"]{height:20px;box-sizing:border-box;padding:2px 8px;border-radius:4px;background:var(--nl-strong);color:var(--nl-secondary);font-size:12px;line-height:16px;font-weight:500;font-family:var(--nl-font-medium)}
|
|
474
480
|
.ok-native-list-section{padding:0 8px;background:var(--nl-bg);gap:8px}.ok-native-list-section[data-variant="summary"]{padding:0 20px}.ok-native-list-section[data-variant="gallery"]{padding:0 12px}.ok-native-list-section[data-variant="history"]{padding:0 8px}.ok-native-list-section-title{font-size:13px;line-height:18px;font-weight:700;color:var(--nl-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-family:var(--nl-font-bold)}.ok-native-list-section[data-variant="summary"] .ok-native-list-section-title{font-size:16px;font-weight:500;color:var(--nl-primary);font-family:var(--nl-font-medium)}.ok-native-list-section[data-variant="gallery"] .ok-native-list-section-title{font-size:16px;color:var(--nl-primary)}.ok-native-list-section[data-variant="history"] .ok-native-list-section-title{font-size:12px;line-height:16px;letter-spacing:0.8px}.ok-native-list-section-value{margin-left:auto}
|
|
475
481
|
.ok-native-list-action-row{justify-content:space-between;padding:0 16px}.ok-native-list-action-title{font-size:15px;font-weight:600;color:var(--nl-accent);font-family:var(--nl-font-semibold)}.ok-native-list-action-title[data-tone="danger"]{color:var(--nl-negative)}
|
|
482
|
+
.ok-native-list-button-group{padding:0;gap:10px;overflow:visible}.ok-native-list-block-button{position:relative;display:flex;flex:1 1 0;min-width:0;min-height:48px;align-items:center;justify-content:center;gap:8px;padding:12px 8px;border:1px solid color-mix(in srgb,var(--nl-info) 35%,transparent);border-radius:12px;background:transparent;color:var(--nl-info);font:500 14px/20px var(--nl-font-medium);cursor:pointer}.ok-native-list-block-button>span:not(.ok-native-list-spinner){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ok-native-list-block-button>.ok-native-list-spinner{position:static;flex:0 0 20px;width:20px;height:20px;border-top-color:var(--nl-info)}.ok-native-list-block-button:hover:not(:disabled){background:color-mix(in srgb,var(--nl-info) 10%,transparent);border-color:var(--nl-info)}.ok-native-list-block-button:active:not(:disabled){background:color-mix(in srgb,var(--nl-info) 17%,transparent)}.ok-native-list-block-button:focus-visible{outline:2px solid var(--nl-info);outline-offset:1px}.ok-native-list-block-button:disabled{opacity:.4;cursor:default}
|
|
476
483
|
.ok-native-list-account-action-row{justify-content:flex-start;gap:12px;padding:0 12px}.ok-native-list-account-action-row .ok-native-list-action-title{color:var(--nl-secondary);font-size:16px;line-height:24px;font-weight:400;font-family:var(--nl-font-regular)}
|
|
477
484
|
.ok-native-list-system{justify-content:center;padding:8px 12px;background:var(--nl-bg);color:var(--nl-secondary);cursor:default}.ok-native-list-system[data-variant="retry"],.ok-native-list-system[data-variant="noMatch"],.ok-native-list-system[data-variant="end"]{justify-content:flex-start}.ok-native-list-system[data-variant="retry"]{cursor:pointer}
|
|
478
485
|
.ok-native-list-rail{padding:4px;gap:6px;border-radius:8px}.ok-native-list-rail .ok-native-list-visual{width:20px;height:20px;flex-basis:20px}.ok-native-list-rail .ok-native-list-visual>img,.ok-native-list-rail .ok-native-list-visual-main{width:20px;height:20px}.ok-native-list-rail-title{font-size:12px;font-weight:500;white-space:nowrap;font-family:var(--nl-font-medium)}
|
|
@@ -521,6 +528,7 @@ export const WEB_LIST_CSS = `
|
|
|
521
528
|
.ok-native-list-root .ok-native-list-item>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member>[data-nl-container-background="true"]{background:var(--nl-container-background)}
|
|
522
529
|
.ok-native-list-root [data-nl-container-border="true"]{position:relative}
|
|
523
530
|
.ok-native-list-root [data-nl-container-border="true"]::before{content:"";position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 var(--nl-container-border-width) var(--nl-container-border-color);z-index:2;pointer-events:none}
|
|
531
|
+
.ok-native-list-root [data-nl-inline-warning="true"][data-nl-container-border="true"]::before{box-shadow:none;border-block:var(--nl-container-border-width) solid var(--nl-container-border-color);border-inline:0;border-radius:0}
|
|
524
532
|
.ok-native-list-root .ok-native-list-item[data-native-list-row-press-enabled="true"]:hover>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-item[data-native-list-row-press-enabled="true"]:active>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member:hover>[data-nl-container-background="true"],.ok-native-list-root .ok-native-list-wallet-member:active>[data-nl-container-background="true"]{background:var(--nl-pressed)}
|
|
525
533
|
`;
|
|
526
534
|
function createElement(document, tag, className, text) {
|
|
@@ -718,6 +726,38 @@ function paintSelectorImageBackground(image, frame, inset = 0) {
|
|
|
718
726
|
|
|
719
727
|
// OneKey patch: use source SVG paths for selector actions and wallet provider marks.
|
|
720
728
|
const selectorIcons = {
|
|
729
|
+
RefreshCcwOutline: {
|
|
730
|
+
viewBox: '0 0 24 24',
|
|
731
|
+
paths: [{
|
|
732
|
+
d: 'M5 12a7 7 0 0 0 7 7 7.15 7.15 0 0 0 4.955-2h-2.943v-2h6v6h-2v-2.257A9.148 9.148 0 0 1 12 21a9 9 0 0 1-9-9v-1h2v1Zm1-6.754A9.148 9.148 0 0 1 12 3a9 9 0 0 1 9 9v1h-2v-1a7 7 0 0 0-7-7 7.15 7.15 0 0 0-4.955 2H10v2H4V3h2v2.246Z',
|
|
733
|
+
fill: 'currentColor',
|
|
734
|
+
fillRule: 'nonzero',
|
|
735
|
+
opacity: 1
|
|
736
|
+
}]
|
|
737
|
+
},
|
|
738
|
+
TicketOutline: {
|
|
739
|
+
viewBox: '0 0 24 24',
|
|
740
|
+
paths: [{
|
|
741
|
+
d: 'M16 17.01h-2V15h2v2.01Zm0-4h-2V11h2v2.01Zm0-4h-2V7h2v2.01Z',
|
|
742
|
+
fill: 'currentColor',
|
|
743
|
+
fillRule: 'nonzero',
|
|
744
|
+
opacity: 1
|
|
745
|
+
}, {
|
|
746
|
+
d: 'm22 9.927-.629.252c-1.661.665-1.661 2.977 0 3.642l.629.252V20H2v-5.927l.629-.252c1.661-.665 1.661-2.977 0-3.642L2 9.927V4h20v5.927ZM4 8.636c2.5 1.52 2.499 5.207 0 6.727V18h16v-2.637c-2.499-1.52-2.5-5.208 0-6.727V6H4v2.636Z',
|
|
747
|
+
fill: 'currentColor',
|
|
748
|
+
fillRule: 'evenodd',
|
|
749
|
+
opacity: 1
|
|
750
|
+
}]
|
|
751
|
+
},
|
|
752
|
+
GasSolid: {
|
|
753
|
+
viewBox: '0 0 24 24',
|
|
754
|
+
paths: [{
|
|
755
|
+
d: 'M15 9h4v7h1V8.414L17.586 6 19 4.586l3 3V18h-5v-7h-2v8h1v2H2v-2h1V3h12zM6 9v2h6V9z',
|
|
756
|
+
fill: 'currentColor',
|
|
757
|
+
fillRule: 'evenodd',
|
|
758
|
+
opacity: 1
|
|
759
|
+
}]
|
|
760
|
+
},
|
|
721
761
|
CryptoCoinOutline: {
|
|
722
762
|
viewBox: '0 0 24 24',
|
|
723
763
|
paths: [{
|
|
@@ -962,6 +1002,7 @@ function applySelectorIcon(element, name) {
|
|
|
962
1002
|
}
|
|
963
1003
|
function iconGlyph(name) {
|
|
964
1004
|
const normalized = name.toLocaleLowerCase();
|
|
1005
|
+
if (normalized === 'dotversolid') return '⋮';
|
|
965
1006
|
if (normalized.includes('chevron')) {
|
|
966
1007
|
if (normalized.includes('top')) return '⌃';
|
|
967
1008
|
if (normalized.includes('bottom')) return '⌄';
|
|
@@ -1009,6 +1050,8 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1009
1050
|
const showsSourcePlaceholder = !!source && source.loadingStrategy !== undefined && source.loadingStrategy !== 'none';
|
|
1010
1051
|
frame.style.background = showsSourcePlaceholder ? 'var(--nl-strong)' : visualBackground;
|
|
1011
1052
|
const fallbackIcon = 'fallbackIcon' in visual ? visual.fallbackIcon : undefined;
|
|
1053
|
+
const fallbackBackground = fallbackIcon?.backgroundColor ?? 'var(--nl-strong)';
|
|
1054
|
+
if (!source && fallbackIcon?.backgroundColor) frame.style.background = fallbackBackground;
|
|
1012
1055
|
const handlesSourceFallback = showsSourcePlaceholder && (fallbackIcon !== undefined || 'fallbackText' in visual);
|
|
1013
1056
|
const image = source ? createImage(context, source) : undefined;
|
|
1014
1057
|
if (image) {
|
|
@@ -1022,6 +1065,24 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1022
1065
|
if (image.complete && image.naturalWidth > 0) restoreBackground();
|
|
1023
1066
|
}
|
|
1024
1067
|
if (selectorPresentation) paintSelectorImageBackground(image, frame);
|
|
1068
|
+
if (source?.loadingStrategy === 'skeleton' && !(image.complete && image.naturalWidth > 0)) {
|
|
1069
|
+
const skeleton = createElement(context.document, 'span', 'ok-native-list-image-skeleton');
|
|
1070
|
+
const background = resolvedTheme(context.snapshot).background;
|
|
1071
|
+
const rgb = /^#([0-9a-f]{6})/i.exec(background)?.[1];
|
|
1072
|
+
if (rgb) {
|
|
1073
|
+
const red = Number.parseInt(rgb.slice(0, 2), 16);
|
|
1074
|
+
const green = Number.parseInt(rgb.slice(2, 4), 16);
|
|
1075
|
+
const blue = Number.parseInt(rgb.slice(4, 6), 16);
|
|
1076
|
+
if (red * 299 + green * 587 + blue * 114 < 128_000) skeleton.dataset.dark = 'true';
|
|
1077
|
+
}
|
|
1078
|
+
frame.appendChild(skeleton);
|
|
1079
|
+
image.addEventListener('load', () => skeleton.remove(), {
|
|
1080
|
+
once: true
|
|
1081
|
+
});
|
|
1082
|
+
image.addEventListener('error', () => skeleton.remove(), {
|
|
1083
|
+
once: true
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1025
1086
|
} else if (!source || showsSourcePlaceholder) {
|
|
1026
1087
|
frame.appendChild(createElement(context.document, 'span', 'ok-native-list-visual-fallback', 'fallbackText' in visual ? visual.fallbackText ?? '' : ''));
|
|
1027
1088
|
}
|
|
@@ -1045,11 +1106,19 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1045
1106
|
}
|
|
1046
1107
|
frame.querySelector('.ok-native-list-visual-fallback:not(.ok-native-list-visual-corner)')?.remove();
|
|
1047
1108
|
const fallback = createElement(context.document, 'span', 'ok-native-list-visual-fallback', fallbackIcon ? undefined : 'fallbackText' in visual ? visual.fallbackText ?? '' : '');
|
|
1109
|
+
if ('fallbackTextColor' in visual && visual.fallbackTextColor && !fallbackIcon) fallback.style.color = visual.fallbackTextColor;
|
|
1048
1110
|
if (fallbackIcon) {
|
|
1049
1111
|
applySelectorIcon(fallback, fallbackIcon.name);
|
|
1050
1112
|
if (fallbackIcon.tintColor) fallback.style.color = fallbackIcon.tintColor;
|
|
1113
|
+
if (fallbackIcon.size) {
|
|
1114
|
+
const svg = fallback.querySelector('svg');
|
|
1115
|
+
if (svg) {
|
|
1116
|
+
svg.style.width = `${fallbackIcon.size}px`;
|
|
1117
|
+
svg.style.height = `${fallbackIcon.size}px`;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1051
1120
|
}
|
|
1052
|
-
fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
1121
|
+
if (fallbackIcon?.backgroundColor) frame.style.background = fallbackBackground;else fallback.style.backgroundColor = 'var(--nl-image-fallback-background, transparent)';
|
|
1053
1122
|
frame.prepend(fallback);
|
|
1054
1123
|
};
|
|
1055
1124
|
if (image) image.addEventListener('error', showFallback, {
|
|
@@ -1059,6 +1128,9 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1059
1128
|
if ('borderStyle' in visual && visual.borderStyle === 'dashed') {
|
|
1060
1129
|
frame.style.border = '2px dashed ' + (visual.borderColor ?? 'var(--nl-disabled)');
|
|
1061
1130
|
frame.style.boxSizing = 'border-box';
|
|
1131
|
+
} else if ('borderColor' in visual && visual.borderColor) {
|
|
1132
|
+
frame.style.border = '1px solid ' + visual.borderColor;
|
|
1133
|
+
frame.style.boxSizing = 'border-box';
|
|
1062
1134
|
}
|
|
1063
1135
|
if ('overlays' in visual) visual.overlays?.forEach(overlay => {
|
|
1064
1136
|
const corner = createElement(context.document, 'span', 'ok-native-list-visual-overlay', overlay.text);
|
|
@@ -1072,6 +1144,12 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1072
1144
|
corner.style.lineHeight = '16px';
|
|
1073
1145
|
applyTextWeight(corner, '400');
|
|
1074
1146
|
}
|
|
1147
|
+
if (overlay.fontWeight) applyTextWeight(corner, {
|
|
1148
|
+
regular: 400,
|
|
1149
|
+
medium: 500,
|
|
1150
|
+
semibold: 600,
|
|
1151
|
+
bold: 700
|
|
1152
|
+
}[overlay.fontWeight]);
|
|
1075
1153
|
if (isWalletText || overlay.width !== undefined || overlay.height !== undefined) corner.style.borderRadius = '9999px';
|
|
1076
1154
|
const offsetX = String(-(overlay.offsetX ?? overlay.offset ?? 2)) + 'px';
|
|
1077
1155
|
const offsetY = String(-(overlay.offsetY ?? overlay.offset ?? 2)) + 'px';
|
|
@@ -1087,7 +1165,20 @@ function createVisual(context, visual, selectorPresentation) {
|
|
|
1087
1165
|
if (overlay.image) {
|
|
1088
1166
|
const overlayImage = createImage(context, overlay.image);
|
|
1089
1167
|
if (overlayImage) {
|
|
1168
|
+
if ((overlay.padding ?? 0) > 0 && (overlay.width ?? size) === (overlay.height ?? size)) overlayImage.style.borderRadius = '50%';
|
|
1090
1169
|
corner.appendChild(overlayImage);
|
|
1170
|
+
if (overlay.fallbackIcon) {
|
|
1171
|
+
overlayImage.addEventListener('error', () => {
|
|
1172
|
+
disposeWebImageRetries(overlayImage);
|
|
1173
|
+
overlayImage.remove();
|
|
1174
|
+
const glyph = createElement(context.document, 'span', 'ok-native-list-overlay-fallback');
|
|
1175
|
+
applySelectorIcon(glyph, overlay.fallbackIcon.name);
|
|
1176
|
+
if (overlay.fallbackIcon?.tintColor) glyph.style.color = overlay.fallbackIcon.tintColor;
|
|
1177
|
+
corner.appendChild(glyph);
|
|
1178
|
+
}, {
|
|
1179
|
+
once: true
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1091
1182
|
if (selectorPresentation) paintSelectorImageBackground(overlayImage, corner, overlay.padding ?? 0);
|
|
1092
1183
|
}
|
|
1093
1184
|
} else if (overlay.name) applySelectorIcon(corner, overlay.name);
|
|
@@ -1167,7 +1258,23 @@ function markActionAnchorSource(element, source, slot) {
|
|
|
1167
1258
|
|
|
1168
1259
|
// OneKey patch: the compact zero-count digits share the amount baseline.
|
|
1169
1260
|
|
|
1170
|
-
function createAccessory(context, rowKey, accessory, slot) {
|
|
1261
|
+
function createAccessory(context, rowKey, accessory, slot, rowDisabled) {
|
|
1262
|
+
if (accessory.kind === 'button') {
|
|
1263
|
+
const element = createElement(context.document, 'button', 'ok-native-list-trailing-button', accessory.label);
|
|
1264
|
+
element.type = 'button';
|
|
1265
|
+
element.disabled = Boolean(rowDisabled || accessory.disabled);
|
|
1266
|
+
element.setAttribute('aria-disabled', String(element.disabled));
|
|
1267
|
+
element.setAttribute('aria-label', accessory.accessibilityLabel ?? accessory.label);
|
|
1268
|
+
setData(element, 'testid', accessory.testID);
|
|
1269
|
+
setData(element, 'nativeListAction', accessory.actionKey);
|
|
1270
|
+
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1271
|
+
if (accessory.textColor) element.style.setProperty('--nl-button-text', accessory.textColor);
|
|
1272
|
+
if (accessory.backgroundColor) element.style.setProperty('--nl-button-bg', accessory.backgroundColor);
|
|
1273
|
+
if (accessory.pressedBackgroundColor) element.style.setProperty('--nl-button-pressed', accessory.pressedBackgroundColor);
|
|
1274
|
+
if (accessory.hoverBackgroundColor) element.style.setProperty('--nl-button-hover', accessory.hoverBackgroundColor);
|
|
1275
|
+
if (accessory.focusRingColor) element.style.setProperty('--nl-button-focus', accessory.focusRingColor);
|
|
1276
|
+
return element;
|
|
1277
|
+
}
|
|
1171
1278
|
if (accessory.kind === 'checkbox') {
|
|
1172
1279
|
const element = createCheckbox(context, rowKey, accessory);
|
|
1173
1280
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
@@ -1176,8 +1283,19 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1176
1283
|
if (accessory.kind === 'icon') {
|
|
1177
1284
|
const element = createIconAction(context, accessory.name, accessory.actionKey, accessory.disabled, accessory.tintColor);
|
|
1178
1285
|
markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1286
|
+
if (accessory.name === 'RefreshCcwOutline' && !accessory.actionKey) {
|
|
1287
|
+
element.classList.add('ok-native-list-decorative-refresh');
|
|
1288
|
+
const glyph = element.querySelector('svg');
|
|
1289
|
+
glyph?.setAttribute('width', '16');
|
|
1290
|
+
glyph?.setAttribute('height', '16');
|
|
1291
|
+
}
|
|
1292
|
+
if (accessory.buttonStyle === 'tertiary') {
|
|
1293
|
+
element.classList.add('ok-native-list-tertiary-icon');
|
|
1294
|
+
setData(element, 'nativeListAnchorInset', 7);
|
|
1295
|
+
}
|
|
1179
1296
|
setData(element, 'testid', accessory.testID);
|
|
1180
1297
|
if (accessory.hoverActionKey) setData(element, 'nativeListHoverAction', accessory.hoverActionKey);
|
|
1298
|
+
if (accessory.hoverActionKey && accessory.buttonStyle === 'tertiary') setData(element, 'nativeListIconHelp', true);
|
|
1181
1299
|
if (accessory.accessibilityLabel) element.setAttribute('aria-label', accessory.accessibilityLabel);
|
|
1182
1300
|
const row = context.snapshot.rows[context.itemIndex];
|
|
1183
1301
|
if (row && 'presentation' in row && row.presentation === 'accountSelector') {
|
|
@@ -1210,8 +1328,27 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1210
1328
|
{
|
|
1211
1329
|
const primary = createElement(context.document, 'span', undefined, accessory.primary);
|
|
1212
1330
|
primary.style.color = toneColor(accessory.primaryTone, 'primary');
|
|
1331
|
+
applyValueSegments(primary, accessory.primaryTextSegments, 16, 20, 500);
|
|
1332
|
+
if (accessory.primaryFontWeight === 'medium') applyTextWeight(primary, 500);
|
|
1333
|
+
if (accessory.primaryHelp) {
|
|
1334
|
+
const help = accessory.primaryHelp;
|
|
1335
|
+
primary.tabIndex = 0;
|
|
1336
|
+
primary.setAttribute('role', 'button');
|
|
1337
|
+
if (help.presentation === 'tooltip') {
|
|
1338
|
+
setData(primary, 'nativeListHoverAction', help.actionKey);
|
|
1339
|
+
setData(primary, 'nativeListIconHelp', true);
|
|
1340
|
+
} else {
|
|
1341
|
+
setData(primary, 'nativeListAction', help.actionKey);
|
|
1342
|
+
}
|
|
1343
|
+
if (help.underline === 'dashed') {
|
|
1344
|
+
primary.style.textDecoration = 'underline dashed';
|
|
1345
|
+
primary.style.textUnderlineOffset = '4px';
|
|
1346
|
+
}
|
|
1347
|
+
markActionAnchorSource(primary, 'trailingAccessory', slot);
|
|
1348
|
+
}
|
|
1213
1349
|
const secondary = createElement(context.document, 'span', 'ok-native-list-secondary', accessory.secondary);
|
|
1214
1350
|
secondary.style.color = toneColor(accessory.secondaryTone, 'secondary');
|
|
1351
|
+
applyValueSegments(secondary, accessory.secondaryTextSegments, 14, 20, 400);
|
|
1215
1352
|
element.replaceChildren(primary, '\n', secondary);
|
|
1216
1353
|
element.classList.add('ok-native-list-amounts');
|
|
1217
1354
|
break;
|
|
@@ -1239,10 +1376,10 @@ function createAccessory(context, rowKey, accessory, slot) {
|
|
|
1239
1376
|
if (actionKey) markActionAnchorSource(element, 'trailingAccessory', slot);
|
|
1240
1377
|
return element;
|
|
1241
1378
|
}
|
|
1242
|
-
function rendererPrimitives(context) {
|
|
1379
|
+
function rendererPrimitives(context, rowDisabled) {
|
|
1243
1380
|
return {
|
|
1244
1381
|
background: resolvedTheme(context.snapshot).background,
|
|
1245
|
-
accessory: (key, descriptor, slot) => createAccessory(context, key, descriptor, slot),
|
|
1382
|
+
accessory: (key, descriptor, slot) => createAccessory(context, key, descriptor, slot, rowDisabled),
|
|
1246
1383
|
visual: (source, presentation) => createVisual(context, source, presentation),
|
|
1247
1384
|
thumbnail: source => createImage(context, source, 'ok-native-list-thumbnail'),
|
|
1248
1385
|
textStyle: applyTextStyleToSlot,
|
|
@@ -1252,7 +1389,7 @@ function rendererPrimitives(context) {
|
|
|
1252
1389
|
};
|
|
1253
1390
|
}
|
|
1254
1391
|
export function createRowBody(context, row) {
|
|
1255
|
-
return rowRenderer(row).create(context.document, rendererPrimitives(context));
|
|
1392
|
+
return rowRenderer(row).create(context.document, rendererPrimitives(context, Boolean(row.disabled)));
|
|
1256
1393
|
}
|
|
1257
1394
|
export class NativeListWebEngine {
|
|
1258
1395
|
rows = [];
|
|
@@ -1270,6 +1407,7 @@ export class NativeListWebEngine {
|
|
|
1270
1407
|
rail: [],
|
|
1271
1408
|
mediaTile: [],
|
|
1272
1409
|
action: [],
|
|
1410
|
+
buttonGroup: [],
|
|
1273
1411
|
system: [],
|
|
1274
1412
|
activity: [],
|
|
1275
1413
|
dataRow: [],
|
|
@@ -1296,6 +1434,16 @@ export class NativeListWebEngine {
|
|
|
1296
1434
|
lastViewportWidth = -1;
|
|
1297
1435
|
lastViewportHeight = -1;
|
|
1298
1436
|
destroyed = false;
|
|
1437
|
+
hasAppliedSnapshot = false;
|
|
1438
|
+
structuralRevision = 0;
|
|
1439
|
+
structuralAnimations = [];
|
|
1440
|
+
structuralScrollInterrupted = false;
|
|
1441
|
+
reactFooterHeight = 0;
|
|
1442
|
+
structuralFooterCompensation = 0;
|
|
1443
|
+
structuralFooterExpansion = 0;
|
|
1444
|
+
structuralFooterFromHeight = 0;
|
|
1445
|
+
structuralProgress = 0;
|
|
1446
|
+
structuralPrefixTransition = false;
|
|
1299
1447
|
sectionIndexAlignStart = false;
|
|
1300
1448
|
// Renderers report intrinsic height after browser text wrapping.
|
|
1301
1449
|
measuredRendererHeights = new Map();
|
|
@@ -1384,6 +1532,9 @@ export class NativeListWebEngine {
|
|
|
1384
1532
|
});
|
|
1385
1533
|
}
|
|
1386
1534
|
(this.externalScrollHost ?? this.viewport).addEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
1535
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart']) (this.externalScrollHost ?? this.viewport).addEventListener(event, this.handleStructuralUserScroll, {
|
|
1536
|
+
passive: true
|
|
1537
|
+
});
|
|
1387
1538
|
this.viewport.addEventListener('scroll', this.handleScroll, {
|
|
1388
1539
|
passive: true
|
|
1389
1540
|
});
|
|
@@ -1399,6 +1550,7 @@ export class NativeListWebEngine {
|
|
|
1399
1550
|
this.root.addEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1400
1551
|
// OneKey patch: preserve web tooltip hover for section titles.
|
|
1401
1552
|
this.root.addEventListener('pointerover', this.handleTitlePointerOver);
|
|
1553
|
+
this.root.addEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
1402
1554
|
this.root.addEventListener('focusin', this.handleTitlePointerOver);
|
|
1403
1555
|
this.root.addEventListener('focusout', this.handleTitlePointerOut);
|
|
1404
1556
|
this.root.addEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -1522,8 +1674,282 @@ export class NativeListWebEngine {
|
|
|
1522
1674
|
return next;
|
|
1523
1675
|
});
|
|
1524
1676
|
if (!validated) return;
|
|
1677
|
+
this.pressedHelpElement = undefined;
|
|
1525
1678
|
this.invalidateActionAnchor('snapshot');
|
|
1526
|
-
|
|
1679
|
+
const transition = validated.structuralTransition;
|
|
1680
|
+
const isNewTransition = transition !== undefined && transition.id !== this.lastStructuralTransitionId;
|
|
1681
|
+
if (transition) this.lastStructuralTransitionId = transition.id;
|
|
1682
|
+
const nextRows = effectiveRows(validated);
|
|
1683
|
+
const changedKeys = this.rows.length !== nextRows.length || this.rows.some((row, index) => row.key !== nextRows[index]?.key);
|
|
1684
|
+
const incompatibleActivePrefix = this.structuralPrefixTransition && (validated.layout.kind !== this.snapshot.layout.kind || validated.layout.orientation !== this.snapshot.layout.orientation || nextRows.some((row, index) => row.height !== this.rows[index]?.height || row.style?.container?.height !== this.rows[index]?.style?.container?.height));
|
|
1685
|
+
const shouldAnimate = this.hasAppliedSnapshot && isNewTransition && changedKeys && (this.snapshot.layout.kind === 'linear' || this.snapshot.layout.kind === 'table') && this.snapshot.layout.orientation !== 'horizontal' && (validated.layout.kind === 'linear' || validated.layout.kind === 'table') && validated.layout.orientation !== 'horizontal' && (transition?.durationMs ?? 220) > 0 && !this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
|
|
1686
|
+
if (shouldAnimate && transition) this.applyStructuralSnapshot(validated, transition);else {
|
|
1687
|
+
if (isNewTransition || changedKeys || incompatibleActivePrefix) this.cancelStructuralAnimation();
|
|
1688
|
+
this.setSnapshot(validated);
|
|
1689
|
+
}
|
|
1690
|
+
this.hasAppliedSnapshot = true;
|
|
1691
|
+
}
|
|
1692
|
+
cancelStructuralAnimation() {
|
|
1693
|
+
this.structuralRevision += 1;
|
|
1694
|
+
if (this.structuralFrame !== undefined) this.document.defaultView?.cancelAnimationFrame(this.structuralFrame);
|
|
1695
|
+
if (this.structuralFinish !== undefined) this.document.defaultView?.clearTimeout(this.structuralFinish);
|
|
1696
|
+
this.structuralFrame = undefined;
|
|
1697
|
+
this.structuralFinish = undefined;
|
|
1698
|
+
this.structuralAnimations.forEach(animation => animation.cancel());
|
|
1699
|
+
this.structuralAnimations = [];
|
|
1700
|
+
if (this.structuralTail) {
|
|
1701
|
+
disposeWebImageRetries(this.structuralTail.layer);
|
|
1702
|
+
this.structuralTail.layer.remove();
|
|
1703
|
+
this.structuralTail = undefined;
|
|
1704
|
+
}
|
|
1705
|
+
if (this.structuralContentOverflow !== undefined) {
|
|
1706
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
1707
|
+
this.structuralContentOverflow = undefined;
|
|
1708
|
+
}
|
|
1709
|
+
this.structuralPrefixTransition = false;
|
|
1710
|
+
if (this.structuralFooterElement && this.structuralFooterStyles) {
|
|
1711
|
+
this.structuralFooterElement.style.marginBottom = this.structuralFooterStyles.marginBottom;
|
|
1712
|
+
this.structuralFooterElement.style.transform = this.structuralFooterStyles.transform;
|
|
1713
|
+
this.structuralFooterElement.style.clipPath = this.structuralFooterStyles.clipPath;
|
|
1714
|
+
}
|
|
1715
|
+
this.structuralFooterElement = undefined;
|
|
1716
|
+
this.structuralFooterStyles = undefined;
|
|
1717
|
+
this.structuralScrollInterrupted = false;
|
|
1718
|
+
this.structuralRenderedHeight = undefined;
|
|
1719
|
+
this.structuralTargetHeight = undefined;
|
|
1720
|
+
this.structuralFooterCompensation = 0;
|
|
1721
|
+
this.structuralFooterExpansion = 0;
|
|
1722
|
+
this.structuralProgress = 0;
|
|
1723
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1724
|
+
if (this.structuralAnchorStyles) {
|
|
1725
|
+
owner.style.overflowAnchor = this.structuralAnchorStyles.owner;
|
|
1726
|
+
this.content.style.overflowAnchor = this.structuralAnchorStyles.content;
|
|
1727
|
+
this.structuralAnchorStyles = undefined;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
handleStructuralUserScroll = event => {
|
|
1731
|
+
if (event.type === 'pointerdown' && event.target !== (this.externalScrollHost ?? this.viewport) && event.pointerType !== 'touch') return;
|
|
1732
|
+
this.structuralScrollInterrupted = true;
|
|
1733
|
+
if (this.structuralPrefixTransition) {
|
|
1734
|
+
this.cancelStructuralAnimation();
|
|
1735
|
+
this.recomputeLayout();
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
updateStructuralTailWindow() {
|
|
1739
|
+
const tail = this.structuralTail;
|
|
1740
|
+
if (!tail) return;
|
|
1741
|
+
const visible = visibleWebLayoutItems(tail.layout, this.currentOffset(), this.viewportLength(), this.viewportLength() * OVERSCAN_VIEWPORTS).filter(item => item.index >= tail.firstIndex);
|
|
1742
|
+
const desired = new Set(visible.map(item => item.index));
|
|
1743
|
+
tail.mounted.forEach((element, index) => {
|
|
1744
|
+
if (desired.has(index)) return;
|
|
1745
|
+
disposeWebImageRetries(element);
|
|
1746
|
+
element.remove();
|
|
1747
|
+
tail.mounted.delete(index);
|
|
1748
|
+
});
|
|
1749
|
+
visible.forEach(item => {
|
|
1750
|
+
if (tail.mounted.has(item.index)) return;
|
|
1751
|
+
const row = tail.rows[item.index];
|
|
1752
|
+
if (!row) return;
|
|
1753
|
+
const element = createElement(this.document, 'div', 'ok-native-list-item');
|
|
1754
|
+
element.setAttribute('aria-hidden', 'true');
|
|
1755
|
+
element.style.pointerEvents = 'none';
|
|
1756
|
+
element.style.opacity = String((row.style?.container?.opacity ?? row.opacity ?? 1) * (row.disabled ? 0.5 : 1));
|
|
1757
|
+
const body = createRowBody({
|
|
1758
|
+
document: this.document,
|
|
1759
|
+
snapshot: tail.snapshot,
|
|
1760
|
+
selectedKeys: selectionStateFromSnapshot(tail.snapshot).selectedKeys,
|
|
1761
|
+
itemIndex: item.index
|
|
1762
|
+
}, row);
|
|
1763
|
+
applyRowStyle(body, row);
|
|
1764
|
+
element.append(body);
|
|
1765
|
+
this.positionElement(element, item);
|
|
1766
|
+
tail.layer.append(element);
|
|
1767
|
+
tail.mounted.set(item.index, element);
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
writeStructuralHeight(height) {
|
|
1771
|
+
if (this.externalScrollHost) this.writeExternalHeight(height);else this.content.style.height = `${height}px`;
|
|
1772
|
+
}
|
|
1773
|
+
reactFooterElement() {
|
|
1774
|
+
return this.contentBounds?.querySelector('[data-testid="native-list-footer-slot"]');
|
|
1775
|
+
}
|
|
1776
|
+
readReactFooterHeight() {
|
|
1777
|
+
return this.reactFooterElement()?.getBoundingClientRect().height ?? 0;
|
|
1778
|
+
}
|
|
1779
|
+
applyStructuralFooterVisual(progress) {
|
|
1780
|
+
const footer = this.structuralFooterElement;
|
|
1781
|
+
if (!footer || this.structuralFooterExpansion <= 0) return;
|
|
1782
|
+
const hidden = this.structuralFooterExpansion * (1 - progress);
|
|
1783
|
+
footer.style.marginBottom = `${-hidden}px`;
|
|
1784
|
+
footer.style.transform = `translateY(${-hidden}px)`;
|
|
1785
|
+
footer.style.clipPath = `inset(${hidden}px 0 0 0)`;
|
|
1786
|
+
}
|
|
1787
|
+
applyStructuralSnapshot(next, transition) {
|
|
1788
|
+
const owner = this.externalScrollHost ?? this.viewport;
|
|
1789
|
+
const oldOffset = owner.scrollTop;
|
|
1790
|
+
const oldScrollHeight = owner.scrollHeight;
|
|
1791
|
+
const oldHeight = this.structuralRenderedHeight ?? (this.content.getBoundingClientRect().height || this.layout.contentHeight);
|
|
1792
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
1793
|
+
const oldFooterHeight = this.structuralRenderedHeight === undefined ? this.reactFooterHeight : this.structuralFooterFromHeight + (this.reactFooterHeight - this.structuralFooterFromHeight) * this.structuralProgress;
|
|
1794
|
+
const footerDifference = oldFooterHeight - nextFooterHeight;
|
|
1795
|
+
const startHeight = oldHeight + Math.max(0, footerDifference);
|
|
1796
|
+
const oldSnapshot = this.snapshot;
|
|
1797
|
+
const oldRows = this.rows;
|
|
1798
|
+
const oldLayout = this.layout;
|
|
1799
|
+
const oldItems = oldLayout.items;
|
|
1800
|
+
const nextRows = effectiveRows(next);
|
|
1801
|
+
const prefixCount = Math.min(oldRows.length, nextRows.length);
|
|
1802
|
+
const prefixTailChange = oldSnapshot.layout.kind === next.layout.kind && oldSnapshot.layout.orientation === next.layout.orientation && oldRows.length !== nextRows.length && oldRows.slice(0, prefixCount).every((row, index) => row.key === nextRows[index]?.key);
|
|
1803
|
+
const oldPositions = new Map();
|
|
1804
|
+
this.mounted.forEach((element, index) => {
|
|
1805
|
+
const row = this.rows[index];
|
|
1806
|
+
if (row) oldPositions.set(row.key, element.getBoundingClientRect().top);
|
|
1807
|
+
});
|
|
1808
|
+
const nextKeys = new Set(effectiveRows(next).map(row => row.key));
|
|
1809
|
+
const visibleOffset = this.currentOffset();
|
|
1810
|
+
const visibleSurvivor = oldItems.find(item => item.y + item.height > visibleOffset && nextKeys.has(item.key));
|
|
1811
|
+
const anchor = visibleSurvivor;
|
|
1812
|
+
this.cancelStructuralAnimation();
|
|
1813
|
+
this.structuralScrollInterrupted = false;
|
|
1814
|
+
this.structuralAnchorStyles = {
|
|
1815
|
+
owner: owner.style.overflowAnchor,
|
|
1816
|
+
content: this.content.style.overflowAnchor
|
|
1817
|
+
};
|
|
1818
|
+
owner.style.overflowAnchor = 'none';
|
|
1819
|
+
this.content.style.overflowAnchor = 'none';
|
|
1820
|
+
this.structuralContentOverflow = this.content.style.overflow;
|
|
1821
|
+
if (prefixTailChange) this.content.style.overflow = 'clip';
|
|
1822
|
+
this.structuralRenderedHeight = startHeight;
|
|
1823
|
+
this.structuralFooterFromHeight = oldFooterHeight;
|
|
1824
|
+
this.structuralFooterCompensation = Math.max(0, footerDifference);
|
|
1825
|
+
this.structuralFooterExpansion = Math.max(0, -footerDifference);
|
|
1826
|
+
this.structuralProgress = 0;
|
|
1827
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
1828
|
+
this.structuralFooterElement = this.reactFooterElement() ?? undefined;
|
|
1829
|
+
if (this.structuralFooterElement) {
|
|
1830
|
+
const style = this.structuralFooterElement.style;
|
|
1831
|
+
this.structuralFooterStyles = {
|
|
1832
|
+
marginBottom: style.marginBottom,
|
|
1833
|
+
transform: style.transform,
|
|
1834
|
+
clipPath: style.clipPath
|
|
1835
|
+
};
|
|
1836
|
+
this.applyStructuralFooterVisual(0);
|
|
1837
|
+
}
|
|
1838
|
+
this.setSnapshot(next);
|
|
1839
|
+
const newHeight = this.layout.contentHeight;
|
|
1840
|
+
this.structuralTargetHeight = newHeight;
|
|
1841
|
+
const stablePrefixGeometry = prefixTailChange && oldItems.length === oldRows.length && this.layout.items.length === nextRows.length && oldItems.slice(0, prefixCount).every((item, index) => {
|
|
1842
|
+
const nextItem = this.layout.items[index];
|
|
1843
|
+
return nextItem?.y === item.y && nextItem?.height === item.height && nextItem?.width === item.width;
|
|
1844
|
+
});
|
|
1845
|
+
if (!stablePrefixGeometry) {
|
|
1846
|
+
this.content.style.overflow = this.structuralContentOverflow;
|
|
1847
|
+
this.structuralContentOverflow = undefined;
|
|
1848
|
+
} else {
|
|
1849
|
+
this.structuralPrefixTransition = true;
|
|
1850
|
+
}
|
|
1851
|
+
if (stablePrefixGeometry && nextRows.length < oldRows.length) {
|
|
1852
|
+
const layer = createElement(this.document, 'div', 'ok-native-list-structural-tail');
|
|
1853
|
+
layer.setAttribute('aria-hidden', 'true');
|
|
1854
|
+
layer.setAttribute('inert', '');
|
|
1855
|
+
Object.assign(layer.style, {
|
|
1856
|
+
position: 'absolute',
|
|
1857
|
+
inset: '0',
|
|
1858
|
+
pointerEvents: 'none'
|
|
1859
|
+
});
|
|
1860
|
+
this.content.append(layer);
|
|
1861
|
+
this.structuralTail = {
|
|
1862
|
+
snapshot: oldSnapshot,
|
|
1863
|
+
rows: oldRows,
|
|
1864
|
+
layout: oldLayout,
|
|
1865
|
+
firstIndex: prefixCount,
|
|
1866
|
+
layer,
|
|
1867
|
+
mounted: new Map()
|
|
1868
|
+
};
|
|
1869
|
+
this.updateStructuralTailWindow();
|
|
1870
|
+
}
|
|
1871
|
+
const nextAnchor = anchor && this.layout.items.find(item => item.key === anchor.key);
|
|
1872
|
+
const delta = nextAnchor && anchor ? nextAnchor.y - anchor.y : 0;
|
|
1873
|
+
let finalScrollHeight = oldScrollHeight + newHeight - oldHeight;
|
|
1874
|
+
if (stablePrefixGeometry && this.externalScrollHost) {
|
|
1875
|
+
const beforeMeasure = owner.scrollTop;
|
|
1876
|
+
const tailLayer = this.structuralTail?.layer;
|
|
1877
|
+
if (tailLayer) tailLayer.style.display = 'none';
|
|
1878
|
+
this.writeStructuralHeight(newHeight);
|
|
1879
|
+
this.applyStructuralFooterVisual(1);
|
|
1880
|
+
finalScrollHeight = owner.scrollHeight;
|
|
1881
|
+
this.writeStructuralHeight(startHeight);
|
|
1882
|
+
this.applyStructuralFooterVisual(0);
|
|
1883
|
+
if (tailLayer) tailLayer.style.display = '';
|
|
1884
|
+
owner.scrollTop = beforeMeasure;
|
|
1885
|
+
}
|
|
1886
|
+
const finalMaxOffset = Math.max(0, finalScrollHeight - owner.clientHeight);
|
|
1887
|
+
let targetOffset = Math.max(0, Math.min(oldOffset + delta, finalMaxOffset));
|
|
1888
|
+
if (!visibleSurvivor && transition.anchorKey && !(stablePrefixGeometry && nextRows.length > oldRows.length)) {
|
|
1889
|
+
const fallback = this.layout.items.find(item => item.key === transition.anchorKey);
|
|
1890
|
+
if (fallback) {
|
|
1891
|
+
const pagerStickyInset = Number.parseFloat(this.externalScrollHost?.style.getPropertyValue('--ok-collapsible-pager-sticky-inset') ?? '');
|
|
1892
|
+
const effectiveStickyInset = Math.max(this.externalStickyInset, Number.isFinite(pagerStickyInset) ? pagerStickyInset : 0);
|
|
1893
|
+
const fallbackTop = this.externalScrollHost ? this.externalGeometry().origin + fallback.y - effectiveStickyInset : resolveWebCollapsiblePagerRawOffset(Math.max(0, fallback.y - this.collapsiblePagerInsets().sticky), this.collapsiblePagerInsets().header);
|
|
1894
|
+
if (stablePrefixGeometry && this.externalScrollHost && this.reactFooterHeight > 0) {
|
|
1895
|
+
const footerTop = this.externalGeometry().origin + newHeight;
|
|
1896
|
+
const footerStart = Math.max(0, footerTop + this.reactFooterHeight - owner.clientHeight);
|
|
1897
|
+
const footerEnd = Math.max(0, footerTop - effectiveStickyInset);
|
|
1898
|
+
const nearestVisibleOffset = footerStart <= footerEnd ? Math.max(footerStart, Math.min(oldOffset, footerEnd)) : footerEnd;
|
|
1899
|
+
targetOffset = Math.max(0, Math.min(nearestVisibleOffset, finalMaxOffset));
|
|
1900
|
+
} else {
|
|
1901
|
+
targetOffset = Math.min(targetOffset, Math.max(0, fallbackTop));
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
const duration = transition.durationMs ?? 220;
|
|
1906
|
+
const easing = 'cubic-bezier(0.42, 0, 0.58, 1)';
|
|
1907
|
+
this.mounted.forEach((element, index) => {
|
|
1908
|
+
const row = this.rows[index];
|
|
1909
|
+
const previousTop = row && oldPositions.get(row.key);
|
|
1910
|
+
if (previousTop === undefined || typeof element.animate !== 'function') return;
|
|
1911
|
+
const offset = previousTop - element.getBoundingClientRect().top;
|
|
1912
|
+
if (Math.abs(offset) < 0.5) return;
|
|
1913
|
+
this.structuralAnimations.push(element.animate([{
|
|
1914
|
+
transform: `translateY(${offset}px)`
|
|
1915
|
+
}, {
|
|
1916
|
+
transform: 'translateY(0)'
|
|
1917
|
+
}], {
|
|
1918
|
+
duration,
|
|
1919
|
+
easing
|
|
1920
|
+
}));
|
|
1921
|
+
});
|
|
1922
|
+
const startedAt = this.document.defaultView?.performance.now() ?? Date.now();
|
|
1923
|
+
const revision = this.structuralRevision;
|
|
1924
|
+
const finish = () => {
|
|
1925
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
1926
|
+
const ownsScroll = !this.structuralScrollInterrupted;
|
|
1927
|
+
this.cancelStructuralAnimation();
|
|
1928
|
+
this.recomputeLayout();
|
|
1929
|
+
if (stablePrefixGeometry && ownsScroll) {
|
|
1930
|
+
owner.scrollTop = Math.max(0, Math.min(targetOffset, owner.scrollHeight - owner.clientHeight));
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
const step = time => {
|
|
1934
|
+
if (this.destroyed || revision !== this.structuralRevision) return;
|
|
1935
|
+
if (this.structuralPrefixTransition && this.document.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {
|
|
1936
|
+
finish();
|
|
1937
|
+
return;
|
|
1938
|
+
}
|
|
1939
|
+
const progress = Math.min(1, (time - startedAt) / duration);
|
|
1940
|
+
const eased = progress * progress * (3 - 2 * progress);
|
|
1941
|
+
this.structuralProgress = eased;
|
|
1942
|
+
const renderedHeight = oldHeight + ((this.structuralTargetHeight ?? newHeight) - oldHeight) * eased + this.structuralFooterCompensation * (1 - eased);
|
|
1943
|
+
this.structuralRenderedHeight = renderedHeight;
|
|
1944
|
+
this.writeStructuralHeight(renderedHeight);
|
|
1945
|
+
this.applyStructuralFooterVisual(eased);
|
|
1946
|
+
if (!this.structuralScrollInterrupted) owner.scrollTop = oldOffset + (targetOffset - oldOffset) * eased;
|
|
1947
|
+
this.externalGeometryCache = undefined;
|
|
1948
|
+
this.updateStructuralTailWindow();
|
|
1949
|
+
if (progress < 1) this.structuralFrame = this.document.defaultView?.requestAnimationFrame(step);
|
|
1950
|
+
};
|
|
1951
|
+
this.structuralFrame = this.document.defaultView?.requestAnimationFrame(step);
|
|
1952
|
+
this.structuralFinish = this.document.defaultView?.setTimeout(finish, duration + 40);
|
|
1527
1953
|
}
|
|
1528
1954
|
currentContentHeight() {
|
|
1529
1955
|
return this.layout.contentHeight;
|
|
@@ -1696,6 +2122,8 @@ export class NativeListWebEngine {
|
|
|
1696
2122
|
}
|
|
1697
2123
|
destroy() {
|
|
1698
2124
|
if (this.destroyed) return;
|
|
2125
|
+
this.cancelStructuralAnimation();
|
|
2126
|
+
this.pressedHelpElement = undefined;
|
|
1699
2127
|
this.invalidateActionAnchor('destroy');
|
|
1700
2128
|
this.destroyed = true;
|
|
1701
2129
|
if (this.frameHandle !== undefined) this.cancelFrame(this.frameHandle);
|
|
@@ -1708,6 +2136,7 @@ export class NativeListWebEngine {
|
|
|
1708
2136
|
this.document.defaultView?.removeEventListener('resize', this.handleWindowResize);
|
|
1709
2137
|
this.pendingScroll = undefined;
|
|
1710
2138
|
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-cancel-scroll-command', this.handlePagerScrollCommandCancel);
|
|
2139
|
+
for (const event of ['wheel', 'pointerdown', 'touchstart']) (this.externalScrollHost ?? this.viewport).removeEventListener(event, this.handleStructuralUserScroll);
|
|
1711
2140
|
this.viewport.removeEventListener('scroll', this.handleScroll);
|
|
1712
2141
|
(this.externalScrollHost ?? this.viewport).removeEventListener('ok-collapsible-pager-insets-changed', this.handleCollapsiblePagerInsetsChanged);
|
|
1713
2142
|
this.root.removeEventListener('click', this.handleClick);
|
|
@@ -1719,6 +2148,7 @@ export class NativeListWebEngine {
|
|
|
1719
2148
|
this.root.removeEventListener('pointerup', this.handleMarketPointerEnd);
|
|
1720
2149
|
this.root.removeEventListener('pointercancel', this.handleMarketPointerEnd);
|
|
1721
2150
|
this.root.removeEventListener('pointerover', this.handleTitlePointerOver);
|
|
2151
|
+
this.root.removeEventListener('pointerdown', this.handleIconHelpPointerDown);
|
|
1722
2152
|
this.root.removeEventListener('focusin', this.handleTitlePointerOver);
|
|
1723
2153
|
this.root.removeEventListener('focusout', this.handleTitlePointerOut);
|
|
1724
2154
|
this.root.removeEventListener('pointerout', this.handleTitlePointerOut);
|
|
@@ -1757,6 +2187,7 @@ export class NativeListWebEngine {
|
|
|
1757
2187
|
}
|
|
1758
2188
|
setSnapshot(snapshot, selectedKeys) {
|
|
1759
2189
|
this.cancelMarketPointer();
|
|
2190
|
+
this.pressedHelpElement = undefined;
|
|
1760
2191
|
this.measuredRendererHeights.clear();
|
|
1761
2192
|
this.snapshot = snapshot;
|
|
1762
2193
|
this.rows = effectiveRows(snapshot);
|
|
@@ -1774,6 +2205,7 @@ export class NativeListWebEngine {
|
|
|
1774
2205
|
'--nl-row': theme.rowBackground,
|
|
1775
2206
|
'--nl-selected': theme.rowSelectedBackground,
|
|
1776
2207
|
'--nl-pressed': theme.rowPressedBackground,
|
|
2208
|
+
'--nl-hover': theme.rowHoverBackground ?? theme.rowPressedBackground,
|
|
1777
2209
|
'--nl-subdued': theme.subduedBackground,
|
|
1778
2210
|
'--nl-strong': theme.strongBackground,
|
|
1779
2211
|
'--nl-image-fallback-background': theme.imageFallbackBackground ?? 'transparent',
|
|
@@ -1790,6 +2222,7 @@ export class NativeListWebEngine {
|
|
|
1790
2222
|
'--nl-separator': theme.separator,
|
|
1791
2223
|
'--nl-accent': theme.accent,
|
|
1792
2224
|
'--nl-positive': theme.positive,
|
|
2225
|
+
'--nl-success-background': theme.successBackground,
|
|
1793
2226
|
'--nl-negative': theme.negative,
|
|
1794
2227
|
'--nl-critical': theme.criticalBackground,
|
|
1795
2228
|
'--nl-inverse': theme.inverseBackground,
|
|
@@ -1850,10 +2283,24 @@ export class NativeListWebEngine {
|
|
|
1850
2283
|
}
|
|
1851
2284
|
recomputeLayout = () => {
|
|
1852
2285
|
if (this.destroyed) return;
|
|
2286
|
+
if (this.structuralPrefixTransition && this.lastViewportWidth > 0 && this.viewport.clientWidth > 0 && this.viewport.clientWidth !== this.lastViewportWidth) this.cancelStructuralAnimation();
|
|
2287
|
+
if (this.structuralRenderedHeight === undefined) this.reactFooterHeight = this.readReactFooterHeight();else {
|
|
2288
|
+
const nextFooterHeight = this.readReactFooterHeight();
|
|
2289
|
+
const footerDelta = this.reactFooterHeight - nextFooterHeight;
|
|
2290
|
+
if (footerDelta !== 0) {
|
|
2291
|
+
this.reactFooterHeight = nextFooterHeight;
|
|
2292
|
+
const priorCompensation = this.structuralFooterCompensation;
|
|
2293
|
+
const difference = this.structuralFooterFromHeight - nextFooterHeight;
|
|
2294
|
+
this.structuralFooterCompensation = Math.max(0, difference);
|
|
2295
|
+
this.structuralFooterExpansion = Math.max(0, -difference);
|
|
2296
|
+
this.structuralRenderedHeight += (this.structuralFooterCompensation - priorCompensation) * (1 - this.structuralProgress);
|
|
2297
|
+
this.applyStructuralFooterVisual(this.structuralProgress);
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
1853
2300
|
const cachedWidth = this.lastViewportWidth;
|
|
1854
2301
|
const cachedHeight = this.lastViewportHeight;
|
|
1855
2302
|
const precomputedLayout = this.externalScrollHost && cachedWidth > 0 && cachedHeight > 0 ? this.computeLayout(cachedWidth, cachedHeight) : undefined;
|
|
1856
|
-
if (precomputedLayout) {
|
|
2303
|
+
if (precomputedLayout && this.structuralRenderedHeight === undefined) {
|
|
1857
2304
|
// Commit appended row extent before measuring React-owned slot changes.
|
|
1858
2305
|
this.writeExternalHeight(Math.max(this.layout.contentHeight, precomputedLayout.contentHeight));
|
|
1859
2306
|
}
|
|
@@ -1883,11 +2330,13 @@ export class NativeListWebEngine {
|
|
|
1883
2330
|
const previousHorizontal = this.layout.horizontal;
|
|
1884
2331
|
this.layout = precomputedLayout && viewportWidth === cachedWidth && viewportHeight === cachedHeight ? precomputedLayout : this.computeLayout(viewportWidth, viewportHeight);
|
|
1885
2332
|
this.content.style.width = String(this.layout.contentWidth) + 'px';
|
|
1886
|
-
this.
|
|
2333
|
+
const renderedHeight = this.structuralRenderedHeight ?? this.layout.contentHeight;
|
|
2334
|
+
this.content.style.height = String(renderedHeight) + 'px';
|
|
1887
2335
|
if (this.externalScrollHost) {
|
|
1888
|
-
this.writeExternalHeight(
|
|
2336
|
+
this.writeExternalHeight(renderedHeight);
|
|
1889
2337
|
this.externalGeometryCache = undefined;
|
|
1890
2338
|
}
|
|
2339
|
+
if (this.structuralRenderedHeight !== undefined) this.structuralTargetHeight = this.layout.contentHeight;
|
|
1891
2340
|
this.renderSectionIndex(this.viewport.clientHeight <= 0 ? DEFAULT_VIEWPORT_HEIGHT : Math.max(1, viewportHeight), stickyInset);
|
|
1892
2341
|
if (previousHorizontal !== this.layout.horizontal) {
|
|
1893
2342
|
this.viewport.scrollLeft = 0;
|
|
@@ -1995,6 +2444,7 @@ export class NativeListWebEngine {
|
|
|
1995
2444
|
}
|
|
1996
2445
|
this.updateVisibleSelection();
|
|
1997
2446
|
this.updateVisibleState();
|
|
2447
|
+
this.updateStructuralTailWindow();
|
|
1998
2448
|
}
|
|
1999
2449
|
positionElement(element, item) {
|
|
2000
2450
|
element.style.transform = 'translate3d(' + String(item.x) + 'px,' + String(item.y) + 'px,0)';
|
|
@@ -2040,7 +2490,7 @@ export class NativeListWebEngine {
|
|
|
2040
2490
|
const body = reusableBody ?? createRowBody(context, row);
|
|
2041
2491
|
if (reusableBody) {
|
|
2042
2492
|
resetRowContainerStyle(body);
|
|
2043
|
-
registered.bind(body, rendererPrimitives(context));
|
|
2493
|
+
registered.bind(body, rendererPrimitives(context, Boolean(row.disabled)));
|
|
2044
2494
|
}
|
|
2045
2495
|
// OneKey patch: explicit selector fields preserve original page geometry.
|
|
2046
2496
|
element.style.contain = row.backgroundFullWidth ? 'layout style' : '';
|
|
@@ -2522,6 +2972,7 @@ export class NativeListWebEngine {
|
|
|
2522
2972
|
return anchor.actionElement.isConnected && anchor.rowElement.isConnected && anchor.rowElement.contains(anchor.actionElement) && anchor.rowElement.dataset.nativeListBindingEpoch === anchor.bindingEpoch;
|
|
2523
2973
|
}
|
|
2524
2974
|
invalidateActionAnchorForElement(element) {
|
|
2975
|
+
if (this.pressedHelpElement && element.contains(this.pressedHelpElement)) this.pressedHelpElement = undefined;
|
|
2525
2976
|
const anchor = this.actionAnchor;
|
|
2526
2977
|
if (anchor && (element === anchor.rowElement || element.contains(anchor.actionElement))) {
|
|
2527
2978
|
this.invalidateActionAnchor('rebind');
|
|
@@ -2594,9 +3045,9 @@ export class NativeListWebEngine {
|
|
|
2594
3045
|
if (event.target.closest('[data-native-list-action]')) return;
|
|
2595
3046
|
const rowElement = event.target.closest('[data-native-list-row-key]');
|
|
2596
3047
|
const row = this.rowAtElement(rowElement);
|
|
2597
|
-
if (row?.type !== 'market' || !isRowPressEnabled(row)) return;
|
|
3048
|
+
if (row?.type !== 'market' && row?.type !== 'identity' || !isRowPressEnabled(row)) return;
|
|
2598
3049
|
this.cancelMarketPointer();
|
|
2599
|
-
if (row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
3050
|
+
if (row.type === 'market' && row.pressInActionKey) this.emitRowAction(row, row.pressInActionKey, rowElement ?? undefined, rowElement ?? undefined);
|
|
2600
3051
|
if (!row.longPressActionKey || !rowElement) return;
|
|
2601
3052
|
markActionAnchorSource(rowElement, 'row');
|
|
2602
3053
|
const bindingEpoch = rowElement.dataset.nativeListBindingEpoch;
|
|
@@ -2605,7 +3056,7 @@ export class NativeListWebEngine {
|
|
|
2605
3056
|
if (!current || current.pointerId !== event.pointerId) return;
|
|
2606
3057
|
const currentRow = this.rowAtElement(rowElement);
|
|
2607
3058
|
this.marketPointer = undefined;
|
|
2608
|
-
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
3059
|
+
if (!rowElement.isConnected || rowElement.dataset.nativeListBindingEpoch !== bindingEpoch || currentRow?.key !== row.key || currentRow.type !== 'market' && currentRow.type !== 'identity' || !isRowPressEnabled(currentRow) || !currentRow.longPressActionKey) return;
|
|
2609
3060
|
this.marketLongPressFired = true;
|
|
2610
3061
|
this.emitRowAction(currentRow, currentRow.longPressActionKey, rowElement, rowElement, {
|
|
2611
3062
|
x: event.clientX,
|
|
@@ -2616,7 +3067,7 @@ export class NativeListWebEngine {
|
|
|
2616
3067
|
this.marketPointer = {
|
|
2617
3068
|
pointerId: event.pointerId,
|
|
2618
3069
|
pointerType: event.pointerType,
|
|
2619
|
-
compact: !row.webTable,
|
|
3070
|
+
compact: row.type === 'identity' || !row.webTable,
|
|
2620
3071
|
rowKey: row.key,
|
|
2621
3072
|
startX: event.clientX,
|
|
2622
3073
|
startY: event.clientY,
|
|
@@ -2652,7 +3103,14 @@ export class NativeListWebEngine {
|
|
|
2652
3103
|
if (!(target instanceof Element)) return;
|
|
2653
3104
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2654
3105
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
3106
|
+
if (action.dataset.nativeListIconHelp === 'true') {
|
|
3107
|
+
if (event.type === 'pointerover' && event.pointerType === 'touch') return;
|
|
3108
|
+
if (this.pressedHelpElement === action) return;
|
|
3109
|
+
}
|
|
2655
3110
|
if (action.classList.contains('ok-native-list-market-subtitle-prefix') && action.scrollWidth <= action.clientWidth + 1) return;
|
|
3111
|
+
this.emitHoverAction(action);
|
|
3112
|
+
};
|
|
3113
|
+
emitHoverAction(action) {
|
|
2656
3114
|
const rowElement = action.closest('[data-native-list-row-key]');
|
|
2657
3115
|
const row = this.rowAtElement(rowElement);
|
|
2658
3116
|
const memberKey = action.closest('[data-native-list-group-member-key]')?.dataset.nativeListGroupMemberKey;
|
|
@@ -2661,12 +3119,26 @@ export class NativeListWebEngine {
|
|
|
2661
3119
|
// Legacy Web: hover checks only the resolved source (the member for a
|
|
2662
3120
|
// WalletGroup), not the enclosing row's `disabled`.
|
|
2663
3121
|
if (sourceRow && !sourceRow.disabled && actionKey) this.emitRowAction(sourceRow, actionKey, action, rowElement ?? undefined);
|
|
3122
|
+
}
|
|
3123
|
+
handleIconHelpPointerDown = event => {
|
|
3124
|
+
const target = event.target;
|
|
3125
|
+
if (!(target instanceof Element)) return;
|
|
3126
|
+
const action = target.closest('[data-native-list-icon-help="true"]');
|
|
3127
|
+
if (!action) return;
|
|
3128
|
+
if (event.pointerType === 'touch') {
|
|
3129
|
+
if (this.actionAnchor?.actionElement === action && this.actionAnchor.open) this.invalidateActionAnchor('pointerLeave');else this.emitHoverAction(action);
|
|
3130
|
+
} else {
|
|
3131
|
+
this.pressedHelpElement = action;
|
|
3132
|
+
if (this.actionAnchor?.actionElement === action) this.invalidateActionAnchor('pointerLeave');
|
|
3133
|
+
}
|
|
2664
3134
|
};
|
|
2665
3135
|
handleTitlePointerOut = event => {
|
|
2666
3136
|
const target = event.target;
|
|
2667
3137
|
if (!(target instanceof Element)) return;
|
|
2668
3138
|
const action = target.closest('[data-native-list-hover-action]');
|
|
2669
3139
|
if (!action || event.relatedTarget instanceof Node && action.contains(event.relatedTarget)) return;
|
|
3140
|
+
if (action.dataset.nativeListIconHelp === 'true' && event.type === 'pointerout' && event.pointerType === 'touch') return;
|
|
3141
|
+
if (event.type === 'pointerout' && this.pressedHelpElement === action) this.pressedHelpElement = undefined;
|
|
2670
3142
|
if (this.actionAnchor?.actionElement === action) this.invalidateActionAnchor('pointerLeave');
|
|
2671
3143
|
};
|
|
2672
3144
|
handleClick = event => {
|
|
@@ -2678,6 +3150,11 @@ export class NativeListWebEngine {
|
|
|
2678
3150
|
}
|
|
2679
3151
|
const target = event.target;
|
|
2680
3152
|
if (!(target instanceof Element)) return;
|
|
3153
|
+
if (target.closest('[data-native-list-icon-help="true"]')) {
|
|
3154
|
+
event.preventDefault();
|
|
3155
|
+
event.stopPropagation();
|
|
3156
|
+
return;
|
|
3157
|
+
}
|
|
2681
3158
|
const rowElement = target.closest('[data-native-list-row-key]');
|
|
2682
3159
|
const row = this.rowAtElement(rowElement);
|
|
2683
3160
|
if (!row || row.disabled) return;
|
|
@@ -2689,6 +3166,8 @@ export class NativeListWebEngine {
|
|
|
2689
3166
|
// member press is blocked by `isRowPressEnabled` in `handleRowPress`.
|
|
2690
3167
|
const action = target.closest('[data-native-list-action]');
|
|
2691
3168
|
if (action) {
|
|
3169
|
+
if (action.tagName === 'BUTTON' && action.hasAttribute('disabled')) return;
|
|
3170
|
+
if (action.classList.contains('ok-native-list-trailing-button')) event.stopPropagation();
|
|
2692
3171
|
const scope = action.dataset.selectionScope;
|
|
2693
3172
|
if (scope === 'row') this.activateSelection({
|
|
2694
3173
|
scope: 'row'
|
|
@@ -2703,6 +3182,11 @@ export class NativeListWebEngine {
|
|
|
2703
3182
|
this.handleRowPress(sourceRow, rowElement ?? undefined, memberElement ?? rowElement ?? undefined);
|
|
2704
3183
|
};
|
|
2705
3184
|
handleKeyDown = event => {
|
|
3185
|
+
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && event.target.matches('[role="button"][data-native-list-hover-action]')) {
|
|
3186
|
+
event.preventDefault();
|
|
3187
|
+
if (this.actionAnchor?.actionElement !== event.target || !this.actionAnchor.open) this.emitHoverAction(event.target);
|
|
3188
|
+
return;
|
|
3189
|
+
}
|
|
2706
3190
|
// OneKey patch: non-button title help supports keyboard activation.
|
|
2707
3191
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && event.target.matches('[role="button"][data-native-list-action]')) {
|
|
2708
3192
|
event.preventDefault();
|
|
@@ -2804,6 +3288,7 @@ export class NativeListWebEngine {
|
|
|
2804
3288
|
};
|
|
2805
3289
|
handleScroll = () => {
|
|
2806
3290
|
this.externalGeometryCache = undefined;
|
|
3291
|
+
this.pressedHelpElement = undefined;
|
|
2807
3292
|
this.cancelMarketPointer();
|
|
2808
3293
|
this.invalidateActionAnchor('scroll');
|
|
2809
3294
|
this.scheduleFrame();
|