@deepcitation/deepcitation-js 1.1.26 → 1.1.28

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.
Files changed (79) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +253 -253
  3. package/lib/chunk-2IZXUOQR.js +66 -0
  4. package/lib/chunk-4FGOHQFP.cjs +66 -0
  5. package/lib/chunk-CFXDRAJL.cjs +1 -0
  6. package/lib/chunk-DEUSSEFH.js +2 -0
  7. package/lib/chunk-F2MMVEVC.cjs +1 -0
  8. package/lib/chunk-J7U6YFOI.cjs +2 -0
  9. package/lib/chunk-O2XFH626.js +1 -0
  10. package/lib/chunk-RQPZSRID.js +1 -0
  11. package/lib/client/index.cjs +1 -0
  12. package/lib/client/{DeepCitation.d.ts → index.d.cts} +159 -3
  13. package/lib/client/index.d.ts +342 -2
  14. package/lib/client/index.js +1 -1
  15. package/lib/index.cjs +1 -0
  16. package/lib/index.d.cts +127 -0
  17. package/lib/index.d.ts +126 -23
  18. package/lib/index.js +1 -22
  19. package/lib/prompts/index.cjs +1 -0
  20. package/lib/prompts/index.d.cts +196 -0
  21. package/lib/prompts/index.d.ts +196 -3
  22. package/lib/prompts/index.js +1 -3
  23. package/lib/react/index.cjs +4 -0
  24. package/lib/react/index.js +4 -18
  25. package/lib/types/index.cjs +1 -0
  26. package/lib/types/index.d.cts +96 -0
  27. package/lib/types/index.d.ts +96 -11
  28. package/lib/types/index.js +1 -7
  29. package/package.json +62 -10
  30. package/lib/client/DeepCitation.js +0 -374
  31. package/lib/client/types.d.ts +0 -154
  32. package/lib/client/types.js +0 -1
  33. package/lib/parsing/normalizeCitation.d.ts +0 -5
  34. package/lib/parsing/normalizeCitation.js +0 -198
  35. package/lib/parsing/parseCitation.d.ts +0 -79
  36. package/lib/parsing/parseCitation.js +0 -431
  37. package/lib/parsing/parseWorkAround.d.ts +0 -2
  38. package/lib/parsing/parseWorkAround.js +0 -73
  39. package/lib/prompts/citationPrompts.d.ts +0 -138
  40. package/lib/prompts/citationPrompts.js +0 -168
  41. package/lib/prompts/promptCompression.d.ts +0 -14
  42. package/lib/prompts/promptCompression.js +0 -127
  43. package/lib/prompts/types.d.ts +0 -4
  44. package/lib/prompts/types.js +0 -1
  45. package/lib/react/CitationComponent.d.ts +0 -93
  46. package/lib/react/CitationComponent.js +0 -371
  47. package/lib/react/CitationVariants.d.ts +0 -132
  48. package/lib/react/CitationVariants.js +0 -284
  49. package/lib/react/DiffDisplay.d.ts +0 -10
  50. package/lib/react/DiffDisplay.js +0 -33
  51. package/lib/react/Popover.d.ts +0 -15
  52. package/lib/react/Popover.js +0 -20
  53. package/lib/react/UrlCitationComponent.d.ts +0 -83
  54. package/lib/react/UrlCitationComponent.js +0 -224
  55. package/lib/react/VerificationTabs.d.ts +0 -10
  56. package/lib/react/VerificationTabs.js +0 -36
  57. package/lib/react/icons.d.ts +0 -18
  58. package/lib/react/icons.js +0 -16
  59. package/lib/react/index.d.ts +0 -16
  60. package/lib/react/primitives.d.ts +0 -101
  61. package/lib/react/primitives.js +0 -193
  62. package/lib/react/types.d.ts +0 -283
  63. package/lib/react/types.js +0 -1
  64. package/lib/react/useSmartDiff.d.ts +0 -16
  65. package/lib/react/useSmartDiff.js +0 -64
  66. package/lib/react/utils.d.ts +0 -43
  67. package/lib/react/utils.js +0 -89
  68. package/lib/types/boxes.d.ts +0 -11
  69. package/lib/types/boxes.js +0 -1
  70. package/lib/types/citation.d.ts +0 -39
  71. package/lib/types/citation.js +0 -1
  72. package/lib/types/search.d.ts +0 -19
  73. package/lib/types/search.js +0 -1
  74. package/lib/types/verification.d.ts +0 -27
  75. package/lib/types/verification.js +0 -11
  76. package/lib/utils/diff.d.ts +0 -60
  77. package/lib/utils/diff.js +0 -414
  78. package/lib/utils/sha.d.ts +0 -10
  79. package/lib/utils/sha.js +0 -108
