@osdk/react-components 0.20.0-main-4e2a115a796e8664c3972548bb02e707baafa912 → 0.20.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.
Files changed (134) hide show
  1. package/CHANGELOG.md +2 -10
  2. package/build/browser/object-table/ObjectTable.js +2 -1
  3. package/build/browser/object-table/ObjectTable.js.map +1 -1
  4. package/build/browser/object-table/ObjectTableApi.js.map +1 -1
  5. package/build/browser/object-table/hooks/useObjectTableData.js +5 -3
  6. package/build/browser/object-table/hooks/useObjectTableData.js.map +1 -1
  7. package/build/browser/pdf-viewer/PdfViewer.js +4 -6
  8. package/build/browser/pdf-viewer/PdfViewer.js.map +1 -1
  9. package/build/browser/pdf-viewer/components/PdfAnnotationOverlay.js +43 -0
  10. package/build/browser/pdf-viewer/components/PdfAnnotationOverlay.js.map +1 -0
  11. package/build/browser/pdf-viewer/components/PdfViewerAnnotationLayer.js +22 -14
  12. package/build/browser/pdf-viewer/components/PdfViewerAnnotationLayer.js.map +1 -1
  13. package/build/browser/pdf-viewer/components/PdfViewerContent.js +4 -6
  14. package/build/browser/pdf-viewer/components/PdfViewerContent.js.map +1 -1
  15. package/build/browser/pdf-viewer/hooks/usePdfAnnotationPortals.js +83 -13
  16. package/build/browser/pdf-viewer/hooks/usePdfAnnotationPortals.js.map +1 -1
  17. package/build/browser/pdf-viewer/types.js.map +1 -1
  18. package/build/browser/shared/calendar/DatePickerCommon.module.css +5 -0
  19. package/build/browser/styles.css +5 -0
  20. package/build/browser/util/UserAgent.js +1 -1
  21. package/build/browser/util/UserAgent.js.map +1 -1
  22. package/build/cjs/chunk-2GAPPUP5.cjs +11 -0
  23. package/build/cjs/{chunk-BN5MGNSI.cjs.map → chunk-2GAPPUP5.cjs.map} +1 -1
  24. package/build/cjs/{chunk-QYUADULX.cjs → chunk-4MGATUJ3.cjs} +17 -17
  25. package/build/cjs/{chunk-QYUADULX.cjs.map → chunk-4MGATUJ3.cjs.map} +1 -1
  26. package/build/cjs/{chunk-HOPH2463.cjs → chunk-4WDDVYWV.cjs} +3 -3
  27. package/build/cjs/chunk-4WDDVYWV.cjs.map +1 -0
  28. package/build/cjs/chunk-5UTN55T6.cjs +11 -0
  29. package/build/cjs/{chunk-LLGHXDSY.cjs.map → chunk-5UTN55T6.cjs.map} +1 -1
  30. package/build/cjs/{chunk-YWDLYGD5.cjs → chunk-AICPFRJQ.cjs} +32 -32
  31. package/build/cjs/{chunk-YWDLYGD5.cjs.map → chunk-AICPFRJQ.cjs.map} +1 -1
  32. package/build/cjs/{chunk-WYIUQ3FZ.cjs → chunk-DAHWLFFD.cjs} +4 -4
  33. package/build/cjs/{chunk-WYIUQ3FZ.cjs.map → chunk-DAHWLFFD.cjs.map} +1 -1
  34. package/build/cjs/{chunk-ETOC4FJE.cjs → chunk-FWZS3WQ4.cjs} +135 -34
  35. package/build/cjs/chunk-FWZS3WQ4.cjs.map +1 -0
  36. package/build/cjs/{chunk-67LMSFXM.cjs → chunk-GUBIWML7.cjs} +16 -13
  37. package/build/cjs/chunk-GUBIWML7.cjs.map +1 -0
  38. package/build/cjs/chunk-KLL6MAZL.cjs +11 -0
  39. package/build/cjs/{chunk-YWYFWFUF.cjs.map → chunk-KLL6MAZL.cjs.map} +1 -1
  40. package/build/cjs/{chunk-7CYKOZFL.cjs → chunk-LIF2LJ2I.cjs} +7 -7
  41. package/build/cjs/{chunk-7CYKOZFL.cjs.map → chunk-LIF2LJ2I.cjs.map} +1 -1
  42. package/build/cjs/{chunk-4JJP3RNQ.cjs → chunk-PPQSIR4K.cjs} +4 -4
  43. package/build/cjs/{chunk-4JJP3RNQ.cjs.map → chunk-PPQSIR4K.cjs.map} +1 -1
  44. package/build/cjs/{chunk-4V245Z6A.cjs → chunk-PWXV5SBK.cjs} +26 -28
  45. package/build/cjs/chunk-PWXV5SBK.cjs.map +1 -0
  46. package/build/cjs/chunk-UJKIIMIE.cjs +11 -0
  47. package/build/cjs/{chunk-DCRVOHKP.cjs.map → chunk-UJKIIMIE.cjs.map} +1 -1
  48. package/build/cjs/chunk-VBM5GWFP.cjs +11 -0
  49. package/build/cjs/{chunk-LGUTBX34.cjs.map → chunk-VBM5GWFP.cjs.map} +1 -1
  50. package/build/cjs/{chunk-4KC5U44T.cjs → chunk-XA3S7YAO.cjs} +2 -2
  51. package/build/cjs/chunk-XA3S7YAO.cjs.map +1 -0
  52. package/build/cjs/{chunk-GN3PIYGH.cjs → chunk-Y6BGC7DP.cjs} +22 -22
  53. package/build/cjs/{chunk-GN3PIYGH.cjs.map → chunk-Y6BGC7DP.cjs.map} +1 -1
  54. package/build/cjs/public/experimental/action-form.cjs +6 -6
  55. package/build/cjs/public/experimental/action-form.css +3 -0
  56. package/build/cjs/public/experimental/action-form.css.map +1 -1
  57. package/build/cjs/public/experimental/document-viewer.cjs +5 -5
  58. package/build/cjs/public/experimental/document-viewer.d.cts +1 -1
  59. package/build/cjs/public/experimental/email-viewer.cjs +3 -3
  60. package/build/cjs/public/experimental/excel-viewer.cjs +3 -3
  61. package/build/cjs/public/experimental/filter-list.cjs +15 -15
  62. package/build/cjs/public/experimental/filter-list.css +3 -0
  63. package/build/cjs/public/experimental/filter-list.css.map +1 -1
  64. package/build/cjs/public/experimental/image-viewer.cjs +3 -3
  65. package/build/cjs/public/experimental/markdown-renderer.cjs +3 -3
  66. package/build/cjs/public/experimental/object-table.cjs +10 -10
  67. package/build/cjs/public/experimental/object-table.css +3 -0
  68. package/build/cjs/public/experimental/object-table.css.map +1 -1
  69. package/build/cjs/public/experimental/object-table.d.cts +14 -1
  70. package/build/cjs/public/experimental/pdf-viewer.cjs +25 -25
  71. package/build/cjs/public/experimental/pdf-viewer.d.cts +9 -4
  72. package/build/cjs/public/experimental/tiff-renderer.cjs +3 -3
  73. package/build/cjs/public/experimental/video-viewer.cjs +3 -3
  74. package/build/cjs/public/experimental/xml-viewer.cjs +3 -3
  75. package/build/cjs/public/experimental.cjs +67 -67
  76. package/build/cjs/public/experimental.css +3 -0
  77. package/build/cjs/public/experimental.css.map +1 -1
  78. package/build/cjs/public/experimental.d.cts +1 -1
  79. package/build/cjs/{types-CbSNeyzw.d.cts → types-Cg_LdKf-.d.cts} +1 -0
  80. package/build/esm/object-table/ObjectTable.js +2 -1
  81. package/build/esm/object-table/ObjectTable.js.map +1 -1
  82. package/build/esm/object-table/ObjectTableApi.js.map +1 -1
  83. package/build/esm/object-table/hooks/useObjectTableData.js +5 -3
  84. package/build/esm/object-table/hooks/useObjectTableData.js.map +1 -1
  85. package/build/esm/pdf-viewer/PdfViewer.js +4 -6
  86. package/build/esm/pdf-viewer/PdfViewer.js.map +1 -1
  87. package/build/esm/pdf-viewer/components/PdfAnnotationOverlay.js +43 -0
  88. package/build/esm/pdf-viewer/components/PdfAnnotationOverlay.js.map +1 -0
  89. package/build/esm/pdf-viewer/components/PdfViewerAnnotationLayer.js +22 -14
  90. package/build/esm/pdf-viewer/components/PdfViewerAnnotationLayer.js.map +1 -1
  91. package/build/esm/pdf-viewer/components/PdfViewerContent.js +4 -6
  92. package/build/esm/pdf-viewer/components/PdfViewerContent.js.map +1 -1
  93. package/build/esm/pdf-viewer/hooks/usePdfAnnotationPortals.js +83 -13
  94. package/build/esm/pdf-viewer/hooks/usePdfAnnotationPortals.js.map +1 -1
  95. package/build/esm/pdf-viewer/types.js.map +1 -1
  96. package/build/esm/shared/calendar/DatePickerCommon.module.css +5 -0
  97. package/build/esm/util/UserAgent.js +1 -1
  98. package/build/esm/util/UserAgent.js.map +1 -1
  99. package/build/types/object-table/ObjectTable.d.ts +1 -1
  100. package/build/types/object-table/ObjectTable.d.ts.map +1 -1
  101. package/build/types/object-table/ObjectTableApi.d.ts +13 -0
  102. package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
  103. package/build/types/object-table/hooks/useObjectTableData.d.ts +1 -1
  104. package/build/types/object-table/hooks/useObjectTableData.d.ts.map +1 -1
  105. package/build/types/pdf-viewer/PdfViewer.d.ts.map +1 -1
  106. package/build/types/pdf-viewer/components/PdfAnnotationOverlay.d.ts +9 -0
  107. package/build/types/pdf-viewer/components/PdfAnnotationOverlay.d.ts.map +1 -0
  108. package/build/types/pdf-viewer/components/PdfViewerAnnotationLayer.d.ts +2 -1
  109. package/build/types/pdf-viewer/components/PdfViewerAnnotationLayer.d.ts.map +1 -1
  110. package/build/types/pdf-viewer/components/PdfViewerContent.d.ts.map +1 -1
  111. package/build/types/pdf-viewer/hooks/usePdfAnnotationPortals.d.ts +5 -1
  112. package/build/types/pdf-viewer/hooks/usePdfAnnotationPortals.d.ts.map +1 -1
  113. package/build/types/pdf-viewer/types.d.ts +1 -0
  114. package/build/types/pdf-viewer/types.d.ts.map +1 -1
  115. package/docs/GettingStarted.md +65 -0
  116. package/docs/ObjectTable.md +6 -5
  117. package/docs/Prerequisites.md +1 -2
  118. package/docs/StylingOverview.md +146 -0
  119. package/docs/TokenColors.md +130 -0
  120. package/docs/TokenSpacing.md +73 -0
  121. package/docs/TokenTypography.md +57 -0
  122. package/docs/UsageWithOsdk.md +47 -0
  123. package/docs/Welcome.md +42 -0
  124. package/package.json +8 -8
  125. package/build/cjs/chunk-4KC5U44T.cjs.map +0 -1
  126. package/build/cjs/chunk-4V245Z6A.cjs.map +0 -1
  127. package/build/cjs/chunk-67LMSFXM.cjs.map +0 -1
  128. package/build/cjs/chunk-BN5MGNSI.cjs +0 -11
  129. package/build/cjs/chunk-DCRVOHKP.cjs +0 -11
  130. package/build/cjs/chunk-ETOC4FJE.cjs.map +0 -1
  131. package/build/cjs/chunk-HOPH2463.cjs.map +0 -1
  132. package/build/cjs/chunk-LGUTBX34.cjs +0 -11
  133. package/build/cjs/chunk-LLGHXDSY.cjs +0 -11
  134. package/build/cjs/chunk-YWYFWFUF.cjs +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"PdfViewerAnnotationLayer.js","names":["classnames","React","useCallback","useMemo","styles","computeRectStyle","rect","pageHeight","scale","color","left","x","top","y","height","width","useAnnotationHandlers","annotation","onClick","handleClick","handleKeyDown","e","key","preventDefault","AnnotationItem","className","type","multiRects","rects","hasMultipleRects","length","style","createElement","annotationGroup","onKeyDown","role","tabIndex","title","label","id","map","i","CustomAnnotationItem","undefined","renderProps","render","PdfViewerAnnotationLayer","annotations","onAnnotationClick","annotationLayer"],"sources":["PdfViewerAnnotationLayer.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classnames from \"classnames\";\nimport React, { useCallback, useMemo } from \"react\";\nimport type { PdfAnnotation, PdfCustomAnnotation, PdfRect } from \"../types.js\";\nimport styles from \"./PdfViewerAnnotationLayer.module.css\";\n\nexport interface PdfViewerAnnotationLayerProps {\n annotations: PdfAnnotation[];\n pageHeight: number;\n scale: number;\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n}\n\ninterface AnnotationItemProps {\n annotation: PdfAnnotation;\n pageHeight: number;\n scale: number;\n onClick?: (annotation: PdfAnnotation) => void;\n}\n\n/** Convert a single PDF rect (bottom-left origin) to CSS positioning (top-left origin). */\nfunction computeRectStyle(\n rect: PdfRect,\n pageHeight: number,\n scale: number,\n color: string | undefined,\n): React.CSSProperties {\n return {\n left: rect.x * scale,\n top: (pageHeight - rect.y - rect.height) * scale,\n width: rect.width * scale,\n height: rect.height * scale,\n ...(color != null\n ? { \"--osdk-pdf-annotation-color\": color } as React.CSSProperties\n : {}),\n };\n}\n\nfunction useAnnotationHandlers(\n annotation: PdfAnnotation,\n onClick?: (annotation: PdfAnnotation) => void,\n) {\n const handleClick = useCallback(() => {\n onClick?.(annotation);\n }, [onClick, annotation]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n onClick?.(annotation);\n }\n },\n [onClick, annotation],\n );\n\n return { handleClick, handleKeyDown };\n}\n\nfunction AnnotationItem({\n annotation,\n pageHeight,\n scale,\n onClick,\n}: AnnotationItemProps): React.ReactElement {\n const { handleClick, handleKeyDown } = useAnnotationHandlers(\n annotation,\n onClick,\n );\n\n const className = classnames(\n styles.annotation,\n styles[annotation.type],\n );\n\n const multiRects = annotation.rects;\n const hasMultipleRects = multiRects != null && multiRects.length > 1;\n\n const style = useMemo(\n () =>\n computeRectStyle(annotation.rect, pageHeight, scale, annotation.color),\n [annotation, pageHeight, scale],\n );\n\n // Multi-rect: render a group wrapper with one div per rect\n if (hasMultipleRects) {\n return (\n <div\n className={styles.annotationGroup}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n title={annotation.label}\n data-annotation-id={annotation.id}\n >\n {multiRects.map((rect, i) => (\n <div\n key={i}\n className={className}\n style={computeRectStyle(\n rect,\n pageHeight,\n scale,\n annotation.color,\n )}\n />\n ))}\n </div>\n );\n }\n\n // Single rect: existing behavior\n\n return (\n <div\n className={className}\n style={style}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n title={annotation.label}\n data-annotation-id={annotation.id}\n />\n );\n}\n\nfunction CustomAnnotationItem({\n annotation,\n pageHeight,\n scale,\n onClick,\n}: AnnotationItemProps & {\n annotation: PdfCustomAnnotation;\n}): React.ReactElement {\n const { handleClick, handleKeyDown } = useAnnotationHandlers(\n annotation,\n onClick,\n );\n\n const style = useMemo(\n () => computeRectStyle(annotation.rect, pageHeight, scale, undefined),\n [annotation, pageHeight, scale],\n );\n\n const renderProps = useMemo(\n () => ({ annotation, scale, pageHeight }),\n [annotation, scale, pageHeight],\n );\n\n return (\n <div\n className={styles.annotation}\n style={style}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n title={annotation.label}\n data-annotation-id={annotation.id}\n >\n {annotation.render(renderProps)}\n </div>\n );\n}\n\nexport function PdfViewerAnnotationLayer({\n annotations,\n pageHeight,\n scale,\n onAnnotationClick,\n}: PdfViewerAnnotationLayerProps): React.ReactElement {\n return (\n <div className={styles.annotationLayer}>\n {annotations.map((annotation) =>\n annotation.type === \"custom\"\n ? (\n <CustomAnnotationItem\n key={annotation.id}\n annotation={annotation}\n pageHeight={pageHeight}\n scale={scale}\n onClick={onAnnotationClick}\n />\n )\n : (\n <AnnotationItem\n key={annotation.id}\n annotation={annotation}\n pageHeight={pageHeight}\n scale={scale}\n onClick={onAnnotationClick}\n />\n )\n )}\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAEnD,OAAOC,MAAM,MAAM,uCAAuC;AAgB1D;AACA,SAASC,gBAAgBA,CACvBC,IAAa,EACbC,UAAkB,EAClBC,KAAa,EACbC,KAAyB,EACJ;EACrB,OAAO;IACLC,IAAI,EAAEJ,IAAI,CAACK,CAAC,GAAGH,KAAK;IACpBI,GAAG,EAAE,CAACL,UAAU,GAAGD,IAAI,CAACO,CAAC,GAAGP,IAAI,CAACQ,MAAM,IAAIN,KAAK;IAChDO,KAAK,EAAET,IAAI,CAACS,KAAK,GAAGP,KAAK;IACzBM,MAAM,EAAER,IAAI,CAACQ,MAAM,GAAGN,KAAK;IAC3B,IAAIC,KAAK,IAAI,IAAI,GACb;MAAE,6BAA6B,EAAEA;IAAM,CAAC,GACxC,CAAC,CAAC;EACR,CAAC;AACH;AAEA,SAASO,qBAAqBA,CAC5BC,UAAyB,EACzBC,OAA6C,EAC7C;EACA,MAAMC,WAAW,GAAGjB,WAAW,CAAC,MAAM;I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,WAAY;IACrBe,SAAS,EAAEd,aAAc;IACzBe,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAE,CAAE;IACZC,KAAK,EAAEpB,UAAU,CAACqB,KAAM;IACxB,sBAAoBrB,UAAU,CAACsB;EAAG,GAEjCtB,UAAU,CAAC4B,MAAM,CAACD,WAAW,CAC3B,CAAC;AAEV;AAEA,OAAO,SAASE,wBAAwBA,CAAC;EACvCC,WAAW;EACXxC,UAAU;EACVC,KAAK;EACLwC;AAC6B,CAAC,EAAsB;EACpD,oBACE/C,KAAA,CAAA+B,aAAA;IAAKP,SAAS,EAAErB,MAAM,CAAC6C;EAAgB,GACpCF,WAAW,CAACP,GAAG,CAAEvB,UAAU,IAC1BA,UAAU,CAACS,IAAI,KAAK,QAAQ,gBAExBzB,KAAA,CAAA+B,aAAA,CAACU,oBAAoB;IACnBpB,GAAG,EAAEL,UAAU,CAACsB,EAAG;IACnBtB,UAAU,EAAEA,UAAW;IACvBV,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbU,OAAO,EAAE8B;EAAkB,CAC5B,CAAC,gBAGF/C,KAAA,CAAA+B,aAAA,CAACR,cAAc;IACbF,GAAG,EAAEL,UAAU,CAACsB,EAAG;IACnBtB,UAAU,EAAEA,UAAW;IACvBV,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACbU,OAAO,EAAE8B;EAAkB,CAC5B,CAEP,CACG,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"file":"PdfViewerAnnotationLayer.js","names":["classnames","React","useCallback","useMemo","styles","applyTransform","point","m","computeRectStyle","rect","transform","color","x1","y1","x","y","x2","y2","width","height","left","Math","min","top","abs","useAnnotationHandlers","annotation","onClick","handleClick","handleKeyDown","e","key","preventDefault","AnnotationItem","className","type","multiRects","rects","hasMultipleRects","length","style","createElement","annotationGroup","onKeyDown","role","tabIndex","title","label","id","map","i","CustomAnnotationItem","pageHeight","scale","undefined","renderProps","render","PdfViewerAnnotationLayer","annotations","onAnnotationClick","annotationLayer"],"sources":["PdfViewerAnnotationLayer.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport classnames from \"classnames\";\nimport React, { useCallback, useMemo } from \"react\";\nimport type { PdfAnnotation, PdfCustomAnnotation, PdfRect } from \"../types.js\";\nimport styles from \"./PdfViewerAnnotationLayer.module.css\";\n\nexport interface PdfViewerAnnotationLayerProps {\n annotations: PdfAnnotation[];\n pageHeight: number;\n scale: number;\n transform: number[];\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n}\n\ninterface AnnotationItemProps {\n annotation: PdfAnnotation;\n transform: number[];\n onClick?: (annotation: PdfAnnotation) => void;\n}\n\ninterface CustomAnnotationItemProps extends AnnotationItemProps {\n annotation: PdfCustomAnnotation;\n pageHeight: number;\n scale: number;\n}\n\nfunction applyTransform(\n point: readonly [number, number],\n m: readonly number[],\n): [number, number] {\n return [\n m[0] * point[0] + m[2] * point[1] + m[4],\n m[1] * point[0] + m[3] * point[1] + m[5],\n ];\n}\n\n/** Convert a single PDF rect (bottom-left origin) to CSS positioning (top-left origin). */\nfunction computeRectStyle(\n rect: PdfRect,\n transform: readonly number[],\n color: string | undefined,\n): React.CSSProperties {\n const [x1, y1] = applyTransform([rect.x, rect.y], transform);\n const [x2, y2] = applyTransform(\n [rect.x + rect.width, rect.y + rect.height],\n transform,\n );\n return {\n left: Math.min(x1, x2),\n top: Math.min(y1, y2),\n width: Math.abs(x2 - x1),\n height: Math.abs(y2 - y1),\n ...(color != null\n ? { \"--osdk-pdf-annotation-color\": color } as React.CSSProperties\n : {}),\n };\n}\n\nfunction useAnnotationHandlers(\n annotation: PdfAnnotation,\n onClick?: (annotation: PdfAnnotation) => void,\n) {\n const handleClick = useCallback(() => {\n onClick?.(annotation);\n }, [onClick, annotation]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n onClick?.(annotation);\n }\n },\n [onClick, annotation],\n );\n\n return { handleClick, handleKeyDown };\n}\n\nfunction AnnotationItem({\n annotation,\n transform,\n onClick,\n}: AnnotationItemProps): React.ReactElement {\n const { handleClick, handleKeyDown } = useAnnotationHandlers(\n annotation,\n onClick,\n );\n\n const className = classnames(\n styles.annotation,\n styles[annotation.type],\n );\n\n const multiRects = annotation.rects;\n const hasMultipleRects = multiRects != null && multiRects.length > 1;\n\n const style = useMemo(\n () => computeRectStyle(annotation.rect, transform, annotation.color),\n [annotation, transform],\n );\n\n // Multi-rect: render a group wrapper with one div per rect\n if (hasMultipleRects) {\n return (\n <div\n className={styles.annotationGroup}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n title={annotation.label}\n data-annotation-id={annotation.id}\n >\n {multiRects.map((rect, i) => (\n <div\n key={i}\n className={className}\n style={computeRectStyle(rect, transform, annotation.color)}\n />\n ))}\n </div>\n );\n }\n\n // Single rect: existing behavior\n\n return (\n <div\n className={className}\n style={style}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n title={annotation.label}\n data-annotation-id={annotation.id}\n />\n );\n}\n\nfunction CustomAnnotationItem({\n annotation,\n pageHeight,\n scale,\n transform,\n onClick,\n}: CustomAnnotationItemProps): React.ReactElement {\n const { handleClick, handleKeyDown } = useAnnotationHandlers(\n annotation,\n onClick,\n );\n\n const style = useMemo(\n () => computeRectStyle(annotation.rect, transform, undefined),\n [annotation, transform],\n );\n\n const renderProps = useMemo(\n () => ({ annotation, scale, pageHeight, transform }),\n [annotation, scale, pageHeight, transform],\n );\n\n return (\n <div\n className={styles.annotation}\n style={style}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n role=\"button\"\n tabIndex={0}\n title={annotation.label}\n data-annotation-id={annotation.id}\n >\n {annotation.render(renderProps)}\n </div>\n );\n}\n\nexport function PdfViewerAnnotationLayer({\n annotations,\n pageHeight,\n scale,\n transform,\n onAnnotationClick,\n}: PdfViewerAnnotationLayerProps): React.ReactElement {\n return (\n <div className={styles.annotationLayer}>\n {annotations.map((annotation) =>\n annotation.type === \"custom\"\n ? (\n <CustomAnnotationItem\n key={annotation.id}\n annotation={annotation}\n pageHeight={pageHeight}\n scale={scale}\n transform={transform}\n onClick={onAnnotationClick}\n />\n )\n : (\n <AnnotationItem\n key={annotation.id}\n annotation={annotation}\n transform={transform}\n onClick={onAnnotationClick}\n />\n )\n )}\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAEnD,OAAOC,MAAM,MAAM,uCAAuC;AAsB1D,SAASC,cAAcA,CACrBC,KAAgC,EAChCC,CAAoB,EACF;EAClB,OAAO,CACLA,CAAC,CAAC,CAAC,CAAC,GAAGD,KAAK,CAAC,CAAC,CAAC,GAAGC,CAAC,CAAC,CAAC,CAAC,GAAGD,KAAK,CAAC,CAAC,CAAC,GAAGC,CAAC,CAAC,CAAC,CAAC,EACxCA,CAAC,CAAC,CAAC,CAAC,GAAGD,KAAK,CAAC,CAAC,CAAC,GAAGC,CAAC,CAAC,CAAC,CAAC,GAAGD,KAAK,CAAC,CAAC,CAAC,GAAGC,CAAC,CAAC,CAAC,CAAC,CACzC;AACH;;AAEA;AACA,SAASC,gBAAgBA,CACvBC,IAAa,EACbC,SAA4B,EAC5BC,KAAyB,EACJ;EACrB,M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GACpCF,WAAW,CAACT,GAAG,CAAEvB,UAAU,IAC1BA,UAAU,CAACS,IAAI,KAAK,QAAQ,gBAExBlC,KAAA,CAAAwC,aAAA,CAACU,oBAAoB;IACnBpB,GAAG,EAAEL,UAAU,CAACsB,EAAG;IACnBtB,UAAU,EAAEA,UAAW;IACvB0B,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAEA,KAAM;IACb3C,SAAS,EAAEA,SAAU;IACrBiB,OAAO,EAAEgC;EAAkB,CAC5B,CAAC,gBAGF1D,KAAA,CAAAwC,aAAA,CAACR,cAAc;IACbF,GAAG,EAAEL,UAAU,CAACsB,EAAG;IACnBtB,UAAU,EAAEA,UAAW;IACvBhB,SAAS,EAAEA,SAAU;IACrBiB,OAAO,EAAEgC;EAAkB,CAC5B,CAEP,CACG,CAAC;AAEV","ignoreList":[]}
