@onekeyfe/react-native-native-list 6.7.0-20 → 6.7.0-22

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 (151) hide show
  1. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +5 -0
  2. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +29 -4
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +6 -10
  4. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
  5. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +15 -0
  6. package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
  7. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +33 -2
  8. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +5 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
  10. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +13 -10
  11. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -338
  12. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +5 -0
  13. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +33 -8
  14. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +11 -5
  15. package/docs/ROW_TEMPLATES.md +10 -2
  16. package/docs/SPEC.md +432 -50
  17. package/ios/NativeListAccessoryStack.swift +6 -16
  18. package/ios/NativeListActivityDetailsView.swift +13 -4
  19. package/ios/NativeListDataRowRenderer.swift +15 -6
  20. package/ios/NativeListDesignAssets.swift +13 -84
  21. package/ios/NativeListGeneratedIcons.swift +55 -0
  22. package/ios/NativeListIconBinding.swift +171 -0
  23. package/ios/NativeListIdentityRenderer.swift +69 -13
  24. package/ios/NativeListLeadingVisual.swift +11 -9
  25. package/ios/NativeListMarketRenderer.swift +120 -31
  26. package/ios/NativeListMediaTileRenderer.swift +6 -2
  27. package/ios/NativeListMetricCardRenderer.swift +4 -2
  28. package/ios/NativeListSectionHeaderRenderer.swift +12 -4
  29. package/ios/RNCNativeListView.swift +21 -3
  30. package/ios/tests/NativeListAccessoryStackTests.swift +12 -0
  31. package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
  32. package/ios/tests/NativeListActivityPresentationTests.swift +97 -0
  33. package/ios/tests/NativeListLifecycleTests.swift +73 -4
  34. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  35. package/ios/tests/NativeListSharedIconTests.swift +236 -0
  36. package/lib/module/NativeList.js +25 -6
  37. package/lib/module/NativeList.web.js +9 -12
  38. package/lib/module/models.js +2 -0
  39. package/lib/module/validation.js +695 -114
  40. package/lib/module/web/NativeListGeneratedIcons.js +31 -0
  41. package/lib/module/web/NativeListWebEngine.js +24 -332
  42. package/lib/module/web/templates/ActivityRowRenderer.js +4 -24
  43. package/lib/module/web/templates/IdentityRowRenderer.js +66 -4
  44. package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
  45. package/lib/module/web/templates/MediaTileRowRenderer.js +2 -12
  46. package/lib/typescript/src/NativeList.types.d.ts +2 -2
  47. package/lib/typescript/src/models.d.ts +27 -14
  48. package/lib/typescript/src/validation.d.ts +7 -2
  49. package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
  50. package/lib/typescript/src/web/NativeListWebEngine.d.ts +0 -1
  51. package/package.json +16 -10
  52. package/react-native-native-list.podspec +0 -5
  53. package/scripts/generate-icons.mjs +150 -0
  54. package/scripts/generate-icons.test.mjs +288 -0
  55. package/scripts/native-list-icons.json +260 -0
  56. package/src/NativeList.tsx +30 -10
  57. package/src/NativeList.types.ts +2 -2
  58. package/src/NativeList.web.tsx +10 -14
  59. package/src/models.ts +158 -153
  60. package/src/validation.ts +1757 -167
  61. package/src/web/NativeListGeneratedIcons.ts +28 -0
  62. package/src/web/NativeListWebEngine.ts +31 -415
  63. package/src/web/templates/ActivityRowRenderer.ts +15 -53
  64. package/src/web/templates/IdentityRowRenderer.ts +78 -4
  65. package/src/web/templates/MarketTableRowRenderer.ts +53 -33
  66. package/src/web/templates/MediaTileRowRenderer.ts +2 -15
  67. package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
  68. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
  69. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
  70. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
  71. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
  72. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
  73. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
  74. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
  75. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
  76. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
  77. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
  78. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
  79. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
  80. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
  81. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
  82. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
  83. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
  84. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
  85. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
  86. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
  87. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
  88. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +0 -15
  89. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +0 -4
  90. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +0 -1
  91. package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +0 -1
  92. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
  93. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
  94. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +0 -1
  95. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +0 -1
  96. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
  97. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
  98. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
  99. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
  100. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +0 -15
  101. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +0 -3
  102. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
  103. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
  104. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
  105. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
  106. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
  107. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
  108. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
  109. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
  110. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
  111. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
  112. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
  113. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
  114. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +0 -1
  115. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +0 -1
  116. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
  117. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
  118. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
  119. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
  120. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +0 -15
  121. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +0 -3
  122. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
  123. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
  124. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
  125. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
  126. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
  127. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
  128. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
  129. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
  130. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
  131. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
  132. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
  133. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
  134. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
  135. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
  136. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
  137. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
  138. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
  139. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
  140. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
  141. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
  142. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
  143. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
  144. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
  145. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
  146. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
  147. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
  148. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +0 -1
  149. package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +0 -1
  150. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +0 -1
  151. package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +0 -1
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
3
4
  import { createElement, markActionAnchorSource } from "./RowElements.js";
