@embedpdf/plugin-annotation 3.0.0-next.13 → 3.0.0-next.15

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.
Files changed (61) hide show
  1. package/README.md +129 -0
  2. package/dist/authoring.cjs +12 -2
  3. package/dist/authoring.d.cts +2 -2
  4. package/dist/authoring.d.ts +2 -2
  5. package/dist/authoring.js +2 -3
  6. package/dist/contract/host.cjs +18 -2
  7. package/dist/contract/host.d.cts +3 -2
  8. package/dist/contract/host.d.ts +3 -2
  9. package/dist/contract/host.js +3 -2
  10. package/dist/contract-BK4LHe9v.d.cts +1127 -0
  11. package/dist/contract-BOo9iZKo.d.ts +1127 -0
  12. package/dist/contract-CPzpRG3h.cjs +692 -0
  13. package/dist/contract-CPzpRG3h.cjs.map +1 -0
  14. package/dist/contract-b2e_LZvu.js +651 -0
  15. package/dist/contract-b2e_LZvu.js.map +1 -0
  16. package/dist/contract.cjs +11 -10
  17. package/dist/contract.d.cts +2 -3
  18. package/dist/contract.d.ts +2 -3
  19. package/dist/contract.js +2 -4
  20. package/dist/host-contract-BbjhS_Fo.d.ts +310 -0
  21. package/dist/host-contract-CxrQPcPj.js +52 -0
  22. package/dist/host-contract-CxrQPcPj.js.map +1 -0
  23. package/dist/{contract-a4eaQWga.cjs → host-contract-DY9jFPPF.cjs} +36 -16
  24. package/dist/host-contract-DY9jFPPF.cjs.map +1 -0
  25. package/dist/host-contract-Nzxwh0XS.d.cts +310 -0
  26. package/dist/index.cjs +4995 -414
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +12 -17
  29. package/dist/index.d.ts +12 -17
  30. package/dist/index.js +4949 -388
  31. package/dist/index.js.map +1 -1
  32. package/package.json +11 -14
  33. package/dist/authoring-BhtyfsMx.d.cts +0 -37
  34. package/dist/authoring-R4ezdnXd.d.ts +0 -37
  35. package/dist/capability-B_dkoB1K.js +0 -3041
  36. package/dist/capability-B_dkoB1K.js.map +0 -1
  37. package/dist/capability-DVx1NmTe.cjs +0 -3064
  38. package/dist/capability-DVx1NmTe.cjs.map +0 -1
  39. package/dist/contract-CgAcfAE7.d.cts +0 -34
  40. package/dist/contract-CiG2_HBq.d.ts +0 -34
  41. package/dist/contract-DtXE1hjY.js +0 -32
  42. package/dist/contract-DtXE1hjY.js.map +0 -1
  43. package/dist/contract-a4eaQWga.cjs.map +0 -1
  44. package/dist/internal.cjs +0 -8
  45. package/dist/internal.d.cts +0 -14
  46. package/dist/internal.d.ts +0 -14
  47. package/dist/internal.js +0 -5
  48. package/dist/seam-6pJeKOOJ.cjs +0 -296
  49. package/dist/seam-6pJeKOOJ.cjs.map +0 -1
  50. package/dist/seam-C4L_7rDt.js +0 -225
  51. package/dist/seam-C4L_7rDt.js.map +0 -1
  52. package/dist/tools-0NI3b9z8.cjs +0 -536
  53. package/dist/tools-0NI3b9z8.cjs.map +0 -1
  54. package/dist/tools-DBEYx3-c.js +0 -513
  55. package/dist/tools-DBEYx3-c.js.map +0 -1
  56. package/dist/types-BvB1vUKb.js +0 -20
  57. package/dist/types-BvB1vUKb.js.map +0 -1
  58. package/dist/types-D5V0TIwk.d.ts +0 -1200
  59. package/dist/types-Dlhdw2k_.cjs +0 -31
  60. package/dist/types-Dlhdw2k_.cjs.map +0 -1
  61. package/dist/types-ObcPYc3-.d.cts +0 -1200
