@vertexvis/doc-viewer-react 0.24.5-canary.10
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/LICENSE +21 -0
- package/README.md +72 -0
- package/dist/bundle.cjs.js +107 -0
- package/dist/bundle.cjs.js.map +1 -0
- package/dist/bundle.esm.js +81 -0
- package/dist/bundle.esm.js.map +1 -0
- package/dist/generated/components.d.ts +14 -0
- package/dist/index.d.ts +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 - Present Vertex Software, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# React Bindings for Vertex Document Viewer SDK
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
This project contains React bindings for Vertex's Document Viewer SDK. These bindings are
|
|
7
|
+
auto-generated from `@vertexvis/doc-viewer`.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Run `yarn add @vertexvis/doc-viewer-react` or `npm install @vertexvis/doc-viewer-react`
|
|
12
|
+
to add the project as an NPM dependency.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
`@vertexvis/doc-viewer` includes a component loader, `defineCustomElements`, that
|
|
17
|
+
needs to be invoked to register the components with the browser. It also
|
|
18
|
+
includes a global stylesheet with default styling. Consult your bundlers
|
|
19
|
+
documentation on how to bundle CSS with your project's bundler.
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
import React from 'react';
|
|
23
|
+
import ReactDom from 'react-dom';
|
|
24
|
+
|
|
25
|
+
import { defineCustomElements } from '@vertexvis/doc-viewer/loader';
|
|
26
|
+
import '@vertexvis/doc-viewer/dist/doc-viewer/doc-viewer.css';
|
|
27
|
+
|
|
28
|
+
async function main() {
|
|
29
|
+
await defineCustomElement(window);
|
|
30
|
+
ReactDom.render(<App />, document.querySelector('#app'));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
main();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Next, add one of the components to your React component.
|
|
37
|
+
|
|
38
|
+
```jsx
|
|
39
|
+
import React from 'react';
|
|
40
|
+
import { VertexDocumentViewer } from '@vertexvis/doc-viewer-react';
|
|
41
|
+
import workerSrc from '@vertexvis/doc-viewer/assets/pdf.worker.min.mjs';
|
|
42
|
+
|
|
43
|
+
export function App() {
|
|
44
|
+
return (
|
|
45
|
+
<div>
|
|
46
|
+
<VertexDocumentViewer config={{ pdfJs: { workerSrc } }} src="https://{{ DOCUMENT_URL }}" />
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Note with Webpack builds
|
|
53
|
+
|
|
54
|
+
Webpack will not recognize the `import workerSrc from '@vertexvis/doc-viewer/assets/pdf.worker.min.mjs';` import as
|
|
55
|
+
an asset URL by default. This can cause Webpack to attempt to treat this file as a module and display warnings. To
|
|
56
|
+
resolve this, the following can be added to your webpack config to indicate this file is an asset:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
{
|
|
60
|
+
test: /pdf\.worker\.min\.mjs$/,
|
|
61
|
+
type: 'asset/resource',
|
|
62
|
+
},
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Documentation
|
|
66
|
+
|
|
67
|
+
See [@vertexvis/doc-viewer][component docs] for a full list of components and their
|
|
68
|
+
documentation.
|
|
69
|
+
|
|
70
|
+
[component docs]: https://github.com/Vertexvis/vertex-web-sdk/tree/master/packages/doc-viewer/src/components
|
|
71
|
+
[css variables]: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties
|
|
72
|
+
[global styles]: https://github.com/Vertexvis/vertex-web-sdk/blob/master/packages/doc-viewer/src/css/global.css
|