@arbidocs/react 0.4.55 → 0.4.57

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 (49) hide show
  1. package/dist/PdfViewer-bQH9yxFg.d.cts +55 -0
  2. package/dist/PdfViewer-bQH9yxFg.d.ts +55 -0
  3. package/dist/annotations/freeze/index.cjs +748 -0
  4. package/dist/annotations/freeze/index.cjs.map +1 -0
  5. package/dist/annotations/freeze/index.d.cts +199 -0
  6. package/dist/annotations/freeze/index.d.ts +199 -0
  7. package/dist/annotations/freeze/index.js +738 -0
  8. package/dist/annotations/freeze/index.js.map +1 -0
  9. package/dist/annotations/index.cjs +1756 -0
  10. package/dist/annotations/index.cjs.map +1 -0
  11. package/dist/annotations/index.d.cts +291 -0
  12. package/dist/annotations/index.d.ts +291 -0
  13. package/dist/annotations/index.js +1690 -0
  14. package/dist/annotations/index.js.map +1 -0
  15. package/dist/artifacts/index.cjs +16 -16
  16. package/dist/artifacts/index.js +5 -5
  17. package/dist/chunk-BGDE4DP5.cjs +192 -0
  18. package/dist/chunk-BGDE4DP5.cjs.map +1 -0
  19. package/dist/{chunk-MS7VH2BY.js → chunk-CVN7MAGQ.js} +6 -146
  20. package/dist/chunk-CVN7MAGQ.js.map +1 -0
  21. package/dist/chunk-JWXIRUWN.js +183 -0
  22. package/dist/chunk-JWXIRUWN.js.map +1 -0
  23. package/dist/chunk-QS3Q5542.js +151 -0
  24. package/dist/chunk-QS3Q5542.js.map +1 -0
  25. package/dist/{chunk-RI3BZQWD.cjs → chunk-R6V6YHPD.cjs} +3 -3
  26. package/dist/{chunk-RI3BZQWD.cjs.map → chunk-R6V6YHPD.cjs.map} +1 -1
  27. package/dist/{chunk-LOESXNVT.cjs → chunk-X3F5ABY2.cjs} +5 -158
  28. package/dist/chunk-X3F5ABY2.cjs.map +1 -0
  29. package/dist/chunk-XDCRWZF2.cjs +185 -0
  30. package/dist/chunk-XDCRWZF2.cjs.map +1 -0
  31. package/dist/{chunk-GT6KN3DV.js → chunk-XKGTZ3H6.js} +3 -3
  32. package/dist/{chunk-GT6KN3DV.js.map → chunk-XKGTZ3H6.js.map} +1 -1
  33. package/dist/index.cjs +475 -474
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.js +11 -9
  36. package/dist/index.js.map +1 -1
  37. package/dist/model-DzQxhMMz.d.cts +102 -0
  38. package/dist/model-DzQxhMMz.d.ts +102 -0
  39. package/dist/ui/index.cjs +186 -185
  40. package/dist/ui/index.js +3 -2
  41. package/dist/viewers/index.cjs +61 -52
  42. package/dist/viewers/index.cjs.map +1 -1
  43. package/dist/viewers/index.d.cts +3 -43
  44. package/dist/viewers/index.d.ts +3 -43
  45. package/dist/viewers/index.js +61 -52
  46. package/dist/viewers/index.js.map +1 -1
  47. package/package.json +31 -9
  48. package/dist/chunk-LOESXNVT.cjs.map +0 -1
  49. package/dist/chunk-MS7VH2BY.js.map +0 -1