@@ -0,0 +1,651 @@
1
+ import { createCapabilityToken, defineState } from "@embedpdf/core";
2
+ import { AnnotationTransfer } from "@embedpdf/engine-core/public";
3
+ import { ANNOTATION_FIELD_NAMES } from "@embedpdf/engine-core/runtime";
4
+ //#region src/token.ts
5
+ /** The package token — created once here; `contract.ts` re-exports it and
6
+ * `host-contract.ts` widens it to the host capability. */
7
+ const AnnotationToken = createCapabilityToken("annotation", {
8
+ hint: `add annotationPlugin() from '@embedpdf/plugin-annotation' to your plugins list`,
9
+ promises: {
10
+ refresh: true,
11
+ create: true,
12
+ createFromSelection: true,
13
+ update: true,
14
+ delete: true,
15
+ reorder: true,
16
+ export: true,
17
+ import: true,
18
+ downloadResource: true,
19
+ "links.set": true,
20
+ "links.clear": true,
21
+ "selection.update": true,
22
+ "selection.updateLink": true,
23
+ "selection.delete": true,
24
+ "selection.rotateBy": true,
25
+ "selection.resetRotation": true,
26
+ "selection.group": true,
27
+ "selection.ungroup": true,
28
+ "draft.finish": true,
29
+ "text.end": true,
30
+ "text.toggleFormat": true,
31
+ "stamps.arm": true,
32
+ "stamps.place": true,
33
+ "comments.reply": true,
34
+ "comments.setText": true,
35
+ "comments.setStatus": true,
36
+ "comments.setMarked": true,
37
+ "comments.delete": true,
38
+ "comments.deleteThread": true
39
+ }
40
+ });
41
+ //#endregion
42
+ //#region src/state.ts
43
+ /**
44
+ * The selecting page's State table as code: what `useAnnotationState()`
45
+ * returns, and the same fields in every other framework. The annotations
46
+ * themselves are not here: `useAnnotationList()` reads them, so a component
47
+ * that shows the selection doesn't re-render for every change on the page.
48
+ */
49
+ const annotationState = defineState(AnnotationToken, {
50
+ read: (annotation) => ({
51
+ status: annotation.getStatus(),
52
+ selected: annotation.selection.list(),
53
+ hovered: annotation.getHovered(),
54
+ editing: annotation.text.getEditing()
55
+ }),
56
+ empty: {
57
+ status: "loading",
58
+ selected: [],
59
+ hovered: null,
60
+ editing: null
61
+ }
62
+ });
63
+ //#endregion
64
+ //#region src/tools/definitions.ts
65
+ /**
66
+ * The tool `stamps.arm` activates — and the only tool an armed payload survives
67
+ * onto (plus the legacy `annotation-stamp` tag, honoured for embedder configs
68
+ * written before the tags were unified). Placement consults the armed payload
69
+ * before the active tool's own `source` spec, so a payload must not outlive
70
+ * its tool onto a sibling stamp preset: an `image` preset's click has to open
71
+ * its own picker, not silently place whatever the stamp panel last armed.
72
+ */
73
+ const ARMED_STAMP_TOOL_ID = "stamp";
74
+ /** How opaque a ghost paints unless its tool says. */
75
+ const GHOST_OPACITY = .5;
76
+ /** A tool's ghost setting, resolved: `true` is half see-through. */
77
+ const resolveGhost = (ghost) => ghost === true ? { opacity: GHOST_OPACITY } : ghost;
78
+ /**
79
+ * The fields no tool's defaults may set: where the annotation goes (that comes
80
+ * from the drawing), its identity and relationships, and what the engine
81
+ * stamps or keeps by itself.
82
+ */
83
+ const NOT_DEFAULTS = [
84
+ "ref",
85
+ "page",
86
+ "index",
87
+ "hasAppearance",
88
+ "appearanceState",
89
+ "nm",
90
+ "rect",
91
+ "box",
92
+ "linePoints",
93
+ "vertices",
94
+ "inkList",
95
+ "quadPoints",
96
+ "calloutLine",
97
+ "captionCenter",
98
+ "measure",
99
+ "reply",
100
+ "popup",
101
+ "parent",
102
+ "groupId",
103
+ "author",
104
+ "createdAt",
105
+ "modifiedAt",
106
+ "userId",
107
+ "createdBy",
108
+ "modifiedBy",
109
+ "importedBy",
110
+ "actions"
111
+ ];
112
+ const WIDGET_BOX_FIELDS = [
113
+ "color",
114
+ "interiorColor",
115
+ "strokeWidth",
116
+ "borderStyle"
117
+ ];
118
+ const WIDGET_TEXT_FIELDS = [
119
+ ...WIDGET_BOX_FIELDS,
120
+ "fontFamily",
121
+ "fontSize",
122
+ "fontColor",
123
+ "textAlign"
124
+ ];
125
+ /** Every field of an engine kind a tool's defaults may set: any field but the ones above. */
126
+ const draftDefaults = (subtype) => ANNOTATION_FIELD_NAMES[subtype].filter((name) => !NOT_DEFAULTS.includes(name));
127
+ /**
128
+ * The fields each known authoring kind's defaults may set: any field a create
129
+ * from the tool takes besides where it goes, flags and `contents` included.
130
+ * A key outside it stops the app at startup, naming the tool and the field.
131
+ */
132
+ const TOOL_DEFAULT_FIELDS = {
133
+ square: draftDefaults("square"),
134
+ circle: draftDefaults("circle"),
135
+ line: draftDefaults("line"),
136
+ polygon: draftDefaults("polygon"),
137
+ polyline: draftDefaults("polyline"),
138
+ ink: draftDefaults("ink"),
139
+ "free-text": draftDefaults("free-text"),
140
+ "free-text-callout": draftDefaults("free-text"),
141
+ highlight: draftDefaults("highlight"),
142
+ underline: draftDefaults("underline"),
143
+ strikeout: draftDefaults("strikeout"),
144
+ squiggly: draftDefaults("squiggly"),
145
+ caret: draftDefaults("caret"),
146
+ redact: draftDefaults("redact"),
147
+ stamp: draftDefaults("stamp"),
148
+ link: draftDefaults("link"),
149
+ text: draftDefaults("text"),
150
+ "file-attachment": draftDefaults("file-attachment"),
151
+ "widget-text": WIDGET_TEXT_FIELDS,
152
+ "widget-choice": WIDGET_TEXT_FIELDS,
153
+ "widget-button": WIDGET_TEXT_FIELDS,
154
+ "widget-toggle": WIDGET_BOX_FIELDS,
155
+ "widget-radio": WIDGET_BOX_FIELDS,
156
+ "widget-box": WIDGET_BOX_FIELDS
157
+ };
158
+ /**
159
+ * The tools whose line gesture is captured instead of created: the measurement
160
+ * plugin turns the calibrate tool's two points into a scale. A tool that
161
+ * extends one captures too.
162
+ */
163
+ const CAPTURE_TOOLS = /* @__PURE__ */ new Set(["calibrate"]);
164
+ const DRAW_TAGS = ["annotation-draw", "annotation-edit"];
165
+ /** This viewer's drawing red: shapes, lines and text boxes start in it. */
166
+ const HOUSE_RED = "#e5484d";
167
+ const MARKUP_TAGS = ["text-select", "annotation-edit"];
168
+ /**
169
+ * What one finger does while this annotation tool is active (`Tool.touch`):
170
+ * drag-create tools (shape/ink draw and text-markup select) take it as `'draw'`
171
+ * (a finger draws or marks, two fingers navigate: the drawing-app convention).
172
+ * Click-to-place tools (stamp, note) are `'tap'`: a tap places, and drags keep
173
+ * scrolling. Derived from the gesture tags, so custom registered tools inherit
174
+ * the right behavior. Only annotation-owned tools run through this: the
175
+ * built-in `pointer` tool also enables `text-select`, but the hub registers it.
176
+ */
177
+ const toolTouchOf = (enables) => enables.has("annotation-draw") || enables.has("text-select") ? "draw" : "tap";
178
+ /**
179
+ * The built-in tools, as data (shapes + lines + ink
180
+ * + free text in the draw channel, text markup + caret behind text selection, and
181
+ * the click-to-place stamp). Order is display-neutral; the toolbar owns layout.
182
+ */
183
+ const DEFAULT_TOOLS = [
184
+ {
185
+ id: "square",
186
+ subtype: "square",
187
+ cursor: "crosshair",
188
+ enables: DRAW_TAGS,
189
+ defaults: {
190
+ color: HOUSE_RED,
191
+ strokeWidth: 6
192
+ },
193
+ clickCreate: {
194
+ width: 80,
195
+ height: 60
196
+ },
197
+ upright: true
198
+ },
199
+ {
200
+ id: "circle",
201
+ subtype: "circle",
202
+ cursor: "crosshair",
203
+ enables: DRAW_TAGS,
204
+ defaults: {
205
+ color: HOUSE_RED,
206
+ strokeWidth: 6
207
+ },
208
+ clickCreate: {
209
+ width: 80,
210
+ height: 60
211
+ },
212
+ upright: true
213
+ },
214
+ {
215
+ id: "line",
216
+ subtype: "line",
217
+ cursor: "crosshair",
218
+ enables: DRAW_TAGS,
219
+ defaults: {
220
+ color: HOUSE_RED,
221
+ strokeWidth: 6
222
+ },
223
+ clickCreate: { length: 80 },
224
+ upright: true
225
+ },
226
+ {
227
+ id: "distance",
228
+ extends: "line",
229
+ clickCreate: false,
230
+ defaults: {
231
+ intent: "line-dimension",
232
+ strokeWidth: 1,
233
+ lineEndings: {
234
+ start: "closed-arrow",
235
+ end: "closed-arrow"
236
+ },
237
+ captionEnabled: true,
238
+ captionPosition: "inline",
239
+ leader: {
240
+ length: 12,
241
+ extension: 5,
242
+ offset: 0
243
+ }
244
+ }
245
+ },
246
+ {
247
+ id: "calibrate",
248
+ extends: "line",
249
+ enables: ["annotation-draw"],
250
+ defaults: { strokeWidth: 1 },
251
+ clickCreate: false
252
+ },
253
+ {
254
+ id: "polygon",
255
+ subtype: "polygon",
256
+ cursor: "crosshair",
257
+ enables: DRAW_TAGS,
258
+ defaults: {
259
+ color: HOUSE_RED,
260
+ strokeWidth: 6
261
+ }
262
+ },
263
+ {
264
+ id: "polyline",
265
+ subtype: "polyline",
266
+ cursor: "crosshair",
267
+ enables: DRAW_TAGS,
268
+ defaults: {
269
+ color: HOUSE_RED,
270
+ strokeWidth: 6
271
+ }
272
+ },
273
+ {
274
+ id: "perimeter",
275
+ extends: "polyline",
276
+ defaults: {
277
+ intent: "polyline-dimension",
278
+ strokeWidth: 1,
279
+ lineEndings: {
280
+ start: "none",
281
+ end: "none"
282
+ },
283
+ captionEnabled: true
284
+ }
285
+ },
286
+ {
287
+ id: "area",
288
+ extends: "polygon",
289
+ defaults: {
290
+ intent: "polygon-dimension",
291
+ strokeWidth: 1,
292
+ captionEnabled: true
293
+ }
294
+ },
295
+ {
296
+ id: "ink",
297
+ subtype: "ink",
298
+ cursor: "crosshair",
299
+ enables: DRAW_TAGS,
300
+ defaults: {
301
+ color: "#ef4444",
302
+ strokeWidth: 6,
303
+ blendMode: "normal"
304
+ },
305
+ ink: { groupStrokesMs: 800 }
306
+ },
307
+ {
308
+ id: "ink-highlight",
309
+ extends: "ink",
310
+ defaults: {
311
+ intent: "ink-highlight",
312
+ color: "#ffcd45",
313
+ strokeWidth: 14,
314
+ blendMode: "multiply"
315
+ },
316
+ ink: { straighten: {
317
+ deviationThreshold: .15,
318
+ axisSnapDegrees: 15
319
+ } }
320
+ },
321
+ {
322
+ id: "free-text",
323
+ subtype: "free-text",
324
+ cursor: "crosshair",
325
+ enables: DRAW_TAGS,
326
+ defaults: {
327
+ color: HOUSE_RED,
328
+ strokeWidth: 2,
329
+ fontColor: "#ef4444"
330
+ },
331
+ upright: true,
332
+ clickCreate: {
333
+ width: 180,
334
+ height: 40,
335
+ anchor: "top-left"
336
+ }
337
+ },
338
+ {
339
+ id: "free-text-callout",
340
+ subtype: "free-text-callout",
341
+ cursor: "crosshair",
342
+ enables: DRAW_TAGS,
343
+ defaults: {
344
+ color: HOUSE_RED,
345
+ strokeWidth: 6,
346
+ lineEnding: "open-arrow"
347
+ },
348
+ upright: true
349
+ },
350
+ {
351
+ id: "highlight",
352
+ subtype: "highlight",
353
+ cursor: "default",
354
+ enables: MARKUP_TAGS,
355
+ defaults: {
356
+ color: "#ffe16a",
357
+ blendMode: "multiply"
358
+ },
359
+ selection: { kind: "markup" }
360
+ },
361
+ {
362
+ id: "redact",
363
+ subtype: "redact",
364
+ cursor: "crosshair",
365
+ enables: [
366
+ "text-select",
367
+ "annotation-draw",
368
+ "annotation-edit"
369
+ ],
370
+ defaults: {
371
+ color: "#e44234",
372
+ interiorColor: "#000000",
373
+ fontSize: 14,
374
+ fontColor: "#ffffff",
375
+ opacity: 1
376
+ },
377
+ selection: { kind: "markup" }
378
+ },
379
+ {
380
+ id: "underline",
381
+ subtype: "underline",
382
+ cursor: "default",
383
+ enables: MARKUP_TAGS,
384
+ defaults: { color: "#ef4444" },
385
+ selection: { kind: "markup" }
386
+ },
387
+ {
388
+ id: "strikeout",
389
+ subtype: "strikeout",
390
+ cursor: "default",
391
+ enables: MARKUP_TAGS,
392
+ defaults: { color: "#ef4444" },
393
+ selection: { kind: "markup" }
394
+ },
395
+ {
396
+ id: "squiggly",
397
+ subtype: "squiggly",
398
+ cursor: "default",
399
+ enables: MARKUP_TAGS,
400
+ defaults: { color: "#ef4444" },
401
+ selection: { kind: "markup" }
402
+ },
403
+ {
404
+ id: "insert-text",
405
+ subtype: "caret",
406
+ fieldsKind: "caret",
407
+ preset: "caret",
408
+ cursor: "default",
409
+ enables: MARKUP_TAGS,
410
+ defaults: { color: "#ef4444" },
411
+ selection: {
412
+ kind: "text-edit",
413
+ operation: "insert"
414
+ }
415
+ },
416
+ {
417
+ id: "replace-text",
418
+ subtype: "strikeout",
419
+ fieldsKind: "strikeout",
420
+ cursor: "default",
421
+ enables: MARKUP_TAGS,
422
+ defaults: { color: "#ef4444" },
423
+ selection: {
424
+ kind: "text-edit",
425
+ operation: "replace"
426
+ }
427
+ },
428
+ {
429
+ id: ARMED_STAMP_TOOL_ID,
430
+ subtype: "stamp",
431
+ cursor: "copy",
432
+ enables: ["annotation-place", "annotation-edit"],
433
+ source: {
434
+ kind: "prompt",
435
+ accept: "image/png,image/jpeg,application/pdf"
436
+ },
437
+ upright: true,
438
+ ghost: true
439
+ },
440
+ {
441
+ id: "link",
442
+ subtype: "link",
443
+ cursor: "crosshair",
444
+ enables: DRAW_TAGS
445
+ },
446
+ {
447
+ id: "note",
448
+ subtype: "text",
449
+ cursor: "crosshair",
450
+ enables: ["annotation-place", "annotation-edit"],
451
+ defaults: {
452
+ icon: "comment",
453
+ color: "#facc15"
454
+ },
455
+ flags: {
456
+ noZoom: true,
457
+ noRotate: true
458
+ },
459
+ upright: true,
460
+ ghost: true
461
+ },
462
+ {
463
+ id: "attachment",
464
+ subtype: "file-attachment",
465
+ cursor: "crosshair",
466
+ enables: ["annotation-place", "annotation-edit"],
467
+ source: { kind: "prompt" },
468
+ defaults: {
469
+ icon: "paperclip",
470
+ color: "#facc15"
471
+ },
472
+ flags: {
473
+ noZoom: true,
474
+ noRotate: true
475
+ },
476
+ upright: true,
477
+ ghost: true
478
+ }
479
+ ];
480
+ /** Merge two tools' defaults, `right` over `left`, each value whole. */
481
+ function mergeDefaults(left, right) {
482
+ return left && right ? {
483
+ ...left,
484
+ ...right
485
+ } : right ?? left;
486
+ }
487
+ /** Overlay a same-id override onto a base definition (configure a built-in). */
488
+ function mergeDef(base, over) {
489
+ return {
490
+ ...base,
491
+ ...over,
492
+ enables: over.enables ?? base.enables,
493
+ meta: base.meta || over.meta ? {
494
+ ...base.meta,
495
+ ...over.meta
496
+ } : void 0,
497
+ defaults: mergeDefaults(base.defaults, over.defaults),
498
+ flags: base.flags || over.flags ? {
499
+ ...base.flags,
500
+ ...over.flags
501
+ } : void 0,
502
+ ink: base.ink || over.ink ? {
503
+ ...base.ink,
504
+ ...over.ink
505
+ } : void 0,
506
+ afterCreate: base.afterCreate || over.afterCreate ? {
507
+ ...base.afterCreate,
508
+ ...over.afterCreate
509
+ } : void 0
510
+ };
511
+ }
512
+ function validateDefaults(tool) {
513
+ if (!tool.defaults) return;
514
+ const allowed = TOOL_DEFAULT_FIELDS[tool.subtype];
515
+ if (!allowed) return;
516
+ const keys = new Set(allowed);
517
+ for (const key of Object.keys(tool.defaults)) if (!keys.has(key)) throw new Error(`[annotation] tool '${tool.id}' does not support default '${key}' for '${tool.subtype}'`);
518
+ }
519
+ /**
520
+ * Resolve {@link DEFAULT_TOOLS} + embedder overrides into the ready-to-use table.
521
+ * A same-id override merges over the built-in; a new id adds a tool; `extends`
522
+ * inherits from an already-defined tool. Keyed by id, so lookups are O(1).
523
+ */
524
+ function buildToolRegistry(overrides = []) {
525
+ const defs = /* @__PURE__ */ new Map();
526
+ for (const definition of DEFAULT_TOOLS) defs.set(definition.id, definition);
527
+ for (const override of overrides) {
528
+ const previous = defs.get(override.id);
529
+ defs.set(override.id, previous ? mergeDef(previous, override) : override);
530
+ }
531
+ const out = /* @__PURE__ */ new Map();
532
+ const resolving = /* @__PURE__ */ new Set();
533
+ const resolve = (id) => {
534
+ const cached = out.get(id);
535
+ if (cached) return cached;
536
+ const definition = defs.get(id);
537
+ if (!definition) throw new Error(`[annotation] tool '${id}' extends an unknown tool`);
538
+ let base;
539
+ if (definition.extends && definition.extends !== id && !resolving.has(definition.extends)) {
540
+ resolving.add(id);
541
+ base = resolve(definition.extends);
542
+ resolving.delete(id);
543
+ }
544
+ const subtype = definition.subtype ?? base?.subtype ?? definition.id;
545
+ const resolved = {
546
+ id: definition.id,
547
+ subtype,
548
+ preset: definition.preset ?? definition.id,
549
+ fieldsKind: definition.fieldsKind ?? base?.fieldsKind ?? subtype,
550
+ cursor: definition.cursor ?? base?.cursor ?? "crosshair",
551
+ enables: new Set(definition.enables ?? (base ? [...base.enables] : [])),
552
+ defaults: mergeDefaults(base?.defaults, definition.defaults),
553
+ flags: base?.flags || definition.flags ? {
554
+ ...base?.flags,
555
+ ...definition.flags
556
+ } : void 0,
557
+ source: definition.source ?? base?.source,
558
+ selection: definition.selection ?? base?.selection,
559
+ ink: base?.ink || definition.ink ? {
560
+ ...base?.ink,
561
+ ...definition.ink
562
+ } : void 0,
563
+ upright: definition.upright ?? base?.upright ?? false,
564
+ clickCreate: definition.clickCreate ?? base?.clickCreate ?? false,
565
+ ghost: resolveGhost(definition.ghost ?? base?.ghost ?? false),
566
+ afterCreate: base?.afterCreate || definition.afterCreate ? {
567
+ ...base?.afterCreate,
568
+ ...definition.afterCreate
569
+ } : void 0,
570
+ capture: CAPTURE_TOOLS.has(definition.id) || (base?.capture ?? false),
571
+ meta: base?.meta || definition.meta ? {
572
+ ...base?.meta,
573
+ ...definition.meta
574
+ } : void 0
575
+ };
576
+ validateDefaults(resolved);
577
+ out.set(id, resolved);
578
+ return resolved;
579
+ };
580
+ for (const id of defs.keys()) resolve(id);
581
+ return out;
582
+ }
583
+ //#endregion
584
+ //#region src/contract.ts
585
+ /** What the annotation settings are when the app registers none. */
586
+ const ANNOTATION_DEFAULTS = {
587
+ tools: [],
588
+ afterCreate: {
589
+ select: true,
590
+ tool: "stay",
591
+ editText: true
592
+ },
593
+ chrome: {
594
+ accent: null,
595
+ outline: {
596
+ color: null,
597
+ style: "solid",
598
+ width: 1
599
+ },
600
+ handles: {
601
+ shape: "square",
602
+ size: 8,
603
+ hitSize: 24,
604
+ fill: "#ffffff",
605
+ stroke: null
606
+ },
607
+ rotationHandle: {
608
+ enabled: true,
609
+ size: 10,
610
+ hitSize: 24,
611
+ offset: 32,
612
+ stalk: true,
613
+ fill: null,
614
+ stroke: null
615
+ },
616
+ guides: {
617
+ enabled: true,
618
+ color: "#e91e63",
619
+ rotationColor: null,
620
+ style: "solid",
621
+ width: 1.5
622
+ },
623
+ marquee: {
624
+ fill: null,
625
+ stroke: null
626
+ },
627
+ textOutline: null,
628
+ readout: {
629
+ enabled: true,
630
+ background: "rgb(0 0 0 / 0.8)",
631
+ color: "#ffffff"
632
+ }
633
+ },
634
+ snap: {
635
+ alignment: true,
636
+ alignmentThreshold: 6,
637
+ rotation: true,
638
+ rotationAngles: [
639
+ 0,
640
+ 90,
641
+ 180,
642
+ 270
643
+ ],
644
+ rotationThreshold: 4
645
+ },
646
+ editable: true
647
+ };
648
+ //#endregion
649
+ export { buildToolRegistry as a, AnnotationToken as c, DEFAULT_TOOLS as i, AnnotationTransfer as n, toolTouchOf as o, ARMED_STAMP_TOOL_ID as r, annotationState as s, ANNOTATION_DEFAULTS as t };
650
+
651
+ //# sourceMappingURL=contract-b2e_LZvu.js.map