@lvce-editor/chat-debug-view 10.3.0 → 10.4.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 +94 -18
- package/package.json +1 -1
|
@@ -4476,6 +4476,87 @@ const loadContent = async (state, savedState) => {
|
|
|
4476
4476
|
});
|
|
4477
4477
|
};
|
|
4478
4478
|
|
|
4479
|
+
const isAttachmentImagePreview = value => {
|
|
4480
|
+
return typeof value === 'object' && value !== null && value.previewType === 'image';
|
|
4481
|
+
};
|
|
4482
|
+
|
|
4483
|
+
const getResponseEvent = event => {
|
|
4484
|
+
const {
|
|
4485
|
+
responseEvent
|
|
4486
|
+
} = event;
|
|
4487
|
+
if (responseEvent && typeof responseEvent === 'object' && typeof responseEvent.type === 'string') {
|
|
4488
|
+
const mergedResponseEvent = responseEvent;
|
|
4489
|
+
if (mergedResponseEvent.value !== undefined) {
|
|
4490
|
+
return mergedResponseEvent.value;
|
|
4491
|
+
}
|
|
4492
|
+
return responseEvent;
|
|
4493
|
+
}
|
|
4494
|
+
return event;
|
|
4495
|
+
};
|
|
4496
|
+
|
|
4497
|
+
const getStringLineCount = value => {
|
|
4498
|
+
return value.split('\n').length;
|
|
4499
|
+
};
|
|
4500
|
+
const isChatViewEvent$1 = value => {
|
|
4501
|
+
return typeof value === 'object' && value !== null && typeof value.type === 'string';
|
|
4502
|
+
};
|
|
4503
|
+
const getJsonLineCount = value => {
|
|
4504
|
+
const renderedValue = isChatViewEvent$1(value) ? {
|
|
4505
|
+
...value,
|
|
4506
|
+
type: getEventTypeLabel(value)
|
|
4507
|
+
} : value;
|
|
4508
|
+
const json = JSON.stringify(renderedValue, null, 2);
|
|
4509
|
+
if (!json) {
|
|
4510
|
+
return 1;
|
|
4511
|
+
}
|
|
4512
|
+
let lineCount = 1;
|
|
4513
|
+
for (let i = 0; i < json.length; i++) {
|
|
4514
|
+
if (json[i] === '\n') {
|
|
4515
|
+
lineCount++;
|
|
4516
|
+
}
|
|
4517
|
+
}
|
|
4518
|
+
return lineCount;
|
|
4519
|
+
};
|
|
4520
|
+
const getPreviewLineCount = selectedEvent => {
|
|
4521
|
+
const previewEvent = getPreviewEvent(selectedEvent);
|
|
4522
|
+
if (previewEvent === undefined || isAttachmentImagePreview(previewEvent)) {
|
|
4523
|
+
return 0;
|
|
4524
|
+
}
|
|
4525
|
+
if (typeof previewEvent === 'string') {
|
|
4526
|
+
if (previewEvent === ImageCouldNotBeLoaded || isChatMessageUpdatedEvent(selectedEvent)) {
|
|
4527
|
+
return 0;
|
|
4528
|
+
}
|
|
4529
|
+
return getStringLineCount(previewEvent);
|
|
4530
|
+
}
|
|
4531
|
+
return getJsonLineCount(previewEvent);
|
|
4532
|
+
};
|
|
4533
|
+
const getLineCount = state => {
|
|
4534
|
+
const {
|
|
4535
|
+
selectedEvent
|
|
4536
|
+
} = state;
|
|
4537
|
+
if (!selectedEvent) {
|
|
4538
|
+
return 0;
|
|
4539
|
+
}
|
|
4540
|
+
const selectedDetailTab = getSelectedDetailTab(state.detailTabs);
|
|
4541
|
+
if (selectedDetailTab === Timing) {
|
|
4542
|
+
return 0;
|
|
4543
|
+
}
|
|
4544
|
+
if (selectedDetailTab === Preview) {
|
|
4545
|
+
return getPreviewLineCount(selectedEvent);
|
|
4546
|
+
}
|
|
4547
|
+
if (selectedDetailTab === Payload) {
|
|
4548
|
+
return getJsonLineCount(getPayloadEvent(selectedEvent));
|
|
4549
|
+
}
|
|
4550
|
+
return getJsonLineCount(getResponseEvent(selectedEvent));
|
|
4551
|
+
};
|
|
4552
|
+
const getDetailsLineNumberWidth = state => {
|
|
4553
|
+
const lineCount = getLineCount(state);
|
|
4554
|
+
if (lineCount === 0) {
|
|
4555
|
+
return 0;
|
|
4556
|
+
}
|
|
4557
|
+
return String(lineCount).length * defaultPreviewTextColumnWidth;
|
|
4558
|
+
};
|
|
4559
|
+
|
|
4479
4560
|
// cspell:ignore liga calt
|
|
4480
4561
|
|
|
4481
4562
|
const getCss = state => {
|
|
@@ -4489,6 +4570,7 @@ const getCss = state => {
|
|
|
4489
4570
|
const scrollBarOffset = getScrollBarOffset(state.tableDeltaY, maxDeltaY, tableBodyHeight, scrollBarHeight);
|
|
4490
4571
|
const tableContentWidth = Math.max(0, tableWidth - (showScrollBar ? devtoolsTableScrollBarWidth : 0));
|
|
4491
4572
|
const detailsWidth = hasSelectedEvent ? getDetailsWidth(state.width, state.tableWidth) : 0;
|
|
4573
|
+
const detailsLineNumberWidth = getDetailsLineNumberWidth(state);
|
|
4492
4574
|
const topSize = state.width >= state.largeBreakpoint ? 30 : state.width >= state.mediumBreakpoint ? 60 : 60;
|
|
4493
4575
|
const tableColumnLayout = getTableColumnLayout(tableContentWidth, getVisibleTableColumns(state.tableColumns), state.tableColumnWidths);
|
|
4494
4576
|
const [tableColZeroWidth = 0, tableColOneWidth = 0, tableColTwoWidth = 0] = tableColumnLayout.visibleColumnWidths;
|
|
@@ -4505,6 +4587,7 @@ const getCss = state => {
|
|
|
4505
4587
|
--ChatDebugViewTableColZeroWidth: ${tableColZeroWidth}px;
|
|
4506
4588
|
--ChatDebugViewTableColOneWidth: ${tableColOneWidth}px;
|
|
4507
4589
|
--ChatDebugViewTableColTwoWidth: ${tableColTwoWidth}px;
|
|
4590
|
+
--ChatDebugViewDetailsLineNumberWidth: ${detailsLineNumberWidth}px;
|
|
4508
4591
|
--ChatDebugViewDetailsWidth: ${detailsWidth}px;
|
|
4509
4592
|
--ChatDebugViewDurationColumnWidth: ${state.tableColumnWidths.duration}px;
|
|
4510
4593
|
--ChatDebugViewTableRowHeight: ${devtoolsTableRowHeight}px;
|
|
@@ -4549,6 +4632,17 @@ const getCss = state => {
|
|
|
4549
4632
|
position: relative;
|
|
4550
4633
|
}
|
|
4551
4634
|
|
|
4635
|
+
.ChatDebugViewDetailsBottom .Gutter {
|
|
4636
|
+
flex: 0 0 var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4637
|
+
width: var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4638
|
+
}
|
|
4639
|
+
|
|
4640
|
+
.ChatDebugViewDetailsBottom .ChatDebugViewEventLineNumber {
|
|
4641
|
+
display: inline-block;
|
|
4642
|
+
min-width: var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4643
|
+
width: var(--ChatDebugViewDetailsLineNumberWidth);
|
|
4644
|
+
}
|
|
4645
|
+
|
|
4552
4646
|
.TableScrollBar {
|
|
4553
4647
|
background: rgba(255, 255, 255, 0.06);
|
|
4554
4648
|
border-radius: 999px;
|
|
@@ -5369,10 +5463,6 @@ const getPanelId = detailTab => {
|
|
|
5369
5463
|
return `ChatDebugViewDetailsPanel-${detailTab}`;
|
|
5370
5464
|
};
|
|
5371
5465
|
|
|
5372
|
-
const isAttachmentImagePreview = value => {
|
|
5373
|
-
return typeof value === 'object' && value !== null && value.previewType === 'image';
|
|
5374
|
-
};
|
|
5375
|
-
|
|
5376
5466
|
const getImagePreviewLabelDom = preview => {
|
|
5377
5467
|
if (preview.stats === undefined) {
|
|
5378
5468
|
return [{
|
|
@@ -5733,20 +5823,6 @@ const getEventsClassName = hasSelectedEvent => {
|
|
|
5733
5823
|
return widthClassName;
|
|
5734
5824
|
};
|
|
5735
5825
|
|
|
5736
|
-
const getResponseEvent = event => {
|
|
5737
|
-
const {
|
|
5738
|
-
responseEvent
|
|
5739
|
-
} = event;
|
|
5740
|
-
if (responseEvent && typeof responseEvent === 'object' && typeof responseEvent.type === 'string') {
|
|
5741
|
-
const mergedResponseEvent = responseEvent;
|
|
5742
|
-
if (mergedResponseEvent.value !== undefined) {
|
|
5743
|
-
return mergedResponseEvent.value;
|
|
5744
|
-
}
|
|
5745
|
-
return responseEvent;
|
|
5746
|
-
}
|
|
5747
|
-
return event;
|
|
5748
|
-
};
|
|
5749
|
-
|
|
5750
5826
|
const sashNodesDom = [{
|
|
5751
5827
|
childCount: 0,
|
|
5752
5828
|
className: Sash,
|