@onekeyfe/react-native-native-list 6.7.0-6 → 6.7.0-60

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.
Files changed (216) hide show
  1. package/README.md +312 -375
  2. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  3. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +50 -13
  5. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
  6. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
  7. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  8. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
  10. package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
  12. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
  13. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
  14. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
  15. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
  16. package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
  17. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  18. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +209 -3
  19. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
  20. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  21. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -0
  22. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +8 -3
  23. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  24. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +130 -1
  25. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1978 -136
  26. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
  27. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListDescriptionTouchPolicyTest.kt +153 -0
  28. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  29. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  30. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  31. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  32. package/docs/ROW_TEMPLATES.md +78 -14
  33. package/docs/SPEC.md +1318 -16
  34. package/docs/STYLE_SPEC.md +18 -0
  35. package/ios/HybridNativeList.swift +21 -2
  36. package/ios/NativeListAccessoryStack.swift +237 -51
  37. package/ios/NativeListActivityDetailsView.swift +43 -16
  38. package/ios/NativeListActivityRenderer.swift +8 -2
  39. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  40. package/ios/NativeListDataRowRenderer.swift +167 -30
  41. package/ios/NativeListDesignAssets.swift +13 -75
  42. package/ios/NativeListGeneratedIcons.swift +55 -0
  43. package/ios/NativeListIconBinding.swift +171 -0
  44. package/ios/NativeListIdentityRenderer.swift +256 -39
  45. package/ios/NativeListLeadingVisual.swift +127 -28
  46. package/ios/NativeListMarketRenderer.swift +120 -31
  47. package/ios/NativeListMediaPlaceholderView.swift +189 -0
  48. package/ios/NativeListMediaPreviewSlot.swift +122 -61
  49. package/ios/NativeListMediaTileRenderer.swift +15 -11
  50. package/ios/NativeListMessageRenderer.swift +34 -1
  51. package/ios/NativeListMetricCardRenderer.swift +4 -2
  52. package/ios/NativeListModels.swift +42 -2
  53. package/ios/NativeListRendererRegistry.swift +1 -0
  54. package/ios/NativeListResolvedText.swift +17 -5
  55. package/ios/NativeListRowHost.swift +14 -0
  56. package/ios/NativeListSectionHeaderRenderer.swift +100 -4
  57. package/ios/NativeListTextLabel.swift +106 -0
  58. package/ios/RNCNativeListView.swift +1097 -60
  59. package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
  60. package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
  61. package/ios/tests/NativeListActivityPresentationTests.swift +423 -0
  62. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  63. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  64. package/ios/tests/NativeListLifecycleTests.swift +2959 -4
  65. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  66. package/ios/tests/NativeListMediaVisibilityTests.swift +27 -1
  67. package/ios/tests/NativeListSharedIconTests.swift +236 -0
  68. package/lib/module/NativeList.js +236 -38
  69. package/lib/module/NativeList.web.js +163 -45
  70. package/lib/module/index.js +1 -1
  71. package/lib/module/models.js +3 -0
  72. package/lib/module/selection.js +1 -1
  73. package/lib/module/validation.js +1263 -48
  74. package/lib/module/web/NativeListGeneratedIcons.js +31 -0
  75. package/lib/module/web/NativeListWebEngine.js +513 -275
  76. package/lib/module/web/templates/ActivityRowRenderer.js +41 -54
  77. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  78. package/lib/module/web/templates/DataRowRenderer.js +56 -5
  79. package/lib/module/web/templates/IdentityRowRenderer.js +161 -7
  80. package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
  81. package/lib/module/web/templates/MediaTileRowRenderer.js +84 -25
  82. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  83. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  84. package/lib/module/web/templates/RowRendererRegistry.js +3 -0
  85. package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
  86. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  87. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  88. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  89. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  90. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  91. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  92. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  93. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  94. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  95. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  96. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  97. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  98. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  99. package/lib/typescript/src/NativeList.d.ts +3 -3
  100. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  101. package/lib/typescript/src/NativeList.types.d.ts +20 -2
  102. package/lib/typescript/src/index.d.ts +2 -2
  103. package/lib/typescript/src/models.d.ts +134 -17
  104. package/lib/typescript/src/validation.d.ts +20 -0
  105. package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
  106. package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
  107. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  108. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  109. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
  110. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  111. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  112. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  114. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  115. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  116. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  117. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  118. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  119. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  120. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  121. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  122. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  123. package/package.json +16 -10
  124. package/react-native-native-list.podspec +2 -6
  125. package/scripts/generate-icons.mjs +150 -0
  126. package/scripts/generate-icons.test.mjs +288 -0
  127. package/scripts/native-list-icons.json +260 -0
  128. package/src/NativeList.nitro.ts +2 -0
  129. package/src/NativeList.tsx +439 -91
  130. package/src/NativeList.types.ts +24 -2
  131. package/src/NativeList.web.tsx +286 -88
  132. package/src/index.ts +2 -0
  133. package/src/models.ts +272 -144
  134. package/src/selection.ts +1 -0
  135. package/src/validation.ts +3041 -146
  136. package/src/web/NativeListGeneratedIcons.ts +28 -0
  137. package/src/web/NativeListWebEngine.ts +818 -343
  138. package/src/web/templates/ActivityRowRenderer.ts +71 -91
  139. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  140. package/src/web/templates/DataRowRenderer.ts +121 -20
  141. package/src/web/templates/IdentityRowRenderer.ts +234 -9
  142. package/src/web/templates/MarketTableRowRenderer.ts +53 -33
  143. package/src/web/templates/MediaTileRowRenderer.ts +90 -28
  144. package/src/web/templates/MessageRowRenderer.ts +23 -7
  145. package/src/web/templates/RowContainerStyle.ts +2 -0
  146. package/src/web/templates/RowRendererRegistry.ts +11 -1
  147. package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
  148. package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
  149. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
  150. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
  151. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
  152. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
  153. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
  154. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
  155. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
  156. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
  157. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
  158. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
  159. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
  160. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
  161. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
  162. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
  163. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
  164. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
  165. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
  166. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
  167. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
  168. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
  169. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
  170. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
  171. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
  172. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
  173. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
  174. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
  175. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
  176. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
  177. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
  178. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
  179. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
  180. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
  181. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
  182. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
  183. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
  184. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
  185. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
  186. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
  187. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
  188. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
  189. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
  190. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
  191. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
  192. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
  193. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
  194. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
  195. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
  196. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
  197. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
  198. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
  199. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
  200. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
  201. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
  202. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
  203. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
  204. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
  205. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
  206. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
  207. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
  208. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
  209. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
  210. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
  211. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
  212. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
  213. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
  214. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
  215. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
  216. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
