@embedpdf/plugin-annotation 3.0.0-next.1 → 3.0.0-next.11
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/authoring-BhtyfsMx.d.cts +37 -0
- package/dist/authoring-R4ezdnXd.d.ts +37 -0
- package/dist/authoring.cjs +16 -0
- package/dist/authoring.d.cts +2 -0
- package/dist/authoring.d.ts +2 -0
- package/dist/authoring.js +3 -0
- package/dist/{capability-hb2AU0f6.cjs → capability-Csb9WMm-.cjs} +816 -482
- package/dist/capability-Csb9WMm-.cjs.map +1 -0
- package/dist/{capability-fghl0JmE.js → capability-DBsr2D-L.js} +772 -420
- package/dist/capability-DBsr2D-L.js.map +1 -0
- package/dist/contract/host.cjs +3 -0
- package/dist/contract/host.d.cts +2 -0
- package/dist/contract/host.d.ts +2 -0
- package/dist/contract/host.js +2 -0
- package/dist/contract.cjs +8 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.d.cts +10 -0
- package/dist/contract.d.ts +10 -0
- package/dist/contract.js +8 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.cjs +104 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -47
- package/dist/index.d.ts +5 -47
- package/dist/index.js +96 -96
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +4 -2
- package/dist/internal.d.cts +2 -1
- package/dist/internal.d.ts +2 -1
- package/dist/internal.js +3 -1
- package/dist/seam-6pJeKOOJ.cjs +296 -0
- package/dist/seam-6pJeKOOJ.cjs.map +1 -0
- package/dist/seam-C4L_7rDt.js +225 -0
- package/dist/seam-C4L_7rDt.js.map +1 -0
- package/dist/types-CwytT-TI.js +13 -0
- package/dist/types-CwytT-TI.js.map +1 -0
- package/dist/types-DimcLIic.cjs +17 -0
- package/dist/types-DimcLIic.cjs.map +1 -0
- package/dist/{types-Da6JRmhw.d.ts → types-eLTpocXz.d.cts} +232 -25
- package/dist/{types-BhWgqgbX.d.cts → types-otwv-Cdl.d.ts} +232 -25
- package/package.json +21 -7
- package/dist/capability-fghl0JmE.js.map +0 -1
- package/dist/capability-hb2AU0f6.cjs.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PageObjectNumber } from "@embedpdf/core";
|
|
1
|
+
import { DocumentEvent, PageObjectNumber } from "@embedpdf/core";
|
|
2
|
+
import { AnnotCommitEntry, AnnotCommitResult } from "@embedpdf/plugin-actions/contract/host";
|
|
3
|
+
import { AnnotationAppearanceImage, AnnotationDTO, AnnotationDraft, AnnotationPatch, AnnotationRef, AttachmentContent, AttachmentFileSource, BinarySource, CommentThread, InkIntent, PdfActionTree, PdfLinkTarget, PdfRect } from "@embedpdf/engine-core/runtime";
|
|
4
|
+
import { AnnotationFlags, AnnotationProps, AnnotationPropsPatch, ChromeNode, ClickCreate, CreationDraftAnchor, Geom, Id, InkStraightenOptions, Model, PropKey, PropSpec, Rect, RenderItem, SnapSettings, Subtype, TextEndAnchor, TextQuad, Vec, ViewEnv } from "@embedpdf/core-annotation";
|
|
2
5
|
import { PageRotation } from "@embedpdf/core-geometry";
|
|
3
|
-
import { AnnotationAppearanceImage, AnnotationDTO, AnnotationDraft, AnnotationPatch, AnnotationRef, AttachmentContent, AttachmentFileSource, BinarySource, InkIntent, PdfLinkTarget, PdfRect } from "@embedpdf/engine-core/runtime";
|
|
4
|
-
import { AnnotationFlags, AnnotationProps, AnnotationPropsPatch, ChromeNode, ClickCreate, CreationDraftAnchor, Geom, Id, InkStraightenOptions, Model, PropKey, PropSpec, Rect, RenderItem, SnapSettings, Subtype, Vec, ViewEnv } from "@embedpdf/core-annotation";
|
|
5
6
|
//#region src/tools.d.ts
|
|
6
7
|
/**
|
|
7
8
|
* How a stamp-family tool resolves the image bytes it places — pure DATA, so a
|
|
@@ -315,8 +316,28 @@ interface ChromeSettingsPatch {
|
|
|
315
316
|
knob?: Partial<ChromeSettings['knob']>;
|
|
316
317
|
guides?: Partial<ChromeSettings['guides']>;
|
|
317
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Whole-document annotation hydration. The plugin always hydrates ALL
|
|
321
|
+
* pages through `doc.annotations.listRawAll()` (one bulk request on
|
|
322
|
+
* cloud, one worker job locally) — a comments sidebar needs every page,
|
|
323
|
+
* and per-page lazy loading could never truthfully claim completeness.
|
|
324
|
+
* `loading` covers the initial ingest AND a desync re-ingest; `error`
|
|
325
|
+
* means live events still apply but the whole-document view is
|
|
326
|
+
* incomplete until a rehydrate succeeds.
|
|
327
|
+
*/
|
|
328
|
+
type AnnotationHydration = {
|
|
329
|
+
status: 'loading';
|
|
330
|
+
} | {
|
|
331
|
+
status: 'complete';
|
|
332
|
+
} | {
|
|
333
|
+
status: 'error';
|
|
334
|
+
error: unknown;
|
|
335
|
+
} | {
|
|
336
|
+
status: 'forbidden';
|
|
337
|
+
};
|
|
318
338
|
interface AnnotationState {
|
|
319
339
|
model: Model;
|
|
340
|
+
hydration: AnnotationHydration;
|
|
320
341
|
chrome: ChromeSettings;
|
|
321
342
|
/**
|
|
322
343
|
* The armed tool's FOOTPRINT ghost: where (and what) the NEXT click would
|
|
@@ -377,6 +398,9 @@ interface AnnotationConfig {
|
|
|
377
398
|
type AnnotationAction = {
|
|
378
399
|
type: 'SET_MODEL';
|
|
379
400
|
model: Model;
|
|
401
|
+
} | {
|
|
402
|
+
type: 'SET_HYDRATION';
|
|
403
|
+
hydration: AnnotationHydration;
|
|
380
404
|
} | {
|
|
381
405
|
type: 'SET_CHROME';
|
|
382
406
|
patch: ChromeSettingsPatch;
|
|
@@ -398,6 +422,27 @@ interface LinkNavItem {
|
|
|
398
422
|
id: string;
|
|
399
423
|
rect: Rect;
|
|
400
424
|
target: PdfLinkTarget;
|
|
425
|
+
/**
|
|
426
|
+
* True for a link CHILD riding an editable annotation (an `/RT /Group`
|
|
427
|
+
* subordinate) — a PROPERTY of its parent while authoring, a nav behavior
|
|
428
|
+
* only while reading. The nav layer stands its anchors down for attached
|
|
429
|
+
* items whenever the active tool enables `annotation-edit`, so the parent
|
|
430
|
+
* stays selectable/movable; standalone document links navigate regardless.
|
|
431
|
+
*/
|
|
432
|
+
attached: boolean;
|
|
433
|
+
/** The full payload-carrying `/A` tree, when one exists — the action
|
|
434
|
+
* engine's dispatch input. `target` remains its root projection. */
|
|
435
|
+
activate?: PdfActionTree;
|
|
436
|
+
/** The annotation ref, carried for ActionSource context. */
|
|
437
|
+
ref?: AnnotationRef;
|
|
438
|
+
/** Which `/AA` hover trees this link carries — the nav layer's pump flags
|
|
439
|
+
* (tree-less hover must cost zero dispatches). Links are behavior-inert
|
|
440
|
+
* to the annotation plane's hover feed while navigable, so THEIR
|
|
441
|
+
* cursorEnter/cursorExit can only fire from the LinkLayer anchors. */
|
|
442
|
+
hoverEvents?: {
|
|
443
|
+
enter: boolean;
|
|
444
|
+
exit: boolean;
|
|
445
|
+
};
|
|
401
446
|
}
|
|
402
447
|
interface Behavior {
|
|
403
448
|
id: string;
|
|
@@ -459,11 +504,91 @@ interface TextItem {
|
|
|
459
504
|
* package root (`@embedpdf/plugin-annotation`).
|
|
460
505
|
*
|
|
461
506
|
* Framework-only plumbing (render projection, pointer gestures, behavior
|
|
462
|
-
* registration) lives on {@link AnnotationHostCapability}, reachable
|
|
463
|
-
*
|
|
507
|
+
* registration) lives on {@link AnnotationHostCapability}, reachable through
|
|
508
|
+
* `@embedpdf/plugin-annotation/contract/host` (and the framework's `/internal`
|
|
509
|
+
* entry). Both are the SAME runtime
|
|
464
510
|
* object — two typed lenses on one token — so app code simply can't see the host
|
|
465
511
|
* methods.
|
|
466
512
|
*/
|
|
513
|
+
/**
|
|
514
|
+
* Per-thread action gates, composed from two axes: authority (the
|
|
515
|
+
* engine's collab-resolver mirrors — `allowsAnnotationCreate` for
|
|
516
|
+
* reply/status, `allowsAnnotationMutation` against each target's
|
|
517
|
+
* stamped owner for edit/delete) and PDF state (the two lock flags
|
|
518
|
+
* gate DIFFERENT aspects, ISO 32000 Table 167: `lockedContents` blocks
|
|
519
|
+
* text edits, `locked` blocks deletion). A courtesy, not the guard — the
|
|
520
|
+
* engine independently enforces every write.
|
|
521
|
+
*/
|
|
522
|
+
interface CommentPermissions {
|
|
523
|
+
/** A reply is an annotation CREATE. */
|
|
524
|
+
canReply: boolean;
|
|
525
|
+
/** Editing this comment's text (`contents`) — gated by `lockedContents`. */
|
|
526
|
+
canEditText: boolean;
|
|
527
|
+
/** Deleting this one annotation — gated by `locked`. */
|
|
528
|
+
canDelete: boolean;
|
|
529
|
+
/** A status change is a NEW hidden annotation — create authority only,
|
|
530
|
+
* never edit rights on someone else's comment. */
|
|
531
|
+
canSetStatus: boolean;
|
|
532
|
+
/** `canDelete` over EVERY thread member (root, replies, grouped parts,
|
|
533
|
+
* state annotations) — the whole-thread preflight. */
|
|
534
|
+
canDeleteThread: boolean;
|
|
535
|
+
}
|
|
536
|
+
interface ThreadDeleteResult {
|
|
537
|
+
deleted: AnnotationRef[];
|
|
538
|
+
failed: Array<{
|
|
539
|
+
ref: AnnotationRef;
|
|
540
|
+
error: unknown;
|
|
541
|
+
}>;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* The conversation plane's surface: a derived, memoized threads index over
|
|
545
|
+
* the annotation substrate, plus the ISO-native verbs. Every verb compiles
|
|
546
|
+
* down to plain annotation creates/patches/deletes — one optimistic
|
|
547
|
+
* pipeline, no second write path — so remote SSE events, own edits, and
|
|
548
|
+
* hydration all update `threads()` for free.
|
|
549
|
+
*
|
|
550
|
+
* Threads carry `pageObjectNumber` (identity is PON, like everything
|
|
551
|
+
* else); DISPLAY order is a behavior of `threads()` (sorted against the
|
|
552
|
+
* live layout at computation time), and display labels (`pageIndex`) are a
|
|
553
|
+
* framework-hook enrichment — the layer that watches both stores.
|
|
554
|
+
*/
|
|
555
|
+
interface CommentsApi {
|
|
556
|
+
/** Every comment thread in the document, display-ordered, memoized. */
|
|
557
|
+
threads(): CommentThread[];
|
|
558
|
+
/** The thread containing ANY member ref (root, reply, grouped part, or
|
|
559
|
+
* state annotation), or null. */
|
|
560
|
+
thread(ref: AnnotationRef): CommentThread | null;
|
|
561
|
+
/** Whole-document hydration status (the sidebar's honest loading state). */
|
|
562
|
+
hydration(): AnnotationHydration;
|
|
563
|
+
/** Re-run whole-document hydration (desync recovery / manual refresh). */
|
|
564
|
+
rehydrate(): Promise<void>;
|
|
565
|
+
/** Reply to a thread. Writes FLAT (`/IRT` → the thread root, ISO reply
|
|
566
|
+
* type), whatever member was passed — presentation stays one level. */
|
|
567
|
+
reply(ref: AnnotationRef, text: string): Promise<AnnotationRef>;
|
|
568
|
+
/** Edit a comment's text. Appearance-inert for every kind except
|
|
569
|
+
* free-text and redaction (whose `/AP` paints `/Contents`). */
|
|
570
|
+
edit(ref: AnnotationRef, text: string): Promise<void>;
|
|
571
|
+
/**
|
|
572
|
+
* Set this session's review status on the thread (ISO 32000 §12.5.6.3):
|
|
573
|
+
* creates a hidden state annotation chained to the caller's previous
|
|
574
|
+
* status when one exists, else to the root. The target annotation is
|
|
575
|
+
* never modified. Known states: accepted / rejected / cancelled /
|
|
576
|
+
* completed / none (custom vocabularies ride the raw create API).
|
|
577
|
+
*/
|
|
578
|
+
setStatus(ref: AnnotationRef, state: string): Promise<void>;
|
|
579
|
+
/** Toggle this session's Marked-model checkmark on the thread. */
|
|
580
|
+
setMarked(ref: AnnotationRef, marked: boolean): Promise<void>;
|
|
581
|
+
/** Delete exactly ONE annotation (a reply, a status, or a bare root). */
|
|
582
|
+
remove(ref: AnnotationRef): Promise<void>;
|
|
583
|
+
/**
|
|
584
|
+
* Delete a WHOLE thread, children first. Preflighted: when any member
|
|
585
|
+
* fails the delete gate the call returns every blocked ref as `failed`
|
|
586
|
+
* and deletes nothing; mid-flight races surface the same way.
|
|
587
|
+
*/
|
|
588
|
+
removeThread(ref: AnnotationRef): Promise<ThreadDeleteResult>;
|
|
589
|
+
/** Truthful per-thread action gates for the ref's thread. */
|
|
590
|
+
permissionsFor(ref: AnnotationRef): CommentPermissions;
|
|
591
|
+
}
|
|
467
592
|
interface AnnotationCapability {
|
|
468
593
|
/**
|
|
469
594
|
* Create an annotation on a page. `draft` is the engine-core draft for its
|
|
@@ -515,9 +640,27 @@ interface AnnotationCapability {
|
|
|
515
640
|
* free-text kind). Drives the same sidebar when nothing is selected, paired
|
|
516
641
|
* with {@link currentDefaults}/{@link setDefaults}. */
|
|
517
642
|
propsForTool(toolId: string): PropSpec[];
|
|
643
|
+
canRead(): boolean;
|
|
518
644
|
canCreate(): boolean;
|
|
519
645
|
canEdit(ref: AnnotationRef): boolean;
|
|
520
646
|
canDelete(ref: AnnotationRef): boolean;
|
|
647
|
+
/** The conversation plane's read/write surface — see {@link CommentsApi}. */
|
|
648
|
+
comments: CommentsApi;
|
|
649
|
+
/**
|
|
650
|
+
* The attached-link lens: an annotation's link is a `/Link` CHILD grouped
|
|
651
|
+
* under it in the document (ISO-native, Acrobat-interoperable) — a
|
|
652
|
+
* PROPERTY while authoring, a nav BEHAVIOR while reading. `of` derives
|
|
653
|
+
* from the committed children (the one source of truth); `set`/`clear`
|
|
654
|
+
* resolve when the children are committed, after which `of` reflects the
|
|
655
|
+
* change. `updateSelection({ link })` remains the props-pipeline alias.
|
|
656
|
+
* On the link KIND itself, `of` reads the annotation's own `/A` target
|
|
657
|
+
* (retarget standalone links via `updateSelection`).
|
|
658
|
+
*/
|
|
659
|
+
links: {
|
|
660
|
+
of(ref: AnnotationRef): PdfLinkTarget | null;
|
|
661
|
+
set(ref: AnnotationRef, target: PdfLinkTarget): Promise<void>;
|
|
662
|
+
clear(ref: AnnotationRef): Promise<void>;
|
|
663
|
+
};
|
|
521
664
|
/** The annotation for a ref, or null if unknown / not yet committed. */
|
|
522
665
|
get(ref: AnnotationRef): AnnotationDTO | null;
|
|
523
666
|
/** Every committed annotation on a page, in z-order. */
|
|
@@ -604,6 +747,21 @@ interface AnnotationCapability {
|
|
|
604
747
|
* (`extends`, per-tool `defaults`, …). Returns an unregister fn.
|
|
605
748
|
*/
|
|
606
749
|
registerTool(def: AnnotationToolInput): () => void;
|
|
750
|
+
/**
|
|
751
|
+
* Turn the CURRENT text selection into markup annotations — one per
|
|
752
|
+
* selected page, from the selection's oriented per-line quads — then clear
|
|
753
|
+
* the selection. The one-call form of what the markup tools do on
|
|
754
|
+
* commit, made for selection-menu buttons ("Highlight") and automation.
|
|
755
|
+
* `preset` is a tool id whose defaults style the markup (e.g.
|
|
756
|
+
* `'highlight'`); defaults to the subtype's own. Returns false (and does
|
|
757
|
+
* nothing) when no selection plugin is installed or nothing is selected.
|
|
758
|
+
*/
|
|
759
|
+
markupFromSelection(subtype: Subtype, preset?: string): boolean;
|
|
760
|
+
/** Commit the in-progress multi-click creation draft (no-op when there is
|
|
761
|
+
* none, or it can't finish yet — see `creationDraftAnchor().canFinish`). */
|
|
762
|
+
finishCreationDraft(): void;
|
|
763
|
+
/** Discard the in-progress multi-click creation draft. */
|
|
764
|
+
cancelCreationDraft(): void;
|
|
607
765
|
deleteSelection(): void;
|
|
608
766
|
deselect(): void;
|
|
609
767
|
cancel(): void;
|
|
@@ -675,8 +833,9 @@ type FilePickerProvider = (req: FilePromptRequest) => Promise<AttachmentFileSour
|
|
|
675
833
|
/**
|
|
676
834
|
* The HOST (framework) surface: everything the render layer, the interaction hub,
|
|
677
835
|
* and sibling plugins need, on top of the public {@link AnnotationCapability}.
|
|
678
|
-
*
|
|
679
|
-
*
|
|
836
|
+
* Host-only — sibling plugins import the token from
|
|
837
|
+
* `@embedpdf/plugin-annotation/contract/host`; framework implementation code may
|
|
838
|
+
* use `/internal`. Never use either from application code.
|
|
680
839
|
*/
|
|
681
840
|
interface AnnotationHostCapability extends AnnotationCapability {
|
|
682
841
|
/** `view` (the page's scale + total display rotation, from its transform)
|
|
@@ -723,6 +882,9 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
723
882
|
* the renderer places the baked bitmap by its OWN `/Rect` without touching the
|
|
724
883
|
* PDF↔content seam. Null if the page's crop box is unknown. */
|
|
725
884
|
toContentBox(pon: PageObjectNumber, rect: PdfRect): Rect | null;
|
|
885
|
+
/** No-op since whole-document hydration: the model is seeded by
|
|
886
|
+
* `listRawAll()` at document open. Kept as API for layers that call it
|
|
887
|
+
* on page mount. */
|
|
726
888
|
ensurePage(pon: PageObjectNumber): void;
|
|
727
889
|
/**
|
|
728
890
|
* Drop and RE-READ one page's annotations from the engine — the hook for
|
|
@@ -732,6 +894,21 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
732
894
|
* created.
|
|
733
895
|
*/
|
|
734
896
|
reloadPage(pon: PageObjectNumber): Promise<void>;
|
|
897
|
+
/** Live hydration status — `loading` covers initial ingest AND a desync
|
|
898
|
+
* re-ingest. */
|
|
899
|
+
hydration(): AnnotationHydration;
|
|
900
|
+
/** Kick hydration exactly once per document; the effects layer calls
|
|
901
|
+
* this at registration. Subsequent calls no-op. */
|
|
902
|
+
ensureHydrated(): void;
|
|
903
|
+
/** Re-run whole-document hydration (desync recovery). Safe to call while
|
|
904
|
+
* one is in flight — the fresh run is chained after it. */
|
|
905
|
+
rehydrate(): Promise<void>;
|
|
906
|
+
/**
|
|
907
|
+
* The effects layer hands every REMOTE `annotation.*` event here: during
|
|
908
|
+
* a hydration window it queues (replayed by audit cursor after ingest —
|
|
909
|
+
* the delete-resurrection guard); otherwise it applies immediately.
|
|
910
|
+
*/
|
|
911
|
+
deliverRemoteAnnotationEvent(event: DocumentEvent): void;
|
|
735
912
|
/** The free-text boxes on a page, ready to render as editable elements.
|
|
736
913
|
* `view` as in {@link pageItems}. */
|
|
737
914
|
textItems(pon: PageObjectNumber, view?: ViewEnv): TextItem[];
|
|
@@ -741,8 +918,11 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
741
918
|
/** Enter text-edit on a free-text annotation (focus its editable element). */
|
|
742
919
|
beginTextEdit(ref: AnnotationRef): void;
|
|
743
920
|
/** Enter text-edit on whatever free-text box is under a content point — wired
|
|
744
|
-
* to a double-click by the interaction edit handler.
|
|
745
|
-
|
|
921
|
+
* to a double-click / long-press by the interaction edit handler. Returns
|
|
922
|
+
* whether an editable free-text was actually found and opened; false lets
|
|
923
|
+
* the caller fall through to a normal press (so a long-press on a highlight
|
|
924
|
+
* selects it instead of being swallowed by a no-op edit attempt). */
|
|
925
|
+
beginTextEditAt(pon: PageObjectNumber, point: Vec, scale?: number, rotation?: PageRotation, zoom?: number): boolean;
|
|
746
926
|
/** Apply the editor's plain text — optimistic locally, debounced to the engine. */
|
|
747
927
|
setContents(ref: AnnotationRef, text: string): void;
|
|
748
928
|
/** Leave text-edit (flush any pending write). */
|
|
@@ -752,7 +932,19 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
752
932
|
* screen-constant; `rotation` + `zoom` (relative, `transform.zoom`)
|
|
753
933
|
* complete the view env for screen-anchored bodies. Pass all three from
|
|
754
934
|
* the pointer sample. */
|
|
755
|
-
hitKind(pon: PageObjectNumber, point: Vec, scale?: number, rotation?: PageRotation, zoom?: number
|
|
935
|
+
hitKind(pon: PageObjectNumber, point: Vec, scale?: number, rotation?: PageRotation, zoom?: number,
|
|
936
|
+
/** Widen grab zones to finger-sized targets (pass `pointerType === 'touch'`). */
|
|
937
|
+
touch?: boolean): 'handle' | 'rotate' | 'group-handle' | 'annot' | 'empty';
|
|
938
|
+
/**
|
|
939
|
+
* TOUCH CONSENT (the interaction hub's `claimsTouch` predicate): should a
|
|
940
|
+
* finger landing here own a TOOL gesture instead of navigating? True over
|
|
941
|
+
* the selection's chrome (resize handles, rotate knob, group box) and over
|
|
942
|
+
* the body of an already-SELECTED, transformable annotation — never over an
|
|
943
|
+
* unselected one, so annotation-dense pages still scroll; tap-select first
|
|
944
|
+
* is the platform convention (Apple Markup). Uses finger-sized grab zones.
|
|
945
|
+
* Pure read.
|
|
946
|
+
*/
|
|
947
|
+
claimsTouchAt(pon: PageObjectNumber, point: Vec, scale?: number, rotation?: PageRotation, zoom?: number): boolean;
|
|
756
948
|
/** The cursor to show at a content point (resize over a handle, move/pointer over a body, else null). */
|
|
757
949
|
cursorAt(pon: PageObjectNumber, point: Vec, scale?: number, rotation?: PageRotation, zoom?: number): string | null;
|
|
758
950
|
/**
|
|
@@ -786,27 +978,30 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
786
978
|
* things cannot stay selected. Call after anything that flips engagement
|
|
787
979
|
* (the plugin wires it to tool changes). */
|
|
788
980
|
pruneEngagedSelection(): void;
|
|
789
|
-
editPointer(phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, shift: boolean, scale?: number, rotation?: PageRotation, zoom?: number
|
|
981
|
+
editPointer(phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, shift: boolean, scale?: number, rotation?: PageRotation, zoom?: number,
|
|
982
|
+
/** Finger-sized grab zones for the gesture's own hit resolution — pass the
|
|
983
|
+
* sample's `pointerType === 'touch'` so the gesture grabs exactly what
|
|
984
|
+
* {@link claimsTouchAt} claimed. */
|
|
985
|
+
touch?: boolean): void;
|
|
790
986
|
marqueePointer(phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, shift: boolean, scale?: number, rotation?: PageRotation, zoom?: number): void;
|
|
791
987
|
/** Run the draw gesture for an authoring TOOL (by id). The plugin resolves it
|
|
792
988
|
* to a routing subtype + defaults preset; a bare subtype also works (headless).
|
|
793
989
|
* `displayRotation` (the DOWN sample's page rotation: /Rotate + view rotation)
|
|
794
990
|
* feeds the tool's `upright` policy — omit it and upright is a no-op. */
|
|
795
991
|
createPointer(tool: string, phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, finish?: boolean, displayRotation?: PageRotation): void;
|
|
796
|
-
finishCreationDraft(): void;
|
|
797
992
|
/** Commit the strokes currently buffered by an ink tool's grouping window. */
|
|
798
993
|
finishInkDraft(): void;
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
*
|
|
802
|
-
createMarkup(subtype: Subtype, pon: PageObjectNumber,
|
|
803
|
-
/** Create a caret annotation
|
|
804
|
-
createCaret(pon: PageObjectNumber,
|
|
994
|
+
/** Create one text-markup annotation on a page from the selected text's
|
|
995
|
+
* per-line oriented quads (content space) — the `text-selection` create
|
|
996
|
+
* gesture. Axis-aligned callers build quads with `textQuadFromRect`. */
|
|
997
|
+
createMarkup(subtype: Subtype, pon: PageObjectNumber, quads: TextQuad[], preset?: string): void;
|
|
998
|
+
/** Create a caret annotation at a text-selection end anchor. */
|
|
999
|
+
createCaret(pon: PageObjectNumber, anchor: TextEndAnchor): void;
|
|
805
1000
|
/** Create one Adobe-compatible Caret + StrikeOut replace-text group. */
|
|
806
|
-
createReplaceText(pon: PageObjectNumber,
|
|
807
|
-
/** Set the live markup preview from the selection's per-page
|
|
1001
|
+
createReplaceText(pon: PageObjectNumber, quads: TextQuad[], anchor: TextEndAnchor, preset?: string): void;
|
|
1002
|
+
/** Set the live markup preview from the selection's per-page quads (renders a
|
|
808
1003
|
* ghost that looks like the markup it will become). */
|
|
809
|
-
previewMarkup(subtype: Subtype,
|
|
1004
|
+
previewMarkup(subtype: Subtype, quadsByPage: Record<number, TextQuad[]>, preset?: string): void;
|
|
810
1005
|
clearMarkupPreview(): void;
|
|
811
1006
|
/** Place the armed stamp centred on a content point. Returns false (no
|
|
812
1007
|
* capture) when nothing is armed. `displayRotation` (the click sample's page
|
|
@@ -867,13 +1062,25 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
867
1062
|
* gesture and the created annotation's PDF kind. Falls back to the id. */
|
|
868
1063
|
toolSubtype(id: string): Subtype;
|
|
869
1064
|
registerBehavior(b: Behavior): () => void;
|
|
1065
|
+
/**
|
|
1066
|
+
* The actions plane's session-visibility write (Hide actions, script
|
|
1067
|
+
* `annot.hidden`): resolve annotation OBJECT NUMBERS to loaded model ids
|
|
1068
|
+
* (the `obj:` refKey seam) and merge session-hidden overrides. Returns how
|
|
1069
|
+
* many resolved — unresolved numbers (unloaded pages, nm/index refs) are
|
|
1070
|
+
* the caller's diagnostics. Session state only; never an engine write.
|
|
1071
|
+
*/
|
|
1072
|
+
/** The script/Hide DOCUMENT-commit door (full ISO): engine updates +
|
|
1073
|
+
* model reconciliation, per entry, stop-on-failure. Never enqueues,
|
|
1074
|
+
* never touches the script host — the D2 sink contract. */
|
|
1075
|
+
commitScriptEffects(entries: AnnotCommitEntry[]): Promise<AnnotCommitResult>;
|
|
870
1076
|
}
|
|
871
1077
|
/**
|
|
872
1078
|
* The annotation capability token. Typed to the full {@link AnnotationHostCapability}
|
|
873
|
-
* here (the package internals
|
|
874
|
-
* root re-exports the SAME token narrowed to
|
|
1079
|
+
* here (the package internals, `/contract/host`, and `/internal` use this view).
|
|
1080
|
+
* The package root re-exports the SAME token narrowed to
|
|
1081
|
+
* {@link AnnotationCapability}.
|
|
875
1082
|
*/
|
|
876
1083
|
declare const AnnotationToken: import("@embedpdf/core").CapabilityToken<AnnotationHostCapability>;
|
|
877
1084
|
//#endregion
|
|
878
|
-
export {
|
|
879
|
-
//# sourceMappingURL=types-
|
|
1085
|
+
export { StampSourceSpec as A, AnnotationToolInput as C, PromptSourceSpec as D, InkAuthoringOptions as E, ToolDefaultsFor as M, buildToolRegistry as N, ResolvedTool as O, AnnotationToolDef as S, GhostPolicy as T, SelectionProps as _, AnnotationHydration as a, ThreadDeleteResult as b, Behavior as c, CommentPermissions as d, CommentsApi as f, SelectionFlags as g, LinkNavItem as h, AnnotationHostCapability as i, ToolAuthoringKind as j, SelectionAuthoring as k, ChromeSettings as l, FilePromptRequest as m, AnnotationCapability as n, AnnotationState as o, FilePickerProvider as p, AnnotationConfig as r, AnnotationToken as s, AnnotationAction as t, ChromeSettingsPatch as u, StampToolInput as v, DEFAULT_TOOLS as w, ToolGhost as x, TextItem as y };
|
|
1086
|
+
//# sourceMappingURL=types-otwv-Cdl.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/plugin-annotation",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Annotation feature plugin: the pure annotation-core wired to the engine repository (optimistic create/patch/delete) + the interaction hub (ambient edit + draw tools). Behaviors (forms) plug in here.",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,18 @@
|
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
|
+
"./authoring": {
|
|
16
|
+
"import": "./dist/authoring.js",
|
|
17
|
+
"require": "./dist/authoring.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./contract": {
|
|
20
|
+
"import": "./dist/contract.js",
|
|
21
|
+
"require": "./dist/contract.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./contract/host": {
|
|
24
|
+
"import": "./dist/contract/host.js",
|
|
25
|
+
"require": "./dist/contract/host.cjs"
|
|
26
|
+
},
|
|
15
27
|
"./internal": {
|
|
16
28
|
"import": "./dist/internal.js",
|
|
17
29
|
"require": "./dist/internal.cjs"
|
|
@@ -22,12 +34,14 @@
|
|
|
22
34
|
"dist"
|
|
23
35
|
],
|
|
24
36
|
"dependencies": {
|
|
25
|
-
"@embedpdf/core": "3.0.0-next.
|
|
26
|
-
"@embedpdf/core-
|
|
27
|
-
"@embedpdf/
|
|
28
|
-
"@embedpdf/plugin-selection": "3.0.0-next.
|
|
29
|
-
"@embedpdf/
|
|
30
|
-
"@embedpdf/engine-core": "3.0.0-next.
|
|
37
|
+
"@embedpdf/core-annotation": "3.0.0-next.11",
|
|
38
|
+
"@embedpdf/core-geometry": "3.0.0-next.11",
|
|
39
|
+
"@embedpdf/core": "3.0.0-next.11",
|
|
40
|
+
"@embedpdf/plugin-selection": "3.0.0-next.11",
|
|
41
|
+
"@embedpdf/plugin-interaction": "3.0.0-next.11",
|
|
42
|
+
"@embedpdf/engine-core": "3.0.0-next.11",
|
|
43
|
+
"@embedpdf/core-acrojs": "3.0.0-next.11",
|
|
44
|
+
"@embedpdf/plugin-actions": "3.0.0-next.11"
|
|
31
45
|
},
|
|
32
46
|
"devDependencies": {
|
|
33
47
|
"typescript": "^5.0.0",
|