@embedpdf/react 3.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +192 -0
- package/dist/AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.d.cts +2593 -0
- package/dist/AnnotationListSnapshot-W0RCsyDE-dWna4TTJ.d.ts +2593 -0
- package/dist/annotation-B6jwfTCh.d.cts +173 -0
- package/dist/annotation-Ct6dFtzJ.cjs +913 -0
- package/dist/annotation-Ct6dFtzJ.cjs.map +1 -0
- package/dist/annotation-DjGWJljY.js +829 -0
- package/dist/annotation-DjGWJljY.js.map +1 -0
- package/dist/annotation-menu.cjs +115 -0
- package/dist/annotation-menu.cjs.map +1 -0
- package/dist/annotation-menu.d.cts +7 -0
- package/dist/annotation-menu.d.ts +7 -0
- package/dist/annotation-menu.js +99 -0
- package/dist/annotation-menu.js.map +1 -0
- package/dist/annotation-nUMefyjw.d.ts +173 -0
- package/dist/annotation.cjs +25 -0
- package/dist/annotation.d.cts +3 -0
- package/dist/annotation.d.ts +3 -0
- package/dist/annotation.js +4 -0
- package/dist/commands.cjs +59 -0
- package/dist/commands.cjs.map +1 -0
- package/dist/commands.d.cts +20 -0
- package/dist/commands.d.ts +20 -0
- package/dist/commands.js +47 -0
- package/dist/commands.js.map +1 -0
- package/dist/form.cjs +560 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.cts +52 -0
- package/dist/form.d.ts +52 -0
- package/dist/form.js +545 -0
- package/dist/form.js.map +1 -0
- package/dist/i18n.cjs +52 -0
- package/dist/i18n.cjs.map +1 -0
- package/dist/i18n.d.cts +30 -0
- package/dist/i18n.d.ts +30 -0
- package/dist/i18n.js +42 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.cjs +240 -0
- package/dist/index.d.cts +37 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +37 -0
- package/dist/interaction.cjs +152 -0
- package/dist/interaction.cjs.map +1 -0
- package/dist/interaction.d.cts +46 -0
- package/dist/interaction.d.ts +46 -0
- package/dist/interaction.js +139 -0
- package/dist/interaction.js.map +1 -0
- package/dist/link.cjs +108 -0
- package/dist/link.cjs.map +1 -0
- package/dist/link.d.cts +16 -0
- package/dist/link.d.ts +16 -0
- package/dist/link.js +98 -0
- package/dist/link.js.map +1 -0
- package/dist/metadata.cjs +25 -0
- package/dist/metadata.cjs.map +1 -0
- package/dist/metadata.d.cts +11 -0
- package/dist/metadata.d.ts +11 -0
- package/dist/metadata.js +16 -0
- package/dist/metadata.js.map +1 -0
- package/dist/page-edit.cjs +20 -0
- package/dist/page-edit.cjs.map +1 -0
- package/dist/page-edit.d.cts +7 -0
- package/dist/page-edit.d.ts +7 -0
- package/dist/page-edit.js +11 -0
- package/dist/page-edit.js.map +1 -0
- package/dist/page-view.cjs +107 -0
- package/dist/page-view.cjs.map +1 -0
- package/dist/page-view.d.cts +23 -0
- package/dist/page-view.d.ts +23 -0
- package/dist/page-view.js +95 -0
- package/dist/page-view.js.map +1 -0
- package/dist/redaction.cjs +35 -0
- package/dist/redaction.cjs.map +1 -0
- package/dist/redaction.d.cts +14 -0
- package/dist/redaction.d.ts +14 -0
- package/dist/redaction.js +25 -0
- package/dist/redaction.js.map +1 -0
- package/dist/render.cjs +142 -0
- package/dist/render.cjs.map +1 -0
- package/dist/render.d.cts +32 -0
- package/dist/render.d.ts +32 -0
- package/dist/render.js +131 -0
- package/dist/render.js.map +1 -0
- package/dist/rolldown-runtime-DDXJien1.cjs +50 -0
- package/dist/runtime-CMxIuF2O.d.cts +195 -0
- package/dist/runtime-DV98q7I0.d.ts +195 -0
- package/dist/runtime.cjs +314 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +3 -0
- package/dist/runtime.d.ts +3 -0
- package/dist/runtime.js +287 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scrollbar.cjs +241 -0
- package/dist/scrollbar.cjs.map +1 -0
- package/dist/scrollbar.d.cts +42 -0
- package/dist/scrollbar.d.ts +42 -0
- package/dist/scrollbar.js +213 -0
- package/dist/scrollbar.js.map +1 -0
- package/dist/search.cjs +70 -0
- package/dist/search.cjs.map +1 -0
- package/dist/search.d.cts +35 -0
- package/dist/search.d.ts +35 -0
- package/dist/search.js +58 -0
- package/dist/search.js.map +1 -0
- package/dist/selection.cjs +60 -0
- package/dist/selection.cjs.map +1 -0
- package/dist/selection.d.cts +12 -0
- package/dist/selection.d.ts +12 -0
- package/dist/selection.js +49 -0
- package/dist/selection.js.map +1 -0
- package/dist/shell.cjs +57 -0
- package/dist/shell.cjs.map +1 -0
- package/dist/shell.d.cts +27 -0
- package/dist/shell.d.ts +27 -0
- package/dist/shell.js +46 -0
- package/dist/shell.js.map +1 -0
- package/dist/stage.cjs +343 -0
- package/dist/stage.cjs.map +1 -0
- package/dist/stage.d.cts +104 -0
- package/dist/stage.d.ts +104 -0
- package/dist/stage.js +327 -0
- package/dist/stage.js.map +1 -0
- package/dist/stamp.cjs +76 -0
- package/dist/stamp.cjs.map +1 -0
- package/dist/stamp.d.cts +28 -0
- package/dist/stamp.d.ts +28 -0
- package/dist/stamp.js +63 -0
- package/dist/stamp.js.map +1 -0
- package/dist/toolbar.cjs +515 -0
- package/dist/toolbar.cjs.map +1 -0
- package/dist/toolbar.d.cts +100 -0
- package/dist/toolbar.d.ts +100 -0
- package/dist/toolbar.js +505 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/views.cjs +35 -0
- package/dist/views.cjs.map +1 -0
- package/dist/views.d.cts +21 -0
- package/dist/views.d.ts +21 -0
- package/dist/views.js +26 -0
- package/dist/views.js.map +1 -0
- package/package.json +158 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { shallowArray, useCapability, usePage, useSelector } from "./runtime.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { SelectionToken } from "@embedpdf/plugin-selection";
|
|
5
|
+
export * from "@embedpdf/plugin-selection";
|
|
6
|
+
//#region src/selection.tsx
|
|
7
|
+
function SelectionLayer({ color = "rgba(33, 150, 243, 0.35)" }) {
|
|
8
|
+
const page = usePage();
|
|
9
|
+
const selection = useCapability(SelectionToken);
|
|
10
|
+
const rects = useSelector(SelectionToken, (c) => c.rectsForPage(page.pon), shallowArray);
|
|
11
|
+
const visible = useSelector(SelectionToken, (c) => c.highlightVisible());
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
selection.ensurePage(page.pon);
|
|
14
|
+
}, [selection, page.pon]);
|
|
15
|
+
if (!visible) return null;
|
|
16
|
+
return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
style: {
|
|
18
|
+
position: "absolute",
|
|
19
|
+
inset: 0,
|
|
20
|
+
pointerEvents: "none"
|
|
21
|
+
},
|
|
22
|
+
children: rects.map((r, i) => {
|
|
23
|
+
const tl = page.transform.pageToContent({
|
|
24
|
+
x: r.x,
|
|
25
|
+
y: r.y
|
|
26
|
+
});
|
|
27
|
+
const br = page.transform.pageToContent({
|
|
28
|
+
x: r.x + r.width,
|
|
29
|
+
y: r.y + r.height
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ jsx("div", { style: {
|
|
32
|
+
position: "absolute",
|
|
33
|
+
left: tl.x,
|
|
34
|
+
top: tl.y,
|
|
35
|
+
width: br.x - tl.x,
|
|
36
|
+
height: br.y - tl.y,
|
|
37
|
+
background: color
|
|
38
|
+
} }, i);
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** The selection capability (clear(), hasSelection(), …) for app chrome. */
|
|
43
|
+
function useSelection() {
|
|
44
|
+
return useCapability(SelectionToken);
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { SelectionLayer, useSelection };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","names":[],"sources":["../src/selection.tsx"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-selection.\n *\n * <SelectionLayer> is a dumb renderer: it warms the page's geometry on mount,\n * reads the content-space highlight rects from the capability, and paints them —\n * mapping each rect through PageContext.pageToContent (the same path markers use).\n * Zero pointer handling here; that's the PagePointerSource + the hub.\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-selection';\nimport * as React from 'react';\nimport { useEffect } from 'react';\nimport { SelectionToken } from '@embedpdf/plugin-selection';\nimport { shallowArray, useCapability, usePage, useSelector } from './runtime';\n\nexport interface SelectionLayerProps {\n /** Highlight colour (default: translucent blue). */\n color?: string;\n}\n\nexport function SelectionLayer({ color = 'rgba(33, 150, 243, 0.35)' }: SelectionLayerProps) {\n const page = usePage();\n const selection = useCapability(SelectionToken);\n const rects = useSelector(SelectionToken, (c) => c.rectsForPage(page.pon), shallowArray);\n // A consumer (e.g. a markup tool drawing its own preview) can take over the\n // selection visual; when it does, we render nothing so the two never overlap.\n const visible = useSelector(SelectionToken, (c) => c.highlightVisible());\n\n // Warm this page's text geometry as soon as it's on screen, so the first\n // pointer-down can hit-test without waiting on the engine round-trip.\n useEffect(() => {\n selection.ensurePage(page.pon);\n }, [selection, page.pon]);\n\n if (!visible) return null;\n\n return (\n <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>\n {rects.map((r, i) => {\n // content space → un-rotated content view px (rides the page's CSS rotation)\n const tl = page.transform.pageToContent({ x: r.x, y: r.y });\n const br = page.transform.pageToContent({ x: r.x + r.width, y: r.y + r.height });\n return (\n <div\n key={i}\n style={{\n position: 'absolute',\n left: tl.x,\n top: tl.y,\n width: br.x - tl.x,\n height: br.y - tl.y,\n background: color,\n }}\n />\n );\n })}\n </div>\n );\n}\n\n/** The selection capability (clear(), hasSelection(), …) for app chrome. */\nexport function useSelection() {\n return useCapability(SelectionToken);\n}\n"],"mappings":";;;;;;AAqBA,SAAgB,eAAe,EAAE,QAAQ,8BAAmD;CAC1F,MAAM,OAAO,QAAQ;CACrB,MAAM,YAAY,cAAc,cAAc;CAC9C,MAAM,QAAQ,YAAY,iBAAiB,MAAM,EAAE,aAAa,KAAK,GAAG,GAAG,YAAY;CAGvF,MAAM,UAAU,YAAY,iBAAiB,MAAM,EAAE,iBAAiB,CAAC;CAIvE,gBAAgB;EACd,UAAU,WAAW,KAAK,GAAG;CAC/B,GAAG,CAAC,WAAW,KAAK,GAAG,CAAC;CAExB,IAAI,CAAC,SAAS,OAAO;CAErB,OACE,oBAAC,OAAD;EAAK,OAAO;GAAE,UAAU;GAAY,OAAO;GAAG,eAAe;EAAO;EACjE,UAAA,MAAM,KAAK,GAAG,MAAM;GAEnB,MAAM,KAAK,KAAK,UAAU,cAAc;IAAE,GAAG,EAAE;IAAG,GAAG,EAAE;GAAE,CAAC;GAC1D,MAAM,KAAK,KAAK,UAAU,cAAc;IAAE,GAAG,EAAE,IAAI,EAAE;IAAO,GAAG,EAAE,IAAI,EAAE;GAAO,CAAC;GAC/E,OACE,oBAAC,OAAD,EAEE,OAAO;IACL,UAAU;IACV,MAAM,GAAG;IACT,KAAK,GAAG;IACR,OAAO,GAAG,IAAI,GAAG;IACjB,QAAQ,GAAG,IAAI,GAAG;IAClB,YAAY;GACd,EACD,GATM,CASN;EAEL,CAAC;CACE,CAAA;AAET;;AAGA,SAAgB,eAAe;CAC7B,OAAO,cAAc,cAAc;AACrC"}
|
package/dist/shell.cjs
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./rolldown-runtime-DDXJien1.cjs");
|
|
3
|
+
const require_runtime = require("./runtime.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let _embedpdf_plugin_shell = require("@embedpdf/plugin-shell");
|
|
6
|
+
//#region src/shell.ts
|
|
7
|
+
/** The raw capability — throws without a document; for gated subtrees. */
|
|
8
|
+
function useShell() {
|
|
9
|
+
return require_runtime.useCapability(_embedpdf_plugin_shell.ShellToken);
|
|
10
|
+
}
|
|
11
|
+
/** One named surface (panel / modal / overlay), bound to this subtree's
|
|
12
|
+
* document. Reads as closed — and intents no-op — while no document is open. */
|
|
13
|
+
function useSurface(id) {
|
|
14
|
+
const shell = require_runtime.useOptionalCapability(_embedpdf_plugin_shell.ShellToken);
|
|
15
|
+
const isOpen = require_runtime.useOptionalSelector(_embedpdf_plugin_shell.ShellToken, (s) => s.isOpen(id), false);
|
|
16
|
+
const props = require_runtime.useOptionalSelector(_embedpdf_plugin_shell.ShellToken, (s) => s.surfaceProps(id), void 0);
|
|
17
|
+
return (0, react.useMemo)(() => ({
|
|
18
|
+
isOpen,
|
|
19
|
+
props,
|
|
20
|
+
open: (opts) => shell?.open(id, opts),
|
|
21
|
+
close: () => shell?.close(id),
|
|
22
|
+
toggle: (opts) => shell?.toggle(id, opts)
|
|
23
|
+
}), [
|
|
24
|
+
shell,
|
|
25
|
+
id,
|
|
26
|
+
isOpen,
|
|
27
|
+
props
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
const NO_MENUS = [];
|
|
31
|
+
const stringArrayEqual = (a, b) => a === b || a.length === b.length && a.every((x, i) => x === b[i]);
|
|
32
|
+
/** The dropdown-menu stack for this subtree's document (empty without one). */
|
|
33
|
+
function useMenus() {
|
|
34
|
+
const shell = require_runtime.useOptionalCapability(_embedpdf_plugin_shell.ShellToken);
|
|
35
|
+
const open = require_runtime.useOptionalSelector(_embedpdf_plugin_shell.ShellToken, (s) => s.openMenus(), NO_MENUS, stringArrayEqual);
|
|
36
|
+
return (0, react.useMemo)(() => ({
|
|
37
|
+
open,
|
|
38
|
+
isOpen: (id) => open.includes(id),
|
|
39
|
+
toggle: (id) => shell?.toggleMenu(id),
|
|
40
|
+
close: (id) => shell?.closeMenu(id),
|
|
41
|
+
closeAll: () => shell?.closeAllMenus()
|
|
42
|
+
}), [shell, open]);
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
exports.useMenus = useMenus;
|
|
46
|
+
exports.useShell = useShell;
|
|
47
|
+
exports.useSurface = useSurface;
|
|
48
|
+
Object.keys(_embedpdf_plugin_shell).forEach(function(k) {
|
|
49
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function() {
|
|
52
|
+
return _embedpdf_plugin_shell[k];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=shell.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.cjs","names":["useCapability","ShellToken","useOptionalCapability","useOptionalSelector"],"sources":["../src/shell.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-shell. The app owns every\n * surface's DOM; these hooks bind its open/closed state to the kernel so\n * commands can drive it and applications can restore it.\n *\n * These hooks are TOTAL: shell state is document-scoped, and chrome that uses\n * it (panel buttons, mode bands, menu anchors) stays mounted across the\n * empty-workspace state. With no document, surfaces read as closed, menus as\n * none, and intents no-op — mirroring how command execution `tryGet`s the\n * shell. Use the raw capability (`useShell`) when you need fail-fast access\n * inside a <DocumentGate>.\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-shell';\nimport { useMemo } from 'react';\nimport { ShellToken } from '@embedpdf/plugin-shell';\nimport type { OpenSurfaceOptions, ShellCapability } from '@embedpdf/plugin-shell';\nimport { useCapability, useOptionalCapability, useOptionalSelector } from './runtime';\n\n/** The raw capability — throws without a document; for gated subtrees. */\nexport function useShell(): ShellCapability {\n return useCapability(ShellToken);\n}\n\nexport interface SurfaceHandle {\n readonly isOpen: boolean;\n readonly props: Readonly<Record<string, unknown>> | undefined;\n open(opts?: OpenSurfaceOptions): void;\n close(): void;\n toggle(opts?: OpenSurfaceOptions): void;\n}\n\n/** One named surface (panel / modal / overlay), bound to this subtree's\n * document. Reads as closed — and intents no-op — while no document is open. */\nexport function useSurface(id: string): SurfaceHandle {\n const shell = useOptionalCapability(ShellToken);\n const isOpen = useOptionalSelector(ShellToken, (s) => s.isOpen(id), false);\n const props = useOptionalSelector(ShellToken, (s) => s.surfaceProps(id), undefined);\n return useMemo(\n () => ({\n isOpen,\n props,\n open: (opts?: OpenSurfaceOptions) => shell?.open(id, opts),\n close: () => shell?.close(id),\n toggle: (opts?: OpenSurfaceOptions) => shell?.toggle(id, opts),\n }),\n [shell, id, isOpen, props],\n );\n}\n\nexport interface MenusHandle {\n readonly open: readonly string[];\n isOpen(id: string): boolean;\n toggle(id: string): void;\n close(id: string): void;\n closeAll(): void;\n}\n\nconst NO_MENUS: readonly string[] = [];\nconst stringArrayEqual = (a: readonly string[], b: readonly string[]) =>\n a === b || (a.length === b.length && a.every((x, i) => x === b[i]));\n\n/** The dropdown-menu stack for this subtree's document (empty without one). */\nexport function useMenus(): MenusHandle {\n const shell = useOptionalCapability(ShellToken);\n const open = useOptionalSelector(ShellToken, (s) => s.openMenus(), NO_MENUS, stringArrayEqual);\n return useMemo(\n () => ({\n open,\n isOpen: (id: string) => open.includes(id),\n toggle: (id: string) => shell?.toggleMenu(id),\n close: (id: string) => shell?.closeMenu(id),\n closeAll: () => shell?.closeAllMenus(),\n }),\n [shell, open],\n );\n}\n"],"mappings":";;;;;;;AAqBA,SAAgB,WAA4B;CAC1C,OAAOA,gBAAAA,cAAcC,uBAAAA,UAAU;AACjC;;;AAYA,SAAgB,WAAW,IAA2B;CACpD,MAAM,QAAQC,gBAAAA,sBAAsBD,uBAAAA,UAAU;CAC9C,MAAM,SAASE,gBAAAA,oBAAoBF,uBAAAA,aAAa,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK;CACzE,MAAM,QAAQE,gBAAAA,oBAAoBF,uBAAAA,aAAa,MAAM,EAAE,aAAa,EAAE,GAAG,KAAA,CAAS;CAClF,QAAA,GAAA,MAAA,QAAA,QACS;EACL;EACA;EACA,OAAO,SAA8B,OAAO,KAAK,IAAI,IAAI;EACzD,aAAa,OAAO,MAAM,EAAE;EAC5B,SAAS,SAA8B,OAAO,OAAO,IAAI,IAAI;CAC/D,IACA;EAAC;EAAO;EAAI;EAAQ;CAAK,CAC3B;AACF;AAUA,MAAM,WAA8B,CAAC;AACrC,MAAM,oBAAoB,GAAsB,MAC9C,MAAM,KAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,MAAM,EAAE,EAAE;;AAGnE,SAAgB,WAAwB;CACtC,MAAM,QAAQC,gBAAAA,sBAAsBD,uBAAAA,UAAU;CAC9C,MAAM,OAAOE,gBAAAA,oBAAoBF,uBAAAA,aAAa,MAAM,EAAE,UAAU,GAAG,UAAU,gBAAgB;CAC7F,QAAA,GAAA,MAAA,QAAA,QACS;EACL;EACA,SAAS,OAAe,KAAK,SAAS,EAAE;EACxC,SAAS,OAAe,OAAO,WAAW,EAAE;EAC5C,QAAQ,OAAe,OAAO,UAAU,EAAE;EAC1C,gBAAgB,OAAO,cAAc;CACvC,IACA,CAAC,OAAO,IAAI,CACd;AACF"}
|
package/dist/shell.d.cts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OpenSurfaceOptions, ShellCapability } from "@embedpdf/plugin-shell";
|
|
2
|
+
export * from "@embedpdf/plugin-shell";
|
|
3
|
+
//#region src/shell.d.ts
|
|
4
|
+
/** The raw capability — throws without a document; for gated subtrees. */
|
|
5
|
+
declare function useShell(): ShellCapability;
|
|
6
|
+
interface SurfaceHandle {
|
|
7
|
+
readonly isOpen: boolean;
|
|
8
|
+
readonly props: Readonly<Record<string, unknown>> | undefined;
|
|
9
|
+
open(opts?: OpenSurfaceOptions): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
toggle(opts?: OpenSurfaceOptions): void;
|
|
12
|
+
}
|
|
13
|
+
/** One named surface (panel / modal / overlay), bound to this subtree's
|
|
14
|
+
* document. Reads as closed — and intents no-op — while no document is open. */
|
|
15
|
+
declare function useSurface(id: string): SurfaceHandle;
|
|
16
|
+
interface MenusHandle {
|
|
17
|
+
readonly open: readonly string[];
|
|
18
|
+
isOpen(id: string): boolean;
|
|
19
|
+
toggle(id: string): void;
|
|
20
|
+
close(id: string): void;
|
|
21
|
+
closeAll(): void;
|
|
22
|
+
}
|
|
23
|
+
/** The dropdown-menu stack for this subtree's document (empty without one). */
|
|
24
|
+
declare function useMenus(): MenusHandle;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { MenusHandle, SurfaceHandle, useMenus, useShell, useSurface };
|
|
27
|
+
//# sourceMappingURL=shell.d.cts.map
|
package/dist/shell.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OpenSurfaceOptions, ShellCapability } from "@embedpdf/plugin-shell";
|
|
2
|
+
export * from "@embedpdf/plugin-shell";
|
|
3
|
+
//#region src/shell.d.ts
|
|
4
|
+
/** The raw capability — throws without a document; for gated subtrees. */
|
|
5
|
+
declare function useShell(): ShellCapability;
|
|
6
|
+
interface SurfaceHandle {
|
|
7
|
+
readonly isOpen: boolean;
|
|
8
|
+
readonly props: Readonly<Record<string, unknown>> | undefined;
|
|
9
|
+
open(opts?: OpenSurfaceOptions): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
toggle(opts?: OpenSurfaceOptions): void;
|
|
12
|
+
}
|
|
13
|
+
/** One named surface (panel / modal / overlay), bound to this subtree's
|
|
14
|
+
* document. Reads as closed — and intents no-op — while no document is open. */
|
|
15
|
+
declare function useSurface(id: string): SurfaceHandle;
|
|
16
|
+
interface MenusHandle {
|
|
17
|
+
readonly open: readonly string[];
|
|
18
|
+
isOpen(id: string): boolean;
|
|
19
|
+
toggle(id: string): void;
|
|
20
|
+
close(id: string): void;
|
|
21
|
+
closeAll(): void;
|
|
22
|
+
}
|
|
23
|
+
/** The dropdown-menu stack for this subtree's document (empty without one). */
|
|
24
|
+
declare function useMenus(): MenusHandle;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { MenusHandle, SurfaceHandle, useMenus, useShell, useSurface };
|
|
27
|
+
//# sourceMappingURL=shell.d.ts.map
|
package/dist/shell.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useCapability, useOptionalCapability, useOptionalSelector } from "./runtime.js";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { ShellToken } from "@embedpdf/plugin-shell";
|
|
4
|
+
export * from "@embedpdf/plugin-shell";
|
|
5
|
+
//#region src/shell.ts
|
|
6
|
+
/** The raw capability — throws without a document; for gated subtrees. */
|
|
7
|
+
function useShell() {
|
|
8
|
+
return useCapability(ShellToken);
|
|
9
|
+
}
|
|
10
|
+
/** One named surface (panel / modal / overlay), bound to this subtree's
|
|
11
|
+
* document. Reads as closed — and intents no-op — while no document is open. */
|
|
12
|
+
function useSurface(id) {
|
|
13
|
+
const shell = useOptionalCapability(ShellToken);
|
|
14
|
+
const isOpen = useOptionalSelector(ShellToken, (s) => s.isOpen(id), false);
|
|
15
|
+
const props = useOptionalSelector(ShellToken, (s) => s.surfaceProps(id), void 0);
|
|
16
|
+
return useMemo(() => ({
|
|
17
|
+
isOpen,
|
|
18
|
+
props,
|
|
19
|
+
open: (opts) => shell?.open(id, opts),
|
|
20
|
+
close: () => shell?.close(id),
|
|
21
|
+
toggle: (opts) => shell?.toggle(id, opts)
|
|
22
|
+
}), [
|
|
23
|
+
shell,
|
|
24
|
+
id,
|
|
25
|
+
isOpen,
|
|
26
|
+
props
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
const NO_MENUS = [];
|
|
30
|
+
const stringArrayEqual = (a, b) => a === b || a.length === b.length && a.every((x, i) => x === b[i]);
|
|
31
|
+
/** The dropdown-menu stack for this subtree's document (empty without one). */
|
|
32
|
+
function useMenus() {
|
|
33
|
+
const shell = useOptionalCapability(ShellToken);
|
|
34
|
+
const open = useOptionalSelector(ShellToken, (s) => s.openMenus(), NO_MENUS, stringArrayEqual);
|
|
35
|
+
return useMemo(() => ({
|
|
36
|
+
open,
|
|
37
|
+
isOpen: (id) => open.includes(id),
|
|
38
|
+
toggle: (id) => shell?.toggleMenu(id),
|
|
39
|
+
close: (id) => shell?.closeMenu(id),
|
|
40
|
+
closeAll: () => shell?.closeAllMenus()
|
|
41
|
+
}), [shell, open]);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { useMenus, useShell, useSurface };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","names":[],"sources":["../src/shell.ts"],"sourcesContent":["/**\n * The React surface for @embedpdf/plugin-shell. The app owns every\n * surface's DOM; these hooks bind its open/closed state to the kernel so\n * commands can drive it and applications can restore it.\n *\n * These hooks are TOTAL: shell state is document-scoped, and chrome that uses\n * it (panel buttons, mode bands, menu anchors) stays mounted across the\n * empty-workspace state. With no document, surfaces read as closed, menus as\n * none, and intents no-op — mirroring how command execution `tryGet`s the\n * shell. Use the raw capability (`useShell`) when you need fail-fast access\n * inside a <DocumentGate>.\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-shell';\nimport { useMemo } from 'react';\nimport { ShellToken } from '@embedpdf/plugin-shell';\nimport type { OpenSurfaceOptions, ShellCapability } from '@embedpdf/plugin-shell';\nimport { useCapability, useOptionalCapability, useOptionalSelector } from './runtime';\n\n/** The raw capability — throws without a document; for gated subtrees. */\nexport function useShell(): ShellCapability {\n return useCapability(ShellToken);\n}\n\nexport interface SurfaceHandle {\n readonly isOpen: boolean;\n readonly props: Readonly<Record<string, unknown>> | undefined;\n open(opts?: OpenSurfaceOptions): void;\n close(): void;\n toggle(opts?: OpenSurfaceOptions): void;\n}\n\n/** One named surface (panel / modal / overlay), bound to this subtree's\n * document. Reads as closed — and intents no-op — while no document is open. */\nexport function useSurface(id: string): SurfaceHandle {\n const shell = useOptionalCapability(ShellToken);\n const isOpen = useOptionalSelector(ShellToken, (s) => s.isOpen(id), false);\n const props = useOptionalSelector(ShellToken, (s) => s.surfaceProps(id), undefined);\n return useMemo(\n () => ({\n isOpen,\n props,\n open: (opts?: OpenSurfaceOptions) => shell?.open(id, opts),\n close: () => shell?.close(id),\n toggle: (opts?: OpenSurfaceOptions) => shell?.toggle(id, opts),\n }),\n [shell, id, isOpen, props],\n );\n}\n\nexport interface MenusHandle {\n readonly open: readonly string[];\n isOpen(id: string): boolean;\n toggle(id: string): void;\n close(id: string): void;\n closeAll(): void;\n}\n\nconst NO_MENUS: readonly string[] = [];\nconst stringArrayEqual = (a: readonly string[], b: readonly string[]) =>\n a === b || (a.length === b.length && a.every((x, i) => x === b[i]));\n\n/** The dropdown-menu stack for this subtree's document (empty without one). */\nexport function useMenus(): MenusHandle {\n const shell = useOptionalCapability(ShellToken);\n const open = useOptionalSelector(ShellToken, (s) => s.openMenus(), NO_MENUS, stringArrayEqual);\n return useMemo(\n () => ({\n open,\n isOpen: (id: string) => open.includes(id),\n toggle: (id: string) => shell?.toggleMenu(id),\n close: (id: string) => shell?.closeMenu(id),\n closeAll: () => shell?.closeAllMenus(),\n }),\n [shell, open],\n );\n}\n"],"mappings":";;;;;;AAqBA,SAAgB,WAA4B;CAC1C,OAAO,cAAc,UAAU;AACjC;;;AAYA,SAAgB,WAAW,IAA2B;CACpD,MAAM,QAAQ,sBAAsB,UAAU;CAC9C,MAAM,SAAS,oBAAoB,aAAa,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK;CACzE,MAAM,QAAQ,oBAAoB,aAAa,MAAM,EAAE,aAAa,EAAE,GAAG,KAAA,CAAS;CAClF,OAAO,eACE;EACL;EACA;EACA,OAAO,SAA8B,OAAO,KAAK,IAAI,IAAI;EACzD,aAAa,OAAO,MAAM,EAAE;EAC5B,SAAS,SAA8B,OAAO,OAAO,IAAI,IAAI;CAC/D,IACA;EAAC;EAAO;EAAI;EAAQ;CAAK,CAC3B;AACF;AAUA,MAAM,WAA8B,CAAC;AACrC,MAAM,oBAAoB,GAAsB,MAC9C,MAAM,KAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,MAAM,EAAE,EAAE;;AAGnE,SAAgB,WAAwB;CACtC,MAAM,QAAQ,sBAAsB,UAAU;CAC9C,MAAM,OAAO,oBAAoB,aAAa,MAAM,EAAE,UAAU,GAAG,UAAU,gBAAgB;CAC7F,OAAO,eACE;EACL;EACA,SAAS,OAAe,KAAK,SAAS,EAAE;EACxC,SAAS,OAAe,OAAO,WAAW,EAAE;EAC5C,QAAQ,OAAe,OAAO,UAAU,EAAE;EAC1C,gBAAgB,OAAO,cAAc;CACvC,IACA,CAAC,OAAO,IAAI,CACd;AACF"}
|
package/dist/stage.cjs
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DDXJien1.cjs");
|
|
3
|
+
const require_runtime = require("./runtime.cjs");
|
|
4
|
+
const require_interaction = require("./interaction.cjs");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
let react = require("react");
|
|
7
|
+
react = require_rolldown_runtime.__toESM(react, 1);
|
|
8
|
+
let _embedpdf_plugin_stage = require("@embedpdf/plugin-stage");
|
|
9
|
+
let _embedpdf_plugin_interaction = require("@embedpdf/plugin-interaction");
|
|
10
|
+
//#region src/stage.tsx
|
|
11
|
+
function PageSurface({ documentId, page, frame, stage, render, chrome }) {
|
|
12
|
+
const ref = (0, react.useRef)(null);
|
|
13
|
+
const t = page.transform;
|
|
14
|
+
const rotation = page.rotation;
|
|
15
|
+
const outerW = t.viewWidth + frame.left + frame.right;
|
|
16
|
+
const outerH = t.viewHeight + frame.top + frame.bottom;
|
|
17
|
+
const left = page.screenX - frame.left;
|
|
18
|
+
const top = page.screenY - frame.top;
|
|
19
|
+
const contentLeft = frame.left + (t.viewWidth - t.contentWidth) / 2;
|
|
20
|
+
const contentTop = frame.top + (t.viewHeight - t.contentHeight) / 2;
|
|
21
|
+
const ctx = (0, react.useMemo)(() => require_runtime.makePageContext(documentId, page.pon, page.pageIndex, frame, t, () => ref.current.getBoundingClientRect(), () => {
|
|
22
|
+
const live = stage.visiblePages().find((p) => p.pon === page.pon);
|
|
23
|
+
return live ? {
|
|
24
|
+
desiredDeviceWidth: live.transform.deviceWidth,
|
|
25
|
+
visibleRect: live.visibleRect
|
|
26
|
+
} : {
|
|
27
|
+
desiredDeviceWidth: t.deviceWidth,
|
|
28
|
+
visibleRect: {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 0,
|
|
31
|
+
width: 0,
|
|
32
|
+
height: 0
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}), [
|
|
36
|
+
documentId,
|
|
37
|
+
page.pon,
|
|
38
|
+
page.pageIndex,
|
|
39
|
+
frame,
|
|
40
|
+
t,
|
|
41
|
+
stage
|
|
42
|
+
]);
|
|
43
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
44
|
+
style: {
|
|
45
|
+
position: "absolute",
|
|
46
|
+
left,
|
|
47
|
+
top,
|
|
48
|
+
width: outerW,
|
|
49
|
+
height: outerH
|
|
50
|
+
},
|
|
51
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_runtime.PageProvider, {
|
|
52
|
+
value: ctx,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { style: {
|
|
55
|
+
position: "absolute",
|
|
56
|
+
left: frame.left,
|
|
57
|
+
top: frame.top,
|
|
58
|
+
width: t.viewWidth,
|
|
59
|
+
height: t.viewHeight,
|
|
60
|
+
boxShadow: "0 6px 18px rgba(0,0,0,.18)"
|
|
61
|
+
} }),
|
|
62
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
63
|
+
ref,
|
|
64
|
+
style: {
|
|
65
|
+
position: "absolute",
|
|
66
|
+
left: contentLeft,
|
|
67
|
+
top: contentTop,
|
|
68
|
+
width: t.contentWidth,
|
|
69
|
+
height: t.contentHeight,
|
|
70
|
+
background: "#fff",
|
|
71
|
+
transform: rotation ? `rotate(${rotation}deg)` : void 0,
|
|
72
|
+
userSelect: "none",
|
|
73
|
+
WebkitUserSelect: "none"
|
|
74
|
+
},
|
|
75
|
+
children: render(ctx)
|
|
76
|
+
}),
|
|
77
|
+
chrome?.(ctx)
|
|
78
|
+
]
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function Stage({ children, pageChrome, overlay, interaction = false, zoomGestures = true, token = _embedpdf_plugin_stage.StageToken, className, style }) {
|
|
83
|
+
const stage = require_runtime.useCapability(token);
|
|
84
|
+
const ix = require_runtime.useOptionalCapability(_embedpdf_plugin_interaction.InteractionToken);
|
|
85
|
+
const useHub = interaction && !!ix;
|
|
86
|
+
const hubCursor = require_runtime.useKernelValue(() => ix?.cursor() ?? "default");
|
|
87
|
+
const ref = (0, react.useRef)(null);
|
|
88
|
+
const docId = require_runtime.useDocumentId();
|
|
89
|
+
const pages = require_runtime.useSelector(token, (c) => c.visiblePages());
|
|
90
|
+
const frame = require_runtime.useSelector(token, (c) => c.pageFrame(), (a, b) => a.top === b.top && a.right === b.right && a.bottom === b.bottom && a.left === b.left);
|
|
91
|
+
(0, react.useEffect)(() => {
|
|
92
|
+
const el = ref.current;
|
|
93
|
+
const setVp = () => stage.setViewport({
|
|
94
|
+
width: el.clientWidth,
|
|
95
|
+
height: el.clientHeight
|
|
96
|
+
});
|
|
97
|
+
const ro = new ResizeObserver(setVp);
|
|
98
|
+
ro.observe(el);
|
|
99
|
+
setVp();
|
|
100
|
+
let mq = null;
|
|
101
|
+
const reportDpr = () => {
|
|
102
|
+
stage.setDevicePixelRatio(window.devicePixelRatio || 1);
|
|
103
|
+
mq?.removeEventListener("change", reportDpr);
|
|
104
|
+
mq = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);
|
|
105
|
+
mq.addEventListener("change", reportDpr);
|
|
106
|
+
};
|
|
107
|
+
reportDpr();
|
|
108
|
+
const onWheel = (e) => {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
const r = el.getBoundingClientRect();
|
|
111
|
+
if (zoomGestures && (e.ctrlKey || e.metaKey)) stage.zoomAround({
|
|
112
|
+
x: e.clientX - r.left,
|
|
113
|
+
y: e.clientY - r.top
|
|
114
|
+
}, (0, _embedpdf_plugin_stage.wheelZoomFactor)(e));
|
|
115
|
+
else {
|
|
116
|
+
const dx = e.shiftKey ? e.deltaY : e.deltaX;
|
|
117
|
+
const dy = e.shiftKey ? e.deltaX : e.deltaY;
|
|
118
|
+
stage.panBy(-dx, -dy);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
el.addEventListener("wheel", onWheel, { passive: false });
|
|
122
|
+
let lastScale = 1;
|
|
123
|
+
const onGestureStart = (e) => {
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
lastScale = e.scale ?? 1;
|
|
126
|
+
};
|
|
127
|
+
const onGestureChange = (e) => {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
const g = e;
|
|
130
|
+
const scale = g.scale ?? 1;
|
|
131
|
+
if (zoomGestures && scale > 0) {
|
|
132
|
+
const r = el.getBoundingClientRect();
|
|
133
|
+
stage.zoomAround({
|
|
134
|
+
x: g.clientX - r.left,
|
|
135
|
+
y: g.clientY - r.top
|
|
136
|
+
}, scale / lastScale);
|
|
137
|
+
}
|
|
138
|
+
lastScale = scale;
|
|
139
|
+
};
|
|
140
|
+
const hasGestureEvents = "GestureEvent" in window;
|
|
141
|
+
if (hasGestureEvents) {
|
|
142
|
+
el.addEventListener("gesturestart", onGestureStart);
|
|
143
|
+
el.addEventListener("gesturechange", onGestureChange);
|
|
144
|
+
el.addEventListener("gestureend", onGestureStart);
|
|
145
|
+
}
|
|
146
|
+
const cleanups = [];
|
|
147
|
+
if (useHub && ix) {
|
|
148
|
+
const clicks = require_interaction.createClickCounter();
|
|
149
|
+
const forward = (phase, e, clickCount = 1) => {
|
|
150
|
+
const r = el.getBoundingClientRect();
|
|
151
|
+
const vpt = {
|
|
152
|
+
x: e.clientX - r.left,
|
|
153
|
+
y: e.clientY - r.top
|
|
154
|
+
};
|
|
155
|
+
ix.dispatch({
|
|
156
|
+
phase,
|
|
157
|
+
viewport: vpt,
|
|
158
|
+
page: stage.pageAt(vpt) ?? void 0,
|
|
159
|
+
project: (pon) => stage.pointOnPage(pon, vpt),
|
|
160
|
+
modifiers: {
|
|
161
|
+
shift: e.shiftKey,
|
|
162
|
+
alt: e.altKey,
|
|
163
|
+
ctrl: e.ctrlKey,
|
|
164
|
+
meta: e.metaKey
|
|
165
|
+
},
|
|
166
|
+
clickCount
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
let dragging = false;
|
|
170
|
+
const down = (e) => {
|
|
171
|
+
if (e.button !== 0) return;
|
|
172
|
+
dragging = true;
|
|
173
|
+
forward("down", e, clicks(Date.now(), e.clientX, e.clientY));
|
|
174
|
+
};
|
|
175
|
+
const hover = (e) => {
|
|
176
|
+
if (!dragging) forward("move", e);
|
|
177
|
+
};
|
|
178
|
+
const winMove = (e) => {
|
|
179
|
+
if (dragging) forward("move", e);
|
|
180
|
+
};
|
|
181
|
+
const up = (e) => {
|
|
182
|
+
if (!dragging) return;
|
|
183
|
+
dragging = false;
|
|
184
|
+
forward("up", e);
|
|
185
|
+
};
|
|
186
|
+
el.addEventListener("pointerdown", down);
|
|
187
|
+
el.addEventListener("pointermove", hover);
|
|
188
|
+
window.addEventListener("pointermove", winMove);
|
|
189
|
+
window.addEventListener("pointerup", up);
|
|
190
|
+
cleanups.push(() => {
|
|
191
|
+
el.removeEventListener("pointerdown", down);
|
|
192
|
+
el.removeEventListener("pointermove", hover);
|
|
193
|
+
window.removeEventListener("pointermove", winMove);
|
|
194
|
+
window.removeEventListener("pointerup", up);
|
|
195
|
+
});
|
|
196
|
+
} else {
|
|
197
|
+
let dragging = false;
|
|
198
|
+
let lx = 0;
|
|
199
|
+
let ly = 0;
|
|
200
|
+
const down = (e) => {
|
|
201
|
+
if (e.button !== 0) return;
|
|
202
|
+
dragging = true;
|
|
203
|
+
lx = e.clientX;
|
|
204
|
+
ly = e.clientY;
|
|
205
|
+
};
|
|
206
|
+
const move = (e) => {
|
|
207
|
+
if (!dragging) return;
|
|
208
|
+
stage.panBy(e.clientX - lx, e.clientY - ly);
|
|
209
|
+
lx = e.clientX;
|
|
210
|
+
ly = e.clientY;
|
|
211
|
+
};
|
|
212
|
+
const up = () => {
|
|
213
|
+
dragging = false;
|
|
214
|
+
};
|
|
215
|
+
el.addEventListener("pointerdown", down);
|
|
216
|
+
window.addEventListener("pointermove", move);
|
|
217
|
+
window.addEventListener("pointerup", up);
|
|
218
|
+
cleanups.push(() => {
|
|
219
|
+
el.removeEventListener("pointerdown", down);
|
|
220
|
+
window.removeEventListener("pointermove", move);
|
|
221
|
+
window.removeEventListener("pointerup", up);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return () => {
|
|
225
|
+
ro.disconnect();
|
|
226
|
+
mq?.removeEventListener("change", reportDpr);
|
|
227
|
+
el.removeEventListener("wheel", onWheel);
|
|
228
|
+
if (hasGestureEvents) {
|
|
229
|
+
el.removeEventListener("gesturestart", onGestureStart);
|
|
230
|
+
el.removeEventListener("gesturechange", onGestureChange);
|
|
231
|
+
el.removeEventListener("gestureend", onGestureStart);
|
|
232
|
+
}
|
|
233
|
+
cleanups.forEach((fn) => fn());
|
|
234
|
+
};
|
|
235
|
+
}, [
|
|
236
|
+
stage,
|
|
237
|
+
ix,
|
|
238
|
+
useHub,
|
|
239
|
+
zoomGestures
|
|
240
|
+
]);
|
|
241
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
242
|
+
ref,
|
|
243
|
+
className,
|
|
244
|
+
style: {
|
|
245
|
+
position: "relative",
|
|
246
|
+
overflow: "hidden",
|
|
247
|
+
touchAction: "none",
|
|
248
|
+
...useHub ? { cursor: hubCursor } : null,
|
|
249
|
+
...style
|
|
250
|
+
},
|
|
251
|
+
children: [pages.map((p) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageSurface, {
|
|
252
|
+
documentId: docId ?? "",
|
|
253
|
+
page: p,
|
|
254
|
+
frame,
|
|
255
|
+
stage,
|
|
256
|
+
render: children,
|
|
257
|
+
chrome: pageChrome
|
|
258
|
+
}, p.pageIndex)), overlay]
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function useStage(token = _embedpdf_plugin_stage.StageToken) {
|
|
262
|
+
return require_runtime.useCapability(token);
|
|
263
|
+
}
|
|
264
|
+
function useZoom(token = _embedpdf_plugin_stage.StageToken) {
|
|
265
|
+
const s = require_runtime.useCapability(token);
|
|
266
|
+
return {
|
|
267
|
+
zoom: require_runtime.useSelector(token, (c) => c.zoomLevel()),
|
|
268
|
+
/** Active zoom intent: 'automatic' | 'fit-page' | 'fit-width' | 'fit-all' | 'custom'. */
|
|
269
|
+
mode: require_runtime.useSelector(token, (c) => c.zoomMode()),
|
|
270
|
+
zoomIn: s.zoomIn,
|
|
271
|
+
zoomOut: s.zoomOut,
|
|
272
|
+
fitWidth: s.fitWidth,
|
|
273
|
+
fitPage: s.fitPage,
|
|
274
|
+
fitAll: s.fitAll,
|
|
275
|
+
automatic: s.automatic,
|
|
276
|
+
zoomTo: s.zoomTo
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function usePages(token = _embedpdf_plugin_stage.StageToken) {
|
|
280
|
+
const s = require_runtime.useCapability(token);
|
|
281
|
+
return {
|
|
282
|
+
currentPage: require_runtime.useSelector(token, (c) => c.currentPage()),
|
|
283
|
+
pageCount: require_runtime.useSelector(token, (c) => c.pageCount()),
|
|
284
|
+
goToPage: s.goToPage,
|
|
285
|
+
next: s.next,
|
|
286
|
+
prev: s.prev,
|
|
287
|
+
reveal: s.reveal
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function useLayout(token = _embedpdf_plugin_stage.StageToken) {
|
|
291
|
+
const s = require_runtime.useCapability(token);
|
|
292
|
+
return {
|
|
293
|
+
flow: require_runtime.useSelector(token, (c) => c.flow()),
|
|
294
|
+
layout: require_runtime.useSelector(token, (c) => c.layout()),
|
|
295
|
+
spread: require_runtime.useSelector(token, (c) => c.spread()),
|
|
296
|
+
sizing: require_runtime.useSelector(token, (c) => c.sizing()),
|
|
297
|
+
bounded: require_runtime.useSelector(token, (c) => c.bounded()),
|
|
298
|
+
setFlow: s.setFlow,
|
|
299
|
+
setLayout: s.setLayout,
|
|
300
|
+
setSpread: s.setSpread,
|
|
301
|
+
setSizing: s.setSizing,
|
|
302
|
+
setBounded: s.setBounded
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/** The document's page list (with PDF labels) + the current item's pages — the
|
|
306
|
+
* data for page thumbnails / worksheet-style page tabs. */
|
|
307
|
+
function usePageList(token = _embedpdf_plugin_stage.StageToken) {
|
|
308
|
+
return {
|
|
309
|
+
pages: require_runtime.useSelector(token, (c) => c.pages(), (a, b) => a.length === b.length && a.every((p, i) => p.pon === b[i].pon && p.label === b[i].label)),
|
|
310
|
+
currentItemPages: require_runtime.useSelector(token, (c) => c.currentItemPages(), (a, b) => a.length === b.length && a.every((x, i) => x === b[i]))
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* All Stage settings + the batch `update`. This is the seam for "presets are a
|
|
315
|
+
* customer concern": keep your own `Partial<StageSettings>` objects and apply them
|
|
316
|
+
* with `update(preset)` (one anchor-preserving change).
|
|
317
|
+
*/
|
|
318
|
+
function useStageSettings(token = _embedpdf_plugin_stage.StageToken) {
|
|
319
|
+
const s = require_runtime.useCapability(token);
|
|
320
|
+
return {
|
|
321
|
+
settings: require_runtime.useSelector(token, (c) => c.settings(), _embedpdf_plugin_stage.settingsEqual),
|
|
322
|
+
update: s.update,
|
|
323
|
+
reset: s.resetView
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
exports.Stage = Stage;
|
|
328
|
+
exports.useLayout = useLayout;
|
|
329
|
+
exports.usePageList = usePageList;
|
|
330
|
+
exports.usePages = usePages;
|
|
331
|
+
exports.useStage = useStage;
|
|
332
|
+
exports.useStageSettings = useStageSettings;
|
|
333
|
+
exports.useZoom = useZoom;
|
|
334
|
+
Object.keys(_embedpdf_plugin_stage).forEach(function(k) {
|
|
335
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
336
|
+
enumerable: true,
|
|
337
|
+
get: function() {
|
|
338
|
+
return _embedpdf_plugin_stage[k];
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
//# sourceMappingURL=stage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage.cjs","names":["makePageContext","PageProvider","StageToken","useCapability","useOptionalCapability","InteractionToken","useKernelValue","useDocumentId","useSelector","createClickCounter","settingsEqual"],"sources":["../src/stage.tsx"],"sourcesContent":["/**\n * Stage / RenderLayer + facade hooks.\n *\n * <Stage> virtualizes and positions page surfaces by the camera, and hands each\n * one to YOUR render prop — you bring the layers. (The standalone, Stage-free\n * single-page surface lives in `./page-view` so it never pulls the stage plugin.)\n */\n\n// One-line-per-feature: registration travels with the UI.\nexport * from '@embedpdf/plugin-stage';\nimport * as React from 'react';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { StageToken, settingsEqual, wheelZoomFactor } from '@embedpdf/plugin-stage';\nimport type { StageCapability, VisiblePage } from '@embedpdf/plugin-stage';\nimport type { CapabilityToken } from '@embedpdf/core';\n\n/** Which stage lens to bind to. Defaults to the main StageToken — pass a custom\n * token to drive an additional lens (e.g. a wrapped thumbnail sidebar). */\nexport type StageTokenProp = CapabilityToken<StageCapability>;\nimport type { PageFrame } from '@embedpdf/core-geometry';\nimport { InteractionToken } from '@embedpdf/plugin-interaction';\nimport type { PointerSample } from '@embedpdf/plugin-interaction';\nimport { createClickCounter } from './interaction';\nimport {\n makePageContext,\n PageProvider,\n useCapability,\n useDocumentId,\n useKernelValue,\n useOptionalCapability,\n useSelector,\n} from './runtime';\nimport type { PageContextValue } from './runtime';\n\nfunction PageSurface({\n documentId,\n page,\n frame,\n stage,\n render,\n chrome,\n}: {\n documentId: string;\n page: VisiblePage;\n /** Reserved chrome bands around the page (screen px); the layout reserved the\n * matching space, so the outer box tiles into it. */\n frame: PageFrame;\n /** The stage capability — the demand getter reads visibility LIVE off it. */\n stage: StageCapability;\n render: (page: PageContextValue) => React.ReactNode;\n chrome?: (page: PageContextValue) => React.ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const t = page.transform;\n const rotation = page.rotation;\n // All geometry comes from the transform: the DISPLAY footprint (viewWidth/Height,\n // already w↔h-swapped + device-snapped) and the UN-rotated content box\n // (contentWidth/Height). The shell never re-derives `* zoom` / `* dpr` / snapping.\n const outerW = t.viewWidth + frame.left + frame.right;\n const outerH = t.viewHeight + frame.top + frame.bottom;\n // page.screenX/screenY are the device-snapped footprint top-left; the outer box\n // sits one frame further out so the content keeps its scene position.\n const left = page.screenX - frame.left;\n const top = page.screenY - frame.top;\n // Center the (possibly rotated) content box on the display box and rotate about\n // its center — NO translate(), so rotation 0 carries no transform and pixel-snaps\n // like the axis-aligned shadow behind it (no hairline seam).\n const contentLeft = frame.left + (t.viewWidth - t.contentWidth) / 2;\n const contentTop = frame.top + (t.viewHeight - t.contentHeight) / 2;\n // The page-view DEMAND is a PULL: the getter closes over\n // stable references (capability + pon) and reads the stage's live state at\n // call time — visibility is the STAGE's data (`VisiblePage.visibleRect`),\n // not something an adapter re-derives or caches. Absent from the visible\n // set = zero rect (\"want nothing\"), distinct from PageView's undefined\n // getter (\"whole page\").\n const ctx = useMemo(\n () =>\n makePageContext(\n documentId,\n page.pon,\n page.pageIndex,\n frame,\n t,\n () => ref.current!.getBoundingClientRect(),\n () => {\n const live = stage.visiblePages().find((p) => p.pon === page.pon);\n return live\n ? { desiredDeviceWidth: live.transform.deviceWidth, visibleRect: live.visibleRect }\n : {\n desiredDeviceWidth: t.deviceWidth,\n visibleRect: { x: 0, y: 0, width: 0, height: 0 },\n };\n },\n ),\n [documentId, page.pon, page.pageIndex, frame, t, stage],\n );\n return (\n <div style={{ position: 'absolute', left, top, width: outerW, height: outerH }}>\n <PageProvider value={ctx}>\n {/* drop shadow ONLY — axis-aligned at the content box (inset by the frame),\n transparent fill so it can never peek out behind the bitmap, and it\n stays put under rotation. */}\n <div\n style={{\n position: 'absolute',\n left: frame.left,\n top: frame.top,\n width: t.viewWidth,\n height: t.viewHeight,\n boxShadow: '0 6px 18px rgba(0,0,0,.18)',\n }}\n />\n {/* the page: white backing + bitmap as ONE rasterized box, so there is no\n seam between them and nothing white larger than the bitmap to leak.\n The ONLY thing rotation turns; markers/annotations ride it in content\n coordinates. Rotation 0 carries no transform → pixel-snaps cleanly. */}\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 // We render our own selection highlights — suppress native text/image\n // selection (and the double-click image grab) on the whole page subtree.\n userSelect: 'none',\n WebkitUserSelect: 'none',\n }}\n >\n {render(ctx)}\n </div>\n {/* box-space chrome — labels, selection border, per-page buttons — fills\n the outer box, NEVER rotates. Bands are plain regions: a label is\n `bottom:0; height: frame.bottom`, a button row `top:0; height: frame.top`. */}\n {chrome?.(ctx)}\n </PageProvider>\n </div>\n );\n}\n\nexport interface StageProps {\n /**\n * PAGE-SPACE content for each visible page (RenderLayer, annotations,\n * markers). Rendered inside the page's content frame, so it ROTATES with the\n * page's display rotation — coordinates are plain PDF points.\n */\n children: (page: PageContextValue) => React.ReactNode;\n /**\n * BOX-SPACE chrome for each visible page (page-number label, selection\n * border, a per-page rotate/delete button). Rendered into the OUTER box\n * (content + reserved `pageFrame`), so it does NOT rotate and the reserved\n * bands are plain regions (`bottom:0; height: page.frame.bottom`). The three\n * coordinate spaces: `children` (page content), `pageChrome` (page box +\n * frame), `overlay` (viewport).\n */\n pageChrome?: (page: PageContextValue) => React.ReactNode;\n /** Viewport-space UI (menus, controls) rendered above the pages. */\n overlay?: React.ReactNode;\n /**\n * Route this Stage's pointer events to the interaction hub (page-resolved via\n * `pageAt`) instead of the built-in drag-to-pan. Pan then becomes the `pan`\n * tool's job and dragging in `pointer` mode selects text (incl. across pages).\n * Pair with `stagePlugin({ interaction: true })`. Default false (built-in pan).\n */\n interaction?: boolean;\n /**\n * Ambient ZOOM gestures on this stage: ctrl/cmd+wheel and trackpad pinch\n * (Safari gesture events included). Default true. Turn OFF for follower\n * lenses with a fixed magnification — a thumbnail rail should scroll under\n * cmd+wheel, not zoom — so a zoom-wheel falls through to ordinary wheel\n * pan, and pinches are still swallowed (they never page-zoom the browser).\n */\n zoomGestures?: boolean;\n /** The stage lens to drive (default: the main StageToken). */\n token?: StageTokenProp;\n className?: string;\n style?: React.CSSProperties;\n}\n\nexport function Stage({\n children,\n pageChrome,\n overlay,\n interaction = false,\n zoomGestures = true,\n token = StageToken,\n className,\n style,\n}: StageProps) {\n const stage = useCapability(token);\n const ix = useOptionalCapability(InteractionToken);\n const useHub = interaction && !!ix;\n // The hub's resolved cursor (text/grab/…), applied to the viewport when driving.\n const hubCursor = useKernelValue(() => ix?.cursor() ?? 'default');\n const ref = useRef<HTMLDivElement>(null);\n const docId = useDocumentId();\n // visiblePages already folds in the camera (each page carries its device-snapped\n // screenX/screenY + transform), so panning re-emits the list — no separate\n // camera subscription needed for positioning.\n const pages = useSelector(token, (c) => c.visiblePages()); // memoized -> stable ref\n // Reserved chrome bands (screen px), uniform across pages — the frame the\n // outer box reserves and `pageChrome` paints into.\n const frame = useSelector(\n token,\n (c) => c.pageFrame(),\n (a, b) => a.top === b.top && a.right === b.right && a.bottom === b.bottom && a.left === b.left,\n );\n\n useEffect(() => {\n const el = ref.current!;\n // Only report the viewport size. Initial placement (home) is the Stage plugin's\n // job — it watches the viewport and homes once it's ready (and a higher-priority\n // initial-view provider can override that). The shell stays dumb.\n const setVp = () => stage.setViewport({ width: el.clientWidth, height: el.clientHeight });\n const ro = new ResizeObserver(setVp);\n ro.observe(el);\n setVp();\n\n // Report the device pixel ratio so page transforms render crisp. dppx changes\n // (zoom, dragging between monitors) fire the media query; re-subscribe each\n // time since the query value itself moves.\n let mq: MediaQueryList | null = null;\n const reportDpr = () => {\n stage.setDevicePixelRatio(window.devicePixelRatio || 1);\n mq?.removeEventListener('change', reportDpr);\n mq = window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);\n mq.addEventListener('change', reportDpr);\n };\n reportDpr();\n\n // Wheel is ambient navigation in BOTH modes: ctrl/meta zooms (classified\n // per input — synthesized pinch, mouse notch, cmd-scroll scrub — by\n // wheelZoomFactor), else scrolls. With zoom gestures off, a zoom-wheel\n // falls through to ordinary pan (a cmd+scroll over a thumbnail rail\n // scrolls the rail).\n const onWheel = (e: WheelEvent) => {\n e.preventDefault();\n const r = el.getBoundingClientRect();\n if (zoomGestures && (e.ctrlKey || e.metaKey)) {\n stage.zoomAround({ x: e.clientX - r.left, y: e.clientY - r.top }, wheelZoomFactor(e));\n } else {\n const dx = e.shiftKey ? e.deltaY : e.deltaX;\n const dy = e.shiftKey ? e.deltaX : e.deltaY;\n stage.panBy(-dx, -dy);\n }\n };\n el.addEventListener('wheel', onWheel, { passive: false });\n\n // Safari never synthesizes ctrl+wheel for trackpad pinch — it fires\n // proprietary gesture events carrying an ABSOLUTE scale; convert to the\n // per-event ratio the camera physics wants. Feature-detected: Chrome and\n // Firefox don't have GestureEvent, so this wiring costs them nothing.\n // preventDefault runs even with zoom gestures off — a pinch over the\n // stage must never zoom the page itself.\n let lastScale = 1;\n const onGestureStart = (e: Event) => {\n e.preventDefault();\n lastScale = (e as unknown as { scale?: number }).scale ?? 1;\n };\n const onGestureChange = (e: Event) => {\n e.preventDefault();\n const g = e as unknown as { scale?: number; clientX: number; clientY: number };\n const scale = g.scale ?? 1;\n if (zoomGestures && scale > 0) {\n const r = el.getBoundingClientRect();\n stage.zoomAround({ x: g.clientX - r.left, y: g.clientY - r.top }, scale / lastScale);\n }\n lastScale = scale;\n };\n const hasGestureEvents = 'GestureEvent' in window;\n if (hasGestureEvents) {\n el.addEventListener('gesturestart', onGestureStart);\n el.addEventListener('gesturechange', onGestureChange);\n el.addEventListener('gestureend', onGestureStart); // reset the base\n }\n\n const cleanups: Array<() => void> = [];\n if (useHub && ix) {\n // Forward to the hub: pan/select/etc. become tool-gated handlers. `pageAt`\n // resolves the page per event, so a drag can cross pages (text selection).\n const clicks = createClickCounter();\n const forward = (phase: PointerSample['phase'], e: PointerEvent, clickCount = 1) => {\n const r = el.getBoundingClientRect();\n const vpt = { x: e.clientX - r.left, y: e.clientY - r.top };\n ix.dispatch({\n phase,\n viewport: vpt,\n page: stage.pageAt(vpt) ?? undefined,\n // Page-anchored gestures (annotation move/resize) track the origin\n // page's frame through this even when the cursor is off that page.\n project: (pon) => stage.pointOnPage(pon, vpt),\n modifiers: { shift: e.shiftKey, alt: e.altKey, ctrl: e.ctrlKey, meta: e.metaKey },\n clickCount,\n });\n };\n let dragging = false;\n const down = (e: PointerEvent) => {\n if (e.button !== 0) return;\n dragging = true;\n forward('down', e, clicks(Date.now(), e.clientX, e.clientY));\n };\n const hover = (e: PointerEvent) => {\n if (!dragging) forward('move', e); // cursor feedback, no gesture\n };\n const winMove = (e: PointerEvent) => {\n if (dragging) forward('move', e);\n };\n const up = (e: PointerEvent) => {\n if (!dragging) return;\n dragging = false;\n forward('up', e);\n };\n el.addEventListener('pointerdown', down);\n el.addEventListener('pointermove', hover);\n window.addEventListener('pointermove', winMove);\n window.addEventListener('pointerup', up);\n cleanups.push(() => {\n el.removeEventListener('pointerdown', down);\n el.removeEventListener('pointermove', hover);\n window.removeEventListener('pointermove', winMove);\n window.removeEventListener('pointerup', up);\n });\n } else {\n // Built-in drag-to-pan (no interaction hub) — unchanged behaviour.\n let dragging = false;\n let lx = 0;\n let ly = 0;\n const down = (e: PointerEvent) => {\n if (e.button !== 0) return;\n dragging = true;\n lx = e.clientX;\n ly = e.clientY;\n };\n const move = (e: PointerEvent) => {\n if (!dragging) return;\n stage.panBy(e.clientX - lx, e.clientY - ly);\n lx = e.clientX;\n ly = e.clientY;\n };\n const up = () => {\n dragging = false;\n };\n el.addEventListener('pointerdown', down);\n window.addEventListener('pointermove', move);\n window.addEventListener('pointerup', up);\n cleanups.push(() => {\n el.removeEventListener('pointerdown', down);\n window.removeEventListener('pointermove', move);\n window.removeEventListener('pointerup', up);\n });\n }\n\n return () => {\n ro.disconnect();\n mq?.removeEventListener('change', reportDpr);\n el.removeEventListener('wheel', onWheel);\n if (hasGestureEvents) {\n el.removeEventListener('gesturestart', onGestureStart);\n el.removeEventListener('gesturechange', onGestureChange);\n el.removeEventListener('gestureend', onGestureStart);\n }\n cleanups.forEach((fn) => fn());\n };\n }, [stage, ix, useHub, zoomGestures]);\n\n return (\n <div\n ref={ref}\n className={className}\n style={{\n position: 'relative',\n overflow: 'hidden',\n touchAction: 'none',\n ...(useHub ? { cursor: hubCursor } : null),\n ...style,\n }}\n >\n {pages.map((p) => (\n <PageSurface\n key={p.pageIndex}\n documentId={docId ?? ''}\n page={p}\n frame={frame}\n stage={stage}\n render={children}\n chrome={pageChrome}\n />\n ))}\n {overlay}\n </div>\n );\n}\n\n// ── Facade hooks — thin sugar over the capability + generic binding ───────────\nexport function useStage(token: StageTokenProp = StageToken) {\n return useCapability(token);\n}\nexport function useZoom(token: StageTokenProp = StageToken) {\n const s = useCapability(token);\n const zoom = useSelector(token, (c) => c.zoomLevel());\n const mode = useSelector(token, (c) => c.zoomMode());\n return {\n zoom,\n /** Active zoom intent: 'automatic' | 'fit-page' | 'fit-width' | 'fit-all' | 'custom'. */\n mode,\n zoomIn: s.zoomIn,\n zoomOut: s.zoomOut,\n fitWidth: s.fitWidth,\n fitPage: s.fitPage,\n fitAll: s.fitAll,\n automatic: s.automatic,\n zoomTo: s.zoomTo,\n };\n}\nexport function usePages(token: StageTokenProp = StageToken) {\n const s = useCapability(token);\n const currentPage = useSelector(token, (c) => c.currentPage());\n const pageCount = useSelector(token, (c) => c.pageCount());\n return {\n currentPage,\n pageCount,\n goToPage: s.goToPage,\n next: s.next,\n prev: s.prev,\n reveal: s.reveal,\n };\n}\nexport function useLayout(token: StageTokenProp = StageToken) {\n const s = useCapability(token);\n const flow = useSelector(token, (c) => c.flow());\n const layout = useSelector(token, (c) => c.layout());\n const spread = useSelector(token, (c) => c.spread());\n const sizing = useSelector(token, (c) => c.sizing());\n const bounded = useSelector(token, (c) => c.bounded());\n return {\n flow,\n layout,\n spread,\n sizing,\n bounded,\n setFlow: s.setFlow,\n setLayout: s.setLayout,\n setSpread: s.setSpread,\n setSizing: s.setSizing,\n setBounded: s.setBounded,\n };\n}\n\n/** The document's page list (with PDF labels) + the current item's pages — the\n * data for page thumbnails / worksheet-style page tabs. */\nexport function usePageList(token: StageTokenProp = StageToken) {\n const pages = useSelector(\n token,\n (c) => c.pages(),\n (a, b) =>\n a.length === b.length && a.every((p, i) => p.pon === b[i].pon && p.label === b[i].label),\n );\n const current = useSelector(\n token,\n (c) => c.currentItemPages(),\n (a, b) => a.length === b.length && a.every((x, i) => x === b[i]),\n );\n return { pages, currentItemPages: current };\n}\n\n/**\n * All Stage settings + the batch `update`. This is the seam for \"presets are a\n * customer concern\": keep your own `Partial<StageSettings>` objects and apply them\n * with `update(preset)` (one anchor-preserving change).\n */\nexport function useStageSettings(token: StageTokenProp = StageToken) {\n const s = useCapability(token);\n // settingsEqual derives from the plugin's settings registry — a new setting is\n // covered here automatically, without this package spelling out the shape.\n const settings = useSelector(token, (c) => c.settings(), settingsEqual);\n return { settings, update: s.update, reset: s.resetView };\n}\n"],"mappings":";;;;;;;;;;AAkCA,SAAS,YAAY,EACnB,YACA,MACA,OACA,OACA,QACA,UAWC;CACD,MAAM,OAAA,GAAA,MAAA,OAAA,CAA6B,IAAI;CACvC,MAAM,IAAI,KAAK;CACf,MAAM,WAAW,KAAK;CAItB,MAAM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