@embedpdf/viewer-react 3.0.0-next.14 → 3.0.0-next.15
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/README.md +38 -8
- package/dist/component.cjs +19 -0
- package/dist/component.d.cts +2 -0
- package/dist/component.d.ts +2 -0
- package/dist/component.js +3 -0
- package/dist/core.cjs +20 -6
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -5
- package/dist/core.d.ts +2 -5
- package/dist/core.js +3 -4
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +21 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -8
- package/dist/index.d.ts +3 -8
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -0
- package/dist/parts-BNOPi71I.js +315 -0
- package/dist/parts-BNOPi71I.js.map +1 -0
- package/dist/parts-CDiQnn2K.d.cts +134 -0
- package/dist/parts-DraHrZwl.cjs +368 -0
- package/dist/parts-DraHrZwl.cjs.map +1 -0
- package/dist/parts-U3eTUt92.d.ts +134 -0
- package/package.json +18 -4
- package/dist/component-B4Bvq3Dk.js +0 -31
- package/dist/component-B4Bvq3Dk.js.map +0 -1
- package/dist/component-B8nwtJtn.d.cts +0 -29
- package/dist/component-CGxTTf8T.d.ts +0 -29
- package/dist/component-DmxO8uud.cjs +0 -36
- package/dist/component-DmxO8uud.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -21,26 +21,56 @@ bundler ships `embedpdf.wasm` inside your own build. Self-hosting, strict-CSP
|
|
|
21
21
|
worker delivery, and injecting a different engine implementation are all
|
|
22
22
|
available through the `engine` prop — see the docs.
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Your own components
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
`ToolbarItem`, `Panel` and `Region` put your component in the place the layout
|
|
27
|
+
makes for it, while it stays in **your** React tree — your context, your
|
|
28
28
|
state, your CSS:
|
|
29
29
|
|
|
30
30
|
```tsx
|
|
31
|
-
<PDFViewer
|
|
32
|
-
|
|
31
|
+
<PDFViewer
|
|
32
|
+
src="/report.pdf"
|
|
33
|
+
layout={(layout) => layout.add({ custom: 'doc-picker' }, { to: 'main', section: 'start' })}
|
|
34
|
+
>
|
|
35
|
+
<ToolbarItem id="doc-picker">
|
|
36
|
+
<MyDocPicker />
|
|
37
|
+
</ToolbarItem>
|
|
33
38
|
</PDFViewer>
|
|
34
39
|
```
|
|
35
40
|
|
|
41
|
+
`useToolbarItem()` tells it where it sits, and `Button`, `Menu` and `MenuItem`
|
|
42
|
+
are the viewer's own, for yours.
|
|
43
|
+
|
|
36
44
|
## Driving the viewer
|
|
37
45
|
|
|
38
46
|
```tsx
|
|
39
|
-
<PDFViewer
|
|
47
|
+
<PDFViewer
|
|
48
|
+
src="/report.pdf"
|
|
49
|
+
onReady={(viewer) => viewer.commands.execute('zoom:in')}
|
|
50
|
+
/>
|
|
40
51
|
```
|
|
41
52
|
|
|
42
|
-
`onReady` hands you the viewer
|
|
43
|
-
`viewer.get(
|
|
53
|
+
`onReady` hands you the `viewer`: each plugin's API by its name
|
|
54
|
+
(`viewer.get('search')`, or its token), `viewer.documents`, `viewer.commands`
|
|
55
|
+
and the `watch` reactivity primitive. Inside the viewer, a component of yours
|
|
56
|
+
gets it with `usePDFViewer()`, and `useCommand(id)` gives it a command as a
|
|
57
|
+
button needs it (label, icon, shortcut, state and `run()`). The headless hooks
|
|
58
|
+
of `@embedpdf/react` work there too. When the viewer unmounts, its `viewer` is
|
|
59
|
+
done: its listeners stop and its calls refuse.
|
|
60
|
+
|
|
61
|
+
`plugins` takes each plugin's settings by its name
|
|
62
|
+
(`plugins={{ stage: { spread: 'odd' } }}`), and a plugin of your own by a name
|
|
63
|
+
`viewer.get()` then finds it under.
|
|
64
|
+
|
|
65
|
+
`src`, `theme`, `locale`, `disable` and `readOnly` follow their props while the
|
|
66
|
+
viewer runs; every other prop is read once, so give the viewer a new `key` to
|
|
67
|
+
start over with a changed one.
|
|
68
|
+
|
|
69
|
+
## Server-side rendering
|
|
70
|
+
|
|
71
|
+
The package is a client component (`'use client'`) and safe to import on the
|
|
72
|
+
server, where `<PDFViewer>` renders the empty `<embedpdf-viewer>` element; the
|
|
73
|
+
viewer starts in the browser.
|
|
44
74
|
|
|
45
75
|
## Documentation
|
|
46
76
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_parts = require("./parts-DraHrZwl.cjs");
|
|
4
|
+
let _embedpdf_react_commands = require("@embedpdf/react/commands");
|
|
5
|
+
exports.Button = require_parts.Button;
|
|
6
|
+
exports.Menu = require_parts.Menu;
|
|
7
|
+
exports.MenuItem = require_parts.MenuItem;
|
|
8
|
+
exports.PDFViewer = require_parts.PDFViewer;
|
|
9
|
+
exports.Panel = require_parts.Panel;
|
|
10
|
+
exports.Region = require_parts.Region;
|
|
11
|
+
exports.ToolbarItem = require_parts.ToolbarItem;
|
|
12
|
+
Object.defineProperty(exports, "useCommand", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function() {
|
|
15
|
+
return _embedpdf_react_commands.useCommand;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
exports.usePDFViewer = require_parts.usePDFViewer;
|
|
19
|
+
exports.useToolbarItem = require_parts.useToolbarItem;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as PDFViewer, a as MenuItemProps, c as PanelProps, d as RegionProps, f as ToolbarItem, g as usePDFViewer, h as useCommand, i as MenuItem, l as Region, m as useToolbarItem, n as ButtonProps, o as MenuProps, p as ToolbarItemProps, r as Menu, s as Panel, t as Button, u as RegionName, v as PDFViewerExtras, y as PDFViewerImplProps } from "./parts-CDiQnn2K.cjs";
|
|
2
|
+
export { Button, type ButtonProps, Menu, MenuItem, type MenuItemProps, type MenuProps, PDFViewer, type PDFViewerExtras, type PDFViewerImplProps, Panel, type PanelProps, Region, type RegionName, type RegionProps, ToolbarItem, type ToolbarItemProps, useCommand, usePDFViewer, useToolbarItem };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { _ as PDFViewer, a as MenuItemProps, c as PanelProps, d as RegionProps, f as ToolbarItem, g as usePDFViewer, h as useCommand, i as MenuItem, l as Region, m as useToolbarItem, n as ButtonProps, o as MenuProps, p as ToolbarItemProps, r as Menu, s as Panel, t as Button, u as RegionName, v as PDFViewerExtras, y as PDFViewerImplProps } from "./parts-U3eTUt92.js";
|
|
2
|
+
export { Button, type ButtonProps, Menu, MenuItem, type MenuItemProps, type MenuProps, PDFViewer, type PDFViewerExtras, type PDFViewerImplProps, Panel, type PanelProps, Region, type RegionName, type RegionProps, ToolbarItem, type ToolbarItemProps, useCommand, usePDFViewer, useToolbarItem };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as Region, c as PDFViewer, i as Panel, l as useCommand, n as Menu, o as ToolbarItem, r as MenuItem, s as useToolbarItem, t as Button, u as usePDFViewer } from "./parts-BNOPi71I.js";
|
|
3
|
+
export { Button, Menu, MenuItem, PDFViewer, Panel, Region, ToolbarItem, useCommand, usePDFViewer, useToolbarItem };
|
package/dist/core.cjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
+
const require_parts = require("./parts-DraHrZwl.cjs");
|
|
3
4
|
require("@embedpdf/viewer/core");
|
|
5
|
+
let _embedpdf_react_commands = require("@embedpdf/react/commands");
|
|
4
6
|
//#region src/core.ts
|
|
5
7
|
/**
|
|
6
|
-
* @embedpdf/viewer-react/core — the
|
|
8
|
+
* @embedpdf/viewer-react/core — the engine-agnostic React door.
|
|
7
9
|
*
|
|
8
10
|
* ```tsx
|
|
9
11
|
* import { PDFViewer } from '@embedpdf/viewer-react/core';
|
|
@@ -13,7 +15,7 @@ require("@embedpdf/viewer/core");
|
|
|
13
15
|
* ```
|
|
14
16
|
*
|
|
15
17
|
* The same <PDFViewer> as the main entry — but no default engine, so `engine`
|
|
16
|
-
* is
|
|
18
|
+
* is required and takes only a real implementation (an `Engine`, or a factory
|
|
17
19
|
* thunk the viewer owns the lifetime of). In exchange the local PDFium engine —
|
|
18
20
|
* wasm, worker source, main-thread recipe — never enters your module graph:
|
|
19
21
|
* nothing is stubbed or aliased away, it is simply not imported. Its options
|
|
@@ -24,11 +26,23 @@ require("@embedpdf/viewer/core");
|
|
|
24
26
|
* `@embedpdf/viewer-react`; this entry exists for builds that always inject
|
|
25
27
|
* their own engine, and is what the CloudPDF React wrapper is built on.
|
|
26
28
|
*/
|
|
27
|
-
|
|
28
|
-
* implementation is typed with the wider config — see ./component). */
|
|
29
|
-
const PDFViewer = require_component.PDFViewer;
|
|
29
|
+
const PDFViewer = require_parts.PDFViewer;
|
|
30
30
|
//#endregion
|
|
31
|
+
exports.Button = require_parts.Button;
|
|
32
|
+
exports.Menu = require_parts.Menu;
|
|
33
|
+
exports.MenuItem = require_parts.MenuItem;
|
|
31
34
|
exports.PDFViewer = PDFViewer;
|
|
35
|
+
exports.Panel = require_parts.Panel;
|
|
36
|
+
exports.Region = require_parts.Region;
|
|
37
|
+
exports.ToolbarItem = require_parts.ToolbarItem;
|
|
38
|
+
Object.defineProperty(exports, "useCommand", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function() {
|
|
41
|
+
return _embedpdf_react_commands.useCommand;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
exports.usePDFViewer = require_parts.usePDFViewer;
|
|
45
|
+
exports.useToolbarItem = require_parts.useToolbarItem;
|
|
32
46
|
Object.keys(_embedpdf_viewer_core).forEach(function(k) {
|
|
33
47
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
34
48
|
enumerable: true,
|
package/dist/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","names":["PDFViewerImpl"],"sources":["../src/core.ts"],"sourcesContent":["/**\n * @embedpdf/viewer-react/core — the
|
|
1
|
+
{"version":3,"file":"core.cjs","names":["PDFViewerImpl"],"sources":["../src/core.ts"],"sourcesContent":["'use client';\n/**\n * @embedpdf/viewer-react/core — the engine-agnostic React door.\n *\n * ```tsx\n * import { PDFViewer } from '@embedpdf/viewer-react/core';\n * import { cloudEngine } from '@cloudpdf/engine';\n *\n * <PDFViewer engine={() => cloudEngine({ baseUrl, token })} documents={docs} />\n * ```\n *\n * The same <PDFViewer> as the main entry — but no default engine, so `engine`\n * is required and takes only a real implementation (an `Engine`, or a factory\n * thunk the viewer owns the lifetime of). In exchange the local PDFium engine —\n * wasm, worker source, main-thread recipe — never enters your module graph:\n * nothing is stubbed or aliased away, it is simply not imported. Its options\n * bag is absent from the type for the same reason (there is no built-in engine\n * here for `{ assetsUrl }` to configure).\n *\n * App code that wants the batteries-included viewer should import\n * `@embedpdf/viewer-react`; this entry exists for builds that always inject\n * their own engine, and is what the CloudPDF React wrapper is built on.\n */\nimport '@embedpdf/viewer/core';\n\nimport type { ViewerConfig } from '@embedpdf/viewer/core';\n\nimport { PDFViewer as PDFViewerImpl, type PDFViewerExtras } from './parts';\n\nexport * from '@embedpdf/viewer/core';\nexport * from './parts';\n\nexport type PDFViewerProps = ViewerConfig & PDFViewerExtras;\n\nexport const PDFViewer: (props: PDFViewerProps) => ReturnType<typeof PDFViewerImpl> = PDFViewerImpl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,YAAyEA,cAAAA"}
|
package/dist/core.d.cts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { _ as PDFViewer$1, a as MenuItemProps, c as PanelProps, d as RegionProps, f as ToolbarItem, g as usePDFViewer, h as useCommand, i as MenuItem, l as Region, m as useToolbarItem, n as ButtonProps, o as MenuProps, p as ToolbarItemProps, r as Menu, s as Panel, t as Button, u as RegionName, v as PDFViewerExtras, y as PDFViewerImplProps } from "./parts-CDiQnn2K.cjs";
|
|
2
2
|
import { ViewerConfig } from "@embedpdf/viewer/core";
|
|
3
3
|
export * from "@embedpdf/viewer/core";
|
|
4
4
|
//#region src/core.d.ts
|
|
5
|
-
/** Props on THIS door: `engine` is required, and only a real engine satisfies it. */
|
|
6
5
|
type PDFViewerProps = ViewerConfig & PDFViewerExtras;
|
|
7
|
-
/** The shared component, narrowed to this door's contract (no cast needed: the
|
|
8
|
-
* implementation is typed with the wider config — see ./component). */
|
|
9
6
|
declare const PDFViewer: (props: PDFViewerProps) => ReturnType<typeof PDFViewer$1>;
|
|
10
7
|
//#endregion
|
|
11
|
-
export { PDFViewer, type PDFViewerExtras, PDFViewerProps };
|
|
8
|
+
export { Button, type ButtonProps, Menu, MenuItem, type MenuItemProps, type MenuProps, PDFViewer, type PDFViewerExtras, type PDFViewerImplProps, PDFViewerProps, Panel, type PanelProps, Region, type RegionName, type RegionProps, ToolbarItem, type ToolbarItemProps, useCommand, usePDFViewer, useToolbarItem };
|
|
12
9
|
//# sourceMappingURL=core.d.cts.map
|
package/dist/core.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { _ as PDFViewer$1, a as MenuItemProps, c as PanelProps, d as RegionProps, f as ToolbarItem, g as usePDFViewer, h as useCommand, i as MenuItem, l as Region, m as useToolbarItem, n as ButtonProps, o as MenuProps, p as ToolbarItemProps, r as Menu, s as Panel, t as Button, u as RegionName, v as PDFViewerExtras, y as PDFViewerImplProps } from "./parts-U3eTUt92.js";
|
|
2
2
|
import { ViewerConfig } from "@embedpdf/viewer/core";
|
|
3
3
|
export * from "@embedpdf/viewer/core";
|
|
4
4
|
//#region src/core.d.ts
|
|
5
|
-
/** Props on THIS door: `engine` is required, and only a real engine satisfies it. */
|
|
6
5
|
type PDFViewerProps = ViewerConfig & PDFViewerExtras;
|
|
7
|
-
/** The shared component, narrowed to this door's contract (no cast needed: the
|
|
8
|
-
* implementation is typed with the wider config — see ./component). */
|
|
9
6
|
declare const PDFViewer: (props: PDFViewerProps) => ReturnType<typeof PDFViewer$1>;
|
|
10
7
|
//#endregion
|
|
11
|
-
export { PDFViewer, type PDFViewerExtras, PDFViewerProps };
|
|
8
|
+
export { Button, type ButtonProps, Menu, MenuItem, type MenuItemProps, type MenuProps, PDFViewer, type PDFViewerExtras, type PDFViewerImplProps, PDFViewerProps, Panel, type PanelProps, Region, type RegionName, type RegionProps, ToolbarItem, type ToolbarItemProps, useCommand, usePDFViewer, useToolbarItem };
|
|
12
9
|
//# sourceMappingURL=core.d.ts.map
|
package/dist/core.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as Region, c as PDFViewer$1, i as Panel, l as useCommand, n as Menu, o as ToolbarItem, r as MenuItem, s as useToolbarItem, t as Button, u as usePDFViewer } from "./parts-BNOPi71I.js";
|
|
2
3
|
import "@embedpdf/viewer/core";
|
|
3
4
|
export * from "@embedpdf/viewer/core";
|
|
4
5
|
//#region src/core.ts
|
|
5
|
-
/** The shared component, narrowed to this door's contract (no cast needed: the
|
|
6
|
-
* implementation is typed with the wider config — see ./component). */
|
|
7
6
|
const PDFViewer = PDFViewer$1;
|
|
8
7
|
//#endregion
|
|
9
|
-
export { PDFViewer };
|
|
8
|
+
export { Button, Menu, MenuItem, PDFViewer, Panel, Region, ToolbarItem, useCommand, usePDFViewer, useToolbarItem };
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","names":["PDFViewerImpl"],"sources":["../src/core.ts"],"sourcesContent":["/**\n * @embedpdf/viewer-react/core — the
|
|
1
|
+
{"version":3,"file":"core.js","names":["PDFViewerImpl"],"sources":["../src/core.ts"],"sourcesContent":["'use client';\n/**\n * @embedpdf/viewer-react/core — the engine-agnostic React door.\n *\n * ```tsx\n * import { PDFViewer } from '@embedpdf/viewer-react/core';\n * import { cloudEngine } from '@cloudpdf/engine';\n *\n * <PDFViewer engine={() => cloudEngine({ baseUrl, token })} documents={docs} />\n * ```\n *\n * The same <PDFViewer> as the main entry — but no default engine, so `engine`\n * is required and takes only a real implementation (an `Engine`, or a factory\n * thunk the viewer owns the lifetime of). In exchange the local PDFium engine —\n * wasm, worker source, main-thread recipe — never enters your module graph:\n * nothing is stubbed or aliased away, it is simply not imported. Its options\n * bag is absent from the type for the same reason (there is no built-in engine\n * here for `{ assetsUrl }` to configure).\n *\n * App code that wants the batteries-included viewer should import\n * `@embedpdf/viewer-react`; this entry exists for builds that always inject\n * their own engine, and is what the CloudPDF React wrapper is built on.\n */\nimport '@embedpdf/viewer/core';\n\nimport type { ViewerConfig } from '@embedpdf/viewer/core';\n\nimport { PDFViewer as PDFViewerImpl, type PDFViewerExtras } from './parts';\n\nexport * from '@embedpdf/viewer/core';\nexport * from './parts';\n\nexport type PDFViewerProps = ViewerConfig & PDFViewerExtras;\n\nexport const PDFViewer: (props: PDFViewerProps) => ReturnType<typeof PDFViewerImpl> = PDFViewerImpl;\n"],"mappings":";;;;;AAkCA,MAAa,YAAyEA"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
+
const require_parts = require("./parts-DraHrZwl.cjs");
|
|
3
4
|
require("@embedpdf/viewer");
|
|
5
|
+
let _embedpdf_react_commands = require("@embedpdf/react/commands");
|
|
4
6
|
//#region src/index.ts
|
|
5
7
|
/**
|
|
6
8
|
* @embedpdf/viewer-react — the full viewer as a React component, with the
|
|
7
|
-
* built-in
|
|
9
|
+
* built-in local engine (PDFium wasm in a worker) as the default.
|
|
8
10
|
*
|
|
9
11
|
* ```tsx
|
|
10
12
|
* import { PDFViewer } from '@embedpdf/viewer-react';
|
|
@@ -18,10 +20,25 @@ require("@embedpdf/viewer");
|
|
|
18
20
|
* instead, which is the same component with PDFium structurally absent.
|
|
19
21
|
*
|
|
20
22
|
* The component itself lives in `./component` and is engine-blind; the one
|
|
21
|
-
* import below is what makes
|
|
23
|
+
* import below is what makes this entry the local-engine door.
|
|
22
24
|
*/
|
|
25
|
+
const PDFViewer = require_parts.PDFViewer;
|
|
23
26
|
//#endregion
|
|
24
|
-
exports.
|
|
27
|
+
exports.Button = require_parts.Button;
|
|
28
|
+
exports.Menu = require_parts.Menu;
|
|
29
|
+
exports.MenuItem = require_parts.MenuItem;
|
|
30
|
+
exports.PDFViewer = PDFViewer;
|
|
31
|
+
exports.Panel = require_parts.Panel;
|
|
32
|
+
exports.Region = require_parts.Region;
|
|
33
|
+
exports.ToolbarItem = require_parts.ToolbarItem;
|
|
34
|
+
Object.defineProperty(exports, "useCommand", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function() {
|
|
37
|
+
return _embedpdf_react_commands.useCommand;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
exports.usePDFViewer = require_parts.usePDFViewer;
|
|
41
|
+
exports.useToolbarItem = require_parts.useToolbarItem;
|
|
25
42
|
Object.keys(_embedpdf_viewer).forEach(function(k) {
|
|
26
43
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
27
44
|
enumerable: true,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @embedpdf/viewer-react — the full viewer as a React component, with the\n * built-in
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["PDFViewerImpl"],"sources":["../src/index.ts"],"sourcesContent":["'use client';\n/**\n * @embedpdf/viewer-react — the full viewer as a React component, with the\n * built-in local engine (PDFium wasm in a worker) as the default.\n *\n * ```tsx\n * import { PDFViewer } from '@embedpdf/viewer-react';\n *\n * <PDFViewer src=\"/report.pdf\" style={{ height: '100vh' }} />\n * ```\n *\n * Zero config: no `engine` prop, no bundler setup. This is the door app code\n * should use. Builds that always inject their own engine — a cloud deployment,\n * a self-hosted `@cloudpdf/server` — import `@embedpdf/viewer-react/core`\n * instead, which is the same component with PDFium structurally absent.\n *\n * The component itself lives in `./component` and is engine-blind; the one\n * import below is what makes this entry the local-engine door.\n */\nimport '@embedpdf/viewer';\n\nimport type { ViewerConfig } from '@embedpdf/viewer';\n\nimport { PDFViewer as PDFViewerImpl, type PDFViewerExtras } from './parts';\n\nexport * from '@embedpdf/viewer';\nexport * from './parts';\n\nexport type PDFViewerProps = ViewerConfig & PDFViewerExtras;\n\nexport const PDFViewer: (props: PDFViewerProps) => ReturnType<typeof PDFViewerImpl> = PDFViewerImpl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,YAAyEA,cAAAA"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { _ as PDFViewer$1, a as MenuItemProps, c as PanelProps, d as RegionProps, f as ToolbarItem, g as usePDFViewer, h as useCommand, i as MenuItem, l as Region, m as useToolbarItem, n as ButtonProps, o as MenuProps, p as ToolbarItemProps, r as Menu, s as Panel, t as Button, u as RegionName, v as PDFViewerExtras, y as PDFViewerImplProps } from "./parts-CDiQnn2K.cjs";
|
|
2
2
|
import { ViewerConfig } from "@embedpdf/viewer";
|
|
3
3
|
export * from "@embedpdf/viewer";
|
|
4
4
|
//#region src/index.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Props on THIS door: `engine` is OPTIONAL — omit it for the built-in local
|
|
7
|
-
* engine (zero bundler config; your bundler ships `embedpdf.wasm` inside your own
|
|
8
|
-
* build, sibling-first with a pinned-CDN fetch-failure fallback), or pass its
|
|
9
|
-
* options bag (`{ wasmUrl }` / `{ assetsUrl }` / worker URLs for strict CSP).
|
|
10
|
-
*/
|
|
11
5
|
type PDFViewerProps = ViewerConfig & PDFViewerExtras;
|
|
6
|
+
declare const PDFViewer: (props: PDFViewerProps) => ReturnType<typeof PDFViewer$1>;
|
|
12
7
|
//#endregion
|
|
13
|
-
export { PDFViewer, type PDFViewerExtras, PDFViewerProps };
|
|
8
|
+
export { Button, type ButtonProps, Menu, MenuItem, type MenuItemProps, type MenuProps, PDFViewer, type PDFViewerExtras, type PDFViewerImplProps, PDFViewerProps, Panel, type PanelProps, Region, type RegionName, type RegionProps, ToolbarItem, type ToolbarItemProps, useCommand, usePDFViewer, useToolbarItem };
|
|
14
9
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { _ as PDFViewer$1, a as MenuItemProps, c as PanelProps, d as RegionProps, f as ToolbarItem, g as usePDFViewer, h as useCommand, i as MenuItem, l as Region, m as useToolbarItem, n as ButtonProps, o as MenuProps, p as ToolbarItemProps, r as Menu, s as Panel, t as Button, u as RegionName, v as PDFViewerExtras, y as PDFViewerImplProps } from "./parts-U3eTUt92.js";
|
|
2
2
|
import { ViewerConfig } from "@embedpdf/viewer";
|
|
3
3
|
export * from "@embedpdf/viewer";
|
|
4
4
|
//#region src/index.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Props on THIS door: `engine` is OPTIONAL — omit it for the built-in local
|
|
7
|
-
* engine (zero bundler config; your bundler ships `embedpdf.wasm` inside your own
|
|
8
|
-
* build, sibling-first with a pinned-CDN fetch-failure fallback), or pass its
|
|
9
|
-
* options bag (`{ wasmUrl }` / `{ assetsUrl }` / worker URLs for strict CSP).
|
|
10
|
-
*/
|
|
11
5
|
type PDFViewerProps = ViewerConfig & PDFViewerExtras;
|
|
6
|
+
declare const PDFViewer: (props: PDFViewerProps) => ReturnType<typeof PDFViewer$1>;
|
|
12
7
|
//#endregion
|
|
13
|
-
export { PDFViewer, type PDFViewerExtras, PDFViewerProps };
|
|
8
|
+
export { Button, type ButtonProps, Menu, MenuItem, type MenuItemProps, type MenuProps, PDFViewer, type PDFViewerExtras, type PDFViewerImplProps, PDFViewerProps, Panel, type PanelProps, Region, type RegionName, type RegionProps, ToolbarItem, type ToolbarItemProps, useCommand, usePDFViewer, useToolbarItem };
|
|
14
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as Region, c as PDFViewer$1, i as Panel, l as useCommand, n as Menu, o as ToolbarItem, r as MenuItem, s as useToolbarItem, t as Button, u as usePDFViewer } from "./parts-BNOPi71I.js";
|
|
2
3
|
import "@embedpdf/viewer";
|
|
3
4
|
export * from "@embedpdf/viewer";
|
|
4
|
-
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
const PDFViewer = PDFViewer$1;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Button, Menu, MenuItem, PDFViewer, Panel, Region, ToolbarItem, useCommand, usePDFViewer, useToolbarItem };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["PDFViewerImpl"],"sources":["../src/index.ts"],"sourcesContent":["'use client';\n/**\n * @embedpdf/viewer-react — the full viewer as a React component, with the\n * built-in local engine (PDFium wasm in a worker) as the default.\n *\n * ```tsx\n * import { PDFViewer } from '@embedpdf/viewer-react';\n *\n * <PDFViewer src=\"/report.pdf\" style={{ height: '100vh' }} />\n * ```\n *\n * Zero config: no `engine` prop, no bundler setup. This is the door app code\n * should use. Builds that always inject their own engine — a cloud deployment,\n * a self-hosted `@cloudpdf/server` — import `@embedpdf/viewer-react/core`\n * instead, which is the same component with PDFium structurally absent.\n *\n * The component itself lives in `./component` and is engine-blind; the one\n * import below is what makes this entry the local-engine door.\n */\nimport '@embedpdf/viewer';\n\nimport type { ViewerConfig } from '@embedpdf/viewer';\n\nimport { PDFViewer as PDFViewerImpl, type PDFViewerExtras } from './parts';\n\nexport * from '@embedpdf/viewer';\nexport * from './parts';\n\nexport type PDFViewerProps = ViewerConfig & PDFViewerExtras;\n\nexport const PDFViewer: (props: PDFViewerProps) => ReturnType<typeof PDFViewerImpl> = PDFViewerImpl;\n"],"mappings":";;;;;AA8BA,MAAa,YAAyEA"}
|