@embedpdf/plugin-annotation 3.0.0-next.4 → 3.0.0-next.6

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,7 +1,7 @@
1
1
  import { PageObjectNumber } from "@embedpdf/core";
2
- import { PageRotation } from "@embedpdf/core-geometry";
3
2
  import { AnnotationAppearanceImage, AnnotationDTO, AnnotationDraft, AnnotationPatch, AnnotationRef, AttachmentContent, AttachmentFileSource, BinarySource, InkIntent, PdfLinkTarget, PdfRect } from "@embedpdf/engine-core/runtime";
4
3
  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";
4
+ import { PageRotation } from "@embedpdf/core-geometry";
5
5
  //#region src/tools.d.ts
6
6
  /**
7
7
  * How a stamp-family tool resolves the image bytes it places — pure DATA, so a
@@ -604,6 +604,21 @@ interface AnnotationCapability {
604
604
  * (`extends`, per-tool `defaults`, …). Returns an unregister fn.
605
605
  */
606
606
  registerTool(def: AnnotationToolInput): () => void;
607
+ /**
608
+ * Turn the CURRENT text selection into markup annotations — one per
609
+ * selected page, from the selection's oriented per-line quads — then clear
610
+ * the selection. The one-call form of what the markup tools do on
611
+ * commit, made for selection-menu buttons ("Highlight") and automation.
612
+ * `preset` is a tool id whose defaults style the markup (e.g.
613
+ * `'highlight'`); defaults to the subtype's own. Returns false (and does
614
+ * nothing) when no selection plugin is installed or nothing is selected.
615
+ */
616
+ markupFromSelection(subtype: Subtype, preset?: string): boolean;
617
+ /** Commit the in-progress multi-click creation draft (no-op when there is
618
+ * none, or it can't finish yet — see `creationDraftAnchor().canFinish`). */
619
+ finishCreationDraft(): void;
620
+ /** Discard the in-progress multi-click creation draft. */
621
+ cancelCreationDraft(): void;
607
622
  deleteSelection(): void;
608
623
  deselect(): void;
609
624
  cancel(): void;