package/dist/ui/index.js CHANGED
@@ -1,6 +1,7 @@
1
- export { AgentBadge, AiMarkdown, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EntityIcon, EntityPill, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, Input, Label, MarkMenu, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, ThreadVisibilityIcon, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, UserMenu, VISIBILITY_ICONS, VisibilityIcon, VisibilityToggle, badgeVariants, buttonVariants, cardVariants, configureEntityRegistry, configureRagLabels, configureStatusRegistry, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, toggleVariants } from '../chunk-MS7VH2BY.js';
2
- export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ScrollArea, ScrollBar } from '../chunk-N5SVBDLC.js';
1
+ export { AgentBadge, AiMarkdown, Avatar, AvatarFallback, AvatarImage, BASE_COLORS, Badge, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DictateProvider, DocumentCard, DocumentEntity, ENTITY_MAPPINGS, EntityIcon, EntityPill, HoverCard, HoverCardContent, HoverCardTrigger, IconToggle, Input, Label, MarkMenu, NEUTRAL_GRAY, PLACEHOLDER_COLOR, PassageCard, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PresenceLabel, Progress, ProjectEntity, RadioGroup, RadioGroupItem, RagDot, RelevanceDot, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Slider, StatusPill, Switch, TAG_TYPE_ICONS, TAG_TYPE_LABELS, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TagEntity, Textarea, ThreadVisibilityIcon, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserEntity, UserMenu, VISIBILITY_ICONS, VisibilityIcon, VisibilityToggle, badgeVariants, cardVariants, configureEntityRegistry, configureRagLabels, configureStatusRegistry, getDocIcon, getEntityColor, getEntityColorStyles, getEntityIcon, getEntityLabel, getStatusVariant, getTagTypeIcon, getTagTypeLabel, getWorkspaceColor, toggleVariants } from '../chunk-CVN7MAGQ.js';
2
+ export { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, buttonVariants } from '../chunk-QS3Q5542.js';
3
3
  export { MarkdownRenderer, MarkdownStreamingContext, closeOpenEmphasis, markdownBaseComponents, splitMarkdownBlocks, trimOpenCitation } from '../chunk-JPGV7NMY.js';
4
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ScrollArea, ScrollBar } from '../chunk-N5SVBDLC.js';
4
5
  export { cn } from '../chunk-SN5YV6FF.js';
5
6
  //# sourceMappingURL=index.js.map
6
7
  //# sourceMappingURL=index.js.map
