@embedpdf/react 3.0.0-next.13 → 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/dist/AnnotationList-CkijRHet-HEFNUIZe.d.cts +877 -0
- package/dist/AnnotationList-CkijRHet-HEFNUIZe.d.ts +877 -0
- package/dist/actions.cjs +25 -5
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.d.cts +18 -5
- package/dist/actions.d.ts +18 -5
- package/dist/actions.js +22 -6
- package/dist/actions.js.map +1 -1
- package/dist/anchored-DeX95xSd.d.ts +85 -0
- package/dist/anchored-DzN3JywS.d.cts +85 -0
- package/dist/anchored.cjs +71 -28
- package/dist/anchored.cjs.map +1 -1
- package/dist/anchored.d.cts +2 -45
- package/dist/anchored.d.ts +2 -45
- package/dist/anchored.js +56 -19
- package/dist/anchored.js.map +1 -1
- package/dist/annotation-B48UT2ln.d.ts +302 -0
- package/dist/annotation-C1ttM8Wj.js +708 -0
- package/dist/annotation-C1ttM8Wj.js.map +1 -0
- package/dist/annotation-C9dVwo9b.d.cts +302 -0
- package/dist/annotation-Dex5EBda.cjs +830 -0
- package/dist/annotation-Dex5EBda.cjs.map +1 -0
- package/dist/annotation.cjs +20 -783
- package/dist/annotation.d.cts +2 -2
- package/dist/annotation.d.ts +2 -2
- package/dist/annotation.js +2 -768
- package/dist/commands.cjs +68 -28
- package/dist/commands.cjs.map +1 -1
- package/dist/commands.d.cts +37 -10
- package/dist/commands.d.ts +37 -10
- package/dist/commands.js +68 -31
- package/dist/commands.js.map +1 -1
- package/dist/form-55izw0jS.js +511 -0
- package/dist/form-55izw0jS.js.map +1 -0
- package/dist/form-BNqQfGGH.cjs +548 -0
- package/dist/form-BNqQfGGH.cjs.map +1 -0
- package/dist/form.cjs +5 -5
- package/dist/form.d.cts +32 -25
- package/dist/form.d.ts +32 -25
- package/dist/form.js +2 -3
- package/dist/history.cjs +38 -0
- package/dist/history.cjs.map +1 -0
- package/dist/history.d.cts +27 -0
- package/dist/history.d.ts +27 -0
- package/dist/history.js +27 -0
- package/dist/history.js.map +1 -0
- package/dist/i18n.cjs +26 -30
- package/dist/i18n.cjs.map +1 -1
- package/dist/i18n.d.cts +24 -21
- package/dist/i18n.d.ts +24 -21
- package/dist/i18n.js +24 -31
- package/dist/i18n.js.map +1 -1
- package/dist/index.cjs +213 -57
- package/dist/index.d.cts +32 -31
- package/dist/index.d.ts +32 -31
- package/dist/index.js +33 -29
- package/dist/inert-CmBEbKCn.cjs +19 -0
- package/dist/inert-CmBEbKCn.cjs.map +1 -0
- package/dist/inert-D8fkennb.js +14 -0
- package/dist/inert-D8fkennb.js.map +1 -0
- package/dist/interaction.cjs +48 -102
- package/dist/interaction.cjs.map +1 -1
- package/dist/interaction.d.cts +23 -32
- package/dist/interaction.d.ts +23 -32
- package/dist/interaction.js +33 -102
- package/dist/interaction.js.map +1 -1
- package/dist/link.cjs +65 -104
- package/dist/link.cjs.map +1 -1
- package/dist/link.d.cts +21 -16
- package/dist/link.d.ts +22 -17
- package/dist/link.js +67 -107
- package/dist/link.js.map +1 -1
- package/dist/measurement.cjs +56 -0
- package/dist/measurement.cjs.map +1 -0
- package/dist/measurement.d.cts +38 -0
- package/dist/measurement.d.ts +38 -0
- package/dist/measurement.js +42 -0
- package/dist/measurement.js.map +1 -0
- package/dist/metadata.cjs +20 -7
- package/dist/metadata.cjs.map +1 -1
- package/dist/metadata.d.cts +22 -7
- package/dist/metadata.d.ts +22 -7
- package/dist/metadata.js +20 -10
- package/dist/metadata.js.map +1 -1
- package/dist/page-edit.cjs +7 -3
- package/dist/page-edit.cjs.map +1 -1
- package/dist/page-edit.d.cts +6 -2
- package/dist/page-edit.d.ts +6 -2
- package/dist/page-edit.js +7 -4
- package/dist/page-edit.js.map +1 -1
- package/dist/page-layers-Bkaaz8Zf.js +26 -0
- package/dist/page-layers-Bkaaz8Zf.js.map +1 -0
- package/dist/page-layers-BloZDoOV.cjs +37 -0
- package/dist/page-layers-BloZDoOV.cjs.map +1 -0
- package/dist/page-view.cjs +89 -82
- package/dist/page-view.cjs.map +1 -1
- package/dist/page-view.d.cts +14 -7
- package/dist/page-view.d.ts +18 -11
- package/dist/page-view.js +86 -81
- package/dist/page-view.js.map +1 -1
- package/dist/redaction.cjs +30 -15
- package/dist/redaction.cjs.map +1 -1
- package/dist/redaction.d.cts +27 -9
- package/dist/redaction.d.ts +27 -9
- package/dist/redaction.js +29 -18
- package/dist/redaction.js.map +1 -1
- package/dist/render.cjs +71 -46
- package/dist/render.cjs.map +1 -1
- package/dist/render.d.cts +17 -5
- package/dist/render.d.ts +17 -5
- package/dist/render.js +70 -49
- package/dist/render.js.map +1 -1
- package/dist/runtime-B6xcPsEb.js +398 -0
- package/dist/runtime-B6xcPsEb.js.map +1 -0
- package/dist/runtime-DBEBlpQV.d.cts +237 -0
- package/dist/runtime-V3MVMb91.d.ts +237 -0
- package/dist/runtime-fzpGv78v.cjs +555 -0
- package/dist/runtime-fzpGv78v.cjs.map +1 -0
- package/dist/runtime.cjs +45 -324
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +2 -306
- package/dist/search.cjs +81 -50
- package/dist/search.cjs.map +1 -1
- package/dist/search.d.cts +36 -24
- package/dist/search.d.ts +36 -24
- package/dist/search.js +81 -53
- package/dist/search.js.map +1 -1
- package/dist/selection.cjs +105 -108
- package/dist/selection.cjs.map +1 -1
- package/dist/selection.d.cts +54 -26
- package/dist/selection.d.ts +56 -28
- package/dist/selection.js +103 -110
- package/dist/selection.js.map +1 -1
- package/dist/shell.cjs +36 -21
- package/dist/shell.cjs.map +1 -1
- package/dist/shell.d.cts +32 -17
- package/dist/shell.d.ts +32 -17
- package/dist/shell.js +36 -24
- package/dist/shell.js.map +1 -1
- package/dist/signature.cjs +29 -48
- package/dist/signature.cjs.map +1 -1
- package/dist/signature.d.cts +26 -26
- package/dist/signature.d.ts +26 -26
- package/dist/signature.js +30 -48
- package/dist/signature.js.map +1 -1
- package/dist/stage-BIG6aeVd.cjs +369 -0
- package/dist/stage-BIG6aeVd.cjs.map +1 -0
- package/dist/stage-ByFPD-Fv.d.cts +117 -0
- package/dist/stage-DaboaheR.d.ts +117 -0
- package/dist/stage-DoVekb83.js +302 -0
- package/dist/stage-DoVekb83.js.map +1 -0
- package/dist/stage-scope-CQgCuf1w.cjs +46 -0
- package/dist/stage-scope-CQgCuf1w.cjs.map +1 -0
- package/dist/stage-scope-D7ZeNduT.js +23 -0
- package/dist/stage-scope-D7ZeNduT.js.map +1 -0
- package/dist/stage.cjs +12 -235
- package/dist/stage.d.cts +2 -116
- package/dist/stage.d.ts +2 -116
- package/dist/stage.js +3 -228
- package/dist/stamp.cjs +41 -35
- package/dist/stamp.cjs.map +1 -1
- package/dist/stamp.d.cts +25 -18
- package/dist/stamp.d.ts +25 -18
- package/dist/stamp.js +40 -37
- package/dist/stamp.js.map +1 -1
- package/dist/state-0K1I5cM4.d.cts +29 -0
- package/dist/state-0K1I5cM4.d.ts +29 -0
- package/dist/state-CbgxhwLA.js +62 -0
- package/dist/state-CbgxhwLA.js.map +1 -0
- package/dist/state-CsfZy_Eq.cjs +73 -0
- package/dist/state-CsfZy_Eq.cjs.map +1 -0
- package/dist/svg-shapes-Dm1yTR1b.js +40 -0
- package/dist/svg-shapes-Dm1yTR1b.js.map +1 -0
- package/dist/svg-shapes-zo0GNkc9.cjs +53 -0
- package/dist/svg-shapes-zo0GNkc9.cjs.map +1 -0
- package/dist/toolbar.cjs +297 -295
- package/dist/toolbar.cjs.map +1 -1
- package/dist/toolbar.d.cts +58 -68
- package/dist/toolbar.d.ts +67 -77
- package/dist/toolbar.js +271 -293
- package/dist/toolbar.js.map +1 -1
- package/dist/view-manager.cjs +34 -0
- package/dist/view-manager.cjs.map +1 -0
- package/dist/view-manager.d.cts +21 -0
- package/dist/view-manager.d.ts +21 -0
- package/dist/view-manager.js +23 -0
- package/dist/view-manager.js.map +1 -0
- package/package.json +41 -38
- package/dist/AnnotationListSnapshot-D3mFut1e-C_GMpK25.d.cts +0 -546
- package/dist/AnnotationListSnapshot-D3mFut1e-C_GMpK25.d.ts +0 -546
- package/dist/annotation-BCED_p9H.d.cts +0 -160
- package/dist/annotation-anchors-CetwM1g7.js +0 -15
- package/dist/annotation-anchors-CetwM1g7.js.map +0 -1
- package/dist/annotation-anchors-DuYRBJLl.cjs +0 -26
- package/dist/annotation-anchors-DuYRBJLl.cjs.map +0 -1
- package/dist/annotation-hooks-BB5ZhPpf.cjs +0 -16
- package/dist/annotation-hooks-BB5ZhPpf.cjs.map +0 -1
- package/dist/annotation-hooks-Df8EmzDO.js +0 -11
- package/dist/annotation-hooks-Df8EmzDO.js.map +0 -1
- package/dist/annotation-k38KDlIZ.d.ts +0 -160
- package/dist/annotation-menu.cjs +0 -64
- package/dist/annotation-menu.cjs.map +0 -1
- package/dist/annotation-menu.d.cts +0 -33
- package/dist/annotation-menu.d.ts +0 -33
- package/dist/annotation-menu.js +0 -48
- package/dist/annotation-menu.js.map +0 -1
- package/dist/annotation.cjs.map +0 -1
- package/dist/annotation.js.map +0 -1
- package/dist/form-BVumS7up.cjs +0 -926
- package/dist/form-BVumS7up.cjs.map +0 -1
- package/dist/form-CK3mp99m.js +0 -895
- package/dist/form-CK3mp99m.js.map +0 -1
- package/dist/rolldown-runtime-BBjsoOtd.js +0 -27
- package/dist/runtime-DE76hlnl.d.ts +0 -216
- package/dist/runtime-umHA_xHt.d.cts +0 -216
- package/dist/runtime.cjs.map +0 -1
- package/dist/runtime.js.map +0 -1
- package/dist/scrollbar.cjs +0 -241
- package/dist/scrollbar.cjs.map +0 -1
- package/dist/scrollbar.d.cts +0 -42
- package/dist/scrollbar.d.ts +0 -42
- package/dist/scrollbar.js +0 -213
- package/dist/scrollbar.js.map +0 -1
- package/dist/stage.cjs.map +0 -1
- package/dist/stage.js.map +0 -1
- package/dist/views.cjs +0 -35
- package/dist/views.cjs.map +0 -1
- package/dist/views.d.cts +0 -21
- package/dist/views.d.ts +0 -21
- package/dist/views.js +0 -27
- package/dist/views.js.map +0 -1
package/dist/metadata.d.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as StateHook } from "./state-0K1I5cM4.js";
|
|
2
|
+
import { EventHook } from "@embedpdf/core";
|
|
3
|
+
import { MetadataCapability } from "@embedpdf/plugin-metadata";
|
|
2
4
|
export * from "@embedpdf/plugin-metadata";
|
|
3
5
|
//#region src/metadata.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The metadata capability (update, custom.update, refresh, canUpdate) of the
|
|
8
|
+
* surrounding `<DocumentScope>`'s document, else the active one. Outside a
|
|
9
|
+
* document, every method throws `not-ready`.
|
|
10
|
+
*/
|
|
11
|
+
declare function useMetadata(): MetadataCapability;
|
|
12
|
+
/**
|
|
13
|
+
* The metadata's state: the standard fields, your own fields and the load
|
|
14
|
+
* state (the page's State table, declared once in `metadataState`). Takes a
|
|
15
|
+
* selector, and re-renders only when what it returns changes.
|
|
16
|
+
*/
|
|
17
|
+
declare const useMetadataState: StateHook<{
|
|
18
|
+
metadata: import("@embedpdf/core").DocumentMetadata | null;
|
|
19
|
+
custom: import("@embedpdf/core").CustomMetadata | null;
|
|
20
|
+
status: import("@embedpdf/core").ResourceStatus;
|
|
21
|
+
}>;
|
|
22
|
+
/** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */
|
|
23
|
+
declare function useMetadataEvent<T>(select: (metadata: MetadataCapability) => EventHook<T>, handler: (event: T) => void): void;
|
|
9
24
|
//#endregion
|
|
10
|
-
export { useMetadata };
|
|
25
|
+
export { useMetadata, useMetadataEvent, useMetadataState };
|
|
11
26
|
//# sourceMappingURL=metadata.d.ts.map
|
package/dist/metadata.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import { MetadataToken } from "@embedpdf/plugin-metadata";
|
|
1
|
+
import { f as useCapability, p as useCapabilityEvent } from "./runtime-B6xcPsEb.js";
|
|
2
|
+
import { n as stateHook } from "./state-CbgxhwLA.js";
|
|
3
|
+
import { MetadataToken, metadataState } from "@embedpdf/plugin-metadata";
|
|
4
4
|
export * from "@embedpdf/plugin-metadata";
|
|
5
5
|
//#region src/metadata.ts
|
|
6
|
+
/**
|
|
7
|
+
* The metadata capability (update, custom.update, refresh, canUpdate) of the
|
|
8
|
+
* surrounding `<DocumentScope>`'s document, else the active one. Outside a
|
|
9
|
+
* document, every method throws `not-ready`.
|
|
10
|
+
*/
|
|
6
11
|
function useMetadata() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
return useCapability(MetadataToken);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The metadata's state: the standard fields, your own fields and the load
|
|
16
|
+
* state (the page's State table, declared once in `metadataState`). Takes a
|
|
17
|
+
* selector, and re-renders only when what it returns changes.
|
|
18
|
+
*/
|
|
19
|
+
const useMetadataState = stateHook(metadataState);
|
|
20
|
+
/** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */
|
|
21
|
+
function useMetadataEvent(select, handler) {
|
|
22
|
+
useCapabilityEvent(MetadataToken, select, handler);
|
|
13
23
|
}
|
|
14
24
|
//#endregion
|
|
15
|
-
export { useMetadata };
|
|
25
|
+
export { useMetadata, useMetadataEvent, useMetadataState };
|
|
16
26
|
|
|
17
27
|
//# sourceMappingURL=metadata.js.map
|
package/dist/metadata.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","names":[],"sources":["../src/metadata.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"metadata.js","names":[],"sources":["../src/metadata.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-metadata: the capability, the state\n * declared once in `metadataState`, and its events. The plugin keeps the\n * metadata live off the document event stream, so the state updates after\n * your own edits and after other sessions'.\n *\n * const metadata = useMetadata();\n * const { metadata: fields, custom, status } = useMetadataState();\n * await metadata.update({ title: 'New title' }); // resolves once the state shows it\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-metadata';\nimport { MetadataToken, metadataState, type MetadataCapability } from '@embedpdf/plugin-metadata';\nimport type { EventHook } from '@embedpdf/core';\nimport { useCapability, useCapabilityEvent } from './runtime';\nimport { stateHook } from './state';\n\n/**\n * The metadata capability (update, custom.update, refresh, canUpdate) of the\n * surrounding `<DocumentScope>`'s document, else the active one. Outside a\n * document, every method throws `not-ready`.\n */\nexport function useMetadata(): MetadataCapability {\n return useCapability(MetadataToken);\n}\n\n/**\n * The metadata's state: the standard fields, your own fields and the load\n * state (the page's State table, declared once in `metadataState`). Takes a\n * selector, and re-renders only when what it returns changes.\n */\nexport const useMetadataState = stateHook(metadataState);\n\n/** Subscribe to one metadata event for the mounted lifetime: `useMetadataEvent((metadata) => metadata.onUpdated, handler)`. */\nexport function useMetadataEvent<T>(\n select: (metadata: MetadataCapability) => EventHook<T>,\n handler: (event: T) => void,\n): void {\n useCapabilityEvent(MetadataToken, select, handler);\n}\n"],"mappings":";;;;;;;;;;AAuBA,SAAgB,cAAkC;CAChD,OAAO,cAAc,aAAa;AACpC;;;;;;AAOA,MAAa,mBAAmB,UAAU,aAAa;;AAGvD,SAAgB,iBACd,QACA,SACM;CACN,mBAAmB,eAAe,QAAQ,OAAO;AACnD"}
|
package/dist/page-edit.cjs
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./rolldown-runtime-DDXJien1.cjs");
|
|
3
|
-
const require_runtime = require("./runtime.cjs");
|
|
3
|
+
const require_runtime = require("./runtime-fzpGv78v.cjs");
|
|
4
4
|
let _embedpdf_plugin_page_edit = require("@embedpdf/plugin-page-edit");
|
|
5
5
|
//#region src/page-edit.ts
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The page edits of the surrounding `<DocumentScope>`'s document, else the
|
|
8
|
+
* active one. Outside a document, every method throws `not-ready`.
|
|
9
|
+
*/
|
|
10
|
+
function usePageEdit() {
|
|
7
11
|
return require_runtime.useCapability(_embedpdf_plugin_page_edit.PageEditToken);
|
|
8
12
|
}
|
|
9
13
|
//#endregion
|
|
10
|
-
exports.
|
|
14
|
+
exports.usePageEdit = usePageEdit;
|
|
11
15
|
Object.keys(_embedpdf_plugin_page_edit).forEach(function(k) {
|
|
12
16
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
13
17
|
enumerable: true,
|
package/dist/page-edit.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-edit.cjs","names":["useCapability","PageEditToken"],"sources":["../src/page-edit.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"page-edit.cjs","names":["useCapability","PageEditToken"],"sources":["../src/page-edit.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-page-edit. The plugin turns a page\n * relative to its rotation and resolves placements, so this file is binding\n * only:\n *\n * const pageEdit = usePageEdit();\n * await pageEdit.rotateBy([page.ref], 90);\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-page-edit';\nimport { PageEditToken, type PageEditCapability } from '@embedpdf/plugin-page-edit';\nimport { useCapability } from './runtime';\n\n/**\n * The page edits of the surrounding `<DocumentScope>`'s document, else the\n * active one. Outside a document, every method throws `not-ready`.\n */\nexport function usePageEdit(): PageEditCapability {\n return useCapability(PageEditToken);\n}\n"],"mappings":";;;;;;;;;AAkBA,SAAgB,cAAkC;CAChD,OAAOA,gBAAAA,cAAcC,2BAAAA,aAAa;AACpC"}
|
package/dist/page-edit.d.cts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { PageEditCapability } from "@embedpdf/plugin-page-edit";
|
|
2
2
|
export * from "@embedpdf/plugin-page-edit";
|
|
3
3
|
//#region src/page-edit.d.ts
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The page edits of the surrounding `<DocumentScope>`'s document, else the
|
|
6
|
+
* active one. Outside a document, every method throws `not-ready`.
|
|
7
|
+
*/
|
|
8
|
+
declare function usePageEdit(): PageEditCapability;
|
|
5
9
|
//#endregion
|
|
6
|
-
export {
|
|
10
|
+
export { usePageEdit };
|
|
7
11
|
//# sourceMappingURL=page-edit.d.cts.map
|
package/dist/page-edit.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { PageEditCapability } from "@embedpdf/plugin-page-edit";
|
|
2
2
|
export * from "@embedpdf/plugin-page-edit";
|
|
3
3
|
//#region src/page-edit.d.ts
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The page edits of the surrounding `<DocumentScope>`'s document, else the
|
|
6
|
+
* active one. Outside a document, every method throws `not-ready`.
|
|
7
|
+
*/
|
|
8
|
+
declare function usePageEdit(): PageEditCapability;
|
|
5
9
|
//#endregion
|
|
6
|
-
export {
|
|
10
|
+
export { usePageEdit };
|
|
7
11
|
//# sourceMappingURL=page-edit.d.ts.map
|
package/dist/page-edit.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { useCapability } from "./runtime.js";
|
|
1
|
+
import { f as useCapability } from "./runtime-B6xcPsEb.js";
|
|
3
2
|
import { PageEditToken } from "@embedpdf/plugin-page-edit";
|
|
4
3
|
export * from "@embedpdf/plugin-page-edit";
|
|
5
4
|
//#region src/page-edit.ts
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The page edits of the surrounding `<DocumentScope>`'s document, else the
|
|
7
|
+
* active one. Outside a document, every method throws `not-ready`.
|
|
8
|
+
*/
|
|
9
|
+
function usePageEdit() {
|
|
7
10
|
return useCapability(PageEditToken);
|
|
8
11
|
}
|
|
9
12
|
//#endregion
|
|
10
|
-
export {
|
|
13
|
+
export { usePageEdit };
|
|
11
14
|
|
|
12
15
|
//# sourceMappingURL=page-edit.js.map
|
package/dist/page-edit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-edit.js","names":[],"sources":["../src/page-edit.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"page-edit.js","names":[],"sources":["../src/page-edit.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-page-edit. The plugin turns a page\n * relative to its rotation and resolves placements, so this file is binding\n * only:\n *\n * const pageEdit = usePageEdit();\n * await pageEdit.rotateBy([page.ref], 90);\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-page-edit';\nimport { PageEditToken, type PageEditCapability } from '@embedpdf/plugin-page-edit';\nimport { useCapability } from './runtime';\n\n/**\n * The page edits of the surrounding `<DocumentScope>`'s document, else the\n * active one. Outside a document, every method throws `not-ready`.\n */\nexport function usePageEdit(): PageEditCapability {\n return useCapability(PageEditToken);\n}\n"],"mappings":";;;;;;;;AAkBA,SAAgB,cAAkC;CAChD,OAAO,cAAc,aAAa;AACpC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { pageLayersOf } from "@embedpdf/web";
|
|
2
|
+
import { useInsertionEffect, useSyncExternalStore } from "react";
|
|
3
|
+
//#region src/page-layers.ts
|
|
4
|
+
/**
|
|
5
|
+
* The React side of `@embedpdf/web`'s page layers: a layer says, while it's
|
|
6
|
+
* mounted, which part of its page it paints, and the render layer reads which
|
|
7
|
+
* parts are painted, to leave them out of the page's picture.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Say, while mounted, that this layer paints `part` of its page (`pageRef`,
|
|
11
|
+
* the page context's `ref`). Said in an insertion effect, which runs before
|
|
12
|
+
* any layout effect of the same commit, so a render layer mounted alongside
|
|
13
|
+
* already plans its tiles without it.
|
|
14
|
+
*/
|
|
15
|
+
function usePaintsPagePart(pageRef, part) {
|
|
16
|
+
useInsertionEffect(() => pageLayersOf(pageRef).paint(part), [pageRef, part]);
|
|
17
|
+
}
|
|
18
|
+
/** Which parts of the page (`pageRef`, the page context's `ref`) the layers on it paint. */
|
|
19
|
+
function usePaintedParts(pageRef) {
|
|
20
|
+
const layers = pageLayersOf(pageRef);
|
|
21
|
+
return useSyncExternalStore(layers.subscribe, layers.painted, layers.painted);
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { usePaintsPagePart as n, usePaintedParts as t };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=page-layers-Bkaaz8Zf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-layers-Bkaaz8Zf.js","names":[],"sources":["../src/page-layers.ts"],"sourcesContent":["/**\n * The React side of `@embedpdf/web`'s page layers: a layer says, while it's\n * mounted, which part of its page it paints, and the render layer reads which\n * parts are painted, to leave them out of the page's picture.\n */\nimport { pageLayersOf, type PagePart, type PaintedParts } from '@embedpdf/web';\nimport { useInsertionEffect, useSyncExternalStore } from 'react';\n\n/**\n * Say, while mounted, that this layer paints `part` of its page (`pageRef`,\n * the page context's `ref`). Said in an insertion effect, which runs before\n * any layout effect of the same commit, so a render layer mounted alongside\n * already plans its tiles without it.\n */\nexport function usePaintsPagePart(pageRef: object, part: PagePart): void {\n useInsertionEffect(() => pageLayersOf(pageRef).paint(part), [pageRef, part]);\n}\n\n/** Which parts of the page (`pageRef`, the page context's `ref`) the layers on it paint. */\nexport function usePaintedParts(pageRef: object): PaintedParts {\n const layers = pageLayersOf(pageRef);\n return useSyncExternalStore(layers.subscribe, layers.painted, layers.painted);\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,SAAgB,kBAAkB,SAAiB,MAAsB;CACvE,yBAAyB,aAAa,OAAO,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,SAAS,IAAI,CAAC;AAC7E;;AAGA,SAAgB,gBAAgB,SAA+B;CAC7D,MAAM,SAAS,aAAa,OAAO;CACnC,OAAO,qBAAqB,OAAO,WAAW,OAAO,SAAS,OAAO,OAAO;AAC9E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
let _embedpdf_web = require("@embedpdf/web");
|
|
2
|
+
let react = require("react");
|
|
3
|
+
//#region src/page-layers.ts
|
|
4
|
+
/**
|
|
5
|
+
* The React side of `@embedpdf/web`'s page layers: a layer says, while it's
|
|
6
|
+
* mounted, which part of its page it paints, and the render layer reads which
|
|
7
|
+
* parts are painted, to leave them out of the page's picture.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Say, while mounted, that this layer paints `part` of its page (`pageRef`,
|
|
11
|
+
* the page context's `ref`). Said in an insertion effect, which runs before
|
|
12
|
+
* any layout effect of the same commit, so a render layer mounted alongside
|
|
13
|
+
* already plans its tiles without it.
|
|
14
|
+
*/
|
|
15
|
+
function usePaintsPagePart(pageRef, part) {
|
|
16
|
+
(0, react.useInsertionEffect)(() => (0, _embedpdf_web.pageLayersOf)(pageRef).paint(part), [pageRef, part]);
|
|
17
|
+
}
|
|
18
|
+
/** Which parts of the page (`pageRef`, the page context's `ref`) the layers on it paint. */
|
|
19
|
+
function usePaintedParts(pageRef) {
|
|
20
|
+
const layers = (0, _embedpdf_web.pageLayersOf)(pageRef);
|
|
21
|
+
return (0, react.useSyncExternalStore)(layers.subscribe, layers.painted, layers.painted);
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
Object.defineProperty(exports, "usePaintedParts", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function() {
|
|
27
|
+
return usePaintedParts;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "usePaintsPagePart", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function() {
|
|
33
|
+
return usePaintsPagePart;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=page-layers-BloZDoOV.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-layers-BloZDoOV.cjs","names":[],"sources":["../src/page-layers.ts"],"sourcesContent":["/**\n * The React side of `@embedpdf/web`'s page layers: a layer says, while it's\n * mounted, which part of its page it paints, and the render layer reads which\n * parts are painted, to leave them out of the page's picture.\n */\nimport { pageLayersOf, type PagePart, type PaintedParts } from '@embedpdf/web';\nimport { useInsertionEffect, useSyncExternalStore } from 'react';\n\n/**\n * Say, while mounted, that this layer paints `part` of its page (`pageRef`,\n * the page context's `ref`). Said in an insertion effect, which runs before\n * any layout effect of the same commit, so a render layer mounted alongside\n * already plans its tiles without it.\n */\nexport function usePaintsPagePart(pageRef: object, part: PagePart): void {\n useInsertionEffect(() => pageLayersOf(pageRef).paint(part), [pageRef, part]);\n}\n\n/** Which parts of the page (`pageRef`, the page context's `ref`) the layers on it paint. */\nexport function usePaintedParts(pageRef: object): PaintedParts {\n const layers = pageLayersOf(pageRef);\n return useSyncExternalStore(layers.subscribe, layers.painted, layers.painted);\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,SAAgB,kBAAkB,SAAiB,MAAsB;CACvE,CAAA,GAAA,MAAA,mBAAA,QAAA,GAAA,cAAA,aAAA,CAAsC,OAAO,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,SAAS,IAAI,CAAC;AAC7E;;AAGA,SAAgB,gBAAgB,SAA+B;CAC7D,MAAM,UAAA,GAAA,cAAA,aAAA,CAAsB,OAAO;CACnC,QAAA,GAAA,MAAA,qBAAA,CAA4B,OAAO,WAAW,OAAO,SAAS,OAAO,OAAO;AAC9E"}
|
package/dist/page-view.cjs
CHANGED
|
@@ -1,125 +1,132 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-DDXJien1.cjs");
|
|
3
|
-
const require_runtime = require("./runtime.cjs");
|
|
3
|
+
const require_runtime = require("./runtime-fzpGv78v.cjs");
|
|
4
4
|
const require_anchored = require("./anchored.cjs");
|
|
5
|
+
const require_interaction = require("./interaction.cjs");
|
|
5
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _embedpdf_core = require("@embedpdf/core");
|
|
8
|
+
let _embedpdf_web = require("@embedpdf/web");
|
|
6
9
|
let react = require("react");
|
|
7
10
|
react = require_rolldown_runtime.__toESM(react, 1);
|
|
8
|
-
let
|
|
11
|
+
let _embedpdf_plugin_interaction_contract_host = require("@embedpdf/plugin-interaction/contract/host");
|
|
9
12
|
let _embedpdf_core_geometry = require("@embedpdf/core-geometry");
|
|
10
13
|
//#region src/page-view.tsx
|
|
11
14
|
/**
|
|
12
|
-
* <PageView> — a single page surface with
|
|
15
|
+
* <PageView> — a single page surface with no Stage.
|
|
13
16
|
*
|
|
14
17
|
* Same layers + rotation + chrome frame as a `<Stage>` page, but no
|
|
15
|
-
* camera/scroll/zoom and, crucially,
|
|
18
|
+
* camera/scroll/zoom and, crucially, no dependency on `@embedpdf/plugin-stage`.
|
|
16
19
|
* It builds its own `PageTransform` from a target content width and shares the
|
|
17
20
|
* exact `PageContext` seam, so every layer (RenderLayer, AnnotationLayer, …)
|
|
18
21
|
* works here identically — and it provides the measured `ViewProjector`, so
|
|
19
22
|
* anchored UI (`<AnnotationMenu>`, `<SelectionMenu>`) works here too, portalled
|
|
20
|
-
* and clipping-immune.
|
|
23
|
+
* and clipping-immune. With the interaction plugin registered it is also the
|
|
24
|
+
* page's pointer surface, so tools (text selection, annotation editing) work in
|
|
25
|
+
* it as they do on a Stage page.
|
|
21
26
|
*/
|
|
22
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* The page's pointer surface, when the interaction plugin is registered. It sits
|
|
29
|
+
* below the layers, like the Stage's own listener: a press on a layer that lets
|
|
30
|
+
* the pointer through (the picture, the selection highlight) reaches the tools,
|
|
31
|
+
* and a control that takes its own presses (a link, a form field) keeps them.
|
|
32
|
+
*/
|
|
33
|
+
function PointerSurface() {
|
|
34
|
+
return require_runtime.useOptionalCapability(_embedpdf_plugin_interaction_contract_host.InteractionToken) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_interaction.PagePointerSource, {}) : null;
|
|
35
|
+
}
|
|
36
|
+
/** A single page surface with no Stage — same layers + rotation + chrome frame,
|
|
23
37
|
* no camera/scroll/zoom. */
|
|
24
|
-
function PageView({ page, documentId, width = 240, pageFrame
|
|
25
|
-
const
|
|
26
|
-
const
|
|
38
|
+
function PageView({ page: wanted, documentId, fallback = null, width = 240, pageFrame: framePatch, children, pageChrome, className, style }) {
|
|
39
|
+
const wantedRef = typeof wanted === "number" ? null : wanted;
|
|
40
|
+
const wantedIndex = typeof wanted === "number" ? wanted : null;
|
|
41
|
+
const { top = 0, right = 0, bottom = 0, left = 0 } = framePatch ?? _embedpdf_core_geometry.NO_FRAME;
|
|
42
|
+
const pageFrame = (0, react.useMemo)(() => ({
|
|
43
|
+
top,
|
|
44
|
+
right,
|
|
45
|
+
bottom,
|
|
46
|
+
left
|
|
47
|
+
}), [
|
|
48
|
+
top,
|
|
49
|
+
right,
|
|
50
|
+
bottom,
|
|
51
|
+
left
|
|
52
|
+
]);
|
|
53
|
+
const inScope = require_runtime.useDocumentId();
|
|
27
54
|
const ref = (0, react.useRef)(null);
|
|
28
|
-
const docId = documentId ??
|
|
29
|
-
const
|
|
30
|
-
const base =
|
|
31
|
-
|
|
32
|
-
|
|
55
|
+
const docId = documentId ?? inScope;
|
|
56
|
+
const wantedPageObjectNumber = wantedRef?.objectNumber ?? null;
|
|
57
|
+
const base = require_runtime.useKernelValue((kernel) => {
|
|
58
|
+
if (!docId) return null;
|
|
59
|
+
const pages = kernel.documents.listPages(docId);
|
|
60
|
+
return (wantedPageObjectNumber !== null ? pages.find((pageInfo) => pageInfo.ref.objectNumber === wantedPageObjectNumber) : pages[wantedIndex ?? 0]) ?? null;
|
|
61
|
+
});
|
|
62
|
+
const page = base?.index ?? wantedIndex ?? 0;
|
|
63
|
+
const pageObjectNumber = base?.ref.objectNumber ?? wantedPageObjectNumber ?? page + 1;
|
|
64
|
+
const pageRef = (0, react.useMemo)(() => (0, _embedpdf_core.toPageRef)(pageObjectNumber), [pageObjectNumber]);
|
|
33
65
|
const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
|
|
34
|
-
const transform = (0, react.useMemo)(() => (0, _embedpdf_core_geometry.pageTransform)(
|
|
35
|
-
pageSize: base ? {
|
|
36
|
-
width: base.size.width,
|
|
37
|
-
height: base.size.height
|
|
38
|
-
} : {
|
|
39
|
-
width: 1,
|
|
40
|
-
height: 1
|
|
41
|
-
},
|
|
42
|
-
rotation,
|
|
43
|
-
scale: base ? width / base.size.width : 1,
|
|
44
|
-
baseScale: 96 / 72 * (base?.userUnit ?? 1),
|
|
45
|
-
dpr
|
|
46
|
-
}), [
|
|
66
|
+
const transform = (0, react.useMemo)(() => (0, _embedpdf_core_geometry.pageTransform)((0, _embedpdf_web.pageViewTransformInput)(base, width, dpr)), [
|
|
47
67
|
base?.size.width,
|
|
48
68
|
base?.size.height,
|
|
49
69
|
base?.userUnit,
|
|
50
|
-
rotation,
|
|
70
|
+
base?.rotation,
|
|
51
71
|
width,
|
|
52
72
|
dpr
|
|
53
73
|
]);
|
|
54
74
|
const viewId = (0, react.useId)();
|
|
55
|
-
const ctx = (0, react.useMemo)(() =>
|
|
75
|
+
const ctx = (0, react.useMemo)(() => (0, _embedpdf_web.makePageContext)(docId ?? "", `page-view:${viewId}`, pageRef, page, pageFrame, transform, () => ref.current.getBoundingClientRect()), [
|
|
56
76
|
docId,
|
|
57
|
-
|
|
77
|
+
pageRef,
|
|
58
78
|
page,
|
|
59
79
|
pageFrame,
|
|
60
80
|
transform,
|
|
61
81
|
viewId
|
|
62
82
|
]);
|
|
63
|
-
const projector = (0, react.useMemo)(() => (
|
|
64
|
-
space: "client",
|
|
65
|
-
toScreen: (p, rect) => p === ctx.pon && ref.current ? ctx.toClientRect(rect) : null,
|
|
66
|
-
toScreenPoint: (p, at) => p === ctx.pon && ref.current ? ctx.toClientPoint(at) : null,
|
|
67
|
-
viewEnv: (p) => p === ctx.pon ? {
|
|
68
|
-
scale: ctx.transform.viewScale,
|
|
69
|
-
rotation: ctx.transform.rotation,
|
|
70
|
-
zoom: ctx.transform.zoom
|
|
71
|
-
} : null
|
|
72
|
-
}), [ctx]);
|
|
83
|
+
const projector = (0, react.useMemo)(() => (0, _embedpdf_web.clientPageProjector)(ctx, () => ref.current !== null), [ctx]);
|
|
73
84
|
const projectorBinding = (0, react.useMemo)(() => ({
|
|
74
85
|
projector,
|
|
75
86
|
revision: ctx,
|
|
76
87
|
subscribe: _embedpdf_web.observeClientGeometry
|
|
77
88
|
}), [projector, ctx]);
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
const contentLeft = pageFrame.left + (t.viewWidth - t.contentWidth) / 2;
|
|
83
|
-
const contentTop = pageFrame.top + (t.viewHeight - t.contentHeight) / 2;
|
|
89
|
+
const shownPages = (0, react.useMemo)(() => /* @__PURE__ */ new Set([ctx.ref.objectNumber]), [ctx.ref.objectNumber]);
|
|
90
|
+
const look = require_runtime.useViewerSettings((settings) => settings.page);
|
|
91
|
+
if (!docId || !base) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: fallback });
|
|
92
|
+
const layout = (0, _embedpdf_web.pageSurfaceLayout)(transform, pageFrame);
|
|
84
93
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_runtime.DocumentScope, {
|
|
85
94
|
id: docId,
|
|
86
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_anchored.
|
|
87
|
-
value:
|
|
88
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
width: t.viewWidth,
|
|
103
|
-
height: t.viewHeight,
|
|
104
|
-
boxShadow: "var(--epdf-page-shadow, 0 6px 18px rgba(0,0,0,.18))"
|
|
105
|
-
} }),
|
|
106
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
107
|
-
ref,
|
|
108
|
-
style: {
|
|
95
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_anchored.ShownPagesProvider, {
|
|
96
|
+
value: shownPages,
|
|
97
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_anchored.ProjectorProvider, {
|
|
98
|
+
value: projectorBinding,
|
|
99
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
100
|
+
className,
|
|
101
|
+
style: {
|
|
102
|
+
position: "relative",
|
|
103
|
+
width: layout.outer.width,
|
|
104
|
+
height: layout.outer.height,
|
|
105
|
+
...style
|
|
106
|
+
},
|
|
107
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_runtime.PageProvider, {
|
|
108
|
+
value: ctx,
|
|
109
|
+
children: [
|
|
110
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
|
|
109
111
|
position: "absolute",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
...layout.shadow,
|
|
113
|
+
boxShadow: (0, _embedpdf_web.paint)("page-shadow", look.shadow)
|
|
114
|
+
} }),
|
|
115
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
116
|
+
ref,
|
|
117
|
+
style: {
|
|
118
|
+
position: "absolute",
|
|
119
|
+
...layout.content,
|
|
120
|
+
background: (0, _embedpdf_web.paint)("page-background", look.background),
|
|
121
|
+
transform: layout.turn ?? void 0,
|
|
122
|
+
userSelect: "none",
|
|
123
|
+
WebkitUserSelect: "none"
|
|
124
|
+
},
|
|
125
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PointerSurface, {}), children]
|
|
126
|
+
}),
|
|
127
|
+
pageChrome
|
|
128
|
+
]
|
|
129
|
+
})
|
|
123
130
|
})
|
|
124
131
|
})
|
|
125
132
|
})
|
package/dist/page-view.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-view.cjs","names":["NO_FRAME","useKernel","useActiveDocumentId","makePageContext","observeClientGeometry","DocumentScope","ProjectorProvider","PageProvider"],"sources":["../src/page-view.tsx"],"sourcesContent":["/**\n * <PageView> — a single page surface with NO Stage.\n *\n * Same layers + rotation + chrome frame as a `<Stage>` page, but no\n * camera/scroll/zoom and, crucially, NO dependency on `@embedpdf/plugin-stage`.\n * It builds its own `PageTransform` from a target content width and shares the\n * exact `PageContext` seam, so every layer (RenderLayer, AnnotationLayer, …)\n * works here identically — and it provides the measured `ViewProjector`, so\n * anchored UI (`<AnnotationMenu>`, `<SelectionMenu>`) works here too, portalled\n * and clipping-immune.\n */\nimport * as React from 'react';\nimport { useId, useMemo, useRef } from 'react';\nimport { NO_FRAME, pageTransform, type PageFrame } from '@embedpdf/core-geometry';\nimport { observeClientGeometry } from '@embedpdf/web';\nimport { ProjectorProvider, type ProjectorBinding, type ViewProjector } from './anchored';\nimport {\n DocumentScope,\n makePageContext,\n PageProvider,\n useActiveDocumentId,\n useKernel,\n} from './runtime';\n\nexport interface PageViewProps {\n page: number;\n /** Which document to show. Defaults to the active document. */\n documentId?: string;\n /** Target width for the page CONTENT; the display box is the rotated footprint. */\n width?: number;\n /** Reserved chrome bands around the page (screen px) — same model as `<Stage>`. */\n pageFrame?: PageFrame;\n /** Page-space content (rotates with the page). */\n children: React.ReactNode;\n /** Box-space chrome (label, border, …) — never rotated. Mirrors `<Stage pageChrome>`. */\n pageChrome?: React.ReactNode;\n style?: React.CSSProperties;\n}\n\n/** A single page surface with NO Stage — same layers + rotation + chrome frame,\n * no camera/scroll/zoom. */\nexport function PageView({\n page,\n documentId,\n width = 240,\n pageFrame = NO_FRAME,\n children,\n pageChrome,\n style,\n}: PageViewProps) {\n const kernel = useKernel();\n const active = useActiveDocumentId();\n const ref = useRef<HTMLDivElement>(null);\n const docId = documentId ?? active;\n const meta = docId ? kernel.getState().core.documents[docId] : undefined;\n const base = meta?.pages[page];\n const pon = base?.pageObjectNumber ?? page + 1;\n const rotation = base?.rotation ?? 0;\n const dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;\n // Standalone (no Stage/camera): build the page's transform from the target\n // content `width` directly. `scale` is view px per point = width / pageWidthPts.\n const transform = useMemo(\n () =>\n pageTransform({\n pageSize: base\n ? { width: base.size.width, height: base.size.height }\n : { width: 1, height: 1 },\n rotation,\n scale: base ? width / base.size.width : 1,\n // Physical 100% on the web: 1pt = 96/72 CSS px, times the page's\n // /UserUnit — so `transform.zoom` is meaningful even without a Stage\n // (a thumbnail-sized PageView reads as zoomed out, as it should).\n baseScale: (96 / 72) * (base?.userUnit ?? 1),\n dpr,\n }),\n [base?.size.width, base?.size.height, base?.userUnit, rotation, width, dpr],\n );\n // This instance's VIEW identity: two PageViews of the same page (a compare\n // strip) must plan rasters independently, like two stage lenses do.\n const viewId = useId();\n const ctx = useMemo(\n () =>\n makePageContext(\n docId ?? '',\n `page-view:${viewId}`,\n pon,\n page,\n pageFrame,\n transform,\n () => ref.current!.getBoundingClientRect(),\n ),\n [docId, pon, page, pageFrame, transform, viewId],\n );\n // The PageView's ViewProjector: no camera, so anchored UI positions by\n // MEASURING the DOM (client space → portal + position:fixed, immune to\n // ancestor overflow clipping). `toScreen` answers null until the page\n // element has committed — <Anchored> forces one post-commit pass to pick\n // it up. The binding's revision covers state-driven changes (a new\n // transform/page); `observeClientGeometry` covers the genuinely\n // browser-driven ones (document scroll, window resize) that no state\n // change announces.\n const projector = useMemo<ViewProjector>(\n () => ({\n space: 'client',\n toScreen: (p, rect) => (p === ctx.pon && ref.current ? ctx.toClientRect(rect) : null),\n toScreenPoint: (p, at) => (p === ctx.pon && ref.current ? ctx.toClientPoint(at) : null),\n viewEnv: (p) =>\n p === ctx.pon\n ? {\n scale: ctx.transform.viewScale,\n rotation: ctx.transform.rotation,\n zoom: ctx.transform.zoom,\n }\n : null,\n }),\n [ctx],\n );\n const projectorBinding = useMemo<ProjectorBinding>(\n () => ({ projector, revision: ctx, subscribe: observeClientGeometry }),\n [projector, ctx],\n );\n if (!docId || !meta || !base) return null;\n const t = transform;\n const outerW = t.viewWidth + pageFrame.left + pageFrame.right;\n const outerH = t.viewHeight + pageFrame.top + pageFrame.bottom;\n const contentLeft = pageFrame.left + (t.viewWidth - t.contentWidth) / 2;\n const contentTop = pageFrame.top + (t.viewHeight - t.contentHeight) / 2;\n return (\n <DocumentScope id={docId}>\n <ProjectorProvider value={projectorBinding}>\n <div style={{ position: 'relative', width: outerW, height: outerH, ...style }}>\n <PageProvider value={ctx}>\n {/* drop shadow ONLY — transparent, axis-aligned, can't leak behind the bitmap */}\n <div\n style={{\n position: 'absolute',\n left: pageFrame.left,\n top: pageFrame.top,\n width: t.viewWidth,\n height: t.viewHeight,\n boxShadow: 'var(--epdf-page-shadow, 0 6px 18px rgba(0,0,0,.18))',\n }}\n />\n {/* white backing + content as ONE box; rotation 0 carries no transform */}\n <div\n ref={ref}\n style={{\n position: 'absolute',\n left: contentLeft,\n top: contentTop,\n width: t.contentWidth,\n height: t.contentHeight,\n background: '#fff',\n transform: rotation ? `rotate(${rotation}deg)` : undefined,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n }}\n >\n {children}\n </div>\n {pageChrome}\n </PageProvider>\n </div>\n </ProjectorProvider>\n </DocumentScope>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,SAAS,EACvB,MACA,YACA,QA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Y;QACZ,kBAAkB;OACpB;OAEC;MACE,CAAA;MACJ;KACW;;GACX,CAAA;EACc,CAAA;CACN,CAAA;AAEnB"}
|
|
1
|
+
{"version":3,"file":"page-view.cjs","names":["useOptionalCapability","InteractionHostToken","PagePointerSource","NO_FRAME","useDocumentId","useKernelValue","observeClientGeometry","useViewerSettings","DocumentScope","ShownPagesProvider","ProjectorProvider","PageProvider"],"sources":["../src/page-view.tsx"],"sourcesContent":["/**\n * <PageView> — a single page surface with no Stage.\n *\n * Same layers + rotation + chrome frame as a `<Stage>` page, but no\n * camera/scroll/zoom and, crucially, no dependency on `@embedpdf/plugin-stage`.\n * It builds its own `PageTransform` from a target content width and shares the\n * exact `PageContext` seam, so every layer (RenderLayer, AnnotationLayer, …)\n * works here identically — and it provides the measured `ViewProjector`, so\n * anchored UI (`<AnnotationMenu>`, `<SelectionMenu>`) works here too, portalled\n * and clipping-immune. With the interaction plugin registered it is also the\n * page's pointer surface, so tools (text selection, annotation editing) work in\n * it as they do on a Stage page.\n */\nimport * as React from 'react';\nimport { useId, useMemo, useRef } from 'react';\nimport { toPageRef } from '@embedpdf/core';\nimport type { PageRef } from '@embedpdf/core';\nimport { NO_FRAME, pageTransform, type PageFrame } from '@embedpdf/core-geometry';\nimport {\n clientPageProjector,\n makePageContext,\n observeClientGeometry,\n pageSurfaceLayout,\n pageViewTransformInput,\n paint,\n} from '@embedpdf/web';\nimport { InteractionToken as InteractionHostToken } from '@embedpdf/plugin-interaction/contract/host';\nimport {\n ProjectorProvider,\n ShownPagesProvider,\n type ProjectorBinding,\n type ShownPages,\n type ViewProjector,\n} from './anchored';\nimport { PagePointerSource } from './interaction';\nimport {\n DocumentScope,\n PageProvider,\n useDocumentId,\n useKernelValue,\n useOptionalCapability,\n useViewerSettings,\n} from './runtime';\n\n/**\n * The page's pointer surface, when the interaction plugin is registered. It sits\n * below the layers, like the Stage's own listener: a press on a layer that lets\n * the pointer through (the picture, the selection highlight) reaches the tools,\n * and a control that takes its own presses (a link, a form field) keeps them.\n */\nfunction PointerSurface() {\n const interaction = useOptionalCapability(InteractionHostToken);\n return interaction ? <PagePointerSource /> : null;\n}\n\nexport interface PageViewProps {\n /** The page: its `ref`, which follows it when pages move, or its index, from 0. */\n page: PageRef | number;\n /** Which document to show. Defaults to the one a `<DocumentScope>` names, else the active one. */\n documentId?: string;\n /** Shown while the document or the page is not available yet (default: nothing). */\n fallback?: React.ReactNode;\n /** The width of the page, in pixels; the display box is the rotated footprint. Default 240. */\n width?: number;\n /** Space reserved around the page for your own labels, in pixels per side; the sides left out are 0. */\n pageFrame?: Partial<PageFrame>;\n /** Page-space content (rotates with the page). */\n children: React.ReactNode;\n /** Box-space chrome (label, border, …) — never rotated. Mirrors `<Stage pageChrome>`. */\n pageChrome?: React.ReactNode;\n /** On the outer box. */\n className?: string;\n /** On the outer box. */\n style?: React.CSSProperties;\n}\n\n/** A single page surface with no Stage — same layers + rotation + chrome frame,\n * no camera/scroll/zoom. */\nexport function PageView({\n page: wanted,\n documentId,\n fallback = null,\n width = 240,\n pageFrame: framePatch,\n children,\n pageChrome,\n className,\n style,\n}: PageViewProps) {\n const wantedRef = typeof wanted === 'number' ? null : wanted;\n const wantedIndex = typeof wanted === 'number' ? wanted : null;\n // The sides left out reserve nothing; memoized by value so the context stays stable.\n const { top = 0, right = 0, bottom = 0, left = 0 } = framePatch ?? NO_FRAME;\n const pageFrame = useMemo<PageFrame>(\n () => ({ top, right, bottom, left }),\n [top, right, bottom, left],\n );\n const inScope = useDocumentId();\n const ref = useRef<HTMLDivElement>(null);\n const docId = documentId ?? inScope;\n // The page-registry entry, subscribed: a rotate or a reorder re-renders\n // this surface like it re-renders a Stage page. Entries are reference-\n // stable per page in the registry, so identity is the right equality.\n const wantedPageObjectNumber = wantedRef?.objectNumber ?? null;\n const base = useKernelValue((kernel) => {\n if (!docId) return null;\n const pages = kernel.documents.listPages(docId);\n const found =\n wantedPageObjectNumber !== null\n ? pages.find((pageInfo) => pageInfo.ref.objectNumber === wantedPageObjectNumber)\n : pages[wantedIndex ?? 0];\n return found ?? null;\n });\n const page = base?.index ?? wantedIndex ?? 0;\n // The page's address is the kernel's (`PageLayout.ref`); a placeholder\n // (object number = 1-based index) only until the layout is known — the\n // surface renders the fallback before that anyway. Memoized by the number so\n // the context's `ref` stays identity-stable across re-renders (layers key\n // effects on it).\n const pageObjectNumber = base?.ref.objectNumber ?? wantedPageObjectNumber ?? page + 1;\n const pageRef = useMemo(() => toPageRef(pageObjectNumber), [pageObjectNumber]);\n const dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;\n // Standalone (no Stage/camera): build the page's transform from the target\n // content `width` directly. Memoized by value: a new registry entry for an\n // unchanged page keeps the transform.\n const transform = useMemo(\n () => pageTransform(pageViewTransformInput(base, width, dpr)),\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `base` by the values it gives\n [base?.size.width, base?.size.height, base?.userUnit, base?.rotation, width, dpr],\n );\n // This instance's view identity: two PageViews of the same page (a compare\n // strip) must plan rasters independently, like two stage lenses do.\n const viewId = useId();\n const ctx = useMemo(\n () =>\n makePageContext(docId ?? '', `page-view:${viewId}`, pageRef, page, pageFrame, transform, () =>\n ref.current!.getBoundingClientRect(),\n ),\n [docId, pageRef, page, pageFrame, transform, viewId],\n );\n // The PageView's ViewProjector: no camera, so anchored UI positions by\n // measuring the DOM (client space → portal + position:fixed, immune to\n // ancestor overflow clipping). `toScreen` answers null until the page\n // element has committed — <Anchored> forces one post-commit pass to pick\n // it up. The binding's revision covers state-driven changes (a new\n // transform/page); `observeClientGeometry` covers the genuinely\n // browser-driven ones (document scroll, window resize) that no state\n // change announces.\n const projector = useMemo<ViewProjector>(\n () => clientPageProjector(ctx, () => ref.current !== null),\n [ctx],\n );\n const projectorBinding = useMemo<ProjectorBinding>(\n () => ({ projector, revision: ctx, subscribe: observeClientGeometry }),\n [projector, ctx],\n );\n // A PageView shows its one page.\n const shownPages = useMemo<ShownPages>(\n () => new Set([ctx.ref.objectNumber]),\n [ctx.ref.objectNumber],\n );\n // The viewer's `page` settings; `--epdf-page-*` CSS variables win over them.\n const look = useViewerSettings((settings) => settings.page);\n if (!docId || !base) return <>{fallback}</>;\n // The outer box (page and frame), the shadow at the footprint, and the turned content box.\n const layout = pageSurfaceLayout(transform, pageFrame);\n return (\n <DocumentScope id={docId}>\n <ShownPagesProvider value={shownPages}>\n <ProjectorProvider value={projectorBinding}>\n <div\n className={className}\n style={{\n position: 'relative',\n width: layout.outer.width,\n height: layout.outer.height,\n ...style,\n }}\n >\n <PageProvider value={ctx}>\n {/* drop shadow ONLY — transparent, axis-aligned, can't leak behind the bitmap */}\n <div\n style={{\n position: 'absolute',\n ...layout.shadow,\n boxShadow: paint('page-shadow', look.shadow),\n }}\n />\n {/* white backing + content as ONE box; rotation 0 carries no transform */}\n <div\n ref={ref}\n style={{\n position: 'absolute',\n ...layout.content,\n background: paint('page-background', look.background),\n transform: layout.turn ?? undefined,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n }}\n >\n <PointerSurface />\n {children}\n </div>\n {pageChrome}\n </PageProvider>\n </div>\n </ProjectorProvider>\n </ShownPagesProvider>\n </DocumentScope>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,iBAAiB;CAExB,OADoBA,gBAAAA,sBAAsBC,2CAAAA,gBACzB,IAAI,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,mBAAD,CAAoB,CAAA,IAAI;AAC/C;;;AAyBA,SAAgB,SAAS,EACvB,MAAM,QACN,YACA,WAAW,MACX,QAAQ,KACR,WAAW,YACX,UACA,YACA,WACA,SACgB;CAChB,MAAM,YAAY,OAAO,WAAW,WAAW,OAAO;CACtD,MAAM,cAAc,OAAO,WAAW,WAAW,SAAS;CAE1D,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,MAAM,cAAcC,wBAAAA;CACnE,MAAM,aAAA,GAAA,MAAA,QAAA,QACG;EAAE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,WAAW,OAAO,QAAQ,KAAA;SAC1B,YAAY;SACZ,kBAAkB;QACpB;QATF,UAAA,CAWE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAD,CAAiB,CAAA,GAChB,QACE;;OACJ;MACW;;IACX,CAAA;GACY,CAAA;EACD,CAAA;CACP,CAAA;AAEnB"}
|
package/dist/page-view.d.cts
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
|
+
import { PageRef } from "@embedpdf/core";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { PageFrame } from "@embedpdf/core-geometry";
|
|
3
4
|
//#region src/page-view.d.ts
|
|
4
5
|
interface PageViewProps {
|
|
5
|
-
page:
|
|
6
|
-
|
|
6
|
+
/** The page: its `ref`, which follows it when pages move, or its index, from 0. */
|
|
7
|
+
page: PageRef | number;
|
|
8
|
+
/** Which document to show. Defaults to the one a `<DocumentScope>` names, else the active one. */
|
|
7
9
|
documentId?: string;
|
|
8
|
-
/**
|
|
10
|
+
/** Shown while the document or the page is not available yet (default: nothing). */
|
|
11
|
+
fallback?: React.ReactNode;
|
|
12
|
+
/** The width of the page, in pixels; the display box is the rotated footprint. Default 240. */
|
|
9
13
|
width?: number;
|
|
10
|
-
/**
|
|
11
|
-
pageFrame?: PageFrame
|
|
14
|
+
/** Space reserved around the page for your own labels, in pixels per side; the sides left out are 0. */
|
|
15
|
+
pageFrame?: Partial<PageFrame>;
|
|
12
16
|
/** Page-space content (rotates with the page). */
|
|
13
17
|
children: React.ReactNode;
|
|
14
18
|
/** Box-space chrome (label, border, …) — never rotated. Mirrors `<Stage pageChrome>`. */
|
|
15
19
|
pageChrome?: React.ReactNode;
|
|
20
|
+
/** On the outer box. */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** On the outer box. */
|
|
16
23
|
style?: React.CSSProperties;
|
|
17
24
|
}
|
|
18
|
-
/** A single page surface with
|
|
25
|
+
/** A single page surface with no Stage — same layers + rotation + chrome frame,
|
|
19
26
|
* no camera/scroll/zoom. */
|
|
20
|
-
declare function PageView({ page, documentId, width, pageFrame, children, pageChrome, style }: PageViewProps): import("react/jsx-runtime").JSX.Element
|
|
27
|
+
declare function PageView({ page: wanted, documentId, fallback, width, pageFrame: framePatch, children, pageChrome, className, style }: PageViewProps): import("react/jsx-runtime").JSX.Element;
|
|
21
28
|
//#endregion
|
|
22
29
|
export { PageView, PageViewProps };
|
|
23
30
|
//# sourceMappingURL=page-view.d.cts.map
|
package/dist/page-view.d.ts
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PageRef } from "@embedpdf/core";
|
|
2
|
+
import * as React$1 from "react";
|
|
2
3
|
import { PageFrame } from "@embedpdf/core-geometry";
|
|
3
4
|
//#region src/page-view.d.ts
|
|
4
5
|
interface PageViewProps {
|
|
5
|
-
page:
|
|
6
|
-
|
|
6
|
+
/** The page: its `ref`, which follows it when pages move, or its index, from 0. */
|
|
7
|
+
page: PageRef | number;
|
|
8
|
+
/** Which document to show. Defaults to the one a `<DocumentScope>` names, else the active one. */
|
|
7
9
|
documentId?: string;
|
|
8
|
-
/**
|
|
10
|
+
/** Shown while the document or the page is not available yet (default: nothing). */
|
|
11
|
+
fallback?: React$1.ReactNode;
|
|
12
|
+
/** The width of the page, in pixels; the display box is the rotated footprint. Default 240. */
|
|
9
13
|
width?: number;
|
|
10
|
-
/**
|
|
11
|
-
pageFrame?: PageFrame
|
|
14
|
+
/** Space reserved around the page for your own labels, in pixels per side; the sides left out are 0. */
|
|
15
|
+
pageFrame?: Partial<PageFrame>;
|
|
12
16
|
/** Page-space content (rotates with the page). */
|
|
13
|
-
children: React.ReactNode;
|
|
17
|
+
children: React$1.ReactNode;
|
|
14
18
|
/** Box-space chrome (label, border, …) — never rotated. Mirrors `<Stage pageChrome>`. */
|
|
15
|
-
pageChrome?: React.ReactNode;
|
|
16
|
-
|
|
19
|
+
pageChrome?: React$1.ReactNode;
|
|
20
|
+
/** On the outer box. */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** On the outer box. */
|
|
23
|
+
style?: React$1.CSSProperties;
|
|
17
24
|
}
|
|
18
|
-
/** A single page surface with
|
|
25
|
+
/** A single page surface with no Stage — same layers + rotation + chrome frame,
|
|
19
26
|
* no camera/scroll/zoom. */
|
|
20
|
-
declare function PageView({ page, documentId, width, pageFrame, children, pageChrome, style }: PageViewProps): import("react/jsx-runtime").JSX.Element
|
|
27
|
+
declare function PageView({ page: wanted, documentId, fallback, width, pageFrame: framePatch, children, pageChrome, className, style }: PageViewProps): import("react/jsx-runtime").JSX.Element;
|
|
21
28
|
//#endregion
|
|
22
29
|
export { PageView, PageViewProps };
|
|
23
30
|
//# sourceMappingURL=page-view.d.ts.map
|