@assistant-ui/react-native 0.1.40 → 0.1.42
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/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/primitives/composer/ComposerAddAttachment.d.ts +3 -5
- package/dist/primitives/composer/ComposerAddAttachment.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerAddAttachment.js +2 -4
- package/dist/primitives/composer/ComposerAddAttachment.js.map +1 -1
- package/dist/primitives/message/MessageContent.d.ts.map +1 -1
- package/dist/primitives/message/MessageContent.js +1 -1
- package/dist/primitives/message/MessageContent.js.map +1 -1
- package/dist/primitives/message/MessageParts.js +2 -14
- package/dist/primitives/message/MessageParts.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +186 -152
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/package.json +9 -8
- package/src/index.ts +29 -0
- package/src/primitives/composer/ComposerAddAttachment.tsx +3 -8
- package/src/primitives/message/MessageContent.runtime.test.tsx +81 -0
- package/src/primitives/message/MessageContent.test.tsx +6 -1
- package/src/primitives/message/MessageContent.tsx +13 -7
- package/src/primitives/message/MessageParts.test.tsx +116 -0
- package/src/primitives/message/MessageParts.tsx +1 -24
- package/src/primitives/thread/ThreadMessages.test.tsx +256 -53
- package/src/primitives/thread/ThreadMessages.tsx +67 -26
|
@@ -100,96 +100,111 @@ const useComposedFlatListRef = (forwardedRef) => {
|
|
|
100
100
|
return t1;
|
|
101
101
|
};
|
|
102
102
|
const useThreadMessagesFlatListAutoScroll = (t0) => {
|
|
103
|
-
const $ = c(
|
|
104
|
-
const { flatListRef, hasMessages,
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
|
|
103
|
+
const $ = c(29);
|
|
104
|
+
const { flatListRef, hasMessages, horizontal: t1, autoScroll: t2, scrollToBottomOnRunStart: t3, scrollToBottomOnInitialize: t4, scrollToBottomOnThreadSwitch: t5 } = t0;
|
|
105
|
+
const horizontal = t1 === void 0 ? false : t1;
|
|
106
|
+
const autoScroll = t2 === void 0 ? true : t2;
|
|
107
|
+
const scrollToBottomOnRunStart = t3 === void 0 ? true : t3;
|
|
108
|
+
const scrollToBottomOnInitialize = t4 === void 0 ? true : t4;
|
|
109
|
+
const scrollToBottomOnThreadSwitch = t5 === void 0 ? true : t5;
|
|
110
|
+
let t6;
|
|
110
111
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
111
|
-
|
|
112
|
+
t6 = {
|
|
112
113
|
contentHeight: 0,
|
|
113
114
|
viewportHeight: 0,
|
|
114
115
|
scrollY: 0
|
|
115
116
|
};
|
|
116
|
-
$[0] =
|
|
117
|
-
} else
|
|
118
|
-
const metricsRef = useRef(
|
|
117
|
+
$[0] = t6;
|
|
118
|
+
} else t6 = $[0];
|
|
119
|
+
const metricsRef = useRef(t6);
|
|
119
120
|
const isAtBottomRef = useRef(true);
|
|
120
|
-
const
|
|
121
|
+
const lastScrollEventOffsetRef = useRef(0);
|
|
121
122
|
const initializeScrollRequestedRef = useRef(false);
|
|
123
|
+
const contentSizeVersionRef = useRef(0);
|
|
122
124
|
const pendingScrollToBottomRef = useRef(false);
|
|
123
|
-
let
|
|
125
|
+
let t7;
|
|
124
126
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
125
|
-
|
|
127
|
+
t7 = () => {
|
|
126
128
|
const { contentHeight, scrollY, viewportHeight } = metricsRef.current;
|
|
127
129
|
isAtBottomRef.current = contentHeight <= viewportHeight || contentHeight - scrollY - viewportHeight <= AT_BOTTOM_THRESHOLD;
|
|
128
130
|
};
|
|
129
|
-
$[1] =
|
|
130
|
-
} else
|
|
131
|
-
const updateIsAtBottom =
|
|
132
|
-
let
|
|
131
|
+
$[1] = t7;
|
|
132
|
+
} else t7 = $[1];
|
|
133
|
+
const updateIsAtBottom = t7;
|
|
134
|
+
let t8;
|
|
133
135
|
if ($[2] !== flatListRef) {
|
|
134
|
-
|
|
136
|
+
t8 = (animated) => {
|
|
135
137
|
const { contentHeight: contentHeight_0, viewportHeight: viewportHeight_0 } = metricsRef.current;
|
|
136
|
-
|
|
138
|
+
const offset = Math.max(0, contentHeight_0 - viewportHeight_0);
|
|
139
|
+
metricsRef.current.scrollY = offset;
|
|
137
140
|
isAtBottomRef.current = true;
|
|
138
|
-
flatListRef.current?.
|
|
141
|
+
flatListRef.current?.scrollToOffset({
|
|
142
|
+
offset,
|
|
143
|
+
animated
|
|
144
|
+
});
|
|
139
145
|
};
|
|
140
146
|
$[2] = flatListRef;
|
|
141
|
-
$[3] =
|
|
142
|
-
} else
|
|
143
|
-
const scrollToBottom =
|
|
144
|
-
let
|
|
145
|
-
if ($[4] !== autoScroll || $[5] !== scrollToBottom) {
|
|
146
|
-
|
|
147
|
+
$[3] = t8;
|
|
148
|
+
} else t8 = $[3];
|
|
149
|
+
const scrollToBottom = t8;
|
|
150
|
+
let t9;
|
|
151
|
+
if ($[4] !== autoScroll || $[5] !== horizontal || $[6] !== scrollToBottom) {
|
|
152
|
+
t9 = (event) => {
|
|
147
153
|
const wasAtBottom = isAtBottomRef.current;
|
|
148
154
|
const previousViewportHeight = metricsRef.current.viewportHeight;
|
|
149
|
-
const viewportHeight_1 = event.nativeEvent.layout.height;
|
|
155
|
+
const viewportHeight_1 = horizontal ? event.nativeEvent.layout.width : event.nativeEvent.layout.height;
|
|
150
156
|
metricsRef.current.viewportHeight = viewportHeight_1;
|
|
151
157
|
updateIsAtBottom();
|
|
158
|
+
const pending = pendingScrollToBottomRef.current;
|
|
159
|
+
if (pending && contentSizeVersionRef.current >= pending.minimumContentSizeVersion && viewportHeight_1 > 0) {
|
|
160
|
+
pendingScrollToBottomRef.current = false;
|
|
161
|
+
scrollToBottom(pending.animated);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
152
164
|
if (!wasAtBottom) return;
|
|
153
|
-
if (autoScroll && previousViewportHeight !== 0 && viewportHeight_1 !== previousViewportHeight)
|
|
154
|
-
|
|
155
|
-
scrollToBottom(pending ? pending.animated : false);
|
|
156
|
-
} else isAtBottomRef.current = true;
|
|
165
|
+
if (autoScroll && previousViewportHeight !== 0 && viewportHeight_1 !== previousViewportHeight) scrollToBottom(pending ? pending.animated : false);
|
|
166
|
+
else isAtBottomRef.current = true;
|
|
157
167
|
};
|
|
158
168
|
$[4] = autoScroll;
|
|
159
|
-
$[5] =
|
|
160
|
-
$[6] =
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
169
|
+
$[5] = horizontal;
|
|
170
|
+
$[6] = scrollToBottom;
|
|
171
|
+
$[7] = t9;
|
|
172
|
+
} else t9 = $[7];
|
|
173
|
+
const handleLayout = t9;
|
|
174
|
+
let t10;
|
|
175
|
+
if ($[8] !== horizontal) {
|
|
176
|
+
t10 = (event_0) => {
|
|
166
177
|
const { contentOffset, contentSize, layoutMeasurement } = event_0.nativeEvent;
|
|
167
|
-
const
|
|
178
|
+
const scrollOffset = horizontal ? contentOffset.x : contentOffset.y;
|
|
179
|
+
const previousEventOffset = lastScrollEventOffsetRef.current;
|
|
168
180
|
const wasPinnedToBottom = isAtBottomRef.current;
|
|
169
|
-
|
|
181
|
+
lastScrollEventOffsetRef.current = scrollOffset;
|
|
170
182
|
metricsRef.current = {
|
|
171
|
-
contentHeight: contentSize.height,
|
|
172
|
-
viewportHeight: layoutMeasurement.height,
|
|
173
|
-
scrollY:
|
|
183
|
+
contentHeight: horizontal ? contentSize.width : contentSize.height,
|
|
184
|
+
viewportHeight: horizontal ? layoutMeasurement.width : layoutMeasurement.height,
|
|
185
|
+
scrollY: scrollOffset
|
|
174
186
|
};
|
|
175
187
|
updateIsAtBottom();
|
|
176
|
-
const upwardMove =
|
|
188
|
+
const upwardMove = scrollOffset < previousEventOffset;
|
|
177
189
|
if (wasPinnedToBottom && !upwardMove) isAtBottomRef.current = true;
|
|
178
190
|
if (!isAtBottomRef.current && upwardMove) pendingScrollToBottomRef.current = false;
|
|
179
191
|
};
|
|
180
|
-
$[
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
192
|
+
$[8] = horizontal;
|
|
193
|
+
$[9] = t10;
|
|
194
|
+
} else t10 = $[9];
|
|
195
|
+
const handleScroll = t10;
|
|
196
|
+
let t11;
|
|
197
|
+
if ($[10] !== autoScroll || $[11] !== horizontal || $[12] !== scrollToBottom) {
|
|
198
|
+
t11 = (width, height) => {
|
|
186
199
|
const metrics = metricsRef.current;
|
|
200
|
+
const contentHeight_1 = horizontal ? width : height;
|
|
187
201
|
const previousContentHeight = metrics.contentHeight;
|
|
188
202
|
const wasAtBottom_0 = isAtBottomRef.current;
|
|
189
|
-
|
|
203
|
+
if (contentHeight_1 > 0) contentSizeVersionRef.current = contentSizeVersionRef.current + 1;
|
|
204
|
+
metrics.contentHeight = contentHeight_1;
|
|
190
205
|
updateIsAtBottom();
|
|
191
206
|
const pendingScroll = pendingScrollToBottomRef.current;
|
|
192
|
-
if (pendingScroll) {
|
|
207
|
+
if (pendingScroll && contentSizeVersionRef.current >= pendingScroll.minimumContentSizeVersion && metrics.viewportHeight > 0) {
|
|
193
208
|
pendingScrollToBottomRef.current = false;
|
|
194
209
|
scrollToBottom(pendingScroll.animated);
|
|
195
210
|
return;
|
|
@@ -197,18 +212,19 @@ const useThreadMessagesFlatListAutoScroll = (t0) => {
|
|
|
197
212
|
if (!autoScroll) return;
|
|
198
213
|
if (!wasAtBottom_0) return;
|
|
199
214
|
if (previousContentHeight === 0) return;
|
|
200
|
-
if (
|
|
215
|
+
if (contentHeight_1 <= previousContentHeight) return;
|
|
201
216
|
scrollToBottom(false);
|
|
202
217
|
};
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
218
|
+
$[10] = autoScroll;
|
|
219
|
+
$[11] = horizontal;
|
|
220
|
+
$[12] = scrollToBottom;
|
|
221
|
+
$[13] = t11;
|
|
222
|
+
} else t11 = $[13];
|
|
223
|
+
const handleContentSizeChange = t11;
|
|
209
224
|
let t12;
|
|
210
|
-
|
|
211
|
-
|
|
225
|
+
let t13;
|
|
226
|
+
if ($[14] !== hasMessages || $[15] !== scrollToBottom || $[16] !== scrollToBottomOnInitialize) {
|
|
227
|
+
t12 = () => {
|
|
212
228
|
if (!scrollToBottomOnInitialize) return;
|
|
213
229
|
if (!hasMessages) {
|
|
214
230
|
initializeScrollRequestedRef.current = false;
|
|
@@ -216,65 +232,75 @@ const useThreadMessagesFlatListAutoScroll = (t0) => {
|
|
|
216
232
|
}
|
|
217
233
|
if (initializeScrollRequestedRef.current) return;
|
|
218
234
|
initializeScrollRequestedRef.current = true;
|
|
219
|
-
pendingScrollToBottomRef.current = {
|
|
235
|
+
pendingScrollToBottomRef.current = {
|
|
236
|
+
animated: false,
|
|
237
|
+
minimumContentSizeVersion: Math.max(1, contentSizeVersionRef.current)
|
|
238
|
+
};
|
|
220
239
|
scrollToBottom(false);
|
|
221
240
|
};
|
|
222
|
-
|
|
241
|
+
t13 = [
|
|
223
242
|
hasMessages,
|
|
224
243
|
scrollToBottom,
|
|
225
244
|
scrollToBottomOnInitialize
|
|
226
245
|
];
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
246
|
+
$[14] = hasMessages;
|
|
247
|
+
$[15] = scrollToBottom;
|
|
248
|
+
$[16] = scrollToBottomOnInitialize;
|
|
249
|
+
$[17] = t12;
|
|
250
|
+
$[18] = t13;
|
|
232
251
|
} else {
|
|
233
|
-
|
|
234
|
-
|
|
252
|
+
t12 = $[17];
|
|
253
|
+
t13 = $[18];
|
|
235
254
|
}
|
|
236
|
-
useEffect(
|
|
237
|
-
let t13;
|
|
238
|
-
if ($[16] !== scrollToBottom || $[17] !== scrollToBottomOnRunStart) {
|
|
239
|
-
t13 = () => {
|
|
240
|
-
if (!scrollToBottomOnRunStart) return;
|
|
241
|
-
pendingScrollToBottomRef.current = { animated: true };
|
|
242
|
-
scrollToBottom(true);
|
|
243
|
-
};
|
|
244
|
-
$[16] = scrollToBottom;
|
|
245
|
-
$[17] = scrollToBottomOnRunStart;
|
|
246
|
-
$[18] = t13;
|
|
247
|
-
} else t13 = $[18];
|
|
248
|
-
useAuiEvent("thread.runStart", t13);
|
|
255
|
+
useEffect(t12, t13);
|
|
249
256
|
let t14;
|
|
250
|
-
if ($[19] !== scrollToBottom || $[20] !==
|
|
257
|
+
if ($[19] !== scrollToBottom || $[20] !== scrollToBottomOnRunStart) {
|
|
251
258
|
t14 = () => {
|
|
252
|
-
if (!
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
259
|
+
if (!scrollToBottomOnRunStart) return;
|
|
260
|
+
pendingScrollToBottomRef.current = {
|
|
261
|
+
animated: true,
|
|
262
|
+
minimumContentSizeVersion: contentSizeVersionRef.current + 1
|
|
263
|
+
};
|
|
264
|
+
scrollToBottom(true);
|
|
257
265
|
};
|
|
258
266
|
$[19] = scrollToBottom;
|
|
259
|
-
$[20] =
|
|
267
|
+
$[20] = scrollToBottomOnRunStart;
|
|
260
268
|
$[21] = t14;
|
|
261
269
|
} else t14 = $[21];
|
|
262
|
-
useAuiEvent("
|
|
270
|
+
useAuiEvent("thread.runStart", t14);
|
|
263
271
|
let t15;
|
|
264
|
-
if ($[22] !==
|
|
265
|
-
t15 = {
|
|
272
|
+
if ($[22] !== scrollToBottom || $[23] !== scrollToBottomOnThreadSwitch) {
|
|
273
|
+
t15 = () => {
|
|
274
|
+
if (!scrollToBottomOnThreadSwitch) return;
|
|
275
|
+
initializeScrollRequestedRef.current = false;
|
|
276
|
+
lastScrollEventOffsetRef.current = 0;
|
|
277
|
+
pendingScrollToBottomRef.current = {
|
|
278
|
+
animated: false,
|
|
279
|
+
minimumContentSizeVersion: contentSizeVersionRef.current + 1
|
|
280
|
+
};
|
|
281
|
+
scrollToBottom(false);
|
|
282
|
+
};
|
|
283
|
+
$[22] = scrollToBottom;
|
|
284
|
+
$[23] = scrollToBottomOnThreadSwitch;
|
|
285
|
+
$[24] = t15;
|
|
286
|
+
} else t15 = $[24];
|
|
287
|
+
useAuiEvent("threads.selectionChanged", t15);
|
|
288
|
+
let t16;
|
|
289
|
+
if ($[25] !== handleContentSizeChange || $[26] !== handleLayout || $[27] !== handleScroll) {
|
|
290
|
+
t16 = {
|
|
266
291
|
handleLayout,
|
|
267
292
|
handleScroll,
|
|
268
293
|
handleContentSizeChange
|
|
269
294
|
};
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
|
|
274
|
-
|
|
295
|
+
$[25] = handleContentSizeChange;
|
|
296
|
+
$[26] = handleLayout;
|
|
297
|
+
$[27] = handleScroll;
|
|
298
|
+
$[28] = t16;
|
|
299
|
+
} else t16 = $[28];
|
|
300
|
+
return t16;
|
|
275
301
|
};
|
|
276
302
|
const ThreadMessagesFlatList = forwardRef((t0, forwardedRef) => {
|
|
277
|
-
const $ = c(
|
|
303
|
+
const $ = c(48);
|
|
278
304
|
let autoScroll;
|
|
279
305
|
let children;
|
|
280
306
|
let components;
|
|
@@ -317,26 +343,28 @@ const ThreadMessagesFlatList = forwardRef((t0, forwardedRef) => {
|
|
|
317
343
|
const [flatListRef, setFlatListRef] = useComposedFlatListRef(forwardedRef);
|
|
318
344
|
const t1 = messages.length > 0;
|
|
319
345
|
let t2;
|
|
320
|
-
if ($[12] !== autoScroll || $[13] !==
|
|
346
|
+
if ($[12] !== autoScroll || $[13] !== flatListProps.horizontal || $[14] !== flatListRef || $[15] !== scrollToBottomOnInitialize || $[16] !== scrollToBottomOnRunStart || $[17] !== scrollToBottomOnThreadSwitch || $[18] !== t1) {
|
|
321
347
|
t2 = {
|
|
322
348
|
flatListRef,
|
|
323
349
|
hasMessages: t1,
|
|
350
|
+
horizontal: flatListProps.horizontal,
|
|
324
351
|
autoScroll,
|
|
325
352
|
scrollToBottomOnInitialize,
|
|
326
353
|
scrollToBottomOnRunStart,
|
|
327
354
|
scrollToBottomOnThreadSwitch
|
|
328
355
|
};
|
|
329
356
|
$[12] = autoScroll;
|
|
330
|
-
$[13] =
|
|
331
|
-
$[14] =
|
|
332
|
-
$[15] =
|
|
333
|
-
$[16] =
|
|
334
|
-
$[17] =
|
|
335
|
-
$[18] =
|
|
336
|
-
|
|
357
|
+
$[13] = flatListProps.horizontal;
|
|
358
|
+
$[14] = flatListRef;
|
|
359
|
+
$[15] = scrollToBottomOnInitialize;
|
|
360
|
+
$[16] = scrollToBottomOnRunStart;
|
|
361
|
+
$[17] = scrollToBottomOnThreadSwitch;
|
|
362
|
+
$[18] = t1;
|
|
363
|
+
$[19] = t2;
|
|
364
|
+
} else t2 = $[19];
|
|
337
365
|
const { handleContentSizeChange: handleAutoScrollContentSizeChange, handleLayout: handleAutoScrollLayout, handleScroll: handleAutoScrollScroll } = useThreadMessagesFlatListAutoScroll(t2);
|
|
338
366
|
let t3;
|
|
339
|
-
if ($[
|
|
367
|
+
if ($[20] !== children || $[21] !== components) {
|
|
340
368
|
t3 = (t4) => {
|
|
341
369
|
const { index } = t4;
|
|
342
370
|
if (children) return /* @__PURE__ */ jsx(ThreadMessageByChildren, {
|
|
@@ -348,50 +376,55 @@ const ThreadMessagesFlatList = forwardRef((t0, forwardedRef) => {
|
|
|
348
376
|
components
|
|
349
377
|
});
|
|
350
378
|
};
|
|
351
|
-
$[
|
|
352
|
-
$[
|
|
353
|
-
$[
|
|
354
|
-
} else t3 = $[
|
|
379
|
+
$[20] = children;
|
|
380
|
+
$[21] = components;
|
|
381
|
+
$[22] = t3;
|
|
382
|
+
} else t3 = $[22];
|
|
355
383
|
const renderItem = t3;
|
|
356
384
|
const keyExtractor = _temp4;
|
|
357
385
|
const scrollTracking = (autoScroll ?? true) || (scrollToBottomOnInitialize ?? true) || (scrollToBottomOnRunStart ?? true) || (scrollToBottomOnThreadSwitch ?? true);
|
|
358
386
|
let t4;
|
|
359
|
-
if ($[
|
|
387
|
+
if ($[23] !== handleAutoScrollLayout || $[24] !== onLayout) {
|
|
360
388
|
t4 = (event) => {
|
|
361
389
|
handleAutoScrollLayout(event);
|
|
362
390
|
onLayout?.(event);
|
|
363
391
|
};
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
} else t4 = $[
|
|
392
|
+
$[23] = handleAutoScrollLayout;
|
|
393
|
+
$[24] = onLayout;
|
|
394
|
+
$[25] = t4;
|
|
395
|
+
} else t4 = $[25];
|
|
368
396
|
const handleLayout = t4;
|
|
369
397
|
let t5;
|
|
370
|
-
if ($[
|
|
398
|
+
if ($[26] !== handleAutoScrollScroll || $[27] !== onScroll) {
|
|
371
399
|
t5 = (event_0) => {
|
|
372
400
|
handleAutoScrollScroll(event_0);
|
|
373
401
|
onScroll?.(event_0);
|
|
374
402
|
};
|
|
375
|
-
$[
|
|
376
|
-
$[
|
|
377
|
-
$[
|
|
378
|
-
} else t5 = $[
|
|
403
|
+
$[26] = handleAutoScrollScroll;
|
|
404
|
+
$[27] = onScroll;
|
|
405
|
+
$[28] = t5;
|
|
406
|
+
} else t5 = $[28];
|
|
379
407
|
const handleScroll = t5;
|
|
380
408
|
let t6;
|
|
381
|
-
if ($[
|
|
409
|
+
if ($[29] !== handleAutoScrollContentSizeChange || $[30] !== onContentSizeChange) {
|
|
382
410
|
t6 = (width, height) => {
|
|
383
411
|
handleAutoScrollContentSizeChange(width, height);
|
|
384
412
|
onContentSizeChange?.(width, height);
|
|
385
413
|
};
|
|
386
|
-
$[
|
|
387
|
-
$[
|
|
388
|
-
$[
|
|
389
|
-
} else t6 = $[
|
|
414
|
+
$[29] = handleAutoScrollContentSizeChange;
|
|
415
|
+
$[30] = onContentSizeChange;
|
|
416
|
+
$[31] = t6;
|
|
417
|
+
} else t6 = $[31];
|
|
390
418
|
const handleContentSizeChange = t6;
|
|
391
419
|
const t7 = messages;
|
|
392
420
|
let t8;
|
|
393
|
-
if ($[
|
|
394
|
-
t8 =
|
|
421
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
422
|
+
t8 = { minIndexForVisible: 0 };
|
|
423
|
+
$[32] = t8;
|
|
424
|
+
} else t8 = $[32];
|
|
425
|
+
let t9;
|
|
426
|
+
if ($[33] !== handleContentSizeChange || $[34] !== handleLayout || $[35] !== handleScroll || $[36] !== onContentSizeChange || $[37] !== onLayout || $[38] !== onScroll || $[39] !== scrollEventThrottle || $[40] !== scrollTracking) {
|
|
427
|
+
t9 = scrollTracking ? {
|
|
395
428
|
onContentSizeChange: handleContentSizeChange,
|
|
396
429
|
onLayout: handleLayout,
|
|
397
430
|
onScroll: handleScroll,
|
|
@@ -402,34 +435,35 @@ const ThreadMessagesFlatList = forwardRef((t0, forwardedRef) => {
|
|
|
402
435
|
...onScroll && { onScroll },
|
|
403
436
|
...scrollEventThrottle !== void 0 && { scrollEventThrottle }
|
|
404
437
|
};
|
|
405
|
-
$[
|
|
406
|
-
$[
|
|
407
|
-
$[
|
|
408
|
-
$[
|
|
409
|
-
$[
|
|
410
|
-
$[
|
|
411
|
-
$[
|
|
412
|
-
$[
|
|
413
|
-
$[
|
|
414
|
-
} else
|
|
415
|
-
let
|
|
416
|
-
if ($[
|
|
417
|
-
|
|
438
|
+
$[33] = handleContentSizeChange;
|
|
439
|
+
$[34] = handleLayout;
|
|
440
|
+
$[35] = handleScroll;
|
|
441
|
+
$[36] = onContentSizeChange;
|
|
442
|
+
$[37] = onLayout;
|
|
443
|
+
$[38] = onScroll;
|
|
444
|
+
$[39] = scrollEventThrottle;
|
|
445
|
+
$[40] = scrollTracking;
|
|
446
|
+
$[41] = t9;
|
|
447
|
+
} else t9 = $[41];
|
|
448
|
+
let t10;
|
|
449
|
+
if ($[42] !== flatListProps || $[43] !== renderItem || $[44] !== setFlatListRef || $[45] !== t7 || $[46] !== t9) {
|
|
450
|
+
t10 = /* @__PURE__ */ jsx(FlatList, {
|
|
418
451
|
ref: setFlatListRef,
|
|
419
452
|
data: t7,
|
|
420
453
|
renderItem,
|
|
421
454
|
keyExtractor,
|
|
422
|
-
|
|
455
|
+
maintainVisibleContentPosition: t8,
|
|
456
|
+
...t9,
|
|
423
457
|
...flatListProps
|
|
424
458
|
});
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
428
|
-
$[
|
|
429
|
-
$[
|
|
430
|
-
$[
|
|
431
|
-
} else
|
|
432
|
-
return
|
|
459
|
+
$[42] = flatListProps;
|
|
460
|
+
$[43] = renderItem;
|
|
461
|
+
$[44] = setFlatListRef;
|
|
462
|
+
$[45] = t7;
|
|
463
|
+
$[46] = t9;
|
|
464
|
+
$[47] = t10;
|
|
465
|
+
} else t10 = $[47];
|
|
466
|
+
return t10;
|
|
433
467
|
});
|
|
434
468
|
ThreadMessagesFlatList.displayName = "ThreadPrimitive.MessagesFlatList";
|
|
435
469
|
/** @deprecated Use ThreadPrimitive.MessagesFlatList instead. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadMessages.js","names":["ComponentType","FC","ForwardedRef","ReactNode","RefObject","forwardRef","memo","useCallback","useEffect","useRef","FlatList","FlatListProps","LayoutChangeEvent","NativeScrollEvent","NativeSyntheticEvent","MessageState","ThreadMessage","RenderChildrenWithAccessor","useAuiEvent","useAuiState","MessageByIndexProvider","MessageComponents","Message","EditComposer","UserEditComposer","AssistantEditComposer","SystemEditComposer","UserMessage","AssistantMessage","SystemMessage","MessagesContent","components","children","value","message","ThreadMessagesFlatListProps","Omit","autoScroll","scrollToBottomOnRunStart","scrollToBottomOnInitialize","scrollToBottomOnThreadSwitch","ThreadMessagesProps","DEFAULT_SYSTEM_MESSAGE","AT_BOTTOM_THRESHOLD","getComponent","role","isEditing","_exhaustiveCheck","Error","ThreadMessageComponent","t0","$","_c","_temp","_temp2","t1","Component","t2","ThreadMessageByIndex","index","prev","next","displayName","ThreadMessageByChildren","aui","thread","getState","getItem","setForwardedRef","ref","T","current","useComposedFlatListRef","forwardedRef","flatListRef","node","setFlatListRef","const","useThreadMessagesFlatListAutoScroll","hasMessages","t3","t4","undefined","t5","Symbol","for","contentHeight","viewportHeight","scrollY","metricsRef","isAtBottomRef","lastScrollEventYRef","initializeScrollRequestedRef","pendingScrollToBottomRef","t6","updateIsAtBottom","t7","animated","contentHeight_0","viewportHeight_0","Math","max","scrollToEnd","scrollToBottom","t8","event","wasAtBottom","previousViewportHeight","viewportHeight_1","nativeEvent","layout","height","pending","handleLayout","t9","event_0","contentOffset","contentSize","layoutMeasurement","previousEventY","wasPinnedToBottom","y","upwardMove","handleScroll","t10","_width","metrics","previousContentHeight","wasAtBottom_0","pendingScroll","handleContentSizeChange","t11","t12","t13","t14","t15","ThreadMessagesFlatList","flatListProps","onContentSizeChange","onLayout","onScroll","scrollEventThrottle","messages","_temp3","length","handleAutoScrollContentSizeChange","handleAutoScrollLayout","handleAutoScrollScroll","renderItem","keyExtractor","_temp4","scrollTracking","width","ThreadMessages","props","s","s_0","composer","item","id"],"sources":["../../../src/primitives/thread/ThreadMessages.tsx"],"sourcesContent":["import {\n type ComponentType,\n type FC,\n type ForwardedRef,\n type ReactNode,\n type RefObject,\n forwardRef,\n memo,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport {\n FlatList,\n type FlatListProps,\n type LayoutChangeEvent,\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n} from \"react-native\";\nimport type { MessageState, ThreadMessage } from \"@assistant-ui/core\";\nimport {\n RenderChildrenWithAccessor,\n useAuiEvent,\n useAuiState,\n} from \"@assistant-ui/store\";\nimport { MessageByIndexProvider } from \"@assistant-ui/core/react\";\n\ntype MessageComponents =\n | {\n Message: ComponentType;\n EditComposer?: ComponentType | undefined;\n UserEditComposer?: ComponentType | undefined;\n AssistantEditComposer?: ComponentType | undefined;\n SystemEditComposer?: ComponentType | undefined;\n UserMessage?: ComponentType | undefined;\n AssistantMessage?: ComponentType | undefined;\n SystemMessage?: ComponentType | undefined;\n }\n | {\n Message?: ComponentType | undefined;\n EditComposer?: ComponentType | undefined;\n UserEditComposer?: ComponentType | undefined;\n AssistantEditComposer?: ComponentType | undefined;\n SystemEditComposer?: ComponentType | undefined;\n UserMessage: ComponentType;\n AssistantMessage: ComponentType;\n SystemMessage?: ComponentType | undefined;\n };\n\ntype MessagesContent =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessageComponents;\n children?: never;\n }\n | {\n children: (value: { message: MessageState }) => ReactNode;\n components?: never;\n };\n\nexport type ThreadMessagesFlatListProps = Omit<\n FlatListProps<ThreadMessage>,\n \"data\" | \"renderItem\" | \"children\"\n> &\n MessagesContent & {\n autoScroll?: boolean | undefined;\n scrollToBottomOnRunStart?: boolean | undefined;\n scrollToBottomOnInitialize?: boolean | undefined;\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n };\n\n/** @deprecated Use ThreadMessagesFlatListProps instead. */\nexport type ThreadMessagesProps = ThreadMessagesFlatListProps;\n\nconst DEFAULT_SYSTEM_MESSAGE = () => null;\nconst AT_BOTTOM_THRESHOLD = 4;\n\nconst getComponent = (\n components: MessageComponents,\n role: ThreadMessage[\"role\"],\n isEditing: boolean,\n) => {\n switch (role) {\n case \"user\":\n if (isEditing) {\n return (\n components.UserEditComposer ??\n components.EditComposer ??\n components.UserMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return components.UserMessage ?? (components.Message as ComponentType);\n }\n case \"assistant\":\n if (isEditing) {\n return (\n components.AssistantEditComposer ??\n components.EditComposer ??\n components.AssistantMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.AssistantMessage ?? (components.Message as ComponentType)\n );\n }\n case \"system\":\n if (isEditing) {\n return (\n components.SystemEditComposer ??\n components.EditComposer ??\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n } else {\n return (\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unknown message role: ${_exhaustiveCheck}`);\n }\n }\n};\n\nconst ThreadMessageComponent: FC<{ components: MessageComponents }> = ({\n components,\n}) => {\n const role = useAuiState((s) => s.message.role);\n const isEditing = useAuiState((s) => s.message.composer.isEditing);\n const Component = getComponent(components, role, isEditing);\n\n return <Component />;\n};\n\nconst ThreadMessageByIndex = memo(\n ({ index, components }: { index: number; components: MessageComponents }) => {\n return (\n <MessageByIndexProvider index={index}>\n <ThreadMessageComponent components={components} />\n </MessageByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index && prev.components === next.components,\n);\nThreadMessageByIndex.displayName = \"ThreadPrimitive.MessageByIndex\";\n\nconst ThreadMessageByChildren = memo(\n ({\n index,\n children,\n }: {\n index: number;\n children: (value: { message: MessageState }) => ReactNode;\n }) => {\n return (\n <MessageByIndexProvider index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.thread.message({ index }).getState()}\n >\n {(getItem) =>\n children({\n get message() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageByIndexProvider>\n );\n },\n (prev, next) => prev.index === next.index && prev.children === next.children,\n);\nThreadMessageByChildren.displayName = \"ThreadPrimitive.MessageByChildren\";\n\nconst setForwardedRef = <T,>(ref: ForwardedRef<T>, value: T | null) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nconst useComposedFlatListRef = (\n forwardedRef: ForwardedRef<FlatList<ThreadMessage>>,\n) => {\n const flatListRef = useRef<FlatList<ThreadMessage> | null>(null);\n\n const setFlatListRef = useCallback(\n (node: FlatList<ThreadMessage> | null) => {\n flatListRef.current = node;\n setForwardedRef(forwardedRef, node);\n },\n [forwardedRef],\n );\n\n return [flatListRef, setFlatListRef] as const;\n};\n\nconst useThreadMessagesFlatListAutoScroll = ({\n flatListRef,\n hasMessages,\n autoScroll = true,\n scrollToBottomOnRunStart = true,\n scrollToBottomOnInitialize = true,\n scrollToBottomOnThreadSwitch = true,\n}: {\n flatListRef: RefObject<FlatList<ThreadMessage> | null>;\n hasMessages: boolean;\n autoScroll?: boolean | undefined;\n scrollToBottomOnRunStart?: boolean | undefined;\n scrollToBottomOnInitialize?: boolean | undefined;\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n}) => {\n const metricsRef = useRef({\n contentHeight: 0,\n viewportHeight: 0,\n scrollY: 0,\n });\n const isAtBottomRef = useRef(true);\n const lastScrollEventYRef = useRef(0);\n const initializeScrollRequestedRef = useRef(false);\n const pendingScrollToBottomRef = useRef<false | { animated: boolean }>(false);\n\n const updateIsAtBottom = useCallback(() => {\n const { contentHeight, scrollY, viewportHeight } = metricsRef.current;\n isAtBottomRef.current =\n contentHeight <= viewportHeight ||\n contentHeight - scrollY - viewportHeight <= AT_BOTTOM_THRESHOLD;\n }, []);\n\n // Commanding a scroll records the intended position immediately; the\n // native scroll echo is bridged and throttled, so waiting for it lets a\n // fast stream observe stale metrics and drop out of following.\n const scrollToBottom = useCallback(\n (animated: boolean) => {\n const { contentHeight, viewportHeight } = metricsRef.current;\n metricsRef.current.scrollY = Math.max(0, contentHeight - viewportHeight);\n isAtBottomRef.current = true;\n flatListRef.current?.scrollToEnd({ animated });\n },\n [flatListRef],\n );\n\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n const wasAtBottom = isAtBottomRef.current;\n const previousViewportHeight = metricsRef.current.viewportHeight;\n const viewportHeight = event.nativeEvent.layout.height;\n metricsRef.current.viewportHeight = viewportHeight;\n updateIsAtBottom();\n if (!wasAtBottom) return;\n // Layout changes are never user gestures, so they must not unpin. Past\n // the first measurement, a viewport change while pinned re-commands the\n // bottom position, since no content-size event follows a bare keyboard\n // open or close.\n if (\n autoScroll &&\n previousViewportHeight !== 0 &&\n viewportHeight !== previousViewportHeight\n ) {\n const pending = pendingScrollToBottomRef.current;\n scrollToBottom(pending ? pending.animated : false);\n } else {\n isAtBottomRef.current = true;\n }\n },\n [autoScroll, scrollToBottom, updateIsAtBottom],\n );\n\n const handleScroll = useCallback(\n (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n const { contentOffset, contentSize, layoutMeasurement } =\n event.nativeEvent;\n const previousEventY = lastScrollEventYRef.current;\n const wasPinnedToBottom = isAtBottomRef.current;\n lastScrollEventYRef.current = contentOffset.y;\n metricsRef.current = {\n contentHeight: contentSize.height,\n viewportHeight: layoutMeasurement.height,\n scrollY: contentOffset.y,\n };\n updateIsAtBottom();\n const upwardMove = contentOffset.y < previousEventY;\n // Only a deliberate upward move unpins or cancels a pending scroll.\n // Gestures are detected echo-to-echo because a commanded scroll\n // optimistically moves the tracked position ahead of its ascending\n // animation echoes, and those echoes must not unpin mid-flight.\n if (wasPinnedToBottom && !upwardMove) {\n isAtBottomRef.current = true;\n }\n if (!isAtBottomRef.current && upwardMove) {\n pendingScrollToBottomRef.current = false;\n }\n },\n [updateIsAtBottom],\n );\n\n const handleContentSizeChange = useCallback(\n (_width: number, height: number) => {\n const metrics = metricsRef.current;\n const previousContentHeight = metrics.contentHeight;\n const wasAtBottom = isAtBottomRef.current;\n metrics.contentHeight = height;\n updateIsAtBottom();\n\n // FlatList.scrollToEnd is a no-op before the list has measured, so the\n // initialize and thread-switch scrolls land on the next content-size\n // event, once real metrics exist.\n const pendingScroll = pendingScrollToBottomRef.current;\n if (pendingScroll) {\n pendingScrollToBottomRef.current = false;\n scrollToBottom(pendingScroll.animated);\n return;\n }\n\n if (!autoScroll) return;\n if (!wasAtBottom) return;\n if (previousContentHeight === 0) return;\n if (height <= previousContentHeight) return;\n\n scrollToBottom(false);\n },\n [autoScroll, scrollToBottom, updateIsAtBottom],\n );\n\n useEffect(() => {\n if (!scrollToBottomOnInitialize) return;\n if (!hasMessages) {\n initializeScrollRequestedRef.current = false;\n return;\n }\n if (initializeScrollRequestedRef.current) return;\n\n initializeScrollRequestedRef.current = true;\n pendingScrollToBottomRef.current = { animated: false };\n scrollToBottom(false);\n }, [hasMessages, scrollToBottom, scrollToBottomOnInitialize]);\n\n useAuiEvent(\"thread.runStart\", () => {\n if (!scrollToBottomOnRunStart) return;\n pendingScrollToBottomRef.current = { animated: true };\n scrollToBottom(true);\n });\n\n useAuiEvent(\"threads.selectionChanged\", () => {\n if (!scrollToBottomOnThreadSwitch) return;\n initializeScrollRequestedRef.current = false;\n lastScrollEventYRef.current = 0;\n pendingScrollToBottomRef.current = { animated: false };\n scrollToBottom(false);\n });\n\n return {\n handleLayout,\n handleScroll,\n handleContentSizeChange,\n };\n};\n\nexport const ThreadMessagesFlatList = forwardRef<\n FlatList<ThreadMessage>,\n ThreadMessagesFlatListProps\n>(\n (\n {\n autoScroll,\n components,\n children,\n onContentSizeChange,\n onLayout,\n onScroll,\n scrollEventThrottle,\n scrollToBottomOnInitialize,\n scrollToBottomOnRunStart,\n scrollToBottomOnThreadSwitch,\n ...flatListProps\n },\n forwardedRef,\n ) => {\n const messages = useAuiState((s) => s.thread.messages);\n const [flatListRef, setFlatListRef] = useComposedFlatListRef(forwardedRef);\n const {\n handleContentSizeChange: handleAutoScrollContentSizeChange,\n handleLayout: handleAutoScrollLayout,\n handleScroll: handleAutoScrollScroll,\n } = useThreadMessagesFlatListAutoScroll({\n flatListRef,\n hasMessages: messages.length > 0,\n autoScroll,\n scrollToBottomOnInitialize,\n scrollToBottomOnRunStart,\n scrollToBottomOnThreadSwitch,\n });\n\n const renderItem = useCallback(\n ({ index }: { item: ThreadMessage; index: number }) => {\n if (children) {\n return (\n <ThreadMessageByChildren index={index}>\n {children}\n </ThreadMessageByChildren>\n );\n }\n return <ThreadMessageByIndex index={index} components={components!} />;\n },\n [components, children],\n );\n\n const keyExtractor = useCallback((item: ThreadMessage) => item.id, []);\n\n const scrollTracking =\n (autoScroll ?? true) ||\n (scrollToBottomOnInitialize ?? true) ||\n (scrollToBottomOnRunStart ?? true) ||\n (scrollToBottomOnThreadSwitch ?? true);\n\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n handleAutoScrollLayout(event);\n onLayout?.(event);\n },\n [handleAutoScrollLayout, onLayout],\n );\n\n const handleScroll = useCallback(\n (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n handleAutoScrollScroll(event);\n onScroll?.(event);\n },\n [handleAutoScrollScroll, onScroll],\n );\n\n const handleContentSizeChange = useCallback(\n (width: number, height: number) => {\n handleAutoScrollContentSizeChange(width, height);\n onContentSizeChange?.(width, height);\n },\n [handleAutoScrollContentSizeChange, onContentSizeChange],\n );\n\n return (\n <FlatList\n ref={setFlatListRef}\n data={messages as unknown as ThreadMessage[]}\n renderItem={renderItem}\n keyExtractor={keyExtractor}\n {...(scrollTracking\n ? {\n onContentSizeChange: handleContentSizeChange,\n onLayout: handleLayout,\n onScroll: handleScroll,\n scrollEventThrottle: scrollEventThrottle ?? 16,\n }\n : {\n ...(onContentSizeChange && { onContentSizeChange }),\n ...(onLayout && { onLayout }),\n ...(onScroll && { onScroll }),\n ...(scrollEventThrottle !== undefined && { scrollEventThrottle }),\n })}\n {...flatListProps}\n />\n );\n },\n);\nThreadMessagesFlatList.displayName = \"ThreadPrimitive.MessagesFlatList\";\n\n/** @deprecated Use ThreadPrimitive.MessagesFlatList instead. */\nexport const ThreadMessages = forwardRef<\n FlatList<ThreadMessage>,\n ThreadMessagesProps\n>(\n (\n {\n autoScroll = false,\n scrollToBottomOnInitialize = false,\n scrollToBottomOnRunStart = false,\n scrollToBottomOnThreadSwitch = false,\n ...props\n },\n ref,\n ) => (\n <ThreadMessagesFlatList\n ref={ref}\n autoScroll={autoScroll}\n scrollToBottomOnInitialize={scrollToBottomOnInitialize}\n scrollToBottomOnRunStart={scrollToBottomOnRunStart}\n scrollToBottomOnThreadSwitch={scrollToBottomOnThreadSwitch}\n {...props}\n />\n ),\n);\nThreadMessages.displayName = \"ThreadPrimitive.Messages\";\n"],"mappings":";;;;;;;AA0EA,MAAM0C,+BAA+B;AACrC,MAAMC,sBAAsB;AAE5B,MAAMC,gBACJb,YACAc,MACAC,cACG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AA,OAAAkB,OAAAlB,EAAA,OAAAZ,8BAAAY,EAAA,QAAAb,4BAAAa,EAAA,QAAAX,8BAAA;EAKtC2C,KAAA,oBAAC,wBAAD;GACOd;GACOhC;GACgBE;GACFD;GACIE;GAA4B,GACtDkH;EAAK,CAAA;EACTvG,EAAA,KAAAd;EAAAc,EAAA,KAAAuG;EAAAvG,EAAA,KAAAkB;EAAAlB,EAAA,KAAAZ;EAAAY,EAAA,MAAAb;EAAAa,EAAA,MAAAX;EAAAW,EAAA,MAAAgC;CAAA,OAAAA,KAAAhC,EAAA;CAAA,OAPFgC;AAOE,CAEN;AACAsE,eAAe3F,cAAc;AAhXyC,SAAAT,MAAAsG,GAAA;CAAA,OAGpCA,EAACzH,QAAQW;AAAK;AAHsB,SAAAS,OAAAsG,KAAA;CAAA,OAI/BD,IAACzH,QAAQ2H,SAAS/G;AAAU;AA4OjE,SAAAiG,OAAAY,GAAA;CAAA,OAgBsCA,EAAC1F,OAAO6E;AAAS;AAhBvD,SAAAQ,OAAAQ,MAAA;CAAA,OA6C4DA,KAAIC;AAAG"}
|
|
1
|
+
{"version":3,"file":"ThreadMessages.js","names":["ComponentType","FC","ForwardedRef","ReactNode","RefObject","forwardRef","memo","useCallback","useEffect","useRef","FlatList","FlatListProps","LayoutChangeEvent","NativeScrollEvent","NativeSyntheticEvent","MessageState","ThreadMessage","RenderChildrenWithAccessor","useAuiEvent","useAuiState","MessageByIndexProvider","MessageComponents","Message","EditComposer","UserEditComposer","AssistantEditComposer","SystemEditComposer","UserMessage","AssistantMessage","SystemMessage","MessagesContent","components","children","value","message","ThreadMessagesFlatListProps","Omit","autoScroll","scrollToBottomOnRunStart","scrollToBottomOnInitialize","scrollToBottomOnThreadSwitch","ThreadMessagesProps","DEFAULT_SYSTEM_MESSAGE","AT_BOTTOM_THRESHOLD","getComponent","role","isEditing","_exhaustiveCheck","Error","ThreadMessageComponent","t0","$","_c","_temp","_temp2","t1","Component","t2","ThreadMessageByIndex","index","prev","next","displayName","ThreadMessageByChildren","aui","thread","getState","getItem","setForwardedRef","ref","T","current","useComposedFlatListRef","forwardedRef","flatListRef","node","setFlatListRef","const","useThreadMessagesFlatListAutoScroll","hasMessages","horizontal","t3","t4","t5","undefined","t6","Symbol","for","contentHeight","viewportHeight","scrollY","metricsRef","isAtBottomRef","lastScrollEventOffsetRef","initializeScrollRequestedRef","contentSizeVersionRef","pendingScrollToBottomRef","t7","updateIsAtBottom","t8","animated","contentHeight_0","viewportHeight_0","offset","Math","max","scrollToOffset","scrollToBottom","t9","event","wasAtBottom","previousViewportHeight","viewportHeight_1","nativeEvent","layout","width","height","pending","minimumContentSizeVersion","handleLayout","t10","event_0","contentOffset","contentSize","layoutMeasurement","scrollOffset","x","y","previousEventOffset","wasPinnedToBottom","upwardMove","handleScroll","t11","metrics","contentHeight_1","previousContentHeight","wasAtBottom_0","pendingScroll","handleContentSizeChange","t12","t13","t14","t15","t16","ThreadMessagesFlatList","flatListProps","onContentSizeChange","onLayout","onScroll","scrollEventThrottle","messages","_temp3","length","handleAutoScrollContentSizeChange","handleAutoScrollLayout","handleAutoScrollScroll","renderItem","keyExtractor","_temp4","scrollTracking","minIndexForVisible","ThreadMessages","props","s","s_0","composer","item","id"],"sources":["../../../src/primitives/thread/ThreadMessages.tsx"],"sourcesContent":["import {\n type ComponentType,\n type FC,\n type ForwardedRef,\n type ReactNode,\n type RefObject,\n forwardRef,\n memo,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport {\n FlatList,\n type FlatListProps,\n type LayoutChangeEvent,\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n} from \"react-native\";\nimport type { MessageState, ThreadMessage } from \"@assistant-ui/core\";\nimport {\n RenderChildrenWithAccessor,\n useAuiEvent,\n useAuiState,\n} from \"@assistant-ui/store\";\nimport { MessageByIndexProvider } from \"@assistant-ui/core/react\";\n\ntype MessageComponents =\n | {\n Message: ComponentType;\n EditComposer?: ComponentType | undefined;\n UserEditComposer?: ComponentType | undefined;\n AssistantEditComposer?: ComponentType | undefined;\n SystemEditComposer?: ComponentType | undefined;\n UserMessage?: ComponentType | undefined;\n AssistantMessage?: ComponentType | undefined;\n SystemMessage?: ComponentType | undefined;\n }\n | {\n Message?: ComponentType | undefined;\n EditComposer?: ComponentType | undefined;\n UserEditComposer?: ComponentType | undefined;\n AssistantEditComposer?: ComponentType | undefined;\n SystemEditComposer?: ComponentType | undefined;\n UserMessage: ComponentType;\n AssistantMessage: ComponentType;\n SystemMessage?: ComponentType | undefined;\n };\n\ntype MessagesContent =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessageComponents;\n children?: never;\n }\n | {\n children: (value: { message: MessageState }) => ReactNode;\n components?: never;\n };\n\nexport type ThreadMessagesFlatListProps = Omit<\n FlatListProps<ThreadMessage>,\n \"data\" | \"renderItem\" | \"children\"\n> &\n MessagesContent & {\n autoScroll?: boolean | undefined;\n scrollToBottomOnRunStart?: boolean | undefined;\n scrollToBottomOnInitialize?: boolean | undefined;\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n };\n\n/** @deprecated Use ThreadMessagesFlatListProps instead. */\nexport type ThreadMessagesProps = ThreadMessagesFlatListProps;\n\nconst DEFAULT_SYSTEM_MESSAGE = () => null;\nconst AT_BOTTOM_THRESHOLD = 4;\n\nconst getComponent = (\n components: MessageComponents,\n role: ThreadMessage[\"role\"],\n isEditing: boolean,\n) => {\n switch (role) {\n case \"user\":\n if (isEditing) {\n return (\n components.UserEditComposer ??\n components.EditComposer ??\n components.UserMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return components.UserMessage ?? (components.Message as ComponentType);\n }\n case \"assistant\":\n if (isEditing) {\n return (\n components.AssistantEditComposer ??\n components.EditComposer ??\n components.AssistantMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.AssistantMessage ?? (components.Message as ComponentType)\n );\n }\n case \"system\":\n if (isEditing) {\n return (\n components.SystemEditComposer ??\n components.EditComposer ??\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n } else {\n return (\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unknown message role: ${_exhaustiveCheck}`);\n }\n }\n};\n\nconst ThreadMessageComponent: FC<{ components: MessageComponents }> = ({\n components,\n}) => {\n const role = useAuiState((s) => s.message.role);\n const isEditing = useAuiState((s) => s.message.composer.isEditing);\n const Component = getComponent(components, role, isEditing);\n\n return <Component />;\n};\n\nconst ThreadMessageByIndex = memo(\n ({ index, components }: { index: number; components: MessageComponents }) => {\n return (\n <MessageByIndexProvider index={index}>\n <ThreadMessageComponent components={components} />\n </MessageByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index && prev.components === next.components,\n);\nThreadMessageByIndex.displayName = \"ThreadPrimitive.MessageByIndex\";\n\nconst ThreadMessageByChildren = memo(\n ({\n index,\n children,\n }: {\n index: number;\n children: (value: { message: MessageState }) => ReactNode;\n }) => {\n return (\n <MessageByIndexProvider index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.thread.message({ index }).getState()}\n >\n {(getItem) =>\n children({\n get message() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageByIndexProvider>\n );\n },\n (prev, next) => prev.index === next.index && prev.children === next.children,\n);\nThreadMessageByChildren.displayName = \"ThreadPrimitive.MessageByChildren\";\n\nconst setForwardedRef = <T,>(ref: ForwardedRef<T>, value: T | null) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nconst useComposedFlatListRef = (\n forwardedRef: ForwardedRef<FlatList<ThreadMessage>>,\n) => {\n const flatListRef = useRef<FlatList<ThreadMessage> | null>(null);\n\n const setFlatListRef = useCallback(\n (node: FlatList<ThreadMessage> | null) => {\n flatListRef.current = node;\n setForwardedRef(forwardedRef, node);\n },\n [forwardedRef],\n );\n\n return [flatListRef, setFlatListRef] as const;\n};\n\nconst useThreadMessagesFlatListAutoScroll = ({\n flatListRef,\n hasMessages,\n horizontal = false,\n autoScroll = true,\n scrollToBottomOnRunStart = true,\n scrollToBottomOnInitialize = true,\n scrollToBottomOnThreadSwitch = true,\n}: {\n flatListRef: RefObject<FlatList<ThreadMessage> | null>;\n hasMessages: boolean;\n horizontal?: boolean | null | undefined;\n autoScroll?: boolean | undefined;\n scrollToBottomOnRunStart?: boolean | undefined;\n scrollToBottomOnInitialize?: boolean | undefined;\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n}) => {\n const metricsRef = useRef({\n contentHeight: 0,\n viewportHeight: 0,\n scrollY: 0,\n });\n const isAtBottomRef = useRef(true);\n const lastScrollEventOffsetRef = useRef(0);\n const initializeScrollRequestedRef = useRef(false);\n const contentSizeVersionRef = useRef(0);\n const pendingScrollToBottomRef = useRef<\n | false\n | {\n animated: boolean;\n minimumContentSizeVersion: number;\n }\n >(false);\n\n const updateIsAtBottom = useCallback(() => {\n const { contentHeight, scrollY, viewportHeight } = metricsRef.current;\n isAtBottomRef.current =\n contentHeight <= viewportHeight ||\n contentHeight - scrollY - viewportHeight <= AT_BOTTOM_THRESHOLD;\n }, []);\n\n // Commanding a scroll records the intended position immediately; the\n // native scroll echo is bridged and throttled, so waiting for it lets a\n // fast stream observe stale metrics and drop out of following.\n const scrollToBottom = useCallback(\n (animated: boolean) => {\n const { contentHeight, viewportHeight } = metricsRef.current;\n const offset = Math.max(0, contentHeight - viewportHeight);\n metricsRef.current.scrollY = offset;\n isAtBottomRef.current = true;\n flatListRef.current?.scrollToOffset({ offset, animated });\n },\n [flatListRef],\n );\n\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n const wasAtBottom = isAtBottomRef.current;\n const previousViewportHeight = metricsRef.current.viewportHeight;\n const viewportHeight = horizontal\n ? event.nativeEvent.layout.width\n : event.nativeEvent.layout.height;\n metricsRef.current.viewportHeight = viewportHeight;\n updateIsAtBottom();\n const pending = pendingScrollToBottomRef.current;\n if (\n pending &&\n contentSizeVersionRef.current >= pending.minimumContentSizeVersion &&\n viewportHeight > 0\n ) {\n pendingScrollToBottomRef.current = false;\n scrollToBottom(pending.animated);\n return;\n }\n if (!wasAtBottom) return;\n // Layout changes are never user gestures, so they must not unpin. Past\n // the first measurement, a viewport change while pinned re-commands the\n // bottom position, since no content-size event follows a bare keyboard\n // open or close.\n if (\n autoScroll &&\n previousViewportHeight !== 0 &&\n viewportHeight !== previousViewportHeight\n ) {\n scrollToBottom(pending ? pending.animated : false);\n } else {\n isAtBottomRef.current = true;\n }\n },\n [autoScroll, horizontal, scrollToBottom, updateIsAtBottom],\n );\n\n const handleScroll = useCallback(\n (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n const { contentOffset, contentSize, layoutMeasurement } =\n event.nativeEvent;\n const scrollOffset = horizontal ? contentOffset.x : contentOffset.y;\n const previousEventOffset = lastScrollEventOffsetRef.current;\n const wasPinnedToBottom = isAtBottomRef.current;\n lastScrollEventOffsetRef.current = scrollOffset;\n metricsRef.current = {\n contentHeight: horizontal ? contentSize.width : contentSize.height,\n viewportHeight: horizontal\n ? layoutMeasurement.width\n : layoutMeasurement.height,\n scrollY: scrollOffset,\n };\n updateIsAtBottom();\n const upwardMove = scrollOffset < previousEventOffset;\n // Only a deliberate upward move unpins or cancels a pending scroll.\n // Gestures are detected echo-to-echo because a commanded scroll\n // optimistically moves the tracked position ahead of its ascending\n // animation echoes, and those echoes must not unpin mid-flight.\n if (wasPinnedToBottom && !upwardMove) {\n isAtBottomRef.current = true;\n }\n if (!isAtBottomRef.current && upwardMove) {\n pendingScrollToBottomRef.current = false;\n }\n },\n [horizontal, updateIsAtBottom],\n );\n\n const handleContentSizeChange = useCallback(\n (width: number, height: number) => {\n const metrics = metricsRef.current;\n const contentHeight = horizontal ? width : height;\n const previousContentHeight = metrics.contentHeight;\n const wasAtBottom = isAtBottomRef.current;\n if (contentHeight > 0) contentSizeVersionRef.current += 1;\n metrics.contentHeight = contentHeight;\n updateIsAtBottom();\n\n // Initialize and thread-switch requests are repeated after the list has\n // measured so the explicit bottom offset uses real content metrics.\n const pendingScroll = pendingScrollToBottomRef.current;\n if (\n pendingScroll &&\n contentSizeVersionRef.current >=\n pendingScroll.minimumContentSizeVersion &&\n metrics.viewportHeight > 0\n ) {\n pendingScrollToBottomRef.current = false;\n scrollToBottom(pendingScroll.animated);\n return;\n }\n\n if (!autoScroll) return;\n if (!wasAtBottom) return;\n if (previousContentHeight === 0) return;\n if (contentHeight <= previousContentHeight) return;\n\n scrollToBottom(false);\n },\n [autoScroll, horizontal, scrollToBottom, updateIsAtBottom],\n );\n\n useEffect(() => {\n if (!scrollToBottomOnInitialize) return;\n if (!hasMessages) {\n initializeScrollRequestedRef.current = false;\n return;\n }\n if (initializeScrollRequestedRef.current) return;\n\n initializeScrollRequestedRef.current = true;\n pendingScrollToBottomRef.current = {\n animated: false,\n minimumContentSizeVersion: Math.max(1, contentSizeVersionRef.current),\n };\n scrollToBottom(false);\n }, [hasMessages, scrollToBottom, scrollToBottomOnInitialize]);\n\n useAuiEvent(\"thread.runStart\", () => {\n if (!scrollToBottomOnRunStart) return;\n pendingScrollToBottomRef.current = {\n animated: true,\n minimumContentSizeVersion: contentSizeVersionRef.current + 1,\n };\n scrollToBottom(true);\n });\n\n useAuiEvent(\"threads.selectionChanged\", () => {\n if (!scrollToBottomOnThreadSwitch) return;\n initializeScrollRequestedRef.current = false;\n lastScrollEventOffsetRef.current = 0;\n pendingScrollToBottomRef.current = {\n animated: false,\n minimumContentSizeVersion: contentSizeVersionRef.current + 1,\n };\n scrollToBottom(false);\n });\n\n return {\n handleLayout,\n handleScroll,\n handleContentSizeChange,\n };\n};\n\nexport const ThreadMessagesFlatList = forwardRef<\n FlatList<ThreadMessage>,\n ThreadMessagesFlatListProps\n>(\n (\n {\n autoScroll,\n components,\n children,\n onContentSizeChange,\n onLayout,\n onScroll,\n scrollEventThrottle,\n scrollToBottomOnInitialize,\n scrollToBottomOnRunStart,\n scrollToBottomOnThreadSwitch,\n ...flatListProps\n },\n forwardedRef,\n ) => {\n const messages = useAuiState((s) => s.thread.messages);\n const [flatListRef, setFlatListRef] = useComposedFlatListRef(forwardedRef);\n const {\n handleContentSizeChange: handleAutoScrollContentSizeChange,\n handleLayout: handleAutoScrollLayout,\n handleScroll: handleAutoScrollScroll,\n } = useThreadMessagesFlatListAutoScroll({\n flatListRef,\n hasMessages: messages.length > 0,\n horizontal: flatListProps.horizontal,\n autoScroll,\n scrollToBottomOnInitialize,\n scrollToBottomOnRunStart,\n scrollToBottomOnThreadSwitch,\n });\n\n const renderItem = useCallback(\n ({ index }: { item: ThreadMessage; index: number }) => {\n if (children) {\n return (\n <ThreadMessageByChildren index={index}>\n {children}\n </ThreadMessageByChildren>\n );\n }\n return <ThreadMessageByIndex index={index} components={components!} />;\n },\n [components, children],\n );\n\n const keyExtractor = useCallback((item: ThreadMessage) => item.id, []);\n\n const scrollTracking =\n (autoScroll ?? true) ||\n (scrollToBottomOnInitialize ?? true) ||\n (scrollToBottomOnRunStart ?? true) ||\n (scrollToBottomOnThreadSwitch ?? true);\n\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n handleAutoScrollLayout(event);\n onLayout?.(event);\n },\n [handleAutoScrollLayout, onLayout],\n );\n\n const handleScroll = useCallback(\n (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n handleAutoScrollScroll(event);\n onScroll?.(event);\n },\n [handleAutoScrollScroll, onScroll],\n );\n\n const handleContentSizeChange = useCallback(\n (width: number, height: number) => {\n handleAutoScrollContentSizeChange(width, height);\n onContentSizeChange?.(width, height);\n },\n [handleAutoScrollContentSizeChange, onContentSizeChange],\n );\n\n return (\n <FlatList\n ref={setFlatListRef}\n data={messages as unknown as ThreadMessage[]}\n renderItem={renderItem}\n keyExtractor={keyExtractor}\n maintainVisibleContentPosition={{ minIndexForVisible: 0 }}\n {...(scrollTracking\n ? {\n onContentSizeChange: handleContentSizeChange,\n onLayout: handleLayout,\n onScroll: handleScroll,\n scrollEventThrottle: scrollEventThrottle ?? 16,\n }\n : {\n ...(onContentSizeChange && { onContentSizeChange }),\n ...(onLayout && { onLayout }),\n ...(onScroll && { onScroll }),\n ...(scrollEventThrottle !== undefined && { scrollEventThrottle }),\n })}\n {...flatListProps}\n />\n );\n },\n);\nThreadMessagesFlatList.displayName = \"ThreadPrimitive.MessagesFlatList\";\n\n/** @deprecated Use ThreadPrimitive.MessagesFlatList instead. */\nexport const ThreadMessages = forwardRef<\n FlatList<ThreadMessage>,\n ThreadMessagesProps\n>(\n (\n {\n autoScroll = false,\n scrollToBottomOnInitialize = false,\n scrollToBottomOnRunStart = false,\n scrollToBottomOnThreadSwitch = false,\n ...props\n },\n ref,\n ) => (\n <ThreadMessagesFlatList\n ref={ref}\n autoScroll={autoScroll}\n scrollToBottomOnInitialize={scrollToBottomOnInitialize}\n scrollToBottomOnRunStart={scrollToBottomOnRunStart}\n scrollToBottomOnThreadSwitch={scrollToBottomOnThreadSwitch}\n {...props}\n />\n ),\n);\nThreadMessages.displayName = \"ThreadPrimitive.Messages\";\n"],"mappings":";;;;;;;AA0EA,MAAM0C,+BAA+B;AACrC,MAAMC,sBAAsB;AAE5B,MAAMC,gBACJb,YACAc,MACAC,cACG;CACH,QAAQD,MAAR;EACE,KAAK,QACH,IAAIC,WACF,OACEf,WAAWP,oBACXO,WAAWR,gBACXQ,WAAWJ,eACVI,WAAWT;OAGd,OAAOS,WAAWJ,eAAgBI,WAAWT;EAEjD,KAAK,aACH,IAAIwB,WACF,OACEf,WAAWN,yBACXM,WAAWR,gBACXQ,WAAWH,oBACVG,WAAWT;OAGd,OACES,WAAWH,oBAAqBG,WAAWT;EAGjD,KAAK,UACH,IAAIwB,WACF,OACEf,WAAWL,sBACXK,WAAWR,gBACXQ,WAAWF,iBACVE,WAAWT,WACZoB;OAGF,OACEX,WAAWF,iBACVE,WAAWT,WACZoB;EAGN,SAEE,MAAM,IAAIM,MAAM,yBAAyBD,MAAkB;CAE/D;AACF;AAEA,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