@@ -300,7 +300,8 @@ function PdfViewer({
300
300
  onZoomChange,
301
301
  onPageChange,
302
302
  disableFontFace = false,
303
- assets
303
+ assets,
304
+ renderPageOverlay
304
305
  }) {
305
306
  const workerSrc = assets?.workerSrc ?? DEFAULT_ASSETS.workerSrc;
306
307
  const cMapUrl = assets?.cMapUrl ?? DEFAULT_ASSETS.cMapUrl;
@@ -311,6 +312,7 @@ function PdfViewer({
311
312
  const [containerWidth, setContainerWidth] = react.useState(0);
312
313
  const [defaultRatio, setDefaultRatio] = react.useState(DEFAULT_PAGE_ASPECT_RATIO);
313
314
  const [pageRatios, setPageRatios] = react.useState(/* @__PURE__ */ new Map());
315
+ const [pageWidthsPt, setPageWidthsPt] = react.useState(/* @__PURE__ */ new Map());
314
316
  const [loadError, setLoadError] = react.useState(null);
315
317
  const [documentKey, setDocumentKey] = react.useState(() => `pdf-${Date.now()}`);
316
318
  const initialPage = currentPage || 1;
@@ -503,6 +505,7 @@ function PdfViewer({
503
505
  reactPdf.Document,
504
506
  {
505
507
  className: "flex w-max min-w-full flex-col",
508
+ suspense: false,
506
509
  file,
507
510
  onLoadSuccess: onDocumentLoadSuccess,
508
511
  onLoadError: onDocumentLoadError,
@@ -525,7 +528,7 @@ function PdfViewer({
525
528
  const renderWidth = containerWidth * renderZoom;
526
529
  const scale = zoom / renderZoom;
527
530
  const shouldRenderTextLayer = visiblePages.has(pageNumber);
528
- return /* @__PURE__ */ jsxRuntime.jsx(
531
+ return /* @__PURE__ */ jsxRuntime.jsxs(
529
532
  "div",
530
533
  {
531
534
  ref: (el) => {
@@ -536,59 +539,65 @@ function PdfViewer({
536
539
  }
537
540
  },
538
541
  "data-page-number": pageNumber,
539
- className: "mx-auto mb-6 shrink-0 shadow-xl bg-white border border-border",
542
+ className: "relative mx-auto mb-6 shrink-0 shadow-xl bg-white border border-border",
540
543
  style: { width: pageWidth + PAGE_BORDER_PX, height: pageHeight + PAGE_BORDER_PX },
541
544
  role: "article",
542
545
  "aria-label": `Page ${pageNumber} of ${numPages}`,
543
- children: shouldRender ? /* @__PURE__ */ jsxRuntime.jsx(
544
- "div",
545
- {
546
- "data-testid": `pdf-page-scaler-${pageNumber}`,
547
- style: scale === 1 ? void 0 : { transform: `scale(${scale})`, transformOrigin: "0 0" },
548
- children: /* @__PURE__ */ jsxRuntime.jsx(
549
- reactPdf.Page,
550
- {
551
- pageNumber,
552
- width: renderWidth,
553
- renderTextLayer: shouldRenderTextLayer,
554
- renderAnnotationLayer: false,
555
- onLoadSuccess: (page) => {
556
- const ratio2 = page.originalHeight / page.originalWidth;
557
- setPageRatios(
558
- (prev) => Math.abs((prev.get(pageNumber) ?? defaultRatio) - ratio2) < 1e-3 ? prev : new Map(prev).set(pageNumber, ratio2)
559
- );
560
- },
561
- devicePixelRatio: renderDpr(
562
- renderWidth,
563
- renderWidth * ratio,
564
- window.devicePixelRatio || 1
565
- ),
566
- loading: /* @__PURE__ */ jsxRuntime.jsx(
567
- "div",
568
- {
569
- className: "flex items-center justify-center bg-muted",
570
- style: { width: renderWidth, height: renderWidth * ratio },
571
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted-foreground", children: [
572
- "Loading page ",
573
- pageNumber,
574
- "..."
575
- ] })
576
- }
577
- )
578
- }
579
- )
580
- }
581
- ) : /* @__PURE__ */ jsxRuntime.jsx(
582
- "div",
583
- {
584
- className: "flex items-center justify-center bg-muted",
585
- style: { width: pageWidth, height: pageHeight },
586
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted-foreground", children: [
587
- "Page ",
588
- pageNumber
589
- ] })
590
- }
591
- )
546
+ children: [
547
+ shouldRender ? /* @__PURE__ */ jsxRuntime.jsx(
548
+ "div",
549
+ {
550
+ "data-testid": `pdf-page-scaler-${pageNumber}`,
551
+ style: scale === 1 ? void 0 : { transform: `scale(${scale})`, transformOrigin: "0 0" },
552
+ children: /* @__PURE__ */ jsxRuntime.jsx(
553
+ reactPdf.Page,
554
+ {
555
+ pageNumber,
556
+ width: renderWidth,
557
+ renderTextLayer: shouldRenderTextLayer,
558
+ renderAnnotationLayer: false,
559
+ onLoadSuccess: (page) => {
560
+ setPageWidthsPt(
561
+ (prev) => prev.get(pageNumber) === page.originalWidth ? prev : new Map(prev).set(pageNumber, page.originalWidth)
562
+ );
563
+ const ratio2 = page.originalHeight / page.originalWidth;
564
+ setPageRatios(
565
+ (prev) => Math.abs((prev.get(pageNumber) ?? defaultRatio) - ratio2) < 1e-3 ? prev : new Map(prev).set(pageNumber, ratio2)
566
+ );
567
+ },
568
+ devicePixelRatio: renderDpr(
569
+ renderWidth,
570
+ renderWidth * ratio,
571
+ window.devicePixelRatio || 1
572
+ ),
573
+ loading: /* @__PURE__ */ jsxRuntime.jsx(
574
+ "div",
575
+ {
576
+ className: "flex items-center justify-center bg-muted",
577
+ style: { width: renderWidth, height: renderWidth * ratio },
578
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted-foreground", children: [
579
+ "Loading page ",
580
+ pageNumber,
581
+ "..."
582
+ ] })
583
+ }
584
+ )
585
+ }
586
+ )
587
+ }
588
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
589
+ "div",
590
+ {
591
+ className: "flex items-center justify-center bg-muted",
592
+ style: { width: pageWidth, height: pageHeight },
593
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted-foreground", children: [
594
+ "Page ",
595
+ pageNumber
596
+ ] })
597
+ }
598
+ ),
599
+ renderPageOverlay?.({ pageNumber, pageWidthPt: pageWidthsPt.get(pageNumber) })
600
+ ]
592
601
  },
593
602
  `page_${pageNumber}`
594
603
  );