@@ -4,10 +4,13 @@ import { useNativeListFontFamiliesJson } from "./fonts.js";
4
4
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
5
5
  import { View } from 'react-native';
6
6
  import { normalizeIndexScroll, normalizeKeyScroll, normalizePositionScroll, resolveLocationIndex, scrollFailure, validateOffset } from "./scrolling.js";
7
- import { applyRowPatches, validateSnapshot } from "./validation.js";
7
+ import { applyRowPatches, containNativeListInput, emptyNativeListSnapshot, validateSnapshot } from "./validation.js";
8
8
  import { NativeListWebEngine } from "./web/NativeListWebEngine.js";
9
9
  import { acquireNativeListAvatar, canonicalNativeListAvatarUri } from "./web/NativeListWebAvatarCache.js";
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const collapsedExpandedContentStyle = {
12
+ display: 'none'
13
+ };
11
14
  export function preloadNativeListAvatarImages(sources) {
12
15
  if (typeof document === 'undefined') return Promise.resolve(false);
13
16
  const uris = [...new Set(sources.map(source => canonicalNativeListAvatarUri(source.uri)).filter(uri => uri !== undefined))];
@@ -22,14 +25,18 @@ export function preloadNativeListAvatarImages(sources) {
22
25
  }))).then(results => results.every(Boolean));
23
26
  }
24
27
  export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
25
- snapshot,
28
+ snapshot: inputSnapshot,
26
29
  listHeader,
27
30
  listEmpty,
28
31
  listFooter,
32
+ listExpandedContent,
33
+ listStructureToggle,
34
+ listSidecar,
35
+ sidecarLayout,
29
36
  topOverlay: _topOverlay,
30
37
  topScrollEdgeEffect: _topScrollEdgeEffect,