@@ -1,284 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { memo, useMemo, useCallback, forwardRef, } from "react";
3
- import { getCitationStatus } from "../parsing/parseCitation.js";
4
- import { generateCitationKey, generateCitationInstanceId, getCitationDisplayText, getCitationKeySpanText, classNames, } from "./utils.js";
5
- const TWO_DOTS_THINKING_CONTENT = "..";
6
- /**
7
- * Hook to get common citation data.
8
- * NOTE: Status is not memoized because verification may be mutated in place.
9
- */
10
- function useCitationData(citation, verification) {
11
- const citationKey = useMemo(() => generateCitationKey(citation), [citation]);
12
- const citationInstanceId = useMemo(() => generateCitationInstanceId(citationKey), [citationKey]);
13
- // Don't memoize - object reference as dependency causes stale values on mutation
14
- const status = getCitationStatus(verification ?? null);
15
- return { citationKey, citationInstanceId, status };
16
- }
17
- /**
18
- * Default verified indicator (checkmark)
19
- */
20
- const DefaultVerifiedIndicator = () => (_jsx("span", { className: "citation-verified-icon", "aria-hidden": "true", children: "\u2713" }));
21
- /**
22
- * Default partial match indicator (asterisk)
23
- */
24
- const DefaultPartialIndicator = () => (_jsx("span", { className: "citation-partial-icon", "aria-hidden": "true", children: "*" }));
25
- /**
26
- * Chip/Badge style citation component.
27
- * Displays citation as a rounded pill/badge.
28
- *
29
- * @example
30
- * ```tsx
31
- * <ChipCitation citation={citation} verification={found} size="md" />
32
- * ```
33
- */
34
- export const ChipCitation = forwardRef(({ citation, children, className, hideKeySpan = false, fallbackDisplay, verification, eventHandlers, isMobile = false, preventTooltips = false, pendingContent = TWO_DOTS_THINKING_CONTENT, renderVerifiedIndicator = () => _jsx(DefaultVerifiedIndicator, {}), renderPartialIndicator = () => _jsx(DefaultPartialIndicator, {}), size = "md", showIcon = false, icon, }, ref) => {
35
- const { citationKey, citationInstanceId, status } = useCitationData(citation, verification);
36
- const { isVerified, isMiss, isPartialMatch, isPending } = status;
37
- const displayText = useMemo(() => getCitationDisplayText(citation, {
38
- hideKeySpan,
39
- fallbackDisplay,
40
- }), [citation, hideKeySpan, fallbackDisplay]);
41
- const keySpanText = useMemo(() => getCitationKeySpanText(citation, {
42
- hideKeySpan,
43
- }), [citation, hideKeySpan]);
44
- const handleClick = useCallback((e) => {
45
- e.preventDefault();
46
- e.stopPropagation();
47
- eventHandlers?.onClick?.(citation, citationKey, e);
48
- }, [eventHandlers, citation, citationKey]);
49
- const handleMouseEnter = useCallback(() => {
50
- eventHandlers?.onMouseEnter?.(citation, citationKey);
51
- }, [eventHandlers, citation, citationKey]);
52
- const handleMouseLeave = useCallback(() => {
53
- eventHandlers?.onMouseLeave?.(citation, citationKey);
54
- }, [eventHandlers, citation, citationKey]);
55
- const sizeClasses = {
56
- sm: "citation-chip--sm",
57
- md: "citation-chip--md",
58
- lg: "citation-chip--lg",
59
- };
60
- // Check partial first since isVerified is true when isPartialMatch is true
61
- const statusClass = isPartialMatch
62
- ? "citation-chip--partial"
63
- : isMiss
64
- ? "citation-chip--miss"
65
- : isVerified
66
- ? "citation-chip--verified"
67
- : isPending
68
- ? "citation-chip--pending"
69
- : "";
70
- return (_jsxs(_Fragment, { children: [children, _jsxs("span", { ref: ref, "data-citation-id": citationKey, "data-citation-instance": citationInstanceId, "data-variant": "chip", className: classNames("citation-chip", sizeClasses[size], statusClass, className), onMouseEnter: preventTooltips ? undefined : handleMouseEnter, onMouseLeave: preventTooltips ? undefined : handleMouseLeave, onMouseDown: handleClick, onClick: (e) => e.stopPropagation(), "aria-label": displayText ? `Citation: ${displayText}` : undefined, children: [showIcon &&
71
- (icon || _jsx("span", { className: "citation-chip__icon", children: "\uD83D\uDCC4" })), _jsx("span", { className: "citation-chip__text", children: displayText }), isPartialMatch && renderPartialIndicator(status), isVerified && !isPartialMatch && renderVerifiedIndicator(status), isPending && (_jsx("span", { className: "citation-chip__pending", children: pendingContent }))] })] }));
72
- });
73
- ChipCitation.displayName = "ChipCitation";
74
- /**
75
- * Superscript style citation component.
76
- * Displays citation as a superscript number like academic papers.
77
- *
78
- * @example
79
- * ```tsx
80
- * <SuperscriptCitation citation={citation} verification={found} />
81
- * // Renders: Text content¹
82
- * ```
83
- */
84
- export const SuperscriptCitation = forwardRef(({ citation, children, className, hideKeySpan = false, fallbackDisplay, verification, eventHandlers, isMobile = false, preventTooltips = false, pendingContent = TWO_DOTS_THINKING_CONTENT, renderVerifiedIndicator = () => _jsx(DefaultVerifiedIndicator, {}), renderPartialIndicator = () => _jsx(DefaultPartialIndicator, {}), hideBrackets = false, }, ref) => {
85
- const { citationKey, citationInstanceId, status } = useCitationData(citation, verification);
86
- const { isVerified, isMiss, isPartialMatch, isPending } = status;
87
- const displayText = useMemo(() => getCitationDisplayText(citation, {
88
- hideKeySpan,
89
- fallbackDisplay,
90
- }), [citation, hideKeySpan, fallbackDisplay]);
91
- const handleClick = useCallback((e) => {
92
- e.preventDefault();
93
- e.stopPropagation();
94
- eventHandlers?.onClick?.(citation, citationKey, e);
95
- }, [eventHandlers, citation, citationKey]);
96
- const handleMouseEnter = useCallback(() => {
97
- eventHandlers?.onMouseEnter?.(citation, citationKey);
98
- }, [eventHandlers, citation, citationKey]);
99
- const handleMouseLeave = useCallback(() => {
100
- eventHandlers?.onMouseLeave?.(citation, citationKey);
101
- }, [eventHandlers, citation, citationKey]);
102
- // Check partial first since isVerified is true when isPartialMatch is true
103
- const statusClass = isPartialMatch
104
- ? "citation-superscript--partial"
105
- : isMiss
106
- ? "citation-superscript--miss"
107
- : isVerified
108
- ? "citation-superscript--verified"
109
- : isPending
110
- ? "citation-superscript--pending"
111
- : "";
112
- return (_jsxs(_Fragment, { children: [children, _jsxs("sup", { ref: ref, "data-citation-id": citationKey, "data-citation-instance": citationInstanceId, "data-variant": "superscript", className: classNames("citation-superscript", statusClass, className), onMouseEnter: preventTooltips ? undefined : handleMouseEnter, onMouseLeave: preventTooltips ? undefined : handleMouseLeave, onMouseDown: handleClick, onClick: (e) => e.stopPropagation(), "aria-label": `Citation ${displayText}`, children: [!hideBrackets && "[", displayText, isPartialMatch && renderPartialIndicator(status), isVerified && !isPartialMatch && renderVerifiedIndicator(status), isPending && pendingContent, !hideBrackets && "]"] })] }));
113
- });
114
- SuperscriptCitation.displayName = "SuperscriptCitation";
115
- const FOOTNOTE_SYMBOLS = ["*", "†", "‡", "§", "‖", "¶"];
116
- /**
117
- * Footnote style citation component.
118
- * Displays citation as a footnote marker.
119
- *
120
- * @example
121
- * ```tsx
122
- * <FootnoteCitation citation={citation} symbolStyle="asterisk" />
123
- * // Renders: Text content*
124
- * ```
125
- */
126
- export const FootnoteCitation = forwardRef(({ citation, children, className, fallbackDisplay, verification, eventHandlers, preventTooltips = false, pendingContent = TWO_DOTS_THINKING_CONTENT, renderVerifiedIndicator = () => _jsx(DefaultVerifiedIndicator, {}), renderPartialIndicator = () => _jsx(DefaultPartialIndicator, {}), symbolStyle = "number", customSymbol, }, ref) => {
127
- const { citationKey, citationInstanceId, status } = useCitationData(citation, verification);
128
- const { isVerified, isMiss, isPartialMatch, isPending } = status;
129
- const displaySymbol = useMemo(() => {
130
- if (symbolStyle === "custom" && customSymbol)
131
- return customSymbol;
132
- if (symbolStyle === "number")
133
- return citation.citationNumber?.toString() || "1";
134
- if (symbolStyle === "asterisk")
135
- return "*";
136
- if (symbolStyle === "dagger") {
137
- const num = (citation.citationNumber || 1) - 1;
138
- return FOOTNOTE_SYMBOLS[num % FOOTNOTE_SYMBOLS.length];
139
- }
140
- return "*";
141
- }, [symbolStyle, customSymbol, citation.citationNumber]);
142
- const handleClick = useCallback((e) => {
143
- e.preventDefault();
144
- e.stopPropagation();
145
- eventHandlers?.onClick?.(citation, citationKey, e);
146
- }, [eventHandlers, citation, citationKey]);
147
- const handleMouseEnter = useCallback(() => {
148
- eventHandlers?.onMouseEnter?.(citation, citationKey);
149
- }, [eventHandlers, citation, citationKey]);
150
- const handleMouseLeave = useCallback(() => {
151
- eventHandlers?.onMouseLeave?.(citation, citationKey);
152
- }, [eventHandlers, citation, citationKey]);
153
- // Check partial first since isVerified is true when isPartialMatch is true
154
- const statusClass = isPartialMatch
155
- ? "citation-footnote--partial"
156
- : isMiss
157
- ? "citation-footnote--miss"
158
- : isVerified
159
- ? "citation-footnote--verified"
160
- : isPending
161
- ? "citation-footnote--pending"
162
- : "";
163
- return (_jsxs(_Fragment, { children: [children, _jsxs("sup", { ref: ref, "data-citation-id": citationKey, "data-citation-instance": citationInstanceId, "data-variant": "footnote", className: classNames("citation-footnote", statusClass, className), onMouseEnter: preventTooltips ? undefined : handleMouseEnter, onMouseLeave: preventTooltips ? undefined : handleMouseLeave, onMouseDown: handleClick, onClick: (e) => e.stopPropagation(), "aria-label": `Footnote ${displaySymbol}`, children: [displaySymbol, isPartialMatch && renderPartialIndicator(status), isVerified && !isPartialMatch && renderVerifiedIndicator(status), isPending && pendingContent] })] }));
164
- });
165
- FootnoteCitation.displayName = "FootnoteCitation";
166
- /**
167
- * Inline style citation component.
168
- * Displays citation inline with subtle underline decoration.
169
- *
170
- * @example
171
- * ```tsx
172
- * <InlineCitation citation={citation} underlineStyle="dotted" />
173
- * // Renders: "quoted text" with subtle underline
174
- * ```
175
- */
176
- export const InlineCitation = forwardRef(({ citation, children, className, hideKeySpan = false, // Default to showing keySpan for inline
177
- fallbackDisplay, verification, eventHandlers, preventTooltips = false, pendingContent = TWO_DOTS_THINKING_CONTENT, renderVerifiedIndicator = () => _jsx(DefaultVerifiedIndicator, {}), renderPartialIndicator = () => _jsx(DefaultPartialIndicator, {}), underlineStyle = "dotted", }, ref) => {
178
- const { citationKey, citationInstanceId, status } = useCitationData(citation, verification);
179
- const { isVerified, isMiss, isPartialMatch, isPending } = status;
180
- const displayText = useMemo(() => getCitationDisplayText(citation, {
181
- hideKeySpan,
182
- fallbackDisplay,
183
- }), [citation, hideKeySpan, fallbackDisplay]);
184
- const handleClick = useCallback((e) => {
185
- e.preventDefault();
186
- e.stopPropagation();
187
- eventHandlers?.onClick?.(citation, citationKey, e);
188
- }, [eventHandlers, citation, citationKey]);
189
- const handleMouseEnter = useCallback(() => {
190
- eventHandlers?.onMouseEnter?.(citation, citationKey);
191
- }, [eventHandlers, citation, citationKey]);
192
- const handleMouseLeave = useCallback(() => {
193
- eventHandlers?.onMouseLeave?.(citation, citationKey);
194
- }, [eventHandlers, citation, citationKey]);
195
- // Check partial first since isVerified is true when isPartialMatch is true
196
- const statusClass = isPartialMatch
197
- ? "citation-inline--partial"
198
- : isMiss
199
- ? "citation-inline--miss"
200
- : isVerified
201
- ? "citation-inline--verified"
202
- : isPending
203
- ? "citation-inline--pending"
204
- : "";
205
- const underlineClass = `citation-inline--underline-${underlineStyle}`;
206
- return (_jsxs(_Fragment, { children: [children, _jsxs("span", { ref: ref, "data-citation-id": citationKey, "data-citation-instance": citationInstanceId, "data-variant": "inline", className: classNames("citation-inline", underlineClass, statusClass, className), onMouseEnter: preventTooltips ? undefined : handleMouseEnter, onMouseLeave: preventTooltips ? undefined : handleMouseLeave, onMouseDown: handleClick, onClick: (e) => e.stopPropagation(), "aria-label": `Citation: ${displayText}`, children: [displayText, isPartialMatch && renderPartialIndicator(status), isVerified && !isPartialMatch && renderVerifiedIndicator(status), isPending && (_jsx("span", { className: "citation-inline__pending", children: pendingContent }))] })] }));
207
- });
208
- InlineCitation.displayName = "InlineCitation";
209
- /**
210
- * Minimal style citation component.
211
- * Displays just the citation number with minimal decoration.
212
- *
213
- * @example
214
- * ```tsx
215
- * <MinimalCitation citation={citation} />
216
- * // Renders: 1
217
- * ```
218
- */
219
- export const MinimalCitation = forwardRef(({ citation, children, className, hideKeySpan = false, fallbackDisplay, verification, eventHandlers, preventTooltips = false, pendingContent = TWO_DOTS_THINKING_CONTENT, renderVerifiedIndicator = () => _jsx(DefaultVerifiedIndicator, {}), renderPartialIndicator = () => _jsx(DefaultPartialIndicator, {}), showStatusIndicator = true, }, ref) => {
220
- const { citationKey, citationInstanceId, status } = useCitationData(citation, verification);
221
- const { isVerified, isMiss, isPartialMatch, isPending } = status;
222
- const displayText = useMemo(() => getCitationDisplayText(citation, {
223
- hideKeySpan,
224
- fallbackDisplay,
225
- }), [citation, hideKeySpan, fallbackDisplay]);
226
- const handleClick = useCallback((e) => {
227
- e.preventDefault();
228
- e.stopPropagation();
229
- eventHandlers?.onClick?.(citation, citationKey, e);
230
- }, [eventHandlers, citation, citationKey]);
231
- const handleMouseEnter = useCallback(() => {
232
- eventHandlers?.onMouseEnter?.(citation, citationKey);
233
- }, [eventHandlers, citation, citationKey]);
234
- const handleMouseLeave = useCallback(() => {
235
- eventHandlers?.onMouseLeave?.(citation, citationKey);
236
- }, [eventHandlers, citation, citationKey]);
237
- // Check partial first since isVerified is true when isPartialMatch is true
238
- const statusClass = isPartialMatch
239
- ? "citation-minimal--partial"
240
- : isMiss
241
- ? "citation-minimal--miss"
242
- : isVerified
243
- ? "citation-minimal--verified"
244
- : isPending
245
- ? "citation-minimal--pending"
246
- : "";
247
- return (_jsxs(_Fragment, { children: [children, _jsxs("span", { ref: ref, "data-citation-id": citationKey, "data-citation-instance": citationInstanceId, "data-variant": "minimal", className: classNames("citation-minimal", statusClass, className), onMouseEnter: preventTooltips ? undefined : handleMouseEnter, onMouseLeave: preventTooltips ? undefined : handleMouseLeave, onMouseDown: handleClick, onClick: (e) => e.stopPropagation(), "aria-label": `Citation ${displayText}`, children: [displayText, showStatusIndicator && (_jsxs(_Fragment, { children: [isPartialMatch && renderPartialIndicator(status), isVerified && !isPartialMatch && renderVerifiedIndicator(status), isPending && pendingContent] }))] })] }));
248
- });
249
- MinimalCitation.displayName = "MinimalCitation";
250
- /**
251
- * Factory component that renders the appropriate citation variant.
252
- *
253
- * @example
254
- * ```tsx
255
- * <CitationVariantFactory variant="chip" citation={citation} chipProps={{ size: "lg" }} />
256
- * ```
257
- */
258
- export const CitationVariantFactory = forwardRef(({ variant = "bracket", chipProps, superscriptProps, footnoteProps, inlineProps, minimalProps, ...props }, ref) => {
259
- switch (variant) {
260
- case "chip":
261
- return _jsx(ChipCitation, { ref: ref, ...props, ...chipProps });
262
- case "superscript":
263
- return (_jsx(SuperscriptCitation, { ref: ref, ...props, ...superscriptProps }));
264
- case "footnote":
265
- return _jsx(FootnoteCitation, { ref: ref, ...props, ...footnoteProps });
266
- case "inline":
267
- return _jsx(InlineCitation, { ref: ref, ...props, ...inlineProps });
268
- case "minimal":
269
- return _jsx(MinimalCitation, { ref: ref, ...props, ...minimalProps });
270
- case "bracket":
271
- default:
272
- // For bracket variant, we return null here as CitationComponent handles it
273
- // This factory is meant to be used for alternate variants
274
- return null;
275
- }
276
- });
277
- CitationVariantFactory.displayName = "CitationVariantFactory";
278
- // Memoized versions for performance
279
- export const MemoizedChipCitation = memo(ChipCitation);
280
- export const MemoizedSuperscriptCitation = memo(SuperscriptCitation);
281
- export const MemoizedFootnoteCitation = memo(FootnoteCitation);
282
- export const MemoizedInlineCitation = memo(InlineCitation);
283
- export const MemoizedMinimalCitation = memo(MinimalCitation);
284
- export const MemoizedCitationVariantFactory = memo(CitationVariantFactory);
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- interface DiffDisplayProps {
3
- expected: string;
4
- actual: string;
5
- label?: string;
6
- className?: string;
7
- sanitize?: (text: string) => string;
8
- }
9
- declare const DiffDisplay: React.FC<DiffDisplayProps>;
10
- export default DiffDisplay;
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useMemo } from "react";
3
- import { useSmartDiff } from "./useSmartDiff.js";
4
- import { classNames } from "./utils.js";
5
- const DiffDisplay = ({ expected, actual, label, className, sanitize }) => {
6
- // 1. Sanitize Inputs if sanitization function provided
7
- const { sanitizedExpected, sanitizedActual } = useMemo(() => {
8
- if (sanitize) {
9
- return {
10
- sanitizedExpected: sanitize(expected),
11
- sanitizedActual: sanitize(actual),
12
- };
13
- }
14
- return {
15
- sanitizedExpected: expected,
16
- sanitizedActual: actual,
17
- };
18
- }, [expected, actual, sanitize]);
19
- // 2. Run the Smart Diff Hook
20
- const { diffResult } = useSmartDiff(sanitizedExpected, sanitizedActual);
21
- return (_jsxs("div", { className: classNames("dc-diff-display", className), children: [label && _jsx("div", { className: "dc-diff-label", children: label }), _jsx("div", { className: "dc-diff-content", children: _jsx("div", { className: "dc-diff-blocks", children: diffResult.map((block, blockIndex) => (_jsx("div", { className: classNames("dc-diff-block", `dc-diff-block--${block.type}`, block.type === "added" ? "dc-diff-block-added" : ""), children: block.parts.map((part, partIndex) => {
22
- const key = `p-${blockIndex}-${partIndex}`;
23
- if (part.removed) {
24
- return (_jsx("span", { className: "dc-diff-part dc-diff-part--removed", title: "Expected text", children: part.value }, key));
25
- }
26
- if (part.added) {
27
- return (_jsx("span", { className: "dc-diff-part dc-diff-part--added", title: "Actual text found", children: part.value }, key));
28
- }
29
- // Unchanged text
30
- return (_jsx("span", { className: "dc-diff-part dc-diff-part--unchanged", children: part.value }, key));
31
- }) }, `block-${blockIndex}`))) }) })] }));
32
- };
33
- export default DiffDisplay;
@@ -1,15 +0,0 @@
1
- /**
2
- * Popover component built on Radix UI primitives.
3
- * This is a shadcn-style component - copy/paste friendly.
4
- *
5
- * @see https://ui.shadcn.com/docs/components/popover
6
- * @see https://www.radix-ui.com/primitives/docs/components/popover
7
- */
8
- import * as React from "react";
9
- import * as PopoverPrimitive from "@radix-ui/react-popover";
10
- declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
11
- declare const PopoverTrigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
12
- declare const PopoverAnchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
13
- declare const PopoverPortal: React.FC<PopoverPrimitive.PopoverPortalProps>;
14
- declare const PopoverContent: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
- export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverPortal };
@@ -1,20 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * Popover component built on Radix UI primitives.
4
- * This is a shadcn-style component - copy/paste friendly.
5
- *
6
- * @see https://ui.shadcn.com/docs/components/popover
7
- * @see https://www.radix-ui.com/primitives/docs/components/popover
8
- */
9
- import * as React from "react";
10
- import * as PopoverPrimitive from "@radix-ui/react-popover";
11
- function cn(...classes) {
12
- return classes.filter(Boolean).join(" ");
13
- }
14
- const Popover = PopoverPrimitive.Root;
15
- const PopoverTrigger = PopoverPrimitive.Trigger;
16
- const PopoverAnchor = PopoverPrimitive.Anchor;
17
- const PopoverPortal = PopoverPrimitive.Portal;
18
- const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, className: cn("z-50 rounded-md border bg-white p-1 shadow-md outline-none", "border-gray-200 dark:border-gray-700 dark:bg-gray-900", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2", "data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2", "data-[side=top]:slide-in-from-bottom-2", className), ...props }) })));
19
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
20
- export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverPortal };
@@ -1,83 +0,0 @@
1
- import React from "react";
2
- import type { UrlCitationMeta, UrlCitationProps, UrlFetchStatus } from "./types.js";
3
- /**
4
- * Extracts domain from URL for compact display.
5
- */
6
- export declare function extractDomain(url: string): string;
7
- /**
8
- * Truncates a string to max length with ellipsis.
9
- */
10
- declare function truncateString(str: string, maxLength: number): string;
11
- /**
12
- * Get path from URL for display.
13
- */
14
- declare function getUrlPath(url: string): string;
15
- /**
16
- * Status indicator icons for URL fetch states.
17
- */
18
- declare const STATUS_ICONS: Record<UrlFetchStatus, {
19
- icon: string;
20
- label: string;
21
- className: string;
22
- }>;
23
- /**
24
- * Checks if status is a blocked status.
25
- */
26
- export declare function isBlockedStatus(status: UrlFetchStatus): boolean;
27
- /**
28
- * Checks if status is an error status.
29
- */
30
- export declare function isErrorStatus(status: UrlFetchStatus): boolean;
31
- /**
32
- * Checks if URL was successfully verified.
33
- */
34
- export declare function isVerifiedStatus(status: UrlFetchStatus): boolean;
35
- /**
36
- * URL Citation Component
37
- *
38
- * Displays a URL citation with compact domain display,
39
- * verification status, and blocked/error indicators.
40
- *
41
- * @example
42
- * ```tsx
43
- * <UrlCitationComponent
44
- * urlMeta={{
45
- * url: "https://example.com/article",
46
- * fetchStatus: "verified",
47
- * }}
48
- * />
49
- * // Renders: [example.com ✓]
50
- *
51
- * <UrlCitationComponent
52
- * urlMeta={{
53
- * url: "https://protected-site.com/page",
54
- * fetchStatus: "blocked_login",
55
- * }}
56
- * />
57
- * // Renders: [protected-site.com 🔒]
58
- * ```
59
- */
60
- export declare const UrlCitationComponent: React.ForwardRefExoticComponent<UrlCitationProps & React.RefAttributes<HTMLSpanElement>>;
61
- /**
62
- * Memoized version for performance.
63
- */
64
- export declare const MemoizedUrlCitationComponent: React.NamedExoticComponent<UrlCitationProps & React.RefAttributes<HTMLSpanElement>>;
65
- /**
66
- * Hook to parse URL and create UrlCitationMeta.
67
- */
68
- export declare function useUrlMeta(url: string, fetchStatus?: UrlFetchStatus, additionalMeta?: Partial<UrlCitationMeta>): UrlCitationMeta;
69
- /**
70
- * Compact URL display utilities.
71
- */
72
- export declare const urlDisplayUtils: {
73
- extractDomain: typeof extractDomain;
74
- truncateString: typeof truncateString;
75
- getUrlPath: typeof getUrlPath;
76
- isBlockedStatus: typeof isBlockedStatus;
77
- isErrorStatus: typeof isErrorStatus;
78
- isVerifiedStatus: typeof isVerifiedStatus;
79
- };
80
- /**
81
- * Status configuration for custom styling.
82
- */
83
- export { STATUS_ICONS };