@embedpdf/plugin-annotation 3.0.0-next.22 → 3.0.0-next.23
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/contract/host.cjs +2 -2
- package/dist/contract/host.d.cts +3 -3
- package/dist/contract/host.d.ts +3 -3
- package/dist/contract/host.js +2 -2
- package/dist/{contract-BzsydV7F.d.cts → contract-BK2g1Rem.d.ts} +65 -62
- package/dist/{contract-CPzpRG3h.cjs → contract-BtAl3Yo2.cjs} +4 -4
- package/dist/contract-BtAl3Yo2.cjs.map +1 -0
- package/dist/{contract-DnQUGmxG.d.ts → contract-CBYEqnev.d.cts} +65 -62
- package/dist/{contract-b2e_LZvu.js → contract-OwgW3JE8.js} +4 -4
- package/dist/contract-OwgW3JE8.js.map +1 -0
- package/dist/contract.cjs +1 -1
- package/dist/contract.d.cts +2 -2
- package/dist/contract.d.ts +2 -2
- package/dist/contract.js +1 -1
- package/dist/{host-contract-DY9jFPPF.cjs → host-contract-BzM2upsA.cjs} +2 -2
- package/dist/host-contract-BzM2upsA.cjs.map +1 -0
- package/dist/{host-contract-BMliTeaD.d.ts → host-contract-COF2Prd-.d.ts} +25 -25
- package/dist/{host-contract-CxrQPcPj.js → host-contract-CSKiuu3g.js} +2 -2
- package/dist/host-contract-CSKiuu3g.js.map +1 -0
- package/dist/{host-contract-CYPNi49b.d.cts → host-contract-CxOrR_pp.d.cts} +25 -25
- package/dist/index.cjs +44 -43
- 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 +45 -44
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/dist/contract-CPzpRG3h.cjs.map +0 -1
- package/dist/contract-b2e_LZvu.js.map +0 -1
- package/dist/host-contract-CxrQPcPj.js.map +0 -1
- package/dist/host-contract-DY9jFPPF.cjs.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { widgetAppearanceOf } from "./authoring.cjs";
|
|
2
|
-
import { $ as Color, A as AnnotationResources, At as AnnotationState, B as AnnotationTool, Bt as ResolvedGhost, C as AnnotationPatch, Ct as StampPlacement, D as AnnotationRef, Dt as ThreadDeleteResult, E as AnnotationProperty, Et as TextItem, F as AnnotationSelectionChangedEvent, Ft as AnnotationToolInput, G as ArmedStampInfo, Gt as ToolDefaultsFor, H as AnnotationTransfer, Ht as SelectionAuthoring, I as AnnotationSettings, It as DEFAULT_TOOLS, J as AttachmentFileSource, Jt as TextFormat, K as ArmedStampPreview, L as
|
|
3
|
-
import { f as AnnotationModel, n as AnnotationHostCapability } from "./host-contract-
|
|
2
|
+
import { $ as Color, A as AnnotationResources, At as AnnotationState, B as AnnotationTool, Bt as ResolvedGhost, C as AnnotationPatch, Ct as StampPlacement, D as AnnotationRef, Dt as ThreadDeleteResult, E as AnnotationProperty, Et as TextItem, F as AnnotationSelectionChangedEvent, Ft as AnnotationToolInput, G as ArmedStampInfo, Gt as ToolDefaultsFor, H as AnnotationTransfer, Ht as SelectionAuthoring, I as AnnotationSettings, It as DEFAULT_TOOLS, J as AttachmentFileSource, Jt as TextFormat, K as ArmedStampPreview, L as AnnotationStampsCapability, Lt as GhostPolicy, M as AnnotationRotationAnchor, Mt as AnnotationToken, N as AnnotationSelectionAnchor, Nt as ARMED_STAMP_TOOL_ID, O as AnnotationReorderedEvent, Ot as ToolDefaults, P as AnnotationSelectionCapability, Pt as AnnotationToolDefinition, Q as ClickCreate, R as AnnotationSubtype, Rt as InkAuthoringOptions, S as AnnotationOption, St as StampInput, T as AnnotationProperties, Tt as TextAlign, U as AnnotationUpdatedEvent, Ut as StampSourceSpec, V as AnnotationToolsCapability, Vt as ResolvedTool, W as AnnotationWriteFailedEvent, Wt as ToolAuthoringKind, X as BlendMode, Y as Behavior, Yt as TextSelection, Z as ChromeSettings, _ as AnnotationHoverChangedEvent, _t as MarkupSubtype, a as AnnotationBundle, at as EditableKind, b as AnnotationImportResult, bt as ReviewStatus, c as AnnotationCreatedEvent, ct as FilePickerProvider, d as AnnotationDraftCapability, dt as HandleRole, et as CommentThread, f as AnnotationDraftChangedEvent, ft as ImageGhost, g as AnnotationFlags, gt as LinkNavItem, h as AnnotationFilter, ht as LineStyle, i as AnnotationAnchor, it as CreationDraft, j as AnnotationResyncedEvent, jt as annotationState, k as AnnotationResourceRole, kt as ToolDefaultsChangedEvent, l as AnnotationDeletedEvent, lt as FilePromptRequest, m as AnnotationExportSelection, mt as LineEndings, n as AfterCreateSettings, nt as CommentThreadReview, o as AnnotationCapability, ot as EditableKinds, p as AnnotationEditingChangedEvent, pt as LineEnding, q as AttachmentContent, qt as Face, r as Annotation, rt as CommentsCapability, s as AnnotationConfig, st as FieldValues, t as ANNOTATION_DEFAULTS, tt as CommentThreadChangedEvent, u as AnnotationDraft, ut as FlagKey, v as AnnotationImportDrop, vt as MeasurementIntent, w as AnnotationPosition, wt as StampPreviewProvider, x as AnnotationLinksCapability, xt as SnapSettings, y as AnnotationImportOptions, yt as PdfLinkTarget, z as AnnotationTextCapability, zt as PromptSourceSpec } from "./contract-CBYEqnev.cjs";
|
|
3
|
+
import { f as AnnotationModel, n as AnnotationHostCapability } from "./host-contract-CxOrR_pp.cjs";
|
|
4
4
|
import { MIN_DRAG, Placement, gesturePlacement, kindNamed, propertiesOf, resolveClickPlacement } from "@embedpdf/core-annotation";
|
|
5
5
|
import { annotationKey } from "@embedpdf/core";
|
|
6
6
|
//#region src/annotation.plugin.d.ts
|
|
@@ -13,7 +13,7 @@ import { annotationKey } from "@embedpdf/core";
|
|
|
13
13
|
* programs the engine writes with. `config` is the settings the app
|
|
14
14
|
* registers, over {@link ANNOTATION_DEFAULTS}.
|
|
15
15
|
*/
|
|
16
|
-
declare const annotationPlugin: (config?: AnnotationConfig) => import("@embedpdf/core").
|
|
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,
|
|
18
|
+
export { ANNOTATION_DEFAULTS, ARMED_STAMP_TOOL_ID, AfterCreateSettings, type Annotation, AnnotationAnchor, type AnnotationBundle, AnnotationCapability, AnnotationConfig, AnnotationCreatedEvent, AnnotationDeletedEvent, type AnnotationDraft, AnnotationDraftCapability, AnnotationDraftChangedEvent, 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 };
|
|
19
19
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { widgetAppearanceOf } from "./authoring.js";
|
|
2
|
-
import { $ as Color, A as AnnotationResources, At as AnnotationState, B as AnnotationTool, Bt as ResolvedGhost, C as AnnotationPatch, Ct as StampPlacement, D as AnnotationRef, Dt as ThreadDeleteResult, E as AnnotationProperty, Et as TextItem, F as AnnotationSelectionChangedEvent, Ft as AnnotationToolInput, G as ArmedStampInfo, Gt as ToolDefaultsFor, H as AnnotationTransfer, Ht as SelectionAuthoring, I as AnnotationSettings, It as DEFAULT_TOOLS, J as AttachmentFileSource, Jt as TextFormat, K as ArmedStampPreview, L as
|
|
3
|
-
import { f as AnnotationModel, n as AnnotationHostCapability } from "./host-contract-
|
|
2
|
+
import { $ as Color, A as AnnotationResources, At as AnnotationState, B as AnnotationTool, Bt as ResolvedGhost, C as AnnotationPatch, Ct as StampPlacement, D as AnnotationRef, Dt as ThreadDeleteResult, E as AnnotationProperty, Et as TextItem, F as AnnotationSelectionChangedEvent, Ft as AnnotationToolInput, G as ArmedStampInfo, Gt as ToolDefaultsFor, H as AnnotationTransfer, Ht as SelectionAuthoring, I as AnnotationSettings, It as DEFAULT_TOOLS, J as AttachmentFileSource, Jt as TextFormat, K as ArmedStampPreview, L as AnnotationStampsCapability, Lt as GhostPolicy, M as AnnotationRotationAnchor, Mt as AnnotationToken, N as AnnotationSelectionAnchor, Nt as ARMED_STAMP_TOOL_ID, O as AnnotationReorderedEvent, Ot as ToolDefaults, P as AnnotationSelectionCapability, Pt as AnnotationToolDefinition, Q as ClickCreate, R as AnnotationSubtype, Rt as InkAuthoringOptions, S as AnnotationOption, St as StampInput, T as AnnotationProperties, Tt as TextAlign, U as AnnotationUpdatedEvent, Ut as StampSourceSpec, V as AnnotationToolsCapability, Vt as ResolvedTool, W as AnnotationWriteFailedEvent, Wt as ToolAuthoringKind, X as BlendMode, Y as Behavior, Yt as TextSelection, Z as ChromeSettings, _ as AnnotationHoverChangedEvent, _t as MarkupSubtype, a as AnnotationBundle, at as EditableKind, b as AnnotationImportResult, bt as ReviewStatus, c as AnnotationCreatedEvent, ct as FilePickerProvider, d as AnnotationDraftCapability, dt as HandleRole, et as CommentThread, f as AnnotationDraftChangedEvent, ft as ImageGhost, g as AnnotationFlags, gt as LinkNavItem, h as AnnotationFilter, ht as LineStyle, i as AnnotationAnchor, it as CreationDraft, j as AnnotationResyncedEvent, jt as annotationState, k as AnnotationResourceRole, kt as ToolDefaultsChangedEvent, l as AnnotationDeletedEvent, lt as FilePromptRequest, m as AnnotationExportSelection, mt as LineEndings, n as AfterCreateSettings, nt as CommentThreadReview, o as AnnotationCapability, ot as EditableKinds, p as AnnotationEditingChangedEvent, pt as LineEnding, q as AttachmentContent, qt as Face, r as Annotation, rt as CommentsCapability, s as AnnotationConfig, st as FieldValues, t as ANNOTATION_DEFAULTS, tt as CommentThreadChangedEvent, u as AnnotationDraft, ut as FlagKey, v as AnnotationImportDrop, vt as MeasurementIntent, w as AnnotationPosition, wt as StampPreviewProvider, x as AnnotationLinksCapability, xt as SnapSettings, y as AnnotationImportOptions, yt as PdfLinkTarget, z as AnnotationTextCapability, zt as PromptSourceSpec } from "./contract-BK2g1Rem.js";
|
|
3
|
+
import { f as AnnotationModel, n as AnnotationHostCapability } from "./host-contract-COF2Prd-.js";
|
|
4
4
|
import { annotationKey } from "@embedpdf/core";
|
|
5
5
|
import { MIN_DRAG, Placement, gesturePlacement, kindNamed, propertiesOf, resolveClickPlacement } from "@embedpdf/core-annotation";
|
|
6
6
|
//#region src/annotation.plugin.d.ts
|
|
@@ -13,7 +13,7 @@ import { MIN_DRAG, Placement, gesturePlacement, kindNamed, propertiesOf, resolve
|
|
|
13
13
|
* programs the engine writes with. `config` is the settings the app
|
|
14
14
|
* registers, over {@link ANNOTATION_DEFAULTS}.
|
|
15
15
|
*/
|
|
16
|
-
declare const annotationPlugin: (config?: AnnotationConfig) => import("@embedpdf/core").
|
|
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,
|
|
18
|
+
export { ANNOTATION_DEFAULTS, ARMED_STAMP_TOOL_ID, AfterCreateSettings, type Annotation, AnnotationAnchor, type AnnotationBundle, AnnotationCapability, AnnotationConfig, AnnotationCreatedEvent, AnnotationDeletedEvent, type AnnotationDraft, AnnotationDraftCapability, AnnotationDraftChangedEvent, 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 };
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as buildToolRegistry, c as AnnotationToken, i as DEFAULT_TOOLS, n as AnnotationTransfer, o as toolTouchOf, r as ARMED_STAMP_TOOL_ID, s as annotationState, t as ANNOTATION_DEFAULTS } from "./contract-
|
|
2
|
-
import { n as previewBucket, t as AnnotationToken$1 } from "./host-contract-
|
|
1
|
+
import { a as buildToolRegistry, c as AnnotationToken, i as DEFAULT_TOOLS, n as AnnotationTransfer, o as toolTouchOf, r as ARMED_STAMP_TOOL_ID, s as annotationState, t as ANNOTATION_DEFAULTS } from "./contract-OwgW3JE8.js";
|
|
2
|
+
import { n as previewBucket, t as AnnotationToken$1 } from "./host-contract-CSKiuu3g.js";
|
|
3
3
|
import { widgetAppearanceOf } from "./authoring.js";
|
|
4
4
|
import { PluginError, annotationKey, composeApi, definePlugin, memo, pageRefsEqual, reload, toPluginError, toPluginErrorInfo } from "@embedpdf/core";
|
|
5
5
|
import { ActionsToken, createHoverPump } from "@embedpdf/plugin-actions/contract";
|
|
@@ -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, reorderPart, reorderedList, resolveAnnotationPatch, resolveBinarySource, serializeError, sniffBinaryMetadata, standardFontForFace, toPageRef, viewportForPoint } from "@embedpdf/engine-core/runtime";
|
|
11
|
-
import { MIN_DRAG, anchorModeOf,
|
|
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, 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";
|
|
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";
|
|
@@ -119,9 +119,9 @@ function createComments(ctx, { store, authority, events }, threads, crud) {
|
|
|
119
119
|
const record = store.model().byId[annotationKey$1(ref)];
|
|
120
120
|
return !!record && !isDimension(record.annotation) && annotContentsEditable(record);
|
|
121
121
|
};
|
|
122
|
-
const announce = (root,
|
|
122
|
+
const announce = (root, type) => events.threadChanged.emit({
|
|
123
123
|
rootRef: root,
|
|
124
|
-
|
|
124
|
+
type
|
|
125
125
|
});
|
|
126
126
|
return { api: { comments: {
|
|
127
127
|
listThreads: () => threads.index().threads,
|
|
@@ -362,12 +362,12 @@ function createPlaceHandler(anno, interaction) {
|
|
|
362
362
|
id: "annotation-place",
|
|
363
363
|
priority: 95,
|
|
364
364
|
enabledFor: (tool) => tool.enables.has("annotation-place") || tool.enables.has("annotation-stamp"),
|
|
365
|
-
|
|
365
|
+
onPointerDown: (sample) => {
|
|
366
366
|
if (!sample.page) return false;
|
|
367
367
|
return anno.placeAt(sample.page.ref, sample.page.point, sample.page.rotation, sample.page.zoom);
|
|
368
368
|
},
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
onPointerUp: () => anno.clearGhost(),
|
|
370
|
+
onPointerCancel: () => anno.clearGhost(),
|
|
371
371
|
onHover: (sample) => followGhost(anno, interaction, sample)
|
|
372
372
|
};
|
|
373
373
|
}
|
|
@@ -385,9 +385,9 @@ function createEditHandler(anno, interaction) {
|
|
|
385
385
|
priority: 100,
|
|
386
386
|
enabledFor: (tool) => tool.enables.has("annotation-edit"),
|
|
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.getDistanceCreationPage?.() != null) return false;
|
|
391
391
|
const touch = sample.pointerType === "touch";
|
|
392
392
|
const wasEditing = anno.getEditingId() != null;
|
|
393
393
|
if (wasEditing) anno.text.end();
|
|
@@ -407,19 +407,19 @@ function createEditHandler(anno, interaction) {
|
|
|
407
407
|
};
|
|
408
408
|
return true;
|
|
409
409
|
},
|
|
410
|
-
|
|
410
|
+
onPointerMove: (sample) => {
|
|
411
411
|
if (!origin) return;
|
|
412
412
|
const point = pointOn(sample, origin.page);
|
|
413
413
|
if (!point) return;
|
|
414
414
|
origin.point = point;
|
|
415
415
|
anno.editPointer("move", origin.page, point, sample.modifiers.shift, sample.page?.scale, sample.page?.rotation, sample.page?.zoom, origin.touch);
|
|
416
416
|
},
|
|
417
|
-
|
|
417
|
+
onPointerUp: (sample) => {
|
|
418
418
|
if (!origin) return;
|
|
419
419
|
anno.editPointer("up", origin.page, pointOn(sample, origin.page) ?? origin.point, false, void 0, void 0, void 0, origin.touch);
|
|
420
420
|
origin = null;
|
|
421
421
|
},
|
|
422
|
-
|
|
422
|
+
onPointerCancel: () => {
|
|
423
423
|
if (!origin) return;
|
|
424
424
|
const { page, downPoint, touch } = origin;
|
|
425
425
|
origin = null;
|
|
@@ -451,7 +451,7 @@ function createMarqueeHandler(anno) {
|
|
|
451
451
|
id: "annotation-marquee",
|
|
452
452
|
priority: 50,
|
|
453
453
|
enabledFor: (tool) => tool.enables.has("annotation-marquee"),
|
|
454
|
-
|
|
454
|
+
onPointerDown: (sample) => {
|
|
455
455
|
if (!sample.page) return false;
|
|
456
456
|
anchor = {
|
|
457
457
|
page: sample.page.ref,
|
|
@@ -472,7 +472,7 @@ function createMarqueeHandler(anno) {
|
|
|
472
472
|
dragging = false;
|
|
473
473
|
return true;
|
|
474
474
|
},
|
|
475
|
-
|
|
475
|
+
onPointerMove: (sample) => {
|
|
476
476
|
if (!anchor) return;
|
|
477
477
|
const point = pointOn(sample, anchor.page);
|
|
478
478
|
if (!point) return;
|
|
@@ -487,13 +487,13 @@ function createMarqueeHandler(anno) {
|
|
|
487
487
|
}
|
|
488
488
|
anno.marqueePointer("move", anchor.page, point, anchor.shift, view.scale, view.rotation, view.zoom);
|
|
489
489
|
},
|
|
490
|
-
|
|
490
|
+
onPointerUp: () => {
|
|
491
491
|
if (dragging && anchor && last) anno.marqueePointer("up", anchor.page, last.point, anchor.shift, view.scale, view.rotation, view.zoom);
|
|
492
492
|
anchor = null;
|
|
493
493
|
last = null;
|
|
494
494
|
dragging = false;
|
|
495
495
|
},
|
|
496
|
-
|
|
496
|
+
onPointerCancel: () => {
|
|
497
497
|
anchor = null;
|
|
498
498
|
last = null;
|
|
499
499
|
dragging = false;
|
|
@@ -532,10 +532,10 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
532
532
|
id: "annotation-draw",
|
|
533
533
|
priority: 55,
|
|
534
534
|
enabledFor: (tool) => tool.enables.has("annotation-draw"),
|
|
535
|
-
|
|
535
|
+
onPointerDown: (sample) => {
|
|
536
536
|
const tool = toolId();
|
|
537
537
|
const st = subtypeOf(tool);
|
|
538
|
-
const distancePage = anno.
|
|
538
|
+
const distancePage = anno.getDistanceCreationPage?.();
|
|
539
539
|
if (distancePage != null) {
|
|
540
540
|
const point = pointOn(sample, distancePage);
|
|
541
541
|
if (point) anno.createPointer(tool, "down", distancePage, point);
|
|
@@ -566,7 +566,7 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
566
566
|
anno.createPointer(tool, "down", sample.page.ref, sample.page.point, false, sample.page.rotation);
|
|
567
567
|
return true;
|
|
568
568
|
},
|
|
569
|
-
|
|
569
|
+
onPointerMove: (sample) => {
|
|
570
570
|
const tool = toolId();
|
|
571
571
|
const st = subtypeOf(tool);
|
|
572
572
|
if (!origin || isPolyTool(st) && !drawingPoly) return;
|
|
@@ -575,7 +575,7 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
575
575
|
origin.point = point;
|
|
576
576
|
anno.createPointer(tool, "move", origin.page, point);
|
|
577
577
|
},
|
|
578
|
-
|
|
578
|
+
onPointerUp: (sample) => {
|
|
579
579
|
const tool = toolId();
|
|
580
580
|
const st = subtypeOf(tool);
|
|
581
581
|
if (origin && !isPolyTool(st)) {
|
|
@@ -595,7 +595,7 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
595
595
|
origin = null;
|
|
596
596
|
anno.clearGhost();
|
|
597
597
|
},
|
|
598
|
-
|
|
598
|
+
onPointerCancel: () => {
|
|
599
599
|
if (pendingInk) {
|
|
600
600
|
pendingInk.cancelWait();
|
|
601
601
|
pendingInk = null;
|
|
@@ -611,7 +611,7 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
611
611
|
followGhost(anno, interaction, sample);
|
|
612
612
|
const tool = toolId();
|
|
613
613
|
const st = subtypeOf(tool);
|
|
614
|
-
const distancePage = anno.
|
|
614
|
+
const distancePage = anno.getDistanceCreationPage?.();
|
|
615
615
|
if (distancePage != null) {
|
|
616
616
|
const point = pointOn(sample, distancePage);
|
|
617
617
|
if (point) anno.createPointer(tool, "move", distancePage, point);
|
|
@@ -1710,7 +1710,7 @@ function createRenderReads(ctx, { view: { pageModel }, lending, fonts: fontLooku
|
|
|
1710
1710
|
return {
|
|
1711
1711
|
engine,
|
|
1712
1712
|
placed: placed.sort().join("|"),
|
|
1713
|
-
lent: lentShown && lender ? `lent:${lender.
|
|
1713
|
+
lent: lentShown && lender ? `lent:${lender.getPictureEpoch(page)}` : ""
|
|
1714
1714
|
};
|
|
1715
1715
|
};
|
|
1716
1716
|
/** The lender's pictures of its records on `page`, in every state, at their picture versions. */
|
|
@@ -1735,7 +1735,7 @@ function createRenderReads(ctx, { view: { pageModel }, lending, fonts: fontLooku
|
|
|
1735
1735
|
/** The family whose pictures a record's are: the lender's widgets, or annotations. */
|
|
1736
1736
|
const familyOf = (id) => lending.owns(id) ? "widgets" : "annotations";
|
|
1737
1737
|
/** The engine's last pictures of a record, kept a while after it left its page. */
|
|
1738
|
-
const keptOf = (id, ref) => ctx.tryGet(RenderToken$1)?.
|
|
1738
|
+
const keptOf = (id, ref) => ctx.tryGet(RenderToken$1)?.getKeptAppearances(familyOf(id), ref) ?? [];
|
|
1739
1739
|
/**
|
|
1740
1740
|
* The pictures of what shows on `page` that the engine hasn't written yet:
|
|
1741
1741
|
* a stamp this session placed shows its preview, at the size the page shows
|
|
@@ -1936,16 +1936,16 @@ function createView(ctx, records, lending) {
|
|
|
1936
1936
|
...fromDTO(shown),
|
|
1937
1937
|
unconfirmed: true,
|
|
1938
1938
|
source: confirmedOnce.has(annotationKey$1(shown.ref)) ? "baked" : "vector",
|
|
1939
|
-
pictureVersion: lender.
|
|
1940
|
-
authority: lender.
|
|
1939
|
+
pictureVersion: lender.getPictureVersion(shown.ref),
|
|
1940
|
+
authority: lender.getAuthority(shown),
|
|
1941
1941
|
...painterOf(shown, lender)
|
|
1942
1942
|
};
|
|
1943
1943
|
else {
|
|
1944
1944
|
const base = {
|
|
1945
1945
|
...fromDTO(truth),
|
|
1946
1946
|
source: sourceOfConfirmed(truth, false),
|
|
1947
|
-
pictureVersion: lender.
|
|
1948
|
-
authority: lender.
|
|
1947
|
+
pictureVersion: lender.getPictureVersion(truth.ref),
|
|
1948
|
+
authority: lender.getAuthority(truth),
|
|
1949
1949
|
...painterOf(shown, lender)
|
|
1950
1950
|
};
|
|
1951
1951
|
const patch = {
|
|
@@ -1957,7 +1957,7 @@ function createView(ctx, records, lending) {
|
|
|
1957
1957
|
annotation: shown,
|
|
1958
1958
|
...drawnAfter(base, patch)
|
|
1959
1959
|
};
|
|
1960
|
-
if (lender.
|
|
1960
|
+
if (lender.isPending(shown.ref) && drawsLive(record)) record = {
|
|
1961
1961
|
...record,
|
|
1962
1962
|
source: "vector"
|
|
1963
1963
|
};
|
|
@@ -2631,7 +2631,7 @@ function createRecordsMirror(ctx, events) {
|
|
|
2631
2631
|
const list = await doc.annotations.list();
|
|
2632
2632
|
return {
|
|
2633
2633
|
value: fromSnapshot(records.get(), list.annotations),
|
|
2634
|
-
cursor: list.auditHead
|
|
2634
|
+
cursor: list.auditHead
|
|
2635
2635
|
};
|
|
2636
2636
|
},
|
|
2637
2637
|
fold: foldRecords,
|
|
@@ -2642,7 +2642,7 @@ function createRecordsMirror(ctx, events) {
|
|
|
2642
2642
|
const { annotations } = reading.length ? await doc.annotations.list({ pages: reading }) : { annotations: [] };
|
|
2643
2643
|
return (current) => withPages(current, pages, annotations);
|
|
2644
2644
|
},
|
|
2645
|
-
|
|
2645
|
+
onChanged: (change) => events.recordsChanged.emit(change)
|
|
2646
2646
|
});
|
|
2647
2647
|
return records;
|
|
2648
2648
|
}
|
|
@@ -3729,13 +3729,13 @@ const annotationOfTool = (model, tool) => ({
|
|
|
3729
3729
|
* size, hanging from its rect's upper-left corner. So the placement starts
|
|
3730
3730
|
* from how it shows, the icon centred on the pointer and kept on the page
|
|
3731
3731
|
* (`shown`, what the ghost draws), and stores the rect whose own display is
|
|
3732
|
-
* exactly that (`rect`, through `
|
|
3732
|
+
* exactly that (`rect`, through `unanchoredGeometry`, the inverse gestures use).
|
|
3733
3733
|
* `annotation` is what the tool creates, read for its flags. Without a view
|
|
3734
3734
|
* the two are the same box.
|
|
3735
3735
|
*/
|
|
3736
3736
|
function iconPlaceAt(annotation, point, page, view) {
|
|
3737
3737
|
const mode = anchorModeOf({ annotation });
|
|
3738
|
-
const { box: size, rotation } =
|
|
3738
|
+
const { box: size, rotation } = anchoredGeometry({
|
|
3739
3739
|
kind: "box",
|
|
3740
3740
|
box: {
|
|
3741
3741
|
x: 0,
|
|
@@ -3756,7 +3756,7 @@ function iconPlaceAt(annotation, point, page, view) {
|
|
|
3756
3756
|
};
|
|
3757
3757
|
return {
|
|
3758
3758
|
shown,
|
|
3759
|
-
rect:
|
|
3759
|
+
rect: unanchoredGeometry(shown, mode, view).box
|
|
3760
3760
|
};
|
|
3761
3761
|
}
|
|
3762
3762
|
/**
|
|
@@ -4145,7 +4145,7 @@ function createDrafts(ctx, { store, events, tools, afterCreate }, annotations) {
|
|
|
4145
4145
|
cancel: () => {
|
|
4146
4146
|
store.commit({ type: "cancel" });
|
|
4147
4147
|
},
|
|
4148
|
-
|
|
4148
|
+
getDistanceCreationPage: () => {
|
|
4149
4149
|
const draft = store.model().draft;
|
|
4150
4150
|
return draft?.kind === "create-distance" && draft.step === "offset" ? draft.page : null;
|
|
4151
4151
|
},
|
|
@@ -4920,7 +4920,7 @@ function createSelectionWrites(ctx, { store, authority, fonts, behaviors, lendin
|
|
|
4920
4920
|
};
|
|
4921
4921
|
/** The `selection` noun (its reads come from the property and chrome reads). */
|
|
4922
4922
|
const selection = {
|
|
4923
|
-
|
|
4923
|
+
select: (refs) => refs.length ? select(refs, false) : void store.commit({ type: "deselect" }),
|
|
4924
4924
|
add: (refs) => select(refs, true),
|
|
4925
4925
|
selectAll: (page) => {
|
|
4926
4926
|
const only = page === void 0 ? null : ctx.getPage(page);
|
|
@@ -4949,7 +4949,7 @@ function createSelectionWrites(ctx, { store, authority, fonts, behaviors, lendin
|
|
|
4949
4949
|
clear: () => {
|
|
4950
4950
|
store.commit({ type: "deselect" });
|
|
4951
4951
|
},
|
|
4952
|
-
|
|
4952
|
+
getSelected: () => annotations.listSelected(),
|
|
4953
4953
|
update: (changes, options = {}) => commitOverSelection(() => restyle(changes), options.signal),
|
|
4954
4954
|
updateLink: (target, options = {}) => commitOverSelection(() => [store.commit({
|
|
4955
4955
|
type: "setLink",
|
|
@@ -5459,9 +5459,9 @@ function createAnnotationController(ctx) {
|
|
|
5459
5459
|
const { events, records, view, authority, tools, behaviors, settings } = services;
|
|
5460
5460
|
ctx.state.update(withSnap, settings.get().snap);
|
|
5461
5461
|
ctx.state.update(withEditable, settings.get().editable);
|
|
5462
|
-
settings.api.onSettingsChanged(({ settings: next,
|
|
5463
|
-
if (
|
|
5464
|
-
if (
|
|
5462
|
+
settings.api.onSettingsChanged(({ settings: next, changedKeys }) => {
|
|
5463
|
+
if (changedKeys.includes("snap")) ctx.state.update(withSnap, next.snap);
|
|
5464
|
+
if (changedKeys.includes("editable")) ctx.state.update(withEditable, next.editable);
|
|
5465
5465
|
});
|
|
5466
5466
|
const annotations = createAnnotationReads(ctx, services);
|
|
5467
5467
|
const chrome = createChromeReads(ctx, services);
|
|
@@ -5472,8 +5472,8 @@ function createAnnotationController(ctx) {
|
|
|
5472
5472
|
await text.sendTyping();
|
|
5473
5473
|
await services.store.whenWritten();
|
|
5474
5474
|
};
|
|
5475
|
-
settings.api.onSettingsChanged(({
|
|
5476
|
-
if (!
|
|
5475
|
+
settings.api.onSettingsChanged(({ changedKeys }) => {
|
|
5476
|
+
if (!changedKeys.includes("editable")) return;
|
|
5477
5477
|
const model = services.store.model();
|
|
5478
5478
|
const editing = model.editing === null ? void 0 : model.byId[model.editing];
|
|
5479
5479
|
if (editing && !isContentsEditableByHand(model, editing)) text.text.end();
|
|
@@ -5580,7 +5580,8 @@ const annotationPlugin = (config) => definePlugin({
|
|
|
5580
5580
|
state: initialAnnotationModel,
|
|
5581
5581
|
settings: {
|
|
5582
5582
|
defaults: ANNOTATION_DEFAULTS,
|
|
5583
|
-
registered: config
|
|
5583
|
+
registered: config,
|
|
5584
|
+
whole: ["chrome.marquee"]
|
|
5584
5585
|
},
|
|
5585
5586
|
create: createAnnotationController
|
|
5586
5587
|
});
|