@@ -18,13 +18,12 @@ import { Error as ErrorIcon, Spin } from "@blueprintjs/icons";
18
18
  import classnames from "classnames";
19
19
  import "pdfjs-dist/web/pdf_viewer.css";
20
20
  import React, { useEffect, useRef } from "react";
21
- import { createPortal } from "react-dom";
22
21
  import { EMPTY_ANNOTATION_ARRAY } from "../constants.js";
23
22
  import { usePdfAnnotationsByPage } from "../hooks/usePdfAnnotationsByPage.js";
24
23
  import { usePdfFormFields } from "../hooks/usePdfFormFields.js";
25
24
  import { usePdfViewerCore } from "../hooks/usePdfViewerCore.js";
26
25
  import styles from "../PdfViewer.module.css";
27
- import { PdfViewerAnnotationLayer } from "./PdfViewerAnnotationLayer.js";
26
+ import { PdfAnnotationOverlay } from "./PdfAnnotationOverlay.js";
28
27
  export function PdfViewerContent({
29
28
  src,
30
29
  annotations = EMPTY_ANNOTATION_ARRAY,
@@ -113,13 +112,12 @@ export function PdfViewerContent({
113
112
  if (pageAnnotations.length === 0) {
114
113
  return null;
115
114
  }
116
- return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(PdfViewerAnnotationLayer, {
115
+ return /*#__PURE__*/React.createElement(PdfAnnotationOverlay, {
117
116
  key: target.pageNumber,
117
+ target: target,
118
118
  annotations: pageAnnotations,
119
- pageHeight: target.pageHeight,
120
- scale: target.scale,
121
119
  onAnnotationClick: onAnnotationClick
122
- }), target.container);
120
+ });
123
121
  }))));
