@lvce-editor/chat-debug-view 10.8.0 → 10.10.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 +146 -134
- package/package.json +1 -1
|
@@ -5541,18 +5541,51 @@ const getDebugViewTopDom = (filterValue, useDevtoolsLayout, categoryFilters) =>
|
|
|
5541
5541
|
return [{
|
|
5542
5542
|
childCount: 2 + (quickFilterNodes.length > 0 ? 1 : 0),
|
|
5543
5543
|
className: mergeClassNames(ChatDebugViewTop, ChatDebugViewTopDevtools),
|
|
5544
|
-
onContextMenu: HandleHeaderContextMenu,
|
|
5545
5544
|
type: Search
|
|
5546
5545
|
}, getFilterInputDom(filterValue, true), ...quickFilterNodes, ...refreshButtonDom];
|
|
5547
5546
|
}
|
|
5548
5547
|
return [{
|
|
5549
5548
|
childCount: 2,
|
|
5550
5549
|
className: ChatDebugViewTop,
|
|
5551
|
-
onContextMenu: HandleHeaderContextMenu,
|
|
5552
5550
|
type: Search
|
|
5553
5551
|
}, getFilterInputDom(filterValue, false), ...refreshButtonDom];
|
|
5554
5552
|
};
|
|
5555
5553
|
|
|
5554
|
+
const getNextSiblingIndex$2 = (nodes, index) => {
|
|
5555
|
+
let nextSiblingIndex = index + 1;
|
|
5556
|
+
const childCount = nodes[index]?.childCount || 0;
|
|
5557
|
+
for (let i = 0; i < childCount; i++) {
|
|
5558
|
+
nextSiblingIndex = getNextSiblingIndex$2(nodes, nextSiblingIndex);
|
|
5559
|
+
}
|
|
5560
|
+
return nextSiblingIndex;
|
|
5561
|
+
};
|
|
5562
|
+
|
|
5563
|
+
const getDirectChildCount$1 = nodes => {
|
|
5564
|
+
let count = 0;
|
|
5565
|
+
let index = 0;
|
|
5566
|
+
while (index < nodes.length) {
|
|
5567
|
+
count++;
|
|
5568
|
+
index = getNextSiblingIndex$2(nodes, index);
|
|
5569
|
+
}
|
|
5570
|
+
return count;
|
|
5571
|
+
};
|
|
5572
|
+
|
|
5573
|
+
const getPanelId = detailTab => {
|
|
5574
|
+
return `ChatDebugViewDetailsPanel-${detailTab}`;
|
|
5575
|
+
};
|
|
5576
|
+
|
|
5577
|
+
const getDetailContentDom = (selectedDetailTab, safeSelectedDetailTab, contentNodes) => {
|
|
5578
|
+
return [{
|
|
5579
|
+
'aria-label': selectedDetailTab.label,
|
|
5580
|
+
childCount: getDirectChildCount$1(contentNodes),
|
|
5581
|
+
className: ChatDebugViewDetailsBottom,
|
|
5582
|
+
id: getPanelId(safeSelectedDetailTab),
|
|
5583
|
+
onContextMenu: HandleDetailsContextMenu,
|
|
5584
|
+
role: 'tabpanel',
|
|
5585
|
+
type: Div
|
|
5586
|
+
}, ...contentNodes];
|
|
5587
|
+
};
|
|
5588
|
+
|
|
5556
5589
|
const detailsCloseButtonDom = [{
|
|
5557
5590
|
'aria-label': closeDetails(),
|
|
5558
5591
|
childCount: 1,
|
|
@@ -5571,6 +5604,29 @@ const getDetailsCloseButtonDom = () => {
|
|
|
5571
5604
|
return detailsCloseButtonDom;
|
|
5572
5605
|
};
|
|
5573
5606
|
|
|
5607
|
+
const getNormalizedDetailTabs = (selectedEvent, detailTabs) => {
|
|
5608
|
+
if (selectedEvent === null) {
|
|
5609
|
+
return detailTabs;
|
|
5610
|
+
}
|
|
5611
|
+
return createDetailTabs(getSelectedDetailTab(detailTabs), selectedEvent);
|
|
5612
|
+
};
|
|
5613
|
+
|
|
5614
|
+
const getEditorRowDom = line => {
|
|
5615
|
+
return [{
|
|
5616
|
+
childCount: line.childCount,
|
|
5617
|
+
className: EditorRow,
|
|
5618
|
+
type: Div
|
|
5619
|
+
}, ...line.nodes];
|
|
5620
|
+
};
|
|
5621
|
+
|
|
5622
|
+
const getEditorRowsDom = lineData => {
|
|
5623
|
+
return [{
|
|
5624
|
+
childCount: lineData.length,
|
|
5625
|
+
className: EditorRows,
|
|
5626
|
+
type: Div
|
|
5627
|
+
}, ...lineData.flatMap(getEditorRowDom)];
|
|
5628
|
+
};
|
|
5629
|
+
|
|
5574
5630
|
const defaultEditorCursor = {
|
|
5575
5631
|
columnIndex: 0,
|
|
5576
5632
|
rowIndex: 1
|
|
@@ -5588,6 +5644,7 @@ const getEditorSelectionDom = (cursor = defaultEditorCursor) => {
|
|
|
5588
5644
|
type: Div
|
|
5589
5645
|
}] : [])];
|
|
5590
5646
|
};
|
|
5647
|
+
|
|
5591
5648
|
const getGutterDom = (lineData, showLineNumbers, lineNumberStart = 0) => {
|
|
5592
5649
|
const gutterNodes = showLineNumbers ? lineData.flatMap((_, index) => {
|
|
5593
5650
|
return [{
|
|
@@ -5602,31 +5659,14 @@ const getGutterDom = (lineData, showLineNumbers, lineNumberStart = 0) => {
|
|
|
5602
5659
|
type: Div
|
|
5603
5660
|
}, ...gutterNodes];
|
|
5604
5661
|
};
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
className: EditorRow,
|
|
5609
|
-
type: Div
|
|
5610
|
-
}, ...line.nodes];
|
|
5611
|
-
};
|
|
5612
|
-
const getEditorRowsDom = lineData => {
|
|
5613
|
-
return [{
|
|
5614
|
-
childCount: lineData.length,
|
|
5615
|
-
className: EditorRows,
|
|
5616
|
-
type: Div
|
|
5617
|
-
}, ...lineData.flatMap(getEditorRowDom)];
|
|
5618
|
-
};
|
|
5619
|
-
const getEditorDom = (lineData, showLineNumbers = true, cursor = defaultEditorCursor, onPointerDown) => {
|
|
5620
|
-
return [{
|
|
5621
|
-
childCount: 1,
|
|
5622
|
-
className: EditorContainer,
|
|
5623
|
-
type: Div
|
|
5624
|
-
}, {
|
|
5662
|
+
|
|
5663
|
+
const getVirtualizedEditorDom = (lineData, showLineNumbers = true, cursor = null, onPointerDown, options) => {
|
|
5664
|
+
const editorChildren = [{
|
|
5625
5665
|
childCount: 2,
|
|
5626
5666
|
className: EditorViewlet,
|
|
5627
5667
|
role: 'code',
|
|
5628
5668
|
type: Div
|
|
5629
|
-
}, ...getGutterDom(lineData, showLineNumbers), {
|
|
5669
|
+
}, ...getGutterDom(lineData, showLineNumbers, options.lineNumberStart), {
|
|
5630
5670
|
childCount: 2,
|
|
5631
5671
|
className: EditorContent,
|
|
5632
5672
|
onPointerDown,
|
|
@@ -5650,14 +5690,34 @@ const getEditorDom = (lineData, showLineNumbers = true, cursor = defaultEditorCu
|
|
|
5650
5690
|
className: EditorLayers,
|
|
5651
5691
|
type: Div
|
|
5652
5692
|
}, ...getEditorSelectionDom(cursor), ...getEditorRowsDom(lineData)];
|
|
5693
|
+
return [{
|
|
5694
|
+
childCount: options.showScrollBar ? 2 : 1,
|
|
5695
|
+
className: mergeClassNames(EditorContainer, PreviewVirtualizedEditor),
|
|
5696
|
+
onWheel: options.onWheel,
|
|
5697
|
+
type: Div
|
|
5698
|
+
}, ...editorChildren, ...(options.showScrollBar ? [{
|
|
5699
|
+
childCount: 1,
|
|
5700
|
+
className: PreviewTextScrollBar,
|
|
5701
|
+
onPointerDown: options.onScrollBarPointerDown,
|
|
5702
|
+
type: Div
|
|
5703
|
+
}, {
|
|
5704
|
+
childCount: 0,
|
|
5705
|
+
className: PreviewTextScrollBarThumb,
|
|
5706
|
+
type: Div
|
|
5707
|
+
}] : [])];
|
|
5653
5708
|
};
|
|
5654
|
-
|
|
5655
|
-
|
|
5709
|
+
|
|
5710
|
+
const getEditorDom = (lineData, showLineNumbers = true, cursor, onPointerDown) => {
|
|
5711
|
+
return [{
|
|
5712
|
+
childCount: 1,
|
|
5713
|
+
className: EditorContainer,
|
|
5714
|
+
type: Div
|
|
5715
|
+
}, {
|
|
5656
5716
|
childCount: 2,
|
|
5657
5717
|
className: EditorViewlet,
|
|
5658
5718
|
role: 'code',
|
|
5659
5719
|
type: Div
|
|
5660
|
-
}, ...getGutterDom(lineData, showLineNumbers
|
|
5720
|
+
}, ...getGutterDom(lineData, showLineNumbers), {
|
|
5661
5721
|
childCount: 2,
|
|
5662
5722
|
className: EditorContent,
|
|
5663
5723
|
onPointerDown,
|
|
@@ -5681,21 +5741,6 @@ const getVirtualizedEditorDom = (lineData, showLineNumbers = true, cursor = null
|
|
|
5681
5741
|
className: EditorLayers,
|
|
5682
5742
|
type: Div
|
|
5683
5743
|
}, ...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
5744
|
};
|
|
5700
5745
|
|
|
5701
5746
|
const isDigit$1 = character => {
|
|
@@ -5920,8 +5965,14 @@ const getEventNode = value => {
|
|
|
5920
5965
|
return getEditorDom(lineData);
|
|
5921
5966
|
};
|
|
5922
5967
|
|
|
5923
|
-
const
|
|
5924
|
-
|
|
5968
|
+
const getPayloadContentNodes = (payloadEventNodes, selectedEvent) => {
|
|
5969
|
+
if (payloadEventNodes.length > 0) {
|
|
5970
|
+
return payloadEventNodes;
|
|
5971
|
+
}
|
|
5972
|
+
if (selectedEvent === null) {
|
|
5973
|
+
return [];
|
|
5974
|
+
}
|
|
5975
|
+
return getEventNode(getPayloadEvent(selectedEvent));
|
|
5925
5976
|
};
|
|
5926
5977
|
|
|
5927
5978
|
const getImagePreviewLabelDom = preview => {
|
|
@@ -6459,33 +6510,27 @@ const getPreviewEventNodes = (previewEvent, selectedEvent, previewTextCursor, vi
|
|
|
6459
6510
|
return getEventNode(previewEvent);
|
|
6460
6511
|
};
|
|
6461
6512
|
|
|
6462
|
-
const
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
}
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
onClick: SelectDetailTab,
|
|
6474
|
-
onFocus: HandleDetailTabsFocus,
|
|
6475
|
-
role: Tab,
|
|
6476
|
-
tabIndex: isSelected ? 0 : -1,
|
|
6477
|
-
type: Button$1
|
|
6478
|
-
}, text(detailTab.label)];
|
|
6513
|
+
const getPreviewContentNodes = (previewEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, virtualization) => {
|
|
6514
|
+
if (previewEventNodes.length > 0) {
|
|
6515
|
+
return previewEventNodes;
|
|
6516
|
+
}
|
|
6517
|
+
if (selectedEvent === null) {
|
|
6518
|
+
return [];
|
|
6519
|
+
}
|
|
6520
|
+
return getPreviewEventNodes(getPreviewEvent(selectedEvent), selectedEvent, previewTextCursorRowIndex === null || previewTextCursorColumnIndex === null ? null : {
|
|
6521
|
+
columnIndex: previewTextCursorColumnIndex,
|
|
6522
|
+
rowIndex: previewTextCursorRowIndex
|
|
6523
|
+
}, virtualization);
|
|
6479
6524
|
};
|
|
6480
6525
|
|
|
6481
|
-
const
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6526
|
+
const getResponseContentNodes = (responseEventNodes, selectedEvent) => {
|
|
6527
|
+
if (responseEventNodes.length > 0) {
|
|
6528
|
+
return responseEventNodes;
|
|
6529
|
+
}
|
|
6530
|
+
if (selectedEvent === null) {
|
|
6531
|
+
return [];
|
|
6532
|
+
}
|
|
6533
|
+
return getEventNode(selectedEvent);
|
|
6489
6534
|
};
|
|
6490
6535
|
|
|
6491
6536
|
const timestampFormatter = new Intl.DateTimeFormat('en-US', {
|
|
@@ -6601,65 +6646,13 @@ const getTimingDetailsDom = event => {
|
|
|
6601
6646
|
}, ...getTimingPreviewDom(event), ...getTimingRowDom(started(), getStartText(event)), ...getTimingRowDom(ended(), getEndText(event)), ...getTimingRowDom(duration(), getDurationText(event))];
|
|
6602
6647
|
};
|
|
6603
6648
|
|
|
6604
|
-
const getNextSiblingIndex$2 = (nodes, index) => {
|
|
6605
|
-
let nextSiblingIndex = index + 1;
|
|
6606
|
-
const childCount = nodes[index]?.childCount || 0;
|
|
6607
|
-
for (let i = 0; i < childCount; i++) {
|
|
6608
|
-
nextSiblingIndex = getNextSiblingIndex$2(nodes, nextSiblingIndex);
|
|
6609
|
-
}
|
|
6610
|
-
return nextSiblingIndex;
|
|
6611
|
-
};
|
|
6612
|
-
const getDirectChildCount$1 = nodes => {
|
|
6613
|
-
let count = 0;
|
|
6614
|
-
let index = 0;
|
|
6615
|
-
while (index < nodes.length) {
|
|
6616
|
-
count++;
|
|
6617
|
-
index = getNextSiblingIndex$2(nodes, index);
|
|
6618
|
-
}
|
|
6619
|
-
return count;
|
|
6620
|
-
};
|
|
6621
|
-
const getNormalizedDetailTabs = (selectedEvent, detailTabs) => {
|
|
6622
|
-
if (selectedEvent === null) {
|
|
6623
|
-
return detailTabs;
|
|
6624
|
-
}
|
|
6625
|
-
return createDetailTabs(getSelectedDetailTab(detailTabs), selectedEvent);
|
|
6626
|
-
};
|
|
6627
6649
|
const getTimingContentNodes = (responseEventNodes, selectedEvent) => {
|
|
6628
6650
|
if (selectedEvent === null) {
|
|
6629
6651
|
return responseEventNodes;
|
|
6630
6652
|
}
|
|
6631
6653
|
return getTimingDetailsDom(selectedEvent);
|
|
6632
6654
|
};
|
|
6633
|
-
|
|
6634
|
-
if (previewEventNodes.length > 0) {
|
|
6635
|
-
return previewEventNodes;
|
|
6636
|
-
}
|
|
6637
|
-
if (selectedEvent === null) {
|
|
6638
|
-
return [];
|
|
6639
|
-
}
|
|
6640
|
-
return getPreviewEventNodes(getPreviewEvent(selectedEvent), selectedEvent, previewTextCursorRowIndex === null || previewTextCursorColumnIndex === null ? null : {
|
|
6641
|
-
columnIndex: previewTextCursorColumnIndex,
|
|
6642
|
-
rowIndex: previewTextCursorRowIndex
|
|
6643
|
-
}, virtualization);
|
|
6644
|
-
};
|
|
6645
|
-
const getPayloadContentNodes = (payloadEventNodes, selectedEvent) => {
|
|
6646
|
-
if (payloadEventNodes.length > 0) {
|
|
6647
|
-
return payloadEventNodes;
|
|
6648
|
-
}
|
|
6649
|
-
if (selectedEvent === null) {
|
|
6650
|
-
return [];
|
|
6651
|
-
}
|
|
6652
|
-
return getEventNode(getPayloadEvent(selectedEvent));
|
|
6653
|
-
};
|
|
6654
|
-
const getResponseContentNodes = (responseEventNodes, selectedEvent) => {
|
|
6655
|
-
if (responseEventNodes.length > 0) {
|
|
6656
|
-
return responseEventNodes;
|
|
6657
|
-
}
|
|
6658
|
-
if (selectedEvent === null) {
|
|
6659
|
-
return [];
|
|
6660
|
-
}
|
|
6661
|
-
return getEventNode(selectedEvent);
|
|
6662
|
-
};
|
|
6655
|
+
|
|
6663
6656
|
const getSelectedContentNodes = (safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization) => {
|
|
6664
6657
|
if (safeSelectedDetailTab === Timing) {
|
|
6665
6658
|
return getTimingContentNodes(responseEventNodes, selectedEvent);
|
|
@@ -6672,6 +6665,36 @@ const getSelectedContentNodes = (safeSelectedDetailTab, previewEventNodes, paylo
|
|
|
6672
6665
|
}
|
|
6673
6666
|
return getResponseContentNodes(responseEventNodes, selectedEvent);
|
|
6674
6667
|
};
|
|
6668
|
+
|
|
6669
|
+
const getDetailTabDom = detailTab => {
|
|
6670
|
+
const {
|
|
6671
|
+
isSelected
|
|
6672
|
+
} = detailTab;
|
|
6673
|
+
return [{
|
|
6674
|
+
'aria-controls': getPanelId(detailTab.name),
|
|
6675
|
+
ariaSelected: isSelected,
|
|
6676
|
+
childCount: 1,
|
|
6677
|
+
className: mergeClassNames(PanelTab, isSelected ? PanelTabSelected : ''),
|
|
6678
|
+
name: detailTab.name,
|
|
6679
|
+
onChange: SelectDetailTab,
|
|
6680
|
+
onClick: SelectDetailTab,
|
|
6681
|
+
onFocus: HandleDetailTabsFocus,
|
|
6682
|
+
role: Tab,
|
|
6683
|
+
tabIndex: isSelected ? 0 : -1,
|
|
6684
|
+
type: Button$1
|
|
6685
|
+
}, text(detailTab.label)];
|
|
6686
|
+
};
|
|
6687
|
+
|
|
6688
|
+
const getTabNodes = detailTabs => {
|
|
6689
|
+
return [{
|
|
6690
|
+
'aria-label': detailSections(),
|
|
6691
|
+
childCount: detailTabs.length,
|
|
6692
|
+
className: ChatDebugViewDetailsTabs,
|
|
6693
|
+
role: 'tablist',
|
|
6694
|
+
type: Div
|
|
6695
|
+
}, ...detailTabs.flatMap(getDetailTabDom)];
|
|
6696
|
+
};
|
|
6697
|
+
|
|
6675
6698
|
const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes, responseEventNodes = payloadEventNodes, selectedEvent = null, detailTabs = createDetailTabs(), previewTextCursorRowIndex = null, previewTextCursorColumnIndex = null, previewVirtualization) => {
|
|
6676
6699
|
if (previewEventNodes.length === 0 && payloadEventNodes.length === 0 && responseEventNodes.length === 0) {
|
|
6677
6700
|
return [];
|
|
@@ -6679,18 +6702,7 @@ const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes,
|
|
|
6679
6702
|
const normalizedDetailTabs = getNormalizedDetailTabs(selectedEvent, detailTabs);
|
|
6680
6703
|
const safeSelectedDetailTab = getSelectedDetailTab(normalizedDetailTabs);
|
|
6681
6704
|
const selectedDetailTab = normalizedDetailTabs.find(detailTab => detailTab.name === safeSelectedDetailTab) ?? normalizedDetailTabs[0];
|
|
6682
|
-
const
|
|
6683
|
-
const contentNodes = getSelectedContentNodes(safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization);
|
|
6684
|
-
return [{
|
|
6685
|
-
'aria-label': selectedDetailTab.label,
|
|
6686
|
-
childCount: getDirectChildCount$1(contentNodes),
|
|
6687
|
-
className: ChatDebugViewDetailsBottom,
|
|
6688
|
-
id: getPanelId(safeSelectedDetailTab),
|
|
6689
|
-
onContextMenu: HandleDetailsContextMenu,
|
|
6690
|
-
role: 'tabpanel',
|
|
6691
|
-
type: Div
|
|
6692
|
-
}, ...contentNodes];
|
|
6693
|
-
};
|
|
6705
|
+
const contentNodes = getSelectedContentNodes(safeSelectedDetailTab, previewEventNodes, payloadEventNodes, responseEventNodes, selectedEvent, previewTextCursorRowIndex, previewTextCursorColumnIndex, previewVirtualization);
|
|
6694
6706
|
return [{
|
|
6695
6707
|
childCount: 2,
|
|
6696
6708
|
className: ChatDebugViewDetails,
|
|
@@ -6700,7 +6712,7 @@ const getDetailsDom = (previewEventNodes, payloadEventNodes = previewEventNodes,
|
|
|
6700
6712
|
className: ChatDebugViewDetailsTop,
|
|
6701
6713
|
onContextMenu: HandleDetailsTopContextMenu,
|
|
6702
6714
|
type: Div
|
|
6703
|
-
}, ...getDetailsCloseButtonDom(), ...getTabNodes(normalizedDetailTabs), ...getDetailContentDom()];
|
|
6715
|
+
}, ...getDetailsCloseButtonDom(), ...getTabNodes(normalizedDetailTabs), ...getDetailContentDom(selectedDetailTab, safeSelectedDetailTab, contentNodes)];
|
|
6704
6716
|
};
|
|
6705
6717
|
|
|
6706
6718
|
const getMethods = new Set(['list_dir', 'list_files', 'read_file']);
|