@@ -793,10 +808,8 @@ interface AnnotationHostCapability extends AnnotationCapability {
793
808
  * `displayRotation` (the DOWN sample's page rotation: /Rotate + view rotation)
794
809
  * feeds the tool's `upright` policy — omit it and upright is a no-op. */
795
810
  createPointer(tool: string, phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, finish?: boolean, displayRotation?: PageRotation): void;
796
- finishCreationDraft(): void;
797
811
  /** Commit the strokes currently buffered by an ink tool's grouping window. */
798
812
  finishInkDraft(): void;
799
- cancelCreationDraft(): void;
800
813
  /** Create one text-markup annotation on a page from the selected text's
801
814
  * per-line oriented quads (content space) — the `text-selection` create
802
815
  * gesture. Axis-aligned callers build quads with `textQuadFromRect`. */
@@ -877,4 +890,4 @@ interface AnnotationHostCapability extends AnnotationCapability {
877
890
  declare const AnnotationToken: import("@embedpdf/core").CapabilityToken<AnnotationHostCapability>;
878
891
  //#endregion
879
892
  export { PromptSourceSpec as C, ToolAuthoringKind as D, StampSourceSpec as E, ToolDefaultsFor as O, InkAuthoringOptions as S, SelectionAuthoring as T, ToolGhost as _, AnnotationState as a, DEFAULT_TOOLS as b, ChromeSettings as c, FilePromptRequest as d, LinkNavItem as f, TextItem as g, StampToolInput as h, AnnotationHostCapability as i, buildToolRegistry as k, ChromeSettingsPatch as l, SelectionProps as m, AnnotationCapability as n, AnnotationToken as o, SelectionFlags as p, AnnotationConfig as r, Behavior as s, AnnotationAction as t, FilePickerProvider as u, AnnotationToolDef as v, ResolvedTool as w, GhostPolicy as x, AnnotationToolInput as y };
880
- //# sourceMappingURL=types-CfewRmXH.d.cts.map
893
+ //# sourceMappingURL=types-BCB5YKIk.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { PageObjectNumber } from "@embedpdf/core";
2
+ import { PageRotation } from "@embedpdf/core-geometry";
2
3
  import { AnnotationAppearanceImage, AnnotationDTO, AnnotationDraft, AnnotationPatch, AnnotationRef, AttachmentContent, AttachmentFileSource, BinarySource, InkIntent, PdfLinkTarget, PdfRect } from "@embedpdf/engine-core/runtime";
3
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";
4
- import { PageRotation } from "@embedpdf/core-geometry";
5
5
  //#region src/tools.d.ts
6
6
  /**
7
7
  * How a stamp-family tool resolves the image bytes it places — pure DATA, so a
@@ -604,6 +604,21 @@ interface AnnotationCapability {
604
604
  * (`extends`, per-tool `defaults`, …). Returns an unregister fn.
605
605
  */
606
606
  registerTool(def: AnnotationToolInput): () => void;
607
+ /**
608
+ * Turn the CURRENT text selection into markup annotations — one per
609
+ * selected page, from the selection's oriented per-line quads — then clear
610
+ * the selection. The one-call form of what the markup tools do on
611
+ * commit, made for selection-menu buttons ("Highlight") and automation.
612
+ * `preset` is a tool id whose defaults style the markup (e.g.
613
+ * `'highlight'`); defaults to the subtype's own. Returns false (and does
614
+ * nothing) when no selection plugin is installed or nothing is selected.
615
+ */
616
+ markupFromSelection(subtype: Subtype, preset?: string): boolean;
617
+ /** Commit the in-progress multi-click creation draft (no-op when there is
618
+ * none, or it can't finish yet — see `creationDraftAnchor().canFinish`). */
619
+ finishCreationDraft(): void;
620
+ /** Discard the in-progress multi-click creation draft. */
621
+ cancelCreationDraft(): void;
607
622
  deleteSelection(): void;
608
623
  deselect(): void;
609
624
  cancel(): void;
@@ -793,10 +808,8 @@ interface AnnotationHostCapability extends AnnotationCapability {
793
808
  * `displayRotation` (the DOWN sample's page rotation: /Rotate + view rotation)
794
809
  * feeds the tool's `upright` policy — omit it and upright is a no-op. */
795
810
  createPointer(tool: string, phase: 'down' | 'move' | 'up', pon: PageObjectNumber, point: Vec, finish?: boolean, displayRotation?: PageRotation): void;
796
- finishCreationDraft(): void;
797
811
  /** Commit the strokes currently buffered by an ink tool's grouping window. */
798
812
  finishInkDraft(): void;
799
- cancelCreationDraft(): void;
800
813
  /** Create one text-markup annotation on a page from the selected text's
801
814
  * per-line oriented quads (content space) — the `text-selection` create
802
815
  * gesture. Axis-aligned callers build quads with `textQuadFromRect`. */
@@ -877,4 +890,4 @@ interface AnnotationHostCapability extends AnnotationCapability {
877
890
  declare const AnnotationToken: import("@embedpdf/core").CapabilityToken<AnnotationHostCapability>;
878
891
  //#endregion
879
892
  export { PromptSourceSpec as C, ToolAuthoringKind as D, StampSourceSpec as E, ToolDefaultsFor as O, InkAuthoringOptions as S, SelectionAuthoring as T, ToolGhost as _, AnnotationState as a, DEFAULT_TOOLS as b, ChromeSettings as c, FilePromptRequest as d, LinkNavItem as f, TextItem as g, StampToolInput as h, AnnotationHostCapability as i, buildToolRegistry as k, ChromeSettingsPatch as l, SelectionProps as m, AnnotationCapability as n, AnnotationToken as o, SelectionFlags as p, AnnotationConfig as r, Behavior as s, AnnotationAction as t, FilePickerProvider as u, AnnotationToolDef as v, ResolvedTool as w, GhostPolicy as x, AnnotationToolInput as y };
880
- //# sourceMappingURL=types-DZ29RSW9.d.ts.map
893
+ //# sourceMappingURL=types-N25K86pT.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/plugin-annotation",
3
- "version": "3.0.0-next.4",
3
+ "version": "3.0.0-next.6",
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",
@@ -22,12 +22,12 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@embedpdf/core": "3.0.0-next.4",
26
- "@embedpdf/core-geometry": "3.0.0-next.4",
27
- "@embedpdf/core-annotation": "3.0.0-next.4",
28
- "@embedpdf/plugin-interaction": "3.0.0-next.4",
29
- "@embedpdf/plugin-selection": "3.0.0-next.4",
30
- "@embedpdf/engine-core": "3.0.0-next.4"
25
+ "@embedpdf/core": "3.0.0-next.6",
26
+ "@embedpdf/core-geometry": "3.0.0-next.6",
27
+ "@embedpdf/core-annotation": "3.0.0-next.6",
28
+ "@embedpdf/plugin-interaction": "3.0.0-next.6",
29
+ "@embedpdf/engine-core": "3.0.0-next.6",
30
+ "@embedpdf/plugin-selection": "3.0.0-next.6"
31
31
  },
32
32
  "devDependencies": {
33
33
  "typescript": "^5.0.0",