31
38
  webScrollHost,
32
- webStickyInset = 0,
39
+ webStickyInset: inputStickyInset = 0,
33
40
  scrollPositionThresholds: _scrollPositionThresholds,
34
41
  onScrollPositionThresholdChange: _onScrollPositionThresholdChange,
35
42
  webVirtualizationEnabled = true,
@@ -42,6 +49,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
42
49
  onReorder,
43
50
  onEndReached,
44
51
  onVisibleRangeChanged,
52
+ onStructuralTransitionSettled: _onStructuralTransitionSettled,
45
53
  onRefresh,
46
54
  onScrollToIndexFailed,
47
55
  initialScrollIndex,
@@ -50,35 +58,39 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
50
58
  initialScrollViewOffset,
51
59
  ...viewProps
52
60
  }, forwardedRef) {
61
+ const acceptedSnapshotRef = useRef(emptyNativeListSnapshot());
62
+ const initializedSnapshot = useRef(false);
63
+ const webStickyInset = useMemo(() => containNativeListInput(() => {
64
+ if (!Number.isFinite(inputStickyInset) || inputStickyInset < 0) throw new Error('webStickyInset must be finite and non-negative');
65
+ return inputStickyInset;
66
+ }) ?? 0, [inputStickyInset]);
67
+ // Freshness is limited to this component invocation; later renders revalidate.
68
+ let freshlyValidatedSnapshot;
69
+ const preparedSnapshot = useMemo(() => {
70
+ const prepared = containNativeListInput(() => validateSnapshot(inputSnapshot));
71
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- The value is intentionally render-local.
72
+ freshlyValidatedSnapshot = prepared;
73
+ return prepared;
74
+ }, [inputSnapshot]);
75
+ const snapshot = preparedSnapshot ?? acceptedSnapshotRef.current;
53
76
  const fontFamiliesJson = useNativeListFontFamiliesJson();
54
77
  const fontFamiliesJsonRef = useRef(fontFamiliesJson);
55
78
  fontFamiliesJsonRef.current = fontFamiliesJson;
56
79
  const hasEmptySlot = listEmpty !== undefined;
57
80
  const hasEmptySlotRef = useRef(hasEmptySlot);
58
81
  hasEmptySlotRef.current = hasEmptySlot;
59
- const [slotState, setSlotState] = useState(() => ({
60
- hasRows: snapshot.rows.length > 0,
61
- emptyBottomPadding: !snapshot.rows.length && hasEmptySlot ? snapshot.layout.contentPaddingBottom ?? snapshot.layout.contentPadding ?? 0 : 0,
62
- padding: snapshot.layout.contentPaddingHorizontal ?? snapshot.layout.contentPadding ?? 0
63
- }));
64
- const synchronizeSlots = next => {
65
- const hasRows = next.rows.length > 0;
66
- const padding = next.layout.contentPaddingHorizontal ?? next.layout.contentPadding ?? 0;
67
- const emptyBottomPadding = !hasRows && hasEmptySlotRef.current ? next.layout.contentPaddingBottom ?? next.layout.contentPadding ?? 0 : 0;
68
- setSlotState(previous => previous.hasRows === hasRows && previous.padding === padding && previous.emptyBottomPadding === emptyBottomPadding ? previous : {
69
- hasRows,
70
- padding,
71
- emptyBottomPadding
72
- });
73
- };
74
- const normalizeWebSnapshot = (next, hasReactEmpty = hasEmptySlotRef.current, hasSlotLayout = useSlotLayoutRef.current) => {
82
+ const [viewportWidth, setViewportWidth] = useState(0);
83
+ const [sidecarHeight, setSidecarHeight] = useState(0);
84
+ const normalizeWebSnapshot = (next, hasReactEmpty = hasEmptySlotRef.current, hasSlotLayout = useSlotLayoutRef.current, validatedInThisRender = false) => {
75
85
  if (hasSlotLayout && next.layout.orientation === 'horizontal') throw new Error('Web parent scrolling and container slots support vertical lists only');
76
86
  const emptySlot = hasReactEmpty && next.rows.length === 0;
77
- const validated = validateSnapshot(emptySlot ? {
87
+ const normalized = emptySlot && next.emptyState !== undefined ? {
78
88
  ...next,
79
89
  emptyState: undefined
80
- } : next);
81
- return emptySlot ? {
90
+ } : next;
91
+ const validated = validatedInThisRender ? normalized : validateSnapshot(normalized);
92
+ // Preserve an already normalized fallback's identity across rerenders.
93
+ return emptySlot && validated.layout.contentPaddingBottom !== 0 ? {
82
94
  ...validated,
83
95
  layout: {
84
96
  ...validated.layout,
@@ -91,20 +103,68 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
91
103
  const [ownedScrollHost, setOwnedScrollHost] = useState(null);
92
104
  const useSlotLayoutRef = useRef(false);
93
105
  useSlotLayoutRef.current ||= webScrollHost !== undefined || listHeader !== undefined || listEmpty !== undefined || listFooter !== undefined;
106
+ useSlotLayoutRef.current ||= listSidecar !== undefined;
107
+ useSlotLayoutRef.current ||= listExpandedContent !== undefined || listStructureToggle !== undefined;
94
108
  const useSlotLayout = useSlotLayoutRef.current;
95
109
  const resolvedScrollHost = webScrollHost === undefined ? useSlotLayout ? ownedScrollHost : undefined : webScrollHost;
96
- if (!Number.isFinite(webStickyInset) || webStickyInset < 0) throw new Error('webStickyInset must be finite and non-negative');
97
110
  const engineRef = useRef(undefined);
98
111
  const webVirtualizationEnabledRef = useRef(webVirtualizationEnabled);
99
112
  webVirtualizationEnabledRef.current = webVirtualizationEnabled;
100
- const validatedSnapshot = useMemo(() => normalizeWebSnapshot(snapshot, hasEmptySlot, useSlotLayout), [snapshot, hasEmptySlot, useSlotLayout]);
113
+ const validatedSnapshot = useMemo(() => containNativeListInput(() => {
114
+ if (listSidecar !== undefined !== (sidecarLayout !== undefined)) throw new Error('listSidecar and sidecarLayout must be supplied together');
115
+ if (sidecarLayout) {
116
+ const {
117
+ width,
118
+ gap,
119
+ maxContentWidth
120
+ } = sidecarLayout;
121
+ if (snapshot.layout.kind !== 'linear' || !Number.isFinite(width) || width <= 0 || !Number.isFinite(gap) || gap < 0 || !Number.isFinite(maxContentWidth) || maxContentWidth <= width + gap) throw new Error('Invalid NativeList sidecar layout');
122
+ }
123
+ return normalizeWebSnapshot(snapshot, hasEmptySlot, useSlotLayout, preparedSnapshot !== undefined && preparedSnapshot === freshlyValidatedSnapshot);
124
+ }) ?? acceptedSnapshotRef.current,
125
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- Preserve the existing memo dependencies; freshness is render-local.
126
+ [snapshot, hasEmptySlot, useSlotLayout, listSidecar, sidecarLayout]);
127
+ const [slotState, setSlotState] = useState(() => ({
128
+ hasRows: validatedSnapshot.rows.length > 0,
129
+ emptyBottomPadding: !validatedSnapshot.rows.length && hasEmptySlot ? validatedSnapshot.layout.contentPaddingBottom ?? validatedSnapshot.layout.contentPadding ?? 0 : 0,
130
+ padding: validatedSnapshot.layout.contentPaddingHorizontal ?? validatedSnapshot.layout.contentPadding ?? 0,
131
+ disclosurePresent: validatedSnapshot.disclosure !== undefined,
132
+ disclosureExpanded: validatedSnapshot.disclosure?.expanded === true,
133
+ hasExpandedContent: validatedSnapshot.disclosure?.expanded === true,
134
+ expandedTrailingInset: validatedSnapshot.disclosure?.expandedTrailingInset ?? 0
135
+ }));
136
+ const synchronizeSlots = next => {
137
+ const hasRows = next.rows.length > 0;
138
+ const padding = next.layout.contentPaddingHorizontal ?? next.layout.contentPadding ?? 0;
139
+ const emptyBottomPadding = !hasRows && hasEmptySlotRef.current ? next.layout.contentPaddingBottom ?? next.layout.contentPadding ?? 0 : 0;
140
+ const disclosurePresent = next.disclosure !== undefined;
141
+ const disclosureExpanded = next.disclosure?.expanded === true;
142
+ const expandedTrailingInset = next.disclosure?.expandedTrailingInset ?? 0;
143
+ setSlotState(previous => {
144
+ const hasExpandedContent = previous.hasExpandedContent || disclosureExpanded;
145
+ return previous.hasRows === hasRows && previous.padding === padding && previous.emptyBottomPadding === emptyBottomPadding && previous.disclosurePresent === disclosurePresent && previous.disclosureExpanded === disclosureExpanded && previous.hasExpandedContent === hasExpandedContent && previous.expandedTrailingInset === expandedTrailingInset ? previous : {
146
+ hasRows,
147
+ padding,
148
+ emptyBottomPadding,
149
+ disclosurePresent,
150
+ disclosureExpanded,
151
+ hasExpandedContent,
152
+ expandedTrailingInset
153
+ };
154
+ });
155
+ };
101
156
  const snapshotRef = useRef(validatedSnapshot);
102
157
  const snapshotPropRef = useRef(validatedSnapshot);
103
158
  // An imperative snapshot survives host mounting until the snapshot prop changes.
104
159
  if (snapshotPropRef.current !== validatedSnapshot) {
105
160
  snapshotPropRef.current = validatedSnapshot;
106
161
  snapshotRef.current = validatedSnapshot;
107
- synchronizeSlots(snapshot);
162
+ acceptedSnapshotRef.current = validatedSnapshot;
163
+ synchronizeSlots(validatedSnapshot);
164
+ }
165
+ if (!initializedSnapshot.current) {
166
+ acceptedSnapshotRef.current = validatedSnapshot;
167
+ initializedSnapshot.current = true;
108
168
  }
109
169
  const appliedSnapshotRef = useRef(undefined);
110
170
  const callbacksRef = useRef({});
@@ -118,7 +178,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
118
178
  onRefresh,
119
179
  onScrollToIndexFailed
120
180
  };
121
- const initialScrollRef = useRef(initialScrollIndex === undefined && initialScrollKey === undefined ? undefined : initialScrollIndex !== undefined ? normalizeIndexScroll({
181
+ const initialScrollRef = useRef(containNativeListInput(() => initialScrollIndex === undefined && initialScrollKey === undefined ? undefined : initialScrollIndex !== undefined ? normalizeIndexScroll({
122
182
  index: initialScrollIndex,
123
183
  animated: false,
124
184
  viewPosition: initialScrollViewPosition,
@@ -130,7 +190,7 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
130
190
  viewPosition: initialScrollViewPosition,
131
191
  viewOffset: initialScrollViewOffset
132
192
  }, 'start')
133
- });
193
+ }));
134
194
  const didApplyInitialScroll = useRef(false);
135
195
  const scrollOptionsRef = useRef({
136
196
  stickyInset: webStickyInset,
@@ -142,11 +202,12 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
142
202
  };
143
203
  useEffect(() => {
144
204
  if (!host || resolvedScrollHost === null || useSlotLayout && !contentBounds) return;
145
- const engine = new NativeListWebEngine(host, snapshotRef.current, callbacksRef.current, webVirtualizationEnabledRef.current, webSectionIndexContainerRef?.current, fontFamiliesJsonRef.current, {
205
+ const engine = containNativeListInput(() => new NativeListWebEngine(host, snapshotRef.current, callbacksRef.current, webVirtualizationEnabledRef.current, webSectionIndexContainerRef?.current, fontFamiliesJsonRef.current, {
146
206
  scrollHost: resolvedScrollHost,
147
207
  contentBounds: contentBounds ?? undefined,
148
208
  ...scrollOptionsRef.current
149
- });
209
+ }));
210
+ if (!engine) return;
150
211
  host.style.height = '';
151
212
  engineRef.current = engine;
152
213
  appliedSnapshotRef.current = snapshotRef.current;
@@ -185,20 +246,24 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
185
246
  };
186
247
  useImperativeHandle(forwardedRef, () => ({
187
248
  applySnapshot(nextSnapshot) {
188
- const next = normalizeWebSnapshot(nextSnapshot);
249
+ const next = containNativeListInput(() => normalizeWebSnapshot(nextSnapshot));
250
+ if (!next) return;
189
251
  engineRef.current?.applySnapshot(next);
190
252
  snapshotRef.current = next;
253
+ acceptedSnapshotRef.current = next;
191
254
  appliedSnapshotRef.current = next;
192
- synchronizeSlots(nextSnapshot);
255
+ synchronizeSlots(next);
193
256
  },
194
257
  applyPatches(patches) {
195
- if (patches.length > 0) {
196
- const engine = engineRef.current;
197
- if (engine) {
198
- engine.applyPatches(patches);
199
- snapshotRef.current = engine.currentSnapshot();
200
- } else snapshotRef.current = applyRowPatches(snapshotRef.current, patches);
258
+ const engine = engineRef.current;
259
+ if (engine) {
260
+ engine.applyPatches(patches);
261
+ snapshotRef.current = engine.currentSnapshot();
262
+ } else {
263
+ const next = containNativeListInput(() => applyRowPatches(snapshotRef.current, patches));
264
+ if (next) snapshotRef.current = next;
201
265
  }
266
+ acceptedSnapshotRef.current = snapshotRef.current;
202
267
  },
203
268
  reconcileSelection(selectedKeys) {
204
269
  engineRef.current?.reconcileSelection(selectedKeys);
@@ -276,8 +341,15 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
276
341
  ref: setHostRef
277
342
  });
278
343
  const padding = slotState.padding;
344
+ const footerBandStyle = {
345
+ paddingHorizontal: padding
346
+ };
347
+ const trailingInsetStyle = {
348
+ height: slotState.disclosureExpanded ? slotState.expandedTrailingInset : 0
349
+ };
350
+ const hasFooterBand = listFooter !== undefined || listExpandedContent !== undefined || listStructureToggle !== undefined;
279
351
  const content = /*#__PURE__*/_jsxs(View, {
280
- ref: setBoundsRef,
352
+ ref: sidecarLayout ? undefined : setBoundsRef,
281
353
  style: {
282
354
  position: 'relative',
283
355
  flexShrink: 0,
@@ -300,15 +372,61 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
300
372
  paddingBottom: slotState.emptyBottomPadding
301
373
  },
302
374
  children: listEmpty
303
- }) : null, listFooter !== undefined ? /*#__PURE__*/_jsx(View, {
304
- style: {
305
- paddingHorizontal: padding
306
- },
307
- children: listFooter
375
+ }) : null, hasFooterBand ? /*#__PURE__*/_jsxs(View, {
376
+ testID: "native-list-footer-slot",
377
+ style: footerBandStyle,
378
+ children: [listExpandedContent !== undefined && slotState.hasExpandedContent ? /*#__PURE__*/_jsx(View, {
379
+ testID: "native-list-expanded-content-slot",
380
+ "aria-hidden": !slotState.disclosureExpanded,
381
+ pointerEvents: slotState.disclosureExpanded ? 'auto' : 'none',
382
+ style: slotState.disclosureExpanded ? undefined : collapsedExpandedContentStyle,
383
+ children: listExpandedContent
384
+ }) : null, listStructureToggle !== undefined ? /*#__PURE__*/_jsx(View, {
385
+ testID: "native-list-structure-toggle-slot",
386
+ "aria-hidden": !slotState.disclosurePresent,
387
+ pointerEvents: slotState.disclosurePresent ? 'auto' : 'none',
388
+ style: slotState.disclosurePresent ? {
389
+ marginHorizontal: -padding
390
+ } : collapsedExpandedContentStyle,
391
+ children: listStructureToggle
392
+ }) : null, slotState.expandedTrailingInset > 0 && (listExpandedContent !== undefined || listStructureToggle !== undefined) ? /*#__PURE__*/_jsx(View, {
393
+ testID: "native-list-trailing-inset-slot",
394
+ style: trailingInsetStyle
395
+ }) : null, listFooter]
308
396
  }) : null]
309
397
  });
398
+ const bandWidth = sidecarLayout ? Math.min(viewportWidth, sidecarLayout.maxContentWidth) : 0;
399
+ const sidecarMargin = Math.max(0, (viewportWidth - bandWidth) / 2);
400
+ const leftWidth = Math.max(0, bandWidth - (sidecarLayout?.width ?? 0) - (sidecarLayout?.gap ?? 0));
401
+ const scrollContent = sidecarLayout ? /*#__PURE__*/_jsxs(View, {
402
+ ref: setBoundsRef,
403
+ style: {
404
+ position: 'relative',
405
+ minHeight: sidecarHeight
406
+ },
407
+ children: [/*#__PURE__*/_jsx(View, {
408
+ style: {
409
+ marginStart: sidecarMargin,
410
+ width: leftWidth
411
+ },
412
+ children: content
413
+ }), /*#__PURE__*/_jsx(View, {
414
+ style: {
415
+ position: 'absolute',
416
+ end: sidecarMargin,
417
+ top: 0,
418
+ width: sidecarLayout.width
419
+ },
420
+ onLayout: event => setSidecarHeight(event.nativeEvent.layout.height),
421
+ children: listSidecar
422
+ })]
423
+ }) : content;
310
424
  return /*#__PURE__*/_jsx(View, {
311
425
  ...viewProps,
426
+ onLayout: event => {
427
+ setViewportWidth(event.nativeEvent.layout.width);
428
+ viewProps.onLayout?.(event);
429
+ },
312
430
  style: [viewProps.style, {
313
431
  position: 'relative',
314
432
  minHeight: 0
@@ -320,8 +438,8 @@ export const NativeList = /*#__PURE__*/forwardRef(function NativeList({
320
438
  inset: 0,
321
439
  overflow: 'scroll'
322
440
  },
323
- children: content
324
- }) : content
441
+ children: scrollContent
442
+ }) : scrollContent
325
443
  });
326
444
  });
327
445
  //# sourceMappingURL=NativeList.web.js.map
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  export { NativeList, preloadNativeListAvatarImages } from './NativeList';
4
- export { applyRowPatches, serializePatches, serializeSnapshot, validatePatches, validateSnapshot } from "./validation.js";
4
+ export { applyRowPatches, planNativeListPatches, serializePatches, serializeSnapshot, validatePatches, validateSnapshot } from "./validation.js";
5
5
  export { checkboxStateForKeys, checkboxStateForSection, isSelectableRow, reduceSelection, selectionStateFromSnapshot } from "./selection.js";
6
6
  export { configureNativeListFonts } from "./fonts.js";
7
7
  export { ScrollEdgeEffect } from "./ScrollEdgeEffect.js";
@@ -24,6 +24,7 @@ export const ROW_BOX_STYLE_KEYS_BY_TYPE = {
24
24
  metricCard: ['horizontalPadding', 'verticalPadding', 'leadingGap', 'lineGap', 'image'],
25
25
  sectionHeader: ['horizontalPadding', 'verticalPadding', 'lineGap', 'trailingGap'],
26
26
  action: ['horizontalPadding', 'verticalPadding', 'leadingGap', 'trailingGap', 'image'],
27
+ buttonGroup: [],
27
28
  system: ['horizontalPadding', 'verticalPadding', 'lineGap']
28
29
  };
29
30
 
@@ -53,4 +54,6 @@ export const ROW_BOX_STYLE_KEYS_BY_TYPE = {
53
54
  // type CommonPatchFields = 'revision' | 'disabled' | 'selected' | 'separator';
54
55
  // OneKey patch: balance patches also refresh the existing row's spoken content.
55
56
  // type CommonPatchFields = 'revision' | 'disabled' | 'selected' | 'separator' | 'height' | 'heightRounding' | 'opacity' | 'pressDisabled';
57
+
58
+ /** Null removes optional fields; undefined leaves the existing value unchanged. */
56
59
  //# sourceMappingURL=models.js.map
@@ -4,7 +4,7 @@ export function isSelectableRow(row) {
4
4
  return !row.disabled && (row.type === 'identity' || row.type === 'rail' || row.type === 'activity' || row.type === 'message' || row.type === 'dataRow' || row.type === 'mediaTile' || row.type === 'metricCard');
5
5
  }
6
6
  export function isRowPressEnabled(row) {
7
- return !row.disabled && !row.pressDisabled && (row.type !== 'system' || row.variant === 'retry');
7
+ return !row.disabled && !row.pressDisabled && row.type !== 'buttonGroup' && (row.type !== 'system' || row.variant === 'retry');
8
8
  }
9
9
  function deltaBetween(before, after, source, sourceKey) {
10
10
  return {