@embedpdf/plugin-annotation 3.2.0 → 3.4.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/dist/commands.cjs +25 -0
- package/dist/commands.cjs.map +1 -0
- package/dist/commands.d.cts +7 -0
- package/dist/commands.d.ts +7 -0
- package/dist/commands.js +24 -0
- package/dist/commands.js.map +1 -0
- package/dist/contract/host.d.cts +2 -2
- package/dist/contract/host.d.ts +2 -2
- package/dist/{contract-DkxvCGXL.d.cts → contract-BfZ-mTF7.d.cts} +10 -4
- package/dist/contract-BrvLUGi2.js.map +1 -1
- package/dist/{contract-CQfRsCVj.d.ts → contract-DRUUSPzY.d.ts} +10 -4
- package/dist/contract-X3gZNpwu.cjs.map +1 -1
- package/dist/contract.d.cts +1 -1
- package/dist/contract.d.ts +1 -1
- package/dist/{host-contract-BSH_muud.d.cts → host-contract-BrC7hZw_.d.ts} +27 -8
- package/dist/host-contract-C7vx6wTQ.cjs.map +1 -1
- package/dist/host-contract-CDp5skzD.js.map +1 -1
- package/dist/{host-contract-DU3CxFE1.d.ts → host-contract-CjPbxfhS.d.cts} +27 -8
- package/dist/index.cjs +140 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +136 -64
- package/dist/index.js.map +1 -1
- package/package.json +16 -12
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { widgetAppearanceOf } from "./authoring.cjs";
|
|
2
|
-
import { $ as ChromeSettings, A as AnnotationReorderedEvent, At as ToolDefaults, B as AnnotationSubtype, Bt as InkAuthoringOptions, C as AnnotationLinksCapability, Ct as SnapSettings, D as AnnotationProperties, Dt as TextAlign, E as AnnotationPosition, Et as StampPreviewProvider, F as AnnotationSelectionAnchor, Ft as ARMED_STAMP_TOOL_ID, G as AnnotationUpdatedEvent, Gt as StampSourceSpec, H as AnnotationTool, Ht as ResolvedGhost, I as AnnotationSelectionCapability, It as AnnotationToolDefinition, J as ArmedStampPreview, K as AnnotationWriteFailedEvent, Kt as ToolAuthoringKind, L as AnnotationSelectionChangedEvent, Lt as AnnotationToolInput, M as AnnotationResources, Mt as AnnotationState, N as AnnotationResyncedEvent, Nt as annotationState, O as AnnotationProperty, Ot as TextItem, P as AnnotationRotationAnchor, Pt as AnnotationToken, Q as BlendMode, R as AnnotationSettings, Rt as DEFAULT_TOOLS, S as AnnotationImportResult, St as ReviewStatus, T as AnnotationPatch, Tt as StampPlacement, U as AnnotationToolsCapability, Ut as ResolvedTool, V as AnnotationTextCapability, Vt as PromptSourceSpec, W as AnnotationTransfer, Wt as SelectionAuthoring, X as AttachmentFileSource, Xt as TextFormat, Y as AttachmentContent, Yt as Face, Z as Behavior, Zt as TextSelection, _ as AnnotationFilter, _t as LineStyle, a as AnnotationBundle, at as CommentsCapability, b as AnnotationImportDrop, bt as MeasurementIntent, c as AnnotationCreatedEvent, ct as EditableKinds, d as AnnotationDraftCapability, dt as FilePromptRequest, et as ClickCreate, f as AnnotationDraftChangedEvent, ft as FlagKey, g as AnnotationExportSelection, gt as LineEndings, h as AnnotationEditingChangedEvent, ht as LineEnding, i as AnnotationAnchor, it as CommentThreadReview, j as AnnotationResourceRole, jt as ToolDefaultsChangedEvent, k as AnnotationRef, kt as ThreadDeleteResult, l as AnnotationDeletedEvent, lt as FieldValues, m as AnnotationDuplicateResult, mt as ImageGhost, n as AfterCreateSettings, nt as CommentThread, o as AnnotationCapability, ot as CreationDraft, p as AnnotationDuplicateOptions, pt as HandleRole, q as ArmedStampInfo, qt as ToolDefaultsFor, r as Annotation, rt as CommentThreadChangedEvent, s as AnnotationConfig, st as EditableKind, t as ANNOTATION_DEFAULTS, tt as Color, u as AnnotationDraft, ut as FilePickerProvider, v as AnnotationFlags, vt as LinkNavItem, w as AnnotationOption, wt as StampInput, x as AnnotationImportOptions, xt as PdfLinkTarget, y as AnnotationHoverChangedEvent, yt as MarkupSubtype, z as AnnotationStampsCapability, zt as GhostPolicy } from "./contract-
|
|
3
|
-
import { f as AnnotationModel, n as AnnotationHostCapability } from "./host-contract-
|
|
4
|
-
import { MIN_DRAG, Placement, gesturePlacement, kindNamed, propertiesOf, resolveClickPlacement } from "@embedpdf/core-annotation";
|
|
2
|
+
import { $ as ChromeSettings, A as AnnotationReorderedEvent, At as ToolDefaults, B as AnnotationSubtype, Bt as InkAuthoringOptions, C as AnnotationLinksCapability, Ct as SnapSettings, D as AnnotationProperties, Dt as TextAlign, E as AnnotationPosition, Et as StampPreviewProvider, F as AnnotationSelectionAnchor, Ft as ARMED_STAMP_TOOL_ID, G as AnnotationUpdatedEvent, Gt as StampSourceSpec, H as AnnotationTool, Ht as ResolvedGhost, I as AnnotationSelectionCapability, It as AnnotationToolDefinition, J as ArmedStampPreview, K as AnnotationWriteFailedEvent, Kt as ToolAuthoringKind, L as AnnotationSelectionChangedEvent, Lt as AnnotationToolInput, M as AnnotationResources, Mt as AnnotationState, N as AnnotationResyncedEvent, Nt as annotationState, O as AnnotationProperty, Ot as TextItem, P as AnnotationRotationAnchor, Pt as AnnotationToken, Q as BlendMode, R as AnnotationSettings, Rt as DEFAULT_TOOLS, S as AnnotationImportResult, St as ReviewStatus, T as AnnotationPatch, Tt as StampPlacement, U as AnnotationToolsCapability, Ut as ResolvedTool, V as AnnotationTextCapability, Vt as PromptSourceSpec, W as AnnotationTransfer, Wt as SelectionAuthoring, X as AttachmentFileSource, Xt as TextFormat, Y as AttachmentContent, Yt as Face, Z as Behavior, Zt as TextSelection, _ as AnnotationFilter, _t as LineStyle, a as AnnotationBundle, at as CommentsCapability, b as AnnotationImportDrop, bt as MeasurementIntent, c as AnnotationCreatedEvent, ct as EditableKinds, d as AnnotationDraftCapability, dt as FilePromptRequest, et as ClickCreate, f as AnnotationDraftChangedEvent, ft as FlagKey, g as AnnotationExportSelection, gt as LineEndings, h as AnnotationEditingChangedEvent, ht as LineEnding, i as AnnotationAnchor, it as CommentThreadReview, j as AnnotationResourceRole, jt as ToolDefaultsChangedEvent, k as AnnotationRef, kt as ThreadDeleteResult, l as AnnotationDeletedEvent, lt as FieldValues, m as AnnotationDuplicateResult, mt as ImageGhost, n as AfterCreateSettings, nt as CommentThread, o as AnnotationCapability, ot as CreationDraft, p as AnnotationDuplicateOptions, pt as HandleRole, q as ArmedStampInfo, qt as ToolDefaultsFor, r as Annotation, rt as CommentThreadChangedEvent, s as AnnotationConfig, st as EditableKind, t as ANNOTATION_DEFAULTS, tt as Color, u as AnnotationDraft, ut as FilePickerProvider, v as AnnotationFlags, vt as LinkNavItem, w as AnnotationOption, wt as StampInput, x as AnnotationImportOptions, xt as PdfLinkTarget, y as AnnotationHoverChangedEvent, yt as MarkupSubtype, z as AnnotationStampsCapability, zt as GhostPolicy } from "./contract-BfZ-mTF7.cjs";
|
|
3
|
+
import { f as AnnotationModel, n as AnnotationHostCapability } from "./host-contract-CjPbxfhS.cjs";
|
|
4
|
+
import { MIN_DRAG, Placement, gesturePlacement, kindNamed, orientationPatch, propertiesOf, resolveClickPlacement } from "@embedpdf/core-annotation";
|
|
5
5
|
import { annotationKey } from "@embedpdf/core";
|
|
6
6
|
//#region src/annotation.plugin.d.ts
|
|
7
7
|
/**
|
|
@@ -15,5 +15,5 @@ import { annotationKey } from "@embedpdf/core";
|
|
|
15
15
|
*/
|
|
16
16
|
declare const annotationPlugin: (config?: AnnotationConfig) => import("@embedpdf/core").PluginDefinition<AnnotationModel, AnnotationHostCapability, AnnotationSettings>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { ANNOTATION_DEFAULTS, ARMED_STAMP_TOOL_ID, AfterCreateSettings, type Annotation, AnnotationAnchor, type AnnotationBundle, AnnotationCapability, AnnotationConfig, AnnotationCreatedEvent, AnnotationDeletedEvent, type AnnotationDraft, AnnotationDraftCapability, AnnotationDraftChangedEvent, AnnotationDuplicateOptions, AnnotationDuplicateResult, AnnotationEditingChangedEvent, AnnotationExportSelection, AnnotationFilter, type AnnotationFlags, AnnotationHoverChangedEvent, type AnnotationImportDrop, type AnnotationImportOptions, AnnotationImportResult, AnnotationLinksCapability, type AnnotationOption, type AnnotationPatch, type AnnotationPosition, AnnotationProperties, type AnnotationProperty, type AnnotationRef, AnnotationReorderedEvent, type AnnotationResourceRole, type AnnotationResources, AnnotationResyncedEvent, AnnotationRotationAnchor, AnnotationSelectionAnchor, AnnotationSelectionCapability, AnnotationSelectionChangedEvent, AnnotationSettings, AnnotationStampsCapability, type AnnotationState, type AnnotationSubtype, AnnotationTextCapability, AnnotationToken, AnnotationTool, type AnnotationToolDefinition, type AnnotationToolInput, AnnotationToolsCapability, AnnotationTransfer, AnnotationUpdatedEvent, AnnotationWriteFailedEvent, ArmedStampInfo, ArmedStampPreview, type AttachmentContent, type AttachmentFileSource, Behavior, type BlendMode, ChromeSettings, type ClickCreate, type Color, type CommentThread, CommentThreadChangedEvent, type CommentThreadReview, CommentsCapability, CreationDraft, DEFAULT_TOOLS, type EditableKind, type EditableKinds, type Face, type FieldValues, FilePickerProvider, FilePromptRequest, type FlagKey, type GhostPolicy, type HandleRole, ImageGhost, type InkAuthoringOptions, type LineEnding, type LineEndings, LineStyle, LinkNavItem, MIN_DRAG, MarkupSubtype, type MeasurementIntent, type PdfLinkTarget, type Placement, type PromptSourceSpec, type ResolvedGhost, type ResolvedTool, type ReviewStatus, type SelectionAuthoring, type SnapSettings, StampInput, StampPlacement, StampPreviewProvider, type StampSourceSpec, type TextAlign, type TextFormat, TextItem, type TextSelection, ThreadDeleteResult, type ToolAuthoringKind, ToolDefaults, ToolDefaultsChangedEvent, type ToolDefaultsFor, annotationKey, annotationPlugin, annotationState, gesturePlacement, kindNamed, propertiesOf, resolveClickPlacement, widgetAppearanceOf };
|
|
18
|
+
export { ANNOTATION_DEFAULTS, ARMED_STAMP_TOOL_ID, AfterCreateSettings, type Annotation, AnnotationAnchor, type AnnotationBundle, AnnotationCapability, AnnotationConfig, AnnotationCreatedEvent, AnnotationDeletedEvent, type AnnotationDraft, AnnotationDraftCapability, AnnotationDraftChangedEvent, AnnotationDuplicateOptions, AnnotationDuplicateResult, AnnotationEditingChangedEvent, AnnotationExportSelection, AnnotationFilter, type AnnotationFlags, AnnotationHoverChangedEvent, type AnnotationImportDrop, type AnnotationImportOptions, AnnotationImportResult, AnnotationLinksCapability, type AnnotationOption, type AnnotationPatch, type AnnotationPosition, AnnotationProperties, type AnnotationProperty, type AnnotationRef, AnnotationReorderedEvent, type AnnotationResourceRole, type AnnotationResources, AnnotationResyncedEvent, AnnotationRotationAnchor, AnnotationSelectionAnchor, AnnotationSelectionCapability, AnnotationSelectionChangedEvent, AnnotationSettings, AnnotationStampsCapability, type AnnotationState, type AnnotationSubtype, AnnotationTextCapability, AnnotationToken, AnnotationTool, type AnnotationToolDefinition, type AnnotationToolInput, AnnotationToolsCapability, AnnotationTransfer, AnnotationUpdatedEvent, AnnotationWriteFailedEvent, ArmedStampInfo, ArmedStampPreview, type AttachmentContent, type AttachmentFileSource, Behavior, type BlendMode, ChromeSettings, type ClickCreate, type Color, type CommentThread, CommentThreadChangedEvent, type CommentThreadReview, CommentsCapability, CreationDraft, DEFAULT_TOOLS, type EditableKind, type EditableKinds, type Face, type FieldValues, FilePickerProvider, FilePromptRequest, type FlagKey, type GhostPolicy, type HandleRole, ImageGhost, type InkAuthoringOptions, type LineEnding, type LineEndings, LineStyle, LinkNavItem, MIN_DRAG, MarkupSubtype, type MeasurementIntent, type PdfLinkTarget, type Placement, type PromptSourceSpec, type ResolvedGhost, type ResolvedTool, type ReviewStatus, type SelectionAuthoring, type SnapSettings, StampInput, StampPlacement, StampPreviewProvider, type StampSourceSpec, type TextAlign, type TextFormat, TextItem, type TextSelection, ThreadDeleteResult, type ToolAuthoringKind, ToolDefaults, ToolDefaultsChangedEvent, type ToolDefaultsFor, annotationKey, annotationPlugin, annotationState, gesturePlacement, kindNamed, orientationPatch, propertiesOf, resolveClickPlacement, widgetAppearanceOf };
|
|
19
19
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { widgetAppearanceOf } from "./authoring.js";
|
|
2
|
-
import { $ as ChromeSettings, A as AnnotationReorderedEvent, At as ToolDefaults, B as AnnotationSubtype, Bt as InkAuthoringOptions, C as AnnotationLinksCapability, Ct as SnapSettings, D as AnnotationProperties, Dt as TextAlign, E as AnnotationPosition, Et as StampPreviewProvider, F as AnnotationSelectionAnchor, Ft as ARMED_STAMP_TOOL_ID, G as AnnotationUpdatedEvent, Gt as StampSourceSpec, H as AnnotationTool, Ht as ResolvedGhost, I as AnnotationSelectionCapability, It as AnnotationToolDefinition, J as ArmedStampPreview, K as AnnotationWriteFailedEvent, Kt as ToolAuthoringKind, L as AnnotationSelectionChangedEvent, Lt as AnnotationToolInput, M as AnnotationResources, Mt as AnnotationState, N as AnnotationResyncedEvent, Nt as annotationState, O as AnnotationProperty, Ot as TextItem, P as AnnotationRotationAnchor, Pt as AnnotationToken, Q as BlendMode, R as AnnotationSettings, Rt as DEFAULT_TOOLS, S as AnnotationImportResult, St as ReviewStatus, T as AnnotationPatch, Tt as StampPlacement, U as AnnotationToolsCapability, Ut as ResolvedTool, V as AnnotationTextCapability, Vt as PromptSourceSpec, W as AnnotationTransfer, Wt as SelectionAuthoring, X as AttachmentFileSource, Xt as TextFormat, Y as AttachmentContent, Yt as Face, Z as Behavior, Zt as TextSelection, _ as AnnotationFilter, _t as LineStyle, a as AnnotationBundle, at as CommentsCapability, b as AnnotationImportDrop, bt as MeasurementIntent, c as AnnotationCreatedEvent, ct as EditableKinds, d as AnnotationDraftCapability, dt as FilePromptRequest, et as ClickCreate, f as AnnotationDraftChangedEvent, ft as FlagKey, g as AnnotationExportSelection, gt as LineEndings, h as AnnotationEditingChangedEvent, ht as LineEnding, i as AnnotationAnchor, it as CommentThreadReview, j as AnnotationResourceRole, jt as ToolDefaultsChangedEvent, k as AnnotationRef, kt as ThreadDeleteResult, l as AnnotationDeletedEvent, lt as FieldValues, m as AnnotationDuplicateResult, mt as ImageGhost, n as AfterCreateSettings, nt as CommentThread, o as AnnotationCapability, ot as CreationDraft, p as AnnotationDuplicateOptions, pt as HandleRole, q as ArmedStampInfo, qt as ToolDefaultsFor, r as Annotation, rt as CommentThreadChangedEvent, s as AnnotationConfig, st as EditableKind, t as ANNOTATION_DEFAULTS, tt as Color, u as AnnotationDraft, ut as FilePickerProvider, v as AnnotationFlags, vt as LinkNavItem, w as AnnotationOption, wt as StampInput, x as AnnotationImportOptions, xt as PdfLinkTarget, y as AnnotationHoverChangedEvent, yt as MarkupSubtype, z as AnnotationStampsCapability, zt as GhostPolicy } from "./contract-
|
|
3
|
-
import { f as AnnotationModel, n as AnnotationHostCapability } from "./host-contract-
|
|
2
|
+
import { $ as ChromeSettings, A as AnnotationReorderedEvent, At as ToolDefaults, B as AnnotationSubtype, Bt as InkAuthoringOptions, C as AnnotationLinksCapability, Ct as SnapSettings, D as AnnotationProperties, Dt as TextAlign, E as AnnotationPosition, Et as StampPreviewProvider, F as AnnotationSelectionAnchor, Ft as ARMED_STAMP_TOOL_ID, G as AnnotationUpdatedEvent, Gt as StampSourceSpec, H as AnnotationTool, Ht as ResolvedGhost, I as AnnotationSelectionCapability, It as AnnotationToolDefinition, J as ArmedStampPreview, K as AnnotationWriteFailedEvent, Kt as ToolAuthoringKind, L as AnnotationSelectionChangedEvent, Lt as AnnotationToolInput, M as AnnotationResources, Mt as AnnotationState, N as AnnotationResyncedEvent, Nt as annotationState, O as AnnotationProperty, Ot as TextItem, P as AnnotationRotationAnchor, Pt as AnnotationToken, Q as BlendMode, R as AnnotationSettings, Rt as DEFAULT_TOOLS, S as AnnotationImportResult, St as ReviewStatus, T as AnnotationPatch, Tt as StampPlacement, U as AnnotationToolsCapability, Ut as ResolvedTool, V as AnnotationTextCapability, Vt as PromptSourceSpec, W as AnnotationTransfer, Wt as SelectionAuthoring, X as AttachmentFileSource, Xt as TextFormat, Y as AttachmentContent, Yt as Face, Z as Behavior, Zt as TextSelection, _ as AnnotationFilter, _t as LineStyle, a as AnnotationBundle, at as CommentsCapability, b as AnnotationImportDrop, bt as MeasurementIntent, c as AnnotationCreatedEvent, ct as EditableKinds, d as AnnotationDraftCapability, dt as FilePromptRequest, et as ClickCreate, f as AnnotationDraftChangedEvent, ft as FlagKey, g as AnnotationExportSelection, gt as LineEndings, h as AnnotationEditingChangedEvent, ht as LineEnding, i as AnnotationAnchor, it as CommentThreadReview, j as AnnotationResourceRole, jt as ToolDefaultsChangedEvent, k as AnnotationRef, kt as ThreadDeleteResult, l as AnnotationDeletedEvent, lt as FieldValues, m as AnnotationDuplicateResult, mt as ImageGhost, n as AfterCreateSettings, nt as CommentThread, o as AnnotationCapability, ot as CreationDraft, p as AnnotationDuplicateOptions, pt as HandleRole, q as ArmedStampInfo, qt as ToolDefaultsFor, r as Annotation, rt as CommentThreadChangedEvent, s as AnnotationConfig, st as EditableKind, t as ANNOTATION_DEFAULTS, tt as Color, u as AnnotationDraft, ut as FilePickerProvider, v as AnnotationFlags, vt as LinkNavItem, w as AnnotationOption, wt as StampInput, x as AnnotationImportOptions, xt as PdfLinkTarget, y as AnnotationHoverChangedEvent, yt as MarkupSubtype, z as AnnotationStampsCapability, zt as GhostPolicy } from "./contract-DRUUSPzY.js";
|
|
3
|
+
import { f as AnnotationModel, n as AnnotationHostCapability } from "./host-contract-BrC7hZw_.js";
|
|
4
4
|
import { annotationKey } from "@embedpdf/core";
|
|
5
|
-
import { MIN_DRAG, Placement, gesturePlacement, kindNamed, propertiesOf, resolveClickPlacement } from "@embedpdf/core-annotation";
|
|
5
|
+
import { MIN_DRAG, Placement, gesturePlacement, kindNamed, orientationPatch, propertiesOf, resolveClickPlacement } from "@embedpdf/core-annotation";
|
|
6
6
|
//#region src/annotation.plugin.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* The annotation plugin. Document-scoped; requires the interaction hub and
|
|
@@ -15,5 +15,5 @@ import { MIN_DRAG, Placement, gesturePlacement, kindNamed, propertiesOf, resolve
|
|
|
15
15
|
*/
|
|
16
16
|
declare const annotationPlugin: (config?: AnnotationConfig) => import("@embedpdf/core").PluginDefinition<AnnotationModel, AnnotationHostCapability, AnnotationSettings>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { ANNOTATION_DEFAULTS, ARMED_STAMP_TOOL_ID, AfterCreateSettings, type Annotation, AnnotationAnchor, type AnnotationBundle, AnnotationCapability, AnnotationConfig, AnnotationCreatedEvent, AnnotationDeletedEvent, type AnnotationDraft, AnnotationDraftCapability, AnnotationDraftChangedEvent, AnnotationDuplicateOptions, AnnotationDuplicateResult, AnnotationEditingChangedEvent, AnnotationExportSelection, AnnotationFilter, type AnnotationFlags, AnnotationHoverChangedEvent, type AnnotationImportDrop, type AnnotationImportOptions, AnnotationImportResult, AnnotationLinksCapability, type AnnotationOption, type AnnotationPatch, type AnnotationPosition, AnnotationProperties, type AnnotationProperty, type AnnotationRef, AnnotationReorderedEvent, type AnnotationResourceRole, type AnnotationResources, AnnotationResyncedEvent, AnnotationRotationAnchor, AnnotationSelectionAnchor, AnnotationSelectionCapability, AnnotationSelectionChangedEvent, AnnotationSettings, AnnotationStampsCapability, type AnnotationState, type AnnotationSubtype, AnnotationTextCapability, AnnotationToken, AnnotationTool, type AnnotationToolDefinition, type AnnotationToolInput, AnnotationToolsCapability, AnnotationTransfer, AnnotationUpdatedEvent, AnnotationWriteFailedEvent, ArmedStampInfo, ArmedStampPreview, type AttachmentContent, type AttachmentFileSource, Behavior, type BlendMode, ChromeSettings, type ClickCreate, type Color, type CommentThread, CommentThreadChangedEvent, type CommentThreadReview, CommentsCapability, CreationDraft, DEFAULT_TOOLS, type EditableKind, type EditableKinds, type Face, type FieldValues, FilePickerProvider, FilePromptRequest, type FlagKey, type GhostPolicy, type HandleRole, ImageGhost, type InkAuthoringOptions, type LineEnding, type LineEndings, LineStyle, LinkNavItem, MIN_DRAG, MarkupSubtype, type MeasurementIntent, type PdfLinkTarget, type Placement, type PromptSourceSpec, type ResolvedGhost, type ResolvedTool, type ReviewStatus, type SelectionAuthoring, type SnapSettings, StampInput, StampPlacement, StampPreviewProvider, type StampSourceSpec, type TextAlign, type TextFormat, TextItem, type TextSelection, ThreadDeleteResult, type ToolAuthoringKind, ToolDefaults, ToolDefaultsChangedEvent, type ToolDefaultsFor, annotationKey, annotationPlugin, annotationState, gesturePlacement, kindNamed, propertiesOf, resolveClickPlacement, widgetAppearanceOf };
|
|
18
|
+
export { ANNOTATION_DEFAULTS, ARMED_STAMP_TOOL_ID, AfterCreateSettings, type Annotation, AnnotationAnchor, type AnnotationBundle, AnnotationCapability, AnnotationConfig, AnnotationCreatedEvent, AnnotationDeletedEvent, type AnnotationDraft, AnnotationDraftCapability, AnnotationDraftChangedEvent, AnnotationDuplicateOptions, AnnotationDuplicateResult, AnnotationEditingChangedEvent, AnnotationExportSelection, AnnotationFilter, type AnnotationFlags, AnnotationHoverChangedEvent, type AnnotationImportDrop, type AnnotationImportOptions, AnnotationImportResult, AnnotationLinksCapability, type AnnotationOption, type AnnotationPatch, type AnnotationPosition, AnnotationProperties, type AnnotationProperty, type AnnotationRef, AnnotationReorderedEvent, type AnnotationResourceRole, type AnnotationResources, AnnotationResyncedEvent, AnnotationRotationAnchor, AnnotationSelectionAnchor, AnnotationSelectionCapability, AnnotationSelectionChangedEvent, AnnotationSettings, AnnotationStampsCapability, type AnnotationState, type AnnotationSubtype, AnnotationTextCapability, AnnotationToken, AnnotationTool, type AnnotationToolDefinition, type AnnotationToolInput, AnnotationToolsCapability, AnnotationTransfer, AnnotationUpdatedEvent, AnnotationWriteFailedEvent, ArmedStampInfo, ArmedStampPreview, type AttachmentContent, type AttachmentFileSource, Behavior, type BlendMode, ChromeSettings, type ClickCreate, type Color, type CommentThread, CommentThreadChangedEvent, type CommentThreadReview, CommentsCapability, CreationDraft, DEFAULT_TOOLS, type EditableKind, type EditableKinds, type Face, type FieldValues, FilePickerProvider, FilePromptRequest, type FlagKey, type GhostPolicy, type HandleRole, ImageGhost, type InkAuthoringOptions, type LineEnding, type LineEndings, LineStyle, LinkNavItem, MIN_DRAG, MarkupSubtype, type MeasurementIntent, type PdfLinkTarget, type Placement, type PromptSourceSpec, type ResolvedGhost, type ResolvedTool, type ReviewStatus, type SelectionAuthoring, type SnapSettings, StampInput, StampPlacement, StampPreviewProvider, type StampSourceSpec, type TextAlign, type TextFormat, TextItem, type TextSelection, ThreadDeleteResult, type ToolAuthoringKind, ToolDefaults, ToolDefaultsChangedEvent, type ToolDefaultsFor, annotationKey, annotationPlugin, annotationState, gesturePlacement, kindNamed, orientationPatch, propertiesOf, resolveClickPlacement, widgetAppearanceOf };
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { InteractionToken } from "@embedpdf/plugin-interaction/contract/host";
|
|
|
8
8
|
import { RenderToken } from "@embedpdf/plugin-render/contract";
|
|
9
9
|
import { SelectionToken } from "@embedpdf/plugin-selection/contract/host";
|
|
10
10
|
import { ANNOTATION_FIELD_NAMES, STANDARD_FACES, anchorOf, annotationKey as annotationKey$1, annotationPatchBetween, buildCommentThreads, colorOf, compareIsoDateTime, deletedWith, faceForFontName, familyKey, fontNameForFace, imageSourceOfBytes, isDimension, isLocalEngine, isReadout, measurementReadout, pageBoxOf, planAnnotationCopies, reorderPart, reorderedList, resolveAnnotationPatch, resolveBinarySource, serializeError, sniffBinaryMetadata, standardFontForFace, toPageRef, viewportForPoint } from "@embedpdf/engine-core/runtime";
|
|
11
|
-
import { MIN_DRAG, anchorModeOf, anchoredGeometry, annotContentsEditable, annotDeletable, annotTransformable, annotationAfter, annotationAnchor, annotationOfNew, applyStyleToRange, canMove, chrome, creationDraftAnchor, cursorAt, defaultsFor, drawnAfter, drawsLive, expandGroups, faceForFont, fitStampBox, fromDTO, gesturePlacement, gesturePlacement as gesturePlacement$1, groupKeyOf, groupOf, hitTest, initialSession, initialTextStyle, isContentsEditableByHand, isDrag, isEditableByHand, isMovable, isOnTextBox, isSelectable, isSubstrateOnly, isTransformableByHand, kindNamed, kindNamed as kindNamed$1, kindOf, linkChildRects, linkChildrenOf, linkOf, locateOffset, newRecordsAtMost, pageItems, placedShape, propertiesOf, propertiesOf as propertiesOf$1, readOfDefaults, refOf, resolveClickPlacement, resolveClickPlacement as resolveClickPlacement$1, richDocOf, richTextLength, rotationAnchor, sameSession, selectionAnchor, selectionInBox, selectionProperties, shapeOf, sourceOfConfirmed, sourceOfNew, styleAt, styleOf, textBoxOf, textBoxes, textOf, textPlateInset, toolAnnotation, typeWithStyle, unanchoredGeometry, unmadeItem, update, uprightRotation, viewable, writableTarget } from "@embedpdf/core-annotation";
|
|
11
|
+
import { MIN_DRAG, anchorModeOf, anchoredGeometry, annotContentsEditable, annotDeletable, annotTransformable, annotationAfter, annotationAnchor, annotationOfNew, applyStyleToRange, canMove, chrome, creationDraftAnchor, cursorAt, defaultsFor, drawnAfter, drawsLive, dropsWaitingInk, expandGroups, faceForFont, fitStampBox, fromDTO, gesturePlacement, gesturePlacement as gesturePlacement$1, groupKeyOf, groupOf, hitTest, initialSession, initialTextStyle, isContentsEditableByHand, isDrag, isEditableByHand, isMovable, isOnTextBox, isSelectable, isSubstrateOnly, isTransformableByHand, kindNamed, kindNamed as kindNamed$1, kindOf, linkChildRects, linkChildrenOf, linkOf, locateOffset, newRecordsAtMost, orientationPatch, pageItems, placedShape, propertiesOf, propertiesOf as propertiesOf$1, readOfDefaults, refOf, resolveClickPlacement, resolveClickPlacement as resolveClickPlacement$1, richDocOf, richTextLength, rotationAnchor, sameSession, selectionAnchor, selectionInBox, selectionProperties, shapeOf, sourceOfConfirmed, sourceOfNew, styleAt, styleOf, textBoxOf, textBoxes, textOf, textPlateInset, toolAnnotation, typeWithStyle, unanchoredGeometry, unmadeItem, update, uprightRotation, viewable, writableTarget } from "@embedpdf/core-annotation";
|
|
12
12
|
import { ActionsToken as ActionsToken$1 } from "@embedpdf/plugin-actions/contract/host";
|
|
13
13
|
import { RenderToken as RenderToken$1 } from "@embedpdf/plugin-render/contract/host";
|
|
14
14
|
import { standardFontCss, standardFontOf, standardFontOfProgramFamily } from "@embedpdf/core-fonts";
|
|
@@ -387,7 +387,7 @@ function createEditHandler(anno, interaction) {
|
|
|
387
387
|
claimsTouch: (sample) => !!sample.page && anno.claimsTouchAt(sample.page.ref, sample.page.point, sample.page.scale, sample.page.rotation, sample.page.zoom),
|
|
388
388
|
onPointerDown: (sample) => {
|
|
389
389
|
if (!sample.page) return false;
|
|
390
|
-
if (anno.
|
|
390
|
+
if (anno.hasCreationAwaitingClick()) return false;
|
|
391
391
|
const touch = sample.pointerType === "touch";
|
|
392
392
|
const wasEditing = anno.getEditingId() != null;
|
|
393
393
|
if (wasEditing) anno.text.end();
|
|
@@ -427,13 +427,14 @@ function createEditHandler(anno, interaction) {
|
|
|
427
427
|
anno.editPointer("up", page, downPoint, false, void 0, void 0, void 0, touch);
|
|
428
428
|
},
|
|
429
429
|
onHover: (sample) => {
|
|
430
|
-
|
|
431
|
-
anno.
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
430
|
+
const page = anno.hasCreationAwaitingClick() ? void 0 : sample.page;
|
|
431
|
+
interaction.claimCursor("annotation", page ? anno.getCursorAt(page.ref, page.point, page.scale, page.rotation, page.zoom) : null, 20);
|
|
432
|
+
anno.hoverAt(page ? {
|
|
433
|
+
page: page.ref,
|
|
434
|
+
point: page.point,
|
|
435
|
+
scale: page.scale,
|
|
436
|
+
rotation: page.rotation,
|
|
437
|
+
zoom: page.zoom
|
|
437
438
|
} : null);
|
|
438
439
|
}
|
|
439
440
|
};
|
|
@@ -506,23 +507,14 @@ function createMarqueeHandler(anno) {
|
|
|
506
507
|
* Its hover shows the tool's ghost where a click lands; the ghost stays while
|
|
507
508
|
* the press is still a click, and clears when the gesture ends.
|
|
508
509
|
*/
|
|
509
|
-
function createDrawHandler(anno, interaction
|
|
510
|
+
function createDrawHandler(anno, interaction) {
|
|
510
511
|
const toolId = () => interaction.getActiveToolId();
|
|
511
512
|
const subtypeOf = (id) => anno.getToolSubtype(id);
|
|
512
513
|
let drawingPoly = false;
|
|
513
514
|
let drawingCallout = false;
|
|
514
515
|
let followPage = null;
|
|
515
516
|
let origin = null;
|
|
516
|
-
let pendingInk = null;
|
|
517
|
-
const flushPendingInk = () => {
|
|
518
|
-
if (!pendingInk) return;
|
|
519
|
-
pendingInk.cancelWait();
|
|
520
|
-
pendingInk = null;
|
|
521
|
-
anno.finishInkDraft();
|
|
522
|
-
};
|
|
523
|
-
onSettle?.(flushPendingInk);
|
|
524
517
|
interaction.onToolChanged(() => {
|
|
525
|
-
flushPendingInk();
|
|
526
518
|
drawingPoly = false;
|
|
527
519
|
drawingCallout = false;
|
|
528
520
|
followPage = null;
|
|
@@ -543,10 +535,6 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
543
535
|
return true;
|
|
544
536
|
}
|
|
545
537
|
if (!sample.page) return false;
|
|
546
|
-
if (st === "ink" && pendingInk) if (pendingInk.tool === tool && pendingInk.page.objectNumber === sample.page.ref.objectNumber) {
|
|
547
|
-
pendingInk.cancelWait();
|
|
548
|
-
pendingInk = null;
|
|
549
|
-
} else flushPendingInk();
|
|
550
538
|
origin = {
|
|
551
539
|
page: sample.page.ref,
|
|
552
540
|
point: sample.page.point
|
|
@@ -578,28 +566,11 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
578
566
|
onPointerUp: (sample) => {
|
|
579
567
|
const tool = toolId();
|
|
580
568
|
const st = subtypeOf(tool);
|
|
581
|
-
if (origin && !isPolyTool(st))
|
|
582
|
-
anno.createPointer(tool, "up", origin.page, pointOn(sample, origin.page) ?? origin.point);
|
|
583
|
-
if (st === "ink") {
|
|
584
|
-
const groupStrokesMs = anno.getResolvedTool(tool)?.ink?.groupStrokesMs ?? 0;
|
|
585
|
-
if (groupStrokesMs > 0) pendingInk = {
|
|
586
|
-
tool,
|
|
587
|
-
page: origin.page,
|
|
588
|
-
cancelWait: clock.after(groupStrokesMs, () => {
|
|
589
|
-
pendingInk = null;
|
|
590
|
-
anno.finishInkDraft();
|
|
591
|
-
})
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
}
|
|
569
|
+
if (origin && !isPolyTool(st)) anno.createPointer(tool, "up", origin.page, pointOn(sample, origin.page) ?? origin.point);
|
|
595
570
|
origin = null;
|
|
596
571
|
anno.clearGhost();
|
|
597
572
|
},
|
|
598
573
|
onPointerCancel: () => {
|
|
599
|
-
if (pendingInk) {
|
|
600
|
-
pendingInk.cancelWait();
|
|
601
|
-
pendingInk = null;
|
|
602
|
-
}
|
|
603
574
|
drawingPoly = false;
|
|
604
575
|
drawingCallout = false;
|
|
605
576
|
followPage = null;
|
|
@@ -674,16 +645,18 @@ function connectAnnotation(ctx, annotation) {
|
|
|
674
645
|
id: tool.id,
|
|
675
646
|
cursor: tool.cursor,
|
|
676
647
|
enables: tool.enables,
|
|
677
|
-
touch: toolTouchOf(tool.enables)
|
|
648
|
+
touch: toolTouchOf(tool.enables),
|
|
649
|
+
canUse: () => annotation.canCreate()
|
|
678
650
|
}));
|
|
679
651
|
}
|
|
680
652
|
for (const handler of [
|
|
681
653
|
createPlaceHandler(annotation, interaction),
|
|
682
654
|
createEditHandler(annotation, interaction),
|
|
683
655
|
createMarqueeHandler(annotation),
|
|
684
|
-
createDrawHandler(annotation, interaction
|
|
656
|
+
createDrawHandler(annotation, interaction)
|
|
685
657
|
]) ctx.cleanup(interaction.registerHandler(handler));
|
|
686
658
|
ctx.listen(interaction.onToolChanged, () => {
|
|
659
|
+
annotation.finishInkDraft();
|
|
687
660
|
annotation.cancel();
|
|
688
661
|
annotation.clearGhost();
|
|
689
662
|
annotation.pruneEngagedSelection();
|
|
@@ -1340,6 +1313,7 @@ const FORMATS = /* @__PURE__ */ new Set([
|
|
|
1340
1313
|
/** One property's value, by its key (the border's is its three fields). */
|
|
1341
1314
|
function propertyValue(spec, { data, text, link }) {
|
|
1342
1315
|
if (spec.key === "link") return link ?? null;
|
|
1316
|
+
if (spec.key === "orientation") return String(data.rotation ?? 0);
|
|
1343
1317
|
if (spec.key === "borderStyle") return {
|
|
1344
1318
|
borderStyle: data.borderStyle ?? "solid",
|
|
1345
1319
|
dashArray: data.dashArray ?? null,
|
|
@@ -2007,11 +1981,17 @@ function createView(ctx, records, lending) {
|
|
|
2007
1981
|
const painter = lender.painter(shown);
|
|
2008
1982
|
return painter ? { painter } : {};
|
|
2009
1983
|
};
|
|
2010
|
-
/**
|
|
1984
|
+
/** The same accent: none on both sides, or the same color as strong. */
|
|
1985
|
+
const sameAccent = (left, right) => left === right || left !== null && right !== null && left.color === right.color && left.strength === right.strength;
|
|
1986
|
+
/**
|
|
1987
|
+
* A lent record as the model has it, cached per shown row, the confirmed row it was made from
|
|
1988
|
+
* and the accent its lender gives it.
|
|
1989
|
+
*/
|
|
2011
1990
|
const lent = /* @__PURE__ */ new WeakMap();
|
|
2012
1991
|
const lentRecord = (shown, truth, lender) => {
|
|
1992
|
+
const accent = lender.accentOf?.(shown) ?? null;
|
|
2013
1993
|
const cached = lent.get(shown);
|
|
2014
|
-
if (cached && cached.truth === truth) return cached.record;
|
|
1994
|
+
if (cached && cached.truth === truth && sameAccent(cached.accent, accent)) return cached.record;
|
|
2015
1995
|
let record;
|
|
2016
1996
|
if (!truth) record = {
|
|
2017
1997
|
...fromDTO(shown),
|
|
@@ -2043,8 +2023,13 @@ function createView(ctx, records, lending) {
|
|
|
2043
2023
|
source: "vector"
|
|
2044
2024
|
};
|
|
2045
2025
|
}
|
|
2026
|
+
if (accent) record = {
|
|
2027
|
+
...record,
|
|
2028
|
+
accent
|
|
2029
|
+
};
|
|
2046
2030
|
lent.set(shown, {
|
|
2047
2031
|
truth,
|
|
2032
|
+
accent,
|
|
2048
2033
|
record
|
|
2049
2034
|
});
|
|
2050
2035
|
return record;
|
|
@@ -3083,6 +3068,7 @@ const NOTHING_WRITTEN = {
|
|
|
3083
3068
|
const noNumbers = () => new PluginError("not-ready", "annotation", "the document holds no object number for a new annotation right now");
|
|
3084
3069
|
function createStore(ctx, view, records, events, lending, copySources) {
|
|
3085
3070
|
let followUp = null;
|
|
3071
|
+
let finishWaitingInk = null;
|
|
3086
3072
|
const builders = /* @__PURE__ */ new Map();
|
|
3087
3073
|
const model = view.model;
|
|
3088
3074
|
/** The changes this plugin staged that the engine hasn't answered: their refusals are reported. */
|
|
@@ -3156,6 +3142,10 @@ function createStore(ctx, view, records, events, lending, copySources) {
|
|
|
3156
3142
|
} catch (error) {
|
|
3157
3143
|
throw toPluginError("annotation", error);
|
|
3158
3144
|
}
|
|
3145
|
+
if (finishWaitingInk && dropsWaitingInk(before, result.session, message)) {
|
|
3146
|
+
finishWaitingInk();
|
|
3147
|
+
if (model().draft !== before.draft) return commit(message, options);
|
|
3148
|
+
}
|
|
3159
3149
|
if (options.adjust) result = options.adjust(result);
|
|
3160
3150
|
const after = modelAfter(before, result);
|
|
3161
3151
|
const shown = records.view();
|
|
@@ -3347,6 +3337,9 @@ function createStore(ctx, view, records, events, lending, copySources) {
|
|
|
3347
3337
|
onUpdate: (next) => {
|
|
3348
3338
|
followUp = next;
|
|
3349
3339
|
},
|
|
3340
|
+
onWaitingInk: (finish) => {
|
|
3341
|
+
finishWaitingInk = finish;
|
|
3342
|
+
},
|
|
3350
3343
|
onEffect: (kind, build) => {
|
|
3351
3344
|
builders.set(kind, (effect, current, before) => build(effect, current, before));
|
|
3352
3345
|
},
|
|
@@ -3723,11 +3716,13 @@ function createToolRegistry(ctx, settingTools, store, events) {
|
|
|
3723
3716
|
/** Put `tool` on the hub, in place of any tool with its id. */
|
|
3724
3717
|
const registerOnHub = (tool) => {
|
|
3725
3718
|
const { id, cursor, enables } = tool;
|
|
3719
|
+
const canUse = () => ctx.allows("annotations:create");
|
|
3726
3720
|
const hubTool = {
|
|
3727
3721
|
id,
|
|
3728
3722
|
cursor,
|
|
3729
3723
|
enables,
|
|
3730
|
-
touch: toolTouchOf(enables)
|
|
3724
|
+
touch: toolTouchOf(enables),
|
|
3725
|
+
canUse
|
|
3731
3726
|
};
|
|
3732
3727
|
return ctx.tryGet(InteractionToken)?.registerTool(hubTool, { replace: true });
|
|
3733
3728
|
};
|
|
@@ -4179,7 +4174,11 @@ function createGhost(ctx, { store, geometry, tools }, stamps) {
|
|
|
4179
4174
|
}
|
|
4180
4175
|
const placingTool = placing && tools.get(placing.toolId);
|
|
4181
4176
|
if (placing?.page.objectNumber === pageObjectNumber && placingTool && isDrag("box", placing.from, placing.to)) {
|
|
4182
|
-
const placement = gesturePlacement$1("box", placing.from, placing.to, placingTool.clickCreate, {
|
|
4177
|
+
const placement = gesturePlacement$1("box", placing.from, placing.to, placingTool.clickCreate, {
|
|
4178
|
+
pageBox: geometry.pageBoxOf(pageObjectNumber),
|
|
4179
|
+
upright: placingTool.upright,
|
|
4180
|
+
displayRotation: placing.displayRotation
|
|
4181
|
+
});
|
|
4183
4182
|
const annotation = annotationOfTool(model, placingTool);
|
|
4184
4183
|
const shape = placement && placedShape(annotation, placement);
|
|
4185
4184
|
if (shape) items.push(unmadeItem(PLACING_ID, annotation, shape, "draft", view));
|
|
@@ -4219,12 +4218,13 @@ function createGhost(ctx, { store, geometry, tools }, stamps) {
|
|
|
4219
4218
|
api: {
|
|
4220
4219
|
hoverGhostAt,
|
|
4221
4220
|
clearGhost,
|
|
4222
|
-
previewPlacement: (toolId, page, from, to) => {
|
|
4221
|
+
previewPlacement: (toolId, page, from, to, displayRotation) => {
|
|
4223
4222
|
ctx.state.update(setPlacing, {
|
|
4224
4223
|
toolId,
|
|
4225
4224
|
page,
|
|
4226
4225
|
from,
|
|
4227
|
-
to
|
|
4226
|
+
to,
|
|
4227
|
+
...displayRotation !== void 0 ? { displayRotation } : {}
|
|
4228
4228
|
});
|
|
4229
4229
|
},
|
|
4230
4230
|
clearPlacementPreview: () => {
|
|
@@ -4448,9 +4448,10 @@ function createCrud(ctx, { store, tools, records, lending }, annotations, settle
|
|
|
4448
4448
|
//#endregion
|
|
4449
4449
|
//#region src/write/drafts.ts
|
|
4450
4450
|
/**
|
|
4451
|
-
* Creation drafts: the polygon or polyline a click per point builds
|
|
4452
|
-
*
|
|
4453
|
-
*
|
|
4451
|
+
* Creation drafts: the polygon or polyline a click per point builds, its
|
|
4452
|
+
* finish and cancel doors, and the captured-draft seam the measurement plugin
|
|
4453
|
+
* calibrates from. Also the pen drawing that waits for its next stroke: the
|
|
4454
|
+
* wait, and everything that ends it.
|
|
4454
4455
|
*/
|
|
4455
4456
|
function createDrafts(ctx, { store, events, tools, afterCreate }, annotations) {
|
|
4456
4457
|
let anchorCache = null;
|
|
@@ -4484,6 +4485,60 @@ function createDrafts(ctx, { store, events, tools, afterCreate }, annotations) {
|
|
|
4484
4485
|
const annotation = annotations.get(ref);
|
|
4485
4486
|
return annotation ? { annotation } : null;
|
|
4486
4487
|
};
|
|
4488
|
+
/**
|
|
4489
|
+
* The wait that is running: the draft as the pen left it, the tool that
|
|
4490
|
+
* drew it, the tool that was active then, and the wait's cancel. It speaks
|
|
4491
|
+
* for the drawing only while the model's draft is that same object: the
|
|
4492
|
+
* next stroke, and whatever ends the drawing, put another draft there.
|
|
4493
|
+
*/
|
|
4494
|
+
let wait = null;
|
|
4495
|
+
/** The ink draft whose pen is up, or null: a stroke still being drawn is not waiting. */
|
|
4496
|
+
const waitingInk = () => {
|
|
4497
|
+
const draft = store.model().draft;
|
|
4498
|
+
return draft?.kind === "create-ink" && !draft.drawing ? draft : null;
|
|
4499
|
+
};
|
|
4500
|
+
/**
|
|
4501
|
+
* Make the drawing that waits an annotation now, as its tool's
|
|
4502
|
+
* `afterCreate` says. With `selects: false` the selection stays as it is:
|
|
4503
|
+
* what ended the wait decides it.
|
|
4504
|
+
*/
|
|
4505
|
+
const finishWaitingInk = ({ selects = true } = {}) => {
|
|
4506
|
+
const draft = waitingInk();
|
|
4507
|
+
if (!draft) return;
|
|
4508
|
+
const running = wait?.draft === draft ? wait : null;
|
|
4509
|
+
wait?.cancel();
|
|
4510
|
+
wait = null;
|
|
4511
|
+
const toolId = running ? running.toolId : tools.activeTool()?.id;
|
|
4512
|
+
const { selected } = store.model();
|
|
4513
|
+
const commit = store.commit({ type: "finishInkDraft" }, { adjust: selects ? afterCreate.shape(toolId) : (result) => ({
|
|
4514
|
+
...result,
|
|
4515
|
+
session: {
|
|
4516
|
+
...result.session,
|
|
4517
|
+
selected
|
|
4518
|
+
}
|
|
4519
|
+
}) });
|
|
4520
|
+
if (!running || running.activeToolId === tools.activeTool()?.id) afterCreate.done(toolId, commit);
|
|
4521
|
+
};
|
|
4522
|
+
/**
|
|
4523
|
+
* The pen is up and its stroke is held back: wait `delayMs` for the next
|
|
4524
|
+
* stroke of the same drawing. When none comes, the drawing is finished.
|
|
4525
|
+
*/
|
|
4526
|
+
const waitForNextStroke = (toolId, delayMs) => {
|
|
4527
|
+
const draft = waitingInk();
|
|
4528
|
+
if (!draft) return;
|
|
4529
|
+
wait?.cancel();
|
|
4530
|
+
const cancel = ctx.clock.after(delayMs, () => {
|
|
4531
|
+
if (store.model().draft === draft) finishWaitingInk();
|
|
4532
|
+
});
|
|
4533
|
+
wait = {
|
|
4534
|
+
draft,
|
|
4535
|
+
toolId,
|
|
4536
|
+
activeToolId: tools.activeTool()?.id,
|
|
4537
|
+
cancel
|
|
4538
|
+
};
|
|
4539
|
+
};
|
|
4540
|
+
store.onWaitingInk(() => finishWaitingInk({ selects: false }));
|
|
4541
|
+
ctx.onSettle(() => finishWaitingInk());
|
|
4487
4542
|
return {
|
|
4488
4543
|
draft: {
|
|
4489
4544
|
get: () => draftAnchorOf(),
|
|
@@ -4493,10 +4548,7 @@ function createDrafts(ctx, { store, events, tools, afterCreate }, annotations) {
|
|
|
4493
4548
|
}
|
|
4494
4549
|
},
|
|
4495
4550
|
api: {
|
|
4496
|
-
finishInkDraft: () =>
|
|
4497
|
-
const toolId = tools.activeTool()?.id;
|
|
4498
|
-
afterCreate.done(toolId, store.commit({ type: "finishInkDraft" }, { adjust: afterCreate.shape(toolId) }));
|
|
4499
|
-
},
|
|
4551
|
+
finishInkDraft: () => finishWaitingInk(),
|
|
4500
4552
|
cancel: () => {
|
|
4501
4553
|
store.commit({ type: "cancel" });
|
|
4502
4554
|
},
|
|
@@ -4504,8 +4556,13 @@ function createDrafts(ctx, { store, events, tools, afterCreate }, annotations) {
|
|
|
4504
4556
|
const draft = store.model().draft;
|
|
4505
4557
|
return draft?.kind === "create-distance" && draft.step === "offset" ? draft.page : null;
|
|
4506
4558
|
},
|
|
4507
|
-
onDraftCaptured: events.draftCaptured.on
|
|
4508
|
-
|
|
4559
|
+
onDraftCaptured: events.draftCaptured.on,
|
|
4560
|
+
hasCreationAwaitingClick: () => {
|
|
4561
|
+
const draft = store.model().draft;
|
|
4562
|
+
return draft?.kind === "create-poly" || draft?.kind === "create-callout" || draft?.kind === "create-distance" && draft.step === "offset";
|
|
4563
|
+
}
|
|
4564
|
+
},
|
|
4565
|
+
waitForNextStroke
|
|
4509
4566
|
};
|
|
4510
4567
|
}
|
|
4511
4568
|
//#endregion
|
|
@@ -4944,7 +5001,7 @@ function createAnnotationHoverFeed(actions, annotOf) {
|
|
|
4944
5001
|
* (edit, marquee, create, hover), each folded into the pure core with this
|
|
4945
5002
|
* plugin's inputs filled in (page box, chrome geometry, engaged ids, view).
|
|
4946
5003
|
*/
|
|
4947
|
-
function createPointer(ctx, { store, geometry, authority, tools, behaviors, afterCreate }, chrome, measurement) {
|
|
5004
|
+
function createPointer(ctx, { store, geometry, authority, tools, behaviors, afterCreate }, chrome, measurement, drafts) {
|
|
4948
5005
|
const actionsForHover = ctx.tryGet(ActionsToken);
|
|
4949
5006
|
const hoverFeed = actionsForHover ? createAnnotationHoverFeed(actionsForHover, (id) => store.model().byId[id] ?? null) : null;
|
|
4950
5007
|
return { api: {
|
|
@@ -4986,6 +5043,7 @@ function createPointer(ctx, { store, geometry, authority, tools, behaviors, afte
|
|
|
4986
5043
|
if (resolvedTool?.capture === true ? !ctx.doc?.security.allows("doc.annotate.modify") : !authority.canCreate()) return;
|
|
4987
5044
|
const laidOut = geometry.sizeOf(pageObjectNumber) !== null;
|
|
4988
5045
|
const cache = measurement.viewportsOf(pageObjectNumber);
|
|
5046
|
+
const groupStrokesMs = resolvedTool?.ink?.groupStrokesMs ?? 0;
|
|
4989
5047
|
const draft = store.model().draft;
|
|
4990
5048
|
const continuingMeasurement = (draft?.kind === "create-distance" || draft?.kind === "create-poly") && draft.page.objectNumber === pageObjectNumber && draft.preset === (resolvedTool?.preset ?? tool);
|
|
4991
5049
|
const own = resolvedTool ? defaultsFor(store.model(), resolvedTool.preset) : {};
|
|
@@ -5051,7 +5109,7 @@ function createPointer(ctx, { store, geometry, authority, tools, behaviors, afte
|
|
|
5051
5109
|
intent: intent === "ink-highlight" ? intent : void 0,
|
|
5052
5110
|
clickCreate: resolvedTool?.clickCreate,
|
|
5053
5111
|
flags: resolvedTool?.flags,
|
|
5054
|
-
deferInkCommit:
|
|
5112
|
+
deferInkCommit: groupStrokesMs > 0,
|
|
5055
5113
|
straightenInk: resolvedTool?.ink?.straighten,
|
|
5056
5114
|
in: {
|
|
5057
5115
|
page,
|
|
@@ -5064,6 +5122,7 @@ function createPointer(ctx, { store, geometry, authority, tools, behaviors, afte
|
|
|
5064
5122
|
}
|
|
5065
5123
|
}, { adjust: afterCreate.shape(resolvedTool?.id) });
|
|
5066
5124
|
afterCreate.done(resolvedTool?.id, committed);
|
|
5125
|
+
if (phase === "up" && groupStrokesMs > 0) drafts.waitForNextStroke(resolvedTool?.id, groupStrokesMs);
|
|
5067
5126
|
},
|
|
5068
5127
|
hoverAt: (at) => {
|
|
5069
5128
|
const model = store.model();
|
|
@@ -5234,6 +5293,15 @@ function createSelectionWrites(ctx, { store, authority, fonts, behaviors, lendin
|
|
|
5234
5293
|
y: flips("y", "height") ? -10 : DUPLICATE_OFFSET
|
|
5235
5294
|
};
|
|
5236
5295
|
};
|
|
5296
|
+
/** The box of each page the selection is on: where a turn keeps what it turned. */
|
|
5297
|
+
const selectionPageBoxes = () => {
|
|
5298
|
+
const boxes = {};
|
|
5299
|
+
for (const { annotation } of annotations.selectedRecords()) {
|
|
5300
|
+
const box = geometry.pageBoxOf(annotation.page.objectNumber);
|
|
5301
|
+
if (box) boxes[annotation.page.objectNumber] = box;
|
|
5302
|
+
}
|
|
5303
|
+
return boxes;
|
|
5304
|
+
};
|
|
5237
5305
|
/** Commit a selection message; resolves with its outcome over the refs that were selected. */
|
|
5238
5306
|
const commitOverSelection = async (commit, signal) => {
|
|
5239
5307
|
return batchResultOf(selectedRefs(), { failed: (await ctx.cancellable(signal, Promise.all(commit().map((committed) => committed.written)))).flatMap((outcome) => outcome.failed) });
|
|
@@ -5346,12 +5414,16 @@ function createSelectionWrites(ctx, { store, authority, fonts, behaviors, lendin
|
|
|
5346
5414
|
rotateBy: async (degrees, options = {}) => {
|
|
5347
5415
|
const commit = store.commit({
|
|
5348
5416
|
type: "rotateSelection",
|
|
5349
|
-
degrees
|
|
5417
|
+
degrees,
|
|
5418
|
+
pageBoxes: selectionPageBoxes()
|
|
5350
5419
|
});
|
|
5351
5420
|
throwIfFailed(await ctx.cancellable(options.signal, commit.written));
|
|
5352
5421
|
},
|
|
5353
5422
|
resetRotation: async (options = {}) => {
|
|
5354
|
-
const commit = store.commit({
|
|
5423
|
+
const commit = store.commit({
|
|
5424
|
+
type: "resetRotation",
|
|
5425
|
+
pageBoxes: selectionPageBoxes()
|
|
5426
|
+
});
|
|
5355
5427
|
throwIfFailed(await ctx.cancellable(options.signal, commit.written));
|
|
5356
5428
|
},
|
|
5357
5429
|
getAnchor: () => chrome.selectionAnchor(),
|
|
@@ -5894,8 +5966,8 @@ function createAnnotationController(ctx) {
|
|
|
5894
5966
|
const icons = createIcons(ctx, services, stamps);
|
|
5895
5967
|
const selection = createSelectionWrites(ctx, services, annotations, properties, chrome, text, crud);
|
|
5896
5968
|
const measurement = createMeasurement(ctx, services);
|
|
5897
|
-
const pointer = createPointer(ctx, services, chrome, measurement);
|
|
5898
5969
|
const drafts = createDrafts(ctx, services, annotations);
|
|
5970
|
+
const pointer = createPointer(ctx, services, chrome, measurement, drafts);
|
|
5899
5971
|
const markup = createMarkupWrites(ctx, services, annotations);
|
|
5900
5972
|
const scripts = createScriptEffects(ctx, services);
|
|
5901
5973
|
const comments = createComments(ctx, services, createThreadIndex(ctx, services), crud);
|
|
@@ -5992,6 +6064,6 @@ const annotationPlugin = (config) => definePlugin({
|
|
|
5992
6064
|
create: createAnnotationController
|
|
5993
6065
|
});
|
|
5994
6066
|
//#endregion
|
|
5995
|
-
export { ANNOTATION_DEFAULTS, ARMED_STAMP_TOOL_ID, AnnotationToken, AnnotationTransfer, DEFAULT_TOOLS, MIN_DRAG, annotationKey, annotationPlugin, annotationState, gesturePlacement, kindNamed, propertiesOf, resolveClickPlacement, widgetAppearanceOf };
|
|
6067
|
+
export { ANNOTATION_DEFAULTS, ARMED_STAMP_TOOL_ID, AnnotationToken, AnnotationTransfer, DEFAULT_TOOLS, MIN_DRAG, annotationKey, annotationPlugin, annotationState, gesturePlacement, kindNamed, orientationPatch, propertiesOf, resolveClickPlacement, widgetAppearanceOf };
|
|
5996
6068
|
|
|
5997
6069
|
//# sourceMappingURL=index.js.map
|