4
5
  import { applyTextWeight, applyValueSegments } from "./RowText.js";
5
6
  const views = new WeakMap();
6
7
  const columnSignatures = new WeakMap();
7
8
  let sparklineId = 0;
8
9
  const svgNamespace = 'http://www.w3.org/2000/svg';
9
- const outlineStar = 'm15.455 7.243 7.729 1.123-5.592 5.45 1.32 7.698L12 17.879l-6.911 3.635 1.32-7.698-5.592-5.45 7.728-1.123L12 .24zM9.872 9.071l-4.759.69 3.444 3.358-.814 4.738L12 15.62l.465.245 3.791 1.993-.813-4.739 3.443-3.357-4.758-.69L12 4.758z';
10
- const solidStar = 'm15.405 7.313 7.84 1.034-5.735 5.443 1.44 7.774L12 17.793l-6.948 3.771 1.44-7.774L.756 8.347l7.839-1.034L12 .178z';
11
10
  function columnsSignature(columns) {
12
11
  let signature = columnSignatures.get(columns);
13
12
  if (signature === undefined) {
@@ -113,17 +112,10 @@ function action(element, key, label, slot) {
113
112
  flexShrink: '0'
114
113
  });
115
114
  }
116
- function icon(document, d, size) {
117
- const svg = document.createElementNS(svgNamespace, 'svg');
118
- svg.setAttribute('viewBox', '0 0 24 24');
115
+ function icon(document, name, size) {
116
+ const svg = createNamedIcon(document, name);
119
117
  svg.setAttribute('width', String(size));
120
118
  svg.setAttribute('height', String(size));
121
- svg.setAttribute('aria-hidden', 'true');
122
- svg.setAttribute('fill', 'currentColor');
123
- const path = document.createElementNS(svgNamespace, 'path');
124
- path.setAttribute('d', d);
125
- path.setAttribute('fill-rule', 'evenodd');
126
- svg.appendChild(path);
127
119
  return svg;
128
120
  }
129
121
  function drawSparkline(element, cell) {
@@ -203,11 +195,32 @@ function updateCell(view, cell, primitives, index) {
203
195
  if (cell.kind === 'asset') {
204
196
  const visualKey = JSON.stringify(cell.leading);
205
197
  if (view.visualKey !== visualKey) {
206
- if (view.visual) {
207
- primitives.dispose(view.visual);
208
- view.visual.remove();
198
+ const visualImageKey = JSON.stringify(cell.leading?.kind === 'token' ? {
199
+ ...cell.leading,
200
+ overlays: undefined
201
+ } : cell.leading);
202
+ if (view.visual && cell.leading?.kind === 'token' && view.visualImageKey === visualImageKey) {
203
+ // Keep the main frame: its load/error callbacks own its visibility.
204
+ for (const overlay of view.visual.querySelectorAll(':scope > .ok-native-list-visual-overlay')) {
205
+ primitives.dispose(overlay);
206
+ overlay.remove();
207
+ }
208
+ const overlayVisual = primitives.visual({
209
+ kind: 'token',
210
+ overlays: cell.leading.overlays
211
+ });
212
+ if (overlayVisual) {
213
+ for (const overlay of overlayVisual.querySelectorAll(':scope > .ok-native-list-visual-overlay')) view.visual.appendChild(overlay);
214
+ primitives.dispose(overlayVisual);
215
+ }
216
+ } else {
217
+ if (view.visual) {
218
+ primitives.dispose(view.visual);
219
+ view.visual.remove();
220
+ }
221
+ view.visual = primitives.visual(cell.leading);
209
222
  }
210
- view.visual = primitives.visual(cell.leading);
223
+ view.visualImageKey = visualImageKey;
211
224
  view.visualKey = visualKey;
212
225
  if (view.visual) Object.assign(view.visual.style, {
213
226
  width: '40px',
@@ -331,7 +344,7 @@ function updateCell(view, cell, primitives, index) {
331
344
  }[badge.style?.fontWeight ?? 'regular']);
332
345
  if (badge.actionKey) node.dataset.nativeListHoverAction = 'true';
333
346
  node.textContent = '';
334
- const svg = icon(document, 'M9.483 11.458v3.5h-1v-3.5z M10.467 2.698a2.03 2.03 0 0 1 3.065 0l1.358 1.564a.03.03 0 0 0 .028.01l2.046-.325a2.03 2.03 0 0 1 2.347 1.971l.037 2.07q0 .016.014.026l1.776 1.066a2.03 2.03 0 0 1 .532 3.019l-1.304 1.609a.03.03 0 0 0-.005.03l.675 1.956a2.03 2.03 0 0 1-1.533 2.656l-2.033.394a.03.03 0 0 0-.023.019l-.741 1.933a2.03 2.03 0 0 1-2.88 1.05l-1.811-1.006a.03.03 0 0 0-.03 0l-1.811 1.005a2.03 2.03 0 0 1-2.88-1.049l-.742-1.933a.03.03 0 0 0-.023-.019l-2.033-.394a2.03 2.03 0 0 1-1.532-2.656l.675-1.957a.03.03 0 0 0-.005-.029l-1.304-1.61a2.03 2.03 0 0 1 .532-3.018l1.776-1.066a.03.03 0 0 0 .014-.026l.035-2.07a2.03 2.03 0 0 1 2.349-1.97l2.045.324a.03.03 0 0 0 .028-.01zm1.516 3.76a.5.5 0 0 0-.447.276l-1.861 3.724H8.483a1 1 0 0 0-1 1v3.5a1 1 0 0 0 1 1h6.692a2 2 0 0 0 1.981-1.73l.341-2.5a2 2 0 0 0-1.982-2.27h-1.939l.197-1.269a1.5 1.5 0 0 0-1.481-1.731z', 14);
347
+ const svg = icon(document, 'BadgeRecognizedSolid', 14);
335
348
  node.appendChild(svg);
336
349
  }
337
350
  title.appendChild(node);
@@ -432,7 +445,7 @@ function updateCell(view, cell, primitives, index) {
432
445
  action(button, cell.hoverActionKey, cell.hoverActionLabel ?? 'Copy address', index);
433
446
  button.style.padding = '0';
434
447
  button.style.color = 'var(--nl-icon-subdued)';
435
- button.appendChild(icon(document, 'M21 17h-4v4H3V7h4V3h14zM5 19h10V9H5zM9 7h8v8h2V5H9z', 14));
448
+ button.appendChild(icon(document, 'Copy3Outline', 14));
436
449
  hoverFrame.appendChild(button);
437
450
  }
438
451
  track.appendChild(hoverFrame);
@@ -455,10 +468,14 @@ function updateCell(view, cell, primitives, index) {
455
468
  button.style.color = cell.active ? 'var(--nl-accent)' : 'var(--nl-icon-subdued)';
456
469
  let svg = button.querySelector('svg');
457
470
  if (!svg) {
458
- svg = icon(document, cell.active ? solidStar : outlineStar, 16);
471
+ svg = icon(document, cell.active ? 'StarSolid' : 'StarOutline', 16);
459
472
  button.appendChild(svg);
460
473
  }
461
- svg.querySelector('path')?.setAttribute('d', cell.active ? solidStar : outlineStar);
474
+ const name = cell.active ? 'StarSolid' : 'StarOutline';
475
+ if (!svg.querySelector('use')?.getAttribute('href')?.endsWith(`#onekey-${name}`)) {
476
+ const replacement = icon(document, name, 16);
477
+ svg.replaceWith(replacement);
478
+ }
462
479
  if (!button.parentElement) element.appendChild(button);
463
480
  } else if (cell.kind === 'sparkline') drawSparkline(element, cell);else {
464
481
  element.replaceChildren();
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import { createNamedIcon } from '@onekeyfe/react-native-image/icon/dom';
3
4
  const views = new WeakMap();
4
5
  function bindLegacy(body, row, primitives) {
5
6
  const v = views.get(body);
@@ -148,18 +149,7 @@ function initGallery(body, primitives) {
148
149
  };
149
150
  const frame = element('ok-native-list-media-image');
150
151
  const fallback = element('ok-native-list-media-fallback');
151
- const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
152
- svg.setAttribute('viewBox', '0 0 24 24');
153
- svg.setAttribute('width', '24');
154
- svg.setAttribute('height', '24');
155
- svg.setAttribute('aria-hidden', 'true');
156
- svg.setAttribute('fill', 'currentColor');
157
- for (const d of ['M14.25 7a2 2 0 1 1 0 4 2 2 0 0 1 0-4', 'M21 21H3V3h18zM5 16.414V19h12.586L14 15.414l-2 2-4-4zm0-2.828 3-3 4 4 2-2 5 5V5H5z']) {
158
- const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
159
- path.setAttribute('d', d);
160
- path.setAttribute('fill-rule', 'evenodd');
161
- svg.append(path);
162
- }
152
+ const svg = createNamedIcon(document, 'ImageSquareWavesOutline');
163
153
  fallback.append(svg);
164
154
  Object.assign(fallback.style, {
165
155
  position: 'absolute',
@@ -1,6 +1,6 @@
1
1
  import type { ScrollEdgeEffect } from './ScrollEdgeEffect';
2
2
  import type { ReactNode, RefObject } from 'react';
3
- import type { View, ViewProps } from 'react-native';
3
+ import type { ViewInstance, ViewProps } from 'react-native';
4
4
  import type { ActionAnchorInvalidatedEvent, EndReachedEvent, NativeListSnapshot, ReorderEvent, RowActionEvent, RowModel, RowPatch, SelectionDeltaEvent, VisibleRangeChangedEvent } from './models';
5
5
  export type ActionAnchorState = Readonly<{
6
6
  token: string;
@@ -114,7 +114,7 @@ export type NativeListProps = Omit<ViewProps, 'children'> & Readonly<{
114
114
  /** Web only: visible sticky chrome above the parent's list viewport. */
115
115
  webStickyInset?: number;
116
116
  /** Web only. Hosts the section index inside this container. */
117
- webSectionIndexContainerRef?: RefObject<View | null>;
117
+ webSectionIndexContainerRef?: RefObject<ViewInstance | null>;
118
118
  /** Defaults to `none`. `interactive` behaves as `none` on Android. */
119
119
  keyboardDismissMode?: NativeListKeyboardDismissMode;
120
120
  /**
@@ -428,6 +428,13 @@ export type IdentityRow = RowBase & Readonly<{
428
428
  }>;
429
429
  /** Web-only additional help icon after titleIcon. */
430
430
  secondaryTitleIcon?: IdentityRow['titleIcon'];
431
+ /** Circular image after title icons; image dimensions must be square, 1...40. */
432
+ titleImage?: Readonly<{
433
+ image: ImageSource;
434
+ accessibilityLabel?: string;
435
+ /** Web-only help anchor; the consumer owns tooltip content. */
436
+ hoverActionKey?: string;
437
+ }>;
431
438
  subtitle?: string;
432
439
  tertiary?: string;
433
440
  tertiaryTone?: 'secondary' | 'info';
@@ -595,6 +602,8 @@ export type MarketRow = RowBase & Readonly<{
595
602
  variant: 'token' | 'stock' | 'perp';
596
603
  /** Web-only bounded table presentation; native reads the ordinary Market fields. */
597
604
  webTable?: WebMarketTablePresentation;
605
+ /** Two or three ordered native text metrics; omitting them keeps the compact quote. */
606
+ metrics?: readonly Pick<DataColumn, 'key' | 'text' | 'textSegments' | 'secondaryText' | 'secondaryTextSegments' | 'weight' | 'alignment' | 'tone' | 'secondaryTone'>[];
598
607
  leadingAction?: Extract<TrailingAccessory, {
599
608
  kind: 'icon';
600
609
  }>;
@@ -864,57 +873,61 @@ export type NativeListSnapshot = Readonly<{
864
873
  listStyle?: NativeListListStyle;
865
874
  }>;
866
875
  type CommonPatchFields = 'revision' | 'disabled' | 'selected' | 'separator' | 'height' | 'heightRounding' | 'opacity' | 'pressDisabled' | 'accessibilityLabel' | 'style';
876
+ /** Null removes optional fields; undefined leaves the existing value unchanged. */
877
+ export type PatchClearableChanges<Row, Keys extends keyof Row> = Readonly<{
878
+ [K in Keys]?: undefined extends Row[K] ? Row[K] | null : Row[K];
879
+ }>;
867
880
  export type RowPatch = Readonly<{
868
881
  type: 'identity';
869
882
  key: string;
870
- changes: Partial<Pick<IdentityRow, CommonPatchFields | 'title' | 'titleSuffixes' | 'titleIcon' | 'secondaryTitleIcon' | 'subtitle' | 'subtitleLines' | 'contentHeight' | 'longPressActionKey' | 'tertiary' | 'tertiaryTone' | 'badges' | 'trailing' | 'leading' | 'leadingAction' | 'titleMatch' | 'titleActionKey' | 'titleActionOnHover' | 'subtitleSegments'>>;
883
+ changes: PatchClearableChanges<IdentityRow, CommonPatchFields | 'title' | 'titleSuffixes' | 'titleIcon' | 'secondaryTitleIcon' | 'titleImage' | 'subtitle' | 'subtitleLines' | 'contentHeight' | 'longPressActionKey' | 'tertiary' | 'tertiaryTone' | 'badges' | 'trailing' | 'leading' | 'leadingAction' | 'titleMatch' | 'titleActionKey' | 'titleActionOnHover' | 'subtitleSegments'>;
871
884
  }> | Readonly<{
872
885
  type: 'rail';
873
886
  key: string;
874
- changes: Partial<Pick<RailRow, CommonPatchFields | 'title' | 'status' | 'badge' | 'visual'>>;
887
+ changes: PatchClearableChanges<RailRow, CommonPatchFields | 'title' | 'status' | 'badge' | 'visual'>;
875
888
  }> | Readonly<{
876
889
  type: 'activity';
877
890
  key: string;
878
- changes: Partial<Pick<ActivityRow, CommonPatchFields | 'title' | 'description' | 'status' | 'amounts' | 'badges' | 'presentation' | 'fee' | 'descriptionActionKey' | 'primaryAmount' | 'secondaryAmount' | 'leading' | 'hideLeading' | 'secondaryLeading' | 'footerActions'>>;
891
+ changes: PatchClearableChanges<ActivityRow, CommonPatchFields | 'title' | 'description' | 'status' | 'amounts' | 'badges' | 'presentation' | 'fee' | 'descriptionActionKey' | 'primaryAmount' | 'secondaryAmount' | 'leading' | 'hideLeading' | 'secondaryLeading' | 'footerActions'>;
879
892
  }> | Readonly<{
880
893
  type: 'message';
881
894
  key: string;
882
- changes: Partial<Pick<MessageRow, CommonPatchFields | 'unread' | 'title' | 'body' | 'bodyLines' | 'presentation' | 'time' | 'thumbnail'>>;
895
+ changes: PatchClearableChanges<MessageRow, CommonPatchFields | 'unread' | 'title' | 'body' | 'bodyLines' | 'presentation' | 'time' | 'thumbnail'>;
883
896
  }> | Readonly<{
884
897
  type: 'dataRow';
885
898
  key: string;
886
- changes: Partial<Pick<DataRow, CommonPatchFields | 'leading' | 'columns' | 'trailing' | 'checkbox' | 'index' | 'badge' | 'badges' | 'favorite' | 'favoriteActive'>>;
899
+ changes: PatchClearableChanges<DataRow, CommonPatchFields | 'leading' | 'columns' | 'trailing' | 'checkbox' | 'index' | 'badge' | 'badges' | 'favorite' | 'favoriteActive'>;
887
900
  }> | Readonly<{
888
901
  type: 'market';
889
902
  key: string;
890
- changes: Partial<Pick<MarketRow, CommonPatchFields | 'leadingAction' | 'leading' | 'title' | 'subtitle' | 'subtitleSegments' | 'price' | 'priceSegments' | 'change' | 'badges' | 'pressActionKey' | 'pressInActionKey' | 'longPressActionKey' | 'diagnostics' | 'webTable' | 'style'>>;
903
+ changes: PatchClearableChanges<MarketRow, CommonPatchFields | 'leadingAction' | 'leading' | 'title' | 'subtitle' | 'subtitleSegments' | 'price' | 'priceSegments' | 'change' | 'badges' | 'pressActionKey' | 'pressInActionKey' | 'longPressActionKey' | 'diagnostics' | 'webTable' | 'metrics' | 'style'>;
891
904
  }> | Readonly<{
892
905
  type: 'mediaTile';
893
906
  key: string;
894
- changes: Partial<Pick<MediaTileRow, CommonPatchFields | 'image' | 'imageState' | 'media' | 'networkImage' | 'title' | 'subtitle' | 'badge' | 'closeActionKey'>>;
907
+ changes: PatchClearableChanges<MediaTileRow, CommonPatchFields | 'image' | 'imageState' | 'media' | 'networkImage' | 'title' | 'subtitle' | 'badge' | 'closeActionKey'>;
895
908
  }> | Readonly<{
896
909
  type: 'metricCard';
897
910
  key: string;
898
- changes: Partial<Pick<MetricCardRow, CommonPatchFields | 'variant' | 'title' | 'value' | 'subtitle' | 'trend' | 'trendTone' | 'visual' | 'badge' | 'metrics' | 'progress'>>;
911
+ changes: PatchClearableChanges<MetricCardRow, CommonPatchFields | 'variant' | 'title' | 'value' | 'subtitle' | 'trend' | 'trendTone' | 'visual' | 'badge' | 'metrics' | 'progress'>;
899
912
  }> | Readonly<{
900
913
  type: 'sectionHeader';
901
914
  key: string;
902
- changes: Partial<Pick<SectionHeaderRow, CommonPatchFields | 'variant' | 'titleLoading' | 'title' | 'subtitle' | 'value' | 'valueHelp' | 'leadingBadge' | 'valueActionKey' | 'titleActionKey' | 'titleActionOnHover' | 'titleIcon' | 'valueIcon' | 'checkbox'>>;
915
+ changes: PatchClearableChanges<SectionHeaderRow, CommonPatchFields | 'variant' | 'titleLoading' | 'title' | 'subtitle' | 'value' | 'valueHelp' | 'leadingBadge' | 'valueActionKey' | 'titleActionKey' | 'titleActionOnHover' | 'titleIcon' | 'valueIcon' | 'checkbox'>;
903
916
  }> | Readonly<{
904
917
  type: 'action';
905
918
  key: string;
906
- changes: Partial<Pick<ActionRow, CommonPatchFields | 'title' | 'tone' | 'icon' | 'checkbox' | 'trailing'>>;
919
+ changes: PatchClearableChanges<ActionRow, CommonPatchFields | 'title' | 'tone' | 'icon' | 'checkbox' | 'trailing'>;
907
920
  }> | Readonly<{
908
921
  type: 'buttonGroup';
909
922
  key: string;
910
- changes: Partial<Pick<ButtonGroupRow, CommonPatchFields | 'buttons'>>;
923
+ changes: PatchClearableChanges<ButtonGroupRow, CommonPatchFields | 'buttons'>;
911
924
  }> | Readonly<{
912
925
  type: 'system';
913
926
  key: string;
914
927
  changes: Readonly<{
915
- revision?: number;
916
- disabled?: boolean;
917
- message?: string;
928
+ revision?: number | null;
929
+ disabled?: boolean | null;
930
+ message?: string | null;
918
931
  }>;
919
932
  }>;
920
933
  export type NativeListActionSource = 'row' | 'marketBadge' | 'leadingAction' | 'trailingAccessory' | 'footerAction' | 'buttonGroup' | 'description' | 'mediaClose';
@@ -10,13 +10,18 @@ export declare function ownValidatedNativeSnapshot(snapshot: NativeListSnapshot)
10
10
  export declare function validatePatches(patches: readonly RowPatch[]): readonly RowPatch[];
11
11
  /** Plan value-only patches; callers own valid immutable snapshots and commit state. */
12
12
  export declare function planNativeListPatches(previous: NativeListSnapshot, next: NativeListSnapshot): readonly RowPatch[] | undefined;
13
- export declare function applyRowPatches(snapshot: NativeListSnapshot, patches: readonly RowPatch[]): NativeListSnapshot;
14
- /** Native wrapper only: preserve full public validation for unsupported patches. */
13
+ /** One canonical batch owns both accepted rows and the native wire payload. */
14
+ export declare function applyValidatedRowPatches(snapshot: NativeListSnapshot, patches: readonly RowPatch[]): {
15
+ patches: readonly RowPatch[];
16
+ snapshot: NativeListSnapshot;
17
+ json: string;
18
+ };
15
19
  export declare function applyOwnedNativePatches(snapshot: NativeListSnapshot, patches: readonly RowPatch[]): {
16
20
  patches: readonly RowPatch[];
17
21
  snapshot: NativeListSnapshot;
18
22
  json: string;
19
23
  };
24
+ export declare function applyRowPatches(snapshot: NativeListSnapshot, patches: readonly RowPatch[]): NativeListSnapshot;
20
25
  export declare function serializeSnapshot(snapshot: NativeListSnapshot): string;
21
26
  export declare function serializePatches(patches: readonly RowPatch[]): string;
22
27
  //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const nativeListGeneratedIcons: Readonly<Record<string, string>>;
2
+ //# sourceMappingURL=NativeListGeneratedIcons.d.ts.map
@@ -8,7 +8,6 @@ export declare const WEB_REORDER_ANIMATION: {
8
8
  readonly dropDurationMs: 80;
9
9
  readonly dropTimingFunction: "ease";
10
10
  };
11
- export declare const WEB_MARKET_VERIFIED_PATH = "M9.483 11.458v3.5h-1v-3.5z M10.467 2.698a2.03 2.03 0 0 1 3.065 0l1.358 1.564a.03.03 0 0 0 .028.01l2.046-.325a2.03 2.03 0 0 1 2.347 1.971l.037 2.07q0 .016.014.026l1.776 1.066a2.03 2.03 0 0 1 .532 3.019l-1.304 1.609a.03.03 0 0 0-.005.03l.675 1.956a2.03 2.03 0 0 1-1.533 2.656l-2.033.394a.03.03 0 0 0-.023.019l-.741 1.933a2.03 2.03 0 0 1-2.88 1.05l-1.811-1.006a.03.03 0 0 0-.03 0l-1.811 1.005a2.03 2.03 0 0 1-2.88-1.049l-.742-1.933a.03.03 0 0 0-.023-.019l-2.033-.394a2.03 2.03 0 0 1-1.532-2.656l.675-1.957a.03.03 0 0 0-.005-.029l-1.304-1.61a2.03 2.03 0 0 1 .532-3.018l1.776-1.066a.03.03 0 0 0 .014-.026l.035-2.07a2.03 2.03 0 0 1 2.349-1.97l2.045.324a.03.03 0 0 0 .028-.01zm1.516 3.76a.5.5 0 0 0-.447.276l-1.861 3.724H8.483a1 1 0 0 0-1 1v3.5a1 1 0 0 0 1 1h6.692a2 2 0 0 0 1.981-1.73l.341-2.5a2 2 0 0 0-1.982-2.27h-1.939l.197-1.269a1.5 1.5 0 0 0-1.481-1.731z";
12
11
  export type WebLayoutItem = Readonly<{
13
12
  index: number;
14
13
  key: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "6.7.0-20",
3
+ "version": "6.7.0-22",
4
4
  "description": "Template-driven native RecyclerView and UICollectionView for React Native",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",
@@ -33,6 +33,9 @@
33
33
  "scripts"
34
34
  ],
35
35
  "scripts": {
36
+ "icons:generate": "node scripts/generate-icons.mjs",
37
+ "icons:check": "node scripts/generate-icons.mjs --check",
38
+ "icons:test": "node scripts/generate-icons.test.mjs",
36
39
  "clean": "del-cli lib",
37
40
  "prepare": "del-cli lib && bob build && cp -r nitrogen lib/nitrogen",
38
41
  "nitrogen": "nitrogen && node scripts/enable-container-slots.mjs",
@@ -67,10 +70,10 @@
67
70
  "@eslint/compat": "^1.3.2",
68
71
  "@eslint/eslintrc": "^3.3.1",
69
72
  "@eslint/js": "^9.35.0",
70
- "@react-native/babel-preset": "0.86.2",
71
- "@react-native/eslint-config": "0.86.2",
73
+ "@react-native/babel-preset": "0.88.0",
74
+ "@react-native/eslint-config": "0.88.0",
72
75
  "@types/jest": "^29.5.14",
73
- "@types/react": "^19.2.0",
76
+ "@types/react": "^19.3.0",
74
77
  "del-cli": "^6.0.0",
75
78
  "eslint": "^9.35.0",
76
79
  "eslint-config-prettier": "^10.1.8",
@@ -79,15 +82,15 @@
79
82
  "jsdom": "26.1.0",
80
83
  "nitrogen": "0.37.0",
81
84
  "prettier": "^2.8.8",
82
- "react": "19.2.3",
83
- "react-native": "patch:react-native@npm%3A0.86.2#~/.yarn/patches/react-native-npm-0.86.2-c9d546616f.patch",
85
+ "react": "19.3.0",
86
+ "react-native": "patch:react-native@npm%3A0.88.0#~/.yarn/patches/react-native-npm-0.88.0-60c6201dd2.patch",
84
87
  "react-native-builder-bob": "^0.40.13",
85
88
  "react-native-nitro-modules": "0.37.0",
86
89
  "typescript": "^5.9.2"
87
90
  },
88
91
  "peerDependencies": {
89
- "@onekeyfe/react-native-image": "6.7.0-20",
90
- "@onekeyfe/react-native-native-logger": "6.7.0-20",
92
+ "@onekeyfe/react-native-image": "6.7.0-22",
93
+ "@onekeyfe/react-native-native-logger": "6.7.0-22",
91
94
  "react": "*",
92
95
  "react-native": "*",
93
96
  "react-native-nitro-modules": "0.37.0"
@@ -118,10 +121,13 @@
118
121
  ]
119
122
  },
120
123
  "jest": {
121
- "preset": "react-native",
124
+ "preset": "@react-native/jest-preset",
122
125
  "modulePathIgnorePatterns": [
123
126
  "<rootDir>/lib/"
124
- ]
127
+ ],
128
+ "moduleNameMapper": {
129
+ "^#onekey-icon-assets$": "<rootDir>/../../example/react-native/icon-fixtures/web/assetUrls.ts"
130
+ }
125
131
  },
126
132
  "prettier": {
127
133
  "singleQuote": true,
@@ -14,11 +14,6 @@ Pod::Spec.new do |s|
14
14
  s.source = { :git => "https://github.com/OneKeyHQ/app-modules.git", :tag => "#{s.version}" }
15
15
  s.source_files = ["ios/**/*.{swift,h,m,mm,cpp}"]
16
16
  s.exclude_files = "ios/tests/**/*"
17
- s.resource_bundles = {
18
- "NativeListResources" => [
19
- "ios/Resources/NativeListIcons.xcassets"
20
- ]
21
- }
22
17
  s.static_framework = true
23
18
 
24
19
  s.pod_target_xcconfig = {
@@ -0,0 +1,150 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import crypto from 'node:crypto';
4
+ import { createRequire } from 'node:module';
5
+ import { fileURLToPath } from 'node:url';
6
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
7
+ const require = createRequire(import.meta.url);
8
+ const prettier = require('prettier');
9
+ const format = JSON.parse(
10
+ fs.readFileSync(path.join(root, 'package.json'), 'utf8')
11
+ ).prettier;
12
+ const header =
13
+ '// Generated by scripts/generate-icons.mjs. Coverage and legacy names only; hosts provide SVG resources.\n';
14
+ export function generateOutputs(
15
+ fixtureRoot = path.resolve(
16
+ root,
17
+ '../../example/react-native/icon-fixtures/native/icons'
18
+ ),
19
+ outputRoot = root
20
+ ) {
21
+ const entries = JSON.parse(
22
+ fs.readFileSync(path.join(root, 'scripts/native-list-icons.json'), 'utf8')
23
+ );
24
+ const catalog = JSON.parse(
25
+ fs.readFileSync(path.join(fixtureRoot, 'manifest.json'), 'utf8')
26
+ );
27
+ const records = resolveRecords(entries, catalog, fixtureRoot);
28
+ return renderOutputs(records, outputRoot);
29
+ }
30
+ export function resolveRecords(entries, catalog, fixtureRoot) {
31
+ const names = new Set();
32
+ if (!Array.isArray(entries)) throw new Error('Invalid icon manifest');
33
+ return entries
34
+ .map((entry) => {
35
+ if (
36
+ !entry ||
37
+ typeof entry.name !== 'string' ||
38
+ !/^[A-Z][A-Za-z0-9]*$/.test(entry.name) ||
39
+ names.has(entry.name) ||
40
+ !Array.isArray(entry.platforms) ||
41
+ !entry.platforms.length ||
42
+ new Set(entry.platforms).size !== entry.platforms.length ||
43
+ entry.platforms.some((p) => !['ios', 'android', 'web'].includes(p)) ||
44
+ !['template', 'original', 'primitive'].includes(entry.rendering)
45
+ )
46
+ throw new Error('Invalid icon manifest entry');
47
+ names.add(entry.name);
48
+ if (entry.name === 'Circle')
49
+ return { ...entry, canonical: 'Circle', width: 24, height: 24 };
50
+ if (
51
+ typeof entry.source !== 'string' ||
52
+ entry.source.includes('..') ||
53
+ path.isAbsolute(entry.source)
54
+ )
55
+ throw new Error('Invalid icon manifest entry');
56
+ const matches = Object.entries(catalog).filter(
57
+ ([, value]) => value.source === entry.source
58
+ );
59
+ if (matches.length > 1)
60
+ throw new Error(`Ambiguous shared SVG source: ${entry.source}`);
61
+ const match = matches[0];
62
+ if (!match) throw new Error(`Missing shared SVG source: ${entry.source}`);
63
+ const [canonical, metadata] = match;
64
+ const source = fs.readFileSync(
65
+ path.join(fixtureRoot, `${canonical}.svg`),
66
+ 'utf8'
67
+ );
68
+ const raw = source.endsWith('\n') ? source : source + '\n';
69
+ if (
70
+ crypto.createHash('sha256').update(raw).digest('hex') !==
71
+ metadata.digest
72
+ )
73
+ throw new Error(`Shared SVG resources stale: ${entry.source}`);
74
+ return {
75
+ ...entry,
76
+ canonical,
77
+ width: metadata.viewBox[2],
78
+ height: metadata.viewBox[3],
79
+ };
80
+ })
81
+ .sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
82
+ }
83
+ function renderOutputs(records, outputRoot) {
84
+ const swift =
85
+ header +
86
+ 'import UIKit\n\nstruct NativeListIconMetadata {\n let name: String\n let size: CGSize\n let original: Bool\n}\n\nenum NativeListGeneratedIcons {\n static let icons: [String: NativeListIconMetadata] = [\n' +
87
+ records
88
+ .filter((x) => x.platforms.includes('ios'))
89
+ .map(
90
+ (x) =>
91
+ ` "${x.name}": NativeListIconMetadata(name: "${
92
+ x.canonical
93
+ }", size: CGSize(width: ${x.width}, height: ${x.height}), original: ${
94
+ x.rendering === 'original'
95
+ }),`
96
+ )
97
+ .join('\n') +
98
+ '\n ]\n}\n';
99
+ const kotlin =
100
+ header +
101
+ 'package com.margelo.nitro.nativelist\n\ninternal data class NativeListIconMetadata(val name: String, val width: Float, val height: Float)\ninternal val nativeListGeneratedIcons: Map<String, NativeListIconMetadata> = mapOf(\n' +
102
+ records
103
+ .filter((x) => x.platforms.includes('android'))
104
+ .map(
105
+ (x) =>
106
+ ` "${x.name}" to NativeListIconMetadata("${x.canonical}", ${x.width}f, ${x.height}f),`
107
+ )
108
+ .join('\n') +
109
+ '\n)\n';
110
+ const web =
111
+ header +
112
+ 'export const nativeListGeneratedIcons: Readonly<Record<string, string>> = ' +
113
+ JSON.stringify(
114
+ Object.fromEntries(
115
+ records
116
+ .filter((x) => x.platforms.includes('web'))
117
+ .map((x) => [x.name, x.canonical])
118
+ )
119
+ ) +
120
+ ';\n';
121
+ return new Map([
122
+ [path.join(outputRoot, 'ios/NativeListGeneratedIcons.swift'), swift],
123
+ [
124
+ path.join(
125
+ outputRoot,
126
+ 'android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt'
127
+ ),
128
+ kotlin,
129
+ ],
130
+ [
131
+ path.join(outputRoot, 'src/web/NativeListGeneratedIcons.ts'),
132
+ prettier.format(web, { ...format, parser: 'typescript' }),
133
+ ],
134
+ ]);
135
+ }
136
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
137
+ const outputs = generateOutputs();
138
+ const stale = [...outputs].filter(
139
+ ([file, text]) =>
140
+ !fs.existsSync(file) || fs.readFileSync(file, 'utf8') !== text
141
+ );
142
+ if (process.argv.includes('--check') && stale.length)
143
+ throw new Error('Stale NativeList icon metadata');
144
+ if (!process.argv.includes('--check'))
145
+ for (const [file, text] of stale) {
146
+ fs.mkdirSync(path.dirname(file), { recursive: true });
147
+ fs.writeFileSync(file, text);
148
+ }
149
+ console.log(JSON.stringify({ outputs: outputs.size, changed: stale.length }));
150
+ }