@lvce-editor/chat-debug-view 10.13.0 → 10.15.0
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/chatDebugViewWorkerMain.js +108 -77
- package/package.json +1 -1
|
@@ -2232,6 +2232,10 @@ const getEventsWithTime = events => {
|
|
|
2232
2232
|
});
|
|
2233
2233
|
};
|
|
2234
2234
|
|
|
2235
|
+
const clamp$1 = (value, minimum, maximum) => {
|
|
2236
|
+
return Math.max(minimum, Math.min(value, maximum));
|
|
2237
|
+
};
|
|
2238
|
+
|
|
2235
2239
|
const parseTimelineSeconds = value => {
|
|
2236
2240
|
const trimmed = value.trim();
|
|
2237
2241
|
if (!trimmed) {
|
|
@@ -2260,8 +2264,10 @@ const getNormalizedRange = (durationSeconds, startValue, endValue) => {
|
|
|
2260
2264
|
}
|
|
2261
2265
|
const rawStart = parsedStart ?? 0;
|
|
2262
2266
|
const rawEnd = parsedEnd ?? durationSeconds;
|
|
2263
|
-
const
|
|
2264
|
-
const
|
|
2267
|
+
const rangeStart = Math.min(rawStart, rawEnd);
|
|
2268
|
+
const rangeEnd = Math.max(rawStart, rawEnd);
|
|
2269
|
+
const normalizedStart = clamp$1(rangeStart, 0, durationSeconds);
|
|
2270
|
+
const normalizedEnd = clamp$1(rangeEnd, 0, durationSeconds);
|
|
2265
2271
|
return {
|
|
2266
2272
|
endSeconds: roundSeconds(normalizedEnd),
|
|
2267
2273
|
hasSelection: true,
|
|
@@ -3129,11 +3135,8 @@ const withPreparedSelectedEventPreview = async event => {
|
|
|
3129
3135
|
return setSelectedEventPreview(event, preview);
|
|
3130
3136
|
};
|
|
3131
3137
|
|
|
3132
|
-
const selectEventAtIndexDependencies = {
|
|
3133
|
-
loadSelectedEvent: loadSelectedEvent
|
|
3134
|
-
};
|
|
3135
3138
|
const getCurrentEvents$1 = state => getCurrentEvents$2(state);
|
|
3136
|
-
const selectEventAtIndex = async (state, selectedEventIndex,
|
|
3139
|
+
const selectEventAtIndex = async (state, selectedEventIndex, loadSelectedEvent$1 = loadSelectedEvent) => {
|
|
3137
3140
|
const {
|
|
3138
3141
|
databaseName,
|
|
3139
3142
|
dataBaseVersion,
|
|
@@ -3161,7 +3164,7 @@ const selectEventAtIndex = async (state, selectedEventIndex, dependencies = sele
|
|
|
3161
3164
|
selectedEventIndex
|
|
3162
3165
|
};
|
|
3163
3166
|
}
|
|
3164
|
-
const selectedEventDetails = await
|
|
3167
|
+
const selectedEventDetails = await loadSelectedEvent$1(databaseName, dataBaseVersion, eventStoreName, sessionId, sessionIdIndexName, selectedEvent.eventId, selectedEvent.type);
|
|
3165
3168
|
const resolvedSelectedEvent = await withPreparedSelectedEventPreview(mergeSelectedEventDetails(selectedEvent, selectedEventDetails));
|
|
3166
3169
|
return withSelectedEventVisible({
|
|
3167
3170
|
...state,
|
|
@@ -3268,7 +3271,10 @@ const getMenuEntriesTableHeader = state => {
|
|
|
3268
3271
|
|
|
3269
3272
|
const MenuChatDebugTableHeader = 2189;
|
|
3270
3273
|
const handleHeaderContextMenu = async (state, eventX, eventY) => {
|
|
3271
|
-
|
|
3274
|
+
const {
|
|
3275
|
+
uid
|
|
3276
|
+
} = state;
|
|
3277
|
+
await showContextMenu2(uid, MenuChatDebugTableHeader, eventX, eventY, {
|
|
3272
3278
|
menuId: MenuChatDebugTableHeader
|
|
3273
3279
|
});
|
|
3274
3280
|
return state;
|
|
@@ -3798,13 +3804,10 @@ const handleEventCategoryFilter$1 = (state, value, ctrlKey = false, metaKey = fa
|
|
|
3798
3804
|
return withPreservedSelection$1(state, nextState);
|
|
3799
3805
|
};
|
|
3800
3806
|
|
|
3801
|
-
const handleEventRowClickDependencies = {
|
|
3802
|
-
loadSelectedEvent: loadSelectedEvent
|
|
3803
|
-
};
|
|
3804
3807
|
const isPrimaryButton = button => {
|
|
3805
3808
|
return button === 0;
|
|
3806
3809
|
};
|
|
3807
|
-
const handleEventRowClick = async (state, index, button = 0) => {
|
|
3810
|
+
const handleEventRowClick = async (state, index, button = 0, loadSelectedEvent) => {
|
|
3808
3811
|
const actual = typeof index === 'string' ? Number.parseInt(index, 10) : index;
|
|
3809
3812
|
if (!isPrimaryButton(button)) {
|
|
3810
3813
|
return state;
|
|
@@ -3812,12 +3815,12 @@ const handleEventRowClick = async (state, index, button = 0) => {
|
|
|
3812
3815
|
if (actual === -1) {
|
|
3813
3816
|
return state;
|
|
3814
3817
|
}
|
|
3815
|
-
return selectEventAtIndex(state, actual,
|
|
3818
|
+
return selectEventAtIndex(state, actual, loadSelectedEvent);
|
|
3816
3819
|
};
|
|
3817
3820
|
|
|
3818
|
-
const handleEventRowClickAt = async (state, eventX, eventY, button = 0) => {
|
|
3821
|
+
const handleEventRowClickAt = async (state, eventX, eventY, button = 0, loadSelectedEvent) => {
|
|
3819
3822
|
const selectedEventIndex = getTableBodyEventIndex(state, eventX, eventY);
|
|
3820
|
-
return handleEventRowClick(state, selectedEventIndex, button);
|
|
3823
|
+
return handleEventRowClick(state, selectedEventIndex, button, loadSelectedEvent);
|
|
3821
3824
|
};
|
|
3822
3825
|
|
|
3823
3826
|
const getBoolean = value => {
|
|
@@ -4472,16 +4475,22 @@ const handlePreviewTextScrollBarPointerDown = (state, eventY) => {
|
|
|
4472
4475
|
};
|
|
4473
4476
|
|
|
4474
4477
|
const handlePreviewTextScrollBarPointerMove = (state, eventY) => {
|
|
4475
|
-
|
|
4478
|
+
const {
|
|
4479
|
+
previewTextDeltaY,
|
|
4480
|
+
previewTextScrollBarHandleOffset,
|
|
4481
|
+
previewTextScrollBarPointerActive,
|
|
4482
|
+
selectedEvent
|
|
4483
|
+
} = state;
|
|
4484
|
+
if (!previewTextScrollBarPointerActive) {
|
|
4476
4485
|
return state;
|
|
4477
4486
|
}
|
|
4478
4487
|
const viewportHeight = getPreviewTextViewportHeight(state);
|
|
4479
|
-
const virtualization = getPreviewVirtualizationState(
|
|
4488
|
+
const virtualization = getPreviewVirtualizationState(selectedEvent, viewportHeight, previewTextDeltaY);
|
|
4480
4489
|
if (viewportHeight === 0 || virtualization.scrollBarHeight === 0) {
|
|
4481
4490
|
return state;
|
|
4482
4491
|
}
|
|
4483
4492
|
const relativeY = eventY - getPreviewTextBodyY(state);
|
|
4484
|
-
const nextHandleTop = Math.max(0, Math.min(viewportHeight - virtualization.scrollBarHeight, relativeY -
|
|
4493
|
+
const nextHandleTop = Math.max(0, Math.min(viewportHeight - virtualization.scrollBarHeight, relativeY - previewTextScrollBarHandleOffset));
|
|
4485
4494
|
const percent = nextHandleTop / Math.max(1, viewportHeight - virtualization.scrollBarHeight);
|
|
4486
4495
|
const nextState = setPreviewTextDeltaY(state, percent * virtualization.maxDeltaY);
|
|
4487
4496
|
return {
|
|
@@ -4502,7 +4511,10 @@ const handlePreviewTextScrollBarPointerUp = state => {
|
|
|
4502
4511
|
};
|
|
4503
4512
|
|
|
4504
4513
|
const handlePreviewTextWheel = (state, deltaY) => {
|
|
4505
|
-
|
|
4514
|
+
const {
|
|
4515
|
+
previewTextDeltaY
|
|
4516
|
+
} = state;
|
|
4517
|
+
return setPreviewTextDeltaY(state, previewTextDeltaY + deltaY);
|
|
4506
4518
|
};
|
|
4507
4519
|
|
|
4508
4520
|
const handleRootContextMenu = state => {
|
|
@@ -5782,6 +5794,7 @@ const getFilterInputDom = (filterValue, useDevtoolsLayout) => {
|
|
|
5782
5794
|
};
|
|
5783
5795
|
};
|
|
5784
5796
|
|
|
5797
|
+
const selectedClassName = mergeClassNames(ChatDebugViewQuickFilterPill, ChatDebugViewQuickFilterPillSelected);
|
|
5785
5798
|
const getQuickFilterDom = categoryFilter => {
|
|
5786
5799
|
const {
|
|
5787
5800
|
isSelected,
|
|
@@ -5791,7 +5804,7 @@ const getQuickFilterDom = categoryFilter => {
|
|
|
5791
5804
|
return [{
|
|
5792
5805
|
ariaSelected: isSelected,
|
|
5793
5806
|
childCount: 1,
|
|
5794
|
-
className:
|
|
5807
|
+
className: isSelected ? selectedClassName : ChatDebugViewQuickFilterPill,
|
|
5795
5808
|
name,
|
|
5796
5809
|
onClick: HandleEventCategoryFilter,
|
|
5797
5810
|
role: Option,
|
|
@@ -5841,6 +5854,19 @@ const getDebugViewTopDom = (filterValue, useDevtoolsLayout, categoryFilters) =>
|
|
|
5841
5854
|
}, getFilterInputDom(filterValue, false), ...refreshButtonDom];
|
|
5842
5855
|
};
|
|
5843
5856
|
|
|
5857
|
+
const createDevtoolsRows = (events, selectedEventIndex, startIndex = 0) => {
|
|
5858
|
+
return events.map((event, index) => {
|
|
5859
|
+
const actualIndex = startIndex + index;
|
|
5860
|
+
return {
|
|
5861
|
+
event,
|
|
5862
|
+
index: actualIndex,
|
|
5863
|
+
isErrorStatus: hasErrorStatus(event),
|
|
5864
|
+
isEven: actualIndex % 2 === 1,
|
|
5865
|
+
isSelected: selectedEventIndex === actualIndex
|
|
5866
|
+
};
|
|
5867
|
+
});
|
|
5868
|
+
};
|
|
5869
|
+
|
|
5844
5870
|
const getNextSiblingIndex$2 = (nodes, index) => {
|
|
5845
5871
|
let nextSiblingIndex = index + 1;
|
|
5846
5872
|
const childCount = nodes[index]?.childCount || 0;
|
|
@@ -6910,12 +6936,15 @@ const getTextNode = (value, showLineNumbers = true, cursor = null, tokenSegments
|
|
|
6910
6936
|
return getEditorDom(lineData, showLineNumbers, cursor, showLineNumbers ? HandlePreviewTextPointerDown : undefined);
|
|
6911
6937
|
};
|
|
6912
6938
|
|
|
6939
|
+
const getTextEvent = (previewEvent, selectedEvent, previewTextCursor, virtualization) => {
|
|
6940
|
+
const isInvalidImageMessage = previewEvent === ImageCouldNotBeLoaded;
|
|
6941
|
+
const isChatMessageUpdatedPreview = !!selectedEvent && isChatMessageUpdatedEvent(selectedEvent);
|
|
6942
|
+
const showLineNumbers = !isInvalidImageMessage && !isChatMessageUpdatedPreview;
|
|
6943
|
+
return getTextNode(previewEvent, showLineNumbers, showLineNumbers ? previewTextCursor ?? null : null, undefined, virtualization);
|
|
6944
|
+
};
|
|
6913
6945
|
const getPreviewEventNodes = (previewEvent, selectedEvent, previewTextCursor, virtualization) => {
|
|
6914
6946
|
if (typeof previewEvent === 'string') {
|
|
6915
|
-
|
|
6916
|
-
const isChatMessageUpdatedPreview = !!selectedEvent && isChatMessageUpdatedEvent(selectedEvent);
|
|
6917
|
-
const showLineNumbers = !isInvalidImageMessage && !isChatMessageUpdatedPreview;
|
|
6918
|
-
return getTextNode(previewEvent, showLineNumbers, showLineNumbers ? previewTextCursor ?? null : null, undefined, virtualization);
|
|
6947
|
+
return getTextEvent(previewEvent, selectedEvent, previewTextCursor, virtualization);
|
|
6919
6948
|
}
|
|
6920
6949
|
if (isWriteFilePreview(previewEvent)) {
|
|
6921
6950
|
const language = getLanguageFromFileExtension(previewEvent.uri);
|
|
@@ -7161,52 +7190,51 @@ const getEventTableMethodLabel = event => {
|
|
|
7161
7190
|
return '';
|
|
7162
7191
|
};
|
|
7163
7192
|
|
|
7193
|
+
const getTableCellDom = (column, event, isErrorStatus) => {
|
|
7194
|
+
switch (column) {
|
|
7195
|
+
case Duration:
|
|
7196
|
+
return [{
|
|
7197
|
+
childCount: 1,
|
|
7198
|
+
className: mergeClassNames(TableCell, ChatDebugViewCellDuration),
|
|
7199
|
+
type: Td
|
|
7200
|
+
}, text(getEventTableDurationText(event))];
|
|
7201
|
+
case Method:
|
|
7202
|
+
return [{
|
|
7203
|
+
childCount: 1,
|
|
7204
|
+
className: TableCell,
|
|
7205
|
+
type: Td
|
|
7206
|
+
}, text(getEventTableMethodLabel(event))];
|
|
7207
|
+
case Status$1:
|
|
7208
|
+
return [{
|
|
7209
|
+
childCount: 1,
|
|
7210
|
+
className: mergeClassNames(TableCell, isErrorStatus ? ChatDebugViewCellStatusError : ''),
|
|
7211
|
+
type: Td
|
|
7212
|
+
}, text(getStatusText(event))];
|
|
7213
|
+
case Type:
|
|
7214
|
+
return [{
|
|
7215
|
+
childCount: 1,
|
|
7216
|
+
className: TableCell,
|
|
7217
|
+
type: Td
|
|
7218
|
+
}, text(getEventTableTypeLabel(event))];
|
|
7219
|
+
default:
|
|
7220
|
+
return [];
|
|
7221
|
+
}
|
|
7222
|
+
};
|
|
7164
7223
|
const getRowCellNodes = (event, isErrorStatus, visibleTableColumns) => {
|
|
7165
7224
|
const orderedVisibleTableColumns = getOrderedVisibleTableColumns(visibleTableColumns);
|
|
7166
|
-
return orderedVisibleTableColumns.flatMap(
|
|
7167
|
-
|
|
7168
|
-
case Duration:
|
|
7169
|
-
return [{
|
|
7170
|
-
childCount: 1,
|
|
7171
|
-
className: mergeClassNames(TableCell, ChatDebugViewCellDuration),
|
|
7172
|
-
type: Td
|
|
7173
|
-
}, text(getEventTableDurationText(event))];
|
|
7174
|
-
case Method:
|
|
7175
|
-
return [{
|
|
7176
|
-
childCount: 1,
|
|
7177
|
-
className: TableCell,
|
|
7178
|
-
type: Td
|
|
7179
|
-
}, text(getEventTableMethodLabel(event))];
|
|
7180
|
-
case Status$1:
|
|
7181
|
-
return [{
|
|
7182
|
-
childCount: 1,
|
|
7183
|
-
className: mergeClassNames(TableCell, isErrorStatus ? ChatDebugViewCellStatusError : ''),
|
|
7184
|
-
type: Td
|
|
7185
|
-
}, text(getStatusText(event))];
|
|
7186
|
-
case Type:
|
|
7187
|
-
return [{
|
|
7188
|
-
childCount: 1,
|
|
7189
|
-
className: TableCell,
|
|
7190
|
-
type: Td
|
|
7191
|
-
}, text(getEventTableTypeLabel(event))];
|
|
7192
|
-
default:
|
|
7193
|
-
return [];
|
|
7194
|
-
}
|
|
7225
|
+
return orderedVisibleTableColumns.flatMap(column => {
|
|
7226
|
+
return getTableCellDom(column, event, isErrorStatus);
|
|
7195
7227
|
});
|
|
7196
7228
|
};
|
|
7197
7229
|
|
|
7198
|
-
const getDevtoolsRows = (
|
|
7199
|
-
return
|
|
7200
|
-
const
|
|
7201
|
-
const
|
|
7202
|
-
const rowClassName = isEvenRow ? TableRowEven : TableRowOdd;
|
|
7203
|
-
const isSelected = selectedEventIndex === actualIndex;
|
|
7204
|
-
const isErrorStatus = hasErrorStatus(event);
|
|
7205
|
-
const rowCellNodes = getRowCellNodes(event, isErrorStatus, visibleTableColumns);
|
|
7230
|
+
const getDevtoolsRows = (rows, visibleTableColumns = defaultVisibleTableColumns) => {
|
|
7231
|
+
return rows.flatMap(row => {
|
|
7232
|
+
const rowClassName = row.isEven ? TableRowEven : TableRowOdd;
|
|
7233
|
+
const rowCellNodes = getRowCellNodes(row.event, row.isErrorStatus, visibleTableColumns);
|
|
7206
7234
|
return [{
|
|
7207
7235
|
childCount: visibleTableColumns.length,
|
|
7208
|
-
className: mergeClassNames(TableRow, rowClassName, isSelected ? TableRowSelected : ''),
|
|
7209
|
-
'data-index': `${
|
|
7236
|
+
className: mergeClassNames(TableRow, rowClassName, row.isSelected ? TableRowSelected : ''),
|
|
7237
|
+
'data-index': `${row.index}`,
|
|
7210
7238
|
type: Tr
|
|
7211
7239
|
}, ...rowCellNodes];
|
|
7212
7240
|
});
|
|
@@ -7529,6 +7557,20 @@ const formatPercent = value => {
|
|
|
7529
7557
|
return `${Number(value.toFixed(3))}%`;
|
|
7530
7558
|
};
|
|
7531
7559
|
|
|
7560
|
+
const startHandle = {
|
|
7561
|
+
childCount: 0,
|
|
7562
|
+
className: mergeClassNames(ChatDebugViewTimelineSelectionHandle, ChatDebugViewTimelineSelectionHandleStart, ChatDebugViewTimelineSelectionMarker, ChatDebugViewTimelineSelectionMarkerStart),
|
|
7563
|
+
name: Start,
|
|
7564
|
+
role: None,
|
|
7565
|
+
type: Button$1
|
|
7566
|
+
};
|
|
7567
|
+
const endHandle = {
|
|
7568
|
+
childCount: 0,
|
|
7569
|
+
className: mergeClassNames(ChatDebugViewTimelineSelectionHandle, ChatDebugViewTimelineSelectionHandleEnd, ChatDebugViewTimelineSelectionMarker, ChatDebugViewTimelineSelectionMarkerEnd),
|
|
7570
|
+
name: End,
|
|
7571
|
+
role: None,
|
|
7572
|
+
type: Button$1
|
|
7573
|
+
};
|
|
7532
7574
|
const getSelectionNodesDom = (hasSelection, selectionStartPercent, selectionEndPercent) => {
|
|
7533
7575
|
if (!hasSelection || selectionStartPercent === null || selectionEndPercent === null) {
|
|
7534
7576
|
return [];
|
|
@@ -7538,19 +7580,7 @@ const getSelectionNodesDom = (hasSelection, selectionStartPercent, selectionEndP
|
|
|
7538
7580
|
className: ChatDebugViewTimelineSelectionRange,
|
|
7539
7581
|
style: `left:${formatPercent(selectionStartPercent)};width:${formatPercent(selectionEndPercent - selectionStartPercent)};`,
|
|
7540
7582
|
type: Div
|
|
7541
|
-
},
|
|
7542
|
-
childCount: 0,
|
|
7543
|
-
className: mergeClassNames(ChatDebugViewTimelineSelectionHandle, ChatDebugViewTimelineSelectionHandleStart, ChatDebugViewTimelineSelectionMarker, ChatDebugViewTimelineSelectionMarkerStart),
|
|
7544
|
-
name: Start,
|
|
7545
|
-
role: None,
|
|
7546
|
-
type: Button$1
|
|
7547
|
-
}, {
|
|
7548
|
-
childCount: 0,
|
|
7549
|
-
className: mergeClassNames(ChatDebugViewTimelineSelectionHandle, ChatDebugViewTimelineSelectionHandleEnd, ChatDebugViewTimelineSelectionMarker, ChatDebugViewTimelineSelectionMarkerEnd),
|
|
7550
|
-
name: End,
|
|
7551
|
-
role: None,
|
|
7552
|
-
type: Button$1
|
|
7553
|
-
}];
|
|
7583
|
+
}, startHandle, endHandle];
|
|
7554
7584
|
};
|
|
7555
7585
|
|
|
7556
7586
|
const getTimelineBadgeValues = durationSeconds => {
|
|
@@ -7639,7 +7669,8 @@ const getTimelineDom = (timelineInfo, hoverPercent = null) => {
|
|
|
7639
7669
|
|
|
7640
7670
|
const getDevtoolsDom = (events, selectedEvent, selectedEventIndex, timelineEvents, timelineStartSeconds, timelineEndSeconds, emptyMessage = noEventsFound(), timelineSelectionActive = false, timelineSelectionAnchorSeconds = '', timelineSelectionFocusSeconds = '', detailTabs = createDetailTabs(), visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), timelineInfo, timelineHoverPercent = null, focus = 0, previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, previewTextDeltaY = 0, previewTextViewportHeight = 0, minLineY = 0, maxLineY = events.length) => {
|
|
7641
7671
|
const visibleEvents = events.slice(minLineY, maxLineY);
|
|
7642
|
-
const
|
|
7672
|
+
const rows = createDevtoolsRows(visibleEvents, selectedEventIndex, minLineY);
|
|
7673
|
+
const rowNodes = getDevtoolsRows(rows, visibleTableColumns);
|
|
7643
7674
|
const effectiveRange = getEffectiveTimelineRange(timelineStartSeconds, timelineEndSeconds, timelineSelectionActive, timelineSelectionAnchorSeconds, timelineSelectionFocusSeconds);
|
|
7644
7675
|
const resolvedTimelineInfo = timelineInfo || getTimelineInfo(timelineEvents, effectiveRange.startSeconds, effectiveRange.endSeconds);
|
|
7645
7676
|
const timelineNodes = getTimelineDom(resolvedTimelineInfo, timelineHoverPercent);
|