@deepcitation/deepcitation-js 1.1.21 → 1.1.22
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.
|
@@ -106,11 +106,23 @@ const StatusTooltipContent = ({ citation, status, verification, isExpanded, onTo
|
|
|
106
106
|
if (isPartialMatch) {
|
|
107
107
|
const expectedText = citation.fullPhrase || citation.keySpan?.toString() || "";
|
|
108
108
|
const actualText = verification?.matchSnippet || "";
|
|
109
|
+
const textMatches = expectedText === actualText;
|
|
109
110
|
const truncatedExpected = expectedText.length > 100
|
|
110
111
|
? expectedText.slice(0, 100) + "…"
|
|
111
112
|
: expectedText;
|
|
112
113
|
const truncatedActual = actualText.length > 100 ? actualText.slice(0, 100) + "…" : actualText;
|
|
113
|
-
|
|
114
|
+
// Check for line ID and page number differences
|
|
115
|
+
const expectedLineIds = citation.lineIds;
|
|
116
|
+
const actualLineIds = verification?.lineIds;
|
|
117
|
+
const lineIdDiffers = expectedLineIds &&
|
|
118
|
+
actualLineIds &&
|
|
119
|
+
JSON.stringify(expectedLineIds) !== JSON.stringify(actualLineIds);
|
|
120
|
+
const expectedPage = citation.pageNumber;
|
|
121
|
+
const actualPage = verification?.pageNumber;
|
|
122
|
+
const pageDiffers = expectedPage != null &&
|
|
123
|
+
actualPage != null &&
|
|
124
|
+
expectedPage !== actualPage;
|
|
125
|
+
return (_jsxs("span", { className: "dc-status-tooltip", role: "tooltip", children: [_jsxs("span", { className: "dc-status-header dc-status-header--partial", children: [_jsx(WarningIcon, {}), _jsx("span", { children: "Partial match" })] }), textMatches ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "dc-status-description", children: "Text matches, but location differs." }), truncatedExpected && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Text" }), _jsx("span", { className: "dc-status-text", children: truncatedExpected })] }))] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "dc-status-description", children: "Text differs from citation." }), truncatedExpected && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Expected" }), _jsx("span", { className: "dc-status-text dc-status-text--expected", children: truncatedExpected })] })), truncatedActual && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Found" }), _jsx("span", { className: "dc-status-text", children: truncatedActual })] }))] })), pageDiffers && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Page" }), _jsxs("span", { className: "dc-status-text", children: [_jsx("span", { className: "dc-status-text--expected", children: expectedPage }), " → ", actualPage] })] })), lineIdDiffers && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Line" }), _jsxs("span", { className: "dc-status-text", children: [_jsx("span", { className: "dc-status-text--expected", children: expectedLineIds?.join(", ") }), " → ", actualLineIds?.join(", ")] })] }))] }));
|
|
114
126
|
}
|
|
115
127
|
return null;
|
|
116
128
|
};
|
|
@@ -138,7 +150,7 @@ const ImageOverlay = ({ src, alt, onClose, }) => {
|
|
|
138
150
|
};
|
|
139
151
|
/**
|
|
140
152
|
* Diff details for partial/miss verification states.
|
|
141
|
-
* Shows expected vs found text.
|
|
153
|
+
* Shows expected vs found text, and location differences when applicable.
|
|
142
154
|
*/
|
|
143
155
|
const DiffDetails = ({ citation, verification, status, }) => {
|
|
144
156
|
const { isMiss, isPartialMatch } = status;
|
|
@@ -146,9 +158,25 @@ const DiffDetails = ({ citation, verification, status, }) => {
|
|
|
146
158
|
return null;
|
|
147
159
|
const expectedText = citation.fullPhrase || citation.keySpan?.toString() || "";
|
|
148
160
|
const actualText = verification?.matchSnippet || "";
|
|
161
|
+
const textMatches = expectedText === actualText;
|
|
149
162
|
const truncatedExpected = expectedText.length > 100 ? expectedText.slice(0, 100) + "…" : expectedText;
|
|
150
163
|
const truncatedActual = actualText.length > 100 ? actualText.slice(0, 100) + "…" : actualText;
|
|
151
|
-
|
|
164
|
+
// Check for line ID and page number differences
|
|
165
|
+
const expectedLineIds = citation.lineIds;
|
|
166
|
+
const actualLineIds = verification?.lineIds;
|
|
167
|
+
const lineIdDiffers = expectedLineIds &&
|
|
168
|
+
actualLineIds &&
|
|
169
|
+
JSON.stringify(expectedLineIds) !== JSON.stringify(actualLineIds);
|
|
170
|
+
const expectedPage = citation.pageNumber;
|
|
171
|
+
const actualPage = verification?.pageNumber;
|
|
172
|
+
const pageDiffers = expectedPage != null &&
|
|
173
|
+
actualPage != null &&
|
|
174
|
+
expectedPage !== actualPage;
|
|
175
|
+
return (_jsxs("span", { className: "dc-diff-details", children: [isPartialMatch && textMatches ? (
|
|
176
|
+
// Text matches but location differs - show text once
|
|
177
|
+
truncatedExpected && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Text" }), _jsx("span", { className: "dc-status-text", children: truncatedExpected })] }))) : (
|
|
178
|
+
// Text differs - show expected and found
|
|
179
|
+
_jsxs(_Fragment, { children: [truncatedExpected && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Expected" }), _jsx("span", { className: "dc-status-text dc-status-text--expected", children: truncatedExpected })] })), isPartialMatch && truncatedActual && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Found" }), _jsx("span", { className: "dc-status-text", children: truncatedActual })] }))] })), isMiss && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Found" }), _jsx("span", { className: "dc-status-text dc-status-text--miss", children: "Not found in source" })] })), pageDiffers && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Page" }), _jsxs("span", { className: "dc-status-text", children: [_jsx("span", { className: "dc-status-text--expected", children: expectedPage }), " → ", actualPage] })] })), lineIdDiffers && (_jsxs("span", { className: "dc-status-searched", children: [_jsx("span", { className: "dc-status-label", children: "Line" }), _jsxs("span", { className: "dc-status-text", children: [_jsx("span", { className: "dc-status-text--expected", children: expectedLineIds?.join(", ") }), " → ", actualLineIds?.join(", ")] })] }))] }));
|
|
152
180
|
};
|
|
153
181
|
/**
|
|
154
182
|
* Default popover content component.
|
package/lib/react/styles.css
CHANGED
|
@@ -451,6 +451,12 @@
|
|
|
451
451
|
font-style: italic;
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
+
.dc-status-text--expected {
|
|
455
|
+
color: var(--dc-color-error, #dc2626);
|
|
456
|
+
text-decoration: line-through;
|
|
457
|
+
opacity: 0.7;
|
|
458
|
+
}
|
|
459
|
+
|
|
454
460
|
/* Diff details container in popover */
|
|
455
461
|
.dc-diff-details {
|
|
456
462
|
display: flex;
|