@osdk/react-components 0.23.0 → 0.23.1-main-ab08d5335fc9da824d25c5d9d05c17c3f059fa33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +17 -17
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/{chunk-CDKWDUSS.cjs → chunk-46DKUUP7.cjs} +4 -4
- package/build/cjs/{chunk-CDKWDUSS.cjs.map → chunk-46DKUUP7.cjs.map} +1 -1
- package/build/cjs/{chunk-WYDFI4D2.cjs → chunk-53LQ33NA.cjs} +4 -4
- package/build/cjs/{chunk-WYDFI4D2.cjs.map → chunk-53LQ33NA.cjs.map} +1 -1
- package/build/cjs/chunk-5CHN75OI.cjs +11 -0
- package/build/cjs/{chunk-KNMWCCZY.cjs.map → chunk-5CHN75OI.cjs.map} +1 -1
- package/build/cjs/chunk-6NN3K3EX.cjs +11 -0
- package/build/cjs/{chunk-F4J3FXNK.cjs.map → chunk-6NN3K3EX.cjs.map} +1 -1
- package/build/cjs/{chunk-MOL6BDEN.cjs → chunk-AX4PH6SH.cjs} +4 -4
- package/build/cjs/{chunk-MOL6BDEN.cjs.map → chunk-AX4PH6SH.cjs.map} +1 -1
- package/build/cjs/chunk-BMYYSXTN.cjs +11 -0
- package/build/cjs/{chunk-JNIYR5HQ.cjs.map → chunk-BMYYSXTN.cjs.map} +1 -1
- package/build/cjs/{chunk-Z6F6MHWG.cjs → chunk-C6WWTQZD.cjs} +4 -4
- package/build/cjs/{chunk-Z6F6MHWG.cjs.map → chunk-C6WWTQZD.cjs.map} +1 -1
- package/build/cjs/{chunk-ZIYQXEEB.cjs → chunk-GZK554U2.cjs} +3 -3
- package/build/cjs/chunk-GZK554U2.cjs.map +1 -0
- package/build/cjs/chunk-K73C4Z73.cjs +11 -0
- package/build/cjs/{chunk-44Q6YNJY.cjs.map → chunk-K73C4Z73.cjs.map} +1 -1
- package/build/cjs/{chunk-UG5QG75Y.cjs → chunk-PJ3LF5CM.cjs} +4 -4
- package/build/cjs/{chunk-UG5QG75Y.cjs.map → chunk-PJ3LF5CM.cjs.map} +1 -1
- package/build/cjs/{chunk-M2B7X4UP.cjs → chunk-SRUSRME4.cjs} +4 -4
- package/build/cjs/{chunk-M2B7X4UP.cjs.map → chunk-SRUSRME4.cjs.map} +1 -1
- package/build/cjs/chunk-TR75RVME.cjs +11 -0
- package/build/cjs/{chunk-LXYK5HUR.cjs.map → chunk-TR75RVME.cjs.map} +1 -1
- package/build/cjs/{chunk-NP2OODWG.cjs → chunk-VPM76U6O.cjs} +4 -4
- package/build/cjs/{chunk-NP2OODWG.cjs.map → chunk-VPM76U6O.cjs.map} +1 -1
- package/build/cjs/public/experimental/action-form.cjs +4 -4
- package/build/cjs/public/experimental/document-viewer.cjs +4 -4
- package/build/cjs/public/experimental/email-viewer.cjs +3 -3
- package/build/cjs/public/experimental/excel-viewer.cjs +3 -3
- package/build/cjs/public/experimental/filter-list.cjs +14 -14
- package/build/cjs/public/experimental/image-viewer.cjs +3 -3
- package/build/cjs/public/experimental/markdown-renderer.cjs +3 -3
- package/build/cjs/public/experimental/object-table.cjs +8 -8
- package/build/cjs/public/experimental/pdf-viewer.cjs +7 -7
- package/build/cjs/public/experimental/tiff-renderer.cjs +3 -3
- package/build/cjs/public/experimental/video-viewer.cjs +3 -3
- package/build/cjs/public/experimental/xml-viewer.cjs +3 -3
- package/build/cjs/public/experimental.cjs +47 -47
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/package.json +4 -4
- package/build/cjs/chunk-44Q6YNJY.cjs +0 -11
- package/build/cjs/chunk-F4J3FXNK.cjs +0 -11
- package/build/cjs/chunk-JNIYR5HQ.cjs +0 -11
- package/build/cjs/chunk-KNMWCCZY.cjs +0 -11
- package/build/cjs/chunk-LXYK5HUR.cjs +0 -11
- package/build/cjs/chunk-ZIYQXEEB.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
React components for building Foundry applications. These components are Ontology-aware — pass in OSDK entities, and they handle data loading, caching, and state management automatically.
|
|
6
6
|
|
|
7
|
-
Built on top of [@osdk/react](
|
|
7
|
+
Built on top of [@osdk/react](https://github.com/palantir/osdk-ts/tree/main/packages/react), these components use OSDK hooks internally to provide ready-to-use UI elements. While @osdk/react gives you low-level hooks for data fetching, @osdk/react-components provides UI widgets for common patterns like tables and forms.
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
10
10
|
|
|
@@ -125,18 +125,18 @@ Add `isolation: isolate` to your app's root element. This is required for Base U
|
|
|
125
125
|
|
|
126
126
|
The components that this package will provide are:
|
|
127
127
|
|
|
128
|
-
| Component | Description | Documentation
|
|
129
|
-
| ---------------- | ----------------------------------------------------------------------------------- |
|
|
130
|
-
| `ObjectTable` | Displays an Object Set as a sortable, paginated table with inline editing support | [Guide](
|
|
131
|
-
| `PdfViewer` | Renders PDF documents with annotations, search, sidebar navigation, and zoom | [Guide](
|
|
132
|
-
| `FilterList` | Visualize a high-level summary of objects data to allow users to filter that data. | [Guide](
|
|
133
|
-
| `ActionForm` | Auto-generated form for executing Ontology Actions | [Guide](
|
|
134
|
-
| `DocumentViewer` | Unified media viewer that auto-detects file type and renders the appropriate viewer | [Guide](
|
|
135
|
-
| `EmailViewer` | Parses and renders EML files with headers and sandboxed HTML body | [Guide](
|
|
136
|
-
| `ExcelViewer` | Renders Excel spreadsheets with sheet tabs and column/row headers | [Guide](
|
|
137
|
-
| `ImageViewer` | Renders images (PNG, JPEG, GIF, SVG, WebP, BMP) | [Guide](
|
|
138
|
-
| `VideoViewer` | Renders video with native browser controls | [Guide](
|
|
139
|
-
| `XmlViewer` | Renders XML content with syntax preservation | [Guide](
|
|
128
|
+
| Component | Description | Documentation |
|
|
129
|
+
| ---------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
130
|
+
| `ObjectTable` | Displays an Object Set as a sortable, paginated table with inline editing support | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/ObjectTable.md) |
|
|
131
|
+
| `PdfViewer` | Renders PDF documents with annotations, search, sidebar navigation, and zoom | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/PdfViewer.md) |
|
|
132
|
+
| `FilterList` | Visualize a high-level summary of objects data to allow users to filter that data. | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/FilterList.md) |
|
|
133
|
+
| `ActionForm` | Auto-generated form for executing Ontology Actions | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/ActionForm.md) |
|
|
134
|
+
| `DocumentViewer` | Unified media viewer that auto-detects file type and renders the appropriate viewer | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/DocumentViewer.md) |
|
|
135
|
+
| `EmailViewer` | Parses and renders EML files with headers and sandboxed HTML body | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/EmailViewer.md) |
|
|
136
|
+
| `ExcelViewer` | Renders Excel spreadsheets with sheet tabs and column/row headers | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/ExcelViewer.md) |
|
|
137
|
+
| `ImageViewer` | Renders images (PNG, JPEG, GIF, SVG, WebP, BMP) | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/ImageViewer.md) |
|
|
138
|
+
| `VideoViewer` | Renders video with native browser controls | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/VideoViewer.md) |
|
|
139
|
+
| `XmlViewer` | Renders XML content with syntax preservation | [Guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/XmlViewer.md) |
|
|
140
140
|
|
|
141
141
|
## Component Architecture
|
|
142
142
|
|
|
@@ -168,7 +168,7 @@ For example, the PDF viewer offers three levels of customization:
|
|
|
168
168
|
| Building blocks | `PdfViewerToolbar`, `PdfViewerSidebar`, `PdfViewerContent`, etc. | Custom layout using standard parts |
|
|
169
169
|
| Hooks | `usePdfViewerState` / `usePdfViewerCore` / primitive hooks | Build entirely custom components; hooks do all the heavy lifting |
|
|
170
170
|
|
|
171
|
-
See the [PdfViewer guide](
|
|
171
|
+
See the [PdfViewer guide](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/PdfViewer.md) for the full API reference.
|
|
172
172
|
|
|
173
173
|
### Example: ObjectTable and BaseTable
|
|
174
174
|
|
|
@@ -273,7 +273,7 @@ export const MyComponent: typeof _MyComponent = withOsdkMetrics(
|
|
|
273
273
|
|
|
274
274
|
## Custom Styling
|
|
275
275
|
|
|
276
|
-
See the [CSS Variables Reference](
|
|
276
|
+
See the [CSS Variables Reference](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/docs/CSSVariables.md) on how to apply custom themes and styling to the components.
|
|
277
277
|
|
|
278
278
|
## Example Usage
|
|
279
279
|
|
|
@@ -294,9 +294,9 @@ function EmployeeDirectory() {
|
|
|
294
294
|
|
|
295
295
|
## Contributing
|
|
296
296
|
|
|
297
|
-
Looking to contribute to the codebase? Read the [contribution guidelines](
|
|
297
|
+
Looking to contribute to the codebase? Read the [contribution guidelines](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/CONTRIBUTING.md).
|
|
298
298
|
|
|
299
|
-
If you use [Claude Code](https://claude.com/claude-code), run `/add-new-component` (or just describe the component you want to add) — the [`add-new-component` skill](
|
|
299
|
+
If you use [Claude Code](https://claude.com/claude-code), run `/add-new-component` (or just describe the component you want to add) — the [`add-new-component` skill](https://github.com/palantir/osdk-ts/blob/main/packages/react-components/.claude/skills/add-new-component/SKILL.md) walks you through the API-first PR, MVP checklist, and verification loop on top of `CONTRIBUTING.md`.
|
|
300
300
|
|
|
301
301
|
## Development Workflow
|
|
302
302
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const PACKAGE_USER_AGENT = `osdk-react-components/${"0.23.
|
|
17
|
+
const PACKAGE_USER_AGENT = `osdk-react-components/${"0.23.1-main-ab08d5335fc9da824d25c5d9d05c17c3f059fa33"}`;
|
|
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,
|
|
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":[]}
|
|
@@ -9,7 +9,7 @@ var chunkOUJQJQ7N_cjs = require('./chunk-OUJQJQ7N.cjs');
|
|
|
9
9
|
var chunkPKJFOG2Z_cjs = require('./chunk-PKJFOG2Z.cjs');
|
|
10
10
|
var chunk4VJIPB7R_cjs = require('./chunk-4VJIPB7R.cjs');
|
|
11
11
|
var chunkUCTQICPR_cjs = require('./chunk-UCTQICPR.cjs');
|
|
12
|
-
var
|
|
12
|
+
var chunkGZK554U2_cjs = require('./chunk-GZK554U2.cjs');
|
|
13
13
|
var icons = require('@blueprintjs/icons');
|
|
14
14
|
var classnames = require('classnames');
|
|
15
15
|
var React2 = require('react');
|
|
@@ -310,9 +310,9 @@ function DocumentViewer({
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
// src/public/experimental/document-viewer.ts
|
|
313
|
-
var DocumentViewer2 =
|
|
313
|
+
var DocumentViewer2 = chunkGZK554U2_cjs.withOsdkMetrics(DocumentViewer, "DocumentViewer");
|
|
314
314
|
|
|
315
315
|
exports.DocumentViewer = DocumentViewer2;
|
|
316
316
|
exports.ViewerType = ViewerType;
|
|
317
|
-
//# sourceMappingURL=chunk-
|
|
318
|
-
//# sourceMappingURL=chunk-
|
|
317
|
+
//# sourceMappingURL=chunk-46DKUUP7.cjs.map
|
|
318
|
+
//# sourceMappingURL=chunk-46DKUUP7.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/document-viewer/DocumentViewer.module.css","../../src/document-viewer/DocumentViewerApi.ts","../../src/document-viewer/hooks/useTiffToPdf.ts","../../src/document-viewer/TiffDocumentViewer.tsx","../../src/document-viewer/DocumentViewer.tsx","../../src/public/experimental/document-viewer.ts"],"names":["ViewerType","useOsdkClient","useState","useRef","useEffect","UTIF","__EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait","React","Spin","BasePdfViewer","TiffViewerMedia","_extends","useMemo","classnames","PdfViewer","ImageViewer","VideoViewer","MarkdownViewerMedia","ExcelViewer","EmailViewer","XmlViewer","DocumentIcon","assertUnreachable","DocumentViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,sBAAA,GAAA,EAAA;;;ACgBO,IAAI,UAAA,6BAAoCA,WAAAA,EAAY;AACzD,EAAAA,WAAAA,CAAW,KAAK,CAAA,GAAI,KAAA;AACpB,EAAAA,WAAAA,CAAW,MAAM,CAAA,GAAI,MAAA;AACrB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,UAAU,CAAA,GAAI,UAAA;AACzB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,KAAK,CAAA,GAAI,KAAA;AACpB,EAAAA,WAAAA,CAAW,aAAa,CAAA,GAAI,aAAA;AAC5B,EAAA,OAAOA,WAAAA;AACT,CAAA,EAAE,EAAE;ACJJ,IAAM,eAAA,GAAkB;AAAA,EACtB,YAAY,UAAA,CAAW,IAAA;AAAA,EACvB,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS,KAAA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UAAU,CAAA;AAAA;AAElC;;;ACnIO,IAAMC,eAAAA,GAAiBC,iCAAA,CAAgB,cAAA,EAAiB,gBAAgB","file":"chunk-CDKWDUSS.cjs","sourcesContent":[".container {\n display: flex;\n width: 100%;\n height: 100%;\n background-color: var(--osdk-document-viewer-bg);\n border: var(--osdk-document-viewer-border);\n border-radius: var(--osdk-surface-border-radius);\n overflow: hidden;\n}\n\n.unsupportedContainer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--osdk-surface-spacing);\n width: 100%;\n height: 100%;\n font-family: var(--osdk-typography-family-default);\n font-size: var(--osdk-typography-size-body-medium);\n color: var(--osdk-typography-color-muted);\n}\n\n.unsupportedIcon {\n flex-shrink: 0;\n}\n\n.loadingContainer {\n composes: loadingContainer from \"../shared/LoadingError.module.css\";\n width: 100%;\n}\n\n.spinnerIcon {\n composes: spinnerIcon from \"../shared/LoadingError.module.css\";\n}\n","/*\n * Copyright 2026 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\nexport let ViewerType = /*#__PURE__*/function (ViewerType) {\n ViewerType[\"Pdf\"] = \"pdf\";\n ViewerType[\"Tiff\"] = \"tiff\";\n ViewerType[\"Image\"] = \"image\";\n ViewerType[\"Video\"] = \"video\";\n ViewerType[\"Markdown\"] = \"markdown\";\n ViewerType[\"Excel\"] = \"excel\";\n ViewerType[\"Email\"] = \"email\";\n ViewerType[\"Xml\"] = \"xml\";\n ViewerType[\"Unsupported\"] = \"unsupported\";\n return ViewerType;\n}({});","/*\n * Copyright 2026 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\n/* cspell:words ifds */\n\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait } from \"@osdk/api/unstable\";\nimport { useOsdkClient } from \"@osdk/react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport * as UTIF from \"utif\";\nimport { ViewerType } from \"../DocumentViewerApi.js\";\nconst DISABLED_RESULT = {\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: undefined\n};\n\n/**\n * Detects multi-page TIFFs and converts them to PDF via the MIO transform API.\n * Single-page TIFFs are left for the TiffRenderer to handle.\n *\n * @param media - The OSDK Media object (must be a TIFF)\n * @param enabled - Whether to attempt multi-page detection and conversion\n */\nexport function useTiffToPdf(media, enabled) {\n const client = useOsdkClient();\n const [result, setResult] = useState(DISABLED_RESULT);\n const mediaRef = useRef(media);\n mediaRef.current = media;\n useEffect(() => {\n if (!enabled) {\n setResult(DISABLED_RESULT);\n return;\n }\n let cancelled = false;\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: true,\n error: undefined\n });\n async function detectAndTransform() {\n const currentMedia = mediaRef.current;\n\n // Step 1: Fetch TIFF bytes and count pages\n const response = await currentMedia.fetchContents();\n const buffer = await response.arrayBuffer();\n if (cancelled) return;\n const ifds = UTIF.decode(buffer);\n const pageCount = ifds.length;\n if (pageCount <= 1) {\n // Single-page TIFF — use TiffRenderer\n if (!cancelled) {\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: undefined\n });\n }\n return;\n }\n\n // Step 2: Multi-page TIFF — convert to PDF via MIO transform\n const mediaReference = currentMedia.getMediaReference();\n const pdfResponse = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait).transformAndWait({\n mediaReference,\n transformation: {\n $imageToDocument: {\n $operation: {\n $createPdf: {}\n }\n }\n }\n });\n if (cancelled) return;\n const pdfBuffer = await pdfResponse.arrayBuffer();\n if (!cancelled) {\n setResult({\n viewerType: ViewerType.Pdf,\n pdfData: pdfBuffer,\n loading: false,\n error: undefined\n });\n }\n }\n detectAndTransform().catch(err => {\n if (!cancelled) {\n // eslint-disable-next-line no-console\n console.warn(\"TIFF to PDF conversion failed, falling back to TIFF renderer:\", err);\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: err instanceof Error ? err : new Error(String(err))\n });\n }\n });\n return () => {\n cancelled = true;\n };\n }, [media, enabled, client]);\n return result;\n}","function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n/*\n * Copyright 2026 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 { Spin } from \"@blueprintjs/icons\";\nimport React from \"react\";\nimport { TiffViewerMedia } from \"../images/tiff-renderer/TiffViewerMedia.js\";\nimport { BasePdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nimport styles from \"./DocumentViewer.module.css\";\nimport { ViewerType } from \"./DocumentViewerApi.js\";\nimport { useTiffToPdf } from \"./hooks/useTiffToPdf.js\";\nexport function TiffDocumentViewer({\n media,\n className,\n enableTiffToPdf,\n tiffRendererProps,\n pdfViewerProps\n}) {\n const {\n viewerType,\n pdfData,\n loading\n } = useTiffToPdf(media, enableTiffToPdf);\n if (loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: className\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Converting document\\u2026\"));\n }\n if (viewerType === ViewerType.Pdf && pdfData != null) {\n return /*#__PURE__*/React.createElement(BasePdfViewer, _extends({\n src: pdfData,\n className: className\n }, pdfViewerProps));\n }\n return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({\n media: media,\n className: className\n }, tiffRendererProps));\n}","function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n/*\n * Copyright 2026 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\n/* cspell:words openxmlformats officedocument wordprocessingml spreadsheetml */\n\nimport { Document as DocumentIcon } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport React, { useMemo } from \"react\";\nimport { EmailViewer } from \"../email-viewer/EmailViewer.js\";\nimport { ExcelViewer } from \"../excel-viewer/ExcelViewer.js\";\nimport { ImageViewer } from \"../images/image-viewer/ImageViewer.js\";\nimport { TiffViewerMedia } from \"../images/tiff-renderer/TiffViewerMedia.js\";\nimport { MarkdownViewerMedia } from \"../markdown-renderer/MarkdownViewerMedia.js\";\nimport { PdfViewer } from \"../pdf-viewer/PdfRenderer.js\";\nimport { assertUnreachable } from \"../shared/assertUnreachable.js\";\nimport { VideoViewer } from \"../video-viewer/VideoViewer.js\";\nimport { XmlViewer } from \"../xml-viewer/XmlViewer.js\";\nimport styles from \"./DocumentViewer.module.css\";\nimport { ViewerType } from \"./DocumentViewerApi.js\";\nimport { TiffDocumentViewer } from \"./TiffDocumentViewer.js\";\nconst IMAGE_MIME_TYPES = new Set([\"image/png\", \"image/jpeg\", \"image/gif\", \"image/svg+xml\", \"image/webp\", \"image/bmp\"]);\nconst MARKDOWN_MIME_TYPES = new Set([\"text/markdown\", \"text/x-markdown\"]);\nconst XML_MIME_TYPES = new Set([\"application/xml\", \"text/xml\"]);\nfunction isTiffFile(mimeType, fileName) {\n if (mimeType === \"image/tiff\") {\n return true;\n }\n const lowered = fileName?.toLowerCase();\n return lowered?.endsWith(\".tif\") === true || lowered?.endsWith(\".tiff\") === true;\n}\nfunction getViewerType(mimeType, fileName) {\n if (mimeType === \"application/pdf\") {\n return ViewerType.Pdf;\n }\n if (isTiffFile(mimeType, fileName)) {\n return ViewerType.Tiff;\n }\n if (IMAGE_MIME_TYPES.has(mimeType)) {\n return ViewerType.Image;\n }\n if (mimeType.startsWith(\"video/\")) {\n return ViewerType.Video;\n }\n if (MARKDOWN_MIME_TYPES.has(mimeType)) {\n return ViewerType.Markdown;\n }\n if (mimeType === \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\") {\n return ViewerType.Excel;\n }\n if (mimeType === \"message/rfc822\") {\n return ViewerType.Email;\n }\n if (XML_MIME_TYPES.has(mimeType)) {\n return ViewerType.Xml;\n }\n return ViewerType.Unsupported;\n}\nexport function DocumentViewer({\n media,\n className,\n mimeTypeOverride,\n pdfViewerProps,\n imageViewerProps,\n videoViewerProps,\n tiffRendererProps,\n markdownRendererProps,\n excelViewerProps,\n emailViewerProps,\n xmlViewerProps,\n fileName,\n enableTiffToPdf = false\n}) {\n const mimeType = mimeTypeOverride ?? media.getMediaReference().mimeType;\n const viewerType = useMemo(() => getViewerType(mimeType, fileName), [mimeType, fileName]);\n const rootClassName = classnames(styles.container, className);\n switch (viewerType) {\n case ViewerType.Pdf:\n return /*#__PURE__*/React.createElement(PdfViewer, _extends({\n media: media,\n className: rootClassName\n }, pdfViewerProps));\n case ViewerType.Tiff:\n if (enableTiffToPdf) {\n return /*#__PURE__*/React.createElement(TiffDocumentViewer, {\n media: media,\n className: rootClassName,\n enableTiffToPdf: enableTiffToPdf,\n tiffRendererProps: tiffRendererProps,\n pdfViewerProps: pdfViewerProps\n });\n }\n return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({\n media: media,\n className: rootClassName\n }, tiffRendererProps));\n case ViewerType.Image:\n return /*#__PURE__*/React.createElement(ImageViewer, _extends({\n media: media,\n className: rootClassName\n }, imageViewerProps));\n case ViewerType.Video:\n return /*#__PURE__*/React.createElement(VideoViewer, _extends({\n media: media,\n className: rootClassName\n }, videoViewerProps));\n case ViewerType.Markdown:\n return /*#__PURE__*/React.createElement(MarkdownViewerMedia, _extends({\n media: media,\n className: rootClassName\n }, markdownRendererProps));\n case ViewerType.Excel:\n return /*#__PURE__*/React.createElement(ExcelViewer, _extends({\n media: media,\n className: rootClassName\n }, excelViewerProps));\n case ViewerType.Email:\n return /*#__PURE__*/React.createElement(EmailViewer, _extends({\n media: media,\n className: rootClassName\n }, emailViewerProps));\n case ViewerType.Xml:\n return /*#__PURE__*/React.createElement(XmlViewer, _extends({\n media: media,\n className: rootClassName\n }, xmlViewerProps));\n case ViewerType.Unsupported:\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.unsupportedContainer\n }, /*#__PURE__*/React.createElement(DocumentIcon, {\n className: styles.unsupportedIcon\n }), \"Unsupported file type: \", mimeType));\n default:\n assertUnreachable(viewerType);\n }\n}","/*\n * Copyright 2026 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\n// DocumentViewer\nimport { DocumentViewer as _DocumentViewer } from \"../../document-viewer/DocumentViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const DocumentViewer = withOsdkMetrics(_DocumentViewer, \"DocumentViewer\");\nexport { ViewerType } from \"../../document-viewer/DocumentViewerApi.js\";"]}
|
|
1
|
+
{"version":3,"sources":["../../src/document-viewer/DocumentViewer.module.css","../../src/document-viewer/DocumentViewerApi.ts","../../src/document-viewer/hooks/useTiffToPdf.ts","../../src/document-viewer/TiffDocumentViewer.tsx","../../src/document-viewer/DocumentViewer.tsx","../../src/public/experimental/document-viewer.ts"],"names":["ViewerType","useOsdkClient","useState","useRef","useEffect","UTIF","__EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait","React","Spin","BasePdfViewer","TiffViewerMedia","_extends","useMemo","classnames","PdfViewer","ImageViewer","VideoViewer","MarkdownViewerMedia","ExcelViewer","EmailViewer","XmlViewer","DocumentIcon","assertUnreachable","DocumentViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,sBAAA,GAAA,EAAA;;;ACgBO,IAAI,UAAA,6BAAoCA,WAAAA,EAAY;AACzD,EAAAA,WAAAA,CAAW,KAAK,CAAA,GAAI,KAAA;AACpB,EAAAA,WAAAA,CAAW,MAAM,CAAA,GAAI,MAAA;AACrB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,EAAAA,WAAAA,CAAW,OAAO,CAAA,GAAI,OAAA;AACtB,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Ac,CAAC,CAAA;AAAA,IACpB,KAAK,UAAA,CAAW,WAAA;AACd,MAAA,uBAAoBJ,uBAAAA,CAAM,aAAA,CAAc,KAAA,EAAO;AAAA,QAC7C,SAAA,EAAW;AAAA,OACb,kBAAgBA,uBAAAA,CAAM,aAAA,CAAc,KAAA,EAAO;AAAA,QACzC,WAAW,sBAAA,CAAO;AAAA,OACpB,kBAAgBA,uBAAAA,CAAM,aAAA,CAAcc,cAAA,EAAc;AAAA,QAChD,WAAW,sBAAA,CAAO;AAAA,OACnB,CAAA,EAAG,yBAAA,EAA2B,QAAQ,CAAC,CAAA;AAAA,IAC1C;AACE,MAAAC,mCAAA,CAAkB,UAAU,CAAA;AAAA;AAElC;;;ACnIO,IAAMC,eAAAA,GAAiBC,iCAAA,CAAgB,cAAA,EAAiB,gBAAgB","file":"chunk-46DKUUP7.cjs","sourcesContent":[".container {\n display: flex;\n width: 100%;\n height: 100%;\n background-color: var(--osdk-document-viewer-bg);\n border: var(--osdk-document-viewer-border);\n border-radius: var(--osdk-surface-border-radius);\n overflow: hidden;\n}\n\n.unsupportedContainer {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: var(--osdk-surface-spacing);\n width: 100%;\n height: 100%;\n font-family: var(--osdk-typography-family-default);\n font-size: var(--osdk-typography-size-body-medium);\n color: var(--osdk-typography-color-muted);\n}\n\n.unsupportedIcon {\n flex-shrink: 0;\n}\n\n.loadingContainer {\n composes: loadingContainer from \"../shared/LoadingError.module.css\";\n width: 100%;\n}\n\n.spinnerIcon {\n composes: spinnerIcon from \"../shared/LoadingError.module.css\";\n}\n","/*\n * Copyright 2026 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\nexport let ViewerType = /*#__PURE__*/function (ViewerType) {\n ViewerType[\"Pdf\"] = \"pdf\";\n ViewerType[\"Tiff\"] = \"tiff\";\n ViewerType[\"Image\"] = \"image\";\n ViewerType[\"Video\"] = \"video\";\n ViewerType[\"Markdown\"] = \"markdown\";\n ViewerType[\"Excel\"] = \"excel\";\n ViewerType[\"Email\"] = \"email\";\n ViewerType[\"Xml\"] = \"xml\";\n ViewerType[\"Unsupported\"] = \"unsupported\";\n return ViewerType;\n}({});","/*\n * Copyright 2026 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\n/* cspell:words ifds */\n\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait } from \"@osdk/api/unstable\";\nimport { useOsdkClient } from \"@osdk/react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport * as UTIF from \"utif\";\nimport { ViewerType } from \"../DocumentViewerApi.js\";\nconst DISABLED_RESULT = {\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: undefined\n};\n\n/**\n * Detects multi-page TIFFs and converts them to PDF via the MIO transform API.\n * Single-page TIFFs are left for the TiffRenderer to handle.\n *\n * @param media - The OSDK Media object (must be a TIFF)\n * @param enabled - Whether to attempt multi-page detection and conversion\n */\nexport function useTiffToPdf(media, enabled) {\n const client = useOsdkClient();\n const [result, setResult] = useState(DISABLED_RESULT);\n const mediaRef = useRef(media);\n mediaRef.current = media;\n useEffect(() => {\n if (!enabled) {\n setResult(DISABLED_RESULT);\n return;\n }\n let cancelled = false;\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: true,\n error: undefined\n });\n async function detectAndTransform() {\n const currentMedia = mediaRef.current;\n\n // Step 1: Fetch TIFF bytes and count pages\n const response = await currentMedia.fetchContents();\n const buffer = await response.arrayBuffer();\n if (cancelled) return;\n const ifds = UTIF.decode(buffer);\n const pageCount = ifds.length;\n if (pageCount <= 1) {\n // Single-page TIFF — use TiffRenderer\n if (!cancelled) {\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: undefined\n });\n }\n return;\n }\n\n // Step 2: Multi-page TIFF — convert to PDF via MIO transform\n const mediaReference = currentMedia.getMediaReference();\n const pdfResponse = await client(__EXPERIMENTAL__NOT_SUPPORTED_YET__transformAndWait).transformAndWait({\n mediaReference,\n transformation: {\n $imageToDocument: {\n $operation: {\n $createPdf: {}\n }\n }\n }\n });\n if (cancelled) return;\n const pdfBuffer = await pdfResponse.arrayBuffer();\n if (!cancelled) {\n setResult({\n viewerType: ViewerType.Pdf,\n pdfData: pdfBuffer,\n loading: false,\n error: undefined\n });\n }\n }\n detectAndTransform().catch(err => {\n if (!cancelled) {\n // eslint-disable-next-line no-console\n console.warn(\"TIFF to PDF conversion failed, falling back to TIFF renderer:\", err);\n setResult({\n viewerType: ViewerType.Tiff,\n pdfData: undefined,\n loading: false,\n error: err instanceof Error ? err : new Error(String(err))\n });\n }\n });\n return () => {\n cancelled = true;\n };\n }, [media, enabled, client]);\n return result;\n}","function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n/*\n * Copyright 2026 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 { Spin } from \"@blueprintjs/icons\";\nimport React from \"react\";\nimport { TiffViewerMedia } from \"../images/tiff-renderer/TiffViewerMedia.js\";\nimport { BasePdfViewer } from \"../pdf-viewer/PdfViewer.js\";\nimport styles from \"./DocumentViewer.module.css\";\nimport { ViewerType } from \"./DocumentViewerApi.js\";\nimport { useTiffToPdf } from \"./hooks/useTiffToPdf.js\";\nexport function TiffDocumentViewer({\n media,\n className,\n enableTiffToPdf,\n tiffRendererProps,\n pdfViewerProps\n}) {\n const {\n viewerType,\n pdfData,\n loading\n } = useTiffToPdf(media, enableTiffToPdf);\n if (loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: className\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Converting document\\u2026\"));\n }\n if (viewerType === ViewerType.Pdf && pdfData != null) {\n return /*#__PURE__*/React.createElement(BasePdfViewer, _extends({\n src: pdfData,\n className: className\n }, pdfViewerProps));\n }\n return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({\n media: media,\n className: className\n }, tiffRendererProps));\n}","function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }\n/*\n * Copyright 2026 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\n/* cspell:words openxmlformats officedocument wordprocessingml spreadsheetml */\n\nimport { Document as DocumentIcon } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport React, { useMemo } from \"react\";\nimport { EmailViewer } from \"../email-viewer/EmailViewer.js\";\nimport { ExcelViewer } from \"../excel-viewer/ExcelViewer.js\";\nimport { ImageViewer } from \"../images/image-viewer/ImageViewer.js\";\nimport { TiffViewerMedia } from \"../images/tiff-renderer/TiffViewerMedia.js\";\nimport { MarkdownViewerMedia } from \"../markdown-renderer/MarkdownViewerMedia.js\";\nimport { PdfViewer } from \"../pdf-viewer/PdfRenderer.js\";\nimport { assertUnreachable } from \"../shared/assertUnreachable.js\";\nimport { VideoViewer } from \"../video-viewer/VideoViewer.js\";\nimport { XmlViewer } from \"../xml-viewer/XmlViewer.js\";\nimport styles from \"./DocumentViewer.module.css\";\nimport { ViewerType } from \"./DocumentViewerApi.js\";\nimport { TiffDocumentViewer } from \"./TiffDocumentViewer.js\";\nconst IMAGE_MIME_TYPES = new Set([\"image/png\", \"image/jpeg\", \"image/gif\", \"image/svg+xml\", \"image/webp\", \"image/bmp\"]);\nconst MARKDOWN_MIME_TYPES = new Set([\"text/markdown\", \"text/x-markdown\"]);\nconst XML_MIME_TYPES = new Set([\"application/xml\", \"text/xml\"]);\nfunction isTiffFile(mimeType, fileName) {\n if (mimeType === \"image/tiff\") {\n return true;\n }\n const lowered = fileName?.toLowerCase();\n return lowered?.endsWith(\".tif\") === true || lowered?.endsWith(\".tiff\") === true;\n}\nfunction getViewerType(mimeType, fileName) {\n if (mimeType === \"application/pdf\") {\n return ViewerType.Pdf;\n }\n if (isTiffFile(mimeType, fileName)) {\n return ViewerType.Tiff;\n }\n if (IMAGE_MIME_TYPES.has(mimeType)) {\n return ViewerType.Image;\n }\n if (mimeType.startsWith(\"video/\")) {\n return ViewerType.Video;\n }\n if (MARKDOWN_MIME_TYPES.has(mimeType)) {\n return ViewerType.Markdown;\n }\n if (mimeType === \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\") {\n return ViewerType.Excel;\n }\n if (mimeType === \"message/rfc822\") {\n return ViewerType.Email;\n }\n if (XML_MIME_TYPES.has(mimeType)) {\n return ViewerType.Xml;\n }\n return ViewerType.Unsupported;\n}\nexport function DocumentViewer({\n media,\n className,\n mimeTypeOverride,\n pdfViewerProps,\n imageViewerProps,\n videoViewerProps,\n tiffRendererProps,\n markdownRendererProps,\n excelViewerProps,\n emailViewerProps,\n xmlViewerProps,\n fileName,\n enableTiffToPdf = false\n}) {\n const mimeType = mimeTypeOverride ?? media.getMediaReference().mimeType;\n const viewerType = useMemo(() => getViewerType(mimeType, fileName), [mimeType, fileName]);\n const rootClassName = classnames(styles.container, className);\n switch (viewerType) {\n case ViewerType.Pdf:\n return /*#__PURE__*/React.createElement(PdfViewer, _extends({\n media: media,\n className: rootClassName\n }, pdfViewerProps));\n case ViewerType.Tiff:\n if (enableTiffToPdf) {\n return /*#__PURE__*/React.createElement(TiffDocumentViewer, {\n media: media,\n className: rootClassName,\n enableTiffToPdf: enableTiffToPdf,\n tiffRendererProps: tiffRendererProps,\n pdfViewerProps: pdfViewerProps\n });\n }\n return /*#__PURE__*/React.createElement(TiffViewerMedia, _extends({\n media: media,\n className: rootClassName\n }, tiffRendererProps));\n case ViewerType.Image:\n return /*#__PURE__*/React.createElement(ImageViewer, _extends({\n media: media,\n className: rootClassName\n }, imageViewerProps));\n case ViewerType.Video:\n return /*#__PURE__*/React.createElement(VideoViewer, _extends({\n media: media,\n className: rootClassName\n }, videoViewerProps));\n case ViewerType.Markdown:\n return /*#__PURE__*/React.createElement(MarkdownViewerMedia, _extends({\n media: media,\n className: rootClassName\n }, markdownRendererProps));\n case ViewerType.Excel:\n return /*#__PURE__*/React.createElement(ExcelViewer, _extends({\n media: media,\n className: rootClassName\n }, excelViewerProps));\n case ViewerType.Email:\n return /*#__PURE__*/React.createElement(EmailViewer, _extends({\n media: media,\n className: rootClassName\n }, emailViewerProps));\n case ViewerType.Xml:\n return /*#__PURE__*/React.createElement(XmlViewer, _extends({\n media: media,\n className: rootClassName\n }, xmlViewerProps));\n case ViewerType.Unsupported:\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.unsupportedContainer\n }, /*#__PURE__*/React.createElement(DocumentIcon, {\n className: styles.unsupportedIcon\n }), \"Unsupported file type: \", mimeType));\n default:\n assertUnreachable(viewerType);\n }\n}","/*\n * Copyright 2026 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\n// DocumentViewer\nimport { DocumentViewer as _DocumentViewer } from \"../../document-viewer/DocumentViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const DocumentViewer = withOsdkMetrics(_DocumentViewer, \"DocumentViewer\");\nexport { ViewerType } from \"../../document-viewer/DocumentViewerApi.js\";"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkFWZS3WQ4_cjs = require('./chunk-FWZS3WQ4.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkGZK554U2_cjs = require('./chunk-GZK554U2.cjs');
|
|
5
5
|
var icons = require('@blueprintjs/icons');
|
|
6
6
|
var classnames = require('classnames');
|
|
7
7
|
require('pdfjs-dist/web/pdf_viewer.css');
|
|
@@ -179,12 +179,12 @@ function usePdfViewerInstance(options) {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
// src/public/experimental/pdf-viewer.ts
|
|
182
|
-
var PdfViewer2 =
|
|
182
|
+
var PdfViewer2 = chunkGZK554U2_cjs.withOsdkMetrics(chunkFWZS3WQ4_cjs.PdfViewer, "PdfViewer");
|
|
183
183
|
|
|
184
184
|
exports.PdfViewer = PdfViewer2;
|
|
185
185
|
exports.PdfViewerContent = PdfViewerContent;
|
|
186
186
|
exports.PdfViewerProvider = PdfViewerProvider;
|
|
187
187
|
exports.usePdfViewerContext = usePdfViewerContext;
|
|
188
188
|
exports.usePdfViewerInstance = usePdfViewerInstance;
|
|
189
|
-
//# sourceMappingURL=chunk-
|
|
190
|
-
//# sourceMappingURL=chunk-
|
|
189
|
+
//# sourceMappingURL=chunk-53LQ33NA.cjs.map
|
|
190
|
+
//# sourceMappingURL=chunk-53LQ33NA.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pdf-viewer/components/PdfViewerContent.tsx","../../src/pdf-viewer/PdfViewerContext.tsx","../../src/public/experimental/pdf-viewer.ts"],"names":["EMPTY_ANNOTATION_ARRAY","usePdfViewerCore","usePdfAnnotationsByPage","usePdfFormFields","useRef","useEffect","classnames","PdfViewer_default","React","Spin","ErrorIcon","PdfAnnotationOverlay","useContext","usePdfViewerState","usePdfHighlightMode","useMemo","PdfViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;AA0BO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,GAAA;AAAA,EACA,WAAA,GAAcA,wCAAA;AAAA,EACd,iBAAA;AAAA,EACA,WAAA,GAAc,CAAA;AAAA,EACd,YAAA,GAAe,CAAA;AAAA,EACf,YAAA,EAAc,gBAAA;AAAA,EACd,aAAA,EAAe,iBAAA;AAAA,EACf,QAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,EAAG;AACD,EAAA,MAAM,SAASC,kCAAA,CAAiB;AAAA,IAC9B,GAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA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AA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF,CAAA,EAAI,CAAC,MAAA,EAAQ,gBAAA,EAAkB,qBAAqB,mBAAA,EAAqB,aAAA,EAAe,cAAA,EAAgB,WAAA,EAAa,iBAAA,EAAmB,iBAAA,EAAmB,cAAA,EAAgB,cAAA,EAAgB,YAAY,CAAC,CAAA;AAC1M;;;AC9DO,IAAMC,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-WYDFI4D2.cjs","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 { PdfAnnotationOverlay } from \"./PdfAnnotationOverlay.js\";\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}) {\n const viewer = usePdfViewerCore({\n src,\n initialPage,\n initialScale\n });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\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 useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n const rootClassName = classnames(styles.pdfViewer, className);\n if (viewer.loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Loading\\u2026\"));\n }\n if (viewer.error != null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.errorContainer\n }, /*#__PURE__*/React.createElement(ErrorIcon, {\n className: styles.errorIcon\n }), \"Failed to load PDF: \", viewer.error.message));\n }\n if (viewer.document == null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, \"No document\"));\n }\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.scrollContainerWrapper\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.containerRef,\n className: styles.scrollContainer\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.viewerRef,\n className: \"pdfViewer\"\n }), viewer.portalTargets.map(target => {\n const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(PdfAnnotationOverlay, {\n key: target.pageNumber,\n target: target,\n annotations: pageAnnotations,\n onAnnotationClick: onAnnotationClick\n });\n }))));\n}","/*\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 React, { createContext, useContext, useMemo } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"./constants.js\";\nimport { usePdfAnnotationsByPage } from \"./hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"./hooks/usePdfFormFields.js\";\nimport { usePdfHighlightMode } from \"./hooks/usePdfHighlightMode.js\";\nimport { usePdfViewerState } from \"./hooks/usePdfViewerState.js\";\n\n/** The shape of the value provided by {@link PdfViewerProvider}. */\n\nconst PdfViewerContext = /*#__PURE__*/createContext(null);\n/** Provides {@link PdfViewerContextValue} to descendant components. */\nexport function PdfViewerProvider({\n value,\n children\n}) {\n return /*#__PURE__*/React.createElement(PdfViewerContext.Provider, {\n value: value\n }, children);\n}\n\n/**\n * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.\n * Throws if called outside a provider.\n */\nexport function usePdfViewerContext() {\n const ctx = useContext(PdfViewerContext);\n if (ctx == null) {\n throw new Error(\"usePdfViewerContext must be used within a PdfViewerProvider\");\n }\n return ctx;\n}\n\n/**\n * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.\n * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable\n * for passing to {@link PdfViewerProvider}.\n */\nexport function usePdfViewerInstance(options) {\n const viewer = usePdfViewerState({\n src: options.src,\n initialPage: options.initialPage,\n initialScale: options.initialScale,\n initialAutoSize: options.initialAutoSize,\n initialSidebarOpen: options.initialSidebarOpen,\n sidebarMode: options.sidebarMode,\n onDownload: options.onDownload\n });\n const {\n highlightModeActive,\n toggleHighlightMode\n } = usePdfHighlightMode({\n pdfViewerRef: viewer.pdfViewerRef,\n document: viewer.document,\n enabled: options.highlightEnabled ?? false,\n onTextHighlight: options.onTextHighlight,\n onHighlightDelete: options.onHighlightDelete\n });\n const {\n hasFormFields,\n submitFormData\n } = usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData: options.formData,\n onFormSubmit: options.onFormSubmit,\n onFormChange: options.onFormChange\n });\n const annotations = options.annotations ?? EMPTY_ANNOTATION_ARRAY;\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n const highlightEnabled = options.highlightEnabled ?? false;\n const enableDownload = options.enableDownload ?? false;\n const enableFormSave = options.onFormSubmit != null && hasFormFields;\n const {\n onAnnotationClick,\n outlineIcons\n } = options;\n return useMemo(() => ({\n ...viewer,\n highlightEnabled,\n highlightModeActive,\n toggleHighlightMode,\n hasFormFields,\n submitFormData,\n annotations,\n annotationsByPage,\n onAnnotationClick,\n enableDownload,\n enableFormSave,\n outlineIcons\n }), [viewer, highlightEnabled, highlightModeActive, toggleHighlightMode, hasFormFields, submitFormData, annotations, annotationsByPage, onAnnotationClick, enableDownload, enableFormSave, outlineIcons]);\n}","/*\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\n// PdfViewer\nexport { BasePdfViewer } from \"../../pdf-viewer/PdfViewer.js\";\n// PdfViewer building blocks\nexport { PdfViewerAnnotationLayer } from \"../../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport { PdfViewerContent } from \"../../pdf-viewer/components/PdfViewerContent.js\";\nexport { PdfViewerOutlineSidebar } from \"../../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport { PdfViewerSearchBar } from \"../../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport { PdfViewerSidebar } from \"../../pdf-viewer/components/PdfViewerSidebar.js\";\nexport { PdfViewerToolbar } from \"../../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport { usePdfAnnotationPortals } from \"../../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../../pdf-viewer/hooks/usePdfDocument.js\";\nexport { usePdfFormFields } from \"../../pdf-viewer/hooks/usePdfFormFields.js\";\nexport { usePdfHighlightMode } from \"../../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../../pdf-viewer/hooks/usePdfOutline.js\";\nexport { usePdfViewer } from \"../../pdf-viewer/hooks/usePdfViewer.js\";\nexport { usePdfViewerSearch } from \"../../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../../pdf-viewer/hooks/usePdfViewerSync.js\";\n// PdfViewer context\nexport { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from \"../../pdf-viewer/PdfViewerContext.js\";\n// PdfViewer hooks — composition\nexport { usePdfViewerCore } from \"../../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport { usePdfViewerState } from \"../../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nimport { PdfViewer as _PdfViewer } from \"../../pdf-viewer/PdfRenderer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const PdfViewer = withOsdkMetrics(_PdfViewer, \"PdfViewer\");"]}
|
|
1
|
+
{"version":3,"sources":["../../src/pdf-viewer/components/PdfViewerContent.tsx","../../src/pdf-viewer/PdfViewerContext.tsx","../../src/public/experimental/pdf-viewer.ts"],"names":["EMPTY_ANNOTATION_ARRAY","usePdfViewerCore","usePdfAnnotationsByPage","usePdfFormFields","useRef","useEffect","classnames","PdfViewer_default","React","Spin","ErrorIcon","PdfAnnotationOverlay","useContext","usePdfViewerState","usePdfHighlightMode","useMemo","PdfViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;AA0BO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,GAAA;AAAA,EACA,WAAA,GAAcA,wCAAA;AAAA,EACd,iBAAA;AAAA,EACA,WAAA,GAAc,CAAA;AAAA,EACd,YAAA,GAAe,CAAA;AAAA,EACf,YAAA,EAAc,gBAAA;AAAA,EACd,aAAA,EAAe,iBAAA;AAAA,EACf,QAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA,EAAG;AACD,EAAA,MAAM,SAASC,kCAAA,CAAiB;AAAA,IAC9B,GAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AACD,EAAA,MAAM,iBAAA,GAAoBC,0CAAwB,WAAW,CAAA;AAC7D,EAAAC,kCAAA,CAAiB;AAAA,IACf,cAAc,MAAA,CAAO,YAAA;AAAA,IACrB,aAAa,MAAA,CAAO,WAAA;AAAA,IACpB,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,QAAA;AAAA,IACA;AAAA,GACD,CAAA;AAGD,EAAA,MAAM,eAAA,GAAkBC,aAAO,gBAAgB,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C,CAAA;AAC1M;;;AC9DO,IAAMC,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-53LQ33NA.cjs","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 { PdfAnnotationOverlay } from \"./PdfAnnotationOverlay.js\";\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}) {\n const viewer = usePdfViewerCore({\n src,\n initialPage,\n initialScale\n });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\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 useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n const rootClassName = classnames(styles.pdfViewer, className);\n if (viewer.loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Loading\\u2026\"));\n }\n if (viewer.error != null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.errorContainer\n }, /*#__PURE__*/React.createElement(ErrorIcon, {\n className: styles.errorIcon\n }), \"Failed to load PDF: \", viewer.error.message));\n }\n if (viewer.document == null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, \"No document\"));\n }\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.scrollContainerWrapper\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.containerRef,\n className: styles.scrollContainer\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.viewerRef,\n className: \"pdfViewer\"\n }), viewer.portalTargets.map(target => {\n const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(PdfAnnotationOverlay, {\n key: target.pageNumber,\n target: target,\n annotations: pageAnnotations,\n onAnnotationClick: onAnnotationClick\n });\n }))));\n}","/*\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 React, { createContext, useContext, useMemo } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"./constants.js\";\nimport { usePdfAnnotationsByPage } from \"./hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"./hooks/usePdfFormFields.js\";\nimport { usePdfHighlightMode } from \"./hooks/usePdfHighlightMode.js\";\nimport { usePdfViewerState } from \"./hooks/usePdfViewerState.js\";\n\n/** The shape of the value provided by {@link PdfViewerProvider}. */\n\nconst PdfViewerContext = /*#__PURE__*/createContext(null);\n/** Provides {@link PdfViewerContextValue} to descendant components. */\nexport function PdfViewerProvider({\n value,\n children\n}) {\n return /*#__PURE__*/React.createElement(PdfViewerContext.Provider, {\n value: value\n }, children);\n}\n\n/**\n * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.\n * Throws if called outside a provider.\n */\nexport function usePdfViewerContext() {\n const ctx = useContext(PdfViewerContext);\n if (ctx == null) {\n throw new Error(\"usePdfViewerContext must be used within a PdfViewerProvider\");\n }\n return ctx;\n}\n\n/**\n * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.\n * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable\n * for passing to {@link PdfViewerProvider}.\n */\nexport function usePdfViewerInstance(options) {\n const viewer = usePdfViewerState({\n src: options.src,\n initialPage: options.initialPage,\n initialScale: options.initialScale,\n initialAutoSize: options.initialAutoSize,\n initialSidebarOpen: options.initialSidebarOpen,\n sidebarMode: options.sidebarMode,\n onDownload: options.onDownload\n });\n const {\n highlightModeActive,\n toggleHighlightMode\n } = usePdfHighlightMode({\n pdfViewerRef: viewer.pdfViewerRef,\n document: viewer.document,\n enabled: options.highlightEnabled ?? false,\n onTextHighlight: options.onTextHighlight,\n onHighlightDelete: options.onHighlightDelete\n });\n const {\n hasFormFields,\n submitFormData\n } = usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData: options.formData,\n onFormSubmit: options.onFormSubmit,\n onFormChange: options.onFormChange\n });\n const annotations = options.annotations ?? EMPTY_ANNOTATION_ARRAY;\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n const highlightEnabled = options.highlightEnabled ?? false;\n const enableDownload = options.enableDownload ?? false;\n const enableFormSave = options.onFormSubmit != null && hasFormFields;\n const {\n onAnnotationClick,\n outlineIcons\n } = options;\n return useMemo(() => ({\n ...viewer,\n highlightEnabled,\n highlightModeActive,\n toggleHighlightMode,\n hasFormFields,\n submitFormData,\n annotations,\n annotationsByPage,\n onAnnotationClick,\n enableDownload,\n enableFormSave,\n outlineIcons\n }), [viewer, highlightEnabled, highlightModeActive, toggleHighlightMode, hasFormFields, submitFormData, annotations, annotationsByPage, onAnnotationClick, enableDownload, enableFormSave, outlineIcons]);\n}","/*\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\n// PdfViewer\nexport { BasePdfViewer } from \"../../pdf-viewer/PdfViewer.js\";\n// PdfViewer building blocks\nexport { PdfViewerAnnotationLayer } from \"../../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport { PdfViewerContent } from \"../../pdf-viewer/components/PdfViewerContent.js\";\nexport { PdfViewerOutlineSidebar } from \"../../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport { PdfViewerSearchBar } from \"../../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport { PdfViewerSidebar } from \"../../pdf-viewer/components/PdfViewerSidebar.js\";\nexport { PdfViewerToolbar } from \"../../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport { usePdfAnnotationPortals } from \"../../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../../pdf-viewer/hooks/usePdfDocument.js\";\nexport { usePdfFormFields } from \"../../pdf-viewer/hooks/usePdfFormFields.js\";\nexport { usePdfHighlightMode } from \"../../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../../pdf-viewer/hooks/usePdfOutline.js\";\nexport { usePdfViewer } from \"../../pdf-viewer/hooks/usePdfViewer.js\";\nexport { usePdfViewerSearch } from \"../../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../../pdf-viewer/hooks/usePdfViewerSync.js\";\n// PdfViewer context\nexport { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from \"../../pdf-viewer/PdfViewerContext.js\";\n// PdfViewer hooks — composition\nexport { usePdfViewerCore } from \"../../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport { usePdfViewerState } from \"../../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nimport { PdfViewer as _PdfViewer } from \"../../pdf-viewer/PdfRenderer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const PdfViewer = withOsdkMetrics(_PdfViewer, \"PdfViewer\");"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkOUJQJQ7N_cjs = require('./chunk-OUJQJQ7N.cjs');
|
|
4
|
+
var chunkGZK554U2_cjs = require('./chunk-GZK554U2.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/experimental/xml-viewer.ts
|
|
7
|
+
var XmlViewer2 = chunkGZK554U2_cjs.withOsdkMetrics(chunkOUJQJQ7N_cjs.XmlViewer, "XmlViewer");
|
|
8
|
+
|
|
9
|
+
exports.XmlViewer = XmlViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-5CHN75OI.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-5CHN75OI.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/xml-viewer.ts"],"names":["XmlViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/xml-viewer.ts"],"names":["XmlViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-5CHN75OI.cjs","sourcesContent":["/*\n * Copyright 2026 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\n// BaseXmlViewer\nexport { BaseXmlViewer } from \"../../xml-viewer/BaseXmlViewer.js\";\n// XmlViewer (Media wrapper)\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nimport { XmlViewer as _XmlViewer } from \"../../xml-viewer/XmlViewer.js\";\nexport const XmlViewer = withOsdkMetrics(_XmlViewer, \"XmlViewer\");"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPKJFOG2Z_cjs = require('./chunk-PKJFOG2Z.cjs');
|
|
4
|
+
var chunkGZK554U2_cjs = require('./chunk-GZK554U2.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/experimental/email-viewer.ts
|
|
7
|
+
var EmailViewer2 = chunkGZK554U2_cjs.withOsdkMetrics(chunkPKJFOG2Z_cjs.EmailViewer, "EmailViewer");
|
|
8
|
+
|
|
9
|
+
exports.EmailViewer = EmailViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-6NN3K3EX.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-6NN3K3EX.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/email-viewer.ts"],"names":["EmailViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/email-viewer.ts"],"names":["EmailViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-6NN3K3EX.cjs","sourcesContent":["/*\n * Copyright 2026 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\n// BaseEmailViewer\nexport { BaseEmailViewer } from \"../../email-viewer/BaseEmailViewer.js\";\n// EmailViewer (Media wrapper)\nimport { EmailViewer as _EmailViewer } from \"../../email-viewer/EmailViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const EmailViewer = withOsdkMetrics(_EmailViewer, \"EmailViewer\");"]}
|
|
@@ -7,7 +7,7 @@ var chunkE5OKIBYJ_cjs = require('./chunk-E5OKIBYJ.cjs');
|
|
|
7
7
|
var chunk7LXS66DW_cjs = require('./chunk-7LXS66DW.cjs');
|
|
8
8
|
var chunkMD4KDE44_cjs = require('./chunk-MD4KDE44.cjs');
|
|
9
9
|
var chunkUCTQICPR_cjs = require('./chunk-UCTQICPR.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkGZK554U2_cjs = require('./chunk-GZK554U2.cjs');
|
|
11
11
|
var react = require('@osdk/react');
|
|
12
12
|
var React17 = require('react');
|
|
13
13
|
var icons = require('@blueprintjs/icons');
|
|
@@ -1853,9 +1853,9 @@ var ActionForm = chunk3S52UDZM_cjs.typedReactMemo(function ActionFormFn({
|
|
|
1853
1853
|
});
|
|
1854
1854
|
|
|
1855
1855
|
// src/public/experimental/action-form.ts
|
|
1856
|
-
var ActionForm2 =
|
|
1856
|
+
var ActionForm2 = chunkGZK554U2_cjs.withOsdkMetrics(ActionForm, "ActionForm");
|
|
1857
1857
|
|
|
1858
1858
|
exports.ActionForm = ActionForm2;
|
|
1859
1859
|
exports.BaseForm = BaseForm;
|
|
1860
|
-
//# sourceMappingURL=chunk-
|
|
1861
|
-
//# sourceMappingURL=chunk-
|
|
1860
|
+
//# sourceMappingURL=chunk-AX4PH6SH.cjs.map
|
|
1861
|
+
//# sourceMappingURL=chunk-AX4PH6SH.cjs.map
|