@onekeyfe/react-native-native-list 6.8.0-3 → 6.8.0-30

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 (62) hide show
  1. package/android/build.gradle +3 -0
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +18 -4
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +12 -1
  4. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +166 -36
  5. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +3 -2
  6. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +8 -1
  7. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +6 -3
  8. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +21 -4
  9. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +24 -3
  10. package/android/src/main/java/com/onekey/nativelist/NativeListRowUpdates.kt +34 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +11 -4
  12. package/android/src/main/java/com/onekey/nativelist/NativeListTitleSegmentLayout.kt +71 -0
  13. package/android/src/main/java/com/onekey/nativelist/NativeListTitleSegmentsView.kt +126 -0
  14. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +84 -9
  15. package/android/src/main/res/values/native_scroll_coordinator_ids.xml +1 -0
  16. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentitySubtitleBindingTest.kt +177 -0
  17. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +2 -0
  18. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListTitleSegmentLayoutTest.kt +130 -0
  19. package/docs/ROW_TEMPLATES.md +8 -1
  20. package/docs/SPEC.md +312 -5
  21. package/docs/STYLE_SPEC.md +7 -1
  22. package/ios/NativeListAccessoryStack.swift +22 -0
  23. package/ios/NativeListActivityDetailsView.swift +45 -1
  24. package/ios/NativeListDataRowRenderer.swift +12 -5
  25. package/ios/NativeListIdentityRenderer.swift +145 -66
  26. package/ios/NativeListLeadingVisual.swift +8 -0
  27. package/ios/NativeListMarketRenderer.swift +6 -2
  28. package/ios/NativeListModels.swift +7 -0
  29. package/ios/NativeListResolvedText.swift +9 -7
  30. package/ios/NativeListSectionHeaderRenderer.swift +9 -43
  31. package/ios/NativeListTextStyles.swift +72 -12
  32. package/ios/NativeListTitleSegmentLayout.swift +72 -0
  33. package/ios/NativeListTitleSegmentsLabel.swift +92 -0
  34. package/ios/RNCNativeListView.swift +203 -45
  35. package/ios/tests/NativeListActivityPresentationTests.swift +137 -0
  36. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +155 -0
  37. package/ios/tests/NativeListLifecycleTests.swift +298 -24
  38. package/ios/tests/NativeListMediaVisibilityTests.swift +2 -1
  39. package/lib/module/models.js +2 -0
  40. package/lib/module/validation.js +96 -13
  41. package/lib/module/web/NativeListWebEngine.js +427 -100
  42. package/lib/module/web/templates/ActivityRowRenderer.js +1 -1
  43. package/lib/module/web/templates/IdentityRowRenderer.js +134 -3
  44. package/lib/module/web/templates/MarketRowRenderer.js +2 -0
  45. package/lib/module/web/templates/MediaTileRowRenderer.js +1 -0
  46. package/lib/module/web/templates/RowElements.js +2 -2
  47. package/lib/module/web/templates/RowText.js +2 -0
  48. package/lib/typescript/src/models.d.ts +35 -1
  49. package/lib/typescript/src/web/NativeListWebEngine.d.ts +17 -2
  50. package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +6 -2
  51. package/lib/typescript/src/web/templates/RowVisual.d.ts +1 -1
  52. package/package.json +1 -1
  53. package/src/models.ts +38 -0
  54. package/src/validation.ts +196 -6
  55. package/src/web/NativeListWebEngine.ts +671 -112
  56. package/src/web/templates/ActivityRowRenderer.ts +1 -1
  57. package/src/web/templates/IdentityRowRenderer.ts +208 -3
  58. package/src/web/templates/MarketRowRenderer.ts +2 -0
  59. package/src/web/templates/MediaTileRowRenderer.ts +1 -0
  60. package/src/web/templates/RowElements.ts +3 -2
  61. package/src/web/templates/RowText.ts +6 -0
  62. package/src/web/templates/RowVisual.ts +2 -1
