@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
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Et as TextItem, G as ArmedStampInfo, K as ArmedStampPreview, Kt as EditorSelection, N as AnnotationSelectionAnchor, Vt as ResolvedTool, Y as Behavior, ft as ImageGhost, gt as LinkNavItem, i as AnnotationAnchor, o as AnnotationCapability, r as Annotation$1 } from "./contract-
|
|
1
|
+
import { Et as TextItem, G as ArmedStampInfo, K as ArmedStampPreview, Kt as EditorSelection, N as AnnotationSelectionAnchor, Vt as ResolvedTool, Y as Behavior, ft as ImageGhost, gt as LinkNavItem, i as AnnotationAnchor, o as AnnotationCapability, r as Annotation$1 } from "./contract-CBYEqnev.cjs";
|
|
2
2
|
import { ChromeNode, EditableKinds, Effect, Id, KindName, Model, Point, Quad, Rect, RenderItem, SceneNode, Session, SnapSettings, TextEndAnchor, ViewEnv } from "@embedpdf/core-annotation";
|
|
3
3
|
import { EventHook, PredictedOp, Unsubscribe } from "@embedpdf/core";
|
|
4
|
-
import {
|
|
4
|
+
import { Rotation } from "@embedpdf/core-geometry";
|
|
5
5
|
import { AnnotationAppearanceImage, AnnotationPosition, AnnotationRef, ChangeOp, ImageSource, PageMeasurementViewport, PageRef, PdfMeasure, RichTextParagraph, SerializedEngineError } from "@embedpdf/engine-core/runtime";
|
|
6
|
-
import {
|
|
6
|
+
import { AnnotationCommitEntry, AnnotationCommitResult } from "@embedpdf/plugin-actions/contract/host";
|
|
7
7
|
import { AppearancePicture } from "@embedpdf/plugin-render/contract/host";
|
|
8
8
|
//#region src/model.d.ts
|
|
9
9
|
/** Where the active tool's ghost is: the pointer on a page, and how that page shows there. */
|
|
@@ -12,7 +12,7 @@ interface GhostPointer {
|
|
|
12
12
|
readonly page: PageRef;
|
|
13
13
|
readonly point: Point;
|
|
14
14
|
/** The page's display rotation at the pointer (an upright tool lays its click out as seen). */
|
|
15
|
-
readonly displayRotation?:
|
|
15
|
+
readonly displayRotation?: Rotation;
|
|
16
16
|
/** The page's zoom at the pointer (a screen-sized icon's size depends on it). */
|
|
17
17
|
readonly zoom?: number;
|
|
18
18
|
}
|
|
@@ -121,20 +121,20 @@ interface AnnotationLender {
|
|
|
121
121
|
/** The ops that move these records of one page to `position` in its drawing order. */
|
|
122
122
|
reorderOps(page: PageRef, refs: readonly AnnotationRef[], position: AnnotationPosition): readonly ChangeOp[];
|
|
123
123
|
/** Whether this session may change and delete the record. */
|
|
124
|
-
|
|
124
|
+
getAuthority(record: Annotation$1): {
|
|
125
125
|
readonly update: boolean;
|
|
126
126
|
readonly delete: boolean;
|
|
127
127
|
};
|
|
128
128
|
/** What its records' pictures on a page depend on: a new value means new pictures. */
|
|
129
|
-
|
|
129
|
+
getPictureEpoch(page: PageRef): string;
|
|
130
130
|
/** A record's confirmed picture version; kept for one that went, so an undo brings it back with it. */
|
|
131
|
-
|
|
131
|
+
getPictureVersion(record: AnnotationRef): number;
|
|
132
132
|
/**
|
|
133
133
|
* The record's look as it shows isn't its confirmed look yet, whatever changed it (a restyle,
|
|
134
134
|
* a resize, one just placed, a change the lender made itself): it draws live, by its
|
|
135
135
|
* {@link painter}, until the engine's picture of it is there.
|
|
136
136
|
*/
|
|
137
|
-
|
|
137
|
+
isPending(record: AnnotationRef): boolean;
|
|
138
138
|
/**
|
|
139
139
|
* How the lender draws the record live: the record upright in `box` (its box, or where a
|
|
140
140
|
* gesture has it), in page space; `null` for one it doesn't draw. A record with a painter
|
|
@@ -181,7 +181,7 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
181
181
|
remeasurePage(page: PageRef, scale: PdfMeasure): Promise<RecalibrationReport>;
|
|
182
182
|
/** A distance draft was captured (the measurement plugin turns it into a calibration). */
|
|
183
183
|
readonly onDraftCaptured: EventHook<CapturedAnnotationDraft>;
|
|
184
|
-
|
|
184
|
+
getDistanceCreationPage(): PageRef | null;
|
|
185
185
|
/**
|
|
186
186
|
* The selection's anchor as a page shows it: its rotation handle where the
|
|
187
187
|
* page's view puts it (screen-sized, so it depends on the zoom), for a menu
|
|
@@ -189,7 +189,7 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
189
189
|
*/
|
|
190
190
|
getSelectionAnchorIn(view: {
|
|
191
191
|
scale?: number;
|
|
192
|
-
rotation?:
|
|
192
|
+
rotation?: Rotation;
|
|
193
193
|
zoom?: number;
|
|
194
194
|
}): AnnotationSelectionAnchor | null;
|
|
195
195
|
/**
|
|
@@ -211,7 +211,7 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
211
211
|
* engine picture is drawn under. `null` for one that isn't a free text here.
|
|
212
212
|
*/
|
|
213
213
|
getTextItem(ref: AnnotationRef, view?: ViewEnv): TextItem | null;
|
|
214
|
-
listChromeNodes(page: PageRef, scale?: number, rotation?:
|
|
214
|
+
listChromeNodes(page: PageRef, scale?: number, rotation?: Rotation, zoom?: number): ChromeNode[];
|
|
215
215
|
listLinkItems(page: PageRef): LinkNavItem[];
|
|
216
216
|
/**
|
|
217
217
|
* What a page's pictures depend on: its baked records at their picture
|
|
@@ -232,7 +232,7 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
232
232
|
*/
|
|
233
233
|
whenSynced(): Promise<void>;
|
|
234
234
|
getEditingId(): Id | null;
|
|
235
|
-
beginTextEditAt(page: PageRef, point: Point, scale?: number, rotation?:
|
|
235
|
+
beginTextEditAt(page: PageRef, point: Point, scale?: number, rotation?: Rotation, zoom?: number): boolean;
|
|
236
236
|
draftContents(ref: AnnotationRef, text: string): void;
|
|
237
237
|
/** Returns the paragraphs it keeps: the text typed at the caret takes a style chosen there. */
|
|
238
238
|
draftRichText(ref: AnnotationRef, doc: {
|
|
@@ -256,24 +256,24 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
256
256
|
}, id: string | null): string;
|
|
257
257
|
/** The family a CSS family a text box was drawn with stands for, for text the browser drew itself. */
|
|
258
258
|
getFamilyOfCss(cssFamily: string): string | undefined;
|
|
259
|
-
getHitKind(page: PageRef, point: Point, scale?: number, rotation?:
|
|
260
|
-
claimsTouchAt(page: PageRef, point: Point, scale?: number, rotation?:
|
|
261
|
-
getCursorAt(page: PageRef, point: Point, scale?: number, rotation?:
|
|
259
|
+
getHitKind(page: PageRef, point: Point, scale?: number, rotation?: Rotation, zoom?: number, touch?: boolean): 'handle' | 'rotate' | 'group-handle' | 'annot' | 'empty';
|
|
260
|
+
claimsTouchAt(page: PageRef, point: Point, scale?: number, rotation?: Rotation, zoom?: number): boolean;
|
|
261
|
+
getCursorAt(page: PageRef, point: Point, scale?: number, rotation?: Rotation, zoom?: number): string | null;
|
|
262
262
|
hoverAt(at: {
|
|
263
263
|
page: PageRef;
|
|
264
264
|
point: Point;
|
|
265
265
|
scale?: number;
|
|
266
|
-
rotation?:
|
|
266
|
+
rotation?: Rotation;
|
|
267
267
|
zoom?: number;
|
|
268
268
|
} | null): void;
|
|
269
|
-
editPointer(phase: 'down' | 'move' | 'up', page: PageRef, point: Point, shift: boolean, scale?: number, rotation?:
|
|
270
|
-
marqueePointer(phase: 'down' | 'move' | 'up', page: PageRef, point: Point, shift: boolean, scale?: number, rotation?:
|
|
271
|
-
createPointer(tool: string, phase: 'down' | 'move' | 'up', page: PageRef, point: Point, finish?: boolean, displayRotation?:
|
|
269
|
+
editPointer(phase: 'down' | 'move' | 'up', page: PageRef, point: Point, shift: boolean, scale?: number, rotation?: Rotation, zoom?: number, touch?: boolean): void;
|
|
270
|
+
marqueePointer(phase: 'down' | 'move' | 'up', page: PageRef, point: Point, shift: boolean, scale?: number, rotation?: Rotation, zoom?: number): void;
|
|
271
|
+
createPointer(tool: string, phase: 'down' | 'move' | 'up', page: PageRef, point: Point, finish?: boolean, displayRotation?: Rotation): void;
|
|
272
272
|
finishInkDraft(): void;
|
|
273
273
|
/** Place with the active tool at a click; `displayRotation` and `zoom` are the page's view there. */
|
|
274
|
-
placeAt(page: PageRef, point: Point, displayRotation?:
|
|
275
|
-
placeArmedStamp(page: PageRef, point: Point, displayRotation?:
|
|
276
|
-
requestStampAt(page: PageRef, point: Point, displayRotation?:
|
|
274
|
+
placeAt(page: PageRef, point: Point, displayRotation?: Rotation, zoom?: number): boolean;
|
|
275
|
+
placeArmedStamp(page: PageRef, point: Point, displayRotation?: Rotation): boolean;
|
|
276
|
+
requestStampAt(page: PageRef, point: Point, displayRotation?: Rotation): boolean;
|
|
277
277
|
/**
|
|
278
278
|
* Turn the text selection into what the tool makes of it (markup, a caret,
|
|
279
279
|
* a replace-text pair) and clear the selection; `false`, and nothing, for a
|
|
@@ -292,7 +292,7 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
292
292
|
* would take the click calls it, only where the click would reach it and
|
|
293
293
|
* the user may create; a tool without a ghost clears it.
|
|
294
294
|
*/
|
|
295
|
-
hoverGhostAt(toolId: string, page: PageRef, point: Point, displayRotation?:
|
|
295
|
+
hoverGhostAt(toolId: string, page: PageRef, point: Point, displayRotation?: Rotation, zoom?: number): void;
|
|
296
296
|
clearGhost(): void;
|
|
297
297
|
/**
|
|
298
298
|
* A sibling plugin's placement gesture with one of this plugin's tools (the
|
|
@@ -321,7 +321,7 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
321
321
|
/** The engaged behavior that owns this annotation now, or `null`. */
|
|
322
322
|
getBehaviorFor(annotation: Annotation$1): Behavior | null;
|
|
323
323
|
pruneEngagedSelection(): void;
|
|
324
|
-
commitScriptEffects(entries:
|
|
324
|
+
commitScriptEffects(entries: AnnotationCommitEntry[]): Promise<AnnotationCommitResult>;
|
|
325
325
|
}
|
|
326
326
|
/**
|
|
327
327
|
* The annotation capability token, typed to the full
|
|
@@ -332,4 +332,4 @@ interface AnnotationHostCapability extends AnnotationCapability {
|
|
|
332
332
|
declare const AnnotationToken: import("@embedpdf/core").CapabilityToken<AnnotationHostCapability>;
|
|
333
333
|
//#endregion
|
|
334
334
|
export { CapturedAnnotationDraft as a, ANNOTATION_DRAW_PRIORITY as c, ANNOTATION_PLACE_PRIORITY as d, AnnotationModel as f, AnnotationToken as i, ANNOTATION_EDIT_PRIORITY as l, AnnotationHostCapability as n, RecalibrationReport as o, AnnotationLender as r, previewBucket as s, AnnotationAppearancePicture as t, ANNOTATION_MARQUEE_PRIORITY as u };
|
|
335
|
-
//# sourceMappingURL=host-contract-
|
|
335
|
+
//# sourceMappingURL=host-contract-CxOrR_pp.d.cts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_contract = require("./contract-
|
|
3
|
-
const require_host_contract = require("./host-contract-
|
|
2
|
+
const require_contract = require("./contract-BtAl3Yo2.cjs");
|
|
3
|
+
const require_host_contract = require("./host-contract-BzM2upsA.cjs");
|
|
4
4
|
require("./authoring.cjs");
|
|
5
5
|
let _embedpdf_core = require("@embedpdf/core");
|
|
6
6
|
let _embedpdf_plugin_actions_contract = require("@embedpdf/plugin-actions/contract");
|
|
@@ -121,9 +121,9 @@ function createComments(ctx, { store, authority, events }, threads, crud) {
|
|
|
121
121
|
const record = store.model().byId[(0, _embedpdf_engine_core_runtime.annotationKey)(ref)];
|
|
122
122
|
return !!record && !(0, _embedpdf_engine_core_runtime.isDimension)(record.annotation) && (0, _embedpdf_core_annotation.annotContentsEditable)(record);
|
|
123
123
|
};
|
|
124
|
-
const announce = (root,
|
|
124
|
+
const announce = (root, type) => events.threadChanged.emit({
|
|
125
125
|
rootRef: root,
|
|
126
|
-
|
|
126
|
+
type
|
|
127
127
|
});
|
|
128
128
|
return { api: { comments: {
|
|
129
129
|
listThreads: () => threads.index().threads,
|
|
@@ -364,12 +364,12 @@ function createPlaceHandler(anno, interaction) {
|
|
|
364
364
|
id: "annotation-place",
|
|
365
365
|
priority: 95,
|
|
366
366
|
enabledFor: (tool) => tool.enables.has("annotation-place") || tool.enables.has("annotation-stamp"),
|
|
367
|
-
|
|
367
|
+
onPointerDown: (sample) => {
|
|
368
368
|
if (!sample.page) return false;
|
|
369
369
|
return anno.placeAt(sample.page.ref, sample.page.point, sample.page.rotation, sample.page.zoom);
|
|
370
370
|
},
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
onPointerUp: () => anno.clearGhost(),
|
|
372
|
+
onPointerCancel: () => anno.clearGhost(),
|
|
373
373
|
onHover: (sample) => followGhost(anno, interaction, sample)
|
|
374
374
|
};
|
|
375
375
|
}
|
|
@@ -387,9 +387,9 @@ function createEditHandler(anno, interaction) {
|
|
|
387
387
|
priority: 100,
|
|
388
388
|
enabledFor: (tool) => tool.enables.has("annotation-edit"),
|
|
389
389
|
claimsTouch: (sample) => !!sample.page && anno.claimsTouchAt(sample.page.ref, sample.page.point, sample.page.scale, sample.page.rotation, sample.page.zoom),
|
|
390
|
-
|
|
390
|
+
onPointerDown: (sample) => {
|
|
391
391
|
if (!sample.page) return false;
|
|
392
|
-
if (anno.
|
|
392
|
+
if (anno.getDistanceCreationPage?.() != null) return false;
|
|
393
393
|
const touch = sample.pointerType === "touch";
|
|
394
394
|
const wasEditing = anno.getEditingId() != null;
|
|
395
395
|
if (wasEditing) anno.text.end();
|
|
@@ -409,19 +409,19 @@ function createEditHandler(anno, interaction) {
|
|
|
409
409
|
};
|
|
410
410
|
return true;
|
|
411
411
|
},
|
|
412
|
-
|
|
412
|
+
onPointerMove: (sample) => {
|
|
413
413
|
if (!origin) return;
|
|
414
414
|
const point = pointOn(sample, origin.page);
|
|
415
415
|
if (!point) return;
|
|
416
416
|
origin.point = point;
|
|
417
417
|
anno.editPointer("move", origin.page, point, sample.modifiers.shift, sample.page?.scale, sample.page?.rotation, sample.page?.zoom, origin.touch);
|
|
418
418
|
},
|
|
419
|
-
|
|
419
|
+
onPointerUp: (sample) => {
|
|
420
420
|
if (!origin) return;
|
|
421
421
|
anno.editPointer("up", origin.page, pointOn(sample, origin.page) ?? origin.point, false, void 0, void 0, void 0, origin.touch);
|
|
422
422
|
origin = null;
|
|
423
423
|
},
|
|
424
|
-
|
|
424
|
+
onPointerCancel: () => {
|
|
425
425
|
if (!origin) return;
|
|
426
426
|
const { page, downPoint, touch } = origin;
|
|
427
427
|
origin = null;
|
|
@@ -453,7 +453,7 @@ function createMarqueeHandler(anno) {
|
|
|
453
453
|
id: "annotation-marquee",
|
|
454
454
|
priority: 50,
|
|
455
455
|
enabledFor: (tool) => tool.enables.has("annotation-marquee"),
|
|
456
|
-
|
|
456
|
+
onPointerDown: (sample) => {
|
|
457
457
|
if (!sample.page) return false;
|
|
458
458
|
anchor = {
|
|
459
459
|
page: sample.page.ref,
|
|
@@ -474,7 +474,7 @@ function createMarqueeHandler(anno) {
|
|
|
474
474
|
dragging = false;
|
|
475
475
|
return true;
|
|
476
476
|
},
|
|
477
|
-
|
|
477
|
+
onPointerMove: (sample) => {
|
|
478
478
|
if (!anchor) return;
|
|
479
479
|
const point = pointOn(sample, anchor.page);
|
|
480
480
|
if (!point) return;
|
|
@@ -489,13 +489,13 @@ function createMarqueeHandler(anno) {
|
|
|
489
489
|
}
|
|
490
490
|
anno.marqueePointer("move", anchor.page, point, anchor.shift, view.scale, view.rotation, view.zoom);
|
|
491
491
|
},
|
|
492
|
-
|
|
492
|
+
onPointerUp: () => {
|
|
493
493
|
if (dragging && anchor && last) anno.marqueePointer("up", anchor.page, last.point, anchor.shift, view.scale, view.rotation, view.zoom);
|
|
494
494
|
anchor = null;
|
|
495
495
|
last = null;
|
|
496
496
|
dragging = false;
|
|
497
497
|
},
|
|
498
|
-
|
|
498
|
+
onPointerCancel: () => {
|
|
499
499
|
anchor = null;
|
|
500
500
|
last = null;
|
|
501
501
|
dragging = false;
|
|
@@ -534,10 +534,10 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
534
534
|
id: "annotation-draw",
|
|
535
535
|
priority: 55,
|
|
536
536
|
enabledFor: (tool) => tool.enables.has("annotation-draw"),
|
|
537
|
-
|
|
537
|
+
onPointerDown: (sample) => {
|
|
538
538
|
const tool = toolId();
|
|
539
539
|
const st = subtypeOf(tool);
|
|
540
|
-
const distancePage = anno.
|
|
540
|
+
const distancePage = anno.getDistanceCreationPage?.();
|
|
541
541
|
if (distancePage != null) {
|
|
542
542
|
const point = pointOn(sample, distancePage);
|
|
543
543
|
if (point) anno.createPointer(tool, "down", distancePage, point);
|
|
@@ -568,7 +568,7 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
568
568
|
anno.createPointer(tool, "down", sample.page.ref, sample.page.point, false, sample.page.rotation);
|
|
569
569
|
return true;
|
|
570
570
|
},
|
|
571
|
-
|
|
571
|
+
onPointerMove: (sample) => {
|
|
572
572
|
const tool = toolId();
|
|
573
573
|
const st = subtypeOf(tool);
|
|
574
574
|
if (!origin || isPolyTool(st) && !drawingPoly) return;
|
|
@@ -577,7 +577,7 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
577
577
|
origin.point = point;
|
|
578
578
|
anno.createPointer(tool, "move", origin.page, point);
|
|
579
579
|
},
|
|
580
|
-
|
|
580
|
+
onPointerUp: (sample) => {
|
|
581
581
|
const tool = toolId();
|
|
582
582
|
const st = subtypeOf(tool);
|
|
583
583
|
if (origin && !isPolyTool(st)) {
|
|
@@ -597,7 +597,7 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
597
597
|
origin = null;
|
|
598
598
|
anno.clearGhost();
|
|
599
599
|
},
|
|
600
|
-
|
|
600
|
+
onPointerCancel: () => {
|
|
601
601
|
if (pendingInk) {
|
|
602
602
|
pendingInk.cancelWait();
|
|
603
603
|
pendingInk = null;
|
|
@@ -613,7 +613,7 @@ function createDrawHandler(anno, interaction, clock, onSettle) {
|
|
|
613
613
|
followGhost(anno, interaction, sample);
|
|
614
614
|
const tool = toolId();
|
|
615
615
|
const st = subtypeOf(tool);
|
|
616
|
-
const distancePage = anno.
|
|
616
|
+
const distancePage = anno.getDistanceCreationPage?.();
|
|
617
617
|
if (distancePage != null) {
|
|
618
618
|
const point = pointOn(sample, distancePage);
|
|
619
619
|
if (point) anno.createPointer(tool, "move", distancePage, point);
|
|
@@ -1712,7 +1712,7 @@ function createRenderReads(ctx, { view: { pageModel }, lending, fonts: fontLooku
|
|
|
1712
1712
|
return {
|
|
1713
1713
|
engine,
|
|
1714
1714
|
placed: placed.sort().join("|"),
|
|
1715
|
-
lent: lentShown && lender ? `lent:${lender.
|
|
1715
|
+
lent: lentShown && lender ? `lent:${lender.getPictureEpoch(page)}` : ""
|
|
1716
1716
|
};
|
|
1717
1717
|
};
|
|
1718
1718
|
/** The lender's pictures of its records on `page`, in every state, at their picture versions. */
|
|
@@ -1737,7 +1737,7 @@ function createRenderReads(ctx, { view: { pageModel }, lending, fonts: fontLooku
|
|
|
1737
1737
|
/** The family whose pictures a record's are: the lender's widgets, or annotations. */
|
|
1738
1738
|
const familyOf = (id) => lending.owns(id) ? "widgets" : "annotations";
|
|
1739
1739
|
/** The engine's last pictures of a record, kept a while after it left its page. */
|
|
1740
|
-
const keptOf = (id, ref) => ctx.tryGet(_embedpdf_plugin_render_contract_host.RenderToken)?.
|
|
1740
|
+
const keptOf = (id, ref) => ctx.tryGet(_embedpdf_plugin_render_contract_host.RenderToken)?.getKeptAppearances(familyOf(id), ref) ?? [];
|
|
1741
1741
|
/**
|
|
1742
1742
|
* The pictures of what shows on `page` that the engine hasn't written yet:
|
|
1743
1743
|
* a stamp this session placed shows its preview, at the size the page shows
|
|
@@ -1938,16 +1938,16 @@ function createView(ctx, records, lending) {
|
|
|
1938
1938
|
...(0, _embedpdf_core_annotation.fromDTO)(shown),
|
|
1939
1939
|
unconfirmed: true,
|
|
1940
1940
|
source: confirmedOnce.has((0, _embedpdf_engine_core_runtime.annotationKey)(shown.ref)) ? "baked" : "vector",
|
|
1941
|
-
pictureVersion: lender.
|
|
1942
|
-
authority: lender.
|
|
1941
|
+
pictureVersion: lender.getPictureVersion(shown.ref),
|
|
1942
|
+
authority: lender.getAuthority(shown),
|
|
1943
1943
|
...painterOf(shown, lender)
|
|
1944
1944
|
};
|
|
1945
1945
|
else {
|
|
1946
1946
|
const base = {
|
|
1947
1947
|
...(0, _embedpdf_core_annotation.fromDTO)(truth),
|
|
1948
1948
|
source: (0, _embedpdf_core_annotation.sourceOfConfirmed)(truth, false),
|
|
1949
|
-
pictureVersion: lender.
|
|
1950
|
-
authority: lender.
|
|
1949
|
+
pictureVersion: lender.getPictureVersion(truth.ref),
|
|
1950
|
+
authority: lender.getAuthority(truth),
|
|
1951
1951
|
...painterOf(shown, lender)
|
|
1952
1952
|
};
|
|
1953
1953
|
const patch = {
|
|
@@ -1959,7 +1959,7 @@ function createView(ctx, records, lending) {
|
|
|
1959
1959
|
annotation: shown,
|
|
1960
1960
|
...(0, _embedpdf_core_annotation.drawnAfter)(base, patch)
|
|
1961
1961
|
};
|
|
1962
|
-
if (lender.
|
|
1962
|
+
if (lender.isPending(shown.ref) && (0, _embedpdf_core_annotation.drawsLive)(record)) record = {
|
|
1963
1963
|
...record,
|
|
1964
1964
|
source: "vector"
|
|
1965
1965
|
};
|
|
@@ -2633,7 +2633,7 @@ function createRecordsMirror(ctx, events) {
|
|
|
2633
2633
|
const list = await doc.annotations.list();
|
|
2634
2634
|
return {
|
|
2635
2635
|
value: fromSnapshot(records.get(), list.annotations),
|
|
2636
|
-
cursor: list.auditHead
|
|
2636
|
+
cursor: list.auditHead
|
|
2637
2637
|
};
|
|
2638
2638
|
},
|
|
2639
2639
|
fold: foldRecords,
|
|
@@ -2644,7 +2644,7 @@ function createRecordsMirror(ctx, events) {
|
|
|
2644
2644
|
const { annotations } = reading.length ? await doc.annotations.list({ pages: reading }) : { annotations: [] };
|
|
2645
2645
|
return (current) => withPages(current, pages, annotations);
|
|
2646
2646
|
},
|
|
2647
|
-
|
|
2647
|
+
onChanged: (change) => events.recordsChanged.emit(change)
|
|
2648
2648
|
});
|
|
2649
2649
|
return records;
|
|
2650
2650
|
}
|
|
@@ -3731,13 +3731,13 @@ const annotationOfTool = (model, tool) => ({
|
|
|
3731
3731
|
* size, hanging from its rect's upper-left corner. So the placement starts
|
|
3732
3732
|
* from how it shows, the icon centred on the pointer and kept on the page
|
|
3733
3733
|
* (`shown`, what the ghost draws), and stores the rect whose own display is
|
|
3734
|
-
* exactly that (`rect`, through `
|
|
3734
|
+
* exactly that (`rect`, through `unanchoredGeometry`, the inverse gestures use).
|
|
3735
3735
|
* `annotation` is what the tool creates, read for its flags. Without a view
|
|
3736
3736
|
* the two are the same box.
|
|
3737
3737
|
*/
|
|
3738
3738
|
function iconPlaceAt(annotation, point, page, view) {
|
|
3739
3739
|
const mode = (0, _embedpdf_core_annotation.anchorModeOf)({ annotation });
|
|
3740
|
-
const { box: size, rotation } = (0, _embedpdf_core_annotation.
|
|
3740
|
+
const { box: size, rotation } = (0, _embedpdf_core_annotation.anchoredGeometry)({
|
|
3741
3741
|
kind: "box",
|
|
3742
3742
|
box: {
|
|
3743
3743
|
x: 0,
|
|
@@ -3758,7 +3758,7 @@ function iconPlaceAt(annotation, point, page, view) {
|
|
|
3758
3758
|
};
|
|
3759
3759
|
return {
|
|
3760
3760
|
shown,
|
|
3761
|
-
rect: (0, _embedpdf_core_annotation.
|
|
3761
|
+
rect: (0, _embedpdf_core_annotation.unanchoredGeometry)(shown, mode, view).box
|
|
3762
3762
|
};
|
|
3763
3763
|
}
|
|
3764
3764
|
/**
|
|
@@ -4147,7 +4147,7 @@ function createDrafts(ctx, { store, events, tools, afterCreate }, annotations) {
|
|
|
4147
4147
|
cancel: () => {
|
|
4148
4148
|
store.commit({ type: "cancel" });
|
|
4149
4149
|
},
|
|
4150
|
-
|
|
4150
|
+
getDistanceCreationPage: () => {
|
|
4151
4151
|
const draft = store.model().draft;
|
|
4152
4152
|
return draft?.kind === "create-distance" && draft.step === "offset" ? draft.page : null;
|
|
4153
4153
|
},
|
|
@@ -4922,7 +4922,7 @@ function createSelectionWrites(ctx, { store, authority, fonts, behaviors, lendin
|
|
|
4922
4922
|
};
|
|
4923
4923
|
/** The `selection` noun (its reads come from the property and chrome reads). */
|
|
4924
4924
|
const selection = {
|
|
4925
|
-
|
|
4925
|
+
select: (refs) => refs.length ? select(refs, false) : void store.commit({ type: "deselect" }),
|
|
4926
4926
|
add: (refs) => select(refs, true),
|
|
4927
4927
|
selectAll: (page) => {
|
|
4928
4928
|
const only = page === void 0 ? null : ctx.getPage(page);
|
|
@@ -4951,7 +4951,7 @@ function createSelectionWrites(ctx, { store, authority, fonts, behaviors, lendin
|
|
|
4951
4951
|
clear: () => {
|
|
4952
4952
|
store.commit({ type: "deselect" });
|
|
4953
4953
|
},
|
|
4954
|
-
|
|
4954
|
+
getSelected: () => annotations.listSelected(),
|
|
4955
4955
|
update: (changes, options = {}) => commitOverSelection(() => restyle(changes), options.signal),
|
|
4956
4956
|
updateLink: (target, options = {}) => commitOverSelection(() => [store.commit({
|
|
4957
4957
|
type: "setLink",
|
|
@@ -5461,9 +5461,9 @@ function createAnnotationController(ctx) {
|
|
|
5461
5461
|
const { events, records, view, authority, tools, behaviors, settings } = services;
|
|
5462
5462
|
ctx.state.update(withSnap, settings.get().snap);
|
|
5463
5463
|
ctx.state.update(withEditable, settings.get().editable);
|
|
5464
|
-
settings.api.onSettingsChanged(({ settings: next,
|
|
5465
|
-
if (
|
|
5466
|
-
if (
|
|
5464
|
+
settings.api.onSettingsChanged(({ settings: next, changedKeys }) => {
|
|
5465
|
+
if (changedKeys.includes("snap")) ctx.state.update(withSnap, next.snap);
|
|
5466
|
+
if (changedKeys.includes("editable")) ctx.state.update(withEditable, next.editable);
|
|
5467
5467
|
});
|
|
5468
5468
|
const annotations = createAnnotationReads(ctx, services);
|
|
5469
5469
|
const chrome = createChromeReads(ctx, services);
|
|
@@ -5474,8 +5474,8 @@ function createAnnotationController(ctx) {
|
|
|
5474
5474
|
await text.sendTyping();
|
|
5475
5475
|
await services.store.whenWritten();
|
|
5476
5476
|
};
|
|
5477
|
-
settings.api.onSettingsChanged(({
|
|
5478
|
-
if (!
|
|
5477
|
+
settings.api.onSettingsChanged(({ changedKeys }) => {
|
|
5478
|
+
if (!changedKeys.includes("editable")) return;
|
|
5479
5479
|
const model = services.store.model();
|
|
5480
5480
|
const editing = model.editing === null ? void 0 : model.byId[model.editing];
|
|
5481
5481
|
if (editing && !(0, _embedpdf_core_annotation.isContentsEditableByHand)(model, editing)) text.text.end();
|
|
@@ -5582,7 +5582,8 @@ const annotationPlugin = (config) => (0, _embedpdf_core.definePlugin)({
|
|
|
5582
5582
|
state: initialAnnotationModel,
|
|
5583
5583
|
settings: {
|
|
5584
5584
|
defaults: require_contract.ANNOTATION_DEFAULTS,
|
|
5585
|
-
registered: config
|
|
5585
|
+
registered: config,
|
|
5586
|
+
whole: ["chrome.marquee"]
|
|
5586
5587
|
},
|
|
5587
5588
|
create: createAnnotationController
|
|
5588
5589
|
});
|