@embedpdf/plugin-page-edit 3.0.0-next.14 → 3.0.0-next.16

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.
@@ -1,82 +0,0 @@
1
- import { AbortablePromise, PageDeleteResult, PageInsertResult, PageMoveResult, PageObjectNumber, PageRotateResult, PageRotation, PdfSize } from "@embedpdf/core";
2
- //#region src/types.d.ts
3
- /**
4
- * Where added pages land. The PON anchors are the thumbnail gestures ("+
5
- * after this page") and stay correct across a concurrent reorder between
6
- * click and call — a raw index does not; `index` remains for absolute
7
- * positions ("at the start"). Omitted → append. Resolved to the engine's
8
- * index wire by the capability at call time, from the registry.
9
- */
10
- type PagePlacement = {
11
- after: PageObjectNumber;
12
- } | {
13
- before: PageObjectNumber;
14
- } | {
15
- index: number;
16
- };
17
- /**
18
- * Structural page edits, addressed by durable PON (never display index — an
19
- * index shifts the moment a sibling is moved or deleted). Mirrors the engine's
20
- * `DocumentPagesService` 1:1, with one addition the engine can't have: the
21
- * relative `rotateBy` gesture. The engine wire is always ABSOLUTE; turning a
22
- * "+90° on this thumbnail" click into an absolute value needs the page's
23
- * current rotation, so that read+arithmetic lives HERE — once — instead of
24
- * being re-derived in every framework adapter's click handler.
25
- *
26
- * Document-scoped: rotation is shared document metadata, so editing through the
27
- * sidebar lens and seeing it in the main lens is automatic (both read the same
28
- * registry, which the kernel keeps in sync from the engine's event stream).
29
- */
30
- interface PageEditCapability {
31
- /**
32
- * Whether this caller is authorized to perform structural page edits —
33
- * `effectiveScope` includes `doc.pages.assemble` (PDF bit 11). UIs gate
34
- * ALL their edit affordances on this, the add verbs included (rotate,
35
- * move, delete, addBlank, and insert share the one capability); the
36
- * engine independently enforces the same capability and throws
37
- * `PermissionDenied` if a call slips through.
38
- */
39
- canEdit(): boolean;
40
- /**
41
- * Rotate a SINGLE page by a relative quarter-turn — the per-thumbnail button
42
- * gesture. Reads the page's current rotation from the registry and forwards
43
- * the resulting absolute rotation to the engine.
44
- */
45
- rotateBy(pon: PageObjectNumber, delta: 90 | -90): AbortablePromise<PageRotateResult>;
46
- /**
47
- * Set the ABSOLUTE rotation of one or more pages to a single shared value —
48
- * the multi-select gesture. Maps 1:1 to the engine.
49
- */
50
- setRotation(pons: PageObjectNumber[], rotation: PageRotation): AbortablePromise<PageRotateResult>;
51
- /** Reorder pages (by PON) as a contiguous block starting at `destIndex`. */
52
- move(pons: PageObjectNumber[], destIndex: number): AbortablePromise<PageMoveResult>;
53
- /** Delete pages by PON. The engine rejects deleting every page. */
54
- delete(pons: PageObjectNumber[]): AbortablePromise<PageDeleteResult>;
55
- /**
56
- * Create blank pages — gate the affordance on `canEdit()`, like every
57
- * other structure verb (the add verbs share the `doc.pages.assemble`
58
- * capability and are mandatory on the engine contract). `size` defaults
59
- * to the page the new pages sit beside — the anchor for PON placements,
60
- * else the insertion point's predecessor, else the last page — so "add
61
- * page" matches the document without an A4-vs-Letter guess. That default
62
- * is a registry read, which is why it lives HERE and the engine wire
63
- * stays explicit (the `rotateBy` law). `count` defaults to 1.
64
- */
65
- addBlank(opts?: {
66
- size?: PdfSize;
67
- count?: number;
68
- placement?: PagePlacement;
69
- }): AbortablePromise<PageInsertResult>;
70
- /**
71
- * Copy every page of a standalone PDF (`bytes`) in at the placement —
72
- * the merge/import gesture. Forwards to `pages.insert`; the inserted
73
- * copies get fresh PONs, returned in insertion order.
74
- */
75
- insert(bytes: Uint8Array | ArrayBuffer, opts?: {
76
- placement?: PagePlacement;
77
- }): AbortablePromise<PageInsertResult>;
78
- }
79
- declare const PageEditToken: import("@embedpdf/core").CapabilityToken<PageEditCapability>;
80
- //#endregion
81
- export { PageEditToken as n, PageEditCapability as t };
82
- //# sourceMappingURL=contract-BnXi11KD.d.ts.map
@@ -1,7 +0,0 @@
1
- import { createCapabilityToken } from "@embedpdf/core";
2
- //#region src/types.ts
3
- const PageEditToken = createCapabilityToken("page-edit");
4
- //#endregion
5
- export { PageEditToken as t };
6
-
7
- //# sourceMappingURL=contract-BsNelyd8.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract-BsNelyd8.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import {\n createCapabilityToken,\n type AbortablePromise,\n type PageObjectNumber,\n type PageRotation,\n type PageRotateResult,\n type PageMoveResult,\n type PageDeleteResult,\n type PageInsertResult,\n type PdfSize,\n} from '@embedpdf/core';\n\n/**\n * Where added pages land. The PON anchors are the thumbnail gestures (\"+\n * after this page\") and stay correct across a concurrent reorder between\n * click and call — a raw index does not; `index` remains for absolute\n * positions (\"at the start\"). Omitted → append. Resolved to the engine's\n * index wire by the capability at call time, from the registry.\n */\nexport type PagePlacement =\n | { after: PageObjectNumber }\n | { before: PageObjectNumber }\n | { index: number };\n\n/**\n * Structural page edits, addressed by durable PON (never display index — an\n * index shifts the moment a sibling is moved or deleted). Mirrors the engine's\n * `DocumentPagesService` 1:1, with one addition the engine can't have: the\n * relative `rotateBy` gesture. The engine wire is always ABSOLUTE; turning a\n * \"+90° on this thumbnail\" click into an absolute value needs the page's\n * current rotation, so that read+arithmetic lives HERE — once — instead of\n * being re-derived in every framework adapter's click handler.\n *\n * Document-scoped: rotation is shared document metadata, so editing through the\n * sidebar lens and seeing it in the main lens is automatic (both read the same\n * registry, which the kernel keeps in sync from the engine's event stream).\n */\nexport interface PageEditCapability {\n /**\n * Whether this caller is authorized to perform structural page edits —\n * `effectiveScope` includes `doc.pages.assemble` (PDF bit 11). UIs gate\n * ALL their edit affordances on this, the add verbs included (rotate,\n * move, delete, addBlank, and insert share the one capability); the\n * engine independently enforces the same capability and throws\n * `PermissionDenied` if a call slips through.\n */\n canEdit(): boolean;\n\n /**\n * Rotate a SINGLE page by a relative quarter-turn — the per-thumbnail button\n * gesture. Reads the page's current rotation from the registry and forwards\n * the resulting absolute rotation to the engine.\n */\n rotateBy(pon: PageObjectNumber, delta: 90 | -90): AbortablePromise<PageRotateResult>;\n\n /**\n * Set the ABSOLUTE rotation of one or more pages to a single shared value —\n * the multi-select gesture. Maps 1:1 to the engine.\n */\n setRotation(pons: PageObjectNumber[], rotation: PageRotation): AbortablePromise<PageRotateResult>;\n\n /** Reorder pages (by PON) as a contiguous block starting at `destIndex`. */\n move(pons: PageObjectNumber[], destIndex: number): AbortablePromise<PageMoveResult>;\n\n /** Delete pages by PON. The engine rejects deleting every page. */\n delete(pons: PageObjectNumber[]): AbortablePromise<PageDeleteResult>;\n\n /**\n * Create blank pages — gate the affordance on `canEdit()`, like every\n * other structure verb (the add verbs share the `doc.pages.assemble`\n * capability and are mandatory on the engine contract). `size` defaults\n * to the page the new pages sit beside — the anchor for PON placements,\n * else the insertion point's predecessor, else the last page — so \"add\n * page\" matches the document without an A4-vs-Letter guess. That default\n * is a registry read, which is why it lives HERE and the engine wire\n * stays explicit (the `rotateBy` law). `count` defaults to 1.\n */\n addBlank(opts?: {\n size?: PdfSize;\n count?: number;\n placement?: PagePlacement;\n }): AbortablePromise<PageInsertResult>;\n\n /**\n * Copy every page of a standalone PDF (`bytes`) in at the placement —\n * the merge/import gesture. Forwards to `pages.insert`; the inserted\n * copies get fresh PONs, returned in insertion order.\n */\n insert(\n bytes: Uint8Array | ArrayBuffer,\n opts?: { placement?: PagePlacement },\n ): AbortablePromise<PageInsertResult>;\n}\n\nexport const PageEditToken = createCapabilityToken<PageEditCapability>('page-edit');\n"],"mappings":";;AA8FA,MAAa,gBAAgB,sBAA0C,WAAW"}
@@ -1,11 +0,0 @@
1
- //#region src/types.ts
2
- const PageEditToken = (0, require("@embedpdf/core").createCapabilityToken)("page-edit");
3
- //#endregion
4
- Object.defineProperty(exports, "PageEditToken", {
5
- enumerable: true,
6
- get: function() {
7
- return PageEditToken;
8
- }
9
- });
10
-
11
- //# sourceMappingURL=contract-UeGRCn-t.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contract-UeGRCn-t.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import {\n createCapabilityToken,\n type AbortablePromise,\n type PageObjectNumber,\n type PageRotation,\n type PageRotateResult,\n type PageMoveResult,\n type PageDeleteResult,\n type PageInsertResult,\n type PdfSize,\n} from '@embedpdf/core';\n\n/**\n * Where added pages land. The PON anchors are the thumbnail gestures (\"+\n * after this page\") and stay correct across a concurrent reorder between\n * click and call — a raw index does not; `index` remains for absolute\n * positions (\"at the start\"). Omitted → append. Resolved to the engine's\n * index wire by the capability at call time, from the registry.\n */\nexport type PagePlacement =\n | { after: PageObjectNumber }\n | { before: PageObjectNumber }\n | { index: number };\n\n/**\n * Structural page edits, addressed by durable PON (never display index — an\n * index shifts the moment a sibling is moved or deleted). Mirrors the engine's\n * `DocumentPagesService` 1:1, with one addition the engine can't have: the\n * relative `rotateBy` gesture. The engine wire is always ABSOLUTE; turning a\n * \"+90° on this thumbnail\" click into an absolute value needs the page's\n * current rotation, so that read+arithmetic lives HERE — once — instead of\n * being re-derived in every framework adapter's click handler.\n *\n * Document-scoped: rotation is shared document metadata, so editing through the\n * sidebar lens and seeing it in the main lens is automatic (both read the same\n * registry, which the kernel keeps in sync from the engine's event stream).\n */\nexport interface PageEditCapability {\n /**\n * Whether this caller is authorized to perform structural page edits —\n * `effectiveScope` includes `doc.pages.assemble` (PDF bit 11). UIs gate\n * ALL their edit affordances on this, the add verbs included (rotate,\n * move, delete, addBlank, and insert share the one capability); the\n * engine independently enforces the same capability and throws\n * `PermissionDenied` if a call slips through.\n */\n canEdit(): boolean;\n\n /**\n * Rotate a SINGLE page by a relative quarter-turn — the per-thumbnail button\n * gesture. Reads the page's current rotation from the registry and forwards\n * the resulting absolute rotation to the engine.\n */\n rotateBy(pon: PageObjectNumber, delta: 90 | -90): AbortablePromise<PageRotateResult>;\n\n /**\n * Set the ABSOLUTE rotation of one or more pages to a single shared value —\n * the multi-select gesture. Maps 1:1 to the engine.\n */\n setRotation(pons: PageObjectNumber[], rotation: PageRotation): AbortablePromise<PageRotateResult>;\n\n /** Reorder pages (by PON) as a contiguous block starting at `destIndex`. */\n move(pons: PageObjectNumber[], destIndex: number): AbortablePromise<PageMoveResult>;\n\n /** Delete pages by PON. The engine rejects deleting every page. */\n delete(pons: PageObjectNumber[]): AbortablePromise<PageDeleteResult>;\n\n /**\n * Create blank pages — gate the affordance on `canEdit()`, like every\n * other structure verb (the add verbs share the `doc.pages.assemble`\n * capability and are mandatory on the engine contract). `size` defaults\n * to the page the new pages sit beside — the anchor for PON placements,\n * else the insertion point's predecessor, else the last page — so \"add\n * page\" matches the document without an A4-vs-Letter guess. That default\n * is a registry read, which is why it lives HERE and the engine wire\n * stays explicit (the `rotateBy` law). `count` defaults to 1.\n */\n addBlank(opts?: {\n size?: PdfSize;\n count?: number;\n placement?: PagePlacement;\n }): AbortablePromise<PageInsertResult>;\n\n /**\n * Copy every page of a standalone PDF (`bytes`) in at the placement —\n * the merge/import gesture. Forwards to `pages.insert`; the inserted\n * copies get fresh PONs, returned in insertion order.\n */\n insert(\n bytes: Uint8Array | ArrayBuffer,\n opts?: { placement?: PagePlacement },\n ): AbortablePromise<PageInsertResult>;\n}\n\nexport const PageEditToken = createCapabilityToken<PageEditCapability>('page-edit');\n"],"mappings":";AA8FA,MAAa,iBAAA,2BAAA,CAAA,CAAA,sBAAA,CAA0D,WAAW"}