@lvce-editor/chat-debug-view 10.7.0 → 10.8.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 +991 -86
- package/package.json +1 -1
|
@@ -1446,6 +1446,7 @@ const ImageCouldNotBeLoaded = 'image could not be loaded';
|
|
|
1446
1446
|
const InvalidSessionId = 'Invalid session id';
|
|
1447
1447
|
const InvalidUriEncoding = 'Invalid URI encoding';
|
|
1448
1448
|
const InvalidUriFormat = 'Invalid URI format';
|
|
1449
|
+
const Method$1 = 'Method';
|
|
1449
1450
|
const MissingUri = 'Missing URI';
|
|
1450
1451
|
const Network$1 = 'Network';
|
|
1451
1452
|
const NoChatSessionFound = 'No chat session found for sessionId "{PH1}".';
|
|
@@ -1528,6 +1529,9 @@ const invalidUriFormat = () => {
|
|
|
1528
1529
|
const missingUri = () => {
|
|
1529
1530
|
return i18nString(MissingUri);
|
|
1530
1531
|
};
|
|
1532
|
+
const method = () => {
|
|
1533
|
+
return i18nString(Method$1);
|
|
1534
|
+
};
|
|
1531
1535
|
const network = () => {
|
|
1532
1536
|
return i18nString(Network$1);
|
|
1533
1537
|
};
|
|
@@ -1830,14 +1834,19 @@ const parseFilterValue = filterValue => {
|
|
|
1830
1834
|
};
|
|
1831
1835
|
|
|
1832
1836
|
const Type = 'type';
|
|
1837
|
+
const Method = 'method';
|
|
1833
1838
|
const Duration = 'duration';
|
|
1834
1839
|
const Status$1 = 'status';
|
|
1835
|
-
const tableColumnNames = [Type, Status$1, Duration];
|
|
1840
|
+
const tableColumnNames = [Type, Method, Status$1, Duration];
|
|
1836
1841
|
const createTableColumns = () => {
|
|
1837
1842
|
return [{
|
|
1838
1843
|
isVisible: true,
|
|
1839
1844
|
label: type(),
|
|
1840
1845
|
name: Type
|
|
1846
|
+
}, {
|
|
1847
|
+
isVisible: true,
|
|
1848
|
+
label: method(),
|
|
1849
|
+
name: Method
|
|
1841
1850
|
}, {
|
|
1842
1851
|
isVisible: true,
|
|
1843
1852
|
label: status(),
|
|
@@ -1877,6 +1886,8 @@ const getTableColumnLabel = (tableColumns, name) => {
|
|
|
1877
1886
|
switch (name) {
|
|
1878
1887
|
case Duration:
|
|
1879
1888
|
return duration();
|
|
1889
|
+
case Method:
|
|
1890
|
+
return method();
|
|
1880
1891
|
case Status$1:
|
|
1881
1892
|
return status();
|
|
1882
1893
|
case Type:
|
|
@@ -1888,6 +1899,7 @@ const getTableColumnLabel = (tableColumns, name) => {
|
|
|
1888
1899
|
|
|
1889
1900
|
const defaultTableColumnWidths = {
|
|
1890
1901
|
duration: 110,
|
|
1902
|
+
method: 90,
|
|
1891
1903
|
status: 110,
|
|
1892
1904
|
type: 260
|
|
1893
1905
|
};
|
|
@@ -1921,6 +1933,7 @@ const getTableWidthFromClientX = (viewX, width, clientX) => {
|
|
|
1921
1933
|
|
|
1922
1934
|
const minimumTableColumnWidths = {
|
|
1923
1935
|
[Duration]: 80,
|
|
1936
|
+
[Method]: 56,
|
|
1924
1937
|
[Status$1]: 56,
|
|
1925
1938
|
[Type]: 80
|
|
1926
1939
|
};
|
|
@@ -1989,7 +2002,7 @@ const getResizedTableColumnWidths = (width, tableWidth, visibleTableColumns, tab
|
|
|
1989
2002
|
};
|
|
1990
2003
|
|
|
1991
2004
|
const isSameTableColumnWidths = (first, second) => {
|
|
1992
|
-
return first.type === second.type && first.duration === second.duration && first.status === second.status;
|
|
2005
|
+
return first.type === second.type && first.method === second.method && first.duration === second.duration && first.status === second.status;
|
|
1993
2006
|
};
|
|
1994
2007
|
|
|
1995
2008
|
const isFiniteNumber = value => {
|
|
@@ -2001,7 +2014,7 @@ const isTableColumnWidths = value => {
|
|
|
2001
2014
|
return false;
|
|
2002
2015
|
}
|
|
2003
2016
|
const record = value;
|
|
2004
|
-
return isFiniteNumber(record.type) && isFiniteNumber(record.duration) && isFiniteNumber(record.status);
|
|
2017
|
+
return isFiniteNumber(record.type) && isFiniteNumber(record.method) && isFiniteNumber(record.duration) && isFiniteNumber(record.status);
|
|
2005
2018
|
};
|
|
2006
2019
|
|
|
2007
2020
|
const validEventCategoryFilters = new Set([All, Network, Stream, Tools, Ui]);
|
|
@@ -2210,6 +2223,9 @@ const createDefaultState = () => {
|
|
|
2210
2223
|
databaseName: 'lvce-chat-view-sessions',
|
|
2211
2224
|
dataBaseVersion: 2,
|
|
2212
2225
|
detailTabs: createDetailTabs(),
|
|
2226
|
+
devtoolsRootGap: 4,
|
|
2227
|
+
devtoolsTimelineHeight: 88,
|
|
2228
|
+
devtoolsTopHeight: 28,
|
|
2213
2229
|
errorMessage: '',
|
|
2214
2230
|
events: [],
|
|
2215
2231
|
eventStoreName: 'chat-view-events',
|
|
@@ -2222,6 +2238,9 @@ const createDefaultState = () => {
|
|
|
2222
2238
|
platform: 0,
|
|
2223
2239
|
previewTextCursorColumnIndex: null,
|
|
2224
2240
|
previewTextCursorRowIndex: null,
|
|
2241
|
+
previewTextDeltaY: 0,
|
|
2242
|
+
previewTextScrollBarHandleOffset: 0,
|
|
2243
|
+
previewTextScrollBarPointerActive: false,
|
|
2225
2244
|
sashPointerActive: false,
|
|
2226
2245
|
selectedEvent: null,
|
|
2227
2246
|
selectedEventId: null,
|
|
@@ -2293,7 +2312,7 @@ const RenderFocusContext = 4;
|
|
|
2293
2312
|
const RenderFocus = 5;
|
|
2294
2313
|
|
|
2295
2314
|
const diff = (oldState, newState) => {
|
|
2296
|
-
if (oldState.categoryFilters !== newState.categoryFilters || oldState.detailTabs !== newState.detailTabs || oldState.errorMessage !== newState.errorMessage || oldState.events !== newState.events || oldState.filterValue !== newState.filterValue || oldState.previewTextCursorColumnIndex !== newState.previewTextCursorColumnIndex || oldState.previewTextCursorRowIndex !== newState.previewTextCursorRowIndex || oldState.sessionId !== newState.sessionId || oldState.showEventStreamFinishedEvents !== newState.showEventStreamFinishedEvents || oldState.showInputEvents !== newState.showInputEvents || oldState.showResponsePartEvents !== newState.showResponsePartEvents || oldState.sortColumn !== newState.sortColumn || oldState.sortDescending !== newState.sortDescending || oldState.tableColumnWidths !== newState.tableColumnWidths || oldState.tableDeltaY !== newState.tableDeltaY || oldState.tableMaxLineY !== newState.tableMaxLineY || oldState.tableMinLineY !== newState.tableMinLineY || oldState.tableWidth !== newState.tableWidth || oldState.timelineEndSeconds !== newState.timelineEndSeconds || oldState.timelineHeight !== newState.timelineHeight || oldState.timelineHoverPercent !== newState.timelineHoverPercent || oldState.timelineHoverSeconds !== newState.timelineHoverSeconds || oldState.timelineSelectionActive !== newState.timelineSelectionActive || oldState.timelineSelectionAnchorSeconds !== newState.timelineSelectionAnchorSeconds || oldState.timelineSelectionFocusSeconds !== newState.timelineSelectionFocusSeconds || oldState.timelineStartSeconds !== newState.timelineStartSeconds || oldState.useDevtoolsLayout !== newState.useDevtoolsLayout || oldState.tableColumns !== newState.tableColumns || oldState.selectedEvent !== newState.selectedEvent || oldState.selectedEventIndex !== newState.selectedEventIndex || oldState.focus !== newState.focus || oldState.width !== newState.width || oldState.uid !== newState.uid) {
|
|
2315
|
+
if (oldState.categoryFilters !== newState.categoryFilters || oldState.detailTabs !== newState.detailTabs || oldState.errorMessage !== newState.errorMessage || oldState.events !== newState.events || oldState.filterValue !== newState.filterValue || oldState.previewTextCursorColumnIndex !== newState.previewTextCursorColumnIndex || oldState.previewTextCursorRowIndex !== newState.previewTextCursorRowIndex || oldState.previewTextDeltaY !== newState.previewTextDeltaY || oldState.sessionId !== newState.sessionId || oldState.showEventStreamFinishedEvents !== newState.showEventStreamFinishedEvents || oldState.showInputEvents !== newState.showInputEvents || oldState.showResponsePartEvents !== newState.showResponsePartEvents || oldState.sortColumn !== newState.sortColumn || oldState.sortDescending !== newState.sortDescending || oldState.tableColumnWidths !== newState.tableColumnWidths || oldState.tableDeltaY !== newState.tableDeltaY || oldState.tableMaxLineY !== newState.tableMaxLineY || oldState.tableMinLineY !== newState.tableMinLineY || oldState.tableWidth !== newState.tableWidth || oldState.timelineEndSeconds !== newState.timelineEndSeconds || oldState.timelineHeight !== newState.timelineHeight || oldState.timelineHoverPercent !== newState.timelineHoverPercent || oldState.timelineHoverSeconds !== newState.timelineHoverSeconds || oldState.timelineSelectionActive !== newState.timelineSelectionActive || oldState.timelineSelectionAnchorSeconds !== newState.timelineSelectionAnchorSeconds || oldState.timelineSelectionFocusSeconds !== newState.timelineSelectionFocusSeconds || oldState.timelineStartSeconds !== newState.timelineStartSeconds || oldState.useDevtoolsLayout !== newState.useDevtoolsLayout || oldState.tableColumns !== newState.tableColumns || oldState.selectedEvent !== newState.selectedEvent || oldState.selectedEventIndex !== newState.selectedEventIndex || oldState.focus !== newState.focus || oldState.width !== newState.width || oldState.uid !== newState.uid) {
|
|
2297
2316
|
return [RenderIncremental, RenderCss];
|
|
2298
2317
|
}
|
|
2299
2318
|
return [];
|
|
@@ -2501,7 +2520,7 @@ const getVisibleEvents = (events, showInputEvents, showResponsePartEvents, showE
|
|
|
2501
2520
|
|
|
2502
2521
|
const isNetworkEvent = event => {
|
|
2503
2522
|
const normalizedType = event.type.toLowerCase();
|
|
2504
|
-
return normalizedType === 'request' || normalizedType === 'response' || normalizedType === 'handle-response' || normalizedType.includes('fetch') || normalizedType.includes('xhr');
|
|
2523
|
+
return normalizedType === 'request' || normalizedType === 'ai-request' || normalizedType === 'response' || normalizedType === 'ai-response-success' || normalizedType === 'handle-response' || normalizedType.includes('fetch') || normalizedType.includes('xhr');
|
|
2505
2524
|
};
|
|
2506
2525
|
|
|
2507
2526
|
const isStreamEvent = event => {
|
|
@@ -2574,7 +2593,6 @@ const getEventTableDurationText = event => {
|
|
|
2574
2593
|
return `${durationText.slice(0, -2)} ms`;
|
|
2575
2594
|
};
|
|
2576
2595
|
|
|
2577
|
-
const toolExecutionTypePrefix = 'tool-execution';
|
|
2578
2596
|
const getToolName = event => {
|
|
2579
2597
|
if (typeof event.toolName === 'string' && event.toolName) {
|
|
2580
2598
|
return event.toolName;
|
|
@@ -2596,6 +2614,8 @@ const getToolName = event => {
|
|
|
2596
2614
|
}
|
|
2597
2615
|
return name;
|
|
2598
2616
|
};
|
|
2617
|
+
|
|
2618
|
+
const toolExecutionTypePrefix = 'tool-execution';
|
|
2599
2619
|
const getEventTypeLabel = event => {
|
|
2600
2620
|
if (!event.type.startsWith(toolExecutionTypePrefix)) {
|
|
2601
2621
|
return event.type;
|
|
@@ -2748,11 +2768,11 @@ const devtoolsTableScrollBarWidth = 12;
|
|
|
2748
2768
|
const devtoolsTableSummaryHeight = 24;
|
|
2749
2769
|
const minimumDevtoolsTableScrollBarHeight = 20;
|
|
2750
2770
|
|
|
2751
|
-
const devtoolsRootGap = 4;
|
|
2752
|
-
const devtoolsTopHeight = 28;
|
|
2753
|
-
const devtoolsTimelineHeight = 88;
|
|
2754
2771
|
const getTableBodyY = (state, hasTimeline) => {
|
|
2755
2772
|
const {
|
|
2773
|
+
devtoolsRootGap,
|
|
2774
|
+
devtoolsTimelineHeight,
|
|
2775
|
+
devtoolsTopHeight,
|
|
2756
2776
|
y
|
|
2757
2777
|
} = state;
|
|
2758
2778
|
return y + viewPadding + devtoolsTopHeight + devtoolsRootGap + (hasTimeline ? devtoolsTimelineHeight : 0) + devtoolsTableHeaderHeight;
|
|
@@ -2990,6 +3010,9 @@ const selectEventAtIndex = async (state, selectedEventIndex, dependencies = sele
|
|
|
2990
3010
|
detailTabs: createDetailTabs(selectedDetailTab, resolvedSelectedEvent),
|
|
2991
3011
|
previewTextCursorColumnIndex: null,
|
|
2992
3012
|
previewTextCursorRowIndex: null,
|
|
3013
|
+
previewTextDeltaY: 0,
|
|
3014
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3015
|
+
previewTextScrollBarPointerActive: false,
|
|
2993
3016
|
selectedEvent: resolvedSelectedEvent,
|
|
2994
3017
|
selectedEventId: selectedEvent.eventId,
|
|
2995
3018
|
selectedEventIndex
|
|
@@ -3332,6 +3355,9 @@ const restoreSelectedEvent = async state => {
|
|
|
3332
3355
|
...state,
|
|
3333
3356
|
previewTextCursorColumnIndex: null,
|
|
3334
3357
|
previewTextCursorRowIndex: null,
|
|
3358
|
+
previewTextDeltaY: 0,
|
|
3359
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3360
|
+
previewTextScrollBarPointerActive: false,
|
|
3335
3361
|
selectedEvent: null,
|
|
3336
3362
|
selectedEventIndex: null
|
|
3337
3363
|
};
|
|
@@ -3343,6 +3369,9 @@ const restoreSelectedEvent = async state => {
|
|
|
3343
3369
|
...state,
|
|
3344
3370
|
previewTextCursorColumnIndex: null,
|
|
3345
3371
|
previewTextCursorRowIndex: null,
|
|
3372
|
+
previewTextDeltaY: 0,
|
|
3373
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3374
|
+
previewTextScrollBarPointerActive: false,
|
|
3346
3375
|
selectedEvent: null,
|
|
3347
3376
|
selectedEventId: null,
|
|
3348
3377
|
selectedEventIndex: null
|
|
@@ -3354,6 +3383,9 @@ const restoreSelectedEvent = async state => {
|
|
|
3354
3383
|
...state,
|
|
3355
3384
|
previewTextCursorColumnIndex: null,
|
|
3356
3385
|
previewTextCursorRowIndex: null,
|
|
3386
|
+
previewTextDeltaY: 0,
|
|
3387
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3388
|
+
previewTextScrollBarPointerActive: false,
|
|
3357
3389
|
selectedEvent: null,
|
|
3358
3390
|
selectedEventId: null,
|
|
3359
3391
|
selectedEventIndex: null
|
|
@@ -3365,6 +3397,9 @@ const restoreSelectedEvent = async state => {
|
|
|
3365
3397
|
...state,
|
|
3366
3398
|
previewTextCursorColumnIndex: null,
|
|
3367
3399
|
previewTextCursorRowIndex: null,
|
|
3400
|
+
previewTextDeltaY: 0,
|
|
3401
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3402
|
+
previewTextScrollBarPointerActive: false,
|
|
3368
3403
|
selectedEvent: resolvedSelectedEvent,
|
|
3369
3404
|
selectedEventId: selectedEvent.eventId,
|
|
3370
3405
|
selectedEventIndex
|
|
@@ -3449,6 +3484,9 @@ const handleCloseDetails$1 = state => {
|
|
|
3449
3484
|
...state,
|
|
3450
3485
|
previewTextCursorColumnIndex: null,
|
|
3451
3486
|
previewTextCursorRowIndex: null,
|
|
3487
|
+
previewTextDeltaY: 0,
|
|
3488
|
+
previewTextScrollBarHandleOffset: 0,
|
|
3489
|
+
previewTextScrollBarPointerActive: false,
|
|
3452
3490
|
selectedEvent: null,
|
|
3453
3491
|
selectedEventId: null,
|
|
3454
3492
|
selectedEventIndex: null
|
|
@@ -3880,26 +3918,42 @@ const getResponseContentText = content => {
|
|
|
3880
3918
|
} = content;
|
|
3881
3919
|
return typeof text === 'string' ? text : undefined;
|
|
3882
3920
|
};
|
|
3883
|
-
const
|
|
3884
|
-
if (event.type
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
value
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3921
|
+
const getResponseOutput = event => {
|
|
3922
|
+
if (event.type === 'sse-response-completed') {
|
|
3923
|
+
const {
|
|
3924
|
+
value
|
|
3925
|
+
} = event;
|
|
3926
|
+
if (!value || typeof value !== 'object') {
|
|
3927
|
+
return undefined;
|
|
3928
|
+
}
|
|
3929
|
+
const {
|
|
3930
|
+
response
|
|
3931
|
+
} = value;
|
|
3932
|
+
if (!response || typeof response !== 'object') {
|
|
3933
|
+
return undefined;
|
|
3934
|
+
}
|
|
3935
|
+
const {
|
|
3936
|
+
output
|
|
3937
|
+
} = response;
|
|
3938
|
+
return Array.isArray(output) ? output : undefined;
|
|
3892
3939
|
}
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3940
|
+
if (event.type === 'ai-response') {
|
|
3941
|
+
const {
|
|
3942
|
+
value
|
|
3943
|
+
} = event;
|
|
3944
|
+
if (!value || typeof value !== 'object') {
|
|
3945
|
+
return undefined;
|
|
3946
|
+
}
|
|
3947
|
+
const {
|
|
3948
|
+
output
|
|
3949
|
+
} = value;
|
|
3950
|
+
return Array.isArray(output) ? output : undefined;
|
|
3898
3951
|
}
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3952
|
+
return undefined;
|
|
3953
|
+
};
|
|
3954
|
+
const getResponsePreviewText = event => {
|
|
3955
|
+
const output = getResponseOutput(event);
|
|
3956
|
+
if (!output || output.length === 0) {
|
|
3903
3957
|
return undefined;
|
|
3904
3958
|
}
|
|
3905
3959
|
const [firstOutput] = output;
|
|
@@ -3915,9 +3969,9 @@ const getPreviewMessageText = event => {
|
|
|
3915
3969
|
if (isChatMessageUpdatedEvent(event) && typeof event.text === 'string') {
|
|
3916
3970
|
return event.text;
|
|
3917
3971
|
}
|
|
3918
|
-
const
|
|
3919
|
-
if (
|
|
3920
|
-
return
|
|
3972
|
+
const responsePreviewText = getResponsePreviewText(event);
|
|
3973
|
+
if (responsePreviewText !== undefined) {
|
|
3974
|
+
return responsePreviewText;
|
|
3921
3975
|
}
|
|
3922
3976
|
if (!isChatMessageAddedEvent(event)) {
|
|
3923
3977
|
return undefined;
|
|
@@ -4004,16 +4058,21 @@ const getWriteFilePreviewText = (event, name) => {
|
|
|
4004
4058
|
const {
|
|
4005
4059
|
arguments: toolArguments
|
|
4006
4060
|
} = event;
|
|
4007
|
-
if (typeof toolArguments !== 'object' || toolArguments === null || !Object.hasOwn(toolArguments, 'content')) {
|
|
4061
|
+
if (typeof toolArguments !== 'object' || toolArguments === null || !Object.hasOwn(toolArguments, 'content') || !Object.hasOwn(toolArguments, 'uri')) {
|
|
4008
4062
|
return undefined;
|
|
4009
4063
|
}
|
|
4010
4064
|
const {
|
|
4011
|
-
content
|
|
4065
|
+
content,
|
|
4066
|
+
uri
|
|
4012
4067
|
} = toolArguments;
|
|
4013
|
-
if (typeof content !== 'string') {
|
|
4068
|
+
if (typeof content !== 'string' || typeof uri !== 'string') {
|
|
4014
4069
|
return undefined;
|
|
4015
4070
|
}
|
|
4016
|
-
return
|
|
4071
|
+
return {
|
|
4072
|
+
content,
|
|
4073
|
+
previewType: 'write-file',
|
|
4074
|
+
uri
|
|
4075
|
+
};
|
|
4017
4076
|
};
|
|
4018
4077
|
|
|
4019
4078
|
const getPreviewEvent = event => {
|
|
@@ -4064,6 +4123,77 @@ const getPreviewTextCursorStyle = cursor => {
|
|
|
4064
4123
|
return `height: ${previewTextRowHeight}px; left: ${cursor.columnIndex * defaultPreviewTextColumnWidth}px; top: ${cursor.rowIndex * previewTextRowHeight}px; width: 0px;`;
|
|
4065
4124
|
};
|
|
4066
4125
|
|
|
4126
|
+
const isWriteFilePreview = value => {
|
|
4127
|
+
return typeof value === 'object' && value !== null && value.previewType === 'write-file' && typeof value.content === 'string' && typeof value.uri === 'string';
|
|
4128
|
+
};
|
|
4129
|
+
|
|
4130
|
+
const getPreviewTextValue = selectedEvent => {
|
|
4131
|
+
if (!selectedEvent) {
|
|
4132
|
+
return undefined;
|
|
4133
|
+
}
|
|
4134
|
+
const previewEvent = getPreviewEvent(selectedEvent);
|
|
4135
|
+
if (typeof previewEvent === 'string') {
|
|
4136
|
+
return previewEvent;
|
|
4137
|
+
}
|
|
4138
|
+
if (isWriteFilePreview(previewEvent)) {
|
|
4139
|
+
return previewEvent.content;
|
|
4140
|
+
}
|
|
4141
|
+
return undefined;
|
|
4142
|
+
};
|
|
4143
|
+
const getPreviewTextLineCount = selectedEvent => {
|
|
4144
|
+
const value = getPreviewTextValue(selectedEvent);
|
|
4145
|
+
if (value === undefined) {
|
|
4146
|
+
return 0;
|
|
4147
|
+
}
|
|
4148
|
+
return value.split('\n').length;
|
|
4149
|
+
};
|
|
4150
|
+
const getPreviewTextViewportHeight = state => {
|
|
4151
|
+
if (!state.selectedEvent) {
|
|
4152
|
+
return 0;
|
|
4153
|
+
}
|
|
4154
|
+
return getTableBodyHeight(state, 1);
|
|
4155
|
+
};
|
|
4156
|
+
const getPreviewTextMaxDeltaY = (lineCount, viewportHeight) => {
|
|
4157
|
+
return Math.max(lineCount * previewTextRowHeight - viewportHeight, 0);
|
|
4158
|
+
};
|
|
4159
|
+
const clampPreviewTextDeltaY = (deltaY, lineCount, viewportHeight) => {
|
|
4160
|
+
const maxDeltaY = getPreviewTextMaxDeltaY(lineCount, viewportHeight);
|
|
4161
|
+
if (deltaY < 0) {
|
|
4162
|
+
return 0;
|
|
4163
|
+
}
|
|
4164
|
+
if (deltaY > maxDeltaY) {
|
|
4165
|
+
return maxDeltaY;
|
|
4166
|
+
}
|
|
4167
|
+
return deltaY;
|
|
4168
|
+
};
|
|
4169
|
+
const getPreviewVirtualizationState = (selectedEvent, viewportHeight, deltaY) => {
|
|
4170
|
+
const totalLineCount = getPreviewTextLineCount(selectedEvent);
|
|
4171
|
+
const clampedDeltaY = clampPreviewTextDeltaY(deltaY, totalLineCount, viewportHeight);
|
|
4172
|
+
const startLineY = Math.floor(clampedDeltaY / previewTextRowHeight);
|
|
4173
|
+
const visibleLineCount = viewportHeight <= 0 ? 0 : Math.max(1, Math.ceil(viewportHeight / previewTextRowHeight));
|
|
4174
|
+
const endLineY = Math.min(totalLineCount, startLineY + visibleLineCount);
|
|
4175
|
+
const maxDeltaY = getPreviewTextMaxDeltaY(totalLineCount, viewportHeight);
|
|
4176
|
+
const scrollBarHeight = getScrollBarHeight(totalLineCount, viewportHeight);
|
|
4177
|
+
const scrollBarOffset = getScrollBarOffset(clampedDeltaY, maxDeltaY, viewportHeight, scrollBarHeight);
|
|
4178
|
+
return {
|
|
4179
|
+
deltaY: clampedDeltaY,
|
|
4180
|
+
endLineY,
|
|
4181
|
+
maxDeltaY,
|
|
4182
|
+
scrollBarHeight,
|
|
4183
|
+
scrollBarOffset,
|
|
4184
|
+
showScrollBar: scrollBarHeight > 0,
|
|
4185
|
+
startLineY,
|
|
4186
|
+
totalLineCount,
|
|
4187
|
+
viewportHeight
|
|
4188
|
+
};
|
|
4189
|
+
};
|
|
4190
|
+
const setPreviewTextDeltaY = (state, deltaY) => {
|
|
4191
|
+
return {
|
|
4192
|
+
...state,
|
|
4193
|
+
previewTextDeltaY: clampPreviewTextDeltaY(deltaY, getPreviewTextLineCount(state.selectedEvent), getPreviewTextViewportHeight(state))
|
|
4194
|
+
};
|
|
4195
|
+
};
|
|
4196
|
+
|
|
4067
4197
|
const hasNumberedTextPreview = (state, previewEvent) => {
|
|
4068
4198
|
if (typeof previewEvent !== 'string') {
|
|
4069
4199
|
return false;
|
|
@@ -4081,7 +4211,8 @@ const handlePreviewTextPointerDown = (state, x, y) => {
|
|
|
4081
4211
|
if (!hasNumberedTextPreview(state, previewEvent)) {
|
|
4082
4212
|
return state;
|
|
4083
4213
|
}
|
|
4084
|
-
const
|
|
4214
|
+
const deltaY = clampPreviewTextDeltaY(state.previewTextDeltaY, getPreviewTextLineCount(state.selectedEvent), getPreviewTextViewportHeight(state));
|
|
4215
|
+
const cursor = getPreviewTextCursorFromPoint(previewEvent, x, y + deltaY);
|
|
4085
4216
|
if (state.previewTextCursorColumnIndex === cursor.columnIndex && state.previewTextCursorRowIndex === cursor.rowIndex) {
|
|
4086
4217
|
return state;
|
|
4087
4218
|
}
|
|
@@ -4092,6 +4223,87 @@ const handlePreviewTextPointerDown = (state, x, y) => {
|
|
|
4092
4223
|
};
|
|
4093
4224
|
};
|
|
4094
4225
|
|
|
4226
|
+
const getPreviewTextBodyY = state => {
|
|
4227
|
+
return getTableBodyY(state, true);
|
|
4228
|
+
};
|
|
4229
|
+
|
|
4230
|
+
const getHandleOffsetAndPercent$1 = (viewportHeight, scrollBarHeight, relativeY) => {
|
|
4231
|
+
const halfScrollBarHeight = scrollBarHeight / 2;
|
|
4232
|
+
if (relativeY <= halfScrollBarHeight) {
|
|
4233
|
+
return {
|
|
4234
|
+
handleOffset: relativeY,
|
|
4235
|
+
percent: 0
|
|
4236
|
+
};
|
|
4237
|
+
}
|
|
4238
|
+
if (relativeY <= viewportHeight - halfScrollBarHeight) {
|
|
4239
|
+
return {
|
|
4240
|
+
handleOffset: halfScrollBarHeight,
|
|
4241
|
+
percent: (relativeY - halfScrollBarHeight) / Math.max(1, viewportHeight - scrollBarHeight)
|
|
4242
|
+
};
|
|
4243
|
+
}
|
|
4244
|
+
return {
|
|
4245
|
+
handleOffset: scrollBarHeight - viewportHeight + relativeY,
|
|
4246
|
+
percent: 1
|
|
4247
|
+
};
|
|
4248
|
+
};
|
|
4249
|
+
const handlePreviewTextScrollBarPointerDown = (state, eventY) => {
|
|
4250
|
+
const viewportHeight = getPreviewTextViewportHeight(state);
|
|
4251
|
+
const virtualization = getPreviewVirtualizationState(state.selectedEvent, viewportHeight, state.previewTextDeltaY);
|
|
4252
|
+
const bodyY = getPreviewTextBodyY(state);
|
|
4253
|
+
const relativeY = eventY - bodyY;
|
|
4254
|
+
if (virtualization.viewportHeight === 0 || virtualization.scrollBarHeight === 0) {
|
|
4255
|
+
return state;
|
|
4256
|
+
}
|
|
4257
|
+
const {
|
|
4258
|
+
handleOffset,
|
|
4259
|
+
percent
|
|
4260
|
+
} = getHandleOffsetAndPercent$1(virtualization.viewportHeight, virtualization.scrollBarHeight, relativeY);
|
|
4261
|
+
const nextState = setPreviewTextDeltaY(state, percent * virtualization.maxDeltaY);
|
|
4262
|
+
return {
|
|
4263
|
+
...nextState,
|
|
4264
|
+
previewTextScrollBarHandleOffset: handleOffset,
|
|
4265
|
+
previewTextScrollBarPointerActive: true
|
|
4266
|
+
};
|
|
4267
|
+
};
|
|
4268
|
+
|
|
4269
|
+
const handlePreviewTextScrollBarPointerMove = (state, eventY) => {
|
|
4270
|
+
if (!state.previewTextScrollBarPointerActive) {
|
|
4271
|
+
return state;
|
|
4272
|
+
}
|
|
4273
|
+
const viewportHeight = getPreviewTextViewportHeight(state);
|
|
4274
|
+
const virtualization = getPreviewVirtualizationState(state.selectedEvent, viewportHeight, state.previewTextDeltaY);
|
|
4275
|
+
if (viewportHeight === 0 || virtualization.scrollBarHeight === 0) {
|
|
4276
|
+
return state;
|
|
4277
|
+
}
|
|
4278
|
+
const relativeY = eventY - getPreviewTextBodyY(state);
|
|
4279
|
+
const nextHandleTop = Math.max(0, Math.min(viewportHeight - virtualization.scrollBarHeight, relativeY - state.previewTextScrollBarHandleOffset));
|
|
4280
|
+
const percent = nextHandleTop / Math.max(1, viewportHeight - virtualization.scrollBarHeight);
|
|
4281
|
+
const nextState = setPreviewTextDeltaY(state, percent * virtualization.maxDeltaY);
|
|
4282
|
+
return {
|
|
4283
|
+
...nextState,
|
|
4284
|
+
previewTextScrollBarPointerActive: true
|
|
4285
|
+
};
|
|
4286
|
+
};
|
|
4287
|
+
|
|
4288
|
+
const handlePreviewTextScrollBarPointerUp = state => {
|
|
4289
|
+
if (!state.previewTextScrollBarPointerActive && state.previewTextScrollBarHandleOffset === 0) {
|
|
4290
|
+
return state;
|
|
4291
|
+
}
|
|
4292
|
+
return {
|
|
4293
|
+
...state,
|
|
4294
|
+
previewTextScrollBarHandleOffset: 0,
|
|
4295
|
+
previewTextScrollBarPointerActive: false
|
|
4296
|
+
};
|
|
4297
|
+
};
|
|
4298
|
+
|
|
4299
|
+
const handlePreviewTextWheel = (state, deltaY) => {
|
|
4300
|
+
return setPreviewTextDeltaY(state, state.previewTextDeltaY + deltaY);
|
|
4301
|
+
};
|
|
4302
|
+
|
|
4303
|
+
const handleRootContextMenu = state => {
|
|
4304
|
+
return state;
|
|
4305
|
+
};
|
|
4306
|
+
|
|
4095
4307
|
const handleSashPointerDown = (state, eventX, eventY) => {
|
|
4096
4308
|
if (state.sashPointerActive) {
|
|
4097
4309
|
return state;
|
|
@@ -4152,6 +4364,8 @@ const getTableResizerId = name => {
|
|
|
4152
4364
|
switch (name) {
|
|
4153
4365
|
case 'ResizerOne':
|
|
4154
4366
|
return 1;
|
|
4367
|
+
case 'ResizerThree':
|
|
4368
|
+
return 3;
|
|
4155
4369
|
case 'ResizerTwo':
|
|
4156
4370
|
return 2;
|
|
4157
4371
|
default:
|
|
@@ -4476,6 +4690,9 @@ const setUseDevtoolsLayout = (state, checked) => {
|
|
|
4476
4690
|
...state,
|
|
4477
4691
|
previewTextCursorColumnIndex: useDevtoolsLayout && selectedEventIndex !== null ? state.previewTextCursorColumnIndex : null,
|
|
4478
4692
|
previewTextCursorRowIndex: useDevtoolsLayout && selectedEventIndex !== null ? state.previewTextCursorRowIndex : null,
|
|
4693
|
+
previewTextDeltaY: useDevtoolsLayout && selectedEventIndex !== null ? state.previewTextDeltaY : 0,
|
|
4694
|
+
previewTextScrollBarHandleOffset: 0,
|
|
4695
|
+
previewTextScrollBarPointerActive: false,
|
|
4479
4696
|
selectedEvent: useDevtoolsLayout && selectedEventIndex !== null ? state.selectedEvent : null,
|
|
4480
4697
|
selectedEventId: useDevtoolsLayout && selectedEventIndex !== null ? state.selectedEventId : null,
|
|
4481
4698
|
selectedEventIndex,
|
|
@@ -4625,14 +4842,17 @@ const getCss = state => {
|
|
|
4625
4842
|
const tableContentWidth = Math.max(0, tableWidth - (showScrollBar ? devtoolsTableScrollBarWidth : 0));
|
|
4626
4843
|
const detailsWidth = hasSelectedEvent ? getDetailsWidth(state.width, state.tableWidth) : 0;
|
|
4627
4844
|
const detailsLineNumberWidth = getDetailsLineNumberWidth(state);
|
|
4845
|
+
const previewTextViewportHeight = getPreviewTextViewportHeight(state);
|
|
4846
|
+
const previewVirtualization = getPreviewVirtualizationState(state.selectedEvent, previewTextViewportHeight, state.previewTextDeltaY);
|
|
4628
4847
|
let topSize = 60;
|
|
4629
4848
|
if (state.width >= state.largeBreakpoint) {
|
|
4630
4849
|
topSize = 30;
|
|
4631
4850
|
}
|
|
4632
4851
|
const tableColumnLayout = getTableColumnLayout(tableContentWidth, getVisibleTableColumns(state.tableColumns), state.tableColumnWidths);
|
|
4633
|
-
const [tableColZeroWidth = 0, tableColOneWidth = 0, tableColTwoWidth = 0] = tableColumnLayout.visibleColumnWidths;
|
|
4852
|
+
const [tableColZeroWidth = 0, tableColOneWidth = 0, tableColTwoWidth = 0, tableColThreeWidth = 0] = tableColumnLayout.visibleColumnWidths;
|
|
4634
4853
|
const resizerOneLeft = tableColumnLayout.resizerLefts[0] ?? 0;
|
|
4635
4854
|
const resizerTwoLeft = tableColumnLayout.resizerLefts[1] ?? 0;
|
|
4855
|
+
const resizerThreeLeft = tableColumnLayout.resizerLefts[2] ?? 0;
|
|
4636
4856
|
const {
|
|
4637
4857
|
selectionEndPercent,
|
|
4638
4858
|
selectionStartPercent
|
|
@@ -4644,7 +4864,12 @@ const getCss = state => {
|
|
|
4644
4864
|
--ChatDebugViewTableColZeroWidth: ${tableColZeroWidth}px;
|
|
4645
4865
|
--ChatDebugViewTableColOneWidth: ${tableColOneWidth}px;
|
|
4646
4866
|
--ChatDebugViewTableColTwoWidth: ${tableColTwoWidth}px;
|
|
4867
|
+
--ChatDebugViewTableColThreeWidth: ${tableColThreeWidth}px;
|
|
4647
4868
|
--ChatDebugViewDetailsLineNumberWidth: ${detailsLineNumberWidth}px;
|
|
4869
|
+
--ChatDebugViewPreviewScrollBarHeight: ${previewVirtualization.scrollBarHeight}px;
|
|
4870
|
+
--ChatDebugViewPreviewScrollBarOffset: ${previewVirtualization.scrollBarOffset}px;
|
|
4871
|
+
--ChatDebugViewPreviewScrollBarWidth: ${previewVirtualization.showScrollBar ? devtoolsTableScrollBarWidth : 0}px;
|
|
4872
|
+
--ChatDebugViewPreviewViewportHeight: ${previewVirtualization.viewportHeight}px;
|
|
4648
4873
|
--ChatDebugViewDetailsWidth: ${detailsWidth}px;
|
|
4649
4874
|
--ChatDebugViewDurationColumnWidth: ${state.tableColumnWidths.duration}px;
|
|
4650
4875
|
--ChatDebugViewTableRowHeight: ${devtoolsTableRowHeight}px;
|
|
@@ -4653,6 +4878,7 @@ const getCss = state => {
|
|
|
4653
4878
|
--ChatDebugViewTableScrollBarWidth: ${showScrollBar ? devtoolsTableScrollBarWidth : 0}px;
|
|
4654
4879
|
--ResizerOneLeft: ${resizerOneLeft}px;
|
|
4655
4880
|
--ResizerTwoLeft: ${resizerTwoLeft}px;
|
|
4881
|
+
--ResizerThreeLeft: ${resizerThreeLeft}px;
|
|
4656
4882
|
--ChatDebugViewSashWidth: ${sashWidth}px;
|
|
4657
4883
|
--ChatDebugViewTableWidth: ${tableWidth}px;
|
|
4658
4884
|
--ChatDebugViewTimelineHeight: ${state.timelineHeight}px;
|
|
@@ -4700,6 +4926,36 @@ const getCss = state => {
|
|
|
4700
4926
|
width: var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4701
4927
|
}
|
|
4702
4928
|
|
|
4929
|
+
.PreviewVirtualizedEditor {
|
|
4930
|
+
height: var(--ChatDebugViewPreviewViewportHeight);
|
|
4931
|
+
overflow: hidden;
|
|
4932
|
+
position: relative;
|
|
4933
|
+
}
|
|
4934
|
+
|
|
4935
|
+
.PreviewVirtualizedEditor .Editor {
|
|
4936
|
+
width: calc(100% - var(--ChatDebugViewPreviewScrollBarWidth));
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
.PreviewTextScrollBar {
|
|
4940
|
+
background: rgba(255, 255, 255, 0.06);
|
|
4941
|
+
border-radius: 999px;
|
|
4942
|
+
height: var(--ChatDebugViewPreviewViewportHeight);
|
|
4943
|
+
position: absolute;
|
|
4944
|
+
right: 0;
|
|
4945
|
+
top: 0;
|
|
4946
|
+
width: var(--ChatDebugViewPreviewScrollBarWidth);
|
|
4947
|
+
}
|
|
4948
|
+
|
|
4949
|
+
.PreviewTextScrollBarThumb {
|
|
4950
|
+
background: rgba(255, 255, 255, 0.22);
|
|
4951
|
+
border-radius: 999px;
|
|
4952
|
+
height: var(--ChatDebugViewPreviewScrollBarHeight);
|
|
4953
|
+
left: 2px;
|
|
4954
|
+
position: absolute;
|
|
4955
|
+
top: var(--ChatDebugViewPreviewScrollBarOffset);
|
|
4956
|
+
width: calc(100% - 4px);
|
|
4957
|
+
}
|
|
4958
|
+
|
|
4703
4959
|
.TableScrollBar {
|
|
4704
4960
|
background: rgba(255, 255, 255, 0.06);
|
|
4705
4961
|
border-radius: 999px;
|
|
@@ -4720,6 +4976,38 @@ const getCss = state => {
|
|
|
4720
4976
|
width: calc(100% - 4px);
|
|
4721
4977
|
}
|
|
4722
4978
|
|
|
4979
|
+
.TokenText {
|
|
4980
|
+
color: var(--vscode-editor-foreground);
|
|
4981
|
+
}
|
|
4982
|
+
|
|
4983
|
+
.TokenString {
|
|
4984
|
+
color: var(--vscode-debugTokenExpression-string, #ce9178);
|
|
4985
|
+
}
|
|
4986
|
+
|
|
4987
|
+
.TokenNumeric {
|
|
4988
|
+
color: var(--vscode-debugTokenExpression-number, #b5cea8);
|
|
4989
|
+
}
|
|
4990
|
+
|
|
4991
|
+
.TokenBoolean {
|
|
4992
|
+
color: var(--vscode-debugTokenExpression-boolean, #569cd6);
|
|
4993
|
+
}
|
|
4994
|
+
|
|
4995
|
+
.TokenKey,
|
|
4996
|
+
.TokenAttributeName,
|
|
4997
|
+
.TokenPropertyName {
|
|
4998
|
+
color: var(--vscode-symbolIcon-propertyForeground, #9cdcfe);
|
|
4999
|
+
}
|
|
5000
|
+
|
|
5001
|
+
.TokenKeyword,
|
|
5002
|
+
.TokenTag,
|
|
5003
|
+
.TokenSelector {
|
|
5004
|
+
color: var(--vscode-symbolIcon-keywordForeground, #569cd6);
|
|
5005
|
+
}
|
|
5006
|
+
|
|
5007
|
+
.TokenComment {
|
|
5008
|
+
color: var(--vscode-editorLineNumber-foreground, #6a9955);
|
|
5009
|
+
}
|
|
5010
|
+
|
|
4723
5011
|
`;
|
|
4724
5012
|
};
|
|
4725
5013
|
|
|
@@ -5048,6 +5336,9 @@ const EditorRows = 'EditorRows';
|
|
|
5048
5336
|
const EditorSelection = 'EditorSelection';
|
|
5049
5337
|
const EditorSelections = 'Selections';
|
|
5050
5338
|
const EditorViewlet = 'Viewlet Editor';
|
|
5339
|
+
const PreviewTextScrollBar = 'PreviewTextScrollBar';
|
|
5340
|
+
const PreviewTextScrollBarThumb = 'PreviewTextScrollBarThumb';
|
|
5341
|
+
const PreviewVirtualizedEditor = 'PreviewVirtualizedEditor';
|
|
5051
5342
|
const ChatDebugViewEventLineNumber = 'ChatDebugViewEventLineNumber';
|
|
5052
5343
|
const Gutter = 'Gutter';
|
|
5053
5344
|
const TableRowSelected = 'TableRowSelected';
|
|
@@ -5077,6 +5368,7 @@ const Resizer = 'Resizer';
|
|
|
5077
5368
|
const ResizerInner = 'ResizerInner';
|
|
5078
5369
|
const ResizerOne = 'ResizerOne';
|
|
5079
5370
|
const ResizerTwo = 'ResizerTwo';
|
|
5371
|
+
const ResizerThree = 'ResizerThree';
|
|
5080
5372
|
const TableHead = 'TableHead';
|
|
5081
5373
|
const Resizers = 'Resizers';
|
|
5082
5374
|
const TableCol = 'TableCol';
|
|
@@ -5123,25 +5415,17 @@ const ChatDebugViewCellDuration = 'ChatDebugViewCellDuration';
|
|
|
5123
5415
|
const ChatDebugViewCellStatusError = 'ChatDebugViewCellStatusError';
|
|
5124
5416
|
const InputBox = 'InputBox';
|
|
5125
5417
|
const TokenBoolean = 'Token TokenBoolean';
|
|
5418
|
+
const TokenComment = 'Token TokenComment';
|
|
5126
5419
|
const TokenKey = 'Token TokenKey';
|
|
5420
|
+
const TokenKeyword = 'Token TokenKeyword';
|
|
5127
5421
|
const TokenNumeric = 'Token TokenNumeric';
|
|
5422
|
+
const TokenAttributeName = 'Token TokenAttributeName';
|
|
5423
|
+
const TokenPropertyName = 'Token TokenPropertyName';
|
|
5424
|
+
const TokenSelector = 'Token TokenSelector';
|
|
5128
5425
|
const TokenString = 'Token TokenString';
|
|
5426
|
+
const TokenTag = 'Token TokenTag';
|
|
5129
5427
|
const TokenText = 'Token TokenText';
|
|
5130
5428
|
|
|
5131
|
-
const debugErrorRootNode = {
|
|
5132
|
-
childCount: 1,
|
|
5133
|
-
className: ChatDebugView,
|
|
5134
|
-
type: Div
|
|
5135
|
-
};
|
|
5136
|
-
const debugErrorMessageNode = {
|
|
5137
|
-
childCount: 1,
|
|
5138
|
-
className: ChatDebugViewError,
|
|
5139
|
-
type: Div
|
|
5140
|
-
};
|
|
5141
|
-
const getDebugErrorDom = errorMessage => {
|
|
5142
|
-
return [debugErrorRootNode, debugErrorMessageNode, text(errorMessage)];
|
|
5143
|
-
};
|
|
5144
|
-
|
|
5145
5429
|
const HandleEventCategoryFilter = 4;
|
|
5146
5430
|
const HandleFilterInput = 5;
|
|
5147
5431
|
const SelectDetailTab = 6;
|
|
@@ -5174,6 +5458,25 @@ const HandleTableScrollBarPointerDown = 32;
|
|
|
5174
5458
|
const HandleTableScrollBarPointerMove = 33;
|
|
5175
5459
|
const HandleTableScrollBarPointerUp = 34;
|
|
5176
5460
|
const HandleTableWheel = 35;
|
|
5461
|
+
const HandlePreviewTextWheel = 36;
|
|
5462
|
+
const HandlePreviewTextScrollBarPointerDown = 37;
|
|
5463
|
+
const HandlePreviewTextScrollBarPointerMove = 38;
|
|
5464
|
+
const HandlePreviewTextScrollBarPointerUp = 39;
|
|
5465
|
+
const HandleRootContextMenu = 40;
|
|
5466
|
+
|
|
5467
|
+
const debugErrorRootNode = {
|
|
5468
|
+
childCount: 1,
|
|
5469
|
+
className: ChatDebugView,
|
|
5470
|
+
type: Div
|
|
5471
|
+
};
|
|
5472
|
+
const debugErrorMessageNode = {
|
|
5473
|
+
childCount: 1,
|
|
5474
|
+
className: ChatDebugViewError,
|
|
5475
|
+
type: Div
|
|
5476
|
+
};
|
|
5477
|
+
const getDebugErrorDom = errorMessage => {
|
|
5478
|
+
return [debugErrorRootNode, debugErrorMessageNode, text(errorMessage)];
|
|
5479
|
+
};
|
|
5177
5480
|
|
|
5178
5481
|
const getFilterInputDom = (filterValue, useDevtoolsLayout) => {
|
|
5179
5482
|
return {
|
|
@@ -5285,13 +5588,13 @@ const getEditorSelectionDom = (cursor = defaultEditorCursor) => {
|
|
|
5285
5588
|
type: Div
|
|
5286
5589
|
}] : [])];
|
|
5287
5590
|
};
|
|
5288
|
-
const getGutterDom = (lineData, showLineNumbers) => {
|
|
5591
|
+
const getGutterDom = (lineData, showLineNumbers, lineNumberStart = 0) => {
|
|
5289
5592
|
const gutterNodes = showLineNumbers ? lineData.flatMap((_, index) => {
|
|
5290
5593
|
return [{
|
|
5291
5594
|
childCount: 1,
|
|
5292
5595
|
className: ChatDebugViewEventLineNumber,
|
|
5293
5596
|
type: Span
|
|
5294
|
-
}, text(String(index + 1))];
|
|
5597
|
+
}, text(String(lineNumberStart + index + 1))];
|
|
5295
5598
|
}) : [];
|
|
5296
5599
|
return [{
|
|
5297
5600
|
childCount: showLineNumbers ? lineData.length : 0,
|
|
@@ -5348,8 +5651,54 @@ const getEditorDom = (lineData, showLineNumbers = true, cursor = defaultEditorCu
|
|
|
5348
5651
|
type: Div
|
|
5349
5652
|
}, ...getEditorSelectionDom(cursor), ...getEditorRowsDom(lineData)];
|
|
5350
5653
|
};
|
|
5654
|
+
const getVirtualizedEditorDom = (lineData, showLineNumbers = true, cursor = null, onPointerDown, options) => {
|
|
5655
|
+
const editorChildren = [{
|
|
5656
|
+
childCount: 2,
|
|
5657
|
+
className: EditorViewlet,
|
|
5658
|
+
role: 'code',
|
|
5659
|
+
type: Div
|
|
5660
|
+
}, ...getGutterDom(lineData, showLineNumbers, options.lineNumberStart), {
|
|
5661
|
+
childCount: 2,
|
|
5662
|
+
className: EditorContent,
|
|
5663
|
+
onPointerDown,
|
|
5664
|
+
type: Div
|
|
5665
|
+
}, {
|
|
5666
|
+
'aria-autocomplete': 'list',
|
|
5667
|
+
'aria-multiline': true,
|
|
5668
|
+
'aria-roledescription': 'editor',
|
|
5669
|
+
autocapitalize: 'off',
|
|
5670
|
+
autocomplete: 'off',
|
|
5671
|
+
autocorrect: 'off',
|
|
5672
|
+
childCount: 0,
|
|
5673
|
+
className: EditorInput,
|
|
5674
|
+
name: 'editor',
|
|
5675
|
+
role: 'textbox',
|
|
5676
|
+
spellcheck: false,
|
|
5677
|
+
type: TextArea,
|
|
5678
|
+
wrap: 'off'
|
|
5679
|
+
}, {
|
|
5680
|
+
childCount: 2,
|
|
5681
|
+
className: EditorLayers,
|
|
5682
|
+
type: Div
|
|
5683
|
+
}, ...getEditorSelectionDom(cursor), ...getEditorRowsDom(lineData)];
|
|
5684
|
+
return [{
|
|
5685
|
+
childCount: options.showScrollBar ? 2 : 1,
|
|
5686
|
+
className: mergeClassNames(EditorContainer, PreviewVirtualizedEditor),
|
|
5687
|
+
onWheel: options.onWheel,
|
|
5688
|
+
type: Div
|
|
5689
|
+
}, ...editorChildren, ...(options.showScrollBar ? [{
|
|
5690
|
+
childCount: 1,
|
|
5691
|
+
className: PreviewTextScrollBar,
|
|
5692
|
+
onPointerDown: options.onScrollBarPointerDown,
|
|
5693
|
+
type: Div
|
|
5694
|
+
}, {
|
|
5695
|
+
childCount: 0,
|
|
5696
|
+
className: PreviewTextScrollBarThumb,
|
|
5697
|
+
type: Div
|
|
5698
|
+
}] : [])];
|
|
5699
|
+
};
|
|
5351
5700
|
|
|
5352
|
-
const isDigit = character => {
|
|
5701
|
+
const isDigit$1 = character => {
|
|
5353
5702
|
return character !== undefined && character >= '0' && character <= '9';
|
|
5354
5703
|
};
|
|
5355
5704
|
const isWhitespace = character => {
|
|
@@ -5363,10 +5712,10 @@ const getIntegerEnd = (json, start) => {
|
|
|
5363
5712
|
if (json[i] === '0') {
|
|
5364
5713
|
return i + 1;
|
|
5365
5714
|
}
|
|
5366
|
-
if (!isDigit(json[i])) {
|
|
5715
|
+
if (!isDigit$1(json[i])) {
|
|
5367
5716
|
return start;
|
|
5368
5717
|
}
|
|
5369
|
-
while (isDigit(json[i])) {
|
|
5718
|
+
while (isDigit$1(json[i])) {
|
|
5370
5719
|
i++;
|
|
5371
5720
|
}
|
|
5372
5721
|
return i;
|
|
@@ -5377,10 +5726,10 @@ const getFractionEnd = (json, start) => {
|
|
|
5377
5726
|
}
|
|
5378
5727
|
const decimalStart = start;
|
|
5379
5728
|
let i = start + 1;
|
|
5380
|
-
if (!isDigit(json[i])) {
|
|
5729
|
+
if (!isDigit$1(json[i])) {
|
|
5381
5730
|
return decimalStart;
|
|
5382
5731
|
}
|
|
5383
|
-
while (isDigit(json[i])) {
|
|
5732
|
+
while (isDigit$1(json[i])) {
|
|
5384
5733
|
i++;
|
|
5385
5734
|
}
|
|
5386
5735
|
return i;
|
|
@@ -5394,10 +5743,10 @@ const getExponentEnd = (json, start) => {
|
|
|
5394
5743
|
if (json[i] === '+' || json[i] === '-') {
|
|
5395
5744
|
i++;
|
|
5396
5745
|
}
|
|
5397
|
-
if (!isDigit(json[i])) {
|
|
5746
|
+
if (!isDigit$1(json[i])) {
|
|
5398
5747
|
return exponentStart;
|
|
5399
5748
|
}
|
|
5400
|
-
while (isDigit(json[i])) {
|
|
5749
|
+
while (isDigit$1(json[i])) {
|
|
5401
5750
|
i++;
|
|
5402
5751
|
}
|
|
5403
5752
|
return i;
|
|
@@ -5409,7 +5758,7 @@ const getWhitespaceEnd = (json, start) => {
|
|
|
5409
5758
|
}
|
|
5410
5759
|
return i;
|
|
5411
5760
|
};
|
|
5412
|
-
const getStringEnd = (json, start) => {
|
|
5761
|
+
const getStringEnd$1 = (json, start) => {
|
|
5413
5762
|
let i = start + 1;
|
|
5414
5763
|
while (i < json.length) {
|
|
5415
5764
|
const currentCharacter = json[i];
|
|
@@ -5425,7 +5774,7 @@ const getStringEnd = (json, start) => {
|
|
|
5425
5774
|
return i;
|
|
5426
5775
|
};
|
|
5427
5776
|
const emitStringToken = (json, start, onToken) => {
|
|
5428
|
-
const end = getStringEnd(json, start);
|
|
5777
|
+
const end = getStringEnd$1(json, start);
|
|
5429
5778
|
const lookAheadIndex = getWhitespaceEnd(json, end);
|
|
5430
5779
|
const className = json[lookAheadIndex] === ':' ? TokenKey : TokenString;
|
|
5431
5780
|
onToken(className, json.slice(start, end));
|
|
@@ -5452,7 +5801,7 @@ const getLiteralToken = (json, start) => {
|
|
|
5452
5801
|
}
|
|
5453
5802
|
return undefined;
|
|
5454
5803
|
};
|
|
5455
|
-
const getNumberEnd = (json, start) => {
|
|
5804
|
+
const getNumberEnd$1 = (json, start) => {
|
|
5456
5805
|
let i = getIntegerEnd(json, start);
|
|
5457
5806
|
if (i === start) {
|
|
5458
5807
|
return start;
|
|
@@ -5469,7 +5818,7 @@ const forEachTokenSegment = (json, onToken) => {
|
|
|
5469
5818
|
i = emitStringToken(json, i, onToken);
|
|
5470
5819
|
continue;
|
|
5471
5820
|
}
|
|
5472
|
-
const numberEnd = getNumberEnd(json, i);
|
|
5821
|
+
const numberEnd = getNumberEnd$1(json, i);
|
|
5473
5822
|
if (numberEnd > i) {
|
|
5474
5823
|
onToken(TokenNumeric, json.slice(i, numberEnd));
|
|
5475
5824
|
i = numberEnd;
|
|
@@ -5485,6 +5834,24 @@ const forEachTokenSegment = (json, onToken) => {
|
|
|
5485
5834
|
i++;
|
|
5486
5835
|
}
|
|
5487
5836
|
};
|
|
5837
|
+
const getTokenSegments = json => {
|
|
5838
|
+
const segments = [];
|
|
5839
|
+
forEachTokenSegment(json, (className, value) => {
|
|
5840
|
+
if (!value) {
|
|
5841
|
+
return;
|
|
5842
|
+
}
|
|
5843
|
+
const lastSegment = segments.at(-1);
|
|
5844
|
+
if (lastSegment && lastSegment.className === className) {
|
|
5845
|
+
lastSegment.value += value;
|
|
5846
|
+
return;
|
|
5847
|
+
}
|
|
5848
|
+
segments.push({
|
|
5849
|
+
className,
|
|
5850
|
+
value
|
|
5851
|
+
});
|
|
5852
|
+
});
|
|
5853
|
+
return segments;
|
|
5854
|
+
};
|
|
5488
5855
|
|
|
5489
5856
|
const getJsonLines = value => {
|
|
5490
5857
|
const json = JSON.stringify(value, null, 2);
|
|
@@ -5595,9 +5962,411 @@ const getImagePreviewDom = preview => {
|
|
|
5595
5962
|
}, ...getImagePreviewLabelDom(preview)];
|
|
5596
5963
|
};
|
|
5597
5964
|
|
|
5598
|
-
const
|
|
5965
|
+
const extensionToLanguage = {
|
|
5966
|
+
css: 'css',
|
|
5967
|
+
html: 'html',
|
|
5968
|
+
js: 'javascript',
|
|
5969
|
+
json: 'json',
|
|
5970
|
+
py: 'python',
|
|
5971
|
+
ts: 'typescript'
|
|
5972
|
+
};
|
|
5973
|
+
const getLanguageFromFileExtension = uri => {
|
|
5974
|
+
try {
|
|
5975
|
+
const url = new URL(uri);
|
|
5976
|
+
const path = url.pathname.toLowerCase();
|
|
5977
|
+
const lastDotIndex = path.lastIndexOf('.');
|
|
5978
|
+
if (lastDotIndex === -1) {
|
|
5979
|
+
return undefined;
|
|
5980
|
+
}
|
|
5981
|
+
const extension = path.slice(lastDotIndex + 1);
|
|
5982
|
+
return extensionToLanguage[extension];
|
|
5983
|
+
} catch {
|
|
5984
|
+
return undefined;
|
|
5985
|
+
}
|
|
5986
|
+
};
|
|
5987
|
+
|
|
5988
|
+
const pushToken = (segments, className, value) => {
|
|
5989
|
+
if (!value) {
|
|
5990
|
+
return segments;
|
|
5991
|
+
}
|
|
5992
|
+
const lastSegment = segments.at(-1);
|
|
5993
|
+
if (lastSegment && lastSegment.className === className) {
|
|
5994
|
+
const merged = {
|
|
5995
|
+
className,
|
|
5996
|
+
value: lastSegment.value + value
|
|
5997
|
+
};
|
|
5998
|
+
return [...segments.slice(0, -1), merged];
|
|
5999
|
+
}
|
|
6000
|
+
return [...segments, {
|
|
6001
|
+
className,
|
|
6002
|
+
value
|
|
6003
|
+
}];
|
|
6004
|
+
};
|
|
6005
|
+
|
|
6006
|
+
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
6007
|
+
|
|
6008
|
+
const jsIdentifierStartRegex = /[A-Za-z_$]/;
|
|
6009
|
+
const jsIdentifierPartRegex = /[\w$]/;
|
|
6010
|
+
const pythonIdentifierStartRegex = /[A-Za-z_]/;
|
|
6011
|
+
const pythonIdentifierPartRegex = /\w/;
|
|
6012
|
+
const cssIdentifierRegex = /[A-Za-z-]/;
|
|
6013
|
+
const htmlTagNameRegex = /[A-Za-z0-9:-]/;
|
|
6014
|
+
const htmlAttributeStartRegex = /[A-Za-z:_-]/;
|
|
6015
|
+
const htmlAttributePartRegex = /[\w:-]/;
|
|
6016
|
+
const leadingWhitespaceRegex = /^\s*/;
|
|
6017
|
+
const trailingWhitespaceRegex = /\s*$/;
|
|
6018
|
+
const jsKeywords = new Set(['async', 'await', 'class', 'const', 'else', 'export', 'extends', 'for', 'from', 'function', 'if', 'import', 'let', 'new', 'return', 'switch', 'try', 'while']);
|
|
6019
|
+
const tsKeywords = new Set([...jsKeywords, 'interface', 'implements', 'number', 'readonly', 'string', 'type']);
|
|
6020
|
+
const pythonKeywords = new Set(['as', 'class', 'def', 'elif', 'else', 'except', 'False', 'for', 'from', 'if', 'import', 'None', 'return', 'True', 'try', 'while', 'with']);
|
|
6021
|
+
const isIdentifierStart = character => {
|
|
6022
|
+
return !!character && jsIdentifierStartRegex.test(character);
|
|
6023
|
+
};
|
|
6024
|
+
const isIdentifierPart = character => {
|
|
6025
|
+
return !!character && jsIdentifierPartRegex.test(character);
|
|
6026
|
+
};
|
|
6027
|
+
const isPythonIdentifierStart = character => {
|
|
6028
|
+
return !!character && pythonIdentifierStartRegex.test(character);
|
|
6029
|
+
};
|
|
6030
|
+
const isPythonIdentifierPart = character => {
|
|
6031
|
+
return !!character && pythonIdentifierPartRegex.test(character);
|
|
6032
|
+
};
|
|
6033
|
+
const isDigit = character => {
|
|
6034
|
+
return !!character && character >= '0' && character <= '9';
|
|
6035
|
+
};
|
|
6036
|
+
const getStringEnd = (value, start, quote) => {
|
|
6037
|
+
let i = start + 1;
|
|
6038
|
+
while (i < value.length) {
|
|
6039
|
+
if (value[i] === '\\') {
|
|
6040
|
+
i += 2;
|
|
6041
|
+
continue;
|
|
6042
|
+
}
|
|
6043
|
+
if (value[i] === quote) {
|
|
6044
|
+
return i + 1;
|
|
6045
|
+
}
|
|
6046
|
+
i++;
|
|
6047
|
+
}
|
|
6048
|
+
return value.length;
|
|
6049
|
+
};
|
|
6050
|
+
const getBlockCommentEnd = (value, start, terminator) => {
|
|
6051
|
+
const endIndex = value.indexOf(terminator, start);
|
|
6052
|
+
if (endIndex === -1) {
|
|
6053
|
+
return value.length;
|
|
6054
|
+
}
|
|
6055
|
+
return endIndex + terminator.length;
|
|
6056
|
+
};
|
|
6057
|
+
const getLineCommentEnd = (value, start) => {
|
|
6058
|
+
const endIndex = value.indexOf('\n', start);
|
|
6059
|
+
if (endIndex === -1) {
|
|
6060
|
+
return value.length;
|
|
6061
|
+
}
|
|
6062
|
+
return endIndex;
|
|
6063
|
+
};
|
|
6064
|
+
const getNumberEnd = (value, start) => {
|
|
6065
|
+
let i = start;
|
|
6066
|
+
while (isDigit(value[i])) {
|
|
6067
|
+
i++;
|
|
6068
|
+
}
|
|
6069
|
+
if (value[i] === '.') {
|
|
6070
|
+
i++;
|
|
6071
|
+
while (isDigit(value[i])) {
|
|
6072
|
+
i++;
|
|
6073
|
+
}
|
|
6074
|
+
}
|
|
6075
|
+
return i;
|
|
6076
|
+
};
|
|
6077
|
+
const appendLineComment = (value, state) => {
|
|
6078
|
+
if (!value.startsWith('//', state.i) && !value.startsWith('#', state.i)) {
|
|
6079
|
+
return false;
|
|
6080
|
+
}
|
|
6081
|
+
const end = getLineCommentEnd(value, state.i);
|
|
6082
|
+
state.segments = pushToken(state.segments, TokenComment, value.slice(state.i, end));
|
|
6083
|
+
state.i = end;
|
|
6084
|
+
return true;
|
|
6085
|
+
};
|
|
6086
|
+
const appendBlockComment = (value, state) => {
|
|
6087
|
+
if (!value.startsWith('/*', state.i)) {
|
|
6088
|
+
return false;
|
|
6089
|
+
}
|
|
6090
|
+
const end = getBlockCommentEnd(value, state.i, '*/');
|
|
6091
|
+
state.segments = pushToken(state.segments, TokenComment, value.slice(state.i, end));
|
|
6092
|
+
state.i = end;
|
|
6093
|
+
return true;
|
|
6094
|
+
};
|
|
6095
|
+
const appendStringToken = (value, state) => {
|
|
6096
|
+
const quote = value[state.i];
|
|
6097
|
+
if (quote !== '"' && quote !== "'" && quote !== '`') {
|
|
6098
|
+
return false;
|
|
6099
|
+
}
|
|
6100
|
+
const end = getStringEnd(value, state.i, quote);
|
|
6101
|
+
state.segments = pushToken(state.segments, TokenString, value.slice(state.i, end));
|
|
6102
|
+
state.i = end;
|
|
6103
|
+
return true;
|
|
6104
|
+
};
|
|
6105
|
+
const appendNumericToken = (value, state) => {
|
|
6106
|
+
if (!isDigit(value[state.i])) {
|
|
6107
|
+
return false;
|
|
6108
|
+
}
|
|
6109
|
+
const end = getNumberEnd(value, state.i);
|
|
6110
|
+
state.segments = pushToken(state.segments, TokenNumeric, value.slice(state.i, end));
|
|
6111
|
+
state.i = end;
|
|
6112
|
+
return true;
|
|
6113
|
+
};
|
|
6114
|
+
const appendIdentifierToken = (value, state, keywords, isIdentifierStartCharacter, isIdentifierPartCharacter) => {
|
|
6115
|
+
if (!isIdentifierStartCharacter(value[state.i])) {
|
|
6116
|
+
return false;
|
|
6117
|
+
}
|
|
6118
|
+
let end = state.i + 1;
|
|
6119
|
+
while (isIdentifierPartCharacter(value[end])) {
|
|
6120
|
+
end++;
|
|
6121
|
+
}
|
|
6122
|
+
const identifier = value.slice(state.i, end);
|
|
6123
|
+
const className = keywords.has(identifier) ? TokenKeyword : TokenText;
|
|
6124
|
+
state.segments = pushToken(state.segments, className, identifier);
|
|
6125
|
+
state.i = end;
|
|
6126
|
+
return true;
|
|
6127
|
+
};
|
|
6128
|
+
const appendTextCharacter = (value, state) => {
|
|
6129
|
+
state.segments = pushToken(state.segments, TokenText, value[state.i]);
|
|
6130
|
+
state.i++;
|
|
6131
|
+
};
|
|
6132
|
+
const tokenizeCode = (value, keywords, isIdentifierStartCharacter, isIdentifierPartCharacter, supportsBlockComments) => {
|
|
6133
|
+
const state = {
|
|
6134
|
+
i: 0,
|
|
6135
|
+
segments: []
|
|
6136
|
+
};
|
|
6137
|
+
while (state.i < value.length) {
|
|
6138
|
+
if (appendLineComment(value, state)) {
|
|
6139
|
+
continue;
|
|
6140
|
+
}
|
|
6141
|
+
if (supportsBlockComments && appendBlockComment(value, state)) {
|
|
6142
|
+
continue;
|
|
6143
|
+
}
|
|
6144
|
+
if (appendStringToken(value, state)) {
|
|
6145
|
+
continue;
|
|
6146
|
+
}
|
|
6147
|
+
if (appendNumericToken(value, state)) {
|
|
6148
|
+
continue;
|
|
6149
|
+
}
|
|
6150
|
+
if (appendIdentifierToken(value, state, keywords, isIdentifierStartCharacter, isIdentifierPartCharacter)) {
|
|
6151
|
+
continue;
|
|
6152
|
+
}
|
|
6153
|
+
appendTextCharacter(value, state);
|
|
6154
|
+
}
|
|
6155
|
+
return state.segments;
|
|
6156
|
+
};
|
|
6157
|
+
const pushTrimmedSelector = (segments, value) => {
|
|
6158
|
+
const leadingWhitespace = value.match(leadingWhitespaceRegex)?.[0] ?? '';
|
|
6159
|
+
const trailingWhitespace = value.match(trailingWhitespaceRegex)?.[0] ?? '';
|
|
6160
|
+
const trimmed = value.slice(leadingWhitespace.length, value.length - trailingWhitespace.length);
|
|
6161
|
+
let result = segments;
|
|
6162
|
+
result = pushToken(result, TokenText, leadingWhitespace);
|
|
6163
|
+
result = pushToken(result, TokenSelector, trimmed);
|
|
6164
|
+
result = pushToken(result, TokenText, trailingWhitespace);
|
|
6165
|
+
return result;
|
|
6166
|
+
};
|
|
6167
|
+
const getCssIdentifierEnd = (value, start) => {
|
|
6168
|
+
let end = start + 1;
|
|
6169
|
+
while (cssIdentifierRegex.test(value[end] ?? '')) {
|
|
6170
|
+
end++;
|
|
6171
|
+
}
|
|
6172
|
+
return end;
|
|
6173
|
+
};
|
|
6174
|
+
const getCssIdentifierClassName = (value, end) => {
|
|
6175
|
+
let lookAhead = end;
|
|
6176
|
+
while (value[lookAhead] === ' ' || value[lookAhead] === '\t') {
|
|
6177
|
+
lookAhead++;
|
|
6178
|
+
}
|
|
6179
|
+
return value[lookAhead] === ':' ? TokenPropertyName : TokenText;
|
|
6180
|
+
};
|
|
6181
|
+
const appendCssIdentifier = (value, state) => {
|
|
6182
|
+
if (!cssIdentifierRegex.test(value[state.i] ?? '')) {
|
|
6183
|
+
return false;
|
|
6184
|
+
}
|
|
6185
|
+
const end = getCssIdentifierEnd(value, state.i);
|
|
6186
|
+
const identifier = value.slice(state.i, end);
|
|
6187
|
+
state.segments = pushToken(state.segments, getCssIdentifierClassName(value, end), identifier);
|
|
6188
|
+
state.i = end;
|
|
6189
|
+
return true;
|
|
6190
|
+
};
|
|
6191
|
+
const appendCssOutsideDeclaration = (value, state) => {
|
|
6192
|
+
const nextBrace = value.indexOf('{', state.i);
|
|
6193
|
+
if (nextBrace === -1) {
|
|
6194
|
+
state.segments = pushToken(state.segments, TokenText, value.slice(state.i));
|
|
6195
|
+
state.i = value.length;
|
|
6196
|
+
return true;
|
|
6197
|
+
}
|
|
6198
|
+
state.segments = pushTrimmedSelector(state.segments, value.slice(state.i, nextBrace));
|
|
6199
|
+
state.segments = pushToken(state.segments, TokenText, '{');
|
|
6200
|
+
state.i = nextBrace + 1;
|
|
6201
|
+
return false;
|
|
6202
|
+
};
|
|
6203
|
+
const handleCssDeclarationToken = (value, state) => {
|
|
6204
|
+
if (value[state.i] === '}') {
|
|
6205
|
+
state.segments = pushToken(state.segments, TokenText, '}');
|
|
6206
|
+
state.i++;
|
|
6207
|
+
return false;
|
|
6208
|
+
}
|
|
6209
|
+
if (appendNumericToken(value, state)) {
|
|
6210
|
+
return true;
|
|
6211
|
+
}
|
|
6212
|
+
if (appendCssIdentifier(value, state)) {
|
|
6213
|
+
return true;
|
|
6214
|
+
}
|
|
6215
|
+
appendTextCharacter(value, state);
|
|
6216
|
+
return true;
|
|
6217
|
+
};
|
|
6218
|
+
const tokenizeCss = value => {
|
|
6219
|
+
const state = {
|
|
6220
|
+
i: 0,
|
|
6221
|
+
segments: []
|
|
6222
|
+
};
|
|
6223
|
+
let inDeclarationBlock = false;
|
|
6224
|
+
while (state.i < value.length) {
|
|
6225
|
+
if (appendBlockComment(value, state)) {
|
|
6226
|
+
continue;
|
|
6227
|
+
}
|
|
6228
|
+
if (appendStringToken(value, state)) {
|
|
6229
|
+
continue;
|
|
6230
|
+
}
|
|
6231
|
+
if (!inDeclarationBlock) {
|
|
6232
|
+
if (appendCssOutsideDeclaration(value, state)) {
|
|
6233
|
+
break;
|
|
6234
|
+
}
|
|
6235
|
+
inDeclarationBlock = true;
|
|
6236
|
+
continue;
|
|
6237
|
+
}
|
|
6238
|
+
inDeclarationBlock = handleCssDeclarationToken(value, state);
|
|
6239
|
+
}
|
|
6240
|
+
return state.segments;
|
|
6241
|
+
};
|
|
6242
|
+
const getHtmlTagNameEnd = (value, start) => {
|
|
6243
|
+
let i = start + 1;
|
|
6244
|
+
while (htmlTagNameRegex.test(value[i] ?? '')) {
|
|
6245
|
+
i++;
|
|
6246
|
+
}
|
|
6247
|
+
return i;
|
|
6248
|
+
};
|
|
6249
|
+
const getHtmlAttributeEnd = (value, start) => {
|
|
6250
|
+
let end = start + 1;
|
|
6251
|
+
while (htmlAttributePartRegex.test(value[end] ?? '')) {
|
|
6252
|
+
end++;
|
|
6253
|
+
}
|
|
6254
|
+
return end;
|
|
6255
|
+
};
|
|
6256
|
+
const appendHtmlAttribute = (value, state) => {
|
|
6257
|
+
if (!htmlAttributeStartRegex.test(value[state.i] ?? '')) {
|
|
6258
|
+
return false;
|
|
6259
|
+
}
|
|
6260
|
+
const end = getHtmlAttributeEnd(value, state.i);
|
|
6261
|
+
state.segments = pushToken(state.segments, TokenAttributeName, value.slice(state.i, end));
|
|
6262
|
+
state.i = end;
|
|
6263
|
+
return true;
|
|
6264
|
+
};
|
|
6265
|
+
const appendHtmlString = (value, state) => {
|
|
6266
|
+
const quote = value[state.i];
|
|
6267
|
+
if (quote !== '"' && quote !== "'") {
|
|
6268
|
+
return false;
|
|
6269
|
+
}
|
|
6270
|
+
const end = getStringEnd(value, state.i, quote);
|
|
6271
|
+
state.segments = pushToken(state.segments, TokenString, value.slice(state.i, end));
|
|
6272
|
+
state.i = end;
|
|
6273
|
+
return true;
|
|
6274
|
+
};
|
|
6275
|
+
const tokenizeHtmlTag = (value, start) => {
|
|
6276
|
+
let segments = [];
|
|
6277
|
+
if (value.startsWith('</', start)) {
|
|
6278
|
+
const end = value.indexOf('>', start);
|
|
6279
|
+
const tagEnd = end === -1 ? value.length : end + 1;
|
|
6280
|
+
segments = pushToken(segments, TokenTag, value.slice(start, tagEnd));
|
|
6281
|
+
return {
|
|
6282
|
+
end: tagEnd,
|
|
6283
|
+
segments
|
|
6284
|
+
};
|
|
6285
|
+
}
|
|
6286
|
+
let i = getHtmlTagNameEnd(value, start);
|
|
6287
|
+
segments = pushToken(segments, TokenTag, value.slice(start, i));
|
|
6288
|
+
while (i < value.length) {
|
|
6289
|
+
if (value[i] === '>') {
|
|
6290
|
+
segments = pushToken(segments, TokenText, '>');
|
|
6291
|
+
return {
|
|
6292
|
+
end: i + 1,
|
|
6293
|
+
segments
|
|
6294
|
+
};
|
|
6295
|
+
}
|
|
6296
|
+
const state = {
|
|
6297
|
+
i,
|
|
6298
|
+
segments
|
|
6299
|
+
};
|
|
6300
|
+
if (appendHtmlString(value, state)) {
|
|
6301
|
+
({
|
|
6302
|
+
i,
|
|
6303
|
+
segments
|
|
6304
|
+
} = state);
|
|
6305
|
+
continue;
|
|
6306
|
+
}
|
|
6307
|
+
if (appendHtmlAttribute(value, state)) {
|
|
6308
|
+
({
|
|
6309
|
+
i,
|
|
6310
|
+
segments
|
|
6311
|
+
} = state);
|
|
6312
|
+
continue;
|
|
6313
|
+
}
|
|
6314
|
+
segments = pushToken(segments, TokenText, value[i]);
|
|
6315
|
+
i++;
|
|
6316
|
+
}
|
|
6317
|
+
return {
|
|
6318
|
+
end: value.length,
|
|
6319
|
+
segments
|
|
6320
|
+
};
|
|
6321
|
+
};
|
|
6322
|
+
const tokenizeHtml = value => {
|
|
6323
|
+
let segments = [];
|
|
6324
|
+
let i = 0;
|
|
6325
|
+
while (i < value.length) {
|
|
6326
|
+
if (value.startsWith('<!--', i)) {
|
|
6327
|
+
const end = getBlockCommentEnd(value, i, '-->');
|
|
6328
|
+
segments = pushToken(segments, TokenComment, value.slice(i, end));
|
|
6329
|
+
i = end;
|
|
6330
|
+
continue;
|
|
6331
|
+
}
|
|
6332
|
+
if (value[i] === '<') {
|
|
6333
|
+
const {
|
|
6334
|
+
end,
|
|
6335
|
+
segments: tagSegments
|
|
6336
|
+
} = tokenizeHtmlTag(value, i);
|
|
6337
|
+
for (const segment of tagSegments) {
|
|
6338
|
+
segments = pushToken(segments, segment.className, segment.value);
|
|
6339
|
+
}
|
|
6340
|
+
i = end;
|
|
6341
|
+
continue;
|
|
6342
|
+
}
|
|
6343
|
+
const nextTag = value.indexOf('<', i);
|
|
6344
|
+
const end = nextTag === -1 ? value.length : nextTag;
|
|
6345
|
+
segments = pushToken(segments, TokenText, value.slice(i, end));
|
|
6346
|
+
i = end;
|
|
6347
|
+
}
|
|
6348
|
+
return segments;
|
|
6349
|
+
};
|
|
6350
|
+
const getSyntaxHighlightTokens = (value, language) => {
|
|
6351
|
+
switch (language) {
|
|
6352
|
+
case 'css':
|
|
6353
|
+
return tokenizeCss(value);
|
|
6354
|
+
case 'html':
|
|
6355
|
+
return tokenizeHtml(value);
|
|
6356
|
+
case 'javascript':
|
|
6357
|
+
return tokenizeCode(value, jsKeywords, isIdentifierStart, isIdentifierPart, true);
|
|
6358
|
+
case 'json':
|
|
6359
|
+
return getTokenSegments(value);
|
|
6360
|
+
case 'python':
|
|
6361
|
+
return tokenizeCode(value, pythonKeywords, isPythonIdentifierStart, isPythonIdentifierPart, false);
|
|
6362
|
+
case 'typescript':
|
|
6363
|
+
return tokenizeCode(value, tsKeywords, isIdentifierStart, isIdentifierPart, true);
|
|
6364
|
+
}
|
|
6365
|
+
};
|
|
6366
|
+
|
|
6367
|
+
const getTextLineData = value => {
|
|
5599
6368
|
const lines = value.split('\n');
|
|
5600
|
-
|
|
6369
|
+
return lines.map(line => {
|
|
5601
6370
|
return {
|
|
5602
6371
|
childCount: 1,
|
|
5603
6372
|
nodes: [{
|
|
@@ -5607,15 +6376,79 @@ const getTextNode = (value, showLineNumbers = true, cursor = null) => {
|
|
|
5607
6376
|
}, text(line)]
|
|
5608
6377
|
};
|
|
5609
6378
|
});
|
|
6379
|
+
};
|
|
6380
|
+
const getTokenLineData = tokenSegments => {
|
|
6381
|
+
const lineData = [];
|
|
6382
|
+
let currentNodes = [];
|
|
6383
|
+
let childCount = 0;
|
|
6384
|
+
const pushLine = () => {
|
|
6385
|
+
lineData.push({
|
|
6386
|
+
childCount,
|
|
6387
|
+
nodes: currentNodes
|
|
6388
|
+
});
|
|
6389
|
+
currentNodes = [];
|
|
6390
|
+
childCount = 0;
|
|
6391
|
+
};
|
|
6392
|
+
const pushSegment = (className, segmentValue) => {
|
|
6393
|
+
if (!segmentValue) {
|
|
6394
|
+
return;
|
|
6395
|
+
}
|
|
6396
|
+
currentNodes.push({
|
|
6397
|
+
childCount: 1,
|
|
6398
|
+
className,
|
|
6399
|
+
type: Span
|
|
6400
|
+
}, text(segmentValue));
|
|
6401
|
+
childCount++;
|
|
6402
|
+
};
|
|
6403
|
+
for (const segment of tokenSegments) {
|
|
6404
|
+
let start = 0;
|
|
6405
|
+
for (let i = 0; i < segment.value.length; i++) {
|
|
6406
|
+
if (segment.value[i] !== '\n') {
|
|
6407
|
+
continue;
|
|
6408
|
+
}
|
|
6409
|
+
pushSegment(segment.className, segment.value.slice(start, i));
|
|
6410
|
+
pushLine();
|
|
6411
|
+
start = i + 1;
|
|
6412
|
+
}
|
|
6413
|
+
pushSegment(segment.className, segment.value.slice(start));
|
|
6414
|
+
}
|
|
6415
|
+
if (lineData.length === 0 || currentNodes.length > 0) {
|
|
6416
|
+
pushLine();
|
|
6417
|
+
}
|
|
6418
|
+
return lineData;
|
|
6419
|
+
};
|
|
6420
|
+
const getLineData = (value, tokenSegments) => {
|
|
6421
|
+
return tokenSegments ? getTokenLineData(tokenSegments) : getTextLineData(value);
|
|
6422
|
+
};
|
|
6423
|
+
const getTextNode = (value, showLineNumbers = true, cursor = null, tokenSegments, virtualization) => {
|
|
6424
|
+
const lineData = getLineData(value, tokenSegments);
|
|
6425
|
+
if (virtualization) {
|
|
6426
|
+
const slicedLineData = lineData.slice(virtualization.startLineY, virtualization.endLineY);
|
|
6427
|
+
const visibleCursor = cursor && cursor.rowIndex >= virtualization.startLineY && cursor.rowIndex < virtualization.endLineY ? {
|
|
6428
|
+
...cursor,
|
|
6429
|
+
rowIndex: cursor.rowIndex - virtualization.startLineY
|
|
6430
|
+
} : null;
|
|
6431
|
+
return getVirtualizedEditorDom(slicedLineData, showLineNumbers, visibleCursor, showLineNumbers ? HandlePreviewTextPointerDown : undefined, {
|
|
6432
|
+
lineNumberStart: virtualization.startLineY,
|
|
6433
|
+
onScrollBarPointerDown: HandlePreviewTextScrollBarPointerDown,
|
|
6434
|
+
onWheel: HandlePreviewTextWheel,
|
|
6435
|
+
showScrollBar: virtualization.showScrollBar
|
|
6436
|
+
});
|
|
6437
|
+
}
|
|
5610
6438
|
return getEditorDom(lineData, showLineNumbers, cursor, showLineNumbers ? HandlePreviewTextPointerDown : undefined);
|
|
5611
6439
|
};
|
|
5612
6440
|
|
|
5613
|
-
const getPreviewEventNodes = (previewEvent, selectedEvent, previewTextCursor) => {
|
|
6441
|
+
const getPreviewEventNodes = (previewEvent, selectedEvent, previewTextCursor, virtualization) => {
|
|
5614
6442
|
if (typeof previewEvent === 'string') {
|
|
5615
6443
|
const isInvalidImageMessage = previewEvent === ImageCouldNotBeLoaded;
|
|
5616
6444
|
const isChatMessageUpdatedPreview = !!selectedEvent && isChatMessageUpdatedEvent(selectedEvent);
|
|
5617
6445
|
const showLineNumbers = !isInvalidImageMessage && !isChatMessageUpdatedPreview;
|
|
5618
|
-
return getTextNode(previewEvent, showLineNumbers, showLineNumbers ? previewTextCursor ?? null : null);
|
|
6446
|
+
return getTextNode(previewEvent, showLineNumbers, showLineNumbers ? previewTextCursor ?? null : null, undefined, virtualization);
|
|
6447
|
+
}
|
|
6448
|
+
if (isWriteFilePreview(previewEvent)) {
|
|
6449
|
+
const language = getLanguageFromFileExtension(previewEvent.uri);
|
|
6450
|
+
const tokenSegments = language ? getSyntaxHighlightTokens(previewEvent.content, language) : undefined;
|
|
6451
|
+
return getTextNode(previewEvent.content, true, previewTextCursor ?? null, tokenSegments, virtualization);
|
|
5619
6452
|
}
|
|
5620
6453
|
if (previewEvent === undefined) {
|
|
5621
6454
|
return [];
|
|
@@ -5797,7 +6630,7 @@ const getTimingContentNodes = (responseEventNodes, selectedEvent) => {
|
|
|
5797
6630
|
}
|
|
5798
6631
|
return getTimingDetailsDom(selectedEvent);
|
|
5799
6632
|
};
|
|
5800
|
-
const getPreviewContentNodes = (previewEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex) => {
|
|
6633
|
+
const getPreviewContentNodes = (previewEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, virtualization) => {
|
|
5801
6634
|
if (previewEventNodes.length > 0) {
|
|
5802
6635
|
return previewEventNodes;
|
|
5803
6636
|
}
|
|
@@ -5807,7 +6640,7 @@ const getPreviewContentNodes = (previewEventNodes, selectedEvent, previewTextCur
|
|
|
5807
6640
|
return getPreviewEventNodes(getPreviewEvent(selectedEvent), selectedEvent, previewTextCursorRowIndex === null || previewTextCursorColumnIndex === null ? null : {
|
|
5808
6641
|
columnIndex: previewTextCursorColumnIndex,
|
|
5809
6642
|
rowIndex: previewTextCursorRowIndex
|
|
5810
|
-
});
|
|
6643
|
+
}, virtualization);
|
|
5811
6644
|
};
|
|
5812
6645
|
const getPayloadContentNodes = (payloadEventNodes, selectedEvent) => {
|
|
5813
6646
|
if (payloadEventNodes.length > 0) {
|
|
@@ -5827,19 +6660,19 @@ const getResponseContentNodes = (responseEventNodes, selectedEvent) => {
|
|
|
5827
6660
|
}
|
|
5828
6661
|
return getEventNode(selectedEvent);
|
|
5829
6662
|
};
|
|
5830
|
-
const getSelectedContentNodes = (safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex) => {
|
|
6663
|
+
const getSelectedContentNodes = (safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization) => {
|
|
5831
6664
|
if (safeSelectedDetailTab === Timing) {
|
|
5832
6665
|
return getTimingContentNodes(responseEventNodes, selectedEvent);
|
|
5833
6666
|
}
|
|
5834
6667
|
if (safeSelectedDetailTab === Preview) {
|
|
5835
|
-
return getPreviewContentNodes(previewEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex);
|
|
6668
|
+
return getPreviewContentNodes(previewEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization);
|
|
5836
6669
|
}
|
|
5837
6670
|
if (safeSelectedDetailTab === Payload) {
|
|
5838
6671
|
return getPayloadContentNodes(payloadEventNodes, selectedEvent);
|
|
5839
6672
|
}
|
|
5840
6673
|
return getResponseContentNodes(responseEventNodes, selectedEvent);
|
|
5841
6674
|
};
|
|
5842
|
-
const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes, responseEventNodes = payloadEventNodes, selectedEvent = null, detailTabs = createDetailTabs(), previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null) => {
|
|
6675
|
+
const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes, responseEventNodes = payloadEventNodes, selectedEvent = null, detailTabs = createDetailTabs(), previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, previewVirtualization) => {
|
|
5843
6676
|
if (previewEventNodes.length === 0 && payloadEventNodes.length === 0 && responseEventNodes.length === 0) {
|
|
5844
6677
|
return [];
|
|
5845
6678
|
}
|
|
@@ -5847,7 +6680,7 @@ const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes,
|
|
|
5847
6680
|
const safeSelectedDetailTab = getSelectedDetailTab(normalizedDetailTabs);
|
|
5848
6681
|
const selectedDetailTab = normalizedDetailTabs.find(detailTab => detailTab.name === safeSelectedDetailTab) ?? normalizedDetailTabs[0];
|
|
5849
6682
|
const getDetailContentDom = () => {
|
|
5850
|
-
const contentNodes = getSelectedContentNodes(safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex);
|
|
6683
|
+
const contentNodes = getSelectedContentNodes(safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization);
|
|
5851
6684
|
return [{
|
|
5852
6685
|
'aria-label': selectedDetailTab.label,
|
|
5853
6686
|
childCount: getDirectChildCount$1(contentNodes),
|
|
@@ -5870,6 +6703,26 @@ const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes,
|
|
|
5870
6703
|
}, ...getDetailsCloseButtonDom(), ...getTabNodes(normalizedDetailTabs), ...getDetailContentDom()];
|
|
5871
6704
|
};
|
|
5872
6705
|
|
|
6706
|
+
const getMethods = new Set(['list_dir', 'list_files', 'read_file']);
|
|
6707
|
+
const postMethods = new Set(['create_directory', 'create_file', 'mkdir', 'write_file']);
|
|
6708
|
+
const deleteMethods = new Set(['delete_directory', 'delete_file', 'delete_folder', 'remove_directory', 'remove_file', 'remove_folder']);
|
|
6709
|
+
const getEventTableMethodLabel = event => {
|
|
6710
|
+
const toolName = getToolName(event);
|
|
6711
|
+
if (!toolName) {
|
|
6712
|
+
return '';
|
|
6713
|
+
}
|
|
6714
|
+
if (getMethods.has(toolName)) {
|
|
6715
|
+
return 'GET';
|
|
6716
|
+
}
|
|
6717
|
+
if (postMethods.has(toolName)) {
|
|
6718
|
+
return 'POST';
|
|
6719
|
+
}
|
|
6720
|
+
if (deleteMethods.has(toolName)) {
|
|
6721
|
+
return 'DELETE';
|
|
6722
|
+
}
|
|
6723
|
+
return '';
|
|
6724
|
+
};
|
|
6725
|
+
|
|
5873
6726
|
const getRowCellNodes = (event, isErrorStatus, visibleTableColumns) => {
|
|
5874
6727
|
const orderedVisibleTableColumns = getOrderedVisibleTableColumns(visibleTableColumns);
|
|
5875
6728
|
return orderedVisibleTableColumns.flatMap((column, index) => {
|
|
@@ -5880,6 +6733,12 @@ const getRowCellNodes = (event, isErrorStatus, visibleTableColumns) => {
|
|
|
5880
6733
|
className: mergeClassNames(TableCell, ChatDebugViewCellDuration),
|
|
5881
6734
|
type: Td
|
|
5882
6735
|
}, text(getEventTableDurationText(event))];
|
|
6736
|
+
case Method:
|
|
6737
|
+
return [{
|
|
6738
|
+
childCount: 1,
|
|
6739
|
+
className: TableCell,
|
|
6740
|
+
type: Td
|
|
6741
|
+
}, text(getEventTableMethodLabel(event))];
|
|
5883
6742
|
case Status$1:
|
|
5884
6743
|
return [{
|
|
5885
6744
|
childCount: 1,
|
|
@@ -6050,7 +6909,7 @@ const getTableBodyDom = (rowNodes, eventCount) => {
|
|
|
6050
6909
|
}, ...rowNodes];
|
|
6051
6910
|
};
|
|
6052
6911
|
|
|
6053
|
-
const tableColClassNames = ['TableColZero', 'TableColOne', 'TableColTwo'];
|
|
6912
|
+
const tableColClassNames = ['TableColZero', 'TableColOne', 'TableColTwo', 'TableColThree'];
|
|
6054
6913
|
const getTableColumnGroupDom = visibleTableColumns => {
|
|
6055
6914
|
const orderedVisibleTableColumns = getOrderedVisibleTableColumns(visibleTableColumns);
|
|
6056
6915
|
return [{
|
|
@@ -6073,6 +6932,7 @@ const getHeaderCellNode = (column, tableColumns) => {
|
|
|
6073
6932
|
type: Th
|
|
6074
6933
|
}, text(getTableColumnLabel(tableColumns, column))];
|
|
6075
6934
|
};
|
|
6935
|
+
|
|
6076
6936
|
const getHeaderCellNodes = (visibleTableColumns, tableColumns = createTableColumns()) => {
|
|
6077
6937
|
const orderedVisibleTableColumns = getOrderedVisibleTableColumns(visibleTableColumns, tableColumns);
|
|
6078
6938
|
return orderedVisibleTableColumns.flatMap(column => getHeaderCellNode(column, tableColumns));
|
|
@@ -6101,8 +6961,8 @@ const getTableDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleT
|
|
|
6101
6961
|
}, ...getTableColumnGroupDom(visibleTableColumns), ...getTableHeaderDom(visibleTableColumns, tableColumns), ...getTableBodyDom(rowNodes, eventCount)];
|
|
6102
6962
|
};
|
|
6103
6963
|
|
|
6104
|
-
const resizerNames = ['ResizerOne', 'ResizerTwo'];
|
|
6105
|
-
const resizerClassNames = [ResizerOne, ResizerTwo];
|
|
6964
|
+
const resizerNames = ['ResizerOne', 'ResizerTwo', 'ResizerThree'];
|
|
6965
|
+
const resizerClassNames = [ResizerOne, ResizerTwo, ResizerThree];
|
|
6106
6966
|
const getTableResizersDom = visibleTableColumns => {
|
|
6107
6967
|
const visibleColumnCount = getOrderedVisibleTableColumns(visibleTableColumns).length;
|
|
6108
6968
|
const resizerCount = Math.max(0, visibleColumnCount - 1);
|
|
@@ -6127,6 +6987,7 @@ const getTableResizersDom = visibleTableColumns => {
|
|
|
6127
6987
|
return [{
|
|
6128
6988
|
childCount: resizerCount,
|
|
6129
6989
|
className: Resizers,
|
|
6990
|
+
role: None,
|
|
6130
6991
|
type: Div
|
|
6131
6992
|
}, ...resizerNodes];
|
|
6132
6993
|
};
|
|
@@ -6147,7 +7008,7 @@ const getTableScrollBarDom = visible => {
|
|
|
6147
7008
|
}];
|
|
6148
7009
|
};
|
|
6149
7010
|
|
|
6150
|
-
const getTableWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), summary = '', focus = 0, className = '', role = '', showScrollBar = false) => {
|
|
7011
|
+
const getTableWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), summary = '', focus = 0, className = '', role = 'none', showScrollBar = false) => {
|
|
6151
7012
|
const tableWrapperClassName = mergeClassNames(TableWrapper, focus === FocusChatDebugTable ? FocusOutline : '', className);
|
|
6152
7013
|
const tableWrapperNode = {
|
|
6153
7014
|
childCount: showScrollBar ? 3 : 2,
|
|
@@ -6161,7 +7022,7 @@ const getTableWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultV
|
|
|
6161
7022
|
return [tableWrapperNode, ...getTableDom(rowNodes, eventCount, visibleTableColumns, tableColumns, summary, focus), ...getTableResizersDom(visibleTableColumns), ...getTableScrollBarDom(showScrollBar)];
|
|
6162
7023
|
};
|
|
6163
7024
|
|
|
6164
|
-
const getTableWrapperWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), summary = '', focus = 0, className = '', role = '', showScrollBar = false) => {
|
|
7025
|
+
const getTableWrapperWrapperDom = (rowNodes, eventCount, visibleTableColumns = defaultVisibleTableColumns, tableColumns = createTableColumns(), summary = '', focus = 0, className = '', role = 'none', showScrollBar = false) => {
|
|
6165
7026
|
const tableSummaryNodes = getTableSummaryDom(summary);
|
|
6166
7027
|
return [{
|
|
6167
7028
|
childCount: tableSummaryNodes.length === 0 ? 1 : 2,
|
|
@@ -6338,25 +7199,31 @@ const getTimelineDom = (timelineInfo, hoverPercent = null) => {
|
|
|
6338
7199
|
}, ...selectionNodes];
|
|
6339
7200
|
};
|
|
6340
7201
|
|
|
6341
|
-
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, minLineY = 0, maxLineY = events.length) => {
|
|
7202
|
+
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) => {
|
|
6342
7203
|
const visibleEvents = events.slice(minLineY, maxLineY);
|
|
6343
7204
|
const rowNodes = getDevtoolsRows(visibleEvents, selectedEventIndex, visibleTableColumns, minLineY);
|
|
6344
7205
|
const effectiveRange = getEffectiveTimelineRange(timelineStartSeconds, timelineEndSeconds, timelineSelectionActive, timelineSelectionAnchorSeconds, timelineSelectionFocusSeconds);
|
|
6345
7206
|
const resolvedTimelineInfo = timelineInfo || getTimelineInfo(timelineEvents, effectiveRange.startSeconds, effectiveRange.endSeconds);
|
|
6346
7207
|
const timelineNodes = getTimelineDom(resolvedTimelineInfo, timelineHoverPercent);
|
|
6347
7208
|
const previewEvent = selectedEvent ? getPreviewEvent(selectedEvent) : undefined;
|
|
7209
|
+
const previewVirtualization = getPreviewVirtualizationState(selectedEvent, previewTextViewportHeight, previewTextDeltaY);
|
|
7210
|
+
const previewVirtualizationOptions = previewTextViewportHeight <= 0 || previewVirtualization.totalLineCount === 0 ? undefined : {
|
|
7211
|
+
endLineY: previewVirtualization.endLineY,
|
|
7212
|
+
showScrollBar: previewVirtualization.showScrollBar,
|
|
7213
|
+
startLineY: previewVirtualization.startLineY
|
|
7214
|
+
};
|
|
6348
7215
|
const previewEventNodes = getPreviewEventNodes(previewEvent, selectedEvent, previewTextCursorRowIndex === null || previewTextCursorColumnIndex === null ? null : {
|
|
6349
7216
|
columnIndex: previewTextCursorColumnIndex,
|
|
6350
7217
|
rowIndex: previewTextCursorRowIndex
|
|
6351
|
-
});
|
|
7218
|
+
}, previewVirtualizationOptions);
|
|
6352
7219
|
const payloadEventNodes = selectedEvent ? getEventNode(getPayloadEvent(selectedEvent)) : [];
|
|
6353
7220
|
const responseEventNodes = selectedEvent ? getEventNode(getResponseEvent(selectedEvent)) : [];
|
|
6354
|
-
const hasSelectedEvent =
|
|
7221
|
+
const hasSelectedEvent = !!selectedEvent;
|
|
6355
7222
|
const eventsClassName = getEventsClassName(hasSelectedEvent);
|
|
6356
7223
|
const summary = getTableSummary(events);
|
|
6357
7224
|
const showScrollBar = visibleEvents.length < events.length;
|
|
6358
7225
|
const tableNodes = events.length === 0 ? getEmptyStateDom(emptyMessage) : getTableWrapperWrapperDom(rowNodes, visibleEvents.length, visibleTableColumns, tableColumns, summary, focus, '', '', showScrollBar);
|
|
6359
|
-
const detailsNodes = getDetailsDom(previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, detailTabs, previewTextCursorRowIndex, previewTextCursorColumnIndex);
|
|
7226
|
+
const detailsNodes = getDetailsDom(previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, detailTabs, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualizationOptions);
|
|
6360
7227
|
const sashNodes = getSashNodesDom(hasSelectedEvent);
|
|
6361
7228
|
const splitChildCount = hasSelectedEvent ? 3 : 1;
|
|
6362
7229
|
const rootChildCount = 3;
|
|
@@ -6410,7 +7277,7 @@ const getEventCategoryFilterDescription = eventCategoryFilters => {
|
|
|
6410
7277
|
}
|
|
6411
7278
|
return eventCategoryFilters.map(eventCategoryFilter => getEventCategoryFilterLabel(eventCategoryFilter).toLowerCase()).join(', ');
|
|
6412
7279
|
};
|
|
6413
|
-
const getChatDebugViewDom = (errorMessage, filterValue, eventCategoryFilters, categoryFilters, _showEventStreamFinishedEvents, _showInputEvents, _showResponsePartEvents, useDevtoolsLayout, selectedEvent, selectedEventIndex, timelineStartSeconds, timelineEndSeconds, timelineFilterDescription, timelineEvents, events, timelineSelectionActive = false, timelineSelectionAnchorSeconds = '', timelineSelectionFocusSeconds = '', visibleTableColumns = defaultVisibleTableColumns, detailTabs = createDetailTabs(), tableColumns = createTableColumns(), timelineInfo, timelineHoverPercent = null, focus = 0, previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, minLineY = 0, maxLineY = events.length) => {
|
|
7280
|
+
const getChatDebugViewDom = (errorMessage, filterValue, eventCategoryFilters, categoryFilters, _showEventStreamFinishedEvents, _showInputEvents, _showResponsePartEvents, useDevtoolsLayout, selectedEvent, selectedEventIndex, timelineStartSeconds, timelineEndSeconds, timelineFilterDescription, timelineEvents, events, timelineSelectionActive = false, timelineSelectionAnchorSeconds = '', timelineSelectionFocusSeconds = '', visibleTableColumns = defaultVisibleTableColumns, detailTabs = createDetailTabs(), tableColumns = createTableColumns(), timelineInfo, timelineHoverPercent = null, focus = 0, previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, minLineY = 0, maxLineY = events.length, previewTextDeltaY = 0, previewTextViewportHeight = 0) => {
|
|
6414
7281
|
if (errorMessage) {
|
|
6415
7282
|
return getDebugErrorDom(errorMessage);
|
|
6416
7283
|
}
|
|
@@ -6434,13 +7301,14 @@ const getChatDebugViewDom = (errorMessage, filterValue, eventCategoryFilters, ca
|
|
|
6434
7301
|
const emptyMessage = getEmptyMessage(events.length, hasFilterValue, useNoToolCallEventsMessage, noFilteredEventsMessage);
|
|
6435
7302
|
const safeSelectedEventIndex = selectedEventIndex === null || selectedEventIndex < 0 || selectedEventIndex >= events.length ? null : selectedEventIndex;
|
|
6436
7303
|
if (useDevtoolsLayout) {
|
|
6437
|
-
const devtoolsDom = getDevtoolsDom(events, selectedEvent, safeSelectedEventIndex, timelineEvents, timelineStartSeconds, timelineEndSeconds, emptyMessage, timelineSelectionActive, timelineSelectionAnchorSeconds, timelineSelectionFocusSeconds, detailTabs, visibleTableColumns, tableColumns, timelineInfo, timelineHoverPercent, focus, previewTextCursorRowIndex, previewTextCursorColumnIndex, minLineY, maxLineY);
|
|
7304
|
+
const devtoolsDom = getDevtoolsDom(events, selectedEvent, safeSelectedEventIndex, timelineEvents, timelineStartSeconds, timelineEndSeconds, emptyMessage, timelineSelectionActive, timelineSelectionAnchorSeconds, timelineSelectionFocusSeconds, detailTabs, visibleTableColumns, tableColumns, timelineInfo, timelineHoverPercent, focus, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewTextDeltaY, previewTextViewportHeight, minLineY, maxLineY);
|
|
6438
7305
|
const devtoolsContentNodes = devtoolsDom.slice(1);
|
|
6439
7306
|
const topLevelNodes = [...getDebugViewTopDom(filterValue, useDevtoolsLayout, categoryFilters), ...devtoolsContentNodes];
|
|
6440
7307
|
const rootChildCount = getTopLevelChildCount(topLevelNodes);
|
|
6441
7308
|
return [{
|
|
6442
7309
|
childCount: rootChildCount,
|
|
6443
7310
|
className: mergeClassNames(ChatDebugView, ChatDebugViewDevtools),
|
|
7311
|
+
onContextMenu: HandleRootContextMenu,
|
|
6444
7312
|
type: Div
|
|
6445
7313
|
}, ...topLevelNodes];
|
|
6446
7314
|
}
|
|
@@ -6450,6 +7318,7 @@ const getChatDebugViewDom = (errorMessage, filterValue, eventCategoryFilters, ca
|
|
|
6450
7318
|
return [{
|
|
6451
7319
|
childCount: rootChildCount,
|
|
6452
7320
|
className: mergeClassNames(ChatDebugView, useDevtoolsLayout ? ChatDebugViewDevtools : ''),
|
|
7321
|
+
onContextMenu: HandleRootContextMenu,
|
|
6453
7322
|
type: Div
|
|
6454
7323
|
}, ...debugViewTopDom, ...contentNodes];
|
|
6455
7324
|
};
|
|
@@ -6467,7 +7336,8 @@ const renderItems = (oldState, newState) => {
|
|
|
6467
7336
|
return [SetDom2, newState.uid, []];
|
|
6468
7337
|
}
|
|
6469
7338
|
const filteredEvents = getCurrentEvents$2(newState);
|
|
6470
|
-
const
|
|
7339
|
+
const previewTextViewportHeight = getPreviewTextViewportHeight(newState);
|
|
7340
|
+
const dom = getChatDebugViewDom(newState.errorMessage, newState.filterValue, getSelectedEventCategoryFilters(newState.categoryFilters), newState.categoryFilters, newState.showEventStreamFinishedEvents, newState.showInputEvents, newState.showResponsePartEvents, newState.useDevtoolsLayout, newState.selectedEvent, newState.selectedEventIndex, newState.timelineStartSeconds, newState.timelineEndSeconds, newState.timelineFilterDescription, withSessionEventIds(newState.timelineEvents), withSessionEventIds(filteredEvents), newState.timelineSelectionActive, newState.timelineSelectionAnchorSeconds, newState.timelineSelectionFocusSeconds, getVisibleTableColumns(newState.tableColumns), newState.detailTabs, newState.tableColumns, newState.timelineInfo, newState.timelineHoverPercent, newState.focus, newState.previewTextCursorRowIndex, newState.previewTextCursorColumnIndex, newState.tableMinLineY, newState.tableMaxLineY, newState.previewTextDeltaY, previewTextViewportHeight);
|
|
6471
7341
|
return [SetDom2, newState.uid, dom];
|
|
6472
7342
|
};
|
|
6473
7343
|
|
|
@@ -6539,6 +7409,10 @@ const render2 = (uid, diffResult) => {
|
|
|
6539
7409
|
|
|
6540
7410
|
const renderEventListeners = () => {
|
|
6541
7411
|
return [{
|
|
7412
|
+
name: HandleRootContextMenu,
|
|
7413
|
+
params: ['handleRootContextMenu'],
|
|
7414
|
+
preventDefault: true
|
|
7415
|
+
}, {
|
|
6542
7416
|
name: HandleHeaderContextMenu,
|
|
6543
7417
|
params: ['handleHeaderContextMenu', ClientX, ClientY],
|
|
6544
7418
|
preventDefault: true
|
|
@@ -6626,6 +7500,21 @@ const renderEventListeners = () => {
|
|
|
6626
7500
|
params: ['handleTableWheel', 'event.deltaY'],
|
|
6627
7501
|
passive: true,
|
|
6628
7502
|
preventDefault: true
|
|
7503
|
+
}, {
|
|
7504
|
+
name: HandlePreviewTextWheel,
|
|
7505
|
+
params: ['handlePreviewTextWheel', 'event.deltaY'],
|
|
7506
|
+
passive: true,
|
|
7507
|
+
preventDefault: true
|
|
7508
|
+
}, {
|
|
7509
|
+
name: HandlePreviewTextScrollBarPointerDown,
|
|
7510
|
+
params: ['handlePreviewTextScrollBarPointerDown', ClientY],
|
|
7511
|
+
trackPointerEvents: [HandlePreviewTextScrollBarPointerMove, HandlePreviewTextScrollBarPointerUp]
|
|
7512
|
+
}, {
|
|
7513
|
+
name: HandlePreviewTextScrollBarPointerMove,
|
|
7514
|
+
params: ['handlePreviewTextScrollBarPointerMove', ClientY]
|
|
7515
|
+
}, {
|
|
7516
|
+
name: HandlePreviewTextScrollBarPointerUp,
|
|
7517
|
+
params: ['handlePreviewTextScrollBarPointerUp']
|
|
6629
7518
|
}, {
|
|
6630
7519
|
name: HandleTimelinePointerDown,
|
|
6631
7520
|
params: ['handleTimelinePointerDown', TargetName, ClientX],
|
|
@@ -6653,11 +7542,13 @@ const rerender = state => {
|
|
|
6653
7542
|
};
|
|
6654
7543
|
|
|
6655
7544
|
const resetTableColumns = state => {
|
|
6656
|
-
if (getVisibleTableColumns(state.tableColumns).join(',') === defaultVisibleTableColumns.join(',') && isSameTableColumnWidths(state.tableColumnWidths, defaultTableColumnWidths)) {
|
|
7545
|
+
if (getVisibleTableColumns(state.tableColumns).join(',') === defaultVisibleTableColumns.join(',') && isSameTableColumnWidths(state.tableColumnWidths, defaultTableColumnWidths) && state.sortColumn === '' && state.sortDescending === false) {
|
|
6657
7546
|
return state;
|
|
6658
7547
|
}
|
|
6659
7548
|
return {
|
|
6660
7549
|
...state,
|
|
7550
|
+
sortColumn: '',
|
|
7551
|
+
sortDescending: false,
|
|
6661
7552
|
tableColumns: createTableColumns(),
|
|
6662
7553
|
tableColumnWidths: defaultTableColumnWidths
|
|
6663
7554
|
};
|
|
@@ -6727,6 +7618,9 @@ const setEvents = (state, events) => {
|
|
|
6727
7618
|
initial: false,
|
|
6728
7619
|
previewTextCursorColumnIndex: null,
|
|
6729
7620
|
previewTextCursorRowIndex: null,
|
|
7621
|
+
previewTextDeltaY: 0,
|
|
7622
|
+
previewTextScrollBarHandleOffset: 0,
|
|
7623
|
+
previewTextScrollBarPointerActive: false,
|
|
6730
7624
|
selectedEvent: null,
|
|
6731
7625
|
selectedEventId: null,
|
|
6732
7626
|
selectedEventIndex: null
|
|
@@ -6754,6 +7648,9 @@ const setSessionId = async (state, sessionId) => {
|
|
|
6754
7648
|
initial: false,
|
|
6755
7649
|
previewTextCursorColumnIndex: null,
|
|
6756
7650
|
previewTextCursorRowIndex: null,
|
|
7651
|
+
previewTextDeltaY: 0,
|
|
7652
|
+
previewTextScrollBarHandleOffset: 0,
|
|
7653
|
+
previewTextScrollBarPointerActive: false,
|
|
6757
7654
|
selectedEvent: null,
|
|
6758
7655
|
selectedEventId: null,
|
|
6759
7656
|
selectedEventIndex: null,
|
|
@@ -6770,6 +7667,9 @@ const setSessionId = async (state, sessionId) => {
|
|
|
6770
7667
|
initial: false,
|
|
6771
7668
|
previewTextCursorColumnIndex: null,
|
|
6772
7669
|
previewTextCursorRowIndex: null,
|
|
7670
|
+
previewTextDeltaY: 0,
|
|
7671
|
+
previewTextScrollBarHandleOffset: 0,
|
|
7672
|
+
previewTextScrollBarPointerActive: false,
|
|
6773
7673
|
selectedEvent: null,
|
|
6774
7674
|
selectedEventId: null,
|
|
6775
7675
|
selectedEventIndex: null,
|
|
@@ -6820,6 +7720,11 @@ const commandMap = {
|
|
|
6820
7720
|
'ChatDebug.handleHeaderContextMenu': wrapCommand(handleHeaderContextMenu),
|
|
6821
7721
|
'ChatDebug.handleInput': wrapCommand(handleInput),
|
|
6822
7722
|
'ChatDebug.handlePreviewTextPointerDown': wrapCommand(handlePreviewTextPointerDown),
|
|
7723
|
+
'ChatDebug.handlePreviewTextScrollBarPointerDown': wrapCommand(handlePreviewTextScrollBarPointerDown),
|
|
7724
|
+
'ChatDebug.handlePreviewTextScrollBarPointerMove': wrapCommand(handlePreviewTextScrollBarPointerMove),
|
|
7725
|
+
'ChatDebug.handlePreviewTextScrollBarPointerUp': wrapCommand(handlePreviewTextScrollBarPointerUp),
|
|
7726
|
+
'ChatDebug.handlePreviewTextWheel': wrapCommand(handlePreviewTextWheel),
|
|
7727
|
+
'ChatDebug.handleRootContextMenu': wrapCommand(handleRootContextMenu),
|
|
6823
7728
|
'ChatDebug.handleSashPointerDown': wrapCommand(handleSashPointerDown),
|
|
6824
7729
|
'ChatDebug.handleSashPointerMove': wrapCommand(handleSashPointerMove),
|
|
6825
7730
|
'ChatDebug.handleSashPointerUp': wrapCommand(handleSashPointerUp),
|