@@ -384,7 +384,7 @@ function bindHistory(body, row, primitives) {
384
384
  // the one native label does. A prefix wider than the row is capped instead,
385
385
  // or it would squeeze the action to nothing and leave no pointer target.
386
386
  v.descriptionPrefix.style.cssText = `${ellipsis}flex-shrink:0;max-width:${actionText ? `calc(100% - ${descriptionActionReserve})` : '100%'};white-space:pre;display:${actionStart > 0 ? 'block' : 'none'}`;
387
- v.descriptionAction.style.cssText = `${ellipsis}appearance:none;max-width:100%;border:0;padding:0;background:transparent;text-align:left;color:inherit;font:inherit;font-variant-numeric:inherit;display:${actionText ? 'block' : 'none'};`;
387
+ v.descriptionAction.style.cssText = `${ellipsis}appearance:none;max-width:100%;border:0;padding:0;background:transparent;text-align:left;color:inherit;font:inherit;font-variant-numeric:inherit;letter-spacing:inherit;display:${actionText ? 'block' : 'none'};`;
388
388
  v.descriptionAction.textContent = actionText;
389
389
  v.description.style.display = row.description ? 'flex' : 'none';
390
390
  v.descriptionAction.tabIndex = boundAction ? 0 : -1;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { applyTextWeight } from "./RowText.js";
3
+ import { applyTextWeight, fontWeight } from "./RowText.js";
4
4
  import { applyTabularNumbers, hasExplicitRowHeight } from "./RowElements.js";
5
5
  import { createElement, setData, tagSlot, markActionAnchorSource, createTextColumn, createBadge } from "./RowElements.js";
6
6
  import { applyTextLayout, applyTextStyleToSlot, applyValueSegments } from "./RowText.js";
@@ -11,9 +11,64 @@ function toneColor(tone, fallback) {
11
11
  if (tone === 'secondary') return 'var(--nl-secondary)';
12
12
  return fallback === 'secondary' ? 'var(--nl-secondary)' : 'var(--nl-primary)';
13
13
  }
14
+ // Hidden from sight, still read: the runs themselves are hidden from
15
+ // assistive technology in favor of `title`.
16
+ const VISUALLY_HIDDEN = {
17
+ position: 'absolute',
18
+ width: '1px',
19
+ height: '1px',
20
+ overflow: 'hidden',
21
+ clip: 'rect(0 0 0 0)',
22
+ whiteSpace: 'nowrap'
23
+ };
24
+ function appendTitleRuns(document, target, row) {
25
+ const runs = createElement(document, 'span', 'ok-native-list-identity-title-runs');
26
+ runs.setAttribute('aria-hidden', 'true');
27
+ Object.assign(runs.style, {
28
+ display: 'flex',
29
+ flex: '1 1 auto',
30
+ minWidth: '0',
31
+ maxWidth: '100%',
32
+ overflow: 'hidden'
33
+ });
34
+ row.titleSegments?.forEach(segment => {
35
+ const run = createElement(document, 'span', 'ok-native-list-identity-title-run',
36
+ // A run is one line on every platform: `white-space: pre` would turn a
37
+ // hard break into a second line here.
38
+ segment.text.replace(/\r\n|[\r\n]/g, ' '));
39
+ // Only the shrinking run gives up width; a cap is a share of the line.
40
+ Object.assign(run.style, {
41
+ flex: segment.shrink ? '0 1 auto' : '0 0 auto',
42
+ minWidth: segment.shrink ? '0' : '',
43
+ maxWidth: segment.maxWidthRatio === undefined ? '' : `${segment.maxWidthRatio * 100}%`,
44
+ overflow: 'hidden',
45
+ textOverflow: 'ellipsis',
46
+ whiteSpace: 'pre'
47
+ });
48
+ if (segment.tone) run.style.color = segment.tone === 'secondary' ? 'var(--nl-secondary)' : 'var(--nl-primary)';
49
+ if (segment.fontWeight === 'medium') {
50
+ run.style.fontWeight = '500';
51
+ run.style.fontFamily = 'var(--nl-font-medium)';
52
+ } else if (segment.fontWeight === 'regular') {
53
+ run.style.fontWeight = '400';
54
+ run.style.fontFamily = 'var(--nl-font-regular)';
55
+ }
56
+ setData(run, 'tone', segment.tone);
57
+ runs.appendChild(run);
58
+ });
59
+ const spoken = createElement(document, 'span', 'ok-native-list-identity-title-spoken', row.title);
60
+ Object.assign(spoken.style, VISUALLY_HIDDEN);
61
+ target.replaceChildren(runs, spoken);
62
+ target.style.display = 'flex';
63
+ target.style.minWidth = '0';
64
+ }
14
65
  function appendAccessories(parent, document, primitives, row, accessories) {
15
66
  if (!accessories?.length) return;
16
67
  const container = createElement(document, 'span', 'ok-native-list-accessories');
68
+
69
+ // ListItem's rename + drag pair sits in <XStack gap="$6">; iOS and Android
70
+ // lay the same pair out natively.
71
+ if (accessories.length === 2 && accessories[0].kind === 'icon' && accessories[0].name === 'PencilOutline' && accessories[1].kind === 'drag') container.style.gap = '24px';
17
72
  if (row && hasExplicitRowHeight(row) && 'presentation' in row && row.presentation === 'networkSelector') {
18
73
  container.style.gap = accessories.some(accessory => accessory.kind === 'checkbox') ? '12px' : '20px';
19
74
  }
@@ -39,8 +94,15 @@ function createIdentityRow(document, primitives, row) {
39
94
  markActionAnchorSource(body, 'leadingAction');
40
95
  }
41
96
  if (row.leadingAction) {
42
- const action = primitives.iconAction(row.leadingAction.name, row.leadingAction.actionKey, row.leadingAction.disabled, row.leadingAction.tintColor);
97
+ const action = primitives.iconAction(row.leadingAction.name, row.leadingAction.actionKey, row.leadingAction.disabled, row.leadingAction.tintColor, row.leadingAction.accessibilityLabel);
43
98
  markActionAnchorSource(action, 'leadingAction');
99
+ // ListItem.IconButton geometry, as on iOS and Android: the medium tertiary
100
+ // frame overhangs its 24-point slot by 7 on each side.
101
+ action.classList.add('ok-native-list-tertiary-icon');
102
+ const glyph = createElement(document, 'span', 'ok-native-list-action-glyph');
103
+ glyph.dataset.nativeListAnchorGlyph = '';
104
+ glyph.append(...action.childNodes);
105
+ action.append(glyph);
44
106
  body.appendChild(action);
45
107
  }
46
108
  const visual = primitives.visual(row.leading, hasExplicitRowHeight(row) ? presentation : undefined);
@@ -86,6 +148,13 @@ function createIdentityRow(document, primitives, row) {
86
148
  fragment.appendChild(document.createTextNode(row.title.slice(offset)));
87
149
  textTarget.prepend(fragment);
88
150
  }
151
+ // The runs replace the plain title, except where `title` itself is
152
+ // highlighted or shown in the wallet sidebar.
153
+ const hasTitleRuns = !!row.titleSegments?.length && presentation !== 'walletSidebar' && !row.titleMatch?.length;
154
+ if (hasTitleRuns) {
155
+ const textTarget = titleElement.querySelector('[data-nl-slot="title"]') ?? titleElement;
156
+ appendTitleRuns(document, textTarget, row);
157
+ }
89
158
  if (row.subtitleSegments?.length) {
90
159
  column.querySelector('.ok-native-list-secondary')?.remove();
91
160
  const segments = createElement(document, 'span', 'ok-native-list-subtitle-segments');
@@ -211,12 +280,59 @@ function createIdentityRow(document, primitives, row) {
211
280
  badges.style.minWidth = '0';
212
281
  }
213
282
  }
283
+ if (hasTitleRuns) {
284
+ // The runs fill what the title line leaves, so a ratio is a share of
285
+ // that width and title accessories sit at the line's end.
286
+ const runs = titleElement.querySelector('.ok-native-list-identity-title-runs');
287
+ for (let node = runs?.parentElement; node && node !== titleElement; node = node.parentElement) {
288
+ node.style.display = 'flex';
289
+ node.style.flex = '1 1 auto';
290
+ node.style.minWidth = '0';
291
+ }
292
+ titleElement.style.display = 'flex';
293
+ titleElement.style.alignItems = 'center';
294
+ }
295
+ if (row.titleLeadingIcon && presentation !== 'walletSidebar') {
296
+ const descriptor = row.titleLeadingIcon;
297
+ if (titleElement.hasAttribute('data-nl-slot')) {
298
+ // Keep the glyph out of the title slot that text styles apply to.
299
+ const titleText = tagSlot(createElement(document, 'span', 'ok-native-list-identity-title-text'), 'title');
300
+ while (titleElement.firstChild) titleText.appendChild(titleElement.firstChild);
301
+ if (hasTitleRuns) {
302
+ titleText.style.display = 'flex';
303
+ // Created after the loop above gave the runs' ancestors their share:
304
+ // without it a ratio would be a share of the text's own width.
305
+ titleText.style.flex = '1 1 auto';
306
+ titleText.style.minWidth = '0';
307
+ }
308
+ titleElement.removeAttribute('data-nl-slot');
309
+ titleElement.appendChild(titleText);
310
+ }
311
+ // A label makes the passive glyph an image with that name.
312
+ const icon = primitives.iconAction(descriptor.name, undefined, undefined, descriptor.tintColor, descriptor.accessibilityLabel);
313
+ icon.className = 'ok-native-list-identity-title-leading-icon';
314
+ if (!descriptor.accessibilityLabel) icon.setAttribute('aria-hidden', 'true');
315
+ // The slot is 16px. Host artwork comes at 24px, and a name without
316
+ // artwork leaves the slot empty rather than a text glyph.
317
+ const artwork = icon.querySelector('svg');
318
+ if (artwork) {
319
+ artwork.setAttribute('width', '16');
320
+ artwork.setAttribute('height', '16');
321
+ } else icon.textContent = '';
322
+ titleElement.style.display = 'flex';
323
+ titleElement.style.alignItems = 'center';
324
+ // 6px to the title, whatever gap the title line already has.
325
+ const lineGap = Number.parseFloat(titleElement.style.gap || '0') || 0;
326
+ icon.style.marginInlineEnd = `${Math.max(0, 6 - lineGap)}px`;
327
+ titleElement.prepend(icon);
328
+ }
214
329
  if (presentation === 'walletSidebar' && row.badges?.length) {
215
330
  const badges = createElement(document, 'span', 'ok-native-list-wallet-badges');
216
331
  row.badges.forEach(badge => badges.appendChild(createBadge(document, badge)));
217
332
  column.appendChild(badges);
218
333
  }
219
334
  for (const key of ['title', 'subtitle']) {
335
+ if (key === 'title' && hasTitleRuns) continue;
220
336
  const lines = row.style?.[key]?.lines ?? row[`${key}Lines`];
221
337
  if (lines !== undefined) column.querySelectorAll(`[data-nl-slot="${key}"]`).forEach(text => {
222
338
  applyTextLayout(text, lines === 0 ? {} : {
@@ -303,10 +419,25 @@ function applyIdentityStyle(body, row) {
303
419
  const slotStyle = style[key];
304
420
  if (!slotStyle) return;
305
421
  body.querySelectorAll('[data-nl-slot="' + key + '"]').forEach(element => {
306
- applyTextStyleToSlot(element, slotStyle);
422
+ if (key === 'title' && element.querySelector('.ok-native-list-identity-title-runs')) applyTitleStyleToRuns(element, slotStyle);else applyTextStyleToSlot(element, slotStyle);
307
423
  });
308
424
  });
309
425
  }
426
+ // With runs, `style.title` only sets what a run inherits: a run that names its
427
+ // tone or weight keeps it, and the runs stay on one line whatever `lines` says.
428
+ function applyTitleStyleToRuns(slot, style) {
429
+ if (style.fontSize !== undefined) slot.style.fontSize = String(style.fontSize) + 'px';
430
+ if (style.lineHeight !== undefined) slot.style.lineHeight = String(style.lineHeight) + 'px';
431
+ if (style.fontWeight !== undefined) applyTextWeight(slot, String(fontWeight(style.fontWeight, 400)));
432
+ if (style.color !== undefined) slot.style.color = style.color;
433
+ if (style.tabularNumbers !== undefined) slot.style.fontVariantNumeric = style.tabularNumbers ? 'tabular-nums' : 'proportional-nums';
434
+ if (style.letterSpacing !== undefined) slot.style.letterSpacing = String(style.letterSpacing) + 'px';
435
+ // Paint only, as for a plain title: the line keeps its place in the layout.
436
+ if (style.offsetY !== undefined) {
437
+ const runs = slot.querySelector('.ok-native-list-identity-title-runs');
438
+ if (runs) runs.style.transform = `translateY(${style.offsetY}px)`;
439
+ }
440
+ }
310
441
  const views = new WeakMap();
311
442
  function bind(body, row, primitives) {
312
443
  const v = views.get(body);
@@ -27,6 +27,8 @@ function applyMarketTextStyle(element, style, defaults) {
27
27
  element.style.lineHeight = String(style?.lineHeight ?? defaults.lineHeight) + 'px';
28
28
  applyTextWeight(element, String(fontWeight(style?.fontWeight, defaults.weight)));
29
29
  element.style.color = style?.color ?? '';
30
+ element.style.letterSpacing = '';
31
+ element.style.fontVariantNumeric = '';
30
32
  element.style.textAlign = style?.alignment ?? defaults.alignment;
31
33
  element.style.whiteSpace = (style?.lines ?? 1) > 1 ? 'normal' : 'nowrap';
32
34
  element.style.display = '';
@@ -364,6 +364,7 @@ function bindGallery(body, row, primitives) {
364
364
  }
365
365
  v.badge.textContent = row.badge?.text ?? '';
366
366
  if (row.badge) {
367
+ v.badge.style.cssText = '';
367
368
  Object.assign(v.badge.style, {
368
369
  position: 'absolute',
369
370
  right: '0',
@@ -48,8 +48,8 @@ export function createBadge(document, badge) {
48
48
  // Selector digits retain their font family, including explicit button fonts.
49
49
  export function applyTabularNumbers(body) {
50
50
  body.style.fontVariantNumeric = 'tabular-nums';
51
- body.querySelectorAll('span,button').forEach(text => {
52
- text.style.fontVariantNumeric = 'tabular-nums';
51
+ body.querySelectorAll('button').forEach(button => {
52
+ if (!button.style.fontVariantNumeric) button.style.fontVariantNumeric = 'inherit';
53
53
  });
54
54
  }
55
55
 
@@ -96,6 +96,8 @@ export function applyTextStyleToSlot(element, style, defaultLines) {
96
96
  if (style.lineHeight !== undefined) element.style.lineHeight = String(style.lineHeight) + 'px';
97
97
  if (style.fontWeight !== undefined) applyTextWeight(element, String(fontWeight(style.fontWeight, 400)));
98
98
  if (style.color !== undefined) element.style.color = style.color;
99
+ if (style.tabularNumbers !== undefined) element.style.fontVariantNumeric = style.tabularNumbers ? 'tabular-nums' : 'proportional-nums';
100
+ if (style.letterSpacing !== undefined) element.style.letterSpacing = String(style.letterSpacing) + 'px';
99
101
  // Explicit overrides also apply to rich text runs, but never to sibling badges.
100
102
  // Subscript segments keep their legacy size relative to the field size.
101
103
  element.querySelectorAll('span').forEach(run => {
@@ -51,6 +51,10 @@ export type NativeListTextStyle = Readonly<{
51
51
  verticalAlignment?: 'top' | 'center' | 'bottom';
52
52
  /** Optical translation in logical units; does not affect layout. */
53
53
  offsetY?: number;
54
+ /** Extra spacing between glyphs in logical units. An explicit 0 turns off the platform's pair kerning on iOS, matching React Native `letterSpacing: 0`. */
55
+ letterSpacing?: number;
56
+ /** Equal-width (tabular) digits, matching the App's `SizableText` default. Omission keeps each template's current digits. */
57
+ tabularNumbers?: boolean;
54
58
  }>;
55
59
  /** Retained alias: Market shipped this name before the style surface was shared. */
56
60
  export type MarketTextStyle = NativeListTextStyle;
@@ -254,6 +258,8 @@ type VisualWithImage = Readonly<{
254
258
  overlays?: readonly VisualOverlay[];
255
259
  borderStyle?: 'dashed';
256
260
  borderColor?: string;
261
+ /** Solid border width in logical units (0 < width <= 4); defaults to 1. Use the host's hairline width for a hairline. */
262
+ borderWidth?: number;
257
263
  image?: ImageSource;
258
264
  fallbackText?: string;
259
265
  fallbackTextColor?: string;
@@ -394,6 +400,18 @@ export type RowBase = Readonly<{
394
400
  accessibilityLabel?: string;
395
401
  separator?: boolean;
396
402
  }>;
403
+ /** One run of an identity title line; see docs/SPEC.md. */
404
+ export type IdentityTitleSegment = Readonly<{
405
+ text: string;
406
+ /** Omitted: the title color. */
407
+ tone?: 'primary' | 'secondary';
408
+ /** Omitted: the title weight. */
409
+ fontWeight?: 'regular' | 'medium';
410
+ /** The one run that gives up width when the line is too narrow. */
411
+ shrink?: boolean;
412
+ /** Caps the run at this fraction of the title line, within (0, 1]. */
413
+ maxWidthRatio?: number;
414
+ }>;
397
415
  export type IdentityRow = RowBase & Readonly<{
398
416
  type: 'identity';
399
417
  /** Opt in to content-based height; explicit row/container height still wins. */
@@ -428,6 +446,14 @@ export type IdentityRow = RowBase & Readonly<{
428
446
  }>;
429
447
  /** Web-only additional help icon after titleIcon. */
430
448
  secondaryTitleIcon?: IdentityRow['titleIcon'];
449
+ /** Runs drawn in place of `title`, which stays the spoken label. */
450
+ titleSegments?: readonly IdentityTitleSegment[];
451
+ /** 16-point glyph before the title; decorative unless labelled. */
452
+ titleLeadingIcon?: Readonly<{
453
+ name: string;
454
+ tintColor?: string;
455
+ accessibilityLabel?: string;
456
+ }>;
431
457
  /** Circular image after title icons; image dimensions must be square, 1...40. */
432
458
  titleImage?: Readonly<{
433
459
  image: ImageSource;
@@ -441,6 +467,8 @@ export type IdentityRow = RowBase & Readonly<{
441
467
  titleLines?: 1 | 2;
442
468
  /** Zero displays the complete subtitle. */
443
469
  subtitleLines?: 0 | 1 | 2;
470
+ /** Drop the trailing column (and its gap) when the row has no trailing accessories. Omitted keeps the legacy 12-point reservation. */
471
+ collapseEmptyTrailing?: boolean;
444
472
  badges?: readonly BadgeModel[];
445
473
  trailing?: readonly TrailingAccessory[];
446
474
  draggable?: boolean;
@@ -877,6 +905,12 @@ export type NativeListSnapshot = Readonly<{
877
905
  }>;
878
906
  capabilities?: Readonly<{
879
907
  reorderable?: boolean;
908
+ /**
909
+ * `row` (default) starts a reorder from a long press anywhere on a
910
+ * reorderable row. `handle` starts it only from a long press on the
911
+ * row's trailing `drag` accessory.
912
+ */
913
+ reorderActivation?: 'row' | 'handle';
880
914
  pullToRefresh?: boolean;
881
915
  refreshing?: boolean;
882
916
  refreshTriggerDistance?: number;
@@ -897,7 +931,7 @@ export type PatchClearableChanges<Row, Keys extends keyof Row> = Readonly<{
897
931
  export type RowPatch = Readonly<{
898
932
  type: 'identity';
899
933
  key: string;
900
- changes: PatchClearableChanges<IdentityRow, CommonPatchFields | 'title' | 'titleSuffixes' | 'titleIcon' | 'secondaryTitleIcon' | 'titleImage' | 'subtitle' | 'subtitleLines' | 'contentHeight' | 'longPressActionKey' | 'tertiary' | 'tertiaryTone' | 'badges' | 'trailing' | 'leading' | 'leadingAction' | 'titleMatch' | 'titleActionKey' | 'titleActionOnHover' | 'subtitleSegments'>;
934
+ changes: PatchClearableChanges<IdentityRow, CommonPatchFields | 'title' | 'titleSuffixes' | 'titleIcon' | 'secondaryTitleIcon' | 'titleImage' | 'titleSegments' | 'titleLeadingIcon' | 'subtitle' | 'subtitleLines' | 'collapseEmptyTrailing' | 'contentHeight' | 'longPressActionKey' | 'tertiary' | 'tertiaryTone' | 'badges' | 'trailing' | 'leading' | 'leadingAction' | 'titleMatch' | 'titleActionKey' | 'titleActionOnHover' | 'subtitleSegments'>;
901
935
  }> | Readonly<{
902
936
  type: 'rail';
903
937
  key: string;
@@ -139,7 +139,7 @@ export declare class NativeListWebEngine {
139
139
  private reorderSettlingKey;
140
140
  private reorderCompactKey;
141
141
  private reorderExpandingKey;
142
- private suppressClickUntil;
142
+ private readonly reorderClickPointers;
143
143
  private pullStartY;
144
144
  private pullDistance;
145
145
  private virtualizationEnabled;
@@ -191,6 +191,8 @@ export declare class NativeListWebEngine {
191
191
  private applyValidatedSnapshot;
192
192
  private cancelStructuralAnimation;
193
193
  private handleStructuralUserScroll;
194
+ private wheelReachesScrollOwner;
195
+ private hasNegativeScrollOffsets;
194
196
  private updateStructuralTailWindow;
195
197
  private writeStructuralHeight;
196
198
  private reactFooterElement;
@@ -201,7 +203,7 @@ export declare class NativeListWebEngine {
201
203
  currentSnapshot(): NativeListSnapshot;
202
204
  applyPatches(patches: readonly RowPatch[]): void;
203
205
  reconcileSelection(keys: readonly string[]): void;
204
- scrollToIndex(index: number, scroll: NormalizedPositionScroll): void;
206
+ scrollToIndex(index: number, scroll: NormalizedPositionScroll, behavior?: ScrollBehavior): void;
205
207
  scrollToKey(key: string, scroll: NormalizedPositionScroll): void;
206
208
  scrollToOffset(offset: number, animated: boolean): void;
207
209
  scrollToEnd(animated: boolean): void;
@@ -223,6 +225,8 @@ export declare class NativeListWebEngine {
223
225
  private updateAvatarWindow;
224
226
  private renderWindow;
225
227
  private positionElement;
228
+ private updateRowReorderability;
229
+ private canStartKeyboardReorder;
226
230
  private renderElement;
227
231
  private renderFooter;
228
232
  private sectionIndexVisibleEntryIndices;
@@ -271,12 +275,19 @@ export declare class NativeListWebEngine {
271
275
  private emitHoverAction;
272
276
  private handleIconHelpPointerDown;
273
277
  private handleTitlePointerOut;
278
+ private clearReorderClick;
279
+ private reorderClickTarget;
280
+ private trackReorderPress;
281
+ private trackReorderRelease;
282
+ private legacyClickPointerId;
274
283
  private handleClick;
275
284
  private handleKeyDown;
276
285
  private startKeyboardReorder;
277
286
  private moveKeyboardReorder;
278
287
  private finishKeyboardReorder;
279
288
  private cancelKeyboardReorder;
289
+ private setReorderRows;
290
+ private focusMountedRow;
280
291
  private handleExternalScroll;
281
292
  private handleScroll;
282
293
  private handleWindowResize;
@@ -293,6 +304,8 @@ export declare class NativeListWebEngine {
293
304
  private handlePullEnd;
294
305
  private updateRefreshIndicator;
295
306
  private handleReorderPointerDown;
307
+ private canStartPointerReorder;
308
+ private pointerReorderSourceIndex;
296
309
  private activatePointerReorder;
297
310
  private captureReorderPointer;
298
311
  private releaseReorderPointer;
@@ -313,6 +326,7 @@ export declare class NativeListWebEngine {
313
326
  private runReorderMove;
314
327
  private flushReorderMove;
315
328
  private stopReorderMove;
329
+ private reorderPointerCoordinate;
316
330
  private reorderIndexAtPointer;
317
331
  private movePointerReorderTo;
318
332
  private canReuseReorderLayout;
@@ -324,6 +338,7 @@ export declare class NativeListWebEngine {
324
338
  private completePointerReorder;
325
339
  private handleReorderPointerCancel;
326
340
  private stopReorderAutoScroll;
341
+ private cancelPendingPointerReorder;
327
342
  private cancelPointerReorder;
328
343
  private remapMountedRows;
329
344
  private updateReorderVisualState;
@@ -6,7 +6,7 @@ export declare function rowRenderer(row: RowModel): {
6
6
  create: (document: Document, primitives: Readonly<{
7
7
  background: string;
8
8
  icon: (element: HTMLElement, name: string) => void;
9
- iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
9
+ iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string, accessibilityLabel?: string) => HTMLElement;
10
10
  accessory: (rowKey: string, descriptor: import("../..").TrailingAccessory, slot: number) => HTMLElement;
11
11
  visual: (source: import("../..").LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
12
12
  thumbnail: (source: Readonly<{
@@ -35,13 +35,15 @@ export declare function rowRenderer(row: RowModel): {
35
35
  alignment?: "start" | "center" | "end";
36
36
  verticalAlignment?: "top" | "center" | "bottom";
37
37
  offsetY?: number;
38
+ letterSpacing?: number;
39
+ tabularNumbers?: boolean;
38
40
  }>, defaultLines?: number) => void;
39
41
  dispose: (element: HTMLElement) => void;
40
42
  }>) => HTMLElement;
41
43
  bind: (body: HTMLElement, primitives: Readonly<{
42
44
  background: string;
43
45
  icon: (element: HTMLElement, name: string) => void;
44
- iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
46
+ iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string, accessibilityLabel?: string) => HTMLElement;
45
47
  accessory: (rowKey: string, descriptor: import("../..").TrailingAccessory, slot: number) => HTMLElement;
46
48
  visual: (source: import("../..").LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
47
49
  thumbnail: (source: Readonly<{
@@ -70,6 +72,8 @@ export declare function rowRenderer(row: RowModel): {
70
72
  alignment?: "start" | "center" | "end";
71
73
  verticalAlignment?: "top" | "center" | "bottom";
72
74
  offsetY?: number;
75
+ letterSpacing?: number;
76
+ tabularNumbers?: boolean;
73
77
  }>, defaultLines?: number) => void;
74
78
  dispose: (element: HTMLElement) => void;
75
79
  }>) => void;
@@ -2,7 +2,7 @@ import type { TrailingAccessory, ImageSource, LeadingVisual, NativeListTextStyle
2
2
  export type RowPrimitives = Readonly<{
3
3
  background: string;
4
4
  icon: (element: HTMLElement, name: string) => void;
5
- iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string) => HTMLElement;
5
+ iconAction: (name: string, actionKey: string | undefined, disabled?: boolean, tintColor?: string, accessibilityLabel?: string) => HTMLElement;
6
6
  accessory: (rowKey: string, descriptor: TrailingAccessory, slot: number) => HTMLElement;
7
7
  visual: (source: LeadingVisual | undefined, presentation?: string) => HTMLElement | undefined;
8
8
  thumbnail: (source: ImageSource) => HTMLElement | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-native-list",
3
- "version": "6.8.0-3",
3
+ "version": "6.8.0-30",
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",
package/src/models.ts CHANGED
@@ -66,6 +66,10 @@ export type NativeListTextStyle = Readonly<{
66
66
  verticalAlignment?: 'top' | 'center' | 'bottom';
67
67
  /** Optical translation in logical units; does not affect layout. */
68
68
  offsetY?: number;
69
+ /** Extra spacing between glyphs in logical units. An explicit 0 turns off the platform's pair kerning on iOS, matching React Native `letterSpacing: 0`. */
70
+ letterSpacing?: number;
71
+ /** Equal-width (tabular) digits, matching the App's `SizableText` default. Omission keeps each template's current digits. */
72
+ tabularNumbers?: boolean;
69
73
  }>;
70
74
 
71
75
  /** Retained alias: Market shipped this name before the style surface was shared. */
@@ -372,6 +376,8 @@ type VisualWithImage = Readonly<{
372
376
  overlays?: readonly VisualOverlay[];
373
377
  borderStyle?: 'dashed';
374
378
  borderColor?: string;
379
+ /** Solid border width in logical units (0 < width <= 4); defaults to 1. Use the host's hairline width for a hairline. */
380
+ borderWidth?: number;
375
381
  image?: ImageSource;
376
382
  fallbackText?: string;
377
383
  fallbackTextColor?: string;
@@ -513,6 +519,19 @@ export type RowBase = Readonly<{
513
519
  separator?: boolean;
514
520
  }>;
515
521
 
522
+ /** One run of an identity title line; see docs/SPEC.md. */
523
+ export type IdentityTitleSegment = Readonly<{
524
+ text: string;
525
+ /** Omitted: the title color. */
526
+ tone?: 'primary' | 'secondary';
527
+ /** Omitted: the title weight. */
528
+ fontWeight?: 'regular' | 'medium';
529
+ /** The one run that gives up width when the line is too narrow. */
530
+ shrink?: boolean;
531
+ /** Caps the run at this fraction of the title line, within (0, 1]. */
532
+ maxWidthRatio?: number;
533
+ }>;
534
+
516
535
  export type IdentityRow = RowBase &
517
536
  Readonly<{
518
537
  type: 'identity';
@@ -544,6 +563,14 @@ export type IdentityRow = RowBase &
544
563
  }>;
545
564
  /** Web-only additional help icon after titleIcon. */
546
565
  secondaryTitleIcon?: IdentityRow['titleIcon'];
566
+ /** Runs drawn in place of `title`, which stays the spoken label. */
567
+ titleSegments?: readonly IdentityTitleSegment[];
568
+ /** 16-point glyph before the title; decorative unless labelled. */
569
+ titleLeadingIcon?: Readonly<{
570
+ name: string;
571
+ tintColor?: string;
572
+ accessibilityLabel?: string;
573
+ }>;
547
574
  /** Circular image after title icons; image dimensions must be square, 1...40. */
548
575
  titleImage?: Readonly<{
549
576
  image: ImageSource;
@@ -557,6 +584,8 @@ export type IdentityRow = RowBase &
557
584
  titleLines?: 1 | 2;
558
585
  /** Zero displays the complete subtitle. */
559
586
  subtitleLines?: 0 | 1 | 2;
587
+ /** Drop the trailing column (and its gap) when the row has no trailing accessories. Omitted keeps the legacy 12-point reservation. */
588
+ collapseEmptyTrailing?: boolean;
560
589
  badges?: readonly BadgeModel[];
561
590
  trailing?: readonly TrailingAccessory[];
562
591
  draggable?: boolean;
@@ -1064,6 +1093,12 @@ export type NativeListSnapshot = Readonly<{
1064
1093
  }>;
1065
1094
  capabilities?: Readonly<{
1066
1095
  reorderable?: boolean;
1096
+ /**
1097
+ * `row` (default) starts a reorder from a long press anywhere on a
1098
+ * reorderable row. `handle` starts it only from a long press on the
1099
+ * row's trailing `drag` accessory.
1100
+ */
1101
+ reorderActivation?: 'row' | 'handle';
1067
1102
  pullToRefresh?: boolean;
1068
1103
  refreshing?: boolean;
1069
1104
  refreshTriggerDistance?: number;
@@ -1110,8 +1145,11 @@ export type RowPatch =
1110
1145
  | 'titleIcon'
1111
1146
  | 'secondaryTitleIcon'
1112
1147
  | 'titleImage'
1148
+ | 'titleSegments'
1149
+ | 'titleLeadingIcon'
1113
1150
  | 'subtitle'
1114
1151
  | 'subtitleLines'
1152
+ | 'collapseEmptyTrailing'
1115
1153
  | 'contentHeight'
1116
1154
  | 'longPressActionKey'
1117
1155
  | 'tertiary'