124
122
  }
125
123
  //# sourceMappingURL=PdfViewerContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PdfViewerContent.js","names":["Error","ErrorIcon","Spin","classnames","React","useEffect","useRef","createPortal","EMPTY_ANNOTATION_ARRAY","usePdfAnnotationsByPage","usePdfFormFields","usePdfViewerCore","styles","PdfViewerAnnotationLayer","PdfViewerContent","src","annotations","onAnnotationClick","initialPage","initialScale","onPageChange","onPageChangeProp","onScaleChange","onScaleChangeProp","formData","onFormChange","className","viewer","annotationsByPage","pdfViewerRef","eventBusRef","document","onPageChangeRef","current","onScaleChangeRef","isInitialMountRef","currentPage","scale","rootClassName","pdfViewer","loading","createElement","loadingContainer","spinnerIcon","error","errorContainer","errorIcon","message","scrollContainerWrapper","ref","containerRef","scrollContainer","viewerRef","portalTargets","map","target","pageAnnotations","pageNumber","length","key","pageHeight","container"],"sources":["PdfViewerContent.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Error as ErrorIcon, Spin } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport React, { useEffect, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"../constants.js\";\nimport { usePdfAnnotationsByPage } from \"../hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"../hooks/usePdfFormFields.js\";\nimport { usePdfViewerCore } from \"../hooks/usePdfViewerCore.js\";\nimport styles from \"../PdfViewer.module.css\";\nimport type { PdfAnnotation, PdfFormFieldValue } from \"../types.js\";\nimport { PdfViewerAnnotationLayer } from \"./PdfViewerAnnotationLayer.js\";\n\nexport interface PdfViewerContentProps {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /** Callback fired when an annotation is clicked */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /** Callback fired when the current page changes during scrolling */\n onPageChange?: (page: number) => void;\n /** Callback fired when the zoom scale changes */\n onScaleChange?: (scale: number) => void;\n /** Initial form field values keyed by field name. Applied when the document loads. */\n formData?: Record<string, PdfFormFieldValue>;\n /** Callback fired when any form field value changes. */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Additional CSS class name for the root element */\n className?: string;\n}\n\nexport function PdfViewerContent({\n src,\n annotations = EMPTY_ANNOTATION_ARRAY,\n onAnnotationClick,\n initialPage = 1,\n initialScale = 1.0,\n onPageChange: onPageChangeProp,\n onScaleChange: onScaleChangeProp,\n formData,\n onFormChange,\n className,\n}: PdfViewerContentProps): React.ReactElement {\n const viewer = usePdfViewerCore({ src, initialPage, initialScale });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n\n usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData,\n onFormChange,\n });\n\n // Use refs for callbacks to avoid firing on initial mount\n const onPageChangeRef = useRef(onPageChangeProp);\n onPageChangeRef.current = onPageChangeProp;\n const onScaleChangeRef = useRef(onScaleChangeProp);\n onScaleChangeRef.current = onScaleChangeProp;\n const isInitialMountRef = useRef(true);\n\n useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n\n const rootClassName = classnames(styles.pdfViewer, className);\n\n if (viewer.loading) {\n return (\n <div className={rootClassName}>\n <div className={styles.loadingContainer}>\n <Spin className={styles.spinnerIcon} />\n Loading…\n </div>\n </div>\n );\n }\n\n if (viewer.error != null) {\n return (\n <div className={rootClassName}>\n <div className={styles.errorContainer}>\n <ErrorIcon className={styles.errorIcon} />\n Failed to load PDF: {viewer.error.message}\n </div>\n </div>\n );\n }\n\n if (viewer.document == null) {\n return (\n <div className={rootClassName}>\n <div className={styles.loadingContainer}>No document</div>\n </div>\n );\n }\n\n return (\n <div className={rootClassName}>\n <div className={styles.scrollContainerWrapper}>\n <div ref={viewer.containerRef} className={styles.scrollContainer}>\n <div ref={viewer.viewerRef} className=\"pdfViewer\" />\n {viewer.portalTargets.map((target) => {\n const pageAnnotations = annotationsByPage[target.pageNumber]\n ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return createPortal(\n <PdfViewerAnnotationLayer\n key={target.pageNumber}\n annotations={pageAnnotations}\n pageHeight={target.pageHeight}\n scale={target.scale}\n onAnnotationClick={onAnnotationClick}\n />,\n target.container,\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,IAAIC,SAAS,EAAEC,IAAI,QAAQ,oBAAoB;AAC7D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAO,+BAA+B;AACtC,OAAOC,KAAK,IAAIC,SA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,aAAA;MAAKf,SAAS,EAAEd,MAAM,CAAC8B;IAAiB,GAAC,aAAgB,CACtD,CAAC;EAEV;EAEA,oBACEtC,KAAA,CAAAqC,aAAA;IAAKf,SAAS,EAAEY;EAAc,gBAC5BlC,KAAA,CAAAqC,aAAA;IAAKf,SAAS,EAAEd,MAAM,CAACoC;EAAuB,gBAC5C5C,KAAA,CAAAqC,aAAA;IAAKQ,GAAG,EAAEtB,MAAM,CAACuB,YAAa;IAACxB,SAAS,EAAEd,MAAM,CAACuC;EAAgB,gBAC/D/C,KAAA,CAAAqC,aAAA;IAAKQ,GAAG,EAAEtB,MAAM,CAACyB,SAAU;IAAC1B,SAAS,EAAC;EAAW,CAAE,CAAC,EACnDC,MAAM,CAAC0B,aAAa,CAACC,GAAG,CAAEC,MAAM,IAAK;IACpC,MAAMC,eAAe,GAAG5B,iBAAiB,CAAC2B,MAAM,CAACE,UAAU,CAAC,IACvDjD,sBAAsB;IAC3B,IAAIgD,eAAe,CAACE,MAAM,KAAK,CAAC,EAAE;MAChC,OAAO,IAAI;IACb;IACA,oBAAOnD,YAAY,cACjBH,KAAA,CAAAqC,aAAA,CAAC5B,wBAAwB;MACvB8C,GAAG,EAAEJ,MAAM,CAACE,UAAW;MACvBzC,WAAW,EAAEwC,eAAgB;MAC7BI,UAAU,EAAEL,MAAM,CAACK,UAAW;MAC9BvB,KAAK,EAAEkB,MAAM,CAAClB,KAAM;MACpBpB,iBAAiB,EAAEA;IAAkB,CACtC,CAAC,EACFsC,MAAM,CAACM,SACT,CAAC;EACH,CAAC,CACE,CACF,CACF,CAAC;AAEV","ignoreList":[]}
