@onekeyfe/react-native-native-list 6.7.0-2 → 6.7.0-21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +245 -9
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +35 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +147 -33
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +51 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1953 -117
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
- package/docs/ROW_TEMPLATES.md +70 -11
- package/docs/SPEC.md +1235 -20
- package/docs/STYLE_SPEC.md +6 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +235 -39
- package/ios/NativeListActivityDetailsView.swift +30 -11
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +155 -27
- package/ios/NativeListDesignAssets.swift +9 -0
- package/ios/NativeListIdentityRenderer.swift +239 -31
- package/ios/NativeListLeadingVisual.swift +119 -22
- package/ios/NativeListMarketRenderer.swift +113 -18
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListModels.swift +42 -2
- package/ios/NativeListRendererRegistry.swift +1 -0
- package/ios/NativeListResolvedText.swift +2 -1
- package/ios/NativeListRowHost.swift +14 -0
- package/ios/NativeListSectionHeaderRenderer.swift +88 -0
- package/ios/RNCNativeListView.swift +1052 -58
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +4 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_document2.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_ver_solid.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +3 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_large.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +15 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +3 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_ticket.imageset/icon.svg +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/Contents.json +1 -0
- package/ios/Resources/NativeListIcons.xcassets/onekey_wallet.imageset/icon.svg +1 -0
- package/ios/tests/NativeListAccessoryStackTests.swift +89 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
- package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
- package/ios/tests/NativeListLifecycleTests.swift +2789 -3
- package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
- package/lib/module/NativeList.js +223 -36
- package/lib/module/NativeList.web.js +260 -33
- package/lib/module/index.js +1 -1
- package/lib/module/models.js +3 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +1386 -81
- package/lib/module/web/NativeListWebEngine.js +914 -80
- package/lib/module/web/templates/ActivityRowRenderer.js +487 -7
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
- package/lib/module/web/templates/DataRowRenderer.js +40 -5
- package/lib/module/web/templates/IdentityRowRenderer.js +145 -5
- package/lib/module/web/templates/MarketRowRenderer.js +8 -3
- package/lib/module/web/templates/MarketTableRowRenderer.js +577 -0
- package/lib/module/web/templates/MediaTileRowRenderer.js +260 -5
- package/lib/module/web/templates/MessageRowRenderer.js +18 -2
- package/lib/module/web/templates/RowContainerStyle.js +1 -0
- package/lib/module/web/templates/RowRendererRegistry.js +8 -3
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +70 -3
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/lib/typescript/src/NativeList.d.ts +3 -3
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
- package/lib/typescript/src/NativeList.types.d.ts +29 -1
- package/lib/typescript/src/NativeList.web.d.ts +2 -2
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +196 -17
- package/lib/typescript/src/validation.d.ts +20 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +58 -1
- package/lib/typescript/src/web/templates/ActivityRowRenderer.d.ts +3 -3
- package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
- package/lib/typescript/src/web/templates/MarketTableRowRenderer.d.ts +17 -0
- package/lib/typescript/src/web/templates/MediaTileRowRenderer.d.ts +3 -3
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +10 -4
- package/lib/typescript/src/web/templates/RowRendererRegistry.d.ts +3 -1
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/package.json +3 -3
- package/react-native-native-list.podspec +1 -0
- package/src/NativeList.nitro.ts +2 -0
- package/src/NativeList.tsx +418 -89
- package/src/NativeList.types.ts +34 -1
- package/src/NativeList.web.tsx +417 -66
- package/src/index.ts +2 -0
- package/src/models.ts +355 -143
- package/src/selection.ts +1 -0
- package/src/validation.ts +3315 -166
- package/src/web/NativeListWebEngine.ts +1473 -113
- package/src/web/templates/ActivityRowRenderer.ts +732 -8
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +217 -6
- package/src/web/templates/MarketRowRenderer.ts +19 -3
- package/src/web/templates/MarketTableRowRenderer.ts +755 -0
- package/src/web/templates/MediaTileRowRenderer.ts +313 -5
- package/src/web/templates/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +21 -6
- package/src/web/templates/SectionHeaderRowRenderer.ts +89 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const views = new WeakMap();
|
|
4
|
-
function
|
|
4
|
+
function bindLegacy(body, row, primitives) {
|
|
5
5
|
const v = views.get(body);
|
|
6
6
|
v.primitives = primitives;
|
|
7
7
|
const style = row.style;
|
|
@@ -73,7 +73,7 @@ function bind(body, row, primitives) {
|
|
|
73
73
|
body.appendChild(v.close);
|
|
74
74
|
} else v.close.remove();
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function createLegacy(document, row, primitives) {
|
|
77
77
|
const node = (tag, className, slot) => {
|
|
78
78
|
const n = document.createElement(tag);
|
|
79
79
|
n.className = className;
|
|
@@ -106,10 +106,10 @@ function create(document, row, primitives) {
|
|
|
106
106
|
imageKey: '',
|
|
107
107
|
networkKey: ''
|
|
108
108
|
});
|
|
109
|
-
|
|
109
|
+
bindLegacy(body, row, primitives);
|
|
110
110
|
return body;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function recycleLegacy(body) {
|
|
113
113
|
const v = views.get(body);
|
|
114
114
|
if (!v) return;
|
|
115
115
|
[v.image, v.network].forEach(n => {
|
|
@@ -121,12 +121,267 @@ function recycle(body) {
|
|
|
121
121
|
v.image = v.network = undefined;
|
|
122
122
|
v.imageKey = v.networkKey = '';
|
|
123
123
|
}
|
|
124
|
+
const galleries = new WeakMap();
|
|
125
|
+
const isGalleryMedia = row => row.variant === 'gallery' && (!row.image || !!row.media && !row.imageState);
|
|
126
|
+
function clearGalleryMedia(v) {
|
|
127
|
+
v.epoch += 1;
|
|
128
|
+
v.frame.style.borderRadius = '10px';
|
|
129
|
+
if (!v.media) return;
|
|
130
|
+
v.media.onerror = null;
|
|
131
|
+
v.media.onload = null;
|
|
132
|
+
v.media.onloadeddata = null;
|
|
133
|
+
if (v.media.tagName === 'VIDEO') {
|
|
134
|
+
const video = v.media;
|
|
135
|
+
video.pause();
|
|
136
|
+
video.removeAttribute('src');
|
|
137
|
+
video.load();
|
|
138
|
+
} else v.media.removeAttribute('src');
|
|
139
|
+
v.media.remove();
|
|
140
|
+
v.media = undefined;
|
|
141
|
+
}
|
|
142
|
+
function initGallery(body, primitives) {
|
|
143
|
+
const document = body.ownerDocument;
|
|
144
|
+
const element = className => {
|
|
145
|
+
const node = document.createElement('div');
|
|
146
|
+
node.className = className;
|
|
147
|
+
return node;
|
|
148
|
+
};
|
|
149
|
+
const frame = element('ok-native-list-media-image');
|
|
150
|
+
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
|
+
}
|
|
163
|
+
fallback.append(svg);
|
|
164
|
+
Object.assign(fallback.style, {
|
|
165
|
+
position: 'absolute',
|
|
166
|
+
inset: '0',
|
|
167
|
+
display: 'flex',
|
|
168
|
+
alignItems: 'center',
|
|
169
|
+
justifyContent: 'center',
|
|
170
|
+
color: 'var(--nl-disabled)',
|
|
171
|
+
borderRadius: '10px',
|
|
172
|
+
background: 'var(--nl-strong)'
|
|
173
|
+
});
|
|
174
|
+
const metadata = element('ok-native-list-media-meta');
|
|
175
|
+
const subtitleLine = element('ok-native-list-media-subtitle-row');
|
|
176
|
+
const subtitle = element('ok-native-list-media-subtitle');
|
|
177
|
+
const title = element('ok-native-list-media-title');
|
|
178
|
+
const badge = element('ok-native-list-badge');
|
|
179
|
+
subtitle.dataset.nlSlot = 'subtitle';
|
|
180
|
+
title.dataset.nlSlot = 'title';
|
|
181
|
+
badge.dataset.nlSlot = 'badge';
|
|
182
|
+
subtitleLine.append(subtitle);
|
|
183
|
+
metadata.append(subtitleLine, title);
|
|
184
|
+
frame.append(fallback);
|
|
185
|
+
body.replaceChildren(frame, metadata);
|
|
186
|
+
const enter = () => {
|
|
187
|
+
frame.style.opacity = '0.8';
|
|
188
|
+
};
|
|
189
|
+
const leave = () => {
|
|
190
|
+
frame.style.opacity = '';
|
|
191
|
+
};
|
|
192
|
+
body.addEventListener('mouseenter', enter);
|
|
193
|
+
body.addEventListener('mouseleave', leave);
|
|
194
|
+
const v = {
|
|
195
|
+
frame,
|
|
196
|
+
fallback,
|
|
197
|
+
metadata,
|
|
198
|
+
subtitleLine,
|
|
199
|
+
subtitle,
|
|
200
|
+
title,
|
|
201
|
+
badge,
|
|
202
|
+
networkKey: '',
|
|
203
|
+
mediaKey: '',
|
|
204
|
+
epoch: 0,
|
|
205
|
+
primitives,
|
|
206
|
+
enter,
|
|
207
|
+
leave
|
|
208
|
+
};
|
|
209
|
+
galleries.set(body, v);
|
|
210
|
+
return v;
|
|
211
|
+
}
|
|
212
|
+
function bindGallery(body, row, primitives) {
|
|
213
|
+
const v = galleries.get(body) ?? initGallery(body, primitives);
|
|
214
|
+
v.primitives = primitives;
|
|
215
|
+
const style = row.style;
|
|
216
|
+
body.className = 'ok-native-list-row ok-native-list-media';
|
|
217
|
+
body.style.cssText = '';
|
|
218
|
+
body.removeAttribute('data-nl-container-background');
|
|
219
|
+
body.removeAttribute('data-nl-container-border');
|
|
220
|
+
Object.assign(body.style, {
|
|
221
|
+
display: 'block',
|
|
222
|
+
position: 'relative',
|
|
223
|
+
boxSizing: 'border-box',
|
|
224
|
+
padding: `${style?.verticalPadding ?? 10}px ${style?.horizontalPadding ?? 10}px`,
|
|
225
|
+
borderRadius: '16px',
|
|
226
|
+
background: 'transparent',
|
|
227
|
+
height: 'auto'
|
|
228
|
+
});
|
|
229
|
+
Object.assign(v.frame.style, {
|
|
230
|
+
position: 'relative',
|
|
231
|
+
width: '100%',
|
|
232
|
+
height: 'auto',
|
|
233
|
+
aspectRatio: '1',
|
|
234
|
+
borderRadius: v.media?.tagName === 'VIDEO' ? '0' : '10px',
|
|
235
|
+
overflow: 'hidden',
|
|
236
|
+
background: 'var(--nl-bg)'
|
|
237
|
+
});
|
|
238
|
+
v.metadata.style.paddingTop = `${style?.leadingGap ?? 8}px`;
|
|
239
|
+
v.subtitleLine.style.gap = '0px';
|
|
240
|
+
v.subtitle.style.cssText = 'font-size:12px;line-height:16px;font-weight:400;box-sizing:border-box;padding-right:8px';
|
|
241
|
+
v.title.style.cssText = 'font-size:16px;line-height:24px;font-weight:500';
|
|
242
|
+
v.subtitle.textContent = row.subtitle || '-';
|
|
243
|
+
v.title.textContent = row.title || '-';
|
|
244
|
+
if (style?.subtitle) primitives.textStyle(v.subtitle, style.subtitle);
|
|
245
|
+
if (style?.title) primitives.textStyle(v.title, style.title);
|
|
246
|
+
const mediaKey = JSON.stringify([row.key, row.media, row.imageState]);
|
|
247
|
+
if (v.mediaKey !== mediaKey) {
|
|
248
|
+
clearGalleryMedia(v);
|
|
249
|
+
v.mediaKey = mediaKey;
|
|
250
|
+
v.fallback.style.visibility = 'visible';
|
|
251
|
+
const epoch = v.epoch;
|
|
252
|
+
const source = row.imageState ? undefined : row.media?.source;
|
|
253
|
+
const probe = attempt => {
|
|
254
|
+
if (v.epoch !== epoch) return;
|
|
255
|
+
const kind = row.media?.probeOrder[attempt];
|
|
256
|
+
if (!source?.uri || !kind) return;
|
|
257
|
+
const media = body.ownerDocument.createElement(kind === 'video' ? 'video' : 'img');
|
|
258
|
+
v.frame.style.borderRadius = kind === 'video' ? '0' : '10px';
|
|
259
|
+
Object.assign(media.style, {
|
|
260
|
+
display: 'block',
|
|
261
|
+
position: 'absolute',
|
|
262
|
+
inset: '0',
|
|
263
|
+
width: '100%',
|
|
264
|
+
height: '100%',
|
|
265
|
+
objectFit: source.contentFit === 'center' ? 'none' : source.contentFit ?? (kind === 'video' ? 'contain' : 'cover'),
|
|
266
|
+
borderRadius: kind === 'video' ? '0' : '10px',
|
|
267
|
+
pointerEvents: 'none'
|
|
268
|
+
});
|
|
269
|
+
media.setAttribute('aria-hidden', 'true');
|
|
270
|
+
if (media.tagName === 'VIDEO') {
|
|
271
|
+
const video = media;
|
|
272
|
+
video.muted = true;
|
|
273
|
+
video.autoplay = false;
|
|
274
|
+
video.controls = false;
|
|
275
|
+
video.playsInline = true;
|
|
276
|
+
video.preload = 'metadata';
|
|
277
|
+
video.tabIndex = -1;
|
|
278
|
+
} else {
|
|
279
|
+
media.alt = '';
|
|
280
|
+
media.decoding = 'async';
|
|
281
|
+
}
|
|
282
|
+
media.onerror = () => {
|
|
283
|
+
if (v.epoch !== epoch || v.media !== media) return;
|
|
284
|
+
media.onerror = null;
|
|
285
|
+
media.onload = null;
|
|
286
|
+
media.onloadeddata = null;
|
|
287
|
+
if (media.tagName === 'VIDEO') media.pause();
|
|
288
|
+
media.removeAttribute('src');
|
|
289
|
+
if (media.tagName === 'VIDEO') media.load();
|
|
290
|
+
media.remove();
|
|
291
|
+
v.media = undefined;
|
|
292
|
+
v.frame.style.borderRadius = '10px';
|
|
293
|
+
v.fallback.style.visibility = 'visible';
|
|
294
|
+
probe(attempt + 1);
|
|
295
|
+
};
|
|
296
|
+
const ready = () => {
|
|
297
|
+
if (v.epoch === epoch && v.media === media) v.fallback.style.visibility = 'hidden';
|
|
298
|
+
};
|
|
299
|
+
if (media.tagName === 'VIDEO') media.onloadeddata = ready;else media.onload = ready;
|
|
300
|
+
v.media = media;
|
|
301
|
+
v.frame.insertBefore(media, v.badge.parentNode === v.frame ? v.badge : null);
|
|
302
|
+
media.src = source.uri;
|
|
303
|
+
};
|
|
304
|
+
probe(0);
|
|
305
|
+
}
|
|
306
|
+
v.badge.textContent = row.badge?.text ?? '';
|
|
307
|
+
if (row.badge) {
|
|
308
|
+
Object.assign(v.badge.style, {
|
|
309
|
+
position: 'absolute',
|
|
310
|
+
right: '0',
|
|
311
|
+
bottom: '0',
|
|
312
|
+
boxSizing: 'content-box',
|
|
313
|
+
height: '20px',
|
|
314
|
+
padding: '0 8px',
|
|
315
|
+
border: '2px solid var(--nl-bg)',
|
|
316
|
+
borderRadius: '10px',
|
|
317
|
+
background: 'var(--nl-inverse)',
|
|
318
|
+
color: 'var(--nl-inverse-text)',
|
|
319
|
+
fontSize: '14px',
|
|
320
|
+
fontWeight: '500',
|
|
321
|
+
fontFamily: 'var(--nl-font-medium)',
|
|
322
|
+
lineHeight: '20px'
|
|
323
|
+
});
|
|
324
|
+
if (style?.badge) primitives.textStyle(v.badge, style.badge);
|
|
325
|
+
v.frame.append(v.badge);
|
|
326
|
+
} else v.badge.remove();
|
|
327
|
+
const networkKey = JSON.stringify(row.networkImage);
|
|
328
|
+
if (v.networkKey !== networkKey) {
|
|
329
|
+
if (v.network) {
|
|
330
|
+
primitives.dispose(v.network);
|
|
331
|
+
v.network.remove();
|
|
332
|
+
}
|
|
333
|
+
v.network = row.networkImage ? primitives.thumbnail(row.networkImage) : undefined;
|
|
334
|
+
if (v.network) {
|
|
335
|
+
v.network.className = 'ok-native-list-media-network';
|
|
336
|
+
v.subtitleLine.append(v.network);
|
|
337
|
+
}
|
|
338
|
+
v.networkKey = networkKey;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function recycle(body) {
|
|
342
|
+
const gallery = galleries.get(body);
|
|
343
|
+
if (gallery) {
|
|
344
|
+
clearGalleryMedia(gallery);
|
|
345
|
+
if (gallery.network) gallery.primitives.dispose(gallery.network);
|
|
346
|
+
body.removeEventListener('mouseenter', gallery.enter);
|
|
347
|
+
body.removeEventListener('mouseleave', gallery.leave);
|
|
348
|
+
galleries.delete(body);
|
|
349
|
+
}
|
|
350
|
+
recycleLegacy(body);
|
|
351
|
+
views.delete(body);
|
|
352
|
+
}
|
|
353
|
+
function bind(body, row, primitives) {
|
|
354
|
+
const gallery = isGalleryMedia(row);
|
|
355
|
+
if (gallery) {
|
|
356
|
+
if (views.has(body)) {
|
|
357
|
+
recycleLegacy(body);
|
|
358
|
+
views.delete(body);
|
|
359
|
+
}
|
|
360
|
+
bindGallery(body, row, primitives);
|
|
361
|
+
} else {
|
|
362
|
+
if (galleries.has(body)) recycle(body);
|
|
363
|
+
if (!views.has(body)) {
|
|
364
|
+
const initial = createLegacy(body.ownerDocument, row, primitives);
|
|
365
|
+
body.replaceChildren(...Array.from(initial.childNodes));
|
|
366
|
+
body.className = initial.className;
|
|
367
|
+
views.set(body, views.get(initial));
|
|
368
|
+
views.delete(initial);
|
|
369
|
+
}
|
|
370
|
+
bindLegacy(body, row, primitives);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function create(document, row, primitives) {
|
|
374
|
+
const body = document.createElement('div');
|
|
375
|
+
body.dataset.nlRenderer = 'mediaTile';
|
|
376
|
+
bind(body, row, primitives);
|
|
377
|
+
return body;
|
|
378
|
+
}
|
|
124
379
|
export const mediaTileRowRenderer = {
|
|
125
380
|
key: 'mediaTile',
|
|
126
381
|
create,
|
|
127
382
|
bind,
|
|
128
383
|
recycle,
|
|
129
|
-
measure: (
|
|
384
|
+
measure: (row, width) => isGalleryMedia(row) ? width + 48 : 244,
|
|
130
385
|
measureRendered: (_body, _row) => undefined
|
|
131
386
|
};
|
|
132
387
|
//# sourceMappingURL=MediaTileRowRenderer.js.map
|
|
@@ -46,6 +46,7 @@ export function bindMessageRow(body, row, primitives) {
|
|
|
46
46
|
body.style.cssText = '';
|
|
47
47
|
body.removeAttribute('data-nl-container-background');
|
|
48
48
|
body.removeAttribute('data-nl-container-border');
|
|
49
|
+
if (row.presentation === 'inlineWarning') body.setAttribute('data-nl-inline-warning', 'true');else body.removeAttribute('data-nl-inline-warning');
|
|
49
50
|
body.style.padding = `${resolved.verticalPadding}px ${resolved.horizontalPadding}px`;
|
|
50
51
|
body.style.height = resolved.automaticHeight ? 'auto' : '100%';
|
|
51
52
|
views.column.style.cssText = '';
|
|
@@ -53,7 +54,22 @@ export function bindMessageRow(body, row, primitives) {
|
|
|
53
54
|
for (const [view, text] of [[views.title, resolved.title], [views.body, resolved.body], [views.time, resolved.time]]) {
|
|
54
55
|
view.style.cssText = '';
|
|
55
56
|
view.textContent = text.value;
|
|
56
|
-
|
|
57
|
+
const {
|
|
58
|
+
lines,
|
|
59
|
+
...textStyle
|
|
60
|
+
} = text.style;
|
|
61
|
+
primitives.textStyle(view, lines === 0 ? textStyle : {
|
|
62
|
+
...textStyle,
|
|
63
|
+
lines
|
|
64
|
+
});
|
|
65
|
+
if (lines === 0) {
|
|
66
|
+
view.style.whiteSpace = 'pre-wrap';
|
|
67
|
+
view.style.overflow = 'visible';
|
|
68
|
+
view.style.textOverflow = 'clip';
|
|
69
|
+
view.style.maxHeight = 'none';
|
|
70
|
+
view.style.removeProperty('-webkit-line-clamp');
|
|
71
|
+
view.style.removeProperty('-webkit-box-orient');
|
|
72
|
+
}
|
|
57
73
|
}
|
|
58
74
|
views.unread.style.cssText = '';
|
|
59
75
|
if (row.body) {
|
|
@@ -143,7 +159,7 @@ export function measureMessageRow(row, availableWidth) {
|
|
|
143
159
|
if (!text.value) return 0;
|
|
144
160
|
const value = text.style.lines === 1 ? text.value.replace(/\r\n|[\r\n]/g, ' ') : text.value;
|
|
145
161
|
const lines = value.split(/\r\n|[\r\n]/).reduce((total, line) => total + Math.max(1, Math.ceil(Array.from(line).reduce((sum, char) => sum + (char.charCodeAt(0) > 255 ? text.style.fontSize : text.style.fontSize / 2), 0) / Math.max(1, width))), 0);
|
|
146
|
-
return Math.min(text.style.lines, lines) * text.style.lineHeight;
|
|
162
|
+
return (text.style.lines === 0 ? lines : Math.min(text.style.lines, lines)) * text.style.lineHeight;
|
|
147
163
|
};
|
|
148
164
|
const timeWidth = Math.min(availableWidth / 3, Math.max(0, r.time.value.length * r.time.style.fontSize / 2));
|
|
149
165
|
const textWidth = availableWidth - r.horizontalPadding * 2 - (row.leading ? r.imageWidth + r.leadingGap : 0) - (row.thumbnail ? 76 : 0) - (row.unread ? 19 : 0) - timeWidth - 12;
|
|
@@ -66,6 +66,7 @@ export function applyRowContainerStyle(body, row) {
|
|
|
66
66
|
body.style.removeProperty('background-color');
|
|
67
67
|
}
|
|
68
68
|
if (container.cornerRadius !== undefined) set(body, 'border-radius', `${container.cornerRadius}px`);
|
|
69
|
+
if (row.type === 'message' && row.presentation === 'inlineWarning') set(body, 'border-radius', '0px');
|
|
69
70
|
if (container.borderWidth !== undefined) {
|
|
70
71
|
// Paint above member backgrounds without changing the content box or hit targets.
|
|
71
72
|
body.setAttribute('data-nl-container-border', 'true');
|
|
@@ -4,11 +4,13 @@ import { walletGroupRowRenderer } from "./WalletGroupRowRenderer.js";
|
|
|
4
4
|
import { identityRowRenderer } from "./IdentityRowRenderer.js";
|
|
5
5
|
import { sectionHeaderRowRenderer } from "./SectionHeaderRowRenderer.js";
|
|
6
6
|
import { marketRowRenderer } from "./MarketRowRenderer.js";
|
|
7
|
+
import { marketTableRowRenderer } from "./MarketTableRowRenderer.js";
|
|
7
8
|
import { metricCardRowRenderer } from "./MetricCardRowRenderer.js";
|
|
8
9
|
import { dataRowRenderer } from "./DataRowRenderer.js";
|
|
9
10
|
import { activityRowRenderer } from "./ActivityRowRenderer.js";
|
|
10
11
|
import { systemRowRenderer } from "./SystemRowRenderer.js";
|
|
11
12
|
import { actionRowRenderer } from "./ActionRowRenderer.js";
|
|
13
|
+
import { buttonGroupRowRenderer } from "./ButtonGroupRowRenderer.js";
|
|
12
14
|
import { mediaTileRowRenderer } from "./MediaTileRowRenderer.js";
|
|
13
15
|
import { messageRowRenderer } from "./MessageRowRenderer.js";
|
|
14
16
|
import { railRowRenderer } from "./RailRowRenderer.js";
|
|
@@ -27,12 +29,13 @@ const factories = {
|
|
|
27
29
|
walletGroup: row => registration(walletGroupRowRenderer, row),
|
|
28
30
|
identity: row => registration(identityRowRenderer, row),
|
|
29
31
|
sectionHeader: row => registration(sectionHeaderRowRenderer, row),
|
|
30
|
-
market: row => registration(marketRowRenderer, row),
|
|
32
|
+
market: row => row.webTable ? registration(marketTableRowRenderer, row) : registration(marketRowRenderer, row),
|
|
31
33
|
metricCard: row => registration(metricCardRowRenderer, row),
|
|
32
34
|
dataRow: row => registration(dataRowRenderer, row),
|
|
33
35
|
activity: row => registration(activityRowRenderer, row),
|
|
34
36
|
system: row => registration(systemRowRenderer, row),
|
|
35
37
|
action: row => registration(actionRowRenderer, row),
|
|
38
|
+
buttonGroup: row => registration(buttonGroupRowRenderer, row),
|
|
36
39
|
message: row => registration(messageRowRenderer, row),
|
|
37
40
|
rail: row => registration(railRowRenderer, row),
|
|
38
41
|
mediaTile: row => registration(mediaTileRowRenderer, row)
|
|
@@ -42,11 +45,13 @@ const renderers = {
|
|
|
42
45
|
identity: identityRowRenderer,
|
|
43
46
|
sectionHeader: sectionHeaderRowRenderer,
|
|
44
47
|
market: marketRowRenderer,
|
|
48
|
+
marketTable: marketTableRowRenderer,
|
|
45
49
|
metricCard: metricCardRowRenderer,
|
|
46
50
|
dataRow: dataRowRenderer,
|
|
47
51
|
activity: activityRowRenderer,
|
|
48
52
|
system: systemRowRenderer,
|
|
49
53
|
action: actionRowRenderer,
|
|
54
|
+
buttonGroup: buttonGroupRowRenderer,
|
|
50
55
|
message: messageRowRenderer,
|
|
51
56
|
rail: railRowRenderer,
|
|
52
57
|
mediaTile: mediaTileRowRenderer
|
|
@@ -59,11 +64,11 @@ export function rowRenderer(row) {
|
|
|
59
64
|
return factories[row.type](row);
|
|
60
65
|
}
|
|
61
66
|
export function rowRendererKey(row) {
|
|
62
|
-
return row.type;
|
|
67
|
+
return row.type === 'market' && row.webTable ? 'marketTable' : row.type;
|
|
63
68
|
}
|
|
64
69
|
export function recycleRowBody(body) {
|
|
65
70
|
const key = body.dataset.nlRenderer ?? '';
|
|
66
|
-
if (!
|
|
71
|
+
if (!Object.prototype.hasOwnProperty.call(renderers, key)) return false;
|
|
67
72
|
renderers[key].recycle(body);
|
|
68
73
|
return true;
|
|
69
74
|
}
|
|
@@ -4,6 +4,20 @@ import { applyTextWeight } from "./RowText.js";
|
|
|
4
4
|
import { applyTabularNumbers, hasExplicitRowHeight } from "./RowElements.js";
|
|
5
5
|
import { createElement, setData, tagSlot, markActionAnchorSource, createTextColumn } from "./RowElements.js";
|
|
6
6
|
import { applyValueSegments } from "./RowText.js";
|
|
7
|
+
function bindHelp(target, help) {
|
|
8
|
+
markActionAnchorSource(target, 'trailingAccessory', 0);
|
|
9
|
+
if (help.presentation === 'tooltip') {
|
|
10
|
+
setData(target, 'nativeListHoverAction', help.actionKey);
|
|
11
|
+
setData(target, 'nativeListIconHelp', true);
|
|
12
|
+
} else {
|
|
13
|
+
setData(target, 'nativeListAction', help.actionKey);
|
|
14
|
+
target.setAttribute('role', 'button');
|
|
15
|
+
}
|
|
16
|
+
if (help.underline === 'dashed') {
|
|
17
|
+
target.style.textDecoration = 'underline dashed';
|
|
18
|
+
target.style.textUnderlineOffset = '4px';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
7
21
|
function createSectionHeader(document, primitives, row) {
|
|
8
22
|
const body = createElement(document, 'div', 'ok-native-list-row ok-native-list-section');
|
|
9
23
|
setData(body, 'variant', row.variant);
|
|
@@ -17,6 +31,11 @@ function createSectionHeader(document, primitives, row) {
|
|
|
17
31
|
const column = createTextColumn(document, row.title, row.subtitle);
|
|
18
32
|
const title = column.firstElementChild;
|
|
19
33
|
title.classList.add('ok-native-list-section-title');
|
|
34
|
+
if (row.leadingBadge) {
|
|
35
|
+
const badge = createElement(document, 'span', 'ok-native-list-badge', row.leadingBadge.text);
|
|
36
|
+
if (row.leadingBadge.tone) setData(badge, 'tone', row.leadingBadge.tone);
|
|
37
|
+
body.appendChild(badge);
|
|
38
|
+
}
|
|
20
39
|
if (row.titleActionKey) {
|
|
21
40
|
setData(title, 'nativeListAction', row.titleActionKey);
|
|
22
41
|
markActionAnchorSource(title, 'leadingAction');
|
|
@@ -31,6 +50,11 @@ function createSectionHeader(document, primitives, row) {
|
|
|
31
50
|
}
|
|
32
51
|
if (row.titleActionOnHover) setData(title, 'nativeListHoverAction', true);
|
|
33
52
|
}
|
|
53
|
+
if (row.style?.titleDecoration === 'none') title.style.textDecoration = 'none';
|
|
54
|
+
if (row.style?.titleDecoration === 'dashed') {
|
|
55
|
+
title.style.textDecoration = 'underline dashed';
|
|
56
|
+
title.style.textUnderlineOffset = '4px';
|
|
57
|
+
}
|
|
34
58
|
if (row.presentation === 'networkSelector' && hasExplicitRowHeight(row)) {
|
|
35
59
|
body.style.padding = row.variant === 'summary' ? '24px 12px 20px' : '0 12px';
|
|
36
60
|
body.style.backgroundColor = 'var(--nl-bg)';
|
|
@@ -73,9 +97,42 @@ function createSectionHeader(document, primitives, row) {
|
|
|
73
97
|
title.replaceChildren(text, dotted);
|
|
74
98
|
}
|
|
75
99
|
}
|
|
76
|
-
|
|
100
|
+
if (row.variant === 'history' && row.titleLoading) {
|
|
101
|
+
const pendingLine = createElement(document, 'div');
|
|
102
|
+
pendingLine.style.cssText = 'display:flex;align-items:center;gap:8px;min-width:0;width:100%;height:20px';
|
|
103
|
+
const spinner = createElement(document, 'span');
|
|
104
|
+
spinner.setAttribute('role', 'progressbar');
|
|
105
|
+
spinner.setAttribute('aria-valuemin', '0');
|
|
106
|
+
spinner.setAttribute('aria-valuemax', '1');
|
|
107
|
+
spinner.style.cssText = 'display:block;width:20px;height:20px;flex:0 0 20px';
|
|
108
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
109
|
+
svg.setAttribute('viewBox', '0 0 32 32');
|
|
110
|
+
svg.setAttribute('class', 'ok-native-list-spinner');
|
|
111
|
+
svg.style.cssText = 'display:block;width:20px;height:20px;border:0;animation-duration:.75s';
|
|
112
|
+
for (const track of [true, false]) {
|
|
113
|
+
const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
114
|
+
for (const [name, value] of Object.entries({
|
|
115
|
+
cx: '16',
|
|
116
|
+
cy: '16',
|
|
117
|
+
r: '14',
|
|
118
|
+
fill: 'none',
|
|
119
|
+
'stroke-width': '4'
|
|
120
|
+
})) circle.setAttribute(name, value);
|
|
121
|
+
circle.style.stroke = row.style?.title?.color ?? 'var(--nl-secondary)';
|
|
122
|
+
if (track) circle.style.opacity = '.2';else {
|
|
123
|
+
circle.style.strokeDasharray = '80';
|
|
124
|
+
circle.style.strokeDashoffset = '60';
|
|
125
|
+
}
|
|
126
|
+
svg.appendChild(circle);
|
|
127
|
+
}
|
|
128
|
+
spinner.appendChild(svg);
|
|
129
|
+
title.style.textTransform = 'uppercase';
|
|
130
|
+
pendingLine.append(spinner, column);
|
|
131
|
+
body.style.height = 'calc(100% + 4px)';
|
|
132
|
+
body.appendChild(pendingLine);
|
|
133
|
+
} else body.appendChild(column);
|
|
77
134
|
if (row.value) {
|
|
78
|
-
const value = tagSlot(createElement(document, row.valueActionKey ? 'button' : 'span', row.valueActionKey ? 'ok-native-list-action-button ok-native-list-section-value' : 'ok-native-list-value ok-native-list-section-value', row.value), 'value');
|
|
135
|
+
const value = tagSlot(createElement(document, row.valueActionKey || row.valueHelp?.presentation === 'popover' ? 'button' : 'span', row.valueActionKey || row.valueHelp?.presentation === 'popover' ? 'ok-native-list-action-button ok-native-list-section-value' : 'ok-native-list-value ok-native-list-section-value', row.value), 'value');
|
|
79
136
|
applyValueSegments(value, row.valueSegments);
|
|
80
137
|
if (row.presentation === 'networkSelector' && hasExplicitRowHeight(row)) {
|
|
81
138
|
value.style.fontFamily = 'inherit';
|
|
@@ -94,7 +151,17 @@ function createSectionHeader(document, primitives, row) {
|
|
|
94
151
|
setData(value, 'nativeListAction', row.valueActionKey);
|
|
95
152
|
markActionAnchorSource(value, 'trailingAccessory', 0);
|
|
96
153
|
}
|
|
97
|
-
|
|
154
|
+
if (row.valueHelp) bindHelp(value, row.valueHelp);
|
|
155
|
+
if (row.style?.valuePlacement === 'afterTitle') {
|
|
156
|
+
value.style.marginLeft = '0';
|
|
157
|
+
value.style.flexShrink = '0';
|
|
158
|
+
value.style.alignSelf = 'center';
|
|
159
|
+
title.insertAdjacentElement('afterend', value);
|
|
160
|
+
column.style.flexDirection = 'row';
|
|
161
|
+
column.style.alignItems = 'center';
|
|
162
|
+
column.style.justifyContent = 'flex-start';
|
|
163
|
+
column.style.gap = '8px';
|
|
164
|
+
} else body.appendChild(value);
|
|
98
165
|
}
|
|
99
166
|
if (row.valueIcon) {
|
|
100
167
|
const valueIcon = primitives.iconAction(row.valueIcon.name, row.valueIcon.actionKey, row.valueIcon.disabled, row.valueIcon.tintColor);
|
|
@@ -88,6 +88,15 @@ namespace margelo::nitro::nativelist {
|
|
|
88
88
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* containerSlotHeightsJson */)>("setContainerSlotHeightsJson");
|
|
89
89
|
method(_javaPart, jni::make_jstring(containerSlotHeightsJson));
|
|
90
90
|
}
|
|
91
|
+
std::string JHybridNativeListSpec::getSidecarLayoutJson() {
|
|
92
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getSidecarLayoutJson");
|
|
93
|
+
auto __result = method(_javaPart);
|
|
94
|
+
return __result->toStdString();
|
|
95
|
+
}
|
|
96
|
+
void JHybridNativeListSpec::setSidecarLayoutJson(const std::string& sidecarLayoutJson) {
|
|
97
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* sidecarLayoutJson */)>("setSidecarLayoutJson");
|
|
98
|
+
method(_javaPart, jni::make_jstring(sidecarLayoutJson));
|
|
99
|
+
}
|
|
91
100
|
NativeListScrollEdgeEffect JHybridNativeListSpec::getTopScrollEdgeEffect() {
|
|
92
101
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNativeListScrollEdgeEffect>()>("getTopScrollEdgeEffect");
|
|
93
102
|
auto __result = method(_javaPart);
|
|
@@ -252,6 +261,23 @@ namespace margelo::nitro::nativelist {
|
|
|
252
261
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* onVisibleRangeChanged */)>("setOnVisibleRangeChanged_cxx");
|
|
253
262
|
method(_javaPart, onVisibleRangeChanged.has_value() ? JFunc_void_std__string_cxx::fromCpp(onVisibleRangeChanged.value()) : nullptr);
|
|
254
263
|
}
|
|
264
|
+
std::optional<std::function<void(const std::string& /* payloadJson */)>> JHybridNativeListSpec::getOnStructuralTransitionSettled() {
|
|
265
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__string::javaobject>()>("getOnStructuralTransitionSettled_cxx");
|
|
266
|
+
auto __result = method(_javaPart);
|
|
267
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const std::string& /* payloadJson */)> {
|
|
268
|
+
if (__result->isInstanceOf(JFunc_void_std__string_cxx::javaClassStatic())) [[likely]] {
|
|
269
|
+
auto downcast = jni::static_ref_cast<JFunc_void_std__string_cxx::javaobject>(__result);
|
|
270
|
+
return downcast->cthis()->getFunction();
|
|
271
|
+
} else {
|
|
272
|
+
auto __resultRef = jni::make_global(__result);
|
|
273
|
+
return JNICallable<JFunc_void_std__string, void(std::string)>(std::move(__resultRef));
|
|
274
|
+
}
|
|
275
|
+
}()) : std::nullopt;
|
|
276
|
+
}
|
|
277
|
+
void JHybridNativeListSpec::setOnStructuralTransitionSettled(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onStructuralTransitionSettled) {
|
|
278
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* onStructuralTransitionSettled */)>("setOnStructuralTransitionSettled_cxx");
|
|
279
|
+
method(_javaPart, onStructuralTransitionSettled.has_value() ? JFunc_void_std__string_cxx::fromCpp(onStructuralTransitionSettled.value()) : nullptr);
|
|
280
|
+
}
|
|
255
281
|
|
|
256
282
|
// Methods
|
|
257
283
|
void JHybridNativeListSpec::applySnapshot(const std::string& snapshotJson) {
|
|
@@ -56,6 +56,8 @@ namespace margelo::nitro::nativelist {
|
|
|
56
56
|
void setFontFamiliesJson(const std::string& fontFamiliesJson) override;
|
|
57
57
|
std::string getContainerSlotHeightsJson() override;
|
|
58
58
|
void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) override;
|
|
59
|
+
std::string getSidecarLayoutJson() override;
|
|
60
|
+
void setSidecarLayoutJson(const std::string& sidecarLayoutJson) override;
|
|
59
61
|
NativeListScrollEdgeEffect getTopScrollEdgeEffect() override;
|
|
60
62
|
void setTopScrollEdgeEffect(NativeListScrollEdgeEffect topScrollEdgeEffect) override;
|
|
61
63
|
double getTopOverlayHeight() override;
|
|
@@ -80,6 +82,8 @@ namespace margelo::nitro::nativelist {
|
|
|
80
82
|
void setOnEndReached(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onEndReached) override;
|
|
81
83
|
std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnVisibleRangeChanged() override;
|
|
82
84
|
void setOnVisibleRangeChanged(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onVisibleRangeChanged) override;
|
|
85
|
+
std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnStructuralTransitionSettled() override;
|
|
86
|
+
void setOnStructuralTransitionSettled(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onStructuralTransitionSettled) override;
|
|
83
87
|
|
|
84
88
|
public:
|
|
85
89
|
// Methods
|
|
@@ -68,6 +68,11 @@ void JHybridNativeListStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
68
68
|
: !newProps->containerSlotHeightsJson.hasSameValue(oldProps->containerSlotHeightsJson)) {
|
|
69
69
|
hybridView->setContainerSlotHeightsJson(newProps->containerSlotHeightsJson.get());
|
|
70
70
|
}
|
|
71
|
+
if (oldProps == nullptr
|
|
72
|
+
? newProps->sidecarLayoutJson.isProvided()
|
|
73
|
+
: !newProps->sidecarLayoutJson.hasSameValue(oldProps->sidecarLayoutJson)) {
|
|
74
|
+
hybridView->setSidecarLayoutJson(newProps->sidecarLayoutJson.get());
|
|
75
|
+
}
|
|
71
76
|
if (oldProps == nullptr
|
|
72
77
|
? newProps->topScrollEdgeEffect.isProvided()
|
|
73
78
|
: !newProps->topScrollEdgeEffect.hasSameValue(oldProps->topScrollEdgeEffect)) {
|
|
@@ -128,6 +133,11 @@ void JHybridNativeListStateUpdater::updateViewProps(jni::alias_ref<jni::JClass>
|
|
|
128
133
|
: !newProps->onVisibleRangeChanged.hasSameValue(oldProps->onVisibleRangeChanged)) {
|
|
129
134
|
hybridView->setOnVisibleRangeChanged(newProps->onVisibleRangeChanged.get());
|
|
130
135
|
}
|
|
136
|
+
if (oldProps == nullptr
|
|
137
|
+
? newProps->onStructuralTransitionSettled.isProvided()
|
|
138
|
+
: !newProps->onStructuralTransitionSettled.hasSameValue(oldProps->onStructuralTransitionSettled)) {
|
|
139
|
+
hybridView->setOnStructuralTransitionSettled(newProps->onStructuralTransitionSettled.get());
|
|
140
|
+
}
|
|
131
141
|
|
|
132
142
|
// Update hybridRef if it changed
|
|
133
143
|
if (oldProps == nullptr
|
package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt
CHANGED
|
@@ -45,6 +45,12 @@ abstract class HybridNativeListSpec: HybridView() {
|
|
|
45
45
|
@set:Keep
|
|
46
46
|
abstract var containerSlotHeightsJson: String
|
|
47
47
|
|
|
48
|
+
@get:DoNotStrip
|
|
49
|
+
@get:Keep
|
|
50
|
+
@set:DoNotStrip
|
|
51
|
+
@set:Keep
|
|
52
|
+
abstract var sidecarLayoutJson: String
|
|
53
|
+
|
|
48
54
|
@get:DoNotStrip
|
|
49
55
|
@get:Keep
|
|
50
56
|
@set:DoNotStrip
|
|
@@ -172,6 +178,20 @@ abstract class HybridNativeListSpec: HybridView() {
|
|
|
172
178
|
set(value) {
|
|
173
179
|
onVisibleRangeChanged = value?.let { it }
|
|
174
180
|
}
|
|
181
|
+
|
|
182
|
+
abstract var onStructuralTransitionSettled: ((payloadJson: String) -> Unit)?
|
|
183
|
+
|
|
184
|
+
private var onStructuralTransitionSettled_cxx: Func_void_std__string?
|
|
185
|
+
@Keep
|
|
186
|
+
@DoNotStrip
|
|
187
|
+
get() {
|
|
188
|
+
return onStructuralTransitionSettled?.let { Func_void_std__string_java(it) }
|
|
189
|
+
}
|
|
190
|
+
@Keep
|
|
191
|
+
@DoNotStrip
|
|
192
|
+
set(value) {
|
|
193
|
+
onStructuralTransitionSettled = value?.let { it }
|
|
194
|
+
}
|
|
175
195
|
|
|
176
196
|
// Methods
|
|
177
197
|
@DoNotStrip
|
|
@@ -96,6 +96,13 @@ namespace margelo::nitro::nativelist {
|
|
|
96
96
|
inline void setContainerSlotHeightsJson(const std::string& containerSlotHeightsJson) noexcept override {
|
|
97
97
|
_swiftPart.setContainerSlotHeightsJson(containerSlotHeightsJson);
|
|
98
98
|
}
|
|
99
|
+
inline std::string getSidecarLayoutJson() noexcept override {
|
|
100
|
+
auto __result = _swiftPart.getSidecarLayoutJson();
|
|
101
|
+
return __result;
|
|
102
|
+
}
|
|
103
|
+
inline void setSidecarLayoutJson(const std::string& sidecarLayoutJson) noexcept override {
|
|
104
|
+
_swiftPart.setSidecarLayoutJson(sidecarLayoutJson);
|
|
105
|
+
}
|
|
99
106
|
inline NativeListScrollEdgeEffect getTopScrollEdgeEffect() noexcept override {
|
|
100
107
|
auto __result = _swiftPart.getTopScrollEdgeEffect();
|
|
101
108
|
return static_cast<NativeListScrollEdgeEffect>(__result);
|
|
@@ -179,6 +186,13 @@ namespace margelo::nitro::nativelist {
|
|
|
179
186
|
inline void setOnVisibleRangeChanged(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onVisibleRangeChanged) noexcept override {
|
|
180
187
|
_swiftPart.setOnVisibleRangeChanged(onVisibleRangeChanged);
|
|
181
188
|
}
|
|
189
|
+
inline std::optional<std::function<void(const std::string& /* payloadJson */)>> getOnStructuralTransitionSettled() noexcept override {
|
|
190
|
+
auto __result = _swiftPart.getOnStructuralTransitionSettled();
|
|
191
|
+
return __result;
|
|
192
|
+
}
|
|
193
|
+
inline void setOnStructuralTransitionSettled(const std::optional<std::function<void(const std::string& /* payloadJson */)>>& onStructuralTransitionSettled) noexcept override {
|
|
194
|
+
_swiftPart.setOnStructuralTransitionSettled(onStructuralTransitionSettled);
|
|
195
|
+
}
|
|
182
196
|
|
|
183
197
|
public:
|
|
184
198
|
// Methods
|