@onekeyfe/react-native-native-list 6.7.0-alpha.475 → 6.8.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +312 -379
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +15 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +3 -87
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +60 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +3 -6
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +5 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +75 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +25 -19
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListDescriptionTouchPolicyTest.kt +153 -0
- package/docs/ROW_TEMPLATES.md +9 -11
- package/docs/SPEC.md +188 -108
- package/docs/STYLE_SPEC.md +7 -0
- package/ios/NativeListActivityDetailsView.swift +13 -5
- package/ios/NativeListIdentityRenderer.swift +6 -94
- package/ios/NativeListMediaPlaceholderView.swift +189 -0
- package/ios/NativeListMediaTileRenderer.swift +13 -13
- package/ios/NativeListResolvedText.swift +15 -4
- package/ios/NativeListTextLabel.swift +106 -0
- package/ios/RNCNativeListView.swift +50 -7
- package/ios/tests/NativeListActivityPresentationTests.swift +270 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +0 -95
- package/ios/tests/NativeListLifecycleTests.swift +176 -16
- package/ios/tests/NativeListMediaVisibilityTests.swift +16 -7
- package/lib/module/NativeList.js +17 -4
- package/lib/module/NativeList.web.js +3 -1
- package/lib/module/models.js +0 -2
- package/lib/module/validation.js +23 -72
- package/lib/module/web/NativeListWebEngine.js +13 -11
- package/lib/module/web/templates/ActivityRowRenderer.js +29 -23
- package/lib/module/web/templates/DataRowRenderer.js +16 -0
- package/lib/module/web/templates/IdentityRowRenderer.js +3 -92
- package/lib/module/web/templates/MediaTileRowRenderer.js +84 -15
- package/lib/typescript/src/models.d.ts +10 -22
- package/package.json +1 -1
- package/src/NativeList.tsx +25 -4
- package/src/NativeList.web.tsx +1 -1
- package/src/models.ts +9 -23
- package/src/validation.ts +35 -120
- package/src/web/NativeListWebEngine.ts +16 -11
- package/src/web/templates/ActivityRowRenderer.ts +42 -32
- package/src/web/templates/DataRowRenderer.ts +28 -0
- package/src/web/templates/IdentityRowRenderer.ts +3 -141
- package/src/web/templates/MediaTileRowRenderer.ts +90 -15
- package/android/src/main/java/com/onekey/nativelist/NativeListTitleSegmentLayout.kt +0 -49
- package/android/src/main/java/com/onekey/nativelist/NativeListTitleSegmentsView.kt +0 -105
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListTitleSegmentLayoutTest.kt +0 -80
- package/ios/NativeListTitleSegmentLayout.swift +0 -45
- package/ios/NativeListTitleSegmentsLabel.swift +0 -80
package/docs/SPEC.md
CHANGED
|
@@ -71,15 +71,44 @@ prevention; there is no automatic fitting or shrinking pass.
|
|
|
71
71
|
|
|
72
72
|
## Public API and defaults
|
|
73
73
|
|
|
74
|
-
### Media failure
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
74
|
+
### Media loading and failure placeholders — Implemented
|
|
75
|
+
|
|
76
|
+
Gallery media tiles draw one placeholder layer over the media slot on iOS
|
|
77
|
+
(`NativeListMediaPlaceholderView.swift`), Android
|
|
78
|
+
(`NativeListMediaPlaceholderView.kt`) and Web (`MediaTileRowRenderer.ts`). All
|
|
79
|
+
three share one geometry so the states read the same everywhere:
|
|
80
|
+
|
|
81
|
+
- **Loading** — from bind until the first candidate loads or every candidate
|
|
82
|
+
fails. Fill: `strongBackground`. A sheen band 60% of the tile wide, skewed
|
|
83
|
+
-12°, sweeps left to right over 1.6s (70% travel with `cubic-bezier(0.4, 0,
|
|
84
|
+
0.2, 1)`, 30% rest). Every tile derives its phase from one shared clock
|
|
85
|
+
(`CACurrentMediaTime` / `SystemClock.uptimeMillis` / `performance.now`), so a
|
|
86
|
+
grid sweeps in step, recycled cells included. The sheen is white at 75% on a
|
|
87
|
+
light `rowBackground` (Web: `background`) and 7% on a dark one. Reduced
|
|
88
|
+
motion (iOS Reduce Motion, Android animator scale 0, Web
|
|
89
|
+
`prefers-reduced-motion`) holds the band still at 60% strength.
|
|
90
|
+
- **Failed** — explicit `imageState: 'error'` or exhausted probes. Fill:
|
|
91
|
+
`strongBackground`, plus 1pt `primaryText` lines at 4.5% alpha along 135°,
|
|
92
|
+
7pt apart, masked by a radial gradient that is clear inside 22% of the
|
|
93
|
+
half-diagonal and opaque from 70%. No text is shown, so there is no copy to
|
|
94
|
+
localize.
|
|
95
|
+
- **Loaded / empty** — the placeholder is hidden; `imageState: 'empty'`
|
|
96
|
+
without a source keeps the slot transparent as before.
|
|
97
|
+
|
|
98
|
+
Both visible states draw a 24-unit glyph at 28% of the tile width, capped at
|
|
99
|
+
44pt, stroked 1.5 units in `disabledText` at 70% of its alpha: a rounded frame
|
|
100
|
+
(3,3,18,18, r4), a sun (9,9 r1.6) and a ridge (5,20.5 → 14.5,11 → 21,17.5).
|
|
101
|
+
The failed glyph adds a slash (3,3 → 21,21) and cuts a 1.6-unit gap into the
|
|
102
|
+
frame on both sides of it. A 1px `separator` hairline at 60% of its alpha
|
|
103
|
+
outlines the slot in both states.
|
|
104
|
+
|
|
105
|
+
The placeholder owns the slot fill while visible. On Android the media view
|
|
106
|
+
is made invisible in the failed state, because OneKeyImage may paint its own
|
|
107
|
+
terminal state symbol after a probe advances. Image content and SVG decoding
|
|
108
|
+
remain owned by OneKeyImage; no per-cell WebView or fallback network source is
|
|
109
|
+
added. A theme rebind updates every color. Runtime acceptance (2026-11-10):
|
|
110
|
+
iOS dark and Android light on a watch-only wallet NFT grid, Web light/dark in
|
|
111
|
+
the standalone engine harness.
|
|
83
112
|
|
|
84
113
|
### Recipient identity and inline warning rows
|
|
85
114
|
|
|
@@ -210,96 +239,6 @@ and Web acceptance must cover narrow addresses, dynamic type/fonts, long press
|
|
|
210
239
|
versus tap, keyboard interaction, and the horizontal warning border. Source or
|
|
211
240
|
build success alone is not runtime evidence.
|
|
212
241
|
|
|
213
|
-
### Identity title segments and leading title icon
|
|
214
|
-
|
|
215
|
-
Status: implemented in source for iOS, Android and Web; device and Web runtime
|
|
216
|
-
acceptance is pending. These fields travel in snapshot/patch JSON and do not
|
|
217
|
-
change the Nitro ABI. They serve recipient rows whose title is a wallet and an
|
|
218
|
-
account name in two styles, and address book rows marked by an icon before the
|
|
219
|
-
name.
|
|
220
|
-
|
|
221
|
-
`identity.titleSegments` is an optional list of 1...4 runs drawn on the title
|
|
222
|
-
line in place of `title`:
|
|
223
|
-
|
|
224
|
-
```ts
|
|
225
|
-
titleSegments?: readonly {
|
|
226
|
-
text: string;
|
|
227
|
-
tone?: 'primary' | 'secondary';
|
|
228
|
-
fontWeight?: 'regular' | 'medium';
|
|
229
|
-
shrink?: boolean;
|
|
230
|
-
maxWidthRatio?: number; // (0, 1]
|
|
231
|
-
}[];
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
- `title` stays required. It is the spoken label and the fallback text, so it
|
|
235
|
-
carries the same words as the runs; every renderer exposes `title`, not the
|
|
236
|
-
runs, to accessibility.
|
|
237
|
-
- Each run uses the title's font family, size and line height, including
|
|
238
|
-
`style.title` and the configured fonts. `tone` picks the primary or secondary
|
|
239
|
-
text color and defaults to the title color; `fontWeight` picks the weight and
|
|
240
|
-
defaults to the title weight.
|
|
241
|
-
- The runs share one line. `titleLines` and `style.title.lines` do not apply
|
|
242
|
-
to them; a row that draws `title` instead (it has `titleMatch`, or is a wallet
|
|
243
|
-
sidebar row) keeps them for drawing and for measurement.
|
|
244
|
-
- Layout. The runs take the whole width the title line leaves after the
|
|
245
|
-
leading title icon and the title accessories (title icon, title image,
|
|
246
|
-
suffixes, badges), so those accessories sit at the line's end rather than
|
|
247
|
-
right after the text. W is that width:
|
|
248
|
-
1. A run's base width is its natural width, capped at `maxWidthRatio x W`
|
|
249
|
-
when given. A run longer than its cap truncates at the cap with a tail
|
|
250
|
-
ellipsis.
|
|
251
|
-
2. At most one run sets `shrink: true`. Every other run keeps its base width.
|
|
252
|
-
3. The shrinking run gets `min(base, W - sum of the other runs)` and
|
|
253
|
-
truncates with a tail ellipsis; it may shrink to zero width.
|
|
254
|
-
4. When the runs that do not shrink exceed W on their own, the line is cut at
|
|
255
|
-
its end. Native renderers end the last visible run with an ellipsis; Web
|
|
256
|
-
clips it. This divergence is accepted: callers avoid the case with
|
|
257
|
-
`maxWidthRatio`.
|
|
258
|
-
- Development validation rejects an empty or oversized list, blank or
|
|
259
|
-
oversized text (the 4096-code-unit text bound), unknown keys, tones or
|
|
260
|
-
weights, a ratio outside `(0, 1]`, more than one shrinking run, `titleMatch`
|
|
261
|
-
on the same row (its ranges index `title`), and
|
|
262
|
-
`presentation: 'walletSidebar'`. Production treats the runs as decoration:
|
|
263
|
-
an invalid list is dropped and the row shows `title`. Renderers draw `title`
|
|
264
|
-
instead of runs on a row that also has `titleMatch`, and ignore runs and the
|
|
265
|
-
leading icon with `presentation: 'walletSidebar'`.
|
|
266
|
-
|
|
267
|
-
`identity.titleLeadingIcon` is an optional `{ name, tintColor?,
|
|
268
|
-
accessibilityLabel? }`: a 16-point glyph before the title text or its runs,
|
|
269
|
-
with a 6-point gap, vertically centered on the title line. It keeps its 16
|
|
270
|
-
points: a long title, or its shrinking run, truncates first. The name comes from
|
|
271
|
-
the same closed icon set as `titleIcon`; an unmapped name leaves an empty
|
|
272
|
-
16-point slot. `tintColor` is a hex `#RRGGBB` or `#RRGGBBAA` color and defaults
|
|
273
|
-
to the theme's `iconSubdued`. Without `accessibilityLabel` the glyph is hidden
|
|
274
|
-
from accessibility. It has no action of its own. Development validation
|
|
275
|
-
rejects unknown keys, a blank name, a malformed color and
|
|
276
|
-
`presentation: 'walletSidebar'`; production drops an invalid icon.
|
|
277
|
-
|
|
278
|
-
Both fields are identity patch fields. Omission in a full snapshot removes
|
|
279
|
-
them; omission in a patch keeps the current value. Rebind and recycle remove the
|
|
280
|
-
previous runs and glyph, so a row without them never shows another row's.
|
|
281
|
-
|
|
282
|
-
| Platform | Title runs | Leading icon |
|
|
283
|
-
| --- | --- | --- |
|
|
284
|
-
| iOS | `NativeListTitleSegmentsLabel` draws the runs at the widths that `NativeListTitleSegmentLayout.swift` allocates for its bounds; it fills the title row in place of the row's filler. | `NativeListIconImageView`, first in the title row stack. A plain title beside it drops below required horizontal compression resistance, as beside `titleIcon`, so the title truncates before the glyph narrows. |
|
|
285
|
-
| Android | `NativeListTitleSegmentsView`, a `TextView` whose text is rebuilt for each measured width from `NativeListTitleSegmentLayout.kt` and which measures to the width it is offered. `PackedTitleLineLayout.titleChild` names the flexible title view, so a view may precede it. | `OneKeyIconView`, first in the title line. |
|
|
286
|
-
| Web | A flex line that fills the title line: the shrinking run is `flex: 0 1 auto; min-width: 0`, the others `flex: 0 0 auto` with a `max-width` percentage for a cap. | An icon element before the title text. |
|
|
287
|
-
|
|
288
|
-
Conformance: `src/validation.ts` (`assertTitleSegments`,
|
|
289
|
-
`assertTitleLeadingIcon`, production sanitizing) with `validation.test.ts`;
|
|
290
|
-
`src/web/templates/IdentityRowRenderer.ts` with `IdentityTitleRunsWeb.test.ts`
|
|
291
|
-
(run styles, flex behavior, accessibility, rebind);
|
|
292
|
-
`ios/NativeListTitleSegmentLayout.swift` (run widths, and when the runs and the
|
|
293
|
-
glyph show) with the SwiftPM `NativeListTitleSegmentLayoutTests`; the iOS
|
|
294
|
-
leading glyph beside a long plain title, wallet sidebar rows and the measured
|
|
295
|
-
height of a highlighted title with the XCTest
|
|
296
|
-
`NativeListIdentityTitleIconLayoutTests`; `NativeListTitleSegmentLayout.kt`
|
|
297
|
-
with the JVM `NativeListTitleSegmentLayoutTest`. iOS, Android and Web runtime acceptance is pending: recipient rows
|
|
298
|
-
with long wallet and account names in both truncation directions, narrow rows,
|
|
299
|
-
dark mode, dynamic type and configured fonts, and recycling between rows with
|
|
300
|
-
and without runs or a leading icon. Source and build success alone are not
|
|
301
|
-
runtime evidence.
|
|
302
|
-
|
|
303
242
|
### DeFi position row controls
|
|
304
243
|
|
|
305
244
|
Status: implemented in local source, unreleased. Focused validation and Web
|
|
@@ -722,6 +661,16 @@ An unrelated layout request MUST NOT indefinitely postpone command completion.
|
|
|
722
661
|
Replacement, actual drag, detach and disposal invalidate old callbacks; a stale
|
|
723
662
|
callback MUST NOT move the view or clear a newer command's barriers.
|
|
724
663
|
|
|
664
|
+
On iOS, the existing `scrollToOffset` implementation is also exposed to native
|
|
665
|
+
callers as `onekeyScrollToOffset:animated:`. BottomTabs discovers this selector
|
|
666
|
+
on the collection view's direct NativeList owner and requests offset zero for
|
|
667
|
+
standalone-list double-press scrolling. The call uses `requestScroll`, including
|
|
668
|
+
its explicit-scroll revision, structural-tail interruption, command notifications
|
|
669
|
+
and pending-layout ownership; external callers MUST NOT bypass it by writing
|
|
670
|
+
the internal collection view's offset. This adds no JavaScript/Nitro API.
|
|
671
|
+
BottomTabs and NativeList native sources must ship together. The native handoff
|
|
672
|
+
is source implemented; structural-transition runtime acceptance remains pending.
|
|
673
|
+
|
|
725
674
|
A valid command can privately notify the owning Pager before execution, including
|
|
726
675
|
a same-position no-op; this does not add a public NativeList API. A Pager-owned
|
|
727
676
|
page-top or sticky-top command can privately cancel only its owned list's old
|
|
@@ -909,6 +858,19 @@ keep their existing layout and public interfaces.
|
|
|
909
858
|
|
|
910
859
|
### Android section-index attachment
|
|
911
860
|
|
|
861
|
+
The index rail and its letter preview MUST remain outside the view hierarchy
|
|
862
|
+
until the accepted configuration contains usable index entries. Disabling the
|
|
863
|
+
index or removing its last usable entry MUST detach both views, cancel the
|
|
864
|
+
preview interaction, and prevent a pending attachment callback from restoring
|
|
865
|
+
them. Restoring usable entries MUST reattach the same view instances without
|
|
866
|
+
duplicate parents. This attachment lifecycle is Android-specific; iOS and Web
|
|
867
|
+
keep their existing behavior.
|
|
868
|
+
|
|
869
|
+
The section-index letter preview is decorative. It MUST NOT participate in
|
|
870
|
+
React Native touch targeting while visible, fading, or invisible. Controls in
|
|
871
|
+
React container slots beneath its bounds MUST remain pressable; the index rail
|
|
872
|
+
continues to own index selection and scrubbing.
|
|
873
|
+
|
|
912
874
|
When `sectionIndex.centeredInWindow` is enabled, the Android index rail moves
|
|
913
875
|
between the list container and the window host as list visibility and attachment
|
|
914
876
|
change. Before adding that same rail to its new parent, the previous parent MUST
|
|
@@ -1472,8 +1434,8 @@ There are no controls or video touch targets; the row owns press interaction.
|
|
|
1472
1434
|
Android preserves a black letterbox and iOS a transparent one, matching the
|
|
1473
1435
|
existing native Video views. No code calls play or requests audio focus.
|
|
1474
1436
|
|
|
1475
|
-
A failed candidate advances once; exhaustion displays the
|
|
1476
|
-
placeholder. New source/row identity resets probing; binding, candidate and
|
|
1437
|
+
A failed candidate advances once; exhaustion displays the failed media
|
|
1438
|
+
placeholder (see Media loading and failure placeholders). New source/row identity resets probing; binding, candidate and
|
|
1477
1439
|
player generations reject stale callbacks, including A→B→A. Text-only updates
|
|
1478
1440
|
preserve the current request. On Android, terminal image/player completion is
|
|
1479
1441
|
posted to the next UI queue turn before advancing probes or notifying the row;
|
|
@@ -1588,15 +1550,42 @@ width React lays it out at. Android's narrow-screen row scale and section-index
|
|
|
1588
1550
|
apply to data rows only. Slot React trees own their internal layout and
|
|
1589
1551
|
business actions; NativeList owns their scroll placement and lifecycle.
|
|
1590
1552
|
|
|
1591
|
-
The wrapper mounts
|
|
1592
|
-
|
|
1593
|
-
The sidecar root has zero reserved height when absent. Native validates
|
|
1594
|
-
finite, non-negative heights
|
|
1595
|
-
|
|
1553
|
+
The wrapper mounts six non-collapsible slot roots and reports measured heights
|
|
1554
|
+
through `containerSlotHeightsJson` in header/empty/footer/sidecar/expanded/toggle
|
|
1555
|
+
order. The sidecar root has zero reserved height when absent. Native validates
|
|
1556
|
+
six finite, non-negative heights and still accepts legacy four-number arrays,
|
|
1557
|
+
except for the iOS pending-header state described below. Slot updates MUST NOT
|
|
1558
|
+
alter data-row keys or public row indices. No per-scroll-frame JS position updates are used.
|
|
1596
1559
|
iOS mounts each slot root inside a list-owned host view in UICollectionView and
|
|
1597
1560
|
reserves native layout space. The host owns the slot's vertical position and clips to
|
|
1598
1561
|
the reported height, so React frame updates cannot move a slot out of place and a slot
|
|
1599
1562
|
whose height has not been reported yet (or has just grown) never draws over rows.
|
|
1563
|
+
|
|
1564
|
+
iOS header first-frame measurement: when `listHeader` is present but
|
|
1565
|
+
its first layout has not arrived, the matching wrapper sends `null` for slot 0
|
|
1566
|
+
instead of an authoritative zero. The other five slot values remain finite,
|
|
1567
|
+
non-negative numbers; Android serialization stays unchanged. On iOS, an absent
|
|
1568
|
+
header always reports numeric zero. Each absent/present boundary replaces only
|
|
1569
|
+
the header slot root and starts a new measurement epoch; a layout callback from
|
|
1570
|
+
an earlier epoch MUST NOT make the current header ready. Replacing header content
|
|
1571
|
+
while it remains present does not start another epoch. A newly present header stays pending
|
|
1572
|
+
until its own layout reports a number, including zero.
|
|
1573
|
+
Before that measurement, the iOS host may reserve the current mounted header
|
|
1574
|
+
root's finite, non-negative `ceil(bounds.height)` when its bounds width is finite
|
|
1575
|
+
and positive. It applies that height to both clipping and row placement in the
|
|
1576
|
+
same native update, regardless of whether the root or pending heights arrive
|
|
1577
|
+
first. Without a valid current root, pending height is zero. Unmounting or
|
|
1578
|
+
recycling the root discards its provisional height; another root cannot inherit
|
|
1579
|
+
it. The first numeric measurement, including a genuine zero, is authoritative
|
|
1580
|
+
and retains ordinary dynamic growth and shrink behavior. Legacy four- and
|
|
1581
|
+
six-number arrays remain accepted. Only header slot 0 may be null, and the
|
|
1582
|
+
wrapper and native binary must match for this pending-header protocol.
|
|
1583
|
+
When the vertical iOS collection view first obtains positive bounds in
|
|
1584
|
+
`layoutSubviews`, it emits `OneKeyNativeScrollViewDidBecomeReady` before
|
|
1585
|
+
executing pending scroll requests or laying out container slots so an enclosing
|
|
1586
|
+
`CollapsiblePagerView` can synchronously attach and apply top insets, offset
|
|
1587
|
+
alignment, and sticky heights during the same layout pass.
|
|
1588
|
+
|
|
1600
1589
|
Android uses ConcatAdapter with three single-item slot adapters around the existing
|
|
1601
1590
|
data adapter; adapter binding indices stay local while layout-manager positions
|
|
1602
1591
|
are explicitly translated. Slots span all grid columns, do not select/reorder,
|
|
@@ -1798,6 +1787,61 @@ tones. `descriptionActionKey` makes only the description emit that action with
|
|
|
1798
1787
|
source `description`; footer actions retain their existing source/keys and
|
|
1799
1788
|
disabled behavior. All actions use the current host binding epoch.
|
|
1800
1789
|
|
|
1790
|
+
Description action text. The action is hit on text only, never on the unused
|
|
1791
|
+
width of the description line, which belongs to the row press. Which text is
|
|
1792
|
+
stated by the caller in `descriptionActionStart`, a UTF-16 offset into
|
|
1793
|
+
`description` as supplied (JavaScript string index): the text from the offset on
|
|
1794
|
+
opens the action, the text before it is plain and belongs to the row press.
|
|
1795
|
+
NativeList never derives the offset from the displayed string, its separators or
|
|
1796
|
+
its wording; a caller that composes `prefix + label` records `prefix.length`.
|
|
1797
|
+
|
|
1798
|
+
- Absent means `0`: the whole description text is the action.
|
|
1799
|
+
`description.length` leaves no action text; the row then has no description
|
|
1800
|
+
action, and no button semantics, on any platform.
|
|
1801
|
+
- The field is ignored without `descriptionActionKey`.
|
|
1802
|
+
- Development validation rejects a value that is not a non-negative safe
|
|
1803
|
+
integer, and on a complete row (a snapshot row, or a row after a patch is
|
|
1804
|
+
merged) a value past `description.length`. Production drops a malformed value,
|
|
1805
|
+
which restores the default, and renderers clamp a value past the text to its
|
|
1806
|
+
end.
|
|
1807
|
+
- A patch that changes `description` without `descriptionActionStart` clears the
|
|
1808
|
+
stored offset, because it pointed into the previous string. Callers that keep
|
|
1809
|
+
a prefix restate the offset in the same patch.
|
|
1810
|
+
- iOS and Android map the offset onto the displayed text: a one-line description
|
|
1811
|
+
folds each line break into one space, so offsets after a CRLF move by one.
|
|
1812
|
+
- The hit area follows the laid-out text. iOS and Android build it from the
|
|
1813
|
+
layout engine's own rects for the action's character range (TextKit enclosing
|
|
1814
|
+
rects, the Android layout's selection), one per line and per visual run. A
|
|
1815
|
+
line that ends before the offset takes no touches, the line that holds it
|
|
1816
|
+
takes them from the offset on, later lines take them on their text. In
|
|
1817
|
+
mixed-direction text the action can be several runs on one line with plain
|
|
1818
|
+
text between them, and each run is its own region.
|
|
1819
|
+
- Touch slop reaches into blank space only. iOS and Android widen each run of
|
|
1820
|
+
action text by 8 units, and the widening stops at plain description text on
|
|
1821
|
+
the same line: text before the offset never opens the action, however narrow
|
|
1822
|
+
it is. iOS also extends the first and the last line of the whole layout by 6
|
|
1823
|
+
points away from the text, never a line in between, so the slop cannot reach
|
|
1824
|
+
into a line that holds only plain text. Android extends the first and last
|
|
1825
|
+
line of the layout to the view's top and bottom edge.
|
|
1826
|
+
- An ellipsis belongs to the action while action text is visible before it.
|
|
1827
|
+
Once truncation hides the action text altogether the ellipsis also stands for
|
|
1828
|
+
plain text, and the row has no hit area for the action.
|
|
1829
|
+
- Truncation. The description stays on its declared lines as `prefix + action`.
|
|
1830
|
+
On Web the prefix keeps its natural width and the action text truncates
|
|
1831
|
+
first, which matches the tail truncation of the native label. While action
|
|
1832
|
+
text follows, the Web prefix is capped at the row width less `3em` and
|
|
1833
|
+
truncates itself, so a prefix wider than the row cannot squeeze the action to
|
|
1834
|
+
nothing and leave it without a pointer target. iOS and Android draw one label
|
|
1835
|
+
and truncate its tail; they do not reserve room, so there a long prefix can
|
|
1836
|
+
push the action text out of view. The Web prefix and action are two elements
|
|
1837
|
+
side by side and each resolves its own text direction, so an offset inside a
|
|
1838
|
+
directional run draws that run in two parts; the action element is still
|
|
1839
|
+
exactly the action text.
|
|
1840
|
+
- Internally the native text view holds one optional start: none keeps the
|
|
1841
|
+
view's own hit testing (rows without the action), `0` limits touches to all of
|
|
1842
|
+
the text, a positive value to the text from there on. Binding, rebinding
|
|
1843
|
+
without the action and recycling set or clear that one value.
|
|
1844
|
+
|
|
1801
1845
|
Rich rows measure the declared line/visual metrics; there is no six-line native
|
|
1802
1846
|
truncation. iOS automatic height mirrors the rendered stacks: `lineGap` between the
|
|
1803
1847
|
visible title/description/status lines, the description measured at the identity
|
|
@@ -2082,8 +2126,9 @@ imageState explicitly selects that state.
|
|
|
2082
2126
|
|
|
2083
2127
|
Web gallery media preserves the consuming NFT card presentation: healthy image
|
|
2084
2128
|
and exhausted fallback surfaces have a10px radius, while a healthy video surface
|
|
2085
|
-
has square corners. The image/video frame uses the list page background;
|
|
2086
|
-
|
|
2129
|
+
has square corners. The image/video frame uses the list page background; the
|
|
2130
|
+
loading and exhausted fallback surfaces use the strong background and the
|
|
2131
|
+
shared media placeholders. Rebinding the same
|
|
2087
2132
|
video key retains square corners, and failed-video fallback to an image restores
|
|
2088
2133
|
the image radius. This is Web renderer behavior; native media presentation and
|
|
2089
2134
|
probe-order contracts are unchanged.
|
|
@@ -2345,6 +2390,41 @@ The same native display-link/animator tick changes suffix extent, footer positio
|
|
|
2345
2390
|
|
|
2346
2391
|
Web/Desktop/extension prefix-preserving tail refinement status: source implemented; Web and Desktop consuming-app preview routes exercised with the local candidate Web overlay. Browser extension was outside that preview scope, and no FPS or paint-duration claim has been verified. The complete accepted snapshot becomes current immediately, while removed suffix rows may remain only in an inert, accessibility-hidden presentation window until the existing 220 ms transition completes. That window follows the same scroll owner and mounts only viewport-near old rows as the owner moves; each row keeps its natural height while the tail is clipped by the interpolated list extent. Inserted suffix rows use their final layout immediately and are revealed by the growing extent. The shared animation frame updates list height, React footer compensation, and programmatic scroll together. Its final scroll range uses the actual parent page extent, including a taller sidecar. For an off-screen fallback, Web uses the footer's complete visible interval where it fits, including the sticky inset, and otherwise aligns the footer start below the sticky region; the retained row is preferred only when the footer is absent. Price patches update the accepted snapshot and visible retained rows without restarting the transition. A newer structure command, unsupported shape, user scroll takeover, reduced motion, resize, or disposal releases presentation nodes and animation ownership without a stale completion writing an older offset. Other structural changes retain the existing behavior. This refinement adds no public field or native behavior; focused Web DOM tests passed, while browser extension and broader runtime performance remain unverified.
|
|
2347
2392
|
|
|
2393
|
+
### Web token table geometry
|
|
2394
|
+
|
|
2395
|
+
Status: implemented with focused SDK regression coverage and consuming-App
|
|
2396
|
+
measurements from a local runtime overlay; formal SDK release integration is
|
|
2397
|
+
separate.
|
|
2398
|
+
|
|
2399
|
+
A Web `DataRow` with exactly the ordered column keys `asset`, `balance`, `price`,
|
|
2400
|
+
and `swapSpacer`, without an ordinal index, favorite control, or checkbox,
|
|
2401
|
+
preserves the legacy four equal columns. Rows with any of those controls retain
|
|
2402
|
+
their existing weighted layout so the controls keep their linear positions.
|
|
2403
|
+
The leading visual and its declared gap share the first column with the asset
|
|
2404
|
+
text; an absent visual reserves no icon inset. Balance and price occupy the
|
|
2405
|
+
second and third columns; the trailing accessories align to the end of the
|
|
2406
|
+
fourth. This closed migration shape uses equal columns instead of the
|
|
2407
|
+
previous weight approximation and removes the row's inherited 12px gap so
|
|
2408
|
+
each track occupies exactly one quarter of the padded content width. Other
|
|
2409
|
+
column shapes retain their existing weighted layout. Rebinding a retained row
|
|
2410
|
+
between these shapes clears the old grid placement, gap override, and asset
|
|
2411
|
+
inset, including when the leading visual is reused.
|
|
2412
|
+
Text, icon size, row height, actions, and iOS/Android layouts retain their
|
|
2413
|
+
existing contracts.
|
|
2414
|
+
|
|
2415
|
+
The Web `listStructureToggle` slot cancels the enclosing footer band's
|
|
2416
|
+
horizontal content inset while disclosure is present, since toggle content owns
|
|
2417
|
+
its page padding. The footer and expanded-content slots keep their existing
|
|
2418
|
+
insets. Changing the accepted content padding updates the compensation;
|
|
2419
|
+
removing disclosure still hides and disables the retained toggle subtree.
|
|
2420
|
+
|
|
2421
|
+
Conformance covers token-to-generic and generic-to-token row reuse, rows with an
|
|
2422
|
+
index/favorite/checkbox, leading visual and disabled action preservation,
|
|
2423
|
+
accepted padding changes, and absent disclosure. The consuming App comparison
|
|
2424
|
+
covers six visible rows and the toggle
|
|
2425
|
+
at 1024, 1280, and 1600 CSS-pixel viewports; it does not establish native runtime
|
|
2426
|
+
acceptance or a performance improvement.
|
|
2427
|
+
|
|
2348
2428
|
`DataRow.trailing?: readonly TrailingAccessory[]` reuses the existing accessory action contract, including `rowKey`, `actionKey`, disabled state, and accessibility/test labels. At most two accessories are accepted. Desktop Home can render its independent price/balance columns with `DataRow.columns` and a Swap button in `trailing`. Existing rows without `trailing` retain their current layout. On iOS, trailing controls reserve their intrinsic width and the weighted columns fill the remaining row width. Changing between linear and table layout rebinds retained cells even when their row payload is unchanged.
|
|
2349
2429
|
|
|
2350
2430
|
`DataColumn.textSegments` and `secondaryTextSegments` reuse `ValueTextSegment` (`text`, optional `style: 'subscript'`) for formatted prices, balances, and values in each independent table column. Plain `text` and `secondaryText` remain the spoken/fallback strings. Missing segments preserve existing rendering.
|
package/docs/STYLE_SPEC.md
CHANGED
|
@@ -285,6 +285,10 @@ content; `lineGap` separates content text rows (primary/secondary per data colum
|
|
|
285
285
|
for activity, the native failure label or rich title badges; Web has no activity
|
|
286
286
|
badge target);
|
|
287
287
|
`trailingGap` separates trailing values/controls (title/badge to status for rail).
|
|
288
|
+
For identity those are the trailing accessories: a `valuePair` is one accessory,
|
|
289
|
+
so the gap sits between it and its neighbours and never between its two lines,
|
|
290
|
+
on every platform. For activity the gap separates `primaryAmount` from
|
|
291
|
+
`secondaryAmount`.
|
|
288
292
|
`walletGroup` padding applies only to the group; it never cascades into members.
|
|
289
293
|
Composite metric-card `lineGap` separates heading/metric blocks and dividers; it
|
|
290
294
|
does not change the typography or inner label/value gap of each metric.
|
|
@@ -535,6 +539,9 @@ defaults applied when `style` is absent.
|
|
|
535
539
|
| image radius | 10 | 10 | dp(10) | 10px **=** |
|
|
536
540
|
| tile radius | 16 | 16 | 16 | 16px **=** |
|
|
537
541
|
| network badge | 14 | 14×14, r7 | dp(14), circle | 14px, r50% **=** |
|
|
542
|
+
| placeholder glyph | 28% of width, max 44 | CAShapeLayer | Canvas path | inline SVG **=** |
|
|
543
|
+
| loading sheen | 60% wide, -12°, 1.6s | CAKeyframeAnimation | `postInvalidateOnAnimation` | CSS keyframes **=** |
|
|
544
|
+
| failed hatch | 1 / 7, 135°, 4.5% | CAShapeLayer + radial mask | `saveLayer` + `DST_IN` | repeating gradient + mask **=** |
|
|
538
545
|
|
|
539
546
|
### metricCard
|
|
540
547
|
|
|
@@ -187,17 +187,24 @@ final class NativeListActivityDetailsView: UIStackView {
|
|
|
187
187
|
weight: .medium, color: nativeListColor(theme, "primaryText", "#202020"), lineHeight: 24,
|
|
188
188
|
lines: 1, fonts: fonts
|
|
189
189
|
).bind(title)
|
|
190
|
-
NativeListResolvedText(data.string("description"), style: style.dictionary("description"), size: 14,
|
|
190
|
+
let descriptionText = NativeListResolvedText(data.string("description"), style: style.dictionary("description"), size: 14,
|
|
191
191
|
color: nativeListColor(theme, "secondaryText", "#646464"), lineHeight: 20, lines: 2,
|
|
192
|
-
fonts: fonts
|
|
193
|
-
|
|
192
|
+
fonts: fonts)
|
|
193
|
+
descriptionText.bind(descriptionLabel)
|
|
194
194
|
NativeListResolvedText(data.string("status"), style: style.dictionary("status"), size: 12,
|
|
195
195
|
color: nativeListColor(theme, "secondaryText", "#646464"), lineHeight: 16, lines: 1,
|
|
196
196
|
fonts: fonts
|
|
197
197
|
).bind(status)
|
|
198
198
|
descriptionKey = data.string("descriptionActionKey")
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
// The label spans the identity column, so with an action only its text
|
|
200
|
+
// from the caller's `descriptionActionStart` on takes touches. The start is
|
|
201
|
+
// never read out of the string, and one at the end leaves no action.
|
|
202
|
+
let actionStart = descriptionKey.isEmpty
|
|
203
|
+
? nil : descriptionText.displayOffset(data.int("descriptionActionStart"), in: data.string("description"))
|
|
204
|
+
let hasActionText = actionStart.map { $0 < (descriptionText.text as NSString).length } ?? false
|
|
205
|
+
descriptionLabel.touchableTextStart = actionStart
|
|
206
|
+
descriptionLabel.isUserInteractionEnabled = hasActionText
|
|
207
|
+
descriptionLabel.accessibilityTraits = hasActionText ? .button : .staticText
|
|
201
208
|
for badge in badgeViews { titleLine.removeArrangedSubview(badge); badge.removeFromSuperview() }
|
|
202
209
|
badgeViews = data.dictionaries("badges").map { descriptor in
|
|
203
210
|
let label = NativeListTextLabel()
|
|
@@ -269,6 +276,7 @@ final class NativeListActivityDetailsView: UIStackView {
|
|
|
269
276
|
}
|
|
270
277
|
func recycle() {
|
|
271
278
|
visual.recycle(); visual.isHidden = false; amountViews.forEach { $0.recycle() }; actionKeys = []; descriptionKey = ""
|
|
279
|
+
descriptionLabel.touchableTextStart = nil
|
|
272
280
|
}
|
|
273
281
|
}
|
|
274
282
|
|
|
@@ -49,12 +49,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
49
49
|
stack.spacing = 10
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
private class func showsTitleRuns(_ item: NativeListItem) -> Bool {
|
|
53
|
-
nativeListShowsTitleRuns(
|
|
54
|
-
presentation: item.data.string("presentation"),
|
|
55
|
-
runCount: item.data.dictionaries("titleSegments").count,
|
|
56
|
-
matchCount: item.data.dictionaries("titleMatch").count)
|
|
57
|
-
}
|
|
58
52
|
override class func measure(
|
|
59
53
|
_ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
|
|
60
54
|
fonts: NativeListFontFamilies
|
|
@@ -87,7 +81,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
87
81
|
let title = NativeListResolvedText(
|
|
88
82
|
item.data.string("title"), style: style.dictionary("title"), size: 16,
|
|
89
83
|
weight: .medium, color: .black, lineHeight: 24,
|
|
90
|
-
lines:
|
|
84
|
+
lines: item.data.int("titleLines", default: 1), fonts: fonts)
|
|
91
85
|
let subtitle = NativeListResolvedText(
|
|
92
86
|
item.data.string("subtitle"), style: style.dictionary("subtitle"), size: 14,
|
|
93
87
|
color: .black, lineHeight: 20,
|
|
@@ -116,12 +110,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
116
110
|
private let titleRowStack = UIStackView()
|
|
117
111
|
private let titleLabel = NativeListTextLabel()
|
|
118
112
|
private let titleIconView = NativeListIconImageView()
|
|
119
|
-
private let titleLeadingIconView = NativeListIconImageView()
|
|
120
|
-
private let titleSegmentsLabel = NativeListTitleSegmentsLabel()
|
|
121
|
-
// Runs, when shown, take the title's place in the title row.
|
|
122
|
-
private var visibleTitleView: UIView {
|
|
123
|
-
titleSegmentsLabel.isHidden ? titleLabel : titleSegmentsLabel
|
|
124
|
-
}
|
|
125
113
|
private var titleImageSlot: NativeListImageSlot?
|
|
126
114
|
private var titleImageConstraints: [NSLayoutConstraint] = []
|
|
127
115
|
// Absorbs the title row's slack so the title keeps its intrinsic width and the
|
|
@@ -182,9 +170,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
182
170
|
mainStack.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
183
171
|
titleRowStack.axis = .horizontal
|
|
184
172
|
titleRowStack.alignment = .center
|
|
185
|
-
titleRowStack.addArrangedSubview(titleLeadingIconView)
|
|
186
173
|
titleRowStack.addArrangedSubview(titleLabel)
|
|
187
|
-
titleRowStack.addArrangedSubview(titleSegmentsLabel)
|
|
188
174
|
titleRowStack.addArrangedSubview(titleIconView)
|
|
189
175
|
titleRowStack.addArrangedSubview(badgeLabel)
|
|
190
176
|
titleRowStack.addArrangedSubview(titleRowFiller)
|
|
@@ -199,18 +185,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
199
185
|
])
|
|
200
186
|
titleIconView.contentMode = .scaleAspectFit
|
|
201
187
|
titleIconView.setContentHuggingPriority(.required, for: .horizontal)
|
|
202
|
-
titleLeadingIconView.translatesAutoresizingMaskIntoConstraints = false
|
|
203
|
-
let leadingIconWidth = titleLeadingIconView.widthAnchor.constraint(equalToConstant: 16)
|
|
204
|
-
leadingIconWidth.priority = UILayoutPriority(999)
|
|
205
|
-
NSLayoutConstraint.activate([
|
|
206
|
-
leadingIconWidth,
|
|
207
|
-
titleLeadingIconView.heightAnchor.constraint(equalToConstant: 16),
|
|
208
|
-
])
|
|
209
|
-
titleLeadingIconView.contentMode = .scaleAspectFit
|
|
210
|
-
titleLeadingIconView.setContentHuggingPriority(.required, for: .horizontal)
|
|
211
|
-
titleLeadingIconView.setContentCompressionResistancePriority(.required, for: .horizontal)
|
|
212
|
-
titleLeadingIconView.isHidden = true
|
|
213
|
-
titleSegmentsLabel.isHidden = true
|
|
214
188
|
[titleRowStack, subtitleLabel, tertiaryLabel].forEach(mainStack.addArrangedSubview)
|
|
215
189
|
visual.translatesAutoresizingMaskIntoConstraints = false
|
|
216
190
|
leadingWidth = visual.widthAnchor.constraint(equalToConstant: 40)
|
|
@@ -275,15 +249,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
275
249
|
titleIconView.isHidden = true
|
|
276
250
|
titleIconView.accessibilityLabel = nil
|
|
277
251
|
titleIconView.isAccessibilityElement = false
|
|
278
|
-
titleLeadingIconView.image = nil
|
|
279
|
-
titleLeadingIconView.isHidden = true
|
|
280
|
-
titleLeadingIconView.accessibilityLabel = nil
|
|
281
|
-
titleLeadingIconView.isAccessibilityElement = false
|
|
282
|
-
titleSegmentsLabel.isHidden = true
|
|
283
|
-
titleSegmentsLabel.reset()
|
|
284
|
-
titleRowFiller.isHidden = false
|
|
285
|
-
titleSegmentsLabel.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
286
|
-
titleSegmentsLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
287
252
|
titleImageSlot?.view.isHidden = true
|
|
288
253
|
titleImageSlot?.view.accessibilityLabel = nil
|
|
289
254
|
titleImageSlot?.view.isAccessibilityElement = false
|
|
@@ -345,7 +310,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
345
310
|
let label = titleIcon.string("accessibilityLabel")
|
|
346
311
|
titleIconView.accessibilityLabel = label.isEmpty ? nil : label
|
|
347
312
|
titleIconView.isAccessibilityElement = !label.isEmpty
|
|
348
|
-
titleRowStack.setCustomSpacing(4, after:
|
|
313
|
+
titleRowStack.setCustomSpacing(4, after: titleLabel)
|
|
349
314
|
// A long title truncates ahead of the 20pt glyph (Android caps the title
|
|
350
315
|
// at row width minus accessories, Web shrinks the title first); with the
|
|
351
316
|
// title at `.required` the icon's 999 width constraint collapsed to 0.
|
|
@@ -377,7 +342,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
377
342
|
]
|
|
378
343
|
titleImageConstraints.forEach { $0.priority = UILayoutPriority(999) }
|
|
379
344
|
NSLayoutConstraint.activate(titleImageConstraints)
|
|
380
|
-
titleRowStack.setCustomSpacing(4, after: titleIconView.isHidden ?
|
|
345
|
+
titleRowStack.setCustomSpacing(4, after: titleIconView.isHidden ? titleLabel : titleIconView)
|
|
381
346
|
titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
382
347
|
slot.bind(image, key: "\(item.key):titleImage", placeholder: "#00000000")
|
|
383
348
|
} else {
|
|
@@ -420,7 +385,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
420
385
|
titleRowStack.setCustomSpacing(
|
|
421
386
|
CGFloat(style.double("titleBadgeGap")),
|
|
422
387
|
after: titleImageSlot?.view.isHidden == false ? titleImageSlot!.view
|
|
423
|
-
: titleIconView.isHidden ?
|
|
388
|
+
: titleIconView.isHidden ? titleLabel : titleIconView)
|
|
424
389
|
}
|
|
425
390
|
}
|
|
426
391
|
if style["trailingGap"] != nil { trailingStack.spacing = CGFloat(style.double("trailingGap")) }
|
|
@@ -434,7 +399,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
434
399
|
labels.forEach { NativeListTextStyles.applyStyledText($0, text, fonts: fonts) }
|
|
435
400
|
}
|
|
436
401
|
}
|
|
437
|
-
if !titleSegmentsLabel.isHidden { bindTitleRuns(item, theme: theme, style: style) }
|
|
438
402
|
contentInsets = UIEdgeInsets(
|
|
439
403
|
top: topInset, left: leftInset, bottom: -bottomInset, right: -rightInset)
|
|
440
404
|
if root.axis == .horizontal {
|
|
@@ -500,8 +464,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
500
464
|
}
|
|
501
465
|
override func recycleContent() {
|
|
502
466
|
visual.recycle()
|
|
503
|
-
titleSegmentsLabel.reset()
|
|
504
|
-
titleLeadingIconView.image = nil
|
|
505
467
|
titleImageSlot?.recycle()
|
|
506
468
|
titleImageSlot?.view.isHidden = true
|
|
507
469
|
titleImageSlot?.view.accessibilityLabel = nil
|
|
@@ -550,30 +512,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
550
512
|
visual.bind(
|
|
551
513
|
descriptor, style: image, key: key, theme: currentTheme, isUnread: false, fonts: fonts)
|
|
552
514
|
}
|
|
553
|
-
// Runs take the title's font, size and color unless they set their own tone
|
|
554
|
-
// or weight; the title label holds the final style by now.
|
|
555
|
-
private func bindTitleRuns(_ item: NativeListItem, theme: [String: Any]?, style: [String: Any]) {
|
|
556
|
-
let baseFont = titleLabel.font ?? nativeListFont(ofSize: 16, weight: .medium, fonts: fonts)
|
|
557
|
-
let baseColor = titleLabel.textColor ?? nativeListColor(theme, "primaryText", "#202020")
|
|
558
|
-
let runs = item.data.dictionaries("titleSegments").map { segment in
|
|
559
|
-
let weight = segment.string("fontWeight")
|
|
560
|
-
let tone = segment.string("tone")
|
|
561
|
-
return NativeListTitleSegmentsLabel.Run(
|
|
562
|
-
text: segment.string("text"),
|
|
563
|
-
font: weight.isEmpty
|
|
564
|
-
? baseFont
|
|
565
|
-
: nativeListFont(
|
|
566
|
-
ofSize: baseFont.pointSize, weight: weight == "medium" ? .medium : .regular, fonts: fonts),
|
|
567
|
-
color: tone == "secondary"
|
|
568
|
-
? nativeListColor(theme, "secondaryText", "#646464")
|
|
569
|
-
: tone == "primary" ? nativeListColor(theme, "primaryText", "#202020") : baseColor,
|
|
570
|
-
shrink: segment.bool("shrink"),
|
|
571
|
-
maxWidthRatio: (segment["maxWidthRatio"] as? NSNumber).map { CGFloat(truncating: $0) })
|
|
572
|
-
}
|
|
573
|
-
titleSegmentsLabel.lineHeight = CGFloat(
|
|
574
|
-
style.dictionary("title")?.double("lineHeight", default: 24) ?? 24)
|
|
575
|
-
titleSegmentsLabel.configure(runs, spokenText: item.data.string("title"))
|
|
576
|
-
}
|
|
577
515
|
private func bindIdentity(
|
|
578
516
|
_ item: NativeListItem,
|
|
579
517
|
theme: [String: Any]?,
|
|
@@ -705,36 +643,10 @@ final class NativeListIdentityCell: NativeListRendererCell {
|
|
|
705
643
|
}
|
|
706
644
|
root.addArrangedSubview(mainStack)
|
|
707
645
|
show(titleLabel, item.data.string("title"), lines: item.data.int("titleLines", default: 1))
|
|
708
|
-
// Runs replace the drawn title except where `title` itself is highlighted;
|
|
709
|
-
// their content is bound once the title style is final.
|
|
710
|
-
if Self.showsTitleRuns(item) {
|
|
711
|
-
titleLabel.isHidden = true
|
|
712
|
-
titleSegmentsLabel.isHidden = false
|
|
713
|
-
// The runs fill what the title row leaves, so a ratio is a share of it.
|
|
714
|
-
titleRowFiller.isHidden = true
|
|
715
|
-
titleSegmentsLabel.setContentHuggingPriority(UILayoutPriority(1), for: .horizontal)
|
|
716
|
-
}
|
|
717
|
-
if nativeListAllowsTitleDecorations(presentation: item.data.string("presentation")),
|
|
718
|
-
let icon = item.data.dictionary("titleLeadingIcon")
|
|
719
|
-
{
|
|
720
|
-
titleLeadingIconView.bindIcon(icon.string("name"))
|
|
721
|
-
titleLeadingIconView.tintColor = UIColor(
|
|
722
|
-
nativeListHex: icon.string("tintColor",
|
|
723
|
-
default: theme?["iconSubdued"] as? String ?? "#8D8D8D"),
|
|
724
|
-
fallback: .gray)
|
|
725
|
-
titleLeadingIconView.isHidden = false
|
|
726
|
-
let label = icon.string("accessibilityLabel")
|
|
727
|
-
titleLeadingIconView.accessibilityLabel = label.isEmpty ? nil : label
|
|
728
|
-
titleLeadingIconView.isAccessibilityElement = !label.isEmpty
|
|
729
|
-
titleRowStack.setCustomSpacing(6, after: titleLeadingIconView)
|
|
730
|
-
// As beside `titleIcon`: a plain title left at `.required` collapses the
|
|
731
|
-
// glyph's 999 width constraint instead of truncating.
|
|
732
|
-
titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
|
733
|
-
}
|
|
734
646
|
let titleSuffixes = item.data.dictionaries("titleSuffixes")
|
|
735
647
|
if !titleSuffixes.isEmpty {
|
|
736
|
-
|
|
737
|
-
let minimumTitleWidth =
|
|
648
|
+
titleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
|
649
|
+
let minimumTitleWidth = titleLabel.widthAnchor.constraint(greaterThanOrEqualToConstant: 80)
|
|
738
650
|
minimumTitleWidth.priority = UILayoutPriority(751)
|
|
739
651
|
minimumTitleWidth.isActive = true
|
|
740
652
|
selectorConstraints.append(minimumTitleWidth)
|