1
+ {"version":3,"file":"PdfViewerContent.js","names":["Error","ErrorIcon","Spin","classnames","React","useEffect","useRef","EMPTY_ANNOTATION_ARRAY","usePdfAnnotationsByPage","usePdfFormFields","usePdfViewerCore","styles","PdfAnnotationOverlay","PdfViewerContent","src","annotations","onAnnotationClick","initialPage","initialScale","onPageChange","onPageChangeProp","onScaleChange","onScaleChangeProp","formData","onFormChange","className","viewer","annotationsByPage","pdfViewerRef","eventBusRef","document","onPageChangeRef","current","onScaleChangeRef","isInitialMountRef","currentPage","scale","rootClassName","pdfViewer","loading","createElement","loadingContainer","spinnerIcon","error","errorContainer","errorIcon","message","scrollContainerWrapper","ref","containerRef","scrollContainer","viewerRef","portalTargets","map","target","pageAnnotations","pageNumber","length","key"],"sources":["PdfViewerContent.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Error as ErrorIcon, Spin } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport React, { useEffect, useRef } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"../constants.js\";\nimport { usePdfAnnotationsByPage } from \"../hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"../hooks/usePdfFormFields.js\";\nimport { usePdfViewerCore } from \"../hooks/usePdfViewerCore.js\";\nimport styles from \"../PdfViewer.module.css\";\nimport type { PdfAnnotation, PdfFormFieldValue } from \"../types.js\";\nimport { PdfAnnotationOverlay } from \"./PdfAnnotationOverlay.js\";\n\nexport interface PdfViewerContentProps {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /** Callback fired when an annotation is clicked */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /** Callback fired when the current page changes during scrolling */\n onPageChange?: (page: number) => void;\n /** Callback fired when the zoom scale changes */\n onScaleChange?: (scale: number) => void;\n /** Initial form field values keyed by field name. Applied when the document loads. */\n formData?: Record<string, PdfFormFieldValue>;\n /** Callback fired when any form field value changes. */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Additional CSS class name for the root element */\n className?: string;\n}\n\nexport function PdfViewerContent({\n src,\n annotations = EMPTY_ANNOTATION_ARRAY,\n onAnnotationClick,\n initialPage = 1,\n initialScale = 1.0,\n onPageChange: onPageChangeProp,\n onScaleChange: onScaleChangeProp,\n formData,\n onFormChange,\n className,\n}: PdfViewerContentProps): React.ReactElement {\n const viewer = usePdfViewerCore({ src, initialPage, initialScale });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n\n usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData,\n onFormChange,\n });\n\n // Use refs for callbacks to avoid firing on initial mount\n const onPageChangeRef = useRef(onPageChangeProp);\n onPageChangeRef.current = onPageChangeProp;\n const onScaleChangeRef = useRef(onScaleChangeProp);\n onScaleChangeRef.current = onScaleChangeProp;\n const isInitialMountRef = useRef(true);\n\n useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n\n const rootClassName = classnames(styles.pdfViewer, className);\n\n if (viewer.loading) {\n return (\n <div className={rootClassName}>\n <div className={styles.loadingContainer}>\n <Spin className={styles.spinnerIcon} />\n Loading…\n </div>\n </div>\n );\n }\n\n if (viewer.error != null) {\n return (\n <div className={rootClassName}>\n <div className={styles.errorContainer}>\n <ErrorIcon className={styles.errorIcon} />\n Failed to load PDF: {viewer.error.message}\n </div>\n </div>\n );\n }\n\n if (viewer.document == null) {\n return (\n <div className={rootClassName}>\n <div className={styles.loadingContainer}>No document</div>\n </div>\n );\n }\n\n return (\n <div className={rootClassName}>\n <div className={styles.scrollContainerWrapper}>\n <div ref={viewer.containerRef} className={styles.scrollContainer}>\n <div ref={viewer.viewerRef} className=\"pdfViewer\" />\n {viewer.portalTargets.map((target) => {\n const pageAnnotations = annotationsByPage[target.pageNumber]\n ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return (\n <PdfAnnotationOverlay\n key={target.pageNumber}\n target={target}\n annotations={pageAnnotations}\n onAnnotationClick={onAnnotationClick}\n />\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,IAAIC,SAAS,EAAEC,IAAI,QAAQ,oBAAoB;AAC7D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAO,+BAA+B;AACtC,OAAOC,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,sBAAsB,QAAQ,iBAAiB;AACxD,SAASC,uBAAuB,QAAQ,qCAAqC;AAC7E,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,OAAOC,MAAM,MAAM,yBAAyB;AAE5C,SAASC,oBAAoB,QAAQ,2BAA2B;AAyBhE,OAAO,SAASC,gBAAgBA,CAAC;EAC/BC,GAAG;EACHC,WAAW,GAAGR,sBAAsB;EACpCS,iBAAiB;EACjBC,WAAW,GAAG,CAAC;EACfC,YAAY,GAAG,GAAG;EAClBC,YAAY,EAAEC,gBAAgB;EAC9BC,aAAa,EAAEC,iBAAiB;EAChCC,QAAQ;EACRC,YAAY;EACZC;AACqB,CAAC,EAAsB;EAC5C,MAAMC,MAAM,GAAGh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U,CAAC,IACvDjD,sBAAsB;IAC3B,IAAIgD,eAAe,CAACE,MAAM,KAAK,CAAC,EAAE;MAChC,OAAO,IAAI;IACb;IACA,oBACErD,KAAA,CAAAoC,aAAA,CAAC5B,oBAAoB;MACnB8C,GAAG,EAAEJ,MAAM,CAACE,UAAW;MACvBF,MAAM,EAAEA,MAAO;MACfvC,WAAW,EAAEwC,eAAgB;MAC7BvC,iBAAiB,EAAEA;IAAkB,CACtC,CAAC;EAEN,CAAC,CACE,CACF,CACF,CAAC;AAEV","ignoreList":[]}
@@ -24,31 +24,101 @@ export function usePdfAnnotationPortals(pdfViewerRef, eventBusRef, document) {
24
24
  if (eventBus == null || pdfViewer == null) {
25
25
  return;
26
26
  }
27
- const handlePageRendered = evt => {
28
- const pageIndex = evt.pageNumber - 1;
29
- const pageView = pdfViewer.getPageView(pageIndex);
27
+ const measurePage = (pageNumber, containerRect, scrollContainer) => {
28
+ const pageView = pdfViewer.getPageView(pageNumber - 1);
30
29
  if (pageView?.div == null || pageView?.viewport == null) {
30
+ return null;
31
+ }
32
+ const div = pageView.div;
33
+ const divRect = div.getBoundingClientRect();
34
+ if (divRect.width <= 0 || divRect.height <= 0) {
35
+ return null;
36
+ }
37
+ return {
38
+ pageNumber,
39
+ // Assumes scrollContainer has zero border/padding; otherwise overlays will be offset.
40
+ left: divRect.left - containerRect.left + scrollContainer.scrollLeft,
41
+ top: divRect.top - containerRect.top + scrollContainer.scrollTop,
42
+ width: divRect.width,
43
+ height: divRect.height,
44
+ // viewBox is [xMin, yMin, width, height] and we need the original height before scaling
45
+ pageHeight: pageView.viewport.viewBox[3],
46
+ scale: pageView.viewport.scale,
47
+ transform: pageView.viewport.transform.slice()
48
+ };
49
+ };
50
+ const readContainer = () => {
51
+ const scrollContainer = pdfViewer.container;
52
+ if (scrollContainer == null) {
53
+ return null;
54
+ }
55
+ return {
56
+ rect: scrollContainer.getBoundingClientRect(),
57
+ el: scrollContainer
58
+ };
59
+ };
60
+ const handlePageRendered = evt => {
61
+ const container = readContainer();
62
+ if (container == null) {
31
63
  return;
32
64
  }
33
- const viewport = pageView.viewport;
65
+ const next = measurePage(evt.pageNumber, container.rect, container.el);
34
66
  setPortalTargets(prev => {
35
- // Replace existing entry for this page or add new one
36
67
  const filtered = prev.filter(t => t.pageNumber !== evt.pageNumber);
37
- return [...filtered, {
38
- pageNumber: evt.pageNumber,
39
- container: pageView.div,
40
- pageHeight: viewport.viewBox[3],
41
- // viewBox is [xMin, yMin, width, height] and we need the original height before scaling
42
- scale: viewport.scale
43
- }].sort((a, b) => a.pageNumber - b.pageNumber);
68
+ if (next == null) {
69
+ return filtered;
70
+ }
71
+ return [...filtered, next].sort((a, b) => a.pageNumber - b.pageNumber);
44
72
  });
45
73
  };
74
+ let rafHandle = null;
75
+ const flushRemeasure = () => {
76
+ rafHandle = null;
77
+ setPortalTargets(prev => {
78
+ if (prev.length === 0) {
79
+ return prev;
80
+ }
81
+ const container = readContainer();
82
+ if (container == null) {
83
+ return prev;
84
+ }
85
+ const next = [];
86
+ for (const target of prev) {
87
+ const remeasured = measurePage(target.pageNumber, container.rect, container.el);
88
+ if (remeasured != null) {
89
+ next.push(remeasured);
90
+ }
91
+ }
92
+ return next;
93
+ });
94
+ };
95
+ const remeasureAll = () => {
96
+ if (rafHandle != null) {
97
+ return;
98
+ }
99
+ rafHandle = requestAnimationFrame(flushRemeasure);
100
+ };
46
101
  eventBus.on(PAGE_RENDERED_EVENT, handlePageRendered);
102
+ eventBus.on("scalechanging", remeasureAll);
103
+ eventBus.on("rotationchanging", remeasureAll);
104
+ const scrollContainer = pdfViewer.container;
105
+ let containerObserver;
106
+ if (scrollContainer != null && typeof ResizeObserver !== "undefined") {
107
+ containerObserver = new ResizeObserver(remeasureAll);
108
+ containerObserver.observe(scrollContainer);
109
+ }
47
110
  return () => {
48
111
  eventBus.off(PAGE_RENDERED_EVENT, handlePageRendered);
112
+ eventBus.off("scalechanging", remeasureAll);
113
+ eventBus.off("rotationchanging", remeasureAll);
114
+ containerObserver?.disconnect();
115
+ if (rafHandle != null) {
116
+ cancelAnimationFrame(rafHandle);
117
+ rafHandle = null;
118
+ }
49
119
  setPortalTargets([]);
50
120
  };
51
- }, [eventBusRef, pdfViewerRef, document]);
121
+ }, [document]);
52
122
  return portalTargets;
53
123
  }
54
124
  //# sourceMappingURL=usePdfAnnotationPortals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"usePdfAnnotationPortals.js","names":["useEffect","useState","PAGE_RENDERED_EVENT","usePdfAnnotationPortals","pdfViewerRef","eventBusRef","document","portalTargets","setPortalTargets","eventBus","current","pdfViewer","handlePageRendered","evt","pageIndex","pageNumber","pageView","getPageView","div","viewport","prev","filtered","filter","t","container","pageHeight","viewBox","scale","sort","a","b","on","off"],"sources":["usePdfAnnotationPortals.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PDFDocumentProxy } from \"pdfjs-dist\";\nimport type { EventBus, PDFViewer } from \"pdfjs-dist/web/pdf_viewer.mjs\";\nimport type { RefObject } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { PAGE_RENDERED_EVENT } from \"../constants.js\";\n\nexport interface AnnotationPortalTarget {\n pageNumber: number;\n container: HTMLDivElement;\n pageHeight: number;\n scale: number;\n}\n\nexport function usePdfAnnotationPortals(\n pdfViewerRef: RefObject<PDFViewer | null>,\n eventBusRef: RefObject<EventBus | null>,\n document: PDFDocumentProxy | undefined,\n): AnnotationPortalTarget[] {\n const [portalTargets, setPortalTargets] = useState<AnnotationPortalTarget[]>(\n [],\n );\n\n useEffect(function subscribePageRendered() {\n const eventBus = eventBusRef.current;\n const pdfViewer = pdfViewerRef.current;\n if (eventBus == null || pdfViewer == null) {\n return;\n }\n\n const handlePageRendered = (evt: { pageNumber: number }) => {\n const pageIndex = evt.pageNumber - 1;\n const pageView = pdfViewer.getPageView(pageIndex);\n if (pageView?.div == null || pageView?.viewport == null) {\n return;\n }\n\n const viewport = pageView.viewport;\n\n setPortalTargets((prev) => {\n // Replace existing entry for this page or add new one\n const filtered = prev.filter((t) => t.pageNumber !== evt.pageNumber);\n return [...filtered, {\n pageNumber: evt.pageNumber,\n container: pageView.div as HTMLDivElement,\n pageHeight: viewport.viewBox[3], // viewBox is [xMin, yMin, width, height] and we need the original height before scaling\n scale: viewport.scale,\n }].sort((a, b) => a.pageNumber - b.pageNumber);\n });\n };\n\n eventBus.on(PAGE_RENDERED_EVENT, handlePageRendered);\n\n return () => {\n eventBus.off(PAGE_RENDERED_EVENT, handlePageRendered);\n setPortalTargets([]);\n };\n }, [eventBusRef, pdfViewerRef, document]);\n\n return portalTargets;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,mBAAmB,QAAQ,iBAAiB;AASrD,OAAO,SAASC,uBAAuBA,CACrCC,YAAyC,EACzCC,WAAuC,EACvCC,QAAsC,EACZ;EAC1B,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGP,QAAQ,CAChD,EACF,CAAC;EAEDD,SAAS,CAAC,YAAiC;IACzC,MAAMS,QAAQ,GAAGJ,WAAW,CAACK,OAAO;IACpC,MAAMC,SAAS,GAAGP,YAAY,CAACM,OAAO;IACtC,IAAID,QAAQ,IAAI,IAAI,IAAIE,SAAS,IAAI,IAAI,EAAE;MACzC;IACF;IAEA,MAAMC,kBAAkB,GAAIC,GAA2B,IAAK;MAC1D,MAAMC,SAAS,GAAGD,GAAG,CAACE,UAAU,GAAG,CAAC;MACpC,MAAMC,QAAQ,GAAGL,SAAS,CAACM,WAAW,CAACH,SAAS,CAAC;MACjD,IAAIE,QAAQ,EAAEE,GAAG,IAAI,IAAI,IAAIF,QAAQ,EAAEG,QAAQ,IAAI,IAAI,EAAE;QACvD;MACF;MAEA,MAAMA,QAAQ,GAAGH,QAAQ,CAACG,QAAQ;MAElCX,gBAAgB,CAAEY,IAAI,IAAK;QACzB;QACA,MAAMC,QAAQ,GAAGD,IAAI,CAACE,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACR,UAAU,KAAKF,GAAG,CAACE,UAAU,CAAC;QACpE,OAAO,CAAC,GAAGM,QAAQ,EAAE;UACnBN,UAAU,EAAEF,GAAG,CAACE,UAAU;UAC1BS,SAAS,EAAER,QAAQ,CAACE,GAAqB;UACzCO,UAAU,EAAEN,QAAQ,CAACO,OAAO,CAAC,CAAC,CAAC;UAAE;UACjCC,KAAK,EAAER,QAAQ,CAACQ;QAClB,CAAC,CAAC,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACd,UAAU,GAAGe,CAAC,CAACf,UAAU,CAAC;MAChD,CAAC,CAAC;IACJ,CAAC;IAEDN,QAAQ,CAACsB,EAAE,CAAC7B,mBAAmB,EAAEU,kBAAkB,CAAC;IAEpD,OAAO,MAAM;MACXH,QAAQ,CAACuB,GAAG,CAAC9B,mBAAmB,EAAEU,kBAAkB,CAAC;MACrDJ,gBAAgB,CAAC,EAAE,CAAC;IACtB,CAAC;EACH,CAAC,EAAE,CAACH,WAAW,EAAED,YAAY,EAAEE,QAAQ,CAAC,CAAC;EAEzC,OAAOC,aAAa;AACtB","ignoreList":[]}
1
+ {"version":3,"file":"usePdfAnnotationPortals.js","names":["useEffect","useState","PAGE_RENDERED_EVENT","usePdfAnnotationPortals","pdfViewerRef","eventBusRef","document","portalTargets","setPortalTargets","eventBus","current","pdfViewer","measurePage","pageNumber","containerRect","scrollContainer","pageView","getPageView","div","viewport","divRect","getBoundingClientRect","width","height","left","scrollLeft","top","scrollTop","pageHeight","viewBox","scale","transform","slice","readContainer","container","rect","el","handlePageRendered","evt","next","prev","filtered","filter","t","sort","a","b","rafHandle","flushRemeasure","length","target","remeasured","push","remeasureAll","requestAnimationFrame","on","containerObserver","ResizeObserver","observe","off","disconnect","cancelAnimationFrame"],"sources":["usePdfAnnotationPortals.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PDFDocumentProxy } from \"pdfjs-dist\";\nimport type { EventBus, PDFViewer } from \"pdfjs-dist/web/pdf_viewer.mjs\";\nimport type { RefObject } from \"react\";\nimport { useEffect, useState } from \"react\";\nimport { PAGE_RENDERED_EVENT } from \"../constants.js\";\n\nexport interface AnnotationPortalTarget {\n pageNumber: number;\n left: number;\n top: number;\n width: number;\n height: number;\n pageHeight: number;\n scale: number;\n transform: number[];\n}\n\nexport function usePdfAnnotationPortals(\n pdfViewerRef: RefObject<PDFViewer | null>,\n eventBusRef: RefObject<EventBus | null>,\n document: PDFDocumentProxy | undefined,\n): AnnotationPortalTarget[] {\n const [portalTargets, setPortalTargets] = useState<AnnotationPortalTarget[]>(\n [],\n );\n\n useEffect(function subscribePageEvents() {\n const eventBus = eventBusRef.current;\n const pdfViewer = pdfViewerRef.current;\n if (eventBus == null || pdfViewer == null) {\n return;\n }\n\n const measurePage = (\n pageNumber: number,\n containerRect: DOMRect,\n scrollContainer: HTMLElement,\n ): AnnotationPortalTarget | null => {\n const pageView = pdfViewer.getPageView(pageNumber - 1);\n if (pageView?.div == null || pageView?.viewport == null) {\n return null;\n }\n const div = pageView.div as HTMLDivElement;\n const divRect = div.getBoundingClientRect();\n if (divRect.width <= 0 || divRect.height <= 0) {\n return null;\n }\n return {\n pageNumber,\n // Assumes scrollContainer has zero border/padding; otherwise overlays will be offset.\n left: divRect.left - containerRect.left + scrollContainer.scrollLeft,\n top: divRect.top - containerRect.top + scrollContainer.scrollTop,\n width: divRect.width,\n height: divRect.height,\n // viewBox is [xMin, yMin, width, height] and we need the original height before scaling\n pageHeight: pageView.viewport.viewBox[3],\n scale: pageView.viewport.scale,\n transform: pageView.viewport.transform.slice(),\n };\n };\n\n const readContainer = (): {\n rect: DOMRect;\n el: HTMLElement;\n } | null => {\n const scrollContainer = pdfViewer.container as HTMLElement | null;\n if (scrollContainer == null) {\n return null;\n }\n return {\n rect: scrollContainer.getBoundingClientRect(),\n el: scrollContainer,\n };\n };\n\n const handlePageRendered = (evt: { pageNumber: number }) => {\n const container = readContainer();\n if (container == null) {\n return;\n }\n const next = measurePage(evt.pageNumber, container.rect, container.el);\n setPortalTargets((prev) => {\n const filtered = prev.filter((t) => t.pageNumber !== evt.pageNumber);\n if (next == null) {\n return filtered;\n }\n return [...filtered, next].sort((a, b) => a.pageNumber - b.pageNumber);\n });\n };\n\n let rafHandle: number | null = null;\n const flushRemeasure = () => {\n rafHandle = null;\n setPortalTargets((prev) => {\n if (prev.length === 0) {\n return prev;\n }\n const container = readContainer();\n if (container == null) {\n return prev;\n }\n const next: AnnotationPortalTarget[] = [];\n for (const target of prev) {\n const remeasured = measurePage(\n target.pageNumber,\n container.rect,\n container.el,\n );\n if (remeasured != null) {\n next.push(remeasured);\n }\n }\n return next;\n });\n };\n const remeasureAll = () => {\n if (rafHandle != null) {\n return;\n }\n rafHandle = requestAnimationFrame(flushRemeasure);\n };\n\n eventBus.on(PAGE_RENDERED_EVENT, handlePageRendered);\n eventBus.on(\"scalechanging\", remeasureAll);\n eventBus.on(\"rotationchanging\", remeasureAll);\n\n const scrollContainer = pdfViewer.container as HTMLElement | null;\n let containerObserver: ResizeObserver | undefined;\n if (scrollContainer != null && typeof ResizeObserver !== \"undefined\") {\n containerObserver = new ResizeObserver(remeasureAll);\n containerObserver.observe(scrollContainer);\n }\n\n return () => {\n eventBus.off(PAGE_RENDERED_EVENT, handlePageRendered);\n eventBus.off(\"scalechanging\", remeasureAll);\n eventBus.off(\"rotationchanging\", remeasureAll);\n containerObserver?.disconnect();\n if (rafHandle != null) {\n cancelAnimationFrame(rafHandle);\n rafHandle = null;\n }\n setPortalTargets([]);\n };\n }, [document]);\n\n return portalTargets;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,mBAAmB,QAAQ,iBAAiB;AAarD,OAAO,SAASC,uBAAuBA,CACrCC,YAAyC,EACzCC,WAAuC,EACvCC,QAAsC,EACZ;EAC1B,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGP,QAAQ,CAChD,EACF,CAAC;EAEDD,SAAS,CAAC,YAA+B;IACvC,MAAMS,QAAQ,GAAGJ,WAAW,CAACK,OAAO;IACpC,MAAMC,SAAS,GAAGP,YAAY,CAACM,OAAO;IACtC,IAAID,QAAQ,IAAI,IAAI,IAAIE,SAAS,IAAI,IAAI,EAAE;MACzC;IACF;IAEA,MAAMC,WAAW,GAAGA,CAClBC,UAAkB,EAClBC,aAAsB,EACtBC,eAA4B,KACM;MAClC,MAAMC,QAAQ,GAAGL,SAAS,CAACM,WAAW,CAACJ,UAAU,GAAG,CAAC,CAAC;MACtD,IAAIG,QAAQ,EAAEE,GAAG,IAAI,IAAI,IAAIF,QAAQ,EAAEG,QAAQ,IAAI,IAAI,EAAE;QACvD,OAAO,IAAI;MACb;MACA,MAAMD,GAAG,GAAGF,QAAQ,CAACE,GAAqB;MA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AQ,CAAC8C,EAAE,CAAC,eAAe,EAAEF,YAAY,CAAC;IAC1C5C,QAAQ,CAAC8C,EAAE,CAAC,kBAAkB,EAAEF,YAAY,CAAC;IAE7C,MAAMtC,eAAe,GAAGJ,SAAS,CAACuB,SAA+B;IACjE,IAAIsB,iBAA6C;IACjD,IAAIzC,eAAe,IAAI,IAAI,IAAI,OAAO0C,cAAc,KAAK,WAAW,EAAE;MACpED,iBAAiB,GAAG,IAAIC,cAAc,CAACJ,YAAY,CAAC;MACpDG,iBAAiB,CAACE,OAAO,CAAC3C,eAAe,CAAC;IAC5C;IAEA,OAAO,MAAM;MACXN,QAAQ,CAACkD,GAAG,CAACzD,mBAAmB,EAAEmC,kBAAkB,CAAC;MACrD5B,QAAQ,CAACkD,GAAG,CAAC,eAAe,EAAEN,YAAY,CAAC;MAC3C5C,QAAQ,CAACkD,GAAG,CAAC,kBAAkB,EAAEN,YAAY,CAAC;MAC9CG,iBAAiB,EAAEI,UAAU,CAAC,CAAC;MAC/B,IAAIb,SAAS,IAAI,IAAI,EAAE;QACrBc,oBAAoB,CAACd,SAAS,CAAC;QAC/BA,SAAS,GAAG,IAAI;MAClB;MACAvC,gBAAgB,CAAC,EAAE,CAAC;IACtB,CAAC;EACH,CAAC,EAAE,CAACF,QAAQ,CAAC,CAAC;EAEd,OAAOC,aAAa;AACtB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type React from \"react\";\n\n/** Which sidebar panel to display when the sidebar is open. */\nexport type SidebarMode = \"thumbnails\" | \"outline\";\n\n/** A single item in the PDF document outline (table of contents). */\nexport interface OutlineItem {\n title: string;\n depth: number;\n pageNumber: number;\n bold: boolean;\n italic: boolean;\n}\n\n/** The visual style of an annotation rendered on the PDF. */\nexport type AnnotationType =\n | \"highlight\"\n | \"underline\"\n | \"comment\"\n | \"pin\"\n | \"custom\";\n\n/** A rectangle in PDF coordinate space (origin: bottom-left of page). */\nexport interface PdfRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Props passed to a custom annotation renderer. */\nexport interface PdfAnnotationRenderProps {\n annotation: PdfAnnotation;\n scale: number;\n pageHeight: number;\n}\n\n/** Common fields shared by all annotation types. */\ninterface PdfAnnotationBase {\n /** Unique identifier for this annotation */\n id: string;\n /** Page number (1-indexed) */\n page: number;\n /** Coordinates in PDF points (origin: bottom-left of page) */\n rect: PdfRect;\n /** Additional rects for multi-line text highlights. When present, all rects are rendered. */\n rects?: PdfRect[];\n /** Optional label or tooltip text */\n label?: string;\n /** Optional color override (CSS color string) */\n color?: string;\n}\n\n/** A built-in annotation type (highlight, underline, comment, pin). */\ninterface PdfStandardAnnotation extends PdfAnnotationBase {\n /** The type of annotation to render */\n type: \"highlight\" | \"underline\" | \"comment\" | \"pin\";\n}\n\n/** A custom annotation with a user-provided renderer. */\nexport interface PdfCustomAnnotation extends PdfAnnotationBase {\n /** Must be \"custom\" for custom-rendered annotations */\n type: \"custom\";\n /** Render function for the custom annotation content (required for custom type) */\n render: (props: PdfAnnotationRenderProps) => React.ReactNode;\n}\n\n/** A single annotation positioned on a specific page of the PDF. */\nexport type PdfAnnotation = PdfStandardAnnotation | PdfCustomAnnotation;\n\n/** Result passed to the {@link PdfViewerProps.onDownload} callback. */\nexport type PdfDownloadResult =\n | { success: true; filename: string }\n | { success: false; error: Error };\n\n/** Possible values for a PDF form field. */\nexport type PdfFormFieldValue = string | boolean | string[];\n\n/** Data emitted when the user creates a text highlight via the highlight editor. */\nexport interface PdfTextHighlightEvent {\n /** Internal PDF.js editor ID. Use with `deleteHighlight` to programmatically remove. */\n editorId: string;\n /** Page number (1-indexed) */\n page: number;\n /** Bounding rects in PDF coordinate space (bottom-left origin) */\n rects: PdfRect[];\n /** The selected text content */\n selectedText: string;\n /** Highlight color as CSS color string */\n color: string;\n}\n\n/** Imperative handle for programmatic control of a {@link PdfViewer} or {@link BasePdfViewer}. */\nexport interface PdfViewerHandle {\n /** Scroll the viewer to the given page number (1-indexed). */\n scrollToPage: (page: number) => void;\n /** Programmatically delete a highlight by its `editorId` (from {@link PdfTextHighlightEvent}). */\n deleteHighlight: (editorId: string) => void;\n}\n\n/**\n * Options for {@link usePdfViewerInstance}.\n * Equivalent to {@link PdfViewerProps} minus the `className` rendering concern.\n */\nexport interface PdfViewerInstanceOptions {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /** Callback fired when an annotation is clicked */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /** Callback fired when a download completes or fails */\n onDownload?: (result: PdfDownloadResult) => void;\n /** Whether the highlight toggle button is shown in the toolbar */\n highlightEnabled?: boolean;\n /** Callback fired when the user creates a text highlight */\n onTextHighlight?: (event: PdfTextHighlightEvent) => void;\n /** Callback fired when the user deletes a highlight */\n onHighlightDelete?: (event: PdfTextHighlightEvent) => void;\n /** Initial form field values keyed by field name */\n formData?: Record<string, PdfFormFieldValue>;\n /** Callback fired when the user clicks the save button */\n onFormSubmit?: (data: Record<string, PdfFormFieldValue>) => void;\n /** Callback fired when any form field value changes */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /**\n * Whether auto-size (fit to width) is initially enabled.\n * When enabled, the PDF scales to fit the container width and\n * re-fits automatically on resize. Manual zoom disables auto-size.\n * Takes precedence over {@link initialScale} when enabled.\n * @default false\n */\n initialAutoSize?: boolean;\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /** Whether the download button is shown in the toolbar */\n enableDownload?: boolean;\n /** Which sidebar panel to show: thumbnails or document outline */\n sidebarMode?: SidebarMode;\n /** Custom icon components for each outline depth level (0-indexed) */\n outlineIcons?: Partial<Record<number, React.ComponentType>>;\n}\n\n/** Props for the {@link PdfViewer} component. */\nexport interface PdfViewerProps {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /**\n * Callback fired when an annotation is clicked.\n *\n * @param annotation - The annotation that was clicked\n * @returns void\n */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /**\n * Callback fired when a download completes or fails.\n *\n * @param result - The download result indicating success with the filename, or failure with an error\n * @returns void\n */\n onDownload?: (result: PdfDownloadResult) => void;\n /**\n * Whether the highlight toggle button is shown in the toolbar.\n * @default false\n */\n enableHighlight?: boolean;\n /**\n * Callback fired when the user creates a text highlight.\n * Only fires when highlight mode is active.\n *\n * @param event - The highlight event with page, rects, text, and color\n * @returns void\n */\n onTextHighlight?: (event: PdfTextHighlightEvent) => void;\n /**\n * Callback fired when the user deletes a highlight via the PDF.js editor UI.\n *\n * @param event - The highlight event that was deleted\n * @returns void\n */\n onHighlightDelete?: (event: PdfTextHighlightEvent) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /**\n * Whether auto-size (fit to width) is initially enabled.\n * When enabled, the PDF scales to fit the container width and\n * re-fits automatically on resize. Manual zoom disables auto-size.\n * Takes precedence over {@link initialScale} when enabled.\n * @default false\n */\n initialAutoSize?: boolean;\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /**\n * Whether the download button is shown in the toolbar.\n * @default false\n */\n enableDownload?: boolean;\n /**\n * Which sidebar panel to show: thumbnails or document outline.\n * @default \"thumbnails\"\n */\n sidebarMode?: SidebarMode;\n /**\n * Custom icon components for each outline depth level (0-indexed).\n * Key 0 = top-level items, 1 = first nesting level, etc.\n * If omitted, no icons are rendered.\n */\n outlineIcons?: Partial<Record<number, React.ComponentType>>;\n /**\n * Initial form field values keyed by field name. Applied when the document loads.\n * Use this to pre-populate form fields when resuming a previously edited PDF.\n */\n formData?: Record<string, PdfFormFieldValue>;\n /**\n * Callback fired when the user clicks the save button in the toolbar.\n * Receives all current form field values keyed by field name.\n *\n * @param data - All form field values keyed by field name\n * @returns void\n */\n onFormSubmit?: (data: Record<string, PdfFormFieldValue>) => void;\n /**\n * Callback fired when any form field value changes.\n *\n * @param fieldName - The name of the field that changed\n * @param value - The new value\n * @returns void\n */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Additional CSS class name for the root element */\n className?: string;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type React from \"react\";\n\n/** Which sidebar panel to display when the sidebar is open. */\nexport type SidebarMode = \"thumbnails\" | \"outline\";\n\n/** A single item in the PDF document outline (table of contents). */\nexport interface OutlineItem {\n title: string;\n depth: number;\n pageNumber: number;\n bold: boolean;\n italic: boolean;\n}\n\n/** The visual style of an annotation rendered on the PDF. */\nexport type AnnotationType =\n | \"highlight\"\n | \"underline\"\n | \"comment\"\n | \"pin\"\n | \"custom\";\n\n/** A rectangle in PDF coordinate space (origin: bottom-left of page). */\nexport interface PdfRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Props passed to a custom annotation renderer. */\nexport interface PdfAnnotationRenderProps {\n annotation: PdfAnnotation;\n scale: number;\n pageHeight: number;\n transform: number[];\n}\n\n/** Common fields shared by all annotation types. */\ninterface PdfAnnotationBase {\n /** Unique identifier for this annotation */\n id: string;\n /** Page number (1-indexed) */\n page: number;\n /** Coordinates in PDF points (origin: bottom-left of page) */\n rect: PdfRect;\n /** Additional rects for multi-line text highlights. When present, all rects are rendered. */\n rects?: PdfRect[];\n /** Optional label or tooltip text */\n label?: string;\n /** Optional color override (CSS color string) */\n color?: string;\n}\n\n/** A built-in annotation type (highlight, underline, comment, pin). */\ninterface PdfStandardAnnotation extends PdfAnnotationBase {\n /** The type of annotation to render */\n type: \"highlight\" | \"underline\" | \"comment\" | \"pin\";\n}\n\n/** A custom annotation with a user-provided renderer. */\nexport interface PdfCustomAnnotation extends PdfAnnotationBase {\n /** Must be \"custom\" for custom-rendered annotations */\n type: \"custom\";\n /** Render function for the custom annotation content (required for custom type) */\n render: (props: PdfAnnotationRenderProps) => React.ReactNode;\n}\n\n/** A single annotation positioned on a specific page of the PDF. */\nexport type PdfAnnotation = PdfStandardAnnotation | PdfCustomAnnotation;\n\n/** Result passed to the {@link PdfViewerProps.onDownload} callback. */\nexport type PdfDownloadResult =\n | { success: true; filename: string }\n | { success: false; error: Error };\n\n/** Possible values for a PDF form field. */\nexport type PdfFormFieldValue = string | boolean | string[];\n\n/** Data emitted when the user creates a text highlight via the highlight editor. */\nexport interface PdfTextHighlightEvent {\n /** Internal PDF.js editor ID. Use with `deleteHighlight` to programmatically remove. */\n editorId: string;\n /** Page number (1-indexed) */\n page: number;\n /** Bounding rects in PDF coordinate space (bottom-left origin) */\n rects: PdfRect[];\n /** The selected text content */\n selectedText: string;\n /** Highlight color as CSS color string */\n color: string;\n}\n\n/** Imperative handle for programmatic control of a {@link PdfViewer} or {@link BasePdfViewer}. */\nexport interface PdfViewerHandle {\n /** Scroll the viewer to the given page number (1-indexed). */\n scrollToPage: (page: number) => void;\n /** Programmatically delete a highlight by its `editorId` (from {@link PdfTextHighlightEvent}). */\n deleteHighlight: (editorId: string) => void;\n}\n\n/**\n * Options for {@link usePdfViewerInstance}.\n * Equivalent to {@link PdfViewerProps} minus the `className` rendering concern.\n */\nexport interface PdfViewerInstanceOptions {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /** Callback fired when an annotation is clicked */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /** Callback fired when a download completes or fails */\n onDownload?: (result: PdfDownloadResult) => void;\n /** Whether the highlight toggle button is shown in the toolbar */\n highlightEnabled?: boolean;\n /** Callback fired when the user creates a text highlight */\n onTextHighlight?: (event: PdfTextHighlightEvent) => void;\n /** Callback fired when the user deletes a highlight */\n onHighlightDelete?: (event: PdfTextHighlightEvent) => void;\n /** Initial form field values keyed by field name */\n formData?: Record<string, PdfFormFieldValue>;\n /** Callback fired when the user clicks the save button */\n onFormSubmit?: (data: Record<string, PdfFormFieldValue>) => void;\n /** Callback fired when any form field value changes */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /**\n * Whether auto-size (fit to width) is initially enabled.\n * When enabled, the PDF scales to fit the container width and\n * re-fits automatically on resize. Manual zoom disables auto-size.\n * Takes precedence over {@link initialScale} when enabled.\n * @default false\n */\n initialAutoSize?: boolean;\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /** Whether the download button is shown in the toolbar */\n enableDownload?: boolean;\n /** Which sidebar panel to show: thumbnails or document outline */\n sidebarMode?: SidebarMode;\n /** Custom icon components for each outline depth level (0-indexed) */\n outlineIcons?: Partial<Record<number, React.ComponentType>>;\n}\n\n/** Props for the {@link PdfViewer} component. */\nexport interface PdfViewerProps {\n /** PDF source — URL string or ArrayBuffer */\n src: string | ArrayBuffer;\n /** Annotations to overlay on the PDF */\n annotations?: PdfAnnotation[];\n /**\n * Callback fired when an annotation is clicked.\n *\n * @param annotation - The annotation that was clicked\n * @returns void\n */\n onAnnotationClick?: (annotation: PdfAnnotation) => void;\n /**\n * Callback fired when a download completes or fails.\n *\n * @param result - The download result indicating success with the filename, or failure with an error\n * @returns void\n */\n onDownload?: (result: PdfDownloadResult) => void;\n /**\n * Whether the highlight toggle button is shown in the toolbar.\n * @default false\n */\n enableHighlight?: boolean;\n /**\n * Callback fired when the user creates a text highlight.\n * Only fires when highlight mode is active.\n *\n * @param event - The highlight event with page, rects, text, and color\n * @returns void\n */\n onTextHighlight?: (event: PdfTextHighlightEvent) => void;\n /**\n * Callback fired when the user deletes a highlight via the PDF.js editor UI.\n *\n * @param event - The highlight event that was deleted\n * @returns void\n */\n onHighlightDelete?: (event: PdfTextHighlightEvent) => void;\n /** Initial page number (1-indexed, default 1) */\n initialPage?: number;\n /** Initial zoom scale (default 1.0) */\n initialScale?: number;\n /**\n * Whether auto-size (fit to width) is initially enabled.\n * When enabled, the PDF scales to fit the container width and\n * re-fits automatically on resize. Manual zoom disables auto-size.\n * Takes precedence over {@link initialScale} when enabled.\n * @default false\n */\n initialAutoSize?: boolean;\n /** Whether the sidebar is initially open (default false) */\n initialSidebarOpen?: boolean;\n /**\n * Whether the download button is shown in the toolbar.\n * @default false\n */\n enableDownload?: boolean;\n /**\n * Which sidebar panel to show: thumbnails or document outline.\n * @default \"thumbnails\"\n */\n sidebarMode?: SidebarMode;\n /**\n * Custom icon components for each outline depth level (0-indexed).\n * Key 0 = top-level items, 1 = first nesting level, etc.\n * If omitted, no icons are rendered.\n */\n outlineIcons?: Partial<Record<number, React.ComponentType>>;\n /**\n * Initial form field values keyed by field name. Applied when the document loads.\n * Use this to pre-populate form fields when resuming a previously edited PDF.\n */\n formData?: Record<string, PdfFormFieldValue>;\n /**\n * Callback fired when the user clicks the save button in the toolbar.\n * Receives all current form field values keyed by field name.\n *\n * @param data - All form field values keyed by field name\n * @returns void\n */\n onFormSubmit?: (data: Record<string, PdfFormFieldValue>) => void;\n /**\n * Callback fired when any form field value changes.\n *\n * @param fieldName - The name of the field that changed\n * @param value - The new value\n * @returns void\n */\n onFormChange?: (fieldName: string, value: PdfFormFieldValue) => void;\n /** Additional CSS class name for the root element */\n className?: string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -34,6 +34,11 @@
34
34
  /* Match the dismiss layer's dialog stack level so the later positioner stays
35
35
  clickable above it without escalating z-index values. */
36
36
  z-index: var(--osdk-datetime-popover-z-index);
37
+
38
+ /* Hide the popover when its anchor scrolls out of view */
39
+ &[data-anchor-hidden] {
40
+ visibility: hidden;
41
+ }
37
42
  }
38
43
 
39
44
  .osdkDatePickerPopover {
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- const PACKAGE_USER_AGENT = `osdk-react-components/${"0.20.0-main-4e2a115a796e8664c3972548bb02e707baafa912"}`;
17
+ const PACKAGE_USER_AGENT = `osdk-react-components/${"0.20.0"}`;
18
18
  export function componentUserAgent(componentName) {
19
19
  return `${PACKAGE_USER_AGENT}/${componentName}`;
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UserAgent.js","names":["PACKAGE_USER_AGENT","componentUserAgent","componentName"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst PACKAGE_USER_AGENT =\n `osdk-react-components/${process.env.PACKAGE_VERSION}`;\n\nexport function componentUserAgent(componentName: string): string {\n return `${PACKAGE_USER_AGENT}/${componentName}`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,kBAAkB,GACtB,iFAAsD;AAExD,OAAO,SAASC,kBAAkBA,CAACC,aAAqB,EAAU;EAChE,OAAO,GAAGF,kBAAkB,IAAIE,aAAa,EAAE;AACjD","ignoreList":[]}
1
+ {"version":3,"file":"UserAgent.js","names":["PACKAGE_USER_AGENT","componentUserAgent","componentName"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst PACKAGE_USER_AGENT =\n `osdk-react-components/${process.env.PACKAGE_VERSION}`;\n\nexport function componentUserAgent(componentName: string): string {\n return `${PACKAGE_USER_AGENT}/${componentName}`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,kBAAkB,GACtB,mCAAsD;AAExD,OAAO,SAASC,kBAAkBA,CAACC,aAAqB,EAAU;EAChE,OAAO,GAAGF,kBAAkB,IAAIE,aAAa,EAAE;AACjD","ignoreList":[]}
@@ -13,4 +13,4 @@ export declare function ObjectTable<
13
13
  Q extends ObjectOrInterfaceDefinition,
14
14
  RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
15
15
  FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
16
- >({ objectType, objectSet, columnDefinitions, filter, objectSetOptions, dedupeIntervalMs, pageSize, orderBy, defaultOrderBy, onOrderByChanged, onColumnsPinnedChanged, onColumnResize, onRowSelection, onRowSelectionChanged, onColumnHeaderClick, renderCellContextMenu, selectionMode, selectedRows, isAllSelected: isAllSelectedProp, onColumnVisibilityChanged, onCellValueChanged, onSubmitEdits, enableOrdering, enableColumnPinning, enableColumnResizing, enableColumnConfig, editMode,...props }: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement;
16
+ >({ objectType, objectSet, columnDefinitions, filter, objectSetOptions, dedupeIntervalMs, pageSize, streamUpdates, orderBy, defaultOrderBy, onOrderByChanged, onColumnsPinnedChanged, onColumnResize, onRowSelection, onRowSelectionChanged, onColumnHeaderClick, renderCellContextMenu, selectionMode, selectedRows, isAllSelected: isAllSelectedProp, onColumnVisibilityChanged, onCellValueChanged, onSubmitEdits, enableOrdering, enableColumnPinning, enableColumnResizing, enableColumnConfig, editMode,...props }: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement;
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,6BAIA,iBACA,yBAEK,WAAY;AAGnB,OAAO,WAAqC,OAAQ;AAWpD,cAAc,wBAAwB,qBAAsB;;;;;;;;;AAiB5D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,YACA,WACA,mBACA,QACA,kBACA,kBACA,UACA,SACA,gBACA,kBACA,wBACA,gBAEA,gBACA,uBACA,qBACA,uBACA,eACA,cACA,eAAe,mBACf,2BACA,oBACA,eACA,gBACA,qBACA,sBACA,oBACA,SACA,GAAG,OACwC,EAA1C,iBAAiB,GAAG,MAAM,mBAAmB,MAAM","names":[],"sources":["../../../src/object-table/ObjectTable.tsx"],"version":3,"file":"ObjectTable.d.ts"}
1
+ {"mappings":"AAgBA,cACE,6BAIA,iBACA,yBAEK,WAAY;AAGnB,OAAO,WAAqC,OAAQ;AAWpD,cAAc,wBAAwB,qBAAsB;;;;;;;;;AAiB5D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D,EACA,YACA,WACA,mBACA,QACA,kBACA,kBACA,UACA,eACA,SACA,gBACA,kBACA,wBACA,gBAEA,gBACA,uBACA,qBACA,uBACA,eACA,cACA,eAAe,mBACf,2BACA,oBACA,eACA,gBACA,qBACA,sBACA,oBACA,SACA,GAAG,OACwC,EAA1C,iBAAiB,GAAG,MAAM,mBAAmB,MAAM","names":[],"sources":["../../../src/object-table/ObjectTable.tsx"],"version":3,"file":"ObjectTable.d.ts"}
@@ -207,6 +207,19 @@ export interface ObjectTableProps<
207
207
  */
208
208
  dedupeIntervalMs?: number;
209
209
  /**
210
+ * Enable streaming updates via websocket subscription.
211
+ * When true, the table will automatically update when matching
212
+ * objects are added, updated, or removed in Foundry.
213
+ *
214
+ * Limitations: `streamUpdates` cannot be used together with `pivotTo` or
215
+ * `withProperties`. The server does not support websocket subscriptions
216
+ * for link-traversal or derived-property queries. Those queries still
217
+ * fetch data normally but won't receive real-time updates.
218
+ *
219
+ * @default false
220
+ */
221
+ streamUpdates?: boolean;
222
+ /**
210
223
  * Number of objects to fetch per page.
211
224
  *
212
225
  * @default 50
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,qBACA,iBACA,6BACA,WACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,cAAc,0BAA0B,yBAA0B;AAClE,iBAAiB,WAAW,OAAQ;AACpC,cAAc,cAAc,uBAAuB,kBAAmB;AAEtE,cAAc,uBAAuB;AAErC,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAK5D,yBAAyB,GAAG,MAAM,mBAClC,yBAAyB,GAAG,MAAM;UAE5B;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB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O,aACtB,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,sBAElD;;;;;;;;CASR,6BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C;CACD;;;;;;;;CAUH,0BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C,QAAQ,SAAS,UAAU;CAC5B;;;;;;;CASH,kBACEC,UAAU,aAAa,WAAW,aAAa,iBAC/CC;;;;;;CAQF,cACEZ,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;;;CAYlE,uBACEW,UAAU,aAAa,WAAW,aAAa;;;;;;;;;CAWjD,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;CAM9B;;;;;;;;;;;;CAaA,kBACEE,gBAAgB,eAAe,MAC/BC;;;;;;;CASF,yBACEC,QAAQ,mBAAmB,GAAG;;;;CAKhC,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX,yBAAyB,MAAM;;;;;;CAO/B;;;;;CAMA,oBACEjB,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,UAC7D;CAEL;AACD;;;;;;AAOD,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;EACjD;;;;;;;CAOA,cAAc,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;CAStE;;;;;;;;;;;;;;;;CAiBA,WAAW,UAAU,GAAG;AACzB;AAED,iBAAiB,iBACf,UAAU,6BACV;;;;CAIA,QAAQ,UAAU;;;;CAKlB,YAAY,UAAU;;;;CAKtB,WAAW,UAAU;AACtB","names":["object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","value: unknown","objectSet: ObjectSet<Q, RDPs>","cellData?: unknown","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q> | keyof RDPs;\n direction: \"asc\" | \"desc\";\n }>","info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >","edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number | null","selectedRowIds: PrimaryKeyType<Q>[]","isSelectAll?: boolean","change: RowSelectionChange<Q, RDPs>","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
1
+ {"mappings":"AAgBA,cACE,qBACA,iBACA,6BACA,WACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,cAAc,0BAA0B,yBAA0B;AAClE,iBAAiB,WAAW,OAAQ;AACpC,cAAc,cAAc,uBAAuB,kBAAmB;AAEtE,cAAc,uBAAuB;AAErC,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAK5D,yBAAyB,GAAG,MAAM,mBAClC,yBAAyB,GAAG,MAAM;UAE5B;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;CACA,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;CAeA,cACEA,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChE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S,UAAU;CAC5B;;;;;;;CASH,kBACEC,UAAU,aAAa,WAAW,aAAa,iBAC/CC;;;;;;CAQF,cACEZ,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;;;CAYlE,uBACEW,UAAU,aAAa,WAAW,aAAa;;;;;;;;;CAWjD,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;CAM9B;;;;;;;;;;;;CAaA,kBACEE,gBAAgB,eAAe,MAC/BC;;;;;;;CASF,yBACEC,QAAQ,mBAAmB,GAAG;;;;CAKhC,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX,yBAAyB,MAAM;;;;;;CAO/B;;;;;CAMA,oBACEjB,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,UAC7D;CAEL;AACD;;;;;;AAOD,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;EACjD;;;;;;;CAOA,cAAc,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;CAStE;;;;;;;;;;;;;;;;CAiBA,WAAW,UAAU,GAAG;AACzB;AAED,iBAAiB,iBACf,UAAU,6BACV;;;;CAIA,QAAQ,UAAU;;;;CAKlB,YAAY,UAAU;;;;CAKtB,WAAW,UAAU;AACtB","names":["object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","value: unknown","objectSet: ObjectSet<Q, RDPs>","cellData?: unknown","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q> | keyof RDPs;\n direction: \"asc\" | \"desc\";\n }>","info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >","edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number | null","selectedRowIds: PrimaryKeyType<Q>[]","isSelectAll?: boolean","change: RowSelectionChange<Q, RDPs>","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
@@ -16,5 +16,5 @@ export declare function useObjectTableData<
16
16
  Q extends ObjectOrInterfaceDefinition,
17
17
  RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
18
18
  FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<string, never>
19
- >(objectOrInterfaceType: Q, columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>, filter?: WhereClause<Q, RDPs>, sorting?: SortingState, objectSet?: ObjectSet<Q>, objectSetOptions?: ObjectSetOptions<Q>, dedupeIntervalMs?: number, pageSize?: number): UseObjectTableDataResult<Q, RDPs>;
19
+ >(objectOrInterfaceType: Q, columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>, filter?: WhereClause<Q, RDPs>, sorting?: SortingState, objectSet?: ObjectSet<Q>, objectSetOptions?: ObjectSetOptions<Q>, dedupeIntervalMs?: number, pageSize?: number, streamUpdates?: boolean): UseObjectTableDataResult<Q, RDPs>;
20
20
  export {};
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cAEE,6BACA,WAEA,iBACA,mBACA,mBACK,WAAY;AACnB,cAEO,yBAEA,aAAc;AACrB,cAAc,oBAAoB,uBAAwB;AAE1D,cAAc,kBAAkB,wBAAwB,sBAAuB;UAkBrE;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB;UACzC,KAAK,kBAAkB,GAAG,OAAO,gBAAgB,CAAE;;;;;;;AAO7D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,uBAAuB,GACvBC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,mBACpDC,SAAS,YAAY,GAAG,OACxBC,UAAU,cACVC,YAAY,UAAU,IACtBC,mBAAmB,iBAAiB,IACpCC,2BACAC,oBACC,yBAAyB,GAAG","names":["objectOrInterfaceType: Q","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>","filter?: WhereClause<Q, RDPs>","sorting?: SortingState","objectSet?: ObjectSet<Q>","objectSetOptions?: ObjectSetOptions<Q>","dedupeIntervalMs: number","pageSize: number"],"sources":["../../../../src/object-table/hooks/useObjectTableData.ts"],"version":3,"file":"useObjectTableData.d.ts"}
1
+ {"mappings":"AAgBA,cAEE,6BACA,WAEA,iBACA,mBACA,mBACK,WAAY;AACnB,cAEO,yBAEA,aAAc;AACrB,cAAc,oBAAoB,uBAAwB;AAE1D,cAAc,kBAAkB,wBAAwB,sBAAuB;UAkBrE;CACR,UAAU;CACV,aAAa,eAAe,qBAAqB;UACzC,KAAK,kBAAkB,GAAG,OAAO,gBAAgB,CAAE;;;;;;;AAO7D,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CAIjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,uBAAuB,GACvBC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,mBACpDC,SAAS,YAAY,GAAG,OACxBC,UAAU,cACVC,YAAY,UAAU,IACtBC,mBAAmB,iBAAiB,IACpCC,2BACAC,mBACAC,0BACC,yBAAyB,GAAG","names":["objectOrInterfaceType: Q","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>","filter?: WhereClause<Q, RDPs>","sorting?: SortingState","objectSet?: ObjectSet<Q>","objectSetOptions?: ObjectSetOptions<Q>","dedupeIntervalMs: number","pageSize: number","streamUpdates?: boolean"],"sources":["../../../../src/object-table/hooks/useObjectTableData.ts"],"version":3,"file":"useObjectTableData.d.ts"}
@@ -1 +1 @@
1
- {"mappings":"AAkBA,OAAO,+BAAgC;AACvC,OAAO,WAAgD,OAAQ;AAa/D,cAAc,iBAAiB,sBAAsB,YAAa;AAElE,OAAO,cAAMA,eAAe,MAAM,0BAChC,iBAAiB,MAAM,cAAc","names":["BasePdfViewer: React.ForwardRefExoticComponent<\n PdfViewerProps & React.RefAttributes<PdfViewerHandle>\n>"],"sources":["../../../src/pdf-viewer/PdfViewer.tsx"],"version":3,"file":"PdfViewer.d.ts"}
1
+ {"mappings":"AAkBA,OAAO,+BAAgC;AACvC,OAAO,WAAgD,OAAQ;AAY/D,cAAc,iBAAiB,sBAAsB,YAAa;AAElE,OAAO,cAAMA,eAAe,MAAM,0BAChC,iBAAiB,MAAM,cAAc","names":["BasePdfViewer: React.ForwardRefExoticComponent<\n PdfViewerProps & React.RefAttributes<PdfViewerHandle>\n>"],"sources":["../../../src/pdf-viewer/PdfViewer.tsx"],"version":3,"file":"PdfViewer.d.ts"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { AnnotationPortalTarget } from "../hooks/usePdfAnnotationPortals.js";
3
+ import type { PdfAnnotation } from "../types.js";
4
+ export interface PdfAnnotationOverlayProps {
5
+ target: AnnotationPortalTarget;
6
+ annotations: PdfAnnotation[];
7
+ onAnnotationClick?: (annotation: PdfAnnotation) => void;
8
+ }
9
+ export declare const PdfAnnotationOverlay: React.FC<PdfAnnotationOverlayProps>;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,OAAO,WAAwB,OAAQ;AACvC,cAAc,8BAA8B,qCAAsC;AAClF,cAAc,qBAAqB,aAAc;AAGjD,iBAAiB,0BAA0B;CACzC,QAAQ;CACR,aAAa;CACb,qBAAqBA,YAAY;AAClC;AAED,OAAO,cAAMC,sBAAsB,MAAM,GAAG","names":["annotation: PdfAnnotation","PdfAnnotationOverlay: React.FC<PdfAnnotationOverlayProps>"],"sources":["../../../../src/pdf-viewer/components/PdfAnnotationOverlay.tsx"],"version":3,"file":"PdfAnnotationOverlay.d.ts"}
@@ -4,6 +4,7 @@ export interface PdfViewerAnnotationLayerProps {
4
4
  annotations: PdfAnnotation[];
5
5
  pageHeight: number;
6
6
  scale: number;
7
+ transform: number[];
7
8
  onAnnotationClick?: (annotation: PdfAnnotation) => void;
8
9
  }
9
- export declare function PdfViewerAnnotationLayer({ annotations, pageHeight, scale, onAnnotationClick }: PdfViewerAnnotationLayerProps): React.ReactElement;
10
+ export declare function PdfViewerAnnotationLayer({ annotations, pageHeight, scale, transform, onAnnotationClick }: PdfViewerAnnotationLayerProps): React.ReactElement;
@@ -1 +1 @@
1
- {"mappings":"AAiBA,OAAO,WAAqC,OAAQ;AACpD,cAAc,qBAAmD,aAAc;AAG/E,iBAAiB,8BAA8B;CAC7C,aAAa;CACb;CACA;CACA,qBAAqBA,YAAY;AAClC;AA4JD,OAAO,iBAAS,yBAAyB,EACvC,aACA,YACA,OACA,mBAC8B,EAA7B,gCAAgC,MAAM","names":["annotation: PdfAnnotation"],"sources":["../../../../src/pdf-viewer/components/PdfViewerAnnotationLayer.tsx"],"version":3,"file":"PdfViewerAnnotationLayer.d.ts"}
1
+ {"mappings":"AAiBA,OAAO,WAAqC,OAAQ;AACpD,cAAc,qBAAmD,aAAc;AAG/E,iBAAiB,8BAA8B;CAC7C,aAAa;CACb;CACA;CACA;CACA,qBAAqBA,YAAY;AAClC;AAuKD,OAAO,iBAAS,yBAAyB,EACvC,aACA,YACA,OACA,WACA,mBAC8B,EAA7B,gCAAgC,MAAM","names":["annotation: PdfAnnotation"],"sources":["../../../../src/pdf-viewer/components/PdfViewerAnnotationLayer.tsx"],"version":3,"file":"PdfViewerAnnotationLayer.d.ts"}
@@ -1 +1 @@
1
- {"mappings":"AAkBA,OAAO,+BAAgC;AACvC,OAAO,WAAkC,OAAQ;AAOjD,cAAc,eAAe,yBAAyB,aAAc;AAGpE,iBAAiB,sBAAsB;;CAErC,cAAc;;CAEd,cAAc;;CAEd,qBAAqBA,YAAY;;CAEjC;;CAEA;;CAEA,gBAAgBC;;CAEhB,iBAAiBC;;CAEjB,WAAW,eAAe;;CAE1B,gBAAgBC,mBAAmBC,OAAO;;CAE1C;AACD;AAED,OAAO,iBAAS,iBAAiB,EAC/B,KACA,aACA,mBACA,aACA,cACA,cAAc,kBACd,eAAe,mBACf,UACA,cACA,WACsB,EAArB,wBAAwB,MAAM","names":["annotation: PdfAnnotation","page: number","scale: number","fieldName: string","value: PdfFormFieldValue"],"sources":["../../../../src/pdf-viewer/components/PdfViewerContent.tsx"],"version":3,"file":"PdfViewerContent.d.ts"}
1
+ {"mappings":"AAkBA,OAAO,+BAAgC;AACvC,OAAO,WAAkC,OAAQ;AAMjD,cAAc,eAAe,yBAAyB,aAAc;AAGpE,iBAAiB,sBAAsB;;CAErC,cAAc;;CAEd,cAAc;;CAEd,qBAAqBA,YAAY;;CAEjC;;CAEA;;CAEA,gBAAgBC;;CAEhB,iBAAiBC;;CAEjB,WAAW,eAAe;;CAE1B,gBAAgBC,mBAAmBC,OAAO;;CAE1C;AACD;AAED,OAAO,iBAAS,iBAAiB,EAC/B,KACA,aACA,mBACA,aACA,cACA,cAAc,kBACd,eAAe,mBACf,UACA,cACA,WACsB,EAArB,wBAAwB,MAAM","names":["annotation: PdfAnnotation","page: number","scale: number","fieldName: string","value: PdfFormFieldValue"],"sources":["../../../../src/pdf-viewer/components/PdfViewerContent.tsx"],"version":3,"file":"PdfViewerContent.d.ts"}
@@ -3,8 +3,12 @@ import type { EventBus, PDFViewer } from "pdfjs-dist/web/pdf_viewer.mjs";
3
3
  import type { RefObject } from "react";
4
4
  export interface AnnotationPortalTarget {
5
5
  pageNumber: number;
6
- container: HTMLDivElement;
6
+ left: number;
7
+ top: number;
8
+ width: number;
9
+ height: number;
7
10
  pageHeight: number;
8
11
  scale: number;
12
+ transform: number[];
9
13
  }
10
14
  export declare function usePdfAnnotationPortals(pdfViewerRef: RefObject<PDFViewer | null>, eventBusRef: RefObject<EventBus | null>, document: PDFDocumentProxy | undefined): AnnotationPortalTarget[];
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cAAc,wBAAwB,YAAa;AACnD,cAAc,UAAU,iBAAiB,+BAAgC;AACzE,cAAc,iBAAiB,OAAQ;AAIvC,iBAAiB,uBAAuB;CACtC;CACA,WAAW;CACX;CACA;AACD;AAED,OAAO,iBAAS,wBACdA,cAAc,UAAU,mBACxBC,aAAa,UAAU,kBACvBC,UAAU,+BACT","names":["pdfViewerRef: RefObject<PDFViewer | null>","eventBusRef: RefObject<EventBus | null>","document: PDFDocumentProxy | undefined"],"sources":["../../../../src/pdf-viewer/hooks/usePdfAnnotationPortals.ts"],"version":3,"file":"usePdfAnnotationPortals.d.ts"}
1
+ {"mappings":"AAgBA,cAAc,wBAAwB,YAAa;AACnD,cAAc,UAAU,iBAAiB,+BAAgC;AACzE,cAAc,iBAAiB,OAAQ;AAIvC,iBAAiB,uBAAuB;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAED,OAAO,iBAAS,wBACdA,cAAc,UAAU,mBACxBC,aAAa,UAAU,kBACvBC,UAAU,+BACT","names":["pdfViewerRef: RefObject<PDFViewer | null>","eventBusRef: RefObject<EventBus | null>","document: PDFDocumentProxy | undefined"],"sources":["../../../../src/pdf-viewer/hooks/usePdfAnnotationPortals.ts"],"version":3,"file":"usePdfAnnotationPortals.d.ts"}
@@ -23,6 +23,7 @@ export interface PdfAnnotationRenderProps {
23
23
  annotation: PdfAnnotation;
24
24
  scale: number;
25
25
  pageHeight: number;
26
+ transform: number[];
26
27
  }
27
28
  /** Common fields shared by all annotation types. */
28
29
  interface PdfAnnotationBase {
@@ -1 +1 @@
1
- {"mappings":"AAgBA,YAAY,WAAW,OAAQ;;AAG/B,YAAY,cAAc,eAAe;;AAGzC,iBAAiB,YAAY;CAC3B;CACA;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CAMd,eAAe,QAAQ,eAAe,MAAM;;;;;CAK5C,WAAW,eAAe;;;;;;;;CAQ1B,gBAAgBC,MAAM,eAAe;;;;;;;;CAQrC,gBAAgBC,mBAAmBC,OAAO;;CAE1C;AACD","names":["props: PdfAnnotationRenderProps","page: number","editorId: string","annotation: PdfAnnotation","result: PdfDownloadResult","event: PdfTextHighlightEvent","data: Record<string, PdfFormFieldValue>","fieldName: string","value: PdfFormFieldValue"],"sources":["../../../src/pdf-viewer/types.ts"],"version":3,"file":"types.d.ts"}
1
+ {"mappings":"AAgBA,YAAY,WAAW,OAAQ;;AAG/B,YAAY,cAAc,eAAe;;AAGzC,iBAAiB,YAAY;CAC3B;CACA;CACA;CACA;CACA;AACD;;AAGD,YAAY,iBACR,cACA,cACA,YACA,QACA;;AAGJ,iBAAiB,QAAQ;CACvB;CACA;CACA;CACA;AACD;;AAGD,iBAAiB,yBAAyB;CACxC,YAAY;CACZ;CACA;CACA;AACD;;UAGS,kBAAkB;;CAE1B;;CAEA;;CAEA,MAAM;;CAEN,QAAQ;;CAER;;CAEA;AACD;;UAGS,8BAA8B,kBAAkB;;CAExD,MAAM,cAAc,cAAc,YAAY;AAC/C;;AAGD,iBAAiB,4BAA4B,kBAAkB;;CAE7D,MAAM;;CAEN,SAASA,OAAO,6BAA6B,MAAM;AACpD;;AAGD,YAAY,gBAAgB,wBAAwB;;AAGpD,YAAY,oBACR;CAAE,SAAS;CAAM;AAAkB,IACnC;CAAE,SAAS;CAAO,OAAO;AAAO;;AAGpC,YAAY;;AAGZ,iBAAiB,sBAAsB;;CAErC;;CAEA;;CAEA,OAAO;;CAEP;;CAEA;AACD;;AAGD,iBAAiB,gBAAgB;;CAE/B,eAAeC;;CAEf,kBAAkBC;AACnB;;;;;AAMD,iBAAiB,yBAAyB;;CAExC,cAAc;;CAEd,cAAc;;CAEd,qBAAqBC,YAAY;;CAEjC,cAAcC,QAAQ;;CAEtB;;CAEA,mBAAmBC,OAAO;;CAE1B,qBAAqBA,OAAO;;CAE5B,WAAW,eAAe;;CAE1B,gBAAgBC,MAAM,eAAe;;CAErC,gBAAgBC,mBAAmBC,OAAO;;CAE1C;;CAEA;;;;;;;;CAQA;;CAEA;;CAEA;;CAEA,cAAc;;CAEd,eAAe,QAAQ,eAAe,MAAM;AAC7C;;AAGD,iBAAiB,eAAe;;CAE9B,cAAc;;CAEd,cAAc;;;;;;;CAOd,qBAAqBL,YAAY;;;;;;;CAOjC,cAAcC,QAAQ;;;;;CAKtB;;;;;;;;CAQA,mBAAmBC,OAAO;;;;;;;CAO1B,qBAAqBA,OAAO;;CAE5B;;CAEA;;;;;;;;CAQA;;CAEA;;;;;CAKA;;;;;CAKA,cAAc;;;;;;CAMd,eAAe,QAAQ,eAAe,MAAM;;;;;CAK5C,WAAW,eAAe;;;;;;;;CAQ1B,gBAAgBC,MAAM,eAAe;;;;;;;;CAQrC,gBAAgBC,mBAAmBC,OAAO;;CAE1C;AACD","names":["props: PdfAnnotationRenderProps","page: number","editorId: string","annotation: PdfAnnotation","result: PdfDownloadResult","event: PdfTextHighlightEvent","data: Record<string, PdfFormFieldValue>","fieldName: string","value: PdfFormFieldValue"],"sources":["../../../src/pdf-viewer/types.ts"],"version":3,"file":"types.d.ts"}